[
  {
    "path": ".gitignore",
    "content": ".DS_Store\n"
  },
  {
    "path": "01-finatra/README.md",
    "content": "Week 1: Finatra Tutorial -- Build Beautiful REST API The Twitter Way\n-------\n\n[Finatra](https://github.com/twitter/finatra) is an open-source project by Twitter that can be used to build REST APIs in Scala programming language. Finatra builds on top of Twitter's Scala stack -- twitter-server, finagle, and twitter-util.\n\n1. [Finagle](http://twitter.github.io/finagle/): It can be used to construct high performance servers.\n2. [Twitter Server](http://twitter.github.io/twitter-server/): It defines a template from which servers at Twitter are built. It uses finagle underneath.\n3. [Twitter-Util](http://twitter.github.io/util/): A bunch of idiomatic, small, general purpose tools for Scala.\n\n<img src=\"http://twitter.github.io/finatra/images/finatra_transparent.gif\" height=\"300\" align=\"middle\">\n\nIn this step-by-step tutorial, we will cover how to build a Scala REST API using Finatra version 2. Finatra version 2 is a complete rewrite of finatra and is significantly faster(50 times according to documentation) than version 1.x.\n\n> This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)\n\n## Prerequisite\n\n1. Scala 2.11.7\n2. IntelliJ Idea Community Edition\n3. JDK 8\n\n> Code for today's demo application is on Github at [fitman](fitman)\n\n## Building an application from scratch\n\nIn this blog, we will build a simple application called **fitman**. The goal of this application is to track weight of an individual. Every week, a user enter his/her weight and a status message describing how they are feeling. This will allow them to view a timeline of their body weight.\n\n### Step 1: Create a Scala SBT project using IntelliJ Idea\n\nOpen IntelliJ Idea and select Scala > SBT project. You will see screen as shown below.\n\n<img src=\"images/step1-scala-sbt-project.png\" height=\"450\">\n\nAfter selecting, press ***Next*** button. Enter the project details and press ***Finish*** button.\n\n<img src=\"images/step1-enter-project-details.png\" height=\"450\">\n\nThis will create a Scala based SBT project that we will use.\n\n> You can use any other IDE or tool as well to scaffold a Scala SBT project.\n\n### Step 2: Adding required dependencies to build.sbt\n\nYour `build.sbt` should look like following:\n\n```scala\nname := \"fitman\"\n\nversion := \"1.0\"\n\nscalaVersion := \"2.11.7\"\n\nlazy val versions = new {\n  val finatra = \"2.1.2\"\n  val logback = \"1.1.3\"\n}\n\nresolvers ++= Seq(\n  Resolver.sonatypeRepo(\"releases\"),\n  \"Twitter Maven\" at \"https://maven.twttr.com\"\n)\n\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-http_2.11\" % versions.finatra\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-slf4j_2.11\" % versions.finatra\nlibraryDependencies += \"ch.qos.logback\" % \"logback-classic\" % versions.logback\n```\n\nOut of three dependencies mentioned above, `finatra-http_2.11` is only required. `finatra-slf4j_2.11` and `logback-classic` are added for logging purpose only.\n\n> Couple of things that disappointed me once I added above mentioned dependencies was 1) time it took to download all the dependencies 2) few transient dependencies like `twitter-metrics` are not present on Maven central so you have to add Twitter's Maven repository located at https://maven.twttr.com.\n\n\n### Step 3: Fitman says Hello\n\nA finatra app consists of an http server, a list of controllers, and zero or more filters. Let's create a simple Scala class that extends finatra's `com.twitter.finatra.http.HttpServer` as shown below.\n\n```scala\nimport com.twitter.finatra.http.HttpServer\n\nobject FitmanApp extends FitmanServer\n\nclass FitmanServer extends HttpServer\n```\n\nIn the code shown above, we created a server `FitmanServer` that extends `com.twitter.finatra.http.HttpServer`. `HttpServer` extends `TwitterServer` and adds configuration specific to an http server. `TwitterServer` is a template using which other types of servers can be created. `FitmanApp` is an object that is used to launch the server. From the documentation,\n\n> The reason for having a separate object is to allow server to be instantiated multiple times in tests without worrying about static state persisting across test runs in the same JVM.\n\nAlso, according to documentation **Finatra convention is to create a Scala object with a name ending in **Main****. I prefer to use convention where name ends with `App` so I am using that.\n\nYou can run the application just like you will run any Scala main program. In IntelliJ, right click and click **Fitman App** as shown below.\n\n![](images/step3-run-empty-fitmanapp.png)\n\nThis will launch the netty based server at port `8888`. As there is no route configured, so you will not be able to do anything useful.\n\n> If you want to use any other port that 8888 then you can use `-http.port` flag and set the it to your preferred value like -http.port=:8080\n\nLet's write our first controller -- `HelloController` in the `FitmanApp.scala` file as shown below.\n\n```scala\nimport com.twitter.finagle.http.Request\nimport com.twitter.finatra.http.routing.HttpRouter\nimport com.twitter.finatra.http.{Controller, HttpServer}\n\nobject FitmanApp extends FitmanServer\n\nclass FitmanServer extends HttpServer {\n  override protected def configureHttp(router: HttpRouter): Unit = {\n    router.add(new HelloController)\n  }\n}\n\nclass HelloController extends Controller {\n\n  get(\"/hello\") { request: Request =>\n    \"Fitman says hello\"\n  }\n\n}\n```\n\nIn the code shown above, we created `HelloController` which extends finatra `Controller` abstract class. `HelloController` is defined with one endpoint - `/hello`. When an HTTP GET request is made to `/hello` then the associated callback function will be called. The callback function has `callback: RequestType => ResponseType` signature. It accepts a `com.twitter.finagle.http.Request` and returns back a response of any type that can be converted to `com.twitter.finagle.http.Response`. The callback function in this case just returns a string.\n\nTo make server aware of the controller, we registered `HelloController` with `FitmanServer` by overriding its `configureHttp` method. The `configureHttp` exposes `HttpRouter` that is used to register an instance of `HelloController`.\n\n> You can also ask server to handle instantiation of controller by passing the type of controller to the add method instead of its instance. This becomes very useful when used along with dependency injection framework like Guice. We will discuss it later in detail.\n```scala\noverride protected def configureHttp(router: HttpRouter): Unit = {\n  router.add[HelloController]\n}\n```\n\nNow, when you make an HTTP GET request to `http://localhost:8888/hello` you will receive fitman ascii art as shown below.\n\n```\n→ curl -i http://localhost:8888/hello\nHTTP/1.1 200 OK\nContent-Length: 17\nFitman says hello\n```\n\n\n#### Admin Interface\n\nEvery Finatra by default exposes an admin interface at http://localhost:9990/admin that you can use to get system level details like CPU usage profile, heap profile, server information, and many other. To learn about all admin features refer to [Twitter Server documentation](https://twitter.github.io/twitter-server/Features.html#http-admin-interface).\n\nYou can configure admin interface to run on any other port by passing `-admin.port` flag. In IntelliJ, edit your run configuration as shown below.\n\n<img src=\"images/step3-change-admin-port.png\" height=\"450\">\n\nFrom now on Admin interface will be available at http://localhost:10000/admin.\n\n#### Overriding default server configuration\n\nThere are two ways you can override default server configuration values. One way is to use flags as discussed previously with admin and http ports.  The other way you can override default server configuration is by overriding fields in the `FitmanServer` as shown below.\n\n```scala\nclass FitmanServer extends HttpServer {\n\n  override protected def defaultFinatraHttpPort: String = \":8080\"\n  override protected def defaultTracingEnabled: Boolean = false\n  override protected def defaultHttpServerName: String = \"FitMan\"\n\n  override protected def configureHttp(router: HttpRouter): Unit = {\n    router.add(new HelloController)\n  }\n}\n```\n\n### Step 4: Let's write feature test for HelloController\n\nOne of the feature of Finatra that impressed me most was its inbuilt support for feature testing. Feature testing is a form of blackbox testing that tests a particular feature from outside.\n\nLet's add dependencies to `build.sbt` file. You can view full build.sbt [here](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/01-finatra/fitman/build.sbt).\n\n```scala\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-http_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-server_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-app_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-core_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" %% \"inject-modules\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.google.inject.extensions\" % \"guice-testlib\" % versions.guice % \"test\"\nlibraryDependencies +=  \"com.twitter.finatra\" % \"finatra-jackson_2.11\" % versions.finatra % \"test\"\n\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-http_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-server_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-app_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-core_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-modules_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.google.inject.extensions\" % \"guice-testlib\" % versions.guice % \"test\" classifier \"tests\"\nlibraryDependencies +=  \"com.twitter.finatra\" % \"finatra-jackson_2.11\" % versions.finatra % \"test\"  classifier \"tests\"\n\nlibraryDependencies += \"org.scalatest\" % \"scalatest_2.11\" % \"2.2.4\" % \"test\"\nlibraryDependencies += \"org.specs2\" %% \"specs2\" % \"2.3.12\" % \"test\"\n```\n\n\nLet's write our first feature test that will test the `/hello` endpoint. To create a feature test, you have to extend a trait called `FeatureTest`. You have to provide implementation for server definition as shown below. We created an instance of `EmbeddedHttpServer` passing it our application twitter server -- `FitmanServer`.\n\n```scala\nimport com.twitter.finagle.http.Status\nimport com.twitter.finatra.http.test.EmbeddedHttpServer\nimport com.twitter.inject.server.FeatureTest\n\nclass HelloControllerFeatureTest extends FeatureTest {\n  override val server: EmbeddedHttpServer = new EmbeddedHttpServer(\n    twitterServer = new FitmanServer)\n\n  \"Say Hello\" in {\n    server.httpGet(\n      path = \"/hello\",\n      andExpect = Status.Ok,\n      withBody = \"Fitman says hello\"\n    )\n  }\n}\n```\n\nThis test will start an embedded http server and will make an actual HTTP GET request to the `/hello` endpoint. We asserted that HTTP status code returned by our service is 200 i.e. OK and response body contains text `Fitman says hello`. If you change the body text to something other than `Fitman says hello` then test will fail with detailed message outlining the difference between texts as shown below.\n\n```\n\"Fitman says hello[]\" did not equal \"Fitman says hello[123]\"\n```\n\nThis allows you to test the externally visible features of the API.\n\n### Step 5: Let's capture weight\n\nLet's first write the feature test for our WeightResource. The feature test will test that when an HTTP POST request is made to `/weights` endpoint then weight will be stored in some database. In today's blog, we will use a mutable Map to act as a database. Later in this series, we will cover how to work with databases in Scala. We will update our blog then.\n\n```scala\nimport com.shekhargulati.fitman.FitmanServer\nimport com.twitter.finagle.http.Status\nimport com.twitter.finatra.http.test.EmbeddedHttpServer\nimport com.twitter.inject.server.FeatureTest\n\nclass WeightResourceFeatureTest extends FeatureTest {\n  override val server = new EmbeddedHttpServer(\n    twitterServer = new FitmanServer\n  )\n\n  \"WeightResource\" should {\n    \"Save user weight when POST request is made\" in {\n      server.httpPost(\n        path = \"/weights\",\n        postBody =\n          \"\"\"\n            |{\n            |\"user\":\"shekhar\",\n            |\"weight\":85,\n            |\"status\":\"Feeling great!!!\"\n            |}\n          \"\"\".stripMargin,\n        andExpect = Status.Created,\n        withLocation = \"/weights/shekhar\"\n      )\n    }\n  }\n}\n```\n\nWhen you will run the test case then this test will fail as we have not yet added functionality for WeightResource.\n\nOur data model looks like as shown below. It should have same field names as JSON.\n\n```scala\ncase class Weight(\n                   user: String,\n                   weight: Int,\n                   status: Option[String],\n                   postedAt: Instant = Instant.now()\n                 )\n```\n\nNow, let's write our WeightResource.\n\n```scala\nimport com.twitter.finatra.http.Controller\n\nimport scala.collection.mutable\n\nclass WeightResource extends Controller {\n\n  val db = mutable.Map[String, List[Weight]]()\n\n  post(\"/weights\") { weight: Weight =>\n    val weightsForUser = db.get(weight.user) match {\n      case Some(weights) => weights :+ weight\n      case None => List(weight)\n    }\n    db.put(weight.user, weightsForUser)\n    response.created.location(s\"/weights/${weight.user}\")\n  }\n\n}\n```\nUpdate FitmanServer with new Controller\n```\n    router.add(new WeightResource)\n```\n\nIn the code shown above, we did the following:\n\n1. We created a mutable Map to store weight for a user.\n2. In the `post(\"/weights\")` callback, we are directly using our case class Weight instead of using Finagle request. Finatra automatically converts the request body to the case class.\n3. In the post method callback, we first check whether the user exists in the db or not. If user exists, then we add weight to its existing weights collection else we create new List with weight.\n4. Finally, we return the response back to the user. `response.created` makes sure that HTTP status 201 is set. We also set the location header to point to a new resource.\n\n### Step 6: View user weight\n\nNow, let's write our second operation that will return all captured weights for a user. We will start with a feature test as shown below.\n\n```scala\n\"List all weights for a user when GET request is made\" in {\n  val response = server.httpPost(\n    path = \"/weights\",\n    postBody =\n      \"\"\"\n        |{\n        |\"user\":\"test_user_1\",\n        |\"weight\":80,\n        |\"posted_at\" : \"2016-01-03T14:34:06.871Z\"\n        |}\n      \"\"\".stripMargin,\n    andExpect = Status.Created\n  )\n\n  server.httpGetJson[List[Weight]](\n    path = response.location.get,\n    andExpect = Status.Ok,\n    withJsonBody =\n      \"\"\"\n        |[\n        |  {\n        |    \"user\" : \"test_user_1\",\n        |    \"weight\" : 80,\n        |    \"posted_at\" : \"2016-01-03T14:34:06.871Z\"\n        |  }\n        |]\n      \"\"\".stripMargin\n  )\n}\n```\n\nAdd the following method to `WeightResource`\n\n```scala\nget(\"/weights/:user\") { request: Request =>\n  db.getOrElse(request.params(\"user\"), List())\n}\n```\n\n### Step 7: Getting logging right\n\nIn step 2, we added `finatra-slf4j_2.11` and `logback-classic` dependencies to the classpath so that we can effectively log in our application. `finatra` uses SLF4J api for framework logging. SLF4J provides an API abstraction for various logging framework like log4j, logback, etc. Developers are free to choose their favorite logging library that works with SLF4J. finatra documentation recommends to use Logback as an SLF4J binding as it is much more superior and performant than other logging libraries.\n\nTo log in your application, you have to mixin `com.twitter.inject.Logging` trait into your application's object or class. Let's add some log statements to `WeightResource`.\n\n```scala\nimport com.twitter.finagle.http.Request\nimport com.twitter.finatra.http.Controller\nimport com.twitter.inject.Logging\nimport org.joda.time.Instant\n\nimport scala.collection.mutable\n\nclass WeightResource extends Controller with Logging {\n\n  val db = mutable.Map[String, List[Weight]]()\n\n  get(\"/weights\") { request: Request =>\n    info(\"finding all weights for all users...\")\n    db\n  }\n\n  get(\"/weights/:user\") { request: Request =>\n    info( s\"\"\"finding weight for user ${request.params(\"user\")}\"\"\")\n    db.getOrElse(request.params(\"user\"), List())\n  }\n\n  post(\"/weights\") { weight: Weight =>\n    val r = time(s\"Total time take to post weight for user '${weight.user}' is %d ms\") {\n      val weightsForUser = db.get(weight.user) match {\n        case Some(weights) => weights :+ weight\n        case None => List(weight)\n      }\n      db.put(weight.user, weightsForUser)\n      response.created.location(s\"/weights/${weight.user}\")\n    }\n    r\n  }\n\n}\n\ncase class Weight(\n                   user: String,\n                   weight: Int,\n                   status: Option[String],\n                   postedAt: Instant = Instant.now()\n                 )\n```\n\n### Step 8: Validations\n\nFinatra comes with validation annotations that can be used to add validation support. Out of the box Finatra comes with following validation annotations.\n\n1. CountryCode\n2. FutureTime\n3. Max\n4. Min\n5. NotEmpty\n6. OneOf\n7. PastTime\n8. Range\n9. Size\n10. TimeGranularity\n11. UUID\n\nAll these annotations are defined in `finatra-jackson_2.11` module so you have to add that to build.sbt\n\n```scala\nlibraryDependencies +=  \"com.twitter.finatra\" % \"finatra-jackson_2.11\" % versions.finatra\n```\n\nLet's write a test case\n\n```scala\n\"Bad request when user is not present in request\" in {\n  server.httpPost(\n    path = \"/weights\",\n    postBody =\n      \"\"\"\n        |{\n        |\"weight\":85\n        |}\n      \"\"\".stripMargin,\n    andExpect = Status.BadRequest\n  )\n}\n```\n\nIf you run the test now, it will fail with Http status code 500 i.e. Internal server error.\n\nTo make it work first we have to register a filter in the FitmanServer.\n\n```scala\nimport com.twitter.finatra.http.filters.CommonFilters\n\nclass FitmanServer extends HttpServer {\n  override protected def configureHttp(router: HttpRouter): Unit = {\n\n    router\n      .filter[CommonFilters]\n      .add[HelloController]\n      .add[WeightResource]\n  }\n}\n```\n\nNow test will pass.\n\n```scala\n\"Bad request when data not in range\" in {\n  server.httpPost(\n    path = \"/weights\",\n    postBody =\n      \"\"\"\n        |{\n        |\"user\":\"testing12345678910908980898978798797979789\",\n        |\"weight\":250\n        |}\n      \"\"\".stripMargin,\n    andExpect = Status.BadRequest,\n    withErrors = Seq(\n      \"user: size [42] is not between 1 and 25\",\n      \"weight: [250] is not between 25 and 200\"\n    )\n  )\n}\n```\n\nUpdate the `Weight` case class\n\n```scala\ncase class Weight(\n                   @Size(min = 1, max = 25) user: String,\n                   @Range(min = 25, max = 200) weight: Int,\n                   status: Option[String],\n                   postedAt: Instant = Instant.now()\n                 )\n```\n\nThat's it for this week. Please give your feedback [https://github.com/shekhargulati/52-technologies-in-2016/issues/1](https://github.com/shekhargulati/52-technologies-in-2016/issues/1)\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/01-finatra)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "01-finatra/fitman/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n### SBT template\n# Simple Build Tool\n# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control\n\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n\n"
  },
  {
    "path": "01-finatra/fitman/build.sbt",
    "content": "name := \"fitman\"\n\nversion := \"1.0\"\n\nscalaVersion := \"2.11.7\"\n\nlazy val versions = new {\n  val finatra = \"2.1.2\"\n  val logback = \"1.1.3\"\n  val guice = \"4.0\"\n}\n\nresolvers ++= Seq(\n  Resolver.sonatypeRepo(\"releases\"),\n  \"Twitter Maven\" at \"https://maven.twttr.com\"\n)\n\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-http_2.11\" % versions.finatra\nlibraryDependencies +=  \"com.twitter.finatra\" % \"finatra-jackson_2.11\" % versions.finatra\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-slf4j_2.11\" % versions.finatra\nlibraryDependencies += \"ch.qos.logback\" % \"logback-classic\" % versions.logback\n\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-http_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-server_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-app_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-core_2.11\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.twitter.inject\" %% \"inject-modules\" % versions.finatra % \"test\"\nlibraryDependencies += \"com.google.inject.extensions\" % \"guice-testlib\" % versions.guice % \"test\"\nlibraryDependencies +=  \"com.twitter.finatra\" % \"finatra-jackson_2.11\" % versions.finatra % \"test\"\n\nlibraryDependencies += \"com.twitter.finatra\" % \"finatra-http_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-server_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-app_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-core_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.twitter.inject\" % \"inject-modules_2.11\" % versions.finatra % \"test\" classifier \"tests\"\nlibraryDependencies += \"com.google.inject.extensions\" % \"guice-testlib\" % versions.guice % \"test\" classifier \"tests\"\nlibraryDependencies +=  \"com.twitter.finatra\" % \"finatra-jackson_2.11\" % versions.finatra % \"test\"  classifier \"tests\"\n\nlibraryDependencies += \"org.scalatest\" % \"scalatest_2.11\" % \"2.2.4\" % \"test\"\nlibraryDependencies += \"org.specs2\" %% \"specs2\" % \"2.3.12\" % \"test\""
  },
  {
    "path": "01-finatra/fitman/project/build.properties",
    "content": "sbt.version = 0.13.8"
  },
  {
    "path": "01-finatra/fitman/project/plugins.sbt",
    "content": "logLevel := Level.Warn"
  },
  {
    "path": "01-finatra/fitman/src/main/resources/logback.xml",
    "content": "<configuration>\n    <!-- Console Appender -->\n    <appender name=\"STDOUT\" class=\"ch.qos.logback.core.ConsoleAppender\">\n        <encoder>\n            <pattern>%date %level %-25X{traceId} %-25logger{0} %msg%n</pattern>\n        </encoder>\n    </appender>\n\n    <!-- Per Package Config -->\n    <logger name=\"com.twitter\" level=\"info\"/>\n\n    <!-- Root Logger -->\n    <root level=\"info\">\n        <appender-ref ref=\"STDOUT\"/>\n    </root>\n</configuration>"
  },
  {
    "path": "01-finatra/fitman/src/main/scala/com/shekhargulati/fitman/FitmanApp.scala",
    "content": "package com.shekhargulati.fitman\n\nimport com.shekhargulati.fitman.api.WeightResource\nimport com.twitter.finagle.http.Request\nimport com.twitter.finatra.http.filters.CommonFilters\nimport com.twitter.finatra.http.routing.HttpRouter\nimport com.twitter.finatra.http.{Controller, HttpServer}\n\nobject FitmanApp extends FitmanServer\n\nclass FitmanServer extends HttpServer {\n  override protected def configureHttp(router: HttpRouter): Unit = {\n\n    router\n      .filter[CommonFilters]\n      .add[HelloController]\n      .add[WeightResource]\n  }\n}\n\nclass HelloController extends Controller {\n\n  get(\"/hello\") { request: Request =>\n    \"Fitman says hello\"\n  }\n\n}\n\n\n\n"
  },
  {
    "path": "01-finatra/fitman/src/main/scala/com/shekhargulati/fitman/api/WeightResource.scala",
    "content": "package com.shekhargulati.fitman.api\n\nimport com.twitter.finagle.http.Request\nimport com.twitter.finatra.http.Controller\nimport com.twitter.finatra.validation.{Range, Size}\nimport com.twitter.inject.Logging\nimport org.joda.time.Instant\n\nimport scala.collection.mutable\n\nclass WeightResource extends Controller with Logging {\n\n  val db = mutable.Map[String, List[Weight]]()\n\n  get(\"/weights\") { request: Request =>\n    info(\"finding all weights for all users...\")\n    db\n  }\n\n  get(\"/weights/:user\") { request: Request =>\n    info( s\"\"\"finding weight for user ${request.params(\"user\")}\"\"\")\n    db.getOrElse(request.params(\"user\"), List())\n  }\n\n  post(\"/weights\") { weight: Weight =>\n    val r = time(s\"Total time take to post weight for user '${weight.user}' is %d ms\") {\n      val weightsForUser = db.get(weight.user) match {\n        case Some(weights) => weights :+ weight\n        case None => List(weight)\n      }\n      db.put(weight.user, weightsForUser)\n      response.created.location(s\"/weights/${weight.user}\")\n    }\n    r\n  }\n\n}\n\ncase class Weight(\n                   @Size(min = 1, max = 25) user: String,\n                   @Range(min = 25, max = 200) weight: Int,\n                   status: Option[String],\n                   postedAt: Instant = Instant.now()\n                 )\n"
  },
  {
    "path": "01-finatra/fitman/src/test/scala/com/shekhargulati/fitman/HelloControllerFeatureTest.scala",
    "content": "package com.shekhargulati.fitman\n\nimport com.twitter.finagle.http.Status\nimport com.twitter.finatra.http.test.EmbeddedHttpServer\nimport com.twitter.inject.server.FeatureTest\n\nclass HelloControllerFeatureTest extends FeatureTest {\n  override val server: EmbeddedHttpServer = new EmbeddedHttpServer(\n    twitterServer = new FitmanServer)\n\n  \"Say Hello\" in {\n    server.httpGet(\n      path = \"/hello\",\n      andExpect = Status.Ok,\n      withBody = \"Fitman says hello\"\n    )\n  }\n}\n"
  },
  {
    "path": "01-finatra/fitman/src/test/scala/com/shekhargulati/fitman/api/WeightResourceFeatureTest.scala",
    "content": "package com.shekhargulati.fitman.api\n\nimport com.shekhargulati.fitman.FitmanServer\nimport com.twitter.finagle.http.Status\nimport com.twitter.finatra.http.test.EmbeddedHttpServer\nimport com.twitter.inject.server.FeatureTest\n\nclass WeightResourceFeatureTest extends FeatureTest {\n  override val server = new EmbeddedHttpServer(\n    twitterServer = new FitmanServer\n  )\n\n  \"WeightResource\" should {\n\n    \"Save user weight when POST request is made\" in {\n      server.httpPost(\n        path = \"/weights\",\n        postBody =\n          \"\"\"\n            |{\n            |\"user\":\"shekhar\",\n            |\"weight\":85,\n            |\"status\":\"Feeling great!!!\"\n            |}\n          \"\"\".stripMargin,\n        andExpect = Status.Created,\n        withLocation = \"/weights/shekhar\"\n      )\n    }\n\n    \"List all weights for a user when GET request is made\" in {\n      val response = server.httpPost(\n        path = \"/weights\",\n        postBody =\n          \"\"\"\n            |{\n            |\"user\":\"test_user_1\",\n            |\"weight\":80,\n            |\"posted_at\" : \"2016-01-03T14:34:06.871Z\"\n            |}\n          \"\"\".stripMargin,\n        andExpect = Status.Created\n      )\n\n      server.httpGetJson[List[Weight]](\n        path = response.location.get,\n        andExpect = Status.Ok,\n        withJsonBody =\n          \"\"\"\n            |[\n            |  {\n            |    \"user\" : \"test_user_1\",\n            |    \"weight\" : 80,\n            |    \"posted_at\" : \"2016-01-03T14:34:06.871Z\"\n            |  }\n            |]\n          \"\"\".stripMargin\n      )\n    }\n\n    \"Bad request when user is not present in request\" in {\n      server.httpPost(\n        path = \"/weights\",\n        postBody =\n          \"\"\"\n            |{\n            |\"weight\":85\n            |}\n          \"\"\".stripMargin,\n        andExpect = Status.BadRequest\n      )\n    }\n\n    \"Bad request when data not in range\" in {\n      server.httpPost(\n        path = \"/weights\",\n        postBody =\n          \"\"\"\n            |{\n            |\"user\":\"testing12345678910908980898978798797979789\",\n            |\"weight\":250\n            |}\n          \"\"\".stripMargin,\n        andExpect = Status.BadRequest,\n        withErrors = Seq(\n          \"user: size [42] is not between 1 and 25\",\n          \"weight: [250] is not between 25 and 200\"\n        )\n      )\n    }\n  }\n}"
  },
  {
    "path": "02-sbt/README.md",
    "content": "SBT: The Missing Tutorial [![TimeToRead](http://ttr.myapis.xyz/ttr.svg?pageUrl=https://github.com/shekhargulati/52-technologies-in-2016/blob/master/02-sbt/README.md)](http://ttr.myapis.xyz/)\n---\n\nWelcome to the second blog of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. From last year, I have started using Scala as my main programming language. One of the tools that you have to get used to while working with a programming language is a build tool. In my office projects, we use Gradle for all our projects be it Scala or Java. In most of my personal Scala projects, I have started using `sbt` as my preferred build tool. **`sbt` is a general purpose build tool written in Scala**. Most of the time we try to hack our way while using a build tool never learning it properly. As Scala will be the language that I will cover most in this series, I decided to thoroughly learn `sbt` this week. We (developers) often underestimate the importance of learning a build tool thoroughly and end up not using build tool in the most effective way. Good working knowledge of a build tool can make us more productive so we should take it seriously.\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## Table of Contents\n\nWe will cover the following in this tutorial:\n\n* [What is sbt?](#what-is-sbt)\n* [Install sbt on your machine](#install-sbt-on-your-machine)\n* [Getting started with sbt](#getting-started-with-sbt)\n* [sbt modes](#sbt-modes)\n* [Create an sbt Scala project](#create-a-sbt-scala-project)\n  * [sbt says Hello](#sbt-says-hello)\n  * [Set Scala version](#set-scala-version)\n  * [Building Tasky application](#building-tasky-application)\n    * [Add dependencies](#add-dependencies)\n    * [Run tests](#run-tests)\n    * [Rerun tests](#rerun-tests)\n* [Writing your own tasks](#writing-your-own-tasks)\n* [Using plugins](#using-plugins)\n* [Tips](#tips)\n\n## What is sbt?\n\n`sbt` i.e. Simple Build Tool is a general purpose build tool written in Scala for JVM developers. It borrows good ideas from other successful build tools like Ant, Maven, and Gradle.\n\n1. Default project layouts\n2. Built-in tasks\n3. Plugin architecture\n4. Declarative Dependency management\n5. Code over Configuration: A DSL for build tool\n\nApart from the feature set mentioned above `sbt` also provides the following additional features:\n\n1. Interactive nature: It isn't just a build tool, it also provides an interactive environment to work in\n2. Scala REPL integration\n\n<img src=\"http://www.scala-sbt.org/assets/typesafe_sbt_svg.svg\" height=\"100\" width=\"100\" align=\"middle\">\n\n## Install sbt on your machine\n\nIf you are on mac then, you can use package manager like `brew` to install `sbt` on your machine:\n\n```bash\n$ brew install sbt\n```\n\nFor other systems, download the latest version of sbt from the [website](http://www.scala-sbt.org/download.html). Current production version is `0.13.16`. You can download by clicking [https://cocl.us/sbt01316zip](https://cocl.us/sbt01316zip).\n\nYou can refer to manual instructions from `sbt` website http://www.scala-sbt.org/0.13/tutorial/Manual-Installation.html. This blog is written using sbt version `0.13.9`.\n\nOnce you have successfully installed `sbt` on your machine, create an empty directory somewhere in your file system which we will use for this blog.\n\nTo view the basic information about `sbt`, we can use `about` task. The `sbt about` task and its output is shown below:\n\n```\n$ sbt about\n\n[info] Set current project to code (in build file:/Users/shekhargulati/blogs/sbt-playground)\n[info] This is sbt 0.13.9\n[info] The current project is {file:/Users/shekhargulati/blogs/sbt-playground}code 0.1-SNAPSHOT\n[info] The current project is built against Scala 2.10.5\n[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin\n[info] sbt, sbt plugins, and build definitions are using Scala 2.10.5\n```\n\nAs you can see in the second line of the output we are using sbt version 0.13.9.\n\n> First time you run `sbt`, it will download some jars that are required by sbt to perform its job. The default sbt installation is very minimalistic and does not come bundled with everything.\n\n## Getting started with sbt\n\n`sbt` terminology consists of two terms -- **tasks** and **settings**. A task defines an action which you want to perform like compile. A setting is used to define a value for example name and version of the project.\n\nWith `sbt` whenever you want to perform any action you execute a task. Task is the unit of currency in `sbt`. A task can depend on another task to do its job. `sbt` creates a task dependency graph to determine which task should run first. If task `t1` depends on task `t2` then task `t2` will be executed first and then task `t1` will be executed. You can view all the tasks applicable to a project by running `sbt tasks` task:\n\n```bash\n$ sbt tasks\n```\n\nThe above task will produce the following output:\n\n```\n[info] Set current project to code (in build file:/Users/shekhargulati/blogs/tasky/)\n\nThis is a list of tasks defined for the current project.\nIt does not list the scopes the tasks are defined in; use the 'inspect' task for that.\nTasks produce values.  Use the 'show' task to run the task and print the resulting value.\n\n  clean            Deletes files produced by the build, such as generated sources, compiled classes, and task caches.\n  compile          Compiles sources.\n  console          Starts the Scala interpreter with the project classes on the classpath.\n  consoleProject   Starts the Scala interpreter with the sbt and the build definition on the classpath and useful imports.\n  consoleQuick     Starts the Scala interpreter with the project dependencies on the classpath.\n  copyResources    Copies resources to the output directory.\n  doc              Generates API documentation.\n  package          Produces the main artifact, such as a binary jar.  This is typically an alias for the task that actually does the packaging.\n  packageBin       Produces a main artifact, such as a binary jar.\n  packageDoc       Produces a documentation artifact, such as a jar containing API documentation.\n  packageSrc       Produces a source artifact, such as a jar containing sources and resources.\n  publish          Publishes artifacts to a repository.\n  publishLocal     Publishes artifacts to the local Ivy repository.\n  publishM2        Publishes artifacts to the local Maven repository.\n  run              Runs a main class, passing along arguments provided on the task line.\n  runMain          Runs the main class selected by the first argument, passing the remaining arguments to the main method.\n  test             Executes all tests.\n  testOnly         Executes the tests provided as arguments or all tests if no arguments are provided.\n  testQuick        Executes the tests that either failed before, were not run or whose transitive dependencies changed, among those provided as arguments.\n  update           Resolves and optionally retrieves dependencies, producing a report.\n```\n\n> One thing that surprised me about `sbt` is that it runs all the tasks in parallel by default. If the tasks have dependencies, then `sbt` uses the task dependency graph to determine which tasks can run in parallel and which can run in a sequential manner. To make it clear, let's suppose we have three tasks `t1`, `t2`, and `t3`. `t1` and `t3` depends on `t2` then `t2` will run first and `t1` and `t3` will run in parallel.\n\n## sbt modes\n\nYou can use `sbt` in two modes -- command-line mode and interactive mode. In the command-line mode, you run `sbt` task from your machine terminal. Once the task successfully finishes then `sbt` exits. For example, when you ran `sbt about` task, it printed `sbt` and build information on the console and then `sbt` exited and you were back to your terminal. In the interactive mode, you run `sbt` command and it launches a `sbt` shell. Inside the `sbt` shell session, you run `sbt` tasks.\n\n## Create an sbt Scala project\n\nIn this tutorial, we will build a simple task management app -- `tasky`. A task management app will allow us to work with our daily to-do items. Create a new directory `tasky` at any convenient location on your filesystem. Once created, change directory to `tasky`:\n\n```bash\n$ mkdir tasky\n$ cd tasky\n```\n\n> Code for demo application is on [GitHub](./tasky)\n\nInside the `tasky` directory, create a new file -- `build.sbt` to house the build script. `build.sbt` is the name of the sbt build script. The content of `build.sbt` is shown below:\n\n```scala\nname := \"tasky\"\nversion := \"0.1.0\"\n```\n\n`:=` is a function defined in the `sbt` library. It is used to define a setting that overwrites any previous value without referring to other settings. For example, `name := \"tasky\"` will overwrite any previous value set in the `name` variable.\n\nNow, run the `sbt` command:\n\n```\n$ sbt\n[info] Set current project to tasky (in build file:/Users/shekhargulati/blogs/tasky)\n>\n```\n\nOnce you are inside the `sbt` shell, you can run various `sbt` tasks. To view all the tasks available you can use `help` task:\n\n```bash\n> help\n```\n\n```\nhelp                                    Displays this help message or prints detailed help on requested tasks (run 'help <task>').\ncompletions                             Displays a list of completions for the given argument string (run 'completions <string>').\nabout                                   Displays basic information about sbt and the build.\ntasks                                   Lists the tasks defined for the current project.\nsettings                                Lists the settings defined for the current project.\nreload                                  (Re)loads the current project or changes to plugins project or returns from it.\nprojects                                Lists the names of available projects or temporarily adds/removes extra builds to the session.\nproject                                 Displays the current project or changes to the provided `project`.\nset [every] <setting>                   Evaluates a Setting and applies it to the current project.\nsession                                 Manipulates session settings.  For details, run 'help session'.\ninspect [uses|tree|definitions] <key>   Prints the value for 'key', the defining scope, delegates, related definitions, and dependencies.\n<log-level>                             Sets the logging level to 'log-level'.  Valid levels: debug, info, warn, error\nplugins                                 Lists currently available plugins.\n; <task> (; <task>)*              Runs the provided semicolon-separated tasks.\n~ <task>                             Executes the specified task whenever source files change.\nlast                                    Displays output from a previous task or the output from a specific task.\nlast-grep                               Shows lines from the last output for 'key' that match 'pattern'.\nexport <tasks>+                         Executes tasks and displays the equivalent task lines.\nexit                                    Terminates the build.\n--<task>                             Schedules a task to run before other tasks on startup.\nshow <key>                              Displays the result of evaluating the setting or task associated with 'key'.\nall <task>+                             Executes all of the specified tasks concurrently.\n\nMore task help available using 'help <task>' for:\n  !, +, ++, <, alias, append, apply, eval, iflast, onFailure, reboot, shell\n```\n\nBy default, `sbt` follows Maven project layout i.e. Scala source files are placed inside `src/main/scala` and test source files are placed inside `src/test/scala`:\n\n```bash\n$ mkdir -p src/main/scala\n$ mkdir -p src/test/scala\n```\n\n### sbt says Hello\n\nNow, let's create a new Scala file `HelloSbt.scala` inside `src/main/scala` and place the following contents in it:\n\n```scala\nobject HelloSbt extends App {\n  println(\"Sbt says Hello!!\")\n}\n```\n\nNow you can run the code from inside the `sbt` shell by first compiling the code using `compile` task and then running it using the `run` task as shown below:\n\n```\n> compile\n[info] Compiling 1 Scala source to /Users/shekhargulati/blogs/tasky/target/scala-2.10/classes...\n[success] Total time: 2 s, completed 10 Jan, 2016 8:51:55 AM\n```\n\n```\n> run\n[info] Running HelloSbt\nSbt says Hello!!\n[success] Total time: 0 s, completed 10 Jan, 2016 8:52:15 AM\n```\n\n### Set Scala version\n\nIn the build output shown above, you can see that `sbt` chose Scala version 2.10. You can specify a different Scala version using `scalaVersion` setting. Update the `build.sbt` with the `scalaVersion` setting.\n\n```scala\nname := \"tasky\"\nversion := \"0.1.0\"\nscalaVersion := \"2.11.6\"\n```\n\n`sbt` will not pick any change in the `build.sbt` until you run the `reload` task. Execute the `reload` task to refresh the `sbt` shell with new build script:\n\n```\n> reload\n[info] Set current project to tasky (in build file:/Users/shekhargulati/blogs/tasky/)\n```\n\nNow if you compile the project using `compile` task you will see that project is compiled using scala `2.11.6` version:\n\n```\n> compile\n[info] Updating {file:/Users/shekhargulati/blogs/tasky/}tasky...\n[info] Resolving jline#jline;2.12.1 ...\n[info] Done updating.\n[info] Compiling 1 Scala sources to /Users/shekhargulati/dev/blogs/tasky/target/scala-2.11/classes...\n[info] 'compiler-interface' not yet compiled for Scala 2.11.6. Compiling...\n[info]   Compilation completed in 7.316 s\n[success] Total time: 8 s, completed 10 Jan, 2016 1:30:06 PM\n```\n\n> From the [sbt documentation](http://www.scala-sbt.org/0.13/docs/Howto-Scala.html): If the Scala version is not specified, the version sbt was built against is used. It is recommended to explicitly specify the version of Scala.  \n> Please note that because `compile` is a dependency of `run`, you don’t have to run `compile` before each `run`; just type `sbt run`.\n\n### Building Tasky application\n\nLet's create a simple data model for our task management application. Create a new file `datamodels.scala` inside the `src/main/scala`. Fill the file with the following contents.\n\n```scala\nimport java.time.LocalDate\n\ncase class Task(title: String, dueOn: LocalDate, tags: Seq[String] = Seq(), finished: Boolean = false)\n```\n\n> Please note we are using Java 8 Date-Time API. If you want to learn Java 8, then you can refer to my Java 8 tutorial  [https://github.com/shekhargulati/java8-the-missing-tutorial](https://github.com/shekhargulati/java8-the-missing-tutorial)\n\nIf you are inside the `sbt` shell, then you can compile the code using `compile` task. To experiment with your data model, you can use `sbt` in an interactive mode by executing the `console` task from within the `sbt` shell:\n\n```\n> console\n[info] Updating {file:/Users/shekhargulati/blogs/tasky/}tasky...\n[info] Resolving jline#jline;2.12.1 ...\n[info] Done updating.\n[info] Compiling 3 Scala sources to /Users/shekhargulati/blogs/tasky/target/scala-2.11/classes...\n[info] Starting scala interpreter...\n[info]\nWelcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).\nType in expressions to have them evaluated.\nType :help for more information.\n\nscala>\n```\n\nNow you can start using `Task` class. Let's create a task:\n\n```scala\nscala> import java.time.{LocalDate,Month}\nimport java.time.{LocalDate, Month}\n\nscala> val t1 = Task(\"Write blog on SBT\", LocalDate.of(2016,Month.JANUARY,10), Seq(\"blogging\"))\nt1: Task = Task(Write blog on SBT,2016-01-10,List(blogging),false)\n\nscala> val t2 = Task(\"Write a factorial program\", LocalDate.of(2016,Month.JANUARY,11), Seq(\"coding\"))\nt2: Task = Task(Write a factorial program,2016-01-11,List(coding),false)\n```\n\nWe can find all the tasks which are due today by writing the following code:\n\n```scala\nscala> val tasks = Seq(t1,t2)\ntasks: Seq[Task] = List(Task(Write blog on SBT,2016-01-10,List(blogging),false), Task(Write a factorial program,2016-01-11,List(coding),false))\n\nscala> tasks.filter(t => LocalDate.now().isEqual(t.dueOn))\nres3: Seq[Task] = List(Task(Write blog on SBT,2016-01-10,List(blogging),false))\n```\n\nThis is the kind of experiment driven development that sbt promotes. Once you have a rough idea of what you want to do then, you can start using the TDD approach to get things done.\n\nCreate a new scala file `taskmanager.scala` inside `src/main/scala` and place the following content:\n\n```scala\nobject TaskManager {\n\n  def allTasksDueToday(tasks: List[Task]): List[Task] = Nil\n\n}\n```\n\nIn the code shown above, we have created a scala object `TaskManager` which defines a single method `allTasksDueToday`. Currently, we have not written any implementation as we will first write test case for this method. Let's start with writing a test case for `allTasksDueToday` method. To write a test case, we have to choose a scala library that we can use. For this tutorial, we will use `scalatest` library.\n\n#### Add Dependencies\n\nTo add `scalatest` dependency to your Scala sbt project, add the following line to `build.sbt`. `sbt` uses Apache Ivy dependency manager to perform automatic dependency management:\n\n```scala\nlibraryDependencies += \"org.scalatest\" % \"scalatest_2.11\" % \"2.2.6\" % \"test\"\n```\n\n`sbt` exposes keys that are defined in [Keys.scala](http://www.scala-sbt.org/0.13/sxr/sbt/Keys.scala.html) to `build.sbt`. Keys are of three types: Setting Key, Task Key, and Input Key. From the [sbt documentation](http://www.scala-sbt.org/release/tutorial/Basic-Def.html),\n\n* `SettingKey[T]`: a key for a value computed once (the value is computed when loading the project, and kept around).\n\n* `TaskKey[T]`: a key for a value, called a task, that has to be recomputed each time, potentially with side effects.\n\n* `InputKey[T]`: a key for a task that has task line arguments as input.\n\nSyntax to add a library to build.sbt looks like as shown below:\n\n```\nlibraryDependencies += groupID % artifactID % version % configuration\n```\n\n`configuration` is not required for all dependencies. For `scalatest` dependency we have used `test` configuration.\n\n`libraryDependencies` is a SettingKey that stores all declared managed dependencies. This key is populated only once when a project is loaded and then it is reused. Whenever you add a dependency in `build.sbt` file then you have to call the reload task to update dependencies:\n\n```\n> reload\n[info] Set current project to tasky (in build file:/Users/shekhargulati/blogs/tasky/)\n```\n\n> `reload` will not download the dependencies that you add in the `build.sbt` file. It will only refresh the project model so when you run task next time it will download all the required dependencies.\n\n#### Run Tests\n\nLet's write a test for `TaskManager` `allTasksDueToday` method. There are various testing styles that you can use with `scalatest`. In this tutorial, I am using `FlatSpec` style. You can refer to [scalatest documentation for more information](http://www.scalatest.org/user_guide/selecting_a_style).\n\nCreate `src/test/scala/TaskManagerSpec.scala` and add the following code to it:\n\n```scala\nimport org.scalatest._\n\nclass TaskManagerSpec extends FlatSpec with Matchers {\n\n  \"An empty tasks list\" should \"have 0 tasks due today\" in {\n      val tasksDueToday = TaskManager.allTasksDueToday(List())\n      tasksDueToday should have length 0\n  }\n\n}\n```\n\nTo run the test you can execute the test task:\n\n```\n> test\n[info] Updating {file:/Users/shekhargulati/blogs/tasky/}tasky...\n[info] Resolving jline#jline;2.12.1 ...\n[info] downloading https://jcenter.bintray.com/org/scalatest/scalatest_2.11/2.2.6/scalatest_2.11-2.2.6.jar ...\n[info] \t[SUCCESSFUL ] org.scalatest#scalatest_2.11;2.2.6!scalatest_2.11.jar(bundle) (42568ms)\n[info] Done updating.\n[info] Compiling 1 Scala source to /Users/shekhargulati/blogs/tasky/target/scala-2.11/classes...\n[info] Compiling 1 Scala source to  /Users/shekhargulati/blogs/tasky/target/scala-2.11/test-classes...\n[info] TaskManagerSpec:\n[info] An empty tasks list\n[info] - should have 0 tasks due today\n[info] Run completed in 215 milliseconds.\n[info] Total number of tests run: 1\n[info] Suites: completed 1, aborted 0\n[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0\n[info] All tests passed.\n[success] Total time: 2 s, completed 10 Jan, 2016 2:15:41 PM\n```\n\n> Please note first time you run the `test` task test dependencies will be downloaded from a central repository as can be seen from the output of test task shown above.\n\n#### Rerun Tests\n\nOne of the coolest features of `sbt` is that it can rerun your tasks without manual intervention whenever any project source file changes. This is enabled using the `~` operator. If you prefix any sbt task with `~` then `sbt` will wait for changes in the source files. As soon as any file changes, it will rerun that task.\n\nType the `~test` command inside `sbt` shell:\n\n```\n> ~test\n[info] TaskManagerSpec:\n[info] An empty tasks list\n[info] - should have 0 tasks due today\n[info] Run completed in 167 milliseconds.\n[info] Total number of tests run: 1\n[info] Suites: completed 1, aborted 0\n[info] Tests: succeeded 1, failed 0, canceled 0, ignored 0, pending 0\n[info] All tests passed.\n[success] Total time: 1 s, completed 10 Jan, 2016 2:43:45 PM\n1. Waiting for source changes... (press enter to interrupt)\n```\n\nAs you can see above, `~test` ran the our `TaskManagerSpec` and then entered into watch mode. If we add any new test or change the existing test then `test` task will run again.\n\nLet's add a new test case for scenario when we have a non-empty task list.\n\n```scala\nimport org.scalatest._\nimport java.time.LocalDate\n\nclass TaskManagerSpec extends FlatSpec with Matchers {\n\n  \"An empty tasks list\" should \"have 0 tasks due today\" in {\n      val tasksDueToday = TaskManager.allTasksDueToday(List())\n      tasksDueToday should have length 0\n  }\n\n  \"A task list with one task due today\" should \"have 1 task due today\" in {\n    val t1 = Task(\"Write blog on SBT\", LocalDate.now(), Seq(\"blogging\"))\n    val t2 = Task(\"Write a factorial program\", LocalDate.now().plusDays(1), Seq(\"coding\"))\n    val tasksDueToday = TaskManager.allTasksDueToday(List(t1, t2))\n    tasksDueToday should have length 1\n  }\n\n}\n```\n\nAs soon as you save the file, `sbt` will detect file content change and rerun all the tests. The newly added test will fail as we have not yet added the actual implementation in `allTasksDueToday` method. `sbt` console output is shown below.\n\n```\n1. Waiting for source changes... (press enter to interrupt)\n[info] Compiling 1 Scala source to /Users/shekhargulati/blogs/tasky/target/scala-2.11/test-classes...\n[info] TaskManagerSpec:\n[info] An empty tasks list\n[info] - should have 0 tasks due today\n[info] A task list with one task due today\n[info] - should have 1 task due today *** FAILED ***\n[info]   List() had length 0 instead of expected length 1 (TaskManagerSpec.scala:15)\n[info] Run completed in 172 milliseconds.\n[info] Total number of tests run: 2\n[info] Suites: completed 1, aborted 0\n[info] Tests: succeeded 1, failed 1, canceled 0, ignored 0, pending 0\n[info] *** 1 TEST FAILED ***\n[error] Failed tests:\n[error] \tTaskManagerSpec\n[error] (test:test) sbt.TestsFailedException: Tests unsuccessful\n[error] Total time: 3 s, completed 10 Jan, 2016 2:50:53 PM\n2. Waiting for source changes... (press enter to interrupt)\n```\n\nLet's add the actual implementation to `allTasksDueToday` method:\n\n```scala\nimport java.time.LocalDate\n\nobject TaskManager {\n\n  def allTasksDueToday(tasks: List[Task]): List[Task] = tasks.filter(t => t.dueOn.isEqual(LocalDate.now))\n\n}\n```\n\nNow, tests will pass and you will see the following output in the sbt console:\n\n```\n2. Waiting for source changes... (press enter to interrupt)\n[info] Compiling 1 Scala source to /Users/shekhargulati/blogs/tasky/target/scala-2.11/classes...\n[info] TaskManagerSpec:\n[info] An empty tasks list\n[info] - should have 0 tasks due today\n[info] A task list with one task due today\n[info] - should have 1 task due today\n[info] Run completed in 143 milliseconds.\n[info] Total number of tests run: 2\n[info] Suites: completed 1, aborted 0\n[info] Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0\n[info] All tests passed.\n[success] Total time: 1 s, completed 10 Jan, 2016 2:55:37 PM\n3. Waiting for source changes... (press enter to interrupt)\n```\n\n## Writing your own tasks\n\n`sbt` makes it very easy to define your own tasks. Let's write a simple task that prints total number of commits on the current Git branch. Creating a custom task is a two step process:\n\n1. You have to define a `TaskKey` for your task\n2. You have to provide the task definition\n\nTo write our task we will first write `gitCommitCountTask` `taskKey` in the `build.sbt` file:\n\n```scala\nval gitCommitCountTask = taskKey[String](\"Prints commit count of the current branch\")\n```\n\nThe type specified in the taskKey i.e. String in this case becomes the type of the task result.\n\nThe task definition of the `gitCommitCountTask` is shown below. It uses `git` command-line to get the relevant information:\n\n```scala\ngitCommitCountTask := {\n  val branch = scala.sys.process.Process(\"git symbolic-ref -q HEAD\").lines.head.replace(\"refs/heads/\",\"\")\n  val commitCount = scala.sys.process.Process(s\"git rev-list --count $branch\").lines.head\n  println(s\"total number of commits on [$branch]: $commitCount\")\n  commitCount\n}\n```\n\nYou can run the `gitCommitCountTask` task as shown below. You can also execute the `gitCommitCountTask` from inside the sbt shell:\n\n```\n$ sbt gitCommitCountTask\n[info] Set current project to tasky (in build file:/Users/shekhargulati/blogs/tasky/)\ntotal number of commits on [master]: 10\n[success] Total time: 0 s, completed 10 Jan, 2016 5:16:07 PM\n```\n\nTo learn more about writing custom tasks refer to [sbt documentation](http://www.scala-sbt.org/0.13/tutorial/Custom-Settings.html).\n\n## Using plugins\n\nPlugin allows you to package your tasks so that you can distribute and reuse them easily. One of the plugins that I include in my Scala projects is Scalastyle sbt plugin. Scalastyle is a style checkers for the Scala programming language. From the [Scalastyle project website](http://www.scalastyle.org/),\n\n> Scalastyle examines your Scala code and indicates potential problems with it. If you have come across Checkstyle for Java, then you’ll have a good idea what scalastyle is. Except that it’s for Scala obviously.\n\nTo include `scalastyle-sbt-plugin` in your build, you have to add `scalastyle-sbt-plugin` inside `project/plugins.sbt` file. Create a new file `project/plugins.sbt` and add the following content in it:\n\n```scala\naddSbtPlugin(\"org.scalastyle\" %% \"scalastyle-sbt-plugin\" % \"0.8.0\")\n```\n\n> It is a naming convention to define plugins in the `plugins.sbt` file. You can name it anything else as well.\n\nOnce you have defined the plugin, you can use the plugin by executing the task it exposes. The `scalastyle-sbt-plugin` exposes `scalastyle` task. Let's check the quality of our code:\n\n```\n→ sbt scalastyle\n[info] Loading project definition from /Users/shekhargulati/blogs/tasky/project\n[info] Resolving org.fusesource.jansi#jansi;1.4 ...\n[info] downloading https://repo1.maven.org/maven2/org/scalastyle/scalastyle-sbt-plugin_2.10_0.13/0.8.0/scalastyle-sbt-plugin-0.8.0.jar ...\n[info] \t[SUCCESSFUL ] org.scalastyle#scalastyle-sbt-plugin;0.8.0!scalastyle-sbt-plugin.jar (3199ms)\n[info] downloading https://jcenter.bintray.com/org/scalastyle/scalastyle_2.10/0.8.0/scalastyle_2.10-0.8.0.jar ...\n[info] \t[SUCCESSFUL ] org.scalastyle#scalastyle_2.10;0.8.0!scalastyle_2.10.jar (20244ms)\n[info] downloading https://jcenter.bintray.com/org/scalariform/scalariform_2.10/0.1.7/scalariform_2.10-0.1.7.jar ...\n[info] \t[SUCCESSFUL ] org.scalariform#scalariform_2.10;0.1.7!scalariform_2.10.jar (46701ms)\n[info] downloading https://jcenter.bintray.com/com/typesafe/config/1.2.0/config-1.2.0.jar ...\n[info] \t[SUCCESSFUL ] com.typesafe#config;1.2.0!config.jar(bundle) (9354ms)\n[info] Done updating.\n[info] Set current project to tasky (in build file:/Users/shekhargulati/blogs/tasky/)\n[info] scalastyle using config /Users/shekhargulati/blogs/tasky/scalastyle-config.xml\njava.lang.RuntimeException: config does not exist: scalastyle-config.xml\n\tat scala.sys.package$.error(package.scala:27)\n[error] (compile:scalastyle) config does not exist: scalastyle-config.xml\n[error] Total time: 0 s, completed 10 Jan, 2016 6:01:23 PM\n```\n\nThe task will fail because plugin could not find `scalastyle-config.xml`. You can generate the configuration file using the `scalastyleGenerateConfig` task:\n\n```\n→ sbt scalastyleGenerateConfig\n[info] Loading project definition from /Users/shekhargulati/blogs/tasky/project\n[info] Set current project to tasky (in build file:/Users/shekhargulati/blogs/tasky/)\n[success] created: /Users/shekhargulati/blogs/tasky/scalastyle-config.xml\n[success] Total time: 0 s, completed 10 Jan, 2016 6:04:04 PM\n```\n\nNow, re-run the `scalastyle` task to check the quality of your project. This time task will get executed successfully.\n\nYou can learn more about Scalastyle from its website [http://www.scalastyle.org/](http://www.scalastyle.org/).\n\n## Tips\n\nThese are some of the quick tips that might help you when you use `sbt`.\n\n### Tip 1: Getting the right Scala version with %%\n\nAs mentioned before Scala remain binary compatible only between minor versions. This results in various library versions for different scala versions. Few sections back, we used scalatest library. The dependency was defined as follows:\n\n```scala\nlibraryDependencies += \"org.scalatest\" % \"scalatest_2.11\" % \"2.2.6\" % \"test\"\n```\n\nThe scala version was specified in the artifactID \"scalatest_2.11\". This means every time we update the Scala version we would have to update the dependency. We can implicitly get the Scala version using the `%%` operator:\n\n```scala\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\"\n```\n\n### Tip 2: Cross-compilation for multiple Scala versions\n\nOne thing that we all Java developers take for granted is that Java remain binary compatible between releases. This means you can run code written using JDK 1.0 on JDK 1.8. This is not true for Scala. Scala only remains binary compatible between minor versions i.e. 2.10.1 will remain binary compatible with minor version 2.10.2 but not with major version 2.11.0. Let's suppose you have a library that you want to compile using different versions of Scala. In your `build.sbt` you can .\n\n```scala\nscalaVersion := \"2.11.1\"\n\ncrossScalaVersions := Seq(\"2.9.1\", \"2.10.1\")\n```\n\nNow, when you will use sbt to build the project by default, it will build the project against the Scala version 2.11.1 but, you have an option to use other Scala versions defined in your build script.\n\n\n### Tip 3: Pass options to Scala compiler\n\nYou can pass options to `scalac` by defining a setting `scalacOptions` as shown below:\n\n```scala\nscalacOptions ++= Seq(\"-feature\", \"-language:_\", \"-unchecked\", \"-deprecation\", \"-encoding\", \"utf8\")\n```\n\n### Tip 4: View compile classpath dependencies\n\nTo view compile classpath dependencies you can run the following task from inside the sbt shell. Task and its output is shown below:\n\n```scala\n> show compile:dependencyClasspath\n\n[info] List(Attributed(/Users/shekhargulati/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.6.jar), Attributed(/Users/shekhargulati/.ivy2/cache/com.typesafe.slick/slick_2.11/bundles/slick_2.11-3.1.1.jar), Attributed(/Users/shekhargulati/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.10.jar), Attributed(/Users/shekhargulati/.ivy2/cache/com.typesafe/config/bundles/config-1.2.1.jar), Attributed(/Users/shekhargulati/.ivy2/cache/org.reactivestreams/reactive-streams/jars/reactive-streams-1.0.0.jar), Attributed(/Users/shekhargulati/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.3.jar), Attributed(/Users/shekhargulati/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-1.1.3.jar))\n```\n\nSimilarly, if you have to view test classpath then you can run `show test:dependencyClasspath` task.\n\n### Tip 5: View dependency graph\n\nIf you are Maven or Gradle user then one command that you would like to use is to view the dependency graph. sbt does not have a inbuilt command to view the dependency graph. You can view the dependency graph by using [sbt-dependency-graph plugin](https://github.com/jrudolph/sbt-dependency-graph).\n\nTo use the plugin, first add the plugin to `project/plugins.sbt`:\n\n```scala\naddSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.8.1\")\n```\n\nOnce done, reload the build configuration using the `reload` task.\n\nNow, you will be able to use tasks defined by sbt-dependency-graph plugin. You can refer to sbt-dependency-graph plugin [documentation](https://github.com/jrudolph/sbt-dependency-graph#main-tasks) to get an overview of all the defined tasks:\n\n```\n> dependencyTree\n[info] Updating {file:/Users/shekhargulati/blogs/fitman/}fitman...\n[info] Resolving jline#jline;2.12.1 ...\n[info] Done updating.\n[info] default:fitman_2.11:0.1.0 [S]\n[info]   +-ch.qos.logback:logback-classic:1.1.3\n[info]   | +-ch.qos.logback:logback-core:1.1.3\n[info]   | +-org.slf4j:slf4j-api:1.7.10\n[info]   | +-org.slf4j:slf4j-api:1.7.7 (evicted by: 1.7.10)\n[info]   |\n[info]   +-com.typesafe.slick:slick_2.11:3.1.1 [S]\n[info]     +-com.typesafe:config:1.2.1\n[info]     +-org.reactivestreams:reactive-streams:1.0.0\n[info]     +-org.slf4j:slf4j-api:1.7.10\n[info]\n[success] Total time: 0 s, completed 17 Jan, 2016 3:00:51 PM\n```\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/2](https://github.com/shekhargulati/52-technologies-in-2016/issues/2).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/02-sbt)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "02-sbt/tasky/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n### SBT template\n# Simple Build Tool\n# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control\n\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n\n"
  },
  {
    "path": "02-sbt/tasky/build.sbt",
    "content": "name := \"tasky\"\nversion := \"0.1.0\"\nscalaVersion := \"2.11.6\"\n\nlibraryDependencies += \"org.scalatest\" % \"scalatest_2.11\" % \"2.2.6\" % \"test\"\n\nval gitCommitCountTask = taskKey[String](\"Prints commit count of the current branch\")\n\ngitCommitCountTask := {\n  val branch = Process(\"git symbolic-ref -q HEAD\").lines.head.replace(\"refs/heads/\",\"\")\n  val commitCount = Process(s\"git rev-list --count $branch\").lines.head\n  println(s\"total number of commits on [$branch]: $commitCount\")\n  commitCount\n}\n"
  },
  {
    "path": "02-sbt/tasky/project/plugins.sbt",
    "content": "addSbtPlugin(\"org.scalastyle\" %% \"scalastyle-sbt-plugin\" % \"0.8.0\")\n"
  },
  {
    "path": "02-sbt/tasky/scalastyle-config.xml",
    "content": "<scalastyle>\n <name>Scalastyle standard configuration</name>\n <check level=\"warning\" class=\"org.scalastyle.file.FileTabChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.file.FileLengthChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"maxFileLength\"><![CDATA[800]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.file.HeaderMatchesChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"header\"><![CDATA[// Copyright (C) 2011-2012 the original author or authors.\n// See the LICENCE.txt file distributed with this work for additional\n// information regarding copyright ownership.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.SpacesAfterPlusChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.file.WhitespaceEndOfLineChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.SpacesBeforePlusChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.file.FileLineLengthChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"maxLineLength\"><![CDATA[160]]></parameter>\n   <parameter name=\"tabSize\"><![CDATA[4]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.ClassNamesChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"regex\"><![CDATA[[A-Z][A-Za-z]*]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.ObjectNamesChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"regex\"><![CDATA[[A-Z][A-Za-z]*]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.PackageObjectNamesChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"regex\"><![CDATA[^[a-z][A-Za-z]*$]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.EqualsHashCodeChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.IllegalImportsChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"illegalImports\"><![CDATA[sun._,java.awt._]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.ParameterNumberChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"maxParameters\"><![CDATA[8]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.MagicNumberChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"ignore\"><![CDATA[-1,0,1,2,3]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.NoWhitespaceBeforeLeftBracketChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.NoWhitespaceAfterLeftBracketChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.ReturnChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.NullChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.NoCloneChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.NoFinalizeChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.CovariantEqualsChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.StructuralTypeChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.file.RegexChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"regex\"><![CDATA[println]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.NumberOfTypesChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"maxTypes\"><![CDATA[30]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.CyclomaticComplexityChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"maximum\"><![CDATA[10]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.UppercaseLChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.SimplifyBooleanExpressionChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.IfBraceChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"singleLineAllowed\"><![CDATA[true]]></parameter>\n   <parameter name=\"doubleLineAllowed\"><![CDATA[false]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.MethodLengthChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"maxLength\"><![CDATA[50]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.MethodNamesChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"regex\"><![CDATA[^[a-z][A-Za-z0-9]*$]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.NumberOfMethodsInTypeChecker\" enabled=\"true\">\n  <parameters>\n   <parameter name=\"maxMethods\"><![CDATA[30]]></parameter>\n  </parameters>\n </check>\n <check level=\"warning\" class=\"org.scalastyle.scalariform.PublicMethodsHaveTypeChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.file.NewLineAtEofChecker\" enabled=\"true\"></check>\n <check level=\"warning\" class=\"org.scalastyle.file.NoNewLineAtEofChecker\" enabled=\"false\"></check>\n</scalastyle>"
  },
  {
    "path": "02-sbt/tasky/src/main/scala/HelloSbt.scala",
    "content": "object HelloSbt extends App {\n  println(\"Sbt says Hello!!\")\n}\n"
  },
  {
    "path": "02-sbt/tasky/src/main/scala/datamodels.scala",
    "content": "import java.time.LocalDate\n\ncase class Task(title: String, dueOn: LocalDate, tags: Seq[String] = Seq(), finished: Boolean = false)\n"
  },
  {
    "path": "02-sbt/tasky/src/main/scala/taskmanager.scala",
    "content": "import java.time.LocalDate\n\nobject TaskManager {\n\n  def allTasksDueToday(tasks: List[Task]): List[Task] = tasks.filter(t => t.dueOn.isEqual(LocalDate.now))\n\n}\n"
  },
  {
    "path": "02-sbt/tasky/src/test/scala/TaskManagerSpec.scala",
    "content": "import org.scalatest._\nimport java.time.LocalDate\n\nclass TaskManagerSpec extends FlatSpec with Matchers {\n\n  \"An empty tasks list\" should \"have 0 tasks due today\" in {\n      val tasksDueToday = TaskManager.allTasksDueToday(List())\n      tasksDueToday should have length 0\n  }\n\n  \"A task list with one task due today\" should \"have 1 task due today\" in {\n    val t1 = Task(\"Write blog on SBT\", LocalDate.now(), Seq(\"blogging\"))\n    val t2 = Task(\"Write a factorial program\", LocalDate.now().plusDays(1), Seq(\"coding\"))\n    val tasksDueToday = TaskManager.allTasksDueToday(List(t1, t2))\n    tasksDueToday should have length 1\n  }\n\n}\n"
  },
  {
    "path": "03-stanford-corenlp/README.md",
    "content": "Sentiment Analysis in Scala with Stanford CoreNLP\n-----\n\nSo far in this [series](https://github.com/shekhargulati/52-technologies-in-2016), we have looked at [finatra](../01-finatra) and [sbt](../02-sbt) open-source Scala projects. This week I decided to learn Stanford CoreNLP library for performing sentiment analysis of unstructured text in Scala.\n\nSentiment analysis or opinion mining is a field that uses natural language processing to analyze sentiments in a given text. It has applications in many domains ranging from marketing to customer service. Few years back, I wrote a simple Java application using [Naive Bayes classifier](https://en.wikipedia.org/wiki/Naive_Bayes_classifier) to determine whether people liked a movie or not based on sentiment analysis of tweets about a movie.\n\nFrom the [Stanford CoreNLP website](http://stanfordnlp.github.io/CoreNLP/),\n\n> **Stanford CoreNLP provides a set of natural language analysis tools. It can give the base forms of words, their parts of speech, whether they are names of companies, people, etc., normalize dates, times, and numeric quantities, and mark up the structure of sentences in terms of phrases and word dependencies, indicate which noun phrases refer to the same entities, indicate sentiment, extract open-class relations between mentions, etc.**\n\n<center><img src=\"https://avatars1.githubusercontent.com/u/3046006\" width=\"150\"></center>\n\n## Github repository\n\nThe code for today’s demo application is available on github: [sentiment-analyzer](./sentiment-analyzer).\n\n## Getting Started\n\nStart by creating a new directory `sentiment-analyzer` at a convenient location on your filesystem. This directory will house the source code of our application.\n\n```bash\n$ mkdir sentiment-analyzer\n```\n\nCreate a new file `build.sbt` inside the `sentiment-analyzer` directory. `build.sbt` is the sbt build script.\n> **If you are new to sbt, then [please refer to my earlier post on it](../02-sbt/README.md).**\n\nPopulate `build.sbt` with following contents.\n\n```scala\nname := \"sentiment-analyzer\"\ndescription := \"A demo application to showcase sentiment analysis using Stanford CoreNLP and Scala\"\nversion  := \"0.1.0\"\n\nscalaVersion := \"2.11.7\"\n\nlibraryDependencies += \"edu.stanford.nlp\" % \"stanford-corenlp\" % \"3.5.2\" artifacts (Artifact(\"stanford-corenlp\", \"models\"), Artifact(\"stanford-corenlp\"))\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\"\n```\n\nOne thing that you might not understand in the above mentioned build script is the usage of `artifacts`. `artifacts` is used when the dependency you have defined in your build script has published multiple artifacts. We have used `artifacts` above to tell sbt that we need to include both `stanford-corenlp` and `stanford-models` dependencies in our classpath. `stanford-corenlp` defines the core API that we will use in our code and `stanford-models` contains all the data model files that `stanford-corenlp` library uses underneath. `stanford-models` library is **378.1 MB** in size so sbt will take some time to download it.\n\nCreate a project layout for your Scala source and test files.\n\n```bash\n$ mkdir -p src/main/{scala,resources}\n$ mkdir -p src/test/scala\n```\n\n## Writing SentimentAnalyzer\n\nThe main part of the application is to analyze text for sentiments. We will write a sentiment analyzer in Scala that uses `stanford-corenlp` API.\n\nLet's start by writing a test case for positive sentiment. Create a new file `SentimentAnalyzerSpec.scala` inside `src/test/scala` directory. We are using `scalatest` to write our test cases.\n\n```scala\nimport org.scalatest.{FunSpec, Matchers}\n\nclass SentimentAnalyzerSpec extends FunSpec with Matchers {\n\n  describe(\"sentiment analyzer\") {\n\n    it(\"should return POSITIVE when input has positive emotion\") {\n      val input = \"Scala is a great general purpose language.\"\n      val sentiment = SentimentAnalyzer.mainSentiment(input)\n      sentiment should be(Sentiment.POSITIVE)\n    }\n}\n```\n\nThe test case shown above calls the `SentimentAnalyzer` API's `mainSentiment` method. If the sentiment returned by `SentimentAnalyzer` is `Sentiment.POSITIVE` then the test will pass. The `mainSentiment` method will return sentiment of the largest line of the text i.e. for input `Scala is a great general purpose language. I don't use it often.` will return `Sentiment.POSITIVE` as the longer line of the text `Scala is a great general purpose language` has positive emotion.\n\n`Sentiment` is an enum that we have defined in our application.\n\n```scala\nobject Sentiment extends Enumeration {\n  type Sentiment = Value\n  val POSITIVE, NEGATIVE, NEUTRAL = Value\n\n  def toSentiment(sentiment: Int): Sentiment = sentiment match {\n    case x if x == 0 || x == 1 => Sentiment.NEGATIVE\n    case 2 => Sentiment.NEUTRAL\n    case x if x == 3 || x == 4 => Sentiment.POSITIVE\n  }\n}\n```\n\n`Sentiment` is a Scala enum with a `toSentiment` method defined. The `toSentiment` method is used by `SentimentAnalyzer`(discussed below) to convert integer sentiment value returned by `stanford-corenlp` API to enum constant. The `stanford-corenlp` library gives sentiment of 0 or 1 when text has negative emotion, 2 when text is neutral, 3 or 4 when text has positive emotion.\n\nLet's now discuss about `SentimentAnalyzer`. Full source code of `SentimentAnalyzer` is shown below.\n\n```scala\nimport java.util.Properties\n\nimport com.shekhargulati.sentiment_analyzer.Sentiment.Sentiment\nimport edu.stanford.nlp.ling.CoreAnnotations\nimport edu.stanford.nlp.neural.rnn.RNNCoreAnnotations\nimport edu.stanford.nlp.pipeline.{Annotation, StanfordCoreNLP}\nimport edu.stanford.nlp.sentiment.SentimentCoreAnnotations\n\nimport scala.collection.convert.wrapAll._\n\nobject SentimentAnalyzer {\n\n  val props = new Properties()\n  props.setProperty(\"annotators\", \"tokenize, ssplit, parse, sentiment\")\n  val pipeline: StanfordCoreNLP = new StanfordCoreNLP(props)\n\n  def mainSentiment(input: String): Sentiment = Option(input) match {\n    case Some(text) if !text.isEmpty => extractSentiment(text)\n    case _ => throw new IllegalArgumentException(\"input can't be null or empty\")\n  }\n\n  private def extractSentiment(text: String): Sentiment = {\n    val (_, sentiment) = extractSentiments(text)\n      .maxBy { case (sentence, _) => sentence.length }\n    sentiment\n  }\n\n  def extractSentiments(text: String): List[(String, Sentiment)] = {\n    val annotation: Annotation = pipeline.process(text)\n    val sentences = annotation.get(classOf[CoreAnnotations.SentencesAnnotation])\n    sentences\n      .map(sentence => (sentence, sentence.get(classOf[SentimentCoreAnnotations.SentimentAnnotatedTree])))\n      .map { case (sentence, tree) => (sentence.toString,Sentiment.toSentiment(RNNCoreAnnotations.getPredictedClass(tree))) }\n      .toList\n  }\n\n}\n```\n\nThe code shown above does the following:\n\n1. Creates an instance of `StanfordCoreNLP`. `StanfordCoreNLP` internally constructs a pipeline that takes a text and returns various analyzed linguistic forms. The properties defines which all annotators will be used by the pipeline. For this application `tokenize, ssplit, parse, sentiment` annotators will be used.\n\n2. The `mainSentiment` method checks if string is valid and if valid it calls the `extractSentiment` with the input text.\n\n3. The `extractSentiment` method calls `maxBy` operation on a list of two value tuple returned by `extractSentiments`. The tuple contains a sentence and sentiment. The maxBy operation compares values based on sentence length i.e. a sentence with largest length will be used as main sentiment of text.\n\n4. The `extractSentiments` method uses `StanfordCoreNLP` to process the text. The `process` method processes the text by running the pipeline on the input text. We then get all the sentence annotations from the `annotation`. As we have already imported `scala.collection.convert.wrapAll._` so we can call all the usual Scala collection methods on the `sentences` list. For each sentence annotation in the sentences annotation, we create a tuple of sentence text and sentiment value. Finally, we return the transformed tuple(tuple of sentence text and sentiment) list.\n\nWe can also write test cases for negative and neutral scenarios as shown below.\n\n```scala\nit(\"should return NEGATIVE when input has negative emotion\") {\n  val input = \"Dhoni laments bowling, fielding errors in series loss\"\n  val sentiment = SentimentAnalyzer.mainSentiment(input)\n  sentiment should be(Sentiment.NEGATIVE)\n}\n\nit(\"should return NEUTRAL when input has no emotion\") {\n  val input = \"I am reading a book\"\n  val sentiment = SentimentAnalyzer.mainSentiment(input)\n  sentiment should be(Sentiment.NEUTRAL)\n}\n```\n\nWe can also write another public method that just returns all the sentences and their sentiments as shown below.\n\n```scala\ndef sentiment(input: String): List[(String, Sentiment)] = Option(input) match {\n  case Some(text) if !text.isEmpty => extractSentiments(text)\n  case _ => throw new IllegalArgumentException(\"input can't be null or empty\")\n}\n```\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to https://github.com/shekhargulati/52-technologies-in-2016/issues/5.\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/03-stanford-corenlp)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "03-stanford-corenlp/sentiment-analyzer/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n### SBT template\n# Simple Build Tool\n# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control\n\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\n.history\n.cache\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n\n"
  },
  {
    "path": "03-stanford-corenlp/sentiment-analyzer/build.sbt",
    "content": "name := \"sentiment-analyzer\"\ndescription := \"A demo application to showcase sentiment analysis using Stanford CoreNLP and Scala\"\nversion  := \"0.1.0\"\n\nscalaVersion := \"2.11.7\"\n\nlibraryDependencies += \"edu.stanford.nlp\" % \"stanford-corenlp\" % \"3.5.2\" artifacts (Artifact(\"stanford-corenlp\", \"models\"), Artifact(\"stanford-corenlp\"))\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\"\n"
  },
  {
    "path": "03-stanford-corenlp/sentiment-analyzer/project/plugins.sbt",
    "content": "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.8.1\")"
  },
  {
    "path": "03-stanford-corenlp/sentiment-analyzer/src/main/scala/com/shekhargulati/sentiment_analyzer/SentimentAnalyzer.scala",
    "content": "package com.shekhargulati.sentiment_analyzer\n\nimport java.util.Properties\n\nimport com.shekhargulati.sentiment_analyzer.Sentiment.Sentiment\nimport edu.stanford.nlp.ling.CoreAnnotations\nimport edu.stanford.nlp.neural.rnn.RNNCoreAnnotations\nimport edu.stanford.nlp.pipeline.{Annotation, StanfordCoreNLP}\nimport edu.stanford.nlp.sentiment.SentimentCoreAnnotations\n\nimport scala.collection.convert.wrapAll._\n\nobject SentimentAnalyzer {\n\n  val props = new Properties()\n  props.setProperty(\"annotators\", \"tokenize, ssplit, parse, sentiment\")\n  val pipeline: StanfordCoreNLP = new StanfordCoreNLP(props)\n\n  /**\n    * Extracts the main sentiment for a given input\n    */\n  def mainSentiment(input: String): Sentiment = Option(input) match {\n    case Some(text) if text.nonEmpty => extractSentiment(text)\n    case _ => throw new IllegalArgumentException(\"input can't be null or empty\")\n  }\n\n  /**\n    * Extracts a list of sentiments for a given input\n    */\n  def sentiment(input: String): List[(String, Sentiment)] = Option(input) match {\n    case Some(text) if text.nonEmpty => extractSentiments(text)\n    case _ => throw new IllegalArgumentException(\"input can't be null or empty\")\n  }\n\n  private def extractSentiment(text: String): Sentiment = {\n    val (_, sentiment) = extractSentiments(text)\n      .maxBy { case (sentence, _) => sentence.length }\n    sentiment\n  }\n\n  private def extractSentiments(text: String): List[(String, Sentiment)] = {\n    val annotation: Annotation = pipeline.process(text)\n    val sentences = annotation.get(classOf[CoreAnnotations.SentencesAnnotation])\n    sentences\n      .map(sentence => (sentence, sentence.get(classOf[SentimentCoreAnnotations.SentimentAnnotatedTree])))\n      .map { case (sentence, tree) => (sentence.toString, Sentiment.toSentiment(RNNCoreAnnotations.getPredictedClass(tree))) }\n      .toList\n  }\n\n}\n\nobject Sentiment extends Enumeration {\n  type Sentiment = Value\n  val POSITIVE, NEGATIVE, NEUTRAL = Value\n\n  def toSentiment(sentiment: Int): Sentiment = sentiment match {\n    case x if x == 0 || x == 1 => Sentiment.NEGATIVE\n    case 2 => Sentiment.NEUTRAL\n    case x if x == 3 || x == 4 => Sentiment.POSITIVE\n  }\n}"
  },
  {
    "path": "03-stanford-corenlp/sentiment-analyzer/src/test/scala/com/shekhargulati/sentiment_analyzer/SentimentAnalyzerSpec.scala",
    "content": "package com.shekhargulati.sentiment_analyzer\n\nimport org.scalatest.{FunSpec, Matchers}\n\nclass SentimentAnalyzerSpec extends FunSpec with Matchers {\n\n  describe(\"sentiment analyzer\") {\n\n    it(\"should return POSITIVE when input has positive emotion\") {\n      val input = \"Scala is a great general purpose language.\"\n      val sentiment = SentimentAnalyzer.mainSentiment(input)\n      sentiment should be(Sentiment.POSITIVE)\n    }\n\n    it(\"should return NEGATIVE when input has negative emotion\") {\n      val input = \"Dhoni laments bowling, fielding errors in series loss\"\n      val sentiment = SentimentAnalyzer.mainSentiment(input)\n      sentiment should be(Sentiment.NEGATIVE)\n    }\n\n    it(\"should return NEUTRAL when input has no emotion\") {\n      val input = \"I am reading a book\"\n      val sentiment = SentimentAnalyzer.mainSentiment(input)\n      sentiment should be(Sentiment.NEUTRAL)\n    }\n\n  }\n}"
  },
  {
    "path": "04-slick/README.md",
    "content": "Slick 3: Functional Relational Mapping for Mere Mortals Part 1\n----\n\nWelcome to the fourth blog of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. Today, we will get started with Slick. Slick(Scala Language-Integrated Connection Kit) is a powerful Scala library to work with relational databases. **Slick is not an ORM library**. It bases its implementation on **functional programming** and does not hide database behind an ORM layer giving you full control over when a database access should happen. It allows you to work with database just like you are working with Scala collections. Slick API is asynchronous in nature making it suitable for building reactive applications. Although Slick itself is asynchronous in nature, internally it uses JDBC which is a synchronous API. Slick is a big topic so today we will only cover the basics. I will write couple more parts to this blog.\n\nThe core idea behind Slick is that as a developer you don't have to write SQL queries. Instead, library will create SQL for you if you build the query using the constructs provided by the library.\n\n<img src=\"http://slick.typesafe.com/resources/images/slick-logo.png\">\n\nBenefits of using slick:\n\n1. Type safety and compile time checking\n2. Generate query for any database\n3. Composable\n4. Back-pressure built-in\n5. Streaming support via reactive streams\n6. You can use SQL as well\n\nFrom the [Slick docs](http://slick.typesafe.com/doc/3.1.1/introduction.html#functional-relational-mapping):\n\n> **The language integrated query model in Slick’s FRM is inspired by the LINQ project at Microsoft and leverages concepts tracing all the way back to the early work of Mnesia at Ericsson.**\n\nSlick supports most of the relational databases in the market. You can view full list [here](http://slick.typesafe.com/doc/3.1.1/supported-databases.html). You can work with all open source databases like MySQL, PostgreSQL for free. Databases like Oracle, SQL Server, and DB2 are available as closed extensions that you can use only after buying subscription.\n\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## Github repository\n\nThe code for today’s demo application is available on github: [tasky](./tasky).\n\n## Getting Started\n\nCreate a new directory `tasky` on your filesystem. Inside the `tasky` directory create a sbt build file `build.sbt` with the following contents.\n\n```scala\nname := \"tasky\"\n\ndescription := \"A simple task manager for humans\"\n\nversion := \"0.1.0\"\n\nscalaVersion := \"2.11.7\"\n\nlibraryDependencies += \"com.typesafe.slick\" %% \"slick\" % \"3.1.1\"\nlibraryDependencies += \"com.h2database\" % \"h2\" % \"1.4.191\"\nlibraryDependencies += \"ch.qos.logback\" % \"logback-classic\" % \"1.1.3\"\n\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\"\n```\n\n> **In this tutorial, we will Slick version 3.1.1**\n\nIn the `build.sbt` file shown above, we have first defined basic information about the project like name, version, and description. We have also specified that we are going to use Scala version `2.11.7`.  After that we have declared few dependencies. The only required dependency is of `Slick`. `logback` is used for logging and `scalatest` will be used for writing test cases. In this tutorial, we will use `h2` database so we have declared its dependency as well. `h2` is an in-memory SQL database implementation written in `Java`. It runs in the same process as your application and is useful for testing and getting started purposes. For real apps, you should use databases like MySQL or PostgreSQL.\n\nCreate the following directory structure inside the `tasky` directory.\n\n```bash\n$ mkdir -p src/main/scala\n$ mkdir -p src/test/scala\n```\n\nNow, we have a basic Scala SBT project setup for Slick application development.\n\nNext, import the project in your favorite IDE.\n\n## Define Database Tables\n\nTables represent mapping between Scala datatypes and database tables. Create a new package `datamodel` inside the `src/main/scala` directory.\n\nInside the `datamodel` package, create a scala object `DataModel.scala`.\n\n```scala\npackage datamodel\n\nimport slick.driver.H2Driver.api._\n\nobject DataModel {\n\n}\n```\n\nThe import `slick.driver.H2Driver.api._` is required to tell which Slick database API we will use in our application. As shown above, we are using H2 for our application.\n\nLet's create a new Scala datatype for our task management application. To keep things simple and easy to understand, we will start with only one domain object i.e. Task. `Task` case class is shown below.\n\n```scala\nimport java.time.LocalDateTime\n\nobject DataModel {\n\n  case class Task(\n                   title: String,\n                   description: String = \"\",\n                   createdAt: LocalDateTime = LocalDateTime.now(),\n                   dueBy: LocalDateTime,\n                   tags: Set[String] = Set(),\n                   id: Long = 0L)\n}\n```\n\nThe case class represent a `Task` datatype with six fields. This will map to a task table that will store a list of tasks that a user has to perform. As you can see, we have used different datatypes like String, Java 8 LocalDateTime, Set, and Long. LocalDateTime is part of Java 8 Date Time API. We have also given default values to some of these fields. This will allow us to not pass these value when we are constructing task objects. So, we can create a task by just providing `title` and `dueBy` values.\n\n> **Please refer to [my Java 8 tutorial](https://github.com/shekhargulati/java8-the-missing-tutorial/blob/master/08-date-time-api.md) if you are new to Java 8**\n\nNow let's create a table mapping for our Task case class.\n\n```scala\nobject DataModel {\n\n  case class Task(\n                   title: String,\n                   description: String = \"\",\n                   createdAt: LocalDateTime = LocalDateTime.now(),\n                   dueBy: LocalDateTime,\n                   tags: Set[String] = Set(),\n                   id: Long = 0L)\n\n  class TaskTable(tag: Tag) extends Table[Task](tag, \"tasks\") {\n    def title = column[String](\"title\")\n\n    def description = column[String](\"description\")\n\n    def createdAt = column[LocalDateTime](\"createdAt\")\n\n    def dueBy = column[LocalDateTime](\"dueBy\")\n\n    def tags = column[Set[String]](\"tags\")\n\n    def id = column[Long](\"id\", O.PrimaryKey, O.AutoInc)\n\n    override def * = (title, description, createdAt, dueBy, tags, id) <>(Task.tupled, Task.unapply)\n  }\n}\n```\n\nLet's understand the `TaksTable` class code shown above.\n\n1. Every table needs to extend `Table` abstract class. Table class needs a type parameter that tells what we will store in our table. Here, we are storing `Task` in the TaskTable. TaskTable constructors needs two mandatory fields - tag and table name. As shown above, we have used `tasks` as the name of our table. `tag` is something internal to slick that you have to pass to the `Table` constructor. This is used by slick to determine shape of a single table row. There is not much mentioned about `tag` in the slick documentation so I might not be 100% correct.\n\n2. Next, we defined definitions of each of the columns. These map one-to-one to our domain class `Task`.\n\n3. `id` is our primary key. In the column definition, we have said slick to make id an auto incrementing primary key. This will make sure database allocate id to each row in auto increment manner.\n\n4. The `*` method is the default projection of our table. You have to define this method in your `Table` class. The type of the `*` projection has to be the same as type specified in the `Table` type parameter. In our case, both have to be `Task`. The `<>` method is used to convert between a tuple `(title, description, createdAt, dueBy, tags, id)` and `Task` data type. The `<>` needs two functions - first takes a tuple and convert it to an object and second a function that converts an object to a tuple.\n\n> It is not required to use a case class you could have also used a regular Scala class as well. If you do use a regular class, then you have to provide two extra functions corresponding to `tupled` and `unapply`. The advantage that we get by using a case class is that it provides `tupled` and `unapply` methods. In the code shown below, we have created a Task object and defined two methods `toTask` and `fromTask`. These methods will serve the purpose of `tupled` and `unapply` methods.\n\n```scala\nclass Task(\n            val title: String,\n            val description: String = \"\",\n            val createdAt: LocalDateTime = LocalDateTime.now(),\n            val dueBy: LocalDateTime,\n            val tags: Set[String] = Set[String](),\n            val id: Long = 0L)\n\nobject Task {\n\n  def apply(title: String,\n            description: String = \"\",\n            createdAt: LocalDateTime = LocalDateTime.now(),\n            dueBy: LocalDateTime,\n            tags: Set[String] = Set[String](),\n            id: Long = 0L): Task = new Task(title, description, createdAt, dueBy, tags, id)\n\n  def toTask(t: (String, String, LocalDateTime, LocalDateTime, Set[String], Long)): Task = new Task(t._1, t._2, t._3, t._4, t._5, t._6)\n\n  def fromTask(task: Task): Option[(String, String, LocalDateTime, LocalDateTime, Set[String], Long)] = Some((task.title, task.description, task.createdAt, task.dueBy, task.tags, task.id))\n}\n```\n\n## Create TableQuery object\n\nOnce we have defined our table definition `TaskTable`, we have to define a value of type `TableQuery` which represents an actual database table. It provides a query DSL that you can use to interact with the table.\n\n```scala\nlazy val Tasks = TableQuery[TaskTable]\n```\n\n## Define Custom Mapping\n\nIf you try to compile the code that we have written so far it will not compile. The reason for that is slick does not support Java 8 `LocalDateTime` and `Set[String]` datatypes for column definition. However, we can write our custom mappers that will convert our types to the type `Slick` understands. Create a new object `ColumnDataMapper` in the same file `DataModel.scala` as shown below.\n\n```scala\nobject ColumnDataMapper {\n\n  implicit val localDateTimeColumnType = MappedColumnType.base[LocalDateTime, Timestamp](\n    ldt => Timestamp.valueOf(ldt),\n    t => t.toLocalDateTime\n  )\n\n  implicit val setStringColumnType = MappedColumnType.base[Set[String], String](\n    tags => tags.mkString(\",\"),\n    tagsString => tagsString.split(\",\").toSet\n  )\n\n}\n```\n\nIn the code shown above, we have defined two mapper -- a) converts between `LocalDateTime` to `java.sql.Timestamp` and vice-versa b) converts between `Set[String]` to `String` and vice-versa.\n\nNow, add the import for your custom data mappings. You have to explicitly add the custom mappers to the column definition.\n\n```scala\nimport datamodel.ColumnDataMapper.{localDateTimeColumnType, setStringColumnType}\n\nclass TaskTable(tag: Tag) extends Table[Task](tag, \"tasks\") {\n  def title = column[String](\"title\")\n\n  def description = column[String](\"description\")\n\n  def createdAt = column[LocalDateTime](\"createdAt\")(localDateTimeColumnType)\n\n  def dueBy = column[LocalDateTime](\"dueBy\")(localDateTimeColumnType)\n\n  def tags = column[Set[String]](\"tags\")(setStringColumnType)\n\n  def id = column[Long](\"id\", O.PrimaryKey, O.AutoInc)\n\n  override def * = (title, description, createdAt, dueBy, tags, id) <>(Task.tupled, Task.unapply)\n}\n```\n\nNow, code will compile successfully. You can use `sbt compile` task to compile the application.\n\n## Define Schema Create Action\n\nAction represents commands that we want to run against database. Let's write our first action that will create the database schema.\n\n```scala\nlazy val Tasks = TableQuery[TaskTable]\n\nval createTaskTableAction = Tasks.schema.create\n```\n\nThe `createTaskTableAction` action will create the schema when it is executed against database. **Defining an action does not execute it**.\n\n## Execute Schema Create Action\n\nActions are executed against a database. Slick provides a `Database` type that allows our code to interact with the database. It is a handle to a specific database. To get the handle to a database, you use the following code.\n\n```scala\nval db = Database.forConfig(\"taskydb\")\n```\n\nThe `taskydb` is a reference to a configuration object defined using typesafe config project.\n\nLet's write our first test case that will use the database object to create the schema. In the `src/test/scala`, create a new package `datamodel`. Create a new Scala class `CreateDatabaseSpec` as shown below.\n\n```scala\npackage datamodel\n\nimport org.scalatest.{FunSpec, Matchers}\n\nimport slick.driver.H2Driver.api._\n\nimport scala.concurrent._\nimport scala.concurrent.duration._\nimport scala.concurrent.ExecutionContext.Implicits.global\n\nclass CreateDatabaseSpec extends FunSpec with Matchers {\n\n  describe(\"DataModel Spec\") {\n\n    it(\"should create database\") {\n      val db = Database.forConfig(\"taskydb\")\n      val result = Await.result(db.run(DataModel.createTaskTableAction), 2 seconds)\n      println(result)\n    }\n\n  }\n}\n```\nIn the code shown above:\n\n1. The `scala.concurrent` set of imports are required to tell slick that we will use ExecutionContext defined by the import to execute slick code. We have to do this because slick API is fully asynchronous and executes database calls in a separate thread pool.\n\n2. Then we created our database object using the `taskydb` configuration.  This gives us the handle to interact with database.\n\n3. The db object has a method called `run` that executes an action and returns a `Future`. As slick is async in nature, we have wrapped the future in a `Await.result` call to make it easy to test.\n\nYou will have to create a file called `application.conf` in the `src/test/resources` directory. Populate it with content shown below.\n\n```\ntaskydb = {\n  connectionPool      = disabled\n  url                 = \"jdbc:h2:mem:taskydb\"\n  driver              = \"org.h2.Driver\"\n  keepAliveConnection = true\n}\n```\n\nWhen you will run this code, you will see in the logs that it has create a database schema.\n\n```\n18:50:34.955 [ScalaTest-run-running-CreateDatabaseSpec] DEBUG s.backend.DatabaseComponent.action - #1: schema.create [create table \"tasks\" (\"title\" VARCHAR NOT NULL,\"description\" VARCHAR NOT NULL,\"createdAt\" TIMESTAMP NOT NULL,\"dueBy\" TIMESTAMP NOT NULL,\"tags\" VARCHAR NOT NULL,\"id\" BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY)]\n\n18:50:35.012 [taskydb-1] DEBUG slick.jdbc.JdbcBackend.statement - Preparing statement: create table \"tasks\" (\"title\" VARCHAR NOT NULL,\"description\" VARCHAR NOT NULL,\"createdAt\" TIMESTAMP NOT NULL,\"dueBy\" TIMESTAMP NOT NULL,\"tags\" VARCHAR NOT NULL,\"id\" BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY)\n18:50:35.268 [taskydb-1] DEBUG slick.jdbc.JdbcBackend.benchmark - Execution of prepared statement took 23ms\n```\n\nOn every run of our test case, we will create a new database.\n\n## Insert tasks into Task table\n\nLet's now write a test case that will insert some records into the `Task` table.\n\n```scala\nit(\"should insert single task into database\") {\n  val db = Database.forConfig(\"taskydb\")\n  val result = Await.result(db.run(DataModel.insertTaskAction(Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1)))), 2 seconds)\n  result should be(Some(1))\n}\n```\n\nThe test case shown above calls the `insertTaskAction` passing it a `Task`. The result of `insertTaskAction` is the number of rows affected by the action. As we are only passing one task so we should expect one as result.\n\nNow, let's look at the `insertTaskAction` definition in the `DataModel` object.\n\n```\ndef insertTaskAction(tasks: Task*) = Tasks ++= tasks.toSeq\n```\n\nThe insertTaskAction takes a `varargs` of tasks allowing user to pass one or more tasks. To insert tasks, we used `++=` method.  According to [slick documentation](http://slick.typesafe.com/doc/3.0.0/queries.html#inserting),\n\n> **`++=` gives you an accumulated count in an Option (which can be None if the database system does not provide counts for all rows)**\n\n\n## Query table\n\nLet's query the database to select all the tasks in the database.\n\n```scala\nit(\"should list all tasks in the database\") {\n  val tasks = Seq(\n    Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1)),\n    Task(title = \"Write blog on Slick\", dueBy = LocalDateTime.now().plusDays(2)),\n    Task(title = \"Build a simple application using Slick\", dueBy = LocalDateTime.now().plusDays(3))\n  )\n  Await.result(db.run(DataModel.insertTaskAction(tasks: _*)), 2 seconds)\n  val result = Await.result(db.run(DataModel.listTasksAction), 2 seconds)\n  result should have length 3\n}\n```\n\nThe test case shown above queries the database using `listTasksAction` shown below.\n\n```scala\nval listTasksAction = Tasks.result\n```\n\nThe `listTasksAction` makes a `select \"title\", \"description\", \"createdAt\", \"dueBy\", \"tags\", \"id\" from \"tasks\"` sql query using the default `*` projection.\n\n\n## Conclusion\n\nSlick is a powerful library to interact with relational databases. Today, we have just scratched the surface of this feature rich library. You leant how to define table definition, insert data, perform `select *` query. I will write couple more blogs on Slick to cover it in more details. So stay tuned!\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/6](https://github.com/shekhargulati/52-technologies-in-2016/issues/6).\n\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/04-slick)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "04-slick/tasky/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### SBT template\n# Simple Build Tool\n# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control\n\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\n.history\n.cache\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n\n"
  },
  {
    "path": "04-slick/tasky/build.sbt",
    "content": "name := \"tasky\"\n\ndescription := \"A simple task manager for humans\"\n\nversion := \"0.1.0\"\n\nscalaVersion := \"2.11.7\"\n\nlibraryDependencies += \"com.typesafe.slick\" %% \"slick\" % \"3.1.1\"\nlibraryDependencies += \"com.h2database\" % \"h2\" % \"1.4.191\"\nlibraryDependencies += \"ch.qos.logback\" % \"logback-classic\" % \"1.1.3\"\n\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\""
  },
  {
    "path": "04-slick/tasky/project/plugins.sbt",
    "content": "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.8.1\")"
  },
  {
    "path": "04-slick/tasky/src/main/scala/datamodel/DataModel.scala",
    "content": "package datamodel\n\nimport java.sql.Timestamp\nimport java.time.LocalDateTime\n\nimport datamodel.ColumnDataMapper._\nimport slick.driver.H2Driver.api._\n\n\nobject DataModel {\n\n  case class Task(\n                   title: String,\n                   description: String = \"\",\n                   createdAt: LocalDateTime = LocalDateTime.now(),\n                   dueBy: LocalDateTime,\n                   tags: Set[String] = Set[String](),\n                   id: Long = 0L)\n\n  class TaskTable(tag: Tag) extends Table[Task](tag, \"tasks\") {\n    def title = column[String](\"title\")\n\n    def description = column[String](\"description\")\n\n    def createdAt = column[LocalDateTime](\"createdAt\")(localDateTimeColumnType)\n\n    def dueBy = column[LocalDateTime](\"dueBy\")(localDateTimeColumnType)\n\n    def tags = column[Set[String]](\"tags\")(setStringColumnType)\n\n    def id = column[Long](\"id\", O.PrimaryKey, O.AutoInc)\n\n    override def * = (title, description, createdAt, dueBy, tags, id) <>(Task.tupled, Task.unapply)\n  }\n\n  lazy val Tasks = TableQuery[TaskTable]\n\n  val createTaskTableAction = Tasks.schema.create\n\n  def insertTaskAction(tasks: Task*) = Tasks ++= tasks.toSeq\n\n  val listTasksAction = Tasks.result\n}\n\nobject ColumnDataMapper {\n\n  implicit val localDateTimeColumnType = MappedColumnType.base[LocalDateTime, Timestamp](\n    ldt => Timestamp.valueOf(ldt),\n    t => t.toLocalDateTime\n  )\n\n  implicit val setStringColumnType = MappedColumnType.base[Set[String], String](\n    tags => tags.mkString(\",\"),\n    tagsString => tagsString.split(\",\").toSet\n  )\n\n}\n"
  },
  {
    "path": "04-slick/tasky/src/test/resources/application.conf",
    "content": "taskydb = {\n  connectionPool      = disabled\n  url                 = \"jdbc:h2:mem:taskydb\"\n  driver              = \"org.h2.Driver\"\n  keepAliveConnection = true\n}"
  },
  {
    "path": "04-slick/tasky/src/test/scala/datamodel/DataModelSpec.scala",
    "content": "package datamodel\n\nimport java.time.LocalDateTime\n\nimport datamodel.DataModel.Task\nimport org.scalatest.{BeforeAndAfterEach, FunSpec, Matchers}\nimport slick.driver.H2Driver.api._\n\nimport scala.concurrent._\nimport scala.concurrent.duration._\n\nclass DataModelSpec extends FunSpec with Matchers with BeforeAndAfterEach {\n\n  var db: Database = _\n\n  override protected def beforeEach(): Unit = {\n    db = Database.forConfig(\"taskydb\")\n    Await.result(db.run(DataModel.createTaskTableAction), 2 seconds)\n  }\n\n  override protected def afterEach(): Unit = Await.result(db.shutdown, 2 seconds)\n\n  describe(\"DataModel Spec\") {\n\n    it(\"should insert single task into database\") {\n      val result = Await.result(db.run(DataModel.insertTaskAction(Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1)))), 2 seconds)\n      result should be(Some(1))\n    }\n\n    it(\"should insert multiple tasks into database\") {\n      val tasks = Seq(\n        Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1)),\n        Task(title = \"Write blog on Slick\", dueBy = LocalDateTime.now().plusDays(2)),\n        Task(title = \"Build a simple application using Slick\", dueBy = LocalDateTime.now().plusDays(3))\n      )\n      val result = Await.result(db.run(DataModel.insertTaskAction(tasks: _*)), 2 seconds)\n      result should be(Some(3))\n    }\n\n    it(\"should list all tasks in the database\") {\n      val tasks = Seq(\n        Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1)),\n        Task(title = \"Write blog on Slick\", dueBy = LocalDateTime.now().plusDays(2)),\n        Task(title = \"Build a simple application using Slick\", dueBy = LocalDateTime.now().plusDays(3))\n      )\n      Await.result(db.run(DataModel.insertTaskAction(tasks: _*)), 2 seconds)\n      val result = Await.result(db.run(DataModel.listTasksAction), 2 seconds)\n      result should have length 3\n    }\n\n  }\n\n\n}\n"
  },
  {
    "path": "05-slick/README.md",
    "content": "Slick 3: Functional Relational Mapping for Mere Mortals Part 2: Querying data\n----\n\nLast week we learnt the [basics of Slick](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/04-slick) library. We started with a general introduction of Slick, then covered how to define a table definition, custom mappers, and perform insert queries. Today, we will learn how to perform `select` queries with Slick. Slick allows you to work with database tables in the same way as you work with Scala collections. This means that you can use methods like `map`, `filter`, `sort`, etc. to process data in your table.\n\n> **In case you are new to Slick, please first read [part 1 of Slick tutorial](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/04-slick). This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## Github repository\n\nThe code for today’s demo application is available on github: [tasky](./tasky).\n\n## Let's (again) look at the data model\n\nBefore we start with querying data, let's again look at the data model. I have added one more field to the `TaskTable`. The field that we have added is an enum to store priority of the task. Enums are useful when a variable can have one of the small set of possible values. In our example application, `Priority` is an enum that can be either `HIGH`, `LOW`, or `MEDIUM`. To create a new enum, create an object that extends `scala.Enumeration` as shown below. We have created `Priority` enum in a new file `Priority.scala` inside the `datamodel` package.\n\n```scala\npackage datamodel\n\nobject Priority extends Enumeration {\n  type Priority = Value\n  val HIGH = Value(3)\n  val MEDIUM = Value(2)\n  val LOW = Value(1)\n}\n```\n\nAs you can see above, we have provided int values to each enum constant.\n\nAfter creating our new enum, we have to add its declaration in our `Task` case class as well as `TaskTable`.\n\n```scala\nimport datamodel.columnDataMappers._\ncase class Task(\n                 title: String,\n                 description: String = \"\",\n                 createdAt: LocalDateTime = LocalDateTime.now(),\n                 dueBy: LocalDateTime,\n                 tags: Set[String] = Set[String](),\n                 priority: Priority = Priority.LOW,\n                 id: Long = 0L)\n\n\nclass TaskTable(tag: Tag) extends Table[Task](tag, \"tasks\") {\n  def title = column[String](\"title\")\n\n  def description = column[String](\"description\")\n\n  def createdAt = column[LocalDateTime](\"createdAt\")\n\n  def dueBy = column[LocalDateTime](\"dueBy\")\n\n  def tags = column[Set[String]](\"tags\")\n\n  def priority = column[Priority](\"priority\")\n\n  def id = column[Long](\"id\", O.PrimaryKey, O.AutoInc)\n\n  override def * = (title, description, createdAt, dueBy, tags, priority, id) <>(Task.tupled, Task.unapply)\n}\n```\n\nIf we try to compile code now, it will not compile. We have to add column mapping to convert between `Priority` enum to `Int`. This is shown below.\n\n```scala\nimplicit val priorityMapper = MappedColumnType.base[Priority, Int](\n  p => p.id,\n  v => Priority(v)\n)\n```\n\nCompile and run the test cases using `sbt test` and everything should work fine.\n\n## Select all the tasks in the database\n\nLet's start with the simplest select query i.e. `select * from tasks`. We want to list all the tasks in our database. As discussed last week, we have to create an instance of `TableQuery` that will give us the handle to Slick Query DSL API. We already have instance of `TableQuery` created inside the `dataModels.scala`.\n\n```scala\nlazy val Tasks = TableQuery[TaskTable]\n```\n\nCreate a new Scala object `queries` inside the `queries` package. This object will house all the queries.\n\n```scala\npackage queries\n\nimport datamodel.columnDataMappers._\nimport datamodel.dataModel.Tasks\nimport slick.driver.H2Driver.api._\n\nobject queries {\n\n}\n```\n\nAs shown above, we have created a new Scala object `queries` and added the required imports.\n\n1. `import datamodel.columnDataMappers._` is required so that Slick knows how to handle our custom data types like `LocalDateTime`, `Set[String]`, and `Priority`.\n\n2. `import datamodel.dataModel.Tasks` is required so that we can work with the `Tasks` `TableQuery` object.\n\n3. `import slick.driver.H2Driver.api._` is required to tell which Slick database API we will use in our application.\n\nBefore we will write query for listing all the tasks in the database let's write a test case. Create a new test specification `QueriesSpec` and populate it with following contents.\n\n```scala\npackage queries\n\nimport java.time.LocalDateTime\n\nimport datamodel.dataModel.Task\nimport datamodel.{Priority, dataModel}\nimport org.scalatest.{BeforeAndAfterAll, FunSpec, Matchers}\nimport queries._\nimport slick.driver.H2Driver.api._\n\nimport scala.concurrent._\nimport scala.concurrent.duration._\n\nclass QueriesSpec extends FunSpec with Matchers with BeforeAndAfterAll {\n\n  var db: Database = _\n  var t1: Task = _\n  var t2: Task = _\n  var t3: Task = _\n  var t4: Task = _\n  var t5: Task = _\n  var t6: Task = _\n  var t7: Task = _\n\n  override protected def beforeAll(): Unit = {\n    db = Database.forConfig(\"taskydb\")\n    Await.result(db.run(dataModel.createTaskTableAction), 2 seconds)\n    t1 = Task(title = \"Write part 1 blog on Slick\", dueBy = LocalDateTime.now().minusDays(7), tags = Set(\"blogging\", \"scala\", \"slick\"), priority = Priority.HIGH)\n    t2 = Task(title = \"Give a Java 8 training\", dueBy = LocalDateTime.now().minusDays(3), tags = Set(\"java\", \"training\", \"travel\"), priority = Priority.LOW)\n    t3 = Task(title = \"Write part 2 blog on Slick queries\", dueBy = LocalDateTime.now(), tags = Set(\"blogging\", \"scala\", \"slick\"), priority = Priority.HIGH)\n    t4 = Task(title = \"Read Good to Great book\", dueBy = LocalDateTime.now().plusDays(15), tags = Set(\"reading\", \"books\", \"startup\"), priority = Priority.MEDIUM)\n    t5 = Task(title = \"Read Programming Scala book\", dueBy = LocalDateTime.now().plusDays(30), tags = Set(\"reading\", \"books\", \"scala\"), priority = Priority.HIGH)\n    t6 = Task(title = \"Go to Goa for holiday\", dueBy = LocalDateTime.now().plusDays(60), tags = Set(\"travel\"), priority = Priority.LOW)\n    t7 = Task(title = \"Build my dream application using Play framework and Slick\", dueBy = LocalDateTime.now().plusMonths(3), tags = Set(\"application\", \"play\", \"startup\"), priority = Priority.HIGH)\n    val tasks = Seq(t1, t2, t3, t4, t5, t6, t7)\n    performAction(dataModel.insertTaskAction(tasks: _*))\n  }\n\n  private def performAction[T](action: DBIO[T]): T = {\n    Await.result(db.run(action), 2 seconds)\n  }\n}\n```\n\nIn the code shown above, we have done the following:\n\n1. We imported all the required classes and traits that are required by our test case.\n\n2. We provided implementation of `beforeAll` method. This allows us to perform one time setup for this test case. We inserted seven tasks in the database using the `insertTaskAction` we discussed last week. In the task list shown above, there are two tasks that were due in past and 5 tasks which are due in future.\n\n3. `performAction` is a method that will help us avoid writing boilerplate code of wrapping the future in an `Await`. We will just pass an action to `performAction` and it will take care of the rest. We will use this method in all our test cases.\n\nNow, that we have setup our test data. We can write our first test case that will select all the tasks in the `tasks` table.\n\n```scala\nimport queries._\n\nit(\"should select all the tasks stored in the database\") {\n  val tasks = performAction(selectAllTasksQuery.result)\n  tasks should have length 7\n  tasks.head should have(\n    'title (t1.title),\n    'description (t1.description),\n    'createdAt (t1.createdAt),\n    'dueBy (t1.dueBy),\n    'tags (t1.tags)\n  )\n}\n```\n\nIn the code shown above, only thing that is of interest to us is the `selectAllTasksQuery`. This is imported from the `queries` object. `performAction` method discussed above needs an action. You can convert a query to an action by calling the `result` method on it. If you try to run the test case now, it will not work as we have not yet defined `selectAllTasksQuery`.\n\nIn the `queries` object, define `selectAllTasksQuery` as shown below.\n\n```scala\nobject queries {\n  val selectAllTasksQuery: Query[TaskTable, Task, Seq] = Tasks\n}\n```\n\nLet's try to decipher one line of code that we have written above. In the code shown above, we have a defined a value `selectAllTasksQuery` that returns `Tasks` object. `Tasks` is an instance of `TableQuery` object we defined in `dataModels.scala`. `Tasks` i.e. `TableQuery` object is the gateway to the Slick query DSL API. When you return `Tasks` object then Slick uses the default `*` projection that we defined in the `TaskTable`.\n\nThe other interesting bit is the type of `selectAllTasksQuery`. You are not required to define the type here as Scala can infer the type. By understanding the type `Query[TaskTable, Task, Seq]`, you will understand how Slick determine what value should be returned by the query. `Query` takes three type parameters. The first type parameter is called the packed type i.e. the type of values you work against in the query DSL. The second type is called the unpacked type i.e. the type of values you get back when you run the query. The third type is the container type that collects the result.\n\nRun the test case and it should pass.  You can look at the logs to confirm that Slick executed `select *` query.\n\n```sql\nselect \"title\", \"description\", \"createdAt\", \"dueBy\", \"tags\", \"priority\", \"id\" from \"tasks\"\n```\n\n## Select all task titles\n\nThe first query that we saw above fetches all the columns of `tasks` table. Most of the time we only want to select few columns. Let's write our test case for this use case.\n\n```scala\nit(\"should select all task titles\") {\n  val taskTitles = performAction(selectAllTaskTitleQuery.result)\n  taskTitles should have length 7\n  taskTitles should be(List(t1.title, t2.title, t3.title, t4.title, t5.title, t6.title, t7.title))\n}\n```\n\nAs you can see above, we are executing `selectAllTaskTitleQuery`. This query is defined in `queries` object as shown below.\n\n```scala\nval selectAllTaskTitleQuery: Query[Rep[String], String, Seq] = Tasks.map(taskTable => taskTable.title)\n```\n\nIn the code shown above, we have used map function on the `Tasks` table query object. `map` is a transformation function that take a lambda. The lambda function tells Slick that we only want to select title column. One thing to note here is that in the `map` function we are working on the `TaskTable` object. As `map` function only returns title so the type of `selectAllTaskTitleQuery` is `Query[Rep[String], String, Seq]`.\n\nYou can also use the shorthand `_` in the lambda as shown below.\n\n```scala\nval selectAllTaskTitleQuery: Query[Rep[String], String, Seq] = Tasks.map(_.title)\n```\n\nYou can also select more than one columns in the map function as shown below.\n\n```scala\nval selectMultipleColumnsQuery: Query[(Rep[String], Rep[Priority], Rep[LocalDateTime]), (String, Priority, LocalDateTime), Seq] = Tasks.map(t => (t.title, t.priority, t.createdAt))\n```\n\nThe query executed by Slick can be seen in the logs.\n\n```sql\nselect \"title\", \"priority\", \"createdAt\" from \"tasks\"\n```\n\n## Select all the high priority task titles\n\nSo far we have selected all the data in our tasks table. There are times when we have to filter data as we have to do it this usecase. We have filter out all the high priority tasks and then select only title field. Let's write the test case first.\n\n```scala\nit(\"should select all the high priority task titles\"){\n  val highPriorityTasks = performAction(selectHighPriorityTasksQuery.result)\n  highPriorityTasks should have length 4\n  highPriorityTasks should be(List(t1.title, t3.title, t5.title, t7.title))\n}\n```\n\nIn the dataset that we created in `beforeAll` method, we have four high priority tasks.\n\nThe `selectHighPriorityTasksQuery` will use the `filter` and the `map` operation to get the job done. `filter` allows us to specify the `where` clauses.\n\n```scala\nval selectHighPriorityTasksQuery: Query[Rep[String], String, Seq] = Tasks.filter(_.priority === Priority.HIGH).map(_.title)\n```\n\nIn the code shown above, we first filtered out all the high priority tasks and then selected only title column.\n\nYou can view the SQL query generated by Slick in the logs.\n\n```sql\nselect \"title\" from \"tasks\" where \"priority\" = 3\n```\n\n## Paginate results\n\nSlick allows you to paginate our the result by using the `drop` and `limit` methods of `TableQuery`. To skip first 3 elements and then limit the result to 2 records, you can write following Slick code.\n\n```scala\nTasks.drop(3).take(2)\n```\n\nYou can view the SQL query generated by Slick in the logs.\n\n```sql\nselect \"title\", \"description\", \"createdAt\", \"dueBy\", \"tags\", \"priority\", \"id\" from \"tasks\" limit 3 offset 2\n```\n\n## Sort tasks in descending order of due date\n\nA lot of times we have to work with data in some sorting order. Let's suppose, we want to work on the task that is due last. One way to sort would be to sort the data in your application code. You could also ask your database to return the data in sorted order by passing the `order by clause`. Let's write a test case to test this scenario.\n\n```scala\nit(\"should sort tasks in descending order of due date\") {\n  val tasks = performAction(selectTasksSortedByDueDateDescQuery.result)\n  tasks.head should have(\n    'title (t7.title),\n    'description (t7.description),\n    'createdAt (t7.createdAt),\n    'dueBy (t7.dueBy),\n    'tags (t7.tags)\n  )\n}\n```\n\nWe have to define `selectTasksSortedByDueDateDescQuery` in the `queries` object as shown below.\n\n```scala\nval selectTasksSortedByDueDateDescQuery = Tasks.sortBy(_.dueBy.desc)\n```\n\nThe reason `desc` is available on the `dueBy` is because for Slick it is a `Timestamp`. All the operations that work on `Timestamp` are available on the `dueBy` as well.\n\nYou can view the SQL query generated by Slick in the logs.\n\n```sql\nselect \"title\", \"description\", \"createdAt\", \"dueBy\", \"tags\", \"priority\", \"id\" from \"tasks\" order by \"dueBy\" desc\n```\n\n## Select all tasks due today\n\nTo select all the tasks due today we can use `filter` operator as shown below. We are using `LocalDate` `asStartOfDay` method to define the time range of our where clause.\n\n```scala\nval selectAllTasksDueToday = Tasks\n  .filter(t => t.dueBy > LocalDate.now().atStartOfDay() && t.dueBy < LocalDate.now().atStartOfDay().plusDays(1))\n  .map(_.title)\n```\n\nYou could have also used two filters instead of one as shown below.\n\n```scala\nval selectAllTasksDueToday = Tasks\n  .filter(_.dueBy > LocalDate.now().atStartOfDay())\n  .filter(_.dueBy < LocalDate.now().atStartOfDay().plusDays(1))\n  .map(_.title)\n```\n\nYou can view the SQL query generated by Slick in the logs.\n\n```sql\nselect \"title\" from \"tasks\" where (\"dueBy\" > {ts '2016-01-31 00:00:00.0'}) and (\"dueBy\" < {ts '2016-02-01 00:00:00.0'})\n```\n\n## Select data with in a range\n\nWe can use the SQL `BETWEEN` operator to select data between two dates as shown below.\n\n```scala\nval selectTasksBetweenTodayAndSameDateNextMonthQuery = Tasks.filter(t => t.dueBy.between(LocalDateTime.now(), LocalDateTime.now().plusMonths(1)))\n```\n\nYou can view the SQL query generated by Slick in the logs.\n\n```sql\nselect \"title\", \"description\", \"createdAt\", \"dueBy\", \"tags\", \"priority\", \"id\" from \"tasks\" where \"dueBy\" between {ts '2016-01-31 21:44:40.643'} and {ts '2016-02-29 21:44:40.643'}\n```\n\n## Check if any high priority task is pending today\n\nYou can use SQL `exists` operator as shown below.\n\n```scala\nval selectAllTasksDueToday = Tasks\n  .filter(_.dueBy > LocalDate.now().atStartOfDay())\n  .filter(_.dueBy < LocalDate.now().atStartOfDay().plusDays(1))\n\nval checkIfAnyHighPriorityTaskExistsToday = selectAllTasksDueToday.filter(_.priority === Priority.HIGH).exists\n```\n\nYou can view the SQL query generated by Slick in the logs.\n\n```sql\nselect exists(select \"description\", \"createdAt\", \"priority\", \"tags\", \"dueBy\", \"id\", \"title\" from \"tasks\" where ((\"dueBy\" > {ts '2016-01-31 00:00:00.0'}) and (\"dueBy\" < {ts '2016-02-01 00:00:00.0'})) and (\"priority\" = 3))\n```\n\nThere are many more aggregate functions like `max`, `min`, `average` that you can use.\n\n## Conclusion\n\nToday, we looked at how we can use the Slick library to query our data. If you have used Scala collections or Java 8 Streams you should feel home. We still haven't covered many other important Slick topics like joins, profiles, working with real databases like MySQL or PostgreSQL, etc.  I will write at least one more post about Slick so that we have good understanding of it.\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/7](https://github.com/shekhargulati/52-technologies-in-2016/issues/7).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/05-slick)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "05-slick/tasky/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### SBT template\n# Simple Build Tool\n# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control\n\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\n.history\n.cache\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n\n"
  },
  {
    "path": "05-slick/tasky/build.sbt",
    "content": "name := \"tasky\"\n\ndescription := \"A simple task manager for humans\"\n\nversion := \"0.1.0\"\n\nscalaVersion := \"2.11.7\"\n\nlibraryDependencies += \"com.typesafe.slick\" %% \"slick\" % \"3.1.1\"\nlibraryDependencies += \"com.h2database\" % \"h2\" % \"1.4.191\"\nlibraryDependencies += \"ch.qos.logback\" % \"logback-classic\" % \"1.1.3\"\n\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\""
  },
  {
    "path": "05-slick/tasky/project/plugins.sbt",
    "content": "addSbtPlugin(\"net.virtual-void\" % \"sbt-dependency-graph\" % \"0.8.1\")"
  },
  {
    "path": "05-slick/tasky/src/main/scala/datamodel/Priority.scala",
    "content": "package datamodel\n\nobject Priority extends Enumeration {\n  type Priority = Value\n  val HIGH = Value(3)\n  val MEDIUM = Value(2)\n  val LOW = Value(1)\n}"
  },
  {
    "path": "05-slick/tasky/src/main/scala/datamodel/columnDataMappers.scala",
    "content": "package datamodel\n\nimport java.sql.Timestamp\nimport java.time.LocalDateTime\n\nimport datamodel.Priority._\nimport slick.driver.H2Driver.api._\n\nobject columnDataMappers {\n\n  implicit val localDateTimeColumnType: BaseColumnType[LocalDateTime] = MappedColumnType.base[LocalDateTime, Timestamp](\n    ldt => Timestamp.valueOf(ldt),\n    t => t.toLocalDateTime\n  )\n\n  implicit val setStringColumnType: BaseColumnType[Set[String]] = MappedColumnType.base[Set[String], String](\n    tags => tags.mkString(\",\"),\n    tagsString => tagsString.split(\",\").toSet\n  )\n\n\n  implicit val priorityMapper = MappedColumnType.base[Priority, Int](\n    p => p.id,\n    v => Priority(v)\n  )\n}\n"
  },
  {
    "path": "05-slick/tasky/src/main/scala/datamodel/dataModel.scala",
    "content": "package datamodel\n\nimport java.time.LocalDateTime\n\nimport datamodel.Priority.Priority\nimport datamodel.columnDataMappers._\nimport slick.driver.H2Driver.api._\n\nobject dataModel {\n\n  case class Task(\n                   title: String,\n                   description: String = \"\",\n                   createdAt: LocalDateTime = LocalDateTime.now(),\n                   dueBy: LocalDateTime,\n                   tags: Set[String] = Set[String](),\n                   priority: Priority = Priority.LOW,\n                   id: Long = 0L)\n\n\n  class TaskTable(tag: Tag) extends Table[Task](tag, \"tasks\") {\n    def title = column[String](\"title\")\n\n    def description = column[String](\"description\")\n\n    def createdAt = column[LocalDateTime](\"createdAt\")\n\n    def dueBy = column[LocalDateTime](\"dueBy\")\n\n    def tags = column[Set[String]](\"tags\")\n\n    def priority = column[Priority](\"priority\")\n\n    def id = column[Long](\"id\", O.PrimaryKey, O.AutoInc)\n\n    override def * = (title, description, createdAt, dueBy, tags, priority, id) <>(Task.tupled, Task.unapply)\n  }\n\n  lazy val Tasks = TableQuery[TaskTable]\n\n  val createTaskTableAction = Tasks.schema.create\n\n  def insertTaskAction(tasks: Task*) = Tasks ++= tasks.toSeq\n\n  val listAllTasksAction = Tasks.result\n}\n\n\n\n\n"
  },
  {
    "path": "05-slick/tasky/src/main/scala/queries/queries.scala",
    "content": "package queries\n\nimport java.time.{LocalDate, LocalDateTime}\n\nimport datamodel.Priority\nimport datamodel.Priority.Priority\nimport datamodel.columnDataMappers._\nimport datamodel.dataModel._\nimport slick.driver.H2Driver.api._\n\nobject queries {\n\n  val selectAllTasksQuery: Query[TaskTable, Task, Seq] = Tasks\n\n  //  val findAllTaskTitleQuery = Tasks.map(taskTable => taskTable.title)\n  val selectAllTaskTitleQuery: Query[Rep[String], String, Seq] = Tasks.map(_.title)\n\n  val selectMultipleColumnsQuery: Query[(Rep[String], Rep[Priority], Rep[LocalDateTime]), (String, Priority, LocalDateTime), Seq] = Tasks.map(t => (t.title, t.priority, t.createdAt))\n\n  val selectHighPriorityTasksQuery: Query[Rep[String], String, Seq] = Tasks.filter(_.priority === Priority.HIGH).map(_.title)\n\n  def findAllTasksPageQuery(skip: Int, limit: Int) = Tasks.drop(skip).take(limit)\n\n  val selectTasksSortedByDueDateDescQuery = Tasks.sortBy(_.dueBy.desc)\n\n  val findAllDueTasks = Tasks.filter(_.dueBy >= LocalDate.now().atStartOfDay())\n\n  val selectAllTaskTitlesDueToday = Tasks\n    .filter(_.dueBy > LocalDate.now().atStartOfDay())\n    .filter(_.dueBy < LocalDate.now().atStartOfDay().plusDays(1))\n    .map(_.title)\n\n  val selectTasksBetweenTodayAndSameDateNextMonthQuery = Tasks.filter(t => t.dueBy.between(LocalDateTime.now(), LocalDateTime.now().plusMonths(1)))\n\n  val selectAllTasksDueToday = Tasks\n    .filter(_.dueBy > LocalDate.now().atStartOfDay())\n    .filter(_.dueBy < LocalDate.now().atStartOfDay().plusDays(1))\n\n  val checkIfAnyHighPriorityTaskExistsToday = selectAllTasksDueToday.filter(_.priority === Priority.HIGH).exists\n}\n"
  },
  {
    "path": "05-slick/tasky/src/test/resources/application.conf",
    "content": "taskydb = {\n  connectionPool      = disabled\n  url                 = \"jdbc:h2:mem:taskydb\"\n  driver              = \"org.h2.Driver\"\n  keepAliveConnection = true\n}"
  },
  {
    "path": "05-slick/tasky/src/test/scala/datamodel/DataModelSpec.scala",
    "content": "package datamodel\n\nimport java.time.LocalDateTime\n\nimport datamodel.dataModel.Task\nimport org.scalatest.{BeforeAndAfterEach, FunSpec, Matchers}\nimport slick.driver.H2Driver.api._\n\nimport scala.concurrent._\nimport scala.concurrent.duration._\n\nclass DataModelSpec extends FunSpec with Matchers with BeforeAndAfterEach {\n\n  var db: Database = _\n\n  override protected def beforeEach(): Unit = {\n    db = Database.forConfig(\"taskydb\")\n    Await.result(db.run(dataModel.createTaskTableAction), 2 seconds)\n  }\n\n  override protected def afterEach(): Unit = db.shutdown\n\n  describe(\"DataModel Spec\") {\n\n    it(\"should insert single task into database\") {\n      val result = Await.result(db.run(dataModel.insertTaskAction(Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1), priority = Priority.HIGH))), 2 seconds)\n      result should be(Some(1))\n    }\n\n    it(\"should insert multiple tasks into database\") {\n      val tasks = Seq(\n        Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1), priority = Priority.HIGH),\n        Task(title = \"Write blog on Slick\", dueBy = LocalDateTime.now().plusDays(2), priority = Priority.HIGH),\n        Task(title = \"Build a simple application using Slick\", dueBy = LocalDateTime.now().plusDays(3), priority = Priority.HIGH)\n      )\n      val result = Await.result(db.run(dataModel.insertTaskAction(tasks: _*)), 2 seconds)\n      result should be(Some(3))\n    }\n\n    it(\"should list all tasks in the database\") {\n      val tasks = Seq(\n        Task(title = \"Learn Slick\", dueBy = LocalDateTime.now().plusDays(1), priority = Priority.HIGH),\n        Task(title = \"Write blog on Slick\", dueBy = LocalDateTime.now().plusDays(2), priority = Priority.HIGH),\n        Task(title = \"Build a simple application using Slick\", dueBy = LocalDateTime.now().plusDays(3), priority = Priority.HIGH)\n      )\n      Await.result(db.run(dataModel.insertTaskAction(tasks: _*)), 2 seconds)\n      val result = Await.result(db.run(dataModel.listAllTasksAction), 2 seconds)\n      result should have length 3\n    }\n\n  }\n\n\n}"
  },
  {
    "path": "05-slick/tasky/src/test/scala/queries/QueriesSpec.scala",
    "content": "package queries\n\nimport java.time.LocalDateTime\n\nimport datamodel.dataModel.Task\nimport datamodel.{Priority, dataModel}\nimport org.scalatest.{BeforeAndAfterAll, FunSpec, Matchers}\nimport queries._\nimport slick.driver.H2Driver.api._\n\nimport scala.concurrent._\nimport scala.concurrent.duration._\n\nclass QueriesSpec extends FunSpec with Matchers with BeforeAndAfterAll {\n\n  var db: Database = _\n  var t1: Task = _\n  var t2: Task = _\n  var t3: Task = _\n  var t4: Task = _\n  var t5: Task = _\n  var t6: Task = _\n  var t7: Task = _\n\n  override protected def beforeAll(): Unit = {\n    db = Database.forConfig(\"taskydb\")\n    Await.result(db.run(dataModel.createTaskTableAction), 2 seconds)\n    t1 = Task(title = \"Write part 1 blog on Slick\", dueBy = LocalDateTime.now().minusDays(7), tags = Set(\"blogging\", \"scala\", \"slick\"), priority = Priority.HIGH)\n    t2 = Task(title = \"Give a Java 8 training\", dueBy = LocalDateTime.now().minusDays(3), tags = Set(\"java\", \"training\", \"travel\"), priority = Priority.LOW)\n    t3 = Task(title = \"Write part 2 blog on Slick queries\", dueBy = LocalDateTime.now(), tags = Set(\"blogging\", \"scala\", \"slick\"), priority = Priority.HIGH)\n    t4 = Task(title = \"Read Good to Great book\", dueBy = LocalDateTime.now().plusDays(15), tags = Set(\"reading\", \"books\", \"startup\"), priority = Priority.MEDIUM)\n    t5 = Task(title = \"Read Programming Scala book\", dueBy = LocalDateTime.now().plusDays(30), tags = Set(\"reading\", \"books\", \"scala\"), priority = Priority.HIGH)\n    t6 = Task(title = \"Go to Goa for holiday\", dueBy = LocalDateTime.now().plusDays(60), tags = Set(\"travel\"), priority = Priority.LOW)\n    t7 = Task(title = \"Build my dream application using Play framework and Slick\", dueBy = LocalDateTime.now().plusMonths(3), tags = Set(\"application\", \"play\", \"startup\"), priority = Priority.HIGH)\n    val tasks = Seq(t1, t2, t3, t4, t5, t6, t7)\n    performAction(dataModel.insertTaskAction(tasks: _*))\n  }\n\n  private def performAction[T](action: DBIO[T]): T = {\n    Await.result(db.run(action), 2 seconds)\n  }\n\n  describe(\"Task Data Model Query Spec\") {\n\n    it(\"should select all the tasks stored in the database\") {\n      val tasks = performAction(selectAllTasksQuery.result)\n      tasks should have length 7\n      tasks.head should have(\n        'title (t1.title),\n        'description (t1.description),\n        'createdAt (t1.createdAt),\n        'dueBy (t1.dueBy),\n        'tags (t1.tags)\n      )\n    }\n\n    it(\"should select all task titles\") {\n      val taskTitles = performAction(selectAllTaskTitleQuery.result)\n      taskTitles should have length 7\n      taskTitles should be(List(t1.title, t2.title, t3.title, t4.title, t5.title, t6.title, t7.title))\n    }\n\n    it(\"should select task title, priority, and creation date for all tasks\") {\n      val taskTitles = performAction(selectMultipleColumnsQuery.result)\n      taskTitles should have length 7\n      taskTitles should be(List(\n        (t1.title, t1.priority, t1.createdAt),\n        (t2.title, t2.priority, t2.createdAt),\n        (t3.title, t3.priority, t3.createdAt),\n        (t4.title, t4.priority, t4.createdAt),\n        (t5.title, t5.priority, t5.createdAt),\n        (t6.title, t6.priority, t6.createdAt),\n        (t7.title, t7.priority, t7.createdAt))\n      )\n    }\n\n    it(\"should select all the high priority task titles\"){\n      val highPriorityTasks = performAction(selectHighPriorityTasksQuery.result)\n      highPriorityTasks should have length 4\n      highPriorityTasks should be(List(t1.title, t3.title, t5.title, t7.title))\n    }\n\n    it(\"should skip first 2 records and then limit result to 3\") {\n      val tasks = performAction(findAllTasksPageQuery(2, 3).result)\n      tasks should have length 3\n      tasks.head should have(\n        'title (t3.title),\n        'description (t3.description),\n        'createdAt (t3.createdAt),\n        'dueBy (t3.dueBy),\n        'tags (t3.tags)\n      )\n    }\n\n    it(\"should sort tasks in descending order of due date\") {\n      val tasks = performAction(selectTasksSortedByDueDateDescQuery.result)\n      tasks.head should have(\n        'title (t7.title),\n        'description (t7.description),\n        'createdAt (t7.createdAt),\n        'dueBy (t7.dueBy),\n        'tags (t7.tags)\n      )\n    }\n\n    it(\"should find all due tasks\") {\n      val dueTasks = performAction(findAllDueTasks.result)\n      dueTasks should have length 5\n      dueTasks.map(_.title) should be(List(t3.title, t4.title, t5.title, t6.title, t7.title))\n    }\n\n    it(\"should find all tasks due today\") {\n      val dueTasks = performAction(selectAllTaskTitlesDueToday.result)\n      dueTasks should have length 1\n      dueTasks should be(List(t3.title))\n    }\n\n\n    it(\"select tasks between today and same date next month \"){\n      val tasks = performAction(selectTasksBetweenTodayAndSameDateNextMonthQuery.result)\n      tasks should have length 1\n    }\n\n    it(\"check if any high priority task exists today\"){\n      val exists = performAction(checkIfAnyHighPriorityTaskExistsToday.result)\n      exists should be(true)\n    }\n\n\n  }\n\n\n}"
  },
  {
    "path": "06-okhttp/README.md",
    "content": "Building A Lightweight Scala REST API Client with OkHttp\n----\n\nWelcome to the sixth blog of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. In this blog, we will learn how to write Scala REST API client for [Medium](https://medium.com/)'s REST API using [OkHttp](https://github.com/square/okhttp) library. [REST](https://en.wikipedia.org/wiki/Representational_state_transfer) APIs have become a standard method of communication between two devices over a network. Most applications expose their REST API that developers can use to get work with an application programmatically. For example, if I have to build a realtime opinion mining application then I can use Twitter or Facebook REST APIs to get hold of their data and build my application. To work with an application REST APIs, you either can write your own client or you can use one of the language specific client provided by the application. Last few weeks, I have started using [Medium](https://medium.com/) for posting non-technical blogs. Medium is a blog publishing platform created by Twitter co-founder <a href=\"https://en.wikipedia.org/wiki/Evan_Williams_(Internet_entrepreneur)\">Evan Williams</a>. Evan Williams is the same guy who earlier created <a href=\"https://en.wikipedia.org/wiki/Blogger_(service)\">Blogger</a>, which was bought by Google in 2003.\n\nMedium exposed their REST API to the external world last year. The API is simple and allows you to do operations like submitting a post, getting details of the authenticated user, getting publications for a user, etc. You can read about Medium API documentation in their [Github repository](https://github.com/Medium/medium-api-docs). Medium officially provides REST API clients for [Node.js](https://github.com/Medium/medium-sdk-nodejs), [Python](https://github.com/Medium/medium-sdk-python), and [Go](https://github.com/Medium/medium-sdk-go) programming languages. I couldn't find Scala client for Medium REST API so I decided to write my own client using OkHttp.\n\n## What is OkHttp?\n\n[OkHttp](https://square.github.io/okhttp/) is an open source Java HTTP client library focussed on efficiency. It is written by folks at [Square](https://squareup.com/). It supports [SPDY](https://developers.google.com/speed/spdy/), [HTTP/2](https://http2.github.io/), and [WebSocket](https://tools.ietf.org/html/rfc6455) protocols.\n\nOkHttp API is very easy to use. You just have to add its dependency to your classpath and then you can start using it to build your clients.\n\nAccording to [OkHttp documentation](https://square.github.io/okhttp/),\n\n> OkHttp is an HTTP client that’s efficient by default:\n* HTTP/2 support allows all requests to the same host to share a socket.\n* Connection pooling reduces request latency (if HTTP/2 isn’t available).\n* Transparent GZIP shrinks download sizes.\n* Response caching avoids the network completely for repeat requests.\n\n## Why are you using a Java library?\n\nI know you must be thinking why I am using a Java library to build a Scala REST API client. Like most Scala developers, I thought of using a Scala library instead. But, as I started looking into which Scala library should I use I didn't find any single winner. If you search for \"Scala REST client\", you will land up on this [StackOverFlow question](https://stackoverflow.com/questions/12334476/simple-and-concise-http-client-library-for-scala). It suggests four libraries Dispatch, Scalaz http, spray-client, Play WS. Let's discuss why I didn't used them one by one.\n\n1. [Dispatch](https://github.com/dispatch/reboot): It is a Scala wrapper around Ning's Async Http Client. The project doesn't look very active with last commit on [May 30, 2015](https://github.com/dispatch/reboot/commits/0.11.3). The [travis-ci build](https://travis-ci.org/dispatch/reboot) is also broken so I am not sure if this project is actively maintained.\n\n2. [Scalaz](https://github.com/scalaz/scalaz/) http: Scalaz is an extension to the core Scala library for functional programming. They used to have an HTTP client. They [dropped http module from Scalaz in version 7](https://stackoverflow.com/questions/25482520/what-happened-to-the-scalaz-http-module).\n\n3. [spray-client](http://spray.io/documentation/1.2.2/spray-client/):  It provides high-level HTTP client functionality by adding another logic layer on top of the relatively basic spray-can HTTP Client APIs. spray-client depends on many other spray projects and Akka. I didn't wanted to use a library that depends on so many other libraries.\n\n4. [Play WS](https://www.playframework.com/documentation/2.5.x/ScalaWS): Play WS is part of the Scala's Play web framework. It can used in standalone mode but it also depends on [many other libraries](http://mvnrepository.com/artifact/com.typesafe.play/play-ws_2.11/2.4.6). It also looked very heavy weight for something simple. So, I decided not to use it as well.\n\n## Why OkHttp?\n\nMy reasons for going with OkHttp are:\n\n1. It has only one dependency Okio. [Okio](https://github.com/square/okio) is a library that complements java.io and java.nio to make it much easier to access, store, and process your data.\n2. It has very good testing support. It provides [scriptable web server](https://github.com/square/okhttp/tree/master/mockwebserver) for testing HTTP client. This makes it easy to test whether your client is doing the right thing without depending on the network.\n3. OkHttp is one of the few libraries that is designed up front for efficiency.\n4. Stable and actively developed by Square. Last commit was 15 hours ago.\n5. API is very simple and intuitive to use. It comes with good defaults and works like a charm.\n\nAlthough, OkHttp is a Java library but it works great with Scala. I know it might not be the Scala way but sometimes we have to become pragmatic and choose the right tool for the job. There is also an OkHttp Scala wrapper called [Communicator](https://github.com/Taig/Communicator) that one can use.\n\n## Github repository\n\nThe code for today’s application is available on github: [medium-scala-client](./medium-scala-client). In this blog, I will only cover couple of REST endpoints. You can view the full source of [medium-scala-sdk here](https://github.com/shekhargulati/medium-scala-sdk).\n\n## Getting Started\n\nStart by creating a new directory `medium-scala-client` at a convenient location on your filesystem. This directory will house the source code of our client.\n\n```bash\n$ mkdir medium-scala-client\n```\n\nCreate a new file `build.sbt` inside the `medium-scala-client` directory. `build.sbt` is the sbt build script.\n> **If you are new to sbt, then [please refer to my earlier post on it](../02-sbt/README.md).**\n\nPopulate `build.sbt` with following contents.\n\n```scala\nname := \"medium-scala-client\"\n\nversion := \"1.0\"\n\ndescription := \"Scala client for Medium.com REST API\"\n\nscalaVersion := \"2.11.7\"\n\nlibraryDependencies += \"com.squareup.okhttp3\" % \"okhttp\" % \"3.0.1\"\n\nlibraryDependencies += \"io.spray\" %% \"spray-json\" % \"1.3.2\"\n\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\"\n\nlibraryDependencies += \"com.squareup.okhttp3\" % \"mockwebserver\" % \"3.0.1\" % \"test\"\n```\n\nIn the build script shown above, you can see that we have only added two compile time dependencies -- `okhttp` and `spray-json`. [spray-json](https://github.com/spray/spray-json) is a lightweight, clean, and efficient library to work with JSON in Scala. It has no dependencies. We will use it to convert our domain objects into JSON and vice-versa. `scalatest` and `mockwebserver` are added for testing.\n\nCreate a project layout for your Scala source and test files.\n\n```bash\n$ mkdir -p src/main/{scala,resources}\n$ mkdir -p src/test/scala\n```\n\n## Getting the authenticated user's details\n\nLet's start with implementing the REST endpoint to get details of an authenticated user. To get the details of a user, we have to make an HTTP GET request.\n\n```\nGET https://api.medium.com/v1/me\n```\n\nWe will start with writing a test. Create a new package `medium` inside the `src/test/scala`. After creating the package, create a Scala class `MediumClientSpec`. Populate the `MediumClientSpec` with following contents.\n\n```scala\npackage medium\n\nimport okhttp3.mockwebserver.MockWebServer\nimport org.scalatest.{BeforeAndAfterEach, FunSpec, Matchers}\n\nclass MediumClientSpec extends FunSpec with Matchers  with BeforeAndAfterEach{\n\n  var server: MockWebServer = _\n\n  override protected def beforeEach(): Unit = {\n    server = new MockWebServer()\n  }\n\n  override protected def afterEach(): Unit = {\n    server.shutdown()\n  }\n}\n```\n\nThe code shown above does the following:\n\n1. We created a new class `MediumClientSpec` that extended `FunSpec`, `Matchers`, and `BeforeAndAfterEach` traits. These are part of `scalatest` library.\n2. We override two methods of `BeforeAndAfterEach` trait. `beforeEach` will make sure that `MockWebServer` instance is created before each test case is executed. `MockWebServer` is a scriptable web server. You can configure it to return mock responses for your requests. It works very similarly to any mocking framework. You first set your expectations, then run the application code, and finally verify that expected requests were made.\n3. `afterEach` will make sure that server is shutdown after each test.\n\nAdd the following test case to the `MediumClientSpec`. This code should be added after the `afterEach` method.\n\n```scala\ndescribe(\"MediumClientSpec\") {\n  it(\"should get details of an authenticated user\") {\n    val json =\n      \"\"\"\n        |{\n        |  \"data\": {\n        |    \"id\": \"123\",\n        |    \"username\": \"shekhargulati\",\n        |    \"name\": \"Shekhar Gulati\",\n        |    \"url\": \"https://medium.com/@shekhargulati\",\n        |    \"imageUrl\": \"https://cdn-images-1.medium.com/fit/c/200/200/1*pC-eYQUV-iP2Y10_LgGvwA.jpeg\"\n        |  }\n        |}\n      \"\"\".stripMargin\n\n    server.enqueue(new MockResponse()\n      .setBody(json)\n      .setHeader(\"Content-Type\", \"application/json\")\n      .setHeader(\"charset\", \"utf-8\"))\n    server.start()\n\n    val medium = new MediumClient(\"test_client_id\", \"test_client_secret\", Some(\"access_token\")) {\n      override val baseApiUrl = server.url(\"/v1/me\")\n    }\n    val user = medium.getUser\n    user should have(\n      'id (\"123\"),\n      'username (\"shekhargulati\"),\n      'name (\"Shekhar Gulati\"),\n      'url (\"https://medium.com/@shekhargulati\"),\n      'imageUrl (\"https://cdn-images-1.medium.com/fit/c/200/200/1*pC-eYQUV-iP2Y10_LgGvwA.jpeg\")\n    )\n  }\n}\n```\n\nLet's understand the code show above:\n\n1. We created a json that will be returned by `MockWebServer` when GET request is made to `https://api.medium.com/v1/me`.\n2. Then, we set up the server with a mock response. We set the body to the json created in step 1. Also, we added HTTP headers that will be passed in the response.\n3. Next, we started the mock web server so that it can accept test requests.\n4. Then, we created an instance of MediumClient(that we will create later in the blog). We have to set the URL returned by our server in the client so that it makes requests to the mock server instead of hitting the actual Medium API. This is the reason we have overridden `baseApiUrl` value of `MediumClient`.\n5. Finally, we called the `getUser` method of `MediumClient` and asserted its response.\n\nNow that we have written our test case we should start working on the implementation of MediumClient. Create a new package `medium` inside `src/main/scala`. Then, create a new Scala class `MediumClient` inside the `medium` package.\n\n```scala\npackage medium\n\nclass MediumClient(clientId: String, clientSecret: String, var accessToken: Option[String] = None)\n\nobject MediumClient {\n  def apply(clientId: String, clientSecret: String): MediumClient = new MediumClient(clientId, clientSecret)\n\n  def apply(clientId: String, clientSecret: String, accessToken: String): MediumClient = new MediumClient(clientId, clientSecret, Some(accessToken))\n}\n\ncase class MediumException(message: String, cause: Throwable = null) extends RuntimeException(message, cause)\n```\n\nThe code shown above does the following:\n\n1. We created a new Scala class `MediumClient`. The primary constructor of MediumClient takes three arguments -- `clientId`, `clientSecret`, and `accessToken`. The clientId and clientSecret are created for you when you create new Medium application [http://medium.com/me/applications](http://medium.com/me/applications). Using the clientId and clientSecret, users can generate `accessToken`. You have to pass `accessToken` in each request to the Medium API.\n2. Then, we created a companion object to the `MediumClient`. It provides factory methods to easily construct `MediumClient` instances.\n3. `MediumException` is a runtime exception that we will throw when client will not be able to process user requests.\n\nCreate an instance of `OkHttpClient` inside the `MediumClient` class as shown below. `OkHttpClient` is used to send HTTP requests and read HTTP responses. When you create the `OkHttpClient` instance using the default constructor then an `OkHttpClient` instance is created using the default values. You can also create an instance configured using other values by using the `OkHttpClient.Builder` API. We also created another value `baseApiUrl` of type `okhttp3.HttpUrl`. This will store the base URL of the Medium API i.e. `https://api.medium.com`.\n\n```scala\nimport okhttp3.{HttpUrl, OkHttpClient}\n\nclass MediumClient(clientId: String, clientSecret: String, var accessToken: Option[String] = None) {\n  val client = new OkHttpClient()\n\n  val baseApiUrl: HttpUrl = new HttpUrl.Builder()\n    .scheme(\"https\")\n    .host(\"api.medium.com\")\n    .build()\n\n}\n```\n\nNow, we will write the `getUser` method that will make an HTTP GET request to the Medium API to fetch the user details. User is determined using the `accessToken`. If access token is not set then it will throw `MediumException`.\n\n```scala\ndef getUser: User = accessToken match {\n  case Some(at) => ???\n  case _ => throw new MediumException(\"Please set access token\")\n}\n```\n\n> The Scala syntax `???` lets you write a not yet implemented method. This allows you to write code that compiles. But, if you run this code, then it will thrown an exception.\n\nThe code shown above needs `User` to compile. Create a new Scala object `domainObjects`. The `domainObjects.scala` will house all our domain objects like `User`, `Post`, etc. Create a case class for `User` inside it as shown below.\n\n```scala\npackage medium\n\nobject domainObjects {\n\n  case class User(id: String, username: String, name: String, url: String, imageUrl: String)\n\n}\n```\n\nAs shown above, we created a User case class with five fields inside the `domainObjects` Scala object.\n\nAfter creating the `domainObjects` Scala object, add its import in the `MediumClient` so that code can compile.\n\n```scala\nimport domainObjects._\n\nclass MediumClient(clientId: String, clientSecret: String, var accessToken: Option[String] = None)\n```\n\nNow, let's write code to replace `???` with actual implementation inside the `getUser` method.\n\n```scala\ndef getUser: User = accessToken match {\n  case Some(at) =>\n    val request = new Request.Builder()\n      .header(\"Content-Type\", \"application/json\")\n      .header(\"Accept\", \"application/json\")\n      .header(\"Accept-Charset\", \"utf-8\")\n      .header(\"Authorization\", s\"Bearer $at\")\n      .url(baseApiUrl.resolve(\"/v1/me\"))\n      .get()\n      .build()\n    makeRequest[User](request)\n  case _ => throw new MediumException(\"Please set access token\")\n}\n\nprivate def makeRequest[T](request: Request)(implicit p: JsonReader[T]): T = ???\n```\n\nIn the code shown above:\n\n1. We created request using the OkHttp `Request.Builder` API. We set the required headers in the request and set url of the request to `/v1/me`. `HttpUrl.resolve` method resolves the url against the baseApiUrl. So, the full url will become `https://api.medium.com/v1/me`. OkHttp understands which HTTP method to use by looking at the request. As you can see above, we called the `get` method of the request builder. This constructs an immutable `okhttp3.Request` object.\n2. Once request is created, we passed the request to `makeRequest` method. This method will process any request be it GET or POST or DELETE and return the domain object.\n\nNow, we will implement `makeRequest` method. `makeRequest` method makes use of `OkHttpClient` instance to create a new `Call`. To make the HTTP call, we first called `newCall` method on `OkHttpClient` instance. The `newCall` returns `okhttp3.Call` object. OkHttp uses `Call` to model the task of satisfying your request through however many intermediate requests and responses are necessary. Calls can be executed in synchronous or asynchronous manner. In the code shown below, we called the `execute` method to make a synchronous HTTP GET call.\n\n```scala\nprivate def makeRequest[T](request: Request)(implicit p: JsonReader[T]): T= {\n  val response = client.newCall(request).execute()\n  val responseJson = response.body().string()\n  println(s\"Received response $responseJson\")\n  ???\n}\n```\nIf you run the test method now, it will render the `json` response we have set in the test.\n\n```javascript\nReceived response\n{\n  \"data\": {\n    \"id\": \"123\",\n    \"username\": \"shekhargulati\",\n    \"name\": \"Shekhar Gulati\",\n    \"url\": \"https://medium.com/@shekhargulati\",\n    \"imageUrl\": \"https://cdn-images-1.medium.com/fit/c/200/200/1*pC-eYQUV-iP2Y10_LgGvwA.jpeg\"\n  }\n}\n```\n\nNow, let's take a look at the last bit of code required to convert json into `User` object. To convert json into User object, we will make use of `spray-json` library.\n\nTo use `spray-json`, we have to first add few imports so that relevant elements are added in the scope of  our `MediumClient`.\n\n```scala\nimport spray.json._\nimport DefaultJsonProtocol._\n```\n\nAfter adding the imports, you can convert the json string into User object as shown below.\n\n```scala\nprivate def makeRequest[T](request: Request)(implicit p: JsonReader[T]): T= {\n  val response = client.newCall(request).execute()\n  val responseJson = response.body().string()\n  println(s\"Received response $responseJson\")\n  response match {\n    case r if r.isSuccessful =>\n      val jsValue: JsValue = responseJson.parseJson\n      jsValue.asJsObject.getFields(\"data\").headOption match {\n        case Some(data) => data.convertTo[T]\n        case _ => throw new MediumException(s\"Received unexpected JSON response $responseJson\")\n      }\n    case _ => throw new MediumException(s\"Received HTTP error response code ${response.code()}\")\n  }\n}\n```\n\nThe code shown above will not compile as you have to bring implicit values in scope that provide `JsonFormat[User]` instances for User.\n\nCreate a new object `MediumApiProtocol` that will define a `JsonFormat` to convert `User` into JSON.\n\n```scala\npackage medium\n\nimport medium.domainObjects.User\nimport spray.json.DefaultJsonProtocol\n\nobject MediumApiProtocol extends DefaultJsonProtocol{\n\n  implicit val userFormat = jsonFormat5(User)\n\n}\n```\n\nNow, code will compile and test case will pass.\n\n## Posting a blog on Medium\n\nLet's now implement method that will create a post on Medium. To create a post, we have to use HTTP POST method as we are creating a resource on the server. Let's write a test method, that will test the post creation.\n\n```scala\nit(\"should publish a new post\") {\n  val responsJson =\n    \"\"\"\n      |{\n      | \"data\": {\n      |   \"id\": \"e6f36a\",\n      |   \"title\": \"Liverpool FC\",\n      |   \"authorId\": \"5303d74c64f66366f00cb9b2a94f3251bf5\",\n      |   \"tags\": [\"football\", \"sport\", \"Liverpool\"],\n      |   \"url\": \"https://medium.com/@majelbstoat/liverpool-fc-e6f36a\",\n      |   \"canonicalUrl\": \"http://jamietalbot.com/posts/liverpool-fc\",\n      |   \"publishStatus\": \"public\",\n      |   \"publishedAt\": 1442286338435,\n      |   \"license\": \"all-rights-reserved\",\n      |   \"licenseUrl\": \"https://medium.com/policy/9db0094a1e0f\"\n      | }\n      |}\n    \"\"\".stripMargin\n\n  server.enqueue(new MockResponse()\n    .setBody(responsJson)\n    .setHeader(\"Content-Type\", \"application/json\")\n    .setHeader(\"charset\", \"utf-8\"))\n  server.start()\n  val medium = new MediumClient(\"test_client_id\", \"test_client_secret\", Some(\"access_token\")) {\n    override val baseApiUrl = server.url(\"/v1/users/123/posts\")\n  }\n\n  val content =\n    \"\"\"\n      |# Hello World\n      |Hello how are you?\n      |## What's up today?\n      |Writing REST client for Medium API\n    \"\"\".stripMargin\n  val post = medium.createPost(\"123\", PostRequest(\"Liverpool FC\", \"html\", content))\n\n  post.id should be(\"e6f36a\")\n}\n```\n\nNext, add `PostRequest` and `Post` case classes to `domainObjects.scala`.\n\n```scala\npackage medium\n\nobject domainObjects {\n\n  case class User(id: String, username: String, name: String, url: String, imageUrl: String)\n\n  case class PostRequest(title: String, contentFormat: String, content: String, tags: Array[String] = Array(), canonicalUrl: Option[String] = None, publishStatus: String = \"public\", license: String = \"all-rights-reserved\")\n\n  case class Post(id: String, publicationId: Option[String] = None, title: String, authorId: String, tags: Array[String], url: String, canonicalUrl: String, publishStatus: String, publishedAt: Long, license: String, licenseUrl: String)\n\n}\n```\n\nWrite the JSON formatter in `MediumApiProtocol` as shown below.\n\n```scala\npackage medium\n\nimport medium.domainObjects._\nimport spray.json._\n\nobject MediumApiProtocol extends DefaultJsonProtocol{\n\n  implicit val userFormat = jsonFormat5(User)\n\n  implicit val postRequestFormat = jsonFormat7(PostRequest)\n\n  implicit val postFormat = jsonFormat11(Post)\n\n}\n```\n\nNow, we will write `createPost` that will create a Medium post.\n\n```scala\ndef createPost(authorId: String, postRequest: PostRequest): Post = accessToken match {\n  case Some(at) =>\n    val httpUrl = baseApiUrl.resolve(s\"/v1/users/$authorId/posts\")\n    val request = new Request.Builder()\n      .header(\"Content-Type\", \"application/json\")\n      .header(\"Accept\", \"application/json\")\n      .header(\"Accept-Charset\", \"utf-8\")\n      .header(\"Authorization\", s\"Bearer $at\")\n      .url(httpUrl)\n      .post(RequestBody.create(MediaType.parse(\"application/json\"), postRequest.toJson.prettyPrint))\n      .build()\n    makeRequest[Post](request)\n  case _ => throw new MediumException(\"Please set access token\")\n}\n```\n\nNow, compile the code and run the test case. Both test cases will pass now.\n\n## Conclusion\n\nThis week we learnt how to write REST API using OkHttp library. We covered how to make HTTP GET and POST requests using OkHttp. OkHttp supports all HTTP methods like head, delete, put, etc. You can also use OKHttp to [make asynchronous calls](https://github.com/square/okhttp/wiki/Recipes#asynchronous-get). You can refer to [OkHttp documentation](https://github.com/square/okhttp/wiki) for more details.\n\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/8](https://github.com/shekhargulati/52-technologies-in-2016/issues/8).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/06-okhttp)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "06-okhttp/medium-scala-client/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n### SBT template\n# Simple Build Tool\n# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control\n\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\n.history\n.cache\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n\n"
  },
  {
    "path": "06-okhttp/medium-scala-client/build.sbt",
    "content": "name := \"medium-scala-client\"\n\nversion := \"1.0\"\n\ndescription := \"Scala client for Medium.com REST API\"\n\nscalaVersion := \"2.11.7\"\n\nlibraryDependencies += \"com.squareup.okhttp3\" % \"okhttp\" % \"3.0.1\"\n\nlibraryDependencies += \"io.spray\" %% \"spray-json\" % \"1.3.2\"\n\nlibraryDependencies += \"org.scalatest\" %% \"scalatest\" % \"2.2.6\" % \"test\"\n\nlibraryDependencies += \"com.squareup.okhttp3\" % \"mockwebserver\" % \"3.0.1\" % \"test\"\n"
  },
  {
    "path": "06-okhttp/medium-scala-client/src/main/scala/medium/MediumApiProtocol.scala",
    "content": "package medium\n\nimport medium.domainObjects._\nimport spray.json._\n\nobject MediumApiProtocol extends DefaultJsonProtocol{\n\n  implicit val userFormat = jsonFormat5(User)\n\n  implicit val postRequestFormat = jsonFormat7(PostRequest)\n\n  implicit val postFormat = jsonFormat11(Post)\n\n}\n"
  },
  {
    "path": "06-okhttp/medium-scala-client/src/main/scala/medium/MediumClient.scala",
    "content": "package medium\n\nimport medium.MediumApiProtocol._\nimport medium.domainObjects._\nimport okhttp3._\nimport spray.json._\n\nclass MediumClient(clientId: String, clientSecret: String, var accessToken: Option[String] = None) {\n  val client = new OkHttpClient()\n\n  val baseApiUrl: HttpUrl = new HttpUrl.Builder()\n    .scheme(\"https\")\n    .host(\"api.medium.com\")\n    .build()\n\n  def getUser: User = accessToken match {\n    case Some(at) =>\n      val request = new Request.Builder()\n        .header(\"Content-Type\", \"application/json\")\n        .header(\"Accept\", \"application/json\")\n        .header(\"Accept-Charset\", \"utf-8\")\n        .header(\"Authorization\", s\"Bearer $at\")\n        .url(baseApiUrl.resolve(\"/v1/me\"))\n        .get()\n        .build()\n      makeRequest[User](request)\n    case _ => throw new MediumException(\"Please set access token\")\n  }\n\n  def createPost(authorId: String, postRequest: PostRequest): Post = accessToken match {\n    case Some(at) =>\n      val httpUrl = baseApiUrl.resolve(s\"/v1/users/$authorId/posts\")\n      val request = new Request.Builder()\n        .header(\"Content-Type\", \"application/json\")\n        .header(\"Accept\", \"application/json\")\n        .header(\"Accept-Charset\", \"utf-8\")\n        .header(\"Authorization\", s\"Bearer $at\")\n        .url(httpUrl)\n        .post(RequestBody.create(MediaType.parse(\"application/json\"), postRequest.toJson.prettyPrint))\n        .build()\n      makeRequest[Post](request)\n    case _ => throw new MediumException(\"Please set access token\")\n  }\n\n\n  private def makeRequest[T](request: Request)(implicit p: JsonReader[T]): T= {\n    val response = client.newCall(request).execute()\n    val responseJson = response.body().string()\n    println(s\"Received response $responseJson\")\n    response match {\n      case r if r.isSuccessful =>\n        val jsValue: JsValue = responseJson.parseJson\n        jsValue.asJsObject.getFields(\"data\").headOption match {\n          case Some(data) => data.convertTo[T]\n          case _ => throw new MediumException(s\"Received unexpected JSON response $responseJson\")\n        }\n      case _ => throw new MediumException(s\"Received HTTP error response code ${response.code()}\")\n    }\n  }\n\n\n\n}\n\nobject MediumClient {\n  def apply(clientId: String, clientSecret: String): MediumClient = new MediumClient(clientId, clientSecret)\n\n  def apply(clientId: String, clientSecret: String, accessToken: String): MediumClient = new MediumClient(clientId, clientSecret, Some(accessToken))\n}\n\ncase class MediumException(message: String, cause: Throwable = null) extends RuntimeException(message, cause)\n\n"
  },
  {
    "path": "06-okhttp/medium-scala-client/src/main/scala/medium/domainObjects.scala",
    "content": "package medium\n\nobject domainObjects {\n\n  case class User(id: String, username: String, name: String, url: String, imageUrl: String)\n\n  case class PostRequest(title: String, contentFormat: String, content: String, tags: Array[String] = Array(), canonicalUrl: Option[String] = None, publishStatus: String = \"public\", license: String = \"all-rights-reserved\")\n\n  case class Post(id: String, publicationId: Option[String] = None, title: String, authorId: String, tags: Array[String], url: String, canonicalUrl: String, publishStatus: String, publishedAt: Long, license: String, licenseUrl: String)\n\n}\n"
  },
  {
    "path": "06-okhttp/medium-scala-client/src/test/scala/medium/MediumClientSpec.scala",
    "content": "package medium\n\nimport medium.domainObjects.PostRequest\nimport okhttp3.mockwebserver.{MockResponse, MockWebServer}\nimport org.scalatest.{BeforeAndAfterEach, FunSpec, Matchers}\n\nclass MediumClientSpec extends FunSpec with Matchers with BeforeAndAfterEach {\n\n  var server: MockWebServer = _\n\n  override protected def beforeEach(): Unit = {\n    server = new MockWebServer()\n  }\n\n  override protected def afterEach(): Unit = {\n    server.shutdown()\n  }\n\n  describe(\"MediumClientSpec\") {\n\n    it(\"should get details of an authenticated user\") {\n      val json =\n        \"\"\"\n          |{\n          |  \"data\": {\n          |    \"id\": \"123\",\n          |    \"username\": \"shekhargulati\",\n          |    \"name\": \"Shekhar Gulati\",\n          |    \"url\": \"https://medium.com/@shekhargulati\",\n          |    \"imageUrl\": \"https://cdn-images-1.medium.com/fit/c/200/200/1*pC-eYQUV-iP2Y10_LgGvwA.jpeg\"\n          |  }\n          |}\n        \"\"\".stripMargin\n\n      server.enqueue(new MockResponse()\n        .setBody(json)\n        .setHeader(\"Content-Type\", \"application/json\")\n        .setHeader(\"charset\", \"utf-8\"))\n      server.start()\n\n      val medium = new MediumClient(\"test_client_id\", \"test_client_secret\", Some(\"access_token\")) {\n        override val baseApiUrl = server.url(\"/v1/me\")\n      }\n      val user = medium.getUser\n      user should have(\n        'id (\"123\"),\n        'username (\"shekhargulati\"),\n        'name (\"Shekhar Gulati\"),\n        'url (\"https://medium.com/@shekhargulati\"),\n        'imageUrl (\"https://cdn-images-1.medium.com/fit/c/200/200/1*pC-eYQUV-iP2Y10_LgGvwA.jpeg\")\n      )\n    }\n\n    it(\"should publish a new post\") {\n      val responsJson =\n        \"\"\"\n          |{\n          | \"data\": {\n          |   \"id\": \"e6f36a\",\n          |   \"title\": \"Liverpool FC\",\n          |   \"authorId\": \"5303d74c64f66366f00cb9b2a94f3251bf5\",\n          |   \"tags\": [\"football\", \"sport\", \"Liverpool\"],\n          |   \"url\": \"https://medium.com/@majelbstoat/liverpool-fc-e6f36a\",\n          |   \"canonicalUrl\": \"http://jamietalbot.com/posts/liverpool-fc\",\n          |   \"publishStatus\": \"public\",\n          |   \"publishedAt\": 1442286338435,\n          |   \"license\": \"all-rights-reserved\",\n          |   \"licenseUrl\": \"https://medium.com/policy/9db0094a1e0f\"\n          | }\n          |}\n        \"\"\".stripMargin\n\n      server.enqueue(new MockResponse()\n        .setBody(responsJson)\n        .setHeader(\"Content-Type\", \"application/json\")\n        .setHeader(\"charset\", \"utf-8\"))\n      server.start()\n      val medium = new MediumClient(\"test_client_id\", \"test_client_secret\", Some(\"access_token\")) {\n        override val baseApiUrl = server.url(\"/v1/users/123/posts\")\n      }\n\n      val content =\n        \"\"\"\n          |# Hello World\n          |Hello how are you?\n          |## What's up today?\n          |Writing REST client for Medium API\n        \"\"\".stripMargin\n      val post = medium.createPost(\"123\", PostRequest(\"Liverpool FC\", \"html\", content))\n\n      post.id should be(\"e6f36a\")\n    }\n\n  }\n\n}"
  },
  {
    "path": "07-hugo/README.md",
    "content": "Hugo: A Modern WebSite Engine That Just Works\n----\n\nThis week I decided to take a break from Scala and scratch my own itch my building an online bookshelf using Hugo. **[Hugo](https://gohugo.io/)** is a static site generator written in Go programming language. You can use it for building modern static websites. Static site generator takes your content files written in a markup language like [Markdown](https://en.wikipedia.org/wiki/Markdown), apply layouts you have defined, and generate static HTML files that can be delivered to the user. Static websites are nothing new, they date back to the [first ever website](http://info.cern.ch/hypertext/WWW/TheProject.html) in human history. We started with static websites, then moved to dynamic websites, and finally we are moving back to static websites for use-cases where it make sense. Most common use-cases for static websites are blogs, product documentation, help guides, tutorials, online portfolio or resume.\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\nStatic generators again came into limelight after the introduction of [Jekyll](https://jekyllrb.com/) in 2008. Jekyll is a static website generator written in Ruby. It was created by Github co-founder Tom Preston-Werner. Because Jekyll was created by Github co-founder, it has very good integration with Github. It was very easy to get your website running on Github pages.\n\nAnother reason static site generators are back in popularity has to do with a lot of advantages they offer. In my opinion, static generators offer following advantages:\n\n1. You don't need a database to store content\n2. Forces you to use version control system to store content\n3. Fast and cacheable\n4. Less maintenance overhead\n5. Works well for a lot of use-cases like blogs, documentation, etc.\n6. Low barrier to entry\n7. Runs out of the box on many platforms like Github pages, Amazon S3, or any web server like Nginx\n8. Good developer workflow using Git\n\nI would recommend that you read [good post by David Walsh on advantages and disadvantages of static site generators](https://davidwalsh.name/introduction-static-site-generators). If you look at Google trends, you will notice a steep rise in interest for static site generators. As you can see below, after 2011 more and more people are searching about `static site generator`.\n\n<img src=\"images/google-trends.png\" width=\"600\">\n\nThere are many Open-source static site generators options available to the users. You can choose from more than [400 static site generators](https://staticsitegenerators.net/). The most popular ones are [Jekyll](https://github.com/jekyll/jekyll), [Hugo](https://github.com/spf13/hugo), [Middleman](https://github.com/middleman/middleman), [Harp](https://github.com/sintaxi/harp).\n\n> **I have personally used Jekyll and Hugo. I migrated my company blog to Jekyll and it didn't turned out to be a good decision. The two main drawback of Jekyll are 1) you need Ruby runtime 2) it is very slow for bigger projects. To get someone running Jekyll on a machine is a pain. This leads to a barrier in adoption.**\n\n## Why Hugo?\n\nAs mentioned above, I had a bad experience with Jekyll so I was looking for an alternative that didn't have same limitations. The reasons I prefer Hugo are:\n\n1. It is not dependent on any programming language runtime\n2. It provides binaries for all modern operating system\n3. It is Fast\n4. It provides quick feedback by live reloading of the content\n5. It comes with good defaults and follows convention over configuration philosophy\n\n## Why an online bookshelf?\n\nSome of you might be wondering why I wanted to create an online bookshelf. One promise that I made this year to myself is to read at least one non-technology each month in 2016. Last many years, I am upset with myself for not giving time to read non-technology books. This year I have to change this so I decided to build a bookshelf that will keep track of all the books I read. I got inspired to build my online bookshelf after visiting [Bill Gates blog](https://www.gatesnotes.com/). Bill Gates is maintaining an [awesome bookshelf](https://www.gatesnotes.com/Books) where he shares which his recently read books and their reviews. A screenshot of his bookshelf is shown below.\n\n<img src=\"images/bill_gate_bookshelf.png\" width=\"600\">\n\n-----\n\nBuilding our bookshelf\n---\n\nNow, that we know about static site generators and Hugo let's start building our bookshelf step by step. By the end of this tutorial, we will have our bookshelf hosted on Github pages and mapped to a domain.\n\n## Github repository\n\nThe code for today’s demo application is available on github: [bookshelf](./bookshelf).\n\n## Step 1: Getting started with Hugo\n\nGo to [https://github.com/spf13/hugo/releases](https://github.com/spf13/hugo/releases) and download Hugo for your operating system. If you are on Mac, the you can install using `brew` package manager as well.\n\n```bash\n$ brew update && brew install hugo\n```\n\nOnce `hugo` is installed, make sure to run the `help` command to verify `hugo` installation. Below I am only showing part of the output of the `help` command for brevity.\n\n```bash\n$ hugo help\n```\n```\nhugo is the main command, used to build your Hugo site.\n\nHugo is a Fast and Flexible Static Site Generator\nbuilt with love by spf13 and friends in Go.\n\nComplete documentation is available at http://gohugo.io/.\n```\n\nYou can check `hugo` version using the command shown below.\n\n```bash\n$ hugo version\n```\n```\nHugo Static Site Generator v0.15 BuildDate: 2015-11-26T11:59:00+05:30\n```\n\n> **In this post, we will use the latest version of hugo i.e. version 0.15**\n\n## Step 2: Scaffold bookshelf hugo site\n\nHugo has commands that allows us to quickly scaffold a Hugo managed website. Navigate to a convenient location on your filesystem and create a new Hugo site `bookshelf` by executing the following command.\n\n```bash\n$ hugo new site bookshelf\n```\n\nChange directory to `bookshelf` and you will see the following directory layout.\n\n```bash\n$ tree -a\n```\n```\n.\n|-- archetypes\n|-- config.toml\n|-- content\n|-- data\n|-- layouts\n`-- static\n\n5 directories, 1 file\n```\n\nAs mentioned in the command output, `bookshelf` directory has 5 sub-directories and 1 file. Let's look at each of them one by one.\n\n* **archetypes**: You can create new content files in Hugo using the `hugo new` command. When you run that command, it adds few configuration properties to the post like date and title. [Archetype](https://gohugo.io/content/archetypes/) allows you to define your own configuration properties that will be added to the post front matter whenever `hugo new` command is used.\n\n* **config.toml**: Every website should have a configuration file at the root. By default, the configuration file uses `TOML` format but you can also use `YAML` or `JSON` formats as well. [TOML](https://github.com/toml-lang/toml) is minimal configuration file format that's easy to read due to obvious semantics. The configuration settings mentioned in the `config.toml` are applied to the full site. These configuration settings include `baseurl` and `title` of the website.\n\n* **content**: This is where you will store content of the website. Inside content, you will create sub-directories for different sections. Let's suppose your website has three actions -- `blog`, `article`, and `tutorial` then you will have three different directories for each of them inside the `content` directory. The name of the section i.e. `blog`, `article`, or `tutorial` will be used by Hugo to apply a specific layout applicable to that section.\n\n* **data**: This directory is used to store configuration YAML, JSON,or TOML files that can be used by Hugo when generating your website.\n\n* **layouts**: The content inside this directory is used to specify how your content will be converted into the static website.\n\n* **static**: This directory is used to store all the static content that your website will need like images, CSS, JavaScript or other static content.\n\n## Step 3: Add content\n\nLet's now add a post to our `bookshelf`. We will use the `hugo new` command to add a post. In January, I read [Good To Great](http://www.amazon.com/Good-Great-Some-Companies-Others/dp/0066620996/) book so we will start with creating a post for it. **Make sure you are inside the `bookshelf` directory.**\n\n```bash\n$ hugo new post/good-to-great.md\n```\n```\n/Users/shekhargulati/bookshelf/content/post/good-to-great.md created\n```\n\nThe above command will create a new directory `post` inside the `content` directory and create `good-to-great.md` file inside it.\n\n```bash\n$ tree -a content\n```\n```\ncontent\n`-- post\n    `-- good-to-great.md\n\n1 directory, 1 file\n```\n\nThe content inside the `good-to-great.md` looks like as shown below.\n\n```\n+++\ndate = \"2016-02-14T16:11:58+05:30\"\ndraft = true\ntitle = \"good to great\"\n\n+++\n```\n\nThe content inside `+++` is the TOML configuration for the post. This configuration is called **front matter**. It enables you to define about the post along with the content. Every post has three configuration properties shown above.\n\n* **date** specifies the date and time at which post was created.\n* **draft** specifies that post is not ready for publication yet so it will not be in the generated site\n* **title** specifies title for the post\n\nLet's add a small review for **Good to Great** book.\n\n```\n+++\ndate = \"2016-02-14T16:11:58+05:30\"\ndraft = true\ntitle = \"Good to Great Book Review\"\n\n+++\n\nI read **Good to Great in January 2016**. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.\n```\n\n## Step 4: Serve content\n\nHugo has inbuilt server that can serve content so that you can preview it. You can also use the inbuilt Hugo server in production as well. To serve content, execute the following command.\n\n```bash\n$ hugo server\n```\n```\n0 of 1 draft rendered\n0 future content\n0 pages created\n0 paginator pages created\n0 tags created\n0 categories created\nin 9 ms\nWatching for changes in /Users/shekhargulati/bookshelf/{data,content,layouts,static}\nServing pages from memory\nWeb Server is available at http://localhost:1313/ (bind address 127.0.0.1)\nPress Ctrl+C to stop\n```\n\nThis will start the server on port `1313`. You can view your blog at http://localhost:1313/. When you will go to the link, you will see nothing. There are couple of reasons for that:\n\n1. As you can see in the `hugo server` command output, Hugo didn't rendered the draft. Hugo will only render drafts if you pass `buildDrafts` flag to the `hugo server` command.\n2. We have not specified how Markdown content should be rendered. We have to specify a theme that Hugo can use. We will do that in next step.\n\nTo render drafts, re-run the server with command shown below.\n\n```bash\n$ hugo server --buildDrafts\n```\n```\n1 of 1 draft rendered\n0 future content\n1 pages created\n0 paginator pages created\n0 tags created\n0 categories created\nin 6 ms\nWatching for changes in /Users/shekhargulati/bookshelf/{data,content,layouts,static}\nServing pages from memory\nWeb Server is available at http://localhost:1313/ (bind address 127.0.0.1)\nPress Ctrl+C to stop\n```\n\nIf you go to [http://localhost:1313/](http://localhost:1313/), you will still not view anything as we have not specified theme that Hugo should use.\n\n## Step 5: Add theme\n\nThemes provide the layout and templates that will be used by Hugo to render your website. There are a lot of Open-source themes available at [https://themes.gohugo.io/](https://themes.gohugo.io/) that you can use. From the [Hugo docs](https://gohugo.io/themes/overview/),\n\n> **Hugo currently doesn’t ship with a `default` theme, allowing the user to pick whichever theme best suits their project.**\n\nThemes should be added in the `themes` directory inside the website root. Create new directory themes and change directory to it.\n\n```bash\n$ mkdir themes && cd themes\n```\nNow, you clone one or more themes inside the `themes` directory. We will use robust theme.\n\n```bash\n$ git clone git@github.com:dim0627/hugo_theme_robust.git\n```\n\nStart the server again\n\n```bash\n$ hugo server --theme=hugo_theme_robust --buildDrafts\n```\n```\n1 of 1 draft rendered\n0 future content\n1 pages created\n2 paginator pages created\n0 tags created\n0 categories created\nin 10 ms\nWatching for changes in /Users/shekhargulati/bookshelf/{data,content,layouts,static,themes}\nServing pages from memory\nWeb Server is available at http://localhost:1313/ (bind address 127.0.0.1)\nPress Ctrl+C to stop\n```\n\n> ** If Hugo will not find a specific theme in the `themes` directory then it will throw an exception as shown below.**\n```\nFATAL: 2016/02/14 Unable to find theme Directory: /Users/shekhargulati/bookshelf/themes/robust\n```\n\nTo view your website, you can go to http://localhost:1313/. You will see as shown below.\n\n<img src=\"images/bookshelf-robust-theme.png\" width=\"600\">\n\nLet's understand the layout of a theme. A theme consists of following:\n\n* **theme.toml** is the theme configuration file that gives information about the theme like name and description of theme, author details, theme license.\n\n* **images** directory contains two images -- `screenshot.png` and `tn.png`. `screenshot.png` is the image of the list view and `tn.png` is the single post view.\n\n* **layouts** directory contains different views for different content types. Every content type should have two files single.html and list.html. single.html is used for rendering single piece of content. list.html is used to view a list of content items for example all posts with `programming` tag.\n\n* **static** directory stores all the static assets used by the template. This could JavaScript libraries like jQuery or CSS styles or images or any other static content. This directory will be copied into the final site when rendered.\n\n## Step 6: Use multiple themes\n\nYou can very easy test different layouts by switching between different themes. Let's suppose we want to try out `bleak` theme. We clone `bleak` theme inside the `themes` directory.\n\n```bash\n$ git clone git@github.com:Zenithar/hugo-theme-bleak.git\n```\n\n\nRestart the server using `hugo-theme-bleak`.\n\n```bash\n$ hugo server --theme=hugo-theme-bleak --buildDrafts\n```\n\nNow, website will use `bleak` theme and will be rendered differently as shown below.\n\n<img src=\"images/bookshelf-bleak-theme.png\" width=\"600\">\n\n## Step 7: Update config.toml and live reloading in action\n\nRestart the server with `robust` theme as we will use it in this blog.\n\n```bash\n$ hugo server --theme=hugo_theme_robust --buildDrafts\n```\n\nThe website uses the dummy values specified in the `config.toml`. Let's update the configuration.\n\n```toml\nbaseurl = \"http://replace-this-with-your-hugo-site.com/\"\nlanguageCode = \"en-us\"\ntitle = \"Shekhar Gulati Book Reviews\"\n\n[Params]\n  Author = \"Shekhar Gulati\"\n```\n\nHugo has inbuilt support for live reloading. So, as soon as you save your changes it will apply the change and reload the web page. You will see changes as shown below.\n\n<img src=\"images/bookshelf-updated-config.png\" width=\"600\">\n\nThe same is reflected in the Hugo server logs as well. As soon as the configuration is changed, it applied the changes.\n\n```\nConfig file changed: /Users/shekhargulati/bookshelf/config.toml\n1 of 1 draft rendered\n0 future content\n1 pages created\n2 paginator pages created\n0 tags created\n0 categories created\nin 11 ms\n```\n\n## Step 8: Customize robust theme\n\nRobust theme is a good start towards our online bookshelf but we to customize it a bit to meet the look and feel required for the bookshelf. Hugo makes it very easy to customize themes. You can also create your themes but we will not do that today. If you want to create your own theme, then you should refer to the [Hugo documentation](https://gohugo.io/themes/creation/).\n\nThe first change that we have to make is to use a different default image instead of the one used in the theme. The default image used in both the list and single view page resides inside the `themes/hugo_theme_robust/static/images/default.jpg`. We can easily replace it by creating a simple directory structure inside the `static` directory inside the `bookshelf` directory.\n\nCreate images directory inside the static directory and copy an image with name `default.jpg` inside it. We will use the default image shown below.\n\n<img src=\"images/default.jpg\" width=\"600\">\n\nHugo will sync the changes and reload the website to use new image as shown below.\n\n<img src=\"images/bookshelf-new-default-image.png\" width=\"600\">\n\nNow, we need to change the layout of the index page so that only images are shown instead of the text. The index.html inside the layouts directory of the theme refer to partial `li` that renders the list view shown below.\n\n```html\n<article class=\"li\">\n  <a href=\"{{ .Permalink }}\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url({{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }});\"></div>\n    <div class=\"detail\">\n      <time>{{ with .Site.Params.DateForm }}{{ $.Date.Format . }}{{ else }}{{ $.Date.Format \"Mon, Jan 2, 2006\" }}{{ end }}</time>\n      <h2 class=\"title\">{{ .Title }}</h2>\n      <div class=\"summary\">{{ .Summary }}</div>\n    </div>\n  </a>\n</article>\n```\n\nCreate a new file li.html inside the `bookshelf/layouts/_default` directory. Copy the content shown below into the li.html. We have removed details of the book so that only image is shown.\n\n```html\n<article class=\"li\">\n  <a href=\"{{ .Permalink }}\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url({{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }});\"></div>\n  </a>\n</article>\n```\n\nNow, the website will be rendered as shown below.\n\n<img src=\"images/bookshelf-only-picture.png\" width=\"600\">\n\n\nNext, we want to remove information related to theme from the footer. So, create a new file inside the `partials/default_foot.html` with the content copied from the theme `partials/default_foot.html`. Replace the footer section with the one shown below.\n\n```html\n<footer class=\"site\">\n  <p>{{ with .Site.Copyright | safeHTML }}{{ . }}{{ else }}&copy; {{ $.Site.LastChange.Year }} {{ if isset $.Site.Params \"Author\" }}{{ $.Site.Params.Author }}{{ else }}{{ .Site.Title }}{{ end }}{{ end }}</p>\n  <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n</footer>\n```\n\nWe also have to remove the sidebar on the right. Copy the index.html from the themes layout directory to the bookshelf layouts directory. Remove the section related to sidebar from the html.\n\n```html\n<div class=\"col-sm-3\">\n  {{ partial \"sidebar.html\" . }}\n</div>\n```\n\nSo far we are using the default image but we would like to use the book image so that we can relate to the book. Every book review will define a configuration setting in its front matter. Update the `good-to-great.md` as shown below.\n\n\n```\n+++\ndate = \"2016-02-14T16:11:58+05:30\"\ndraft = true\ntitle = \"Good to Great Book Review\"\nimage = \"good-to-great.jpg\"\n+++\n\nI read **Good to Great in January 2016**. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.\n```\n\nAfter adding few more books to our shelf, the shelf looks like as shown below. These are few books that I have read within last one year.\n\n<img src=\"images/bookshelf.png\" width=\"600\">\n\n\n## Step 9: Make posts public\n\nSo far all the posts that we have written are in draft status. To make a draft public, you can either run a command or manually change the draft status in the post to True.\n\n```bash\n$ hugo undraft content/post/good-to-great.md\n```\n\nNow, you can start the server without `buildDrafts` option.\n\n```\n$ hugo server --theme=hugo_theme_robust\n```\n\n## Step 10: Integrate Disqus\n\nDisqus allows you to integrate comments in your static blog. To enable Disqus, you just have to set `disqusShortname`  in the config.toml as shown below.\n\n```\n[Params]\n  Author = \"Shekhar Gulati\"\n  disqusShortname = \"shekhargulati\"\n```\n\nNow, commenting will be enabled in your blog.\n\n<img src=\"images/bookshelf-disqus.png\" width=\"600\">\n\n## Step 11: Generate website\n\nTo generate Hugo website code that you can use to deploy your website, type the following command.\n\n```bash\n$ hugo --theme=hugo_theme_robust\n0 draft content\n0 future content\n5 pages created\n2 paginator pages created\n0 tags created\n0 categories created\nin 17 ms\n```\n\n> **Make sure to change the baseurl. For my bookshelf on Github pages, url is [https://shekhargulati.github.io/bookshelf](https://shekhargulati.github.io/bookshelf)**\n\nAfter you run the hugo command, a public directory will be created with the generated website source.\n\n\n## Step 12: Deploy bookshelf on Github pages\n\nCreate a new repository with name `bookshelf` on Github. Once created, create a new Git repo on local system and add remote.\n\n```bash\n$ mkdir bookshelf-public\n$ cd bookshelf-public\n$ git init\n$ git remote add origin git@github.com:shekhargulati/bookshelf.git\n```\n\nCopy the content of the `public` directory to the `bookshelf-public` directory. Run this command from with in the `bookshelf-public` directory.\n\n```bash\n$ cp -r ../bookshelf/public/ .\n```\n\nCreate new branch `gh-pages` and checkout it.\n\n```bash\n$ git checkout -b gh-pages\nSwitched to a new branch 'gh-pages'\n```\n\nAdd all the files to the index, commit them, and push the changes to Github.\n\n```bash\n$ git add --all\n$ git commit -am \"bookshelf added\"\n$ git push origin gh-pages\n```\n\nIn couple of minutes, your website will be live https://shekhargulati.github.io/bookshelf/.\n\n----\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/10](https://github.com/shekhargulati/52-technologies-in-2016/issues/10).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/07-hugo)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "07-hugo/bookshelf/config.toml",
    "content": "baseurl = \"http://example.com\"\nlanguageCode = \"en-us\"\ntitle = \"Shekhar Gulati Bookshelf\"\n\n[Params]\n  Author = \"Shekhar Gulati\"\n  disqusShortname = \"shekhargulati\"\n  GoogleAnalyticsUserID = \"UA-73784822-1\"\n"
  },
  {
    "path": "07-hugo/bookshelf/content/post/art-of-thinking-clearly.md",
    "content": "+++\ndate = \"2016-02-14T19:10:29+05:30\"\ndraft = false\ntitle = \"art of thinking clearly\"\nimage = \"art-of-thinking-clearly.jpg\"\n+++\n"
  },
  {
    "path": "07-hugo/bookshelf/content/post/confessions-of-a-public-speaker.md",
    "content": "+++\ndate = \"2016-02-14T19:10:48+05:30\"\ndraft = false\ntitle = \"confessions of a public speaker\"\nimage = \"confessions-of-a-public-speaker.png\"\n+++\n"
  },
  {
    "path": "07-hugo/bookshelf/content/post/good-to-great.md",
    "content": "+++\ndate = \"2016-02-14T19:23:40+05:30\"\ndraft = false\ntitle = \"Good to Great Book Review\"\nimage = \"good-to-great.jpg\"\n+++\n\nI read **Good to Great in January 2016**. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.\n"
  },
  {
    "path": "07-hugo/bookshelf/content/post/hen-who-dreamed-she-could-fly.md",
    "content": "+++\ndate = \"2016-02-14T19:06:04+05:30\"\ndraft = false\ntitle = \"Hen Who Dreamed She Could Fly\"\nimage = \"hen-who-dreamed.jpg\"\n+++\n\n\nIn February 2016, I read **The Hen Who Dreamed She Could Fly**. This short book is an amazing  and inspiring story of a hen Sprout who wanted to live a normal happy life outside of a coop. The lesson I learnt from this book is that you have to break shackles and work towards a life that you want to live. If you believe in your dreams and don’t give up then you will live a life worth living.\n"
  },
  {
    "path": "07-hugo/bookshelf/content/post/seven-habbits-of-highly-effective-people.md",
    "content": "+++\ndate = \"2016-02-14T19:11:05+05:30\"\ndraft = false\ntitle = \"seven habbits of highly effective people\"\nimage = \"seven-habits-of-highly-effective-people.jpg\"\n+++\n"
  },
  {
    "path": "07-hugo/bookshelf/layouts/_default/li.html",
    "content": "<article class=\"li\">\n  <a href=\"{{ .Permalink }}\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url({{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }});\"></div>\n  </a>\n</article>\n"
  },
  {
    "path": "07-hugo/bookshelf/layouts/index.html",
    "content": "<div class=\"index\">\n  {{ partial \"default_head.html\" . }}\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <div class=\"articles\">\n        <div class=\"row\">\n          {{ range $key, $value := .Paginator.Pages }}\n          <div class=\"col-sm-{{ if lt $key 4 }}6{{ else }}4{{ end }}\">\n            {{ .Render \"li\" }}\n          </div>\n          {{ end }}\n        </div>\n      </div>\n\n      {{ partial \"pagination.html\" . }}\n\n    </div>\n\n  </div>\n  {{ partial \"default_foot.html\" . }}\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf/layouts/partials/default_foot.html",
    "content": "    </div>\n\n    <footer class=\"site\">\n      <p>{{ with .Site.Copyright | safeHTML }}{{ . }}{{ else }}&copy; {{ $.Site.LastChange.Year }} {{ if isset $.Site.Params \"Author\" }}{{ $.Site.Params.Author }}{{ else }}{{ .Site.Title }}{{ end }}{{ end }}</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    {{ with .Site.Params.GoogleAnalyticsUserID }}\n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', '{{ . }}', 'auto');\n    ga('send', 'pageview');\n    </script>\n    {{ end }}\n\n  </body>\n</html>\n"
  },
  {
    "path": "07-hugo/bookshelf/layouts/partials/default_head.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    {{ .Hugo.Generator }}\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/{{ with .Site.Params.SyntaxHighlightTheme }}{{ . }}{{ else  }}solarized_dark.min.css{{ end }}\">\n    <link rel=\"stylesheet\" href=\"/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"{{ .Site.BaseURL }}index.xml\">\n\n    {{ if eq .URL \"/\" }}\n    <title>{{ .Title }}</title>\n    <meta property='og:title' content=\"{{ .Title }}\">\n    <meta property=\"og:type\" content=\"website\">\n    {{ else }}\n    <title>{{ .Title }} - {{ .Site.Title }}</title>\n    <meta property='og:title' content=\"{{ .Title }} - {{ .Site.Title }}\">\n    <meta property=\"og:type\" content=\"article\">\n    {{ end }}\n\n    <meta property=\"og:url\" content=\"{{ .Permalink }}\">\n    {{ with .Description }}<meta name=\"description\" content=\"{{ . }}\">{{ end }}\n    {{ with .Params.image }}<meta property=\"og:image\" content=\"{{ $.Site.BaseURL }}images/{{ . }}\">{{ end }}\n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"{{ .Site.BaseURL }}\">{{ .Site.Title }}</a></div>\n    </header>\n\n    <div class=\"container site\">\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/.gitignore",
    "content": "public/\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/LICENSE.md",
    "content": "# The MIT License (MIT)\n\nCopyright (c) 2015 Daisuke Tsuji.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/README.md",
    "content": "![screenshot](https://raw.githubusercontent.com/dim0627/hugo_theme_aglaus/master/images/screenshot.png)\n\n# Features\n\n* Google Analytics\n* Disqus\n* Share Buttons(fb, twitter, google+, pocket)\n* Eye-catching Image\n* MicroData\n* Readable text(Customized Vertical Rhythm).\n\n# Installation\n\n[hugoThemes#Installing Themes](https://github.com/spf13/hugoThemes#installing-themes).\n\n# Configuration\n\n**config.yaml**\n\n``` toml\nbaseurl = \"http://hugo.spf13.com/\"\ntitle = \"Hugo Themes\"\nauthor = \"Steve Francia\"\ncopyright = \"Copyright (c) 2008 - 2014, Steve Francia; all rights reserved.\"\ncanonifyurls = true\npaginate = 3\n\n[params]\n  disqusShortname = \"your disqus id.\" # optional\n```\n\n**example post**\n\n``` toml\n+++\ntitle = \"Getting Started with Hugo\"\ndescription = \"\"\ntags = [\n    \"go\",\n    \"golang\",\n    \"hugo\",\n    \"development\",\n]\ndate = \"2014-04-02\"\ncategories = [\n    \"Development\",\n    \"golang\",\n]\n\nimage = \"image.jpg\" # optional\ntoc = false # optional, When set to FALSE this parameter, table of contents not appears in only this article.\n+++\n\nContents here\n```\n\n# Contact us\n\nPlease mail to `dim0627@gmail.com` or SNS.\n\n[https://www.facebook.com/daisuke.tsuji.735](https://www.facebook.com/daisuke.tsuji.735)\n\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/config.yaml",
    "content": "BaseURL: \"http://example.com\"\nLanguageCode: \"en-us\"\nTitle: \"Robust\"\n\nParams:\n  Author: \"Your name.\"\n  Birth: \"Sun, Feb 26, 1989\"\n  DateForm: \"Mon, Jan 2, 2006\"\n  GoogleAnalyticsUserID: \"Your ID.\"\n  GravatarHash: \"Your Hash.\"\n  Facebook: \"Your ID.\"\n  Twitter: \"Your ID.\"\n  Github: \"Your ID.\"\n  Disqus: \"Your Disqus.\"\n  SyntaxHighlightTheme: \"solarized_dark.min.css\"\n  ShowRelatedPost: True\n  ShowTagCloud: True\n\nIndexes:\n  tag: \"tags\"\n\npermalinks:\n  post: /blog/:year/:month/:day/:title/\n\nMetadataFormat: \"yaml\"\n\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/_default/li.html",
    "content": "<article class=\"li\">\n  <a href=\"{{ .Permalink }}\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url({{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }});\"></div>\n    <div class=\"detail\">\n      <time>{{ with .Site.Params.DateForm }}{{ $.Date.Format . }}{{ else }}{{ $.Date.Format \"Mon, Jan 2, 2006\" }}{{ end }}</time>\n      <h2 class=\"title\">{{ .Title }}</h2>\n      <div class=\"summary\">{{ .Summary }}</div>\n    </div>\n  </a>\n</article>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/_default/list.html",
    "content": "<div class=\"list\">\n  {{ partial \"default_head.html\" . }}\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <header class=\"title\"><h1>{{ .Title }}</h1></header>\n\n      <div class=\"articles\">\n        <div class=\"row\">\n          {{ range (.Paginate .Data.Pages).Pages }}\n          <div class=\"col-sm-4\">\n            {{ .Render \"li\" }}\n          </div>\n          {{ end }}\n        </div>\n      </div>\n\n      {{ partial \"pagination.html\" . }}\n\n    </div>\n\n    <div class=\"col-sm-3\">\n      {{ partial \"sidebar.html\" . }}\n    </div>\n\n  </div>\n  {{ partial \"default_foot.html\" . }}\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/_default/single.html",
    "content": "<div class=\"single\">\n  {{ partial \"default_head.html\" . }}\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <article class=\"single\" itemscope=\"itemscope\" itemtype=\"http://schema.org/Article\">\n\n        <meta itemprop=\"mainEntityOfPage\"  itemType=\"https://schema.org/WebPage\" content=\"{{ .Site.BaseURL }}\"/>\n        <meta itemprop=\"dateModified\" content=\"{{ .Date.Format \"2006-01-02T15:04:05-07:00\" }}\">\n        <meta itemprop=\"headline\" content=\"{{ .Title }}\">\n        <meta itemprop=\"description\" content=\"{{ .Summary }}\">\n        <meta itemprop=\"url\" content=\"{{ .Permalink }}\">\n        <div itemprop=\"image\" itemscope itemtype=\"https://schema.org/ImageObject\">\n          <meta itemprop=\"url\" content=\"{{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }}\" />\n          <meta itemprop=\"width\" content=\"800\">\n          <meta itemprop=\"height\" content=\"800\">\n        </div>\n        <div itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\">\n          <div itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\">\n            <meta itemprop=\"url\" content=\"{{ .Site.BaseURL }}images/logo.jpg\">\n            <meta itemprop=\"width\" content=\"100\">\n            <meta itemprop=\"height\" content=\"100\">\n          </div>\n          <meta itemprop=\"name\" content=\"{{ .Site.Title }}\">\n        </div>\n        <div itemprop=\"author\" itemscope itemtype=\"https://schema.org/Person\">\n          <meta itemprop=\"name\" content=\"{{ .Site.Params.Author }}\">\n        </div>\n\n        <div class=\"image\" style=\"background-image: url({{ $.Site.BaseURL }}images/{{ with .Params.image }}{{ . }}{{ else }}default.jpg{{ end }});\"></div>\n\n        <header class=\"article-header\">\n          <time itemprop=\"datePublished\" pubdate=\"pubdate\" datetime=\"{{ .Date.Format \"2006-01-02T15:04:05-07:00\" }}\">{{ with .Site.Params.DateForm }}{{ $.Date.Format . }}{{ else }}{{ $.Date.Format \"Mon, Jan 2, 2006\" }}{{ end }}</time>\n          <h1 class=\"article-title\">{{ .Title }}</h1>\n        </header>\n\n        <div class=\"article-body\" itemprop=\"articleBody\">\n          {{ .Content }}\n        </div>\n\n\n        <aside>\n          {{ with .Params.tags }}<div class=\"section\">{{ range . }}<a href=\"{{ $.Site.BaseURL}}tags/{{ . }}\" class=\"tag\">{{ . }}</a> {{ end }}</div>{{ end }}\n\n          <div class=\"section share\">\n            <a href=\"http://www.facebook.com/sharer.php?src=bm&u={{ .Permalink }}&t={{ .Title }}\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-facebook\"></i></a>\n            <a href=\"http://twitter.com/intent/tweet?url={{ .Permalink }}&text={{ .Title }}&tw_p=tweetbutton\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-twitter\"></i></a>\n            <a href=\"https://plus.google.com/share?url={{ .Permalink }}\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-google-plus\"></i></a>\n            <a href=\"http://getpocket.com/edit?url={{ .Permalink }}&title={{ .Title }}\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-get-pocket\"></i></a>\n          </div>\n\n          {{ if and (ne .Site.Params.comment false) (ne .Params.comment false) }}\n          {{ with .Site.Params.disqusShortname }}\n          <div id=\"disqus_thread\"></div>\n          <script type=\"text/javascript\">\n(function() {\n  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n  var disqus_shortname = '{{ . }}';\n  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';\n  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n})();\n          </script>\n          <noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n          <a href=\"http://disqus.com/\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>\n          {{ end }}\n          {{ end }}\n        </aside>\n\n      </article>\n    </div>\n\n    <div class=\"col-sm-3\">\n      {{ partial \"sidebar.html\" . }}\n    </div>\n\n  </div>\n\n  {{ partial \"default_foot.html\" . }}\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/_default/terms.html",
    "content": "<div class=\"list\">\n  {{ partial \"default_head.html\" . }}\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <header class=\"title\"><h1>{{ .Title }}</h1></header>\n\n      {{ range $key, $value := .Data.Terms }}\n      <a href=\"/{{ $.Data.Plural }}/{{ $key | urlize }}/\" class=\"{{ $.Data.Singular }}\">{{ $key }}</a>\n      {{ end }}\n\n    </div>\n\n    <div class=\"col-sm-3\">\n      {{ partial \"sidebar.html\" . }}\n    </div>\n\n  </div>\n  {{ partial \"default_foot.html\" . }}\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/index.html",
    "content": "<div class=\"index\">\n  {{ partial \"default_head.html\" . }}\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <div class=\"articles\">\n        <div class=\"row\">\n          {{ range $key, $value := .Paginator.Pages }}\n          <div class=\"col-sm-{{ if lt $key 4 }}6{{ else }}4{{ end }}\">\n            {{ .Render \"li\" }}\n          </div>\n          {{ end }}\n        </div>\n      </div>\n\n      {{ partial \"pagination.html\" . }}\n\n    </div>\n\n    <div class=\"col-sm-3\">\n      {{ partial \"sidebar.html\" . }}\n    </div>\n\n  </div>\n  {{ partial \"default_foot.html\" . }}\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/partials/default_foot.html",
    "content": "    </div>\n\n    <footer class=\"site\">\n      <p>{{ with .Site.Copyright | safeHTML }}{{ . }}{{ else }}&copy; {{ $.Site.LastChange.Year }} {{ if isset $.Site.Params \"Author\" }}{{ $.Site.Params.Author }}{{ else }}{{ .Site.Title }}{{ end }}{{ end }}</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n      <p>Theme <a href=\"https://github.com/dim0627/hugo_theme_robust\" target=\"_blank\">Robust</a> designed by <a href=\"http://yet.unresolved.xyz\" target=\"_blank\">Daisuke Tsuji</a></p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    {{ with .Site.Params.GoogleAnalyticsUserID }}\n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', '{{ . }}', 'auto');\n    ga('send', 'pageview');\n    </script>\n    {{ end }}\n\n  </body>\n</html>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/partials/default_head.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    {{ .Hugo.Generator }}\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/{{ with .Site.Params.SyntaxHighlightTheme }}{{ . }}{{ else  }}solarized_dark.min.css{{ end }}\">\n    <link rel=\"stylesheet\" href=\"/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"{{ .Site.BaseURL }}/index.xml\">\n\n    {{ if eq .URL \"/\" }}\n    <title>{{ .Title }}</title>\n    <meta property='og:title' content=\"{{ .Title }}\">\n    <meta property=\"og:type\" content=\"website\">\n    {{ else }}\n    <title>{{ .Title }} - {{ .Site.Title }}</title>\n    <meta property='og:title' content=\"{{ .Title }} - {{ .Site.Title }}\">\n    <meta property=\"og:type\" content=\"article\">\n    {{ end }}\n\n    <meta property=\"og:url\" content=\"{{ .Permalink }}\">\n    {{ with .Description }}<meta name=\"description\" content=\"{{ . }}\">{{ end }}\n    {{ with .Params.image }}<meta property=\"og:image\" content=\"{{ $.Site.BaseURL }}images/{{ . }}\">{{ end }}\n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"{{ .Site.BaseURL }}\">{{ .Site.Title }}</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/partials/pagination.html",
    "content": "{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}\n<nav class=\"paging\">\n  {{ if .Paginator.HasPrev }}\n  <a href=\"{{ .URL }}page/{{ .Paginator.Prev.PageNumber }}\" class=\"left\" rel=\"prev\">PREV</a>\n  {{ end }}\n\n  {{ if .Paginator.HasNext }}\n  <a href=\"{{ .URL }}page/{{ .Paginator.Next.PageNumber }}\" class=\"right\" rel=\"next\">NEXT</a>\n  {{ end }}\n</nav>\n{{ end }}\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/partials/sidebar.html",
    "content": "<aside class=\"site\">\n\n  {{ if and .IsPage (ne .Params.toc false) }}\n  <div class=\"section\">\n    <header><div class=\"title\">TableOfContents</div></header>\n    <div class=\"list-default\">{{ .TableOfContents }}</div>\n  </div>\n  {{ end }}\n\n  {{ if ne (len .Site.Menus) 0 }}\n  <div class=\"section menu\">\n    <header><div class=\"title\">Menu</div></header>\n\n    {{ range .Site.Menus }}\n    <ul>\n      {{ range . }}\n      <li>\n        {{ if .HasChildren }}\n        <a href=\"#\">{{ .Pre }} {{ .Name }}</a>\n        <ul>\n          {{ range .Children }}\n          <li><a href=\"{{ .URL }}\">{{ .Name }}</a></li>\n          {{ end }}\n        </ul>\n      </li>\n      {{ else }}\n      <li><a href=\"{{ .URL }}\">{{ .Pre }} {{ .Name }}</a></li>\n      {{ end }}\n      {{end}}\n    </ul>\n    {{end}}\n\n  </div>\n  {{ end }}\n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      {{ range first 10 .Site.Pages }}\n      <div class=\"sm\">{{ .Render \"li\" }}</div>\n      {{ end }}\n    </div>\n  </div>\n\n  {{ range $key, $value := .Site.Taxonomies }}\n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">{{ $key | singularize }}</div></header>\n    <div class=\"content\">\n      {{ range first 10 $value.ByCount }}<a href=\"{{ $.Site.BaseURL}}{{ $key }}/{{ .Name | urlize }}\">{{ .Name }}</a>{{ end }}\n    </div>\n  </div>\n  {{ end }}\n\n</aside>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/layouts/rss.xml",
    "content": "<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n  <channel>\n    <title>{{ .Site.Title }} </title>\n    <link>{{ .Permalink }}</link>\n    <language>en-us</language>\n    <author>{{ .Site.Params.Author }}</author>\n    <rights>(C) {{ .Site.LastChange.Year }}</rights>\n    <updated>{{ .Date }}</updated>\n\n    {{ range .Data.Pages }}\n      {{ if eq .Type \"post\"}}\n        <item>\n          <title>{{ .Title }}</title>\n          <link>{{ .Permalink }}</link>\n          <pubDate>{{ .Date.Format \"Mon, 02 Jan 2006 15:04:05 MST\" }}</pubDate>\n          <author>{{ .Site.Params.Author }}</author>\n          <guid>{{ .Permalink }}</guid>\n          <description>{{ .Content | html }}</description>\n        </item>\n      {{ end }}\n    {{ end }}\n\n  </channel>\n</rss>\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/static/css/custom.css",
    "content": ""
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/static/css/styles.css",
    "content": "html {\n  font-size: 16px;\n}\n\nbody {\n  font-family: 'Open Sans', \"ヒラギノ角ゴシック Pro\", \"Hiragino Kaku Gothic Pro\", メイリオ, Meiryo, Osaka, \"ＭＳ Ｐゴシック\", \"MS PGothic\", sans-serif;\n  -webkit-font-smoothing: antialiased;\n  font-size: inherit;\n  color: #000;\n  background-color: #fafafa;\n}\n\n@media (max-width: 768px) {\n  html {\n    font-size: 14px;\n  }\n}\n\nhtml,\nbody {\n  margin: 0;\n}\n\na {\n  transition-duration: .2s;\n  color: #000;\n  text-decoration: underline;\n}\n\na:hover,\na:focus,\na:active {\n  color: #000;\n  outline: none;\n  box-shadow: none;\n}\n\na.tag {\n  font-size: .8rem;\n  line-height: 1rem;\n  color: #999;\n}\n\na.tag:hover {\n  color: #333;\n}\n\ncode:not(.hljs) {\n  background-color: #f5f5f5;\n  border-bottom: 1px solid #ddd;\n  color: #000;\n  font-size: .8rem;\n  border-radius: 2px;\n}\n\ncode, pre {\n  font-size: .8rem;\n  line-height: 1rem;\n}\n\nimg {\n  width: 100%;\n}\n\nh1, h2, h3, h4, h5 ,h6 { margin: 0; }\nh1 { font-size: 1.6rem; line-height: 2rem; }\nh2 { font-size: 1.4rem; line-height: 2rem; }\nh3 { font-size: 1.1rem; line-height: 2rem; }\nh4 { font-size: 1rem; line-height: 1rem; }\nh5 { font-size: 1rem; line-height: 1rem; }\n\nheader.site {\n  padding: 2rem 0;\n  text-align: center;\n  background-color: #fff;\n  margin-bottom: 2rem;\n}\n\nheader.site .title {\n  font-family: 'Marcellus SC', cursive;\n  font-size: 2rem;\n}\n\nheader.site .title a {\n  text-decoration: none;\n}\n\nfooter.site {\n  padding: 3rem 0;\n  text-align: center;\n}\n\nfooter.site p {\n  font-size: .8rem;\n  margin-bottom: .5rem;\n  color: #999;\n}\n\n@media (max-width: 768px) {\n  aside.site {\n    margin-top: 3rem;\n  }\n}\n\naside.site .section {\n  margin-bottom: 1.5rem;\n}\n\naside.site .section header {\n  box-shadow: 0 -1px 0 #eee inset;\n  margin-bottom: 1rem;\n}\n\naside.site .section header .title {\n  position: relative;\n  display: inline-block;\n  border-bottom: 1px solid #000;\n  padding: .5rem 0;\n  padding-right: 1rem;\n}\n\naside.site .section header .title:before {\n  position: absolute;\n  left: 10px;\n  bottom: -11px;\n  content: '';\n  border-top: 5px solid #000;\n  border-right: 5px solid transparent;\n  border-bottom: 5px solid transparent;\n  border-left: 5px solid transparent;\n}\n\ndiv.list header.title {\n  margin-bottom: 2rem;\n}\n\narticle.li {\n  margin-bottom: 2rem;\n  background-color: #fff;\n}\n\narticle.li .detail {\n  padding: 1rem;\n}\n\narticle.li a {\n  position: relative;\n  text-decoration: none;\n  display: block;\n}\n\narticle.li .image {\n  height: 12rem;\n  background-color: #eee;\n  background-position: center;\n  background-size: cover;\n}\n\narticle.li time {\n  position: absolute;\n  top: -5px;\n  left: 15px;\n  display: block;\n  z-index: 1;\n  white-space: nowrap;\n  padding: 3px 7px;\n  color: #fff;\n  background-color: #333;\n  border-bottom: 2px solid #000;\n  font-size: .7rem;\n  line-height: 1rem;\n}\n\narticle.li .title {\n  white-space: nowrap;\n  text-overflow: ellipsis;\n  overflow: hidden;\n}\n\narticle.li .summary {\n  word-break: break-all;\n  height: 5rem;\n  overflow: hidden;\n  color: #999;\n  font-size: .8rem;\n  line-height: 1rem;\n}\n\n@media (min-width: 767px) {\n  .articles .col-sm-4 article.li .image {\n    height: 10rem;\n  }\n\n  .articles .col-sm-4 article.li .title {\n    font-size: 1.2rem;\n  }\n\n  .articles .col-sm-4 article.li .detail {\n    padding: .5rem;\n  }\n}\n\n.sm article.li {\n  margin-bottom: .5rem;\n  background-color: transparent;\n}\n\n.sm article.li .detail {\n  display: table-cell;\n  padding: 0;\n  padding-left: .5rem;\n  height: 50px;\n  vertical-align: middle;\n}\n\n.sm article.li .title {\n  white-space: normal;\n}\n\n.sm article.li .image {\n  float: left;\n  width: 50px;\n  height: 50px;\n}\n\n.sm article.li time {\n  position: relative;\n  display: block;\n  top: auto;\n  left: auto;\n  padding: 0;\n  background-color: transparent;\n  color: #999;\n  line-height: 1rem;\n  font-size: .8rem;\n  border-bottom: none;\n}\n\n.sm article.li .title {\n  line-height: 1rem;\n  font-size: .8rem;\n}\n\n.sm article.li .summary {\n  display: none;\n}\n\narticle.single {\n  background-color: #fff;\n}\n\narticle.single .article-header {\n  padding: 2rem;\n}\n\n@media (max-width: 768px) {\n  article.single .article-header {\n    padding: 1rem;\n    padding-bottom: 2rem;\n  }\n}\n\narticle.single .image {\n  height: 24rem;\n  background-color: #eee;\n  background-position: center;\n  background-size: cover;\n}\n\n@media (max-width: 768px) {\n  article.single .image {\n    height: 12rem;\n  }\n}\n\narticle.single .article-body {\n  max-width: 650px;\n  margin: 0 auto;\n  padding: 0 1rem;\n}\n\narticle.single .article-body h1,\narticle.single .article-body h2,\narticle.single .article-body h3,\narticle.single .article-body h4,\narticle.single .article-body h5,\narticle.single .article-body h6 {\n  word-break: break-all;\n}\n\narticle.single .article-body h1:first-child,\narticle.single .article-body h2:first-child,\narticle.single .article-body h3:first-child,\narticle.single .article-body h4:first-child,\narticle.single .article-body h5:first-child,\narticle.single .article-body h6:first-child {\n  margin-top: 0;\n}\n\narticle.single .article-body h1 {\n  margin-top: 4rem;\n  margin-bottom: 1rem;\n  font-weight: 900;\n}\n\narticle.single .article-body h2 {\n  margin-top: 3rem;\n  margin-bottom: 1rem;\n}\n\narticle.single .article-body h3 {\n  margin-top: 2rem;\n  margin-bottom: 1rem;\n  font-weight: 900;\n}\n\narticle.single .article-body h3,\narticle.single .article-body h4,\narticle.single .article-body h5,\narticle.single .article-body h6 {\n  margin-top: 2rem;\n  margin-bottom: .5rem;\n}\n\narticle.single .article-body p {\n  line-height: 1.5rem;\n  margin-bottom: 1rem;\n  word-break: break-word;\n}\n\narticle.single .article-body ul,\narticle.single .article-body ol {\n  padding-left: 1.5rem;\n}\n\narticle.single .article-body blockquote {\n  padding: .5rem;\n  border-left: none;\n  background-color: #eee;\n  font-size: .8rem;\n}\n\narticle.single .article-body blockquote p {\n  line-height: 1rem;\n}\n\narticle.single .article-body blockquote p:last-child {\n  margin-bottom: 0;\n}\n\narticle.single .article-body pre {\n  padding: 0;\n  border: none;\n  border-radius: 0;\n}\n\narticle.single .article-body pre code {\n  font-size: .8rem;\n  line-height: 1rem;\n  padding: 1rem;\n}\n\n#TableOfContents {\n  font-size: .8rem;\n  line-height: 1.5rem;\n}\n\n#TableOfContents a {\n  display: block;\n}\n\n#TableOfContents ul ul a {\n  text-decoration: none;\n}\n\n#TableOfContents>ul {\n  padding-left: 0;\n  list-style: none;\n}\n\n#TableOfContents>ul>li {\n  font-weight: 900;\n  margin-bottom: 1rem;\n}\n\n#TableOfContents>ul ul {\n  padding-left: 0;\n  font-weight: normal;\n  list-style: none;\n}\n\n#TableOfContents>ul ul ul {\n  padding-left: 1rem;\n  list-style: none;\n}\n\n.section.menu {\n  line-height: 1.5rem;\n}\n\n.section.menu a {\n  display: block;\n}\n\n.section.menu ul {\n  font-size: .8rem;\n  list-style: none;\n  padding-left: 0;\n}\n\n.section.menu ul a {\n  text-decoration: none;\n}\n\n.section.menu ul ul {\n  padding-left: 1rem;\n}\n\n.section.taxonomies a {\n  display: block;\n  font-size: .8rem;\n  text-decoration: none;\n  line-height: 1.5rem;\n}\n\n.section.taxonomies a:before {\n  content: '\\f105';\n  font-family: 'Fontawesome';\n  margin-right: 5px;\n}\n\narticle.single aside {\n  padding: 2rem;\n}\n\n@media (max-width: 768px) {\n  article.single aside {\n    padding: 1rem;\n  }\n}\n\narticle.single aside .section {\n  margin-bottom: 2rem;\n}\n\nnav.paging {\n  position: relative;\n  min-height: 5rem;\n}\n\nnav.paging a {\n  text-decoration: none;\n  display: inline-block;\n  padding: 5px 10px;\n  background-color: #333;\n  border-bottom: 2px solid #000;\n  color: #fff;\n}\n\nnav.paging .left,\nnav.paging .right {\n  position: absolute;\n}\n\nnav.paging .right {\n  right: 0;\n}\n\n.share {\n  text-align: right;\n}\n\n.share a {\n  display: inline-block;\n  color: #999;\n  padding: 0 .5rem;\n}\n\n"
  },
  {
    "path": "07-hugo/bookshelf/themes/hugo_theme_robust/theme.toml",
    "content": "name = \"Robust\"\nlicense = \"MIT\"\nlicenselink = \"https://github.com/dim0627/hugo_theme_robust/blob/master/LICENSE.md\"\ndescription = \"Robust is blog theme for hugo.\"\ntags = [\"blog\"]\nfeatures = [\"blog\"]\nmin_version = 0.15\n\n[author]\n    name = \"Daisuke Tsuji\"\n    homepage = \"http://yet.unresolved.xyz/\"\n\n"
  },
  {
    "path": "07-hugo/bookshelf-public/404.html",
    "content": ""
  },
  {
    "path": "07-hugo/bookshelf-public/categories/index.html",
    "content": "<div class=\"list\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>Categories - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"Categories - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/categories/\">\n    \n    \n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <header class=\"title\"><h1>Categories</h1></header>\n\n      \n\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/css/custom.css",
    "content": ""
  },
  {
    "path": "07-hugo/bookshelf-public/css/styles.css",
    "content": "html {\n  font-size: 16px;\n}\n\nbody {\n  font-family: 'Open Sans', \"ヒラギノ角ゴシック Pro\", \"Hiragino Kaku Gothic Pro\", メイリオ, Meiryo, Osaka, \"ＭＳ Ｐゴシック\", \"MS PGothic\", sans-serif;\n  -webkit-font-smoothing: antialiased;\n  font-size: inherit;\n  color: #000;\n  background-color: #fafafa;\n}\n\n@media (max-width: 768px) {\n  html {\n    font-size: 14px;\n  }\n}\n\nhtml,\nbody {\n  margin: 0;\n}\n\na {\n  transition-duration: .2s;\n  color: #000;\n  text-decoration: underline;\n}\n\na:hover,\na:focus,\na:active {\n  color: #000;\n  outline: none;\n  box-shadow: none;\n}\n\na.tag {\n  font-size: .8rem;\n  line-height: 1rem;\n  color: #999;\n}\n\na.tag:hover {\n  color: #333;\n}\n\ncode:not(.hljs) {\n  background-color: #f5f5f5;\n  border-bottom: 1px solid #ddd;\n  color: #000;\n  font-size: .8rem;\n  border-radius: 2px;\n}\n\ncode, pre {\n  font-size: .8rem;\n  line-height: 1rem;\n}\n\nimg {\n  width: 100%;\n}\n\nh1, h2, h3, h4, h5 ,h6 { margin: 0; }\nh1 { font-size: 1.6rem; line-height: 2rem; }\nh2 { font-size: 1.4rem; line-height: 2rem; }\nh3 { font-size: 1.1rem; line-height: 2rem; }\nh4 { font-size: 1rem; line-height: 1rem; }\nh5 { font-size: 1rem; line-height: 1rem; }\n\nheader.site {\n  padding: 2rem 0;\n  text-align: center;\n  background-color: #fff;\n  margin-bottom: 2rem;\n}\n\nheader.site .title {\n  font-family: 'Marcellus SC', cursive;\n  font-size: 2rem;\n}\n\nheader.site .title a {\n  text-decoration: none;\n}\n\nfooter.site {\n  padding: 3rem 0;\n  text-align: center;\n}\n\nfooter.site p {\n  font-size: .8rem;\n  margin-bottom: .5rem;\n  color: #999;\n}\n\n@media (max-width: 768px) {\n  aside.site {\n    margin-top: 3rem;\n  }\n}\n\naside.site .section {\n  margin-bottom: 1.5rem;\n}\n\naside.site .section header {\n  box-shadow: 0 -1px 0 #eee inset;\n  margin-bottom: 1rem;\n}\n\naside.site .section header .title {\n  position: relative;\n  display: inline-block;\n  border-bottom: 1px solid #000;\n  padding: .5rem 0;\n  padding-right: 1rem;\n}\n\naside.site .section header .title:before {\n  position: absolute;\n  left: 10px;\n  bottom: -11px;\n  content: '';\n  border-top: 5px solid #000;\n  border-right: 5px solid transparent;\n  border-bottom: 5px solid transparent;\n  border-left: 5px solid transparent;\n}\n\ndiv.list header.title {\n  margin-bottom: 2rem;\n}\n\narticle.li {\n  margin-bottom: 2rem;\n  background-color: #fff;\n}\n\narticle.li .detail {\n  padding: 1rem;\n}\n\narticle.li a {\n  position: relative;\n  text-decoration: none;\n  display: block;\n}\n\narticle.li .image {\n  height: 12rem;\n  background-color: #eee;\n  background-position: center;\n  background-size: cover;\n}\n\narticle.li time {\n  position: absolute;\n  top: -5px;\n  left: 15px;\n  display: block;\n  z-index: 1;\n  white-space: nowrap;\n  padding: 3px 7px;\n  color: #fff;\n  background-color: #333;\n  border-bottom: 2px solid #000;\n  font-size: .7rem;\n  line-height: 1rem;\n}\n\narticle.li .title {\n  white-space: nowrap;\n  text-overflow: ellipsis;\n  overflow: hidden;\n}\n\narticle.li .summary {\n  word-break: break-all;\n  height: 5rem;\n  overflow: hidden;\n  color: #999;\n  font-size: .8rem;\n  line-height: 1rem;\n}\n\n@media (min-width: 767px) {\n  .articles .col-sm-4 article.li .image {\n    height: 10rem;\n  }\n\n  .articles .col-sm-4 article.li .title {\n    font-size: 1.2rem;\n  }\n\n  .articles .col-sm-4 article.li .detail {\n    padding: .5rem;\n  }\n}\n\n.sm article.li {\n  margin-bottom: .5rem;\n  background-color: transparent;\n}\n\n.sm article.li .detail {\n  display: table-cell;\n  padding: 0;\n  padding-left: .5rem;\n  height: 50px;\n  vertical-align: middle;\n}\n\n.sm article.li .title {\n  white-space: normal;\n}\n\n.sm article.li .image {\n  float: left;\n  width: 50px;\n  height: 50px;\n}\n\n.sm article.li time {\n  position: relative;\n  display: block;\n  top: auto;\n  left: auto;\n  padding: 0;\n  background-color: transparent;\n  color: #999;\n  line-height: 1rem;\n  font-size: .8rem;\n  border-bottom: none;\n}\n\n.sm article.li .title {\n  line-height: 1rem;\n  font-size: .8rem;\n}\n\n.sm article.li .summary {\n  display: none;\n}\n\narticle.single {\n  background-color: #fff;\n}\n\narticle.single .article-header {\n  padding: 2rem;\n}\n\n@media (max-width: 768px) {\n  article.single .article-header {\n    padding: 1rem;\n    padding-bottom: 2rem;\n  }\n}\n\narticle.single .image {\n  height: 24rem;\n  background-color: #eee;\n  background-position: center;\n  background-size: cover;\n}\n\n@media (max-width: 768px) {\n  article.single .image {\n    height: 12rem;\n  }\n}\n\narticle.single .article-body {\n  max-width: 650px;\n  margin: 0 auto;\n  padding: 0 1rem;\n}\n\narticle.single .article-body h1,\narticle.single .article-body h2,\narticle.single .article-body h3,\narticle.single .article-body h4,\narticle.single .article-body h5,\narticle.single .article-body h6 {\n  word-break: break-all;\n}\n\narticle.single .article-body h1:first-child,\narticle.single .article-body h2:first-child,\narticle.single .article-body h3:first-child,\narticle.single .article-body h4:first-child,\narticle.single .article-body h5:first-child,\narticle.single .article-body h6:first-child {\n  margin-top: 0;\n}\n\narticle.single .article-body h1 {\n  margin-top: 4rem;\n  margin-bottom: 1rem;\n  font-weight: 900;\n}\n\narticle.single .article-body h2 {\n  margin-top: 3rem;\n  margin-bottom: 1rem;\n}\n\narticle.single .article-body h3 {\n  margin-top: 2rem;\n  margin-bottom: 1rem;\n  font-weight: 900;\n}\n\narticle.single .article-body h3,\narticle.single .article-body h4,\narticle.single .article-body h5,\narticle.single .article-body h6 {\n  margin-top: 2rem;\n  margin-bottom: .5rem;\n}\n\narticle.single .article-body p {\n  line-height: 1.5rem;\n  margin-bottom: 1rem;\n  word-break: break-word;\n}\n\narticle.single .article-body ul,\narticle.single .article-body ol {\n  padding-left: 1.5rem;\n}\n\narticle.single .article-body blockquote {\n  padding: .5rem;\n  border-left: none;\n  background-color: #eee;\n  font-size: .8rem;\n}\n\narticle.single .article-body blockquote p {\n  line-height: 1rem;\n}\n\narticle.single .article-body blockquote p:last-child {\n  margin-bottom: 0;\n}\n\narticle.single .article-body pre {\n  padding: 0;\n  border: none;\n  border-radius: 0;\n}\n\narticle.single .article-body pre code {\n  font-size: .8rem;\n  line-height: 1rem;\n  padding: 1rem;\n}\n\n#TableOfContents {\n  font-size: .8rem;\n  line-height: 1.5rem;\n}\n\n#TableOfContents a {\n  display: block;\n}\n\n#TableOfContents ul ul a {\n  text-decoration: none;\n}\n\n#TableOfContents>ul {\n  padding-left: 0;\n  list-style: none;\n}\n\n#TableOfContents>ul>li {\n  font-weight: 900;\n  margin-bottom: 1rem;\n}\n\n#TableOfContents>ul ul {\n  padding-left: 0;\n  font-weight: normal;\n  list-style: none;\n}\n\n#TableOfContents>ul ul ul {\n  padding-left: 1rem;\n  list-style: none;\n}\n\n.section.menu {\n  line-height: 1.5rem;\n}\n\n.section.menu a {\n  display: block;\n}\n\n.section.menu ul {\n  font-size: .8rem;\n  list-style: none;\n  padding-left: 0;\n}\n\n.section.menu ul a {\n  text-decoration: none;\n}\n\n.section.menu ul ul {\n  padding-left: 1rem;\n}\n\n.section.taxonomies a {\n  display: block;\n  font-size: .8rem;\n  text-decoration: none;\n  line-height: 1.5rem;\n}\n\n.section.taxonomies a:before {\n  content: '\\f105';\n  font-family: 'Fontawesome';\n  margin-right: 5px;\n}\n\narticle.single aside {\n  padding: 2rem;\n}\n\n@media (max-width: 768px) {\n  article.single aside {\n    padding: 1rem;\n  }\n}\n\narticle.single aside .section {\n  margin-bottom: 2rem;\n}\n\nnav.paging {\n  position: relative;\n  min-height: 5rem;\n}\n\nnav.paging a {\n  text-decoration: none;\n  display: inline-block;\n  padding: 5px 10px;\n  background-color: #333;\n  border-bottom: 2px solid #000;\n  color: #fff;\n}\n\nnav.paging .left,\nnav.paging .right {\n  position: absolute;\n}\n\nnav.paging .right {\n  right: 0;\n}\n\n.share {\n  text-align: right;\n}\n\n.share a {\n  display: inline-block;\n  color: #999;\n  padding: 0 .5rem;\n}\n\n"
  },
  {
    "path": "07-hugo/bookshelf-public/index.html",
    "content": "<div class=\"index\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"website\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/\">\n    \n    \n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <div class=\"articles\">\n        <div class=\"row\">\n          \n          <div class=\"col-sm-6\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-6\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-6\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-6\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-4\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n        </div>\n      </div>\n\n      \n\n\n    </div>\n\n  </div>\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/index.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n  <channel>\n    <title>Shekhar Gulati Bookshelf </title>\n    <link>https://shekhargulati.github.io/bookshelf/</link>\n    <language>en-us</language>\n    <author>Shekhar Gulati</author>\n    <rights>(C) 2016</rights>\n    <updated>2016-02-14 19:23:40 &#43;0530 IST</updated>\n\n    \n      \n        <item>\n          <title>Good to Great Book Review</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/good-to-great/</link>\n          <pubDate>Sun, 14 Feb 2016 19:23:40 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/good-to-great/</guid>\n          <description>&lt;p&gt;I read &lt;strong&gt;Good to Great in January 2016&lt;/strong&gt;. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.&lt;/p&gt;\n</description>\n        </item>\n      \n    \n      \n        <item>\n          <title>seven habbits of highly effective people</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/</link>\n          <pubDate>Sun, 14 Feb 2016 19:11:05 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/</guid>\n          <description></description>\n        </item>\n      \n    \n      \n        <item>\n          <title>confessions of a public speaker</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/</link>\n          <pubDate>Sun, 14 Feb 2016 19:10:48 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/</guid>\n          <description></description>\n        </item>\n      \n    \n      \n        <item>\n          <title>art of thinking clearly</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/</link>\n          <pubDate>Sun, 14 Feb 2016 19:10:29 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/</guid>\n          <description></description>\n        </item>\n      \n    \n      \n        <item>\n          <title>Hen Who Dreamed She Could Fly</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/</link>\n          <pubDate>Sun, 14 Feb 2016 19:06:04 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/</guid>\n          <description>&lt;p&gt;In February 2016, I read &lt;strong&gt;The Hen Who Dreamed She Could Fly&lt;/strong&gt;. This short book is an amazing  and inspiring story of a hen Sprout who wanted to live a normal happy life outside of a coop. The lesson I learnt from this book is that you have to break shackles and work towards a life that you want to live. If you believe in your dreams and don’t give up then you will live a life worth living.&lt;/p&gt;\n</description>\n        </item>\n      \n    \n\n  </channel>\n</rss>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/page/1/index.html",
    "content": "<!DOCTYPE html><html><head><link rel=\"canonical\" href=\"https://shekhargulati.github.io/bookshelf/\"/><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /><meta http-equiv=\"refresh\" content=\"0;url=https://shekhargulati.github.io/bookshelf/\" /></head></html>"
  },
  {
    "path": "07-hugo/bookshelf-public/post/art-of-thinking-clearly/index.html",
    "content": "<div class=\"single\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>art of thinking clearly - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"art of thinking clearly - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\">\n    \n    <meta property=\"og:image\" content=\"https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg\">\n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <article class=\"single\" itemscope=\"itemscope\" itemtype=\"http://schema.org/Article\">\n\n        <meta itemprop=\"mainEntityOfPage\"  itemType=\"https://schema.org/WebPage\" content=\"https://shekhargulati.github.io/bookshelf/\"/>\n        <meta itemprop=\"dateModified\" content=\"2016-02-14T19:10:29&#43;05:30\">\n        <meta itemprop=\"headline\" content=\"art of thinking clearly\">\n        <meta itemprop=\"description\" content=\"\">\n        <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\">\n        <div itemprop=\"image\" itemscope itemtype=\"https://schema.org/ImageObject\">\n          <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg\" />\n          <meta itemprop=\"width\" content=\"800\">\n          <meta itemprop=\"height\" content=\"800\">\n        </div>\n        <div itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\">\n          <div itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\">\n            <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/logo.jpg\">\n            <meta itemprop=\"width\" content=\"100\">\n            <meta itemprop=\"height\" content=\"100\">\n          </div>\n          <meta itemprop=\"name\" content=\"Shekhar Gulati Bookshelf\">\n        </div>\n        <div itemprop=\"author\" itemscope itemtype=\"https://schema.org/Person\">\n          <meta itemprop=\"name\" content=\"Shekhar Gulati\">\n        </div>\n\n        <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n\n        <header class=\"article-header\">\n          <time itemprop=\"datePublished\" pubdate=\"pubdate\" datetime=\"2016-02-14T19:10:29&#43;05:30\">Sun, Feb 14, 2016</time>\n          <h1 class=\"article-title\">art of thinking clearly</h1>\n        </header>\n\n        <div class=\"article-body\" itemprop=\"articleBody\">\n          \n        </div>\n\n\n        <aside>\n          \n\n          <div class=\"section share\">\n            <a href=\"http://www.facebook.com/sharer.php?src=bm&u=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fart-of-thinking-clearly%2f&t=art%20of%20thinking%20clearly\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-facebook\"></i></a>\n            <a href=\"http://twitter.com/intent/tweet?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fart-of-thinking-clearly%2f&text=art%20of%20thinking%20clearly&tw_p=tweetbutton\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-twitter\"></i></a>\n            <a href=\"https://plus.google.com/share?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fart-of-thinking-clearly%2f\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-google-plus\"></i></a>\n            <a href=\"http://getpocket.com/edit?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fart-of-thinking-clearly%2f&title=art%20of%20thinking%20clearly\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-get-pocket\"></i></a>\n          </div>\n\n          \n          \n          <div id=\"disqus_thread\"></div>\n          <script type=\"text/javascript\">\n(function() {\n  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n  var disqus_shortname = 'shekhargulati';\n  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';\n  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n})();\n          </script>\n          <noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n          <a href=\"http://disqus.com/\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>\n          \n          \n        </aside>\n\n      </article>\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n  <div class=\"section\">\n    <header><div class=\"title\">TableOfContents</div></header>\n    <div class=\"list-default\"></div>\n  </div>\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/post/confessions-of-a-public-speaker/index.html",
    "content": "<div class=\"single\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>confessions of a public speaker - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"confessions of a public speaker - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\">\n    \n    <meta property=\"og:image\" content=\"https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png\">\n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <article class=\"single\" itemscope=\"itemscope\" itemtype=\"http://schema.org/Article\">\n\n        <meta itemprop=\"mainEntityOfPage\"  itemType=\"https://schema.org/WebPage\" content=\"https://shekhargulati.github.io/bookshelf/\"/>\n        <meta itemprop=\"dateModified\" content=\"2016-02-14T19:10:48&#43;05:30\">\n        <meta itemprop=\"headline\" content=\"confessions of a public speaker\">\n        <meta itemprop=\"description\" content=\"\">\n        <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\">\n        <div itemprop=\"image\" itemscope itemtype=\"https://schema.org/ImageObject\">\n          <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png\" />\n          <meta itemprop=\"width\" content=\"800\">\n          <meta itemprop=\"height\" content=\"800\">\n        </div>\n        <div itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\">\n          <div itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\">\n            <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/logo.jpg\">\n            <meta itemprop=\"width\" content=\"100\">\n            <meta itemprop=\"height\" content=\"100\">\n          </div>\n          <meta itemprop=\"name\" content=\"Shekhar Gulati Bookshelf\">\n        </div>\n        <div itemprop=\"author\" itemscope itemtype=\"https://schema.org/Person\">\n          <meta itemprop=\"name\" content=\"Shekhar Gulati\">\n        </div>\n\n        <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n\n        <header class=\"article-header\">\n          <time itemprop=\"datePublished\" pubdate=\"pubdate\" datetime=\"2016-02-14T19:10:48&#43;05:30\">Sun, Feb 14, 2016</time>\n          <h1 class=\"article-title\">confessions of a public speaker</h1>\n        </header>\n\n        <div class=\"article-body\" itemprop=\"articleBody\">\n          \n        </div>\n\n\n        <aside>\n          \n\n          <div class=\"section share\">\n            <a href=\"http://www.facebook.com/sharer.php?src=bm&u=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fconfessions-of-a-public-speaker%2f&t=confessions%20of%20a%20public%20speaker\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-facebook\"></i></a>\n            <a href=\"http://twitter.com/intent/tweet?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fconfessions-of-a-public-speaker%2f&text=confessions%20of%20a%20public%20speaker&tw_p=tweetbutton\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-twitter\"></i></a>\n            <a href=\"https://plus.google.com/share?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fconfessions-of-a-public-speaker%2f\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-google-plus\"></i></a>\n            <a href=\"http://getpocket.com/edit?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fconfessions-of-a-public-speaker%2f&title=confessions%20of%20a%20public%20speaker\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-get-pocket\"></i></a>\n          </div>\n\n          \n          \n          <div id=\"disqus_thread\"></div>\n          <script type=\"text/javascript\">\n(function() {\n  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n  var disqus_shortname = 'shekhargulati';\n  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';\n  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n})();\n          </script>\n          <noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n          <a href=\"http://disqus.com/\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>\n          \n          \n        </aside>\n\n      </article>\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n  <div class=\"section\">\n    <header><div class=\"title\">TableOfContents</div></header>\n    <div class=\"list-default\"></div>\n  </div>\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/post/good-to-great/index.html",
    "content": "<div class=\"single\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>Good to Great Book Review - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"Good to Great Book Review - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\">\n    \n    <meta property=\"og:image\" content=\"https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg\">\n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <article class=\"single\" itemscope=\"itemscope\" itemtype=\"http://schema.org/Article\">\n\n        <meta itemprop=\"mainEntityOfPage\"  itemType=\"https://schema.org/WebPage\" content=\"https://shekhargulati.github.io/bookshelf/\"/>\n        <meta itemprop=\"dateModified\" content=\"2016-02-14T19:23:40&#43;05:30\">\n        <meta itemprop=\"headline\" content=\"Good to Great Book Review\">\n        <meta itemprop=\"description\" content=\"I read Good to Great in January 2016. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.\">\n        <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\">\n        <div itemprop=\"image\" itemscope itemtype=\"https://schema.org/ImageObject\">\n          <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg\" />\n          <meta itemprop=\"width\" content=\"800\">\n          <meta itemprop=\"height\" content=\"800\">\n        </div>\n        <div itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\">\n          <div itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\">\n            <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/logo.jpg\">\n            <meta itemprop=\"width\" content=\"100\">\n            <meta itemprop=\"height\" content=\"100\">\n          </div>\n          <meta itemprop=\"name\" content=\"Shekhar Gulati Bookshelf\">\n        </div>\n        <div itemprop=\"author\" itemscope itemtype=\"https://schema.org/Person\">\n          <meta itemprop=\"name\" content=\"Shekhar Gulati\">\n        </div>\n\n        <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n\n        <header class=\"article-header\">\n          <time itemprop=\"datePublished\" pubdate=\"pubdate\" datetime=\"2016-02-14T19:23:40&#43;05:30\">Sun, Feb 14, 2016</time>\n          <h1 class=\"article-title\">Good to Great Book Review</h1>\n        </header>\n\n        <div class=\"article-body\" itemprop=\"articleBody\">\n          <p>I read <strong>Good to Great in January 2016</strong>. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.</p>\n\n        </div>\n\n\n        <aside>\n          \n\n          <div class=\"section share\">\n            <a href=\"http://www.facebook.com/sharer.php?src=bm&u=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fgood-to-great%2f&t=Good%20to%20Great%20Book%20Review\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-facebook\"></i></a>\n            <a href=\"http://twitter.com/intent/tweet?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fgood-to-great%2f&text=Good%20to%20Great%20Book%20Review&tw_p=tweetbutton\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-twitter\"></i></a>\n            <a href=\"https://plus.google.com/share?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fgood-to-great%2f\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-google-plus\"></i></a>\n            <a href=\"http://getpocket.com/edit?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fgood-to-great%2f&title=Good%20to%20Great%20Book%20Review\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-get-pocket\"></i></a>\n          </div>\n\n          \n          \n          <div id=\"disqus_thread\"></div>\n          <script type=\"text/javascript\">\n(function() {\n  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n  var disqus_shortname = 'shekhargulati';\n  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';\n  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n})();\n          </script>\n          <noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n          <a href=\"http://disqus.com/\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>\n          \n          \n        </aside>\n\n      </article>\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n  <div class=\"section\">\n    <header><div class=\"title\">TableOfContents</div></header>\n    <div class=\"list-default\"></div>\n  </div>\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/post/hen-who-dreamed-she-could-fly/index.html",
    "content": "<div class=\"single\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>Hen Who Dreamed She Could Fly - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"Hen Who Dreamed She Could Fly - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\">\n    \n    <meta property=\"og:image\" content=\"https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg\">\n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <article class=\"single\" itemscope=\"itemscope\" itemtype=\"http://schema.org/Article\">\n\n        <meta itemprop=\"mainEntityOfPage\"  itemType=\"https://schema.org/WebPage\" content=\"https://shekhargulati.github.io/bookshelf/\"/>\n        <meta itemprop=\"dateModified\" content=\"2016-02-14T19:06:04&#43;05:30\">\n        <meta itemprop=\"headline\" content=\"Hen Who Dreamed She Could Fly\">\n        <meta itemprop=\"description\" content=\"In February 2016, I read The Hen Who Dreamed She Could Fly. This short book is an amazing and inspiring story of a hen Sprout who wanted to live a normal happy life outside of a coop. The lesson I learnt from this book is that you have to break shackles and work towards a life that you want to live. If you believe in your dreams and don’t give up then you will live a life worth living.\">\n        <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\">\n        <div itemprop=\"image\" itemscope itemtype=\"https://schema.org/ImageObject\">\n          <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg\" />\n          <meta itemprop=\"width\" content=\"800\">\n          <meta itemprop=\"height\" content=\"800\">\n        </div>\n        <div itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\">\n          <div itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\">\n            <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/logo.jpg\">\n            <meta itemprop=\"width\" content=\"100\">\n            <meta itemprop=\"height\" content=\"100\">\n          </div>\n          <meta itemprop=\"name\" content=\"Shekhar Gulati Bookshelf\">\n        </div>\n        <div itemprop=\"author\" itemscope itemtype=\"https://schema.org/Person\">\n          <meta itemprop=\"name\" content=\"Shekhar Gulati\">\n        </div>\n\n        <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n\n        <header class=\"article-header\">\n          <time itemprop=\"datePublished\" pubdate=\"pubdate\" datetime=\"2016-02-14T19:06:04&#43;05:30\">Sun, Feb 14, 2016</time>\n          <h1 class=\"article-title\">Hen Who Dreamed She Could Fly</h1>\n        </header>\n\n        <div class=\"article-body\" itemprop=\"articleBody\">\n          <p>In February 2016, I read <strong>The Hen Who Dreamed She Could Fly</strong>. This short book is an amazing  and inspiring story of a hen Sprout who wanted to live a normal happy life outside of a coop. The lesson I learnt from this book is that you have to break shackles and work towards a life that you want to live. If you believe in your dreams and don’t give up then you will live a life worth living.</p>\n\n        </div>\n\n\n        <aside>\n          \n\n          <div class=\"section share\">\n            <a href=\"http://www.facebook.com/sharer.php?src=bm&u=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fhen-who-dreamed-she-could-fly%2f&t=Hen%20Who%20Dreamed%20She%20Could%20Fly\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-facebook\"></i></a>\n            <a href=\"http://twitter.com/intent/tweet?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fhen-who-dreamed-she-could-fly%2f&text=Hen%20Who%20Dreamed%20She%20Could%20Fly&tw_p=tweetbutton\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-twitter\"></i></a>\n            <a href=\"https://plus.google.com/share?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fhen-who-dreamed-she-could-fly%2f\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-google-plus\"></i></a>\n            <a href=\"http://getpocket.com/edit?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fhen-who-dreamed-she-could-fly%2f&title=Hen%20Who%20Dreamed%20She%20Could%20Fly\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-get-pocket\"></i></a>\n          </div>\n\n          \n          \n          <div id=\"disqus_thread\"></div>\n          <script type=\"text/javascript\">\n(function() {\n  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n  var disqus_shortname = 'shekhargulati';\n  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';\n  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n})();\n          </script>\n          <noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n          <a href=\"http://disqus.com/\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>\n          \n          \n        </aside>\n\n      </article>\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n  <div class=\"section\">\n    <header><div class=\"title\">TableOfContents</div></header>\n    <div class=\"list-default\"></div>\n  </div>\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/post/index.html",
    "content": "<div class=\"list\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>Posts - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"Posts - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/post/\">\n    \n    \n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <header class=\"title\"><h1>Posts</h1></header>\n\n      <div class=\"articles\">\n        <div class=\"row\">\n          \n          <div class=\"col-sm-4\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-4\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-4\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-4\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n          <div class=\"col-sm-4\">\n            <article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n\n          </div>\n          \n        </div>\n      </div>\n\n      \n\n\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/post/index.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n  <channel>\n    <title>Shekhar Gulati Bookshelf </title>\n    <link>https://shekhargulati.github.io/bookshelf/post/</link>\n    <language>en-us</language>\n    <author>Shekhar Gulati</author>\n    <rights>(C) 2016</rights>\n    <updated>2016-02-14 19:23:40 &#43;0530 IST</updated>\n\n    \n      \n        <item>\n          <title>Good to Great Book Review</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/good-to-great/</link>\n          <pubDate>Sun, 14 Feb 2016 19:23:40 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/good-to-great/</guid>\n          <description>&lt;p&gt;I read &lt;strong&gt;Good to Great in January 2016&lt;/strong&gt;. An awesome read sharing detailed analysis on how good companies became great. Although this book is about how companies became great but we could apply a lot of the learnings on ourselves. Concepts like level 5 leader, hedgehog concept, the stockdale paradox are equally applicable to individuals.&lt;/p&gt;\n</description>\n        </item>\n      \n    \n      \n        <item>\n          <title>seven habbits of highly effective people</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/</link>\n          <pubDate>Sun, 14 Feb 2016 19:11:05 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/</guid>\n          <description></description>\n        </item>\n      \n    \n      \n        <item>\n          <title>confessions of a public speaker</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/</link>\n          <pubDate>Sun, 14 Feb 2016 19:10:48 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/</guid>\n          <description></description>\n        </item>\n      \n    \n      \n        <item>\n          <title>art of thinking clearly</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/</link>\n          <pubDate>Sun, 14 Feb 2016 19:10:29 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/</guid>\n          <description></description>\n        </item>\n      \n    \n      \n        <item>\n          <title>Hen Who Dreamed She Could Fly</title>\n          <link>https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/</link>\n          <pubDate>Sun, 14 Feb 2016 19:06:04 IST</pubDate>\n          <author>Shekhar Gulati</author>\n          <guid>https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/</guid>\n          <description>&lt;p&gt;In February 2016, I read &lt;strong&gt;The Hen Who Dreamed She Could Fly&lt;/strong&gt;. This short book is an amazing  and inspiring story of a hen Sprout who wanted to live a normal happy life outside of a coop. The lesson I learnt from this book is that you have to break shackles and work towards a life that you want to live. If you believe in your dreams and don’t give up then you will live a life worth living.&lt;/p&gt;\n</description>\n        </item>\n      \n    \n\n  </channel>\n</rss>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/post/page/1/index.html",
    "content": "<!DOCTYPE html><html><head><link rel=\"canonical\" href=\"https://shekhargulati.github.io/bookshelf/post/\"/><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /><meta http-equiv=\"refresh\" content=\"0;url=https://shekhargulati.github.io/bookshelf/post/\" /></head></html>"
  },
  {
    "path": "07-hugo/bookshelf-public/post/seven-habbits-of-highly-effective-people/index.html",
    "content": "<div class=\"single\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>seven habbits of highly effective people - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"seven habbits of highly effective people - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\">\n    \n    <meta property=\"og:image\" content=\"https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg\">\n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <article class=\"single\" itemscope=\"itemscope\" itemtype=\"http://schema.org/Article\">\n\n        <meta itemprop=\"mainEntityOfPage\"  itemType=\"https://schema.org/WebPage\" content=\"https://shekhargulati.github.io/bookshelf/\"/>\n        <meta itemprop=\"dateModified\" content=\"2016-02-14T19:11:05&#43;05:30\">\n        <meta itemprop=\"headline\" content=\"seven habbits of highly effective people\">\n        <meta itemprop=\"description\" content=\"\">\n        <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\">\n        <div itemprop=\"image\" itemscope itemtype=\"https://schema.org/ImageObject\">\n          <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg\" />\n          <meta itemprop=\"width\" content=\"800\">\n          <meta itemprop=\"height\" content=\"800\">\n        </div>\n        <div itemprop=\"publisher\" itemscope itemtype=\"https://schema.org/Organization\">\n          <div itemprop=\"logo\" itemscope itemtype=\"https://schema.org/ImageObject\">\n            <meta itemprop=\"url\" content=\"https://shekhargulati.github.io/bookshelf/images/logo.jpg\">\n            <meta itemprop=\"width\" content=\"100\">\n            <meta itemprop=\"height\" content=\"100\">\n          </div>\n          <meta itemprop=\"name\" content=\"Shekhar Gulati Bookshelf\">\n        </div>\n        <div itemprop=\"author\" itemscope itemtype=\"https://schema.org/Person\">\n          <meta itemprop=\"name\" content=\"Shekhar Gulati\">\n        </div>\n\n        <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n\n        <header class=\"article-header\">\n          <time itemprop=\"datePublished\" pubdate=\"pubdate\" datetime=\"2016-02-14T19:11:05&#43;05:30\">Sun, Feb 14, 2016</time>\n          <h1 class=\"article-title\">seven habbits of highly effective people</h1>\n        </header>\n\n        <div class=\"article-body\" itemprop=\"articleBody\">\n          \n        </div>\n\n\n        <aside>\n          \n\n          <div class=\"section share\">\n            <a href=\"http://www.facebook.com/sharer.php?src=bm&u=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fseven-habbits-of-highly-effective-people%2f&t=seven%20habbits%20of%20highly%20effective%20people\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-facebook\"></i></a>\n            <a href=\"http://twitter.com/intent/tweet?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fseven-habbits-of-highly-effective-people%2f&text=seven%20habbits%20of%20highly%20effective%20people&tw_p=tweetbutton\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-twitter\"></i></a>\n            <a href=\"https://plus.google.com/share?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fseven-habbits-of-highly-effective-people%2f\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-google-plus\"></i></a>\n            <a href=\"http://getpocket.com/edit?url=https%3a%2f%2fshekhargulati.github.io%2fbookshelf%2fpost%2fseven-habbits-of-highly-effective-people%2f&title=seven%20habbits%20of%20highly%20effective%20people\" onclick=\"window.open(this.href, 'PCwindow', 'width=550, height=350, menubar=no, toolbar=no, scrollbars=yes'); return false;\"><i class=\"fa fa-get-pocket\"></i></a>\n          </div>\n\n          \n          \n          <div id=\"disqus_thread\"></div>\n          <script type=\"text/javascript\">\n(function() {\n  var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;\n  var disqus_shortname = 'shekhargulati';\n  dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';\n  (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);\n})();\n          </script>\n          <noscript>Please enable JavaScript to view the <a href=\"http://disqus.com/?ref_noscript\">comments powered by Disqus.</a></noscript>\n          <a href=\"http://disqus.com/\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>\n          \n          \n        </aside>\n\n      </article>\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n  <div class=\"section\">\n    <header><div class=\"title\">TableOfContents</div></header>\n    <div class=\"list-default\"></div>\n  </div>\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "07-hugo/bookshelf-public/sitemap.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n  \n  <url>\n    <loc>https://shekhargulati.github.io/bookshelf/</loc>\n    <lastmod>2016-02-14T19:23:40+05:30</lastmod>\n    <priority>0</priority>\n  </url>\n  \n  <url>\n    <loc>https://shekhargulati.github.io/bookshelf/post/good-to-great/</loc>\n    <lastmod>2016-02-14T19:23:40+05:30</lastmod>\n  </url>\n  \n  <url>\n    <loc>https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/</loc>\n    <lastmod>2016-02-14T19:11:05+05:30</lastmod>\n  </url>\n  \n  <url>\n    <loc>https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/</loc>\n    <lastmod>2016-02-14T19:10:48+05:30</lastmod>\n  </url>\n  \n  <url>\n    <loc>https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/</loc>\n    <lastmod>2016-02-14T19:10:29+05:30</lastmod>\n  </url>\n  \n  <url>\n    <loc>https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/</loc>\n    <lastmod>2016-02-14T19:06:04+05:30</lastmod>\n  </url>\n  \n</urlset>"
  },
  {
    "path": "07-hugo/bookshelf-public/tags/index.html",
    "content": "<div class=\"list\">\n  <!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"generator\" content=\"Hugo 0.15\" />\n\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, maximum-scale=1\">\n    <link rel='stylesheet' href='//fonts.googleapis.com/css?family=Open+Sans|Marcellus+SC'>\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css\" integrity=\"sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7\" crossorigin=\"anonymous\">\n    <link rel=\"stylesheet\" href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css\">\n    <link rel=\"stylesheet\" href=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/solarized_dark.min.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/styles.css\">\n    <link rel=\"stylesheet\" href=\"/bookshelf/css/custom.css\">\n    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"https://shekhargulati.github.io/bookshelf/index.xml\">\n\n    \n    <title>Tags - Shekhar Gulati Bookshelf</title>\n    <meta property='og:title' content=\"Tags - Shekhar Gulati Bookshelf\">\n    <meta property=\"og:type\" content=\"article\">\n    \n\n    <meta property=\"og:url\" content=\"https://shekhargulati.github.io/bookshelf/tags/\">\n    \n    \n\n  </head>\n\n  <body>\n\n    <header class=\"site\">\n      <div class=\"title\"><a href=\"https://shekhargulati.github.io/bookshelf/\">Shekhar Gulati Bookshelf</a></div>\n    </header>\n\n    <div class=\"container site\">\n\n  <div class=\"row\">\n    <div class=\"col-sm-9\">\n\n      <header class=\"title\"><h1>Tags</h1></header>\n\n      \n\n    </div>\n\n    <div class=\"col-sm-3\">\n      <aside class=\"site\">\n\n  \n\n  \n\n  <div class=\"section\">\n    <header><div class=\"title\">LatestPosts</div></header>\n    <div class=\"content\">\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/good-to-great/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/good-to-great.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/seven-habbits-of-highly-effective-people/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/seven-habits-of-highly-effective-people.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/confessions-of-a-public-speaker/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/confessions-of-a-public-speaker.png);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/art-of-thinking-clearly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/art-of-thinking-clearly.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n      <div class=\"sm\"><article class=\"li\">\n  <a href=\"https://shekhargulati.github.io/bookshelf/post/hen-who-dreamed-she-could-fly/\" class=\"clearfix\">\n    <div class=\"image\" style=\"background-image: url(https://shekhargulati.github.io/bookshelf/images/hen-who-dreamed.jpg);\"></div>\n  </a>\n</article>\n</div>\n      \n    </div>\n  </div>\n\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">category</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n  <div class=\"section taxonomies\">\n    <header><div class=\"title\">tag</div></header>\n    <div class=\"content\">\n      \n    </div>\n  </div>\n  \n\n</aside>\n\n    </div>\n\n  </div>\n      </div>\n\n    <footer class=\"site\">\n      <p>&copy; 2016 Shekhar Gulati</p>\n      <p>Powered by <a href=\"http://gohugo.io\" target=\"_blank\">Hugo</a>,</p>\n    </footer>\n\n    <script src=\"//code.jquery.com/jquery-2.1.3.min.js\"></script>\n    <script src=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js\" integrity=\"sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS\" crossorigin=\"anonymous\"></script>\n    <script src=\"//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/highlight.min.js\"></script>\n    <script>hljs.initHighlightingOnLoad();</script>\n\n    \n    <script>\n    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n      (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n    ga('create', 'UA-73784822-1', 'auto');\n    ga('send', 'pageview');\n    </script>\n    \n\n  </body>\n</html>\n\n</div>\n"
  },
  {
    "path": "08-coreos/README.md",
    "content": "CoreOS for Application Developers\n----\n\nWelcome to eighth week of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week we will learn about [CoreOS](https://coreos.com/), an Open source Linux distribution built to run and manage highly scalable and fault tolerant systems. It is designed to `docker` and `rocket` containers. When I started learning about CoreOS, I was overwhelmed by its complexity and different components that you have to know and interact with like `etcd`, `systemd`, `fleet`, `Flannel`. I am not an Ops guy so CoreOS documentation and many tutorials that I found on the web didn't clicked with me. The goal of this tutorial is to help application developers understand why they should care about CoreOS and show them how to work with CoreOS cluster running on top of Amazon EC2.\n\n## What is CoreOS?\n\nAccording to [CoreOS website](https://coreos.com/), **CoreOS is a Linux for Massive Server Deployments**. This means it is not a general purpose Linux distro that you can use as your development workspace instead, you will use it to run and your applications at scale.\n\nBuilt on [Gentoo](https://www.gentoo.org/), CoreOS is a lean and mean operating system that runs minimal Linux. When you limit your OS to the bare minimal i.e. just openssl, ssh, linux kernel, gcc then you need a mechanism to run package and run applications that you want to use.  CoreOS does not even has a package manager like `yum` or `Apt`. CoreOS is very different from other Linux distributions as it is centered around containers. *Linux Containers is an operating-system-level virtualization environment for running multiple isolated Linux systems (containers) on a single Linux control host*. CoreOS uses containers to run and manage applications services. You package application along with its dependencies within a container that can be run on a single or multiple CoreOS machines. CoreOS supports both Docker and Rocket containers.\n\n> **Docker is the poster child of containers. In [November 2013](https://blog.openshift.com/day-21-docker-the-missing-tutorial/), I first learnt and wrote about Docker. [Docker](https://www.docker.com/) is a set of toolset geared around containers. Docker clicked with everyone and overnight became the tool that everyone wanted to learn and introduce in their organization. One reason Docker became popular very quickly is its approachability to an average developer. To use Docker, you don't have to know Linux internals and work with complicated tools.**\n\nCoreOS developers claim that it is 40% more efficient in RAM usage than an average linux installation.\n\n![](images/coreos-ram-usage.png)\n\n## Why should I care?\n\nI am an application developer and one trend that I see becoming popular in application development space is **Microservices**. [Microservices](https://en.wikipedia.org/wiki/Microservices) is a software architecture style in which a large complex application is broken down into smaller,independent, autonomous services that work together. These autonomous services encapsulate business functionality corresponding to single a feature and interact with each other using a language agnostic APIs. These applications are built by multiple teams across different geographies.  They have lifecycle of their own and can be deployed independently of each other. Most of the successful internet companies like Amazon, Google, Netflix, Twitter, etc. are using Microservices architecture for their applications.\n\nThere are a lot of benefits an organization can achieve by adopting Microservices architecture. Some of these benefits are:\n\n1. You can **choose right tool for the job**. Each service can possible use a different programming language or different database solution for the problem at hand. This eliminates a long term commitment to a particular technology stack.\n2. You can **deploy services independently of each other**. A small, simple service can be deployed much more easily than a big monolithic application. This will help in delivering business value to the customer faster.\n3. You get **quick feedback for the business functionality**.\n4. You can **understand code much easily**. Each Microservice is designed to do one thing so their code base are reasonably smaller. This helps a developer to understand the code much more easily.\n5. You get **small focussed teams**.\n\nAlthough, there a lot of benefits of Microservice architecture there are some challenges as well. There is an operational cost and complexity associated with Microservices. Microservice architecture leads to many moving parts. This makes them difficult to debug and reason about. A single request might get fulfilled by many services, introducing latency. To work in this new world, you have to rethink about your datacenter. The traditional datacenter model will not work.\n\n### CoreOS: The modern datacenter\n\nWe are moving to the world of web scale IT where we want our applications to be available, fault-tolerant, scalable, and broken into smaller applications. To support such application development landscape, we need web scale Infrastructure. **CoreOS** is one solution to move in the direction of modern datacenter, **datacenter as a machine**. You will be able to work with cluster of machines as one single machine. CoreOS can help us build a datacenter where we can run and manage our Microservices at scale. It is designed to be fault-tolerant and resilient so that if one host fails your application can recover from it without any human intervention.\n\nCoreOS also supports features like automatic updates and rolling releases that you need when you run applications at scale.\n\n## CoreOS Components\n\nThe main components of CoreOS are:\n\n* ***etcd***: The core idea behind `etcd` is that you can replicate your `/etc` directory in a fault tolerant way. `etcd` is a distributed key-value store that is designed to overcome individual node failure. According to wikipedia, `etc` directory\n> **Contains system-wide configuration files and system databases; the name stands for \"et cetera\". Originally also contained \"dangerous maintenance utilities\" such as init, but these have typically been moved to /sbin or elsewhere.**\n\n* ***systemd***: It is an init system for a single host. It is a big upgrade to `init.d` allowing you write service units which point to any bash or Python script. It is based on `cgroups` and does not rely on `pid` files. A simple `systemd` service file looks like as shown below.\n\n  ```\n  [Unit]\n  Description=Sleep Service\n\n  [Service]\n  ExecStart=/usr/bin/sleep 3000\n  ```\n* ***fleet***: `fleet` is an init system for a cluster. You can think it as a distributed `systemd`. fleet let you work with a cluster of machine as one machine.\n\n* ***flannel***: flannel is a virtual network that gives a subnet to each host for use with container runtimes. It creates a UDP encapsulated overlay network that can run fairly inexpensively on virtual machines. The goal of flannel is that each container running on a host has its own unique ip address so that you can get away from port mapping business. flannel creates a logical route table between virtual machine A and virtual machine B and creates an overlay network. This gives it private IPs in the range `10.0.0.16/24` that containers can use.\n\n* ***Docker***: Docker provides an envelope (or container) for running your applications. It packages the application and all its dependencies in a virtual container that runs on any Linux server. This helps enable flexibility and portability on where the application can run, whether on premise, public cloud, private cloud, bare metal, etc.\n\n\n## Launch a CoreOS cluster on Amazon EC2.\n\nCoreOS team provides a Vagrant project that you can use to launch CoreOS cluster on your local machine. In this tutorial, I am going to launch a 3 machine CoreOS cluster on Amazon EC2. CoreOS team provides a list of AMI that we can use to launch our CoreOS cluster. You can refer to [https://coreos.com/os/docs/latest/booting-on-ec2.html](https://coreos.com/os/docs/latest/booting-on-ec2.html) for details. Click on the region in which you want to create your stack. You will be asked to enter details as shown below.\n\n![](images/ec2-coreos-stack.png)\n\nOnce stack is created, you will see three instances running in your EC2 management console.\n\n![](images/ec2-instances.png)\n\n\n## SSH into CoreOS host\n\nSSH into any of the instance using the SSH key you used in the previous step.\n\n```bash\n$ ssh -i ~/.ssh/my-ec2-key.pem core@ec2-50-189-111-255.compute-1.amazonaws.com\n```\n\nBy default, it uses the `core` user instead of `root` and doesn’t use a password for authentication.\n\nOnce SSHed, you will see following screen.\n\n```bash\nCoreOS stable (835.13.0)\ncore@ip-10-129-99-123 ~ $\n```\n\n## Check service status\n\nLet's verify status of `etcd`, `fleet`, and `docker`. We will use `systemctl` command to check status of services. `systemctl` is a system and service manager used to introspect and control the state of the `systemd` system and its units.\n\nTo check status of `etcd`, run the following command.\n\n```\ncore@ip-xx-xx-xx-xx ~ $ systemctl status etcd2\n● etcd2.service - etcd2\n   Loaded: loaded (/usr/lib64/systemd/system/etcd2.service; disabled; vendor preset: disabled)\n  Drop-In: /run/systemd/system/etcd2.service.d\n           └─10-oem.conf, 20-cloudinit.conf\n   Active: active (running) since Mon 2016-02-22 13:36:24 UTC; 8min ago\n Main PID: 772 (etcd2)\n   Memory: 34.8M\n      CPU: 2.477s\n   CGroup: /system.slice/etcd2.service\n           └─772 /usr/bin/etcd2\n```\n\nTo check status of `fleet`, type following command.\n\n```\ncore@ip-xx-xx-xx-xx ~ $ systemctl status fleet\n● fleet.service - fleet daemon\n   Loaded: loaded (/usr/lib64/systemd/system/fleet.service; disabled; vendor preset: disabled)\n   Active: active (running) since Mon 2016-02-22 13:36:24 UTC; 9min ago\n Main PID: 780 (fleetd)\n   Memory: 12.0M\n      CPU: 3.387s\n   CGroup: /system.slice/fleet.service\n           └─780 /usr/bin/fleetd\n```\n\nTo check status of `docker`, execute the following command.\n\n```\ncore@ip-xx-xx-xx-xx ~ $ docker version\nClient:\n Version:      1.8.3\n API version:  1.20\n Go version:   go1.4.2\n Git commit:   cedd534-dirty\n Built:        Thu Feb 18 16:25:16 UTC 2016\n OS/Arch:      linux/amd64\n\nServer:\n Version:      1.8.3\n API version:  1.20\n Go version:   go1.4.2\n Git commit:   cedd534-dirty\n Built:        Thu Feb 18 16:25:16 UTC 2016\n OS/Arch:      linux/amd64\n```\n\n\n## Working with etcd\n\nAs mentioned above, `etcd` is a distributed key value store. Let's SSH into two CoreOS instances and see it in action.\n\n```bash\ncore@ip-xx-xx-xx-xx ~ $ etcdctl set message \"Hello World\"\nHello World\n```\n\nSSH into the second instance to retrieve the value.\n\n```bash\ncore@ip-yy-yy-yy-yy ~ $ etcdctl get message\nHello World\n```\n\nThe data in one node is replicated to the second node. It uses Raft consensus algorithm to replicate the data.\n\nYou can also create directories in `ectd` and then store different configuration values in it.\n\n```\ncore@ip-xx-xx-xx-xx ~ $ etcdctl set /tmp/message1 \"hello 1\"\nhello 1\ncore@ip-xx-xx-xx-xx ~ $ etcdctl set /tmp/message2 \"hello 2\"\nhello 2\ncore@ip-yy-yy-yy-yy ~ $ etcdctl ls /tmp\n/tmp/message1\n/tmp/message2\ncore@ip-yy-yy-yy-yy ~ $ etcdctl get /tmp/message1\nhello 1\n```\n\nIn the commands shown above, we created a directory `tmp` and then stored couples of key value pairs. To view keys in the tmp, we used `ls` command. If the directory contains another directories then you can use `-recursive` flag to list all the directories and their keys.\n\n## Working with systemd\n\nIn this section, we will write a simple service that will periodically poll Github status API. In systemd, you have to write unit files to describe your service. Let's create a new service file `github-status.service` inside the `/etc/systemd/system` directory. Populate it with following contents.\n\n```bash\n[Unit]\nDescription=Check Github Status\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nExecStartPre=/usr/bin/docker build -t=\"shekhargulati/ubuntu-curl\" /home/core\nExecStart=/usr/bin/docker run --name my-container1 shekhargulati/ubuntu-curl:latest /bin/sh -c \"while true; do curl https://status.github.com/api/status.json; sleep 10;done\"\nExecStop=/usr/bin/docker stop my-container1\n\n[Install]\nWantedBy=multi-user.target\n```\n\nIn the unit file shown above, we created a Docker image `shekhargulati/ubuntu-curl` using the Dockerfile present at `/home/core` directory. Dockerfile is shown below.\n\n```\nFROM ubuntu:latest\nRUN apt-get update\nRUN apt-get install -y curl\n```\n\nAfter container is created, we run the container using the command `while true; do curl https://status.github.com/api/status.json; sleep 10;done`. This command polls Github status API every 10 seconds.\n\nTo enable the new service unit, run the following command.\n\n```bash\n$ sudo systemctl enable /etc/systemd/system/github-status.service\n```\nThe above command will create a symlink.\n```\nCreated symlink from /etc/systemd/system/multi-user.target.wants/github-status.service to /etc/systemd/system/github-status.service.\n```\n\n\nNext, you can start the `github-status` service using the following command.\n\n```\n$ sudo systemctl start github-status.service\n```\n\nTo view the logs of systemd service, we can use `journalctl`. `journalctl` is used to query contents of the systemd journal.\n\n```\n$ journalctl -f -u github-status.service\n```\n```\nFeb 22 16:12:32 ip-xx-xx-xx-xx.ec2.internal docker[9374]: {\"status\":\"good\",\"last_updated\":\"2016-02-22T16:11:57Z\"}\nFeb 22 16:12:42 ip-xx-xx-xx-xx.ec2.internal docker[9374]: {\"status\":\"good\",\"last_updated\":\"2016-02-22T16:12:31Z\"}\n```\n\nAs we packaged our github-status.service inside a Docker container, you can view that a container is running using the following command.\n\n```\ncore@ip-xx-xx-xx-xx ~ $ docker ps\nCONTAINER ID        IMAGE                              COMMAND                  CREATED             STATUS              PORTS               NAMES\n108ae4804d21        shekhargulati/ubuntu-curl:latest   \"/bin/sh -c 'while tr\"   15 minutes ago      Up 15 minutes                           my-container1\n```\n\nYou can stop the service using the systemctl as shown below. This will stop the docker container as well.\n\n## Working with fleet\n\n\nWe can use fleet to work with systemd services at cluster level. Let's now create a new service which will print `hello all` message.\n\n```bash\n[Unit]\nDescription=Hello\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nExecStartPre=/usr/bin/docker pull busybox\nExecStartPre=-/usr/bin/docker rm container1\nExecStart=/usr/bin/docker run --name container1 busybox:latest /bin/sh -c \"while true; do echo 'hello all'; sleep 1;done\"\nExecStop=/usr/bin/docker stop container1\n\n[X-Fleet]\n```\n\nSubmit the unit file\n\n```bash\ncore@ip-xx-xx-xx-xx ~ $ fleetctl submit hello.service\nUnit uptime-check.service inactive\n```\n\nList all unit files\n\n```bash\ncore@ip-xx-xx-xx-xx ~ $ fleetctl list-units\nUNIT\t\tMACHINE\t\t\t\tACTIVE\tSUB\nhello.service\t241f23f5.../10.149.77.143\tinactive\tinactive\n```\n\n\nStart the service\n\n```\n$ fleetctl start hello.service\n```\n```\nUnit hello.service launched on 241f23f5.../10.149.77.143\n```\n\nIf you list-units now, you will see that service is running on one host.\n\n```\n$ fleetctl list-units\nUNIT\t\tMACHINE\t\t\t\tACTIVE\tSUB\nhello.service\t241f23f5.../10.149.77.143\tactive\trunning\n```\n\nYou can view the logs using the `journalctl` command.\n\n```\n$ journalctl -u hello.service -f\n-- Logs begin at Mon 2016-02-22 13:35:00 UTC. --\nFeb 22 16:53:49 ip-xx-xx-xx-xx.ec2.internal docker[10660]: hello all\nFeb 22 16:53:50 ip-xx-xx-xx-xx.ec2.internal docker[10660]: hello all\nFeb 22 16:53:51 ip-xx-xx-xx-xx.ec2.internal docker[10660]: hello all\nFeb 22 16:53:52 ip-xx-xx-xx-xx.ec2.internal docker[10660]: hello all\n```\n\nYou can schedule a unit on all machines using the Global option.\n\n```\n[Unit]\nDescription=Hello\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nExecStartPre=/usr/bin/docker pull busybox\nExecStartPre=-/usr/bin/docker rm container1\nExecStart=/usr/bin/docker run --name container1 busybox:latest /bin/sh -c \"while true; do echo 'hello all'; sleep 1;done\"\nExecStop=/usr/bin/docker stop container1\n\n[X-Fleet]\nGlobal=true\n```\n\n```\nfleetctl list-unit-files\nUNIT\t\tHASH\tDSTATE\t\tSTATE\tTARGET\nhello.service\t5659e44\tinactive\t-\tglobal\n```\n\n\n```\n$ fleetctl start hello.service\nTriggered global unit hello.service start\n```\n\n```\n$ fleetctl list-units\nUNIT\t\tMACHINE\t\t\t\tACTIVE\tSUB\nhello.service\t241f23f5.../10.149.77.143\tactive\trunning\nhello.service\tc952b3af.../10.79.177.29\tactive\trunning\nhello.service\tf37a7daa.../10.153.148.154\tactive\trunning\n```\n\nYou can view status on individual hosts by running the `systemctl status hello.service` command.\n\n----\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/11](https://github.com/shekhargulati/52-technologies-in-2016/issues/11).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/08-coreos)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "09-cloudvision/README.md",
    "content": "Realtime People Counter with Google's Cloud Vision API and RxJava\n-----\n\nWelcome to the ninth blog of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)  blog series. Recently, Google released [Cloud Vision](https://cloud.google.com/vision/) API that enables developers to incorporate image recognition in their applications. Image Recognition allow developers to build applications that can understand content of images. Google's Cloud Vision API is very powerful and support following features:\n\n1. **Image categorization**: The API can help classify images into categories. You can build powerful applications like Google Photos that do automatic categorization.\n2. **Inappropriate content detection**: The API can detect inappropriate content in an image like nudity, violence, etc. It uses Google Safe search capabilities underneath.\n3. **Emotion detection**: This allows you to detect happy, sad or moderate emotions in an image.\n4. **Retrieve text from the image**: This allows you to extract text in multiple languages from the images.\n5. **Logo detection**: It can help you identify product logos within an image.\n\nThere are many possible applications that you can build using this powerful API. In this tutorial, we will learn how to build a realtime people counter. The application will subscribe to a twitter stream for a topic and would return number of people found in each image. We can then use this data to get advanced statistic like number of people in a time frame using RxJava buffer capabilities.\n\nAccording to [Wikipedia](https://en.wikipedia.org/wiki/People_counter),\n\n> **A people counter is a device that can be used to measure the number and direction of people traversing a certain passage or entrance. There are many possible use cases couple of them are mentioned below:**\n1. **In retail stores, people counting systems are used to calculate the conversion rate, i.e. the percentage of visitors that make purchases.**\n2. **In shopping centers, they can be used to measure the number of visitors.**\n\nNow, that we have understood what we are going to build today let's get started.\n\n## Prerequisite\n\n1. Knowledge of Java 8 is required. You can refer to [my Java 8 tutorial](https://github.com/shekhargulati/java8-the-missing-tutorial) in case you are new to it.\n2. You should have a Google Cloud Account. Create a new application and enable Cloud Vision API for it.\n3. Get Twitter application connection credentials. Create a new Twitter application at [https://apps.twitter.com/](https://apps.twitter.com/). This will give you the required credentials that you need to connect to Twitter API. At the end, you will have access to consumer key, consumer secret, access token, and access token secret.\n4. Basic knowledge of RxJava is required. You can refer to [my RxJava tutorial](http://blog.xebia.in/2015/09/01/day1-building-an-application-from-scratch-using-rxjava-and-java8/) in case you are new to it.\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## Step 1: Create a Java Gradle project\n\nGoogle Cloud Vision API exposes its REST API so you can build your application using any programming language. Google officially provide SDK for Java and Python. We will use Java SDK in this tutorial. Navigate to a convenient location on your file system and create a Gradle project with name ***people-counter***. You can scaffold a Gradle project using your IDE. Once project is created, open the `build.gradle` file and populate it with following contents.  \n\n```groovy\ngroup 'com.shekhargulati.52tech'\nversion '1.0-SNAPSHOT'\n\napply plugin: 'java'\n\nsourceCompatibility = 1.8\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    compile 'io.reactivex:rxjava:1.1.1'\n    compile 'org.twitter4j:twitter4j-stream:4.0.4'\n    compile 'com.google.apis:google-api-services-vision:v1-rev6-1.21.0'\n\n    testCompile group: 'junit', name: 'junit', version: '4.11'\n}\n```\n\nIn the build script shown above, we have added dependencies to `rxjava`, `twitter4j-stream`, and `google-api-services-vision` libraries. `rxjava` and `twitter4j-stream` libraries are required to convert a tweet stream to an `Observable`. `google-api-services-vision` provide us access to Cloud Vision API.\n\n## Step 2: Detecting faces in an image\n\nGoogle Cloud Vision API has many capabilities. The one that we will use in this blog is **face detection**. Face detection detects all the human faces in an image along with their position and emotions. Let's create a new class `FaceDetector` that will use Cloud Vision API to detect all the faces in an image.\n\n```java\nimport com.google.api.services.vision.v1.Vision;\nimport com.google.api.services.vision.v1.model.FaceAnnotation;\nimport java.nio.file.Path;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class FaceDetector {\n\n    private final Vision vision;\n\n    public FaceDetector(Vision vision) {\n        this.vision = vision;\n    }\n\n    public List<FaceAnnotation> detectFaces(Path image) throws IOException {\n        return Collections.emptyList();\n    }\n}\n```\nIn the code shown above:\n\n1. Constructor of FaceDetector takes Vision as its argument. This will help us inject Vision API instance from outside.\n2. `detectFaces` method will take an image path and return a list of `FaceAnnotation`. FaceAnnotation is a value object that contains result of face detection. If no images are detected in an image then empty result will be returned.\n\nLet's now fill the stub `detectFaces` implementation with the actual code.\n\n```java\nimport com.google.api.services.vision.v1.Vision;\nimport com.google.api.services.vision.v1.model.*;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class FaceDetector {\n\n    private final Vision vision;\n\n    public FaceDetector(Vision vision) {\n        this.vision = vision;\n    }\n\n    public List<FaceAnnotation> detectFaces(Path image) throws IOException {\n        BatchAnnotateImagesRequest batchRequest = new BatchAnnotateImagesRequest()\n                .setRequests(\n                        Collections.singletonList(\n                                new AnnotateImageRequest()\n                                        .setImage(new Image().encodeContent(Files.readAllBytes(image)))\n                                        .setFeatures(Collections.singletonList(new Feature().setType(\"FACE_DETECTION\").setMaxResults(10)))\n                        ));\n        Vision.Images.Annotate annotate = vision.images().annotate(batchRequest);\n        annotate.setDisableGZipContent(true);\n        BatchAnnotateImagesResponse batchAnnotateImagesResponse = annotate.execute();\n        if (batchAnnotateImagesResponse.getResponses().isEmpty()) {\n            return Collections.emptyList();\n        }\n        AnnotateImageResponse annotateImageResponse = batchAnnotateImagesResponse.getResponses().get(0);\n        return annotateImageResponse.getFaceAnnotations();\n    }\n}\n```\n\nIn the `detectFaces` method shown above we did the following:\n\n1. We created a `BatchAnnotateImagesRequest` instance. This allow us to batch multiple image annotation request into a single call.\n2. We populated `BatchAnnotateImagesRequest` with a single `AnnotateImageRequest`.`AnnotateImageRequest` is the request that we make to  Cloud Vision API to annotate `FACE_DETECTION` over the provided image. Each request consists of base64 encoded image data and a list of features to annotate on the image.\n4. Then, we got the `Images` collection from the `vision` instance and asked it to `annotate` our image.\n5. Next, we disabled Gzip as there is a bug in the Cloud Vision API that it fails for large gzipped images.\n6. Finally, we execute our `annotate` request. If there are no responses in the `BatchAnnotateImagesResponse` then we return an empty list else we get the first response and return its face annotations.\n\nLet's see face detection in action by running it over the following image.\n\n![](images/random-people.png)\n\nAs you can see in the image, there are three people in it so we should expect three face annotations.\n\n```java\nimport com.google.api.services.vision.v1.model.FaceAnnotation;\nimport org.junit.Test;\n\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.List;\n\nimport static org.hamcrest.CoreMatchers.equalTo;\nimport static org.junit.Assert.assertThat;\n\npublic class FaceDetectorTest {\n\n    @Test\n    public void shouldReturnFaceAnnotationsAllThreePeople() throws Exception {\n        Path image = Paths.get(\"src\", \"test\", \"resources\", \"random-people.png\");\n        FaceDetector faceDetector = new FaceDetector(GoogleVisionServiceFactory.getVisionServiceInstance(\"app\"));\n        List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(image);\n        assertThat(faceAnnotations.size(), equalTo(3));\n    }\n\n}\n```\n\nTo run the above test case, you have to set an environment variable `GOOGLE_APPLICATION_CREDENTIALS`. The value of `GOOGLE_APPLICATION_CREDENTIALS` environment variable is the path to Google Cloud service account file.\n\n```\n$ export GOOGLE_APPLICATION_CREDENTIALS=path_to_service_account_file\n```\n\nIf you run the test without setting `GOOGLE_APPLICATION_CREDENTIALS`, then you will get an exception with following message.\n\n> **The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.**\n\nCloud Vision API detected three faces. `faceAnnotations` list will contain three entries one for each detected face. Part of the `FaceAnnotation` is shown below.\n\n```javascript\n{\n  \"angerLikelihood\": \"VERY_UNLIKELY\",\n  \"blurredLikelihood\": \"VERY_UNLIKELY\",\n  \"detectionConfidence\": 0.9995242,\n  \"headwearLikelihood\": \"VERY_UNLIKELY\",\n  \"joyLikelihood\": \"VERY_LIKELY\",\n  \"landmarkingConfidence\": 0.64031124,\n  \"landmarks\": [\n    {\n      \"position\": {\n        \"x\": 1643.347,\n        \"y\": 318.13702,\n        \"z\": -4.753362E-4\n      },\n      \"type\": \"LEFT_EYE\"\n    },\n    {\n      \"position\": {\n        \"x\": 1728.9514,\n        \"y\": 315.09427,\n        \"z\": 9.495166\n      },\n      \"type\": \"RIGHT_EYE\"\n    },\n    ...// removed other for brevity\n  ],\n  \"panAngle\": 6.319743,\n  \"rollAngle\": -1.8814136,\n  \"sorrowLikelihood\": \"VERY_UNLIKELY\",\n  \"surpriseLikelihood\": \"VERY_UNLIKELY\",\n  \"tiltAngle\": -6.42992,\n  \"underExposedLikelihood\": \"VERY_UNLIKELY\"\n}\n```\n\nThe JSON response shown above give many more details about the detected face. As shown in the above response, it also contains emotion of the detected face. We can see that this detected face is in the joy mood as  `joyLikelihood` value is `VERY_LIKELY`.\n\nTo verify that it has found three faces we will draw a box around each face. I have copied this code from Google [sample application code](https://github.com/GoogleCloudPlatform/cloud-vision/blob/master/java/face_detection/src/main/java/com/google/cloud/vision/samples/facedetect/FaceDetectApp.java#L151).\n\n```java\n@Test\npublic void shouldReturnFaceAnnotationsAllThreePeople() throws Exception {\n    Path image = Paths.get(\"src\", \"test\", \"resources\", \"random-people.png\");\n    FaceDetector faceDetector = new FaceDetector(GoogleVisionServiceFactory.getVisionServiceInstance(\"image-sentiment-analyzer\"));\n    List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(image);\n    Path outputPath = ImageWriter.writeWithFaces(image, Paths.get(\"build\"), faceAnnotations);\n    System.out.println(\"Output file created at: \" + outputPath.toAbsolutePath().toString());\n    assertThat(faceAnnotations.size(), equalTo(3));\n}\n```\n\nAs you can see above, we are writing an image in the `build` directory using the ImageWriter. The output image will have the same name and extension as the original image. Green box signifies joy, red box signify sorrow, and orange color signify surprise.\n\n![](images/random-people-emotions.png)\n\n## Step 3: Counting people in an image\n\nCounting people in an image is very easy once we have `FaceAnnotation` for an image as shown below.\n\n```java\nimport com.google.api.services.vision.v1.Vision;\nimport com.google.api.services.vision.v1.model.FaceAnnotation;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.util.List;\n\n\npublic class PeopleCounter {\n\n    private final FaceDetector faceDetector;\n\n    public PeopleCounter(Vision vision) {\n        this.faceDetector = new FaceDetector(vision);\n    }\n\n    public ImagePeopleCount count(String imageUrl) {\n        try {\n            List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(urlToByteArray(imageUrl));\n            if (faceAnnotations.isEmpty()) {\n                return new ImagePeopleCount(imageUrl, 0);\n            }\n            return new ImagePeopleCount(imageUrl, faceAnnotations.size());\n        } catch (IOException e) {\n            return new ImagePeopleCount(imageUrl, 0);\n        }\n    }\n\n    public ImagePeopleCount count(Path image) throws IOException {\n        List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(Files.readAllBytes(image));\n        if (faceAnnotations.isEmpty()) {\n            return new ImagePeopleCount(image.toFile().getName(), 0);\n        }\n        return new ImagePeopleCount(image.toFile().getName(), faceAnnotations.size());\n    }\n\n\n    private byte[] urlToByteArray(String urlOfImage) {\n        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n        try (InputStream inputStream = new URL(urlOfImage).openStream()) {\n            byte[] byteChunk = new byte[4096];\n            int n;\n\n            while ((n = inputStream.read(byteChunk)) > 0) {\n                byteArrayOutputStream.write(byteChunk, 0, n);\n            }\n            return byteArrayOutputStream.toByteArray();\n        } catch (IOException e) {\n            System.err.printf(\"Failed while reading bytes from %s: %s\", urlOfImage, e.getMessage());\n            return new byte[0];\n        }\n    }\n\n}\n```\n\n`ImagePeopleCount` is our custom value object to store people count in an image.\n\n```java\npublic class ImagePeopleCount {\n\n    private final String image;\n    private final int count;\n\n    public ImagePeopleCount(String image, int count) {\n        this.image = image;\n        this.count = count;\n    }\n\n    public String getImage() {\n        return image;\n    }\n\n    public int getCount() {\n        return count;\n    }\n}\n```\n\nIn the `ImagePeopleCount`, we can also capture the count of joy, surprise, and sorrow likelihood. We can later use that information in our application to perform sentiment analysis of images.\n\nLet's test over `PeopleCounter` on the image shown below. PeopleCounter should detect one face only.\n\n![](images/monkey-and-man.jpg)\n\n```java\n@Test\npublic void shouldReturnOnlyAsCountInMonkeyAndManImage() throws Exception {\n    Path image = Paths.get(\"src\", \"test\", \"resources\", \"monkey-and-man.jpg\");\n    PeopleCounter peopleCounter = new PeopleCounter(GoogleVisionServiceFactory.getVisionServiceInstance(\"app\"));\n    ImagePeopleCount imagePeopleCount = peopleCounter.count(image);\n    assertThat(imagePeopleCount, equalTo(new ImagePeopleCount(\"monkey-and-man.jpg\", 1)));\n}\n```\n\n![](images/monkey-and-man-emotions.jpg)\n\n## Creating a Tweet Observable\n\nCreate a new class `TweetObservable` that will have a factory method to create an `Observable` as shown below.\n\n```java\nimport rx.Observable;\nimport twitter4j.*;\n\npublic final class TweetObservable {\n\n    public static Observable<Status> of(final String... searchKeywords) {\n        return Observable.create(subscriber -> {\n            final TwitterStream twitterStream = new TwitterStreamFactory().getInstance();\n            twitterStream.addListener(new StatusAdapter() {\n                public void onStatus(Status status) {\n                    subscriber.onNext(status);\n                }\n\n                public void onException(Exception ex) {\n                    subscriber.onError(ex);\n                }\n            });\n            FilterQuery query = new FilterQuery();\n            query.language(\"en\");\n            query.track(searchKeywords);\n            twitterStream.filter(query);\n        });\n\n\n    }\n}\n```\n\nThe code shown above does the following:\n\n1. It creates an `Observable` using the `Observable.create(OnSubscribe)` method.\n2. `Observable.create` method is passed an lambda expression that creates an instance of `TwitterStream` using the `TwitterStreamFactory`.\n3. We query Twitter for all the search terms received as method argument.\n4. The `twitterStream` instance is configured with a listener that will be invoked when a new status is received or an exception is encountered. When a new status is received then `subscriber.onNext()` is called with the status update. In case an error is encountered, subscriber `onError` method is invoked passing it the exception that was thrown.\n\n## PeopleCounterApp: Subscribing to Tweet Observable\n\n\n```java\nimport rx.Observable;\nimport twitter4j.MediaEntity;\nimport twitter4j.Status;\n\npublic class PeopleCounterApp {\n\n    public static void main(String[] args) throws Exception {\n        PeopleCounter peopleCounter = new PeopleCounter(GoogleVisionServiceFactory.getVisionServiceInstance(\"image-sentiment-analyzer\"));\n\n        Observable<Status> tweets = TweetObservable.of(\"Wenger\");\n\n        Observable<String> imageStream = tweets\n                .filter(status -> status.getExtendedMediaEntities().length > 0)\n                .flatMap(s -> Observable.from(s.getExtendedMediaEntities()))\n                .map(MediaEntity::getMediaURL);\n\n        imageStream\n                .map(image -> peopleCounter.count(image))\n                .take(20)\n                .subscribe(System.out::println, e -> e.printStackTrace());\n\n    }\n\n}\n\n```\n\nOutput is shown below.\n\n```\nOutput file created at: ~/09-cloudvision/people-counter/build/044cfa74-a843-4158-8635-13bc9d1c3f81\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNF-SWIAEtJf6.jpg', count=2}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUDzlHWEAAuRw2.jpg', count=0}\nOutput file created at: ~/09-cloudvision/people-counter/build/6465c325-7cdc-49c6-928c-b51ed8869a64\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUDzk2WwAAkKCD.jpg', count=1}\nOutput file created at: ~/09-cloudvision/people-counter/build/4f4314d8-45f3-47f4-a949-c21f6639ef3f\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNF-SWIAEtJf6.jpg', count=2}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUK-geUUAA45q3.jpg', count=0}\nOutput file created at: ~/09-cloudvision/people-counter/build/94807bdf-b497-4976-8f3e-8d8f7849c7ae\nImagePeopleCount{image='http://pbs.twimg.com/media/CcULAYQVAAAYSyk.jpg', count=1}\nOutput file created at: ~/09-cloudvision/people-counter/build/ac3ec34a-ebd3-4dc4-b8b8-205829829120\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUN0j6VAAQYQS7.jpg', count=1}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNzOPUcAAt77W.jpg', count=0}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUN0etUEAAWmvU.jpg', count=0}\nOutput file created at: ~/09-cloudvision/people-counter/build/e44d7b27-5730-4335-a3d8-d88fc9fb5ed3\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNF-SWIAEtJf6.jpg', count=2}\nImagePeopleCount{image='http://pbs.twimg.com/media/COzorzQWsAAPHVd.jpg', count=0}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUDMJtWAAApdC7.jpg', count=0}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUDMKWW0AEac-W.jpg', count=0}\nOutput file created at: ~/09-cloudvision/people-counter/build/cceb5a70-2ec4-48a6-8c51-89d8b0ddba74\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNX0sUUAAHHzl.jpg', count=4}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNXv3UAAA3n42.jpg', count=0}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUK-geUUAA45q3.jpg', count=0}\nOutput file created at: ~/09-cloudvision/people-counter/build/a5b795c1-80b5-47c2-a33b-53d4e74ced99\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNX0sUUAAHHzl.jpg', count=4}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNXv3UAAA3n42.jpg', count=0}\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUN2jPWAAAQf34.jpg', count=0}\nOutput file created at: ~/09-cloudvision/people-counter/build/e482890e-38bd-412d-b3f0-fb31f5d62f62\nImagePeopleCount{image='http://pbs.twimg.com/media/CcUNF-SWIAEtJf6.jpg', count=2}\n```\n\nThree images that standout for me are shown below.\n\n![](images/a64eb141-d2f2-403c-a81b-2d71d15a7359.jpg)\n\n![](images/ac3ec34a-ebd3-4dc4-b8b8-205829829120.jpg)\n\n![](images/cceb5a70-2ec4-48a6-8c51-89d8b0ddba74.jpg)\n\n\n----\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/12](https://github.com/shekhargulati/52-technologies-in-2016/issues/12).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/09-cloudvision)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "09-cloudvision/people-counter/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Gradle template\n.gradle\nbuild/\n\n# Ignore Gradle GUI config\ngradle-app.setting\n\n# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)\n!gradle-wrapper.jar\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n### Java template\n*.class\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Package Files #\n*.jar\n*.war\n*.ear\n\n# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml\nhs_err_pid*\n\n"
  },
  {
    "path": "09-cloudvision/people-counter/build.gradle",
    "content": "group 'com.shekhargulati.52tech'\nversion '1.0-SNAPSHOT'\n\napply plugin: 'java'\n\nsourceCompatibility = 1.8\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    compile 'io.reactivex:rxjava:1.1.1'\n    compile 'org.twitter4j:twitter4j-stream:4.0.4'\n    compile 'com.google.apis:google-api-services-vision:v1-rev6-1.21.0'\n\n    testCompile group: 'junit', name: 'junit', version: '4.11'\n}\n"
  },
  {
    "path": "09-cloudvision/people-counter/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Sun Feb 28 16:45:51 IST 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.5-all.zip\n"
  },
  {
    "path": "09-cloudvision/people-counter/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# For Cygwin, ensure paths are in UNIX format before anything is touched.\nif $cygwin ; then\n    [ -n \"$JAVA_HOME\" ] && JAVA_HOME=`cygpath --unix \"$JAVA_HOME\"`\nfi\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >&-\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >&-\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "09-cloudvision/people-counter/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "09-cloudvision/people-counter/settings.gradle",
    "content": "rootProject.name = 'people-counter'\n\n"
  },
  {
    "path": "09-cloudvision/people-counter/src/main/java/com/shekhargulati/peoplecounter/FaceDetector.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport com.google.api.services.vision.v1.Vision;\nimport com.google.api.services.vision.v1.model.*;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.util.Collections;\nimport java.util.List;\n\npublic class FaceDetector {\n\n    private final Vision vision;\n\n    public FaceDetector(Vision vision) {\n        this.vision = vision;\n    }\n\n    public List<FaceAnnotation> detectFaces(Path image) throws IOException {\n        return detectFaces(Files.readAllBytes(image));\n    }\n\n    public List<FaceAnnotation> detectFaces(byte[] image) throws IOException {\n        BatchAnnotateImagesRequest batchRequest = new BatchAnnotateImagesRequest()\n                .setRequests(\n                        Collections.singletonList(\n                                new AnnotateImageRequest()\n                                        .setImage(new Image().encodeContent(image))\n                                        .setFeatures(Collections.singletonList(new Feature().setType(\"FACE_DETECTION\").setMaxResults(10)))\n                        ));\n        Vision.Images.Annotate annotate = vision.images().annotate(batchRequest);\n        annotate.setDisableGZipContent(true);\n        BatchAnnotateImagesResponse batchAnnotateImagesResponse = annotate.execute();\n        if (batchAnnotateImagesResponse.getResponses().isEmpty()) {\n            return Collections.emptyList();\n        }\n        AnnotateImageResponse annotateImageResponse = batchAnnotateImagesResponse.getResponses().get(0);\n        return annotateImageResponse.getFaceAnnotations();\n    }\n}\n"
  },
  {
    "path": "09-cloudvision/people-counter/src/main/java/com/shekhargulati/peoplecounter/GoogleVisionServiceFactory.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport com.google.api.client.googleapis.auth.oauth2.GoogleCredential;\nimport com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;\nimport com.google.api.client.json.JsonFactory;\nimport com.google.api.client.json.jackson2.JacksonFactory;\nimport com.google.api.services.vision.v1.Vision;\nimport com.google.api.services.vision.v1.VisionScopes;\n\nimport java.io.IOException;\nimport java.security.GeneralSecurityException;\n\npublic abstract class GoogleVisionServiceFactory {\n\n    public static Vision getVisionServiceInstance(final String applicationName) throws IOException, GeneralSecurityException {\n        GoogleCredential credential =\n                GoogleCredential.getApplicationDefault().createScoped(VisionScopes.all());\n        JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();\n        return new Vision.Builder(GoogleNetHttpTransport.newTrustedTransport(), jsonFactory, credential)\n                .setApplicationName(applicationName)\n                .build();\n    }\n\n}\n"
  },
  {
    "path": "09-cloudvision/people-counter/src/main/java/com/shekhargulati/peoplecounter/ImagePeopleCount.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport java.util.Objects;\n\npublic class ImagePeopleCount {\n\n    private final String image;\n    private final int count;\n\n    public ImagePeopleCount(String image, int count) {\n        this.image = image;\n        this.count = count;\n    }\n\n    public String getImage() {\n        return image;\n    }\n\n    public int getCount() {\n        return count;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) return true;\n        if (o == null || getClass() != o.getClass()) return false;\n        ImagePeopleCount that = (ImagePeopleCount) o;\n        return count == that.count &&\n                Objects.equals(image, that.image);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(image, count);\n    }\n\n    @Override\n    public String toString() {\n        return \"ImagePeopleCount{\" +\n                \"image='\" + image + '\\'' +\n                \", count=\" + count +\n                '}';\n    }\n}\n"
  },
  {
    "path": "09-cloudvision/people-counter/src/main/java/com/shekhargulati/peoplecounter/ImageWriter.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport com.google.api.services.vision.v1.model.FaceAnnotation;\nimport com.google.api.services.vision.v1.model.Vertex;\nimport com.google.common.io.Files;\n\nimport javax.imageio.ImageIO;\nimport java.awt.*;\nimport java.awt.image.BufferedImage;\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URL;\nimport java.nio.file.Path;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.UUID;\n\npublic class ImageWriter {\n\n    public static Path writeWithFaces1(String urlOfImage, Path outputPath, List<FaceAnnotation> faces) throws IOException {\n        URL url = new URL(urlOfImage);\n        BufferedImage img = ImageIO.read(url.openStream());\n        annotateWithFaces(img, faces);\n        File output = outputPath.resolve(UUID.randomUUID().toString()).toFile();\n        ImageIO.write(img, \"jpg\", output);\n        return output.toPath();\n    }\n\n    public static Path writeWithFaces(Path inputPath, Path outputPath, List<FaceAnnotation> faces) throws IOException {\n        BufferedImage img = ImageIO.read(inputPath.toFile());\n        annotateWithFaces(img, faces);\n        File output = outputPath.resolve(inputPath.getFileName()).toFile();\n        ImageIO.write(img, Files.getFileExtension(inputPath.toAbsolutePath().toString()), output);\n        return output.toPath();\n    }\n\n    private static void annotateWithFaces(BufferedImage img, List<FaceAnnotation> faces) {\n        for (FaceAnnotation face : faces) {\n            annotateWithFace(img, face);\n        }\n    }\n\n    private static void annotateWithFace(BufferedImage img, FaceAnnotation face) {\n        Graphics2D gfx = img.createGraphics();\n        Polygon poly = new Polygon();\n        for (Vertex vertex : face.getFdBoundingPoly().getVertices()) {\n            poly.addPoint(vertex.getX(), vertex.getY());\n        }\n        gfx.setStroke(new BasicStroke(10));\n        List<String> likelihoods = Arrays.asList(\"LIKELY\", \"VERY_LIKELY\");\n        if (likelihoods.contains(face.getJoyLikelihood())) {\n            gfx.setColor(new Color(0x50FF1C));\n        } else if (likelihoods.contains(face.getSorrowLikelihood())) {\n            gfx.setColor(new Color(0xFF151F));\n        } else if (likelihoods.contains(face.getSurpriseLikelihood())) {\n            gfx.setColor(new Color(0xFFA631));\n        } else {\n            gfx.setColor(new Color(0xFFEE27));\n        }\n        gfx.draw(poly);\n    }\n\n\n}\n"
  },
  {
    "path": "09-cloudvision/people-counter/src/main/java/com/shekhargulati/peoplecounter/PeopleCounter.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport com.google.api.services.vision.v1.Vision;\nimport com.google.api.services.vision.v1.model.FaceAnnotation;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.List;\n\n\npublic class PeopleCounter {\n\n    private final FaceDetector faceDetector;\n\n    public PeopleCounter(Vision vision) {\n        this.faceDetector = new FaceDetector(vision);\n    }\n\n    public ImagePeopleCount count(String imageUrl) {\n        try {\n            List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(urlToByteArray(imageUrl));\n            if (faceAnnotations == null || faceAnnotations.isEmpty()) {\n                return new ImagePeopleCount(imageUrl, 0);\n            }\n            Path outputPath = ImageWriter.writeWithFaces1(imageUrl, Paths.get(\"build\"), faceAnnotations);\n            System.out.println(\"Output file created at: \" + outputPath.toAbsolutePath().toString());\n            return new ImagePeopleCount(imageUrl, faceAnnotations.size());\n        } catch (IOException e) {\n            return new ImagePeopleCount(imageUrl, 0);\n        }\n    }\n\n    public ImagePeopleCount count(Path image) throws IOException {\n        List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(Files.readAllBytes(image));\n        if (faceAnnotations.isEmpty()) {\n            return new ImagePeopleCount(image.toFile().getName(), 0);\n        }\n        return new ImagePeopleCount(image.toFile().getName(), faceAnnotations.size());\n    }\n\n\n    private byte[] urlToByteArray(String urlOfImage) {\n        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n        try (InputStream inputStream = new URL(urlOfImage).openStream()) {\n            byte[] byteChunk = new byte[4096];\n            int n;\n\n            while ((n = inputStream.read(byteChunk)) > 0) {\n                byteArrayOutputStream.write(byteChunk, 0, n);\n            }\n            return byteArrayOutputStream.toByteArray();\n        } catch (IOException e) {\n            System.err.printf(\"Failed while reading bytes from %s: %s\", urlOfImage, e.getMessage());\n            return new byte[0];\n        }\n    }\n\n}"
  },
  {
    "path": "09-cloudvision/people-counter/src/main/java/com/shekhargulati/peoplecounter/PeopleCounterApp.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport rx.Observable;\nimport twitter4j.MediaEntity;\nimport twitter4j.Status;\n\nimport java.util.concurrent.TimeUnit;\n\npublic class PeopleCounterApp {\n\n    public static void main(String[] args) throws Exception {\n        PeopleCounter peopleCounter = new PeopleCounter(GoogleVisionServiceFactory.getVisionServiceInstance(\"image-sentiment-analyzer\"));\n\n        Observable<Status> tweets = TweetObservable.of(\"Wenger\");\n\n        Observable<String> imageStream = tweets\n                .filter(status -> status.getExtendedMediaEntities().length > 0)\n                .flatMap(s -> Observable.from(s.getExtendedMediaEntities()))\n                .map(MediaEntity::getMediaURL);\n\n        imageStream\n                .map(image -> peopleCounter.count(image))\n                .subscribe(System.out::println, e -> e.printStackTrace());\n\n//        Observable<AnnotateImageResponse> annotateImageResponseObservable = imageStream.buffer(5).doOnNext(System.out::println).flatMap(images -> Observable.from(peopleCounter.annotateImageUrls(images)));\n//        annotateImageResponseObservable.forEach(r -> r.getFaceAnnotations().forEach(System.out::println));\n    }\n\n}\n"
  },
  {
    "path": "09-cloudvision/people-counter/src/main/java/com/shekhargulati/peoplecounter/TweetObservable.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport rx.Observable;\nimport twitter4j.*;\n\npublic final class TweetObservable {\n\n    public static Observable<Status> of(final String... searchKeywords) {\n        return Observable.create(subscriber -> {\n            final TwitterStream twitterStream = new TwitterStreamFactory().getInstance();\n            twitterStream.addListener(new StatusAdapter() {\n                public void onStatus(Status status) {\n                    subscriber.onNext(status);\n                }\n\n                public void onException(Exception ex) {\n                    subscriber.onError(ex);\n                }\n            });\n            FilterQuery query = new FilterQuery();\n            query.language(\"en\");\n            query.track(searchKeywords);\n            twitterStream.filter(query);\n        });\n\n\n    }\n}"
  },
  {
    "path": "09-cloudvision/people-counter/src/test/java/com/shekhargulati/peoplecounter/FaceDetectorTest.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport com.google.api.services.vision.v1.model.FaceAnnotation;\nimport org.junit.Test;\n\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.List;\n\nimport static org.hamcrest.CoreMatchers.equalTo;\nimport static org.junit.Assert.assertThat;\n\npublic class FaceDetectorTest {\n\n//    @Test\n    public void shouldReturnFaceAnnotationsAllThreePeople() throws Exception {\n        Path image = Paths.get(\"src\", \"test\", \"resources\", \"random-people.png\");\n        FaceDetector faceDetector = new FaceDetector(GoogleVisionServiceFactory.getVisionServiceInstance(\"image-sentiment-analyzer\"));\n        List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(image);\n        Path outputPath = ImageWriter.writeWithFaces(image, Paths.get(\"build\"), faceAnnotations);\n        System.out.println(\"Output file created at: \" + outputPath.toAbsolutePath().toString());\n        assertThat(faceAnnotations.size(), equalTo(3));\n    }\n\n    @Test\n    public void shouldReturnFaceAnnotationForManOnly() throws Exception {\n        Path image = Paths.get(\"src\", \"test\", \"resources\", \"monkey-and-man.jpg\");\n        FaceDetector faceDetector = new FaceDetector(GoogleVisionServiceFactory.getVisionServiceInstance(\"image-sentiment-analyzer\"));\n        List<FaceAnnotation> faceAnnotations = faceDetector.detectFaces(image);\n        Path outputPath = ImageWriter.writeWithFaces(image, Paths.get(\"build\"), faceAnnotations);\n        System.out.println(\"Output file created at: \" + outputPath.toAbsolutePath().toString());\n        assertThat(faceAnnotations.size(), equalTo(1));\n    }\n}"
  },
  {
    "path": "09-cloudvision/people-counter/src/test/java/com/shekhargulati/peoplecounter/PeopleCounterTest.java",
    "content": "package com.shekhargulati.peoplecounter;\n\nimport org.junit.Test;\n\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\n\nimport static org.hamcrest.CoreMatchers.equalTo;\nimport static org.junit.Assert.assertThat;\n\npublic class PeopleCounterTest {\n\n    @Test\n    public void shouldReturnPeopleCountInAnImage() throws Exception {\n        Path image = Paths.get(\"src\", \"test\", \"resources\", \"random-people.png\");\n        PeopleCounter peopleCounter = new PeopleCounter(GoogleVisionServiceFactory.getVisionServiceInstance(\"image-sentiment-analyzer\"));\n        ImagePeopleCount imagePeopleCount = peopleCounter.count(image);\n        assertThat(imagePeopleCount, equalTo(new ImagePeopleCount(\"random-people.png\", 3)));\n    }\n\n    @Test\n    public void shouldReturnOnlyPeopleCountInAnImage() throws Exception {\n        Path image = Paths.get(\"src\", \"test\", \"resources\", \"monkey-and-man.jpg\");\n        PeopleCounter peopleCounter = new PeopleCounter(GoogleVisionServiceFactory.getVisionServiceInstance(\"image-sentiment-analyzer\"));\n        ImagePeopleCount imagePeopleCount = peopleCounter.count(image);\n        assertThat(imagePeopleCount, equalTo(new ImagePeopleCount(\"monkey-and-man.jpg\", 1)));\n    }\n\n}"
  },
  {
    "path": "09-cloudvision/people-counter/src/test/resources/response.json",
    "content": "{\n  \"angerLikelihood\": \"VERY_UNLIKELY\",\n  \"blurredLikelihood\": \"VERY_UNLIKELY\",\n  \"boundingPoly\": {\n    \"vertices\": [\n      {\n        \"x\": 1534,\n        \"y\": 159\n      },\n      {\n        \"x\": 1821,\n        \"y\": 159\n      },\n      {\n        \"x\": 1821,\n        \"y\": 493\n      },\n      {\n        \"x\": 1534,\n        \"y\": 493\n      }\n    ]\n  },\n  \"detectionConfidence\": 0.9995242,\n  \"fdBoundingPoly\": {\n    \"vertices\": [\n      {\n        \"x\": 1569,\n        \"y\": 245\n      },\n      {\n        \"x\": 1789,\n        \"y\": 245\n      },\n      {\n        \"x\": 1789,\n        \"y\": 464\n      },\n      {\n        \"x\": 1569,\n        \"y\": 464\n      }\n    ]\n  },\n  \"headwearLikelihood\": \"VERY_UNLIKELY\",\n  \"joyLikelihood\": \"VERY_LIKELY\",\n  \"landmarkingConfidence\": 0.64031124,\n  \"landmarks\": [\n    {\n      \"position\": {\n        \"x\": 1643.347,\n        \"y\": 318.13702,\n        \"z\": -4.753362E-4\n      },\n      \"type\": \"LEFT_EYE\"\n    },\n    {\n      \"position\": {\n        \"x\": 1728.9514,\n        \"y\": 315.09427,\n        \"z\": 9.495166\n      },\n      \"type\": \"RIGHT_EYE\"\n    },\n    {\n      \"position\": {\n        \"x\": 1610.0543,\n        \"y\": 303.5824,\n        \"z\": 3.7295928\n      },\n      \"type\": \"LEFT_OF_LEFT_EYEBROW\"\n    },\n    {\n      \"position\": {\n        \"x\": 1666.073,\n        \"y\": 302.90125,\n        \"z\": -16.318792\n      },\n      \"type\": \"RIGHT_OF_LEFT_EYEBROW\"\n    },\n    {\n      \"position\": {\n        \"x\": 1708.9219,\n        \"y\": 299.90326,\n        \"z\": -11.835677\n      },\n      \"type\": \"LEFT_OF_RIGHT_EYEBROW\"\n    },\n    {\n      \"position\": {\n        \"x\": 1757.9265,\n        \"y\": 296.3871,\n        \"z\": 19.386026\n      },\n      \"type\": \"RIGHT_OF_RIGHT_EYEBROW\"\n    },\n    {\n      \"position\": {\n        \"x\": 1688.3384,\n        \"y\": 319.3402,\n        \"z\": -13.357309\n      },\n      \"type\": \"MIDPOINT_BETWEEN_EYES\"\n    },\n    {\n      \"position\": {\n        \"x\": 1692.4175,\n        \"y\": 371.542,\n        \"z\": -32.907703\n      },\n      \"type\": \"NOSE_TIP\"\n    },\n    {\n      \"position\": {\n        \"x\": 1690.6069,\n        \"y\": 399.52835,\n        \"z\": -9.388818\n      },\n      \"type\": \"UPPER_LIP\"\n    },\n    {\n      \"position\": {\n        \"x\": 1691.3741,\n        \"y\": 428.58008,\n        \"z\": 0.27963614\n      },\n      \"type\": \"LOWER_LIP\"\n    },\n    {\n      \"position\": {\n        \"x\": 1650.1881,\n        \"y\": 410.75372,\n        \"z\": 12.415997\n      },\n      \"type\": \"MOUTH_LEFT\"\n    },\n    {\n      \"position\": {\n        \"x\": 1725.9355,\n        \"y\": 405.6969,\n        \"z\": 19.853842\n      },\n      \"type\": \"MOUTH_RIGHT\"\n    },\n    {\n      \"position\": {\n        \"x\": 1690.7727,\n        \"y\": 412.63086,\n        \"z\": -1.4059759\n      },\n      \"type\": \"MOUTH_CENTER\"\n    },\n    {\n      \"position\": {\n        \"x\": 1712.815,\n        \"y\": 371.5016,\n        \"z\": 3.4994051\n      },\n      \"type\": \"NOSE_BOTTOM_RIGHT\"\n    },\n    {\n      \"position\": {\n        \"x\": 1664.2583,\n        \"y\": 376.5078,\n        \"z\": -1.4644238\n      },\n      \"type\": \"NOSE_BOTTOM_LEFT\"\n    },\n    {\n      \"position\": {\n        \"x\": 1690.7123,\n        \"y\": 383.2276,\n        \"z\": -11.641196\n      },\n      \"type\": \"NOSE_BOTTOM_CENTER\"\n    },\n    {\n      \"position\": {\n        \"x\": 1643.5625,\n        \"y\": 315.73096,\n        \"z\": -6.327764\n      },\n      \"type\": \"LEFT_EYE_TOP_BOUNDARY\"\n    },\n    {\n      \"position\": {\n        \"x\": 1661.504,\n        \"y\": 321.86572,\n        \"z\": 2.452986\n      },\n      \"type\": \"LEFT_EYE_RIGHT_CORNER\"\n    },\n    {\n      \"position\": {\n        \"x\": 1642.8551,\n        \"y\": 325.0818,\n        \"z\": -0.09066931\n      },\n      \"type\": \"LEFT_EYE_BOTTOM_BOUNDARY\"\n    },\n    {\n      \"position\": {\n        \"x\": 1624.4496,\n        \"y\": 320.87357,\n        \"z\": 6.224466\n      },\n      \"type\": \"LEFT_EYE_LEFT_CORNER\"\n    },\n    {\n      \"position\": {\n        \"x\": 1642.0294,\n        \"y\": 321.40692,\n        \"z\": -2.3310559\n      },\n      \"type\": \"LEFT_EYE_PUPIL\"\n    },\n    {\n      \"position\": {\n        \"x\": 1729.2927,\n        \"y\": 311.8835,\n        \"z\": 3.1165946\n      },\n      \"type\": \"RIGHT_EYE_TOP_BOUNDARY\"\n    },\n    {\n      \"position\": {\n        \"x\": 1745.3657,\n        \"y\": 315.3733,\n        \"z\": 19.397648\n      },\n      \"type\": \"RIGHT_EYE_RIGHT_CORNER\"\n    },\n    {\n      \"position\": {\n        \"x\": 1730.0469,\n        \"y\": 321.18,\n        \"z\": 9.41447\n      },\n      \"type\": \"RIGHT_EYE_BOTTOM_BOUNDARY\"\n    },\n    {\n      \"position\": {\n        \"x\": 1712.336,\n        \"y\": 319.4284,\n        \"z\": 8.159104\n      },\n      \"type\": \"RIGHT_EYE_LEFT_CORNER\"\n    },\n    {\n      \"position\": {\n        \"x\": 1729.9996,\n        \"y\": 317.4588,\n        \"z\": 7.2813854\n      },\n      \"type\": \"RIGHT_EYE_PUPIL\"\n    },\n    {\n      \"position\": {\n        \"x\": 1639.5662,\n        \"y\": 291.88696,\n        \"z\": -14.020154\n      },\n      \"type\": \"LEFT_EYEBROW_UPPER_MIDPOINT\"\n    },\n    {\n      \"position\": {\n        \"x\": 1732.6587,\n        \"y\": 287.66702,\n        \"z\": -3.7664485\n      },\n      \"type\": \"RIGHT_EYEBROW_UPPER_MIDPOINT\"\n    },\n    {\n      \"position\": {\n        \"x\": 1576.9946,\n        \"y\": 355.6648,\n        \"z\": 104.98196\n      },\n      \"type\": \"LEFT_EAR_TRAGION\"\n    },\n    {\n      \"position\": {\n        \"x\": 1772.6978,\n        \"y\": 345.50574,\n        \"z\": 125.82507\n      },\n      \"type\": \"RIGHT_EAR_TRAGION\"\n    },\n    {\n      \"position\": {\n        \"x\": 1687.5614,\n        \"y\": 300.04626,\n        \"z\": -17.656202\n      },\n      \"type\": \"FOREHEAD_GLABELLA\"\n    },\n    {\n      \"position\": {\n        \"x\": 1691.262,\n        \"y\": 465.7209,\n        \"z\": 16.377066\n      },\n      \"type\": \"CHIN_GNATHION\"\n    },\n    {\n      \"position\": {\n        \"x\": 1592.9967,\n        \"y\": 412.50565,\n        \"z\": 76.95209\n      },\n      \"type\": \"CHIN_LEFT_GONION\"\n    },\n    {\n      \"position\": {\n        \"x\": 1768.9939,\n        \"y\": 404.56512,\n        \"z\": 96.339745\n      },\n      \"type\": \"CHIN_RIGHT_GONION\"\n    }\n  ],\n  \"panAngle\": 6.319743,\n  \"rollAngle\": -1.8814136,\n  \"sorrowLikelihood\": \"VERY_UNLIKELY\",\n  \"surpriseLikelihood\": \"VERY_UNLIKELY\",\n  \"tiltAngle\": -6.42992,\n  \"underExposedLikelihood\": \"VERY_UNLIKELY\"\n}"
  },
  {
    "path": "10-gatling/README.md",
    "content": "Gatling: The Ultimate Load Testing Tools for Programmers\n--------\n\nWelcome to the tenth blog of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)  blog series. **Gatling** is a high performance open source **load testing** tool built on top of Scala, Netty, and Akka. It is a next generation, modern load testing tools very different from existing tools like Apache JMeter. **[Load testing](https://en.wikipedia.org/wiki/Load_testing)** is conducted to understand behavior of an application under load. You put load on the application by simulating users and measure its response time to understand how application will behave under both normal and anticipated peak load conditions.\n\nGatling can be used to load test your HTTP server. HTTP is not the only protocol that one can load test with Gatling. Gatling also has inbuilt support for Web Socket and JMS protocols. You can extend Gatling to support your protocol of choice.\n\nLoad testing is often neglected by most software teams resulting in poor understanding of their application performance characteristics. These days most software teams take unit testing and functional testing seriously but still they ignore load testing. They write unit tests, integration tests, and functional tests and integrate them in their software build. I think part of the reason developer still don't write load tests has to do with the fact that most load testing tools are GUI based so you can't code your load tests. They allow you to export your load test as XML.\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## Why Gatling?\n\nGatling is not the only load testing tool. There are many load testing tools both open source and commercial. These includes [Apache JMeter](https://jmeter.apache.org/), [Grinder](http://grinder.sourceforge.net/), [Load Runner](https://en.wikipedia.org/wiki/HP_LoadRunner), and [many other](http://www.opensourcetesting.org/performance.php). Some of the reasons you should choose Gatling are:\n\n1. Most of the traditional load testing tool simulate virtual users using threads. One virtual user is equal to one thread. This approach is not very resource efficient involving a lot of content switching and overhead. Gatling on the another hand uses Akka messages to simulate users. This allows Gatling to simulate thousands of virtual user in a very cheap and efficient way.\n\n2. Gatling is designed asynchronous in nature. It uses Netty to perform non-blocking IO(NIO).\n\n3. A programmatic way to write load tests. Gatling provides a Scala DSL to write performance tests.\n\n4. It produce rich reports that give information in terms of percentile rather than just min, max, and mean.\n\n5. It is extensible in nature so you can add support for protocols of your choice.\n\n6. It has very good build tool support making it very easy plug your load tests in your continuous delivery pipeline.\n\n## Prerequisite\n\nTo use Gatling, you need to have at least **JDK7u6** installed on your operating system. We will write Gatling load test scenarios against a WordPress application running on OpenShift. [OpenShift](http://openshift.com/) Online is a Platform-as-a-service solution from Red Hat. It has a free tier that allows developers to build and test 3 applications without any upfront cost. In the free tier, application run inside a gear that is 512MB in RAM size and 1GB in disk space. To create a WordPress application, sign in using your OpenShift account and then go to [https://openshift.redhat.com/app/console/application_type/quickstart!1](https://openshift.redhat.com/app/console/application_type/quickstart!1) to create a WordPress application by giving it a name. Once created, your WordPress application will be running at `https://{app-name}-{domain-name}.rhcloud.com/`. My blog is running at [https://my-shekharblogs.rhcloud.com/](https://my-shekharblogs.rhcloud.com/).\n\n## Using Gatling\n\nGatling can be used in two ways:\n\n1. You can create a Scala SBT/Maven/Gradle project and write load test scenarios using its Scala DSL. In this blog, we will use SBT. Create a new directory named `blog` on your filesystem and change directory to it. Create a `build.sbt` file and populate it with following content. Now we will write load test scenarios using Gatling Scala DSL. In this blog, we will use this approach. We are adding required Gatling dependencies in the `build.sbt`.\n  ```scala\n  name := \"blog-load-tests\"\n  version := \"0.1.0\"\n\n  scalaVersion := \"2.11.7\"\n\n  libraryDependencies += \"io.gatling.highcharts\" % \"gatling-charts-highcharts\" % \"2.1.7\" % \"test\"\n  libraryDependencies += \"io.gatling\" % \"gatling-test-framework\" % \"2.1.7\" % \"test\"\n  ```\n2. The second way to use Gatling is to record test scenarios using Recorder. Recorder is a tool provided with Gatling that allows you to record your actions on a web application and export them as a Gatling scenario. To use it, you have to download the [Gatling bundle](https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/2.1.7/gatling-charts-highcharts-bundle-2.1.7-bundle.zip) and then run `recorder.sh` or `recorder.bat` depending on your operating system.\n\n## Enabling Gatling plugin\n\nIn the previous step, we create a SBT project and added Gatling dependencies. Now, we will enable Gatling plugin so that we can execute our Gatling test scenarios. Create `plugins.sbt` inside the `project` directory and populate it with following contents.\n\n```scala\naddSbtPlugin(\"io.gatling\" % \"gatling-sbt\" % \"2.1.5\")\n```\n\nNow, enable plugin by adding following line to `build.sbt`.\n\n```scala\nenablePlugins(GatlingPlugin)\n```\n\n## Writing your first Gatling scenario\n\nLet's start by writing the first scenario to load test our WordPress application. In our scenario, we will simulate 10 new users accessing our WordPress blog every one second for total of 10 seconds. They all will make a GET request to the home page and pause for 1 second.\n\nInside `src/test/scala` directory, create a new Scala class `AccessHomePageSimulation` inside the `loadtests` package as shown below.\n\n```scala\npackage loadtests\n\nimport io.gatling.core.Predef._\nimport io.gatling.http.Predef._\nimport scala.concurrent.duration._\n\nclass AccessHomePageSimulation extends Simulation {\n\n}\n```\n\nIn the code shown above:\n\n1. We imported all the required imports. The first two import statements imports all the required Gatling classes and traits. The `scala.concurrent.duration` package will be required to specify duration of our test scenarios.\n2. We created a Scala class `AccessHomePageSimulation` which extends Gatling `Simulation` abstract class. A simulation represents a load test specification. It describes different scenarios will be executed.\n\nNext, we will write our test scenario as shown below.\n\n```scala\nimport io.gatling.core.Predef._\nimport io.gatling.http.Predef._\nimport scala.concurrent.duration._\n\nclass AccessHomePageSimulation extends Simulation {\n\n  val blogHttpConf = http\n    .baseURL(\"https://my-shekharblogs.rhcloud.com\")\n    .acceptHeader(\"text/html\")\n    .userAgentHeader(\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116\")\n    .acceptLanguageHeader(\"en-US,en;q=0.8,pt;q=0.6\")\n\n  val scenario1 = scenario(\"Access Home Page\")\n    .exec(\n      http(\"GetHomePageRequest\")\n        .get(\"/\")\n        .check(status.is(_ => 200))\n    )\n    .pause(1)\n\n  setUp(\n    scenario1.inject(rampUsers(100) over 10)\n  ).protocols(blogHttpConf)\n\n}\n```\n\nThe code shown above does the following:\n\n1. First, we created the HTTP configuration object that will store request URL and accept headers.\n2. Second, we created our scenario which makes a GET request to home page and pause for 1 second.\n3. Finally, we simulated our 100 virtual users using `rampUsers` method. We are ramping 100 users over 10 seconds so every one second we will have 10 new users.\n\nIf you want to start all the users at once then you can use `atOnceUsers` method as shown below.\n\n```scala\nsetUp(\n  scenario1.inject(atOnceUsers(100))\n).protocols(blogHttpConf)\n```\n\nYou can run the test case using SBT by either running `test` command from within SBT shell or by running `sbt test` command. It will render the test summary on the terminal as shown below.\n\n```\nGenerating reports...\n\n================================================================================\n---- Global Information --------------------------------------------------------\n> request count                                        100 (OK=100    KO=0     )\n> min response time                                   1514 (OK=1514   KO=-     )\n> max response time                                   2899 (OK=2899   KO=-     )\n> mean response time                                  1773 (OK=1773   KO=-     )\n> std deviation                                        261 (OK=261    KO=-     )\n> response time 50th percentile                       1658 (OK=1658   KO=-     )\n> response time 75th percentile                       1814 (OK=1814   KO=-     )\n> mean requests/sec                                  7.987 (OK=7.987  KO=-     )\n---- Response Time Distribution ------------------------------------------------\n> t < 800 ms                                             0 (  0%)\n> 800 ms < t < 1200 ms                                   0 (  0%)\n> t > 1200 ms                                          100 (100%)\n> failed                                                 0 (  0%)\n================================================================================\n```\n\nThe output generated above mentions the key point. We can gather that none of the request failed and all of the requests took more than 1200 ms to execute. We can also see the min, max, and mean response times. The most important statistics is the percentile response times. 50% of the requests have response time less than 1658 ms and 75% of the requests have response time less than 1814 ms.\n\nGatling also generates a HTML report that you can use to drill down on details. The location to the file will be mentioned in the terminal output as shown below.\n\n```\nReports generated in 0s.\nPlease open the following file: /Users/shekhargulati/52-technologies-in-2016/10-gatling/blog/target/gatling/accesshomepagesimulation-1457270287042/index.html\n[info] Simulation AccessHomePageSimulation successful.\n[info] Simulation(s) execution ended.\n```\n\nThe HTML report is generated inside the `accesshomepagesimulation-1457270287042`. You can open the report using your favorite browser. The summary that we saw on the terminal is also mentioned on the web page as shown below.\n\n![](images/summary-all.png)\n\nYou can also view response time percentile over time and number of requests per second.\n\n![](images/graph1.png)\n\n## Conclusion\n\nGatling is a very valuable tool that can help you discover application bottlenecks. You can use the feedback to improve your application performance. There are many other features of Gatling that I have not covered in this blog like dynamic data using Feeders, using loops to perform repetitive tasks, and checking failures. You can refer to [Gatling documentation](http://gatling.io/docs/2.1.7/advanced_tutorial.html#advanced-tutorial) to learn more.\n\nThat's all for this week. Please provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/13](https://github.com/shekhargulati/52-technologies-in-2016/issues/13).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/10-gatling)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "10-gatling/blog/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n### SBT template\n# Simple Build Tool\n# http://www.scala-sbt.org/release/docs/Getting-Started/Directories.html#configuring-version-control\n\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\n.history\n.cache\n\n"
  },
  {
    "path": "10-gatling/blog/build.sbt",
    "content": "name := \"blog-load-tests\"\nversion := \"0.1.0\"\n\nscalaVersion := \"2.11.7\"\n\nenablePlugins(GatlingPlugin)\n\nlibraryDependencies += \"io.gatling.highcharts\" % \"gatling-charts-highcharts\" % \"2.1.7\" % \"test\"\nlibraryDependencies += \"io.gatling\" % \"gatling-test-framework\" % \"2.1.7\" % \"test\"\n\n"
  },
  {
    "path": "10-gatling/blog/project/plugins.sbt",
    "content": "addSbtPlugin(\"io.gatling\" % \"gatling-sbt\" % \"2.1.5\")\n"
  },
  {
    "path": "10-gatling/blog/src/test/scala/loadtests/AccessHomePageSimulation.scala",
    "content": "package loadtests\n\nimport io.gatling.core.Predef._\nimport io.gatling.http.Predef._\nimport scala.concurrent.duration._\n\nclass AccessHomePageSimulation extends Simulation {\n\n  val blogHttpConf = http\n    .baseURL(\"https://my-shekharblogs.rhcloud.com\")\n    .acceptHeader(\"text/html\")\n    .userAgentHeader(\"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116\")\n    .acceptLanguageHeader(\"en-US,en;q=0.8,pt;q=0.6\")\n\n  val scenario1 = scenario(\"Access Home Page\")\n    .exec(\n      http(\"GetHomePageRequest\")\n        .get(\"/\")\n        .check(status.is(_ => 200))\n    )\n    .pause(1)\n\n  setUp(\n    scenario1.inject(rampUsers(100) over 10)\n  ).protocols(blogHttpConf)\n\n}\n"
  },
  {
    "path": "11-textblob/README.md",
    "content": "Sentiment Analysis in Python with TextBlob\n-----\n\nWelcome to the eleventh blog of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)  blog series. If you are following this series then you would have probably noticed that I already wrote week 11 blog on [tweet deduplication](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/11-tweet-deduplication). I was not happy with the content so I decide to write another blog for week 11.\n\nIn week 11, I decided to spend time to learn about text processing using the Python programming language. We will only focus on Sentiment Analysis in this blog. I have written about sentiment analysis multiple times in last few years. We learnt how to do sentiment analysis in Scala using Stanford CoreNLP in [week 3 blog](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/03-stanford-corenlp). Sentiment analysis gives you the power to mine emotions in text. This can help you build awesome applications that understand human behavior. Few years back, I built an application that helped me decide if I should watch a movie or not by doing sentiment analysis on social media data for a movie. There are many possible applications of Sentiment analysis like understanding customer sentiment for a product by analysis of reviews.\n\nIn this blog, I will talk about a Python package called [TextBlob](https://textblob.readthedocs.org/) which can help developers solve understand sentiments in their text. We will first cover some basics, and then we will develop a simple Python Flask application which will use the TextBlob API.\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## What is TextBlob?\n\nIn this blog, I will talk about a Python package called [TextBlob](https://textblob.readthedocs.org/en/). TextBlob is an open source text processing library written in Python. It can be used to perform various natural language processing tasks such as part-of-speech tagging, noun-phrase extraction, sentiment analysis, text translation, and many more. You can read about all the features supported by TextBlog in the official [documentation](https://textblob.readthedocs.org/en/).\nTextBlob stands on strong shoulders of [NTLK](http://www.nltk.org/), which is the leading platform for building Python programs to work with human language data.\n\n## Prerequisite\n\nTo follow this blog, you need to have following on your machine:\n\n1. **Python**: You can download Python executable for your operating system from [https://www.python.org/downloads/](https://www.python.org/downloads/). I will be using Python 2.7.11 version.\n\n2. **Virtualenv**: Virtualenv tool allows you to create isolated Python environments without polluting the global Python installation. This allows you to use multiple Python versions easily on a single machine. Please refer to official documentation for [installation](https://virtualenv.pypa.io/en/latest/installation.html) instructions.\n\n## Github Repository\n\nThe code for demo application is available on github at [sentiment-analyzer](./sentiment-analyzer).\n\n## Application\n\nThe demo application is running on OpenShift [https://sentimentanalysis-52tech.rhcloud.com/](https://sentimentanalysis-52tech.rhcloud.com/). It is a very simple example of using TextBlob sentiment analysis API. You type the text in the textarea shown in the left and press button, then you will see the text in different color on right. If text color is **Green** then review is positive, if text color is **Red** then review is negative, or it text color is **Orange** then text is neutral.\n\n![](images/positive.png)\n![](images/negative1.png)\n![](images/negative2.png)\n\n## Building the application\n\nOpen a command line terminal and create a new directory `sentiment-analyzer` and change directory to it.\n\n```\n$ mkdir sentiment-analyzer\n$ cd sentiment-analyzer\n```\n\nCreate a new virtualenv and activate it as shown below.\n\n```\n$ virtualenv venv --python=python2.7\n$ source venv/bin/activate\n```\n\nWe will use `pip` to install the `textblob` package. After installing the package, we will download the corpora.\n\n```\n$ pip install -U textblob\n$ python -m textblob.download_corpora lite\n```\n\nNext, We will develop a simple Flask application which will expose a REST API. To install the Flask framework, we will again use pip as shown below.\n\n```\n$ pip install flask\n```\n\nCreate a new file called `sentimentanalyzer.py` under the `sentiment-analyzer` directory. Copy the content shown below in `sentimentanalyzer.py`.\n\n```python\nfrom flask import Flask , jsonify, render_template, request\nfrom textblob import TextBlob\n\napp = Flask(__name__)\n\n@app.route('/')\n@app.route('/index')\ndef index():\n\treturn render_template('index.html')\n\n@app.route('/api/sentiment',methods=['POST'])\ndef sentiment():\n\ttext = TextBlob(request.form['message'])\n\tresponse = {'polarity' : text.polarity , 'subjectivity' : text.subjectivity}\n\treturn jsonify(response)\n\nif __name__ == \"__main__\":\n\tapp.run(debug=True)\n```\n\nThe code shown above does the following:\n\n1. It imports the Flask class, `jsonify` function, and `render_template` function from `flask` package.\n\n2. It imports the `TextBlob` class from `textblob` package.\n\n3. It defines a route to `/` and `index` url. So, if a user makes a GET request to either `/` or `/index`, then the index.html will be rendered.\n\n4. It defines a route to `/api/sentiment/` url. The is a placeholder and will contain the text message the user want to run sentiment analysis on. We create an instance of TextBlob passing it the message. Next, we get polarity and subjectivity of the message, and then create a json object and return it back.\n\n5. Finally, we start the development server to run the application using the python `sentimentanalyzer.py` command. We also enabled debugging by passing Debug=True. Debugging provides an interactive debugger in the browser when an unexpected exceptions occur. Another benefit of the debugger is that it will automatically reload the changes. We can keep the debugger running in the background and work through our application. This provides a highly productive environment.\n\n\nThe `index()` function renders an html file. Create a new directory called `templates` in the `sentiment-analyzer` directory and then create new file named `index.html`.\n\n```\n$ mkdir templates\n$ touch templates/index.html\n```\n\nCopy the content to the index.html source file which uses Twitter Boostrap to add style. We are also using jQuery to make REST calls on a keyup event.\n\n```html\n<html>\n<head>\n\t<title>Sentiment Analyzer: Built using Text Blob</title>\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"static/css/bootstrap.css\">\n\t<style type=\"text/css\">\n    body {\n      padding-top:60px;\n      padding-bottom: 60px;\n    }\n  </style>\n</head>\n<body>\n\n<div class=\"navbar navbar-inverse navbar-fixed-top\">\n      <div class=\"container\">\n        <div class=\"navbar-header\">\n          <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n          </button>\n          <a class=\"navbar-brand\" href=\"#\">Text Sentiment Analyzer</a>\n        </div>\n\n    </div>\n  </div>\n\n<div class=\"container\">\n\t<div class=\"row\">\n\t\t<div class=\"col-md-6\">\n\t\t\t<div class=\"row\">\n\t\t\t\t<textarea class=\"form-control\" rows=\"3\" placeholder=\"Write text to see sentiment analysis in action. Write minimum 10 charaters and press button.\"></textarea>\n\t\t\t</div>\n\t\t\t<div class=\"row\">\n\t\t\t\t<br><br>\n\t\t\t\t<button class=\"btn-lg btn-warning\">Perform Sentiment Analysis</button>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"col-md-6\">\n\t\t\t<p id=\"result\"></p>\n\t\t</div>\n\t</div>\n</div>\n\n<script type=\"text/javascript\" src=\"static/js/jquery.js\"></script>\n<script type=\"text/javascript\">\n\n\t$(\"button\").click(function(){\n\t\tvar messageTxt = $('textarea').val();\n\t\t$('#result').removeClass(\"alert alert-warning\");\n\t\t$('#result').removeClass(\"alert alert-danger\");\n\t\t$('#result').removeClass(\"alert alert-success\");\n\t\tif (messageTxt.length > 10){\n\n\t\t\t$.post('/api/sentiment',{message: messageTxt},function(result){\n\t\t\t\tif(result.polarity < 0.0){\n\t\t\t\t\tconsole.log('less than 0');\n\t\t\t\t\t$('#result').addClass(\"alert alert-danger\")\t.text(messageTxt);\n\t\t\t\t} else if( result.polarity >= 0.0 && result.polarity <= 0.5){\n\t\t\t\t\tconsole.log('between 0 and 0.5');\n\t\t\t\t\t$('#result').addClass(\"alert alert-warning\").text(messageTxt);\n\t\t\t\t}else{\n\t\t\t\t\tconsole.log('Greater than 0.5');\n\t\t\t\t\t$('#result').addClass(\"alert alert-success\").text(messageTxt);\n\t\t\t\t}\n\n});\n\t}\n});\n</script>\n</body>\n</html>\n```\n\n## Deploy to OpenShift\n\nTo deploy the application on OpenShift, you have to first install its command-line tool `rhc` and then just type the command shown below.\n\n```\n$ rhc create-app sentimentanalyzer python-2.7 --from-code https://github.com/shekhargulati/sentiment-analyzer.git --timeout 180\n```\n\nIt will do all the stuff from creating an application, to setting up public DNS, to creating private git repository, and then finally deploying the application using code from my Github repository.The application will be deployed on http://sentimentanalyzer-{domain-name}.rhcloud.com. Please replace {domain-name} with your account domain name. The app is running here [https://sentimentanalysis-52tech.rhcloud.com/](https://sentimentanalysis-52tech.rhcloud.com/)\n\n-----\n\nThat's all for this week. Please provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/15](https://github.com/shekhargulati/52-technologies-in-2016/issues/15).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/11-textblob)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.gitignore",
    "content": "venv/\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/action_hooks/README.md",
    "content": "For information about action hooks supported by OpenShift, consult the documentation:\n\nhttp://openshift.github.io/documentation/oo_user_guide.html#the-openshift-directory\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/action_hooks/deploy",
    "content": "#!/bin/bash\nset -x\nexport NLTK_DATA=$OPENSHIFT_DATA_DIR\necho \"YOU ARE IN PRE_START HOOK\"\necho $NLTK_DATA\n. $VIRTUAL_ENV/bin/activate\npip install textblob\npython -m textblob.download_corpora\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/README.cron",
    "content": "Run scripts or jobs on a periodic basis\n=======================================\nAny scripts or jobs added to the minutely, hourly, daily, weekly or monthly\ndirectories will be run on a scheduled basis (frequency is as indicated by the\nname of the directory) using run-parts.\n\nrun-parts ignores any files that are hidden or dotfiles (.*) or backup\nfiles (*~ or *,)  or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved}\n\nThe presence of two specially named files jobs.deny and jobs.allow controls\nhow run-parts executes your scripts/jobs.\n   jobs.deny  ===> Prevents specific scripts or jobs from being executed.\n   jobs.allow ===> Only execute the named scripts or jobs (all other/non-named\n                   scripts that exist in this directory are ignored).\n\nThe principles of jobs.deny and jobs.allow are the same as those of cron.deny\nand cron.allow and are described in detail at: \n   http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html#s2-autotasks-cron-access\n\nSee: man crontab or above link for more details and see the the weekly/\n     directory for an example.\n\nPLEASE NOTE: The Cron cartridge must be installed in order to run the configured jobs.\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/daily/.gitignore",
    "content": ""
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/hourly/.gitignore",
    "content": ""
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/minutely/.gitignore",
    "content": ""
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/monthly/.gitignore",
    "content": ""
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/weekly/README",
    "content": "Run scripts or jobs on a weekly basis\n=====================================\nAny scripts or jobs added to this directory will be run on a scheduled basis\n(weekly) using run-parts.\n\nrun-parts ignores any files that are hidden or dotfiles (.*) or backup\nfiles (*~ or *,)  or named *.{rpmsave,rpmorig,rpmnew,swp,cfsaved} and handles\nthe files named jobs.deny and jobs.allow specially.\n\nIn this specific example, the chronograph script is the only script or job file\nexecuted on a weekly basis (due to white-listing it in jobs.allow). And the\nREADME and chrono.dat file are ignored either as a result of being black-listed\nin jobs.deny or because they are NOT white-listed in the jobs.allow file.\n\nFor more details, please see ../README.cron file.\n\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/weekly/chronograph",
    "content": "#!/bin/bash\n\necho \"`date`: `cat $(dirname \\\"$0\\\")/chrono.dat`\"\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/weekly/jobs.allow",
    "content": "#\n#  Script or job files listed in here (one entry per line) will be\n#  executed on a weekly-basis.\n#\n#  Example: The chronograph script will be executed weekly but the README \n#           and chrono.dat files in this directory will be ignored.\n#\n#           The README file is actually ignored due to the entry in the\n#           jobs.deny which is checked before jobs.allow (this file).\n#\nchronograph\n\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/cron/weekly/jobs.deny",
    "content": "#\n#  Any script or job files listed in here (one entry per line) will NOT be\n#  executed (read as ignored by run-parts).\n#\n\nREADME\n\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/.openshift/markers/.gitkeep",
    "content": ""
  },
  {
    "path": "11-textblob/sentiment-analyzer/requirements.txt",
    "content": "Flask==0.10.1\nJinja2==2.7.2\nMarkupSafe==0.23\nWerkzeug==0.9.4\ndistribute==0.7.3\nitsdangerous==0.24\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/sentimentanalyzer.py",
    "content": "from flask import Flask , jsonify, render_template, request\nfrom textblob import TextBlob\n\napp = Flask(__name__)\n\n@app.route('/')\n@app.route('/index')\ndef index():\n\treturn render_template('index.html')\n\n@app.route('/api/sentiment',methods=['POST'])\ndef sentiment():\n\ttext = TextBlob(request.form['message'])\n\tresponse = {'polarity' : text.polarity , 'subjectivity' : text.subjectivity}\n\treturn jsonify(response)\n\nif __name__ == \"__main__\":\n\tapp.run(debug=True)\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/static/css/bootstrap-theme.css",
    "content": "/*!\n * Bootstrap v3.0.1 by @fat and @mdo\n * Copyright 2013 Twitter, Inc.\n * Licensed under http://www.apache.org/licenses/LICENSE-2.0\n *\n * Designed and built with all the love in the world by @mdo and @fat.\n */\n\n.btn-default,\n.btn-primary,\n.btn-success,\n.btn-info,\n.btn-warning,\n.btn-danger {\n  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);\n  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);\n          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);\n}\n\n.btn-default:active,\n.btn-primary:active,\n.btn-success:active,\n.btn-info:active,\n.btn-warning:active,\n.btn-danger:active,\n.btn-default.active,\n.btn-primary.active,\n.btn-success.active,\n.btn-info.active,\n.btn-warning.active,\n.btn-danger.active {\n  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n          box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n}\n\n.btn:active,\n.btn.active {\n  background-image: none;\n}\n\n.btn-default {\n  text-shadow: 0 1px 0 #fff;\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#e0e0e0));\n  background-image: -webkit-linear-gradient(top, #ffffff 0%, #e0e0e0 100%);\n  background-image: -moz-linear-gradient(top, #ffffff 0%, #e0e0e0 100%);\n  background-image: linear-gradient(to bottom, #ffffff 0%, #e0e0e0 100%);\n  background-repeat: repeat-x;\n  border-color: #dbdbdb;\n  border-color: #ccc;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.btn-default:hover,\n.btn-default:focus {\n  background-color: #e0e0e0;\n  background-position: 0 -15px;\n}\n\n.btn-default:active,\n.btn-default.active {\n  background-color: #e0e0e0;\n  border-color: #dbdbdb;\n}\n\n.btn-primary {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#2d6ca2));\n  background-image: -webkit-linear-gradient(top, #428bca 0%, #2d6ca2 100%);\n  background-image: -moz-linear-gradient(top, #428bca 0%, #2d6ca2 100%);\n  background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%);\n  background-repeat: repeat-x;\n  border-color: #2b669a;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.btn-primary:hover,\n.btn-primary:focus {\n  background-color: #2d6ca2;\n  background-position: 0 -15px;\n}\n\n.btn-primary:active,\n.btn-primary.active {\n  background-color: #2d6ca2;\n  border-color: #2b669a;\n}\n\n.btn-success {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#419641));\n  background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);\n  background-image: -moz-linear-gradient(top, #5cb85c 0%, #419641 100%);\n  background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);\n  background-repeat: repeat-x;\n  border-color: #3e8f3e;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.btn-success:hover,\n.btn-success:focus {\n  background-color: #419641;\n  background-position: 0 -15px;\n}\n\n.btn-success:active,\n.btn-success.active {\n  background-color: #419641;\n  border-color: #3e8f3e;\n}\n\n.btn-warning {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#eb9316));\n  background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);\n  background-image: -moz-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);\n  background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);\n  background-repeat: repeat-x;\n  border-color: #e38d13;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.btn-warning:hover,\n.btn-warning:focus {\n  background-color: #eb9316;\n  background-position: 0 -15px;\n}\n\n.btn-warning:active,\n.btn-warning.active {\n  background-color: #eb9316;\n  border-color: #e38d13;\n}\n\n.btn-danger {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c12e2a));\n  background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);\n  background-image: -moz-linear-gradient(top, #d9534f 0%, #c12e2a 100%);\n  background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);\n  background-repeat: repeat-x;\n  border-color: #b92c28;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.btn-danger:hover,\n.btn-danger:focus {\n  background-color: #c12e2a;\n  background-position: 0 -15px;\n}\n\n.btn-danger:active,\n.btn-danger.active {\n  background-color: #c12e2a;\n  border-color: #b92c28;\n}\n\n.btn-info {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#2aabd2));\n  background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);\n  background-image: -moz-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);\n  background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);\n  background-repeat: repeat-x;\n  border-color: #28a4c9;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.btn-info:hover,\n.btn-info:focus {\n  background-color: #2aabd2;\n  background-position: 0 -15px;\n}\n\n.btn-info:active,\n.btn-info.active {\n  background-color: #2aabd2;\n  border-color: #28a4c9;\n}\n\n.thumbnail,\n.img-thumbnail {\n  -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);\n          box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);\n}\n\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n  background-color: #e8e8e8;\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8));\n  background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);\n  background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);\n  background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);\n}\n\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n  background-color: #357ebd;\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));\n  background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);\n  background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);\n  background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);\n}\n\n.navbar-default {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ffffff), to(#f8f8f8));\n  background-image: -webkit-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);\n  background-image: -moz-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);\n  background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%);\n  background-repeat: repeat-x;\n  border-radius: 4px;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);\n          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);\n}\n\n.navbar-default .navbar-nav > .active > a {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f3f3f3));\n  background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%);\n  background-image: -moz-linear-gradient(top, #ebebeb 0%, #f3f3f3 100%);\n  background-image: linear-gradient(to bottom, #ebebeb 0%, #f3f3f3 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0);\n  -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);\n          box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);\n}\n\n.navbar-brand,\n.navbar-nav > li > a {\n  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);\n}\n\n.navbar-inverse {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#3c3c3c), to(#222222));\n  background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222222 100%);\n  background-image: -moz-linear-gradient(top, #3c3c3c 0%, #222222 100%);\n  background-image: linear-gradient(to bottom, #3c3c3c 0%, #222222 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.navbar-inverse .navbar-nav > .active > a {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#222222), to(#282828));\n  background-image: -webkit-linear-gradient(top, #222222 0%, #282828 100%);\n  background-image: -moz-linear-gradient(top, #222222 0%, #282828 100%);\n  background-image: linear-gradient(to bottom, #222222 0%, #282828 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0);\n  -webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);\n          box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);\n}\n\n.navbar-inverse .navbar-brand,\n.navbar-inverse .navbar-nav > li > a {\n  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);\n}\n\n.navbar-static-top,\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  border-radius: 0;\n}\n\n.alert {\n  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);\n  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);\n          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);\n}\n\n.alert-success {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#c8e5bc));\n  background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);\n  background-image: -moz-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);\n  background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);\n  background-repeat: repeat-x;\n  border-color: #b2dba1;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);\n}\n\n.alert-info {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#b9def0));\n  background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);\n  background-image: -moz-linear-gradient(top, #d9edf7 0%, #b9def0 100%);\n  background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);\n  background-repeat: repeat-x;\n  border-color: #9acfea;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);\n}\n\n.alert-warning {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#f8efc0));\n  background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);\n  background-image: -moz-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);\n  background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);\n  background-repeat: repeat-x;\n  border-color: #f5e79e;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);\n}\n\n.alert-danger {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#e7c3c3));\n  background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);\n  background-image: -moz-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);\n  background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);\n  background-repeat: repeat-x;\n  border-color: #dca7a7;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);\n}\n\n.progress {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#ebebeb), to(#f5f5f5));\n  background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);\n  background-image: -moz-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);\n  background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);\n}\n\n.progress-bar {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3071a9));\n  background-image: -webkit-linear-gradient(top, #428bca 0%, #3071a9 100%);\n  background-image: -moz-linear-gradient(top, #428bca 0%, #3071a9 100%);\n  background-image: linear-gradient(to bottom, #428bca 0%, #3071a9 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);\n}\n\n.progress-bar-success {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5cb85c), to(#449d44));\n  background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);\n  background-image: -moz-linear-gradient(top, #5cb85c 0%, #449d44 100%);\n  background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);\n}\n\n.progress-bar-info {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#5bc0de), to(#31b0d5));\n  background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);\n  background-image: -moz-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);\n  background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);\n}\n\n.progress-bar-warning {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f0ad4e), to(#ec971f));\n  background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);\n  background-image: -moz-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);\n  background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);\n}\n\n.progress-bar-danger {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9534f), to(#c9302c));\n  background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);\n  background-image: -moz-linear-gradient(top, #d9534f 0%, #c9302c 100%);\n  background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);\n}\n\n.list-group {\n  border-radius: 4px;\n  -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);\n          box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);\n}\n\n.list-group-item.active,\n.list-group-item.active:hover,\n.list-group-item.active:focus {\n  text-shadow: 0 -1px 0 #3071a9;\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#3278b3));\n  background-image: -webkit-linear-gradient(top, #428bca 0%, #3278b3 100%);\n  background-image: -moz-linear-gradient(top, #428bca 0%, #3278b3 100%);\n  background-image: linear-gradient(to bottom, #428bca 0%, #3278b3 100%);\n  background-repeat: repeat-x;\n  border-color: #3278b3;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);\n}\n\n.panel {\n  -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);\n          box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);\n}\n\n.panel-default > .panel-heading {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f5f5f5), to(#e8e8e8));\n  background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);\n  background-image: -moz-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);\n  background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);\n}\n\n.panel-primary > .panel-heading {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#428bca), to(#357ebd));\n  background-image: -webkit-linear-gradient(top, #428bca 0%, #357ebd 100%);\n  background-image: -moz-linear-gradient(top, #428bca 0%, #357ebd 100%);\n  background-image: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);\n}\n\n.panel-success > .panel-heading {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#dff0d8), to(#d0e9c6));\n  background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);\n  background-image: -moz-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);\n  background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);\n}\n\n.panel-info > .panel-heading {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#d9edf7), to(#c4e3f3));\n  background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);\n  background-image: -moz-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);\n  background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);\n}\n\n.panel-warning > .panel-heading {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#fcf8e3), to(#faf2cc));\n  background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);\n  background-image: -moz-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);\n  background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);\n}\n\n.panel-danger > .panel-heading {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#f2dede), to(#ebcccc));\n  background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);\n  background-image: -moz-linear-gradient(top, #f2dede 0%, #ebcccc 100%);\n  background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);\n}\n\n.well {\n  background-image: -webkit-gradient(linear, left 0%, left 100%, from(#e8e8e8), to(#f5f5f5));\n  background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);\n  background-image: -moz-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);\n  background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);\n  background-repeat: repeat-x;\n  border-color: #dcdcdc;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);\n  -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);\n          box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);\n}"
  },
  {
    "path": "11-textblob/sentiment-analyzer/static/css/bootstrap.css",
    "content": "/*!\n * Bootstrap v3.0.1 by @fat and @mdo\n * Copyright 2013 Twitter, Inc.\n * Licensed under http://www.apache.org/licenses/LICENSE-2.0\n *\n * Designed and built with all the love in the world by @mdo and @fat.\n */\n\n/*! normalize.css v2.1.3 | MIT License | git.io/normalize */\n\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nnav,\nsection,\nsummary {\n  display: block;\n}\n\naudio,\ncanvas,\nvideo {\n  display: inline-block;\n}\n\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n\n[hidden],\ntemplate {\n  display: none;\n}\n\nhtml {\n  font-family: sans-serif;\n  -webkit-text-size-adjust: 100%;\n      -ms-text-size-adjust: 100%;\n}\n\nbody {\n  margin: 0;\n}\n\na {\n  background: transparent;\n}\n\na:focus {\n  outline: thin dotted;\n}\n\na:active,\na:hover {\n  outline: 0;\n}\n\nh1 {\n  margin: 0.67em 0;\n  font-size: 2em;\n}\n\nabbr[title] {\n  border-bottom: 1px dotted;\n}\n\nb,\nstrong {\n  font-weight: bold;\n}\n\ndfn {\n  font-style: italic;\n}\n\nhr {\n  height: 0;\n  -moz-box-sizing: content-box;\n       box-sizing: content-box;\n}\n\nmark {\n  color: #000;\n  background: #ff0;\n}\n\ncode,\nkbd,\npre,\nsamp {\n  font-family: monospace, serif;\n  font-size: 1em;\n}\n\npre {\n  white-space: pre-wrap;\n}\n\nq {\n  quotes: \"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\";\n}\n\nsmall {\n  font-size: 80%;\n}\n\nsub,\nsup {\n  position: relative;\n  font-size: 75%;\n  line-height: 0;\n  vertical-align: baseline;\n}\n\nsup {\n  top: -0.5em;\n}\n\nsub {\n  bottom: -0.25em;\n}\n\nimg {\n  border: 0;\n}\n\nsvg:not(:root) {\n  overflow: hidden;\n}\n\nfigure {\n  margin: 0;\n}\n\nfieldset {\n  padding: 0.35em 0.625em 0.75em;\n  margin: 0 2px;\n  border: 1px solid #c0c0c0;\n}\n\nlegend {\n  padding: 0;\n  border: 0;\n}\n\nbutton,\ninput,\nselect,\ntextarea {\n  margin: 0;\n  font-family: inherit;\n  font-size: 100%;\n}\n\nbutton,\ninput {\n  line-height: normal;\n}\n\nbutton,\nselect {\n  text-transform: none;\n}\n\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  cursor: pointer;\n  -webkit-appearance: button;\n}\n\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n  padding: 0;\n  box-sizing: border-box;\n}\n\ninput[type=\"search\"] {\n  -webkit-box-sizing: content-box;\n     -moz-box-sizing: content-box;\n          box-sizing: content-box;\n  -webkit-appearance: textfield;\n}\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  padding: 0;\n  border: 0;\n}\n\ntextarea {\n  overflow: auto;\n  vertical-align: top;\n}\n\ntable {\n  border-collapse: collapse;\n  border-spacing: 0;\n}\n\n@media print {\n  * {\n    color: #000 !important;\n    text-shadow: none !important;\n    background: transparent !important;\n    box-shadow: none !important;\n  }\n  a,\n  a:visited {\n    text-decoration: underline;\n  }\n  a[href]:after {\n    content: \" (\" attr(href) \")\";\n  }\n  abbr[title]:after {\n    content: \" (\" attr(title) \")\";\n  }\n  a[href^=\"javascript:\"]:after,\n  a[href^=\"#\"]:after {\n    content: \"\";\n  }\n  pre,\n  blockquote {\n    border: 1px solid #999;\n    page-break-inside: avoid;\n  }\n  thead {\n    display: table-header-group;\n  }\n  tr,\n  img {\n    page-break-inside: avoid;\n  }\n  img {\n    max-width: 100% !important;\n  }\n  @page  {\n    margin: 2cm .5cm;\n  }\n  p,\n  h2,\n  h3 {\n    orphans: 3;\n    widows: 3;\n  }\n  h2,\n  h3 {\n    page-break-after: avoid;\n  }\n  select {\n    background: #fff !important;\n  }\n  .navbar {\n    display: none;\n  }\n  .table td,\n  .table th {\n    background-color: #fff !important;\n  }\n  .btn > .caret,\n  .dropup > .btn > .caret {\n    border-top-color: #000 !important;\n  }\n  .label {\n    border: 1px solid #000;\n  }\n  .table {\n    border-collapse: collapse !important;\n  }\n  .table-bordered th,\n  .table-bordered td {\n    border: 1px solid #ddd !important;\n  }\n}\n\n*,\n*:before,\n*:after {\n  -webkit-box-sizing: border-box;\n     -moz-box-sizing: border-box;\n          box-sizing: border-box;\n}\n\nhtml {\n  font-size: 62.5%;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\n\nbody {\n  font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-size: 14px;\n  line-height: 1.428571429;\n  color: #333333;\n  background-color: #ffffff;\n}\n\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: inherit;\n  font-size: inherit;\n  line-height: inherit;\n}\n\na {\n  color: #428bca;\n  text-decoration: none;\n}\n\na:hover,\na:focus {\n  color: #2a6496;\n  text-decoration: underline;\n}\n\na:focus {\n  outline: thin dotted #333;\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n\nimg {\n  vertical-align: middle;\n}\n\n.img-responsive {\n  display: block;\n  height: auto;\n  max-width: 100%;\n}\n\n.img-rounded {\n  border-radius: 6px;\n}\n\n.img-thumbnail {\n  display: inline-block;\n  height: auto;\n  max-width: 100%;\n  padding: 4px;\n  line-height: 1.428571429;\n  background-color: #ffffff;\n  border: 1px solid #dddddd;\n  border-radius: 4px;\n  -webkit-transition: all 0.2s ease-in-out;\n          transition: all 0.2s ease-in-out;\n}\n\n.img-circle {\n  border-radius: 50%;\n}\n\nhr {\n  margin-top: 20px;\n  margin-bottom: 20px;\n  border: 0;\n  border-top: 1px solid #eeeeee;\n}\n\n.sr-only {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  padding: 0;\n  margin: -1px;\n  overflow: hidden;\n  clip: rect(0, 0, 0, 0);\n  border: 0;\n}\n\np {\n  margin: 0 0 10px;\n}\n\n.lead {\n  margin-bottom: 20px;\n  font-size: 16px;\n  font-weight: 200;\n  line-height: 1.4;\n}\n\n@media (min-width: 768px) {\n  .lead {\n    font-size: 21px;\n  }\n}\n\nsmall,\n.small {\n  font-size: 85%;\n}\n\ncite {\n  font-style: normal;\n}\n\n.text-muted {\n  color: #999999;\n}\n\n.text-primary {\n  color: #428bca;\n}\n\n.text-primary:hover {\n  color: #3071a9;\n}\n\n.text-warning {\n  color: #c09853;\n}\n\n.text-warning:hover {\n  color: #a47e3c;\n}\n\n.text-danger {\n  color: #b94a48;\n}\n\n.text-danger:hover {\n  color: #953b39;\n}\n\n.text-success {\n  color: #468847;\n}\n\n.text-success:hover {\n  color: #356635;\n}\n\n.text-info {\n  color: #3a87ad;\n}\n\n.text-info:hover {\n  color: #2d6987;\n}\n\n.text-left {\n  text-align: left;\n}\n\n.text-right {\n  text-align: right;\n}\n\n.text-center {\n  text-align: center;\n}\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\n.h1,\n.h2,\n.h3,\n.h4,\n.h5,\n.h6 {\n  font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-weight: 500;\n  line-height: 1.1;\n  color: inherit;\n}\n\nh1 small,\nh2 small,\nh3 small,\nh4 small,\nh5 small,\nh6 small,\n.h1 small,\n.h2 small,\n.h3 small,\n.h4 small,\n.h5 small,\n.h6 small,\nh1 .small,\nh2 .small,\nh3 .small,\nh4 .small,\nh5 .small,\nh6 .small,\n.h1 .small,\n.h2 .small,\n.h3 .small,\n.h4 .small,\n.h5 .small,\n.h6 .small {\n  font-weight: normal;\n  line-height: 1;\n  color: #999999;\n}\n\nh1,\nh2,\nh3 {\n  margin-top: 20px;\n  margin-bottom: 10px;\n}\n\nh1 small,\nh2 small,\nh3 small,\nh1 .small,\nh2 .small,\nh3 .small {\n  font-size: 65%;\n}\n\nh4,\nh5,\nh6 {\n  margin-top: 10px;\n  margin-bottom: 10px;\n}\n\nh4 small,\nh5 small,\nh6 small,\nh4 .small,\nh5 .small,\nh6 .small {\n  font-size: 75%;\n}\n\nh1,\n.h1 {\n  font-size: 36px;\n}\n\nh2,\n.h2 {\n  font-size: 30px;\n}\n\nh3,\n.h3 {\n  font-size: 24px;\n}\n\nh4,\n.h4 {\n  font-size: 18px;\n}\n\nh5,\n.h5 {\n  font-size: 14px;\n}\n\nh6,\n.h6 {\n  font-size: 12px;\n}\n\n.page-header {\n  padding-bottom: 9px;\n  margin: 40px 0 20px;\n  border-bottom: 1px solid #eeeeee;\n}\n\nul,\nol {\n  margin-top: 0;\n  margin-bottom: 10px;\n}\n\nul ul,\nol ul,\nul ol,\nol ol {\n  margin-bottom: 0;\n}\n\n.list-unstyled {\n  padding-left: 0;\n  list-style: none;\n}\n\n.list-inline {\n  padding-left: 0;\n  list-style: none;\n}\n\n.list-inline > li {\n  display: inline-block;\n  padding-right: 5px;\n  padding-left: 5px;\n}\n\n.list-inline > li:first-child {\n  padding-left: 0;\n}\n\ndl {\n  margin-bottom: 20px;\n}\n\ndt,\ndd {\n  line-height: 1.428571429;\n}\n\ndt {\n  font-weight: bold;\n}\n\ndd {\n  margin-left: 0;\n}\n\n@media (min-width: 768px) {\n  .dl-horizontal dt {\n    float: left;\n    width: 160px;\n    overflow: hidden;\n    clear: left;\n    text-align: right;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n  .dl-horizontal dd {\n    margin-left: 180px;\n  }\n  .dl-horizontal dd:before,\n  .dl-horizontal dd:after {\n    display: table;\n    content: \" \";\n  }\n  .dl-horizontal dd:after {\n    clear: both;\n  }\n  .dl-horizontal dd:before,\n  .dl-horizontal dd:after {\n    display: table;\n    content: \" \";\n  }\n  .dl-horizontal dd:after {\n    clear: both;\n  }\n}\n\nabbr[title],\nabbr[data-original-title] {\n  cursor: help;\n  border-bottom: 1px dotted #999999;\n}\n\nabbr.initialism {\n  font-size: 90%;\n  text-transform: uppercase;\n}\n\nblockquote {\n  padding: 10px 20px;\n  margin: 0 0 20px;\n  border-left: 5px solid #eeeeee;\n}\n\nblockquote p {\n  font-size: 17.5px;\n  font-weight: 300;\n  line-height: 1.25;\n}\n\nblockquote p:last-child {\n  margin-bottom: 0;\n}\n\nblockquote small {\n  display: block;\n  line-height: 1.428571429;\n  color: #999999;\n}\n\nblockquote small:before {\n  content: '\\2014 \\00A0';\n}\n\nblockquote.pull-right {\n  padding-right: 15px;\n  padding-left: 0;\n  border-right: 5px solid #eeeeee;\n  border-left: 0;\n}\n\nblockquote.pull-right p,\nblockquote.pull-right small,\nblockquote.pull-right .small {\n  text-align: right;\n}\n\nblockquote.pull-right small:before,\nblockquote.pull-right .small:before {\n  content: '';\n}\n\nblockquote.pull-right small:after,\nblockquote.pull-right .small:after {\n  content: '\\00A0 \\2014';\n}\n\nblockquote:before,\nblockquote:after {\n  content: \"\";\n}\n\naddress {\n  margin-bottom: 20px;\n  font-style: normal;\n  line-height: 1.428571429;\n}\n\ncode,\nkbd,\npre,\nsamp {\n  font-family: Monaco, Menlo, Consolas, \"Courier New\", monospace;\n}\n\ncode {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: #c7254e;\n  white-space: nowrap;\n  background-color: #f9f2f4;\n  border-radius: 4px;\n}\n\npre {\n  display: block;\n  padding: 9.5px;\n  margin: 0 0 10px;\n  font-size: 13px;\n  line-height: 1.428571429;\n  color: #333333;\n  word-break: break-all;\n  word-wrap: break-word;\n  background-color: #f5f5f5;\n  border: 1px solid #cccccc;\n  border-radius: 4px;\n}\n\npre code {\n  padding: 0;\n  font-size: inherit;\n  color: inherit;\n  white-space: pre-wrap;\n  background-color: transparent;\n  border-radius: 0;\n}\n\n.pre-scrollable {\n  max-height: 340px;\n  overflow-y: scroll;\n}\n\n.container {\n  padding-right: 15px;\n  padding-left: 15px;\n  margin-right: auto;\n  margin-left: auto;\n}\n\n.container:before,\n.container:after {\n  display: table;\n  content: \" \";\n}\n\n.container:after {\n  clear: both;\n}\n\n.container:before,\n.container:after {\n  display: table;\n  content: \" \";\n}\n\n.container:after {\n  clear: both;\n}\n\n.row {\n  margin-right: -15px;\n  margin-left: -15px;\n}\n\n.row:before,\n.row:after {\n  display: table;\n  content: \" \";\n}\n\n.row:after {\n  clear: both;\n}\n\n.row:before,\n.row:after {\n  display: table;\n  content: \" \";\n}\n\n.row:after {\n  clear: both;\n}\n\n.col-xs-1,\n.col-sm-1,\n.col-md-1,\n.col-lg-1,\n.col-xs-2,\n.col-sm-2,\n.col-md-2,\n.col-lg-2,\n.col-xs-3,\n.col-sm-3,\n.col-md-3,\n.col-lg-3,\n.col-xs-4,\n.col-sm-4,\n.col-md-4,\n.col-lg-4,\n.col-xs-5,\n.col-sm-5,\n.col-md-5,\n.col-lg-5,\n.col-xs-6,\n.col-sm-6,\n.col-md-6,\n.col-lg-6,\n.col-xs-7,\n.col-sm-7,\n.col-md-7,\n.col-lg-7,\n.col-xs-8,\n.col-sm-8,\n.col-md-8,\n.col-lg-8,\n.col-xs-9,\n.col-sm-9,\n.col-md-9,\n.col-lg-9,\n.col-xs-10,\n.col-sm-10,\n.col-md-10,\n.col-lg-10,\n.col-xs-11,\n.col-sm-11,\n.col-md-11,\n.col-lg-11,\n.col-xs-12,\n.col-sm-12,\n.col-md-12,\n.col-lg-12 {\n  position: relative;\n  min-height: 1px;\n  padding-right: 15px;\n  padding-left: 15px;\n}\n\n.col-xs-1,\n.col-xs-2,\n.col-xs-3,\n.col-xs-4,\n.col-xs-5,\n.col-xs-6,\n.col-xs-7,\n.col-xs-8,\n.col-xs-9,\n.col-xs-10,\n.col-xs-11 {\n  float: left;\n}\n\n.col-xs-12 {\n  width: 100%;\n}\n\n.col-xs-11 {\n  width: 91.66666666666666%;\n}\n\n.col-xs-10 {\n  width: 83.33333333333334%;\n}\n\n.col-xs-9 {\n  width: 75%;\n}\n\n.col-xs-8 {\n  width: 66.66666666666666%;\n}\n\n.col-xs-7 {\n  width: 58.333333333333336%;\n}\n\n.col-xs-6 {\n  width: 50%;\n}\n\n.col-xs-5 {\n  width: 41.66666666666667%;\n}\n\n.col-xs-4 {\n  width: 33.33333333333333%;\n}\n\n.col-xs-3 {\n  width: 25%;\n}\n\n.col-xs-2 {\n  width: 16.666666666666664%;\n}\n\n.col-xs-1 {\n  width: 8.333333333333332%;\n}\n\n.col-xs-pull-12 {\n  right: 100%;\n}\n\n.col-xs-pull-11 {\n  right: 91.66666666666666%;\n}\n\n.col-xs-pull-10 {\n  right: 83.33333333333334%;\n}\n\n.col-xs-pull-9 {\n  right: 75%;\n}\n\n.col-xs-pull-8 {\n  right: 66.66666666666666%;\n}\n\n.col-xs-pull-7 {\n  right: 58.333333333333336%;\n}\n\n.col-xs-pull-6 {\n  right: 50%;\n}\n\n.col-xs-pull-5 {\n  right: 41.66666666666667%;\n}\n\n.col-xs-pull-4 {\n  right: 33.33333333333333%;\n}\n\n.col-xs-pull-3 {\n  right: 25%;\n}\n\n.col-xs-pull-2 {\n  right: 16.666666666666664%;\n}\n\n.col-xs-pull-1 {\n  right: 8.333333333333332%;\n}\n\n.col-xs-push-12 {\n  left: 100%;\n}\n\n.col-xs-push-11 {\n  left: 91.66666666666666%;\n}\n\n.col-xs-push-10 {\n  left: 83.33333333333334%;\n}\n\n.col-xs-push-9 {\n  left: 75%;\n}\n\n.col-xs-push-8 {\n  left: 66.66666666666666%;\n}\n\n.col-xs-push-7 {\n  left: 58.333333333333336%;\n}\n\n.col-xs-push-6 {\n  left: 50%;\n}\n\n.col-xs-push-5 {\n  left: 41.66666666666667%;\n}\n\n.col-xs-push-4 {\n  left: 33.33333333333333%;\n}\n\n.col-xs-push-3 {\n  left: 25%;\n}\n\n.col-xs-push-2 {\n  left: 16.666666666666664%;\n}\n\n.col-xs-push-1 {\n  left: 8.333333333333332%;\n}\n\n.col-xs-offset-12 {\n  margin-left: 100%;\n}\n\n.col-xs-offset-11 {\n  margin-left: 91.66666666666666%;\n}\n\n.col-xs-offset-10 {\n  margin-left: 83.33333333333334%;\n}\n\n.col-xs-offset-9 {\n  margin-left: 75%;\n}\n\n.col-xs-offset-8 {\n  margin-left: 66.66666666666666%;\n}\n\n.col-xs-offset-7 {\n  margin-left: 58.333333333333336%;\n}\n\n.col-xs-offset-6 {\n  margin-left: 50%;\n}\n\n.col-xs-offset-5 {\n  margin-left: 41.66666666666667%;\n}\n\n.col-xs-offset-4 {\n  margin-left: 33.33333333333333%;\n}\n\n.col-xs-offset-3 {\n  margin-left: 25%;\n}\n\n.col-xs-offset-2 {\n  margin-left: 16.666666666666664%;\n}\n\n.col-xs-offset-1 {\n  margin-left: 8.333333333333332%;\n}\n\n@media (min-width: 768px) {\n  .container {\n    width: 750px;\n  }\n  .col-sm-1,\n  .col-sm-2,\n  .col-sm-3,\n  .col-sm-4,\n  .col-sm-5,\n  .col-sm-6,\n  .col-sm-7,\n  .col-sm-8,\n  .col-sm-9,\n  .col-sm-10,\n  .col-sm-11 {\n    float: left;\n  }\n  .col-sm-12 {\n    width: 100%;\n  }\n  .col-sm-11 {\n    width: 91.66666666666666%;\n  }\n  .col-sm-10 {\n    width: 83.33333333333334%;\n  }\n  .col-sm-9 {\n    width: 75%;\n  }\n  .col-sm-8 {\n    width: 66.66666666666666%;\n  }\n  .col-sm-7 {\n    width: 58.333333333333336%;\n  }\n  .col-sm-6 {\n    width: 50%;\n  }\n  .col-sm-5 {\n    width: 41.66666666666667%;\n  }\n  .col-sm-4 {\n    width: 33.33333333333333%;\n  }\n  .col-sm-3 {\n    width: 25%;\n  }\n  .col-sm-2 {\n    width: 16.666666666666664%;\n  }\n  .col-sm-1 {\n    width: 8.333333333333332%;\n  }\n  .col-sm-pull-12 {\n    right: 100%;\n  }\n  .col-sm-pull-11 {\n    right: 91.66666666666666%;\n  }\n  .col-sm-pull-10 {\n    right: 83.33333333333334%;\n  }\n  .col-sm-pull-9 {\n    right: 75%;\n  }\n  .col-sm-pull-8 {\n    right: 66.66666666666666%;\n  }\n  .col-sm-pull-7 {\n    right: 58.333333333333336%;\n  }\n  .col-sm-pull-6 {\n    right: 50%;\n  }\n  .col-sm-pull-5 {\n    right: 41.66666666666667%;\n  }\n  .col-sm-pull-4 {\n    right: 33.33333333333333%;\n  }\n  .col-sm-pull-3 {\n    right: 25%;\n  }\n  .col-sm-pull-2 {\n    right: 16.666666666666664%;\n  }\n  .col-sm-pull-1 {\n    right: 8.333333333333332%;\n  }\n  .col-sm-push-12 {\n    left: 100%;\n  }\n  .col-sm-push-11 {\n    left: 91.66666666666666%;\n  }\n  .col-sm-push-10 {\n    left: 83.33333333333334%;\n  }\n  .col-sm-push-9 {\n    left: 75%;\n  }\n  .col-sm-push-8 {\n    left: 66.66666666666666%;\n  }\n  .col-sm-push-7 {\n    left: 58.333333333333336%;\n  }\n  .col-sm-push-6 {\n    left: 50%;\n  }\n  .col-sm-push-5 {\n    left: 41.66666666666667%;\n  }\n  .col-sm-push-4 {\n    left: 33.33333333333333%;\n  }\n  .col-sm-push-3 {\n    left: 25%;\n  }\n  .col-sm-push-2 {\n    left: 16.666666666666664%;\n  }\n  .col-sm-push-1 {\n    left: 8.333333333333332%;\n  }\n  .col-sm-offset-12 {\n    margin-left: 100%;\n  }\n  .col-sm-offset-11 {\n    margin-left: 91.66666666666666%;\n  }\n  .col-sm-offset-10 {\n    margin-left: 83.33333333333334%;\n  }\n  .col-sm-offset-9 {\n    margin-left: 75%;\n  }\n  .col-sm-offset-8 {\n    margin-left: 66.66666666666666%;\n  }\n  .col-sm-offset-7 {\n    margin-left: 58.333333333333336%;\n  }\n  .col-sm-offset-6 {\n    margin-left: 50%;\n  }\n  .col-sm-offset-5 {\n    margin-left: 41.66666666666667%;\n  }\n  .col-sm-offset-4 {\n    margin-left: 33.33333333333333%;\n  }\n  .col-sm-offset-3 {\n    margin-left: 25%;\n  }\n  .col-sm-offset-2 {\n    margin-left: 16.666666666666664%;\n  }\n  .col-sm-offset-1 {\n    margin-left: 8.333333333333332%;\n  }\n}\n\n@media (min-width: 992px) {\n  .container {\n    width: 970px;\n  }\n  .col-md-1,\n  .col-md-2,\n  .col-md-3,\n  .col-md-4,\n  .col-md-5,\n  .col-md-6,\n  .col-md-7,\n  .col-md-8,\n  .col-md-9,\n  .col-md-10,\n  .col-md-11 {\n    float: left;\n  }\n  .col-md-12 {\n    width: 100%;\n  }\n  .col-md-11 {\n    width: 91.66666666666666%;\n  }\n  .col-md-10 {\n    width: 83.33333333333334%;\n  }\n  .col-md-9 {\n    width: 75%;\n  }\n  .col-md-8 {\n    width: 66.66666666666666%;\n  }\n  .col-md-7 {\n    width: 58.333333333333336%;\n  }\n  .col-md-6 {\n    width: 50%;\n  }\n  .col-md-5 {\n    width: 41.66666666666667%;\n  }\n  .col-md-4 {\n    width: 33.33333333333333%;\n  }\n  .col-md-3 {\n    width: 25%;\n  }\n  .col-md-2 {\n    width: 16.666666666666664%;\n  }\n  .col-md-1 {\n    width: 8.333333333333332%;\n  }\n  .col-md-pull-12 {\n    right: 100%;\n  }\n  .col-md-pull-11 {\n    right: 91.66666666666666%;\n  }\n  .col-md-pull-10 {\n    right: 83.33333333333334%;\n  }\n  .col-md-pull-9 {\n    right: 75%;\n  }\n  .col-md-pull-8 {\n    right: 66.66666666666666%;\n  }\n  .col-md-pull-7 {\n    right: 58.333333333333336%;\n  }\n  .col-md-pull-6 {\n    right: 50%;\n  }\n  .col-md-pull-5 {\n    right: 41.66666666666667%;\n  }\n  .col-md-pull-4 {\n    right: 33.33333333333333%;\n  }\n  .col-md-pull-3 {\n    right: 25%;\n  }\n  .col-md-pull-2 {\n    right: 16.666666666666664%;\n  }\n  .col-md-pull-1 {\n    right: 8.333333333333332%;\n  }\n  .col-md-push-12 {\n    left: 100%;\n  }\n  .col-md-push-11 {\n    left: 91.66666666666666%;\n  }\n  .col-md-push-10 {\n    left: 83.33333333333334%;\n  }\n  .col-md-push-9 {\n    left: 75%;\n  }\n  .col-md-push-8 {\n    left: 66.66666666666666%;\n  }\n  .col-md-push-7 {\n    left: 58.333333333333336%;\n  }\n  .col-md-push-6 {\n    left: 50%;\n  }\n  .col-md-push-5 {\n    left: 41.66666666666667%;\n  }\n  .col-md-push-4 {\n    left: 33.33333333333333%;\n  }\n  .col-md-push-3 {\n    left: 25%;\n  }\n  .col-md-push-2 {\n    left: 16.666666666666664%;\n  }\n  .col-md-push-1 {\n    left: 8.333333333333332%;\n  }\n  .col-md-offset-12 {\n    margin-left: 100%;\n  }\n  .col-md-offset-11 {\n    margin-left: 91.66666666666666%;\n  }\n  .col-md-offset-10 {\n    margin-left: 83.33333333333334%;\n  }\n  .col-md-offset-9 {\n    margin-left: 75%;\n  }\n  .col-md-offset-8 {\n    margin-left: 66.66666666666666%;\n  }\n  .col-md-offset-7 {\n    margin-left: 58.333333333333336%;\n  }\n  .col-md-offset-6 {\n    margin-left: 50%;\n  }\n  .col-md-offset-5 {\n    margin-left: 41.66666666666667%;\n  }\n  .col-md-offset-4 {\n    margin-left: 33.33333333333333%;\n  }\n  .col-md-offset-3 {\n    margin-left: 25%;\n  }\n  .col-md-offset-2 {\n    margin-left: 16.666666666666664%;\n  }\n  .col-md-offset-1 {\n    margin-left: 8.333333333333332%;\n  }\n}\n\n@media (min-width: 1200px) {\n  .container {\n    width: 1170px;\n  }\n  .col-lg-1,\n  .col-lg-2,\n  .col-lg-3,\n  .col-lg-4,\n  .col-lg-5,\n  .col-lg-6,\n  .col-lg-7,\n  .col-lg-8,\n  .col-lg-9,\n  .col-lg-10,\n  .col-lg-11 {\n    float: left;\n  }\n  .col-lg-12 {\n    width: 100%;\n  }\n  .col-lg-11 {\n    width: 91.66666666666666%;\n  }\n  .col-lg-10 {\n    width: 83.33333333333334%;\n  }\n  .col-lg-9 {\n    width: 75%;\n  }\n  .col-lg-8 {\n    width: 66.66666666666666%;\n  }\n  .col-lg-7 {\n    width: 58.333333333333336%;\n  }\n  .col-lg-6 {\n    width: 50%;\n  }\n  .col-lg-5 {\n    width: 41.66666666666667%;\n  }\n  .col-lg-4 {\n    width: 33.33333333333333%;\n  }\n  .col-lg-3 {\n    width: 25%;\n  }\n  .col-lg-2 {\n    width: 16.666666666666664%;\n  }\n  .col-lg-1 {\n    width: 8.333333333333332%;\n  }\n  .col-lg-pull-12 {\n    right: 100%;\n  }\n  .col-lg-pull-11 {\n    right: 91.66666666666666%;\n  }\n  .col-lg-pull-10 {\n    right: 83.33333333333334%;\n  }\n  .col-lg-pull-9 {\n    right: 75%;\n  }\n  .col-lg-pull-8 {\n    right: 66.66666666666666%;\n  }\n  .col-lg-pull-7 {\n    right: 58.333333333333336%;\n  }\n  .col-lg-pull-6 {\n    right: 50%;\n  }\n  .col-lg-pull-5 {\n    right: 41.66666666666667%;\n  }\n  .col-lg-pull-4 {\n    right: 33.33333333333333%;\n  }\n  .col-lg-pull-3 {\n    right: 25%;\n  }\n  .col-lg-pull-2 {\n    right: 16.666666666666664%;\n  }\n  .col-lg-pull-1 {\n    right: 8.333333333333332%;\n  }\n  .col-lg-push-12 {\n    left: 100%;\n  }\n  .col-lg-push-11 {\n    left: 91.66666666666666%;\n  }\n  .col-lg-push-10 {\n    left: 83.33333333333334%;\n  }\n  .col-lg-push-9 {\n    left: 75%;\n  }\n  .col-lg-push-8 {\n    left: 66.66666666666666%;\n  }\n  .col-lg-push-7 {\n    left: 58.333333333333336%;\n  }\n  .col-lg-push-6 {\n    left: 50%;\n  }\n  .col-lg-push-5 {\n    left: 41.66666666666667%;\n  }\n  .col-lg-push-4 {\n    left: 33.33333333333333%;\n  }\n  .col-lg-push-3 {\n    left: 25%;\n  }\n  .col-lg-push-2 {\n    left: 16.666666666666664%;\n  }\n  .col-lg-push-1 {\n    left: 8.333333333333332%;\n  }\n  .col-lg-offset-12 {\n    margin-left: 100%;\n  }\n  .col-lg-offset-11 {\n    margin-left: 91.66666666666666%;\n  }\n  .col-lg-offset-10 {\n    margin-left: 83.33333333333334%;\n  }\n  .col-lg-offset-9 {\n    margin-left: 75%;\n  }\n  .col-lg-offset-8 {\n    margin-left: 66.66666666666666%;\n  }\n  .col-lg-offset-7 {\n    margin-left: 58.333333333333336%;\n  }\n  .col-lg-offset-6 {\n    margin-left: 50%;\n  }\n  .col-lg-offset-5 {\n    margin-left: 41.66666666666667%;\n  }\n  .col-lg-offset-4 {\n    margin-left: 33.33333333333333%;\n  }\n  .col-lg-offset-3 {\n    margin-left: 25%;\n  }\n  .col-lg-offset-2 {\n    margin-left: 16.666666666666664%;\n  }\n  .col-lg-offset-1 {\n    margin-left: 8.333333333333332%;\n  }\n}\n\ntable {\n  max-width: 100%;\n  background-color: transparent;\n}\n\nth {\n  text-align: left;\n}\n\n.table {\n  width: 100%;\n  margin-bottom: 20px;\n}\n\n.table > thead > tr > th,\n.table > tbody > tr > th,\n.table > tfoot > tr > th,\n.table > thead > tr > td,\n.table > tbody > tr > td,\n.table > tfoot > tr > td {\n  padding: 8px;\n  line-height: 1.428571429;\n  vertical-align: top;\n  border-top: 1px solid #dddddd;\n}\n\n.table > thead > tr > th {\n  vertical-align: bottom;\n  border-bottom: 2px solid #dddddd;\n}\n\n.table > caption + thead > tr:first-child > th,\n.table > colgroup + thead > tr:first-child > th,\n.table > thead:first-child > tr:first-child > th,\n.table > caption + thead > tr:first-child > td,\n.table > colgroup + thead > tr:first-child > td,\n.table > thead:first-child > tr:first-child > td {\n  border-top: 0;\n}\n\n.table > tbody + tbody {\n  border-top: 2px solid #dddddd;\n}\n\n.table .table {\n  background-color: #ffffff;\n}\n\n.table-condensed > thead > tr > th,\n.table-condensed > tbody > tr > th,\n.table-condensed > tfoot > tr > th,\n.table-condensed > thead > tr > td,\n.table-condensed > tbody > tr > td,\n.table-condensed > tfoot > tr > td {\n  padding: 5px;\n}\n\n.table-bordered {\n  border: 1px solid #dddddd;\n}\n\n.table-bordered > thead > tr > th,\n.table-bordered > tbody > tr > th,\n.table-bordered > tfoot > tr > th,\n.table-bordered > thead > tr > td,\n.table-bordered > tbody > tr > td,\n.table-bordered > tfoot > tr > td {\n  border: 1px solid #dddddd;\n}\n\n.table-bordered > thead > tr > th,\n.table-bordered > thead > tr > td {\n  border-bottom-width: 2px;\n}\n\n.table-striped > tbody > tr:nth-child(odd) > td,\n.table-striped > tbody > tr:nth-child(odd) > th {\n  background-color: #f9f9f9;\n}\n\n.table-hover > tbody > tr:hover > td,\n.table-hover > tbody > tr:hover > th {\n  background-color: #f5f5f5;\n}\n\ntable col[class*=\"col-\"] {\n  display: table-column;\n  float: none;\n}\n\ntable td[class*=\"col-\"],\ntable th[class*=\"col-\"] {\n  display: table-cell;\n  float: none;\n}\n\n.table > thead > tr > td.active,\n.table > tbody > tr > td.active,\n.table > tfoot > tr > td.active,\n.table > thead > tr > th.active,\n.table > tbody > tr > th.active,\n.table > tfoot > tr > th.active,\n.table > thead > tr.active > td,\n.table > tbody > tr.active > td,\n.table > tfoot > tr.active > td,\n.table > thead > tr.active > th,\n.table > tbody > tr.active > th,\n.table > tfoot > tr.active > th {\n  background-color: #f5f5f5;\n}\n\n.table > thead > tr > td.success,\n.table > tbody > tr > td.success,\n.table > tfoot > tr > td.success,\n.table > thead > tr > th.success,\n.table > tbody > tr > th.success,\n.table > tfoot > tr > th.success,\n.table > thead > tr.success > td,\n.table > tbody > tr.success > td,\n.table > tfoot > tr.success > td,\n.table > thead > tr.success > th,\n.table > tbody > tr.success > th,\n.table > tfoot > tr.success > th {\n  background-color: #dff0d8;\n}\n\n.table-hover > tbody > tr > td.success:hover,\n.table-hover > tbody > tr > th.success:hover,\n.table-hover > tbody > tr.success:hover > td,\n.table-hover > tbody > tr.success:hover > th {\n  background-color: #d0e9c6;\n}\n\n.table > thead > tr > td.danger,\n.table > tbody > tr > td.danger,\n.table > tfoot > tr > td.danger,\n.table > thead > tr > th.danger,\n.table > tbody > tr > th.danger,\n.table > tfoot > tr > th.danger,\n.table > thead > tr.danger > td,\n.table > tbody > tr.danger > td,\n.table > tfoot > tr.danger > td,\n.table > thead > tr.danger > th,\n.table > tbody > tr.danger > th,\n.table > tfoot > tr.danger > th {\n  background-color: #f2dede;\n}\n\n.table-hover > tbody > tr > td.danger:hover,\n.table-hover > tbody > tr > th.danger:hover,\n.table-hover > tbody > tr.danger:hover > td,\n.table-hover > tbody > tr.danger:hover > th {\n  background-color: #ebcccc;\n}\n\n.table > thead > tr > td.warning,\n.table > tbody > tr > td.warning,\n.table > tfoot > tr > td.warning,\n.table > thead > tr > th.warning,\n.table > tbody > tr > th.warning,\n.table > tfoot > tr > th.warning,\n.table > thead > tr.warning > td,\n.table > tbody > tr.warning > td,\n.table > tfoot > tr.warning > td,\n.table > thead > tr.warning > th,\n.table > tbody > tr.warning > th,\n.table > tfoot > tr.warning > th {\n  background-color: #fcf8e3;\n}\n\n.table-hover > tbody > tr > td.warning:hover,\n.table-hover > tbody > tr > th.warning:hover,\n.table-hover > tbody > tr.warning:hover > td,\n.table-hover > tbody > tr.warning:hover > th {\n  background-color: #faf2cc;\n}\n\n@media (max-width: 767px) {\n  .table-responsive {\n    width: 100%;\n    margin-bottom: 15px;\n    overflow-x: scroll;\n    overflow-y: hidden;\n    border: 1px solid #dddddd;\n    -ms-overflow-style: -ms-autohiding-scrollbar;\n    -webkit-overflow-scrolling: touch;\n  }\n  .table-responsive > .table {\n    margin-bottom: 0;\n  }\n  .table-responsive > .table > thead > tr > th,\n  .table-responsive > .table > tbody > tr > th,\n  .table-responsive > .table > tfoot > tr > th,\n  .table-responsive > .table > thead > tr > td,\n  .table-responsive > .table > tbody > tr > td,\n  .table-responsive > .table > tfoot > tr > td {\n    white-space: nowrap;\n  }\n  .table-responsive > .table-bordered {\n    border: 0;\n  }\n  .table-responsive > .table-bordered > thead > tr > th:first-child,\n  .table-responsive > .table-bordered > tbody > tr > th:first-child,\n  .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n  .table-responsive > .table-bordered > thead > tr > td:first-child,\n  .table-responsive > .table-bordered > tbody > tr > td:first-child,\n  .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n    border-left: 0;\n  }\n  .table-responsive > .table-bordered > thead > tr > th:last-child,\n  .table-responsive > .table-bordered > tbody > tr > th:last-child,\n  .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n  .table-responsive > .table-bordered > thead > tr > td:last-child,\n  .table-responsive > .table-bordered > tbody > tr > td:last-child,\n  .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n    border-right: 0;\n  }\n  .table-responsive > .table-bordered > tbody > tr:last-child > th,\n  .table-responsive > .table-bordered > tfoot > tr:last-child > th,\n  .table-responsive > .table-bordered > tbody > tr:last-child > td,\n  .table-responsive > .table-bordered > tfoot > tr:last-child > td {\n    border-bottom: 0;\n  }\n}\n\nfieldset {\n  padding: 0;\n  margin: 0;\n  border: 0;\n}\n\nlegend {\n  display: block;\n  width: 100%;\n  padding: 0;\n  margin-bottom: 20px;\n  font-size: 21px;\n  line-height: inherit;\n  color: #333333;\n  border: 0;\n  border-bottom: 1px solid #e5e5e5;\n}\n\nlabel {\n  display: inline-block;\n  margin-bottom: 5px;\n  font-weight: bold;\n}\n\ninput[type=\"search\"] {\n  -webkit-box-sizing: border-box;\n     -moz-box-sizing: border-box;\n          box-sizing: border-box;\n}\n\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 4px 0 0;\n  margin-top: 1px \\9;\n  /* IE8-9 */\n\n  line-height: normal;\n}\n\ninput[type=\"file\"] {\n  display: block;\n}\n\nselect[multiple],\nselect[size] {\n  height: auto;\n}\n\nselect optgroup {\n  font-family: inherit;\n  font-size: inherit;\n  font-style: inherit;\n}\n\ninput[type=\"file\"]:focus,\ninput[type=\"radio\"]:focus,\ninput[type=\"checkbox\"]:focus {\n  outline: thin dotted #333;\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n\ninput[type=\"number\"]::-webkit-outer-spin-button,\ninput[type=\"number\"]::-webkit-inner-spin-button {\n  height: auto;\n}\n\noutput {\n  display: block;\n  padding-top: 7px;\n  font-size: 14px;\n  line-height: 1.428571429;\n  color: #555555;\n  vertical-align: middle;\n}\n\n.form-control:-moz-placeholder {\n  color: #999999;\n}\n\n.form-control::-moz-placeholder {\n  color: #999999;\n}\n\n.form-control:-ms-input-placeholder {\n  color: #999999;\n}\n\n.form-control::-webkit-input-placeholder {\n  color: #999999;\n}\n\n.form-control {\n  display: block;\n  width: 100%;\n  height: 34px;\n  padding: 6px 12px;\n  font-size: 14px;\n  line-height: 1.428571429;\n  color: #555555;\n  vertical-align: middle;\n  background-color: #ffffff;\n  background-image: none;\n  border: 1px solid #cccccc;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n  -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;\n          transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;\n}\n\n.form-control:focus {\n  border-color: #66afe9;\n  outline: 0;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);\n}\n\n.form-control[disabled],\n.form-control[readonly],\nfieldset[disabled] .form-control {\n  cursor: not-allowed;\n  background-color: #eeeeee;\n}\n\ntextarea.form-control {\n  height: auto;\n}\n\n.form-group {\n  margin-bottom: 15px;\n}\n\n.radio,\n.checkbox {\n  display: block;\n  min-height: 20px;\n  padding-left: 20px;\n  margin-top: 10px;\n  margin-bottom: 10px;\n  vertical-align: middle;\n}\n\n.radio label,\n.checkbox label {\n  display: inline;\n  margin-bottom: 0;\n  font-weight: normal;\n  cursor: pointer;\n}\n\n.radio input[type=\"radio\"],\n.radio-inline input[type=\"radio\"],\n.checkbox input[type=\"checkbox\"],\n.checkbox-inline input[type=\"checkbox\"] {\n  float: left;\n  margin-left: -20px;\n}\n\n.radio + .radio,\n.checkbox + .checkbox {\n  margin-top: -5px;\n}\n\n.radio-inline,\n.checkbox-inline {\n  display: inline-block;\n  padding-left: 20px;\n  margin-bottom: 0;\n  font-weight: normal;\n  vertical-align: middle;\n  cursor: pointer;\n}\n\n.radio-inline + .radio-inline,\n.checkbox-inline + .checkbox-inline {\n  margin-top: 0;\n  margin-left: 10px;\n}\n\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\n.radio[disabled],\n.radio-inline[disabled],\n.checkbox[disabled],\n.checkbox-inline[disabled],\nfieldset[disabled] input[type=\"radio\"],\nfieldset[disabled] input[type=\"checkbox\"],\nfieldset[disabled] .radio,\nfieldset[disabled] .radio-inline,\nfieldset[disabled] .checkbox,\nfieldset[disabled] .checkbox-inline {\n  cursor: not-allowed;\n}\n\n.input-sm {\n  height: 30px;\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n\nselect.input-sm {\n  height: 30px;\n  line-height: 30px;\n}\n\ntextarea.input-sm {\n  height: auto;\n}\n\n.input-lg {\n  height: 45px;\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.33;\n  border-radius: 6px;\n}\n\nselect.input-lg {\n  height: 45px;\n  line-height: 45px;\n}\n\ntextarea.input-lg {\n  height: auto;\n}\n\n.has-warning .help-block,\n.has-warning .control-label,\n.has-warning .radio,\n.has-warning .checkbox,\n.has-warning .radio-inline,\n.has-warning .checkbox-inline {\n  color: #c09853;\n}\n\n.has-warning .form-control {\n  border-color: #c09853;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n}\n\n.has-warning .form-control:focus {\n  border-color: #a47e3c;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e;\n}\n\n.has-warning .input-group-addon {\n  color: #c09853;\n  background-color: #fcf8e3;\n  border-color: #c09853;\n}\n\n.has-error .help-block,\n.has-error .control-label,\n.has-error .radio,\n.has-error .checkbox,\n.has-error .radio-inline,\n.has-error .checkbox-inline {\n  color: #b94a48;\n}\n\n.has-error .form-control {\n  border-color: #b94a48;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n}\n\n.has-error .form-control:focus {\n  border-color: #953b39;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392;\n}\n\n.has-error .input-group-addon {\n  color: #b94a48;\n  background-color: #f2dede;\n  border-color: #b94a48;\n}\n\n.has-success .help-block,\n.has-success .control-label,\n.has-success .radio,\n.has-success .checkbox,\n.has-success .radio-inline,\n.has-success .checkbox-inline {\n  color: #468847;\n}\n\n.has-success .form-control {\n  border-color: #468847;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);\n}\n\n.has-success .form-control:focus {\n  border-color: #356635;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b;\n}\n\n.has-success .input-group-addon {\n  color: #468847;\n  background-color: #dff0d8;\n  border-color: #468847;\n}\n\n.form-control-static {\n  margin-bottom: 0;\n}\n\n.help-block {\n  display: block;\n  margin-top: 5px;\n  margin-bottom: 10px;\n  color: #737373;\n}\n\n@media (min-width: 768px) {\n  .form-inline .form-group {\n    display: inline-block;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .form-inline .form-control {\n    display: inline-block;\n  }\n  .form-inline .radio,\n  .form-inline .checkbox {\n    display: inline-block;\n    padding-left: 0;\n    margin-top: 0;\n    margin-bottom: 0;\n  }\n  .form-inline .radio input[type=\"radio\"],\n  .form-inline .checkbox input[type=\"checkbox\"] {\n    float: none;\n    margin-left: 0;\n  }\n}\n\n.form-horizontal .control-label,\n.form-horizontal .radio,\n.form-horizontal .checkbox,\n.form-horizontal .radio-inline,\n.form-horizontal .checkbox-inline {\n  padding-top: 7px;\n  margin-top: 0;\n  margin-bottom: 0;\n}\n\n.form-horizontal .form-group {\n  margin-right: -15px;\n  margin-left: -15px;\n}\n\n.form-horizontal .form-group:before,\n.form-horizontal .form-group:after {\n  display: table;\n  content: \" \";\n}\n\n.form-horizontal .form-group:after {\n  clear: both;\n}\n\n.form-horizontal .form-group:before,\n.form-horizontal .form-group:after {\n  display: table;\n  content: \" \";\n}\n\n.form-horizontal .form-group:after {\n  clear: both;\n}\n\n.form-horizontal .form-control-static {\n  padding-top: 7px;\n}\n\n@media (min-width: 768px) {\n  .form-horizontal .control-label {\n    text-align: right;\n  }\n}\n\n.btn {\n  display: inline-block;\n  padding: 6px 12px;\n  margin-bottom: 0;\n  font-size: 14px;\n  font-weight: normal;\n  line-height: 1.428571429;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: middle;\n  cursor: pointer;\n  background-image: none;\n  border: 1px solid transparent;\n  border-radius: 4px;\n  -webkit-user-select: none;\n     -moz-user-select: none;\n      -ms-user-select: none;\n       -o-user-select: none;\n          user-select: none;\n}\n\n.btn:focus {\n  outline: thin dotted #333;\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n\n.btn:hover,\n.btn:focus {\n  color: #333333;\n  text-decoration: none;\n}\n\n.btn:active,\n.btn.active {\n  background-image: none;\n  outline: 0;\n  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n          box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n}\n\n.btn.disabled,\n.btn[disabled],\nfieldset[disabled] .btn {\n  pointer-events: none;\n  cursor: not-allowed;\n  opacity: 0.65;\n  filter: alpha(opacity=65);\n  -webkit-box-shadow: none;\n          box-shadow: none;\n}\n\n.btn-default {\n  color: #333333;\n  background-color: #ffffff;\n  border-color: #cccccc;\n}\n\n.btn-default:hover,\n.btn-default:focus,\n.btn-default:active,\n.btn-default.active,\n.open .dropdown-toggle.btn-default {\n  color: #333333;\n  background-color: #ebebeb;\n  border-color: #adadad;\n}\n\n.btn-default:active,\n.btn-default.active,\n.open .dropdown-toggle.btn-default {\n  background-image: none;\n}\n\n.btn-default.disabled,\n.btn-default[disabled],\nfieldset[disabled] .btn-default,\n.btn-default.disabled:hover,\n.btn-default[disabled]:hover,\nfieldset[disabled] .btn-default:hover,\n.btn-default.disabled:focus,\n.btn-default[disabled]:focus,\nfieldset[disabled] .btn-default:focus,\n.btn-default.disabled:active,\n.btn-default[disabled]:active,\nfieldset[disabled] .btn-default:active,\n.btn-default.disabled.active,\n.btn-default[disabled].active,\nfieldset[disabled] .btn-default.active {\n  background-color: #ffffff;\n  border-color: #cccccc;\n}\n\n.btn-primary {\n  color: #ffffff;\n  background-color: #428bca;\n  border-color: #357ebd;\n}\n\n.btn-primary:hover,\n.btn-primary:focus,\n.btn-primary:active,\n.btn-primary.active,\n.open .dropdown-toggle.btn-primary {\n  color: #ffffff;\n  background-color: #3276b1;\n  border-color: #285e8e;\n}\n\n.btn-primary:active,\n.btn-primary.active,\n.open .dropdown-toggle.btn-primary {\n  background-image: none;\n}\n\n.btn-primary.disabled,\n.btn-primary[disabled],\nfieldset[disabled] .btn-primary,\n.btn-primary.disabled:hover,\n.btn-primary[disabled]:hover,\nfieldset[disabled] .btn-primary:hover,\n.btn-primary.disabled:focus,\n.btn-primary[disabled]:focus,\nfieldset[disabled] .btn-primary:focus,\n.btn-primary.disabled:active,\n.btn-primary[disabled]:active,\nfieldset[disabled] .btn-primary:active,\n.btn-primary.disabled.active,\n.btn-primary[disabled].active,\nfieldset[disabled] .btn-primary.active {\n  background-color: #428bca;\n  border-color: #357ebd;\n}\n\n.btn-warning {\n  color: #ffffff;\n  background-color: #f0ad4e;\n  border-color: #eea236;\n}\n\n.btn-warning:hover,\n.btn-warning:focus,\n.btn-warning:active,\n.btn-warning.active,\n.open .dropdown-toggle.btn-warning {\n  color: #ffffff;\n  background-color: #ed9c28;\n  border-color: #d58512;\n}\n\n.btn-warning:active,\n.btn-warning.active,\n.open .dropdown-toggle.btn-warning {\n  background-image: none;\n}\n\n.btn-warning.disabled,\n.btn-warning[disabled],\nfieldset[disabled] .btn-warning,\n.btn-warning.disabled:hover,\n.btn-warning[disabled]:hover,\nfieldset[disabled] .btn-warning:hover,\n.btn-warning.disabled:focus,\n.btn-warning[disabled]:focus,\nfieldset[disabled] .btn-warning:focus,\n.btn-warning.disabled:active,\n.btn-warning[disabled]:active,\nfieldset[disabled] .btn-warning:active,\n.btn-warning.disabled.active,\n.btn-warning[disabled].active,\nfieldset[disabled] .btn-warning.active {\n  background-color: #f0ad4e;\n  border-color: #eea236;\n}\n\n.btn-danger {\n  color: #ffffff;\n  background-color: #d9534f;\n  border-color: #d43f3a;\n}\n\n.btn-danger:hover,\n.btn-danger:focus,\n.btn-danger:active,\n.btn-danger.active,\n.open .dropdown-toggle.btn-danger {\n  color: #ffffff;\n  background-color: #d2322d;\n  border-color: #ac2925;\n}\n\n.btn-danger:active,\n.btn-danger.active,\n.open .dropdown-toggle.btn-danger {\n  background-image: none;\n}\n\n.btn-danger.disabled,\n.btn-danger[disabled],\nfieldset[disabled] .btn-danger,\n.btn-danger.disabled:hover,\n.btn-danger[disabled]:hover,\nfieldset[disabled] .btn-danger:hover,\n.btn-danger.disabled:focus,\n.btn-danger[disabled]:focus,\nfieldset[disabled] .btn-danger:focus,\n.btn-danger.disabled:active,\n.btn-danger[disabled]:active,\nfieldset[disabled] .btn-danger:active,\n.btn-danger.disabled.active,\n.btn-danger[disabled].active,\nfieldset[disabled] .btn-danger.active {\n  background-color: #d9534f;\n  border-color: #d43f3a;\n}\n\n.btn-success {\n  color: #ffffff;\n  background-color: #5cb85c;\n  border-color: #4cae4c;\n}\n\n.btn-success:hover,\n.btn-success:focus,\n.btn-success:active,\n.btn-success.active,\n.open .dropdown-toggle.btn-success {\n  color: #ffffff;\n  background-color: #47a447;\n  border-color: #398439;\n}\n\n.btn-success:active,\n.btn-success.active,\n.open .dropdown-toggle.btn-success {\n  background-image: none;\n}\n\n.btn-success.disabled,\n.btn-success[disabled],\nfieldset[disabled] .btn-success,\n.btn-success.disabled:hover,\n.btn-success[disabled]:hover,\nfieldset[disabled] .btn-success:hover,\n.btn-success.disabled:focus,\n.btn-success[disabled]:focus,\nfieldset[disabled] .btn-success:focus,\n.btn-success.disabled:active,\n.btn-success[disabled]:active,\nfieldset[disabled] .btn-success:active,\n.btn-success.disabled.active,\n.btn-success[disabled].active,\nfieldset[disabled] .btn-success.active {\n  background-color: #5cb85c;\n  border-color: #4cae4c;\n}\n\n.btn-info {\n  color: #ffffff;\n  background-color: #5bc0de;\n  border-color: #46b8da;\n}\n\n.btn-info:hover,\n.btn-info:focus,\n.btn-info:active,\n.btn-info.active,\n.open .dropdown-toggle.btn-info {\n  color: #ffffff;\n  background-color: #39b3d7;\n  border-color: #269abc;\n}\n\n.btn-info:active,\n.btn-info.active,\n.open .dropdown-toggle.btn-info {\n  background-image: none;\n}\n\n.btn-info.disabled,\n.btn-info[disabled],\nfieldset[disabled] .btn-info,\n.btn-info.disabled:hover,\n.btn-info[disabled]:hover,\nfieldset[disabled] .btn-info:hover,\n.btn-info.disabled:focus,\n.btn-info[disabled]:focus,\nfieldset[disabled] .btn-info:focus,\n.btn-info.disabled:active,\n.btn-info[disabled]:active,\nfieldset[disabled] .btn-info:active,\n.btn-info.disabled.active,\n.btn-info[disabled].active,\nfieldset[disabled] .btn-info.active {\n  background-color: #5bc0de;\n  border-color: #46b8da;\n}\n\n.btn-link {\n  font-weight: normal;\n  color: #428bca;\n  cursor: pointer;\n  border-radius: 0;\n}\n\n.btn-link,\n.btn-link:active,\n.btn-link[disabled],\nfieldset[disabled] .btn-link {\n  background-color: transparent;\n  -webkit-box-shadow: none;\n          box-shadow: none;\n}\n\n.btn-link,\n.btn-link:hover,\n.btn-link:focus,\n.btn-link:active {\n  border-color: transparent;\n}\n\n.btn-link:hover,\n.btn-link:focus {\n  color: #2a6496;\n  text-decoration: underline;\n  background-color: transparent;\n}\n\n.btn-link[disabled]:hover,\nfieldset[disabled] .btn-link:hover,\n.btn-link[disabled]:focus,\nfieldset[disabled] .btn-link:focus {\n  color: #999999;\n  text-decoration: none;\n}\n\n.btn-lg {\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.33;\n  border-radius: 6px;\n}\n\n.btn-sm,\n.btn-xs {\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n\n.btn-xs {\n  padding: 1px 5px;\n}\n\n.btn-block {\n  display: block;\n  width: 100%;\n  padding-right: 0;\n  padding-left: 0;\n}\n\n.btn-block + .btn-block {\n  margin-top: 5px;\n}\n\ninput[type=\"submit\"].btn-block,\ninput[type=\"reset\"].btn-block,\ninput[type=\"button\"].btn-block {\n  width: 100%;\n}\n\n.fade {\n  opacity: 0;\n  -webkit-transition: opacity 0.15s linear;\n          transition: opacity 0.15s linear;\n}\n\n.fade.in {\n  opacity: 1;\n}\n\n.collapse {\n  display: none;\n}\n\n.collapse.in {\n  display: block;\n}\n\n.collapsing {\n  position: relative;\n  height: 0;\n  overflow: hidden;\n  -webkit-transition: height 0.35s ease;\n          transition: height 0.35s ease;\n}\n\n@font-face {\n  font-family: 'Glyphicons Halflings';\n  src: url('../fonts/glyphicons-halflings-regular.eot');\n  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');\n}\n\n.glyphicon {\n  position: relative;\n  top: 1px;\n  display: inline-block;\n  font-family: 'Glyphicons Halflings';\n  -webkit-font-smoothing: antialiased;\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1;\n  -moz-osx-font-smoothing: grayscale;\n}\n\n.glyphicon:empty {\n  width: 1em;\n}\n\n.glyphicon-asterisk:before {\n  content: \"\\2a\";\n}\n\n.glyphicon-plus:before {\n  content: \"\\2b\";\n}\n\n.glyphicon-euro:before {\n  content: \"\\20ac\";\n}\n\n.glyphicon-minus:before {\n  content: \"\\2212\";\n}\n\n.glyphicon-cloud:before {\n  content: \"\\2601\";\n}\n\n.glyphicon-envelope:before {\n  content: \"\\2709\";\n}\n\n.glyphicon-pencil:before {\n  content: \"\\270f\";\n}\n\n.glyphicon-glass:before {\n  content: \"\\e001\";\n}\n\n.glyphicon-music:before {\n  content: \"\\e002\";\n}\n\n.glyphicon-search:before {\n  content: \"\\e003\";\n}\n\n.glyphicon-heart:before {\n  content: \"\\e005\";\n}\n\n.glyphicon-star:before {\n  content: \"\\e006\";\n}\n\n.glyphicon-star-empty:before {\n  content: \"\\e007\";\n}\n\n.glyphicon-user:before {\n  content: \"\\e008\";\n}\n\n.glyphicon-film:before {\n  content: \"\\e009\";\n}\n\n.glyphicon-th-large:before {\n  content: \"\\e010\";\n}\n\n.glyphicon-th:before {\n  content: \"\\e011\";\n}\n\n.glyphicon-th-list:before {\n  content: \"\\e012\";\n}\n\n.glyphicon-ok:before {\n  content: \"\\e013\";\n}\n\n.glyphicon-remove:before {\n  content: \"\\e014\";\n}\n\n.glyphicon-zoom-in:before {\n  content: \"\\e015\";\n}\n\n.glyphicon-zoom-out:before {\n  content: \"\\e016\";\n}\n\n.glyphicon-off:before {\n  content: \"\\e017\";\n}\n\n.glyphicon-signal:before {\n  content: \"\\e018\";\n}\n\n.glyphicon-cog:before {\n  content: \"\\e019\";\n}\n\n.glyphicon-trash:before {\n  content: \"\\e020\";\n}\n\n.glyphicon-home:before {\n  content: \"\\e021\";\n}\n\n.glyphicon-file:before {\n  content: \"\\e022\";\n}\n\n.glyphicon-time:before {\n  content: \"\\e023\";\n}\n\n.glyphicon-road:before {\n  content: \"\\e024\";\n}\n\n.glyphicon-download-alt:before {\n  content: \"\\e025\";\n}\n\n.glyphicon-download:before {\n  content: \"\\e026\";\n}\n\n.glyphicon-upload:before {\n  content: \"\\e027\";\n}\n\n.glyphicon-inbox:before {\n  content: \"\\e028\";\n}\n\n.glyphicon-play-circle:before {\n  content: \"\\e029\";\n}\n\n.glyphicon-repeat:before {\n  content: \"\\e030\";\n}\n\n.glyphicon-refresh:before {\n  content: \"\\e031\";\n}\n\n.glyphicon-list-alt:before {\n  content: \"\\e032\";\n}\n\n.glyphicon-lock:before {\n  content: \"\\e033\";\n}\n\n.glyphicon-flag:before {\n  content: \"\\e034\";\n}\n\n.glyphicon-headphones:before {\n  content: \"\\e035\";\n}\n\n.glyphicon-volume-off:before {\n  content: \"\\e036\";\n}\n\n.glyphicon-volume-down:before {\n  content: \"\\e037\";\n}\n\n.glyphicon-volume-up:before {\n  content: \"\\e038\";\n}\n\n.glyphicon-qrcode:before {\n  content: \"\\e039\";\n}\n\n.glyphicon-barcode:before {\n  content: \"\\e040\";\n}\n\n.glyphicon-tag:before {\n  content: \"\\e041\";\n}\n\n.glyphicon-tags:before {\n  content: \"\\e042\";\n}\n\n.glyphicon-book:before {\n  content: \"\\e043\";\n}\n\n.glyphicon-bookmark:before {\n  content: \"\\e044\";\n}\n\n.glyphicon-print:before {\n  content: \"\\e045\";\n}\n\n.glyphicon-camera:before {\n  content: \"\\e046\";\n}\n\n.glyphicon-font:before {\n  content: \"\\e047\";\n}\n\n.glyphicon-bold:before {\n  content: \"\\e048\";\n}\n\n.glyphicon-italic:before {\n  content: \"\\e049\";\n}\n\n.glyphicon-text-height:before {\n  content: \"\\e050\";\n}\n\n.glyphicon-text-width:before {\n  content: \"\\e051\";\n}\n\n.glyphicon-align-left:before {\n  content: \"\\e052\";\n}\n\n.glyphicon-align-center:before {\n  content: \"\\e053\";\n}\n\n.glyphicon-align-right:before {\n  content: \"\\e054\";\n}\n\n.glyphicon-align-justify:before {\n  content: \"\\e055\";\n}\n\n.glyphicon-list:before {\n  content: \"\\e056\";\n}\n\n.glyphicon-indent-left:before {\n  content: \"\\e057\";\n}\n\n.glyphicon-indent-right:before {\n  content: \"\\e058\";\n}\n\n.glyphicon-facetime-video:before {\n  content: \"\\e059\";\n}\n\n.glyphicon-picture:before {\n  content: \"\\e060\";\n}\n\n.glyphicon-map-marker:before {\n  content: \"\\e062\";\n}\n\n.glyphicon-adjust:before {\n  content: \"\\e063\";\n}\n\n.glyphicon-tint:before {\n  content: \"\\e064\";\n}\n\n.glyphicon-edit:before {\n  content: \"\\e065\";\n}\n\n.glyphicon-share:before {\n  content: \"\\e066\";\n}\n\n.glyphicon-check:before {\n  content: \"\\e067\";\n}\n\n.glyphicon-move:before {\n  content: \"\\e068\";\n}\n\n.glyphicon-step-backward:before {\n  content: \"\\e069\";\n}\n\n.glyphicon-fast-backward:before {\n  content: \"\\e070\";\n}\n\n.glyphicon-backward:before {\n  content: \"\\e071\";\n}\n\n.glyphicon-play:before {\n  content: \"\\e072\";\n}\n\n.glyphicon-pause:before {\n  content: \"\\e073\";\n}\n\n.glyphicon-stop:before {\n  content: \"\\e074\";\n}\n\n.glyphicon-forward:before {\n  content: \"\\e075\";\n}\n\n.glyphicon-fast-forward:before {\n  content: \"\\e076\";\n}\n\n.glyphicon-step-forward:before {\n  content: \"\\e077\";\n}\n\n.glyphicon-eject:before {\n  content: \"\\e078\";\n}\n\n.glyphicon-chevron-left:before {\n  content: \"\\e079\";\n}\n\n.glyphicon-chevron-right:before {\n  content: \"\\e080\";\n}\n\n.glyphicon-plus-sign:before {\n  content: \"\\e081\";\n}\n\n.glyphicon-minus-sign:before {\n  content: \"\\e082\";\n}\n\n.glyphicon-remove-sign:before {\n  content: \"\\e083\";\n}\n\n.glyphicon-ok-sign:before {\n  content: \"\\e084\";\n}\n\n.glyphicon-question-sign:before {\n  content: \"\\e085\";\n}\n\n.glyphicon-info-sign:before {\n  content: \"\\e086\";\n}\n\n.glyphicon-screenshot:before {\n  content: \"\\e087\";\n}\n\n.glyphicon-remove-circle:before {\n  content: \"\\e088\";\n}\n\n.glyphicon-ok-circle:before {\n  content: \"\\e089\";\n}\n\n.glyphicon-ban-circle:before {\n  content: \"\\e090\";\n}\n\n.glyphicon-arrow-left:before {\n  content: \"\\e091\";\n}\n\n.glyphicon-arrow-right:before {\n  content: \"\\e092\";\n}\n\n.glyphicon-arrow-up:before {\n  content: \"\\e093\";\n}\n\n.glyphicon-arrow-down:before {\n  content: \"\\e094\";\n}\n\n.glyphicon-share-alt:before {\n  content: \"\\e095\";\n}\n\n.glyphicon-resize-full:before {\n  content: \"\\e096\";\n}\n\n.glyphicon-resize-small:before {\n  content: \"\\e097\";\n}\n\n.glyphicon-exclamation-sign:before {\n  content: \"\\e101\";\n}\n\n.glyphicon-gift:before {\n  content: \"\\e102\";\n}\n\n.glyphicon-leaf:before {\n  content: \"\\e103\";\n}\n\n.glyphicon-fire:before {\n  content: \"\\e104\";\n}\n\n.glyphicon-eye-open:before {\n  content: \"\\e105\";\n}\n\n.glyphicon-eye-close:before {\n  content: \"\\e106\";\n}\n\n.glyphicon-warning-sign:before {\n  content: \"\\e107\";\n}\n\n.glyphicon-plane:before {\n  content: \"\\e108\";\n}\n\n.glyphicon-calendar:before {\n  content: \"\\e109\";\n}\n\n.glyphicon-random:before {\n  content: \"\\e110\";\n}\n\n.glyphicon-comment:before {\n  content: \"\\e111\";\n}\n\n.glyphicon-magnet:before {\n  content: \"\\e112\";\n}\n\n.glyphicon-chevron-up:before {\n  content: \"\\e113\";\n}\n\n.glyphicon-chevron-down:before {\n  content: \"\\e114\";\n}\n\n.glyphicon-retweet:before {\n  content: \"\\e115\";\n}\n\n.glyphicon-shopping-cart:before {\n  content: \"\\e116\";\n}\n\n.glyphicon-folder-close:before {\n  content: \"\\e117\";\n}\n\n.glyphicon-folder-open:before {\n  content: \"\\e118\";\n}\n\n.glyphicon-resize-vertical:before {\n  content: \"\\e119\";\n}\n\n.glyphicon-resize-horizontal:before {\n  content: \"\\e120\";\n}\n\n.glyphicon-hdd:before {\n  content: \"\\e121\";\n}\n\n.glyphicon-bullhorn:before {\n  content: \"\\e122\";\n}\n\n.glyphicon-bell:before {\n  content: \"\\e123\";\n}\n\n.glyphicon-certificate:before {\n  content: \"\\e124\";\n}\n\n.glyphicon-thumbs-up:before {\n  content: \"\\e125\";\n}\n\n.glyphicon-thumbs-down:before {\n  content: \"\\e126\";\n}\n\n.glyphicon-hand-right:before {\n  content: \"\\e127\";\n}\n\n.glyphicon-hand-left:before {\n  content: \"\\e128\";\n}\n\n.glyphicon-hand-up:before {\n  content: \"\\e129\";\n}\n\n.glyphicon-hand-down:before {\n  content: \"\\e130\";\n}\n\n.glyphicon-circle-arrow-right:before {\n  content: \"\\e131\";\n}\n\n.glyphicon-circle-arrow-left:before {\n  content: \"\\e132\";\n}\n\n.glyphicon-circle-arrow-up:before {\n  content: \"\\e133\";\n}\n\n.glyphicon-circle-arrow-down:before {\n  content: \"\\e134\";\n}\n\n.glyphicon-globe:before {\n  content: \"\\e135\";\n}\n\n.glyphicon-wrench:before {\n  content: \"\\e136\";\n}\n\n.glyphicon-tasks:before {\n  content: \"\\e137\";\n}\n\n.glyphicon-filter:before {\n  content: \"\\e138\";\n}\n\n.glyphicon-briefcase:before {\n  content: \"\\e139\";\n}\n\n.glyphicon-fullscreen:before {\n  content: \"\\e140\";\n}\n\n.glyphicon-dashboard:before {\n  content: \"\\e141\";\n}\n\n.glyphicon-paperclip:before {\n  content: \"\\e142\";\n}\n\n.glyphicon-heart-empty:before {\n  content: \"\\e143\";\n}\n\n.glyphicon-link:before {\n  content: \"\\e144\";\n}\n\n.glyphicon-phone:before {\n  content: \"\\e145\";\n}\n\n.glyphicon-pushpin:before {\n  content: \"\\e146\";\n}\n\n.glyphicon-usd:before {\n  content: \"\\e148\";\n}\n\n.glyphicon-gbp:before {\n  content: \"\\e149\";\n}\n\n.glyphicon-sort:before {\n  content: \"\\e150\";\n}\n\n.glyphicon-sort-by-alphabet:before {\n  content: \"\\e151\";\n}\n\n.glyphicon-sort-by-alphabet-alt:before {\n  content: \"\\e152\";\n}\n\n.glyphicon-sort-by-order:before {\n  content: \"\\e153\";\n}\n\n.glyphicon-sort-by-order-alt:before {\n  content: \"\\e154\";\n}\n\n.glyphicon-sort-by-attributes:before {\n  content: \"\\e155\";\n}\n\n.glyphicon-sort-by-attributes-alt:before {\n  content: \"\\e156\";\n}\n\n.glyphicon-unchecked:before {\n  content: \"\\e157\";\n}\n\n.glyphicon-expand:before {\n  content: \"\\e158\";\n}\n\n.glyphicon-collapse-down:before {\n  content: \"\\e159\";\n}\n\n.glyphicon-collapse-up:before {\n  content: \"\\e160\";\n}\n\n.glyphicon-log-in:before {\n  content: \"\\e161\";\n}\n\n.glyphicon-flash:before {\n  content: \"\\e162\";\n}\n\n.glyphicon-log-out:before {\n  content: \"\\e163\";\n}\n\n.glyphicon-new-window:before {\n  content: \"\\e164\";\n}\n\n.glyphicon-record:before {\n  content: \"\\e165\";\n}\n\n.glyphicon-save:before {\n  content: \"\\e166\";\n}\n\n.glyphicon-open:before {\n  content: \"\\e167\";\n}\n\n.glyphicon-saved:before {\n  content: \"\\e168\";\n}\n\n.glyphicon-import:before {\n  content: \"\\e169\";\n}\n\n.glyphicon-export:before {\n  content: \"\\e170\";\n}\n\n.glyphicon-send:before {\n  content: \"\\e171\";\n}\n\n.glyphicon-floppy-disk:before {\n  content: \"\\e172\";\n}\n\n.glyphicon-floppy-saved:before {\n  content: \"\\e173\";\n}\n\n.glyphicon-floppy-remove:before {\n  content: \"\\e174\";\n}\n\n.glyphicon-floppy-save:before {\n  content: \"\\e175\";\n}\n\n.glyphicon-floppy-open:before {\n  content: \"\\e176\";\n}\n\n.glyphicon-credit-card:before {\n  content: \"\\e177\";\n}\n\n.glyphicon-transfer:before {\n  content: \"\\e178\";\n}\n\n.glyphicon-cutlery:before {\n  content: \"\\e179\";\n}\n\n.glyphicon-header:before {\n  content: \"\\e180\";\n}\n\n.glyphicon-compressed:before {\n  content: \"\\e181\";\n}\n\n.glyphicon-earphone:before {\n  content: \"\\e182\";\n}\n\n.glyphicon-phone-alt:before {\n  content: \"\\e183\";\n}\n\n.glyphicon-tower:before {\n  content: \"\\e184\";\n}\n\n.glyphicon-stats:before {\n  content: \"\\e185\";\n}\n\n.glyphicon-sd-video:before {\n  content: \"\\e186\";\n}\n\n.glyphicon-hd-video:before {\n  content: \"\\e187\";\n}\n\n.glyphicon-subtitles:before {\n  content: \"\\e188\";\n}\n\n.glyphicon-sound-stereo:before {\n  content: \"\\e189\";\n}\n\n.glyphicon-sound-dolby:before {\n  content: \"\\e190\";\n}\n\n.glyphicon-sound-5-1:before {\n  content: \"\\e191\";\n}\n\n.glyphicon-sound-6-1:before {\n  content: \"\\e192\";\n}\n\n.glyphicon-sound-7-1:before {\n  content: \"\\e193\";\n}\n\n.glyphicon-copyright-mark:before {\n  content: \"\\e194\";\n}\n\n.glyphicon-registration-mark:before {\n  content: \"\\e195\";\n}\n\n.glyphicon-cloud-download:before {\n  content: \"\\e197\";\n}\n\n.glyphicon-cloud-upload:before {\n  content: \"\\e198\";\n}\n\n.glyphicon-tree-conifer:before {\n  content: \"\\e199\";\n}\n\n.glyphicon-tree-deciduous:before {\n  content: \"\\e200\";\n}\n\n.caret {\n  display: inline-block;\n  width: 0;\n  height: 0;\n  margin-left: 2px;\n  vertical-align: middle;\n  border-top: 4px solid #000000;\n  border-right: 4px solid transparent;\n  border-bottom: 0 dotted;\n  border-left: 4px solid transparent;\n}\n\n.dropdown {\n  position: relative;\n}\n\n.dropdown-toggle:focus {\n  outline: 0;\n}\n\n.dropdown-menu {\n  position: absolute;\n  top: 100%;\n  left: 0;\n  z-index: 1000;\n  display: none;\n  float: left;\n  min-width: 160px;\n  padding: 5px 0;\n  margin: 2px 0 0;\n  font-size: 14px;\n  list-style: none;\n  background-color: #ffffff;\n  border: 1px solid #cccccc;\n  border: 1px solid rgba(0, 0, 0, 0.15);\n  border-radius: 4px;\n  -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n          box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n  background-clip: padding-box;\n}\n\n.dropdown-menu.pull-right {\n  right: 0;\n  left: auto;\n}\n\n.dropdown-menu .divider {\n  height: 1px;\n  margin: 9px 0;\n  overflow: hidden;\n  background-color: #e5e5e5;\n}\n\n.dropdown-menu > li > a {\n  display: block;\n  padding: 3px 20px;\n  clear: both;\n  font-weight: normal;\n  line-height: 1.428571429;\n  color: #333333;\n  white-space: nowrap;\n}\n\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n  color: #262626;\n  text-decoration: none;\n  background-color: #f5f5f5;\n}\n\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n  color: #ffffff;\n  text-decoration: none;\n  background-color: #428bca;\n  outline: 0;\n}\n\n.dropdown-menu > .disabled > a,\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n  color: #999999;\n}\n\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n  text-decoration: none;\n  cursor: not-allowed;\n  background-color: transparent;\n  background-image: none;\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);\n}\n\n.open > .dropdown-menu {\n  display: block;\n}\n\n.open > a {\n  outline: 0;\n}\n\n.dropdown-header {\n  display: block;\n  padding: 3px 20px;\n  font-size: 12px;\n  line-height: 1.428571429;\n  color: #999999;\n}\n\n.dropdown-backdrop {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 990;\n}\n\n.pull-right > .dropdown-menu {\n  right: 0;\n  left: auto;\n}\n\n.dropup .caret,\n.navbar-fixed-bottom .dropdown .caret {\n  border-top: 0 dotted;\n  border-bottom: 4px solid #000000;\n  content: \"\";\n}\n\n.dropup .dropdown-menu,\n.navbar-fixed-bottom .dropdown .dropdown-menu {\n  top: auto;\n  bottom: 100%;\n  margin-bottom: 1px;\n}\n\n@media (min-width: 768px) {\n  .navbar-right .dropdown-menu {\n    right: 0;\n    left: auto;\n  }\n}\n\n.btn-default .caret {\n  border-top-color: #333333;\n}\n\n.btn-primary .caret,\n.btn-success .caret,\n.btn-warning .caret,\n.btn-danger .caret,\n.btn-info .caret {\n  border-top-color: #fff;\n}\n\n.dropup .btn-default .caret {\n  border-bottom-color: #333333;\n}\n\n.dropup .btn-primary .caret,\n.dropup .btn-success .caret,\n.dropup .btn-warning .caret,\n.dropup .btn-danger .caret,\n.dropup .btn-info .caret {\n  border-bottom-color: #fff;\n}\n\n.btn-group,\n.btn-group-vertical {\n  position: relative;\n  display: inline-block;\n  vertical-align: middle;\n}\n\n.btn-group > .btn,\n.btn-group-vertical > .btn {\n  position: relative;\n  float: left;\n}\n\n.btn-group > .btn:hover,\n.btn-group-vertical > .btn:hover,\n.btn-group > .btn:focus,\n.btn-group-vertical > .btn:focus,\n.btn-group > .btn:active,\n.btn-group-vertical > .btn:active,\n.btn-group > .btn.active,\n.btn-group-vertical > .btn.active {\n  z-index: 2;\n}\n\n.btn-group > .btn:focus,\n.btn-group-vertical > .btn:focus {\n  outline: none;\n}\n\n.btn-group .btn + .btn,\n.btn-group .btn + .btn-group,\n.btn-group .btn-group + .btn,\n.btn-group .btn-group + .btn-group {\n  margin-left: -1px;\n}\n\n.btn-toolbar:before,\n.btn-toolbar:after {\n  display: table;\n  content: \" \";\n}\n\n.btn-toolbar:after {\n  clear: both;\n}\n\n.btn-toolbar:before,\n.btn-toolbar:after {\n  display: table;\n  content: \" \";\n}\n\n.btn-toolbar:after {\n  clear: both;\n}\n\n.btn-toolbar .btn-group {\n  float: left;\n}\n\n.btn-toolbar > .btn + .btn,\n.btn-toolbar > .btn-group + .btn,\n.btn-toolbar > .btn + .btn-group,\n.btn-toolbar > .btn-group + .btn-group {\n  margin-left: 5px;\n}\n\n.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {\n  border-radius: 0;\n}\n\n.btn-group > .btn:first-child {\n  margin-left: 0;\n}\n\n.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {\n  border-top-right-radius: 0;\n  border-bottom-right-radius: 0;\n}\n\n.btn-group > .btn:last-child:not(:first-child),\n.btn-group > .dropdown-toggle:not(:first-child) {\n  border-bottom-left-radius: 0;\n  border-top-left-radius: 0;\n}\n\n.btn-group > .btn-group {\n  float: left;\n}\n\n.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n\n.btn-group > .btn-group:first-child > .btn:last-child,\n.btn-group > .btn-group:first-child > .dropdown-toggle {\n  border-top-right-radius: 0;\n  border-bottom-right-radius: 0;\n}\n\n.btn-group > .btn-group:last-child > .btn:first-child {\n  border-bottom-left-radius: 0;\n  border-top-left-radius: 0;\n}\n\n.btn-group .dropdown-toggle:active,\n.btn-group.open .dropdown-toggle {\n  outline: 0;\n}\n\n.btn-group-xs > .btn {\n  padding: 5px 10px;\n  padding: 1px 5px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n\n.btn-group-sm > .btn {\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n\n.btn-group-lg > .btn {\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.33;\n  border-radius: 6px;\n}\n\n.btn-group > .btn + .dropdown-toggle {\n  padding-right: 8px;\n  padding-left: 8px;\n}\n\n.btn-group > .btn-lg + .dropdown-toggle {\n  padding-right: 12px;\n  padding-left: 12px;\n}\n\n.btn-group.open .dropdown-toggle {\n  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n          box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);\n}\n\n.btn-group.open .dropdown-toggle.btn-link {\n  -webkit-box-shadow: none;\n          box-shadow: none;\n}\n\n.btn .caret {\n  margin-left: 0;\n}\n\n.btn-lg .caret {\n  border-width: 5px 5px 0;\n  border-bottom-width: 0;\n}\n\n.dropup .btn-lg .caret {\n  border-width: 0 5px 5px;\n}\n\n.btn-group-vertical > .btn,\n.btn-group-vertical > .btn-group {\n  display: block;\n  float: none;\n  width: 100%;\n  max-width: 100%;\n}\n\n.btn-group-vertical > .btn-group:before,\n.btn-group-vertical > .btn-group:after {\n  display: table;\n  content: \" \";\n}\n\n.btn-group-vertical > .btn-group:after {\n  clear: both;\n}\n\n.btn-group-vertical > .btn-group:before,\n.btn-group-vertical > .btn-group:after {\n  display: table;\n  content: \" \";\n}\n\n.btn-group-vertical > .btn-group:after {\n  clear: both;\n}\n\n.btn-group-vertical > .btn-group > .btn {\n  float: none;\n}\n\n.btn-group-vertical > .btn + .btn,\n.btn-group-vertical > .btn + .btn-group,\n.btn-group-vertical > .btn-group + .btn,\n.btn-group-vertical > .btn-group + .btn-group {\n  margin-top: -1px;\n  margin-left: 0;\n}\n\n.btn-group-vertical > .btn:not(:first-child):not(:last-child) {\n  border-radius: 0;\n}\n\n.btn-group-vertical > .btn:first-child:not(:last-child) {\n  border-top-right-radius: 4px;\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n\n.btn-group-vertical > .btn:last-child:not(:first-child) {\n  border-top-right-radius: 0;\n  border-bottom-left-radius: 4px;\n  border-top-left-radius: 0;\n}\n\n.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n\n.btn-group-vertical > .btn-group:first-child > .btn:last-child,\n.btn-group-vertical > .btn-group:first-child > .dropdown-toggle {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n\n.btn-group-vertical > .btn-group:last-child > .btn:first-child {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n\n.btn-group-justified {\n  display: table;\n  width: 100%;\n  border-collapse: separate;\n  table-layout: fixed;\n}\n\n.btn-group-justified .btn {\n  display: table-cell;\n  float: none;\n  width: 1%;\n}\n\n[data-toggle=\"buttons\"] > .btn > input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn > input[type=\"checkbox\"] {\n  display: none;\n}\n\n.input-group {\n  position: relative;\n  display: table;\n  border-collapse: separate;\n}\n\n.input-group.col {\n  float: none;\n  padding-right: 0;\n  padding-left: 0;\n}\n\n.input-group .form-control {\n  width: 100%;\n  margin-bottom: 0;\n}\n\n.input-group-lg > .form-control,\n.input-group-lg > .input-group-addon,\n.input-group-lg > .input-group-btn > .btn {\n  height: 45px;\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.33;\n  border-radius: 6px;\n}\n\nselect.input-group-lg > .form-control,\nselect.input-group-lg > .input-group-addon,\nselect.input-group-lg > .input-group-btn > .btn {\n  height: 45px;\n  line-height: 45px;\n}\n\ntextarea.input-group-lg > .form-control,\ntextarea.input-group-lg > .input-group-addon,\ntextarea.input-group-lg > .input-group-btn > .btn {\n  height: auto;\n}\n\n.input-group-sm > .form-control,\n.input-group-sm > .input-group-addon,\n.input-group-sm > .input-group-btn > .btn {\n  height: 30px;\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n\nselect.input-group-sm > .form-control,\nselect.input-group-sm > .input-group-addon,\nselect.input-group-sm > .input-group-btn > .btn {\n  height: 30px;\n  line-height: 30px;\n}\n\ntextarea.input-group-sm > .form-control,\ntextarea.input-group-sm > .input-group-addon,\ntextarea.input-group-sm > .input-group-btn > .btn {\n  height: auto;\n}\n\n.input-group-addon,\n.input-group-btn,\n.input-group .form-control {\n  display: table-cell;\n}\n\n.input-group-addon:not(:first-child):not(:last-child),\n.input-group-btn:not(:first-child):not(:last-child),\n.input-group .form-control:not(:first-child):not(:last-child) {\n  border-radius: 0;\n}\n\n.input-group-addon,\n.input-group-btn {\n  width: 1%;\n  white-space: nowrap;\n  vertical-align: middle;\n}\n\n.input-group-addon {\n  padding: 6px 12px;\n  font-size: 14px;\n  font-weight: normal;\n  line-height: 1;\n  color: #555555;\n  text-align: center;\n  background-color: #eeeeee;\n  border: 1px solid #cccccc;\n  border-radius: 4px;\n}\n\n.input-group-addon.input-sm {\n  padding: 5px 10px;\n  font-size: 12px;\n  border-radius: 3px;\n}\n\n.input-group-addon.input-lg {\n  padding: 10px 16px;\n  font-size: 18px;\n  border-radius: 6px;\n}\n\n.input-group-addon input[type=\"radio\"],\n.input-group-addon input[type=\"checkbox\"] {\n  margin-top: 0;\n}\n\n.input-group .form-control:first-child,\n.input-group-addon:first-child,\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .dropdown-toggle,\n.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle) {\n  border-top-right-radius: 0;\n  border-bottom-right-radius: 0;\n}\n\n.input-group-addon:first-child {\n  border-right: 0;\n}\n\n.input-group .form-control:last-child,\n.input-group-addon:last-child,\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .dropdown-toggle,\n.input-group-btn:first-child > .btn:not(:first-child) {\n  border-bottom-left-radius: 0;\n  border-top-left-radius: 0;\n}\n\n.input-group-addon:last-child {\n  border-left: 0;\n}\n\n.input-group-btn {\n  position: relative;\n  white-space: nowrap;\n}\n\n.input-group-btn:first-child > .btn {\n  margin-right: -1px;\n}\n\n.input-group-btn:last-child > .btn {\n  margin-left: -1px;\n}\n\n.input-group-btn > .btn {\n  position: relative;\n}\n\n.input-group-btn > .btn + .btn {\n  margin-left: -4px;\n}\n\n.input-group-btn > .btn:hover,\n.input-group-btn > .btn:active {\n  z-index: 2;\n}\n\n.nav {\n  padding-left: 0;\n  margin-bottom: 0;\n  list-style: none;\n}\n\n.nav:before,\n.nav:after {\n  display: table;\n  content: \" \";\n}\n\n.nav:after {\n  clear: both;\n}\n\n.nav:before,\n.nav:after {\n  display: table;\n  content: \" \";\n}\n\n.nav:after {\n  clear: both;\n}\n\n.nav > li {\n  position: relative;\n  display: block;\n}\n\n.nav > li > a {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n}\n\n.nav > li > a:hover,\n.nav > li > a:focus {\n  text-decoration: none;\n  background-color: #eeeeee;\n}\n\n.nav > li.disabled > a {\n  color: #999999;\n}\n\n.nav > li.disabled > a:hover,\n.nav > li.disabled > a:focus {\n  color: #999999;\n  text-decoration: none;\n  cursor: not-allowed;\n  background-color: transparent;\n}\n\n.nav .open > a,\n.nav .open > a:hover,\n.nav .open > a:focus {\n  background-color: #eeeeee;\n  border-color: #428bca;\n}\n\n.nav .open > a .caret,\n.nav .open > a:hover .caret,\n.nav .open > a:focus .caret {\n  border-top-color: #2a6496;\n  border-bottom-color: #2a6496;\n}\n\n.nav .nav-divider {\n  height: 1px;\n  margin: 9px 0;\n  overflow: hidden;\n  background-color: #e5e5e5;\n}\n\n.nav > li > a > img {\n  max-width: none;\n}\n\n.nav-tabs {\n  border-bottom: 1px solid #dddddd;\n}\n\n.nav-tabs > li {\n  float: left;\n  margin-bottom: -1px;\n}\n\n.nav-tabs > li > a {\n  margin-right: 2px;\n  line-height: 1.428571429;\n  border: 1px solid transparent;\n  border-radius: 4px 4px 0 0;\n}\n\n.nav-tabs > li > a:hover {\n  border-color: #eeeeee #eeeeee #dddddd;\n}\n\n.nav-tabs > li.active > a,\n.nav-tabs > li.active > a:hover,\n.nav-tabs > li.active > a:focus {\n  color: #555555;\n  cursor: default;\n  background-color: #ffffff;\n  border: 1px solid #dddddd;\n  border-bottom-color: transparent;\n}\n\n.nav-tabs.nav-justified {\n  width: 100%;\n  border-bottom: 0;\n}\n\n.nav-tabs.nav-justified > li {\n  float: none;\n}\n\n.nav-tabs.nav-justified > li > a {\n  margin-bottom: 5px;\n  text-align: center;\n}\n\n.nav-tabs.nav-justified > .dropdown .dropdown-menu {\n  top: auto;\n  left: auto;\n}\n\n@media (min-width: 768px) {\n  .nav-tabs.nav-justified > li {\n    display: table-cell;\n    width: 1%;\n  }\n  .nav-tabs.nav-justified > li > a {\n    margin-bottom: 0;\n  }\n}\n\n.nav-tabs.nav-justified > li > a {\n  margin-right: 0;\n  border-radius: 4px;\n}\n\n.nav-tabs.nav-justified > .active > a,\n.nav-tabs.nav-justified > .active > a:hover,\n.nav-tabs.nav-justified > .active > a:focus {\n  border: 1px solid #dddddd;\n}\n\n@media (min-width: 768px) {\n  .nav-tabs.nav-justified > li > a {\n    border-bottom: 1px solid #dddddd;\n    border-radius: 4px 4px 0 0;\n  }\n  .nav-tabs.nav-justified > .active > a,\n  .nav-tabs.nav-justified > .active > a:hover,\n  .nav-tabs.nav-justified > .active > a:focus {\n    border-bottom-color: #ffffff;\n  }\n}\n\n.nav-pills > li {\n  float: left;\n}\n\n.nav-pills > li > a {\n  border-radius: 4px;\n}\n\n.nav-pills > li + li {\n  margin-left: 2px;\n}\n\n.nav-pills > li.active > a,\n.nav-pills > li.active > a:hover,\n.nav-pills > li.active > a:focus {\n  color: #ffffff;\n  background-color: #428bca;\n}\n\n.nav-pills > li.active > a .caret,\n.nav-pills > li.active > a:hover .caret,\n.nav-pills > li.active > a:focus .caret {\n  border-top-color: #ffffff;\n  border-bottom-color: #ffffff;\n}\n\n.nav-stacked > li {\n  float: none;\n}\n\n.nav-stacked > li + li {\n  margin-top: 2px;\n  margin-left: 0;\n}\n\n.nav-justified {\n  width: 100%;\n}\n\n.nav-justified > li {\n  float: none;\n}\n\n.nav-justified > li > a {\n  margin-bottom: 5px;\n  text-align: center;\n}\n\n.nav-justified > .dropdown .dropdown-menu {\n  top: auto;\n  left: auto;\n}\n\n@media (min-width: 768px) {\n  .nav-justified > li {\n    display: table-cell;\n    width: 1%;\n  }\n  .nav-justified > li > a {\n    margin-bottom: 0;\n  }\n}\n\n.nav-tabs-justified {\n  border-bottom: 0;\n}\n\n.nav-tabs-justified > li > a {\n  margin-right: 0;\n  border-radius: 4px;\n}\n\n.nav-tabs-justified > .active > a,\n.nav-tabs-justified > .active > a:hover,\n.nav-tabs-justified > .active > a:focus {\n  border: 1px solid #dddddd;\n}\n\n@media (min-width: 768px) {\n  .nav-tabs-justified > li > a {\n    border-bottom: 1px solid #dddddd;\n    border-radius: 4px 4px 0 0;\n  }\n  .nav-tabs-justified > .active > a,\n  .nav-tabs-justified > .active > a:hover,\n  .nav-tabs-justified > .active > a:focus {\n    border-bottom-color: #ffffff;\n  }\n}\n\n.tab-content > .tab-pane {\n  display: none;\n}\n\n.tab-content > .active {\n  display: block;\n}\n\n.nav .caret {\n  border-top-color: #428bca;\n  border-bottom-color: #428bca;\n}\n\n.nav a:hover .caret {\n  border-top-color: #2a6496;\n  border-bottom-color: #2a6496;\n}\n\n.nav-tabs .dropdown-menu {\n  margin-top: -1px;\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n\n.navbar {\n  position: relative;\n  min-height: 50px;\n  margin-bottom: 20px;\n  border: 1px solid transparent;\n}\n\n.navbar:before,\n.navbar:after {\n  display: table;\n  content: \" \";\n}\n\n.navbar:after {\n  clear: both;\n}\n\n.navbar:before,\n.navbar:after {\n  display: table;\n  content: \" \";\n}\n\n.navbar:after {\n  clear: both;\n}\n\n@media (min-width: 768px) {\n  .navbar {\n    border-radius: 4px;\n  }\n}\n\n.navbar-header:before,\n.navbar-header:after {\n  display: table;\n  content: \" \";\n}\n\n.navbar-header:after {\n  clear: both;\n}\n\n.navbar-header:before,\n.navbar-header:after {\n  display: table;\n  content: \" \";\n}\n\n.navbar-header:after {\n  clear: both;\n}\n\n@media (min-width: 768px) {\n  .navbar-header {\n    float: left;\n  }\n}\n\n.navbar-collapse {\n  max-height: 340px;\n  padding-right: 15px;\n  padding-left: 15px;\n  overflow-x: visible;\n  border-top: 1px solid transparent;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);\n  -webkit-overflow-scrolling: touch;\n}\n\n.navbar-collapse:before,\n.navbar-collapse:after {\n  display: table;\n  content: \" \";\n}\n\n.navbar-collapse:after {\n  clear: both;\n}\n\n.navbar-collapse:before,\n.navbar-collapse:after {\n  display: table;\n  content: \" \";\n}\n\n.navbar-collapse:after {\n  clear: both;\n}\n\n.navbar-collapse.in {\n  overflow-y: auto;\n}\n\n@media (min-width: 768px) {\n  .navbar-collapse {\n    width: auto;\n    border-top: 0;\n    box-shadow: none;\n  }\n  .navbar-collapse.collapse {\n    display: block !important;\n    height: auto !important;\n    padding-bottom: 0;\n    overflow: visible !important;\n  }\n  .navbar-collapse.in {\n    overflow-y: auto;\n  }\n  .navbar-collapse .navbar-nav.navbar-left:first-child {\n    margin-left: -15px;\n  }\n  .navbar-collapse .navbar-nav.navbar-right:last-child {\n    margin-right: -15px;\n  }\n  .navbar-collapse .navbar-text:last-child {\n    margin-right: 0;\n  }\n}\n\n.container > .navbar-header,\n.container > .navbar-collapse {\n  margin-right: -15px;\n  margin-left: -15px;\n}\n\n@media (min-width: 768px) {\n  .container > .navbar-header,\n  .container > .navbar-collapse {\n    margin-right: 0;\n    margin-left: 0;\n  }\n}\n\n.navbar-static-top {\n  z-index: 1000;\n  border-width: 0 0 1px;\n}\n\n@media (min-width: 768px) {\n  .navbar-static-top {\n    border-radius: 0;\n  }\n}\n\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  position: fixed;\n  right: 0;\n  left: 0;\n  z-index: 1030;\n}\n\n@media (min-width: 768px) {\n  .navbar-fixed-top,\n  .navbar-fixed-bottom {\n    border-radius: 0;\n  }\n}\n\n.navbar-fixed-top {\n  top: 0;\n  border-width: 0 0 1px;\n}\n\n.navbar-fixed-bottom {\n  bottom: 0;\n  margin-bottom: 0;\n  border-width: 1px 0 0;\n}\n\n.navbar-brand {\n  float: left;\n  padding: 15px 15px;\n  font-size: 18px;\n  line-height: 20px;\n}\n\n.navbar-brand:hover,\n.navbar-brand:focus {\n  text-decoration: none;\n}\n\n@media (min-width: 768px) {\n  .navbar > .container .navbar-brand {\n    margin-left: -15px;\n  }\n}\n\n.navbar-toggle {\n  position: relative;\n  float: right;\n  padding: 9px 10px;\n  margin-top: 8px;\n  margin-right: 15px;\n  margin-bottom: 8px;\n  background-color: transparent;\n  border: 1px solid transparent;\n  border-radius: 4px;\n}\n\n.navbar-toggle .icon-bar {\n  display: block;\n  width: 22px;\n  height: 2px;\n  border-radius: 1px;\n}\n\n.navbar-toggle .icon-bar + .icon-bar {\n  margin-top: 4px;\n}\n\n@media (min-width: 768px) {\n  .navbar-toggle {\n    display: none;\n  }\n}\n\n.navbar-nav {\n  margin: 7.5px -15px;\n}\n\n.navbar-nav > li > a {\n  padding-top: 10px;\n  padding-bottom: 10px;\n  line-height: 20px;\n}\n\n@media (max-width: 767px) {\n  .navbar-nav .open .dropdown-menu {\n    position: static;\n    float: none;\n    width: auto;\n    margin-top: 0;\n    background-color: transparent;\n    border: 0;\n    box-shadow: none;\n  }\n  .navbar-nav .open .dropdown-menu > li > a,\n  .navbar-nav .open .dropdown-menu .dropdown-header {\n    padding: 5px 15px 5px 25px;\n  }\n  .navbar-nav .open .dropdown-menu > li > a {\n    line-height: 20px;\n  }\n  .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-nav .open .dropdown-menu > li > a:focus {\n    background-image: none;\n  }\n}\n\n@media (min-width: 768px) {\n  .navbar-nav {\n    float: left;\n    margin: 0;\n  }\n  .navbar-nav > li {\n    float: left;\n  }\n  .navbar-nav > li > a {\n    padding-top: 15px;\n    padding-bottom: 15px;\n  }\n}\n\n@media (min-width: 768px) {\n  .navbar-left {\n    float: left !important;\n  }\n  .navbar-right {\n    float: right !important;\n  }\n}\n\n.navbar-form {\n  padding: 10px 15px;\n  margin-top: 8px;\n  margin-right: -15px;\n  margin-bottom: 8px;\n  margin-left: -15px;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid transparent;\n  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);\n          box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);\n}\n\n@media (min-width: 768px) {\n  .navbar-form .form-group {\n    display: inline-block;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .navbar-form .form-control {\n    display: inline-block;\n  }\n  .navbar-form .radio,\n  .navbar-form .checkbox {\n    display: inline-block;\n    padding-left: 0;\n    margin-top: 0;\n    margin-bottom: 0;\n  }\n  .navbar-form .radio input[type=\"radio\"],\n  .navbar-form .checkbox input[type=\"checkbox\"] {\n    float: none;\n    margin-left: 0;\n  }\n}\n\n@media (max-width: 767px) {\n  .navbar-form .form-group {\n    margin-bottom: 5px;\n  }\n}\n\n@media (min-width: 768px) {\n  .navbar-form {\n    width: auto;\n    padding-top: 0;\n    padding-bottom: 0;\n    margin-right: 0;\n    margin-left: 0;\n    border: 0;\n    -webkit-box-shadow: none;\n            box-shadow: none;\n  }\n}\n\n.navbar-nav > li > .dropdown-menu {\n  margin-top: 0;\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n\n.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n\n.navbar-nav.pull-right > li > .dropdown-menu,\n.navbar-nav > li > .dropdown-menu.pull-right {\n  right: 0;\n  left: auto;\n}\n\n.navbar-btn {\n  margin-top: 8px;\n  margin-bottom: 8px;\n}\n\n.navbar-text {\n  float: left;\n  margin-top: 15px;\n  margin-bottom: 15px;\n}\n\n@media (min-width: 768px) {\n  .navbar-text {\n    margin-right: 15px;\n    margin-left: 15px;\n  }\n}\n\n.navbar-default {\n  background-color: #f8f8f8;\n  border-color: #e7e7e7;\n}\n\n.navbar-default .navbar-brand {\n  color: #777777;\n}\n\n.navbar-default .navbar-brand:hover,\n.navbar-default .navbar-brand:focus {\n  color: #5e5e5e;\n  background-color: transparent;\n}\n\n.navbar-default .navbar-text {\n  color: #777777;\n}\n\n.navbar-default .navbar-nav > li > a {\n  color: #777777;\n}\n\n.navbar-default .navbar-nav > li > a:hover,\n.navbar-default .navbar-nav > li > a:focus {\n  color: #333333;\n  background-color: transparent;\n}\n\n.navbar-default .navbar-nav > .active > a,\n.navbar-default .navbar-nav > .active > a:hover,\n.navbar-default .navbar-nav > .active > a:focus {\n  color: #555555;\n  background-color: #e7e7e7;\n}\n\n.navbar-default .navbar-nav > .disabled > a,\n.navbar-default .navbar-nav > .disabled > a:hover,\n.navbar-default .navbar-nav > .disabled > a:focus {\n  color: #cccccc;\n  background-color: transparent;\n}\n\n.navbar-default .navbar-toggle {\n  border-color: #dddddd;\n}\n\n.navbar-default .navbar-toggle:hover,\n.navbar-default .navbar-toggle:focus {\n  background-color: #dddddd;\n}\n\n.navbar-default .navbar-toggle .icon-bar {\n  background-color: #cccccc;\n}\n\n.navbar-default .navbar-collapse,\n.navbar-default .navbar-form {\n  border-color: #e7e7e7;\n}\n\n.navbar-default .navbar-nav > .dropdown > a:hover .caret,\n.navbar-default .navbar-nav > .dropdown > a:focus .caret {\n  border-top-color: #333333;\n  border-bottom-color: #333333;\n}\n\n.navbar-default .navbar-nav > .open > a,\n.navbar-default .navbar-nav > .open > a:hover,\n.navbar-default .navbar-nav > .open > a:focus {\n  color: #555555;\n  background-color: #e7e7e7;\n}\n\n.navbar-default .navbar-nav > .open > a .caret,\n.navbar-default .navbar-nav > .open > a:hover .caret,\n.navbar-default .navbar-nav > .open > a:focus .caret {\n  border-top-color: #555555;\n  border-bottom-color: #555555;\n}\n\n.navbar-default .navbar-nav > .dropdown > a .caret {\n  border-top-color: #777777;\n  border-bottom-color: #777777;\n}\n\n@media (max-width: 767px) {\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a {\n    color: #777777;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {\n    color: #333333;\n    background-color: transparent;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a,\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {\n    color: #555555;\n    background-color: #e7e7e7;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n    color: #cccccc;\n    background-color: transparent;\n  }\n}\n\n.navbar-default .navbar-link {\n  color: #777777;\n}\n\n.navbar-default .navbar-link:hover {\n  color: #333333;\n}\n\n.navbar-inverse {\n  background-color: #222222;\n  border-color: #080808;\n}\n\n.navbar-inverse .navbar-brand {\n  color: #999999;\n}\n\n.navbar-inverse .navbar-brand:hover,\n.navbar-inverse .navbar-brand:focus {\n  color: #ffffff;\n  background-color: transparent;\n}\n\n.navbar-inverse .navbar-text {\n  color: #999999;\n}\n\n.navbar-inverse .navbar-nav > li > a {\n  color: #999999;\n}\n\n.navbar-inverse .navbar-nav > li > a:hover,\n.navbar-inverse .navbar-nav > li > a:focus {\n  color: #ffffff;\n  background-color: transparent;\n}\n\n.navbar-inverse .navbar-nav > .active > a,\n.navbar-inverse .navbar-nav > .active > a:hover,\n.navbar-inverse .navbar-nav > .active > a:focus {\n  color: #ffffff;\n  background-color: #080808;\n}\n\n.navbar-inverse .navbar-nav > .disabled > a,\n.navbar-inverse .navbar-nav > .disabled > a:hover,\n.navbar-inverse .navbar-nav > .disabled > a:focus {\n  color: #444444;\n  background-color: transparent;\n}\n\n.navbar-inverse .navbar-toggle {\n  border-color: #333333;\n}\n\n.navbar-inverse .navbar-toggle:hover,\n.navbar-inverse .navbar-toggle:focus {\n  background-color: #333333;\n}\n\n.navbar-inverse .navbar-toggle .icon-bar {\n  background-color: #ffffff;\n}\n\n.navbar-inverse .navbar-collapse,\n.navbar-inverse .navbar-form {\n  border-color: #101010;\n}\n\n.navbar-inverse .navbar-nav > .open > a,\n.navbar-inverse .navbar-nav > .open > a:hover,\n.navbar-inverse .navbar-nav > .open > a:focus {\n  color: #ffffff;\n  background-color: #080808;\n}\n\n.navbar-inverse .navbar-nav > .dropdown > a:hover .caret {\n  border-top-color: #ffffff;\n  border-bottom-color: #ffffff;\n}\n\n.navbar-inverse .navbar-nav > .dropdown > a .caret {\n  border-top-color: #999999;\n  border-bottom-color: #999999;\n}\n\n.navbar-inverse .navbar-nav > .open > a .caret,\n.navbar-inverse .navbar-nav > .open > a:hover .caret,\n.navbar-inverse .navbar-nav > .open > a:focus .caret {\n  border-top-color: #ffffff;\n  border-bottom-color: #ffffff;\n}\n\n@media (max-width: 767px) {\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {\n    border-color: #080808;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a {\n    color: #999999;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {\n    color: #ffffff;\n    background-color: transparent;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {\n    color: #ffffff;\n    background-color: #080808;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n    color: #444444;\n    background-color: transparent;\n  }\n}\n\n.navbar-inverse .navbar-link {\n  color: #999999;\n}\n\n.navbar-inverse .navbar-link:hover {\n  color: #ffffff;\n}\n\n.breadcrumb {\n  padding: 8px 15px;\n  margin-bottom: 20px;\n  list-style: none;\n  background-color: #f5f5f5;\n  border-radius: 4px;\n}\n\n.breadcrumb > li {\n  display: inline-block;\n}\n\n.breadcrumb > li + li:before {\n  padding: 0 5px;\n  color: #cccccc;\n  content: \"/\\00a0\";\n}\n\n.breadcrumb > .active {\n  color: #999999;\n}\n\n.pagination {\n  display: inline-block;\n  padding-left: 0;\n  margin: 20px 0;\n  border-radius: 4px;\n}\n\n.pagination > li {\n  display: inline;\n}\n\n.pagination > li > a,\n.pagination > li > span {\n  position: relative;\n  float: left;\n  padding: 6px 12px;\n  margin-left: -1px;\n  line-height: 1.428571429;\n  text-decoration: none;\n  background-color: #ffffff;\n  border: 1px solid #dddddd;\n}\n\n.pagination > li:first-child > a,\n.pagination > li:first-child > span {\n  margin-left: 0;\n  border-bottom-left-radius: 4px;\n  border-top-left-radius: 4px;\n}\n\n.pagination > li:last-child > a,\n.pagination > li:last-child > span {\n  border-top-right-radius: 4px;\n  border-bottom-right-radius: 4px;\n}\n\n.pagination > li > a:hover,\n.pagination > li > span:hover,\n.pagination > li > a:focus,\n.pagination > li > span:focus {\n  background-color: #eeeeee;\n}\n\n.pagination > .active > a,\n.pagination > .active > span,\n.pagination > .active > a:hover,\n.pagination > .active > span:hover,\n.pagination > .active > a:focus,\n.pagination > .active > span:focus {\n  z-index: 2;\n  color: #ffffff;\n  cursor: default;\n  background-color: #428bca;\n  border-color: #428bca;\n}\n\n.pagination > .disabled > span,\n.pagination > .disabled > span:hover,\n.pagination > .disabled > span:focus,\n.pagination > .disabled > a,\n.pagination > .disabled > a:hover,\n.pagination > .disabled > a:focus {\n  color: #999999;\n  cursor: not-allowed;\n  background-color: #ffffff;\n  border-color: #dddddd;\n}\n\n.pagination-lg > li > a,\n.pagination-lg > li > span {\n  padding: 10px 16px;\n  font-size: 18px;\n}\n\n.pagination-lg > li:first-child > a,\n.pagination-lg > li:first-child > span {\n  border-bottom-left-radius: 6px;\n  border-top-left-radius: 6px;\n}\n\n.pagination-lg > li:last-child > a,\n.pagination-lg > li:last-child > span {\n  border-top-right-radius: 6px;\n  border-bottom-right-radius: 6px;\n}\n\n.pagination-sm > li > a,\n.pagination-sm > li > span {\n  padding: 5px 10px;\n  font-size: 12px;\n}\n\n.pagination-sm > li:first-child > a,\n.pagination-sm > li:first-child > span {\n  border-bottom-left-radius: 3px;\n  border-top-left-radius: 3px;\n}\n\n.pagination-sm > li:last-child > a,\n.pagination-sm > li:last-child > span {\n  border-top-right-radius: 3px;\n  border-bottom-right-radius: 3px;\n}\n\n.pager {\n  padding-left: 0;\n  margin: 20px 0;\n  text-align: center;\n  list-style: none;\n}\n\n.pager:before,\n.pager:after {\n  display: table;\n  content: \" \";\n}\n\n.pager:after {\n  clear: both;\n}\n\n.pager:before,\n.pager:after {\n  display: table;\n  content: \" \";\n}\n\n.pager:after {\n  clear: both;\n}\n\n.pager li {\n  display: inline;\n}\n\n.pager li > a,\n.pager li > span {\n  display: inline-block;\n  padding: 5px 14px;\n  background-color: #ffffff;\n  border: 1px solid #dddddd;\n  border-radius: 15px;\n}\n\n.pager li > a:hover,\n.pager li > a:focus {\n  text-decoration: none;\n  background-color: #eeeeee;\n}\n\n.pager .next > a,\n.pager .next > span {\n  float: right;\n}\n\n.pager .previous > a,\n.pager .previous > span {\n  float: left;\n}\n\n.pager .disabled > a,\n.pager .disabled > a:hover,\n.pager .disabled > a:focus,\n.pager .disabled > span {\n  color: #999999;\n  cursor: not-allowed;\n  background-color: #ffffff;\n}\n\n.label {\n  display: inline;\n  padding: .2em .6em .3em;\n  font-size: 75%;\n  font-weight: bold;\n  line-height: 1;\n  color: #ffffff;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: baseline;\n  border-radius: .25em;\n}\n\n.label[href]:hover,\n.label[href]:focus {\n  color: #ffffff;\n  text-decoration: none;\n  cursor: pointer;\n}\n\n.label:empty {\n  display: none;\n}\n\n.label-default {\n  background-color: #999999;\n}\n\n.label-default[href]:hover,\n.label-default[href]:focus {\n  background-color: #808080;\n}\n\n.label-primary {\n  background-color: #428bca;\n}\n\n.label-primary[href]:hover,\n.label-primary[href]:focus {\n  background-color: #3071a9;\n}\n\n.label-success {\n  background-color: #5cb85c;\n}\n\n.label-success[href]:hover,\n.label-success[href]:focus {\n  background-color: #449d44;\n}\n\n.label-info {\n  background-color: #5bc0de;\n}\n\n.label-info[href]:hover,\n.label-info[href]:focus {\n  background-color: #31b0d5;\n}\n\n.label-warning {\n  background-color: #f0ad4e;\n}\n\n.label-warning[href]:hover,\n.label-warning[href]:focus {\n  background-color: #ec971f;\n}\n\n.label-danger {\n  background-color: #d9534f;\n}\n\n.label-danger[href]:hover,\n.label-danger[href]:focus {\n  background-color: #c9302c;\n}\n\n.badge {\n  display: inline-block;\n  min-width: 10px;\n  padding: 3px 7px;\n  font-size: 12px;\n  font-weight: bold;\n  line-height: 1;\n  color: #ffffff;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: baseline;\n  background-color: #999999;\n  border-radius: 10px;\n}\n\n.badge:empty {\n  display: none;\n}\n\na.badge:hover,\na.badge:focus {\n  color: #ffffff;\n  text-decoration: none;\n  cursor: pointer;\n}\n\n.btn .badge {\n  position: relative;\n  top: -1px;\n}\n\na.list-group-item.active > .badge,\n.nav-pills > .active > a > .badge {\n  color: #428bca;\n  background-color: #ffffff;\n}\n\n.nav-pills > li > a > .badge {\n  margin-left: 3px;\n}\n\n.jumbotron {\n  padding: 30px;\n  margin-bottom: 30px;\n  font-size: 21px;\n  font-weight: 200;\n  line-height: 2.1428571435;\n  color: inherit;\n  background-color: #eeeeee;\n}\n\n.jumbotron h1 {\n  line-height: 1;\n  color: inherit;\n}\n\n.jumbotron p {\n  line-height: 1.4;\n}\n\n.container .jumbotron {\n  border-radius: 6px;\n}\n\n@media screen and (min-width: 768px) {\n  .jumbotron {\n    padding-top: 48px;\n    padding-bottom: 48px;\n  }\n  .container .jumbotron {\n    padding-right: 60px;\n    padding-left: 60px;\n  }\n  .jumbotron h1 {\n    font-size: 63px;\n  }\n}\n\n.thumbnail {\n  display: inline-block;\n  display: block;\n  height: auto;\n  max-width: 100%;\n  padding: 4px;\n  margin-bottom: 20px;\n  line-height: 1.428571429;\n  background-color: #ffffff;\n  border: 1px solid #dddddd;\n  border-radius: 4px;\n  -webkit-transition: all 0.2s ease-in-out;\n          transition: all 0.2s ease-in-out;\n}\n\n.thumbnail > img {\n  display: block;\n  height: auto;\n  max-width: 100%;\n  margin-right: auto;\n  margin-left: auto;\n}\n\na.thumbnail:hover,\na.thumbnail:focus,\na.thumbnail.active {\n  border-color: #428bca;\n}\n\n.thumbnail .caption {\n  padding: 9px;\n  color: #333333;\n}\n\n.alert {\n  padding: 15px;\n  margin-bottom: 20px;\n  border: 1px solid transparent;\n  border-radius: 4px;\n}\n\n.alert h4 {\n  margin-top: 0;\n  color: inherit;\n}\n\n.alert .alert-link {\n  font-weight: bold;\n}\n\n.alert > p,\n.alert > ul {\n  margin-bottom: 0;\n}\n\n.alert > p + p {\n  margin-top: 5px;\n}\n\n.alert-dismissable {\n  padding-right: 35px;\n}\n\n.alert-dismissable .close {\n  position: relative;\n  top: -2px;\n  right: -21px;\n  color: inherit;\n}\n\n.alert-success {\n  color: #468847;\n  background-color: #dff0d8;\n  border-color: #d6e9c6;\n}\n\n.alert-success hr {\n  border-top-color: #c9e2b3;\n}\n\n.alert-success .alert-link {\n  color: #356635;\n}\n\n.alert-info {\n  color: #3a87ad;\n  background-color: #d9edf7;\n  border-color: #bce8f1;\n}\n\n.alert-info hr {\n  border-top-color: #a6e1ec;\n}\n\n.alert-info .alert-link {\n  color: #2d6987;\n}\n\n.alert-warning {\n  color: #c09853;\n  background-color: #fcf8e3;\n  border-color: #faebcc;\n}\n\n.alert-warning hr {\n  border-top-color: #f7e1b5;\n}\n\n.alert-warning .alert-link {\n  color: #a47e3c;\n}\n\n.alert-danger {\n  color: #b94a48;\n  background-color: #f2dede;\n  border-color: #ebccd1;\n}\n\n.alert-danger hr {\n  border-top-color: #e4b9c0;\n}\n\n.alert-danger .alert-link {\n  color: #953b39;\n}\n\n@-webkit-keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n\n@-moz-keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n\n@-o-keyframes progress-bar-stripes {\n  from {\n    background-position: 0 0;\n  }\n  to {\n    background-position: 40px 0;\n  }\n}\n\n@keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n\n.progress {\n  height: 20px;\n  margin-bottom: 20px;\n  overflow: hidden;\n  background-color: #f5f5f5;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);\n          box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);\n}\n\n.progress-bar {\n  float: left;\n  width: 0;\n  height: 100%;\n  font-size: 12px;\n  line-height: 20px;\n  color: #ffffff;\n  text-align: center;\n  background-color: #428bca;\n  -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);\n          box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);\n  -webkit-transition: width 0.6s ease;\n          transition: width 0.6s ease;\n}\n\n.progress-striped .progress-bar {\n  background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-size: 40px 40px;\n}\n\n.progress.active .progress-bar {\n  -webkit-animation: progress-bar-stripes 2s linear infinite;\n          animation: progress-bar-stripes 2s linear infinite;\n}\n\n.progress-bar-success {\n  background-color: #5cb85c;\n}\n\n.progress-striped .progress-bar-success {\n  background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n\n.progress-bar-info {\n  background-color: #5bc0de;\n}\n\n.progress-striped .progress-bar-info {\n  background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n\n.progress-bar-warning {\n  background-color: #f0ad4e;\n}\n\n.progress-striped .progress-bar-warning {\n  background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n\n.progress-bar-danger {\n  background-color: #d9534f;\n}\n\n.progress-striped .progress-bar-danger {\n  background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: -moz-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n  background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);\n}\n\n.media,\n.media-body {\n  overflow: hidden;\n  zoom: 1;\n}\n\n.media,\n.media .media {\n  margin-top: 15px;\n}\n\n.media:first-child {\n  margin-top: 0;\n}\n\n.media-object {\n  display: block;\n}\n\n.media-heading {\n  margin: 0 0 5px;\n}\n\n.media > .pull-left {\n  margin-right: 10px;\n}\n\n.media > .pull-right {\n  margin-left: 10px;\n}\n\n.media-list {\n  padding-left: 0;\n  list-style: none;\n}\n\n.list-group {\n  padding-left: 0;\n  margin-bottom: 20px;\n}\n\n.list-group-item {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n  margin-bottom: -1px;\n  background-color: #ffffff;\n  border: 1px solid #dddddd;\n}\n\n.list-group-item:first-child {\n  border-top-right-radius: 4px;\n  border-top-left-radius: 4px;\n}\n\n.list-group-item:last-child {\n  margin-bottom: 0;\n  border-bottom-right-radius: 4px;\n  border-bottom-left-radius: 4px;\n}\n\n.list-group-item > .badge {\n  float: right;\n}\n\n.list-group-item > .badge + .badge {\n  margin-right: 5px;\n}\n\na.list-group-item {\n  color: #555555;\n}\n\na.list-group-item .list-group-item-heading {\n  color: #333333;\n}\n\na.list-group-item:hover,\na.list-group-item:focus {\n  text-decoration: none;\n  background-color: #f5f5f5;\n}\n\na.list-group-item.active,\na.list-group-item.active:hover,\na.list-group-item.active:focus {\n  z-index: 2;\n  color: #ffffff;\n  background-color: #428bca;\n  border-color: #428bca;\n}\n\na.list-group-item.active .list-group-item-heading,\na.list-group-item.active:hover .list-group-item-heading,\na.list-group-item.active:focus .list-group-item-heading {\n  color: inherit;\n}\n\na.list-group-item.active .list-group-item-text,\na.list-group-item.active:hover .list-group-item-text,\na.list-group-item.active:focus .list-group-item-text {\n  color: #e1edf7;\n}\n\n.list-group-item-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n\n.list-group-item-text {\n  margin-bottom: 0;\n  line-height: 1.3;\n}\n\n.panel {\n  margin-bottom: 20px;\n  background-color: #ffffff;\n  border: 1px solid transparent;\n  border-radius: 4px;\n  -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);\n          box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);\n}\n\n.panel-body {\n  padding: 15px;\n}\n\n.panel-body:before,\n.panel-body:after {\n  display: table;\n  content: \" \";\n}\n\n.panel-body:after {\n  clear: both;\n}\n\n.panel-body:before,\n.panel-body:after {\n  display: table;\n  content: \" \";\n}\n\n.panel-body:after {\n  clear: both;\n}\n\n.panel > .list-group {\n  margin-bottom: 0;\n}\n\n.panel > .list-group .list-group-item {\n  border-width: 1px 0;\n}\n\n.panel > .list-group .list-group-item:first-child {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n\n.panel > .list-group .list-group-item:last-child {\n  border-bottom: 0;\n}\n\n.panel-heading + .list-group .list-group-item:first-child {\n  border-top-width: 0;\n}\n\n.panel > .table,\n.panel > .table-responsive {\n  margin-bottom: 0;\n}\n\n.panel > .panel-body + .table,\n.panel > .panel-body + .table-responsive {\n  border-top: 1px solid #dddddd;\n}\n\n.panel > .table-bordered,\n.panel > .table-responsive > .table-bordered {\n  border: 0;\n}\n\n.panel > .table-bordered > thead > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,\n.panel > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-bordered > thead > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,\n.panel > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-bordered > tfoot > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n  border-left: 0;\n}\n\n.panel > .table-bordered > thead > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,\n.panel > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-bordered > thead > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,\n.panel > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-bordered > tfoot > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n  border-right: 0;\n}\n\n.panel > .table-bordered > thead > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > thead > tr:last-child > th,\n.panel > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-bordered > tfoot > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th,\n.panel > .table-bordered > thead > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > thead > tr:last-child > td,\n.panel > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-bordered > tfoot > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td {\n  border-bottom: 0;\n}\n\n.panel-heading {\n  padding: 10px 15px;\n  border-bottom: 1px solid transparent;\n  border-top-right-radius: 3px;\n  border-top-left-radius: 3px;\n}\n\n.panel-heading > .dropdown .dropdown-toggle {\n  color: inherit;\n}\n\n.panel-title {\n  margin-top: 0;\n  margin-bottom: 0;\n  font-size: 16px;\n}\n\n.panel-title > a {\n  color: inherit;\n}\n\n.panel-footer {\n  padding: 10px 15px;\n  background-color: #f5f5f5;\n  border-top: 1px solid #dddddd;\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n\n.panel-group .panel {\n  margin-bottom: 0;\n  overflow: hidden;\n  border-radius: 4px;\n}\n\n.panel-group .panel + .panel {\n  margin-top: 5px;\n}\n\n.panel-group .panel-heading {\n  border-bottom: 0;\n}\n\n.panel-group .panel-heading + .panel-collapse .panel-body {\n  border-top: 1px solid #dddddd;\n}\n\n.panel-group .panel-footer {\n  border-top: 0;\n}\n\n.panel-group .panel-footer + .panel-collapse .panel-body {\n  border-bottom: 1px solid #dddddd;\n}\n\n.panel-default {\n  border-color: #dddddd;\n}\n\n.panel-default > .panel-heading {\n  color: #333333;\n  background-color: #f5f5f5;\n  border-color: #dddddd;\n}\n\n.panel-default > .panel-heading + .panel-collapse .panel-body {\n  border-top-color: #dddddd;\n}\n\n.panel-default > .panel-heading > .dropdown .caret {\n  border-color: #333333 transparent;\n}\n\n.panel-default > .panel-footer + .panel-collapse .panel-body {\n  border-bottom-color: #dddddd;\n}\n\n.panel-primary {\n  border-color: #428bca;\n}\n\n.panel-primary > .panel-heading {\n  color: #ffffff;\n  background-color: #428bca;\n  border-color: #428bca;\n}\n\n.panel-primary > .panel-heading + .panel-collapse .panel-body {\n  border-top-color: #428bca;\n}\n\n.panel-primary > .panel-heading > .dropdown .caret {\n  border-color: #ffffff transparent;\n}\n\n.panel-primary > .panel-footer + .panel-collapse .panel-body {\n  border-bottom-color: #428bca;\n}\n\n.panel-success {\n  border-color: #d6e9c6;\n}\n\n.panel-success > .panel-heading {\n  color: #468847;\n  background-color: #dff0d8;\n  border-color: #d6e9c6;\n}\n\n.panel-success > .panel-heading + .panel-collapse .panel-body {\n  border-top-color: #d6e9c6;\n}\n\n.panel-success > .panel-heading > .dropdown .caret {\n  border-color: #468847 transparent;\n}\n\n.panel-success > .panel-footer + .panel-collapse .panel-body {\n  border-bottom-color: #d6e9c6;\n}\n\n.panel-warning {\n  border-color: #faebcc;\n}\n\n.panel-warning > .panel-heading {\n  color: #c09853;\n  background-color: #fcf8e3;\n  border-color: #faebcc;\n}\n\n.panel-warning > .panel-heading + .panel-collapse .panel-body {\n  border-top-color: #faebcc;\n}\n\n.panel-warning > .panel-heading > .dropdown .caret {\n  border-color: #c09853 transparent;\n}\n\n.panel-warning > .panel-footer + .panel-collapse .panel-body {\n  border-bottom-color: #faebcc;\n}\n\n.panel-danger {\n  border-color: #ebccd1;\n}\n\n.panel-danger > .panel-heading {\n  color: #b94a48;\n  background-color: #f2dede;\n  border-color: #ebccd1;\n}\n\n.panel-danger > .panel-heading + .panel-collapse .panel-body {\n  border-top-color: #ebccd1;\n}\n\n.panel-danger > .panel-heading > .dropdown .caret {\n  border-color: #b94a48 transparent;\n}\n\n.panel-danger > .panel-footer + .panel-collapse .panel-body {\n  border-bottom-color: #ebccd1;\n}\n\n.panel-info {\n  border-color: #bce8f1;\n}\n\n.panel-info > .panel-heading {\n  color: #3a87ad;\n  background-color: #d9edf7;\n  border-color: #bce8f1;\n}\n\n.panel-info > .panel-heading + .panel-collapse .panel-body {\n  border-top-color: #bce8f1;\n}\n\n.panel-info > .panel-heading > .dropdown .caret {\n  border-color: #3a87ad transparent;\n}\n\n.panel-info > .panel-footer + .panel-collapse .panel-body {\n  border-bottom-color: #bce8f1;\n}\n\n.well {\n  min-height: 20px;\n  padding: 19px;\n  margin-bottom: 20px;\n  background-color: #f5f5f5;\n  border: 1px solid #e3e3e3;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);\n}\n\n.well blockquote {\n  border-color: #ddd;\n  border-color: rgba(0, 0, 0, 0.15);\n}\n\n.well-lg {\n  padding: 24px;\n  border-radius: 6px;\n}\n\n.well-sm {\n  padding: 9px;\n  border-radius: 3px;\n}\n\n.close {\n  float: right;\n  font-size: 21px;\n  font-weight: bold;\n  line-height: 1;\n  color: #000000;\n  text-shadow: 0 1px 0 #ffffff;\n  opacity: 0.2;\n  filter: alpha(opacity=20);\n}\n\n.close:hover,\n.close:focus {\n  color: #000000;\n  text-decoration: none;\n  cursor: pointer;\n  opacity: 0.5;\n  filter: alpha(opacity=50);\n}\n\nbutton.close {\n  padding: 0;\n  cursor: pointer;\n  background: transparent;\n  border: 0;\n  -webkit-appearance: none;\n}\n\n.modal-open {\n  overflow: hidden;\n}\n\n.modal {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1040;\n  display: none;\n  overflow: auto;\n  overflow-y: scroll;\n}\n\n.modal.fade .modal-dialog {\n  -webkit-transform: translate(0, -25%);\n      -ms-transform: translate(0, -25%);\n          transform: translate(0, -25%);\n  -webkit-transition: -webkit-transform 0.3s ease-out;\n     -moz-transition: -moz-transform 0.3s ease-out;\n       -o-transition: -o-transform 0.3s ease-out;\n          transition: transform 0.3s ease-out;\n}\n\n.modal.in .modal-dialog {\n  -webkit-transform: translate(0, 0);\n      -ms-transform: translate(0, 0);\n          transform: translate(0, 0);\n}\n\n.modal-dialog {\n  position: relative;\n  z-index: 1050;\n  width: auto;\n  padding: 10px;\n  margin-right: auto;\n  margin-left: auto;\n}\n\n.modal-content {\n  position: relative;\n  background-color: #ffffff;\n  border: 1px solid #999999;\n  border: 1px solid rgba(0, 0, 0, 0.2);\n  border-radius: 6px;\n  outline: none;\n  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);\n          box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);\n  background-clip: padding-box;\n}\n\n.modal-backdrop {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1030;\n  background-color: #000000;\n}\n\n.modal-backdrop.fade {\n  opacity: 0;\n  filter: alpha(opacity=0);\n}\n\n.modal-backdrop.in {\n  opacity: 0.5;\n  filter: alpha(opacity=50);\n}\n\n.modal-header {\n  min-height: 16.428571429px;\n  padding: 15px;\n  border-bottom: 1px solid #e5e5e5;\n}\n\n.modal-header .close {\n  margin-top: -2px;\n}\n\n.modal-title {\n  margin: 0;\n  line-height: 1.428571429;\n}\n\n.modal-body {\n  position: relative;\n  padding: 20px;\n}\n\n.modal-footer {\n  padding: 19px 20px 20px;\n  margin-top: 15px;\n  text-align: right;\n  border-top: 1px solid #e5e5e5;\n}\n\n.modal-footer:before,\n.modal-footer:after {\n  display: table;\n  content: \" \";\n}\n\n.modal-footer:after {\n  clear: both;\n}\n\n.modal-footer:before,\n.modal-footer:after {\n  display: table;\n  content: \" \";\n}\n\n.modal-footer:after {\n  clear: both;\n}\n\n.modal-footer .btn + .btn {\n  margin-bottom: 0;\n  margin-left: 5px;\n}\n\n.modal-footer .btn-group .btn + .btn {\n  margin-left: -1px;\n}\n\n.modal-footer .btn-block + .btn-block {\n  margin-left: 0;\n}\n\n@media screen and (min-width: 768px) {\n  .modal-dialog {\n    width: 600px;\n    padding-top: 30px;\n    padding-bottom: 30px;\n  }\n  .modal-content {\n    -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);\n            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);\n  }\n}\n\n.tooltip {\n  position: absolute;\n  z-index: 1030;\n  display: block;\n  font-size: 12px;\n  line-height: 1.4;\n  opacity: 0;\n  filter: alpha(opacity=0);\n  visibility: visible;\n}\n\n.tooltip.in {\n  opacity: 0.9;\n  filter: alpha(opacity=90);\n}\n\n.tooltip.top {\n  padding: 5px 0;\n  margin-top: -3px;\n}\n\n.tooltip.right {\n  padding: 0 5px;\n  margin-left: 3px;\n}\n\n.tooltip.bottom {\n  padding: 5px 0;\n  margin-top: 3px;\n}\n\n.tooltip.left {\n  padding: 0 5px;\n  margin-left: -3px;\n}\n\n.tooltip-inner {\n  max-width: 200px;\n  padding: 3px 8px;\n  color: #ffffff;\n  text-align: center;\n  text-decoration: none;\n  background-color: #000000;\n  border-radius: 4px;\n}\n\n.tooltip-arrow {\n  position: absolute;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n\n.tooltip.top .tooltip-arrow {\n  bottom: 0;\n  left: 50%;\n  margin-left: -5px;\n  border-top-color: #000000;\n  border-width: 5px 5px 0;\n}\n\n.tooltip.top-left .tooltip-arrow {\n  bottom: 0;\n  left: 5px;\n  border-top-color: #000000;\n  border-width: 5px 5px 0;\n}\n\n.tooltip.top-right .tooltip-arrow {\n  right: 5px;\n  bottom: 0;\n  border-top-color: #000000;\n  border-width: 5px 5px 0;\n}\n\n.tooltip.right .tooltip-arrow {\n  top: 50%;\n  left: 0;\n  margin-top: -5px;\n  border-right-color: #000000;\n  border-width: 5px 5px 5px 0;\n}\n\n.tooltip.left .tooltip-arrow {\n  top: 50%;\n  right: 0;\n  margin-top: -5px;\n  border-left-color: #000000;\n  border-width: 5px 0 5px 5px;\n}\n\n.tooltip.bottom .tooltip-arrow {\n  top: 0;\n  left: 50%;\n  margin-left: -5px;\n  border-bottom-color: #000000;\n  border-width: 0 5px 5px;\n}\n\n.tooltip.bottom-left .tooltip-arrow {\n  top: 0;\n  left: 5px;\n  border-bottom-color: #000000;\n  border-width: 0 5px 5px;\n}\n\n.tooltip.bottom-right .tooltip-arrow {\n  top: 0;\n  right: 5px;\n  border-bottom-color: #000000;\n  border-width: 0 5px 5px;\n}\n\n.popover {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 1010;\n  display: none;\n  max-width: 276px;\n  padding: 1px;\n  text-align: left;\n  white-space: normal;\n  background-color: #ffffff;\n  border: 1px solid #cccccc;\n  border: 1px solid rgba(0, 0, 0, 0.2);\n  border-radius: 6px;\n  -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\n          box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\n  background-clip: padding-box;\n}\n\n.popover.top {\n  margin-top: -10px;\n}\n\n.popover.right {\n  margin-left: 10px;\n}\n\n.popover.bottom {\n  margin-top: 10px;\n}\n\n.popover.left {\n  margin-left: -10px;\n}\n\n.popover-title {\n  padding: 8px 14px;\n  margin: 0;\n  font-size: 14px;\n  font-weight: normal;\n  line-height: 18px;\n  background-color: #f7f7f7;\n  border-bottom: 1px solid #ebebeb;\n  border-radius: 5px 5px 0 0;\n}\n\n.popover-content {\n  padding: 9px 14px;\n}\n\n.popover .arrow,\n.popover .arrow:after {\n  position: absolute;\n  display: block;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n\n.popover .arrow {\n  border-width: 11px;\n}\n\n.popover .arrow:after {\n  border-width: 10px;\n  content: \"\";\n}\n\n.popover.top .arrow {\n  bottom: -11px;\n  left: 50%;\n  margin-left: -11px;\n  border-top-color: #999999;\n  border-top-color: rgba(0, 0, 0, 0.25);\n  border-bottom-width: 0;\n}\n\n.popover.top .arrow:after {\n  bottom: 1px;\n  margin-left: -10px;\n  border-top-color: #ffffff;\n  border-bottom-width: 0;\n  content: \" \";\n}\n\n.popover.right .arrow {\n  top: 50%;\n  left: -11px;\n  margin-top: -11px;\n  border-right-color: #999999;\n  border-right-color: rgba(0, 0, 0, 0.25);\n  border-left-width: 0;\n}\n\n.popover.right .arrow:after {\n  bottom: -10px;\n  left: 1px;\n  border-right-color: #ffffff;\n  border-left-width: 0;\n  content: \" \";\n}\n\n.popover.bottom .arrow {\n  top: -11px;\n  left: 50%;\n  margin-left: -11px;\n  border-bottom-color: #999999;\n  border-bottom-color: rgba(0, 0, 0, 0.25);\n  border-top-width: 0;\n}\n\n.popover.bottom .arrow:after {\n  top: 1px;\n  margin-left: -10px;\n  border-bottom-color: #ffffff;\n  border-top-width: 0;\n  content: \" \";\n}\n\n.popover.left .arrow {\n  top: 50%;\n  right: -11px;\n  margin-top: -11px;\n  border-left-color: #999999;\n  border-left-color: rgba(0, 0, 0, 0.25);\n  border-right-width: 0;\n}\n\n.popover.left .arrow:after {\n  right: 1px;\n  bottom: -10px;\n  border-left-color: #ffffff;\n  border-right-width: 0;\n  content: \" \";\n}\n\n.carousel {\n  position: relative;\n}\n\n.carousel-inner {\n  position: relative;\n  width: 100%;\n  overflow: hidden;\n}\n\n.carousel-inner > .item {\n  position: relative;\n  display: none;\n  -webkit-transition: 0.6s ease-in-out left;\n          transition: 0.6s ease-in-out left;\n}\n\n.carousel-inner > .item > img,\n.carousel-inner > .item > a > img {\n  display: block;\n  height: auto;\n  max-width: 100%;\n  line-height: 1;\n}\n\n.carousel-inner > .active,\n.carousel-inner > .next,\n.carousel-inner > .prev {\n  display: block;\n}\n\n.carousel-inner > .active {\n  left: 0;\n}\n\n.carousel-inner > .next,\n.carousel-inner > .prev {\n  position: absolute;\n  top: 0;\n  width: 100%;\n}\n\n.carousel-inner > .next {\n  left: 100%;\n}\n\n.carousel-inner > .prev {\n  left: -100%;\n}\n\n.carousel-inner > .next.left,\n.carousel-inner > .prev.right {\n  left: 0;\n}\n\n.carousel-inner > .active.left {\n  left: -100%;\n}\n\n.carousel-inner > .active.right {\n  left: 100%;\n}\n\n.carousel-control {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: 0;\n  width: 15%;\n  font-size: 20px;\n  color: #ffffff;\n  text-align: center;\n  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);\n  opacity: 0.5;\n  filter: alpha(opacity=50);\n}\n\n.carousel-control.left {\n  background-image: -webkit-gradient(linear, 0 top, 100% top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0.0001)));\n  background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.5) 0), color-stop(rgba(0, 0, 0, 0.0001) 100%));\n  background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0.0001) 100%);\n  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0, rgba(0, 0, 0, 0.0001) 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);\n}\n\n.carousel-control.right {\n  right: 0;\n  left: auto;\n  background-image: -webkit-gradient(linear, 0 top, 100% top, from(rgba(0, 0, 0, 0.0001)), to(rgba(0, 0, 0, 0.5)));\n  background-image: -webkit-linear-gradient(left, color-stop(rgba(0, 0, 0, 0.0001) 0), color-stop(rgba(0, 0, 0, 0.5) 100%));\n  background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0, rgba(0, 0, 0, 0.5) 100%);\n  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0, rgba(0, 0, 0, 0.5) 100%);\n  background-repeat: repeat-x;\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);\n}\n\n.carousel-control:hover,\n.carousel-control:focus {\n  color: #ffffff;\n  text-decoration: none;\n  opacity: 0.9;\n  filter: alpha(opacity=90);\n}\n\n.carousel-control .icon-prev,\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-left,\n.carousel-control .glyphicon-chevron-right {\n  position: absolute;\n  top: 50%;\n  z-index: 5;\n  display: inline-block;\n}\n\n.carousel-control .icon-prev,\n.carousel-control .glyphicon-chevron-left {\n  left: 50%;\n}\n\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-right {\n  right: 50%;\n}\n\n.carousel-control .icon-prev,\n.carousel-control .icon-next {\n  width: 20px;\n  height: 20px;\n  margin-top: -10px;\n  margin-left: -10px;\n  font-family: serif;\n}\n\n.carousel-control .icon-prev:before {\n  content: '\\2039';\n}\n\n.carousel-control .icon-next:before {\n  content: '\\203a';\n}\n\n.carousel-indicators {\n  position: absolute;\n  bottom: 10px;\n  left: 50%;\n  z-index: 15;\n  width: 60%;\n  padding-left: 0;\n  margin-left: -30%;\n  text-align: center;\n  list-style: none;\n}\n\n.carousel-indicators li {\n  display: inline-block;\n  width: 10px;\n  height: 10px;\n  margin: 1px;\n  text-indent: -999px;\n  cursor: pointer;\n  background-color: #000 \\9;\n  background-color: rgba(0, 0, 0, 0);\n  border: 1px solid #ffffff;\n  border-radius: 10px;\n}\n\n.carousel-indicators .active {\n  width: 12px;\n  height: 12px;\n  margin: 0;\n  background-color: #ffffff;\n}\n\n.carousel-caption {\n  position: absolute;\n  right: 15%;\n  bottom: 20px;\n  left: 15%;\n  z-index: 10;\n  padding-top: 20px;\n  padding-bottom: 20px;\n  color: #ffffff;\n  text-align: center;\n  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);\n}\n\n.carousel-caption .btn {\n  text-shadow: none;\n}\n\n@media screen and (min-width: 768px) {\n  .carousel-control .glyphicons-chevron-left,\n  .carousel-control .glyphicons-chevron-right,\n  .carousel-control .icon-prev,\n  .carousel-control .icon-next {\n    width: 30px;\n    height: 30px;\n    margin-top: -15px;\n    margin-left: -15px;\n    font-size: 30px;\n  }\n  .carousel-caption {\n    right: 20%;\n    left: 20%;\n    padding-bottom: 30px;\n  }\n  .carousel-indicators {\n    bottom: 20px;\n  }\n}\n\n.clearfix:before,\n.clearfix:after {\n  display: table;\n  content: \" \";\n}\n\n.clearfix:after {\n  clear: both;\n}\n\n.center-block {\n  display: block;\n  margin-right: auto;\n  margin-left: auto;\n}\n\n.pull-right {\n  float: right !important;\n}\n\n.pull-left {\n  float: left !important;\n}\n\n.hide {\n  display: none !important;\n}\n\n.show {\n  display: block !important;\n}\n\n.invisible {\n  visibility: hidden;\n}\n\n.text-hide {\n  font: 0/0 a;\n  color: transparent;\n  text-shadow: none;\n  background-color: transparent;\n  border: 0;\n}\n\n.hidden {\n  display: none !important;\n  visibility: hidden !important;\n}\n\n.affix {\n  position: fixed;\n}\n\n@-ms-viewport {\n  width: device-width;\n}\n\n.visible-xs,\ntr.visible-xs,\nth.visible-xs,\ntd.visible-xs {\n  display: none !important;\n}\n\n@media (max-width: 767px) {\n  .visible-xs {\n    display: block !important;\n  }\n  tr.visible-xs {\n    display: table-row !important;\n  }\n  th.visible-xs,\n  td.visible-xs {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-xs.visible-sm {\n    display: block !important;\n  }\n  tr.visible-xs.visible-sm {\n    display: table-row !important;\n  }\n  th.visible-xs.visible-sm,\n  td.visible-xs.visible-sm {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-xs.visible-md {\n    display: block !important;\n  }\n  tr.visible-xs.visible-md {\n    display: table-row !important;\n  }\n  th.visible-xs.visible-md,\n  td.visible-xs.visible-md {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .visible-xs.visible-lg {\n    display: block !important;\n  }\n  tr.visible-xs.visible-lg {\n    display: table-row !important;\n  }\n  th.visible-xs.visible-lg,\n  td.visible-xs.visible-lg {\n    display: table-cell !important;\n  }\n}\n\n.visible-sm,\ntr.visible-sm,\nth.visible-sm,\ntd.visible-sm {\n  display: none !important;\n}\n\n@media (max-width: 767px) {\n  .visible-sm.visible-xs {\n    display: block !important;\n  }\n  tr.visible-sm.visible-xs {\n    display: table-row !important;\n  }\n  th.visible-sm.visible-xs,\n  td.visible-sm.visible-xs {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm {\n    display: block !important;\n  }\n  tr.visible-sm {\n    display: table-row !important;\n  }\n  th.visible-sm,\n  td.visible-sm {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-sm.visible-md {\n    display: block !important;\n  }\n  tr.visible-sm.visible-md {\n    display: table-row !important;\n  }\n  th.visible-sm.visible-md,\n  td.visible-sm.visible-md {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .visible-sm.visible-lg {\n    display: block !important;\n  }\n  tr.visible-sm.visible-lg {\n    display: table-row !important;\n  }\n  th.visible-sm.visible-lg,\n  td.visible-sm.visible-lg {\n    display: table-cell !important;\n  }\n}\n\n.visible-md,\ntr.visible-md,\nth.visible-md,\ntd.visible-md {\n  display: none !important;\n}\n\n@media (max-width: 767px) {\n  .visible-md.visible-xs {\n    display: block !important;\n  }\n  tr.visible-md.visible-xs {\n    display: table-row !important;\n  }\n  th.visible-md.visible-xs,\n  td.visible-md.visible-xs {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-md.visible-sm {\n    display: block !important;\n  }\n  tr.visible-md.visible-sm {\n    display: table-row !important;\n  }\n  th.visible-md.visible-sm,\n  td.visible-md.visible-sm {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md {\n    display: block !important;\n  }\n  tr.visible-md {\n    display: table-row !important;\n  }\n  th.visible-md,\n  td.visible-md {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .visible-md.visible-lg {\n    display: block !important;\n  }\n  tr.visible-md.visible-lg {\n    display: table-row !important;\n  }\n  th.visible-md.visible-lg,\n  td.visible-md.visible-lg {\n    display: table-cell !important;\n  }\n}\n\n.visible-lg,\ntr.visible-lg,\nth.visible-lg,\ntd.visible-lg {\n  display: none !important;\n}\n\n@media (max-width: 767px) {\n  .visible-lg.visible-xs {\n    display: block !important;\n  }\n  tr.visible-lg.visible-xs {\n    display: table-row !important;\n  }\n  th.visible-lg.visible-xs,\n  td.visible-lg.visible-xs {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-lg.visible-sm {\n    display: block !important;\n  }\n  tr.visible-lg.visible-sm {\n    display: table-row !important;\n  }\n  th.visible-lg.visible-sm,\n  td.visible-lg.visible-sm {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-lg.visible-md {\n    display: block !important;\n  }\n  tr.visible-lg.visible-md {\n    display: table-row !important;\n  }\n  th.visible-lg.visible-md,\n  td.visible-lg.visible-md {\n    display: table-cell !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .visible-lg {\n    display: block !important;\n  }\n  tr.visible-lg {\n    display: table-row !important;\n  }\n  th.visible-lg,\n  td.visible-lg {\n    display: table-cell !important;\n  }\n}\n\n.hidden-xs {\n  display: block !important;\n}\n\ntr.hidden-xs {\n  display: table-row !important;\n}\n\nth.hidden-xs,\ntd.hidden-xs {\n  display: table-cell !important;\n}\n\n@media (max-width: 767px) {\n  .hidden-xs,\n  tr.hidden-xs,\n  th.hidden-xs,\n  td.hidden-xs {\n    display: none !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .hidden-xs.hidden-sm,\n  tr.hidden-xs.hidden-sm,\n  th.hidden-xs.hidden-sm,\n  td.hidden-xs.hidden-sm {\n    display: none !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .hidden-xs.hidden-md,\n  tr.hidden-xs.hidden-md,\n  th.hidden-xs.hidden-md,\n  td.hidden-xs.hidden-md {\n    display: none !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .hidden-xs.hidden-lg,\n  tr.hidden-xs.hidden-lg,\n  th.hidden-xs.hidden-lg,\n  td.hidden-xs.hidden-lg {\n    display: none !important;\n  }\n}\n\n.hidden-sm {\n  display: block !important;\n}\n\ntr.hidden-sm {\n  display: table-row !important;\n}\n\nth.hidden-sm,\ntd.hidden-sm {\n  display: table-cell !important;\n}\n\n@media (max-width: 767px) {\n  .hidden-sm.hidden-xs,\n  tr.hidden-sm.hidden-xs,\n  th.hidden-sm.hidden-xs,\n  td.hidden-sm.hidden-xs {\n    display: none !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .hidden-sm,\n  tr.hidden-sm,\n  th.hidden-sm,\n  td.hidden-sm {\n    display: none !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .hidden-sm.hidden-md,\n  tr.hidden-sm.hidden-md,\n  th.hidden-sm.hidden-md,\n  td.hidden-sm.hidden-md {\n    display: none !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .hidden-sm.hidden-lg,\n  tr.hidden-sm.hidden-lg,\n  th.hidden-sm.hidden-lg,\n  td.hidden-sm.hidden-lg {\n    display: none !important;\n  }\n}\n\n.hidden-md {\n  display: block !important;\n}\n\ntr.hidden-md {\n  display: table-row !important;\n}\n\nth.hidden-md,\ntd.hidden-md {\n  display: table-cell !important;\n}\n\n@media (max-width: 767px) {\n  .hidden-md.hidden-xs,\n  tr.hidden-md.hidden-xs,\n  th.hidden-md.hidden-xs,\n  td.hidden-md.hidden-xs {\n    display: none !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .hidden-md.hidden-sm,\n  tr.hidden-md.hidden-sm,\n  th.hidden-md.hidden-sm,\n  td.hidden-md.hidden-sm {\n    display: none !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .hidden-md,\n  tr.hidden-md,\n  th.hidden-md,\n  td.hidden-md {\n    display: none !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .hidden-md.hidden-lg,\n  tr.hidden-md.hidden-lg,\n  th.hidden-md.hidden-lg,\n  td.hidden-md.hidden-lg {\n    display: none !important;\n  }\n}\n\n.hidden-lg {\n  display: block !important;\n}\n\ntr.hidden-lg {\n  display: table-row !important;\n}\n\nth.hidden-lg,\ntd.hidden-lg {\n  display: table-cell !important;\n}\n\n@media (max-width: 767px) {\n  .hidden-lg.hidden-xs,\n  tr.hidden-lg.hidden-xs,\n  th.hidden-lg.hidden-xs,\n  td.hidden-lg.hidden-xs {\n    display: none !important;\n  }\n}\n\n@media (min-width: 768px) and (max-width: 991px) {\n  .hidden-lg.hidden-sm,\n  tr.hidden-lg.hidden-sm,\n  th.hidden-lg.hidden-sm,\n  td.hidden-lg.hidden-sm {\n    display: none !important;\n  }\n}\n\n@media (min-width: 992px) and (max-width: 1199px) {\n  .hidden-lg.hidden-md,\n  tr.hidden-lg.hidden-md,\n  th.hidden-lg.hidden-md,\n  td.hidden-lg.hidden-md {\n    display: none !important;\n  }\n}\n\n@media (min-width: 1200px) {\n  .hidden-lg,\n  tr.hidden-lg,\n  th.hidden-lg,\n  td.hidden-lg {\n    display: none !important;\n  }\n}\n\n.visible-print,\ntr.visible-print,\nth.visible-print,\ntd.visible-print {\n  display: none !important;\n}\n\n@media print {\n  .visible-print {\n    display: block !important;\n  }\n  tr.visible-print {\n    display: table-row !important;\n  }\n  th.visible-print,\n  td.visible-print {\n    display: table-cell !important;\n  }\n  .hidden-print,\n  tr.hidden-print,\n  th.hidden-print,\n  td.hidden-print {\n    display: none !important;\n  }\n}"
  },
  {
    "path": "11-textblob/sentiment-analyzer/static/js/jquery.js",
    "content": "/*!\n * jQuery JavaScript Library v2.0.3\n * http://jquery.com/\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n *\n * Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2013-07-03T13:30Z\n */\n(function( window, undefined ) {\n\n// Can't do this because several apps including ASP.NET trace\n// the stack via arguments.caller.callee and Firefox dies if\n// you try to trace through \"use strict\" call chains. (#13335)\n// Support: Firefox 18+\n//\"use strict\";\nvar\n\t// A central reference to the root jQuery(document)\n\trootjQuery,\n\n\t// The deferred used on DOM ready\n\treadyList,\n\n\t// Support: IE9\n\t// For `typeof xmlNode.method` instead of `xmlNode.method !== undefined`\n\tcore_strundefined = typeof undefined,\n\n\t// Use the correct document accordingly with window argument (sandbox)\n\tlocation = window.location,\n\tdocument = window.document,\n\tdocElem = document.documentElement,\n\n\t// Map over jQuery in case of overwrite\n\t_jQuery = window.jQuery,\n\n\t// Map over the $ in case of overwrite\n\t_$ = window.$,\n\n\t// [[Class]] -> type pairs\n\tclass2type = {},\n\n\t// List of deleted data cache ids, so we can reuse them\n\tcore_deletedIds = [],\n\n\tcore_version = \"2.0.3\",\n\n\t// Save a reference to some core methods\n\tcore_concat = core_deletedIds.concat,\n\tcore_push = core_deletedIds.push,\n\tcore_slice = core_deletedIds.slice,\n\tcore_indexOf = core_deletedIds.indexOf,\n\tcore_toString = class2type.toString,\n\tcore_hasOwn = class2type.hasOwnProperty,\n\tcore_trim = core_version.trim,\n\n\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {\n\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\treturn new jQuery.fn.init( selector, context, rootjQuery );\n\t},\n\n\t// Used for matching numbers\n\tcore_pnum = /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,\n\n\t// Used for splitting on whitespace\n\tcore_rnotwhite = /\\S+/g,\n\n\t// A simple way to check for HTML strings\n\t// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\n\t// Strict HTML recognition (#11290: must start with <)\n\trquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]*))$/,\n\n\t// Match a standalone tag\n\trsingleTag = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,\n\n\t// Matches dashed string for camelizing\n\trmsPrefix = /^-ms-/,\n\trdashAlpha = /-([\\da-z])/gi,\n\n\t// Used by jQuery.camelCase as callback to replace()\n\tfcamelCase = function( all, letter ) {\n\t\treturn letter.toUpperCase();\n\t},\n\n\t// The ready event handler and self cleanup method\n\tcompleted = function() {\n\t\tdocument.removeEventListener( \"DOMContentLoaded\", completed, false );\n\t\twindow.removeEventListener( \"load\", completed, false );\n\t\tjQuery.ready();\n\t};\n\njQuery.fn = jQuery.prototype = {\n\t// The current version of jQuery being used\n\tjquery: core_version,\n\n\tconstructor: jQuery,\n\tinit: function( selector, context, rootjQuery ) {\n\t\tvar match, elem;\n\n\t\t// HANDLE: $(\"\"), $(null), $(undefined), $(false)\n\t\tif ( !selector ) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Handle HTML strings\n\t\tif ( typeof selector === \"string\" ) {\n\t\t\tif ( selector.charAt(0) === \"<\" && selector.charAt( selector.length - 1 ) === \">\" && selector.length >= 3 ) {\n\t\t\t\t// Assume that strings that start and end with <> are HTML and skip the regex check\n\t\t\t\tmatch = [ null, selector, null ];\n\n\t\t\t} else {\n\t\t\t\tmatch = rquickExpr.exec( selector );\n\t\t\t}\n\n\t\t\t// Match html or make sure no context is specified for #id\n\t\t\tif ( match && (match[1] || !context) ) {\n\n\t\t\t\t// HANDLE: $(html) -> $(array)\n\t\t\t\tif ( match[1] ) {\n\t\t\t\t\tcontext = context instanceof jQuery ? context[0] : context;\n\n\t\t\t\t\t// scripts is true for back-compat\n\t\t\t\t\tjQuery.merge( this, jQuery.parseHTML(\n\t\t\t\t\t\tmatch[1],\n\t\t\t\t\t\tcontext && context.nodeType ? context.ownerDocument || context : document,\n\t\t\t\t\t\ttrue\n\t\t\t\t\t) );\n\n\t\t\t\t\t// HANDLE: $(html, props)\n\t\t\t\t\tif ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {\n\t\t\t\t\t\tfor ( match in context ) {\n\t\t\t\t\t\t\t// Properties of context are called as methods if possible\n\t\t\t\t\t\t\tif ( jQuery.isFunction( this[ match ] ) ) {\n\t\t\t\t\t\t\t\tthis[ match ]( context[ match ] );\n\n\t\t\t\t\t\t\t// ...and otherwise set as attributes\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.attr( match, context[ match ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\n\t\t\t\t// HANDLE: $(#id)\n\t\t\t\t} else {\n\t\t\t\t\telem = document.getElementById( match[2] );\n\n\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\tif ( elem && elem.parentNode ) {\n\t\t\t\t\t\t// Inject the element directly into the jQuery object\n\t\t\t\t\t\tthis.length = 1;\n\t\t\t\t\t\tthis[0] = elem;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.context = document;\n\t\t\t\t\tthis.selector = selector;\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t// HANDLE: $(expr, $(...))\n\t\t\t} else if ( !context || context.jquery ) {\n\t\t\t\treturn ( context || rootjQuery ).find( selector );\n\n\t\t\t// HANDLE: $(expr, context)\n\t\t\t// (which is just equivalent to: $(context).find(expr)\n\t\t\t} else {\n\t\t\t\treturn this.constructor( context ).find( selector );\n\t\t\t}\n\n\t\t// HANDLE: $(DOMElement)\n\t\t} else if ( selector.nodeType ) {\n\t\t\tthis.context = this[0] = selector;\n\t\t\tthis.length = 1;\n\t\t\treturn this;\n\n\t\t// HANDLE: $(function)\n\t\t// Shortcut for document ready\n\t\t} else if ( jQuery.isFunction( selector ) ) {\n\t\t\treturn rootjQuery.ready( selector );\n\t\t}\n\n\t\tif ( selector.selector !== undefined ) {\n\t\t\tthis.selector = selector.selector;\n\t\t\tthis.context = selector.context;\n\t\t}\n\n\t\treturn jQuery.makeArray( selector, this );\n\t},\n\n\t// Start with an empty selector\n\tselector: \"\",\n\n\t// The default length of a jQuery object is 0\n\tlength: 0,\n\n\ttoArray: function() {\n\t\treturn core_slice.call( this );\n\t},\n\n\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {\n\t\treturn num == null ?\n\n\t\t\t// Return a 'clean' array\n\t\t\tthis.toArray() :\n\n\t\t\t// Return just the object\n\t\t\t( num < 0 ? this[ this.length + num ] : this[ num ] );\n\t},\n\n\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems ) {\n\n\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );\n\n\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;\n\t\tret.context = this.context;\n\n\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},\n\n\t// Execute a callback for every element in the matched set.\n\t// (You can seed the arguments with an array of args, but this is\n\t// only used internally.)\n\teach: function( callback, args ) {\n\t\treturn jQuery.each( this, callback, args );\n\t},\n\n\tready: function( fn ) {\n\t\t// Add the callback\n\t\tjQuery.ready.promise().done( fn );\n\n\t\treturn this;\n\t},\n\n\tslice: function() {\n\t\treturn this.pushStack( core_slice.apply( this, arguments ) );\n\t},\n\n\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},\n\n\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},\n\n\teq: function( i ) {\n\t\tvar len = this.length,\n\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\treturn this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );\n\t},\n\n\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map(this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t}));\n\t},\n\n\tend: function() {\n\t\treturn this.prevObject || this.constructor(null);\n\t},\n\n\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: core_push,\n\tsort: [].sort,\n\tsplice: [].splice\n};\n\n// Give the init function the jQuery prototype for later instantiation\njQuery.fn.init.prototype = jQuery.fn;\n\njQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[0] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !jQuery.isFunction(target) ) {\n\t\ttarget = {};\n\t}\n\n\t// extend jQuery itself if only one argument is passed\n\tif ( length === i ) {\n\t\ttarget = this;\n\t\t--i;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\t\t// Only deal with non-null/undefined values\n\t\tif ( (options = arguments[ i ]) != null ) {\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && jQuery.isArray(src) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject(src) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\njQuery.extend({\n\t// Unique for each copy of jQuery on the page\n\texpando: \"jQuery\" + ( core_version + Math.random() ).replace( /\\D/g, \"\" ),\n\n\tnoConflict: function( deep ) {\n\t\tif ( window.$ === jQuery ) {\n\t\t\twindow.$ = _$;\n\t\t}\n\n\t\tif ( deep && window.jQuery === jQuery ) {\n\t\t\twindow.jQuery = _jQuery;\n\t\t}\n\n\t\treturn jQuery;\n\t},\n\n\t// Is the DOM ready to be used? Set to true once it occurs.\n\tisReady: false,\n\n\t// A counter to track how many items to wait for before\n\t// the ready event fires. See #6781\n\treadyWait: 1,\n\n\t// Hold (or release) the ready event\n\tholdReady: function( hold ) {\n\t\tif ( hold ) {\n\t\t\tjQuery.readyWait++;\n\t\t} else {\n\t\t\tjQuery.ready( true );\n\t\t}\n\t},\n\n\t// Handle when the DOM is ready\n\tready: function( wait ) {\n\n\t\t// Abort if there are pending holds or we're already ready\n\t\tif ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remember that the DOM is ready\n\t\tjQuery.isReady = true;\n\n\t\t// If a normal DOM Ready event fired, decrement, and wait if need be\n\t\tif ( wait !== true && --jQuery.readyWait > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there are functions bound, to execute\n\t\treadyList.resolveWith( document, [ jQuery ] );\n\n\t\t// Trigger any bound ready events\n\t\tif ( jQuery.fn.trigger ) {\n\t\t\tjQuery( document ).trigger(\"ready\").off(\"ready\");\n\t\t}\n\t},\n\n\t// See test/unit/core.js for details concerning isFunction.\n\t// Since version 1.3, DOM methods and functions like alert\n\t// aren't supported. They return false on IE (#2968).\n\tisFunction: function( obj ) {\n\t\treturn jQuery.type(obj) === \"function\";\n\t},\n\n\tisArray: Array.isArray,\n\n\tisWindow: function( obj ) {\n\t\treturn obj != null && obj === obj.window;\n\t},\n\n\tisNumeric: function( obj ) {\n\t\treturn !isNaN( parseFloat(obj) ) && isFinite( obj );\n\t},\n\n\ttype: function( obj ) {\n\t\tif ( obj == null ) {\n\t\t\treturn String( obj );\n\t\t}\n\t\t// Support: Safari <= 5.1 (functionish RegExp)\n\t\treturn typeof obj === \"object\" || typeof obj === \"function\" ?\n\t\t\tclass2type[ core_toString.call(obj) ] || \"object\" :\n\t\t\ttypeof obj;\n\t},\n\n\tisPlainObject: function( obj ) {\n\t\t// Not plain objects:\n\t\t// - Any object or value whose internal [[Class]] property is not \"[object Object]\"\n\t\t// - DOM nodes\n\t\t// - window\n\t\tif ( jQuery.type( obj ) !== \"object\" || obj.nodeType || jQuery.isWindow( obj ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Support: Firefox <20\n\t\t// The try/catch suppresses exceptions thrown when attempting to access\n\t\t// the \"constructor\" property of certain host objects, ie. |window.location|\n\t\t// https://bugzilla.mozilla.org/show_bug.cgi?id=814622\n\t\ttry {\n\t\t\tif ( obj.constructor &&\n\t\t\t\t\t!core_hasOwn.call( obj.constructor.prototype, \"isPrototypeOf\" ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch ( e ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// If the function hasn't returned already, we're confident that\n\t\t// |obj| is a plain object, created by {} or constructed with new Object\n\t\treturn true;\n\t},\n\n\tisEmptyObject: function( obj ) {\n\t\tvar name;\n\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\n\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},\n\n\t// data: string of html\n\t// context (optional): If specified, the fragment will be created in this context, defaults to document\n\t// keepScripts (optional): If true, will include scripts passed in the html string\n\tparseHTML: function( data, context, keepScripts ) {\n\t\tif ( !data || typeof data !== \"string\" ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( typeof context === \"boolean\" ) {\n\t\t\tkeepScripts = context;\n\t\t\tcontext = false;\n\t\t}\n\t\tcontext = context || document;\n\n\t\tvar parsed = rsingleTag.exec( data ),\n\t\t\tscripts = !keepScripts && [];\n\n\t\t// Single tag\n\t\tif ( parsed ) {\n\t\t\treturn [ context.createElement( parsed[1] ) ];\n\t\t}\n\n\t\tparsed = jQuery.buildFragment( [ data ], context, scripts );\n\n\t\tif ( scripts ) {\n\t\t\tjQuery( scripts ).remove();\n\t\t}\n\n\t\treturn jQuery.merge( [], parsed.childNodes );\n\t},\n\n\tparseJSON: JSON.parse,\n\n\t// Cross-browser xml parsing\n\tparseXML: function( data ) {\n\t\tvar xml, tmp;\n\t\tif ( !data || typeof data !== \"string\" ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Support: IE9\n\t\ttry {\n\t\t\ttmp = new DOMParser();\n\t\t\txml = tmp.parseFromString( data , \"text/xml\" );\n\t\t} catch ( e ) {\n\t\t\txml = undefined;\n\t\t}\n\n\t\tif ( !xml || xml.getElementsByTagName( \"parsererror\" ).length ) {\n\t\t\tjQuery.error( \"Invalid XML: \" + data );\n\t\t}\n\t\treturn xml;\n\t},\n\n\tnoop: function() {},\n\n\t// Evaluates a script in a global context\n\tglobalEval: function( code ) {\n\t\tvar script,\n\t\t\t\tindirect = eval;\n\n\t\tcode = jQuery.trim( code );\n\n\t\tif ( code ) {\n\t\t\t// If the code includes a valid, prologue position\n\t\t\t// strict mode pragma, execute code by injecting a\n\t\t\t// script tag into the document.\n\t\t\tif ( code.indexOf(\"use strict\") === 1 ) {\n\t\t\t\tscript = document.createElement(\"script\");\n\t\t\t\tscript.text = code;\n\t\t\t\tdocument.head.appendChild( script ).parentNode.removeChild( script );\n\t\t\t} else {\n\t\t\t// Otherwise, avoid the DOM node creation, insertion\n\t\t\t// and removal by using an indirect global eval\n\t\t\t\tindirect( code );\n\t\t\t}\n\t\t}\n\t},\n\n\t// Convert dashed to camelCase; used by the css and data modules\n\t// Microsoft forgot to hump their vendor prefix (#9572)\n\tcamelCase: function( string ) {\n\t\treturn string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n\t},\n\n\tnodeName: function( elem, name ) {\n\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n\t},\n\n\t// args is for internal usage only\n\teach: function( obj, callback, args ) {\n\t\tvar value,\n\t\t\ti = 0,\n\t\t\tlength = obj.length,\n\t\t\tisArray = isArraylike( obj );\n\n\t\tif ( args ) {\n\t\t\tif ( isArray ) {\n\t\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\t\tvalue = callback.apply( obj[ i ], args );\n\n\t\t\t\t\tif ( value === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( i in obj ) {\n\t\t\t\t\tvalue = callback.apply( obj[ i ], args );\n\n\t\t\t\t\tif ( value === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// A special, fast, case for the most common use of each\n\t\t} else {\n\t\t\tif ( isArray ) {\n\t\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\t\tvalue = callback.call( obj[ i ], i, obj[ i ] );\n\n\t\t\t\t\tif ( value === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( i in obj ) {\n\t\t\t\t\tvalue = callback.call( obj[ i ], i, obj[ i ] );\n\n\t\t\t\t\tif ( value === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn obj;\n\t},\n\n\ttrim: function( text ) {\n\t\treturn text == null ? \"\" : core_trim.call( text );\n\t},\n\n\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar ret = results || [];\n\n\t\tif ( arr != null ) {\n\t\t\tif ( isArraylike( Object(arr) ) ) {\n\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\ttypeof arr === \"string\" ?\n\t\t\t\t\t[ arr ] : arr\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tcore_push.call( ret, arr );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tinArray: function( elem, arr, i ) {\n\t\treturn arr == null ? -1 : core_indexOf.call( arr, elem, i );\n\t},\n\n\tmerge: function( first, second ) {\n\t\tvar l = second.length,\n\t\t\ti = first.length,\n\t\t\tj = 0;\n\n\t\tif ( typeof l === \"number\" ) {\n\t\t\tfor ( ; j < l; j++ ) {\n\t\t\t\tfirst[ i++ ] = second[ j ];\n\t\t\t}\n\t\t} else {\n\t\t\twhile ( second[j] !== undefined ) {\n\t\t\t\tfirst[ i++ ] = second[ j++ ];\n\t\t\t}\n\t\t}\n\n\t\tfirst.length = i;\n\n\t\treturn first;\n\t},\n\n\tgrep: function( elems, callback, inv ) {\n\t\tvar retVal,\n\t\t\tret = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length;\n\t\tinv = !!inv;\n\n\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tretVal = !!callback( elems[ i ], i );\n\t\t\tif ( inv !== retVal ) {\n\t\t\t\tret.push( elems[ i ] );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar value,\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\tisArray = isArraylike( elems ),\n\t\t\tret = [];\n\n\t\t// Go through the array, translating each of the items to their\n\t\tif ( isArray ) {\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret[ ret.length ] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( i in elems ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret[ ret.length ] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Flatten any nested arrays\n\t\treturn core_concat.apply( [], ret );\n\t},\n\n\t// A global GUID counter for objects\n\tguid: 1,\n\n\t// Bind a function to a context, optionally partially applying any\n\t// arguments.\n\tproxy: function( fn, context ) {\n\t\tvar tmp, args, proxy;\n\n\t\tif ( typeof context === \"string\" ) {\n\t\t\ttmp = fn[ context ];\n\t\t\tcontext = fn;\n\t\t\tfn = tmp;\n\t\t}\n\n\t\t// Quick check to determine if target is callable, in the spec\n\t\t// this throws a TypeError, but we will just return undefined.\n\t\tif ( !jQuery.isFunction( fn ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Simulated bind\n\t\targs = core_slice.call( arguments, 2 );\n\t\tproxy = function() {\n\t\t\treturn fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );\n\t\t};\n\n\t\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\t\tproxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\n\t\treturn proxy;\n\t},\n\n\t// Multifunctional method to get and set values of a collection\n\t// The value/s can optionally be executed if it's a function\n\taccess: function( elems, fn, key, value, chainable, emptyGet, raw ) {\n\t\tvar i = 0,\n\t\t\tlength = elems.length,\n\t\t\tbulk = key == null;\n\n\t\t// Sets many values\n\t\tif ( jQuery.type( key ) === \"object\" ) {\n\t\t\tchainable = true;\n\t\t\tfor ( i in key ) {\n\t\t\t\tjQuery.access( elems, fn, i, key[i], true, emptyGet, raw );\n\t\t\t}\n\n\t\t// Sets one value\n\t\t} else if ( value !== undefined ) {\n\t\t\tchainable = true;\n\n\t\t\tif ( !jQuery.isFunction( value ) ) {\n\t\t\t\traw = true;\n\t\t\t}\n\n\t\t\tif ( bulk ) {\n\t\t\t\t// Bulk operations run against the entire set\n\t\t\t\tif ( raw ) {\n\t\t\t\t\tfn.call( elems, value );\n\t\t\t\t\tfn = null;\n\n\t\t\t\t// ...except when executing function values\n\t\t\t\t} else {\n\t\t\t\t\tbulk = fn;\n\t\t\t\t\tfn = function( elem, key, value ) {\n\t\t\t\t\t\treturn bulk.call( jQuery( elem ), value );\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( fn ) {\n\t\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\t\tfn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn chainable ?\n\t\t\telems :\n\n\t\t\t// Gets\n\t\t\tbulk ?\n\t\t\t\tfn.call( elems ) :\n\t\t\t\tlength ? fn( elems[0], key ) : emptyGet;\n\t},\n\n\tnow: Date.now,\n\n\t// A method for quickly swapping in/out CSS properties to get correct calculations.\n\t// Note: this method belongs to the css module but it's needed here for the support module.\n\t// If support gets modularized, this method should be moved back to the css module.\n\tswap: function( elem, options, callback, args ) {\n\t\tvar ret, name,\n\t\t\told = {};\n\n\t\t// Remember the old values, and insert the new ones\n\t\tfor ( name in options ) {\n\t\t\told[ name ] = elem.style[ name ];\n\t\t\telem.style[ name ] = options[ name ];\n\t\t}\n\n\t\tret = callback.apply( elem, args || [] );\n\n\t\t// Revert the old values\n\t\tfor ( name in options ) {\n\t\t\telem.style[ name ] = old[ name ];\n\t\t}\n\n\t\treturn ret;\n\t}\n});\n\njQuery.ready.promise = function( obj ) {\n\tif ( !readyList ) {\n\n\t\treadyList = jQuery.Deferred();\n\n\t\t// Catch cases where $(document).ready() is called after the browser event has already occurred.\n\t\t// we once tried to use readyState \"interactive\" here, but it caused issues like the one\n\t\t// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15\n\t\tif ( document.readyState === \"complete\" ) {\n\t\t\t// Handle it asynchronously to allow scripts the opportunity to delay ready\n\t\t\tsetTimeout( jQuery.ready );\n\n\t\t} else {\n\n\t\t\t// Use the handy event callback\n\t\t\tdocument.addEventListener( \"DOMContentLoaded\", completed, false );\n\n\t\t\t// A fallback to window.onload, that will always work\n\t\t\twindow.addEventListener( \"load\", completed, false );\n\t\t}\n\t}\n\treturn readyList.promise( obj );\n};\n\n// Populate the class2type map\njQuery.each(\"Boolean Number String Function Array Date RegExp Object Error\".split(\" \"), function(i, name) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\nfunction isArraylike( obj ) {\n\tvar length = obj.length,\n\t\ttype = jQuery.type( obj );\n\n\tif ( jQuery.isWindow( obj ) ) {\n\t\treturn false;\n\t}\n\n\tif ( obj.nodeType === 1 && length ) {\n\t\treturn true;\n\t}\n\n\treturn type === \"array\" || type !== \"function\" &&\n\t\t( length === 0 ||\n\t\ttypeof length === \"number\" && length > 0 && ( length - 1 ) in obj );\n}\n\n// All jQuery objects should point back to these\nrootjQuery = jQuery(document);\n/*!\n * Sizzle CSS Selector Engine v1.9.4-pre\n * http://sizzlejs.com/\n *\n * Copyright 2013 jQuery Foundation, Inc. and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: 2013-06-03\n */\n(function( window, undefined ) {\n\nvar i,\n\tsupport,\n\tcachedruns,\n\tExpr,\n\tgetText,\n\tisXML,\n\tcompile,\n\toutermostContext,\n\tsortInput,\n\n\t// Local document vars\n\tsetDocument,\n\tdocument,\n\tdocElem,\n\tdocumentIsHTML,\n\trbuggyQSA,\n\trbuggyMatches,\n\tmatches,\n\tcontains,\n\n\t// Instance-specific data\n\texpando = \"sizzle\" + -(new Date()),\n\tpreferredDoc = window.document,\n\tdirruns = 0,\n\tdone = 0,\n\tclassCache = createCache(),\n\ttokenCache = createCache(),\n\tcompilerCache = createCache(),\n\thasDuplicate = false,\n\tsortOrder = function( a, b ) {\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\t\treturn 0;\n\t},\n\n\t// General-purpose constants\n\tstrundefined = typeof undefined,\n\tMAX_NEGATIVE = 1 << 31,\n\n\t// Instance methods\n\thasOwn = ({}).hasOwnProperty,\n\tarr = [],\n\tpop = arr.pop,\n\tpush_native = arr.push,\n\tpush = arr.push,\n\tslice = arr.slice,\n\t// Use a stripped-down indexOf if we can't use a native one\n\tindexOf = arr.indexOf || function( elem ) {\n\t\tvar i = 0,\n\t\t\tlen = this.length;\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( this[i] === elem ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t},\n\n\tbooleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",\n\n\t// Regular expressions\n\n\t// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace\n\twhitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n\t// http://www.w3.org/TR/css3-syntax/#characters\n\tcharacterEncoding = \"(?:\\\\\\\\.|[\\\\w-]|[^\\\\x00-\\\\xa0])+\",\n\n\t// Loosely modeled on CSS identifier characters\n\t// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors\n\t// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n\tidentifier = characterEncoding.replace( \"w\", \"w#\" ),\n\n\t// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors\n\tattributes = \"\\\\[\" + whitespace + \"*(\" + characterEncoding + \")\" + whitespace +\n\t\t\"*(?:([*^$|!~]?=)\" + whitespace + \"*(?:(['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\3|(\" + identifier + \")|)|)\" + whitespace + \"*\\\\]\",\n\n\t// Prefer arguments quoted,\n\t//   then not containing pseudos/brackets,\n\t//   then attribute selectors/non-parenthetical expressions,\n\t//   then anything else\n\t// These preferences are here to reduce the number of selectors\n\t//   needing tokenize in the PSEUDO preFilter\n\tpseudos = \":(\" + characterEncoding + \")(?:\\\\(((['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\3|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes.replace( 3, 8 ) + \")*)|.*)\\\\)|)\",\n\n\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\trtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\n\trcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n\trcombinators = new RegExp( \"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace + \"*\" ),\n\n\trsibling = new RegExp( whitespace + \"*[+~]\" ),\n\trattributeQuotes = new RegExp( \"=\" + whitespace + \"*([^\\\\]'\\\"]*)\" + whitespace + \"*\\\\]\", \"g\" ),\n\n\trpseudo = new RegExp( pseudos ),\n\tridentifier = new RegExp( \"^\" + identifier + \"$\" ),\n\n\tmatchExpr = {\n\t\t\"ID\": new RegExp( \"^#(\" + characterEncoding + \")\" ),\n\t\t\"CLASS\": new RegExp( \"^\\\\.(\" + characterEncoding + \")\" ),\n\t\t\"TAG\": new RegExp( \"^(\" + characterEncoding.replace( \"w\", \"w*\" ) + \")\" ),\n\t\t\"ATTR\": new RegExp( \"^\" + attributes ),\n\t\t\"PSEUDO\": new RegExp( \"^\" + pseudos ),\n\t\t\"CHILD\": new RegExp( \"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace +\n\t\t\t\"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n\t\t\t\"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n\t\t\"bool\": new RegExp( \"^(?:\" + booleans + \")$\", \"i\" ),\n\t\t// For use in libraries implementing .is()\n\t\t// We use this for POS matching in `select`\n\t\t\"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" +\n\t\t\twhitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\" )\n\t},\n\n\trnative = /^[^{]+\\{\\s*\\[native \\w/,\n\n\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\trquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n\n\trinputs = /^(?:input|select|textarea|button)$/i,\n\trheader = /^h\\d$/i,\n\n\trescape = /'|\\\\/g,\n\n\t// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n\trunescape = new RegExp( \"\\\\\\\\([\\\\da-f]{1,6}\" + whitespace + \"?|(\" + whitespace + \")|.)\", \"ig\" ),\n\tfunescape = function( _, escaped, escapedWhitespace ) {\n\t\tvar high = \"0x\" + escaped - 0x10000;\n\t\t// NaN means non-codepoint\n\t\t// Support: Firefox\n\t\t// Workaround erroneous numeric interpretation of +\"0x\"\n\t\treturn high !== high || escapedWhitespace ?\n\t\t\tescaped :\n\t\t\t// BMP codepoint\n\t\t\thigh < 0 ?\n\t\t\t\tString.fromCharCode( high + 0x10000 ) :\n\t\t\t\t// Supplemental Plane codepoint (surrogate pair)\n\t\t\t\tString.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );\n\t};\n\n// Optimize for push.apply( _, NodeList )\ntry {\n\tpush.apply(\n\t\t(arr = slice.call( preferredDoc.childNodes )),\n\t\tpreferredDoc.childNodes\n\t);\n\t// Support: Android<4.0\n\t// Detect silently failing push.apply\n\tarr[ preferredDoc.childNodes.length ].nodeType;\n} catch ( e ) {\n\tpush = { apply: arr.length ?\n\n\t\t// Leverage slice if possible\n\t\tfunction( target, els ) {\n\t\t\tpush_native.apply( target, slice.call(els) );\n\t\t} :\n\n\t\t// Support: IE<9\n\t\t// Otherwise append directly\n\t\tfunction( target, els ) {\n\t\t\tvar j = target.length,\n\t\t\t\ti = 0;\n\t\t\t// Can't trust NodeList.length\n\t\t\twhile ( (target[j++] = els[i++]) ) {}\n\t\t\ttarget.length = j - 1;\n\t\t}\n\t};\n}\n\nfunction Sizzle( selector, context, results, seed ) {\n\tvar match, elem, m, nodeType,\n\t\t// QSA vars\n\t\ti, groups, old, nid, newContext, newSelector;\n\n\tif ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {\n\t\tsetDocument( context );\n\t}\n\n\tcontext = context || document;\n\tresults = results || [];\n\n\tif ( !selector || typeof selector !== \"string\" ) {\n\t\treturn results;\n\t}\n\n\tif ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {\n\t\treturn [];\n\t}\n\n\tif ( documentIsHTML && !seed ) {\n\n\t\t// Shortcuts\n\t\tif ( (match = rquickExpr.exec( selector )) ) {\n\t\t\t// Speed-up: Sizzle(\"#ID\")\n\t\t\tif ( (m = match[1]) ) {\n\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\telem = context.getElementById( m );\n\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\tif ( elem && elem.parentNode ) {\n\t\t\t\t\t\t// Handle the case where IE, Opera, and Webkit return items\n\t\t\t\t\t\t// by name instead of ID\n\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Context is not a document\n\t\t\t\t\tif ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&\n\t\t\t\t\t\tcontains( context, elem ) && elem.id === m ) {\n\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// Speed-up: Sizzle(\"TAG\")\n\t\t\t} else if ( match[2] ) {\n\t\t\t\tpush.apply( results, context.getElementsByTagName( selector ) );\n\t\t\t\treturn results;\n\n\t\t\t// Speed-up: Sizzle(\".CLASS\")\n\t\t\t} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {\n\t\t\t\tpush.apply( results, context.getElementsByClassName( m ) );\n\t\t\t\treturn results;\n\t\t\t}\n\t\t}\n\n\t\t// QSA path\n\t\tif ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {\n\t\t\tnid = old = expando;\n\t\t\tnewContext = context;\n\t\t\tnewSelector = nodeType === 9 && selector;\n\n\t\t\t// qSA works strangely on Element-rooted queries\n\t\t\t// We can work around this by specifying an extra ID on the root\n\t\t\t// and working up from there (Thanks to Andrew Dupont for the technique)\n\t\t\t// IE 8 doesn't work on object elements\n\t\t\tif ( nodeType === 1 && context.nodeName.toLowerCase() !== \"object\" ) {\n\t\t\t\tgroups = tokenize( selector );\n\n\t\t\t\tif ( (old = context.getAttribute(\"id\")) ) {\n\t\t\t\t\tnid = old.replace( rescape, \"\\\\$&\" );\n\t\t\t\t} else {\n\t\t\t\t\tcontext.setAttribute( \"id\", nid );\n\t\t\t\t}\n\t\t\t\tnid = \"[id='\" + nid + \"'] \";\n\n\t\t\t\ti = groups.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tgroups[i] = nid + toSelector( groups[i] );\n\t\t\t\t}\n\t\t\t\tnewContext = rsibling.test( selector ) && context.parentNode || context;\n\t\t\t\tnewSelector = groups.join(\",\");\n\t\t\t}\n\n\t\t\tif ( newSelector ) {\n\t\t\t\ttry {\n\t\t\t\t\tpush.apply( results,\n\t\t\t\t\t\tnewContext.querySelectorAll( newSelector )\n\t\t\t\t\t);\n\t\t\t\t\treturn results;\n\t\t\t\t} catch(qsaError) {\n\t\t\t\t} finally {\n\t\t\t\t\tif ( !old ) {\n\t\t\t\t\t\tcontext.removeAttribute(\"id\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// All others\n\treturn select( selector.replace( rtrim, \"$1\" ), context, results, seed );\n}\n\n/**\n * Create key-value caches of limited size\n * @returns {Function(string, Object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\nfunction createCache() {\n\tvar keys = [];\n\n\tfunction cache( key, value ) {\n\t\t// Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n\t\tif ( keys.push( key += \" \" ) > Expr.cacheLength ) {\n\t\t\t// Only keep the most recent entries\n\t\t\tdelete cache[ keys.shift() ];\n\t\t}\n\t\treturn (cache[ key ] = value);\n\t}\n\treturn cache;\n}\n\n/**\n * Mark a function for special use by Sizzle\n * @param {Function} fn The function to mark\n */\nfunction markFunction( fn ) {\n\tfn[ expando ] = true;\n\treturn fn;\n}\n\n/**\n * Support testing using an element\n * @param {Function} fn Passed the created div and expects a boolean result\n */\nfunction assert( fn ) {\n\tvar div = document.createElement(\"div\");\n\n\ttry {\n\t\treturn !!fn( div );\n\t} catch (e) {\n\t\treturn false;\n\t} finally {\n\t\t// Remove from its parent by default\n\t\tif ( div.parentNode ) {\n\t\t\tdiv.parentNode.removeChild( div );\n\t\t}\n\t\t// release memory in IE\n\t\tdiv = null;\n\t}\n}\n\n/**\n * Adds the same handler for all of the specified attrs\n * @param {String} attrs Pipe-separated list of attributes\n * @param {Function} handler The method that will be applied\n */\nfunction addHandle( attrs, handler ) {\n\tvar arr = attrs.split(\"|\"),\n\t\ti = attrs.length;\n\n\twhile ( i-- ) {\n\t\tExpr.attrHandle[ arr[i] ] = handler;\n\t}\n}\n\n/**\n * Checks document order of two siblings\n * @param {Element} a\n * @param {Element} b\n * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n */\nfunction siblingCheck( a, b ) {\n\tvar cur = b && a,\n\t\tdiff = cur && a.nodeType === 1 && b.nodeType === 1 &&\n\t\t\t( ~b.sourceIndex || MAX_NEGATIVE ) -\n\t\t\t( ~a.sourceIndex || MAX_NEGATIVE );\n\n\t// Use IE sourceIndex if available on both nodes\n\tif ( diff ) {\n\t\treturn diff;\n\t}\n\n\t// Check if b follows a\n\tif ( cur ) {\n\t\twhile ( (cur = cur.nextSibling) ) {\n\t\t\tif ( cur === b ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn a ? 1 : -1;\n}\n\n/**\n * Returns a function to use in pseudos for input types\n * @param {String} type\n */\nfunction createInputPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn name === \"input\" && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for buttons\n * @param {String} type\n */\nfunction createButtonPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn (name === \"input\" || name === \"button\") && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for positionals\n * @param {Function} fn\n */\nfunction createPositionalPseudo( fn ) {\n\treturn markFunction(function( argument ) {\n\t\targument = +argument;\n\t\treturn markFunction(function( seed, matches ) {\n\t\t\tvar j,\n\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\ti = matchIndexes.length;\n\n\t\t\t// Match elements found at the specified indexes\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( seed[ (j = matchIndexes[i]) ] ) {\n\t\t\t\t\tseed[j] = !(matches[j] = seed[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Detect xml\n * @param {Element|Object} elem An element or a document\n */\nisXML = Sizzle.isXML = function( elem ) {\n\t// documentElement is verified for cases where it doesn't yet exist\n\t// (such as loading iframes in IE - #4833)\n\tvar documentElement = elem && (elem.ownerDocument || elem).documentElement;\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\n// Expose support vars for convenience\nsupport = Sizzle.support = {};\n\n/**\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [doc] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\nsetDocument = Sizzle.setDocument = function( node ) {\n\tvar doc = node ? node.ownerDocument || node : preferredDoc,\n\t\tparent = doc.defaultView;\n\n\t// If no document and documentElement is available, return\n\tif ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {\n\t\treturn document;\n\t}\n\n\t// Set our document\n\tdocument = doc;\n\tdocElem = doc.documentElement;\n\n\t// Support tests\n\tdocumentIsHTML = !isXML( doc );\n\n\t// Support: IE>8\n\t// If iframe document is assigned to \"document\" variable and if iframe has been reloaded,\n\t// IE will throw \"permission denied\" error when accessing \"document\" variable, see jQuery #13936\n\t// IE6-8 do not support the defaultView property so parent will be undefined\n\tif ( parent && parent.attachEvent && parent !== parent.top ) {\n\t\tparent.attachEvent( \"onbeforeunload\", function() {\n\t\t\tsetDocument();\n\t\t});\n\t}\n\n\t/* Attributes\n\t---------------------------------------------------------------------- */\n\n\t// Support: IE<8\n\t// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)\n\tsupport.attributes = assert(function( div ) {\n\t\tdiv.className = \"i\";\n\t\treturn !div.getAttribute(\"className\");\n\t});\n\n\t/* getElement(s)By*\n\t---------------------------------------------------------------------- */\n\n\t// Check if getElementsByTagName(\"*\") returns only elements\n\tsupport.getElementsByTagName = assert(function( div ) {\n\t\tdiv.appendChild( doc.createComment(\"\") );\n\t\treturn !div.getElementsByTagName(\"*\").length;\n\t});\n\n\t// Check if getElementsByClassName can be trusted\n\tsupport.getElementsByClassName = assert(function( div ) {\n\t\tdiv.innerHTML = \"<div class='a'></div><div class='a i'></div>\";\n\n\t\t// Support: Safari<4\n\t\t// Catch class over-caching\n\t\tdiv.firstChild.className = \"i\";\n\t\t// Support: Opera<10\n\t\t// Catch gEBCN failure to find non-leading classes\n\t\treturn div.getElementsByClassName(\"i\").length === 2;\n\t});\n\n\t// Support: IE<10\n\t// Check if getElementById returns elements by name\n\t// The broken getElementById methods don't pick up programatically-set names,\n\t// so use a roundabout getElementsByName test\n\tsupport.getById = assert(function( div ) {\n\t\tdocElem.appendChild( div ).id = expando;\n\t\treturn !doc.getElementsByName || !doc.getElementsByName( expando ).length;\n\t});\n\n\t// ID find and filter\n\tif ( support.getById ) {\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== strundefined && documentIsHTML ) {\n\t\t\t\tvar m = context.getElementById( id );\n\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\treturn m && m.parentNode ? [m] : [];\n\t\t\t}\n\t\t};\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.getAttribute(\"id\") === attrId;\n\t\t\t};\n\t\t};\n\t} else {\n\t\t// Support: IE6/7\n\t\t// getElementById is not reliable as a find shortcut\n\t\tdelete Expr.find[\"ID\"];\n\n\t\tExpr.filter[\"ID\"] =  function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\tvar node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode(\"id\");\n\t\t\t\treturn node && node.value === attrId;\n\t\t\t};\n\t\t};\n\t}\n\n\t// Tag\n\tExpr.find[\"TAG\"] = support.getElementsByTagName ?\n\t\tfunction( tag, context ) {\n\t\t\tif ( typeof context.getElementsByTagName !== strundefined ) {\n\t\t\t\treturn context.getElementsByTagName( tag );\n\t\t\t}\n\t\t} :\n\t\tfunction( tag, context ) {\n\t\t\tvar elem,\n\t\t\t\ttmp = [],\n\t\t\t\ti = 0,\n\t\t\t\tresults = context.getElementsByTagName( tag );\n\n\t\t\t// Filter out possible comments\n\t\t\tif ( tag === \"*\" ) {\n\t\t\t\twhile ( (elem = results[i++]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\ttmp.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t\treturn results;\n\t\t};\n\n\t// Class\n\tExpr.find[\"CLASS\"] = support.getElementsByClassName && function( className, context ) {\n\t\tif ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {\n\t\t\treturn context.getElementsByClassName( className );\n\t\t}\n\t};\n\n\t/* QSA/matchesSelector\n\t---------------------------------------------------------------------- */\n\n\t// QSA and matchesSelector support\n\n\t// matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\trbuggyMatches = [];\n\n\t// qSa(:focus) reports false when true (Chrome 21)\n\t// We allow this because of a bug in IE8/9 that throws an error\n\t// whenever `document.activeElement` is accessed on an iframe\n\t// So, we allow :focus to pass through QSA all the time to avoid the IE error\n\t// See http://bugs.jquery.com/ticket/13378\n\trbuggyQSA = [];\n\n\tif ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {\n\t\t// Build QSA regex\n\t\t// Regex strategy adopted from Diego Perini\n\t\tassert(function( div ) {\n\t\t\t// Select is set to empty string on purpose\n\t\t\t// This is to test IE's treatment of not explicitly\n\t\t\t// setting a boolean content attribute,\n\t\t\t// since its presence should be enough\n\t\t\t// http://bugs.jquery.com/ticket/12359\n\t\t\tdiv.innerHTML = \"<select><option selected=''></option></select>\";\n\n\t\t\t// Support: IE8\n\t\t\t// Boolean attributes and \"value\" are not treated correctly\n\t\t\tif ( !div.querySelectorAll(\"[selected]\").length ) {\n\t\t\t\trbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\" );\n\t\t\t}\n\n\t\t\t// Webkit/Opera - :checked should return selected option elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !div.querySelectorAll(\":checked\").length ) {\n\t\t\t\trbuggyQSA.push(\":checked\");\n\t\t\t}\n\t\t});\n\n\t\tassert(function( div ) {\n\n\t\t\t// Support: Opera 10-12/IE8\n\t\t\t// ^= $= *= and empty values\n\t\t\t// Should not select anything\n\t\t\t// Support: Windows 8 Native Apps\n\t\t\t// The type attribute is restricted during .innerHTML assignment\n\t\t\tvar input = doc.createElement(\"input\");\n\t\t\tinput.setAttribute( \"type\", \"hidden\" );\n\t\t\tdiv.appendChild( input ).setAttribute( \"t\", \"\" );\n\n\t\t\tif ( div.querySelectorAll(\"[t^='']\").length ) {\n\t\t\t\trbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\" );\n\t\t\t}\n\n\t\t\t// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !div.querySelectorAll(\":enabled\").length ) {\n\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t}\n\n\t\t\t// Opera 10-11 does not throw on post-comma invalid pseudos\n\t\t\tdiv.querySelectorAll(\"*,:x\");\n\t\t\trbuggyQSA.push(\",.*:\");\n\t\t});\n\t}\n\n\tif ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||\n\t\tdocElem.mozMatchesSelector ||\n\t\tdocElem.oMatchesSelector ||\n\t\tdocElem.msMatchesSelector) )) ) {\n\n\t\tassert(function( div ) {\n\t\t\t// Check to see if it's possible to do matchesSelector\n\t\t\t// on a disconnected node (IE 9)\n\t\t\tsupport.disconnectedMatch = matches.call( div, \"div\" );\n\n\t\t\t// This should fail with an exception\n\t\t\t// Gecko does not error, returns false instead\n\t\t\tmatches.call( div, \"[s!='']:x\" );\n\t\t\trbuggyMatches.push( \"!=\", pseudos );\n\t\t});\n\t}\n\n\trbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join(\"|\") );\n\trbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join(\"|\") );\n\n\t/* Contains\n\t---------------------------------------------------------------------- */\n\n\t// Element contains another\n\t// Purposefully does not implement inclusive descendent\n\t// As in, an element does not contain itself\n\tcontains = rnative.test( docElem.contains ) || docElem.compareDocumentPosition ?\n\t\tfunction( a, b ) {\n\t\t\tvar adown = a.nodeType === 9 ? a.documentElement : a,\n\t\t\t\tbup = b && b.parentNode;\n\t\t\treturn a === bup || !!( bup && bup.nodeType === 1 && (\n\t\t\t\tadown.contains ?\n\t\t\t\t\tadown.contains( bup ) :\n\t\t\t\t\ta.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n\t\t\t));\n\t\t} :\n\t\tfunction( a, b ) {\n\t\t\tif ( b ) {\n\t\t\t\twhile ( (b = b.parentNode) ) {\n\t\t\t\t\tif ( b === a ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\n\t/* Sorting\n\t---------------------------------------------------------------------- */\n\n\t// Document order sorting\n\tsortOrder = docElem.compareDocumentPosition ?\n\tfunction( a, b ) {\n\n\t\t// Flag for duplicate removal\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );\n\n\t\tif ( compare ) {\n\t\t\t// Disconnected nodes\n\t\t\tif ( compare & 1 ||\n\t\t\t\t(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {\n\n\t\t\t\t// Choose the first element that is related to our preferred document\n\t\t\t\tif ( a === doc || contains(preferredDoc, a) ) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tif ( b === doc || contains(preferredDoc, b) ) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\t// Maintain original order\n\t\t\t\treturn sortInput ?\n\t\t\t\t\t( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :\n\t\t\t\t\t0;\n\t\t\t}\n\n\t\t\treturn compare & 4 ? -1 : 1;\n\t\t}\n\n\t\t// Not directly comparable, sort on existence of method\n\t\treturn a.compareDocumentPosition ? -1 : 1;\n\t} :\n\tfunction( a, b ) {\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\taup = a.parentNode,\n\t\t\tbup = b.parentNode,\n\t\t\tap = [ a ],\n\t\t\tbp = [ b ];\n\n\t\t// Exit early if the nodes are identical\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\n\t\t// Parentless nodes are either documents or disconnected\n\t\t} else if ( !aup || !bup ) {\n\t\t\treturn a === doc ? -1 :\n\t\t\t\tb === doc ? 1 :\n\t\t\t\taup ? -1 :\n\t\t\t\tbup ? 1 :\n\t\t\t\tsortInput ?\n\t\t\t\t( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :\n\t\t\t\t0;\n\n\t\t// If the nodes are siblings, we can do a quick check\n\t\t} else if ( aup === bup ) {\n\t\t\treturn siblingCheck( a, b );\n\t\t}\n\n\t\t// Otherwise we need full lists of their ancestors for comparison\n\t\tcur = a;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tap.unshift( cur );\n\t\t}\n\t\tcur = b;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tbp.unshift( cur );\n\t\t}\n\n\t\t// Walk down the tree looking for a discrepancy\n\t\twhile ( ap[i] === bp[i] ) {\n\t\t\ti++;\n\t\t}\n\n\t\treturn i ?\n\t\t\t// Do a sibling check if the nodes have a common ancestor\n\t\t\tsiblingCheck( ap[i], bp[i] ) :\n\n\t\t\t// Otherwise nodes in our document sort first\n\t\t\tap[i] === preferredDoc ? -1 :\n\t\t\tbp[i] === preferredDoc ? 1 :\n\t\t\t0;\n\t};\n\n\treturn doc;\n};\n\nSizzle.matches = function( expr, elements ) {\n\treturn Sizzle( expr, null, null, elements );\n};\n\nSizzle.matchesSelector = function( elem, expr ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\t// Make sure that attribute selectors are quoted\n\texpr = expr.replace( rattributeQuotes, \"='$1']\" );\n\n\tif ( support.matchesSelector && documentIsHTML &&\n\t\t( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&\n\t\t( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {\n\n\t\ttry {\n\t\t\tvar ret = matches.call( elem, expr );\n\n\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\tif ( ret || support.disconnectedMatch ||\n\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t} catch(e) {}\n\t}\n\n\treturn Sizzle( expr, document, null, [elem] ).length > 0;\n};\n\nSizzle.contains = function( context, elem ) {\n\t// Set document vars if needed\n\tif ( ( context.ownerDocument || context ) !== document ) {\n\t\tsetDocument( context );\n\t}\n\treturn contains( context, elem );\n};\n\nSizzle.attr = function( elem, name ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\tvar fn = Expr.attrHandle[ name.toLowerCase() ],\n\t\t// Don't get fooled by Object.prototype properties (jQuery #13807)\n\t\tval = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?\n\t\t\tfn( elem, name, !documentIsHTML ) :\n\t\t\tundefined;\n\n\treturn val === undefined ?\n\t\tsupport.attributes || !documentIsHTML ?\n\t\t\telem.getAttribute( name ) :\n\t\t\t(val = elem.getAttributeNode(name)) && val.specified ?\n\t\t\t\tval.value :\n\t\t\t\tnull :\n\t\tval;\n};\n\nSizzle.error = function( msg ) {\n\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\n/**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\nSizzle.uniqueSort = function( results ) {\n\tvar elem,\n\t\tduplicates = [],\n\t\tj = 0,\n\t\ti = 0;\n\n\t// Unless we *know* we can detect duplicates, assume their presence\n\thasDuplicate = !support.detectDuplicates;\n\tsortInput = !support.sortStable && results.slice( 0 );\n\tresults.sort( sortOrder );\n\n\tif ( hasDuplicate ) {\n\t\twhile ( (elem = results[i++]) ) {\n\t\t\tif ( elem === results[ i ] ) {\n\t\t\t\tj = duplicates.push( i );\n\t\t\t}\n\t\t}\n\t\twhile ( j-- ) {\n\t\t\tresults.splice( duplicates[ j ], 1 );\n\t\t}\n\t}\n\n\treturn results;\n};\n\n/**\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\ngetText = Sizzle.getText = function( elem ) {\n\tvar node,\n\t\tret = \"\",\n\t\ti = 0,\n\t\tnodeType = elem.nodeType;\n\n\tif ( !nodeType ) {\n\t\t// If no nodeType, this is expected to be an array\n\t\tfor ( ; (node = elem[i]); i++ ) {\n\t\t\t// Do not traverse comment nodes\n\t\t\tret += getText( node );\n\t\t}\n\t} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n\t\t// Use textContent for elements\n\t\t// innerText usage removed for consistency of new lines (see #11153)\n\t\tif ( typeof elem.textContent === \"string\" ) {\n\t\t\treturn elem.textContent;\n\t\t} else {\n\t\t\t// Traverse its children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tret += getText( elem );\n\t\t\t}\n\t\t}\n\t} else if ( nodeType === 3 || nodeType === 4 ) {\n\t\treturn elem.nodeValue;\n\t}\n\t// Do not include comment or processing instruction nodes\n\n\treturn ret;\n};\n\nExpr = Sizzle.selectors = {\n\n\t// Can be adjusted by the user\n\tcacheLength: 50,\n\n\tcreatePseudo: markFunction,\n\n\tmatch: matchExpr,\n\n\tattrHandle: {},\n\n\tfind: {},\n\n\trelative: {\n\t\t\">\": { dir: \"parentNode\", first: true },\n\t\t\" \": { dir: \"parentNode\" },\n\t\t\"+\": { dir: \"previousSibling\", first: true },\n\t\t\"~\": { dir: \"previousSibling\" }\n\t},\n\n\tpreFilter: {\n\t\t\"ATTR\": function( match ) {\n\t\t\tmatch[1] = match[1].replace( runescape, funescape );\n\n\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\tmatch[3] = ( match[4] || match[5] || \"\" ).replace( runescape, funescape );\n\n\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\tmatch[3] = \" \" + match[3] + \" \";\n\t\t\t}\n\n\t\t\treturn match.slice( 0, 4 );\n\t\t},\n\n\t\t\"CHILD\": function( match ) {\n\t\t\t/* matches from matchExpr[\"CHILD\"]\n\t\t\t\t1 type (only|nth|...)\n\t\t\t\t2 what (child|of-type)\n\t\t\t\t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t4 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t5 sign of xn-component\n\t\t\t\t6 x of xn-component\n\t\t\t\t7 sign of y-component\n\t\t\t\t8 y of y-component\n\t\t\t*/\n\t\t\tmatch[1] = match[1].toLowerCase();\n\n\t\t\tif ( match[1].slice( 0, 3 ) === \"nth\" ) {\n\t\t\t\t// nth-* requires argument\n\t\t\t\tif ( !match[3] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\n\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\tmatch[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === \"even\" || match[3] === \"odd\" ) );\n\t\t\t\tmatch[5] = +( ( match[7] + match[8] ) || match[3] === \"odd\" );\n\n\t\t\t// other types prohibit arguments\n\t\t\t} else if ( match[3] ) {\n\t\t\t\tSizzle.error( match[0] );\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\t\"PSEUDO\": function( match ) {\n\t\t\tvar excess,\n\t\t\t\tunquoted = !match[5] && match[2];\n\n\t\t\tif ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Accept quoted arguments as-is\n\t\t\tif ( match[3] && match[4] !== undefined ) {\n\t\t\t\tmatch[2] = match[4];\n\n\t\t\t// Strip excess characters from unquoted arguments\n\t\t\t} else if ( unquoted && rpseudo.test( unquoted ) &&\n\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t(excess = tokenize( unquoted, true )) &&\n\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t(excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\n\t\t\t\t// excess is a negative index\n\t\t\t\tmatch[0] = match[0].slice( 0, excess );\n\t\t\t\tmatch[2] = unquoted.slice( 0, excess );\n\t\t\t}\n\n\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\treturn match.slice( 0, 3 );\n\t\t}\n\t},\n\n\tfilter: {\n\n\t\t\"TAG\": function( nodeNameSelector ) {\n\t\t\tvar nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn nodeNameSelector === \"*\" ?\n\t\t\t\tfunction() { return true; } :\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n\t\t\t\t};\n\t\t},\n\n\t\t\"CLASS\": function( className ) {\n\t\t\tvar pattern = classCache[ className + \" \" ];\n\n\t\t\treturn pattern ||\n\t\t\t\t(pattern = new RegExp( \"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\" )) &&\n\t\t\t\tclassCache( className, function( elem ) {\n\t\t\t\t\treturn pattern.test( typeof elem.className === \"string\" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute(\"class\") || \"\" );\n\t\t\t\t});\n\t\t},\n\n\t\t\"ATTR\": function( name, operator, check ) {\n\t\t\treturn function( elem ) {\n\t\t\t\tvar result = Sizzle.attr( elem, name );\n\n\t\t\t\tif ( result == null ) {\n\t\t\t\t\treturn operator === \"!=\";\n\t\t\t\t}\n\t\t\t\tif ( !operator ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tresult += \"\";\n\n\t\t\t\treturn operator === \"=\" ? result === check :\n\t\t\t\t\toperator === \"!=\" ? result !== check :\n\t\t\t\t\toperator === \"^=\" ? check && result.indexOf( check ) === 0 :\n\t\t\t\t\toperator === \"*=\" ? check && result.indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"$=\" ? check && result.slice( -check.length ) === check :\n\t\t\t\t\toperator === \"~=\" ? ( \" \" + result + \" \" ).indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"|=\" ? result === check || result.slice( 0, check.length + 1 ) === check + \"-\" :\n\t\t\t\t\tfalse;\n\t\t\t};\n\t\t},\n\n\t\t\"CHILD\": function( type, what, argument, first, last ) {\n\t\t\tvar simple = type.slice( 0, 3 ) !== \"nth\",\n\t\t\t\tforward = type.slice( -4 ) !== \"last\",\n\t\t\t\tofType = what === \"of-type\";\n\n\t\t\treturn first === 1 && last === 0 ?\n\n\t\t\t\t// Shortcut for :nth-*(n)\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn !!elem.parentNode;\n\t\t\t\t} :\n\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tvar cache, outerCache, node, diff, nodeIndex, start,\n\t\t\t\t\t\tdir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n\t\t\t\t\t\tparent = elem.parentNode,\n\t\t\t\t\t\tname = ofType && elem.nodeName.toLowerCase(),\n\t\t\t\t\t\tuseCache = !xml && !ofType;\n\n\t\t\t\t\tif ( parent ) {\n\n\t\t\t\t\t\t// :(first|last|only)-(child|of-type)\n\t\t\t\t\t\tif ( simple ) {\n\t\t\t\t\t\t\twhile ( dir ) {\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\twhile ( (node = node[ dir ]) ) {\n\t\t\t\t\t\t\t\t\tif ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Reverse direction for :only-* (if we haven't yet done so)\n\t\t\t\t\t\t\t\tstart = dir = type === \"only\" && !start && \"nextSibling\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart = [ forward ? parent.firstChild : parent.lastChild ];\n\n\t\t\t\t\t\t// non-xml :nth-child(...) stores cache data on `parent`\n\t\t\t\t\t\tif ( forward && useCache ) {\n\t\t\t\t\t\t\t// Seek `elem` from a previously-cached index\n\t\t\t\t\t\t\touterCache = parent[ expando ] || (parent[ expando ] = {});\n\t\t\t\t\t\t\tcache = outerCache[ type ] || [];\n\t\t\t\t\t\t\tnodeIndex = cache[0] === dirruns && cache[1];\n\t\t\t\t\t\t\tdiff = cache[0] === dirruns && cache[2];\n\t\t\t\t\t\t\tnode = nodeIndex && parent.childNodes[ nodeIndex ];\n\n\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\n\t\t\t\t\t\t\t\t// Fallback to seeking `elem` from the start\n\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t// When found, cache indexes on `parent` and break\n\t\t\t\t\t\t\t\tif ( node.nodeType === 1 && ++diff && node === elem ) {\n\t\t\t\t\t\t\t\t\touterCache[ type ] = [ dirruns, nodeIndex, diff ];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Use previously-cached element index if available\n\t\t\t\t\t\t} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {\n\t\t\t\t\t\t\tdiff = cache[1];\n\n\t\t\t\t\t\t// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Use the same loop as above to seek `elem` from the start\n\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\tif ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {\n\t\t\t\t\t\t\t\t\t// Cache the index of each encountered element\n\t\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t\t(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif ( node === elem ) {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Incorporate the offset, then check against cycle size\n\t\t\t\t\t\tdiff -= last;\n\t\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t},\n\n\t\t\"PSEUDO\": function( pseudo, argument ) {\n\t\t\t// pseudo-class names are case-insensitive\n\t\t\t// http://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\tvar args,\n\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\tSizzle.error( \"unsupported pseudo: \" + pseudo );\n\n\t\t\t// The user may use createPseudo to indicate that\n\t\t\t// arguments are needed to create the filter function\n\t\t\t// just as Sizzle does\n\t\t\tif ( fn[ expando ] ) {\n\t\t\t\treturn fn( argument );\n\t\t\t}\n\n\t\t\t// But maintain support for old signatures\n\t\t\tif ( fn.length > 1 ) {\n\t\t\t\targs = [ pseudo, pseudo, \"\", argument ];\n\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\tmarkFunction(function( seed, matches ) {\n\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tidx = indexOf.call( seed, matched[i] );\n\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[i] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}) :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn fn;\n\t\t}\n\t},\n\n\tpseudos: {\n\t\t// Potentially complex pseudos\n\t\t\"not\": markFunction(function( selector ) {\n\t\t\t// Trim the selector passed to compile\n\t\t\t// to avoid treating leading and trailing\n\t\t\t// spaces as combinators\n\t\t\tvar input = [],\n\t\t\t\tresults = [],\n\t\t\t\tmatcher = compile( selector.replace( rtrim, \"$1\" ) );\n\n\t\t\treturn matcher[ expando ] ?\n\t\t\t\tmarkFunction(function( seed, matches, context, xml ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\ti = seed.length;\n\n\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\t\t\t\tseed[i] = !(matches[i] = elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}) :\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tinput[0] = elem;\n\t\t\t\t\tmatcher( input, null, xml, results );\n\t\t\t\t\treturn !results.pop();\n\t\t\t\t};\n\t\t}),\n\n\t\t\"has\": markFunction(function( selector ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn Sizzle( selector, elem ).length > 0;\n\t\t\t};\n\t\t}),\n\n\t\t\"contains\": markFunction(function( text ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n\t\t\t};\n\t\t}),\n\n\t\t// \"Whether an element is represented by a :lang() selector\n\t\t// is based solely on the element's language value\n\t\t// being equal to the identifier C,\n\t\t// or beginning with the identifier C immediately followed by \"-\".\n\t\t// The matching of C against the element's language value is performed case-insensitively.\n\t\t// The identifier C does not have to be a valid language name.\"\n\t\t// http://www.w3.org/TR/selectors/#lang-pseudo\n\t\t\"lang\": markFunction( function( lang ) {\n\t\t\t// lang value must be a valid identifier\n\t\t\tif ( !ridentifier.test(lang || \"\") ) {\n\t\t\t\tSizzle.error( \"unsupported lang: \" + lang );\n\t\t\t}\n\t\t\tlang = lang.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn function( elem ) {\n\t\t\t\tvar elemLang;\n\t\t\t\tdo {\n\t\t\t\t\tif ( (elemLang = documentIsHTML ?\n\t\t\t\t\t\telem.lang :\n\t\t\t\t\t\telem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) ) {\n\n\t\t\t\t\t\telemLang = elemLang.toLowerCase();\n\t\t\t\t\t\treturn elemLang === lang || elemLang.indexOf( lang + \"-\" ) === 0;\n\t\t\t\t\t}\n\t\t\t\t} while ( (elem = elem.parentNode) && elem.nodeType === 1 );\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}),\n\n\t\t// Miscellaneous\n\t\t\"target\": function( elem ) {\n\t\t\tvar hash = window.location && window.location.hash;\n\t\t\treturn hash && hash.slice( 1 ) === elem.id;\n\t\t},\n\n\t\t\"root\": function( elem ) {\n\t\t\treturn elem === docElem;\n\t\t},\n\n\t\t\"focus\": function( elem ) {\n\t\t\treturn elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n\t\t},\n\n\t\t// Boolean properties\n\t\t\"enabled\": function( elem ) {\n\t\t\treturn elem.disabled === false;\n\t\t},\n\n\t\t\"disabled\": function( elem ) {\n\t\t\treturn elem.disabled === true;\n\t\t},\n\n\t\t\"checked\": function( elem ) {\n\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\tvar nodeName = elem.nodeName.toLowerCase();\n\t\t\treturn (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n\t\t},\n\n\t\t\"selected\": function( elem ) {\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\t// Contents\n\t\t\"empty\": function( elem ) {\n\t\t\t// http://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),\n\t\t\t//   not comment, processing instructions, or others\n\t\t\t// Thanks to Diego Perini for the nodeName shortcut\n\t\t\t//   Greater than \"@\" means alpha characters (specifically not starting with \"#\" or \"?\")\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tif ( elem.nodeName > \"@\" || elem.nodeType === 3 || elem.nodeType === 4 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t\"parent\": function( elem ) {\n\t\t\treturn !Expr.pseudos[\"empty\"]( elem );\n\t\t},\n\n\t\t// Element/input types\n\t\t\"header\": function( elem ) {\n\t\t\treturn rheader.test( elem.nodeName );\n\t\t},\n\n\t\t\"input\": function( elem ) {\n\t\t\treturn rinputs.test( elem.nodeName );\n\t\t},\n\n\t\t\"button\": function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && elem.type === \"button\" || name === \"button\";\n\t\t},\n\n\t\t\"text\": function( elem ) {\n\t\t\tvar attr;\n\t\t\t// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)\n\t\t\t// use getAttribute instead to test this case\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" &&\n\t\t\t\telem.type === \"text\" &&\n\t\t\t\t( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === elem.type );\n\t\t},\n\n\t\t// Position-in-collection\n\t\t\"first\": createPositionalPseudo(function() {\n\t\t\treturn [ 0 ];\n\t\t}),\n\n\t\t\"last\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\treturn [ length - 1 ];\n\t\t}),\n\n\t\t\"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t}),\n\n\t\t\"even\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"odd\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 1;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; --i >= 0; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; ++i < length; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t})\n\t}\n};\n\nExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\n// Add button/input type pseudos\nfor ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {\n\tExpr.pseudos[ i ] = createInputPseudo( i );\n}\nfor ( i in { submit: true, reset: true } ) {\n\tExpr.pseudos[ i ] = createButtonPseudo( i );\n}\n\n// Easy API for creating new setFilters\nfunction setFilters() {}\nsetFilters.prototype = Expr.filters = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\nfunction tokenize( selector, parseOnly ) {\n\tvar matched, match, tokens, type,\n\t\tsoFar, groups, preFilters,\n\t\tcached = tokenCache[ selector + \" \" ];\n\n\tif ( cached ) {\n\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t}\n\n\tsoFar = selector;\n\tgroups = [];\n\tpreFilters = Expr.preFilter;\n\n\twhile ( soFar ) {\n\n\t\t// Comma and first run\n\t\tif ( !matched || (match = rcomma.exec( soFar )) ) {\n\t\t\tif ( match ) {\n\t\t\t\t// Don't consume trailing commas as valid\n\t\t\t\tsoFar = soFar.slice( match[0].length ) || soFar;\n\t\t\t}\n\t\t\tgroups.push( tokens = [] );\n\t\t}\n\n\t\tmatched = false;\n\n\t\t// Combinators\n\t\tif ( (match = rcombinators.exec( soFar )) ) {\n\t\t\tmatched = match.shift();\n\t\t\ttokens.push({\n\t\t\t\tvalue: matched,\n\t\t\t\t// Cast descendant combinators to space\n\t\t\t\ttype: match[0].replace( rtrim, \" \" )\n\t\t\t});\n\t\t\tsoFar = soFar.slice( matched.length );\n\t\t}\n\n\t\t// Filters\n\t\tfor ( type in Expr.filter ) {\n\t\t\tif ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n\t\t\t\t(match = preFilters[ type ]( match ))) ) {\n\t\t\t\tmatched = match.shift();\n\t\t\t\ttokens.push({\n\t\t\t\t\tvalue: matched,\n\t\t\t\t\ttype: type,\n\t\t\t\t\tmatches: match\n\t\t\t\t});\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t}\n\t\t}\n\n\t\tif ( !matched ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Return the length of the invalid excess\n\t// if we're just parsing\n\t// Otherwise, throw an error or return tokens\n\treturn parseOnly ?\n\t\tsoFar.length :\n\t\tsoFar ?\n\t\t\tSizzle.error( selector ) :\n\t\t\t// Cache the tokens\n\t\t\ttokenCache( selector, groups ).slice( 0 );\n}\n\nfunction toSelector( tokens ) {\n\tvar i = 0,\n\t\tlen = tokens.length,\n\t\tselector = \"\";\n\tfor ( ; i < len; i++ ) {\n\t\tselector += tokens[i].value;\n\t}\n\treturn selector;\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n\tvar dir = combinator.dir,\n\t\tcheckNonElements = base && dir === \"parentNode\",\n\t\tdoneName = done++;\n\n\treturn combinator.first ?\n\t\t// Check against closest ancestor/preceding element\n\t\tfunction( elem, context, xml ) {\n\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t}\n\t\t\t}\n\t\t} :\n\n\t\t// Check against all ancestor/preceding elements\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar data, cache, outerCache,\n\t\t\t\tdirkey = dirruns + \" \" + doneName;\n\n\t\t\t// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching\n\t\t\tif ( xml ) {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\touterCache = elem[ expando ] || (elem[ expando ] = {});\n\t\t\t\t\t\tif ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {\n\t\t\t\t\t\t\tif ( (data = cache[1]) === true || data === cachedruns ) {\n\t\t\t\t\t\t\t\treturn data === true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcache = outerCache[ dir ] = [ dirkey ];\n\t\t\t\t\t\t\tcache[1] = matcher( elem, context, xml ) || cachedruns;\n\t\t\t\t\t\t\tif ( cache[1] === true ) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n}\n\nfunction elementMatcher( matchers ) {\n\treturn matchers.length > 1 ?\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar i = matchers.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( !matchers[i]( elem, context, xml ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} :\n\t\tmatchers[0];\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n\tvar elem,\n\t\tnewUnmatched = [],\n\t\ti = 0,\n\t\tlen = unmatched.length,\n\t\tmapped = map != null;\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (elem = unmatched[i]) ) {\n\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\tif ( mapped ) {\n\t\t\t\t\tmap.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\tif ( postFilter && !postFilter[ expando ] ) {\n\t\tpostFilter = setMatcher( postFilter );\n\t}\n\tif ( postFinder && !postFinder[ expando ] ) {\n\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t}\n\treturn markFunction(function( seed, results, context, xml ) {\n\t\tvar temp, i, elem,\n\t\t\tpreMap = [],\n\t\t\tpostMap = [],\n\t\t\tpreexisting = results.length,\n\n\t\t\t// Get initial elements from seed or context\n\t\t\telems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [] ),\n\n\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\telems,\n\n\t\t\tmatcherOut = matcher ?\n\t\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n\t\t\t\tpostFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n\t\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t\t[] :\n\n\t\t\t\t\t// ...otherwise use results directly\n\t\t\t\t\tresults :\n\t\t\t\tmatcherIn;\n\n\t\t// Find primary matches\n\t\tif ( matcher ) {\n\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t}\n\n\t\t// Apply postFilter\n\t\tif ( postFilter ) {\n\t\t\ttemp = condense( matcherOut, postMap );\n\t\t\tpostFilter( temp, [], context, xml );\n\n\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\ti = temp.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( (elem = temp[i]) ) {\n\t\t\t\t\tmatcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( seed ) {\n\t\t\tif ( postFinder || preFilter ) {\n\t\t\t\tif ( postFinder ) {\n\t\t\t\t\t// Get the final matcherOut by condensing this intermediate into postFinder contexts\n\t\t\t\t\ttemp = [];\n\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = matcherOut[i]) ) {\n\t\t\t\t\t\t\t// Restore matcherIn since elem is not yet a final match\n\t\t\t\t\t\t\ttemp.push( (matcherIn[i] = elem) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpostFinder( null, (matcherOut = []), temp, xml );\n\t\t\t\t}\n\n\t\t\t\t// Move matched elements from seed to results to keep them synchronized\n\t\t\t\ti = matcherOut.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( (elem = matcherOut[i]) &&\n\t\t\t\t\t\t(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {\n\n\t\t\t\t\t\tseed[temp] = !(results[temp] = elem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Add elements to results, through postFinder if defined\n\t\t} else {\n\t\t\tmatcherOut = condense(\n\t\t\t\tmatcherOut === results ?\n\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\tmatcherOut\n\t\t\t);\n\t\t\tif ( postFinder ) {\n\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t} else {\n\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction matcherFromTokens( tokens ) {\n\tvar checkContext, matcher, j,\n\t\tlen = tokens.length,\n\t\tleadingRelative = Expr.relative[ tokens[0].type ],\n\t\timplicitRelative = leadingRelative || Expr.relative[\" \"],\n\t\ti = leadingRelative ? 1 : 0,\n\n\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\treturn elem === checkContext;\n\t\t}, implicitRelative, true ),\n\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\treturn indexOf.call( checkContext, elem ) > -1;\n\t\t}, implicitRelative, true ),\n\t\tmatchers = [ function( elem, context, xml ) {\n\t\t\treturn ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n\t\t\t\t(checkContext = context).nodeType ?\n\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\t\t} ];\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n\t\t\tmatchers = [ addCombinator(elementMatcher( matchers ), matcher) ];\n\t\t} else {\n\t\t\tmatcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\n\t\t\t// Return special upon seeing a positional matcher\n\t\t\tif ( matcher[ expando ] ) {\n\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\tj = ++i;\n\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\tif ( Expr.relative[ tokens[j].type ] ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn setMatcher(\n\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\ti > 1 && toSelector(\n\t\t\t\t\t\t// If the preceding token was a descendant combinator, insert an implicit any-element `*`\n\t\t\t\t\t\ttokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === \" \" ? \"*\" : \"\" })\n\t\t\t\t\t).replace( rtrim, \"$1\" ),\n\t\t\t\t\tmatcher,\n\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\tj < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n\t\t\t\t\tj < len && toSelector( tokens )\n\t\t\t\t);\n\t\t\t}\n\t\t\tmatchers.push( matcher );\n\t\t}\n\t}\n\n\treturn elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\t// A counter to specify which element is currently being matched\n\tvar matcherCachedRuns = 0,\n\t\tbySet = setMatchers.length > 0,\n\t\tbyElement = elementMatchers.length > 0,\n\t\tsuperMatcher = function( seed, context, xml, results, expandContext ) {\n\t\t\tvar elem, j, matcher,\n\t\t\t\tsetMatched = [],\n\t\t\t\tmatchedCount = 0,\n\t\t\t\ti = \"0\",\n\t\t\t\tunmatched = seed && [],\n\t\t\t\toutermost = expandContext != null,\n\t\t\t\tcontextBackup = outermostContext,\n\t\t\t\t// We must always have either seed elements or context\n\t\t\t\telems = seed || byElement && Expr.find[\"TAG\"]( \"*\", expandContext && context.parentNode || context ),\n\t\t\t\t// Use integer dirruns iff this is the outermost matcher\n\t\t\t\tdirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);\n\n\t\t\tif ( outermost ) {\n\t\t\t\toutermostContext = context !== document && context;\n\t\t\t\tcachedruns = matcherCachedRuns;\n\t\t\t}\n\n\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\t// Keep `i` a string if there are no elements so `matchedCount` will be \"00\" below\n\t\t\tfor ( ; (elem = elems[i]) != null; i++ ) {\n\t\t\t\tif ( byElement && elem ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( (matcher = elementMatchers[j++]) ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( outermost ) {\n\t\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\t\tcachedruns = ++matcherCachedRuns;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Track unmatched elements for set filters\n\t\t\t\tif ( bySet ) {\n\t\t\t\t\t// They will have gone through all possible matchers\n\t\t\t\t\tif ( (elem = !matcher && elem) ) {\n\t\t\t\t\t\tmatchedCount--;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Lengthen the array for every element, matched or not\n\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\tunmatched.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Apply set filters to unmatched elements\n\t\t\tmatchedCount += i;\n\t\t\tif ( bySet && i !== matchedCount ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( (matcher = setMatchers[j++]) ) {\n\t\t\t\t\tmatcher( unmatched, setMatched, context, xml );\n\t\t\t\t}\n\n\t\t\t\tif ( seed ) {\n\t\t\t\t\t// Reintegrate element matches to eliminate the need for sorting\n\t\t\t\t\tif ( matchedCount > 0 ) {\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( !(unmatched[i] || setMatched[i]) ) {\n\t\t\t\t\t\t\t\tsetMatched[i] = pop.call( results );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Discard index placeholder values to get only actual matches\n\t\t\t\t\tsetMatched = condense( setMatched );\n\t\t\t\t}\n\n\t\t\t\t// Add matches to results\n\t\t\t\tpush.apply( results, setMatched );\n\n\t\t\t\t// Seedless set matches succeeding multiple successful matchers stipulate sorting\n\t\t\t\tif ( outermost && !seed && setMatched.length > 0 &&\n\t\t\t\t\t( matchedCount + setMatchers.length ) > 1 ) {\n\n\t\t\t\t\tSizzle.uniqueSort( results );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Override manipulation of globals by nested matchers\n\t\t\tif ( outermost ) {\n\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\toutermostContext = contextBackup;\n\t\t\t}\n\n\t\t\treturn unmatched;\n\t\t};\n\n\treturn bySet ?\n\t\tmarkFunction( superMatcher ) :\n\t\tsuperMatcher;\n}\n\ncompile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {\n\tvar i,\n\t\tsetMatchers = [],\n\t\telementMatchers = [],\n\t\tcached = compilerCache[ selector + \" \" ];\n\n\tif ( !cached ) {\n\t\t// Generate a function of recursive functions that can be used to check each element\n\t\tif ( !group ) {\n\t\t\tgroup = tokenize( selector );\n\t\t}\n\t\ti = group.length;\n\t\twhile ( i-- ) {\n\t\t\tcached = matcherFromTokens( group[i] );\n\t\t\tif ( cached[ expando ] ) {\n\t\t\t\tsetMatchers.push( cached );\n\t\t\t} else {\n\t\t\t\telementMatchers.push( cached );\n\t\t\t}\n\t\t}\n\n\t\t// Cache the compiled function\n\t\tcached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\n\t}\n\treturn cached;\n};\n\nfunction multipleContexts( selector, contexts, results ) {\n\tvar i = 0,\n\t\tlen = contexts.length;\n\tfor ( ; i < len; i++ ) {\n\t\tSizzle( selector, contexts[i], results );\n\t}\n\treturn results;\n}\n\nfunction select( selector, context, results, seed ) {\n\tvar i, tokens, token, type, find,\n\t\tmatch = tokenize( selector );\n\n\tif ( !seed ) {\n\t\t// Try to minimize operations if there is only one group\n\t\tif ( match.length === 1 ) {\n\n\t\t\t// Take a shortcut and set the context if the root selector is an ID\n\t\t\ttokens = match[0] = match[0].slice( 0 );\n\t\t\tif ( tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n\t\t\t\t\tsupport.getById && context.nodeType === 9 && documentIsHTML &&\n\t\t\t\t\tExpr.relative[ tokens[1].type ] ) {\n\n\t\t\t\tcontext = ( Expr.find[\"ID\"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];\n\t\t\t\tif ( !context ) {\n\t\t\t\t\treturn results;\n\t\t\t\t}\n\t\t\t\tselector = selector.slice( tokens.shift().value.length );\n\t\t\t}\n\n\t\t\t// Fetch a seed set for right-to-left matching\n\t\t\ti = matchExpr[\"needsContext\"].test( selector ) ? 0 : tokens.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\ttoken = tokens[i];\n\n\t\t\t\t// Abort if we hit a combinator\n\t\t\t\tif ( Expr.relative[ (type = token.type) ] ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( (find = Expr.find[ type ]) ) {\n\t\t\t\t\t// Search, expanding context for leading sibling combinators\n\t\t\t\t\tif ( (seed = find(\n\t\t\t\t\t\ttoken.matches[0].replace( runescape, funescape ),\n\t\t\t\t\t\trsibling.test( tokens[0].type ) && context.parentNode || context\n\t\t\t\t\t)) ) {\n\n\t\t\t\t\t\t// If seed is empty or no tokens remain, we can return early\n\t\t\t\t\t\ttokens.splice( i, 1 );\n\t\t\t\t\t\tselector = seed.length && toSelector( tokens );\n\t\t\t\t\t\tif ( !selector ) {\n\t\t\t\t\t\t\tpush.apply( results, seed );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compile and execute a filtering function\n\t// Provide `match` to avoid retokenization if we modified the selector above\n\tcompile( selector, match )(\n\t\tseed,\n\t\tcontext,\n\t\t!documentIsHTML,\n\t\tresults,\n\t\trsibling.test( selector )\n\t);\n\treturn results;\n}\n\n// One-time assignments\n\n// Sort stability\nsupport.sortStable = expando.split(\"\").sort( sortOrder ).join(\"\") === expando;\n\n// Support: Chrome<14\n// Always assume duplicates if they aren't passed to the comparison function\nsupport.detectDuplicates = hasDuplicate;\n\n// Initialize against the default document\nsetDocument();\n\n// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)\n// Detached nodes confoundingly follow *each other*\nsupport.sortDetached = assert(function( div1 ) {\n\t// Should return 1, but returns 4 (following)\n\treturn div1.compareDocumentPosition( document.createElement(\"div\") ) & 1;\n});\n\n// Support: IE<8\n// Prevent attribute/property \"interpolation\"\n// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx\nif ( !assert(function( div ) {\n\tdiv.innerHTML = \"<a href='#'></a>\";\n\treturn div.firstChild.getAttribute(\"href\") === \"#\" ;\n}) ) {\n\taddHandle( \"type|href|height|width\", function( elem, name, isXML ) {\n\t\tif ( !isXML ) {\n\t\t\treturn elem.getAttribute( name, name.toLowerCase() === \"type\" ? 1 : 2 );\n\t\t}\n\t});\n}\n\n// Support: IE<9\n// Use defaultValue in place of getAttribute(\"value\")\nif ( !support.attributes || !assert(function( div ) {\n\tdiv.innerHTML = \"<input/>\";\n\tdiv.firstChild.setAttribute( \"value\", \"\" );\n\treturn div.firstChild.getAttribute( \"value\" ) === \"\";\n}) ) {\n\taddHandle( \"value\", function( elem, name, isXML ) {\n\t\tif ( !isXML && elem.nodeName.toLowerCase() === \"input\" ) {\n\t\t\treturn elem.defaultValue;\n\t\t}\n\t});\n}\n\n// Support: IE<9\n// Use getAttributeNode to fetch booleans when getAttribute lies\nif ( !assert(function( div ) {\n\treturn div.getAttribute(\"disabled\") == null;\n}) ) {\n\taddHandle( booleans, function( elem, name, isXML ) {\n\t\tvar val;\n\t\tif ( !isXML ) {\n\t\t\treturn (val = elem.getAttributeNode( name )) && val.specified ?\n\t\t\t\tval.value :\n\t\t\t\telem[ name ] === true ? name.toLowerCase() : null;\n\t\t}\n\t});\n}\n\njQuery.find = Sizzle;\njQuery.expr = Sizzle.selectors;\njQuery.expr[\":\"] = jQuery.expr.pseudos;\njQuery.unique = Sizzle.uniqueSort;\njQuery.text = Sizzle.getText;\njQuery.isXMLDoc = Sizzle.isXML;\njQuery.contains = Sizzle.contains;\n\n\n})( window );\n// String to Object options format cache\nvar optionsCache = {};\n\n// Convert String-formatted options into Object-formatted ones and store in cache\nfunction createOptions( options ) {\n\tvar object = optionsCache[ options ] = {};\n\tjQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {\n\t\tobject[ flag ] = true;\n\t});\n\treturn object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n\t// Convert options from String-formatted to Object-formatted if needed\n\t// (we check in cache first)\n\toptions = typeof options === \"string\" ?\n\t\t( optionsCache[ options ] || createOptions( options ) ) :\n\t\tjQuery.extend( {}, options );\n\n\tvar // Last fire value (for non-forgettable lists)\n\t\tmemory,\n\t\t// Flag to know if list was already fired\n\t\tfired,\n\t\t// Flag to know if list is currently firing\n\t\tfiring,\n\t\t// First callback to fire (used internally by add and fireWith)\n\t\tfiringStart,\n\t\t// End of the loop when firing\n\t\tfiringLength,\n\t\t// Index of currently firing callback (modified by remove if needed)\n\t\tfiringIndex,\n\t\t// Actual callback list\n\t\tlist = [],\n\t\t// Stack of fire calls for repeatable lists\n\t\tstack = !options.once && [],\n\t\t// Fire callbacks\n\t\tfire = function( data ) {\n\t\t\tmemory = options.memory && data;\n\t\t\tfired = true;\n\t\t\tfiringIndex = firingStart || 0;\n\t\t\tfiringStart = 0;\n\t\t\tfiringLength = list.length;\n\t\t\tfiring = true;\n\t\t\tfor ( ; list && firingIndex < firingLength; firingIndex++ ) {\n\t\t\t\tif ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {\n\t\t\t\t\tmemory = false; // To prevent further calls using add\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfiring = false;\n\t\t\tif ( list ) {\n\t\t\t\tif ( stack ) {\n\t\t\t\t\tif ( stack.length ) {\n\t\t\t\t\t\tfire( stack.shift() );\n\t\t\t\t\t}\n\t\t\t\t} else if ( memory ) {\n\t\t\t\t\tlist = [];\n\t\t\t\t} else {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Actual Callbacks object\n\t\tself = {\n\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\tadd: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\t// First, we save the current length\n\t\t\t\t\tvar start = list.length;\n\t\t\t\t\t(function add( args ) {\n\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\tvar type = jQuery.type( arg );\n\t\t\t\t\t\t\tif ( type === \"function\" ) {\n\t\t\t\t\t\t\t\tif ( !options.unique || !self.has( arg ) ) {\n\t\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ( arg && arg.length && type !== \"string\" ) {\n\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t})( arguments );\n\t\t\t\t\t// Do we need to add the callbacks to the\n\t\t\t\t\t// current firing batch?\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tfiringLength = list.length;\n\t\t\t\t\t// With memory, if we're not firing then\n\t\t\t\t\t// we should call right away\n\t\t\t\t\t} else if ( memory ) {\n\t\t\t\t\t\tfiringStart = start;\n\t\t\t\t\t\tfire( memory );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Remove a callback from the list\n\t\t\tremove: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\t\tvar index;\n\t\t\t\t\t\twhile( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\t\tlist.splice( index, 1 );\n\t\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\t\t\tif ( index <= firingLength ) {\n\t\t\t\t\t\t\t\t\tfiringLength--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Check if a given callback is in the list.\n\t\t\t// If no argument is given, return whether or not list has callbacks attached.\n\t\t\thas: function( fn ) {\n\t\t\t\treturn fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );\n\t\t\t},\n\t\t\t// Remove all callbacks from the list\n\t\t\tempty: function() {\n\t\t\t\tlist = [];\n\t\t\t\tfiringLength = 0;\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Have the list do nothing anymore\n\t\t\tdisable: function() {\n\t\t\t\tlist = stack = memory = undefined;\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it disabled?\n\t\t\tdisabled: function() {\n\t\t\t\treturn !list;\n\t\t\t},\n\t\t\t// Lock the list in its current state\n\t\t\tlock: function() {\n\t\t\t\tstack = undefined;\n\t\t\t\tif ( !memory ) {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it locked?\n\t\t\tlocked: function() {\n\t\t\t\treturn !stack;\n\t\t\t},\n\t\t\t// Call all callbacks with the given context and arguments\n\t\t\tfireWith: function( context, args ) {\n\t\t\t\tif ( list && ( !fired || stack ) ) {\n\t\t\t\t\targs = args || [];\n\t\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tstack.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfire( args );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Call all the callbacks with the given arguments\n\t\t\tfire: function() {\n\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// To know if the callbacks have already been called at least once\n\t\t\tfired: function() {\n\t\t\t\treturn !!fired;\n\t\t\t}\n\t\t};\n\n\treturn self;\n};\njQuery.extend({\n\n\tDeferred: function( func ) {\n\t\tvar tuples = [\n\t\t\t\t// action, add listener, listener list, final state\n\t\t\t\t[ \"resolve\", \"done\", jQuery.Callbacks(\"once memory\"), \"resolved\" ],\n\t\t\t\t[ \"reject\", \"fail\", jQuery.Callbacks(\"once memory\"), \"rejected\" ],\n\t\t\t\t[ \"notify\", \"progress\", jQuery.Callbacks(\"memory\") ]\n\t\t\t],\n\t\t\tstate = \"pending\",\n\t\t\tpromise = {\n\t\t\t\tstate: function() {\n\t\t\t\t\treturn state;\n\t\t\t\t},\n\t\t\t\talways: function() {\n\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tthen: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\tvar fns = arguments;\n\t\t\t\t\treturn jQuery.Deferred(function( newDefer ) {\n\t\t\t\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\t\t\t\t\tvar action = tuple[ 0 ],\n\t\t\t\t\t\t\t\tfn = jQuery.isFunction( fns[ i ] ) && fns[ i ];\n\t\t\t\t\t\t\t// deferred[ done | fail | progress ] for forwarding actions to newDefer\n\t\t\t\t\t\t\tdeferred[ tuple[1] ](function() {\n\t\t\t\t\t\t\t\tvar returned = fn && fn.apply( this, arguments );\n\t\t\t\t\t\t\t\tif ( returned && jQuery.isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject )\n\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnewDefer[ action + \"With\" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfns = null;\n\t\t\t\t\t}).promise();\n\t\t\t\t},\n\t\t\t\t// Get a promise for this deferred\n\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeferred = {};\n\n\t\t// Keep pipe for back-compat\n\t\tpromise.pipe = promise.then;\n\n\t\t// Add list-specific methods\n\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\tvar list = tuple[ 2 ],\n\t\t\t\tstateString = tuple[ 3 ];\n\n\t\t\t// promise[ done | fail | progress ] = list.add\n\t\t\tpromise[ tuple[1] ] = list.add;\n\n\t\t\t// Handle state\n\t\t\tif ( stateString ) {\n\t\t\t\tlist.add(function() {\n\t\t\t\t\t// state = [ resolved | rejected ]\n\t\t\t\t\tstate = stateString;\n\n\t\t\t\t// [ reject_list | resolve_list ].disable; progress_list.lock\n\t\t\t\t}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );\n\t\t\t}\n\n\t\t\t// deferred[ resolve | reject | notify ]\n\t\t\tdeferred[ tuple[0] ] = function() {\n\t\t\t\tdeferred[ tuple[0] + \"With\" ]( this === deferred ? promise : this, arguments );\n\t\t\t\treturn this;\n\t\t\t};\n\t\t\tdeferred[ tuple[0] + \"With\" ] = list.fireWith;\n\t\t});\n\n\t\t// Make the deferred a promise\n\t\tpromise.promise( deferred );\n\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\n\t\t// All done!\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( subordinate /* , ..., subordinateN */ ) {\n\t\tvar i = 0,\n\t\t\tresolveValues = core_slice.call( arguments ),\n\t\t\tlength = resolveValues.length,\n\n\t\t\t// the count of uncompleted subordinates\n\t\t\tremaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,\n\n\t\t\t// the master Deferred. If resolveValues consist of only a single Deferred, just use that.\n\t\t\tdeferred = remaining === 1 ? subordinate : jQuery.Deferred(),\n\n\t\t\t// Update function for both resolve and progress values\n\t\t\tupdateFunc = function( i, contexts, values ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tcontexts[ i ] = this;\n\t\t\t\t\tvalues[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;\n\t\t\t\t\tif( values === progressValues ) {\n\t\t\t\t\t\tdeferred.notifyWith( contexts, values );\n\t\t\t\t\t} else if ( !( --remaining ) ) {\n\t\t\t\t\t\tdeferred.resolveWith( contexts, values );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tprogressValues, progressContexts, resolveContexts;\n\n\t\t// add listeners to Deferred subordinates; treat others as resolved\n\t\tif ( length > 1 ) {\n\t\t\tprogressValues = new Array( length );\n\t\t\tprogressContexts = new Array( length );\n\t\t\tresolveContexts = new Array( length );\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {\n\t\t\t\t\tresolveValues[ i ].promise()\n\t\t\t\t\t\t.done( updateFunc( i, resolveContexts, resolveValues ) )\n\t\t\t\t\t\t.fail( deferred.reject )\n\t\t\t\t\t\t.progress( updateFunc( i, progressContexts, progressValues ) );\n\t\t\t\t} else {\n\t\t\t\t\t--remaining;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if we're not waiting on anything, resolve the master\n\t\tif ( !remaining ) {\n\t\t\tdeferred.resolveWith( resolveContexts, resolveValues );\n\t\t}\n\n\t\treturn deferred.promise();\n\t}\n});\njQuery.support = (function( support ) {\n\tvar input = document.createElement(\"input\"),\n\t\tfragment = document.createDocumentFragment(),\n\t\tdiv = document.createElement(\"div\"),\n\t\tselect = document.createElement(\"select\"),\n\t\topt = select.appendChild( document.createElement(\"option\") );\n\n\t// Finish early in limited environments\n\tif ( !input.type ) {\n\t\treturn support;\n\t}\n\n\tinput.type = \"checkbox\";\n\n\t// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3\n\t// Check the default checkbox/radio value (\"\" on old WebKit; \"on\" elsewhere)\n\tsupport.checkOn = input.value !== \"\";\n\n\t// Must access the parent to make an option select properly\n\t// Support: IE9, IE10\n\tsupport.optSelected = opt.selected;\n\n\t// Will be defined later\n\tsupport.reliableMarginRight = true;\n\tsupport.boxSizingReliable = true;\n\tsupport.pixelPosition = false;\n\n\t// Make sure checked status is properly cloned\n\t// Support: IE9, IE10\n\tinput.checked = true;\n\tsupport.noCloneChecked = input.cloneNode( true ).checked;\n\n\t// Make sure that the options inside disabled selects aren't marked as disabled\n\t// (WebKit marks them as disabled)\n\tselect.disabled = true;\n\tsupport.optDisabled = !opt.disabled;\n\n\t// Check if an input maintains its value after becoming a radio\n\t// Support: IE9, IE10\n\tinput = document.createElement(\"input\");\n\tinput.value = \"t\";\n\tinput.type = \"radio\";\n\tsupport.radioValue = input.value === \"t\";\n\n\t// #11217 - WebKit loses check when the name is after the checked attribute\n\tinput.setAttribute( \"checked\", \"t\" );\n\tinput.setAttribute( \"name\", \"t\" );\n\n\tfragment.appendChild( input );\n\n\t// Support: Safari 5.1, Android 4.x, Android 2.3\n\t// old WebKit doesn't clone checked state correctly in fragments\n\tsupport.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\n\t// Support: Firefox, Chrome, Safari\n\t// Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP)\n\tsupport.focusinBubbles = \"onfocusin\" in window;\n\n\tdiv.style.backgroundClip = \"content-box\";\n\tdiv.cloneNode( true ).style.backgroundClip = \"\";\n\tsupport.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n\n\t// Run tests that need a body at doc ready\n\tjQuery(function() {\n\t\tvar container, marginDiv,\n\t\t\t// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).\n\t\t\tdivReset = \"padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box\",\n\t\t\tbody = document.getElementsByTagName(\"body\")[ 0 ];\n\n\t\tif ( !body ) {\n\t\t\t// Return for frameset docs that don't have a body\n\t\t\treturn;\n\t\t}\n\n\t\tcontainer = document.createElement(\"div\");\n\t\tcontainer.style.cssText = \"border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px\";\n\n\t\t// Check box-sizing and margin behavior.\n\t\tbody.appendChild( container ).appendChild( div );\n\t\tdiv.innerHTML = \"\";\n\t\t// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).\n\t\tdiv.style.cssText = \"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%\";\n\n\t\t// Workaround failing boxSizing test due to offsetWidth returning wrong value\n\t\t// with some non-1 values of body zoom, ticket #13543\n\t\tjQuery.swap( body, body.style.zoom != null ? { zoom: 1 } : {}, function() {\n\t\t\tsupport.boxSizing = div.offsetWidth === 4;\n\t\t});\n\n\t\t// Use window.getComputedStyle because jsdom on node.js will break without it.\n\t\tif ( window.getComputedStyle ) {\n\t\t\tsupport.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== \"1%\";\n\t\t\tsupport.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: \"4px\" } ).width === \"4px\";\n\n\t\t\t// Support: Android 2.3\n\t\t\t// Check if div with explicit width and no margin-right incorrectly\n\t\t\t// gets computed margin-right based on width of container. (#3333)\n\t\t\t// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n\t\t\tmarginDiv = div.appendChild( document.createElement(\"div\") );\n\t\t\tmarginDiv.style.cssText = div.style.cssText = divReset;\n\t\t\tmarginDiv.style.marginRight = marginDiv.style.width = \"0\";\n\t\t\tdiv.style.width = \"1px\";\n\n\t\t\tsupport.reliableMarginRight =\n\t\t\t\t!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );\n\t\t}\n\n\t\tbody.removeChild( container );\n\t});\n\n\treturn support;\n})( {} );\n\n/*\n\tImplementation Summary\n\n\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n\t2. Improve the module's maintainability by reducing the storage\n\t\tpaths to a single mechanism.\n\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n*/\nvar data_user, data_priv,\n\trbrace = /(?:\\{[\\s\\S]*\\}|\\[[\\s\\S]*\\])$/,\n\trmultiDash = /([A-Z])/g;\n\nfunction Data() {\n\t// Support: Android < 4,\n\t// Old WebKit does not have Object.preventExtensions/freeze method,\n\t// return new empty object instead with no [[set]] accessor\n\tObject.defineProperty( this.cache = {}, 0, {\n\t\tget: function() {\n\t\t\treturn {};\n\t\t}\n\t});\n\n\tthis.expando = jQuery.expando + Math.random();\n}\n\nData.uid = 1;\n\nData.accepts = function( owner ) {\n\t// Accepts only:\n\t//  - Node\n\t//    - Node.ELEMENT_NODE\n\t//    - Node.DOCUMENT_NODE\n\t//  - Object\n\t//    - Any\n\treturn owner.nodeType ?\n\t\towner.nodeType === 1 || owner.nodeType === 9 : true;\n};\n\nData.prototype = {\n\tkey: function( owner ) {\n\t\t// We can accept data for non-element nodes in modern browsers,\n\t\t// but we should not, see #8335.\n\t\t// Always return the key for a frozen object.\n\t\tif ( !Data.accepts( owner ) ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar descriptor = {},\n\t\t\t// Check if the owner object already has a cache key\n\t\t\tunlock = owner[ this.expando ];\n\n\t\t// If not, create one\n\t\tif ( !unlock ) {\n\t\t\tunlock = Data.uid++;\n\n\t\t\t// Secure it in a non-enumerable, non-writable property\n\t\t\ttry {\n\t\t\t\tdescriptor[ this.expando ] = { value: unlock };\n\t\t\t\tObject.defineProperties( owner, descriptor );\n\n\t\t\t// Support: Android < 4\n\t\t\t// Fallback to a less secure definition\n\t\t\t} catch ( e ) {\n\t\t\t\tdescriptor[ this.expando ] = unlock;\n\t\t\t\tjQuery.extend( owner, descriptor );\n\t\t\t}\n\t\t}\n\n\t\t// Ensure the cache object\n\t\tif ( !this.cache[ unlock ] ) {\n\t\t\tthis.cache[ unlock ] = {};\n\t\t}\n\n\t\treturn unlock;\n\t},\n\tset: function( owner, data, value ) {\n\t\tvar prop,\n\t\t\t// There may be an unlock assigned to this node,\n\t\t\t// if there is no entry for this \"owner\", create one inline\n\t\t\t// and set the unlock as though an owner entry had always existed\n\t\t\tunlock = this.key( owner ),\n\t\t\tcache = this.cache[ unlock ];\n\n\t\t// Handle: [ owner, key, value ] args\n\t\tif ( typeof data === \"string\" ) {\n\t\t\tcache[ data ] = value;\n\n\t\t// Handle: [ owner, { properties } ] args\n\t\t} else {\n\t\t\t// Fresh assignments by object are shallow copied\n\t\t\tif ( jQuery.isEmptyObject( cache ) ) {\n\t\t\t\tjQuery.extend( this.cache[ unlock ], data );\n\t\t\t// Otherwise, copy the properties one-by-one to the cache object\n\t\t\t} else {\n\t\t\t\tfor ( prop in data ) {\n\t\t\t\t\tcache[ prop ] = data[ prop ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn cache;\n\t},\n\tget: function( owner, key ) {\n\t\t// Either a valid cache is found, or will be created.\n\t\t// New caches will be created and the unlock returned,\n\t\t// allowing direct access to the newly created\n\t\t// empty data object. A valid owner object must be provided.\n\t\tvar cache = this.cache[ this.key( owner ) ];\n\n\t\treturn key === undefined ?\n\t\t\tcache : cache[ key ];\n\t},\n\taccess: function( owner, key, value ) {\n\t\tvar stored;\n\t\t// In cases where either:\n\t\t//\n\t\t//   1. No key was specified\n\t\t//   2. A string key was specified, but no value provided\n\t\t//\n\t\t// Take the \"read\" path and allow the get method to determine\n\t\t// which value to return, respectively either:\n\t\t//\n\t\t//   1. The entire cache object\n\t\t//   2. The data stored at the key\n\t\t//\n\t\tif ( key === undefined ||\n\t\t\t\t((key && typeof key === \"string\") && value === undefined) ) {\n\n\t\t\tstored = this.get( owner, key );\n\n\t\t\treturn stored !== undefined ?\n\t\t\t\tstored : this.get( owner, jQuery.camelCase(key) );\n\t\t}\n\n\t\t// [*]When the key is not a string, or both a key and value\n\t\t// are specified, set or extend (existing objects) with either:\n\t\t//\n\t\t//   1. An object of properties\n\t\t//   2. A key and value\n\t\t//\n\t\tthis.set( owner, key, value );\n\n\t\t// Since the \"set\" path can have two possible entry points\n\t\t// return the expected data based on which path was taken[*]\n\t\treturn value !== undefined ? value : key;\n\t},\n\tremove: function( owner, key ) {\n\t\tvar i, name, camel,\n\t\t\tunlock = this.key( owner ),\n\t\t\tcache = this.cache[ unlock ];\n\n\t\tif ( key === undefined ) {\n\t\t\tthis.cache[ unlock ] = {};\n\n\t\t} else {\n\t\t\t// Support array or space separated string of keys\n\t\t\tif ( jQuery.isArray( key ) ) {\n\t\t\t\t// If \"name\" is an array of keys...\n\t\t\t\t// When data is initially created, via (\"key\", \"val\") signature,\n\t\t\t\t// keys will be converted to camelCase.\n\t\t\t\t// Since there is no way to tell _how_ a key was added, remove\n\t\t\t\t// both plain key and camelCase key. #12786\n\t\t\t\t// This will only penalize the array argument path.\n\t\t\t\tname = key.concat( key.map( jQuery.camelCase ) );\n\t\t\t} else {\n\t\t\t\tcamel = jQuery.camelCase( key );\n\t\t\t\t// Try the string as a key before any manipulation\n\t\t\t\tif ( key in cache ) {\n\t\t\t\t\tname = [ key, camel ];\n\t\t\t\t} else {\n\t\t\t\t\t// If a key with the spaces exists, use it.\n\t\t\t\t\t// Otherwise, create an array by matching non-whitespace\n\t\t\t\t\tname = camel;\n\t\t\t\t\tname = name in cache ?\n\t\t\t\t\t\t[ name ] : ( name.match( core_rnotwhite ) || [] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ti = name.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tdelete cache[ name[ i ] ];\n\t\t\t}\n\t\t}\n\t},\n\thasData: function( owner ) {\n\t\treturn !jQuery.isEmptyObject(\n\t\t\tthis.cache[ owner[ this.expando ] ] || {}\n\t\t);\n\t},\n\tdiscard: function( owner ) {\n\t\tif ( owner[ this.expando ] ) {\n\t\t\tdelete this.cache[ owner[ this.expando ] ];\n\t\t}\n\t}\n};\n\n// These may be used throughout the jQuery core codebase\ndata_user = new Data();\ndata_priv = new Data();\n\n\njQuery.extend({\n\tacceptData: Data.accepts,\n\n\thasData: function( elem ) {\n\t\treturn data_user.hasData( elem ) || data_priv.hasData( elem );\n\t},\n\n\tdata: function( elem, name, data ) {\n\t\treturn data_user.access( elem, name, data );\n\t},\n\n\tremoveData: function( elem, name ) {\n\t\tdata_user.remove( elem, name );\n\t},\n\n\t// TODO: Now that all calls to _data and _removeData have been replaced\n\t// with direct calls to data_priv methods, these can be deprecated.\n\t_data: function( elem, name, data ) {\n\t\treturn data_priv.access( elem, name, data );\n\t},\n\n\t_removeData: function( elem, name ) {\n\t\tdata_priv.remove( elem, name );\n\t}\n});\n\njQuery.fn.extend({\n\tdata: function( key, value ) {\n\t\tvar attrs, name,\n\t\t\telem = this[ 0 ],\n\t\t\ti = 0,\n\t\t\tdata = null;\n\n\t\t// Gets all values\n\t\tif ( key === undefined ) {\n\t\t\tif ( this.length ) {\n\t\t\t\tdata = data_user.get( elem );\n\n\t\t\t\tif ( elem.nodeType === 1 && !data_priv.get( elem, \"hasDataAttrs\" ) ) {\n\t\t\t\t\tattrs = elem.attributes;\n\t\t\t\t\tfor ( ; i < attrs.length; i++ ) {\n\t\t\t\t\t\tname = attrs[ i ].name;\n\n\t\t\t\t\t\tif ( name.indexOf( \"data-\" ) === 0 ) {\n\t\t\t\t\t\t\tname = jQuery.camelCase( name.slice(5) );\n\t\t\t\t\t\t\tdataAttr( elem, name, data[ name ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdata_priv.set( elem, \"hasDataAttrs\", true );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}\n\n\t\t// Sets multiple values\n\t\tif ( typeof key === \"object\" ) {\n\t\t\treturn this.each(function() {\n\t\t\t\tdata_user.set( this, key );\n\t\t\t});\n\t\t}\n\n\t\treturn jQuery.access( this, function( value ) {\n\t\t\tvar data,\n\t\t\t\tcamelKey = jQuery.camelCase( key );\n\n\t\t\t// The calling jQuery object (element matches) is not empty\n\t\t\t// (and therefore has an element appears at this[ 0 ]) and the\n\t\t\t// `value` parameter was not undefined. An empty jQuery object\n\t\t\t// will result in `undefined` for elem = this[ 0 ] which will\n\t\t\t// throw an exception if an attempt to read a data cache is made.\n\t\t\tif ( elem && value === undefined ) {\n\t\t\t\t// Attempt to get data from the cache\n\t\t\t\t// with the key as-is\n\t\t\t\tdata = data_user.get( elem, key );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// Attempt to get data from the cache\n\t\t\t\t// with the key camelized\n\t\t\t\tdata = data_user.get( elem, camelKey );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// Attempt to \"discover\" the data in\n\t\t\t\t// HTML5 custom data-* attrs\n\t\t\t\tdata = dataAttr( elem, camelKey, undefined );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// We tried really hard, but the data doesn't exist.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the data...\n\t\t\tthis.each(function() {\n\t\t\t\t// First, attempt to store a copy or reference of any\n\t\t\t\t// data that might've been store with a camelCased key.\n\t\t\t\tvar data = data_user.get( this, camelKey );\n\n\t\t\t\t// For HTML5 data-* attribute interop, we have to\n\t\t\t\t// store property names with dashes in a camelCase form.\n\t\t\t\t// This might not apply to all properties...*\n\t\t\t\tdata_user.set( this, camelKey, value );\n\n\t\t\t\t// *... In the case of properties that might _actually_\n\t\t\t\t// have dashes, we need to also store a copy of that\n\t\t\t\t// unchanged property.\n\t\t\t\tif ( key.indexOf(\"-\") !== -1 && data !== undefined ) {\n\t\t\t\t\tdata_user.set( this, key, value );\n\t\t\t\t}\n\t\t\t});\n\t\t}, null, value, arguments.length > 1, null, true );\n\t},\n\n\tremoveData: function( key ) {\n\t\treturn this.each(function() {\n\t\t\tdata_user.remove( this, key );\n\t\t});\n\t}\n});\n\nfunction dataAttr( elem, key, data ) {\n\tvar name;\n\n\t// If nothing was found internally, try to fetch any\n\t// data from the HTML5 data-* attribute\n\tif ( data === undefined && elem.nodeType === 1 ) {\n\t\tname = \"data-\" + key.replace( rmultiDash, \"-$1\" ).toLowerCase();\n\t\tdata = elem.getAttribute( name );\n\n\t\tif ( typeof data === \"string\" ) {\n\t\t\ttry {\n\t\t\t\tdata = data === \"true\" ? true :\n\t\t\t\t\tdata === \"false\" ? false :\n\t\t\t\t\tdata === \"null\" ? null :\n\t\t\t\t\t// Only convert to a number if it doesn't change the string\n\t\t\t\t\t+data + \"\" === data ? +data :\n\t\t\t\t\trbrace.test( data ) ? JSON.parse( data ) :\n\t\t\t\t\tdata;\n\t\t\t} catch( e ) {}\n\n\t\t\t// Make sure we set the data so it isn't changed later\n\t\t\tdata_user.set( elem, key, data );\n\t\t} else {\n\t\t\tdata = undefined;\n\t\t}\n\t}\n\treturn data;\n}\njQuery.extend({\n\tqueue: function( elem, type, data ) {\n\t\tvar queue;\n\n\t\tif ( elem ) {\n\t\t\ttype = ( type || \"fx\" ) + \"queue\";\n\t\t\tqueue = data_priv.get( elem, type );\n\n\t\t\t// Speed up dequeue by getting out quickly if this is just a lookup\n\t\t\tif ( data ) {\n\t\t\t\tif ( !queue || jQuery.isArray( data ) ) {\n\t\t\t\t\tqueue = data_priv.access( elem, type, jQuery.makeArray(data) );\n\t\t\t\t} else {\n\t\t\t\t\tqueue.push( data );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn queue || [];\n\t\t}\n\t},\n\n\tdequeue: function( elem, type ) {\n\t\ttype = type || \"fx\";\n\n\t\tvar queue = jQuery.queue( elem, type ),\n\t\t\tstartLength = queue.length,\n\t\t\tfn = queue.shift(),\n\t\t\thooks = jQuery._queueHooks( elem, type ),\n\t\t\tnext = function() {\n\t\t\t\tjQuery.dequeue( elem, type );\n\t\t\t};\n\n\t\t// If the fx queue is dequeued, always remove the progress sentinel\n\t\tif ( fn === \"inprogress\" ) {\n\t\t\tfn = queue.shift();\n\t\t\tstartLength--;\n\t\t}\n\n\t\tif ( fn ) {\n\n\t\t\t// Add a progress sentinel to prevent the fx queue from being\n\t\t\t// automatically dequeued\n\t\t\tif ( type === \"fx\" ) {\n\t\t\t\tqueue.unshift( \"inprogress\" );\n\t\t\t}\n\n\t\t\t// clear up the last queue stop function\n\t\t\tdelete hooks.stop;\n\t\t\tfn.call( elem, next, hooks );\n\t\t}\n\n\t\tif ( !startLength && hooks ) {\n\t\t\thooks.empty.fire();\n\t\t}\n\t},\n\n\t// not intended for public consumption - generates a queueHooks object, or returns the current one\n\t_queueHooks: function( elem, type ) {\n\t\tvar key = type + \"queueHooks\";\n\t\treturn data_priv.get( elem, key ) || data_priv.access( elem, key, {\n\t\t\tempty: jQuery.Callbacks(\"once memory\").add(function() {\n\t\t\t\tdata_priv.remove( elem, [ type + \"queue\", key ] );\n\t\t\t})\n\t\t});\n\t}\n});\n\njQuery.fn.extend({\n\tqueue: function( type, data ) {\n\t\tvar setter = 2;\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tdata = type;\n\t\t\ttype = \"fx\";\n\t\t\tsetter--;\n\t\t}\n\n\t\tif ( arguments.length < setter ) {\n\t\t\treturn jQuery.queue( this[0], type );\n\t\t}\n\n\t\treturn data === undefined ?\n\t\t\tthis :\n\t\t\tthis.each(function() {\n\t\t\t\tvar queue = jQuery.queue( this, type, data );\n\n\t\t\t\t// ensure a hooks for this queue\n\t\t\t\tjQuery._queueHooks( this, type );\n\n\t\t\t\tif ( type === \"fx\" && queue[0] !== \"inprogress\" ) {\n\t\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t\t}\n\t\t\t});\n\t},\n\tdequeue: function( type ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.dequeue( this, type );\n\t\t});\n\t},\n\t// Based off of the plugin by Clint Helfers, with permission.\n\t// http://blindsignals.com/index.php/2009/07/jquery-delay/\n\tdelay: function( time, type ) {\n\t\ttime = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\n\t\ttype = type || \"fx\";\n\n\t\treturn this.queue( type, function( next, hooks ) {\n\t\t\tvar timeout = setTimeout( next, time );\n\t\t\thooks.stop = function() {\n\t\t\t\tclearTimeout( timeout );\n\t\t\t};\n\t\t});\n\t},\n\tclearQueue: function( type ) {\n\t\treturn this.queue( type || \"fx\", [] );\n\t},\n\t// Get a promise resolved when queues of a certain type\n\t// are emptied (fx is the type by default)\n\tpromise: function( type, obj ) {\n\t\tvar tmp,\n\t\t\tcount = 1,\n\t\t\tdefer = jQuery.Deferred(),\n\t\t\telements = this,\n\t\t\ti = this.length,\n\t\t\tresolve = function() {\n\t\t\t\tif ( !( --count ) ) {\n\t\t\t\t\tdefer.resolveWith( elements, [ elements ] );\n\t\t\t\t}\n\t\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tobj = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\ttype = type || \"fx\";\n\n\t\twhile( i-- ) {\n\t\t\ttmp = data_priv.get( elements[ i ], type + \"queueHooks\" );\n\t\t\tif ( tmp && tmp.empty ) {\n\t\t\t\tcount++;\n\t\t\t\ttmp.empty.add( resolve );\n\t\t\t}\n\t\t}\n\t\tresolve();\n\t\treturn defer.promise( obj );\n\t}\n});\nvar nodeHook, boolHook,\n\trclass = /[\\t\\r\\n\\f]/g,\n\trreturn = /\\r/g,\n\trfocusable = /^(?:input|select|textarea|button)$/i;\n\njQuery.fn.extend({\n\tattr: function( name, value ) {\n\t\treturn jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );\n\t},\n\n\tremoveAttr: function( name ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.removeAttr( this, name );\n\t\t});\n\t},\n\n\tprop: function( name, value ) {\n\t\treturn jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );\n\t},\n\n\tremoveProp: function( name ) {\n\t\treturn this.each(function() {\n\t\t\tdelete this[ jQuery.propFix[ name ] || name ];\n\t\t});\n\t},\n\n\taddClass: function( value ) {\n\t\tvar classes, elem, cur, clazz, j,\n\t\t\ti = 0,\n\t\t\tlen = this.length,\n\t\t\tproceed = typeof value === \"string\" && value;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call( this, j, this.className ) );\n\t\t\t});\n\t\t}\n\n\t\tif ( proceed ) {\n\t\t\t// The disjunction here is for better compressibility (see removeClass)\n\t\t\tclasses = ( value || \"\" ).match( core_rnotwhite ) || [];\n\n\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\telem = this[ i ];\n\t\t\t\tcur = elem.nodeType === 1 && ( elem.className ?\n\t\t\t\t\t( \" \" + elem.className + \" \" ).replace( rclass, \" \" ) :\n\t\t\t\t\t\" \"\n\t\t\t\t);\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( (clazz = classes[j++]) ) {\n\t\t\t\t\t\tif ( cur.indexOf( \" \" + clazz + \" \" ) < 0 ) {\n\t\t\t\t\t\t\tcur += clazz + \" \";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telem.className = jQuery.trim( cur );\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tremoveClass: function( value ) {\n\t\tvar classes, elem, cur, clazz, j,\n\t\t\ti = 0,\n\t\t\tlen = this.length,\n\t\t\tproceed = arguments.length === 0 || typeof value === \"string\" && value;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).removeClass( value.call( this, j, this.className ) );\n\t\t\t});\n\t\t}\n\t\tif ( proceed ) {\n\t\t\tclasses = ( value || \"\" ).match( core_rnotwhite ) || [];\n\n\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\telem = this[ i ];\n\t\t\t\t// This expression is here for better compressibility (see addClass)\n\t\t\t\tcur = elem.nodeType === 1 && ( elem.className ?\n\t\t\t\t\t( \" \" + elem.className + \" \" ).replace( rclass, \" \" ) :\n\t\t\t\t\t\"\"\n\t\t\t\t);\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( (clazz = classes[j++]) ) {\n\t\t\t\t\t\t// Remove *all* instances\n\t\t\t\t\t\twhile ( cur.indexOf( \" \" + clazz + \" \" ) >= 0 ) {\n\t\t\t\t\t\t\tcur = cur.replace( \" \" + clazz + \" \", \" \" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telem.className = value ? jQuery.trim( cur ) : \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\ttoggleClass: function( value, stateVal ) {\n\t\tvar type = typeof value;\n\n\t\tif ( typeof stateVal === \"boolean\" && type === \"string\" ) {\n\t\t\treturn stateVal ? this.addClass( value ) : this.removeClass( value );\n\t\t}\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tjQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );\n\t\t\t});\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tif ( type === \"string\" ) {\n\t\t\t\t// toggle individual class names\n\t\t\t\tvar className,\n\t\t\t\t\ti = 0,\n\t\t\t\t\tself = jQuery( this ),\n\t\t\t\t\tclassNames = value.match( core_rnotwhite ) || [];\n\n\t\t\t\twhile ( (className = classNames[ i++ ]) ) {\n\t\t\t\t\t// check each className given, space separated list\n\t\t\t\t\tif ( self.hasClass( className ) ) {\n\t\t\t\t\t\tself.removeClass( className );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.addClass( className );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// Toggle whole class name\n\t\t\t} else if ( type === core_strundefined || type === \"boolean\" ) {\n\t\t\t\tif ( this.className ) {\n\t\t\t\t\t// store className if set\n\t\t\t\t\tdata_priv.set( this, \"__className__\", this.className );\n\t\t\t\t}\n\n\t\t\t\t// If the element has a class name or if we're passed \"false\",\n\t\t\t\t// then remove the whole classname (if there was one, the above saved it).\n\t\t\t\t// Otherwise bring back whatever was previously saved (if anything),\n\t\t\t\t// falling back to the empty string if nothing was stored.\n\t\t\t\tthis.className = this.className || value === false ? \"\" : data_priv.get( this, \"__className__\" ) || \"\";\n\t\t\t}\n\t\t});\n\t},\n\n\thasClass: function( selector ) {\n\t\tvar className = \" \" + selector + \" \",\n\t\t\ti = 0,\n\t\t\tl = this.length;\n\t\tfor ( ; i < l; i++ ) {\n\t\t\tif ( this[i].nodeType === 1 && (\" \" + this[i].className + \" \").replace(rclass, \" \").indexOf( className ) >= 0 ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t},\n\n\tval: function( value ) {\n\t\tvar hooks, ret, isFunction,\n\t\t\telem = this[0];\n\n\t\tif ( !arguments.length ) {\n\t\t\tif ( elem ) {\n\t\t\t\thooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];\n\n\t\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, \"value\" )) !== undefined ) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\n\t\t\t\tret = elem.value;\n\n\t\t\t\treturn typeof ret === \"string\" ?\n\t\t\t\t\t// handle most common string cases\n\t\t\t\t\tret.replace(rreturn, \"\") :\n\t\t\t\t\t// handle cases where value is null/undef or number\n\t\t\t\t\tret == null ? \"\" : ret;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tisFunction = jQuery.isFunction( value );\n\n\t\treturn this.each(function( i ) {\n\t\t\tvar val;\n\n\t\t\tif ( this.nodeType !== 1 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isFunction ) {\n\t\t\t\tval = value.call( this, i, jQuery( this ).val() );\n\t\t\t} else {\n\t\t\t\tval = value;\n\t\t\t}\n\n\t\t\t// Treat null/undefined as \"\"; convert numbers to string\n\t\t\tif ( val == null ) {\n\t\t\t\tval = \"\";\n\t\t\t} else if ( typeof val === \"number\" ) {\n\t\t\t\tval += \"\";\n\t\t\t} else if ( jQuery.isArray( val ) ) {\n\t\t\t\tval = jQuery.map(val, function ( value ) {\n\t\t\t\t\treturn value == null ? \"\" : value + \"\";\n\t\t\t\t});\n\t\t\t}\n\n\t\t\thooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\n\n\t\t\t// If set returns undefined, fall back to normal setting\n\t\t\tif ( !hooks || !(\"set\" in hooks) || hooks.set( this, val, \"value\" ) === undefined ) {\n\t\t\t\tthis.value = val;\n\t\t\t}\n\t\t});\n\t}\n});\n\njQuery.extend({\n\tvalHooks: {\n\t\toption: {\n\t\t\tget: function( elem ) {\n\t\t\t\t// attributes.value is undefined in Blackberry 4.7 but\n\t\t\t\t// uses .value. See #6932\n\t\t\t\tvar val = elem.attributes.value;\n\t\t\t\treturn !val || val.specified ? elem.value : elem.text;\n\t\t\t}\n\t\t},\n\t\tselect: {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar value, option,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tindex = elem.selectedIndex,\n\t\t\t\t\tone = elem.type === \"select-one\" || index < 0,\n\t\t\t\t\tvalues = one ? null : [],\n\t\t\t\t\tmax = one ? index + 1 : options.length,\n\t\t\t\t\ti = index < 0 ?\n\t\t\t\t\t\tmax :\n\t\t\t\t\t\tone ? index : 0;\n\n\t\t\t\t// Loop through all the selected options\n\t\t\t\tfor ( ; i < max; i++ ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t// IE6-9 doesn't update selected after form reset (#2551)\n\t\t\t\t\tif ( ( option.selected || i === index ) &&\n\t\t\t\t\t\t\t// Don't return options that are disabled or in a disabled optgroup\n\t\t\t\t\t\t\t( jQuery.support.optDisabled ? !option.disabled : option.getAttribute(\"disabled\") === null ) &&\n\t\t\t\t\t\t\t( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, \"optgroup\" ) ) ) {\n\n\t\t\t\t\t\t// Get the specific value for the option\n\t\t\t\t\t\tvalue = jQuery( option ).val();\n\n\t\t\t\t\t\t// We don't need an array for one selects\n\t\t\t\t\t\tif ( one ) {\n\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Multi-Selects return an array\n\t\t\t\t\t\tvalues.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn values;\n\t\t\t},\n\n\t\t\tset: function( elem, value ) {\n\t\t\t\tvar optionSet, option,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tvalues = jQuery.makeArray( value ),\n\t\t\t\t\ti = options.length;\n\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\toption = options[ i ];\n\t\t\t\t\tif ( (option.selected = jQuery.inArray( jQuery(option).val(), values ) >= 0) ) {\n\t\t\t\t\t\toptionSet = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// force browsers to behave consistently when non-matching value is set\n\t\t\t\tif ( !optionSet ) {\n\t\t\t\t\telem.selectedIndex = -1;\n\t\t\t\t}\n\t\t\t\treturn values;\n\t\t\t}\n\t\t}\n\t},\n\n\tattr: function( elem, name, value ) {\n\t\tvar hooks, ret,\n\t\t\tnType = elem.nodeType;\n\n\t\t// don't get/set attributes on text, comment and attribute nodes\n\t\tif ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Fallback to prop when attributes are not supported\n\t\tif ( typeof elem.getAttribute === core_strundefined ) {\n\t\t\treturn jQuery.prop( elem, name, value );\n\t\t}\n\n\t\t// All attributes are lowercase\n\t\t// Grab necessary hook if one is defined\n\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\t\t\tname = name.toLowerCase();\n\t\t\thooks = jQuery.attrHooks[ name ] ||\n\t\t\t\t( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\n\t\t\tif ( value === null ) {\n\t\t\t\tjQuery.removeAttr( elem, name );\n\n\t\t\t} else if ( hooks && \"set\" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {\n\t\t\t\treturn ret;\n\n\t\t\t} else {\n\t\t\t\telem.setAttribute( name, value + \"\" );\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t} else if ( hooks && \"get\" in hooks && (ret = hooks.get( elem, name )) !== null ) {\n\t\t\treturn ret;\n\n\t\t} else {\n\t\t\tret = jQuery.find.attr( elem, name );\n\n\t\t\t// Non-existent attributes return null, we normalize to undefined\n\t\t\treturn ret == null ?\n\t\t\t\tundefined :\n\t\t\t\tret;\n\t\t}\n\t},\n\n\tremoveAttr: function( elem, value ) {\n\t\tvar name, propName,\n\t\t\ti = 0,\n\t\t\tattrNames = value && value.match( core_rnotwhite );\n\n\t\tif ( attrNames && elem.nodeType === 1 ) {\n\t\t\twhile ( (name = attrNames[i++]) ) {\n\t\t\t\tpropName = jQuery.propFix[ name ] || name;\n\n\t\t\t\t// Boolean attributes get special treatment (#10870)\n\t\t\t\tif ( jQuery.expr.match.bool.test( name ) ) {\n\t\t\t\t\t// Set corresponding property to false\n\t\t\t\t\telem[ propName ] = false;\n\t\t\t\t}\n\n\t\t\t\telem.removeAttribute( name );\n\t\t\t}\n\t\t}\n\t},\n\n\tattrHooks: {\n\t\ttype: {\n\t\t\tset: function( elem, value ) {\n\t\t\t\tif ( !jQuery.support.radioValue && value === \"radio\" && jQuery.nodeName(elem, \"input\") ) {\n\t\t\t\t\t// Setting the type on a radio button after the value resets the value in IE6-9\n\t\t\t\t\t// Reset value to default in case type is set after value during creation\n\t\t\t\t\tvar val = elem.value;\n\t\t\t\t\telem.setAttribute( \"type\", value );\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\telem.value = val;\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tpropFix: {\n\t\t\"for\": \"htmlFor\",\n\t\t\"class\": \"className\"\n\t},\n\n\tprop: function( elem, name, value ) {\n\t\tvar ret, hooks, notxml,\n\t\t\tnType = elem.nodeType;\n\n\t\t// don't get/set properties on text, comment and attribute nodes\n\t\tif ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tnotxml = nType !== 1 || !jQuery.isXMLDoc( elem );\n\n\t\tif ( notxml ) {\n\t\t\t// Fix name and attach hooks\n\t\t\tname = jQuery.propFix[ name ] || name;\n\t\t\thooks = jQuery.propHooks[ name ];\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\treturn hooks && \"set\" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?\n\t\t\t\tret :\n\t\t\t\t( elem[ name ] = value );\n\n\t\t} else {\n\t\t\treturn hooks && \"get\" in hooks && (ret = hooks.get( elem, name )) !== null ?\n\t\t\t\tret :\n\t\t\t\telem[ name ];\n\t\t}\n\t},\n\n\tpropHooks: {\n\t\ttabIndex: {\n\t\t\tget: function( elem ) {\n\t\t\t\treturn elem.hasAttribute( \"tabindex\" ) || rfocusable.test( elem.nodeName ) || elem.href ?\n\t\t\t\t\telem.tabIndex :\n\t\t\t\t\t-1;\n\t\t\t}\n\t\t}\n\t}\n});\n\n// Hooks for boolean attributes\nboolHook = {\n\tset: function( elem, value, name ) {\n\t\tif ( value === false ) {\n\t\t\t// Remove boolean attributes when set to false\n\t\t\tjQuery.removeAttr( elem, name );\n\t\t} else {\n\t\t\telem.setAttribute( name, name );\n\t\t}\n\t\treturn name;\n\t}\n};\njQuery.each( jQuery.expr.match.bool.source.match( /\\w+/g ), function( i, name ) {\n\tvar getter = jQuery.expr.attrHandle[ name ] || jQuery.find.attr;\n\n\tjQuery.expr.attrHandle[ name ] = function( elem, name, isXML ) {\n\t\tvar fn = jQuery.expr.attrHandle[ name ],\n\t\t\tret = isXML ?\n\t\t\t\tundefined :\n\t\t\t\t/* jshint eqeqeq: false */\n\t\t\t\t// Temporarily disable this handler to check existence\n\t\t\t\t(jQuery.expr.attrHandle[ name ] = undefined) !=\n\t\t\t\t\tgetter( elem, name, isXML ) ?\n\n\t\t\t\t\tname.toLowerCase() :\n\t\t\t\t\tnull;\n\n\t\t// Restore handler\n\t\tjQuery.expr.attrHandle[ name ] = fn;\n\n\t\treturn ret;\n\t};\n});\n\n// Support: IE9+\n// Selectedness for an option in an optgroup can be inaccurate\nif ( !jQuery.support.optSelected ) {\n\tjQuery.propHooks.selected = {\n\t\tget: function( elem ) {\n\t\t\tvar parent = elem.parentNode;\n\t\t\tif ( parent && parent.parentNode ) {\n\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t};\n}\n\njQuery.each([\n\t\"tabIndex\",\n\t\"readOnly\",\n\t\"maxLength\",\n\t\"cellSpacing\",\n\t\"cellPadding\",\n\t\"rowSpan\",\n\t\"colSpan\",\n\t\"useMap\",\n\t\"frameBorder\",\n\t\"contentEditable\"\n], function() {\n\tjQuery.propFix[ this.toLowerCase() ] = this;\n});\n\n// Radios and checkboxes getter/setter\njQuery.each([ \"radio\", \"checkbox\" ], function() {\n\tjQuery.valHooks[ this ] = {\n\t\tset: function( elem, value ) {\n\t\t\tif ( jQuery.isArray( value ) ) {\n\t\t\t\treturn ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );\n\t\t\t}\n\t\t}\n\t};\n\tif ( !jQuery.support.checkOn ) {\n\t\tjQuery.valHooks[ this ].get = function( elem ) {\n\t\t\t// Support: Webkit\n\t\t\t// \"\" is returned instead of \"on\" if a value isn't specified\n\t\t\treturn elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n\t\t};\n\t}\n});\nvar rkeyEvent = /^key/,\n\trmouseEvent = /^(?:mouse|contextmenu)|click/,\n\trfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n\trtypenamespace = /^([^.]*)(?:\\.(.+)|)$/;\n\nfunction returnTrue() {\n\treturn true;\n}\n\nfunction returnFalse() {\n\treturn false;\n}\n\nfunction safeActiveElement() {\n\ttry {\n\t\treturn document.activeElement;\n\t} catch ( err ) { }\n}\n\n/*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\njQuery.event = {\n\n\tglobal: {},\n\n\tadd: function( elem, types, handler, data, selector ) {\n\n\t\tvar handleObjIn, eventHandle, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = data_priv.get( elem );\n\n\t\t// Don't attach events to noData or text/comment nodes (but allow plain objects)\n\t\tif ( !elemData ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\tif ( handler.handler ) {\n\t\t\thandleObjIn = handler;\n\t\t\thandler = handleObjIn.handler;\n\t\t\tselector = handleObjIn.selector;\n\t\t}\n\n\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\tif ( !handler.guid ) {\n\t\t\thandler.guid = jQuery.guid++;\n\t\t}\n\n\t\t// Init the element's event structure and main handler, if this is the first\n\t\tif ( !(events = elemData.events) ) {\n\t\t\tevents = elemData.events = {};\n\t\t}\n\t\tif ( !(eventHandle = elemData.handle) ) {\n\t\t\teventHandle = elemData.handle = function( e ) {\n\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\treturn typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ?\n\t\t\t\t\tjQuery.event.dispatch.apply( eventHandle.elem, arguments ) :\n\t\t\t\t\tundefined;\n\t\t\t};\n\t\t\t// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events\n\t\t\teventHandle.elem = elem;\n\t\t}\n\n\t\t// Handle multiple events separated by a space\n\t\ttypes = ( types || \"\" ).match( core_rnotwhite ) || [\"\"];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[t] ) || [];\n\t\t\ttype = origType = tmp[1];\n\t\t\tnamespaces = ( tmp[2] || \"\" ).split( \".\" ).sort();\n\n\t\t\t// There *must* be a type, no attaching namespace-only handlers\n\t\t\tif ( !type ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\n\t\t\t// Update special based on newly reset type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// handleObj is passed to all event handlers\n\t\t\thandleObj = jQuery.extend({\n\t\t\t\ttype: type,\n\t\t\t\torigType: origType,\n\t\t\t\tdata: data,\n\t\t\t\thandler: handler,\n\t\t\t\tguid: handler.guid,\n\t\t\t\tselector: selector,\n\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n\t\t\t\tnamespace: namespaces.join(\".\")\n\t\t\t}, handleObjIn );\n\n\t\t\t// Init the event handler queue if we're the first\n\t\t\tif ( !(handlers = events[ type ]) ) {\n\t\t\t\thandlers = events[ type ] = [];\n\t\t\t\thandlers.delegateCount = 0;\n\n\t\t\t\t// Only use addEventListener if the special events handler returns false\n\t\t\t\tif ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\telem.addEventListener( type, eventHandle, false );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( special.add ) {\n\t\t\t\tspecial.add.call( elem, handleObj );\n\n\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add to the element's handler list, delegates in front\n\t\t\tif ( selector ) {\n\t\t\t\thandlers.splice( handlers.delegateCount++, 0, handleObj );\n\t\t\t} else {\n\t\t\t\thandlers.push( handleObj );\n\t\t\t}\n\n\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\tjQuery.event.global[ type ] = true;\n\t\t}\n\n\t\t// Nullify elem to prevent memory leaks in IE\n\t\telem = null;\n\t},\n\n\t// Detach an event or set of events from an element\n\tremove: function( elem, types, handler, selector, mappedTypes ) {\n\n\t\tvar j, origCount, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = data_priv.hasData( elem ) && data_priv.get( elem );\n\n\t\tif ( !elemData || !(events = elemData.events) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Once for each type.namespace in types; type may be omitted\n\t\ttypes = ( types || \"\" ).match( core_rnotwhite ) || [\"\"];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[t] ) || [];\n\t\t\ttype = origType = tmp[1];\n\t\t\tnamespaces = ( tmp[2] || \"\" ).split( \".\" ).sort();\n\n\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\tif ( !type ) {\n\t\t\t\tfor ( type in events ) {\n\t\t\t\t\tjQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\t\thandlers = events[ type ] || [];\n\t\t\ttmp = tmp[2] && new RegExp( \"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\" );\n\n\t\t\t// Remove matching events\n\t\t\torigCount = j = handlers.length;\n\t\t\twhile ( j-- ) {\n\t\t\t\thandleObj = handlers[ j ];\n\n\t\t\t\tif ( ( mappedTypes || origType === handleObj.origType ) &&\n\t\t\t\t\t( !handler || handler.guid === handleObj.guid ) &&\n\t\t\t\t\t( !tmp || tmp.test( handleObj.namespace ) ) &&\n\t\t\t\t\t( !selector || selector === handleObj.selector || selector === \"**\" && handleObj.selector ) ) {\n\t\t\t\t\thandlers.splice( j, 1 );\n\n\t\t\t\t\tif ( handleObj.selector ) {\n\t\t\t\t\t\thandlers.delegateCount--;\n\t\t\t\t\t}\n\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\tif ( origCount && !handlers.length ) {\n\t\t\t\tif ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t}\n\n\t\t\t\tdelete events[ type ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove the expando if it's no longer used\n\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\tdelete elemData.handle;\n\t\t\tdata_priv.remove( elem, \"events\" );\n\t\t}\n\t},\n\n\ttrigger: function( event, data, elem, onlyHandlers ) {\n\n\t\tvar i, cur, tmp, bubbleType, ontype, handle, special,\n\t\t\teventPath = [ elem || document ],\n\t\t\ttype = core_hasOwn.call( event, \"type\" ) ? event.type : event,\n\t\t\tnamespaces = core_hasOwn.call( event, \"namespace\" ) ? event.namespace.split(\".\") : [];\n\n\t\tcur = tmp = elem = elem || document;\n\n\t\t// Don't do events on text and comment nodes\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// focus/blur morphs to focusin/out; ensure we're not firing them right now\n\t\tif ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( type.indexOf(\".\") >= 0 ) {\n\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\tnamespaces = type.split(\".\");\n\t\t\ttype = namespaces.shift();\n\t\t\tnamespaces.sort();\n\t\t}\n\t\tontype = type.indexOf(\":\") < 0 && \"on\" + type;\n\n\t\t// Caller can pass in a jQuery.Event object, Object, or just an event type string\n\t\tevent = event[ jQuery.expando ] ?\n\t\t\tevent :\n\t\t\tnew jQuery.Event( type, typeof event === \"object\" && event );\n\n\t\t// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\t\tevent.isTrigger = onlyHandlers ? 2 : 3;\n\t\tevent.namespace = namespaces.join(\".\");\n\t\tevent.namespace_re = event.namespace ?\n\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\" ) :\n\t\t\tnull;\n\n\t\t// Clean up the event in case it is being reused\n\t\tevent.result = undefined;\n\t\tif ( !event.target ) {\n\t\t\tevent.target = elem;\n\t\t}\n\n\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\tdata = data == null ?\n\t\t\t[ event ] :\n\t\t\tjQuery.makeArray( data, [ event ] );\n\n\t\t// Allow special events to draw outside the lines\n\t\tspecial = jQuery.event.special[ type ] || {};\n\t\tif ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine event propagation path in advance, per W3C events spec (#9951)\n\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\t\tif ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {\n\n\t\t\tbubbleType = special.delegateType || type;\n\t\t\tif ( !rfocusMorph.test( bubbleType + type ) ) {\n\t\t\t\tcur = cur.parentNode;\n\t\t\t}\n\t\t\tfor ( ; cur; cur = cur.parentNode ) {\n\t\t\t\teventPath.push( cur );\n\t\t\t\ttmp = cur;\n\t\t\t}\n\n\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\tif ( tmp === (elem.ownerDocument || document) ) {\n\t\t\t\teventPath.push( tmp.defaultView || tmp.parentWindow || window );\n\t\t\t}\n\t\t}\n\n\t\t// Fire handlers on the event path\n\t\ti = 0;\n\t\twhile ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) {\n\n\t\t\tevent.type = i > 1 ?\n\t\t\t\tbubbleType :\n\t\t\t\tspecial.bindType || type;\n\n\t\t\t// jQuery handler\n\t\t\thandle = ( data_priv.get( cur, \"events\" ) || {} )[ event.type ] && data_priv.get( cur, \"handle\" );\n\t\t\tif ( handle ) {\n\t\t\t\thandle.apply( cur, data );\n\t\t\t}\n\n\t\t\t// Native handler\n\t\t\thandle = ontype && cur[ ontype ];\n\t\t\tif ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t\tevent.type = type;\n\n\t\t// If nobody prevented the default action, do it now\n\t\tif ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\n\t\t\tif ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) &&\n\t\t\t\tjQuery.acceptData( elem ) ) {\n\n\t\t\t\t// Call a native DOM method on the target with the same name name as the event.\n\t\t\t\t// Don't do default actions on window, that's where global variables be (#6170)\n\t\t\t\tif ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {\n\n\t\t\t\t\t// Don't re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\ttmp = elem[ ontype ];\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prevent re-triggering of the same event, since we already bubbled it above\n\t\t\t\t\tjQuery.event.triggered = type;\n\t\t\t\t\telem[ type ]();\n\t\t\t\t\tjQuery.event.triggered = undefined;\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\tdispatch: function( event ) {\n\n\t\t// Make a writable jQuery.Event from the native event object\n\t\tevent = jQuery.event.fix( event );\n\n\t\tvar i, j, ret, matched, handleObj,\n\t\t\thandlerQueue = [],\n\t\t\targs = core_slice.call( arguments ),\n\t\t\thandlers = ( data_priv.get( this, \"events\" ) || {} )[ event.type ] || [],\n\t\t\tspecial = jQuery.event.special[ event.type ] || {};\n\n\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\targs[0] = event;\n\t\tevent.delegateTarget = this;\n\n\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\tif ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine handlers\n\t\thandlerQueue = jQuery.event.handlers.call( this, event, handlers );\n\n\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\ti = 0;\n\t\twhile ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) {\n\t\t\tevent.currentTarget = matched.elem;\n\n\t\t\tj = 0;\n\t\t\twhile ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) {\n\n\t\t\t\t// Triggered event must either 1) have no namespace, or\n\t\t\t\t// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).\n\t\t\t\tif ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) {\n\n\t\t\t\t\tevent.handleObj = handleObj;\n\t\t\t\t\tevent.data = handleObj.data;\n\n\t\t\t\t\tret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )\n\t\t\t\t\t\t\t.apply( matched.elem, args );\n\n\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\tif ( (event.result = ret) === false ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Call the postDispatch hook for the mapped type\n\t\tif ( special.postDispatch ) {\n\t\t\tspecial.postDispatch.call( this, event );\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\thandlers: function( event, handlers ) {\n\t\tvar i, matches, sel, handleObj,\n\t\t\thandlerQueue = [],\n\t\t\tdelegateCount = handlers.delegateCount,\n\t\t\tcur = event.target;\n\n\t\t// Find delegate handlers\n\t\t// Black-hole SVG <use> instance trees (#13180)\n\t\t// Avoid non-left-click bubbling in Firefox (#3861)\n\t\tif ( delegateCount && cur.nodeType && (!event.button || event.type !== \"click\") ) {\n\n\t\t\tfor ( ; cur !== this; cur = cur.parentNode || this ) {\n\n\t\t\t\t// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n\t\t\t\tif ( cur.disabled !== true || event.type !== \"click\" ) {\n\t\t\t\t\tmatches = [];\n\t\t\t\t\tfor ( i = 0; i < delegateCount; i++ ) {\n\t\t\t\t\t\thandleObj = handlers[ i ];\n\n\t\t\t\t\t\t// Don't conflict with Object.prototype properties (#13203)\n\t\t\t\t\t\tsel = handleObj.selector + \" \";\n\n\t\t\t\t\t\tif ( matches[ sel ] === undefined ) {\n\t\t\t\t\t\t\tmatches[ sel ] = handleObj.needsContext ?\n\t\t\t\t\t\t\t\tjQuery( sel, this ).index( cur ) >= 0 :\n\t\t\t\t\t\t\t\tjQuery.find( sel, this, null, [ cur ] ).length;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( matches[ sel ] ) {\n\t\t\t\t\t\t\tmatches.push( handleObj );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( matches.length ) {\n\t\t\t\t\t\thandlerQueue.push({ elem: cur, handlers: matches });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add the remaining (directly-bound) handlers\n\t\tif ( delegateCount < handlers.length ) {\n\t\t\thandlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });\n\t\t}\n\n\t\treturn handlerQueue;\n\t},\n\n\t// Includes some event props shared by KeyEvent and MouseEvent\n\tprops: \"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which\".split(\" \"),\n\n\tfixHooks: {},\n\n\tkeyHooks: {\n\t\tprops: \"char charCode key keyCode\".split(\" \"),\n\t\tfilter: function( event, original ) {\n\n\t\t\t// Add which for key events\n\t\t\tif ( event.which == null ) {\n\t\t\t\tevent.which = original.charCode != null ? original.charCode : original.keyCode;\n\t\t\t}\n\n\t\t\treturn event;\n\t\t}\n\t},\n\n\tmouseHooks: {\n\t\tprops: \"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement\".split(\" \"),\n\t\tfilter: function( event, original ) {\n\t\t\tvar eventDoc, doc, body,\n\t\t\t\tbutton = original.button;\n\n\t\t\t// Calculate pageX/Y if missing and clientX/Y available\n\t\t\tif ( event.pageX == null && original.clientX != null ) {\n\t\t\t\teventDoc = event.target.ownerDocument || document;\n\t\t\t\tdoc = eventDoc.documentElement;\n\t\t\t\tbody = eventDoc.body;\n\n\t\t\t\tevent.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );\n\t\t\t\tevent.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );\n\t\t\t}\n\n\t\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\t\t// Note: button is not normalized, so don't use it\n\t\t\tif ( !event.which && button !== undefined ) {\n\t\t\t\tevent.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );\n\t\t\t}\n\n\t\t\treturn event;\n\t\t}\n\t},\n\n\tfix: function( event ) {\n\t\tif ( event[ jQuery.expando ] ) {\n\t\t\treturn event;\n\t\t}\n\n\t\t// Create a writable copy of the event object and normalize some properties\n\t\tvar i, prop, copy,\n\t\t\ttype = event.type,\n\t\t\toriginalEvent = event,\n\t\t\tfixHook = this.fixHooks[ type ];\n\n\t\tif ( !fixHook ) {\n\t\t\tthis.fixHooks[ type ] = fixHook =\n\t\t\t\trmouseEvent.test( type ) ? this.mouseHooks :\n\t\t\t\trkeyEvent.test( type ) ? this.keyHooks :\n\t\t\t\t{};\n\t\t}\n\t\tcopy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;\n\n\t\tevent = new jQuery.Event( originalEvent );\n\n\t\ti = copy.length;\n\t\twhile ( i-- ) {\n\t\t\tprop = copy[ i ];\n\t\t\tevent[ prop ] = originalEvent[ prop ];\n\t\t}\n\n\t\t// Support: Cordova 2.5 (WebKit) (#13255)\n\t\t// All events should have a target; Cordova deviceready doesn't\n\t\tif ( !event.target ) {\n\t\t\tevent.target = document;\n\t\t}\n\n\t\t// Support: Safari 6.0+, Chrome < 28\n\t\t// Target should not be a text node (#504, #13143)\n\t\tif ( event.target.nodeType === 3 ) {\n\t\t\tevent.target = event.target.parentNode;\n\t\t}\n\n\t\treturn fixHook.filter? fixHook.filter( event, originalEvent ) : event;\n\t},\n\n\tspecial: {\n\t\tload: {\n\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\tnoBubble: true\n\t\t},\n\t\tfocus: {\n\t\t\t// Fire native event if possible so blur/focus sequence is correct\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this !== safeActiveElement() && this.focus ) {\n\t\t\t\t\tthis.focus();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdelegateType: \"focusin\"\n\t\t},\n\t\tblur: {\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this === safeActiveElement() && this.blur ) {\n\t\t\t\t\tthis.blur();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdelegateType: \"focusout\"\n\t\t},\n\t\tclick: {\n\t\t\t// For checkbox, fire native event so checked state will be right\n\t\t\ttrigger: function() {\n\t\t\t\tif ( this.type === \"checkbox\" && this.click && jQuery.nodeName( this, \"input\" ) ) {\n\t\t\t\t\tthis.click();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t// For cross-browser consistency, don't fire native .click() on links\n\t\t\t_default: function( event ) {\n\t\t\t\treturn jQuery.nodeName( event.target, \"a\" );\n\t\t\t}\n\t\t},\n\n\t\tbeforeunload: {\n\t\t\tpostDispatch: function( event ) {\n\n\t\t\t\t// Support: Firefox 20+\n\t\t\t\t// Firefox doesn't alert if the returnValue field is not set.\n\t\t\t\tif ( event.result !== undefined ) {\n\t\t\t\t\tevent.originalEvent.returnValue = event.result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tsimulate: function( type, elem, event, bubble ) {\n\t\t// Piggyback on a donor event to simulate a different one.\n\t\t// Fake originalEvent to avoid donor's stopPropagation, but if the\n\t\t// simulated event prevents default then we do the same on the donor.\n\t\tvar e = jQuery.extend(\n\t\t\tnew jQuery.Event(),\n\t\t\tevent,\n\t\t\t{\n\t\t\t\ttype: type,\n\t\t\t\tisSimulated: true,\n\t\t\t\toriginalEvent: {}\n\t\t\t}\n\t\t);\n\t\tif ( bubble ) {\n\t\t\tjQuery.event.trigger( e, null, elem );\n\t\t} else {\n\t\t\tjQuery.event.dispatch.call( elem, e );\n\t\t}\n\t\tif ( e.isDefaultPrevented() ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n};\n\njQuery.removeEvent = function( elem, type, handle ) {\n\tif ( elem.removeEventListener ) {\n\t\telem.removeEventListener( type, handle, false );\n\t}\n};\n\njQuery.Event = function( src, props ) {\n\t// Allow instantiation without the 'new' keyword\n\tif ( !(this instanceof jQuery.Event) ) {\n\t\treturn new jQuery.Event( src, props );\n\t}\n\n\t// Event object\n\tif ( src && src.type ) {\n\t\tthis.originalEvent = src;\n\t\tthis.type = src.type;\n\n\t\t// Events bubbling up the document may have been marked as prevented\n\t\t// by a handler lower down the tree; reflect the correct value.\n\t\tthis.isDefaultPrevented = ( src.defaultPrevented ||\n\t\t\tsrc.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;\n\n\t// Event type\n\t} else {\n\t\tthis.type = src;\n\t}\n\n\t// Put explicitly provided properties onto the event object\n\tif ( props ) {\n\t\tjQuery.extend( this, props );\n\t}\n\n\t// Create a timestamp if incoming event doesn't have one\n\tthis.timeStamp = src && src.timeStamp || jQuery.now();\n\n\t// Mark it as fixed\n\tthis[ jQuery.expando ] = true;\n};\n\n// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\njQuery.Event.prototype = {\n\tisDefaultPrevented: returnFalse,\n\tisPropagationStopped: returnFalse,\n\tisImmediatePropagationStopped: returnFalse,\n\n\tpreventDefault: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isDefaultPrevented = returnTrue;\n\n\t\tif ( e && e.preventDefault ) {\n\t\t\te.preventDefault();\n\t\t}\n\t},\n\tstopPropagation: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isPropagationStopped = returnTrue;\n\n\t\tif ( e && e.stopPropagation ) {\n\t\t\te.stopPropagation();\n\t\t}\n\t},\n\tstopImmediatePropagation: function() {\n\t\tthis.isImmediatePropagationStopped = returnTrue;\n\t\tthis.stopPropagation();\n\t}\n};\n\n// Create mouseenter/leave events using mouseover/out and event-time checks\n// Support: Chrome 15+\njQuery.each({\n\tmouseenter: \"mouseover\",\n\tmouseleave: \"mouseout\"\n}, function( orig, fix ) {\n\tjQuery.event.special[ orig ] = {\n\t\tdelegateType: fix,\n\t\tbindType: fix,\n\n\t\thandle: function( event ) {\n\t\t\tvar ret,\n\t\t\t\ttarget = this,\n\t\t\t\trelated = event.relatedTarget,\n\t\t\t\thandleObj = event.handleObj;\n\n\t\t\t// For mousenter/leave call the handler if related is outside the target.\n\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\tif ( !related || (related !== target && !jQuery.contains( target, related )) ) {\n\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\tret = handleObj.handler.apply( this, arguments );\n\t\t\t\tevent.type = fix;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t};\n});\n\n// Create \"bubbling\" focus and blur events\n// Support: Firefox, Chrome, Safari\nif ( !jQuery.support.focusinBubbles ) {\n\tjQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\n\t\t// Attach a single capturing handler while someone wants focusin/focusout\n\t\tvar attaches = 0,\n\t\t\thandler = function( event ) {\n\t\t\t\tjQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );\n\t\t\t};\n\n\t\tjQuery.event.special[ fix ] = {\n\t\t\tsetup: function() {\n\t\t\t\tif ( attaches++ === 0 ) {\n\t\t\t\t\tdocument.addEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t},\n\t\t\tteardown: function() {\n\t\t\t\tif ( --attaches === 0 ) {\n\t\t\t\t\tdocument.removeEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t});\n}\n\njQuery.fn.extend({\n\n\ton: function( types, selector, data, fn, /*INTERNAL*/ one ) {\n\t\tvar origFn, type;\n\n\t\t// Types can be a map of types/handlers\n\t\tif ( typeof types === \"object\" ) {\n\t\t\t// ( types-Object, selector, data )\n\t\t\tif ( typeof selector !== \"string\" ) {\n\t\t\t\t// ( types-Object, data )\n\t\t\t\tdata = data || selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t\tfor ( type in types ) {\n\t\t\t\tthis.on( type, selector, data, types[ type ], one );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( data == null && fn == null ) {\n\t\t\t// ( types, fn )\n\t\t\tfn = selector;\n\t\t\tdata = selector = undefined;\n\t\t} else if ( fn == null ) {\n\t\t\tif ( typeof selector === \"string\" ) {\n\t\t\t\t// ( types, selector, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = undefined;\n\t\t\t} else {\n\t\t\t\t// ( types, data, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t} else if ( !fn ) {\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( one === 1 ) {\n\t\t\torigFn = fn;\n\t\t\tfn = function( event ) {\n\t\t\t\t// Can use an empty set, since event contains the info\n\t\t\t\tjQuery().off( event );\n\t\t\t\treturn origFn.apply( this, arguments );\n\t\t\t};\n\t\t\t// Use same guid so caller can remove using origFn\n\t\t\tfn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.add( this, types, fn, data, selector );\n\t\t});\n\t},\n\tone: function( types, selector, data, fn ) {\n\t\treturn this.on( types, selector, data, fn, 1 );\n\t},\n\toff: function( types, selector, fn ) {\n\t\tvar handleObj, type;\n\t\tif ( types && types.preventDefault && types.handleObj ) {\n\t\t\t// ( event )  dispatched jQuery.Event\n\t\t\thandleObj = types.handleObj;\n\t\t\tjQuery( types.delegateTarget ).off(\n\t\t\t\thandleObj.namespace ? handleObj.origType + \".\" + handleObj.namespace : handleObj.origType,\n\t\t\t\thandleObj.selector,\n\t\t\t\thandleObj.handler\n\t\t\t);\n\t\t\treturn this;\n\t\t}\n\t\tif ( typeof types === \"object\" ) {\n\t\t\t// ( types-object [, selector] )\n\t\t\tfor ( type in types ) {\n\t\t\t\tthis.off( type, selector, types[ type ] );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\tif ( selector === false || typeof selector === \"function\" ) {\n\t\t\t// ( types [, fn] )\n\t\t\tfn = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t}\n\t\treturn this.each(function() {\n\t\t\tjQuery.event.remove( this, types, fn, selector );\n\t\t});\n\t},\n\n\ttrigger: function( type, data ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.event.trigger( type, data, this );\n\t\t});\n\t},\n\ttriggerHandler: function( type, data ) {\n\t\tvar elem = this[0];\n\t\tif ( elem ) {\n\t\t\treturn jQuery.event.trigger( type, data, elem, true );\n\t\t}\n\t}\n});\nvar isSimple = /^.[^:#\\[\\.,]*$/,\n\trparentsprev = /^(?:parents|prev(?:Until|All))/,\n\trneedsContext = jQuery.expr.match.needsContext,\n\t// methods guaranteed to produce a unique set when starting from a unique set\n\tguaranteedUnique = {\n\t\tchildren: true,\n\t\tcontents: true,\n\t\tnext: true,\n\t\tprev: true\n\t};\n\njQuery.fn.extend({\n\tfind: function( selector ) {\n\t\tvar i,\n\t\t\tret = [],\n\t\t\tself = this,\n\t\t\tlen = self.length;\n\n\t\tif ( typeof selector !== \"string\" ) {\n\t\t\treturn this.pushStack( jQuery( selector ).filter(function() {\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tif ( jQuery.contains( self[ i ], this ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}) );\n\t\t}\n\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tjQuery.find( selector, self[ i ], ret );\n\t\t}\n\n\t\t// Needed because $( selector, context ) becomes $( context ).find( selector )\n\t\tret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );\n\t\tret.selector = this.selector ? this.selector + \" \" + selector : selector;\n\t\treturn ret;\n\t},\n\n\thas: function( target ) {\n\t\tvar targets = jQuery( target, this ),\n\t\t\tl = targets.length;\n\n\t\treturn this.filter(function() {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tif ( jQuery.contains( this, targets[i] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\n\tnot: function( selector ) {\n\t\treturn this.pushStack( winnow(this, selector || [], true) );\n\t},\n\n\tfilter: function( selector ) {\n\t\treturn this.pushStack( winnow(this, selector || [], false) );\n\t},\n\n\tis: function( selector ) {\n\t\treturn !!winnow(\n\t\t\tthis,\n\n\t\t\t// If this is a positional/relative selector, check membership in the returned set\n\t\t\t// so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n\t\t\ttypeof selector === \"string\" && rneedsContext.test( selector ) ?\n\t\t\t\tjQuery( selector ) :\n\t\t\t\tselector || [],\n\t\t\tfalse\n\t\t).length;\n\t},\n\n\tclosest: function( selectors, context ) {\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\tl = this.length,\n\t\t\tmatched = [],\n\t\t\tpos = ( rneedsContext.test( selectors ) || typeof selectors !== \"string\" ) ?\n\t\t\t\tjQuery( selectors, context || this.context ) :\n\t\t\t\t0;\n\n\t\tfor ( ; i < l; i++ ) {\n\t\t\tfor ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {\n\t\t\t\t// Always skip document fragments\n\t\t\t\tif ( cur.nodeType < 11 && (pos ?\n\t\t\t\t\tpos.index(cur) > -1 :\n\n\t\t\t\t\t// Don't pass non-elements to Sizzle\n\t\t\t\t\tcur.nodeType === 1 &&\n\t\t\t\t\t\tjQuery.find.matchesSelector(cur, selectors)) ) {\n\n\t\t\t\t\tcur = matched.push( cur );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched.length > 1 ? jQuery.unique( matched ) : matched );\n\t},\n\n\t// Determine the position of an element within\n\t// the matched set of elements\n\tindex: function( elem ) {\n\n\t\t// No argument, return index in parent\n\t\tif ( !elem ) {\n\t\t\treturn ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;\n\t\t}\n\n\t\t// index in selector\n\t\tif ( typeof elem === \"string\" ) {\n\t\t\treturn core_indexOf.call( jQuery( elem ), this[ 0 ] );\n\t\t}\n\n\t\t// Locate the position of the desired element\n\t\treturn core_indexOf.call( this,\n\n\t\t\t// If it receives a jQuery object, the first element is used\n\t\t\telem.jquery ? elem[ 0 ] : elem\n\t\t);\n\t},\n\n\tadd: function( selector, context ) {\n\t\tvar set = typeof selector === \"string\" ?\n\t\t\t\tjQuery( selector, context ) :\n\t\t\t\tjQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),\n\t\t\tall = jQuery.merge( this.get(), set );\n\n\t\treturn this.pushStack( jQuery.unique(all) );\n\t},\n\n\taddBack: function( selector ) {\n\t\treturn this.add( selector == null ?\n\t\t\tthis.prevObject : this.prevObject.filter(selector)\n\t\t);\n\t}\n});\n\nfunction sibling( cur, dir ) {\n\twhile ( (cur = cur[dir]) && cur.nodeType !== 1 ) {}\n\n\treturn cur;\n}\n\njQuery.each({\n\tparent: function( elem ) {\n\t\tvar parent = elem.parentNode;\n\t\treturn parent && parent.nodeType !== 11 ? parent : null;\n\t},\n\tparents: function( elem ) {\n\t\treturn jQuery.dir( elem, \"parentNode\" );\n\t},\n\tparentsUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"parentNode\", until );\n\t},\n\tnext: function( elem ) {\n\t\treturn sibling( elem, \"nextSibling\" );\n\t},\n\tprev: function( elem ) {\n\t\treturn sibling( elem, \"previousSibling\" );\n\t},\n\tnextAll: function( elem ) {\n\t\treturn jQuery.dir( elem, \"nextSibling\" );\n\t},\n\tprevAll: function( elem ) {\n\t\treturn jQuery.dir( elem, \"previousSibling\" );\n\t},\n\tnextUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"nextSibling\", until );\n\t},\n\tprevUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"previousSibling\", until );\n\t},\n\tsiblings: function( elem ) {\n\t\treturn jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );\n\t},\n\tchildren: function( elem ) {\n\t\treturn jQuery.sibling( elem.firstChild );\n\t},\n\tcontents: function( elem ) {\n\t\treturn elem.contentDocument || jQuery.merge( [], elem.childNodes );\n\t}\n}, function( name, fn ) {\n\tjQuery.fn[ name ] = function( until, selector ) {\n\t\tvar matched = jQuery.map( this, fn, until );\n\n\t\tif ( name.slice( -5 ) !== \"Until\" ) {\n\t\t\tselector = until;\n\t\t}\n\n\t\tif ( selector && typeof selector === \"string\" ) {\n\t\t\tmatched = jQuery.filter( selector, matched );\n\t\t}\n\n\t\tif ( this.length > 1 ) {\n\t\t\t// Remove duplicates\n\t\t\tif ( !guaranteedUnique[ name ] ) {\n\t\t\t\tjQuery.unique( matched );\n\t\t\t}\n\n\t\t\t// Reverse order for parents* and prev-derivatives\n\t\t\tif ( rparentsprev.test( name ) ) {\n\t\t\t\tmatched.reverse();\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched );\n\t};\n});\n\njQuery.extend({\n\tfilter: function( expr, elems, not ) {\n\t\tvar elem = elems[ 0 ];\n\n\t\tif ( not ) {\n\t\t\texpr = \":not(\" + expr + \")\";\n\t\t}\n\n\t\treturn elems.length === 1 && elem.nodeType === 1 ?\n\t\t\tjQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :\n\t\t\tjQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {\n\t\t\t\treturn elem.nodeType === 1;\n\t\t\t}));\n\t},\n\n\tdir: function( elem, dir, until ) {\n\t\tvar matched = [],\n\t\t\ttruncate = until !== undefined;\n\n\t\twhile ( (elem = elem[ dir ]) && elem.nodeType !== 9 ) {\n\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\tif ( truncate && jQuery( elem ).is( until ) ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tmatched.push( elem );\n\t\t\t}\n\t\t}\n\t\treturn matched;\n\t},\n\n\tsibling: function( n, elem ) {\n\t\tvar matched = [];\n\n\t\tfor ( ; n; n = n.nextSibling ) {\n\t\t\tif ( n.nodeType === 1 && n !== elem ) {\n\t\t\t\tmatched.push( n );\n\t\t\t}\n\t\t}\n\n\t\treturn matched;\n\t}\n});\n\n// Implement the identical functionality for filter and not\nfunction winnow( elements, qualifier, not ) {\n\tif ( jQuery.isFunction( qualifier ) ) {\n\t\treturn jQuery.grep( elements, function( elem, i ) {\n\t\t\t/* jshint -W018 */\n\t\t\treturn !!qualifier.call( elem, i, elem ) !== not;\n\t\t});\n\n\t}\n\n\tif ( qualifier.nodeType ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( elem === qualifier ) !== not;\n\t\t});\n\n\t}\n\n\tif ( typeof qualifier === \"string\" ) {\n\t\tif ( isSimple.test( qualifier ) ) {\n\t\t\treturn jQuery.filter( qualifier, elements, not );\n\t\t}\n\n\t\tqualifier = jQuery.filter( qualifier, elements );\n\t}\n\n\treturn jQuery.grep( elements, function( elem ) {\n\t\treturn ( core_indexOf.call( qualifier, elem ) >= 0 ) !== not;\n\t});\n}\nvar rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/gi,\n\trtagName = /<([\\w:]+)/,\n\trhtml = /<|&#?\\w+;/,\n\trnoInnerhtml = /<(?:script|style|link)/i,\n\tmanipulation_rcheckableType = /^(?:checkbox|radio)$/i,\n\t// checked=\"checked\" or checked\n\trchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n\trscriptType = /^$|\\/(?:java|ecma)script/i,\n\trscriptTypeMasked = /^true\\/(.*)/,\n\trcleanScript = /^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g,\n\n\t// We have to close these tags to support XHTML (#13200)\n\twrapMap = {\n\n\t\t// Support: IE 9\n\t\toption: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n\n\t\tthead: [ 1, \"<table>\", \"</table>\" ],\n\t\tcol: [ 2, \"<table><colgroup>\", \"</colgroup></table>\" ],\n\t\ttr: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n\t\ttd: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n\n\t\t_default: [ 0, \"\", \"\" ]\n\t};\n\n// Support: IE 9\nwrapMap.optgroup = wrapMap.option;\n\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\njQuery.fn.extend({\n\ttext: function( value ) {\n\t\treturn jQuery.access( this, function( value ) {\n\t\t\treturn value === undefined ?\n\t\t\t\tjQuery.text( this ) :\n\t\t\t\tthis.empty().append( ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) );\n\t\t}, null, value, arguments.length );\n\t},\n\n\tappend: function() {\n\t\treturn this.domManip( arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.appendChild( elem );\n\t\t\t}\n\t\t});\n\t},\n\n\tprepend: function() {\n\t\treturn this.domManip( arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.insertBefore( elem, target.firstChild );\n\t\t\t}\n\t\t});\n\t},\n\n\tbefore: function() {\n\t\treturn this.domManip( arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t}\n\t\t});\n\t},\n\n\tafter: function() {\n\t\treturn this.domManip( arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t}\n\t\t});\n\t},\n\n\t// keepData is for internal use only--do not document\n\tremove: function( selector, keepData ) {\n\t\tvar elem,\n\t\t\telems = selector ? jQuery.filter( selector, this ) : this,\n\t\t\ti = 0;\n\n\t\tfor ( ; (elem = elems[i]) != null; i++ ) {\n\t\t\tif ( !keepData && elem.nodeType === 1 ) {\n\t\t\t\tjQuery.cleanData( getAll( elem ) );\n\t\t\t}\n\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\tif ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {\n\t\t\t\t\tsetGlobalEval( getAll( elem, \"script\" ) );\n\t\t\t\t}\n\t\t\t\telem.parentNode.removeChild( elem );\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tempty: function() {\n\t\tvar elem,\n\t\t\ti = 0;\n\n\t\tfor ( ; (elem = this[i]) != null; i++ ) {\n\t\t\tif ( elem.nodeType === 1 ) {\n\n\t\t\t\t// Prevent memory leaks\n\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\n\t\t\t\t// Remove any remaining nodes\n\t\t\t\telem.textContent = \"\";\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\n\t\treturn this.map( function () {\n\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t});\n\t},\n\n\thtml: function( value ) {\n\t\treturn jQuery.access( this, function( value ) {\n\t\t\tvar elem = this[ 0 ] || {},\n\t\t\t\ti = 0,\n\t\t\t\tl = this.length;\n\n\t\t\tif ( value === undefined && elem.nodeType === 1 ) {\n\t\t\t\treturn elem.innerHTML;\n\t\t\t}\n\n\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\tif ( typeof value === \"string\" && !rnoInnerhtml.test( value ) &&\n\t\t\t\t!wrapMap[ ( rtagName.exec( value ) || [ \"\", \"\" ] )[ 1 ].toLowerCase() ] ) {\n\n\t\t\t\tvalue = value.replace( rxhtmlTag, \"<$1></$2>\" );\n\n\t\t\t\ttry {\n\t\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\t\telem = this[ i ] || {};\n\n\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\telem = 0;\n\n\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t} catch( e ) {}\n\t\t\t}\n\n\t\t\tif ( elem ) {\n\t\t\t\tthis.empty().append( value );\n\t\t\t}\n\t\t}, null, value, arguments.length );\n\t},\n\n\treplaceWith: function() {\n\t\tvar\n\t\t\t// Snapshot the DOM in case .domManip sweeps something relevant into its fragment\n\t\t\targs = jQuery.map( this, function( elem ) {\n\t\t\t\treturn [ elem.nextSibling, elem.parentNode ];\n\t\t\t}),\n\t\t\ti = 0;\n\n\t\t// Make the changes, replacing each context element with the new content\n\t\tthis.domManip( arguments, function( elem ) {\n\t\t\tvar next = args[ i++ ],\n\t\t\t\tparent = args[ i++ ];\n\n\t\t\tif ( parent ) {\n\t\t\t\t// Don't use the snapshot next if it has moved (#13810)\n\t\t\t\tif ( next && next.parentNode !== parent ) {\n\t\t\t\t\tnext = this.nextSibling;\n\t\t\t\t}\n\t\t\t\tjQuery( this ).remove();\n\t\t\t\tparent.insertBefore( elem, next );\n\t\t\t}\n\t\t// Allow new content to include elements from the context set\n\t\t}, true );\n\n\t\t// Force removal if there was no new content (e.g., from empty arguments)\n\t\treturn i ? this : this.remove();\n\t},\n\n\tdetach: function( selector ) {\n\t\treturn this.remove( selector, true );\n\t},\n\n\tdomManip: function( args, callback, allowIntersection ) {\n\n\t\t// Flatten any nested arrays\n\t\targs = core_concat.apply( [], args );\n\n\t\tvar fragment, first, scripts, hasScripts, node, doc,\n\t\t\ti = 0,\n\t\t\tl = this.length,\n\t\t\tset = this,\n\t\t\tiNoClone = l - 1,\n\t\t\tvalue = args[ 0 ],\n\t\t\tisFunction = jQuery.isFunction( value );\n\n\t\t// We can't cloneNode fragments that contain checked, in WebKit\n\t\tif ( isFunction || !( l <= 1 || typeof value !== \"string\" || jQuery.support.checkClone || !rchecked.test( value ) ) ) {\n\t\t\treturn this.each(function( index ) {\n\t\t\t\tvar self = set.eq( index );\n\t\t\t\tif ( isFunction ) {\n\t\t\t\t\targs[ 0 ] = value.call( this, index, self.html() );\n\t\t\t\t}\n\t\t\t\tself.domManip( args, callback, allowIntersection );\n\t\t\t});\n\t\t}\n\n\t\tif ( l ) {\n\t\t\tfragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, !allowIntersection && this );\n\t\t\tfirst = fragment.firstChild;\n\n\t\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\t\tfragment = first;\n\t\t\t}\n\n\t\t\tif ( first ) {\n\t\t\t\tscripts = jQuery.map( getAll( fragment, \"script\" ), disableScript );\n\t\t\t\thasScripts = scripts.length;\n\n\t\t\t\t// Use the original fragment for the last item instead of the first because it can end up\n\t\t\t\t// being emptied incorrectly in certain situations (#8070).\n\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\tnode = fragment;\n\n\t\t\t\t\tif ( i !== iNoClone ) {\n\t\t\t\t\t\tnode = jQuery.clone( node, true, true );\n\n\t\t\t\t\t\t// Keep references to cloned scripts for later restoration\n\t\t\t\t\t\tif ( hasScripts ) {\n\t\t\t\t\t\t\t// Support: QtWebKit\n\t\t\t\t\t\t\t// jQuery.merge because core_push.apply(_, arraylike) throws\n\t\t\t\t\t\t\tjQuery.merge( scripts, getAll( node, \"script\" ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback.call( this[ i ], node, i );\n\t\t\t\t}\n\n\t\t\t\tif ( hasScripts ) {\n\t\t\t\t\tdoc = scripts[ scripts.length - 1 ].ownerDocument;\n\n\t\t\t\t\t// Reenable scripts\n\t\t\t\t\tjQuery.map( scripts, restoreScript );\n\n\t\t\t\t\t// Evaluate executable scripts on first document insertion\n\t\t\t\t\tfor ( i = 0; i < hasScripts; i++ ) {\n\t\t\t\t\t\tnode = scripts[ i ];\n\t\t\t\t\t\tif ( rscriptType.test( node.type || \"\" ) &&\n\t\t\t\t\t\t\t!data_priv.access( node, \"globalEval\" ) && jQuery.contains( doc, node ) ) {\n\n\t\t\t\t\t\t\tif ( node.src ) {\n\t\t\t\t\t\t\t\t// Hope ajax is available...\n\t\t\t\t\t\t\t\tjQuery._evalUrl( node.src );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery.globalEval( node.textContent.replace( rcleanScript, \"\" ) );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n});\n\njQuery.each({\n\tappendTo: \"append\",\n\tprependTo: \"prepend\",\n\tinsertBefore: \"before\",\n\tinsertAfter: \"after\",\n\treplaceAll: \"replaceWith\"\n}, function( name, original ) {\n\tjQuery.fn[ name ] = function( selector ) {\n\t\tvar elems,\n\t\t\tret = [],\n\t\t\tinsert = jQuery( selector ),\n\t\t\tlast = insert.length - 1,\n\t\t\ti = 0;\n\n\t\tfor ( ; i <= last; i++ ) {\n\t\t\telems = i === last ? this : this.clone( true );\n\t\t\tjQuery( insert[ i ] )[ original ]( elems );\n\n\t\t\t// Support: QtWebKit\n\t\t\t// .get() because core_push.apply(_, arraylike) throws\n\t\t\tcore_push.apply( ret, elems.get() );\n\t\t}\n\n\t\treturn this.pushStack( ret );\n\t};\n});\n\njQuery.extend({\n\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\tvar i, l, srcElements, destElements,\n\t\t\tclone = elem.cloneNode( true ),\n\t\t\tinPage = jQuery.contains( elem.ownerDocument, elem );\n\n\t\t// Support: IE >= 9\n\t\t// Fix Cloning issues\n\t\tif ( !jQuery.support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) {\n\n\t\t\t// We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2\n\t\t\tdestElements = getAll( clone );\n\t\t\tsrcElements = getAll( elem );\n\n\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\tfixInput( srcElements[ i ], destElements[ i ] );\n\t\t\t}\n\t\t}\n\n\t\t// Copy the events from the original to the clone\n\t\tif ( dataAndEvents ) {\n\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\tsrcElements = srcElements || getAll( elem );\n\t\t\t\tdestElements = destElements || getAll( clone );\n\n\t\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\t\tcloneCopyEvent( srcElements[ i ], destElements[ i ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcloneCopyEvent( elem, clone );\n\t\t\t}\n\t\t}\n\n\t\t// Preserve script evaluation history\n\t\tdestElements = getAll( clone, \"script\" );\n\t\tif ( destElements.length > 0 ) {\n\t\t\tsetGlobalEval( destElements, !inPage && getAll( elem, \"script\" ) );\n\t\t}\n\n\t\t// Return the cloned set\n\t\treturn clone;\n\t},\n\n\tbuildFragment: function( elems, context, scripts, selection ) {\n\t\tvar elem, tmp, tag, wrap, contains, j,\n\t\t\ti = 0,\n\t\t\tl = elems.length,\n\t\t\tfragment = context.createDocumentFragment(),\n\t\t\tnodes = [];\n\n\t\tfor ( ; i < l; i++ ) {\n\t\t\telem = elems[ i ];\n\n\t\t\tif ( elem || elem === 0 ) {\n\n\t\t\t\t// Add nodes directly\n\t\t\t\tif ( jQuery.type( elem ) === \"object\" ) {\n\t\t\t\t\t// Support: QtWebKit\n\t\t\t\t\t// jQuery.merge because core_push.apply(_, arraylike) throws\n\t\t\t\t\tjQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );\n\n\t\t\t\t// Convert non-html into a text node\n\t\t\t\t} else if ( !rhtml.test( elem ) ) {\n\t\t\t\t\tnodes.push( context.createTextNode( elem ) );\n\n\t\t\t\t// Convert html into DOM nodes\n\t\t\t\t} else {\n\t\t\t\t\ttmp = tmp || fragment.appendChild( context.createElement(\"div\") );\n\n\t\t\t\t\t// Deserialize a standard representation\n\t\t\t\t\ttag = ( rtagName.exec( elem ) || [\"\", \"\"] )[ 1 ].toLowerCase();\n\t\t\t\t\twrap = wrapMap[ tag ] || wrapMap._default;\n\t\t\t\t\ttmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, \"<$1></$2>\" ) + wrap[ 2 ];\n\n\t\t\t\t\t// Descend through wrappers to the right content\n\t\t\t\t\tj = wrap[ 0 ];\n\t\t\t\t\twhile ( j-- ) {\n\t\t\t\t\t\ttmp = tmp.lastChild;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Support: QtWebKit\n\t\t\t\t\t// jQuery.merge because core_push.apply(_, arraylike) throws\n\t\t\t\t\tjQuery.merge( nodes, tmp.childNodes );\n\n\t\t\t\t\t// Remember the top-level container\n\t\t\t\t\ttmp = fragment.firstChild;\n\n\t\t\t\t\t// Fixes #12346\n\t\t\t\t\t// Support: Webkit, IE\n\t\t\t\t\ttmp.textContent = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Remove wrapper from fragment\n\t\tfragment.textContent = \"\";\n\n\t\ti = 0;\n\t\twhile ( (elem = nodes[ i++ ]) ) {\n\n\t\t\t// #4087 - If origin and destination elements are the same, and this is\n\t\t\t// that element, do not do anything\n\t\t\tif ( selection && jQuery.inArray( elem, selection ) !== -1 ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcontains = jQuery.contains( elem.ownerDocument, elem );\n\n\t\t\t// Append to fragment\n\t\t\ttmp = getAll( fragment.appendChild( elem ), \"script\" );\n\n\t\t\t// Preserve script evaluation history\n\t\t\tif ( contains ) {\n\t\t\t\tsetGlobalEval( tmp );\n\t\t\t}\n\n\t\t\t// Capture executables\n\t\t\tif ( scripts ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( (elem = tmp[ j++ ]) ) {\n\t\t\t\t\tif ( rscriptType.test( elem.type || \"\" ) ) {\n\t\t\t\t\t\tscripts.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn fragment;\n\t},\n\n\tcleanData: function( elems ) {\n\t\tvar data, elem, events, type, key, j,\n\t\t\tspecial = jQuery.event.special,\n\t\t\ti = 0;\n\n\t\tfor ( ; (elem = elems[ i ]) !== undefined; i++ ) {\n\t\t\tif ( Data.accepts( elem ) ) {\n\t\t\t\tkey = elem[ data_priv.expando ];\n\n\t\t\t\tif ( key && (data = data_priv.cache[ key ]) ) {\n\t\t\t\t\tevents = Object.keys( data.events || {} );\n\t\t\t\t\tif ( events.length ) {\n\t\t\t\t\t\tfor ( j = 0; (type = events[j]) !== undefined; j++ ) {\n\t\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\n\t\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove's overhead\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( data_priv.cache[ key ] ) {\n\t\t\t\t\t\t// Discard any remaining `private` data\n\t\t\t\t\t\tdelete data_priv.cache[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Discard any remaining `user` data\n\t\t\tdelete data_user.cache[ elem[ data_user.expando ] ];\n\t\t}\n\t},\n\n\t_evalUrl: function( url ) {\n\t\treturn jQuery.ajax({\n\t\t\turl: url,\n\t\t\ttype: \"GET\",\n\t\t\tdataType: \"script\",\n\t\t\tasync: false,\n\t\t\tglobal: false,\n\t\t\t\"throws\": true\n\t\t});\n\t}\n});\n\n// Support: 1.x compatibility\n// Manipulating tables requires a tbody\nfunction manipulationTarget( elem, content ) {\n\treturn jQuery.nodeName( elem, \"table\" ) &&\n\t\tjQuery.nodeName( content.nodeType === 1 ? content : content.firstChild, \"tr\" ) ?\n\n\t\telem.getElementsByTagName(\"tbody\")[0] ||\n\t\t\telem.appendChild( elem.ownerDocument.createElement(\"tbody\") ) :\n\t\telem;\n}\n\n// Replace/restore the type attribute of script elements for safe DOM manipulation\nfunction disableScript( elem ) {\n\telem.type = (elem.getAttribute(\"type\") !== null) + \"/\" + elem.type;\n\treturn elem;\n}\nfunction restoreScript( elem ) {\n\tvar match = rscriptTypeMasked.exec( elem.type );\n\n\tif ( match ) {\n\t\telem.type = match[ 1 ];\n\t} else {\n\t\telem.removeAttribute(\"type\");\n\t}\n\n\treturn elem;\n}\n\n// Mark scripts as having already been evaluated\nfunction setGlobalEval( elems, refElements ) {\n\tvar l = elems.length,\n\t\ti = 0;\n\n\tfor ( ; i < l; i++ ) {\n\t\tdata_priv.set(\n\t\t\telems[ i ], \"globalEval\", !refElements || data_priv.get( refElements[ i ], \"globalEval\" )\n\t\t);\n\t}\n}\n\nfunction cloneCopyEvent( src, dest ) {\n\tvar i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;\n\n\tif ( dest.nodeType !== 1 ) {\n\t\treturn;\n\t}\n\n\t// 1. Copy private data: events, handlers, etc.\n\tif ( data_priv.hasData( src ) ) {\n\t\tpdataOld = data_priv.access( src );\n\t\tpdataCur = data_priv.set( dest, pdataOld );\n\t\tevents = pdataOld.events;\n\n\t\tif ( events ) {\n\t\t\tdelete pdataCur.handle;\n\t\t\tpdataCur.events = {};\n\n\t\t\tfor ( type in events ) {\n\t\t\t\tfor ( i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\t\tjQuery.event.add( dest, type, events[ type ][ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// 2. Copy user data\n\tif ( data_user.hasData( src ) ) {\n\t\tudataOld = data_user.access( src );\n\t\tudataCur = jQuery.extend( {}, udataOld );\n\n\t\tdata_user.set( dest, udataCur );\n\t}\n}\n\n\nfunction getAll( context, tag ) {\n\tvar ret = context.getElementsByTagName ? context.getElementsByTagName( tag || \"*\" ) :\n\t\t\tcontext.querySelectorAll ? context.querySelectorAll( tag || \"*\" ) :\n\t\t\t[];\n\n\treturn tag === undefined || tag && jQuery.nodeName( context, tag ) ?\n\t\tjQuery.merge( [ context ], ret ) :\n\t\tret;\n}\n\n// Support: IE >= 9\nfunction fixInput( src, dest ) {\n\tvar nodeName = dest.nodeName.toLowerCase();\n\n\t// Fails to persist the checked state of a cloned checkbox or radio button.\n\tif ( nodeName === \"input\" && manipulation_rcheckableType.test( src.type ) ) {\n\t\tdest.checked = src.checked;\n\n\t// Fails to return the selected option to the default selected state when cloning options\n\t} else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n\t\tdest.defaultValue = src.defaultValue;\n\t}\n}\njQuery.fn.extend({\n\twrapAll: function( html ) {\n\t\tvar wrap;\n\n\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tjQuery( this ).wrapAll( html.call(this, i) );\n\t\t\t});\n\t\t}\n\n\t\tif ( this[ 0 ] ) {\n\n\t\t\t// The elements to wrap the target around\n\t\t\twrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );\n\n\t\t\tif ( this[ 0 ].parentNode ) {\n\t\t\t\twrap.insertBefore( this[ 0 ] );\n\t\t\t}\n\n\t\t\twrap.map(function() {\n\t\t\t\tvar elem = this;\n\n\t\t\t\twhile ( elem.firstElementChild ) {\n\t\t\t\t\telem = elem.firstElementChild;\n\t\t\t\t}\n\n\t\t\t\treturn elem;\n\t\t\t}).append( this );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\twrapInner: function( html ) {\n\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tjQuery( this ).wrapInner( html.call(this, i) );\n\t\t\t});\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tvar self = jQuery( this ),\n\t\t\t\tcontents = self.contents();\n\n\t\t\tif ( contents.length ) {\n\t\t\t\tcontents.wrapAll( html );\n\n\t\t\t} else {\n\t\t\t\tself.append( html );\n\t\t\t}\n\t\t});\n\t},\n\n\twrap: function( html ) {\n\t\tvar isFunction = jQuery.isFunction( html );\n\n\t\treturn this.each(function( i ) {\n\t\t\tjQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );\n\t\t});\n\t},\n\n\tunwrap: function() {\n\t\treturn this.parent().each(function() {\n\t\t\tif ( !jQuery.nodeName( this, \"body\" ) ) {\n\t\t\t\tjQuery( this ).replaceWith( this.childNodes );\n\t\t\t}\n\t\t}).end();\n\t}\n});\nvar curCSS, iframe,\n\t// swappable if display is none or starts with table except \"table\", \"table-cell\", or \"table-caption\"\n\t// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n\trdisplayswap = /^(none|table(?!-c[ea]).+)/,\n\trmargin = /^margin/,\n\trnumsplit = new RegExp( \"^(\" + core_pnum + \")(.*)$\", \"i\" ),\n\trnumnonpx = new RegExp( \"^(\" + core_pnum + \")(?!px)[a-z%]+$\", \"i\" ),\n\trrelNum = new RegExp( \"^([+-])=(\" + core_pnum + \")\", \"i\" ),\n\telemdisplay = { BODY: \"block\" },\n\n\tcssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" },\n\tcssNormalTransform = {\n\t\tletterSpacing: 0,\n\t\tfontWeight: 400\n\t},\n\n\tcssExpand = [ \"Top\", \"Right\", \"Bottom\", \"Left\" ],\n\tcssPrefixes = [ \"Webkit\", \"O\", \"Moz\", \"ms\" ];\n\n// return a css property mapped to a potentially vendor prefixed property\nfunction vendorPropName( style, name ) {\n\n\t// shortcut for names that are not vendor prefixed\n\tif ( name in style ) {\n\t\treturn name;\n\t}\n\n\t// check for vendor prefixed names\n\tvar capName = name.charAt(0).toUpperCase() + name.slice(1),\n\t\torigName = name,\n\t\ti = cssPrefixes.length;\n\n\twhile ( i-- ) {\n\t\tname = cssPrefixes[ i ] + capName;\n\t\tif ( name in style ) {\n\t\t\treturn name;\n\t\t}\n\t}\n\n\treturn origName;\n}\n\nfunction isHidden( elem, el ) {\n\t// isHidden might be called from jQuery#filter function;\n\t// in that case, element will be second argument\n\telem = el || elem;\n\treturn jQuery.css( elem, \"display\" ) === \"none\" || !jQuery.contains( elem.ownerDocument, elem );\n}\n\n// NOTE: we've included the \"window\" in window.getComputedStyle\n// because jsdom on node.js will break without it.\nfunction getStyles( elem ) {\n\treturn window.getComputedStyle( elem, null );\n}\n\nfunction showHide( elements, show ) {\n\tvar display, elem, hidden,\n\t\tvalues = [],\n\t\tindex = 0,\n\t\tlength = elements.length;\n\n\tfor ( ; index < length; index++ ) {\n\t\telem = elements[ index ];\n\t\tif ( !elem.style ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tvalues[ index ] = data_priv.get( elem, \"olddisplay\" );\n\t\tdisplay = elem.style.display;\n\t\tif ( show ) {\n\t\t\t// Reset the inline display of this element to learn if it is\n\t\t\t// being hidden by cascaded rules or not\n\t\t\tif ( !values[ index ] && display === \"none\" ) {\n\t\t\t\telem.style.display = \"\";\n\t\t\t}\n\n\t\t\t// Set elements which have been overridden with display: none\n\t\t\t// in a stylesheet to whatever the default browser style is\n\t\t\t// for such an element\n\t\t\tif ( elem.style.display === \"\" && isHidden( elem ) ) {\n\t\t\t\tvalues[ index ] = data_priv.access( elem, \"olddisplay\", css_defaultDisplay(elem.nodeName) );\n\t\t\t}\n\t\t} else {\n\n\t\t\tif ( !values[ index ] ) {\n\t\t\t\thidden = isHidden( elem );\n\n\t\t\t\tif ( display && display !== \"none\" || !hidden ) {\n\t\t\t\t\tdata_priv.set( elem, \"olddisplay\", hidden ? display : jQuery.css(elem, \"display\") );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set the display of most of the elements in a second loop\n\t// to avoid the constant reflow\n\tfor ( index = 0; index < length; index++ ) {\n\t\telem = elements[ index ];\n\t\tif ( !elem.style ) {\n\t\t\tcontinue;\n\t\t}\n\t\tif ( !show || elem.style.display === \"none\" || elem.style.display === \"\" ) {\n\t\t\telem.style.display = show ? values[ index ] || \"\" : \"none\";\n\t\t}\n\t}\n\n\treturn elements;\n}\n\njQuery.fn.extend({\n\tcss: function( name, value ) {\n\t\treturn jQuery.access( this, function( elem, name, value ) {\n\t\t\tvar styles, len,\n\t\t\t\tmap = {},\n\t\t\t\ti = 0;\n\n\t\t\tif ( jQuery.isArray( name ) ) {\n\t\t\t\tstyles = getStyles( elem );\n\t\t\t\tlen = name.length;\n\n\t\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\t\tmap[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );\n\t\t\t\t}\n\n\t\t\t\treturn map;\n\t\t\t}\n\n\t\t\treturn value !== undefined ?\n\t\t\t\tjQuery.style( elem, name, value ) :\n\t\t\t\tjQuery.css( elem, name );\n\t\t}, name, value, arguments.length > 1 );\n\t},\n\tshow: function() {\n\t\treturn showHide( this, true );\n\t},\n\thide: function() {\n\t\treturn showHide( this );\n\t},\n\ttoggle: function( state ) {\n\t\tif ( typeof state === \"boolean\" ) {\n\t\t\treturn state ? this.show() : this.hide();\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tif ( isHidden( this ) ) {\n\t\t\t\tjQuery( this ).show();\n\t\t\t} else {\n\t\t\t\tjQuery( this ).hide();\n\t\t\t}\n\t\t});\n\t}\n});\n\njQuery.extend({\n\t// Add in style property hooks for overriding the default\n\t// behavior of getting and setting a style property\n\tcssHooks: {\n\t\topacity: {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\t\t\t\t\t// We should always get a number back from opacity\n\t\t\t\t\tvar ret = curCSS( elem, \"opacity\" );\n\t\t\t\t\treturn ret === \"\" ? \"1\" : ret;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t// Don't automatically add \"px\" to these possibly-unitless properties\n\tcssNumber: {\n\t\t\"columnCount\": true,\n\t\t\"fillOpacity\": true,\n\t\t\"fontWeight\": true,\n\t\t\"lineHeight\": true,\n\t\t\"opacity\": true,\n\t\t\"order\": true,\n\t\t\"orphans\": true,\n\t\t\"widows\": true,\n\t\t\"zIndex\": true,\n\t\t\"zoom\": true\n\t},\n\n\t// Add in properties whose names you wish to fix before\n\t// setting or getting the value\n\tcssProps: {\n\t\t// normalize float css property\n\t\t\"float\": \"cssFloat\"\n\t},\n\n\t// Get and set the style property on a DOM Node\n\tstyle: function( elem, name, value, extra ) {\n\t\t// Don't set styles on text and comment nodes\n\t\tif ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure that we're working with the right name\n\t\tvar ret, type, hooks,\n\t\t\torigName = jQuery.camelCase( name ),\n\t\t\tstyle = elem.style;\n\n\t\tname = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );\n\n\t\t// gets hook for the prefixed version\n\t\t// followed by the unprefixed version\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// Check if we're setting a value\n\t\tif ( value !== undefined ) {\n\t\t\ttype = typeof value;\n\n\t\t\t// convert relative number strings (+= or -=) to relative numbers. #7345\n\t\t\tif ( type === \"string\" && (ret = rrelNum.exec( value )) ) {\n\t\t\t\tvalue = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );\n\t\t\t\t// Fixes bug #9237\n\t\t\t\ttype = \"number\";\n\t\t\t}\n\n\t\t\t// Make sure that NaN and null values aren't set. See: #7116\n\t\t\tif ( value == null || type === \"number\" && isNaN( value ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If a number was passed in, add 'px' to the (except for certain CSS properties)\n\t\t\tif ( type === \"number\" && !jQuery.cssNumber[ origName ] ) {\n\t\t\t\tvalue += \"px\";\n\t\t\t}\n\n\t\t\t// Fixes #8908, it can be done more correctly by specifying setters in cssHooks,\n\t\t\t// but it would mean to define eight (for every problematic property) identical functions\n\t\t\tif ( !jQuery.support.clearCloneStyle && value === \"\" && name.indexOf(\"background\") === 0 ) {\n\t\t\t\tstyle[ name ] = \"inherit\";\n\t\t\t}\n\n\t\t\t// If a hook was provided, use that value, otherwise just set the specified value\n\t\t\tif ( !hooks || !(\"set\" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {\n\t\t\t\tstyle[ name ] = value;\n\t\t\t}\n\n\t\t} else {\n\t\t\t// If a hook was provided get the non-computed value from there\n\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\t// Otherwise just get the value from the style object\n\t\t\treturn style[ name ];\n\t\t}\n\t},\n\n\tcss: function( elem, name, extra, styles ) {\n\t\tvar val, num, hooks,\n\t\t\torigName = jQuery.camelCase( name );\n\n\t\t// Make sure that we're working with the right name\n\t\tname = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );\n\n\t\t// gets hook for the prefixed version\n\t\t// followed by the unprefixed version\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// If a hook was provided get the computed value from there\n\t\tif ( hooks && \"get\" in hooks ) {\n\t\t\tval = hooks.get( elem, true, extra );\n\t\t}\n\n\t\t// Otherwise, if a way to get the computed value exists, use that\n\t\tif ( val === undefined ) {\n\t\t\tval = curCSS( elem, name, styles );\n\t\t}\n\n\t\t//convert \"normal\" to computed value\n\t\tif ( val === \"normal\" && name in cssNormalTransform ) {\n\t\t\tval = cssNormalTransform[ name ];\n\t\t}\n\n\t\t// Return, converting to number if forced or a qualifier was provided and val looks numeric\n\t\tif ( extra === \"\" || extra ) {\n\t\t\tnum = parseFloat( val );\n\t\t\treturn extra === true || jQuery.isNumeric( num ) ? num || 0 : val;\n\t\t}\n\t\treturn val;\n\t}\n});\n\ncurCSS = function( elem, name, _computed ) {\n\tvar width, minWidth, maxWidth,\n\t\tcomputed = _computed || getStyles( elem ),\n\n\t\t// Support: IE9\n\t\t// getPropertyValue is only needed for .css('filter') in IE9, see #12537\n\t\tret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,\n\t\tstyle = elem.style;\n\n\tif ( computed ) {\n\n\t\tif ( ret === \"\" && !jQuery.contains( elem.ownerDocument, elem ) ) {\n\t\t\tret = jQuery.style( elem, name );\n\t\t}\n\n\t\t// Support: Safari 5.1\n\t\t// A tribute to the \"awesome hack by Dean Edwards\"\n\t\t// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels\n\t\t// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values\n\t\tif ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {\n\n\t\t\t// Remember the original values\n\t\t\twidth = style.width;\n\t\t\tminWidth = style.minWidth;\n\t\t\tmaxWidth = style.maxWidth;\n\n\t\t\t// Put in the new values to get a computed value out\n\t\t\tstyle.minWidth = style.maxWidth = style.width = ret;\n\t\t\tret = computed.width;\n\n\t\t\t// Revert the changed values\n\t\t\tstyle.width = width;\n\t\t\tstyle.minWidth = minWidth;\n\t\t\tstyle.maxWidth = maxWidth;\n\t\t}\n\t}\n\n\treturn ret;\n};\n\n\nfunction setPositiveNumber( elem, value, subtract ) {\n\tvar matches = rnumsplit.exec( value );\n\treturn matches ?\n\t\t// Guard against undefined \"subtract\", e.g., when used as in cssHooks\n\t\tMath.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || \"px\" ) :\n\t\tvalue;\n}\n\nfunction augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {\n\tvar i = extra === ( isBorderBox ? \"border\" : \"content\" ) ?\n\t\t// If we already have the right measurement, avoid augmentation\n\t\t4 :\n\t\t// Otherwise initialize for horizontal or vertical properties\n\t\tname === \"width\" ? 1 : 0,\n\n\t\tval = 0;\n\n\tfor ( ; i < 4; i += 2 ) {\n\t\t// both box models exclude margin, so add it if we want it\n\t\tif ( extra === \"margin\" ) {\n\t\t\tval += jQuery.css( elem, extra + cssExpand[ i ], true, styles );\n\t\t}\n\n\t\tif ( isBorderBox ) {\n\t\t\t// border-box includes padding, so remove it if we want content\n\t\t\tif ( extra === \"content\" ) {\n\t\t\t\tval -= jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\t\t\t}\n\n\t\t\t// at this point, extra isn't border nor margin, so remove border\n\t\t\tif ( extra !== \"margin\" ) {\n\t\t\t\tval -= jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t}\n\t\t} else {\n\t\t\t// at this point, extra isn't content, so add padding\n\t\t\tval += jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\n\t\t\t// at this point, extra isn't content nor padding, so add border\n\t\t\tif ( extra !== \"padding\" ) {\n\t\t\t\tval += jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn val;\n}\n\nfunction getWidthOrHeight( elem, name, extra ) {\n\n\t// Start with offset property, which is equivalent to the border-box value\n\tvar valueIsBorderBox = true,\n\t\tval = name === \"width\" ? elem.offsetWidth : elem.offsetHeight,\n\t\tstyles = getStyles( elem ),\n\t\tisBorderBox = jQuery.support.boxSizing && jQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\";\n\n\t// some non-html elements return undefined for offsetWidth, so check for null/undefined\n\t// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285\n\t// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668\n\tif ( val <= 0 || val == null ) {\n\t\t// Fall back to computed then uncomputed css if necessary\n\t\tval = curCSS( elem, name, styles );\n\t\tif ( val < 0 || val == null ) {\n\t\t\tval = elem.style[ name ];\n\t\t}\n\n\t\t// Computed unit is not pixels. Stop here and return.\n\t\tif ( rnumnonpx.test(val) ) {\n\t\t\treturn val;\n\t\t}\n\n\t\t// we need the check for style in case a browser which returns unreliable values\n\t\t// for getComputedStyle silently falls back to the reliable elem.style\n\t\tvalueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );\n\n\t\t// Normalize \"\", auto, and prepare for extra\n\t\tval = parseFloat( val ) || 0;\n\t}\n\n\t// use the active box-sizing model to add/subtract irrelevant styles\n\treturn ( val +\n\t\taugmentWidthOrHeight(\n\t\t\telem,\n\t\t\tname,\n\t\t\textra || ( isBorderBox ? \"border\" : \"content\" ),\n\t\t\tvalueIsBorderBox,\n\t\t\tstyles\n\t\t)\n\t) + \"px\";\n}\n\n// Try to determine the default display value of an element\nfunction css_defaultDisplay( nodeName ) {\n\tvar doc = document,\n\t\tdisplay = elemdisplay[ nodeName ];\n\n\tif ( !display ) {\n\t\tdisplay = actualDisplay( nodeName, doc );\n\n\t\t// If the simple way fails, read from inside an iframe\n\t\tif ( display === \"none\" || !display ) {\n\t\t\t// Use the already-created iframe if possible\n\t\t\tiframe = ( iframe ||\n\t\t\t\tjQuery(\"<iframe frameborder='0' width='0' height='0'/>\")\n\t\t\t\t.css( \"cssText\", \"display:block !important\" )\n\t\t\t).appendTo( doc.documentElement );\n\n\t\t\t// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse\n\t\t\tdoc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;\n\t\t\tdoc.write(\"<!doctype html><html><body>\");\n\t\t\tdoc.close();\n\n\t\t\tdisplay = actualDisplay( nodeName, doc );\n\t\t\tiframe.detach();\n\t\t}\n\n\t\t// Store the correct default display\n\t\telemdisplay[ nodeName ] = display;\n\t}\n\n\treturn display;\n}\n\n// Called ONLY from within css_defaultDisplay\nfunction actualDisplay( name, doc ) {\n\tvar elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),\n\t\tdisplay = jQuery.css( elem[0], \"display\" );\n\telem.remove();\n\treturn display;\n}\n\njQuery.each([ \"height\", \"width\" ], function( i, name ) {\n\tjQuery.cssHooks[ name ] = {\n\t\tget: function( elem, computed, extra ) {\n\t\t\tif ( computed ) {\n\t\t\t\t// certain elements can have dimension info if we invisibly show them\n\t\t\t\t// however, it must have a current display style that would benefit from this\n\t\t\t\treturn elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, \"display\" ) ) ?\n\t\t\t\t\tjQuery.swap( elem, cssShow, function() {\n\t\t\t\t\t\treturn getWidthOrHeight( elem, name, extra );\n\t\t\t\t\t}) :\n\t\t\t\t\tgetWidthOrHeight( elem, name, extra );\n\t\t\t}\n\t\t},\n\n\t\tset: function( elem, value, extra ) {\n\t\t\tvar styles = extra && getStyles( elem );\n\t\t\treturn setPositiveNumber( elem, value, extra ?\n\t\t\t\taugmentWidthOrHeight(\n\t\t\t\t\telem,\n\t\t\t\t\tname,\n\t\t\t\t\textra,\n\t\t\t\t\tjQuery.support.boxSizing && jQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\",\n\t\t\t\t\tstyles\n\t\t\t\t) : 0\n\t\t\t);\n\t\t}\n\t};\n});\n\n// These hooks cannot be added until DOM ready because the support test\n// for it is not run until after DOM ready\njQuery(function() {\n\t// Support: Android 2.3\n\tif ( !jQuery.support.reliableMarginRight ) {\n\t\tjQuery.cssHooks.marginRight = {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\t\t\t\t\t// Support: Android 2.3\n\t\t\t\t\t// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n\t\t\t\t\t// Work around by temporarily setting element display to inline-block\n\t\t\t\t\treturn jQuery.swap( elem, { \"display\": \"inline-block\" },\n\t\t\t\t\t\tcurCSS, [ elem, \"marginRight\" ] );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\n\t// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084\n\t// getComputedStyle returns percent when specified for top/left/bottom/right\n\t// rather than make the css module depend on the offset module, we just check for it here\n\tif ( !jQuery.support.pixelPosition && jQuery.fn.position ) {\n\t\tjQuery.each( [ \"top\", \"left\" ], function( i, prop ) {\n\t\t\tjQuery.cssHooks[ prop ] = {\n\t\t\t\tget: function( elem, computed ) {\n\t\t\t\t\tif ( computed ) {\n\t\t\t\t\t\tcomputed = curCSS( elem, prop );\n\t\t\t\t\t\t// if curCSS returns percentage, fallback to offset\n\t\t\t\t\t\treturn rnumnonpx.test( computed ) ?\n\t\t\t\t\t\t\tjQuery( elem ).position()[ prop ] + \"px\" :\n\t\t\t\t\t\t\tcomputed;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t}\n\n});\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n\tjQuery.expr.filters.hidden = function( elem ) {\n\t\t// Support: Opera <= 12.12\n\t\t// Opera reports offsetWidths and offsetHeights less than zero on some elements\n\t\treturn elem.offsetWidth <= 0 && elem.offsetHeight <= 0;\n\t};\n\n\tjQuery.expr.filters.visible = function( elem ) {\n\t\treturn !jQuery.expr.filters.hidden( elem );\n\t};\n}\n\n// These hooks are used by animate to expand properties\njQuery.each({\n\tmargin: \"\",\n\tpadding: \"\",\n\tborder: \"Width\"\n}, function( prefix, suffix ) {\n\tjQuery.cssHooks[ prefix + suffix ] = {\n\t\texpand: function( value ) {\n\t\t\tvar i = 0,\n\t\t\t\texpanded = {},\n\n\t\t\t\t// assumes a single number if not a string\n\t\t\t\tparts = typeof value === \"string\" ? value.split(\" \") : [ value ];\n\n\t\t\tfor ( ; i < 4; i++ ) {\n\t\t\t\texpanded[ prefix + cssExpand[ i ] + suffix ] =\n\t\t\t\t\tparts[ i ] || parts[ i - 2 ] || parts[ 0 ];\n\t\t\t}\n\n\t\t\treturn expanded;\n\t\t}\n\t};\n\n\tif ( !rmargin.test( prefix ) ) {\n\t\tjQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;\n\t}\n});\nvar r20 = /%20/g,\n\trbracket = /\\[\\]$/,\n\trCRLF = /\\r?\\n/g,\n\trsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,\n\trsubmittable = /^(?:input|select|textarea|keygen)/i;\n\njQuery.fn.extend({\n\tserialize: function() {\n\t\treturn jQuery.param( this.serializeArray() );\n\t},\n\tserializeArray: function() {\n\t\treturn this.map(function(){\n\t\t\t// Can add propHook for \"elements\" to filter or add form elements\n\t\t\tvar elements = jQuery.prop( this, \"elements\" );\n\t\t\treturn elements ? jQuery.makeArray( elements ) : this;\n\t\t})\n\t\t.filter(function(){\n\t\t\tvar type = this.type;\n\t\t\t// Use .is(\":disabled\") so that fieldset[disabled] works\n\t\t\treturn this.name && !jQuery( this ).is( \":disabled\" ) &&\n\t\t\t\trsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&\n\t\t\t\t( this.checked || !manipulation_rcheckableType.test( type ) );\n\t\t})\n\t\t.map(function( i, elem ){\n\t\t\tvar val = jQuery( this ).val();\n\n\t\t\treturn val == null ?\n\t\t\t\tnull :\n\t\t\t\tjQuery.isArray( val ) ?\n\t\t\t\t\tjQuery.map( val, function( val ){\n\t\t\t\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t\t\t\t}) :\n\t\t\t\t\t{ name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t}).get();\n\t}\n});\n\n//Serialize an array of form elements or a set of\n//key/values into a query string\njQuery.param = function( a, traditional ) {\n\tvar prefix,\n\t\ts = [],\n\t\tadd = function( key, value ) {\n\t\t\t// If value is a function, invoke it and return its value\n\t\t\tvalue = jQuery.isFunction( value ) ? value() : ( value == null ? \"\" : value );\n\t\t\ts[ s.length ] = encodeURIComponent( key ) + \"=\" + encodeURIComponent( value );\n\t\t};\n\n\t// Set traditional to true for jQuery <= 1.3.2 behavior.\n\tif ( traditional === undefined ) {\n\t\ttraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;\n\t}\n\n\t// If an array was passed in, assume that it is an array of form elements.\n\tif ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n\t\t// Serialize the form elements\n\t\tjQuery.each( a, function() {\n\t\t\tadd( this.name, this.value );\n\t\t});\n\n\t} else {\n\t\t// If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t\t// did it), otherwise encode params recursively.\n\t\tfor ( prefix in a ) {\n\t\t\tbuildParams( prefix, a[ prefix ], traditional, add );\n\t\t}\n\t}\n\n\t// Return the resulting serialization\n\treturn s.join( \"&\" ).replace( r20, \"+\" );\n};\n\nfunction buildParams( prefix, obj, traditional, add ) {\n\tvar name;\n\n\tif ( jQuery.isArray( obj ) ) {\n\t\t// Serialize array item.\n\t\tjQuery.each( obj, function( i, v ) {\n\t\t\tif ( traditional || rbracket.test( prefix ) ) {\n\t\t\t\t// Treat each array item as a scalar.\n\t\t\t\tadd( prefix, v );\n\n\t\t\t} else {\n\t\t\t\t// Item is non-scalar (array or object), encode its numeric index.\n\t\t\t\tbuildParams( prefix + \"[\" + ( typeof v === \"object\" ? i : \"\" ) + \"]\", v, traditional, add );\n\t\t\t}\n\t\t});\n\n\t} else if ( !traditional && jQuery.type( obj ) === \"object\" ) {\n\t\t// Serialize object item.\n\t\tfor ( name in obj ) {\n\t\t\tbuildParams( prefix + \"[\" + name + \"]\", obj[ name ], traditional, add );\n\t\t}\n\n\t} else {\n\t\t// Serialize scalar item.\n\t\tadd( prefix, obj );\n\t}\n}\njQuery.each( (\"blur focus focusin focusout load resize scroll unload click dblclick \" +\n\t\"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n\t\"change select submit keydown keypress keyup error contextmenu\").split(\" \"), function( i, name ) {\n\n\t// Handle event binding\n\tjQuery.fn[ name ] = function( data, fn ) {\n\t\treturn arguments.length > 0 ?\n\t\t\tthis.on( name, null, data, fn ) :\n\t\t\tthis.trigger( name );\n\t};\n});\n\njQuery.fn.extend({\n\thover: function( fnOver, fnOut ) {\n\t\treturn this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\n\t},\n\n\tbind: function( types, data, fn ) {\n\t\treturn this.on( types, null, data, fn );\n\t},\n\tunbind: function( types, fn ) {\n\t\treturn this.off( types, null, fn );\n\t},\n\n\tdelegate: function( selector, types, data, fn ) {\n\t\treturn this.on( types, selector, data, fn );\n\t},\n\tundelegate: function( selector, types, fn ) {\n\t\t// ( namespace ) or ( selector, types [, fn] )\n\t\treturn arguments.length === 1 ? this.off( selector, \"**\" ) : this.off( types, selector || \"**\", fn );\n\t}\n});\nvar\n\t// Document location\n\tajaxLocParts,\n\tajaxLocation,\n\n\tajax_nonce = jQuery.now(),\n\n\tajax_rquery = /\\?/,\n\trhash = /#.*$/,\n\trts = /([?&])_=[^&]*/,\n\trheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg,\n\t// #7653, #8125, #8152: local protocol detection\n\trlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,\n\trnoContent = /^(?:GET|HEAD)$/,\n\trprotocol = /^\\/\\//,\n\trurl = /^([\\w.+-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+)|)|)/,\n\n\t// Keep a copy of the old load method\n\t_load = jQuery.fn.load,\n\n\t/* Prefilters\n\t * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n\t * 2) These are called:\n\t *    - BEFORE asking for a transport\n\t *    - AFTER param serialization (s.data is a string if s.processData is true)\n\t * 3) key is the dataType\n\t * 4) the catchall symbol \"*\" can be used\n\t * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n\t */\n\tprefilters = {},\n\n\t/* Transports bindings\n\t * 1) key is the dataType\n\t * 2) the catchall symbol \"*\" can be used\n\t * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n\t */\n\ttransports = {},\n\n\t// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n\tallTypes = \"*/\".concat(\"*\");\n\n// #8138, IE may throw an exception when accessing\n// a field from window.location if document.domain has been set\ntry {\n\tajaxLocation = location.href;\n} catch( e ) {\n\t// Use the href attribute of an A element\n\t// since IE will modify it given document.location\n\tajaxLocation = document.createElement( \"a\" );\n\tajaxLocation.href = \"\";\n\tajaxLocation = ajaxLocation.href;\n}\n\n// Segment location into parts\najaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];\n\n// Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\nfunction addToPrefiltersOrTransports( structure ) {\n\n\t// dataTypeExpression is optional and defaults to \"*\"\n\treturn function( dataTypeExpression, func ) {\n\n\t\tif ( typeof dataTypeExpression !== \"string\" ) {\n\t\t\tfunc = dataTypeExpression;\n\t\t\tdataTypeExpression = \"*\";\n\t\t}\n\n\t\tvar dataType,\n\t\t\ti = 0,\n\t\t\tdataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || [];\n\n\t\tif ( jQuery.isFunction( func ) ) {\n\t\t\t// For each dataType in the dataTypeExpression\n\t\t\twhile ( (dataType = dataTypes[i++]) ) {\n\t\t\t\t// Prepend if requested\n\t\t\t\tif ( dataType[0] === \"+\" ) {\n\t\t\t\t\tdataType = dataType.slice( 1 ) || \"*\";\n\t\t\t\t\t(structure[ dataType ] = structure[ dataType ] || []).unshift( func );\n\n\t\t\t\t// Otherwise append\n\t\t\t\t} else {\n\t\t\t\t\t(structure[ dataType ] = structure[ dataType ] || []).push( func );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\n// Base inspection function for prefilters and transports\nfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {\n\n\tvar inspected = {},\n\t\tseekingTransport = ( structure === transports );\n\n\tfunction inspect( dataType ) {\n\t\tvar selected;\n\t\tinspected[ dataType ] = true;\n\t\tjQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {\n\t\t\tvar dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );\n\t\t\tif( typeof dataTypeOrTransport === \"string\" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) {\n\t\t\t\toptions.dataTypes.unshift( dataTypeOrTransport );\n\t\t\t\tinspect( dataTypeOrTransport );\n\t\t\t\treturn false;\n\t\t\t} else if ( seekingTransport ) {\n\t\t\t\treturn !( selected = dataTypeOrTransport );\n\t\t\t}\n\t\t});\n\t\treturn selected;\n\t}\n\n\treturn inspect( options.dataTypes[ 0 ] ) || !inspected[ \"*\" ] && inspect( \"*\" );\n}\n\n// A special extend for ajax options\n// that takes \"flat\" options (not to be deep extended)\n// Fixes #9887\nfunction ajaxExtend( target, src ) {\n\tvar key, deep,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}\n\njQuery.fn.load = function( url, params, callback ) {\n\tif ( typeof url !== \"string\" && _load ) {\n\t\treturn _load.apply( this, arguments );\n\t}\n\n\tvar selector, type, response,\n\t\tself = this,\n\t\toff = url.indexOf(\" \");\n\n\tif ( off >= 0 ) {\n\t\tselector = url.slice( off );\n\t\turl = url.slice( 0, off );\n\t}\n\n\t// If it's a function\n\tif ( jQuery.isFunction( params ) ) {\n\n\t\t// We assume that it's the callback\n\t\tcallback = params;\n\t\tparams = undefined;\n\n\t// Otherwise, build a param string\n\t} else if ( params && typeof params === \"object\" ) {\n\t\ttype = \"POST\";\n\t}\n\n\t// If we have elements to modify, make the request\n\tif ( self.length > 0 ) {\n\t\tjQuery.ajax({\n\t\t\turl: url,\n\n\t\t\t// if \"type\" variable is undefined, then \"GET\" method will be used\n\t\t\ttype: type,\n\t\t\tdataType: \"html\",\n\t\t\tdata: params\n\t\t}).done(function( responseText ) {\n\n\t\t\t// Save response for use in complete callback\n\t\t\tresponse = arguments;\n\n\t\t\tself.html( selector ?\n\n\t\t\t\t// If a selector was specified, locate the right elements in a dummy div\n\t\t\t\t// Exclude scripts to avoid IE 'Permission Denied' errors\n\t\t\t\tjQuery(\"<div>\").append( jQuery.parseHTML( responseText ) ).find( selector ) :\n\n\t\t\t\t// Otherwise use the full result\n\t\t\t\tresponseText );\n\n\t\t}).complete( callback && function( jqXHR, status ) {\n\t\t\tself.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );\n\t\t});\n\t}\n\n\treturn this;\n};\n\n// Attach a bunch of functions for handling common AJAX events\njQuery.each( [ \"ajaxStart\", \"ajaxStop\", \"ajaxComplete\", \"ajaxError\", \"ajaxSuccess\", \"ajaxSend\" ], function( i, type ){\n\tjQuery.fn[ type ] = function( fn ){\n\t\treturn this.on( type, fn );\n\t};\n});\n\njQuery.extend({\n\n\t// Counter for holding the number of active queries\n\tactive: 0,\n\n\t// Last-Modified header cache for next request\n\tlastModified: {},\n\tetag: {},\n\n\tajaxSettings: {\n\t\turl: ajaxLocation,\n\t\ttype: \"GET\",\n\t\tisLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),\n\t\tglobal: true,\n\t\tprocessData: true,\n\t\tasync: true,\n\t\tcontentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n\t\t/*\n\t\ttimeout: 0,\n\t\tdata: null,\n\t\tdataType: null,\n\t\tusername: null,\n\t\tpassword: null,\n\t\tcache: null,\n\t\tthrows: false,\n\t\ttraditional: false,\n\t\theaders: {},\n\t\t*/\n\n\t\taccepts: {\n\t\t\t\"*\": allTypes,\n\t\t\ttext: \"text/plain\",\n\t\t\thtml: \"text/html\",\n\t\t\txml: \"application/xml, text/xml\",\n\t\t\tjson: \"application/json, text/javascript\"\n\t\t},\n\n\t\tcontents: {\n\t\t\txml: /xml/,\n\t\t\thtml: /html/,\n\t\t\tjson: /json/\n\t\t},\n\n\t\tresponseFields: {\n\t\t\txml: \"responseXML\",\n\t\t\ttext: \"responseText\",\n\t\t\tjson: \"responseJSON\"\n\t\t},\n\n\t\t// Data converters\n\t\t// Keys separate source (or catchall \"*\") and destination types with a single space\n\t\tconverters: {\n\n\t\t\t// Convert anything to text\n\t\t\t\"* text\": String,\n\n\t\t\t// Text to html (true = no transformation)\n\t\t\t\"text html\": true,\n\n\t\t\t// Evaluate text as a json expression\n\t\t\t\"text json\": jQuery.parseJSON,\n\n\t\t\t// Parse text as xml\n\t\t\t\"text xml\": jQuery.parseXML\n\t\t},\n\n\t\t// For options that shouldn't be deep extended:\n\t\t// you can add your own custom options here if\n\t\t// and when you create one that shouldn't be\n\t\t// deep extended (see ajaxExtend)\n\t\tflatOptions: {\n\t\t\turl: true,\n\t\t\tcontext: true\n\t\t}\n\t},\n\n\t// Creates a full fledged settings object into target\n\t// with both ajaxSettings and settings fields.\n\t// If target is omitted, writes into ajaxSettings.\n\tajaxSetup: function( target, settings ) {\n\t\treturn settings ?\n\n\t\t\t// Building a settings object\n\t\t\tajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :\n\n\t\t\t// Extending ajaxSettings\n\t\t\tajaxExtend( jQuery.ajaxSettings, target );\n\t},\n\n\tajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n\tajaxTransport: addToPrefiltersOrTransports( transports ),\n\n\t// Main method\n\tajax: function( url, options ) {\n\n\t\t// If url is an object, simulate pre-1.5 signature\n\t\tif ( typeof url === \"object\" ) {\n\t\t\toptions = url;\n\t\t\turl = undefined;\n\t\t}\n\n\t\t// Force options to be an object\n\t\toptions = options || {};\n\n\t\tvar transport,\n\t\t\t// URL without anti-cache param\n\t\t\tcacheURL,\n\t\t\t// Response headers\n\t\t\tresponseHeadersString,\n\t\t\tresponseHeaders,\n\t\t\t// timeout handle\n\t\t\ttimeoutTimer,\n\t\t\t// Cross-domain detection vars\n\t\t\tparts,\n\t\t\t// To know if global events are to be dispatched\n\t\t\tfireGlobals,\n\t\t\t// Loop variable\n\t\t\ti,\n\t\t\t// Create the final options object\n\t\t\ts = jQuery.ajaxSetup( {}, options ),\n\t\t\t// Callbacks context\n\t\t\tcallbackContext = s.context || s,\n\t\t\t// Context for global events is callbackContext if it is a DOM node or jQuery collection\n\t\t\tglobalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ?\n\t\t\t\tjQuery( callbackContext ) :\n\t\t\t\tjQuery.event,\n\t\t\t// Deferreds\n\t\t\tdeferred = jQuery.Deferred(),\n\t\t\tcompleteDeferred = jQuery.Callbacks(\"once memory\"),\n\t\t\t// Status-dependent callbacks\n\t\t\tstatusCode = s.statusCode || {},\n\t\t\t// Headers (they are sent all at once)\n\t\t\trequestHeaders = {},\n\t\t\trequestHeadersNames = {},\n\t\t\t// The jqXHR state\n\t\t\tstate = 0,\n\t\t\t// Default abort message\n\t\t\tstrAbort = \"canceled\",\n\t\t\t// Fake xhr\n\t\t\tjqXHR = {\n\t\t\t\treadyState: 0,\n\n\t\t\t\t// Builds headers hashtable if needed\n\t\t\t\tgetResponseHeader: function( key ) {\n\t\t\t\t\tvar match;\n\t\t\t\t\tif ( state === 2 ) {\n\t\t\t\t\t\tif ( !responseHeaders ) {\n\t\t\t\t\t\t\tresponseHeaders = {};\n\t\t\t\t\t\t\twhile ( (match = rheaders.exec( responseHeadersString )) ) {\n\t\t\t\t\t\t\t\tresponseHeaders[ match[1].toLowerCase() ] = match[ 2 ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatch = responseHeaders[ key.toLowerCase() ];\n\t\t\t\t\t}\n\t\t\t\t\treturn match == null ? null : match;\n\t\t\t\t},\n\n\t\t\t\t// Raw string\n\t\t\t\tgetAllResponseHeaders: function() {\n\t\t\t\t\treturn state === 2 ? responseHeadersString : null;\n\t\t\t\t},\n\n\t\t\t\t// Caches the header\n\t\t\t\tsetRequestHeader: function( name, value ) {\n\t\t\t\t\tvar lname = name.toLowerCase();\n\t\t\t\t\tif ( !state ) {\n\t\t\t\t\t\tname = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;\n\t\t\t\t\t\trequestHeaders[ name ] = value;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Overrides response content-type header\n\t\t\t\toverrideMimeType: function( type ) {\n\t\t\t\t\tif ( !state ) {\n\t\t\t\t\t\ts.mimeType = type;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Status-dependent callbacks\n\t\t\t\tstatusCode: function( map ) {\n\t\t\t\t\tvar code;\n\t\t\t\t\tif ( map ) {\n\t\t\t\t\t\tif ( state < 2 ) {\n\t\t\t\t\t\t\tfor ( code in map ) {\n\t\t\t\t\t\t\t\t// Lazy-add the new callback in a way that preserves old ones\n\t\t\t\t\t\t\t\tstatusCode[ code ] = [ statusCode[ code ], map[ code ] ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Execute the appropriate callbacks\n\t\t\t\t\t\t\tjqXHR.always( map[ jqXHR.status ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Cancel the request\n\t\t\t\tabort: function( statusText ) {\n\t\t\t\t\tvar finalText = statusText || strAbort;\n\t\t\t\t\tif ( transport ) {\n\t\t\t\t\t\ttransport.abort( finalText );\n\t\t\t\t\t}\n\t\t\t\t\tdone( 0, finalText );\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t};\n\n\t\t// Attach deferreds\n\t\tdeferred.promise( jqXHR ).complete = completeDeferred.add;\n\t\tjqXHR.success = jqXHR.done;\n\t\tjqXHR.error = jqXHR.fail;\n\n\t\t// Remove hash character (#7531: and string promotion)\n\t\t// Add protocol if not provided (prefilters might expect it)\n\t\t// Handle falsy url in the settings object (#10093: consistency with old signature)\n\t\t// We also use the url parameter if available\n\t\ts.url = ( ( url || s.url || ajaxLocation ) + \"\" ).replace( rhash, \"\" )\n\t\t\t.replace( rprotocol, ajaxLocParts[ 1 ] + \"//\" );\n\n\t\t// Alias method option to type as per ticket #12004\n\t\ts.type = options.method || options.type || s.method || s.type;\n\n\t\t// Extract dataTypes list\n\t\ts.dataTypes = jQuery.trim( s.dataType || \"*\" ).toLowerCase().match( core_rnotwhite ) || [\"\"];\n\n\t\t// A cross-domain request is in order when we have a protocol:host:port mismatch\n\t\tif ( s.crossDomain == null ) {\n\t\t\tparts = rurl.exec( s.url.toLowerCase() );\n\t\t\ts.crossDomain = !!( parts &&\n\t\t\t\t( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||\n\t\t\t\t\t( parts[ 3 ] || ( parts[ 1 ] === \"http:\" ? \"80\" : \"443\" ) ) !==\n\t\t\t\t\t\t( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === \"http:\" ? \"80\" : \"443\" ) ) )\n\t\t\t);\n\t\t}\n\n\t\t// Convert data if not already a string\n\t\tif ( s.data && s.processData && typeof s.data !== \"string\" ) {\n\t\t\ts.data = jQuery.param( s.data, s.traditional );\n\t\t}\n\n\t\t// Apply prefilters\n\t\tinspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\n\t\t// If request was aborted inside a prefilter, stop there\n\t\tif ( state === 2 ) {\n\t\t\treturn jqXHR;\n\t\t}\n\n\t\t// We can fire global events as of now if asked to\n\t\tfireGlobals = s.global;\n\n\t\t// Watch for a new set of requests\n\t\tif ( fireGlobals && jQuery.active++ === 0 ) {\n\t\t\tjQuery.event.trigger(\"ajaxStart\");\n\t\t}\n\n\t\t// Uppercase the type\n\t\ts.type = s.type.toUpperCase();\n\n\t\t// Determine if request has content\n\t\ts.hasContent = !rnoContent.test( s.type );\n\n\t\t// Save the URL in case we're toying with the If-Modified-Since\n\t\t// and/or If-None-Match header later on\n\t\tcacheURL = s.url;\n\n\t\t// More options handling for requests with no content\n\t\tif ( !s.hasContent ) {\n\n\t\t\t// If data is available, append data to url\n\t\t\tif ( s.data ) {\n\t\t\t\tcacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? \"&\" : \"?\" ) + s.data );\n\t\t\t\t// #9682: remove data so that it's not used in an eventual retry\n\t\t\t\tdelete s.data;\n\t\t\t}\n\n\t\t\t// Add anti-cache in url if needed\n\t\t\tif ( s.cache === false ) {\n\t\t\t\ts.url = rts.test( cacheURL ) ?\n\n\t\t\t\t\t// If there is already a '_' parameter, set its value\n\t\t\t\t\tcacheURL.replace( rts, \"$1_=\" + ajax_nonce++ ) :\n\n\t\t\t\t\t// Otherwise add one to the end\n\t\t\t\t\tcacheURL + ( ajax_rquery.test( cacheURL ) ? \"&\" : \"?\" ) + \"_=\" + ajax_nonce++;\n\t\t\t}\n\t\t}\n\n\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\tif ( s.ifModified ) {\n\t\t\tif ( jQuery.lastModified[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-Modified-Since\", jQuery.lastModified[ cacheURL ] );\n\t\t\t}\n\t\t\tif ( jQuery.etag[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-None-Match\", jQuery.etag[ cacheURL ] );\n\t\t\t}\n\t\t}\n\n\t\t// Set the correct header, if data is being sent\n\t\tif ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n\t\t\tjqXHR.setRequestHeader( \"Content-Type\", s.contentType );\n\t\t}\n\n\t\t// Set the Accepts header for the server, depending on the dataType\n\t\tjqXHR.setRequestHeader(\n\t\t\t\"Accept\",\n\t\t\ts.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?\n\t\t\t\ts.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\" ) :\n\t\t\t\ts.accepts[ \"*\" ]\n\t\t);\n\n\t\t// Check for headers option\n\t\tfor ( i in s.headers ) {\n\t\t\tjqXHR.setRequestHeader( i, s.headers[ i ] );\n\t\t}\n\n\t\t// Allow custom headers/mimetypes and early abort\n\t\tif ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {\n\t\t\t// Abort if not done already and return\n\t\t\treturn jqXHR.abort();\n\t\t}\n\n\t\t// aborting is no longer a cancellation\n\t\tstrAbort = \"abort\";\n\n\t\t// Install callbacks on deferreds\n\t\tfor ( i in { success: 1, error: 1, complete: 1 } ) {\n\t\t\tjqXHR[ i ]( s[ i ] );\n\t\t}\n\n\t\t// Get transport\n\t\ttransport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\n\t\t// If no transport, we auto-abort\n\t\tif ( !transport ) {\n\t\t\tdone( -1, \"No Transport\" );\n\t\t} else {\n\t\t\tjqXHR.readyState = 1;\n\n\t\t\t// Send global event\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxSend\", [ jqXHR, s ] );\n\t\t\t}\n\t\t\t// Timeout\n\t\t\tif ( s.async && s.timeout > 0 ) {\n\t\t\t\ttimeoutTimer = setTimeout(function() {\n\t\t\t\t\tjqXHR.abort(\"timeout\");\n\t\t\t\t}, s.timeout );\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tstate = 1;\n\t\t\t\ttransport.send( requestHeaders, done );\n\t\t\t} catch ( e ) {\n\t\t\t\t// Propagate exception as error if not done\n\t\t\t\tif ( state < 2 ) {\n\t\t\t\t\tdone( -1, e );\n\t\t\t\t// Simply rethrow otherwise\n\t\t\t\t} else {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Callback for when everything is done\n\t\tfunction done( status, nativeStatusText, responses, headers ) {\n\t\t\tvar isSuccess, success, error, response, modified,\n\t\t\t\tstatusText = nativeStatusText;\n\n\t\t\t// Called once\n\t\t\tif ( state === 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// State is \"done\" now\n\t\t\tstate = 2;\n\n\t\t\t// Clear timeout if it exists\n\t\t\tif ( timeoutTimer ) {\n\t\t\t\tclearTimeout( timeoutTimer );\n\t\t\t}\n\n\t\t\t// Dereference transport for early garbage collection\n\t\t\t// (no matter how long the jqXHR object will be used)\n\t\t\ttransport = undefined;\n\n\t\t\t// Cache response headers\n\t\t\tresponseHeadersString = headers || \"\";\n\n\t\t\t// Set readyState\n\t\t\tjqXHR.readyState = status > 0 ? 4 : 0;\n\n\t\t\t// Determine if successful\n\t\t\tisSuccess = status >= 200 && status < 300 || status === 304;\n\n\t\t\t// Get response data\n\t\t\tif ( responses ) {\n\t\t\t\tresponse = ajaxHandleResponses( s, jqXHR, responses );\n\t\t\t}\n\n\t\t\t// Convert no matter what (that way responseXXX fields are always set)\n\t\t\tresponse = ajaxConvert( s, response, jqXHR, isSuccess );\n\n\t\t\t// If successful, handle type chaining\n\t\t\tif ( isSuccess ) {\n\n\t\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\t\tif ( s.ifModified ) {\n\t\t\t\t\tmodified = jqXHR.getResponseHeader(\"Last-Modified\");\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.lastModified[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t\tmodified = jqXHR.getResponseHeader(\"etag\");\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.etag[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// if no content\n\t\t\t\tif ( status === 204 || s.type === \"HEAD\" ) {\n\t\t\t\t\tstatusText = \"nocontent\";\n\n\t\t\t\t// if not modified\n\t\t\t\t} else if ( status === 304 ) {\n\t\t\t\t\tstatusText = \"notmodified\";\n\n\t\t\t\t// If we have data, let's convert it\n\t\t\t\t} else {\n\t\t\t\t\tstatusText = response.state;\n\t\t\t\t\tsuccess = response.data;\n\t\t\t\t\terror = response.error;\n\t\t\t\t\tisSuccess = !error;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We extract error from statusText\n\t\t\t\t// then normalize statusText and status for non-aborts\n\t\t\t\terror = statusText;\n\t\t\t\tif ( status || !statusText ) {\n\t\t\t\t\tstatusText = \"error\";\n\t\t\t\t\tif ( status < 0 ) {\n\t\t\t\t\t\tstatus = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set data for the fake xhr object\n\t\t\tjqXHR.status = status;\n\t\t\tjqXHR.statusText = ( nativeStatusText || statusText ) + \"\";\n\n\t\t\t// Success/Error\n\t\t\tif ( isSuccess ) {\n\t\t\t\tdeferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n\t\t\t} else {\n\t\t\t\tdeferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n\t\t\t}\n\n\t\t\t// Status-dependent callbacks\n\t\t\tjqXHR.statusCode( statusCode );\n\t\t\tstatusCode = undefined;\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( isSuccess ? \"ajaxSuccess\" : \"ajaxError\",\n\t\t\t\t\t[ jqXHR, s, isSuccess ? success : error ] );\n\t\t\t}\n\n\t\t\t// Complete\n\t\t\tcompleteDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxComplete\", [ jqXHR, s ] );\n\t\t\t\t// Handle the global AJAX counter\n\t\t\t\tif ( !( --jQuery.active ) ) {\n\t\t\t\t\tjQuery.event.trigger(\"ajaxStop\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn jqXHR;\n\t},\n\n\tgetJSON: function( url, data, callback ) {\n\t\treturn jQuery.get( url, data, callback, \"json\" );\n\t},\n\n\tgetScript: function( url, callback ) {\n\t\treturn jQuery.get( url, undefined, callback, \"script\" );\n\t}\n});\n\njQuery.each( [ \"get\", \"post\" ], function( i, method ) {\n\tjQuery[ method ] = function( url, data, callback, type ) {\n\t\t// shift arguments if data argument was omitted\n\t\tif ( jQuery.isFunction( data ) ) {\n\t\t\ttype = type || callback;\n\t\t\tcallback = data;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\treturn jQuery.ajax({\n\t\t\turl: url,\n\t\t\ttype: method,\n\t\t\tdataType: type,\n\t\t\tdata: data,\n\t\t\tsuccess: callback\n\t\t});\n\t};\n});\n\n/* Handles responses to an ajax request:\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\nfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\n\tvar ct, type, finalDataType, firstDataType,\n\t\tcontents = s.contents,\n\t\tdataTypes = s.dataTypes;\n\n\t// Remove auto dataType and get content-type in the process\n\twhile( dataTypes[ 0 ] === \"*\" ) {\n\t\tdataTypes.shift();\n\t\tif ( ct === undefined ) {\n\t\t\tct = s.mimeType || jqXHR.getResponseHeader(\"Content-Type\");\n\t\t}\n\t}\n\n\t// Check if we're dealing with a known content-type\n\tif ( ct ) {\n\t\tfor ( type in contents ) {\n\t\t\tif ( contents[ type ] && contents[ type ].test( ct ) ) {\n\t\t\t\tdataTypes.unshift( type );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check to see if we have a response for the expected dataType\n\tif ( dataTypes[ 0 ] in responses ) {\n\t\tfinalDataType = dataTypes[ 0 ];\n\t} else {\n\t\t// Try convertible dataTypes\n\t\tfor ( type in responses ) {\n\t\t\tif ( !dataTypes[ 0 ] || s.converters[ type + \" \" + dataTypes[0] ] ) {\n\t\t\t\tfinalDataType = type;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( !firstDataType ) {\n\t\t\t\tfirstDataType = type;\n\t\t\t}\n\t\t}\n\t\t// Or just use first one\n\t\tfinalDataType = finalDataType || firstDataType;\n\t}\n\n\t// If we found a dataType\n\t// We add the dataType to the list if needed\n\t// and return the corresponding response\n\tif ( finalDataType ) {\n\t\tif ( finalDataType !== dataTypes[ 0 ] ) {\n\t\t\tdataTypes.unshift( finalDataType );\n\t\t}\n\t\treturn responses[ finalDataType ];\n\t}\n}\n\n/* Chain conversions given the request and the original response\n * Also sets the responseXXX fields on the jqXHR instance\n */\nfunction ajaxConvert( s, response, jqXHR, isSuccess ) {\n\tvar conv2, current, conv, tmp, prev,\n\t\tconverters = {},\n\t\t// Work with a copy of dataTypes in case we need to modify it for conversion\n\t\tdataTypes = s.dataTypes.slice();\n\n\t// Create converters map with lowercased keys\n\tif ( dataTypes[ 1 ] ) {\n\t\tfor ( conv in s.converters ) {\n\t\t\tconverters[ conv.toLowerCase() ] = s.converters[ conv ];\n\t\t}\n\t}\n\n\tcurrent = dataTypes.shift();\n\n\t// Convert to each sequential dataType\n\twhile ( current ) {\n\n\t\tif ( s.responseFields[ current ] ) {\n\t\t\tjqXHR[ s.responseFields[ current ] ] = response;\n\t\t}\n\n\t\t// Apply the dataFilter if provided\n\t\tif ( !prev && isSuccess && s.dataFilter ) {\n\t\t\tresponse = s.dataFilter( response, s.dataType );\n\t\t}\n\n\t\tprev = current;\n\t\tcurrent = dataTypes.shift();\n\n\t\tif ( current ) {\n\n\t\t// There's only work to do if current dataType is non-auto\n\t\t\tif ( current === \"*\" ) {\n\n\t\t\t\tcurrent = prev;\n\n\t\t\t// Convert response if prev dataType is non-auto and differs from current\n\t\t\t} else if ( prev !== \"*\" && prev !== current ) {\n\n\t\t\t\t// Seek a direct converter\n\t\t\t\tconv = converters[ prev + \" \" + current ] || converters[ \"* \" + current ];\n\n\t\t\t\t// If none found, seek a pair\n\t\t\t\tif ( !conv ) {\n\t\t\t\t\tfor ( conv2 in converters ) {\n\n\t\t\t\t\t\t// If conv2 outputs current\n\t\t\t\t\t\ttmp = conv2.split( \" \" );\n\t\t\t\t\t\tif ( tmp[ 1 ] === current ) {\n\n\t\t\t\t\t\t\t// If prev can be converted to accepted input\n\t\t\t\t\t\t\tconv = converters[ prev + \" \" + tmp[ 0 ] ] ||\n\t\t\t\t\t\t\t\tconverters[ \"* \" + tmp[ 0 ] ];\n\t\t\t\t\t\t\tif ( conv ) {\n\t\t\t\t\t\t\t\t// Condense equivalence converters\n\t\t\t\t\t\t\t\tif ( conv === true ) {\n\t\t\t\t\t\t\t\t\tconv = converters[ conv2 ];\n\n\t\t\t\t\t\t\t\t// Otherwise, insert the intermediate dataType\n\t\t\t\t\t\t\t\t} else if ( converters[ conv2 ] !== true ) {\n\t\t\t\t\t\t\t\t\tcurrent = tmp[ 0 ];\n\t\t\t\t\t\t\t\t\tdataTypes.unshift( tmp[ 1 ] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Apply converter (if not an equivalence)\n\t\t\t\tif ( conv !== true ) {\n\n\t\t\t\t\t// Unless errors are allowed to bubble, catch and return them\n\t\t\t\t\tif ( conv && s[ \"throws\" ] ) {\n\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\treturn { state: \"parsererror\", error: conv ? e : \"No conversion from \" + prev + \" to \" + current };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { state: \"success\", data: response };\n}\n// Install script dataType\njQuery.ajaxSetup({\n\taccepts: {\n\t\tscript: \"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"\n\t},\n\tcontents: {\n\t\tscript: /(?:java|ecma)script/\n\t},\n\tconverters: {\n\t\t\"text script\": function( text ) {\n\t\t\tjQuery.globalEval( text );\n\t\t\treturn text;\n\t\t}\n\t}\n});\n\n// Handle cache's special case and crossDomain\njQuery.ajaxPrefilter( \"script\", function( s ) {\n\tif ( s.cache === undefined ) {\n\t\ts.cache = false;\n\t}\n\tif ( s.crossDomain ) {\n\t\ts.type = \"GET\";\n\t}\n});\n\n// Bind script tag hack transport\njQuery.ajaxTransport( \"script\", function( s ) {\n\t// This transport only deals with cross domain requests\n\tif ( s.crossDomain ) {\n\t\tvar script, callback;\n\t\treturn {\n\t\t\tsend: function( _, complete ) {\n\t\t\t\tscript = jQuery(\"<script>\").prop({\n\t\t\t\t\tasync: true,\n\t\t\t\t\tcharset: s.scriptCharset,\n\t\t\t\t\tsrc: s.url\n\t\t\t\t}).on(\n\t\t\t\t\t\"load error\",\n\t\t\t\t\tcallback = function( evt ) {\n\t\t\t\t\t\tscript.remove();\n\t\t\t\t\t\tcallback = null;\n\t\t\t\t\t\tif ( evt ) {\n\t\t\t\t\t\t\tcomplete( evt.type === \"error\" ? 404 : 200, evt.type );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tdocument.head.appendChild( script[ 0 ] );\n\t\t\t},\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n});\nvar oldCallbacks = [],\n\trjsonp = /(=)\\?(?=&|$)|\\?\\?/;\n\n// Default jsonp settings\njQuery.ajaxSetup({\n\tjsonp: \"callback\",\n\tjsonpCallback: function() {\n\t\tvar callback = oldCallbacks.pop() || ( jQuery.expando + \"_\" + ( ajax_nonce++ ) );\n\t\tthis[ callback ] = true;\n\t\treturn callback;\n\t}\n});\n\n// Detect, normalize options and install callbacks for jsonp requests\njQuery.ajaxPrefilter( \"json jsonp\", function( s, originalSettings, jqXHR ) {\n\n\tvar callbackName, overwritten, responseContainer,\n\t\tjsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?\n\t\t\t\"url\" :\n\t\t\ttypeof s.data === \"string\" && !( s.contentType || \"\" ).indexOf(\"application/x-www-form-urlencoded\") && rjsonp.test( s.data ) && \"data\"\n\t\t);\n\n\t// Handle iff the expected data type is \"jsonp\" or we have a parameter to set\n\tif ( jsonProp || s.dataTypes[ 0 ] === \"jsonp\" ) {\n\n\t\t// Get callback name, remembering preexisting value associated with it\n\t\tcallbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?\n\t\t\ts.jsonpCallback() :\n\t\t\ts.jsonpCallback;\n\n\t\t// Insert callback into url or form data\n\t\tif ( jsonProp ) {\n\t\t\ts[ jsonProp ] = s[ jsonProp ].replace( rjsonp, \"$1\" + callbackName );\n\t\t} else if ( s.jsonp !== false ) {\n\t\t\ts.url += ( ajax_rquery.test( s.url ) ? \"&\" : \"?\" ) + s.jsonp + \"=\" + callbackName;\n\t\t}\n\n\t\t// Use data converter to retrieve json after script execution\n\t\ts.converters[\"script json\"] = function() {\n\t\t\tif ( !responseContainer ) {\n\t\t\t\tjQuery.error( callbackName + \" was not called\" );\n\t\t\t}\n\t\t\treturn responseContainer[ 0 ];\n\t\t};\n\n\t\t// force json dataType\n\t\ts.dataTypes[ 0 ] = \"json\";\n\n\t\t// Install callback\n\t\toverwritten = window[ callbackName ];\n\t\twindow[ callbackName ] = function() {\n\t\t\tresponseContainer = arguments;\n\t\t};\n\n\t\t// Clean-up function (fires after converters)\n\t\tjqXHR.always(function() {\n\t\t\t// Restore preexisting value\n\t\t\twindow[ callbackName ] = overwritten;\n\n\t\t\t// Save back as free\n\t\t\tif ( s[ callbackName ] ) {\n\t\t\t\t// make sure that re-using the options doesn't screw things around\n\t\t\t\ts.jsonpCallback = originalSettings.jsonpCallback;\n\n\t\t\t\t// save the callback name for future use\n\t\t\t\toldCallbacks.push( callbackName );\n\t\t\t}\n\n\t\t\t// Call if it was a function and we have a response\n\t\t\tif ( responseContainer && jQuery.isFunction( overwritten ) ) {\n\t\t\t\toverwritten( responseContainer[ 0 ] );\n\t\t\t}\n\n\t\t\tresponseContainer = overwritten = undefined;\n\t\t});\n\n\t\t// Delegate to script\n\t\treturn \"script\";\n\t}\n});\njQuery.ajaxSettings.xhr = function() {\n\ttry {\n\t\treturn new XMLHttpRequest();\n\t} catch( e ) {}\n};\n\nvar xhrSupported = jQuery.ajaxSettings.xhr(),\n\txhrSuccessStatus = {\n\t\t// file protocol always yields status code 0, assume 200\n\t\t0: 200,\n\t\t// Support: IE9\n\t\t// #1450: sometimes IE returns 1223 when it should be 204\n\t\t1223: 204\n\t},\n\t// Support: IE9\n\t// We need to keep track of outbound xhr and abort them manually\n\t// because IE is not smart enough to do it all by itself\n\txhrId = 0,\n\txhrCallbacks = {};\n\nif ( window.ActiveXObject ) {\n\tjQuery( window ).on( \"unload\", function() {\n\t\tfor( var key in xhrCallbacks ) {\n\t\t\txhrCallbacks[ key ]();\n\t\t}\n\t\txhrCallbacks = undefined;\n\t});\n}\n\njQuery.support.cors = !!xhrSupported && ( \"withCredentials\" in xhrSupported );\njQuery.support.ajax = xhrSupported = !!xhrSupported;\n\njQuery.ajaxTransport(function( options ) {\n\tvar callback;\n\t// Cross domain only allowed if supported through XMLHttpRequest\n\tif ( jQuery.support.cors || xhrSupported && !options.crossDomain ) {\n\t\treturn {\n\t\t\tsend: function( headers, complete ) {\n\t\t\t\tvar i, id,\n\t\t\t\t\txhr = options.xhr();\n\t\t\t\txhr.open( options.type, options.url, options.async, options.username, options.password );\n\t\t\t\t// Apply custom fields if provided\n\t\t\t\tif ( options.xhrFields ) {\n\t\t\t\t\tfor ( i in options.xhrFields ) {\n\t\t\t\t\t\txhr[ i ] = options.xhrFields[ i ];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Override mime type if needed\n\t\t\t\tif ( options.mimeType && xhr.overrideMimeType ) {\n\t\t\t\t\txhr.overrideMimeType( options.mimeType );\n\t\t\t\t}\n\t\t\t\t// X-Requested-With header\n\t\t\t\t// For cross-domain requests, seeing as conditions for a preflight are\n\t\t\t\t// akin to a jigsaw puzzle, we simply never set it to be sure.\n\t\t\t\t// (it can always be set on a per-request basis or even using ajaxSetup)\n\t\t\t\t// For same-domain requests, won't change header if already provided.\n\t\t\t\tif ( !options.crossDomain && !headers[\"X-Requested-With\"] ) {\n\t\t\t\t\theaders[\"X-Requested-With\"] = \"XMLHttpRequest\";\n\t\t\t\t}\n\t\t\t\t// Set headers\n\t\t\t\tfor ( i in headers ) {\n\t\t\t\t\txhr.setRequestHeader( i, headers[ i ] );\n\t\t\t\t}\n\t\t\t\t// Callback\n\t\t\t\tcallback = function( type ) {\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\tdelete xhrCallbacks[ id ];\n\t\t\t\t\t\t\tcallback = xhr.onload = xhr.onerror = null;\n\t\t\t\t\t\t\tif ( type === \"abort\" ) {\n\t\t\t\t\t\t\t\txhr.abort();\n\t\t\t\t\t\t\t} else if ( type === \"error\" ) {\n\t\t\t\t\t\t\t\tcomplete(\n\t\t\t\t\t\t\t\t\t// file protocol always yields status 0, assume 404\n\t\t\t\t\t\t\t\t\txhr.status || 404,\n\t\t\t\t\t\t\t\t\txhr.statusText\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete(\n\t\t\t\t\t\t\t\t\txhrSuccessStatus[ xhr.status ] || xhr.status,\n\t\t\t\t\t\t\t\t\txhr.statusText,\n\t\t\t\t\t\t\t\t\t// Support: IE9\n\t\t\t\t\t\t\t\t\t// #11426: When requesting binary data, IE9 will throw an exception\n\t\t\t\t\t\t\t\t\t// on any attempt to access responseText\n\t\t\t\t\t\t\t\t\ttypeof xhr.responseText === \"string\" ? {\n\t\t\t\t\t\t\t\t\t\ttext: xhr.responseText\n\t\t\t\t\t\t\t\t\t} : undefined,\n\t\t\t\t\t\t\t\t\txhr.getAllResponseHeaders()\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t\t// Listen to events\n\t\t\t\txhr.onload = callback();\n\t\t\t\txhr.onerror = callback(\"error\");\n\t\t\t\t// Create the abort callback\n\t\t\t\tcallback = xhrCallbacks[( id = xhrId++ )] = callback(\"abort\");\n\t\t\t\t// Do send the request\n\t\t\t\t// This may raise an exception which is actually\n\t\t\t\t// handled in jQuery.ajax (so no try/catch here)\n\t\t\t\txhr.send( options.hasContent && options.data || null );\n\t\t\t},\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n});\nvar fxNow, timerId,\n\trfxtypes = /^(?:toggle|show|hide)$/,\n\trfxnum = new RegExp( \"^(?:([+-])=|)(\" + core_pnum + \")([a-z%]*)$\", \"i\" ),\n\trrun = /queueHooks$/,\n\tanimationPrefilters = [ defaultPrefilter ],\n\ttweeners = {\n\t\t\"*\": [function( prop, value ) {\n\t\t\tvar tween = this.createTween( prop, value ),\n\t\t\t\ttarget = tween.cur(),\n\t\t\t\tparts = rfxnum.exec( value ),\n\t\t\t\tunit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" ),\n\n\t\t\t\t// Starting value computation is required for potential unit mismatches\n\t\t\t\tstart = ( jQuery.cssNumber[ prop ] || unit !== \"px\" && +target ) &&\n\t\t\t\t\trfxnum.exec( jQuery.css( tween.elem, prop ) ),\n\t\t\t\tscale = 1,\n\t\t\t\tmaxIterations = 20;\n\n\t\t\tif ( start && start[ 3 ] !== unit ) {\n\t\t\t\t// Trust units reported by jQuery.css\n\t\t\t\tunit = unit || start[ 3 ];\n\n\t\t\t\t// Make sure we update the tween properties later on\n\t\t\t\tparts = parts || [];\n\n\t\t\t\t// Iteratively approximate from a nonzero starting point\n\t\t\t\tstart = +target || 1;\n\n\t\t\t\tdo {\n\t\t\t\t\t// If previous iteration zeroed out, double until we get *something*\n\t\t\t\t\t// Use a string for doubling factor so we don't accidentally see scale as unchanged below\n\t\t\t\t\tscale = scale || \".5\";\n\n\t\t\t\t\t// Adjust and apply\n\t\t\t\t\tstart = start / scale;\n\t\t\t\t\tjQuery.style( tween.elem, prop, start + unit );\n\n\t\t\t\t// Update scale, tolerating zero or NaN from tween.cur()\n\t\t\t\t// And breaking the loop if scale is unchanged or perfect, or if we've just had enough\n\t\t\t\t} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );\n\t\t\t}\n\n\t\t\t// Update tween properties\n\t\t\tif ( parts ) {\n\t\t\t\tstart = tween.start = +start || +target || 0;\n\t\t\t\ttween.unit = unit;\n\t\t\t\t// If a +=/-= token was provided, we're doing a relative animation\n\t\t\t\ttween.end = parts[ 1 ] ?\n\t\t\t\t\tstart + ( parts[ 1 ] + 1 ) * parts[ 2 ] :\n\t\t\t\t\t+parts[ 2 ];\n\t\t\t}\n\n\t\t\treturn tween;\n\t\t}]\n\t};\n\n// Animations created synchronously will run synchronously\nfunction createFxNow() {\n\tsetTimeout(function() {\n\t\tfxNow = undefined;\n\t});\n\treturn ( fxNow = jQuery.now() );\n}\n\nfunction createTween( value, prop, animation ) {\n\tvar tween,\n\t\tcollection = ( tweeners[ prop ] || [] ).concat( tweeners[ \"*\" ] ),\n\t\tindex = 0,\n\t\tlength = collection.length;\n\tfor ( ; index < length; index++ ) {\n\t\tif ( (tween = collection[ index ].call( animation, prop, value )) ) {\n\n\t\t\t// we're done with this property\n\t\t\treturn tween;\n\t\t}\n\t}\n}\n\nfunction Animation( elem, properties, options ) {\n\tvar result,\n\t\tstopped,\n\t\tindex = 0,\n\t\tlength = animationPrefilters.length,\n\t\tdeferred = jQuery.Deferred().always( function() {\n\t\t\t// don't match elem in the :animated selector\n\t\t\tdelete tick.elem;\n\t\t}),\n\t\ttick = function() {\n\t\t\tif ( stopped ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar currentTime = fxNow || createFxNow(),\n\t\t\t\tremaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),\n\t\t\t\t// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)\n\t\t\t\ttemp = remaining / animation.duration || 0,\n\t\t\t\tpercent = 1 - temp,\n\t\t\t\tindex = 0,\n\t\t\t\tlength = animation.tweens.length;\n\n\t\t\tfor ( ; index < length ; index++ ) {\n\t\t\t\tanimation.tweens[ index ].run( percent );\n\t\t\t}\n\n\t\t\tdeferred.notifyWith( elem, [ animation, percent, remaining ]);\n\n\t\t\tif ( percent < 1 && length ) {\n\t\t\t\treturn remaining;\n\t\t\t} else {\n\t\t\t\tdeferred.resolveWith( elem, [ animation ] );\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tanimation = deferred.promise({\n\t\t\telem: elem,\n\t\t\tprops: jQuery.extend( {}, properties ),\n\t\t\topts: jQuery.extend( true, { specialEasing: {} }, options ),\n\t\t\toriginalProperties: properties,\n\t\t\toriginalOptions: options,\n\t\t\tstartTime: fxNow || createFxNow(),\n\t\t\tduration: options.duration,\n\t\t\ttweens: [],\n\t\t\tcreateTween: function( prop, end ) {\n\t\t\t\tvar tween = jQuery.Tween( elem, animation.opts, prop, end,\n\t\t\t\t\t\tanimation.opts.specialEasing[ prop ] || animation.opts.easing );\n\t\t\t\tanimation.tweens.push( tween );\n\t\t\t\treturn tween;\n\t\t\t},\n\t\t\tstop: function( gotoEnd ) {\n\t\t\t\tvar index = 0,\n\t\t\t\t\t// if we are going to the end, we want to run all the tweens\n\t\t\t\t\t// otherwise we skip this part\n\t\t\t\t\tlength = gotoEnd ? animation.tweens.length : 0;\n\t\t\t\tif ( stopped ) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t\tstopped = true;\n\t\t\t\tfor ( ; index < length ; index++ ) {\n\t\t\t\t\tanimation.tweens[ index ].run( 1 );\n\t\t\t\t}\n\n\t\t\t\t// resolve when we played the last frame\n\t\t\t\t// otherwise, reject\n\t\t\t\tif ( gotoEnd ) {\n\t\t\t\t\tdeferred.resolveWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.rejectWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}),\n\t\tprops = animation.props;\n\n\tpropFilter( props, animation.opts.specialEasing );\n\n\tfor ( ; index < length ; index++ ) {\n\t\tresult = animationPrefilters[ index ].call( animation, elem, props, animation.opts );\n\t\tif ( result ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tjQuery.map( props, createTween, animation );\n\n\tif ( jQuery.isFunction( animation.opts.start ) ) {\n\t\tanimation.opts.start.call( elem, animation );\n\t}\n\n\tjQuery.fx.timer(\n\t\tjQuery.extend( tick, {\n\t\t\telem: elem,\n\t\t\tanim: animation,\n\t\t\tqueue: animation.opts.queue\n\t\t})\n\t);\n\n\t// attach callbacks from options\n\treturn animation.progress( animation.opts.progress )\n\t\t.done( animation.opts.done, animation.opts.complete )\n\t\t.fail( animation.opts.fail )\n\t\t.always( animation.opts.always );\n}\n\nfunction propFilter( props, specialEasing ) {\n\tvar index, name, easing, value, hooks;\n\n\t// camelCase, specialEasing and expand cssHook pass\n\tfor ( index in props ) {\n\t\tname = jQuery.camelCase( index );\n\t\teasing = specialEasing[ name ];\n\t\tvalue = props[ index ];\n\t\tif ( jQuery.isArray( value ) ) {\n\t\t\teasing = value[ 1 ];\n\t\t\tvalue = props[ index ] = value[ 0 ];\n\t\t}\n\n\t\tif ( index !== name ) {\n\t\t\tprops[ name ] = value;\n\t\t\tdelete props[ index ];\n\t\t}\n\n\t\thooks = jQuery.cssHooks[ name ];\n\t\tif ( hooks && \"expand\" in hooks ) {\n\t\t\tvalue = hooks.expand( value );\n\t\t\tdelete props[ name ];\n\n\t\t\t// not quite $.extend, this wont overwrite keys already present.\n\t\t\t// also - reusing 'index' from above because we have the correct \"name\"\n\t\t\tfor ( index in value ) {\n\t\t\t\tif ( !( index in props ) ) {\n\t\t\t\t\tprops[ index ] = value[ index ];\n\t\t\t\t\tspecialEasing[ index ] = easing;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tspecialEasing[ name ] = easing;\n\t\t}\n\t}\n}\n\njQuery.Animation = jQuery.extend( Animation, {\n\n\ttweener: function( props, callback ) {\n\t\tif ( jQuery.isFunction( props ) ) {\n\t\t\tcallback = props;\n\t\t\tprops = [ \"*\" ];\n\t\t} else {\n\t\t\tprops = props.split(\" \");\n\t\t}\n\n\t\tvar prop,\n\t\t\tindex = 0,\n\t\t\tlength = props.length;\n\n\t\tfor ( ; index < length ; index++ ) {\n\t\t\tprop = props[ index ];\n\t\t\ttweeners[ prop ] = tweeners[ prop ] || [];\n\t\t\ttweeners[ prop ].unshift( callback );\n\t\t}\n\t},\n\n\tprefilter: function( callback, prepend ) {\n\t\tif ( prepend ) {\n\t\t\tanimationPrefilters.unshift( callback );\n\t\t} else {\n\t\t\tanimationPrefilters.push( callback );\n\t\t}\n\t}\n});\n\nfunction defaultPrefilter( elem, props, opts ) {\n\t/* jshint validthis: true */\n\tvar prop, value, toggle, tween, hooks, oldfire,\n\t\tanim = this,\n\t\torig = {},\n\t\tstyle = elem.style,\n\t\thidden = elem.nodeType && isHidden( elem ),\n\t\tdataShow = data_priv.get( elem, \"fxshow\" );\n\n\t// handle queue: false promises\n\tif ( !opts.queue ) {\n\t\thooks = jQuery._queueHooks( elem, \"fx\" );\n\t\tif ( hooks.unqueued == null ) {\n\t\t\thooks.unqueued = 0;\n\t\t\toldfire = hooks.empty.fire;\n\t\t\thooks.empty.fire = function() {\n\t\t\t\tif ( !hooks.unqueued ) {\n\t\t\t\t\toldfire();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\thooks.unqueued++;\n\n\t\tanim.always(function() {\n\t\t\t// doing this makes sure that the complete handler will be called\n\t\t\t// before this completes\n\t\t\tanim.always(function() {\n\t\t\t\thooks.unqueued--;\n\t\t\t\tif ( !jQuery.queue( elem, \"fx\" ).length ) {\n\t\t\t\t\thooks.empty.fire();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t// height/width overflow pass\n\tif ( elem.nodeType === 1 && ( \"height\" in props || \"width\" in props ) ) {\n\t\t// Make sure that nothing sneaks out\n\t\t// Record all 3 overflow attributes because IE9-10 do not\n\t\t// change the overflow attribute when overflowX and\n\t\t// overflowY are set to the same value\n\t\topts.overflow = [ style.overflow, style.overflowX, style.overflowY ];\n\n\t\t// Set display property to inline-block for height/width\n\t\t// animations on inline elements that are having width/height animated\n\t\tif ( jQuery.css( elem, \"display\" ) === \"inline\" &&\n\t\t\t\tjQuery.css( elem, \"float\" ) === \"none\" ) {\n\n\t\t\tstyle.display = \"inline-block\";\n\t\t}\n\t}\n\n\tif ( opts.overflow ) {\n\t\tstyle.overflow = \"hidden\";\n\t\tanim.always(function() {\n\t\t\tstyle.overflow = opts.overflow[ 0 ];\n\t\t\tstyle.overflowX = opts.overflow[ 1 ];\n\t\t\tstyle.overflowY = opts.overflow[ 2 ];\n\t\t});\n\t}\n\n\n\t// show/hide pass\n\tfor ( prop in props ) {\n\t\tvalue = props[ prop ];\n\t\tif ( rfxtypes.exec( value ) ) {\n\t\t\tdelete props[ prop ];\n\t\t\ttoggle = toggle || value === \"toggle\";\n\t\t\tif ( value === ( hidden ? \"hide\" : \"show\" ) ) {\n\n\t\t\t\t// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden\n\t\t\t\tif ( value === \"show\" && dataShow && dataShow[ prop ] !== undefined ) {\n\t\t\t\t\thidden = true;\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\torig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );\n\t\t}\n\t}\n\n\tif ( !jQuery.isEmptyObject( orig ) ) {\n\t\tif ( dataShow ) {\n\t\t\tif ( \"hidden\" in dataShow ) {\n\t\t\t\thidden = dataShow.hidden;\n\t\t\t}\n\t\t} else {\n\t\t\tdataShow = data_priv.access( elem, \"fxshow\", {} );\n\t\t}\n\n\t\t// store state if its toggle - enables .stop().toggle() to \"reverse\"\n\t\tif ( toggle ) {\n\t\t\tdataShow.hidden = !hidden;\n\t\t}\n\t\tif ( hidden ) {\n\t\t\tjQuery( elem ).show();\n\t\t} else {\n\t\t\tanim.done(function() {\n\t\t\t\tjQuery( elem ).hide();\n\t\t\t});\n\t\t}\n\t\tanim.done(function() {\n\t\t\tvar prop;\n\n\t\t\tdata_priv.remove( elem, \"fxshow\" );\n\t\t\tfor ( prop in orig ) {\n\t\t\t\tjQuery.style( elem, prop, orig[ prop ] );\n\t\t\t}\n\t\t});\n\t\tfor ( prop in orig ) {\n\t\t\ttween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );\n\n\t\t\tif ( !( prop in dataShow ) ) {\n\t\t\t\tdataShow[ prop ] = tween.start;\n\t\t\t\tif ( hidden ) {\n\t\t\t\t\ttween.end = tween.start;\n\t\t\t\t\ttween.start = prop === \"width\" || prop === \"height\" ? 1 : 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction Tween( elem, options, prop, end, easing ) {\n\treturn new Tween.prototype.init( elem, options, prop, end, easing );\n}\njQuery.Tween = Tween;\n\nTween.prototype = {\n\tconstructor: Tween,\n\tinit: function( elem, options, prop, end, easing, unit ) {\n\t\tthis.elem = elem;\n\t\tthis.prop = prop;\n\t\tthis.easing = easing || \"swing\";\n\t\tthis.options = options;\n\t\tthis.start = this.now = this.cur();\n\t\tthis.end = end;\n\t\tthis.unit = unit || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n\t},\n\tcur: function() {\n\t\tvar hooks = Tween.propHooks[ this.prop ];\n\n\t\treturn hooks && hooks.get ?\n\t\t\thooks.get( this ) :\n\t\t\tTween.propHooks._default.get( this );\n\t},\n\trun: function( percent ) {\n\t\tvar eased,\n\t\t\thooks = Tween.propHooks[ this.prop ];\n\n\t\tif ( this.options.duration ) {\n\t\t\tthis.pos = eased = jQuery.easing[ this.easing ](\n\t\t\t\tpercent, this.options.duration * percent, 0, 1, this.options.duration\n\t\t\t);\n\t\t} else {\n\t\t\tthis.pos = eased = percent;\n\t\t}\n\t\tthis.now = ( this.end - this.start ) * eased + this.start;\n\n\t\tif ( this.options.step ) {\n\t\t\tthis.options.step.call( this.elem, this.now, this );\n\t\t}\n\n\t\tif ( hooks && hooks.set ) {\n\t\t\thooks.set( this );\n\t\t} else {\n\t\t\tTween.propHooks._default.set( this );\n\t\t}\n\t\treturn this;\n\t}\n};\n\nTween.prototype.init.prototype = Tween.prototype;\n\nTween.propHooks = {\n\t_default: {\n\t\tget: function( tween ) {\n\t\t\tvar result;\n\n\t\t\tif ( tween.elem[ tween.prop ] != null &&\n\t\t\t\t(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {\n\t\t\t\treturn tween.elem[ tween.prop ];\n\t\t\t}\n\n\t\t\t// passing an empty string as a 3rd parameter to .css will automatically\n\t\t\t// attempt a parseFloat and fallback to a string if the parse fails\n\t\t\t// so, simple values such as \"10px\" are parsed to Float.\n\t\t\t// complex values such as \"rotate(1rad)\" are returned as is.\n\t\t\tresult = jQuery.css( tween.elem, tween.prop, \"\" );\n\t\t\t// Empty strings, null, undefined and \"auto\" are converted to 0.\n\t\t\treturn !result || result === \"auto\" ? 0 : result;\n\t\t},\n\t\tset: function( tween ) {\n\t\t\t// use step hook for back compat - use cssHook if its there - use .style if its\n\t\t\t// available and use plain properties where available\n\t\t\tif ( jQuery.fx.step[ tween.prop ] ) {\n\t\t\t\tjQuery.fx.step[ tween.prop ]( tween );\n\t\t\t} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {\n\t\t\t\tjQuery.style( tween.elem, tween.prop, tween.now + tween.unit );\n\t\t\t} else {\n\t\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Support: IE9\n// Panic based approach to setting things on disconnected nodes\n\nTween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n\tset: function( tween ) {\n\t\tif ( tween.elem.nodeType && tween.elem.parentNode ) {\n\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t}\n\t}\n};\n\njQuery.each([ \"toggle\", \"show\", \"hide\" ], function( i, name ) {\n\tvar cssFn = jQuery.fn[ name ];\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn speed == null || typeof speed === \"boolean\" ?\n\t\t\tcssFn.apply( this, arguments ) :\n\t\t\tthis.animate( genFx( name, true ), speed, easing, callback );\n\t};\n});\n\njQuery.fn.extend({\n\tfadeTo: function( speed, to, easing, callback ) {\n\n\t\t// show any hidden elements after setting opacity to 0\n\t\treturn this.filter( isHidden ).css( \"opacity\", 0 ).show()\n\n\t\t\t// animate to the value specified\n\t\t\t.end().animate({ opacity: to }, speed, easing, callback );\n\t},\n\tanimate: function( prop, speed, easing, callback ) {\n\t\tvar empty = jQuery.isEmptyObject( prop ),\n\t\t\toptall = jQuery.speed( speed, easing, callback ),\n\t\t\tdoAnimation = function() {\n\t\t\t\t// Operate on a copy of prop so per-property easing won't be lost\n\t\t\t\tvar anim = Animation( this, jQuery.extend( {}, prop ), optall );\n\n\t\t\t\t// Empty animations, or finishing resolves immediately\n\t\t\t\tif ( empty || data_priv.get( this, \"finish\" ) ) {\n\t\t\t\t\tanim.stop( true );\n\t\t\t\t}\n\t\t\t};\n\t\t\tdoAnimation.finish = doAnimation;\n\n\t\treturn empty || optall.queue === false ?\n\t\t\tthis.each( doAnimation ) :\n\t\t\tthis.queue( optall.queue, doAnimation );\n\t},\n\tstop: function( type, clearQueue, gotoEnd ) {\n\t\tvar stopQueue = function( hooks ) {\n\t\t\tvar stop = hooks.stop;\n\t\t\tdelete hooks.stop;\n\t\t\tstop( gotoEnd );\n\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tgotoEnd = clearQueue;\n\t\t\tclearQueue = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\tif ( clearQueue && type !== false ) {\n\t\t\tthis.queue( type || \"fx\", [] );\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tvar dequeue = true,\n\t\t\t\tindex = type != null && type + \"queueHooks\",\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tdata = data_priv.get( this );\n\n\t\t\tif ( index ) {\n\t\t\t\tif ( data[ index ] && data[ index ].stop ) {\n\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( index in data ) {\n\t\t\t\t\tif ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {\n\t\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {\n\t\t\t\t\ttimers[ index ].anim.stop( gotoEnd );\n\t\t\t\t\tdequeue = false;\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// start the next in the queue if the last step wasn't forced\n\t\t\t// timers currently will call their complete callbacks, which will dequeue\n\t\t\t// but only if they were gotoEnd\n\t\t\tif ( dequeue || !gotoEnd ) {\n\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t}\n\t\t});\n\t},\n\tfinish: function( type ) {\n\t\tif ( type !== false ) {\n\t\t\ttype = type || \"fx\";\n\t\t}\n\t\treturn this.each(function() {\n\t\t\tvar index,\n\t\t\t\tdata = data_priv.get( this ),\n\t\t\t\tqueue = data[ type + \"queue\" ],\n\t\t\t\thooks = data[ type + \"queueHooks\" ],\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tlength = queue ? queue.length : 0;\n\n\t\t\t// enable finishing flag on private data\n\t\t\tdata.finish = true;\n\n\t\t\t// empty the queue first\n\t\t\tjQuery.queue( this, type, [] );\n\n\t\t\tif ( hooks && hooks.stop ) {\n\t\t\t\thooks.stop.call( this, true );\n\t\t\t}\n\n\t\t\t// look for any active animations, and finish them\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this && timers[ index ].queue === type ) {\n\t\t\t\t\ttimers[ index ].anim.stop( true );\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// look for any animations in the old queue and finish them\n\t\t\tfor ( index = 0; index < length; index++ ) {\n\t\t\t\tif ( queue[ index ] && queue[ index ].finish ) {\n\t\t\t\t\tqueue[ index ].finish.call( this );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// turn off finishing flag\n\t\t\tdelete data.finish;\n\t\t});\n\t}\n});\n\n// Generate parameters to create a standard animation\nfunction genFx( type, includeWidth ) {\n\tvar which,\n\t\tattrs = { height: type },\n\t\ti = 0;\n\n\t// if we include width, step value is 1 to do all cssExpand values,\n\t// if we don't include width, step value is 2 to skip over Left and Right\n\tincludeWidth = includeWidth? 1 : 0;\n\tfor( ; i < 4 ; i += 2 - includeWidth ) {\n\t\twhich = cssExpand[ i ];\n\t\tattrs[ \"margin\" + which ] = attrs[ \"padding\" + which ] = type;\n\t}\n\n\tif ( includeWidth ) {\n\t\tattrs.opacity = attrs.width = type;\n\t}\n\n\treturn attrs;\n}\n\n// Generate shortcuts for custom animations\njQuery.each({\n\tslideDown: genFx(\"show\"),\n\tslideUp: genFx(\"hide\"),\n\tslideToggle: genFx(\"toggle\"),\n\tfadeIn: { opacity: \"show\" },\n\tfadeOut: { opacity: \"hide\" },\n\tfadeToggle: { opacity: \"toggle\" }\n}, function( name, props ) {\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn this.animate( props, speed, easing, callback );\n\t};\n});\n\njQuery.speed = function( speed, easing, fn ) {\n\tvar opt = speed && typeof speed === \"object\" ? jQuery.extend( {}, speed ) : {\n\t\tcomplete: fn || !fn && easing ||\n\t\t\tjQuery.isFunction( speed ) && speed,\n\t\tduration: speed,\n\t\teasing: fn && easing || easing && !jQuery.isFunction( easing ) && easing\n\t};\n\n\topt.duration = jQuery.fx.off ? 0 : typeof opt.duration === \"number\" ? opt.duration :\n\t\topt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;\n\n\t// normalize opt.queue - true/undefined/null -> \"fx\"\n\tif ( opt.queue == null || opt.queue === true ) {\n\t\topt.queue = \"fx\";\n\t}\n\n\t// Queueing\n\topt.old = opt.complete;\n\n\topt.complete = function() {\n\t\tif ( jQuery.isFunction( opt.old ) ) {\n\t\t\topt.old.call( this );\n\t\t}\n\n\t\tif ( opt.queue ) {\n\t\t\tjQuery.dequeue( this, opt.queue );\n\t\t}\n\t};\n\n\treturn opt;\n};\n\njQuery.easing = {\n\tlinear: function( p ) {\n\t\treturn p;\n\t},\n\tswing: function( p ) {\n\t\treturn 0.5 - Math.cos( p*Math.PI ) / 2;\n\t}\n};\n\njQuery.timers = [];\njQuery.fx = Tween.prototype.init;\njQuery.fx.tick = function() {\n\tvar timer,\n\t\ttimers = jQuery.timers,\n\t\ti = 0;\n\n\tfxNow = jQuery.now();\n\n\tfor ( ; i < timers.length; i++ ) {\n\t\ttimer = timers[ i ];\n\t\t// Checks the timer has not already been removed\n\t\tif ( !timer() && timers[ i ] === timer ) {\n\t\t\ttimers.splice( i--, 1 );\n\t\t}\n\t}\n\n\tif ( !timers.length ) {\n\t\tjQuery.fx.stop();\n\t}\n\tfxNow = undefined;\n};\n\njQuery.fx.timer = function( timer ) {\n\tif ( timer() && jQuery.timers.push( timer ) ) {\n\t\tjQuery.fx.start();\n\t}\n};\n\njQuery.fx.interval = 13;\n\njQuery.fx.start = function() {\n\tif ( !timerId ) {\n\t\ttimerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );\n\t}\n};\n\njQuery.fx.stop = function() {\n\tclearInterval( timerId );\n\ttimerId = null;\n};\n\njQuery.fx.speeds = {\n\tslow: 600,\n\tfast: 200,\n\t// Default speed\n\t_default: 400\n};\n\n// Back Compat <1.8 extension point\njQuery.fx.step = {};\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n\tjQuery.expr.filters.animated = function( elem ) {\n\t\treturn jQuery.grep(jQuery.timers, function( fn ) {\n\t\t\treturn elem === fn.elem;\n\t\t}).length;\n\t};\n}\njQuery.fn.offset = function( options ) {\n\tif ( arguments.length ) {\n\t\treturn options === undefined ?\n\t\t\tthis :\n\t\t\tthis.each(function( i ) {\n\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t});\n\t}\n\n\tvar docElem, win,\n\t\telem = this[ 0 ],\n\t\tbox = { top: 0, left: 0 },\n\t\tdoc = elem && elem.ownerDocument;\n\n\tif ( !doc ) {\n\t\treturn;\n\t}\n\n\tdocElem = doc.documentElement;\n\n\t// Make sure it's not a disconnected DOM node\n\tif ( !jQuery.contains( docElem, elem ) ) {\n\t\treturn box;\n\t}\n\n\t// If we don't have gBCR, just use 0,0 rather than error\n\t// BlackBerry 5, iOS 3 (original iPhone)\n\tif ( typeof elem.getBoundingClientRect !== core_strundefined ) {\n\t\tbox = elem.getBoundingClientRect();\n\t}\n\twin = getWindow( doc );\n\treturn {\n\t\ttop: box.top + win.pageYOffset - docElem.clientTop,\n\t\tleft: box.left + win.pageXOffset - docElem.clientLeft\n\t};\n};\n\njQuery.offset = {\n\n\tsetOffset: function( elem, options, i ) {\n\t\tvar curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,\n\t\t\tposition = jQuery.css( elem, \"position\" ),\n\t\t\tcurElem = jQuery( elem ),\n\t\t\tprops = {};\n\n\t\t// Set position first, in-case top/left are set even on static elem\n\t\tif ( position === \"static\" ) {\n\t\t\telem.style.position = \"relative\";\n\t\t}\n\n\t\tcurOffset = curElem.offset();\n\t\tcurCSSTop = jQuery.css( elem, \"top\" );\n\t\tcurCSSLeft = jQuery.css( elem, \"left\" );\n\t\tcalculatePosition = ( position === \"absolute\" || position === \"fixed\" ) && ( curCSSTop + curCSSLeft ).indexOf(\"auto\") > -1;\n\n\t\t// Need to be able to calculate position if either top or left is auto and position is either absolute or fixed\n\t\tif ( calculatePosition ) {\n\t\t\tcurPosition = curElem.position();\n\t\t\tcurTop = curPosition.top;\n\t\t\tcurLeft = curPosition.left;\n\n\t\t} else {\n\t\t\tcurTop = parseFloat( curCSSTop ) || 0;\n\t\t\tcurLeft = parseFloat( curCSSLeft ) || 0;\n\t\t}\n\n\t\tif ( jQuery.isFunction( options ) ) {\n\t\t\toptions = options.call( elem, i, curOffset );\n\t\t}\n\n\t\tif ( options.top != null ) {\n\t\t\tprops.top = ( options.top - curOffset.top ) + curTop;\n\t\t}\n\t\tif ( options.left != null ) {\n\t\t\tprops.left = ( options.left - curOffset.left ) + curLeft;\n\t\t}\n\n\t\tif ( \"using\" in options ) {\n\t\t\toptions.using.call( elem, props );\n\n\t\t} else {\n\t\t\tcurElem.css( props );\n\t\t}\n\t}\n};\n\n\njQuery.fn.extend({\n\n\tposition: function() {\n\t\tif ( !this[ 0 ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar offsetParent, offset,\n\t\t\telem = this[ 0 ],\n\t\t\tparentOffset = { top: 0, left: 0 };\n\n\t\t// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent\n\t\tif ( jQuery.css( elem, \"position\" ) === \"fixed\" ) {\n\t\t\t// We assume that getBoundingClientRect is available when computed position is fixed\n\t\t\toffset = elem.getBoundingClientRect();\n\n\t\t} else {\n\t\t\t// Get *real* offsetParent\n\t\t\toffsetParent = this.offsetParent();\n\n\t\t\t// Get correct offsets\n\t\t\toffset = this.offset();\n\t\t\tif ( !jQuery.nodeName( offsetParent[ 0 ], \"html\" ) ) {\n\t\t\t\tparentOffset = offsetParent.offset();\n\t\t\t}\n\n\t\t\t// Add offsetParent borders\n\t\t\tparentOffset.top += jQuery.css( offsetParent[ 0 ], \"borderTopWidth\", true );\n\t\t\tparentOffset.left += jQuery.css( offsetParent[ 0 ], \"borderLeftWidth\", true );\n\t\t}\n\n\t\t// Subtract parent offsets and element margins\n\t\treturn {\n\t\t\ttop: offset.top - parentOffset.top - jQuery.css( elem, \"marginTop\", true ),\n\t\t\tleft: offset.left - parentOffset.left - jQuery.css( elem, \"marginLeft\", true )\n\t\t};\n\t},\n\n\toffsetParent: function() {\n\t\treturn this.map(function() {\n\t\t\tvar offsetParent = this.offsetParent || docElem;\n\n\t\t\twhile ( offsetParent && ( !jQuery.nodeName( offsetParent, \"html\" ) && jQuery.css( offsetParent, \"position\") === \"static\" ) ) {\n\t\t\t\toffsetParent = offsetParent.offsetParent;\n\t\t\t}\n\n\t\t\treturn offsetParent || docElem;\n\t\t});\n\t}\n});\n\n\n// Create scrollLeft and scrollTop methods\njQuery.each( {scrollLeft: \"pageXOffset\", scrollTop: \"pageYOffset\"}, function( method, prop ) {\n\tvar top = \"pageYOffset\" === prop;\n\n\tjQuery.fn[ method ] = function( val ) {\n\t\treturn jQuery.access( this, function( elem, method, val ) {\n\t\t\tvar win = getWindow( elem );\n\n\t\t\tif ( val === undefined ) {\n\t\t\t\treturn win ? win[ prop ] : elem[ method ];\n\t\t\t}\n\n\t\t\tif ( win ) {\n\t\t\t\twin.scrollTo(\n\t\t\t\t\t!top ? val : window.pageXOffset,\n\t\t\t\t\ttop ? val : window.pageYOffset\n\t\t\t\t);\n\n\t\t\t} else {\n\t\t\t\telem[ method ] = val;\n\t\t\t}\n\t\t}, method, val, arguments.length, null );\n\t};\n});\n\nfunction getWindow( elem ) {\n\treturn jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;\n}\n// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods\njQuery.each( { Height: \"height\", Width: \"width\" }, function( name, type ) {\n\tjQuery.each( { padding: \"inner\" + name, content: type, \"\": \"outer\" + name }, function( defaultExtra, funcName ) {\n\t\t// margin is only for outerHeight, outerWidth\n\t\tjQuery.fn[ funcName ] = function( margin, value ) {\n\t\t\tvar chainable = arguments.length && ( defaultExtra || typeof margin !== \"boolean\" ),\n\t\t\t\textra = defaultExtra || ( margin === true || value === true ? \"margin\" : \"border\" );\n\n\t\t\treturn jQuery.access( this, function( elem, type, value ) {\n\t\t\t\tvar doc;\n\n\t\t\t\tif ( jQuery.isWindow( elem ) ) {\n\t\t\t\t\t// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there\n\t\t\t\t\t// isn't a whole lot we can do. See pull request at this URL for discussion:\n\t\t\t\t\t// https://github.com/jquery/jquery/pull/764\n\t\t\t\t\treturn elem.document.documentElement[ \"client\" + name ];\n\t\t\t\t}\n\n\t\t\t\t// Get document width or height\n\t\t\t\tif ( elem.nodeType === 9 ) {\n\t\t\t\t\tdoc = elem.documentElement;\n\n\t\t\t\t\t// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],\n\t\t\t\t\t// whichever is greatest\n\t\t\t\t\treturn Math.max(\n\t\t\t\t\t\telem.body[ \"scroll\" + name ], doc[ \"scroll\" + name ],\n\t\t\t\t\t\telem.body[ \"offset\" + name ], doc[ \"offset\" + name ],\n\t\t\t\t\t\tdoc[ \"client\" + name ]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn value === undefined ?\n\t\t\t\t\t// Get width or height on the element, requesting but not forcing parseFloat\n\t\t\t\t\tjQuery.css( elem, type, extra ) :\n\n\t\t\t\t\t// Set width or height on the element\n\t\t\t\t\tjQuery.style( elem, type, value, extra );\n\t\t\t}, type, chainable ? margin : undefined, chainable, null );\n\t\t};\n\t});\n});\n// Limit scope pollution from any deprecated API\n// (function() {\n\n// The number of elements contained in the matched element set\njQuery.fn.size = function() {\n\treturn this.length;\n};\n\njQuery.fn.andSelf = jQuery.fn.addBack;\n\n// })();\nif ( typeof module === \"object\" && module && typeof module.exports === \"object\" ) {\n\t// Expose jQuery as module.exports in loaders that implement the Node\n\t// module pattern (including browserify). Do not create the global, since\n\t// the user will be storing it themselves locally, and globals are frowned\n\t// upon in the Node module world.\n\tmodule.exports = jQuery;\n} else {\n\t// Register as a named AMD module, since jQuery can be concatenated with other\n\t// files that may use define, but not via a proper concatenation script that\n\t// understands anonymous AMD modules. A named AMD is safest and most robust\n\t// way to register. Lowercase jquery is used because AMD module names are\n\t// derived from file names, and jQuery is normally delivered in a lowercase\n\t// file name. Do this after creating the global so that if an AMD module wants\n\t// to call noConflict to hide this version of jQuery, it will work.\n\tif ( typeof define === \"function\" && define.amd ) {\n\t\tdefine( \"jquery\", [], function () { return jQuery; } );\n\t}\n}\n\n// If there is a window object, that at least has a document property,\n// define jQuery and $ identifiers\nif ( typeof window === \"object\" && typeof window.document === \"object\" ) {\n\twindow.jQuery = window.$ = jQuery;\n}\n\n})( window );\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/templates/index.html",
    "content": "<html>\n<head>\n\t<title>Sentiment Analyzer: Built using Text Blob</title>\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t<link rel=\"stylesheet\" type=\"text/css\" href=\"static/css/bootstrap.css\">\n\t<style type=\"text/css\">\n    body {\n      padding-top:60px;\n      padding-bottom: 60px;\n    }\n  </style>\n</head>\n<body>\n\n<div class=\"navbar navbar-inverse navbar-fixed-top\">\n      <div class=\"container\">\n        <div class=\"navbar-header\">\n          <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse\">\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n            <span class=\"icon-bar\"></span>\n          </button>\n          <a class=\"navbar-brand\" href=\"#\">Text Sentiment Analyzer</a>\n        </div>\n\n    </div>\n  </div>\n\n<div class=\"container\">\n\t<div class=\"row\">\n\t\t<div class=\"col-md-6\">\n\t\t\t<div class=\"row\">\n\t\t\t\t<textarea class=\"form-control\" rows=\"3\" placeholder=\"Write text to see sentiment analysis in action. Write minimum 10 charaters and press button.\"></textarea>\n\t\t\t</div>\n\t\t\t<div class=\"row\">\n\t\t\t\t<br><br>\n\t\t\t\t<button class=\"btn-lg btn-warning\">Perform Sentiment Analysis</button>\n\t\t\t</div>\n\t\t</div>\n\t\t<div class=\"col-md-6\">\n\t\t\t<p id=\"result\"></p>\n\t\t</div>\n\t</div>\n<br><br>\n\t<div class=\"row\">\n\t\t<p>This application was built as part of <a href=\"https://github.com/shekhargulati/52-technologies-in-2016/\" target=\"_blank\">52 Technologies in 2016</a> blog series. Look what all I have learnt in 2016 <a href=\"https://github.com/shekhargulati/52-technologies-in-2016/\" target=\"_blank\">https://github.com/shekhargulati/52-technologies-in-2016/</a></p>\n\t</div>\n<br><br><br><br>\n\t<footer id=\"footer\">\n\t\t\t\t<p>&copy; Shekhar Gulati 2016</p>\n\n\t\t\t\t<p>\n\t\t\t\t\tMade with love by <a href=\"https://twitter.com/shekhargulati/\"\n\t\t\t\t\t\ttarget=\"_blank\">Shekhar Gulati</a>. Contact him at <a\n\t\t\t\t\t\thref=\"mailto:shekhargulati84@gmail.com\">shekhargulati84@gmail.com</a>.\n\t\t\t\t</p>\n\t\t\t</footer>\n</div>\n\n\n\n\n<script type=\"text/javascript\" src=\"static/js/jquery.js\"></script>\n<script type=\"text/javascript\">\n\n\t$(\"button\").click(function(){\n\t\tvar messageTxt = $('textarea').val();\n\t\t$('#result').removeClass(\"alert alert-warning\");\n\t\t$('#result').removeClass(\"alert alert-danger\");\n\t\t$('#result').removeClass(\"alert alert-success\");\n\t\tif (messageTxt.length > 10){\n\n\t\t\t$.post('/api/sentiment',{message: messageTxt},function(result){\n\t\t\t\tif(result.polarity < 0.0){\n\t\t\t\t\tconsole.log('less than 0');\n\t\t\t\t\t$('#result').addClass(\"alert alert-danger\")\t.text(messageTxt);\n\t\t\t\t} else if( result.polarity >= 0.0 && result.polarity <= 0.5){\n\t\t\t\t\tconsole.log('between 0 and 0.5');\n\t\t\t\t\t$('#result').addClass(\"alert alert-warning\").text(messageTxt);\n\t\t\t\t}else{\n\t\t\t\t\tconsole.log('Greater than 0.5');\n\t\t\t\t\t$('#result').addClass(\"alert alert-success\").text(messageTxt);\n\t\t\t\t}\n\n});\n\t}\n});\n\n\n\n</script>\n\n<script>\n  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n  ga('create', 'UA-75130811-1', 'auto');\n  ga('send', 'pageview');\n\n</script>\n</body>\n</html>\n"
  },
  {
    "path": "11-textblob/sentiment-analyzer/wsgi.py",
    "content": "#!/usr/bin/env python\nfrom sentimentanalyzer import app as application\n"
  },
  {
    "path": "11-tweet-deduplication/README.md",
    "content": "Tweet Deduplication\n---\n\nWelcome to the eleventh blog of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)  blog series. This week I decided to write a tweet deduplication library. The library will give you a stream of deduplicated tweets. The definition of duplicates can vary depending on the application. For my usecase, any tweet which has same text or talks about same URL is a duplicate.\n\n`tweet-deduplication` library provides deduplication functionality over tweets. It uses [rx-tweet-stream](https://github.com/shekhargulati/rx-tweet-stream) to get a RxJava Observable over a twitter status stream. `rx-tweet-stream` wraps Twitter4J Streaming API to provide an Observable of tweets. `tweet-deduplication` API uses JDK 8, RxJava, and Twitter4J.\n\nThe definition of duplicate depends on the application. The default implementation assumes a tweet to be a duplicate if it is talking about same URL or if it has same text. URLs are normalized using the normalizations described in [RFC 3986](https://tools.ietf.org/html/rfc3986). This allows us to determine if two syntactically different URLs are equivalent for example `https://www.github.com/?` is same as `https://github.com`. URL , I will use [urlcleaner](https://github.com/shekhargulati/urlcleaner) library that I have written over the weekend as well.\n\nText comparison is done using SHA1 hash. Two tweets are considered same if their SHA1 hashes are same.\n\n## Github repository\n\nThe code for `tweet-deduplication` is available on github: [tweet-deduplication](https://github.com/shekhargulati/tweet-deduplication).\n\n\nGetting Started\n--------\n\nTo use `tweet-deduplication` in your application, you have to add `tweet-deduplication` in your classpath. `tweet-deduplication` is available on Maven Central so you just need to add dependency to your favorite build tool as show below.\n\nFor Apache Maven users, please add following to your pom.xml.\n\n```xml\n<dependencies>\n    <dependency>\n        <groupId>com.shekhargulati.deduplication.tweet</groupId>\n        <artifactId>tweet-deduplication</artifactId>\n        <version>0.1.0</version>\n        <type>jar</type>\n    </dependency>\n</dependencies>\n```\n\nGradle users can add following to their build.gradle file.\n\n```groovy\ncompile(group: 'com.shekhargulati.deduplication.tweet', name: 'tweet-deduplication', version: '0.1.0', ext: 'jar')\n```\n\n## Usage\n\nThe example shown below uses the Twitter4j environment variables\n\n```\nexport twitter4j.debug=true\nexport twitter4j.oauth.consumerKey=*********************\nexport twitter4j.oauth.consumerSecret=******************************************\nexport twitter4j.oauth.accessToken=**************************************************\nexport twitter4j.oauth.accessTokenSecret=******************************************\n```\n\n```java\nimport com.shekhargulati.deduplication.tweet.TweetDeDuplicator;\n\nTweetDeDuplicator tweetDeDuplicator = TweetDeDuplicator.getDeduplicatorWithInmemoryRepositories();\ntweetDeDuplicator.deduplicate(\"Your Twitter Search Term\").subscribe(System.out::println);\n```\n\nIf you don't want to use environment variables, then you can use the overloaded method that allows you to pass configuration object.\n\n```java\nConfigurationBuilder cb = new ConfigurationBuilder();\ncb.setDebugEnabled(true)\n        .setOAuthConsumerKey(\"*********************\")\n        .setOAuthConsumerSecret(\"******************************************\")\n        .setOAuthAccessToken(\"**************************************************\")\n        .setOAuthAccessTokenSecret(\"******************************************\");\n\ntweetDeDuplicator.deduplicate(cb.build(), \"Your Twitter Search Term\").subscribe(System.out::println);\n```\n\nYou can deduplicate multiple search items at once as well. The code shown below will give you deduplicated content across `java`, `programming`, and `rxjava` search terms.\n\n```java\nimport com.shekhargulati.deduplication.tweet.TweetDeDuplicator;\n\nTweetDeDuplicator tweetDeDuplicator = TweetDeDuplicator.getDeduplicatorWithInmemoryRepositories();\ntweetDeDuplicator.deduplicate(\"java\",\"programming\",\"rxjava\").subscribe(System.out::println);\n```\n\nYou can also deduplicate tweets for specify users as shown below. The code shown below will track users with id 1,2,3,or 4 and give you deduplicated stream across them. You can follow at max 200 users.\n\n```java\nimport com.shekhargulati.deduplication.tweet.TweetDeDuplicator;\n\nTweetDeDuplicator tweetDeDuplicator = TweetDeDuplicator.getDeduplicatorWithInmemoryRepositories();\ntweetDeDuplicator.deduplicate(1,2,3,4).subscribe(System.out::println);\n```\n\n## Tweet deduplication in action\n\nI tested the library on a trending hashtag and results were promising. It was able to clean most of the deduplicated tweets. The output shown below is output of a Tweet Observable with and without deduplication.\n\n```\nTweets per minute without deduplication 99\nTweets per minute with deduplication 70\nTweets per minute without deduplication 98\nTweets per minute with deduplication 68\nTweets per minute without deduplication 85\nTweets per minute with deduplication 54\nTweets per minute without deduplication 75\nTweets per minute with deduplication 47\nTweets per minute without deduplication 83\nTweets per minute with deduplication 48\nTweets per minute without deduplication 79\nTweets per minute with deduplication 35\nTweets per minute without deduplication 101\nTweets per minute with deduplication 62\nTweets per minute without deduplication 72\nTweets per minute with deduplication 45\nTweets per minute without deduplication 82\nTweets per minute with deduplication 45\nTweets per minute without deduplication 85\nTweets per minute with deduplication 32\nTweets per minute without deduplication 82\nTweets per minute with deduplication 50\nTweets per minute without deduplication 85\nTweets per minute with deduplication 39\nTweets per minute without deduplication 86\nTweets per minute with deduplication 52\nTweets per minute without deduplication 78\nTweets per minute with deduplication 45\nTweets per minute without deduplication 72\nTweets per minute with deduplication 37\nTweets per minute without deduplication 86\nTweets per minute with deduplication 43\nTweets per minute without deduplication 74\nTweets per minute with deduplication 39\n```\n\nCode to achieve this data is shown below.\n\n```java\nObservable<Status> tweetsObs = TweetStream.of(\"DaylightSavingTime\");\ntweetsObs.buffer(1, TimeUnit.MINUTES).map(List::size).subscribe(count -> System.out.println(String.format(\"Tweets per minute without deduplication %d\", count)));\ntweetDeDuplicator.deduplicate(tweetsObs).buffer(1, TimeUnit.MINUTES).map(List::size).subscribe(count -> System.out.println(String.format(\"Tweets per minute with deduplication %d\", count)));\n```\n\nLicense\n-------\n\n`tweet-deduplication` is licensed under the MIT License - see the `LICENSE` file for details.\n"
  },
  {
    "path": "12-play/.gitkeep",
    "content": ""
  },
  {
    "path": "13-arangodb/README.md",
    "content": "ArangoDB: Polyglot Persistence Without Cost\n------\n\nWelcome to thirteenth week of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week we will learn about ArangoDB. [ArangoDB](https://www.arangodb.com/) is an open source NoSQL database that provides flexible data model. You can use ArangoDB to model data using combination of document, graph, and key value data modeling styles. Last few years, polyglot persistence has become mainstream. Polyglot persistence as described by [Martin Fowler](http://martinfowler.com/articles/nosql-intro-original.pdf),\n\n> **Polyglot Persistence is using multiple data storage technologies, chosen based upon the way data is being used by individual applications or components of single application.**\n\nWhen I was working as a developer advocate, I gave few talks on building Polyglot persistence applications. In my talk, I showcased how you can build a location aware Job search application using MongoDB, MySQL, Neo4j, and Redis. MongoDB was used to store Job data and provide location aware search using its geospatial indexes, MySQL was used to store user data, Redis was used to act as cache and session store, and Neo4j was used to recommend jobs \"People who applied to this job also applied to these jobs\". Using ArangoDB, we can develop the full application using a single database.\n\nOne of the issues with building Polyglot persistent applications is the maintenance cost associated with managing multiple databases. ArangoDB can help us minimize the maintenance cost as we have to interact with only one database to meet our application needs.\n\nNoSQL databases are broadly classified into Key Value, Document, Graph, and Columnar datastore.\n\n| Data Model     | Description     |Examples|\n| :------------- | :------------- |:------------- |\n| Key Value       | Key-value stores use a Map as their fundamental data model| Redis, Amazon Dynamo DB|\n| Document       | Stores data as document where everything related to a database object is encapsulated together| MongoDB , CouchDB|\n| Graph       | Uses graph structures for semantic queries with nodes, edges and properties to represent and store data| Neo4j, TitanDB |\n| Columnar       | Organize data into column families| HBase, Cassandra|\n\nArangoDB falls in a category of its own as it supports multiple data modeling styles. This makes it more generic and suitable for a lot of use cases. To understand how ArangoDB supports multiple data model styles, we have to understand how it stores data. ArangoDB is a document oriented database where in documents are stored in collections just like any other document oriented database(eg. MongoDB). It acts as key value store as each document is uniquely identified by a key. Documents can be connected to each other allowing you to treat ArangoDB as a graph database.\n\nApart from being multi model, ArangoDB also has many other features that makes it a good choice for your next application:\n\n1. Support for nested documents.\n2. Supports transaction across multiple documents and collections.\n3. Support for ACID transactions.\n4. Inbuilt support for setting up a sharded cluster using user defined or automatically chosen key.\n5. Supports Master/Slave and Master/Master replication.\n6. Fully functional web interface for administration.\n7. Support for joins to combine data across multiple collections.\n\n## Getting started with ArangoDB\n\nArangoDB provides distribution for most operating systems. You can download distribution from [downloads page](https://www.arangodb.com/download/).\n\nIf you are using mac, then you can install ArangoDB using `brew` package manager.\n\n```bash\n$ brew update && brew install arangodb\n```\n\n## Start ArangoDB server\n\nOnce ArangoDB is installed, you can start it using the `arangod` executable.\n\n```bash\n$ /usr/local/sbin/arangod\n```\n\nThis will start the server and you will see output as shown below. I have removed part of the console output for brevity.\n\n```\n2016-03-26T05:56:58Z [11192] INFO Authentication is turned off\n2016-03-26T05:56:58Z [11192] INFO ArangoDB (version 2.8.6 [darwin]) is ready for business. Have fun!\n```\n\nYou can view the web console at [http://localhost:8529/](http://localhost:8529/). ArangoDB provides a fully functional web console which you can use to create databases, collections, perform queries, and administration. In this tutorial, we will use command-line shell `arangosh`.\n\n## Connect to ArangoDB server using `arangosh`\n\nThere are multiple ways you can connect with ArangoDB. You can connect to database server using the web console or command-line shell or using your favorite programming language through database driver. We will use `arangosh`, a command-line shell written in JavaScript. It is very similar in use to MongoDB shell so if you have used MongoDB then you will feel home.\n\n```bash\n$ arangosh\n```\n\nBy default, you will be connected to ArangoDB server running on your machine at default server endpoint `tcp://127.0.0.1:8529`. . If your database is running on a different host then you can specify it using the `--server.endpoint` configuration option.\n\nYou will be connected to default database `_system`. You can specify name of your database using `server.database` option.\n\n```bash\n$ arangosh --server.database localjobs\n```\n\nThere are many other options that you can pass while launching `arangosh`. You can view all options using `arangosh --help` command..\n\nLet's customize our shell so that it greets us with a voice based welcome message. You can enable it using the `voice` option shown below. If you want to customize look and feel of `arangosh` prompt, then you can use prompt option.\n\n```bash\n→ arangosh --voice --prompt \"ArangoDB >> %d -> \" --quiet\n\nArangoDB >> _system ->\n```\n\n`%d` is used to signify database you are currently connected to. As you can see, we are connected to `_system` database.\n\nOnce you are inside the shell, you can perform operations against the database using the `db` object. If you just type `db` and press enter, it will show details of the connected database.\n\n```bash\narangosh [_system]> db\n[object ArangoDatabase \"_system\"]\n```\n\nYou can view version of the database using `version` function.\n\n```\narangosh [_system]> db._version()\n2.8.6\n```\n\nTo view all methods that you can call on `db` object, type db and press `TAB` key. I am showing few of the methods for brevity.\n\n```\narangosh [_system]> db.\ndb._collections()               db._name()\ndb._createDatabase()            db._queues\ndb._help()                      db._version()\ndb._id()                        db.toString()\ndb._index()\n```\n\n## Create `localjobs` database\n\nIn this tutorial, I will showcase how you can use ArangoDB to build location aware job search application. The main entity of our application is Job. Job contains details like title, skills, and location of the job.\n\nWe will create a new database `localjobs` to store application data.\n\n```\narangosh [_system]> db._createDatabase(\"localjobs\")\ntrue\n```\n\nIf database is successfully created then you will see `true` in the response else you will see exception stack trace with the reason why database was not created. For example, if you try to create database with same name twice, you will get following error.\n\n```\nstacktrace: ArangoError: duplicate name\n    at ArangoDatabase._createDatabase (/usr/local/Cellar/arangodb/2.8.6/share/arangodb/js/client/modules/org/arangodb/arango-database.js:863:11)\n    at <shell command>:1:8\n```\n\nNow, that we have created `localjobs` database we can connect to it using the `_useDatabase` method.\n\n```\narangosh [_system]> db._useDatabase(\"localjobs\")\ntrue\n\narangosh [localjobs]>\n```\n\nAs you can see above, `arangosh` prompt is now pointing to `localjobs` database.\n\n\n## Import data using `arangoimp`\n\nArangoDB comes with a bulk importer `arangoimp` that you can use to import data in either JSON, TSV, or CSV format.\n\nWe will import 159 `json` documents that are stored in the `jobs.json` file. I mined this data couple of years back using the LinkedIn API. A single JSON document looks like as shown below.\n\n```json\n{\n  \"company\": {\n    \"id\": \"21836\",\n    \"name\": \"CyberCoders\"\n  },\n  \"title\": \"Ruby on Rails Engineer - PostgreSQL, MongoDB, Redis, HTML, CSS\",\n  \"location\": [\n    33.978622,\n    -118.404471\n  ],\n  \"skills\": [\n    \"mongodb\"\n  ],\n  \"address\": \"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\n  \"experience\": 19\n}\n```\n\nAs you can see, we have details about the company that has posted the job, job title, skills required, location in the form of latitude and longitude, and address of the job posting.\n\nTo import json data file you will run the following command. You can download `jobs.json` from the [repository](https://raw.githubusercontent.com/shekhargulati/52-technologies-in-2016/master/13-arangodb/localjobs/jobs.json). We are running the `arangoimp` command from inside the same directory that contains `jobs.json` file.\n\n```bash\n$ arangoimp --server.database localjobs --file \"jobs.json\" --type json --collection \"jobs\" --create-collection true --create-collection-type \"document\"\n```\n\nThe command shown above will transfer `jobs.json` to the `localjobs` database, create a new document collection `jobs`, import the data into `jobs` collection, and print a status summary as shown below.\n\n```\nConnected to ArangoDB 'tcp://127.0.0.1:8529', version 2.8.6, database: 'localjobs', username: 'root'\n----------------------------------------\ndatabase:         localjobs\ncollection:       jobs\ncreate:           yes\nfile:             jobs.json\ntype:             json\nconnect timeout:  5\nrequest timeout:  1200\n----------------------------------------\nStarting JSON import...\n2016-03-26T09:27:39Z [12348] INFO processed 32767 bytes (3.0%) of input file\n2016-03-26T09:27:39Z [12348] INFO processed 36712 bytes (92.0%) of input file\n\ncreated:          159\nwarnings/errors:  0\nupdated/replaced: 0\nignored:          0\n```\n\nSimilar to `arangosh`, you can specify additional options like which server endpoint to connect. You can view all options using the `arangoimp --help`. One option that you might find useful when importing very large files is `progress`. It allows you to view the progress of import process.\n\n```\n$ arangoimp --server.database localjobs --file \"jobs.json\" --type json --collection \"jobs\" --create-collection true --create-collection-type \"document\" --progress true\n```\n\nYou can also pipe data from another command to `arangoimp` as shown below.\n\n```\n$ cat jobs.json | arangoimp --server.database localjobs --file - --type json --collection \"jobs1\" --create-collection true --create-collection-type \"document\"\n```\n\nYou have to make sure to use `--file -` so that data is read from stdin.\n\nIf you want to create a collection manually then you can use following command.\n\n```js\narangosh [localjobs]> db._create(\"users\")\n[ArangoCollection 1195802007, \"users\" (type document, status loaded)]\n```\n\nThe full signature of `_create` method is `db._create(collection-name, properties)`. You can specify  properties while creating a collection like `waitForSync`,`journalSize`, etc. When you make an insert query to ArangoDB, it does not wait for data to sync to disk. You can change this default behavior by using `waitForSync` property. To learn about all properties you can refer to [documentation](https://docs.arangodb.com/Collections/DatabaseMethods.html).\n\n```js\narangosh [localjobs]> db._create(\"users\",{waitForSync: true})\n```\n\nYou can view all properties for a collection as shown below.\n\n```js\narangosh [localjobs]> db.users.properties()\n{\n  \"doCompact\" : true,\n  \"journalSize\" : 33554432,\n  \"isSystem\" : false,\n  \"isVolatile\" : false,\n  \"waitForSync\" : true,\n  \"keyOptions\" : {\n    \"type\" : \"traditional\",\n    \"allowUserKeys\" : true\n  },\n  \"indexBuckets\" : 8\n}\n```\n\n## Perform simple queries\n\nLet's perform some queries to fetch data from the `jobs` collection.\n\nYou can view any document in `jobs` collection by using the `any` method.\n\n```js\narangosh [localjobs]> db.jobs.any()\n{\n  \"_id\" : \"jobs/1956683195\",\n  \"_key\" : \"1956683195\",\n  \"_rev\" : \"1956683195\",\n  \"experience\" : 5,\n  \"title\" : \"Web Developer - HTML, CSS, JavaScript\",\n  \"address\" : \"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\n  \"location\" : [\n    33.978622,\n    -118.404471\n  ],\n  \"skills\" : [\n    \"node.js\"\n  ],\n  \"company\" : {\n    \"id\" : \"21836\",\n    \"name\" : \"CyberCoders\"\n  }\n}\n```\n\nTo print all the title of jobs, you can execute following command.\n\n```js\narangosh [localjobs]> var allJobs = db.jobs.all()\n\narangosh [localjobs]> while(allJobs.hasNext()) print(allJobs.next().title)\n```\n\n`db.jobs` returns a cursor. We can iterate over cursor using `hasNext` and `next` methods.\n\nYou can write pagination logic using `skip` and limit methods of a cursor.\n\n```js\narangosh [localjobs]> db.jobs.all().limit(2)\nSimpleQueryAll(jobs).limit(2)\narangosh [localjobs]> db.jobs.all().skip(2).count(true)\n157\n```\n\nTo find count of all the documents in the database you can use `count` method.\n\n```js\narangosh [localjobs]> db.jobs.count()\n159\n```\n\n## Performing advance queries with AQL\n\nArangoDB has its own query language AQL (ArangoDB Query Language) that allows you to perform advance queries. You use `_query` method to execute AQL queries.\n\nTo find all jobs with where company name is `Expedia`\n\n```js\nvar q = `FOR j IN jobs FILTER j.company.name == \"Expedia\" RETURN j`\nvar c = db._query(q)\nwhile(c.hasNext())print(c.next())\n```\n\nYou can store the result in an array.\n\n```js\nvar q = `FOR j IN jobs FILTER j.company.name == \"Expedia\" RETURN j`\nvar result = db._query(q).toArray()\n```\n\nYou can define your own projections as well. Let's suppose you only want to return title and company name.\n\n```js\narangosh [localjobs]> var q = `FOR j IN jobs FILTER j.company.name == \"Expedia\" RETURN {title:j.title, companyName: j.company.name, experience: j.experience}`\n\narangosh [localjobs]> var result = db._query(q).toArray()\n\narangosh [localjobs]> result\n[\n  {\n  \"title\" : \"Development Manager\",\n  \"companyName\" : \"Expedia\",\n  \"experience\" : 13\n  },\n  {\n    \"title\" : \"SDE II - Ruby Software Engineer\",\n    \"companyName\" : \"Expedia\",\n    \"experience\" : 5\n  },\n....\n]\n```\n\nBy default, result is unsorted. You can specify the sorting clause using the `SORT` as shown below.\n\n```js\narangosh [localjobs]> var q = `FOR j IN jobs FILTER j.company.name == \"Expedia\" SORT j.experience RETURN {title:j.title, companyName: j.company.name, experience: j.experience}`\n\narangosh [localjobs]> var result = db._query(q).toArray()\n\narangosh [localjobs]> result\n[\n  {\n    \"title\" : \"SDE I - Ruby Software Engineer\",\n    \"companyName\" : \"Expedia\",\n    \"experience\" : 4\n  },\n  {\n    \"title\" : \"SDE II - Ruby Software Engineer\",\n    \"companyName\" : \"Expedia\",\n    \"experience\" : 5\n  },\n  {\n    \"title\" : \"Sr SDE - Senior Ruby Software Engineer\",\n    \"companyName\" : \"Expedia\",\n    \"experience\" : 6\n  },\n  ...\n]\n```\n\nAQL also supports grouping and aggregation using `COLLECT` and `AGGREGATE` operators. You can group all the skills together as shown below.\n\n```js\nvar q = `FOR j IN jobs COLLECT allskills=j.skills RETURN allskills`\nvar result = db._query(q).toArray()\nresult.reduce(function(a,b){ return a.concat(b);})\n```\n\nYou can refer to [documentation](https://docs.arangodb.com/AqlExamples/Grouping.html) to learn more about grouping.\n\n## Performing location aware queries\n\nFrom the [docs](https://docs.arangodb.com/IndexHandling/Geo.html),\n\n> **ArangoDB uses Hilbert curves to implement geo-spatial indexes. A geo-spatial index assumes that the latitude is between -90 and 90 degree and the longitude is between -180 and 180 degree. A geo index will ignore all documents which do not fulfill these requirements.**\n\nBefore you can perform location aware queries, you have to create geo index.\n\n\n```js\narangosh [localjobs]> db.jobs.ensureIndex({type:\"geo\",fields:[\"location\"]})\n```\n```js\n{\n  \"id\" : \"jobs/2073206203\",\n  \"type\" : \"geo1\",\n  \"fields\" : [\n    \"location\"\n  ],\n  \"geoJson\" : false,\n  \"constraint\" : false,\n  \"unique\" : false,\n  \"ignoreNull\" : true,\n  \"sparse\" : true,\n  \"isNewlyCreated\" : true,\n  \"code\" : 201\n}\n```\n\nNow, you can perform near queries. Let's suppose I want to find 2 jobs near to Gurgon, Haryana, India. As you can see below, jobs from Gurgaon are only returned.\n\n```js\narangosh [localjobs]> db.jobs.near(28.481216, 77.019135).limit(2).toArray().map(function(j){return {title:j.title,location:j.location,address:j.address}})\n```\n```js\n[\n  {\n    \"title\" : \"Sr SDE - Senior Ruby Software Engineer\",\n    \"location\" : [\n      28.464956,\n      77.064564\n    ],\n    \"address\" : \"Sector 29, Gurgaon, Delhi, India\"\n  },\n  {\n    \"title\" : \"SDE II - Ruby Software Engineer\",\n    \"location\" : [\n      28.464956,\n      77.064564\n    ],\n    \"address\" : \"Sector 29, Gurgaon, Delhi, India\"\n  }\n]\n```\n\nLet's suppose, I want jobs near San Jose California then I can query as follows.\n\n```js\narangosh [localjobs]> db.jobs.near(37.3394444, -121.8938889).limit(5).toArray().map(function(j){return {title:j.title,location:j.location,address:j.address}})\n```\n```js\n[\n  {\n    \"title\" : \"Director of Cloud\",\n    \"location\" : [\n      37.33085,\n      -121.887947\n    ],\n    \"address\" : \"302 South Market Street, San Jose, CA, United States\"\n  },\n  {\n    \"title\" : \"Senior Ruby Developer-Ruby on Rails Engineer (RoR, MongoDB, Rails, Sinatra)\",\n    \"location\" : [\n      37.391467,\n      -121.977033\n    ],\n    \"address\" : \"4200 Great America Parkway, Santa Clara, CA, United States\"\n  },\n  {\n    \"title\" : \"MTS - Hadoop Distributed File System\",\n    \"location\" : [\n      37.390284,\n      -122.031936\n    ],\n    \"address\" : \"455 West Maude Avenue, Sunnyvale, CA, United States\"\n  },\n  {\n    \"title\" : \"Solutions Engineer - Big Data\",\n    \"location\" : [\n      37.390284,\n      -122.031936\n    ],\n    \"address\" : \"455 West Maude Avenue, Sunnyvale, CA, United States\"\n  },\n  {\n    \"title\" : \"Product Evangelist, Hadoop\",\n    \"location\" : [\n      37.417223,\n      -122.025112\n    ],\n    \"address\" : \"701 1st Avenue, Sunnyvale, CA, United States\"\n  }\n]\n```\n\n## Conclusion\n\nThat's all for this week. ArangoDB is a powerful database that provides multi model capabilities. You can refer to its [documentation](https://docs.arangodb.com/) to learn about other capabilities. I will revisit ArangoDB later in this series to showcase how we can build a Java Spring application with it. We will also look at its graph data model support.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/17](https://github.com/shekhargulati/52-technologies-in-2016/issues/17).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/13-arangodb)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "13-arangodb/localjobs/jobs.json",
    "content": "{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Ruby on Rails Engineer - PostgreSQL, MongoDB, Redis, HTML, CSS\",\"location\":[33.978622,-118.404471],\"skills\":[\"mongodb\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":19}\n{\"company\":{\"id\":\"0\",\"name\":\"Unicommerce eSolutions Pvt. Ltd. \"},\"title\":\"Senior/Java Developer (Java/J2EE, Web services) \",\"location\":[28.584569,77.313302],\"skills\":[\"java\"],\"address\":\"Lower Ground Floor, B-85,, Sector 2, Noida, Uttar Pradesh, India\",\"experience\":3}\n{\"company\":{\"id\":\"488966\",\"name\":\"Inventum\"},\"title\":\"Java Team Lead\",\"location\":[28.5332598,77.410934],\"skills\":[\"java\"],\"address\":\"Inventum Technologies Private Limited, C-70, Phase 2 Extension, NOIDA, Uttar Pradesh 201305, India\",\"experience\":11}\n{\"company\":{\"id\":\"4764\",\"name\":\"BlackRock\"},\"title\":\"VP - Portfolio Mangement Tool(Java Technology)(Looking for only IIT,NIT,REC)\",\"location\":[28.51123,77.085941],\"skills\":[\"java\"],\"address\":\"187, Phase I, Udyog Vihar, Gurgaon, Haryana, India, Udyog Vihar I, India\",\"experience\":1}\n{\"company\":{\"id\":\"32745\",\"name\":\"SapientNitro\"},\"title\":\"Specialist Infrastructure – (Build and Release)\",\"location\":[28.509578,77.070722],\"skills\":[\"must have\"],\"address\":\"Unitech Infospace, Ground Floor, Tower A, Building 2, Sector 21, Dundahera, Gurgaon, Haryana, India\",\"experience\":20}\n{\"company\":{\"id\":\"103683\",\"name\":\"Burns Sheehan\"},\"title\":\"Javascript Developer\",\"location\":[51.511592,-0.087268],\"skills\":[\"node.js\"],\"address\":\"75 King William Street, London, United Kingdom\",\"experience\":13}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"JavaScript Developer - JavaScript, Backbone.js, Node.js, HTML5\",\"location\":[33.018308,-96.794976],\"skills\":[\"node.js\"],\"address\":\"Suite 400, 1400 Preston Road, Plano, TX, United States\",\"experience\":7}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Ruby on Rails Engineer - PostgreSQL, MongoDB, Redis, HTML, CSS\",\"location\":[33.978622,-118.404471],\"skills\":[\"mongodb\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":0}\n{\"company\":{\"id\":\"0\",\"name\":\"Unicommerce eSolutions Pvt. Ltd. \"},\"title\":\"Senior/Java Developer (Java/J2EE, Web services) \",\"location\":[28.584569,77.313302],\"skills\":[\"java\"],\"address\":\"Lower Ground Floor, B-85,, Sector 2, Noida, Uttar Pradesh, India\",\"experience\":18}\n{\"company\":{\"id\":\"488966\",\"name\":\"Inventum\"},\"title\":\"Java Team Lead\",\"location\":[28.5332598,77.410934],\"skills\":[\"java\"],\"address\":\"Inventum Technologies Private Limited, C-70, Phase 2 Extension, NOIDA, Uttar Pradesh 201305, India\",\"experience\":4}\n{\"company\":{\"id\":\"4764\",\"name\":\"BlackRock\"},\"title\":\"VP - Portfolio Mangement Tool(Java Technology)(Looking for only IIT,NIT,REC)\",\"location\":[28.51123,77.085941],\"skills\":[\"java\"],\"address\":\"187, Phase I, Udyog Vihar, Gurgaon, Haryana, India, Udyog Vihar I, India\",\"experience\":11}\n{\"company\":{\"id\":\"32745\",\"name\":\"SapientNitro\"},\"title\":\"Specialist Infrastructure – (Build and Release)\",\"location\":[28.509578,77.070722],\"skills\":[\"must have\"],\"address\":\"Unitech Infospace, Ground Floor, Tower A, Building 2, Sector 21, Dundahera, Gurgaon, Haryana, India\",\"experience\":0}\n{\"company\":{\"id\":\"103683\",\"name\":\"Burns Sheehan\"},\"title\":\"Javascript Developer\",\"location\":[51.511592,-0.087268],\"skills\":[\"node.js\"],\"address\":\"75 King William Street, London, United Kingdom\",\"experience\":19}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Ruby on Rails Engineer - PostgreSQL, MongoDB, Redis, HTML, CSS\",\"location\":[33.978622,-118.404471],\"skills\":[\"mongodb\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":18}\n{\"company\":{\"id\":\"974238\",\"name\":\"Sapient Global Markets\"},\"title\":\"Manager Technology Java\",\"location\":[28.509578,77.070722],\"skills\":[\"core java\",\"java - spring framework\",\"j2ee\",\"java - orm\",\"java - swing applet\",\"java - web presentation frameworks\",\"java - messaging implementation\",\"java web services\",\"sql development languages\",\"enterprise architecture planning (reap)\",\"planning/ execution \\u0026amp; tracking\",\"scoping and estimating\",\"data modeling\",\"high availability and failover applications\",\"high throughput / transaction application\",\"logical architecture design\",\"ooad and uml\",\"package / vendor selection\",\"performance / capacity planning\"],\"address\":\"Unitech Infospace, Ground Floor, Tower A, Building 2, Sector 21, Dundahera, Gurgaon, Haryana, India\",\"experience\":7}\n{\"company\":{\"id\":\"0\",\"name\":\"Unicommerce eSolutions Pvt. Ltd. \"},\"title\":\"Senior/Java Developer (Java/J2EE, Web services) \",\"location\":[28.584569,77.313302],\"skills\":[\"java\"],\"address\":\"Lower Ground Floor, B-85,, Sector 2, Noida, Uttar Pradesh, India\",\"experience\":5}\n{\"company\":{\"id\":\"488966\",\"name\":\"Inventum\"},\"title\":\"Java Team Lead\",\"location\":[28.5332598,77.410934],\"skills\":[\"java\"],\"address\":\"Inventum Technologies Private Limited, C-70, Phase 2 Extension, NOIDA, Uttar Pradesh 201305, India\",\"experience\":13}\n{\"company\":{\"id\":\"4764\",\"name\":\"BlackRock\"},\"title\":\"VP - Portfolio Mangement Tool(Java Technology)(Looking for only IIT,NIT,REC)\",\"location\":[28.51123,77.085941],\"skills\":[\"java\"],\"address\":\"187, Phase I, Udyog Vihar, Gurgaon, Haryana, India, Udyog Vihar I, India\",\"experience\":8}\n{\"company\":{\"id\":\"32745\",\"name\":\"SapientNitro\"},\"title\":\"Specialist Infrastructure – (Build and Release)\",\"location\":[28.509578,77.070722],\"skills\":[\"must have\"],\"address\":\"Unitech Infospace, Ground Floor, Tower A, Building 2, Sector 21, Dundahera, Gurgaon, Haryana, India\",\"experience\":14}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"Sr SDE - Senior Ruby Software Engineer\",\"location\":[28.464956,77.064564],\"skills\":[\"ruby\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":10}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"SDE I - Ruby Software Engineer\",\"location\":[28.464956,77.064564],\"skills\":[\"ruby\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":4}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"SDE II - Ruby Software Engineer\",\"location\":[28.464956,77.064564],\"skills\":[\"ruby\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":5}\n{\"company\":{\"id\":\"288351\",\"name\":\"SlideShare\"},\"title\":\"Software Engineers (Ruby / Python / Java)\",\"location\":[28.45467,77.097816],\"skills\":[\"ruby\"],\"address\":\"Ext Golf Course Road, Gurgaon, Haryana, India\",\"experience\":1}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"SET I\",\"location\":[28.464956,77.064564],\"skills\":[\"ruby\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":19}\n{\"company\":{\"id\":\"288351\",\"name\":\"SlideShare\"},\"title\":\"Software Engineers (Ruby / Python / Java)\",\"location\":[28.45467,77.097816],\"skills\":[\"python\"],\"address\":\"Ext Golf Course Road, Gurgaon, Haryana, India\",\"experience\":6}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"Software Dev Engineer (Active Analytics)\",\"location\":[28.464956,77.064564],\"skills\":[\"python\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":14}\n{\"company\":{\"id\":\"164008\",\"name\":\"GlobalLogic\"},\"title\":\"QA Automation Engineer (Whitebox)\",\"location\":[28.498109,77.434328],\"skills\":[\"python\"],\"address\":\"Sector 144, Noida, Uttar Pradesh, India\",\"experience\":7}\n{\"company\":{\"id\":\"164008\",\"name\":\"GlobalLogic\"},\"title\":\"QA Automation Lead (Whitebox)\",\"location\":[28.498109,77.434328],\"skills\":[\"python\"],\"address\":\"Sector 144, Noida, Uttar Pradesh, India\",\"experience\":20}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"SDE II - Front End Software Engineer\",\"location\":[28.464956,77.064564],\"skills\":[\"node.js\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":14}\n{\"company\":{\"id\":\"103683\",\"name\":\"Burns Sheehan\"},\"title\":\"Javascript Developer\",\"location\":[51.511592,-0.087268],\"skills\":[\"node.js\"],\"address\":\"75 King William Street, London, United Kingdom\",\"experience\":16}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Javascript Developer - Javascript Programmer - Node.JS Developer\",\"location\":[33.978622,-118.404471],\"skills\":[\"node.js\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":4}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Javascript Developer - Javascript Programmer - Node.JS Developer\",\"location\":[33.978622,-118.404471],\"skills\":[\"node.js\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":2}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"JavaScript Developer - JavaScript, Backbone.js, Node.js, HTML5\",\"location\":[33.018308,-96.794976],\"skills\":[\"node.js\"],\"address\":\"Suite 400, 1400 Preston Road, Plano, TX, United States\",\"experience\":7}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"Sr SDE - Senior Ruby Software Engineer\",\"location\":[28.464956,77.064564],\"skills\":[\"mongodb\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":6}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"SET I\",\"location\":[28.464956,77.064564],\"skills\":[\"mongodb\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":13}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Ruby on Rails Engineer - PostgreSQL, MongoDB, Redis, HTML, CSS\",\"location\":[33.978622,-118.404471],\"skills\":[\"mongodb\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":5}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google 1 - US\"},\"title\":\"Partner Technology Manager\",\"location\":[28.546208,77.124055],\"skills\":[\"python\"],\"address\":\"Swarna Jayanti Marg, Mahipalpur Extension, Mahipalpur, New Delhi, Delhi, India\",\"experience\":15}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Javascript Developer - JavaScript, Consumer Web, JS Frameworks\",\"location\":[37.414198,-122.078488],\"skills\":[\"node.js\"],\"address\":\"1400 North Shoreline Boulevard, Mountain View, CA, United States\",\"experience\":18}\n{\"company\":{\"id\":\"1035\",\"name\":\"Microsoft\"},\"title\":\"Partner Segment Marketing Mgr\",\"location\":[28.495068,77.093382],\"skills\":[\"cloud\"],\"address\":\"DLF Cyber Green, Gurgaon, Haryana, India\",\"experience\":14}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google\"},\"title\":\"Enterprise SMB Sales Representative\",\"location\":[28.495624,77.088823],\"skills\":[\"cloud\"],\"address\":\"8th and 9th Floors, Tower C Building No. 8, Dlf Cyber City, Gurgaon, Haryana, India\",\"experience\":4}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google\"},\"title\":\"Enterprise SMB Sales Manager\",\"location\":[28.495624,77.088823],\"skills\":[\"cloud\"],\"address\":\"8th and 9th Floors, Tower C Building No. 8, Dlf Cyber City, Gurgaon, Haryana, India\",\"experience\":12}\n{\"company\":{\"id\":\"1480\",\"name\":\"Adobe\"},\"title\":\"Software Developer (PHP, SOAP/REST, SQL)\",\"location\":[28.588672,77.344826],\"skills\":[\"php\"],\"address\":\"I-1A, City Center, Sector 25-A, Sector 25A, Noida, Uttar Pradesh, India\",\"experience\":15}\n{\"company\":{\"id\":\"2451595\",\"name\":\"HelpingDoc\"},\"title\":\"Sr. Software Developer (PHP, MySQL)\",\"location\":[28.6751689,77.2026103],\"skills\":[\"php\"],\"address\":\"Helping Hands, Basti Harphool Singh, New Delhi, Delhi 110006, India\",\"experience\":5}\n{\"company\":{\"id\":\"233654\",\"name\":\"KLEWARD\"},\"title\":\"Senior Software Engineer - PHP/Zend\",\"location\":[28.6120528,77.3855549],\"skills\":[\"php\"],\"address\":\"Kleward Consulting Pvt Ltd, A-21, Sector 65, Sector - 106, Sector 65, New Delhi, Delhi 201301, India\",\"experience\":9}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"Senior Hadoop Admin\",\"location\":[28.464956,77.064564],\"skills\":[\"hadoop\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":9}\n{\"company\":{\"id\":\"974238\",\"name\":\"Sapient Global Markets\"},\"title\":\"Hadoop Professionals/Experts \",\"location\":[28.509541,77.070723],\"skills\":[\"hadoop\"],\"address\":\"Sector 21, Gurgaon, Haryana, India\",\"experience\":6}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"Development Manager\",\"location\":[28.464956,77.064564],\"skills\":[\"hadoop\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":13}\n{\"company\":{\"id\":\"2751\",\"name\":\"Expedia\"},\"title\":\"Manager, Development (Active Analytics)\",\"location\":[28.464956,77.064564],\"skills\":[\"hadoop\"],\"address\":\"Sector 29, Gurgaon, Delhi, India\",\"experience\":12}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Sr SCALA Software Engineer - Scala Developer - Scala Programmer\",\"location\":[40.750683,-73.979098],\"skills\":[\"scala\"],\"address\":\"90 Park Avenue #1702, New York, NY, United States\",\"experience\":7}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Scala Developer - Scala, Java, PHP\",\"location\":[38.883838,-77.438879],\"skills\":[\"scala\"],\"address\":\"4437 Brookfield Corporate Drive #200, Chantilly, VA, United States\",\"experience\":20}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Scala Developer - Scala, Java, PHP\",\"location\":[39.184974,-76.851856],\"skills\":[\"scala\"],\"address\":\"9891 Brokenland Parkway, Columbia, MD, United States\",\"experience\":18}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Java Developer, Scala, Well Funded Startup, Equity Offered, NYC\",\"location\":[40.750683,-73.979098],\"skills\":[\"scala\"],\"address\":\"90 Park Avenue #1702, New York, NY, United States\",\"experience\":8}\n{\"company\":{\"id\":\"207788\",\"name\":\"Erlang Solutions Ltd.\"},\"title\":\"Senior Erlang Developers\",\"location\":[51.518826,-0.075438],\"skills\":[\"erlang\"],\"address\":\"29 London Fruit \\u0026 Wool Exchange, Brushfield Street, City of London, United Kingdom\",\"experience\":5}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Senior Erlang Developer for massive international gaming company\",\"location\":[33.978622,-118.404471],\"skills\":[\"erlang\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":9}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Senior Erlang Developer for massive international gaming company\",\"location\":[33.978622,-118.404471],\"skills\":[\"erlang\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":0}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Senior erlang developer - Erlang, OTP Development/Coding, Teleco\",\"location\":[38.883838,-77.438879],\"skills\":[\"erlang\"],\"address\":\"4437 Brookfield Corporate Drive #200, Chantilly, VA, United States\",\"experience\":15}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Senior Erlang OTP Developer - Erlang, OTP Development, Telecommu\",\"location\":[38.883838,-77.438879],\"skills\":[\"erlang\"],\"address\":\"4437 Brookfield Corporate Drive #200, Chantilly, VA, United States\",\"experience\":17}\n{\"company\":{\"id\":\"2031\",\"name\":\"Time Warner Cable\"},\"title\":\"Sr. Software Engineer, (HTTP, HTML 5, CSS, JSON, Java, Scala/Lift, Groovy/Grails, Spring,Lucene/Solr) Common Services Tier Job\",\"location\":[39.669076,-104.985392],\"skills\":[\"clojure\"],\"address\":\"2615 South Sherman Street, Denver, CO, United States\",\"experience\":20}\n{\"company\":{\"id\":\"4295\",\"name\":\"EchoStar Corporation\"},\"title\":\"Software Engineer (Java, C++, Python)\",\"location\":[39.575948,-104.867192],\"skills\":[\"clojure\"],\"address\":\"100 Inverness Terrace East, Englewood, CO, United States\",\"experience\":2}\n{\"company\":{\"id\":\"528404\",\"name\":\"Sonian\"},\"title\":\"Principal Software Engineer, User Interface\",\"location\":[42.291374,-71.199217],\"skills\":[\"clojure\"],\"address\":\"95 Wells Avenue, Newton, MA, United States\",\"experience\":7}\n{\"company\":{\"id\":\"1096435\",\"name\":\"Globys Inc\"},\"title\":\"Senior Developer - Big Data \\u0026 Distributed Computing Platforms - Startup Division\",\"location\":[40.752011,-74.002966],\"skills\":[\"clojure\"],\"address\":\"528 West 29th Street, New York, NY, United States\",\"experience\":12}\n{\"company\":{\"id\":\"3076\",\"name\":\"Kforce Inc.\"},\"title\":\"Lisp Developer\",\"location\":[26.136231,-80.334919],\"skills\":[\"clojure\"],\"address\":\"1300 Sawgrass Corporate Parkway #210, Sunrise, FL, United States\",\"experience\":3}\n{\"company\":{\"id\":\"974238\",\"name\":\"Sapient Global Markets\"},\"title\":\"Specialist - Core Java\",\"location\":[28.509578,77.070722],\"skills\":[\"bachelor’s degree in computer science or a related field\"],\"address\":\"Unitech Infospace, Ground Floor, Tower A, Building 2, Sector 21, Dundahera, Gurgaon, Haryana, India\",\"experience\":20}\n{\"company\":{\"id\":\"974238\",\"name\":\"Sapient Global Markets\"},\"title\":\"Specialist - Core Java\",\"location\":[28.509578,77.070722],\"skills\":[\"bachelor’s degree in computer science or a related field\"],\"address\":\"Unitech Infospace, Ground Floor, Tower A, Building 2, Sector 21, Dundahera, Gurgaon, Haryana, India\",\"experience\":0}\n{\"company\":{\"id\":\"32745\",\"name\":\"SapientNitro\"},\"title\":\"Senior Developer Day Communique CMS\",\"location\":[28.509578,77.070722],\"skills\":[\"mastery of all core web technologies including xml\",\"xhtml\",\"client/server-side scripting languages such as javascript\",\"and jsp\",\"and web services development using restful implementations.\"],\"address\":\"Unitech Infospace, Ground Floor, Tower A, Building 2, Sector 21, Dundahera, Gurgaon, Haryana, India\",\"experience\":3}\n{\"company\":{\"id\":\"18305\",\"name\":\"Opera Solutions\"},\"title\":\"Lead Java Developer (Backend)\",\"location\":[28.567812,77.31518179999999],\"skills\":[\"java\"],\"address\":\"Opera Solutions Delhi, Sector 16A, NOIDA, Uttar Pradesh, India\",\"experience\":19}\n{\"company\":{\"id\":\"1480\",\"name\":\"Adobe\"},\"title\":\"Member Technical Staff\",\"location\":[28.588672,77.344826],\"skills\":[\"ruby\"],\"address\":\"I-1A, City Center, Sector 25-A, Sector 25A, Noida, Uttar Pradesh, India\",\"experience\":14}\n{\"company\":{\"id\":\"13162\",\"name\":\"Exponential\"},\"title\":\"DEVELOPER - JAVASCRIPT\",\"location\":[28.670059,77.181637],\"skills\":[\"ruby\"],\"address\":\"Na-3a, Shastri Nagar, Shastri Nagar, New Delhi, Delhi, India\",\"experience\":0}\n{\"company\":{\"id\":\"18305\",\"name\":\"Opera Solutions\"},\"title\":\"Principal Scientist \",\"location\":[28.567812,77.31518179999999],\"skills\":[\"python\"],\"address\":\"Opera Solutions Delhi, Sector 16A, NOIDA, Uttar Pradesh, India\",\"experience\":4}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google\"},\"title\":\"Technical Account Manager\",\"location\":[28.495624,77.088823],\"skills\":[\"python\"],\"address\":\"8th and 9th Floors, Tower C Building No. 8, Dlf Cyber City, Gurgaon, Haryana, India\",\"experience\":6}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google\"},\"title\":\"Technical Account Manager, Android Partner Engineering\",\"location\":[28.495624,77.088823],\"skills\":[\"python\"],\"address\":\"8th and 9th Floors, Tower C Building No. 8, Dlf Cyber City, Gurgaon, Haryana, India\",\"experience\":0}\n{\"company\":{\"id\":\"128628\",\"name\":\"Talener Group\"},\"title\":\"Senior Software Engineer/Development Lead\",\"location\":[37.790346,-122.40185],\"skills\":[\"node.js\"],\"address\":\"100 Montgomery Street, San Francisco, CA, United States\",\"experience\":16}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Web Developer - HTML, CSS, JavaScript\",\"location\":[33.978622,-118.404471],\"skills\":[\"node.js\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":5}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Web Application Engineer - HTML5, CSS3, BackboneJS, JS Framework\",\"location\":[40.750683,-73.979098],\"skills\":[\"node.js\"],\"address\":\"90 Park Avenue #1702, New York, NY, United States\",\"experience\":6}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Web Application Engineer - HTML5, CSS3, BackboneJS, JS Framework\",\"location\":[40.750683,-73.979098],\"skills\":[\"node.js\"],\"address\":\"90 Park Avenue #1702, New York, NY, United States\",\"experience\":16}\n{\"company\":{\"id\":\"2144029\",\"name\":\"GREE International, Inc\"},\"title\":\"Software Engineer - Javascript\",\"location\":[37.579539,-122.345853],\"skills\":[\"node.js\"],\"address\":\"1110 Burlingame Avenue, Burlingame, CA, United States\",\"experience\":2}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Ruby on Rails Engineer - PostgreSQL, MongoDB, Redis, HTML, CSS\",\"location\":[33.978622,-118.404471],\"skills\":[\"mongodb\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":2}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Senior Developer - Ruby, Rails, MongoDB\",\"location\":[37.414198,-122.078488],\"skills\":[\"mongodb\"],\"address\":\"1400 North Shoreline Boulevard, Mountain View, CA, United States\",\"experience\":1}\n{\"company\":{\"id\":\"729369\",\"name\":\"MoTek Technologies\"},\"title\":\"Senior Ruby Developer-Ruby on Rails Engineer (RoR, MongoDB, Rails, Sinatra)\",\"location\":[37.391467,-121.977033],\"skills\":[\"mongodb\"],\"address\":\"4200 Great America Parkway, Santa Clara, CA, United States\",\"experience\":16}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Full Stack Developer - JavaScript, CoffeeScript, HTML, MongoDB\",\"location\":[40.480838,-111.891503],\"skills\":[\"mongodb\"],\"address\":\"486 Coalville Way, Draper, UT, United States\",\"experience\":9}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"VP of Engineering - MongoDB,Lucene - Popular High Traffic Site\",\"location\":[33.978622,-118.404471],\"skills\":[\"mongodb\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":15}\n{\"company\":{\"id\":\"1060\",\"name\":\"Ericsson\"},\"title\":\"Customer Unit - Chief Information Officer\",\"location\":[28.4956,77.088884],\"skills\":[\"cloud\"],\"address\":\"Ericsson Forum, Dlf Cyber City, A, Sector 25, Gurgaon, Haryana, India\",\"experience\":13}\n{\"company\":{\"id\":\"1480\",\"name\":\"Adobe\"},\"title\":\"Senior Product Manager\",\"location\":[28.588672,77.344826],\"skills\":[\"cloud\"],\"address\":\"I-1A, City Center, Sector 25-A, Sector 25A, Noida, Uttar Pradesh, India\",\"experience\":9}\n{\"company\":{\"id\":\"324195\",\"name\":\"Atlogys Technical Consulting\"},\"title\":\"Tech lead / Senior Software Engineer\",\"location\":[28.544643,77.248831],\"skills\":[\"php\"],\"address\":\"Nehru Enclave, New Delhi, Delhi, India\",\"experience\":13}\n{\"company\":{\"id\":\"1986195\",\"name\":\"Intuitent Online\"},\"title\":\"PHP developer with 2+ years of experience for exciting role in startup\",\"location\":[28.463809,77.090554],\"skills\":[\"php\"],\"address\":\"9106, Garden Villas, DLF Phase IV,, Gurgaon, Haryana, India\",\"experience\":14}\n{\"company\":{\"id\":\"144284\",\"name\":\"InfoAxon Technologies Limited\"},\"title\":\"Technical Architect Java,Professional Open Source Practice\",\"location\":[28.620987,77.381161],\"skills\":[\"php\"],\"address\":\"A-105, Sector- 63,, Electronic City, Sector 63 Noida, Uttar Pradesh, India\",\"experience\":9}\n{\"company\":{\"id\":\"1680\",\"name\":\"Cognizant Technology Solutions\"},\"title\":\"Analytics Opportunity in Cognizant\",\"location\":[28.509324,77.070326],\"skills\":[\"hadoop\"],\"address\":\"Sector 21, Gurgaon, Haryana, India\",\"experience\":8}\n{\"company\":{\"id\":\"1288\",\"name\":\"Yahoo!\"},\"title\":\"Product Evangelist, Hadoop\",\"location\":[37.417223,-122.025112],\"skills\":[\"hadoop\"],\"address\":\"701 1st Avenue, Sunnyvale, CA, United States\",\"experience\":2}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Java / Scala Engineers Needed - Growing eCommerce Firm in NYC!\",\"location\":[40.750683,-73.979098],\"skills\":[\"scala\"],\"address\":\"90 Park Avenue #1702, New York, NY, United States\",\"experience\":4}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Senior erlang developer - Erlang, OTP Development/Coding, Teleco\",\"location\":[38.883838,-77.438879],\"skills\":[\"erlang\"],\"address\":\"4437 Brookfield Corporate Drive #200, Chantilly, VA, United States\",\"experience\":15}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Erlang developer, Python Develper, Back end engineer - Erlang,\",\"location\":[37.414198,-122.078488],\"skills\":[\"erlang\"],\"address\":\"1400 North Shoreline Boulevard, Mountain View, CA, United States\",\"experience\":5}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Erlang developer, Python Develper, Back end engineer - Erlang,\",\"location\":[37.414198,-122.078488],\"skills\":[\"erlang\"],\"address\":\"1400 North Shoreline Boulevard, Mountain View, CA, United States\",\"experience\":20}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Senior Erlang Developer - Erland, OTP Coding, Telecommunications\",\"location\":[38.883838,-77.438879],\"skills\":[\"erlang\"],\"address\":\"4437 Brookfield Corporate Drive #200, Chantilly, VA, United States\",\"experience\":18}\n{\"company\":{\"id\":\"165949\",\"name\":\"Shutterfly\"},\"title\":\"Sr. Development Engineer - Platform\",\"location\":[37.539586,-122.256474],\"skills\":[\"clojure\"],\"address\":\"2800 Bridge Parkway #101, Redwood City, CA, United States\",\"experience\":4}\n{\"company\":{\"id\":\"165949\",\"name\":\"Shutterfly\"},\"title\":\"Senior Engineer Dev-OPS - Platform\",\"location\":[37.539586,-122.256474],\"skills\":[\"clojure\"],\"address\":\"2800 Bridge Parkway #101, Redwood City, CA, United States\",\"experience\":2}\n{\"company\":{\"id\":\"5679\",\"name\":\"Commission Junction\"},\"title\":\"Engineering Team Lead \",\"location\":[41.881822,-87.635712],\"skills\":[\"clojure\"],\"address\":\"303 West Madison Street, Chicago, IL, United States\",\"experience\":8}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Big Data Architect - HBase, Scala, Java, Ruby, Hadoop\",\"location\":[30.251246,-97.685988],\"skills\":[\"clojure\"],\"address\":\"800 Interchange Boulevard #102, Austin, TX, United States\",\"experience\":6}\n{\"company\":{\"id\":\"18609\",\"name\":\"Delta Design\"},\"title\":\"Embedded Software Engineer\",\"location\":[32.943164,-117.039618],\"skills\":[\"clojure\"],\"address\":\"12367 Crosthwaite Circle, Poway, CA, United States\",\"experience\":10}\n{\"company\":{\"id\":\"1115\",\"name\":\"SAP\"},\"title\":\"Online Development Manager (f/m)\",\"location\":[49.295272,8.645579],\"skills\":[\"java\"],\"address\":\"Dietmar-Hopp-Allee 15, Walldorf, Germany\",\"experience\":11}\n{\"company\":{\"id\":\"214032\",\"name\":\"Advanced Resource Managers\"},\"title\":\"Multiple Java Developer Opportunites Berlin, Germany Online Super Brand Up To €80,000 + Relocation + Bonus\",\"location\":[52.495541,13.34368],\"skills\":[\"java\"],\"address\":\"Winterfeldtstraße 97, Berlin, Germany\",\"experience\":0}\n{\"company\":{\"id\":\"2307986\",\"name\":\"Jefferson Wolfe\"},\"title\":\"Senior Java Engineer\",\"location\":[52.543609,13.417225],\"skills\":[\"java\"],\"address\":\"Lychener Straße 37, Berlin, Germany\",\"experience\":17}\n{\"company\":{\"id\":\"9624\",\"name\":\"Guidewire Software\"},\"title\":\"Technical Consultant - EU - Germany\",\"location\":[48.130083,11.586187],\"skills\":[\"java\"],\"address\":\"Zeppelinstraße 71-73, Munich, Germany\",\"experience\":6}\n{\"company\":{\"id\":\"0\",\"name\":\"BLUE ELEPHANT SYSTEMS\"},\"title\":\" (Senior) Java Software-Entwickler (m/w) \",\"location\":[48.76361,9.167814],\"skills\":[\"java\"],\"address\":\"Marienplatz 8, Stuttgart, Germany\",\"experience\":15}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Java Developer - Java Cloud Analytics Developer - TS/SCI FSP\",\"location\":[38.883838,-77.438879],\"skills\":[\"java\"],\"address\":\"4437 Brookfield Corporate Drive #200, Chantilly, VA, United States\",\"experience\":19}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Embedded Java Applications Engineer\",\"location\":[37.414198,-122.078488],\"skills\":[\"java\"],\"address\":\"1400 North Shoreline Boulevard, Mountain View, CA, United States\",\"experience\":11}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Embedded Java Applications Engineer\",\"location\":[37.414198,-122.078488],\"skills\":[\"java\"],\"address\":\"1400 North Shoreline Boulevard, Mountain View, CA, United States\",\"experience\":17}\n{\"company\":{\"id\":\"694216\",\"name\":\"Vertex Solutions International Ltd\"},\"title\":\"Chief Software Architect\",\"location\":[52.375488,13.516416],\"skills\":[\"ruby\"],\"address\":\"Mittelstraße, Schönefeld, Germany\",\"experience\":11}\n{\"company\":{\"id\":\"1437303\",\"name\":\"genua mbh\"},\"title\":\"Ruby on Rails Developer (f/m) for Centralized Management of VPN and Firewall Systems\",\"location\":[48.177359,11.759645],\"skills\":[\"ruby\"],\"address\":\"Domagkstraße 7, Kirchheim, Deutschland\",\"experience\":16}\n{\"company\":{\"id\":\"1437303\",\"name\":\"genua mbh\"},\"title\":\"Ruby-on-Rails-Entwickler/-in  für zentrales Management von VPN- und Firewallsystemen\",\"location\":[48.177359,11.759645],\"skills\":[\"ruby\"],\"address\":\"Domagkstraße 7, Kirchheim, Deutschland\",\"experience\":7}\n{\"company\":{\"id\":\"1294036\",\"name\":\"Yieldlab GmbH\"},\"title\":\"Hadoop Big Data Software Engineer\",\"location\":[53.574636,9.760782],\"skills\":[\"ruby\"],\"address\":\"Iserbarg 1a, Hamburg, Deutschland\",\"experience\":7}\n{\"company\":{\"id\":\"1218601\",\"name\":\"ASG International\"},\"title\":\"Social Media Strategist\",\"location\":[48.17645,11.59261],\"skills\":[\"ruby\"],\"address\":\"Mies-van-der-Rohe-Straße 6, Munich, Germany\",\"experience\":1}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Software Engineer - Ruby on Rails - Content and High Traffic Web\",\"location\":[37.414198,-122.078488],\"skills\":[\"ruby\"],\"address\":\"1400 North Shoreline Boulevard, Mountain View, CA, United States\",\"experience\":19}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Sr. Web Developer - Ruby on Rails, Ruby, Unix, NoSQl, Git, Linux\",\"location\":[42.308086,-71.390898],\"skills\":[\"ruby\"],\"address\":\"550 Cochituate Road, Framingham, MA, United States\",\"experience\":16}\n{\"company\":{\"id\":\"1053\",\"name\":\"Intel Corporation\"},\"title\":\"Working Student Python Development (f/m)  - # 631225\",\"location\":[48.151,11.7257],\"skills\":[\"python\"],\"address\":\"Dornacher Straße 1, Feldkirchen, Germany\",\"experience\":4}\n{\"company\":{\"id\":\"2240\",\"name\":\"Juniper Networks\"},\"title\":\"Professional Services Consultant EMS/NMS\",\"location\":[50.08162,8.62686],\"skills\":[\"python\"],\"address\":\"Lyoner Straße 15, Frankfurt, Germany\",\"experience\":20}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google\"},\"title\":\"Software Engineer in Test\",\"location\":[48.138595,11.57729],\"skills\":[\"python\"],\"address\":\"Dienerstraße 12, Munich, Germany\",\"experience\":13}\n{\"company\":{\"id\":\"3534\",\"name\":\"Continental\"},\"title\":\"Werkstudent (m/w) für Software Tool Themen (Job ID: 94485)\",\"location\":[49.006831,12.141348],\"skills\":[\"python\"],\"address\":\"Siemensstraße 12, Regensburg, Germany\",\"experience\":5}\n{\"company\":{\"id\":\"2336\",\"name\":\"McAfee\"},\"title\":\"Software Engineer in Test (SDET)\",\"location\":[51.726051,8.795355],\"skills\":[\"python\"],\"address\":\"Vattmannstraße 3, Paderborn, Germany\",\"experience\":16}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Python Developer - Hot Mobile Startup - Python - Smart Phone Dev\",\"location\":[33.978622,-118.404471],\"skills\":[\"python\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":0}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Python Developer - Hot Mobile Startup - Python - Smart Phone Dev\",\"location\":[33.978622,-118.404471],\"skills\":[\"python\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":9}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Python Developer - Python Programmer - Python Engineer - Python\",\"location\":[33.978622,-118.404471],\"skills\":[\"python\"],\"address\":\"12181 W. Bluff Creek Dr. Suite 1E, Playa Vista, CA, United States\",\"experience\":10}\n{\"company\":{\"id\":\"1480\",\"name\":\"Adobe\"},\"title\":\"Sr. Computer Scientist, Shared Cloud\",\"location\":[53.542883,9.984138],\"skills\":[\"mongodb\"],\"address\":\"Am Sandtorkai 41, Hamburg, Germany\",\"experience\":17}\n{\"company\":{\"id\":\"0\",\"name\":\"69 Grad GmbH\"},\"title\":\"ASP.NET-Entwickler (m/w) mit Leidenschaft gesucht\",\"location\":[48.137768,11.560108],\"skills\":[\"mongodb\"],\"address\":\"Schwanthalerstraße 28, Munich, Germany\",\"experience\":13}\n{\"company\":{\"id\":\"1480\",\"name\":\"Adobe\"},\"title\":\"Computer Scientist, Shared Cloud\",\"location\":[53.542883,9.984138],\"skills\":[\"mongodb\"],\"address\":\"Am Sandtorkai 41, Hamburg, Germany\",\"experience\":5}\n{\"company\":{\"id\":\"157295\",\"name\":\"Ciber\"},\"title\":\"Sr Ruby on Rails Developer\",\"location\":[12.932812,77.602876],\"skills\":[\"mongodb\"],\"address\":\"D block, 5th floor, IBC Knowledge Park, Sadduguntepalya, Bangalore, Karnataka, India\",\"experience\":0}\n{\"company\":{\"id\":\"1480\",\"name\":\"Adobe\"},\"title\":\"Technical Lead, Application Management\",\"location\":[53.542883,9.984138],\"skills\":[\"cloud\"],\"address\":\"Am Sandtorkai 41, Hamburg, Germany\",\"experience\":20}\n{\"company\":{\"id\":\"2712\",\"name\":\"Colt Technology Services\"},\"title\":\"Product Manager – Virtualisation \\u0026 Cloud Services x 2\",\"location\":[50.939919,6.943257],\"skills\":[\"cloud\"],\"address\":\"Magnusstraße 13, Cologne, Germany\",\"experience\":7}\n{\"company\":{\"id\":\"1035\",\"name\":\"Microsoft\"},\"title\":\"CEE BDM Activation\",\"location\":[48.290574,11.581171],\"skills\":[\"cloud\"],\"address\":\"Konrad-Zuse-Straße 1, Unterschleißheim, Germany\",\"experience\":13}\n{\"company\":{\"id\":\"1593\",\"name\":\"Deutsche Telekom\"},\"title\":\"2 Technology Operator Cloud (m/w) (Linux Systemadministrator)\",\"location\":[52.512992,13.320228],\"skills\":[\"cloud\"],\"address\":\"Ernst-Reuter-Platz 7, Berlin, Germany\",\"experience\":0}\n{\"company\":{\"id\":\"5141\",\"name\":\"Exact\"},\"title\":\"Proposition Manager Cloud Solutions Germany\",\"location\":[50.945288,6.921881],\"skills\":[\"cloud\"],\"address\":\"Vogelsanger Straße 76, Cologne, Germany\",\"experience\":10}\n{\"company\":{\"id\":\"729369\",\"name\":\"MoTek Technologies\"},\"title\":\"Director of Cloud\",\"location\":[37.33085,-121.887947],\"skills\":[\"cloud\"],\"address\":\"302 South Market Street, San Jose, CA, United States\",\"experience\":3}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google\"},\"title\":\"Engineering Solutions Architect, Cloud Platform\",\"location\":[37.422131,-122.083911],\"skills\":[\"cloud\"],\"address\":\"1600 Amphitheatre Parkway, Mountain View, CA, United States\",\"experience\":5}\n{\"company\":{\"id\":\"926041\",\"name\":\"Okta, Inc.\"},\"title\":\"Cloud Enterprise Architect\",\"location\":[49.242981,-122.891631],\"skills\":[\"cloud\"],\"address\":\"319 North Road, Coquitlam, BC, Canada\",\"experience\":3}\n{\"company\":{\"id\":\"1028\",\"name\":\"Oracle\"},\"title\":\"Cloud Platform System Engineer\",\"location\":[42.495454,-71.232433],\"skills\":[\"cloud\"],\"address\":\"95 Network Drive, Burlington, MA, United States\",\"experience\":18}\n{\"company\":{\"id\":\"1028\",\"name\":\"Oracle\"},\"title\":\"Cloud Professionals Career Fair\",\"location\":[37.5294,-122.265966],\"skills\":[\"cloud\"],\"address\":\"Oracle, 100 Oracle Pkwy, Redwood City, CA 94065, USA\",\"experience\":14}\n{\"company\":{\"id\":\"429135\",\"name\":\"OBI\"},\"title\":\"Praktikant PHP Entwicklung\",\"location\":[51.14643,7.24809],\"skills\":[\"php\"],\"address\":\"Albert-Einstein-Straße 7-9, Wermelskirchen, Deutschland\",\"experience\":15}\n{\"company\":{\"id\":\"37155\",\"name\":\"Bertrandt AG\"},\"title\":\"Web- und Datenbankentwickler (m/w)\",\"location\":[52.479154,10.741776],\"skills\":[\"php\"],\"address\":\"Krümke 1, Tappenbeck, Germany\",\"experience\":12}\n{\"company\":{\"id\":\"3534\",\"name\":\"Continental\"},\"title\":\"Praktikum Programmierung webbasierte Wissensdatenbank (Job ID: 150749)\",\"location\":[50.14842,8.52418],\"skills\":[\"php\"],\"address\":\"Sodener Straße 9, Schwalbach am Taunus, Germany\",\"experience\":7}\n{\"company\":{\"id\":\"1593\",\"name\":\"Deutsche Telekom\"},\"title\":\"Kundenberater Geschäftskunden in Vollzeit (38h) in Nürnberg (m/w)\",\"location\":[49.458893,11.08952],\"skills\":[\"php\"],\"address\":\"Bayreuther Straße 1, Nuremberg, Germany\",\"experience\":10}\n{\"company\":{\"id\":\"424741\",\"name\":\"Innogames GmbH\"},\"title\":\"Software Developer Portal (m/f)\",\"location\":[53.46529,9.9847],\"skills\":[\"php\"],\"address\":\"Harburger Schloßstraße 28, Hamburg, Deutschland\",\"experience\":9}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"PHP Developer, PHP, LAMP, Fast growing co. looking for PHP guru!\",\"location\":[43.741754,-88.478491],\"skills\":[\"php\"],\"address\":\"420 Trowbridge Drive, Fond du Lac, WI, United States\",\"experience\":7}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Junior PHP Developer - Entry Level PHP Developer\",\"location\":[40.480838,-111.891503],\"skills\":[\"php\"],\"address\":\"486 Coalville Way, Draper, UT, United States\",\"experience\":12}\n{\"company\":{\"id\":\"1093\",\"name\":\"Dell\"},\"title\":\"Solutions Architecture Consultant - Cloud Solutions\",\"location\":[49.136976,6.172974],\"skills\":[\"hadoop\"],\"address\":\"39 Avenue des 2 Fontaines, Metz, France\",\"experience\":0}\n{\"company\":{\"id\":\"1288\",\"name\":\"Yahoo!\"},\"title\":\"Senior Product Manager, Hadoop and Big Data\",\"location\":[37.417223,-122.025112],\"skills\":[\"hadoop\"],\"address\":\"701 1st Avenue, Sunnyvale, CA, United States\",\"experience\":17}\n{\"company\":{\"id\":\"2269733\",\"name\":\"Hortonworks\"},\"title\":\"Solutions Engineer - Big Data\",\"location\":[37.390284,-122.031936],\"skills\":[\"hadoop\"],\"address\":\"455 West Maude Avenue, Sunnyvale, CA, United States\",\"experience\":10}\n{\"company\":{\"id\":\"21836\",\"name\":\"CyberCoders\"},\"title\":\"Database engineer, Hadoop, Incredible company with amazing perks\",\"location\":[42.308086,-71.390898],\"skills\":[\"hadoop\"],\"address\":\"550 Cochituate Road, Framingham, MA, United States\",\"experience\":7}\n{\"company\":{\"id\":\"2269733\",\"name\":\"Hortonworks\"},\"title\":\"MTS - Hadoop Distributed File System\",\"location\":[37.390284,-122.031936],\"skills\":[\"hadoop\"],\"address\":\"455 West Maude Avenue, Sunnyvale, CA, United States\",\"experience\":14}\n{\"company\":{\"id\":\"1070\",\"name\":\"Nokia\"},\"title\":\"Senior Software Engineer Java / Scala\",\"location\":[52.486382,13.32451],\"skills\":[\"scala\"],\"address\":\"Berliner Straße 142, Berlin, Germany\",\"experience\":8}\n{\"company\":{\"id\":\"4383\",\"name\":\"E.ON\"},\"title\":\"Werkstudent (m/w) Programmierung\",\"location\":[51.444171,7.034174],\"skills\":[\"scala\"],\"address\":\"Brüsseler Platz 1, Essen, Germany\",\"experience\":0}\n{\"company\":{\"id\":\"1441\",\"name\":\"Google\"},\"title\":\"Systems Engineer, Google.com\",\"location\":[12.993539,77.660315],\"skills\":[\"scala\"],\"address\":\"No 3, 3rd, 4th and 5th floors, RMZ infinity - Tower E, Old Madras Road, Bangalore, Karnataka, India\",\"experience\":16}\n{\"company\":{\"id\":\"567816\",\"name\":\"Clogeny\"},\"title\":\"Software Engineer (Senior and Junior) - Ruby on Rails\",\"location\":[18.5914534,73.73635589999999],\"skills\":[\"ruby\",\"mongodb\"],\"address\":\"Clogeny Technologies Private Limited, Hinjewadi Infotech Park, Hinjewadi,Pune, Maharashtra, India\",\"experience\":7}\n{\"company\":{\"id\":\"13084\",\"name\":\"Pramati Technologies\"},\"title\":\"Principal Engineer\",\"location\":[17.435803,78.456449],\"skills\":[\"ruby\"],\"address\":\"Kundanbagh, Begumpet, Hyderabad, Andhra Pradesh, India\",\"experience\":16}\n{\"company\":{\"id\":\"651623\",\"name\":\"Amura Marketing Technologies Pvt.Ltd\"},\"title\":\"Ruby on Rails Developer\",\"location\":[18.515845,73.833435],\"skills\":[\"ruby\",\"mongodb\"],\"address\":\"Dr Kelkar Rd, Wadervadi, Pune, MH, India\",\"experience\":13}\n{\"company\":{\"id\":\"567816\",\"name\":\"Clogeny\"},\"title\":\"Software Engineer (Senior and Junior) - Ruby on Rails\",\"location\":[18.5914534,73.73635589999999],\"skills\":[\"ruby\",\"mongodb\"],\"address\":\"Clogeny Technologies Private Limited, Hinjewadi Infotech Park, Hinjewadi,Pune, Maharashtra, India\",\"experience\":4}\n{\"company\":{\"id\":\"13084\",\"name\":\"Pramati Technologies\"},\"title\":\"Principal Engineer\",\"location\":[17.435803,78.456449],\"skills\":[\"ruby\"],\"address\":\"Kundanbagh, Begumpet, Hyderabad, Andhra Pradesh, India\",\"experience\":8}\n{\"company\":{\"id\":\"651623\",\"name\":\"Amura Marketing Technologies Pvt.Ltd\"},\"title\":\"Ruby on Rails Developer\",\"location\":[18.515845,73.833435],\"skills\":[\"ruby\",\"mongodb\"],\"address\":\"Dr Kelkar Rd, Wadervadi, Pune, MH, India\",\"experience\":4}\n{\"company\":{\"id\":\"123456\",\"name\":\"ABC1 Demo Pvt.Ltd\"},\"title\":\"Software Engineer with PDM Experience\",\"location\":[6.9270786,79.86124300000006],\"skills\":[\"ruby\",\"java\",\"mongodb\"],\"address\":\"Aitken Spence Tower II, Level I, 305, Vauxhall Street, Colombo\",\"experience\":20}\n{\"company\":{\"id\":\"123456\",\"name\":\"ABC2 Demo Pvt.Ltd\"},\"title\":\"PHP Programmers\",\"location\":[6.9072435,79.89967890000003],\"skills\":[\"php\",\"mongodb\"],\"address\":\"563/1A Sarasavi Mawatha Nawala-Rajagiriya, Colombo\",\"experience\":7}\n{\"company\":{\"id\":\"123456\",\"name\":\"ABC3 Demo Pvt.Ltd\"},\"title\":\"Ruby on Rails developer\",\"location\":[6.905146100000001,79.85377689999996],\"skills\":[\"ruby\",\"rails\",\"mongodb\"],\"address\":\"#65, Walukarama Road Colombo 03 SRI LANKA\",\"experience\":0}\n"
  },
  {
    "path": "14-kafka/README.md",
    "content": "Apache Kafka\n---\n\nI will write on Apache Kafka this weekend so stay tuned.\n\n----\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/18](https://github.com/shekhargulati/52-technologies-in-2016/issues/18).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/14-kafka)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "15-huginn/README.md",
    "content": "Airline Bot Platform with Huginn\n-----\n\nWelcome to fifteenth week of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I participated in a day long Hackathon organized by an Airline. They were looking for ideas that could help improve their customer travel experience. I, along with my good friend [Rahul](https://www.linkedin.com/in/rahul-sharma-72531111) decided to build a bot platform using [Huginn](https://github.com/cantino/huginn) that can perform a lot of tasks for which we normally use mobile apps. Our goal was to show them that they should think beyond mobile apps and look into the world of bots as bots can be less intrusive, more secure, and does not require installation. ***Apps are dead, long live bots.***\n\nBots are small applications that can perform certain tasks on user's behalf, or react to events, or send notifications. To show them the power of bots, we decided to build a bag tracking system using bots that sends an SMS notification to the passenger as soon as the flight lands with information  whether their bag was loaded in the same flight or not. We integrated our bots platform with a mock checkin system so as soon as the passenger checks in, a bot is created for the passenger that tracks their bag journey. I find it very annoying that after waiting for an hour or more at the airport conveyer belt, I am told that my bag was not loaded in the same flight. I have lost my bag three times at three different international airports Heathrow Airport London, Adolfo Suárez Madrid–Barajas Airport, and Amsterdam Airport Schiphol and each time I had to go through the painful process.\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016).**\n\n## Why bots?\n\nIn my opinion, the biggest advantage of using bots is that they can have a definite lifetime and does not require installation on end user mobile device. Let's take the bag tracking use case I described above, bot can self destruct itself as soon as the passenger receives his or her bag. I may sound like an old school guy but I find installing mobile apps for use cases like I mentioned is asking for too much from the end customer. I learnt about a cool app [http://webkay.robinlinus.com/](http://webkay.robinlinus.com/) that shows how much a modern web browser reveals about the user. Mobile apps have much more access so you can think how much you are sharing unintentionally.\n\n## Other bot use cases for Airlines\n\nThere are many use cases that bots can be used for. These are some of the use cases that I can think of right now:\n\n1. A bot that tracks flight arrival information, books a taxi, informs the driver, and sends an SMS to the passenger with driver details.\n2. A bot that tracks flight information and sends notifications to the loved ones about the journey.\n3. A bot that sends you an email with your ticket 2 hours before your flight.\n4. A bot that listens to baggage lost Twitter stream for an airline and auto reply to the frustrated user with a personalized message.\n5. A bot that sends me an email with a list of 10 articles(you can scrape the article content) based on my twitter favorites or any other read it later app that I can read during the flight.\n\n## Building a bot platform\n\nIn this section, I will showcase how we built the baggage tracking system using Huginn. According to [Huginn website](https://github.com/cantino/huginn) ,\n\n> **Huginn is a system for building agents that perform automated tasks for you online. They can read the web, watch for events, and take actions on your behalf. Huginn's Agents create and consume events, propagating them along a directed graph. Think of it as a hackable Yahoo! Pipes plus IFTTT on your own server. You always know who has your data. You do.**\n\n### Step 1: Getting started with Huginn\n\nHuginn is a Ruby on Rails application. The easiest way to get started with it is to run it inside a Docker container. Assuming, you have Docker Machine installed on your machine. You can create a new Docker machine instance or use existsing and start playing with Huginn.\n\n```bash\n$ docker-machine create --driver virtualbox huginn\n$ docker-machine start huginn\n$ eval \"$(docker-machine env default)\"\n$ docker run -it -p 3000:3000 cantino/huginn\n```\n\nIf you need more information, please refer to the [documentation page](https://github.com/cantino/huginn/blob/master/doc/docker/install.md).\n\nTo access Huginn, you have to get hold of your docker machine instance. You can get that using following command.\n\n```bash\n$ docker-machine ip huginn\n```\n\nNow, you can view the Huginn instance running at http://docker_machine_ip:3000/. Please replace `docker_machine_ip` with the ip of your machine instance. You will see Huginn web application as shown below.\n\n![](images/huginn.png)\n\nYou can login into Huginn system using the **admin/password** combination. Once you login using the default credentials, you will see 6 agents already created for you.  \n\n![](images/huginn_default_agents.png)\n\n> **You can think of bots as Huginn agents as Huginn call them agents. I will use Agents and Bots interchangeably.**\n\nIf you want to learn more about default agents, then you can refer to [wiki](https://github.com/cantino/huginn/wiki#using-huginn) to learn more about them.\n\n### Step 2: Integrate checkin system with Huginn\n\nNow, that Huginn is up and running we can connect it with the Airline checkin system. We created a mock checkin system so that we can show the workflow. When airline does the checkin for a passenger, they will make an HTTP `POST` to the Huginn server to create a new Huginn agent.\n\n> **Huginn currently does not provide a REST API to perform various tasks like creating an Agent. So, we are submitting a form request.**\n\nHuginn supports many different kind of agents. There are agents to send notifications like SMS and email, make POST request to other services, scheduler agent to take action periodically, translation agent, user location agent, etc. You can also create your own agents in Ruby. To learn more about creating agents, you can refer to [documentation](https://github.com/cantino/huginn/wiki/Creating-a-new-agent).\n\nWe created a quick and dirty Python Flask application that renders a form as shown below.\n\n![](images/airline-checkin.png)\n\nWhen the airline submits the data, the `track_bag` endpoint is called which makes the `HTTP POST` to the Huginn server to create an agent.\n\n```python\nfrom flask import Flask, render_template, request, redirect, url_for, flash\n\napp = Flask(__name__)\n\n@app.route(\"/\")\ndef index():\n    return render_template('index.html')\n\n@app.route(\"/trackbag\",methods=['POST'])\ndef track_bag():\n    name = request.form['name']\n    bag_tag = request.form['bagTag']\n    flash(\"You have successfully submitted request for {0}\".format(name))\n    create_agent(name,bag_tag)\n    return redirect(url_for('index'))\n\nif __name__ == \"__main__\":\n    app.run(host= '0.0.0.0',debug=True)\n```\n\nThe code shown below is a simple Python Flask app that does the following:\n\n1. We imported all the required classes and methods of the Flask API\n2. We created an instance of Flask app\n3. When a `HTTP GET` request is made to `\\`, then `index.html` page is rendered. It contains the checkin form.\n4. The checkin form is submitted to the `track_bag` method. We get the customer `name` and `bagTag` from the request and call the `create_agent` method that creates Huginn agent.\n5. Finally, we `redirect` airline agent to the checkin page again.\n\nThe `create_agent` method shown above create the Huginn agent. Let's look at its code.\n\n```python\nimport requests\nimport json\n\ndef create_agent(name, bag_track):\n    headers = {'Content-Type':\"application/x-www-form-urlencoded\",'Cookie':\"COOKIE\"}\n\n    agent_name = name + \" Bag Tracking Bot\"\n    poll_url = \"http://192.168.1.2:3000/bagInfo\"\n\n    agent_options =  {'expected_update_period_in_days':0,'url':poll_url,'type':\"json\",\"mode\":\"on_change\",\"extract\": {'bag_status':{'path':\"$.[:-1].event[:-1].event_code\"}}}\n\n    request_data = {'return':'','agent[type]':\"Agents::WebsiteAgent\",'agent[name]':agent_name,'agent[schedule]':\"every_1m\",'agent[control_target_ids][]':\"\",'agent[keep_events_for]':0,'agent[source_ids][]':\"\",'agent[propagate_immediately]':1,'agent[options]':json.dumps(agent_options),'commit':\"Save\",'authenticity_token':\"AUTHENTICITY_TOKEN\"}\n    res = requests.post(\"http://192.168.99.100:3000/agents\",headers=headers,data=request_data)\n    return res\n```\n\nIn the code shown above, we are doing the following:\n\n1. using the Python `requests` API to submit the form programmatically.\n2. We set the request headers. As we are submitting a form so we are using content type as `application/x-www-form-urlencoded`.\n3. We created an agent using the customer name.\n4. In the `POST` request body, we set the agent type to `WebsiteAgent`. `WebsiteAgent` polls a URL periodically as defined by the `schedule` parameter and publish events. An agent can have options as defined in `agent_options` dictionary. We have defined `poll_url` to be `http://192.168.1.2:3000/bagInfo`. When bot/agent will hit this URL, it will return a JSON response with bag details. We will cover this later. The `extract` parameter inside the `agent_options` define what we want to extract from the JSON returned by `http://192.168.1.2:3000/bagInfo` endpoint. We are using JSONPath expression `$.[:-1].event[:-1].event_code`. The expression means get the last JSON document in the array, then within that document give me the last event, and from the event return me  the `event_code`. This will help us extract the last bag tracking event.\n5. Finally, we make the `POST` request to the Huginn server using the `request_data` and `headers`.\n\n### Step 3: Submit checkin form to create agents\n\nLet's test that our checkin system is integrated with the Huggin. Submit the checkin form with customer name and bag tag. You will see one bot created for you.\n\n![](images/huginn-bag-tracking-agent.png)\n\nBag Tracking bot will start making `GET` request to `http://192.168.1.2:3000/bagInfo` every one minute. As we have not started the bag tracking server so bot will show error in the logs.\n\n![](images/huginn-bag-tracking-error.png)\n\n### Step 4: Get bag tracking information\n\nDuring this Hackathon, I learnt that there is a provider SITA that provides real time information about bag information. They have a [Bag Journey API](https://www.developer.aero/BagJourney-API/API-Overview) that  provides a simple interface into the complex world of baggage management by allowing the retrieval of the real time status of a specific bag, a list of bags on a particular flight or a list of events that describe the journey of a checked in bag or list of bags. **BagJourney API access is only available to Airlines, Airports or their accredited software providers**. To demo our use case, we decided to use a mock REST server that returns JSON documents we specify. We used [json-server](https://github.com/typicode/json-server) as it is very easy to use and meet our needs.\n\n`json-server` is a node.js application that you can install using `npm` as shown below.\n\n```\n$ npm install -g json-server\n```\n\nOnce `json-server` is installed, we started the bag tracking API server using default data.\n\n```\n$ json-server --watch db.json\n```\n\n`db.json` looks like as shown below. It has one `CHECKED_IN` event for the bag with tag `aaa`.\n\n```json\n{\n  \"bagInfo\": [\n    {\n      \"bagtag\": \"aaa\",\n      \"no_of_checked_bags\": 3,\n      \"passenger_first_name\": \"JOHN\",\n      \"passenger_last_name\": \"SMITH\",\n      \"total_weight_of_checkedin_bags\": 33.5,\n      \"weight_indicator\": \"K\",\n      \"event\": [\n        {\n          \"airport\": \"DEL\",\n          \"event_code\": \"CHECKED_IN\",\n          \"local_date_time\": \"2016-08-27T13:00:00-0400\",\n          \"read_location\": \"DCQW\",\n          \"sent_location\": \"B2\",\n          \"stowage_device\": \"AKE12345BD\",\n          \"utc_date_time\": \"2013-08-27T13:00:00Z\"\n        }\n      ]\n    }\n  ]\n}\n```\n\nIn the next poll i.e. after one minute, our bag tracker will extract the event from the JSON and will emit an event and you will see one event as shown below.\n\n![](images/huginn-bag-tracking-event.png)\n\nYou can see all the published events at http://docker_machine_ip:3000/events. You can clearly see that we extracted `CHECKED_IN` from the JSON and emitted an event.\n\n![](images/huginn-bag-tracking-event-page.png)\n\n\n### Step 5: Setting up notifier bots\n\nSo, our bag tracking bot is publishing events, now we need bots that can listen to those events. We will add two notifier bots -- one for email and another for SMS. We will use Gmail to send email and Twillo for sending SMS. Huginn provides `Email Agent` that sends any event it receives in an email. We will use Huginn email agent for sending out email. To send SMS, we will use Twillo API. We will create a new agent `Post Agent`. Post Agent sends an HTTP POST request to URL and then you can do whatever you want with request. We will update our Flask app so after creating bag tracker bot it also creates email and sms bots as well.\n\n```python\n@app.route(\"/trackbag\",methods=['POST'])\ndef track_bag():\n    name = request.form['name']\n    bag_tag = request.form['bagTag']\n    create_agent(name,bag_tag)\n    bag_tracker_agent_id = read_agent_id()\n    create_email_agent(bag_tracker_agent_id)\n    create_sms_agent(bag_tracker_agent_id)\n    flash(\"You have successfully submitted request for {0}\".format(name))\n    return redirect(url_for('index'))\n```\n\nAs you can see above, we are creating email and SMS agent using the `create_email_agent` and `create_sms_agent` methods. The email and SMS agent make use of the bag tracker agent id. They will use bag tracker agent as their source. In Huginn, you can create agent chain where one agent can depend on other agents. The code for `create_email_agent` and `create_sms_agent` is similar to the `create_agent` discussed above. Below is the code that we are using to create Twillo powered SMS agent.\n\n```python\ndef create_sms_agent(agent_id):\n    headers = {'Content-Type':\"application/x-www-form-urlencoded\",'Cookie':\"COOKIE\"}\n\n    agent_name = \"SMS Bag Notifier\"\n\n    payload = {\"bag_status\":\"{{ bag_status }}\"}\n    agent_headers = {\"CONTENT_TYPE\":\"application/json\"}\n\n    agent_options =  {\"post_url\": \"http://192.168.1.2:5000/send_sms\", \"expected_receive_period_in_days\": \"0\", \"content_type\": \"json\", \"method\": \"post\", \"payload\": payload,\"headers\": agent_headers, \"emit_events\": \"false\",\"no_merge\": \"false\"}\n\n    request_data = {'return':'','agent[type]':\"Agents::PostAgent\",'agent[name]':\"SMS Bag Notifier\",'agent[schedule]':\"never\",'agent[control_target_ids][]':\"\",'agent[keep_events_for]':0,'agent[source_ids][]':\"\",'agent[propagate_immediately]':0,'agent[source_ids][]':agent_id,'agent[options]':json.dumps(agent_options),'commit':\"Save\",'authenticity_token':\"AUTHENTICITY_TOKEN\"}\n\n    res = requests.post(\"http://192.168.99.100:3000/agents\",headers=headers,data=request_data)\n    return \"OK\"\n```\n\nThis time we have used `PostAgent` agent type and gave it the url `http://192.168.1.2:5000/send_sms`. This task is not scheduled so we have set schedule to `never`. The source of this agent is set to the agent id of the bag tracking bot id.\n\nThe `send_sms` REST end point will be invoked by Huginn `POSTAgent`. It uses Python `requests` library to make `HTTP POST` request to Twillo API.\n\n```python\n@app.route(\"/send_sms\",methods=['POST'])\ndef send_sms():\n    content = request.get_json(silent=True)\n    twillo_url = \"https://api.twilio.com/2010-04-01/Accounts/AccountID/Messages.json\"\n    request_data = {'To':\"TO_NUMBER\",'From':\"FROM_NUMBER\",\"Body\":msg.format(content.get('bag_status'))}\n    requests.post(twillo_url,data=request_data, auth=('ACCOUNT_SID','AUTH_TOKEN'))\n    return \"OK\"\n```\n\nNow, if you register a new passenger using the Checkin system three agents will be created.\n\n![](images/huginn-notifier-agents.png)\n\nYou can view the event flow by clicking the `View diagram` link on the `agents` page.\n\n![](images/huginn-agent-event-flow.png)\n\nTo see all the three agents in action, let's add couple of more JSON documents to the `db.json`. These JSON will contain `SCREENED` and `LOADED_ON_AIRCRAFT` events.\n\nYou will notice that bag tracking bot has published three events and you will start getting email and SMS.\n\n### Step 6: Bag lost notification\n\nSo far we have seen the happy path when the bag is loaded on the air craft and you will get `LOADED_ON_AIRCRAFT`. The `LOADED_ON_AIRCRAFT` event is sent when the bag is loaded in the aircraft. We will notify user that his/her baggage was lost(i.e. will not be coming in the same flight) if by the time passenger flight landed `LOADED_ON_AIRCRAFT` message is not received by our system.\n\nTo achieve this we will set up another scheduled bot that will send baggage lost SMS after flight time. For every passenger this bot will be scheduled. There will be another bot that will be listening only to the `LOADED_ON_AIRCRAFT` events if it receives the message within flight duration then it will disable the scheduled bot.\n\n\nThe event flow in this use case is shown below.\n\n![](images/huginn-bag-lost-event-flow.png)\n\nThe **Bag Lost Commander Bot** is subscribed for messages of type `LOADED_ON_AIRCRAFT`. This bot will disable its child bots if it receives the `LOADED_ON_AIRCRAFT` message. Otherwise, it will send the `BAG_LOST` message to the customer.\n\n-----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/19](https://github.com/shekhargulati/52-technologies-in-2016/issues/19).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/15-huginn)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "16-newspaper/README.md",
    "content": "Building `Read It Later` App with Python Newspaper Library\n-----\n\nWelcome to sixteenth week of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I will show you how to build a simple yet working **Read It Later** application using Twitter likes (or favorites). I rely on my Twitter feed for my daily reading recommendations. I check Twitter several time during the day and whenever I find any article that interests me I like it so that I can read it later. In this tutorial, you will learn how to build `Read It Later` application using Python programming language. We will make use of article extraction to extract relevant content from the urls.\n\nTo build this application, we will use following Python libraries:\n\n1. **Flask**: We will use `Flask` framework to take care of the web feature of the app i.e. handling requests and responding to use with reading recommendation.\n2. **Tweepy**: `Tweepy` is a very easy to use library that we will use to talk to Twitter streaming API. We will subscribe to a user's Twitter stream so as soon as user likes a tweet our application will be notified.\n3. **Newspaper**: [newspaper](https://github.com/codelucas/newspaper) is a great library to perform article extraction in Python. It makes use of popular Python libraries like `beautifulsoup4`, `lxml`, `nltk` to get the job done.\n\nBy the end of this tutorial, you will have a simple yet working application to view articles that you wanted to read later. The following is the screenshot of our application. As you can see below, we extracted main image, summary text, and title from the url.\n\n![](images/stories.jpg)\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## What is Newspaper?\n\nIn this tutorial, I will talk about a Python package called [Newspaper](http://newspaper.readthedocs.org/). Newspaper is an open source news full-text and article metadata extraction library written in Python 3. It has a very easy to use API that can help you get started in minutes. It can be used to extract the main text of an article, main image of an article, videos in an article, meta description, and meta tags in an article. Newspaper stands on strong shoulders of `beautifulsoup4`, `lxml`, and `nltk` libraries.\n\nTo extract text from a URL is as simple as shown below.\n\n```python\n>>> from newspaper import Article\n\n>>> url = 'http://firstround.com/review/the-remarkable-advantage-of-abundant-thinking/'\n>>> article = Article(url)\n>>> article.build()\n\n>>> article.title\n'The Remarkable Advantage of Abundant Thinking'\n\n>>> article.text.split('\\n\\n')[0]\n\"If you consider yourself to be ambitious, this has happened to you. Your alarm goes off, and you're ambushed by thoughts of the grind ahead; finding that needle in a haystack; denting the universe; the roller coaster that never ends and many more horrible but unfortunately apt cliches. Today, the groupthink in tech largely believes that you have to suffer and barely survive to succeed. But this is a trap, says sought-after executive coach Katia Verresen, who counsels leaders at Facebook, Stanford, Airbnb, Twitter, and a number of prominent startups.\"\n```\n\n## Prerequisite\n\nTo follow this blog, you need to have following on your machine:\n\n1. **Python**: You can download Python executable for your operating system from [https://www.python.org/downloads/](https://www.python.org/downloads/). I will be using Python version `3.4.2`.\n\n2. **Virtualenv**: Virtualenv tool allows you to create isolated Python environments without polluting the global Python installation. This allows you to use multiple Python versions easily on a single machine. Please refer to official documentation for [installation](https://virtualenv.pypa.io/en/latest/installation.html) instructions.\n\n3. Create a new Twitter app [http://dev.twitter.com/apps](http://dev.twitter.com/apps) and note down `Consumer Key (API Key)`, `Consumer Secret (API Secret)`, `Access Token`, and `Access Token Secret`. We will use them to connect to Twitter API for a user.\n\n## Github Repository\n\nThe code for demo application is available on github at [dailyreads](https://github.com/shekhargulati/dailyreads).\n\n## Step 1: Setting up environment\n\nWe will start with setting up development environment so that we can build `dailyreads` application. I use Python `virtualenv` for most of my Python applications. It helps keep my project environment separate and does not pollute global Python installation.\n\nOpen a command-line terminal and navigate to a convenient directory on your file system. Make a new directory called `dailyreads` and change directory to it.\n\n```bash\n$ mkdir dailyreads && cd dailyreads\n```\n\nOnce inside the `dailyreads` directory, create a Python 3 virtualenv and activate it.\n\n```bash\n$ virtualenv venv --python=python3\n$ source venv/bin/activate\n```\n\nYou can verify the Python installation by executing `which python` command. It should point to the Python installation inside the `venv` directory.\n\n## Step 2: Download and install dependencies\n\nAs mentioned above, we will make use of `flask`, `tweepy`, and `newspaper` libraries. We can download all of them using `pip`. `pip` is package manager used to install and manage software packages written in Python.\n\n```bash\n$ pip install flask\n$ pip install tweepy\n$ pip install newspaper3k\n```\n\nThis will download all the required dependencies and their transitive dependencies.  To view all the installed packages, you can use the `pip list` command.\n\n## Step 3: Write twitter stream listener for user liked tweets\n\nCreate a new file `app.py` inside the `dailyreads` directory. The first task of our application is to listen to user's like tweet stream. We will make use of `Tweepy` library to connect to user tweet stream and select events that are of type `favorite` as shown below.\n\n```python\nfrom __future__ import absolute_import, print_function\nfrom tweepy.streaming import StreamListener\nfrom tweepy import OAuthHandler\nfrom tweepy import Stream\nimport os\nimport json\n\nconsumer_key=os.getenv(\"TWITTER_CONSUMER_KEY\")\nconsumer_secret=os.getenv(\"TWITTER_CONSUMER_SECRET\")\naccess_token=os.getenv(\"TWITTER_ACCESS_TOKEN\")\naccess_token_secret=os.getenv(\"TWITTER_ACCESS_SECRET\")\n\nclass LikedTweetsListener(StreamListener):\n    def on_data(self, data):\n        tweet = json.loads(data)\n        if 'event' in tweet and tweet['event'] == \"favorite\":\n            print(tweet)\n        return True\n\n    def on_error(self, status):\n        print(\"Error status received : {0}\".format(status))\n\nif __name__ == '__main__':\n    l = LikedTweetsListener()\n    auth = OAuthHandler(consumer_key, consumer_secret)\n    auth.set_access_token(access_token, access_token_secret)\n\n    stream = Stream(auth, l)\n    stream.userstream()\n```\n\nIn the code shown above, we did following:\n\n1. We imported all the required classes and method that we will need to connect Twitter API.\n2. We extracted twitter keys from the environment variables and set them as script variables. It is a good idea to use environment variables from the beginning to make sure you don't commit your keys to version control system and end up making them public.\n3. We created a new `StreamListener` listener. `StreamListener` exposes several `on_*` methods that will be invoked when particular events happen. We have overridden `on_data` and `on_error` handlers. As is obvious from their names, `on_data` is called whenever new data is available and `on_error` is called whenever any exception happens. In the `on_data` method, we are only printing out events that are of type `favorite`. Twitter uses event type of favorite for like tweets as well.\n4. Finally, we created an instance of `Stream` object and invoked`userstream` method on it.\n\nYou can run `app.py` using the `python app.py`. Make sure to set the environment variables before running the script.\n\n```\nexport TWITTER_CONSUMER_KEY=*********************\nexport TWITTER_CONSUMER_SECRET=******************************************\nexport TWITTER_ACCESS_TOKEN=**************************************************\nexport TWITTER_ACCESS_SECRET=******************************************\n```\n\n## Step 4: Extract article content from the tweet\n\nThis is the main part of the application. Now, that we have handle to a liked tweet. We have to extract the content from it. We will use `newspaper` library to perform article extraction for us.\n\n```python\nfrom __future__ import absolute_import, print_function\nfrom tweepy.streaming import StreamListener\nfrom tweepy import OAuthHandler\nfrom tweepy import Stream\nimport os\n\nconsumer_key=os.getenv(\"TWITTER_CONSUMER_KEY\")\nconsumer_secret=os.getenv(\"TWITTER_CONSUMER_SECRET\")\naccess_token=os.getenv(\"TWITTER_ACCESS_TOKEN\")\naccess_token_secret=os.getenv(\"TWITTER_ACCESS_SECRET\")\n\narticles = []\n\nclass LikedTweetsListener(StreamListener):\n    def on_data(self, data):\n        tweet = json.loads(data)\n        if 'event' in tweet and tweet['event'] == \"favorite\":\n            liked_tweet = tweet[\"target_object\"]\n            liked_tweet_text = liked_tweet[\"text\"]\n            story_url = extract_url(liked_tweet)\n            if story_url:\n                article = extract_article(story_url)\n                if article:\n                    article['story_url'] = story_url\n                    article['liked_on'] = time.time()\n                    articles.append(article)\n        return True\n\n    def on_error(self, status):\n        print(\"Error status received : {0}\".format(status))\n\n\ndef extract_url(liked_tweet):\n    url_entities = liked_tweet[\"entities\"][\"urls\"]\n    if url_entities and len(url_entities) > 0:\n        return url_entities[0]['expanded_url']\n    else:\n        return None    \n\n\nfrom newspaper import Article\n\ndef extract_article(story_url):\n    article = Article(story_url)\n    article.download()\n    article.parse()\n    title = article.title\n    img = article.top_image\n    publish_date = article.publish_date\n    text = article.text.split('\\n\\n')[0] if article.text else \"\"\n    return {\n        'title':title,\n        'img':img,\n        'publish_date':publish_date,\n        'text':text.encode('ascii','ignore')\n    }\n```\n\nThe `extract_article` method shown above does all the important work using the newspaper library. To use it, first import the `Article` class from the `newspaper` module. Then, you build the article by first instantiating it with the `url` and then calling `download` and `parse` methods. The `download` method downloads the page content and `parse` method extract the relevant information from the page. Finally, we build a `dict` object with all the relevant information and return it.\n\n## Step 5: Render articles using Flask\n\nNow, we will a build a simple web application that will render articles. This will also reside inside the `app.py` file.\n\n```python\nfrom flask import Flask, render_template\n\napp = Flask(__name__)\n\n\n@app.route(\"/\")\ndef index():\n    return render_template(\"index.html\", articles=sorted(articles, key=lambda article: article[\"liked_on\"], reverse=True))\n\nif __name__ == '__main__':\n    l = LikedTweetsListener()\n    auth = OAuthHandler(consumer_key, consumer_secret)\n    auth.set_access_token(access_token, access_token_secret)\n\n    stream = Stream(auth, l)\n    stream.userstream(async=True)\n\n    app.run(debug=True)    \n```\n\n\nWhen the request will be made to `\\` then we will render `index.html`. The `index.html` will use `articles` that we populated in the previous step.\n\nI have used a [free Twitter bootstrap theme](http://startbootstrap.com/template-overviews/1-col-portfolio/) for styling purpose.\n\n```html\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n    <title>Daily Reads</title>\n    <link href=\"{{ url_for('static', filename='css/bootstrap.min.css') }}\" rel=\"stylesheet\">\n    <link href=\"{{ url_for('static', filename='css/1-col-portfolio.css') }}\" rel=\"stylesheet\">\n</head>\n\n<body>\n    <div class=\"container\">\n\n        {% for article in articles %}\n            <div class=\"row\">\n            <div class=\"col-md-7\">\n                <a href=\"#\">\n                    <img class=\"img-responsive\" src=\"{{ article.img }}\" alt=\"\">\n                </a>\n            </div>\n            <div class=\"col-md-5\">\n                <h3>{{ article.title }}</h3>\n                <p>{{ article.text.decode(\"utf-8\") }}</p>\n                <a class=\"btn btn-primary\" href=\"{{ article.story_url }}\" target=\"_blank\">Read Full Article <span class=\"glyphicon glyphicon-chevron-right\"></span></a>\n            </div>\n        </div>\n        <hr><hr>\n        {% endfor %}\n\n    </div>\n</body>\n\n</html>\n```\n\n-----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/20](https://github.com/shekhargulati/52-technologies-in-2016/issues/20).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/16-newspaper)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "17-typescript/README.md",
    "content": "Let's Learn TypeScript\n-------\n\nWelcome to seventeenth week of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I decided to learn TypeScript so I will discuss how you can get started with TypeScript. [TypeScript](https://www.typescriptlang.org/) is a typed superset of JavaScript, which means that it supports all the JavaScript features plus it adds static typing to the language. TypeScript is transpiled to JavaScript. According to [wikipedia](https://en.wikipedia.org/wiki/Source-to-source_compiler), transpiling is the process of compiling source code written in one programming language into another programming language. **JavaScript is the new byte code**. There are [many programming languages](https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js) that compile down to JavaScript. MicroSoft is behind the development of TypeScript and one the reason they created TypeScript is to make it easy to build large scale JavaScript applications. The TypeScript compiler is itself written in TypeScript, transcompiled to JavaScript and licensed under the Apache 2 License.\n\nJavaScript as most of you already know is a dynamic typed programming language. This means that type checking is done at runtime. This allows you to rapidly prototype in JavaScript without worrying about type safety. Strong typing or static typing on the other hand perform type checking at the compile time. If you assign number type to a variable then you can't assign anything other than number to that variable else the compile will show error. The advantage of strong typing include better tooling support like auto complete and refactoring.\n\nTypeScript does not take away dynamic nature of JavaScript it allows you to add types to dynamic JavaScript applications.\n\n> **The main reason you should learn TypeScript is that it provides static typing along with making it feasible for you to leverage ES6 and ES7 features today.**\n\nTypeScript allows you to leverage latest JavaScript features defined in ECMAScript 6 and some future features defined in ECMAScript 7 today. Your code can use all the latest features and TypeScript compiler will convert the code to the ECMAScript 5 or ECMAScript 3 code. The reason you have to compile code to previous versions of JavaScript is that most browsers or JavaScript runtimes still don't fully support ECMAScript 6. It will still take few more years before ECMAScript 6 will be the default JavaScript version everywhere.\n\nEvery piece of JavaScript code is a valid TypeScript code. You can take any JavaScript file and rename its extension from `.js` to `.ts` and voila you have a valid TypeScript code.\n\nTypeScript makes use of Type Inference to determine type of an expression from its context. Even if you have not specified any type annotation in your TypeScript code TypeScript in some cases can figure types. For example, if a method return a number then TypeScript knows that this method returns a number and then it can use that information when you are calling that function.\n\n## Example Domain\n\nThroughout this tutorial, we will base our examples on story submission website like HackerNews. There is one entity in our application `Story` that we will use.\n\n## Basic Types\n\nTypeScript supports three basic types -- **boolean**, **number**, **string**.\n\n----\n\nYou can declare a `number` as shown below. Just like JavaScript numbers are floating point values.\n\n```ts\nvar votes = 10;\nvotes++;\nconsole.log(votes); // prints 11\n```\n\nAs you can see above, we have use `number` type annotation to denote that `likes` is a number. If you don't put `number` type annotation then TypeScript will use type inference to determine type that `likes` is a number. Visual Studio code will show the type if you hover over the variable.\n\n![](images/number-type-inference.png)\n\n---\n\nThe second basic type supported by TypeScript is boolean. boolean is a type with only two valid values -- **true** and **false**.\n\n```typescript\nvar visible: boolean = true;\nlet storyExists:boolean = false;\n```\n\n-----\n\nThe third basic type supported by TypeScript is `string`. You can either use single quote `'` or double quote `\"` for strings\n\n```typescript\nlet title: string = \"Learning TypeScript\";\nlet description: string = 'Learning TypeScript Today!'\n```\n\nAs you can see above, we are using `let`, which is part of ECMAScript 6. We can use ECMAScript 6 features with TypeScript.\n\n> **`let` allows you to declare variables that are limited in scope to the block, statement, or expression on which it is used. This is unlike the `var` keyword, which defines a variable globally, or locally to an entire function regardless of block scope.**\n\nThe code when converted to ECMAScript 5 removes all the latest features and type annotations and looks like idiomatic JavaScript that you would have written by hand.\n\n```javascript\nvar likes = 10;\nlikes++;\nconsole.log(likes);\nvar isActive = true;\nvar usernameExists = false;\nvar username = \"shekhargulati\";\nvar fullname = 'Shekhar Gulati';\n```\n\n## Using template literals\n\nECMAScript 6 introduced template literals which allow you to embed expressions in your strings. They are very useful when you are building dynamic strings as shown below. You can use template literals with your TypeScript code.\n\n```typescript\nlet title: string = \"Learning TypeScript\";\nlet fullname = \"Shekhar Gulati\"\nlet summary = `${fullname} is ${title} this weekend.`\n```\n\nThis gets converted to following ECMAScript 5 code.\n\n```javascript\nvar title = fullname + \" is learning \" + topic + \" this weekend.\";\n```\n\n## Typed and Generic Arrays\n\nIn TypeScript, you can either create typed arrays or generic arrays. Typed Arrays are created like as shown below.\n\n```typescript\nvar tags: string[] = [\"javascript\",\"programming\"]\ntags.push(\"typescript\")\ntags.forEach(function(tag){\n    console.log(`Tag ${tag}`)\n});\n```\n\nAs TypeScript knows you are working with Array it will only show you methods applicable to Arrays when you use code completion.\n\n![](images/array-code-completion.png)\n\nThe second way to create arrays is using generic array type.\n\n```typescript\nlet storyLikedBy: Array<number> = [1,2,3]\n```\n\nBoth array declarations generate same JavaScript code.\n\n## Enums\n\nIf you have used programming language like Java or C# then you would have used enum. An `enum` allows you to define a set of predefined constants.\n\n```typescript\nenum StoryType {Video, Article, Tutorial}\nlet st:StoryType = StoryType.Article\n```\n\nECMAScript 5 code for the enum is shown below. As you can see, enum start with number value 0.\n\n```javascript\nvar StoryType;\n(function (StoryType) {\n    StoryType[StoryType[\"Video\"] = 0] = \"Video\";\n    StoryType[StoryType[\"Article\"] = 1] = \"Article\";\n    StoryType[StoryType[\"Tutorial\"] = 2] = \"Tutorial\";\n})(StoryType || (StoryType = {}));\nvar st = StoryType.Article;\n```\n\nYou can specify your own enum numbering as well.\n\n```typescript\nenum StoryType {Video = 10, Article = 20, Tutorial=30}\n```\n\n## Tuple\n\nTuple types allow you to express an array of values of different known types. As shown below, we are mapping over an array of `string` titles and converting it to a tuple of `[string, number]`.\n\n```typescript\nlet storyTitles = [\"Learning TypeScript\", \"Getting started with TypeScript\",\"Building your first app with TypeScript\"]\nlet titlesAndLengths : [string, number][] = storyTitles.map(function(title){\n    let tuple: [string, number]  = [title, title.length]\n    return tuple\n})\n```\n\n## Any\n\nWhen you are working with third party code or want to opt-out of static typing then you can use `Any` type.\n\n```\nvar dontKnow: any = {}\ndontKnow = \"abc\"\ndontKnow = 1\n```\n\n## Union types\n\nIn TypeScript, you can specify that a variable is either of one type or another. For example, if we have a variable `stringOrNumber` that can be either a string or number then we can write it like as shown below.\n\n```typescript\nvar stringOrNumber: (string|number) = 1\nstringOrNumber = \"hello\"\n```\n\nIf we try to assign a boolean then it will show error as shown below.\n\n![](images/either-type.png)\n\n## Functions\n\nYou declare functions in the same way you declare them in JavaScript with additional information of types.\n\n```typescript\nvar stories: [string, string[]][] = []\n\nfunction addStory(title: string, tags: string[]): void {\n    stories.push([title, tags])  \n}\n```\n\nThe generated ECMAScript 5 code is shown below.\n\n```javascript\nvar stories = [];\nfunction addStory(title, tags) {\n    stories.push([title, tags]);\n}\n```\n\n### Lambda expression\n\nFrom ECMAScript 6, you can write inline lambda expressions in JavaScript. TypeScript also allows you to write lambda expressions as shown below.\n\n```typescript\nvar tags: string[] = [\"javascript\",\"programming\"]\nlet tagLengths: number[] = tags.map(tag => tag.length)\n```\n\nSorting tags by their length\n\n```typescript\ntags.sort((tag1, tag2) => tag1.length - tag2.length)\n```\n\nWe can refactor the above to use function types as shown below.\n\n```typescript\nlet sortByLength: (x: string, y: string) => number = (x, y) => x.length - y.length\ntags.sort(sortByLength)\n```\n\nFunctions are first class citizen. The following TypeScript functions will all produce same JavaScript function declarations.\n\n```typescript\nlet sortByLength1 = function(x:string, y:string): number {\n    return x.length - y.length\n}\n\nlet  sortByLength2 = function(x:string, y:string){\n    return x.length - y.length\n}  \n\nlet  sortByLength3 = (x: string, y: string) :  number => {\n    return x.length - y.length\n}\n\nlet  sortByLength4 = (x: string, y: string) :  number => {\n    return x.length - y.length\n}\n\nlet  sortByLength5 = (x: string, y: string) =>  x.length - y.length\n\n\nlet sortByLength6: (x: string, y: string) => number = (x, y) => x.length - y.length\ntags.sort(sortByLength6)\n```\n\n### Optional and default values\n\nYou can define a function has an optional value by using `?:` syntax.\n\n```typescript\nfunction storySummary(title:string, description?: string) {\n    if(description){\n        return title + description;\n    }else{\n        return title;\n    }\n\n}\n```\n\nYou can also use default values.\n\n```typescript\nfunction storySummary(title:string, description: string = \"\") {\n    return title + description;\n}\n```\n\n## Interfaces\n\nIn TypeScript, interfaces are used to define contract for value objects and behavior. TypeScript is based on `structural typing`, in which type compatibility and equivalence are determined by the type's actual structure or definition, and not by other characteristics such as its name or place of declaration. Let's look at Story interface shown below.\n\n```typescript\ninterface Story {\n    title: string;\n    description ?: string;\n    tags : string[]\n}\n```\n\nNow, any object that define `title` and `tags` properties will be treated as a valid implementation of `Story` interface.\n\n```typescript\nlet story1:Story = {title:\"Learning TypeScript\", tags:[\"typescript\",\"learning\"]}\n```\n\nInterfaces can also define functions.\n\n```typescript\ninterface StoryExtractor {\n    extract(url:string): Story\n}\n\nlet extractor:StoryExtractor = {extract: url => story1}\n```\n\nThis can also be written like.\n\n```typescript\ninterface StoryExtractor {\n    (url:string): Story\n}\n\nlet extractor:StoryExtractor = url => story1\n```\n\n## Classes\n\nStarting with ECMAScript 2015, also known as ECMAScript 6, JavaScript programmers will be able to build their applications using this object-oriented class-based approach.\n\n```typescript\nclass TextStory implements Story{\n    title:string\n    tags: string[]\n\n   static storyWithNoTags(title:string): TextStory {\n       return new TextStory(title, [])\n   }\n    constructor(title:string, ...tags){\n        this.title = title;\n        this.tags = tags     \n    }\n\n   summary (){\n       return `TextStory ${this.title}`\n   }\n\n}\n\nlet story = TextStory.storyWithNoTags(\"Learning TypeScript\")\n```\n\nYou can follow common object-oriented design patterns like inheritance as shown below.\n\n```typescript\nclass TutorialStory extends TextStory {\n    constructor(title:string, ...tags){\n        super(title, tags)\n    }\n\n    summary(){\n        return `TutorialStory: ${this.title}`\n    }\n}\n```\n\nYou can also define abstract classes in TypeScript as shown below.\n\n> **Abstract classes are base classes from which other classes may be derived. They may not be instantiated directly. Unlike an interface, an abstract class may contain implementation details for its members. The abstract keyword is used to define abstract classes as well as abstract methods within an abstract class.**\n\n```typescript\nabstract class StoryProcessorTemplate {\n    public process(url: string): Story {\n        var title: string = this.extractTitle(url)\n        var text: string = this.extractText(url)\n        var tags: string[] = this.extractTags(text)\n        return {\n            title : title,\n            tags : tags\n        }\n    }\n\n    abstract extractTitle(url:string): string\n\n    abstract extractText(url:string): string\n\n    abstract extractTags(url:string): string[]\n}\n```\n\n## Module\n\nUntil now, JavaScript had no support for modules. With ECMAScript 6, JavaScript will natively support modules. Each module is defined in its own file. The functions or variables defined in a module are not visible outside unless you explicitly export them. The code snippet shown below declares a module `StoryApp` and exports a class `StoryManager` that clients can use.\n\n```typescript\nmodule StoryApp{\n    export class StoryManager{\n        addStory(){}\n        removeStory(){}\n    }\n}\n\nlet manager = new StoryApp.StoryManager()\nmanager.addStory()\n```\n\nYou can also import a module and use alias for them.\n\n```\nimport s = StoryApp\nlet manager = new s.StoryManager()\nmanager.addStory()\n```\n\nor you can directly import `StoryManager` class as shown below.\n\n```typescript\nimport SM = StoryApp.StoryManager\nlet manager = new SM()\nmanager.addStory()\n```\n\n## Generics\n\nTypeScript also supports Generics which allows you to write components that work over various types.\n\nLet's suppose we want to write a function that works on any type that has length function but we want to make sure both arguments are compatible.\n\n```typescript\n\ninterface HasLength{\n    length: number\n}\n\nfunction addLengths<T extends HasLength>(t1: T, t2: T):number {\n    return t1.length + t2.length;\n}\n\naddLengths(\"hello\",\"abc\")\naddLengths([1,2,3],[100,11,99])\n```\n\nYou can also use Generics with interfaces and classes as shown below.\n\n```typescript\ninterface Textable{\n    text:string\n}\n\ninterface Message<T extends Textable>{\n    content: T\n\n    msg(): string\n}\n```\n\n```typescript\nclass Pair<T>{\n    fst: T\n    snd:T\n}\n```\n\n-----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/22](https://github.com/shekhargulati/52-technologies-in-2016/issues/22).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/17-typescript)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "17-typescript/code/getting-started.ts",
    "content": "// Basic Types\nvar votes = 10;\nvotes++;\nconsole.log(votes);\n\nvar visible: boolean = true;\nlet storyExists:boolean = false;\n\nlet title: string = \"Learning TypeScript\";\nlet description: string = 'Learning TypeScript Today!'\n\n// String literals\nlet fullname = \"Shekhar Gulati\"\nlet summary = `${fullname} is ${title} this weekend.`\n\n// Arrays \n\nvar tags: string[] = [\"javascript\",\"programming\"]\ntags.push(\"typescript\")\ntags.forEach(function(tag){\n    console.log(`Tag ${tag}`)\n});\n\nlet storyLikedBy: Array<number> = [1,2,3]\n\nenum StoryType {Video, Article, Tutorial}\nlet st:StoryType = StoryType.Article\n\nlet storyTitles = [\"Learning TypeScript\", \"Getting started with TypeScript\",\"Building your first app with TypeScript\"]\nlet titlesAndLengths : [string, number][] = storyTitles.map(function(title){\n    let tuple: [string, number]  = [title, title.length]\n    return tuple\n})\n\nvar dontKnow: any = {}\ndontKnow = \"abc\"\ndontKnow = 1\n\nvar stringOrNumber: (string|number) = 1\nstringOrNumber = \"hello\"\n\n\nvar stories: [string, string[]][] = []\n\nfunction addStory(title: string, tags: string[]): void {\n    stories.push([title, tags])  \n}\n\nvar tags: string[] = [\"javascript\",\"programming\"]\nlet tagLengths: number[] = tags.map(tag => tag.length)\n\n\nlet sortByLength1 = function(x:string, y:string): number {\n    return x.length - y.length\n}\n\nlet  sortByLength2 = function(x:string, y:string){\n    return x.length - y.length\n}  \n\nlet  sortByLength3 = (x: string, y: string) :  number => { \n    return x.length - y.length\n}\n\nlet  sortByLength4 = (x: string, y: string) :  number => { \n    return x.length - y.length\n}\n\nlet  sortByLength5 = (x: string, y: string) =>  x.length - y.length\n\n\nlet sortByLength6: (x: string, y: string) => number = (x, y) => x.length - y.length\ntags.sort(sortByLength6)\n\n\nfunction storySummary(title:string, description: string = \"\") {\n    if(description){\n        return title + description;\n    }else{\n        return title;\n    }\n    \n}\n\n\ninterface Story {\n    title: string;\n    description ?: string;\n    tags : string[]\n}\n\nlet story1:Story = {title:\"Learning TypeScript\", tags:[\"typescript\",\"learning\"]}\n\n// interface StoryExtractor {\n//     extract(url:string): Story\n// }\n\n// let extractor:StoryExtractor = {extract: url => story1}\n\ninterface StoryExtractor {\n    (url:string): Story\n}\n\nlet extractor:StoryExtractor = url => story1\n\nclass TextStory implements Story{\n    title:string\n    tags: string[]\n   \n   static storyWithNoTags(title:string): TextStory {\n       return new TextStory(title, [])\n   } \n    constructor(title:string, ...tags){\n        this.title = title;\n        this.tags = tags     \n    } \n   \n   summary (){\n       return `TextStory: ${this.title}`\n   } \n   \n}\n\n\nlet story = TextStory.storyWithNoTags(\"Learning TypeScript\")\n\n\nclass TutorialStory extends TextStory {\n    constructor(title:string, ...tags){\n        super(title, tags)\n    }\n    \n    summary(){\n        return `TutorialStory: ${this.title}`\n    }\n}\n\nabstract class StoryProcessorTemplate {\n    public process(url: string): Story {\n        var title: string = this.extractTitle(url)\n        var text: string = this.extractText(url)\n        var tags: string[] = this.extractTags(text)\n        return {\n            title : title,\n            tags : tags\n        }\n    }\n    \n    abstract extractTitle(url:string): string\n    \n    abstract extractText(url:string): string\n    \n    abstract extractTags(url:string): string[]\n}\n\n\nmodule StoryApp{\n    export class StoryManager{\n        addStory(){}\n        removeStory(){}\n    }\n}\n\n// let manager = new StoryApp.StoryManager()\n// manager.addStory()\n\nimport s = StoryApp\nlet manager = new s.StoryManager()\nmanager.addStory()\n\n\ninterface HasLength{\n    length: number\n}\n\nfunction addLengths<T extends HasLength>(t1: T, t2: T):number {\n    return t1.length + t2.length;\n}\n\naddLengths(\"hello\",\"abc\")\naddLengths([1,2,3],[100,11,99])\n\ninterface Textable{\n    text:string\n}\n\ninterface Message<T extends Textable>{\n    content: T\n    \n    msg(): string\n}\n\nclass Pair<T>{\n    fst: T\n    snd:T\n}"
  },
  {
    "path": "17-typescript/code/js/getting-started.js",
    "content": "var __extends = (this && this.__extends) || function (d, b) {\n    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n    function __() { this.constructor = d; }\n    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\n// Basic Types\nvar votes = 10;\nvotes++;\nconsole.log(votes);\nvar visible = true;\nvar storyExists = false;\nvar title = \"Learning TypeScript\";\nvar description = 'Learning TypeScript Today!';\n// String literals\nvar fullname = \"Shekhar Gulati\";\nvar summary = fullname + \" is \" + title + \" this weekend.\";\n// Arrays \nvar tags = [\"javascript\", \"programming\"];\ntags.push(\"typescript\");\ntags.forEach(function (tag) {\n    console.log(\"Tag \" + tag);\n});\nvar storyLikedBy = [1, 2, 3];\nvar StoryType;\n(function (StoryType) {\n    StoryType[StoryType[\"Video\"] = 0] = \"Video\";\n    StoryType[StoryType[\"Article\"] = 1] = \"Article\";\n    StoryType[StoryType[\"Tutorial\"] = 2] = \"Tutorial\";\n})(StoryType || (StoryType = {}));\nvar st = StoryType.Article;\nvar storyTitles = [\"Learning TypeScript\", \"Getting started with TypeScript\", \"Building your first app with TypeScript\"];\nvar titlesAndLengths = storyTitles.map(function (title) {\n    var tuple = [title, title.length];\n    return tuple;\n});\nvar dontKnow = {};\ndontKnow = \"abc\";\ndontKnow = 1;\nvar stringOrNumber = 1;\nstringOrNumber = \"hello\";\nvar stories = [];\nfunction addStory(title, tags) {\n    stories.push([title, tags]);\n}\nvar tags = [\"javascript\", \"programming\"];\nvar tagLengths = tags.map(function (tag) { return tag.length; });\nvar sortByLength1 = function (x, y) {\n    return x.length - y.length;\n};\nvar sortByLength2 = function (x, y) {\n    return x.length - y.length;\n};\nvar sortByLength3 = function (x, y) {\n    return x.length - y.length;\n};\nvar sortByLength4 = function (x, y) {\n    return x.length - y.length;\n};\nvar sortByLength5 = function (x, y) { return x.length - y.length; };\nvar sortByLength6 = function (x, y) { return x.length - y.length; };\ntags.sort(sortByLength6);\nfunction storySummary(title, description) {\n    if (description === void 0) { description = \"\"; }\n    if (description) {\n        return title + description;\n    }\n    else {\n        return title;\n    }\n}\nvar story1 = { title: \"Learning TypeScript\", tags: [\"typescript\", \"learning\"] };\nvar extractor = function (url) { return story1; };\nvar TextStory = (function () {\n    function TextStory(title) {\n        var tags = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n            tags[_i - 1] = arguments[_i];\n        }\n        this.title = title;\n        this.tags = tags;\n    }\n    TextStory.storyWithNoTags = function (title) {\n        return new TextStory(title, []);\n    };\n    TextStory.prototype.summary = function () {\n        return \"TextStory: \" + this.title;\n    };\n    return TextStory;\n}());\nvar story = TextStory.storyWithNoTags(\"Learning TypeScript\");\nvar TutorialStory = (function (_super) {\n    __extends(TutorialStory, _super);\n    function TutorialStory(title) {\n        var tags = [];\n        for (var _i = 1; _i < arguments.length; _i++) {\n            tags[_i - 1] = arguments[_i];\n        }\n        _super.call(this, title, tags);\n    }\n    TutorialStory.prototype.summary = function () {\n        return \"TutorialStory: \" + this.title;\n    };\n    return TutorialStory;\n}(TextStory));\nvar StoryProcessorTemplate = (function () {\n    function StoryProcessorTemplate() {\n    }\n    StoryProcessorTemplate.prototype.process = function (url) {\n        var title = this.extractTitle(url);\n        var text = this.extractText(url);\n        var tags = this.extractTags(text);\n        return {\n            title: title,\n            tags: tags\n        };\n    };\n    return StoryProcessorTemplate;\n}());\nvar StoryApp;\n(function (StoryApp) {\n    var StoryManager = (function () {\n        function StoryManager() {\n        }\n        StoryManager.prototype.addStory = function () { };\n        StoryManager.prototype.removeStory = function () { };\n        return StoryManager;\n    }());\n    StoryApp.StoryManager = StoryManager;\n})(StoryApp || (StoryApp = {}));\n// let manager = new StoryApp.StoryManager()\n// manager.addStory()\nvar s = StoryApp;\nvar manager = new s.StoryManager();\nmanager.addStory();\nfunction addLengths(t1, t2) {\n    return t1.length + t2.length;\n}\naddLengths(\"hello\", \"abc\");\naddLengths([1, 2, 3], [100, 11, 99]);\nvar Pair = (function () {\n    function Pair() {\n    }\n    return Pair;\n}());\n"
  },
  {
    "path": "17-typescript/code/tsconfig.json",
    "content": "{\n    \"compilerOptions\": {\n        \"outDir\": \"js\",\n        \"target\": \"es5\",\n        \"watch\": true\n    }\n}"
  },
  {
    "path": "18-mesos/README.md",
    "content": "Getting Started with Apache Mesos\n----\n\nWelcome to eighteenth week of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week we will learn about [Apache Mesos](http://mesos.apache.org/) -- an open source cluster manager and scheduler for your datacenter. We will begin this series with an introduction of Apache Mesos covering why it exists and what it can do for us. After covering the why and what of Apache Mesos, we will install Mesos inside a [Vagrant box provided by Mesosphere](https://github.com/mesosphere/playa-mesos) and use it.\n\n## Lets go down the memory lane##\n\nBack in 1950's when computers were a luxury and very expensive it was not possible to use a computer for multiple tasks as the same time. Only one user can work on a computer and run a single application. Then, a brilliant computer scientist named [John McCarthy](https://en.wikipedia.org/wiki/John_McCarthy_(computer_scientist)) came up with an idea ***Lets all share the same computer at the same time.***. He along with his students popularized a concept called **Time-sharing**, which allowed multiple users to concurrently interact with a single computer by means of multi-threading and multi-tasking. So, now a computer was sharing its resources with multiple applications allowing multiple users to work with a computer concurrently, hence dramatically lowering the cost of computing capability.\n\n## Then came the web\n\nFor significant part of the computing history, applications used to run on single machines, then with the advent of web applications, the applications started becoming more distributed. We all have seen application architectures in which one machine running web server and another server running a database. One server architecture started getting out of steam so we started buying bigger and bigger boxes to handle the load but it had its limits so a paradigm shift happened and we started running multiple copies of the servers. So, now we typically have multiple web servers talking to a replicated and/or sharded database clusters.\n\n## Current state of datacenter\n\nThese days web architectures are becoming more and more complicated with multiple components like web server clusters, application server clusters, database clusters, caching clusters, analytics clusters using tools like Hadoop, etc. A simple datacenter architecture is shown below.\n\n![](images/modern-datacenter.jpg)\n\nThis kind of datacenter architecture is called **Statically Partitioned datacenter**. They are called static partitioned datacenter because your datacenter is a group of static clusters -- hadoop cluster, nginx cluster, and so on.\n\n## Limitations of static partitioning\n\nThere are multiple Limitations of traditional datacenter architecture. Some of these are mentioned below.\n\n1. **Under utilization of resources**\n\n2. **Not possible to share resources across clusters**\n\n3. **No centralized view of entire datacenter**\n\n4. **Scale up leads to addition of more servers**\n\n\n## Apache Mesos\n\nIn 2009, Benjamin Hindman along with his fellow PhD students at University of California, Berkeley created Mesos to solve the problem of statically partitioned datacenter by providing a cluster manager and scheduler. The goal was to create a software that will abstract CPU, memory, and disk resources in a way that allows modern datacenter to function like one large machine. It provides a unified API that allow users to work with the datacenter as a single pool of resources. Mesos was later open sourced and donated to Apache software foundation.  Mesos is now a [top level Apache project](http://mesos.apache.org/) and used by many [organizations](http://mesos.apache.org/documentation/latest/powered-by-mesos/) around the world, biggest user being Twitter. Twitter along with Mesosphere and Airbnb are biggest users and contributors to Apache Mesos.\n\nA 10000 feet view of Mesos is shown below. You have server 1..N with a linux based operating system. On each server you have Mesos installed, which gives a feel that all the servers are just one machine that runs multiple applications like Java web applications, Jenkins slaves, hadoop clusters, etc.\n\n![](images/mesos-high-level-view.png)\n\nMesos makes your datacenter multi-tenant in nature allowing multiple applications to work on the same machine. Applications define what resources they need and mesos place them on machines that can fulfill their needs. This leads to efficient utilization of resources.\n\nMesos is used for building highly distributed applications like Hadoop analytics cluster or real time analytics systems based on Apache Storm or Apache Spark.\n\nMesos, itself is highly distributed and fault-tolerant system. A Mesos cluster has a master, zero or more standby masters for fault tolerance, one or more slaves, one or more zookeeper instances for master selection and coordination.\n\n![](images/mesos-distributed-architecture.jpg)\n\n* **Mesos Master**: Master manages the slave daemons running on each server.\n\n* **Mesos Slave**: They are work horses that do the actual work i.e. execute tasks. A mesos slave is installed on each server/node and share its resource information with master periodically.\n\n## Getting Started with Mesos\n\nThere are multiple ways to get started with Mesos. Lets discuss each one of them.\n\n1. Setting up Mesos on your operating system by following the documentation. This is the option for people who like to copy commands from a web page and paste on their terminal. All the steps are mentioned here http://mesos.apache.org/gettingstarted/. It basically goes through downloading Mesos bundle, installing packages for different operating system, updating few configuration files, and then starting services.\n\n2. Second option is to use Mesos on your operating system is by running Mesos inside a virtual machine using Vagrant. Mesosphere provides a Vagrant box that installs Mesos master, slave, and zookeeper instance inside a single virtual machine. This is a free, stupid, and cheap way to try Mesos. In today's blog, we will use this option.\n\n3. Third option is to launch Mesos on a cloud provider like AWS. [Mesos bundle](http://mesos.apache.org/downloads/) available on Mesos website contains a Python script that can launch Mesos cluster on different cloud provider. We will cover this later in this series.\n\n### Launching Mesos Vagrant box\n\nIn this blog, we will use the second option to get our hands dirty with Apache Mesos. Before you can do that you need to make sure following prerequisite are met.\n\n**Prerequisite**\n\n1. Download and install Git on your operating system. You can download installer for your operating system from https://git-scm.com/downloads.\n\n2. Download and install Vagrant on your operating system. You can download installer for your operating system from https://www.vagrantup.com/downloads.html\n\n\nAfter you are down with installing prerequisites on your machine clone the [playa-mesos Git repository](https://github.com/mesosphere/playa-mesos) on your machine and change directory to `playa-mesos` directory.\n\n```\n$ git clone git@github.com:mesosphere/playa-mesos.git\n$ cd playa-mesos\n```\n\nNext, launch the virtual machine using the `vagrant up` command. This will download the vagrant box, start all the required services, and configure SSH access to the virtual machine. You will see output like the one shown below.\n\n```\n→ vagrant up\nBringing machine 'default' up with 'virtualbox' provider...\n==> default: Importing base box 'playa_mesos_ubuntu_14.04'...\n==> default: Matching MAC address for NAT networking...\n==> default: Setting the name of the VM: playa_mesos_ubuntu_14.04\n==> default: Clearing any previously set network interfaces...\n==> default: Preparing network interfaces based on configuration...\n    default: Adapter 1: nat\n    default: Adapter 2: hostonly\n==> default: Forwarding ports...\n    default: 22 => 2222 (adapter 1)\n==> default: Running 'pre-boot' VM customizations...\n==> default: Booting VM...\n==> default: Waiting for machine to boot. This may take a few minutes...\n    default: SSH address: 127.0.0.1:2222\n    default: SSH username: vagrant\n    default: SSH auth method: private key\n    default: Warning: Connection timeout. Retrying...\n==> default: Machine booted and ready!\n==> default: Checking for guest additions in VM...\n==> default: Configuring and enabling network interfaces...\n==> default: Mounting shared folders...\n    default: /vagrant => /Users/abc/7-days-with-mesos/playa-mesos\n```\n\nThe virtual machine is running master, slave, and zookeeper on a single machine. The virtual machine is allocated with 2048MB memory and 2 CPU cores. This configuration is defined in `config.json` file. The virtual machine is given a private IP address `10.141.141.10`, which is also defined inside `config.json` file.\n\nMesos master comes with a web interface that gives you a view of your entire datacenter. You can view the web interface for our single node Mesos at http://10.141.141.10:5050/\n\n![](images/mesos-master-ui.png)\n\nThe web interface shown above is divided into different sections. The **Slaves** section on the left shows that their is one active slave and **Resources** on the left bottom shows that total resources available are 2 cores and 1000MB of memory. The slave is allocated 1000MB because master and zookeeper are also running on the same virtual machine. So far we have not executed any task so **Active Tasks** and **Completed Tasks** sections are empty. You can view all the slaves by clicking **Slaves** http://10.141.141.10:5050/#/slaves in the top navigation bar.\n\n![](images/mesos-ui-slaves.png)\n\nYou can drill into a specific slave by clicking the UUID of the slave, which is a link. This will show details of a single slave and details about all the tasks processed by that slave.\n\n### Executing a simple task\n\nLets now make our single node Mesos cluster do some work. SSH into the vagrant box using `vagrant ssh` command.\n\n```bash\n→ vagrant ssh\nWelcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.16.0-30-generic x86_64)\n\n * Documentation:  https://help.ubuntu.com/\nLast login: Mon Jun  8 23:07:59 2015 from 10.0.2.2\nvagrant@mesos:~$\n```\n\nOnce you are inside the virtual machine, you can execute a task on Mesos cluster using the `mesos-execute` script as shown below. The task shown below will echo `hello world` on `stdout` and then sleep for 10 seconds.\n\n\n```bash\n$ mesos-execute --master=\"127.0.1.1:5050\" --name=\"my-first-task\" --command=\"echo hello world && sleep 10\" --resources=\"cpus:1;mem:128\"\n```\n\nThe output of the above command is shown below.\n\n```\nI0705 21:09:46.693713  1771 sched.cpp:157] Version: 0.22.1\nI0705 21:09:46.695086  1777 sched.cpp:254] New master detected at master@127.0.1.1:5050\nI0705 21:09:46.695516  1777 sched.cpp:264] No credentials provided. Attempting to register without authentication\nI0705 21:09:46.697149  1779 sched.cpp:448] Framework registered with 20150705-202555-16842879-5050-1194-0004\nFramework registered with 20150705-202555-16842879-5050-1194-0004\ntask my-first-task submitted to slave 20150705-202555-16842879-5050-1194-S0\nReceived status update TASK_RUNNING for task my-first-task\nReceived status update TASK_FINISHED for task my-first-task\nI0705 21:09:56.799959  1777 sched.cpp:1589] Asked to stop the driver\nI0705 21:09:56.799985  1777 sched.cpp:831] Stopping framework '20150705-202555-16842879-5050-1194-0004'\n```\n\nNow if you go to Mesos web interface and navigate to the slave, you will see that slave processed our `my-first-task` as shown below.\n\n<img src=\"images/mesos-ui-finished-task.png\" width=\"600\">\n\n## How Mesos works?\n\n1. Mesos Slave offers resources to Mesos master the form of resource offers\n2. Mesos master scheduler decides which framework to offer resources to.\n3. Spark scheduler decides whether it needs the resources. In this case it does not accept the offer\n4. User submits a spark job and Spark scheduler accepts it and wait for resource offer\n5. It accepts a resource offer from master and launches tasks on slaves.\n\n\n-----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/23](https://github.com/shekhargulati/52-technologies-in-2016/issues/23).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/18-mesos)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "19-bees/README.md",
    "content": "Load testing with bees\n---\n\nWelcome to the nineteenth blog of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I discovered a Python utility called [**beeswithmachineguns**](https://github.com/newsapps/beeswithmachineguns) that can load test a web application by launching many micro EC2 instances. In this short blog, I will cover how to get started with this utility.\n\n> **From the [project site](https://github.com/newsapps/beeswithmachineguns#the-caveat-please-read): If you decide to use the Bees, please keep in mind the following important caveat: they are, more-or-less a distributed denial-of-service attack in a fancy package and, therefore, if you point them at any server you don’t own you will behaving unethically, have your Amazon Web Services account locked-out, and be liable in a court of law for any downtime you cause.**\n\n\n## Installing `beeswithmachineguns`\n\nCreate a new Python virtual environment using the following commands.\n\n```bash\n$ virtualenv venv --python=python2.7\n$ source venv/bin/activate\n```\n\nNow, you can check your Python installation by running `which python` to make sure it is pointing to the Python installed inside the virtual environment.\n\n```bash\n$ pip install beeswithmachineguns\n```\n\nThe `beeswithmachineguns` makes use of `boto` and `paramiko` packages. [`boto`](https://github.com/boto/boto3) is the official Python client library to work with Amazon EC2 and [`paramiko`](http://www.paramiko.org/) is an implementation of SSH v2 protocol that `beeswithmachineguns` uses to open a SSH connection and load test your application.\n\nTo make sure, `beeswithmachineguns` is installed correctly please check that following command returns successfully.\n\n```bash\n$ bees -h\n```\n```\nUsage:\nbees COMMAND [options]\n\nBees with Machine Guns\n\nA utility for arming (creating) many bees (small EC2 instances) to attack\n(load test) targets (web applications).\n\ncommands:\n  up      Start a batch of load testing servers.\n  attack  Begin the attack on a specific url.\n  down    Shutdown and deactivate the load testing servers.\n  report  Report the status of the load testing servers.\n```\n\n## Running a load test\n\nBefore you can start using `beeswithmachineguns`, you have to setup AWS credentials in the `~/.aws/credentials` file.\n\n```ini\n[default]\naws_access_key_id = <YOUR_AWS_ACCESS_KEY>\naws_secret_access_key = <YOUR_AWS_ACCESS_SECRET>\n```\n\nYou can also setup the default region in the `~/.aws/config` file.\n\n```ini\n[default]\nregion=us-east-1\n```\n\nNow, you can start using `bees` command-line tool. To spin up instances, you will use `bees up` command as shown below. We are starting one server using the `default` security group and `my-ssh-key` pem key. The `my-ssh-key.pem` should reside inside the `~/.ssh` directory. The server will be lauched inside the `us-east-1` availability zone. You can specify a different zone using the `--zone` option.\n\n```bash\n$ bees up --servers 1 --group default --key my-ssh-key\n```\nYou will see following in the output.\n```\nNew bees will use the \"default\" EC2 security group. Please note that port 22 (SSH) is not normally open on this group. You will need to use to the EC2 tools to open it before you will be able to attack.\nConnecting to the hive.\nAttempting to call up 1 bees.\nWaiting for bees to load their machine guns...\n.\n.\n.\n.\nBee i-b8581a3f is ready for the attack.\nThe swarm has assembled 1 bees.\n```\n\nTo check the status of your servers using the `bees report` command as shown below.\n\n```bash\n$ bees report\n```\n\n```\nRead 1 bees from the roster.\nBee i-b8581a3f: running @ 54.100.99.121\n```\n\nNow, let's attack or load test a website. This is done using the `attack` command.\n\n```bash\n$ bees attack -n 1000 -c 25 -u https://my-website.com/\n```\n\nThe command show above will make total 1000 connections using 25 concurrent connections.\n\nFinally, you can shutdown the servers using the `down` command as shown below.\n\n```bash\n$ bees down\n```\n\n```\nRead 1 bees from the roster.\nConnecting to the hive.\nCalling off the swarm.\nStood down 1 bees.\n```\n\n## Under the hood\n\n`beeswithmachineguns` does something very simple. When you fire the `up` command, it use the `boto` API to launch the instances. The `up` command makes sure the instances are running before it returns. It does that by checking the instance state inside the `while` loop. It usually takes a minute or two before instances are in running state. You can SSH into instances only when they are in running state.\n\nThe `attack` command opens a SSH connection using the `paramiko` API using the `pem` key you specified in the `up` command. Once SSH connection is established, it uses Apache Benchmark tool to generate load on your web site. The parameters you passed with the `attack` command are fed to the `ab`. Finally, it collects the result of `ab` and return them back to the user.\n\n\n----\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/24](https://github.com/shekhargulati/52-technologies-in-2016/issues/24).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/19-bees)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "20-json/README.md",
    "content": "5 open source projects that will make working with JSON awesome and fun\n-------\n\nWelcome to twentieth week of [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I will share my 5 favorite open source projects that makes working with JSON easy and fun. I use them on regular basis and find them very useful whenever I am working with JSON. JSON (JavaScript Object Notation) is the most popular data-interchange format. Most of the REST APIs produce and consume JSON, there are many databases that either directly stores JSON or store JSON in binary format, we even have tools and frameworks that use JSON files for configuration.\n\nLet's get started.\n\n## Project 1: [json-server](https://github.com/typicode/json-server)\n\n[json-server](https://github.com/typicode/json-server) is an easy to use fake REST API server. I used `json-server` for the first time while I was working on a prototype during a hackathon. I was building a product that needs to get data from the SITA(API platform for air transport industry) API. Only airlines are allowed to get data from the SITA API so I used json-server to render the fake data. This allowed me to work as if I was working with a SITA server.\n\n`json-server` is a `node.js` application so you will need node and `npm` installed on your machine. Once you have prerequisite installed, you can install `json-server` by typing the following command.\n\n```\n$ npm install -g json-server\n```\n\nCreate a `JSON` file with fake data. In the example shown below, we are trying to fake a task management application that has two entities - `TaskList` and `Task`.\n\n```js\n{\n  \"tasklists\": [\n    {\n      \"id\": 1,\n      \"name\": \"Todo\"\n    },\n    {\n      \"id\": 2,\n      \"name\": \"In Progress\"\n    },\n    {\n      \"id\": 3,\n      \"name\": \"Done\"\n    }\n  ],\n  \"tasks\": [\n    {\n      \"id\": 1,\n      \"name\": \"Write week 20 blog on json-server\",\n      \"tasklistId\": 1\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Read Machine Learning in Action book\",\n      \"tasklistId\": 2\n    },\n    {\n      \"id\": 3,\n      \"name\": \"Release strman libray\",\n      \"tasklistId\": 3\n    }\n  ]\n}\n```\n\nNow, you can start the `json-server` using the following command.\n\n```\n$ json-server --watch db.json\n```\n\nIf you add more data to the `db.json` it will be automatically picked. You can view the exposed endpoints by going to [http://localhost:3000/](http://localhost:3000/). You will see it has exposed two resources -- [tasklists](http://localhost:3000/tasklists) and [tasks](http://localhost:3000/tasks).\n\n> **By default, json-server will be listening to port number 3000. If you want to change the port number then you can use `port` option `json-server --watch db.json --port 8000`.**\n\nYou are not limited to `GET` requests only, you can make `POST`, `DELETE`, `PUT` requests as well.\n\nYou can make `cURL` request to fetch all the tasks.\n\n```\n$ curl -i http://localhost:3000/tasks\n```\n\nTo learn more about `json-server` please refer to its [documentation](https://github.com/typicode/json-server).\n\n## Project 2: [jq](https://stedolan.github.io/jq/)\n\nAccording to `jq` [documentation](https://stedolan.github.io/jq/),\n\n> **jq is like `sed` for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that `sed`, `awk`, `grep` and friends let you play with text.**\n\nYou can download `jq` for your operating system from the [website](https://stedolan.github.io/jq/download/). On Mac OS X, you can use brew package manager as shown below.\n\n```\n$ brew install jq\n```\n\nLet's see what we can do with `jq`. We will use the REST API exposed by `json-server`. You can use `jq` to pretty print JSON response. You use a tool like cURL to fetch the data and pipe it to `jq` as shown below.\n\n![](images/jq-1.png)\n\nAs you can see in the output above, `jq` formatted the JSON response and syntax highlighting is applied.\n\n`jq` can do much more than formatting and syntax highlighting your JSON. You can use it extract data from the JSON. Let's suppose we only want JSON response to contain `name` then we can use follwing command.\n\n```\n$ curl 'http://localhost:3000/tasks' | jq '.[] | {name:.name}'\n```\n\n```json\n{\n  \"name\": \"Write week 20 blog on json-server\"\n}\n{\n  \"name\": \"Read Machine Learning in Action book\"\n}\n{\n  \"name\": \"Release strman libray\"\n}\n```\n\nThe `jq` command shown above returns all the JSON documents with only `name` field.\n\nYou can also limit the result. Let's suppose we only want 2 tasks then we can execute following command.\n\n```\n$ curl 'http://localhost:3000/tasks' | jq '.[0:2]?' | jq '.[] | {name:.name}'\n```\n\n```js\n{\n  \"name\": \"Write week 20 blog on json-server\"\n}\n{\n  \"name\": \"Read Machine Learning in Action book\"\n}\n```\n\nThere is much more that you can do with `jq`. Please refer to the [documentation](https://stedolan.github.io/jq/manual/) for more information.\n\n## Project 3: [jarg](https://github.com/jdp/jarg)\n\n[jarg](https://github.com/jdp/jarg) is a Python utility that you can use to write JSON. To install `jarg`, you can use the following pip command.\n\n```\n$ pip install jarg\n```\n\nThen, you can create json documents on the fly as shown below.\n\n```\n$ jarg title=\"Learning Rust\" id=1\n```\n\n```js\n{\"id\": 1, \"title\": \"Learning Rust\"}\n```\n\nWe can use `jq` to format our JSON as shown below.\n\n```\n$ jarg title=\"Learning Rust\" id=1 | jq \".\"\n```\n\n```js\n{\n  \"id\": 1,\n  \"title\": \"Learning Rust\"\n}\n```\n\n## Project 4: [json-diff](https://github.com/andreyvit/json-diff)\n\nThere are times when we have to diff two json files. [json-diff]\n(https://github.com/andreyvit/json-diff) is a node module that just does that. You can install it using npm.\n\n```\n$ npm install -g json-diff\n```\n\nLet's create two json.\n\n```js\n$ jarg title=\"Learning Rust\" id=1 | jq \".\" >> a.json\n\n$ jarg title=\"Learning Rust1\" id=1 | jq \".\" >> b.json\n```\n\nNow, you can use json-diff as shown below.\n\n```\n$ json-diff a.json b.json\n```\n\n![](images/json-diff.png)\n\n## Project 5: [json2csv](https://github.com/jehiah/json2csv)\n\nThere are many tools that understand CSV better than JSON so you have to convert JSON to CSV. I use [json2csv](https://github.com/jehiah/json2csv) Go package to achieve that. To use it, you need Go installed. Then you can install `json2csv` using the following command.\n\n```\n$ go get github.com/jehiah/json2csv\n```\n\nTo convert a json to csv, you will run following command.\n\n```\n$ cat data.json | json2csv -k title,id > result.csv\n```\n\n\n-----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/25](https://github.com/shekhargulati/52-technologies-in-2016/issues/25).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/20-json)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "20-json/code/db.json",
    "content": "{\n  \"tasklists\": [\n    {\n      \"id\": 1,\n      \"name\": \"Todo\"\n    },\n    {\n      \"id\": 2,\n      \"name\": \"In Progress\"\n    },\n    {\n      \"id\": 3,\n      \"name\": \"Done\"\n    }\n  ],\n  \"tasks\": [\n    {\n      \"id\": 1,\n      \"name\": \"Write week 20 blog on json-server\",\n      \"tasklistId\": 1\n    },\n    {\n      \"id\": 2,\n      \"name\": \"Read Machine Learning in Action book\",\n      \"tasklistId\": 2\n    },\n    {\n      \"id\": 3,\n      \"name\": \"Release strman libray\",\n      \"tasklistId\": 3\n    }\n  ]\n}"
  },
  {
    "path": "21-strman/README.md",
    "content": "strman - A Java 8 String manipulation library\n------\n\nA Java 8 library for working with String. It is inspired by [dleitee/strman](https://github.com/dleitee/strman).\n\nGetting Started\n--------\n\nTo use strman in your application, you have to add `strman` in your classpath. strman is available on [Maven Central](http://search.maven.org/) so you just need to add dependency to your favorite build tool as show below.\n\nFor Apache Maven users, please add following to your pom.xml.\n\n```xml\n<dependencies>\n    <dependency>\n        <groupId>com.shekhargulati</groupId>\n        <artifactId>strman</artifactId>\n        <version>0.1.0</version>\n        <type>jar</type>\n    </dependency>\n</dependencies>\n```\n\nGradle users can add following to their build.gradle file.\n\n```\ncompile(group: 'com.shekhargulati', name: 'strman', version: '0.1.0', ext: 'jar'){\n        transitive=true\n}\n```\n\n## Available Functions\n\nThese are the available functions in current version of library:\n\n## append\n\nAppends Strings to value\n\n```java\nimport static strman.Strman.append\nappend(\"f\", \"o\", \"o\", \"b\", \"a\", \"r\")\n// result => \"foobar\"\n```\n\n## appendArray\n\nAppend an array of String to value\n\n```java\nimport static strman.Strman.appendArray\nappendArray(\"f\", new String[]{\"o\", \"o\", \"b\", \"a\", \"r\"}\n// result => \"foobar\"\n```\n\n## at\n\nGet the character at index. This method will take care of negative indexes.\n\n```java\nimport static strman.Strman.at\nat(\"foobar\", 0)\n// result => Optional(\"f\")\n```\n\n## between\n\nReturns an array with strings between start and end.\n\n```java\nimport static strman.Strman.between\nbetween(\"[abc][def]\", \"[\", \"]\")\n// result => [\"abc\",\"def\"]\n```\n\n## chars\n\nReturns a String array consisting of the characters in the String.\n\n```java\nimport static strman.Strman.chars\nchars(\"title\")\n// result => [\"t\", \"i\", \"t\", \"l\", \"e\"]\n```\n\n## collapseWhitespace\n\nReplace consecutive whitespace characters with a single space.\n\n```java\nimport static strman.Strman.collapseWhitespace\ncollapseWhitespace(\"foo    bar\")\n// result => \"foo bar\"\n```\n\n## contains\n\nVerifies that the needle is contained in the value.\n\n```java\nimport static strman.Strman.contains\ncontains(\"foo bar\",\"foo\")\n// result => true\n\ncontains(\"foo bar\",\"FOO\", false) // turning off case sensitivity\n// result => true\n```\n\n## containsAll\n\nVerifies that all needles are contained in value\n\n```java\nimport static strman.Strman.containsAll\ncontainsAll(\"foo bar\", new String[]{\"foo\", \"bar\"})\n// result => true\n\ncontainsAll(\"foo bar\", new String[]{\"FOO\", \"bar\"},false)\n// result => true\n```\n\n## containsAny\n\nVerifies that one or more of needles are contained in value.\n\n```java\nimport static strman.Strman.containsAny\ncontainsAny(\"bar foo\", new String[]{\"FOO\", \"BAR\", \"Test\"}, true)\n// result => true\n```\n\n## countSubstr\n\nCount the number of times substr appears in value\n\n```java\nimport static strman.Strman.countSubstr\ncountSubstr(\"aaaAAAaaa\", \"aaa\")\n// result => 2\ncountSubstr(\"aaaAAAaaa\", \"aaa\", false, false)\n// result => 3\n```\n\n## endsWith\n\nTest if value ends with search.\n\n```java\nimport static strman.Strman.endsWith\nendsWith(\"foo bar\", \"bar\")\n// result => true\nendsWith(\"foo Bar\", \"BAR\", false)\n// result => true\n```\n\n## ensureLeft\n\nEnsures that the value begins with prefix. If it doesn't exist, it's prepended.\n\n```java\nimport static strman.Strman.ensureLeft\nensureLeft(\"foobar\", \"foo\")\n// result => \"foobar\"\nensureLeft(\"bar\", \"foo\")\n// result => \"foobar\"\nensureLeft(\"foobar\", \"FOO\", false)\n// result => \"foobar\"\n```\n\n## base64Decode\n\nDecodes data encoded with MIME base64\n\n```java\nimport static strman.Strman.base64Decode\nbase64Decode(\"c3RybWFu\")\n// result => \"strma\"\n```\n\n## base64Encode\n\nEncodes data with MIME base64.\n\n```java\nimport static strman.Strman.base64Encode\nbase64Encode(\"strman\")\n// result => \"c3RybWFu\"\n```\n\n## binDecode\n\nConvert binary unicode (16 digits) string to string chars\n\n```java\nimport static strman.Strman.binDecode\nbinDecode(\"0000000001000001\")\n// result => \"A\"\n```\n\n## binEncode\n\nConvert string chars to binary unicode (16 digits)\n\n```java\nimport static strman.Strman.binEncode\nbinEncode(\"A\")\n// result => \"0000000001000001\"\n```\n\n## decDecode\n\nConvert decimal unicode (5 digits) string to string chars\n\n```java\nimport static strman.Strman.decDecode\ndecDecode(\"00065\")\n// result => \"A\"\n```\n\n## decEncode\n\nConvert string chars to decimal unicode (5 digits)\n\n```java\nimport static strman.Strman.decEncode\ndecEncode(\"A\")\n// result => \"00065\"\n```\n\n## ensureRight\n\nEnsures that the value ends with suffix. If it doesn't, it's appended.\n\n```java\nimport static strman.Strman.ensureRight\nensureRight(\"foo\", \"bar\")\n// result => \"foobar\"\n\nensureRight(\"foobar\", \"bar\")\n// result => \"foobar\"\n\nensureRight(\"fooBAR\", \"bar\", false)\n// result => \"foobar\"\n```\n\n## first\n\nReturns the first n chars of String\n\n```java\nimport static strman.Strman.first\nfirst(\"foobar\", 3)\n// result => \"foo\"\n```\n\n## head\n\nReturn the first char of String\n\n```java\nimport static strman.Strman.head\nhead(\"foobar\")\n// result => \"f\"\n```\n\n## hexDecode\n\nConvert hexadecimal unicode (4 digits) string to string chars\n\n```java\nimport static strman.Strman.hexDecode\nhexDecode(\"0041\")\n// result => \"A\"\n```\n\n## hexEncode\n\nConvert string chars to hexadecimal unicode (4 digits)\n\n```java\nimport static strman.Strman.hexEncode\nhexEncode(\"A\")\n// result => \"0041\"\n```\n\n## inequal\n\nTests if two Strings are inequal\n\n```java\nimport static strman.Strman.inequal\ninequal(\"a\", \"b\")\n// result => true\n```\n\n## insert\n\nInserts 'substr' into the 'value' at the 'index' provided.\n\n```java\nimport static strman.Strman.insert\ninsert(\"fbar\", \"oo\", 1)\n// result => \"foobar\"\n```\n\n## last\n\nReturn the last n chars of String\n\n```java\nimport static strman.Strman.last\nlast(\"foobarfoo\", 3)\n// result => \"foo\"\n```\n\n## leftPad\n\nReturns a new string of a given length such that the beginning of the string is padded.\n\n```java\nimport static strman.Strman.leftPad\nleftPad(\"1\", \"0\", 5)\n// result => \"00001\"\n```\n\n## lastIndexOf\n\nThis method returns the index within the calling String object of the last occurrence of the specified value, searching backwards from the offset.\n\n```java\nimport static strman.Strman.lastIndexOf\nlastIndexOf(\"foobarfoobar\", \"F\", false)\n// result => 6\n```\n\n## leftTrim\n\nRemoves all spaces on left\n\n```java\nimport static strman.Strman.leftTrim\nleftTrim(\"     strman\")\n// result => \"strman\"\n```\n\n## prepend\n\nReturn a new String starting with prepends\n\n```java\nprepend(\"r\", \"f\", \"o\", \"o\", \"b\", \"a\")\n// \"foobar\"\n```\n\n## removeEmptyStrings\n\nRemove empty Strings from string array\n\n```java\nremoveEmptyStrings(new String[]{\"aa\", \"\", \"   \", \"bb\", \"cc\", null})\n// result => [\"aa\", \"bb\", \"cc\"]\n```\n\n## removeLeft\n\nReturns a new String with the prefix removed, if present.\n\n```java\nremoveLeft(\"foofoo\", \"foo\")\n// \"foo\"\n```\n\n## removeNonWords\n\nRemove all non word characters.\n\n```java\nremoveNonWords(\"foo&bar-\")\n// result => \"foobar\"\n```\n\n## removeRight\n\nReturns a new string with the 'suffix' removed, if present.\n\n```java\nremoveRight(\"foobar\", \"bar\")\n// result => \"foo\"\nremoveRight(\"foobar\", \"BAR\",false)\n// result => \"foo\"\n```\n\n## removeSpaces\n\nRemove all spaces and replace for value.\n\n```java\nremoveSpaces(\"foo bar\")\n// result => \"foobar\"\n```\n\n## repeat\n\nReturns a repeated string given a multiplier.\n\n```\nrepeat(\"1\", 3)\n// result  => \"111\"\n```\n\n## reverse\n\nReverse the input String\n\n```java\nreverse(\"foo\")\n// result => \"oof\"\n```\n\n## rightPad\n\nReturns a new string of a given length such that the ending of the string is padded.\n\n```java\nrightPad(\"1\", \"0\", 5)\n// result => \"10000\"\n```\n\n## rightTrim\n\nRemove all spaces on right.\n\n```java\nrightTrim(\"strman   \")\n// result => \"strman\"\n```\n\n## safeTruncate\n\nTruncate the string securely, not cutting a word in half. It always returns the last full word.\n\n```java\nsafeTruncate(\"foo bar\", 4, \".\")\n// result => \"foo.\"\nsafeTruncate(\"A Javascript string manipulation library.\", 16, \"...\")\n// result => \"A Javascript...\"\n```\n\n## truncate\n\nTruncate the unsecured form string, cutting the independent string of required position.\n\n```java\ntruncate(\"A Javascript string manipulation library.\", 14, \"...\")\n// result => \"A Javascrip...\"\n```\n\n## htmlDecode\n\nConverts all HTML entities to applicable characters.\n\n```java\nhtmlDecode(\"&SHcy;\")\n// result => Ш\n```\n\n## htmlEncode\n\nConvert all applicable characters to HTML entities.\n\n```java\nhtmlEncode(\"Ш\")\n// result => \"&SHcy;\"\n```\n\n## shuffle\n\nIt returns a string with its characters in random order.\n\n```java\nshuffle(\"shekhar\")\n```\n\n## slugify\n\nConvert a String to a slug\n\n```java\nslugify(\"foo bar\")\n// result => \"foo-bar\"\n```\n\n## transliterate\n\nRemove all non valid characters. Example: change á => a or ẽ => e.\n\n```java\ntransliterate(\"fóõ bár\")\n// result => \"foo bar\"\n```\n\n## surround\n\nSurrounds a 'value' with the given 'prefix' and 'suffix'.\n\n```java\nsurround(\"div\", \"<\", \">\"\n// result => \"<div>s\"\n```\n\n## tail\n\n```java\ntail(\"foobar\")\n// result => \"oobar\"\n```\n\n## toCamelCase\n\nTransform to camelCase\n\n```java\ntoCamelCase(\"CamelCase\")\n// result => \"camelCase\"\ntoCamelCase(\"camel-case\")\n// result => \"camelCase\"\n```\n\n## toStudlyCase\n\nTransform to StudlyCaps.\n\n```java\ntoStudlyCase(\"hello world\")\n// result => \"HelloWorld\"\n```\n\n## toDecamelize\n\nDecamelize String\n\n```java\ntoDecamelize(\"helloWorld\",null)\n// result => \"hello world\"\n```\n\n## toKebabCase\n\nTransform to kebab-case.\n\n```java\ntoKebabCase(\"hello World\")\n// result => \"hello-world\"\n```\n\n## toSnakeCase\n\nTransform to snake_case.\n\n```java\ntoSnakeCase(\"hello world\")\n// result => \"hello_world\"\n```\n\nLicense\n-------\nstrman is licensed under the MIT License - see the `LICENSE` file for details.\n"
  },
  {
    "path": "22-regex/README.md",
    "content": "Making Sense of Regular Expressions\n-----\n\nWelcome to the twenty second blog of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I wanted to write about speech recognition but end up learning regular expressions. Regular Expressions or Regex allows you to define patterns to match text. For example, you can write a regular expression `[Ss]hekh?ar` which will match `Shekhar, shekhar, Shekar, or shekar`. I am programming for last eleven years but I was never comfortable with regular expressions. Whenever I see a relatively complicated regular expression, I don't understand how to break it into smaller pieces to make sense of it. So, I decided to learn about regular expressions. In this tutorial, I will walk you through a series of examples that will help you learn about regular expressions. I will end this tutorial by covering a library [VerbalExpressions](https://github.com/VerbalExpressions) that you can use to programmatically build regular expressions. VerbalExpressions is implemented in most of the commonly used programming languages so you can use it with your favorite programming language.\n\n\n## Why [Ww]e|[Ii] don't get regular expressions?\n\nI think there are two reasons why I never understood regular expressions.\n\n1. You can easily google for common regular expressions so you don't spend time learning about them.\n\n2. Although regular expressions are composable in nature but because we don't understand them well enough we are unable to break them into smaller pieces and understand them. You can always understand a complicated problem by breaking it into smaller easy to understand components.\n\n3. A lot of time developers abuse regular expressions by using them at places where different solution will be better. There are even jokes on regular expressions. You can read about more jokes on regular expressions [here](http://www.rexegg.com/regex-humor.html).\n\n  > **Some people, when confronted with a problem, think \"I know, I'll use regular expressions.\" Now they have two problems.**\n\n## Regular expressions history\n\nYes, regular expressions too have their history. Regular expression originated in 1956 when an American Mathematician [Stephen Kleene](https://en.wikipedia.org/wiki/Stephen_Cole_Kleene) was working on formalizing Regular languages. **Computer Science borrows most of the good ideas from Mathematics. Mathematicians has biggest impact on computer science.** Regular language is any language that can be expressed using regular expressions. First application of regular expression was an editor named QED developed by Ken Thompson. Regular expressions are present in every programming language and most of the *nix tools make use of them like `find`, `grep`, etc.\n\n\n## Regular expression applications\n\nThere are many applications of regular expressions. Some of them are mentioned below:\n\n1. Form validation\n2. Find and replace\n3. Text transformation\n4. Log Processing\n\n## Regular expression in action\n\nTo learn regular expression, we will learn how to write a pattern that will match all the possible spellings of `Gaddafi`.  [Muammar Gaddafi](https://en.wikipedia.org/wiki/Muammar_Gaddafi) was a Libyan revolutionary, politician, and political theorist. I found this example in a [Stack Overflow question](https://stackoverflow.com/questions/5365283/regular-expression-to-search-for-gadaffi). As per the stackoverflow post, there are 30 possible spellings of Gaddafi as shown below.\n\n```\nGadaffi Gadafi Gadafy Gaddafi Gaddafy Gaddhafi Gadhafi Gathafi Ghadaffi Ghadafi Ghaddafi Ghaddafy Gheddafi Kadaffi Kadafi Kaddafi Kadhafi Kazzafi Khadaffy Khadafy Khaddafi Qadafi Qaddafi Qadhafi Qadhdhafi Qadthafi Qathafi Quathafi Qudhafi Kad'afi\n```\n\nI use [https://www.regexpal.com/](https://www.regexpal.com/), an online tool to test regular expressions.\n\n### Spelling 1: Matching `Gadaffi`\n\nLet's start by matching the first spelling `Gadaffi`. To match this spelling, we can simply use `/Gadaffi/g` as our regular expression as shown below.\n\n![](images/regex-1.png)\n\nBy default, matching is case-sensitive so `Gadaffi` and `gadaffi` are different. You can use flag `\\i` to make search case-insensitive.\n\n### Spelling 2: Matching `Gadafi`\n\nThe first and second spelling differ with each other in number of `f`. `Gadaffi` has two `f`s and `Gadafi` has one. We can define these using quantifier like `/Gadaf{1,2}i/g`. The `{1,2}` tell the regular expression processor that there could be minimum 1 `f` and maximum 2 `f` in the search text. The braces are considered metacharacters.\n\n![](images/regex-2.png\n\nRather than defining a range like `{1,2}`, you can also define fixed values like `f{5}` which means there should be 5 `f` in the search text. Also, you upper limit can be open like `{2,}` which will mean 2 and above.\n\nThere are shorthand notation for common quantifier mentioned below:\n\n`*` = `{0,}`, zero or more\n\n`+` = `{1,}`, one or more\n\n`?` = `{0,1}`, optional\n\n### Spelling 3: Matching `Gadafy`\n\nThe second and third spellings differ only in the last character -- `i` or `y`. In regular expression, you can define a set and any of the value in the set will be selected. The regular expression `/Gadaf{1,2}[iy]/g` means last character could be either `i` or `y`.\n\n![](images/regex-3.png)\n\n### Spelling 4-5: Matching `Gaddafi` and `Gaddafy`\n\nWe can match fourth and fifth spellings very easily by applying quantifiers to `d` as shown below.\n\n![](images/regex-4-5.png)\n\n\n### Spelling 6-7: Matching `Gaddhafi` and `Gadhafi`\n\nThese two spellings differ with previous spellings in that they have `h` in their spellings. This means `h` is optional as it is required by some spelling and not required by others. To mark a character optional, you can use quantifier `{0,1}` or you can use it shorthand notation `?` as shown below.\n\n![](images/regex-6-7.png)\n\n### Spelling 8: Matching `Gathafi`\n\nThis spelling differ from previous one's as it uses `t` instead of `d`. So, we have to make a choice between either `d` or `t`. For this we will use `|` to define an or clause as shown below.\n\n![](images/regex-8.png)\n\n\n### Spelling 9-12: Matching `Ghadaffi`, `Ghadafi`, `Ghaddafi`, and `Ghaddafy`\n\nYou can do this by defining an optional `h` as shown below.\n\n![](images/regex-9-12.png)\n\n### Spelling 13: Matching `Gheddafi`\n\nWe can very easily match this spelling by using a set of `a` and `e`.\n\n![](images/regex-13.png)\n\n### Spelling 14-17 and 19-21: Matching `Kadaffi`, `Kadafi`, `Kaddafi`, `Kadhafi`, `Khadaffy`, `Khadafy`, and `Khaddafi`\n\nTo match these the first character has to be `K`. We have to define a set of `[GK]` to match either `G` or `K` as the first character as shown below.\n\n![](images/regex-14-17-and-19-21.png)\n\n### Spelling 18: Matching `Kazzafi`\n\n![](images/regex-18.png)\n\n\n### Spelling 22-24 and 27: Matching `Qadafi`, `Qaddafi`, `Qadhafi`, and `Qathafi`\n\n![](images/regex-22-24-and-27.png)\n\n### Spelling 25-26: Matching `Qadhdhafi` and `Qadthafi`\n\n![](images/regex-25-26.png)\n\n### Spelling 28-29: Matching `Quathafi` and `Qudhafi`\n\n![](images/regex-28-29.png)\n\n\n### Spelling 30: Matching `Kad'afi`\n\nThis can be very easily matched by adding `'` to the `[dtz]` set as shown below.\n\n![](images/regex-30.png)\n\n### Improving regex by the use of word boundaries\n\n![](images/regex-word-boundary.png)\n\n\n-----\n\n\n## Getting started with VerbalExpressions\n\n`VerbalExpressions` is a library written for most programming languages that helps you construct difficult regular expressions with ease. In this tutorial, I will show you how to use Java implementation of `VerbalExpressions`.\n\nIf you are using Gradle project then you can add following to your `build.gradle`.\n\n```groovy\ncompile \"ru.lanwen.verbalregex:java-verbal-expressions:1.4\"\n```\n\nLet's write a simple test to `match` method using `VerbalExpression` that will match either `Gadaffi` or `Gadafi`.\n\n```java\nimport ru.lanwen.verbalregex.VerbalExpression;\n\npublic class GaddafiSpellingMatcher {\n\n    public static boolean match(final String spelling) {\n        VerbalExpression verbalExpression = VerbalExpression\n                .regex()\n                .startOfLine()\n                .then(\"Gada\")\n                .then(\"f\").count(1, 2)\n                .then(\"i\")\n                .endOfLine()\n                .build();\n        return verbalExpression.test(spelling);\n    }\n\n}\n```\n\nIn the code shown above, we used the `VerbalExpression` fluent API to build a regular expression. We started with creating the expression builder using the `VerbalExpression.regex()`. Then, we build the regular expression by specifying our clauses -- start the line with `Gada`, then there will be either one or two `f`, finally we will have an `i` in the end.\n\n\nTo match all the names starting with either `G` or `K` we wrote following `VerbalExpression` code.\n\n```java\nimport ru.lanwen.verbalregex.VerbalExpression;\n\npublic class GaddafiSpellingMatcher {\n\n    public static boolean match(final String spelling) {\n        VerbalExpression verbalExpression = VerbalExpression\n                .regex()\n                .startOfLine()\n                .anyOf(\"GK\")\n                .maybe(\"h\")\n                .any(\"ae\")\n                .anyOf(\"tdz\").count(1, 2)\n                .maybe(\"h\")\n                .then(\"a\")\n                .then(\"f\").count(1, 2)\n                .anyOf(\"iy\")\n                .endOfLine()\n                .build();\n        return verbalExpression.test(spelling);\n    }\n\n}\n```\n\nTo match all the 30 names, the code looks like as shown below.\n\n```java\nimport ru.lanwen.verbalregex.VerbalExpression;\n\npublic class GaddafiSpellingMatcher {\n\n    public static boolean match(final String spelling) {\n        VerbalExpression verbalExpression = VerbalExpression\n                .regex()\n                .startOfLine()\n                .anyOf(\"GKQ\")\n                .maybe(VerbalExpression.regex().anyOf(\"uh\"))\n                .maybe(VerbalExpression.regex().any(\"ae\"))\n                .anyOf(\"tdz'\").count(1, 2)\n                .maybe(\"h\")\n                .maybe(\"dh\")\n                .then(\"a\")\n                .then(\"f\").count(1, 2)\n                .anyOf(\"iy\")\n                .endOfLine()\n                .build();\n        return verbalExpression.test(spelling);\n    }\n\n}\n```\n\nYou can look at all the code [here](./code).\n\n----\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/28](https://github.com/shekhargulati/52-technologies-in-2016/issues/28).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/22-regex)](https://github.com/igrigorik/ga-beacon)"
  },
  {
    "path": "22-regex/code/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio\n\n*.iml\n\n## Directory-based project format:\n.idea/\n# if you remove the above rule, at least ignore the following:\n\n# User-specific stuff:\n# .idea/workspace.xml\n# .idea/tasks.xml\n# .idea/dictionaries\n\n# Sensitive or high-churn files:\n# .idea/dataSources.ids\n# .idea/dataSources.xml\n# .idea/sqlDataSources.xml\n# .idea/dynamic.xml\n# .idea/uiDesigner.xml\n\n# Gradle:\n# .idea/gradle.xml\n# .idea/libraries\n\n# Mongo Explorer plugin:\n# .idea/mongoSettings.xml\n\n## File-based project format:\n*.ipr\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\n### Java template\n*.class\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Package Files #\n*.jar\n*.war\n*.ear\n\n# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml\nhs_err_pid*\n### Gradle template\n.gradle\nbuild/\n\n# Ignore Gradle GUI config\ngradle-app.setting\n\n# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)\n!gradle-wrapper.jar\n\n"
  },
  {
    "path": "22-regex/code/build.gradle",
    "content": "group 'com.52tech'\nversion '1.0-SNAPSHOT'\n\napply plugin: 'java'\napply plugin: 'idea'\n\nsourceCompatibility = 1.8\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n\n    compile \"ru.lanwen.verbalregex:java-verbal-expressions:1.4\"\n\n    testCompile group: 'junit', name: 'junit', version: '4.11'\n}\n"
  },
  {
    "path": "22-regex/code/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Sat Jun 04 15:59:37 IST 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.5-all.zip\n"
  },
  {
    "path": "22-regex/code/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# For Cygwin, ensure paths are in UNIX format before anything is touched.\nif $cygwin ; then\n    [ -n \"$JAVA_HOME\" ] && JAVA_HOME=`cygpath --unix \"$JAVA_HOME\"`\nfi\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >&-\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >&-\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "22-regex/code/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "22-regex/code/settings.gradle",
    "content": "rootProject.name = 'week22-regex'\n\n"
  },
  {
    "path": "22-regex/code/src/main/java/week22/regex/GaddafiSpellingMatcher.java",
    "content": "package week22.regex;\n\nimport ru.lanwen.verbalregex.VerbalExpression;\n\npublic class GaddafiSpellingMatcher {\n\n    public static boolean match(final String spelling) {\n        VerbalExpression verbalExpression = VerbalExpression\n                .regex()\n                .startOfLine()\n                .anyOf(\"GKQ\")\n                .maybe(VerbalExpression.regex().anyOf(\"uh\"))\n                .maybe(VerbalExpression.regex().any(\"ae\"))\n                .anyOf(\"tdz'\").count(1, 2)\n                .maybe(\"h\")\n                .maybe(\"dh\")\n                .then(\"a\")\n                .then(\"f\").count(1, 2)\n                .anyOf(\"iy\")\n                .endOfLine()\n                .build();\n        return verbalExpression.test(spelling);\n    }\n\n}\n"
  },
  {
    "path": "22-regex/code/src/test/java/week22/regex/GaddafiSpellingMatcherTest.java",
    "content": "package week22.regex;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertTrue;\nimport static week22.regex.GaddafiSpellingMatcher.match;\n\npublic class GaddafiSpellingMatcherTest {\n\n    @Test\n    public void shouldMatchGadaffi() throws Exception {\n        assertTrue(match(\"Gadaffi\"));\n    }\n\n    @Test\n    public void shouldMatchGadafi() throws Exception {\n        assertTrue(match(\"Gadafi\"));\n    }\n\n    @Test\n    public void shouldMatchGadafy() throws Exception {\n        assertTrue(match(\"Gadafy\"));\n    }\n\n    @Test\n    public void shouldMatchGaddafiAndGaddafy() throws Exception {\n        assertTrue(match(\"Gaddafi\"));\n        assertTrue(match(\"Gaddafy\"));\n    }\n\n    @Test\n    public void shouldMatchGaddhafiAndGadhafi() throws Exception {\n        assertTrue(match(\"Gaddhafi\"));\n        assertTrue(match(\"Gadhafi\"));\n    }\n\n    @Test\n    public void shouldMatchGathafi() throws Exception {\n        assertTrue(match(\"Gathafi\"));\n    }\n\n    @Test\n    public void shouldMatchGhadaffi_Ghadafi_Ghaddafi_Ghaddafy() throws Exception {\n        assertTrue(match(\"Ghadaffi\"));\n        assertTrue(match(\"Ghadafi\"));\n        assertTrue(match(\"Ghaddafi\"));\n        assertTrue(match(\"Ghaddafy\"));\n    }\n\n    @Test\n    public void shouldMatchGheddafi() throws Exception {\n        assertTrue(match(\"Gheddafi\"));\n    }\n\n    @Test\n    public void shouldMatchSpellingsStartingWithK() throws Exception {\n        assertTrue(match(\"Kadaffi\"));\n        assertTrue(match(\"Kadafi\"));\n        assertTrue(match(\"Kaddafi\"));\n        assertTrue(match(\"Kadhafi\"));\n        assertTrue(match(\"Khadaffy\"));\n        assertTrue(match(\"Khadafy\"));\n        assertTrue(match(\"Khaddafi\"));\n    }\n\n    @Test\n    public void shouldMatchKazzafi() throws Exception {\n        assertTrue(match(\"Kazzafi\"));\n    }\n\n    @Test\n    public void shouldMatchStartingWithQ() throws Exception {\n        assertTrue(match(\"Qadafi\"));\n        assertTrue(match(\"Qaddafi\"));\n        assertTrue(match(\"Qadhafi\"));\n        assertTrue(match(\"Qadthafi\"));\n        assertTrue(match(\"Qathafi\"));\n    }\n\n    @Test\n    public void shouldMatchQadhdhafi() throws Exception {\n        assertTrue(match(\"Qadhdhafi\"));\n    }\n\n    @Test\n    public void shouldMatchQuathafi() throws Exception {\n        assertTrue(match(\"Quathafi\"));\n    }\n\n    @Test\n    public void shouldMatchQudhafi() throws Exception {\n        assertTrue(match(\"Qudhafi\"));\n    }\n\n    @Test\n    public void shouldMatchKadafiWithSingleQoute() throws Exception {\n        assertTrue(match(\"Kad'afi\"));\n    }\n}"
  },
  {
    "path": "23-android-part1/README.md",
    "content": "Building An Android Application To Track Missing Kids Part 1\n-----\n\nYesterday, I read an article which talked about an alarming issue of missing children in India. Every year more than 100,000 kids go missing in India. Some of these kids are kidnapped for ransom, some are sexually assaulted and then murdered, some are made traffic light beggars, and some are put into human trafficking. So, I thought about building an application that can help track and locate missing kids. The idea of app is that if you see a kid at places like traffic lights or at other unwanted places then you should take their picture using the app. The application will capture the photo and kid's geolocation and share it with the backend. This data will then be matched against the missing kid reports submitted by parents. If possible match is found then parents will be notified.\n\nI understand that I can't build the full application over one weekend so I will be working on the application throughout June and July. I will write blogs covering different aspect of building an Android application. I am new to Android app development so we will go step by step. This week we will focus on capturing photo, storing photo in an album, and finally showing the captured photo for preview.\n\n> **If you are interested in working on this app with me, then please send me an email at <a href=\"mailto:shekhargulati84@gmail.com\">shekhargulati84@gmail.com</a>. The source code for the application is not yet open source but I plan to make project open source it in near future. I am building this application as part of my [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series.**\n\n\n## Missing Kid Tracker Application\n\nIn this tutorial, we will develop an app called **Missing Kid Tracker** that will be used to report and track missing kids. Today, we will only cover photo capturing capability of the application. Like any camera application, this application will enable users to capture photos, save them to an album, and finally upload them to the backend servers.\n\n## Prerequisite\n\nBefore we get started with Android application development. You need following installed on your machine:\n\n1. Your machine should have JDK 6 or above installed.\n\n2. Download and install [Android Studio](https://developer.android.com/studio/index.html) for your operating system. Please refer to documentation for more [information](https://developer.android.com/training/basics/firstapp/index.html).\n\nLet's get started now!\n\n## Step 1: Create an Android Studio Project\n\nLaunch the Android Studio application. You will see a page as shown below. Click on `Start a new Android Studio Project` to create a new application.\n\n![](images/start-a-new-project.png)\n\nNext, you will be asked to configure your project. You will be asked to provide value for following fields:\n\n1. **Application name**: This is the name of your android application. Application will be installed on user device with this name.\n2. **Company domain**: This qualifier is reverse domain name. Before releasing your app on play store, you have to make sure that you are referring to your own valid domain.\n3. **Package name**: This is fully qualified name for your android project. The default value is equal to concatenation of `Application Name` and `Company Domain`.\n4. **Project location**: A convenient location on your file system where you want to house source code for your application.\n\n![](images/configure-your-new-project.png)\n\nAfter entering the details, please press `Next` button.\n\nNow, you will have to select the devices that can run your app. As our application is only for `Phone and Tablet` so we only selected that option. The `Minimum SDK` field is used to specify the minimum Android SDK version that your app will run on. We selected `API 10: Android 2.3.3 (Ginderbread)` as the minimum version that our application will work. Now, we will have to make sure in our app that we handle API incompatibilities in our application code. There may be some features that are only available in latest release of Android SDK.\n\n![](images/select-target-devices.png)\n\nPlease press `Next` to navigate to the next screen. Now, you will be asked to create an Activity. Activity is a single, focussed thing a user can do. You can have one or more activities in your application. Select `Empty Activity` and press `Next`.\n\n![](images/add-an-activity.png)\n\nIn the final screen of project creation wizard, you will be asked to `Customize the Activity`. You can use the default options and press `Finish` button.\n\n![](images/customize-activity.png)\n\nYou can now run the application either in the emulator or on the real device using the USB data cable. I find emulator slow and cumbersome to work so I prefer a real device. To run the application, press the `Run` button as shown below.\n\n![](images/run-app.png)\n\nYou will be asked to select the device on which you want to run the application. Here, you can either choose the real device or an emulator. I will select my Samsung mobile and press `OK`. To use the same device for future launches, you should check the `Use same selection for future launches` checkbox.\n\n![](images/select-deployment-target.png)\n\nThis will launch the application on your target deployment screen.\n\n<img src=\"images/hello-world-app.png\" height=\"300\" width=\"200\"></img>\n\nAndroid Studio makes use of Gradle and Android Debug Bridge (or adb) to perform deployment. Gradle is the build tool for Android application development. Like any build tool, it provide tasks that perform actions on user behalf. When you press the `run` button, Android Studio asks Gradle to run `:app:generateDebugSources, :app:prepareDebugUnitTestDependencies, :app:mockableAndroidJar, :app:generateDebugAndroidTestSources` tasks. Gradle will generate an application package `app-debug.apk` and will put that in the `app/build/outputs/apk` directory. APK or Android Package is an archive file that contains your application source code and resource files. It ends with an `.apk` extension. After `apk` file is generated, Android Studio will use `adb` command-line tool to push the `apk` to the Android device and then start the application. You can see the output of these commands in the `Run` view console.\n\n```\n06/11 19:25:16: Launching app\n$ adb push ~/MissingKidTracker/app/build/outputs/apk/app-debug.apk /data/local/tmp/com.shekhargulati.missingkidtracker\n$ adb shell pm install -r \"/data/local/tmp/com.shekhargulati.missingkidtracker\"\n\tpkg: /data/local/tmp/com.shekhargulati.missingkidtracker\nSuccess\n\n\n$ adb shell am start -n \"com.shekhargulati.missingkidtracker/com.shekhargulati.missingkidtracker.MainActivity\" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER\nConnected to process 4001 on device samsung-gt_i9500-xxxx\n```\n\n## Step 2: Understanding the generated code\n\nIn step 1, you created a skeleton application using the Android Studio. Now, we will understand the purpose of some of the important generated files.\n\n* **AndroidManifest.xml**: This is the file that Android system interacts to understand about your application. The `AndroidManifest.xml` is used to declare the activity that will be launched when your application will start up. It is also used to declare any features or permissions that your application might need. In our application, we will declare that we need camera feature and require permission to save photos. All the activities must be declared in the `AndroidManifest.xml`. The generated `AndroidManifest.xml` looks like as show below.\n\n\t```xml\n\t<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\t<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n\t    package=\"com.shekhargulati.missingkidtracker\">\n\n\t    <application\n\t        android:allowBackup=\"true\"\n\t        android:icon=\"@mipmap/ic_launcher\"\n\t        android:label=\"@string/app_name\"\n\t        android:theme=\"@style/AppTheme\">\n\t        <activity android:name=\".MainActivity\">\n\t            <intent-filter>\n\t                <action android:name=\"android.intent.action.MAIN\" />\n\n\t                <category android:name=\"android.intent.category.LAUNCHER\" />\n\t            </intent-filter>\n\t        </activity>\n\t    </application>\n\n\t</manifest>\n\t```\n\n\tIn the XML shown above, `application` tag is used to declare application specific configuration like app icon, name, etc. You can read more about all the application element in the [documentation](https://developer.android.com/guide/topics/manifest/application-element.html). An application is composed of different components like activities. So, all the activities are declared inside the `application` element using the `activity` tag. The `android.name` attribute is used to define the name of Activity. The `intent-filter` allows developer to declare how other application components may activate it. From the [documentation](https://developer.android.com/guide/components/activities.html),\n\n\t> **When you create a new application using the Android SDK tools, the stub activity that's created for you automatically includes an intent filter that declares the activity responds to the \"main\" action and should be placed in the \"launcher\" category.**\n\n\n* **MainActivity.java**: Activities are one of the most important component of an Android application. They represent a single screen with a user interface. `MainActivity` is the entry point into the application. The \"Main\" in the activity name signifies that it is the activity that will be presented to the user when they will launch an application. Calling this activity `MainActivity` is just a convention, you can name it anything you want. When Android OS launches an application, it looks at the application `AndroidManifest.xml`  for the declaration of the main activity. If you look at `AndroidManifest.xml`, you will find the declaration.\n\n\t```xml\n\t<activity android:name=\".MainActivity\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n\t```\n\n \tIn our application, we will have activities for different use cases. For example, MainActivity will be responsible for showing listing of missing kids, another activity to send data to backend, and another activity for filing missing child reports.\n\n\tAll activities are subtypes of `Activity` class provided by the Android SDK. The `MainActivity` is a sub class of special type `Activity` class called `AppCompatActivity`. This allows MainActivity to use action bar features. If you replace `AppCompatActivity` with `Activity` then your `MainActivity` will not have an action bar.\n\n\tAll activities must override `onCreate` method to set the content view using the `setContentView` method. This callback method is called by the system when your activity is being created. In the code generated by Android Studio, `MainActivity` overrides `onCreate` method and sets the layout specified in `activity_main.xml` using the `setContentView` method.\n\n\t ```java\n\t @Override\nprotected void onCreate(Bundle savedInstanceState) {\n\t\tsuper.onCreate(savedInstanceState);\n\t\tsetContentView(R.layout.activity_main);\n}\n\t ```\n\n* **activity_main.xml**: This XML file represents the layout of your activity. Using XML layout file is considered better design practice as they help keep user interface and business logic concerns separate. [Separation of concerns](https://en.wikipedia.org/wiki/Separation_of_concerns) is a design principle that leads to clean design.  The file contains some default interface elements from the material design library, including the app bar and a floating action button. It also includes a separate layout file with the main content.\n\n* **build.gradle**: Android Studio uses Gradle to compile and build your app. There is a `build.gradle` file for each module of your project, as well as a `build.gradle` file for the entire project. You can learn more about Gradle in the [documentation](https://developer.android.com/studio/build/index.html).\n\n## Step 3: Adding menu\n\nAndroid has inbuilt support for menus. We will add an [option menu](https://developer.android.com/guide/topics/ui/menus.html#options-menu) that will show the main action of our application i.e. `Take Photo`.\n\nMenu are added in the menu resource files. Create a new directory called `menu` inside the `res`. Inside the `menu` directory, create a new XML file `main_menu.xml`. Shown below are the contents of `main_menu.xml` file.\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\">\n\n</menu>\n```\n\nThe `menu` XML tag is used to define a container for menu items.  \n\nMenu is composed of items or groups. An item represent a single action in your menu. A group allows you to group items into categories so that they share properties such as active state and visibility.\n\nLet's add an item to our menu for `Take Photo` action.\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\">\n    <item\n        android:id=\"@+id/menu_take_photo\"\n        android:title=\"@string/menu_take_photo\"\n        app:showAsAction=\"ifRoom\">\n    </item>\n</menu>\n```\n\nIn the XML snippet shown above, we added an `item` tag with following attributes:\n\n1. `android:id`: A unique resource id of the item.\n2. `android:title`: A string describing purpose of the item. We are using strings resource to define the title.\n3. `app:showAsAction`: This is used to specify when and how this item should appear as an action in the app bar. The valid values are: `always`, `collapseActionView`,`ifRoom`, `never`, `withText`.  We are using `ifRoom` as the value. This means place this item in the app bar if there is room for it. You can read more about these values in the [documentation](https://developer.android.com/guide/topics/resources/menu-resource.html).\n\nUpdate the `strings.xml` to define a property `menu_take_photo` with the value `Take Photo` as shown below.\n\n```xml\n<resources>\n    <string name=\"app_name\">MissingKidTracker</string>\n    <string name=\"menu_take_photo\">Take Photo</string>\n</resources>\n```\n\nRather than manually adding a string value resource to `strings.xml`, you can use Android Studio shortcuts to create a property as well. Navigate to `android:title` and press `option+enter` on Mac  or `alt+enter` on Windows, this will open a menu where you can select your action. As we want to create a new string value resource so we will select that.\n\n![](images/add-string-resource.png)\n\nOnce selected, it will open a popup asking you to provide value for `menu_take_photo` string value resource. Enter `Take Photo` as value and press `OK`.\n\n![](images/string-resource-popup.png)\n\nTo add menu to the `MainActivity`, you have to override the `onCreateOptionsMenu` method as shown below.\n\n```java\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n    MenuInflater menuInflater = getMenuInflater();\n    menuInflater.inflate(R.menu.main_menu, menu);\n    return true;\n}\n```\n\nIn the code shown above, you use `MenuInflater` to fill your menu resource in the `Menu` provided in the callback.\n\nRun the application code to see your menu in action. The overflow button on right will show the menu.\n\n<img src=\"images/menu.png\" height=\"300\" width=\"200\"></img>\n\nIf you will click on the overflow button, then you will see `Take Photo` menu item as shown below.\n\n<img src=\"images/take-photo-menu-option.png\" height=\"300\" width=\"200\"></img>\n\n\n## Step 4: Taking photo when user clicks `Take Photo` menu item\n\nNow, that we have integrated menu in our application let's add photo taking capabilities to our application. When a user click `Take Photo`, then we should launch the camera application. To handle menu item clicks, you have to override `onOptionsItemSelected` method as shown below.\n\n```java\n@Override\npublic boolean onOptionsItemSelected(MenuItem item) {\n    switch (item.getItemId()) {\n        case R.id.menu_take_photo:\n            takePhoto();\n            return true;\n        default:\n            return super.onOptionsItemSelected(item);\n\n    }\n}\n\nprivate void takePhoto() {\n\n}\n```\n\nIn the code shown above, if a user selected a `menu_take_photo` menu item then we will call the `takePhoto` method. The `takePhoto` method is responsible for taking photo using the Camera app.\n\nTo use the camera app, we will have to tell Android that we would like to use it. This is done by adding `uses-feature` tag in the `AndroidManifest.xml` as shown below. We used `android.hardware.camera` feature and marked it required. By declaring features in the manifest file, you allow app stores like Google Play Store to not allow installation on devices that do not support the feature. For example, as we have marked `android.hardware.camera` as a required feature our application Google app store will only show our application to users whose mobile has camera features.\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.shekhargulati.missingkidtracker\">\n\n    <uses-feature android:name=\"android.hardware.camera\" android:required=\"true\"/>\n    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />\n\n<!-- Rest is removed for brevity. Please add uses-feature to full xml.-->\n\n</manifest>\n```\n\nNow, we will write code in the `takePhoto` method. To take a photo, we will call the Camera application using the Android feature called `Intent`. Intent allows us to start one component from another component. You can use them to start components from the same app or different app(just like we are starting a Camera app from within our app).\n\n```java\nstatic final int REQUEST_IMAGE_CAPTURE = 1;\npublic static final String IMAGE_EXTENSION = \".jpg\";\nprivate String capturedPhotoPath;\n\nprivate void takePhoto() {\n    final String tag = getString(R.string.app_name);\n    final Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);\n    if (takePictureIntent.resolveActivity(getPackageManager()) != null) {\n        try {\n            final String albumName = getString(R.string.app_name);\n            final String galleryPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath();\n            final String albumPath = galleryPath + File.separator + albumName;\n            File albumDir = new File(albumPath);\n            if (!albumDir.isDirectory() && !albumDir.mkdirs()) {\n                Log.e(tag, String.format(\"Unable to create album directory at [%s]\", albumPath));\n                return;\n            }\n            File image = File.createTempFile(getImageName(), IMAGE_EXTENSION, albumDir);\n            capturedPhotoPath = image.getAbsolutePath();\n            takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image));\n            startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);\n\n        } catch (IOException e) {\n            Log.e(tag, \"Exception encountered while creating file for storing image\", e);\n        }\n    }\n}\n\nprivate String getImageName() {\n    return \"IMG-\" + new SimpleDateFormat(\"yyyyMMdd-HHmmss\").format(new Date()) + \"-\"; //import class from java.util\n}\n```\n\nNow, rerun the application. When you will click on the `Take Photo` button camera application will be launched and you will be able to take photo. So, far we have not written code to save the photo so when you will press `Save` button after taking photo it will be lost and you will be shown the application view.\n\n\n## Step 5: Saving and restoring activity state\n\nWhen you take photo, Android launches another activity to take a photo and stops the `MainActivity` activity . After taking photo, you will be working with new activity. If you store the state in an instance variable then that state will be lost as you will working with new activity instance. To overcome this issue, you will have to override two methods -- `onSaveInstanceState` and `onRestoreInstanceState`.\n\n\n```java\n@Override\nprotected void onSaveInstanceState(Bundle outState) {\n    SharedPreferences.Editor editor = getPreferences(MODE_PRIVATE).edit();\n    editor.putString(\"capturedPhotoPath\", capturedPhotoPath);\n    editor.commit();\n    super.onSaveInstanceState(outState);\n}\n\n@Override\nprotected void onRestoreInstanceState(Bundle savedInstanceState) {\n    SharedPreferences settings = getPreferences(MODE_PRIVATE);\n    capturedPhotoPath = settings.getString(\"capturedPhotoPath\", \"\");\n    super.onRestoreInstanceState(savedInstanceState);\n}\n```\n\n## Step 6: Saving pic to gallery\n\nSo far we can take photo but captured photo is not yet persisted. After photo is taken, `onActivityResult` method will be called. This will contain the result of your action. You can now save the photo to a new album.\n\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    final String tag = getString(R.string.app_name);\n    if (resultCode == RESULT_OK) {\n        Log.d(tag, String.format(\"Photo is successfully saved to [%s]\", capturedPhotoPath));\n        addPicToGallery();\n        setPic();\n    }\n}\n\nprivate void addPicToGallery() {\n    Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);\n    File f = new File(capturedPhotoPath);\n    Uri contentUri = Uri.fromFile(f);\n    mediaScanIntent.setData(contentUri);\n    this.sendBroadcast(mediaScanIntent);\n}\n\nprivate void setPic() {\n\n}\n```\n\n\n## Step 8: Set pic for preview\n\nLast thing we have to do is to set the content of captured photo in the ImageView so that we can preview it. To preview an image, we will update our activity layout to show an image using ImageView as shown below.\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n    android:paddingTop=\"@dimen/activity_vertical_margin\"\n    tools:context=\"com.shekhargulati.missingkidtracker.MainActivity\">\n\n    <ImageView\n        android:id=\"@+id/image_preview\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:adjustViewBounds=\"true\"\n        android:scaleType=\"center\"\n        android:visibility=\"visible\" />\n</RelativeLayout>\n```\n\n```java\nprivate void setPic() {\n    final String tag = getString(R.string.app_name);\n    try {\n        ImageView imageView = (ImageView) this.findViewById(R.id.image_preview);\n        imageView.setVisibility(View.VISIBLE);\n        final BitmapFactory.Options opt = new BitmapFactory.Options();\n        opt.inSampleSize = 2;\n        opt.inJustDecodeBounds = false;\n        Bitmap bitmap = BitmapFactory.decodeFile(capturedPhotoPath, opt);\n        imageView.setImageBitmap(bitmap);\n    } catch (Exception e) {\n        Log.e(tag, \"Error encountered while doing image preview\", e);\n    }\n}\n```\n\n----\n### Handling configuration changes on Samsung phones\n\nUpdate the `AndroidManifest.xml` to handle configuration changes.\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.shekhargulati.missingkidtracker\">\n\n    <uses-feature android:name=\"android.hardware.camera\" android:required=\"true\"/>\n    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />\n\n    <application\n        android:allowBackup=\"true\"\n        android:icon=\"@mipmap/ic_launcher\"\n        android:label=\"@string/app_name\"\n        android:supportsRtl=\"true\"\n        android:theme=\"@style/AppTheme\">\n        <activity android:name=\".MainActivity\" android:configChanges=\"orientation|screenSize\">\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\" />\n\n                <category android:name=\"android.intent.category.LAUNCHER\" />\n            </intent-filter>\n        </activity>\n    </application>\n\n</manifest>\n```\n\n-----\n\nAfter making these changes if you will capture the photo then you will find that images are tilted by 90 degrees. It is an old Android `Image Rotated by 90 degrees` bug. This is a pic that I took.\n\n<img src=\"images/captured-photo-90-degree-bug.png\" height=\"300\" width=\"200\"></img>\n\n\n## Step 9: Fixing the image preview\n\nTo fix the image preview, you would have to use `ExifInterface` to rotate the image based on orientation. I used answer mentioned in the [stackoverflow post](https://stackoverflow.com/questions/29971319/image-orientation-android/32747566#32747566).\n\n```java\nprivate void setPic() {\n    final String tag = getString(R.string.app_name);\n    try {\n        ImageView imageView = (ImageView) this.findViewById(R.id.image_preview);\n        imageView.setVisibility(View.VISIBLE);\n        Bitmap bitmap = createScaledBitmap(capturedPhotoPath);\n        imageView.setImageBitmap(bitmap);\n    } catch (Exception e) {\n        Log.e(tag, \"Error encountered while doing image preview\", e);\n    }\n}\n\npublic Bitmap createScaledBitmap(String pathName) throws IOException {\n    final BitmapFactory.Options opt = new BitmapFactory.Options();\n    opt.inSampleSize = 2;\n    opt.inJustDecodeBounds = false;\n    Bitmap bitmap = BitmapFactory.decodeFile(pathName, opt);\n    File file = new File(capturedPhotoPath);\n    Bitmap rotatedBitmap;\n    ExifInterface exif = new ExifInterface(file.getPath());\n    int rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);\n    int rotationInDegrees = exifToDegrees(rotation);\n    Matrix matrix = new Matrix();  //import this class from android.graphics\n    if (rotation != 0f) {\n        matrix.preRotate(rotationInDegrees);\n    }\n    rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);\n    return rotatedBitmap;\n}\n\nprivate static int exifToDegrees(int exifOrientation) {\n    if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {\n        return 90;\n    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {\n        return 180;\n    } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {\n        return 270;\n    }\n    return 0;\n}\n```\n\nNow, if you will run your app and take a photo it will be shown correctly.\n\n\n<img src=\"images/preview.jpg\" height=\"300\" width=\"200\"></img>\n\n## Note\n \n \nTo avoid importing the wrong classes, please look carefully at the comment beside some of the codes.  Android Studio will correctly import most of the classes automatically but incases where there are multiple choices, the correct package containing the class is written as comment behind that class. \n\n<img src=\"http://i.imgur.com/Ffsqlhy.png\"></img>\n\n\n------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/29](https://github.com/shekhargulati/52-technologies-in-2016/issues/29).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/23-android-part1)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "24-jekyll-to-wordpress/README.md",
    "content": "Saved My Ass: Moving back to WordPress from Jekyll\n----------\n\nWelcome to week 24 of [52-technology-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I will share how I moved my organization's official blog from Jekyll to WordPress. A year back, I had moved the official blog from WordPress to Jekyll because I wanted to define the blog publishing workflow. I wanted to apply the pull request based workflow to blog publishing. The idea was simple - write a blog, raise a pull request, get it reviewed (for grammar and other content related feedback), incorporate changes, and finally a blog administrator would press the merge button and the blog will be published. Being a programmer, this all made sense to me. Our organization mainly consists of programmers so it made sense to have developer oriented workflow.\n\nAs it turned out, it was not a wise decision by me and we decided to move back to WordPress. In this blog, I will share my experience and learnings that I had during this process. **To me, it was like a software project that went wrong because you had decided to rewrite an existing software project. Rewrites are always costly and most of the time they don't deliver the business value that one expects**.\n\n## Issues with WordPress blog back then\n\nThere were a lot of issues with the WordPress blog so I decided to move it to a free of cost Github Pages hosting. Some of the issues were:\n\n1. We were running WordPress on an old machine which went down every few days. There was no monitoring system so we were not even aware if the blog was down for days.\n2. It was very slow. Some requests would take more than a minute to give a response.\n3. It was spammed heavily. Some of the blogs were injected with viagra text snippets.\n4. Layout and theme were not good so it didn't look professional.\n\n> **All these issues could have been easily solved by buying a good theme and hosting WordPress on a commercial provider. It could have cost a bit, but it would have worked great.**\n\n## Move to Jekyll\n\nIn January 2015, we had a company-wide hackathon and I decided to work on migrating WordPress blog to Jekyll. The goal was to get a simple Jekyll-based blog running over the weekend and if everyone liked then we will move ahead and replace the existing blog. Jekyll has a pretty [good documentation](https://import.jekyllrb.com/docs/wordpressdotcom/) on migrating WordPress site. In short, you export the WordPress data using the WordPress's inbuilt export functionality. Then you give the exported XML to Jekyll importer which does the magic of generating a Jekyll site from the XML.\n\n```bash\n$ ruby -rubygems -e 'require \"jekyll-import\";\n    JekyllImport::Importers::WordpressDotCom.run({\n      \"source\" => \"wordpress.xml\",\n      \"no_fetch_images\" => false,\n      \"assets_folder\" => \"assets\"\n    })'\n```\n\nI had to fix some pages manually but most of the site was generated fine. The only thing that left was to customize the default theme so that it looks good and professional. I am not a UI guy so I decided to buy a relatively cheap theme and use it.\n\n## Releasing it to the world\n\nIn a week or so I gave a session on how to use the new blog and wrote a pretty detailed step by step manual for publishing a blog. The reason for writing a detailed manual was to make it easy for people who are not comfortable with Git and Github way of working. I even wrote a `Dockerfile` so that people can run blog in a Docker container. This would allow them to preview their changes easily. These were the steps I had mentioned in the document.\n\n```text\n1. Fork the Github repository. You need to fork the repository because you don't have write access to this repository.\n2. After forking blog repository, you will have your own repository under your Github account. Private repositories remain private even after forking.\n3. Clone your repository on your local machine using Git.\n4. Change directory to blog and then checkout the source branch. Please make sure you are on source branch.\n5. Create a new markdown file in the `_posts` directory. The name of the file should have `YYYY-MM-dd-blog-slug.md` format. You only have to worry about `_posts` directory.\n6. Open the Markdown file in your favorite editor. I(Shekhar) recommend Atom. You can download it from http://atom.io/.\n7. Write your new blog following Markdown syntax.\n8. Once you have written your blog, commit the blog to your local git repository and then push the changes to your own Github repository.\n9. Create a new pull request for your new blog. Make sure to use source branch for both your github repository and official github repository. You can either use github web interface or just open the mentioned link in your favorite browser. Please replace `github_username` with your own github username.\n10. Create a new pull request by pressing the `Create pull request` button.\n11. After you have created pull request, blog review team will receive a notification via email and also on their Github dashboard that a new blog pull request is received.\n```\n\nOnce I explained the process I asked people if they liked it. I received no response. I remember someone said `\"Isn't it too complicated?\"`. My answer was as they are not used to it so they are finding it complicated once they start using it they will feel home. In my mind, it was an opportunity to learn something new so I went ahead with the new blog.\n\n## Jekyll blog in the wild\n\nThe move to Jekyll didn't work well and people stopped blogging. During this process, I learned a lot about the limitations of static generated websites and came to a conclusion that you should not go this route until you really want to spend a lot of time writing code for simplest of use cases. Some of these limitations might be specific to Jekyll but most will apply to all.\n\n1. People want to write blogs not learn new technologies that can help them write blogs. Learning Markdown, Jekyll, Git is too much for most people even developers. **Simple things should remain simple.**\n\n2. There is no easy way to automatically send notifications via social networks or email once the blog is published. You have to write code that can send notifications.\n\n3. Process or workflows restrict people to do their job. I found that I became the bottleneck for everything. People were not comfortable publishing blogs so I had to do it. As this was not my priority most of the time, so blogs remain as PR sometime for more than a month.\n\n4. Jekyll is very slow. It takes around 4 minutes to generate the whole site. We have close to 550 blogs.\n\n5. There is no support for scheduling blogs. You have to write your own custom code to do that.\n\n6. Compared to WordPress, Jekyll lacks quality plugins so you will end up writing Ruby code.\n\n7. You don't have comments support in a static website. You can use service like Disqus to integrate an external commenting system. The problem is to notify the author of the post. Disqus will only send notifications to the registered emails.\n\n8. Github Pages hosting does not allow you to install plugins except the default supported by it. This means you have to generate full HTML static website and push that to Github.\n\n## Going back to WordPress\n\nFinally, it was decided that we should move the blog back to WordPress. You must be thinking Why Wordpress? We thought about a couple of options -- hosting on Medium.com and WordPress. We went with WordPress because we have developers who understand WordPress and they can quickly get a WordPress blog running. I was asked to provide database backup of the existing blog. When I migrated the blog to Jekyll I returned the existing machine used for WordPress blog to the IT team of our office. They decided to format it as well as the database backup system as they thought we will never need it. So, we were left with only static website :(\n\nSo, now we have to somehow create WordPress site from the static website. I found following options:\n\n1. Use ruby [wayback](https://github.com/hartator/wayback-machine-downloader) gem to download the full site from [Internet archive](https://archive.org/index.php). Then, import generated HTML into WordPress. This option didn't work because most of the pages downloaded by this gem were nothing more than 404 pages.\n\n2. Use a paid tool like http://waybackdownloader.com/ that downloads the content from the Internet Archive. This could be an option if nothing works but you have to shelve $30-$40.\n\n3. Another option was to import URLs using the [easy grabber](https://wordpress.org/plugins/easy-grabber/) plugin. I couldn't get this plugin to work.\n\n4. Last option was to generate RSS feed of the static website and then import RSS feed into a WordPress blog using RSS importer blog. This was the option I went with and it worked like a charm.\n\nNow, I will walk through how I generated WordPress export XML using the static website feed.\n\n### Step 1: Enable RSS feed for your site\n\nOur blog already had RSS feed integration so this step was not required. If your blog does not have the RSS feed then there are two options -- either use Liquid or a Jekyll plugin. You can learn more about enabling RSS feed for your blog in the [documentation](http://jekyll.tips/jekyll-casts/rss-feed/). We were using Liquid approach. You need to have `feed.xml` at the blog root as shown below.\n\n```xml\n---\nlayout: null\n---\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n  <channel>\n    <title>{{ site.title | xml_escape }}</title>\n    <description>{{ site.description | xml_escape }}</description>\n    <link>{{ site.url }}{{ site.baseurl }}/</link>\n    <atom:link href=\"{{ \"/feed.xml\" | prepend: site.baseurl | prepend: site.url }}\" rel=\"self\" type=\"application/rss+xml\" />\n    <pubDate>{{ site.time | date_to_rfc822 }}</pubDate>\n    <lastBuildDate>{{ site.time | date_to_rfc822 }}</lastBuildDate>\n    <generator>Jekyll v{{ jekyll.version }}</generator>\n    {% for post in site.posts limit:10 %}\n      <item>\n        <title>{{ post.title | xml_escape }}</title>\n        <description>{{ post.content | xml_escape }}</description>\n        <pubDate>{{ post.date | date_to_rfc822 }}</pubDate>\n        <link>{{ post.url | prepend: site.baseurl | prepend: site.url }}</link>\n        <guid isPermaLink=\"true\">{{ post.url | prepend: site.baseurl | prepend: site.url }}</guid>\n        {% for tag in post.tags %}\n        <category>{{ tag | xml_escape }}</category>\n        {% endfor %}\n        {% for cat in post.categories %}\n        <category>{{ cat | xml_escape }}</category>\n        {% endfor %}\n      </item>\n    {% endfor %}\n  </channel>\n</rss>\n```\n\nNow, if you run Jekyll using `jekyll serve`, you will see feed at [http://localhost:4000/feed.xml](http://localhost:4000/feed.xml).\n\n### Step 2: Download feed of the entire website\n\nThe default `feed.xml` configuration will only generate a feed for 10 blogs as we have limited that in the feed.xml.\n\n```\n{% for post in site.posts limit:10 %}\n```\n\nWordPress feed importer does not allow you to upload feed.xml more than 2 MB in size. If your site content is less than 2MB then you can change the limit to the blog count and you will be done. Our blog content was close to 10MB so we had to generate feed iteratively. To generate a feed of first five hundred blogs in a batch of 100, you can use `limit` and `offset` as shown below.\n\n```\n{% for post in site.posts limit:100 offset 0 %}\n{% for post in site.posts limit:200 offset 100 %}\n{% for post in site.posts limit:300 offset 200 %}\n{% for post in site.posts limit:400 offset 300 %}\n{% for post in site.posts limit:500 offset 400 %}\n```\n\nYou can use `wget` to download the feed.xml\n\n```bash\n$ wget http://localhost:4000/feed.xml\n```\n\n> **After changing the limit and offset, you would have to generate static website again so that feed.xml is generated.**\n\n### Step 3: Running WordPress locally\n\nNow that I have a full website feed, I need to import them into a WordPress blog. I decided to run WordPress locally in Docker containers. When you will Google `Docker wordpress`, the second link will be [Quickstart: Docker Compose and WordPress](https://docs.docker.com/compose/wordpress/). This is the official quickstart by Docker. I never expected that official quickstart will not work. The reason for failure is that Docker Compose does not link WordPress and MySQL containers so you get `MySQL Connection Error: (2002) Connection refused` error in the logs.\n\nSo, I decided to go the manual route of running WordPress in Docker container. To run WordPress, run the following commands. We will first create a docker machine and then run the `docker run` commands to start wordpress and mysql containers.\n\n```bash\n$ docker-machine create --driver virtualbox blog\n$ docker-machine env blog\n$ eval $(docker-machine env blog)\n$ docker run --name db -v data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=password -d mysql:5.7\n$ docker run --name blog --link db:mysql -p 8000:80 -d wordpress:latest\n```\n\nNow, you can access blog at `http://MACHINE_IP:8000`. You can get machine ip by running `docker-machine ip blog` command. The output of `docker ps` command is shown below.\n\n```bash\n$ docker ps\n```\n```\n→ docker ps\nCONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES\n77578726b64b        wordpress:latest    \"/entrypoint.sh apach\"   2 minutes ago       Up 1 seconds        0.0.0.0:8000->80/tcp   blog\nef2a70e40c22        mysql:5.7           \"docker-entrypoint.sh\"   2 minutes ago       Up 10 seconds       3306/tcp              db\n```\n\n### Step 4: Configure WordPress\n\nNext, when you go to `http://MACHINE_IP:8000` you will go through WordPress installation instructions. Once done, login into `wp-admin`.\n\n### Step 5: Import feed\n\nLogin to `wp-admin` and then go to **Tools**. Under `Tools`, go to `Import` as shown below.\n\n![](images/import-wordpress.png)\n\nYou will see import screen with all the import options. Click on the RSS.\n\n![](images/import-rss.png)\n\nClick on RSS and you will see a popup that will ask you to install the plugin. Press the `Install Now` button. Once plugin is installed, click the `Activate Plugin and Run Importer`.\n\n![](images/activate-importer.png)\n\nNow, you can import RSS feed one by one by uploading the feed.xml.\n\n![](images/run-importer.png)\n\nOnce imported all the posts will be public and you will be able to see them in WordPress blog. There are a couple of issues after the import -- 1) It does not create author profiles so all the blogs will be published under administrator user 2) Images will not be imported. Both these could be automated as well. You can write a script that finds all the unique author names in the feed.xml and then using WordPress API, create them. To handle images, you have to do simple find and replace. Replace `src=&quot;/` with `src=&quot;http://blog_url/`. Replace `blog_url` with url of your static blog.\n\n### Step 6: Export WordPress XML\n\nOnce you are happy that all the content is cleanly uploaded into your local WordPress installation, you can take export of the data using the inbuilt export functionality of WordPress. Go to **Dashboard > Tools > Export** and click `Download Export File` button to export the data.\n\n![](images/export.png)\n\n\nNow you can share the exported XML with the team.\n\n------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/30](https://github.com/shekhargulati/52-technologies-in-2016/issues/30).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/24-jekyll-to-wordpress)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "25-angular-dragula/README.md",
    "content": "Trello Clone with Angular Dragula\n----\n\nWelcome to twenty-fifth blog of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I wanted to learn how to build a Trello like website. [Trello](https://trello.com/) is a web-based project management application that uses kanban philosophy to manage projects. In Trello, you have three main entities -- board, list, and card. A board is a collection of lists and list is a collection of cards. You can drag and drop cards on different lists. Below is a screenshot of a simple Trello board with three lists each having one card for your understanding.\n\n![](images/trello-board.png)\n\nIn this blog, we will only cover how to build a drag and drop list user interface. To build user interface of the application, I will use AngularJS along with Twitter Bootstrap. To achieve drag and drop functionality, we will use an [dragula](https://github.com/bevacqua/dragula), an open source JavaScript library to build drag and drop interfaces. We will use Angular Dragula, an Angular wrapper around Dragula. It provides directives that makes it very easy to use dragula in an Angular application.\n\n# Prerequisites\n\nTo follow along you will need following on your machine.\n\n1. Node.js : [Download](https://nodejs.org/en/download/) and install the latest version of node. At the time of writing, latest version was `6.2.2`.\n\n2. Install Yeoman, Gulp, and Bower: [Yeoman](http://yeoman.io/) is a scaffolding tool that you can use to scaffold modern web applications. We will use it to scaffold an Angular application. [Gulp](http://gulpjs.com/) is the modern build tool for JavaScript apps. [Bower](https://bower.io/) is a package manager that can manage client side dependencies for you. To install yeoman, execute the `npm install -g yo gulp bower` command.\n\nNow that we have installed all the prerequisites let's get started with app development.\n\n--------------------------------------------------------------------------------\n\n# Step 1: Scaffold Gulp Angular application\n\nWe will start with scaffolding an Angular Gulp application using the Swiip's [Yeoman generator](https://github.com/Swiip/generator-gulp-angular).\n\n```bash\n$ npm install -g generator-gulp-angular\n```\n\nAfter generator is installed, you can generate the application by typing the following command. Navigate to a convenient location on your filesystem and then run following commands.\n\n```\n$ mkdir trello && cd trello\n$ yo gulp-angular\n```\n\nYou will be asked a series of questions that will be used to setup your project according to your preferences.\n\nFirst, you will be asked to select AngularJS version. We will use version 1.5.\n\n![](images/yeoman-1.png)\n\nThen, you will be asked to select which all Angular modules you want in your application.\n\n![](images/yeoman-2.png)\n\nThen, you will be asked to select jQuery implementation. We will select Angular inbuilt `jgLite`.\n\n![](images/yeoman-3.png)\n\nNext, we will select inbuilt `$http` service for interacting with REST service.\n\n![](images/yeoman-4.png)\n\nNext, you will be asked to select router implementation. We will select none.\n\n![](images/yeoman-5.png)\n\nNext, we will select `Bootstrap` as our UI framework.\n\n![](images/yeoman-6.png)\n\nNext, we will be asked about Bootstrap components.\n\n![](images/yeoman-7.png)\n\nNext, you will be asked if you want to use CSS preprocessor. We will use plain old CSS.\n\n![](images/yeoman-8.png)\n\nLast question you will be asked is your choice of JS preprocessor. We will use `ES6 (Babel formerly 6to5), ECMAScript 6 compiled with Babel which requires no runtime.` as we would like to use ES6.\n\n![](images/yeoman-11.png)\n\n# Step 2: Run the application\n\nOnce application is scaffolded in step 1, we can run the application. To run the application, you will use gulp. We will use `serve` task of gulp. It will build the project and then start a simple HTTP server that will render contents of our web application.\n\n```bash\n$ gulp serve\n```\n\nThis will launch application in your default web browser at [http://localhost:3000](http://localhost:3000).\n\n![](images/yeoman-default-app.png)\n\n# Step 3: Update index.html to have three hard coded lists\n\nNow, we will update `src/index.html` so that it shows three lists. The content of the lists will be the technologies used by this generator. All the three lists will have the same content. We will change them later. Remove the `jumbotron` section and update main `div` as shown below.\n\n```html\n<div class=\"container\" ng-controller=\"MainController as main\">\n\n  <div class=\"row\">\n\n    <div class=\"col-sm-6 col-md-4\">\n      <h2 class=\"text-center\">Todo</h2>\n      <div ng-repeat=\"awesomeThing in main.awesomeThings | orderBy:'rank'\">\n        <div class=\"thumbnail\">\n          <img class=\"pull-right\" ng-src=\"assets/images/{{ awesomeThing.logo }}\" alt=\"{{ awesomeThing.title }}\">\n          <div class=\"caption\">\n            <h3>{{ awesomeThing.title }}</h3>\n            <p>{{ awesomeThing.description }}</p>\n            <p>\n              <a ng-href=\"{{awesomeThing.url}}\">{{ awesomeThing.url }}</a>\n            </p>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div class=\"col-sm-6 col-md-4\">\n      <h2 class=\"text-center\">In Progress</h2>\n      <div ng-repeat=\"awesomeThing in main.awesomeThings | orderBy:'rank'\">\n        <div class=\"thumbnail\">\n          <img class=\"pull-right\" ng-src=\"assets/images/{{ awesomeThing.logo }}\" alt=\"{{ awesomeThing.title }}\">\n          <div class=\"caption\">\n            <h3>{{ awesomeThing.title }}</h3>\n            <p>{{ awesomeThing.description }}</p>\n            <p>\n              <a ng-href=\"{{awesomeThing.url}}\">{{ awesomeThing.url }}</a>\n            </p>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div class=\"col-sm-6 col-md-4\">\n      <h2 class=\"text-center\">Done</h2>\n      <div ng-repeat=\"awesomeThing in main.awesomeThings | orderBy:'rank'\">\n        <div class=\"thumbnail\">\n          <img class=\"pull-right\" ng-src=\"assets/images/{{ awesomeThing.logo }}\" alt=\"{{ awesomeThing.title }}\">\n          <div class=\"caption\">\n            <h3>{{ awesomeThing.title }}</h3>\n            <p>{{ awesomeThing.description }}</p>\n            <p>\n              <a ng-href=\"{{awesomeThing.url}}\">{{ awesomeThing.url }}</a>\n            </p>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n\n</div>\n```\n\nAfter modifying `src/index.html`, changes will be synced and page will be refreshed as shown below.\n\n![](images/three-list-layout.png)\n\n# Step 4: Enable drag and drop with Angular Dragula\n\nNow, that we have three lists we will enable drag and drop feature using Angular Dragula. To use it, you have to first define its dependency in the `bower.json`. In the dependencies section, add a new line at the end that defines `angular-dragula` dependency as shown below. We are using the latest version of Angular Dragula i.e. `1.2.2`.\n\n```json\n\"dependencies\": {\n  \"angular-animate\": \"~1.5.3\",\n  \"angular-cookies\": \"~1.5.3\",\n  \"angular-touch\": \"~1.5.3\",\n  \"angular-sanitize\": \"~1.5.3\",\n  \"angular-messages\": \"~1.5.3\",\n  \"angular-aria\": \"~1.5.3\",\n  \"bootstrap\": \"~3.3.5\",\n  \"malarkey\": \"yuanqing/malarkey#~1.3.1\",\n  \"angular-toastr\": \"~1.5.0\",\n  \"moment\": \"~2.10.6\",\n  \"animate.css\": \"~3.4.0\",\n  \"angular\": \"~1.5.3\",\n  \"angular-dragula\":\"1.2.2\"\n}\n```\n\nNow, install the new module using `bower install` command.\n\nStop and start the app using `gulp serve`.\n\nOnce you have defined the dependency, you have to pass `angularDragula` to your angular module. In the `index.module.js`, declare dependency on `angularDragula` as shown below. `angularDragula` takes `angular` instance and uses it to register its own module, services, and directive.\n\n```javascript\nimport { config } from './index.config';\nimport { runBlock } from './index.run';\nimport { MainController } from './main/main.controller';\nimport { WebDevTecService } from '../app/components/webDevTec/webDevTec.service';\n\nangular.module('trello', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngMessages', 'ngAria', 'toastr', angularDragula(angular)])\n  .config(config)\n  .run(runBlock)\n  .service('webDevTec', WebDevTecService)\n  .controller('MainController', MainController)\n```\n\nNext, you have to modify `src/index.html` to use `dragula` directive. Update all the divs with ng-repeat as shown below. The `dragula` directive groups container together so that you can drag and drop elements among them. Make sure the value of `dragula` directive is same i.e. `bag` in our case. If lists have different `dragula` directive values then you will not be able to drop elements to them. The `dragula-scope` directive is used to pass the scope you want the bag to be stored on. This is required when you are using `ng-repeat` as `ng-repeat` creates a new isolated scope which causes issues when you are trying to drag items among multiple containers.\n\n```html\n<div dragula='\"bag\"' ng-repeat=\"awesomeThing in main.awesomeThings | orderBy:'rank'\" dragula-scope=\"$parent\">\n```\n\nSave your changes. Now, you will be able to drag and drop elements across different lists.\n\n# Step 5: Using trello like data\n\nNow, we will change the code to use trello like data i.e. boards, lists, and tasks. We will start by updating `MainController` to use our new data model as shown below.\n\n```javascript\nexport class MainController {\n  constructor() {\n    'ngInject';\n\n    this.board = {\n      id: 1,\n      title: \"Test Board\",\n      lists: [{\n        id: 1,\n        name: \"Todo\",\n        cards: [{\n          id: 1,\n          title: \"Lean Go programming language\",\n          description: \"I want to learn Go so that I can build applications with it.\"\n        }, {\n          id: 2,\n          title: \"Finish Missing Kids Android application\",\n          description: \"Work on my Android application\"\n        }]\n      }, {\n        id: 2,\n        name: \"In Progress\",\n        cards: [{\n          id: 3,\n          title: \"Blog about Angular Dragula\",\n          description: \"Write week 25 blog on Angular Dragula\"\n        }]\n\n      }, {\n        id: 3,\n        name: \"Done\",\n        cards: [{\n          id: 5,\n          title: \"Blog about Jekyll to WordPress migration\",\n          description: \"Write week 24 blog on migrating from Jekyll to WordPress\"\n        }]\n      }]\n    }\n  }\n}\n```\n\nIn the code shown above, we have a board that contains three lists -- Todo, In Progress, and Done. Each list has a number of cards.\n\nWe will now update `index.html` so that it can work against the update code.\n\n```html\n<body>\n  <!--[if lt IE 10]> <p class=\"browsehappy\">You are using an <strong>outdated</strong> browser. Please <a href=\"http://browsehappy.com/\">upgrade your browser</a> to improve your experience.</p> <![endif]-->\n\n  <div class=\"container\" ng-controller=\"MainController as main\">\n    <div class=\"row\">\n      <div class=\"col-sm-6 col-md-4\" ng-repeat=\"list in main.board.lists\">\n        <h2 class=\"text-center\">{{list.name}}</h2>\n        <div id=\"list-{{list.id}}\" dragula='\"bag\"' ng-repeat=\"card in list.cards\" dragula-scope=\"$parent.$parent\" style=\"min-height: 10px;\">\n          <div id=\"card-{{card.id}}\" class=\"thumbnail\">\n            <div class=\"caption\">\n              <h3>{{ card.title }}</h3>\n              <p>{{ card.description }}</p>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </div>\n\n  // removed commented section for brevity.\n</body>\n```\n\nAfter making these changes, application will look like as shown below.\n\n<img width=\"450\" src=\"images/drag-and-drop-in-action.gif\">\n\n\n## Step 6: Performing action on drop\n\nNow, that you can drag and drop cards let's look at how we can perform action. Angular Dragula emits events that are replicated on the Angular `$scope`. Let's suppose we have to make a REST call to update the backend when a card is dropped on the list. We can subscribe to the drop event as shown below. To learn about all the events refer to the [documentation](https://github.com/bevacqua/dragula#drakeon-events).\n\n```javascript\nexport class MainController {\n  constructor($scope) {\n    'ngInject';\n\n    $scope.$on('bag.drop', function(e, el, target){\n      console.log(`Dropped ${el[0].id} on target ${target[0].id}`);\n    });\n    // removed for brevity\n  }\n}\n```\n\n----\n\nThat's all for this week. Please provide your feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/31](https://github.com/shekhargulati/52-technologies-in-2016/issues/31).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/25-angular-dragula)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "25-angular-dragula/trello/.bowerrc",
    "content": "{\n  \"directory\": \"bower_components\"\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/.editorconfig",
    "content": "# http://editorconfig.org\nroot = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n"
  },
  {
    "path": "25-angular-dragula/trello/.eslintrc",
    "content": "{\n  \"extends\": \"eslint:recommended\",\n  \"plugins\": [\"angular\"],\n  \"env\": {\n    \"es6\": true,\n    \"browser\": true,\n    \"jasmine\": true\n  },\n  \"ecmaFeatures\": {\n    \"modules\": true\n  },\n  \"globals\": {\n    \"angular\": true,\n    \"module\": true,\n    \"inject\": true\n  }\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/.gitignore",
    "content": "node_modules/\nbower_components/\ncoverage/\n.sass-cache/\n.idea/\n.tmp/\ndist/\n"
  },
  {
    "path": "25-angular-dragula/trello/.yo-rc.json",
    "content": "{\n  \"generator-gulp-angular\": {\n    \"version\": \"1.1.0\",\n    \"props\": {\n      \"angularVersion\": \"~1.5.3\",\n      \"angularModules\": [\n        {\n          \"key\": \"animate\",\n          \"module\": \"ngAnimate\"\n        },\n        {\n          \"key\": \"cookies\",\n          \"module\": \"ngCookies\"\n        },\n        {\n          \"key\": \"touch\",\n          \"module\": \"ngTouch\"\n        },\n        {\n          \"key\": \"sanitize\",\n          \"module\": \"ngSanitize\"\n        },\n        {\n          \"key\": \"messages\",\n          \"module\": \"ngMessages\"\n        },\n        {\n          \"key\": \"aria\",\n          \"module\": \"ngAria\"\n        }\n      ],\n      \"jQuery\": {\n        \"key\": \"jqLite\"\n      },\n      \"resource\": {\n        \"key\": \"$http\",\n        \"module\": null\n      },\n      \"router\": {\n        \"key\": \"noRouter\",\n        \"module\": null\n      },\n      \"ui\": {\n        \"key\": \"bootstrap\",\n        \"module\": null\n      },\n      \"bootstrapComponents\": {\n        \"key\": \"noBootstrapComponents\",\n        \"module\": null\n      },\n      \"cssPreprocessor\": {\n        \"key\": \"noCssPrepro\",\n        \"extension\": \"css\"\n      },\n      \"jsPreprocessor\": {\n        \"key\": \"babel\",\n        \"extension\": \"js\",\n        \"srcExtension\": \"es6\"\n      },\n      \"htmlPreprocessor\": {\n        \"key\": \"noHtmlPrepro\",\n        \"extension\": \"html\"\n      },\n      \"foundationComponents\": {\n        \"name\": null,\n        \"version\": null,\n        \"key\": null,\n        \"module\": null\n      },\n      \"paths\": {\n        \"src\": \"src\",\n        \"dist\": \"dist\",\n        \"e2e\": \"e2e\",\n        \"tmp\": \".tmp\"\n      }\n    }\n  }\n}"
  },
  {
    "path": "25-angular-dragula/trello/bower.json",
    "content": "{\n  \"name\": \"trello\",\n  \"version\": \"0.0.0\",\n  \"dependencies\": {\n    \"angular-animate\": \"~1.5.3\",\n    \"angular-cookies\": \"~1.5.3\",\n    \"angular-touch\": \"~1.5.3\",\n    \"angular-sanitize\": \"~1.5.3\",\n    \"angular-messages\": \"~1.5.3\",\n    \"angular-aria\": \"~1.5.3\",\n    \"bootstrap\": \"~3.3.5\",\n    \"malarkey\": \"yuanqing/malarkey#~1.3.1\",\n    \"angular-toastr\": \"~1.5.0\",\n    \"moment\": \"~2.10.6\",\n    \"animate.css\": \"~3.4.0\",\n    \"angular\": \"~1.5.3\",\n    \"angular-dragula\":\"1.2.2\"\n  },\n  \"devDependencies\": {\n    \"angular-mocks\": \"~1.5.3\"\n  },\n  \"overrides\": {\n    \"bootstrap\": {\n      \"main\": [\n        \"dist/css/bootstrap.css\",\n        \"dist/fonts/glyphicons-halflings-regular.eot\",\n        \"dist/fonts/glyphicons-halflings-regular.svg\",\n        \"dist/fonts/glyphicons-halflings-regular.ttf\",\n        \"dist/fonts/glyphicons-halflings-regular.woff\",\n        \"dist/fonts/glyphicons-halflings-regular.woff2\"\n      ]\n    }\n  },\n  \"resolutions\": {\n    \"angular\": \"~1.5.3\"\n  }\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/e2e/.eslintrc",
    "content": "{\n  \"globals\": {\n    \"browser\": false,\n    \"element\": false,\n    \"by\": false,\n    \"$\": false,\n    \"$$\": false\n  }\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/e2e/main.po.js",
    "content": "/**\n * This file uses the Page Object pattern to define the main page for tests\n * https://docs.google.com/presentation/d/1B6manhG0zEXkC-H-tPo2vwU06JhL8w9-XCF9oehXzAQ\n */\n\n'use strict';\n\nvar MainPage = function() {\n  this.jumbEl = element(by.css('.jumbotron'));\n  this.h1El = this.jumbEl.element(by.css('h1'));\n  this.imgEl = this.jumbEl.element(by.css('img'));\n  this.thumbnailEls = element(by.css('body')).all(by.repeater('awesomeThing in main.awesomeThings'));\n};\n\nmodule.exports = new MainPage();\n"
  },
  {
    "path": "25-angular-dragula/trello/e2e/main.spec.js",
    "content": "'use strict';\n\ndescribe('The main view', function () {\n  var page;\n\n  beforeEach(function () {\n    browser.get('/index.html');\n    page = require('./main.po');\n  });\n\n  it('should include jumbotron with correct data', function() {\n    expect(page.h1El.getText()).toBe('\\'Allo, \\'Allo!');\n    expect(page.imgEl.getAttribute('src')).toMatch(/assets\\/images\\/yeoman.png$/);\n    expect(page.imgEl.getAttribute('alt')).toBe('I\\'m Yeoman');\n  });\n\n  it('should list more than 5 awesome things', function () {\n    expect(page.thumbnailEls.count()).toBeGreaterThan(5);\n  });\n\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/.eslintrc",
    "content": "{\n  \"env\": {\n    \"node\": true\n  }\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/build.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar gulp = require('gulp');\nvar conf = require('./conf');\n\nvar $ = require('gulp-load-plugins')({\n  pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del']\n});\n\ngulp.task('partials', function () {\n  return gulp.src([\n    path.join(conf.paths.src, '/app/**/*.html'),\n    path.join(conf.paths.tmp, '/serve/app/**/*.html')\n  ])\n    .pipe($.htmlmin({\n      removeEmptyAttributes: true,\n      removeAttributeQuotes: true,\n      collapseBooleanAttributes: true,\n      collapseWhitespace: true\n    }))\n    .pipe($.angularTemplatecache('templateCacheHtml.js', {\n      module: 'trello',\n      root: 'app'\n    }))\n    .pipe(gulp.dest(conf.paths.tmp + '/partials/'));\n});\n\ngulp.task('html', ['inject', 'partials'], function () {\n  var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), { read: false });\n  var partialsInjectOptions = {\n    starttag: '<!-- inject:partials -->',\n    ignorePath: path.join(conf.paths.tmp, '/partials'),\n    addRootSlash: false\n  };\n\n  var htmlFilter = $.filter('*.html', { restore: true });\n  var jsFilter = $.filter('**/*.js', { restore: true });\n  var cssFilter = $.filter('**/*.css', { restore: true });\n\n  return gulp.src(path.join(conf.paths.tmp, '/serve/*.html'))\n    .pipe($.inject(partialsInjectFile, partialsInjectOptions))\n    .pipe($.useref())\n    .pipe(jsFilter)\n    .pipe($.sourcemaps.init())\n    .pipe($.uglify({ preserveComments: $.uglifySaveLicense })).on('error', conf.errorHandler('Uglify'))\n    .pipe($.rev())\n    .pipe($.sourcemaps.write('maps'))\n    .pipe(jsFilter.restore)\n    .pipe(cssFilter)\n    // .pipe($.sourcemaps.init())\n    .pipe($.cssnano())\n    .pipe($.rev())\n    // .pipe($.sourcemaps.write('maps'))\n    .pipe(cssFilter.restore)\n    .pipe($.revReplace())\n    .pipe(htmlFilter)\n    .pipe($.htmlmin({\n      removeEmptyAttributes: true,\n      removeAttributeQuotes: true,\n      collapseBooleanAttributes: true,\n      collapseWhitespace: true\n    }))\n    .pipe(htmlFilter.restore)\n    .pipe(gulp.dest(path.join(conf.paths.dist, '/')))\n    .pipe($.size({ title: path.join(conf.paths.dist, '/'), showFiles: true }));\n  });\n\n// Only applies for fonts from bower dependencies\n// Custom fonts are handled by the \"other\" task\ngulp.task('fonts', function () {\n  return gulp.src($.mainBowerFiles())\n    .pipe($.filter('**/*.{eot,otf,svg,ttf,woff,woff2}'))\n    .pipe($.flatten())\n    .pipe(gulp.dest(path.join(conf.paths.dist, '/fonts/')));\n});\n\ngulp.task('other', function () {\n  var fileFilter = $.filter(function (file) {\n    return file.stat.isFile();\n  });\n\n  return gulp.src([\n    path.join(conf.paths.src, '/**/*'),\n    path.join('!' + conf.paths.src, '/**/*.{html,css,js}')\n  ])\n    .pipe(fileFilter)\n    .pipe(gulp.dest(path.join(conf.paths.dist, '/')));\n});\n\ngulp.task('clean', function () {\n  return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]);\n});\n\ngulp.task('build', ['html', 'fonts', 'other']);\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/conf.js",
    "content": "/**\n *  This file contains the variables used in other gulp files\n *  which defines tasks\n *  By design, we only put there very generic config values\n *  which are used in several places to keep good readability\n *  of the tasks\n */\n\nvar gutil = require('gulp-util');\n\n/**\n *  The main paths of your project handle these with care\n */\nexports.paths = {\n  src: 'src',\n  dist: 'dist',\n  tmp: '.tmp',\n  e2e: 'e2e'\n};\n\n/**\n *  Wiredep is the lib which inject bower dependencies in your project\n *  Mainly used to inject script tags in the index.html but also used\n *  to inject css preprocessor deps and js files in karma\n */\nexports.wiredep = {\n  exclude: [/jquery/, /\\/bootstrap\\.js$/],\n  directory: 'bower_components'\n};\n\n/**\n *  Common implementation for an error handler of a Gulp plugin\n */\nexports.errorHandler = function(title) {\n  'use strict';\n\n  return function(err) {\n    gutil.log(gutil.colors.red('[' + title + ']'), err.toString());\n    this.emit('end');\n  };\n};\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/e2e-tests.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar gulp = require('gulp');\nvar conf = require('./conf');\n\nvar browserSync = require('browser-sync');\n\nvar $ = require('gulp-load-plugins')();\n\n// Downloads the selenium webdriver\ngulp.task('webdriver-update', $.protractor.webdriver_update);\n\ngulp.task('webdriver-standalone', $.protractor.webdriver_standalone);\n\nfunction runProtractor (done) {\n  var params = process.argv;\n  var args = params.length > 3 ? [params[3], params[4]] : [];\n\n  gulp.src(path.join(conf.paths.e2e, '/**/*.js'))\n    .pipe($.protractor.protractor({\n      configFile: 'protractor.conf.js',\n      args: args\n    }))\n    .on('error', function (err) {\n      // Make sure failed tests cause gulp to exit non-zero\n      throw err;\n    })\n    .on('end', function () {\n      // Close browser sync server\n      browserSync.exit();\n      done();\n    });\n}\n\ngulp.task('protractor', ['protractor:src']);\ngulp.task('protractor:src', ['serve:e2e', 'webdriver-update'], runProtractor);\ngulp.task('protractor:dist', ['serve:e2e-dist', 'webdriver-update'], runProtractor);\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/inject.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar gulp = require('gulp');\nvar conf = require('./conf');\n\nvar $ = require('gulp-load-plugins')();\n\nvar wiredep = require('wiredep').stream;\nvar _ = require('lodash');\n\nvar browserSync = require('browser-sync');\n\ngulp.task('inject-reload', ['inject'], function() {\n  browserSync.reload();\n});\n\ngulp.task('inject', ['scripts'], function () {\n  var injectStyles = gulp.src([\n    path.join(conf.paths.src, '/app/**/*.css')\n  ], { read: false });\n\n  var injectScripts = gulp.src([\n    path.join(conf.paths.tmp, '/serve/app/**/*.module.js')\n  ], { read: false });\n\n  var injectOptions = {\n    ignorePath: [conf.paths.src, path.join(conf.paths.tmp, '/serve')],\n    addRootSlash: false\n  };\n\n  return gulp.src(path.join(conf.paths.src, '/*.html'))\n    .pipe($.inject(injectStyles, injectOptions))\n    .pipe($.inject(injectScripts, injectOptions))\n    .pipe(wiredep(_.extend({}, conf.wiredep)))\n    .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve')));\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/scripts.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar gulp = require('gulp');\nvar conf = require('./conf');\n\nvar browserSync = require('browser-sync');\nvar webpack = require('webpack-stream');\n\nvar $ = require('gulp-load-plugins')();\n\n\nfunction webpackWrapper(watch, test, callback) {\n  var webpackOptions = {\n    watch: watch,\n    module: {\n      preLoaders: [{ test: /\\.js$/, exclude: /node_modules/, loader: 'eslint-loader'}],\n      loaders: [{ test: /\\.js$/, exclude: /node_modules/, loaders: ['ng-annotate', 'babel-loader?presets[]=es2015']}]\n    },\n    output: { filename: 'index.module.js' }\n  };\n\n  if(watch) {\n    webpackOptions.devtool = 'inline-source-map';\n  }\n\n  var webpackChangeHandler = function(err, stats) {\n    if(err) {\n      conf.errorHandler('Webpack')(err);\n    }\n    $.util.log(stats.toString({\n      colors: $.util.colors.supportsColor,\n      chunks: false,\n      hash: false,\n      version: false\n    }));\n    browserSync.reload();\n    if(watch) {\n      watch = false;\n      callback();\n    }\n  };\n\n  var sources = [ path.join(conf.paths.src, '/app/index.module.js') ];\n  if (test) {\n    sources.push(path.join(conf.paths.src, '/app/**/*.spec.js'));\n  }\n\n  return gulp.src(sources)\n    .pipe(webpack(webpackOptions, null, webpackChangeHandler))\n    .pipe(gulp.dest(path.join(conf.paths.tmp, '/serve/app')));\n}\n\ngulp.task('scripts', function () {\n  return webpackWrapper(false, false);\n});\n\ngulp.task('scripts:watch', ['scripts'], function (callback) {\n  return webpackWrapper(true, false, callback);\n});\n\ngulp.task('scripts:test', function () {\n  return webpackWrapper(false, true);\n});\n\ngulp.task('scripts:test-watch', ['scripts'], function (callback) {\n  return webpackWrapper(true, true, callback);\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/server.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar gulp = require('gulp');\nvar conf = require('./conf');\n\nvar browserSync = require('browser-sync');\nvar browserSyncSpa = require('browser-sync-spa');\n\nvar util = require('util');\n\nvar proxyMiddleware = require('http-proxy-middleware');\n\nfunction browserSyncInit(baseDir, browser) {\n  browser = browser === undefined ? 'default' : browser;\n\n  var routes = null;\n  if(baseDir === conf.paths.src || (util.isArray(baseDir) && baseDir.indexOf(conf.paths.src) !== -1)) {\n    routes = {\n      '/bower_components': 'bower_components'\n    };\n  }\n\n  var server = {\n    baseDir: baseDir,\n    routes: routes\n  };\n\n  /*\n   * You can add a proxy to your backend by uncommenting the line below.\n   * You just have to configure a context which will we redirected and the target url.\n   * Example: $http.get('/users') requests will be automatically proxified.\n   *\n   * For more details and option, https://github.com/chimurai/http-proxy-middleware/blob/v0.9.0/README.md\n   */\n  // server.middleware = proxyMiddleware('/users', {target: 'http://jsonplaceholder.typicode.com', changeOrigin: true});\n\n  browserSync.instance = browserSync.init({\n    startPath: '/',\n    server: server,\n    browser: browser\n  });\n}\n\nbrowserSync.use(browserSyncSpa({\n  selector: '[ng-app]'// Only needed for angular apps\n}));\n\ngulp.task('serve', ['watch'], function () {\n  browserSyncInit([path.join(conf.paths.tmp, '/serve'), conf.paths.src]);\n});\n\ngulp.task('serve:dist', ['build'], function () {\n  browserSyncInit(conf.paths.dist);\n});\n\ngulp.task('serve:e2e', ['inject'], function () {\n  browserSyncInit([conf.paths.tmp + '/serve', conf.paths.src], []);\n});\n\ngulp.task('serve:e2e-dist', ['build'], function () {\n  browserSyncInit(conf.paths.dist, []);\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/unit-tests.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar gulp = require('gulp');\nvar conf = require('./conf');\n\nvar karma = require('karma');\n\nvar pathSrcHtml = [\n  path.join(conf.paths.src, '/**/*.html')\n];\n\nvar pathSrcJs = [\n  path.join(conf.paths.tmp, '/serve/app/index.module.js')\n];\n\nfunction runTests (singleRun, done) {\n  var reporters = ['progress'];\n  var preprocessors = {};\n\n  pathSrcHtml.forEach(function(path) {\n    preprocessors[path] = ['ng-html2js'];\n  });\n\n  if (singleRun) {\n    pathSrcJs.forEach(function(path) {\n      preprocessors[path] = ['coverage'];\n    });\n    reporters.push('coverage')\n  }\n\n  var localConfig = {\n    configFile: path.join(__dirname, '/../karma.conf.js'),\n    singleRun: singleRun,\n    autoWatch: !singleRun,\n    reporters: reporters,\n    preprocessors: preprocessors\n  };\n\n  var server = new karma.Server(localConfig, function(failCount) {\n    done(failCount ? new Error(\"Failed \" + failCount + \" tests.\") : null);\n  })\n  server.start();\n}\n\ngulp.task('test', ['scripts:test'], function(done) {\n  runTests(true, done);\n});\n\ngulp.task('test:auto', ['scripts:test-watch'], function(done) {\n  runTests(false, done);\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/gulp/watch.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar gulp = require('gulp');\nvar conf = require('./conf');\n\nvar browserSync = require('browser-sync');\n\nfunction isOnlyChange(event) {\n  return event.type === 'changed';\n}\n\ngulp.task('watch', ['scripts:watch', 'inject'], function () {\n\n  gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject-reload']);\n\n  gulp.watch(path.join(conf.paths.src, '/app/**/*.css'), function(event) {\n    if(isOnlyChange(event)) {\n      browserSync.reload(event.path);\n    } else {\n      gulp.start('inject-reload');\n    }\n  });\n\n\n  gulp.watch(path.join(conf.paths.src, '/app/**/*.html'), function(event) {\n    browserSync.reload(event.path);\n  });\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/gulpfile.js",
    "content": "/**\n *  Welcome to your gulpfile!\n *  The gulp tasks are split into several files in the gulp directory\n *  because putting it all here was too long\n */\n\n'use strict';\n\nvar gulp = require('gulp');\nvar wrench = require('wrench');\n\n/**\n *  This will load all js or coffee files in the gulp directory\n *  in order to load all gulp tasks\n */\nwrench.readdirSyncRecursive('./gulp').filter(function(file) {\n  return (/\\.(js|coffee)$/i).test(file);\n}).map(function(file) {\n  require('./gulp/' + file);\n});\n\n\n/**\n *  Default task clean temporaries directories and launch the\n *  main optimization build task\n */\ngulp.task('default', ['clean'], function () {\n  gulp.start('build');\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/karma.conf.js",
    "content": "'use strict';\n\nvar path = require('path');\nvar conf = require('./gulp/conf');\n\nvar _ = require('lodash');\nvar wiredep = require('wiredep');\n\nvar pathSrcHtml = [\n  path.join(conf.paths.src, '/**/*.html')\n];\n\nfunction listFiles() {\n  var wiredepOptions = _.extend({}, conf.wiredep, {\n    dependencies: true,\n    devDependencies: true\n  });\n\n  var patterns = wiredep(wiredepOptions).js\n    .concat([\n      path.join(conf.paths.tmp, '/serve/app/index.module.js'),\n    ])\n    .concat(pathSrcHtml);\n\n  var files = patterns.map(function(pattern) {\n    return {\n      pattern: pattern\n    };\n  });\n  files.push({\n    pattern: path.join(conf.paths.src, '/assets/**/*'),\n    included: false,\n    served: true,\n    watched: false\n  });\n  return files;\n}\n\nmodule.exports = function(config) {\n\n  var configuration = {\n    files: listFiles(),\n\n    singleRun: true,\n\n    autoWatch: false,\n\n    ngHtml2JsPreprocessor: {\n      stripPrefix: conf.paths.src + '/',\n      moduleName: 'trello'\n    },\n\n    logLevel: 'WARN',\n\n    frameworks: ['phantomjs-shim', 'jasmine'],\n\n    browsers : ['PhantomJS'],\n\n    plugins : [\n      'karma-phantomjs-launcher',\n      'karma-phantomjs-shim',\n      'karma-coverage',\n      'karma-jasmine',\n      'karma-ng-html2js-preprocessor'\n    ],\n\n    coverageReporter: {\n      type : 'html',\n      dir : 'coverage/'\n    },\n\n    reporters: ['progress'],\n\n    proxies: {\n      '/assets/': path.join('/base/', conf.paths.src, '/assets/')\n    }\n  };\n\n  // This is the default preprocessors configuration for a usage with Karma cli\n  // The coverage preprocessor is added in gulp/unit-test.js only for single tests\n  // It was not possible to do it there because karma doesn't let us now if we are\n  // running a single test or not\n  configuration.preprocessors = {};\n  pathSrcHtml.forEach(function(path) {\n    configuration.preprocessors[path] = ['ng-html2js'];\n  });\n\n  // This block is needed to execute Chrome on Travis\n  // If you ever plan to use Chrome and Travis, you can keep it\n  // If not, you can safely remove it\n  // https://github.com/karma-runner/karma/issues/1144#issuecomment-53633076\n  if(configuration.browsers[0] === 'Chrome' && process.env.TRAVIS) {\n    configuration.customLaunchers = {\n      'chrome-travis-ci': {\n        base: 'Chrome',\n        flags: ['--no-sandbox']\n      }\n    };\n    configuration.browsers = ['chrome-travis-ci'];\n  }\n\n  config.set(configuration);\n};\n"
  },
  {
    "path": "25-angular-dragula/trello/package.json",
    "content": "{\n  \"name\": \"trello\",\n  \"version\": \"0.0.0\",\n  \"dependencies\": {},\n  \"scripts\": {\n    \"test\": \"gulp test\"\n  },\n  \"devDependencies\": {\n    \"estraverse\": \"~4.1.0\",\n    \"gulp\": \"~3.9.0\",\n    \"gulp-autoprefixer\": \"~3.0.2\",\n    \"gulp-angular-templatecache\": \"~1.8.0\",\n    \"del\": \"~2.0.2\",\n    \"lodash\": \"~3.10.1\",\n    \"gulp-cssnano\": \"~2.1.1\",\n    \"gulp-filter\": \"~3.0.1\",\n    \"gulp-flatten\": \"~0.2.0\",\n    \"gulp-eslint\": \"~1.0.0\",\n    \"eslint-plugin-angular\": \"~0.12.0\",\n    \"gulp-load-plugins\": \"~0.10.0\",\n    \"gulp-size\": \"~2.0.0\",\n    \"gulp-uglify\": \"~1.4.1\",\n    \"gulp-useref\": \"~3.0.3\",\n    \"gulp-util\": \"~3.0.6\",\n    \"gulp-replace\": \"~0.5.4\",\n    \"gulp-rename\": \"~1.2.2\",\n    \"gulp-rev\": \"~6.0.1\",\n    \"gulp-rev-replace\": \"~0.4.2\",\n    \"gulp-htmlmin\": \"~1.3.0\",\n    \"gulp-inject\": \"~3.0.0\",\n    \"gulp-protractor\": \"~2.1.0\",\n    \"gulp-sourcemaps\": \"~1.6.0\",\n    \"webpack-stream\": \"~2.1.1\",\n    \"ng-annotate-loader\": \"0.0.10\",\n    \"eslint-loader\": \"~1.1.0\",\n    \"babel-core\": \"~6.7.4\",\n    \"babel-loader\": \"~6.2.4\",\n    \"babel-preset-es2015\": \"~6.6.0\",\n    \"main-bower-files\": \"~2.9.0\",\n    \"wiredep\": \"~2.2.2\",\n    \"karma\": \"~0.13.10\",\n    \"karma-jasmine\": \"~0.3.6\",\n    \"karma-phantomjs-launcher\": \"~0.2.1\",\n    \"phantomjs\": \"~1.9.18\",\n    \"karma-phantomjs-shim\": \"~1.2.0\",\n    \"karma-coverage\": \"~0.5.2\",\n    \"karma-ng-html2js-preprocessor\": \"~0.2.0\",\n    \"browser-sync\": \"~2.9.11\",\n    \"browser-sync-spa\": \"~1.0.3\",\n    \"http-proxy-middleware\": \"~0.9.0\",\n    \"chalk\": \"~1.1.1\",\n    \"uglify-save-license\": \"~0.4.1\",\n    \"wrench\": \"~1.5.8\"\n  },\n  \"engines\": {\n    \"node\": \">=0.10.0\"\n  }\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/protractor.conf.js",
    "content": "'use strict';\n\nvar paths = require('./.yo-rc.json')['generator-gulp-angular'].props.paths;\n\n// An example configuration file.\nexports.config = {\n  // The address of a running selenium server.\n  //seleniumAddress: 'http://localhost:4444/wd/hub',\n  //seleniumServerJar: deprecated, this should be set on node_modules/protractor/config.json\n\n  // Capabilities to be passed to the webdriver instance.\n  capabilities: {\n    'browserName': 'chrome'\n  },\n\n  baseUrl: 'http://localhost:3000',\n\n  // Spec patterns are relative to the current working directory when\n  // protractor is called.\n  specs: [paths.e2e + '/**/*.js'],\n\n  // Options to be passed to Jasmine-node.\n  jasmineNodeOpts: {\n    showColors: true,\n    defaultTimeoutInterval: 30000\n  }\n};\n"
  },
  {
    "path": "25-angular-dragula/trello/src/app/index.config.js",
    "content": "export function config ($logProvider, toastrConfig) {\n  'ngInject';\n  // Enable log\n  $logProvider.debugEnabled(true);\n\n  // Set options third-party lib\n  toastrConfig.allowHtml = true;\n  toastrConfig.timeOut = 3000;\n  toastrConfig.positionClass = 'toast-top-right';\n  toastrConfig.preventDuplicates = true;\n  toastrConfig.progressBar = true;\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/src/app/index.css",
    "content": ".browsehappy {\n  margin: 0.2em 0;\n  background: #ccc;\n  color: #000;\n  padding: 0.2em 0;\n}\n\n.thumbnail {\n  height: 200px;\n}\n\n.thumbnail img.pull-right {\n  width: 50px;\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/src/app/index.module.js",
    "content": "/* global malarkey:false, moment:false */\n\nimport { config } from './index.config';\nimport { runBlock } from './index.run';\nimport { MainController } from './main/main.controller';\n\nangular.module('trello', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize', 'ngMessages', 'ngAria', 'toastr', angularDragula(angular)])\n  .config(config)\n  .run(runBlock)\n  .controller('MainController', MainController)\n"
  },
  {
    "path": "25-angular-dragula/trello/src/app/index.run.js",
    "content": "export function runBlock ($log) {\n  'ngInject';\n  $log.debug('runBlock end');\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/src/app/main/main.controller.js",
    "content": "export class MainController {\n  constructor($scope) {\n    'ngInject';\n\n    $scope.$on('bag.drop', function(e, el, target){\n      console.log(`Dropped ${el[0].id} on target ${target[0].id}`);\n    });\n\n\n    this.board = {\n      title: \"Test Board\",\n      lists: [{\n        id: 1,\n        name: \"Todo\",\n        cards: [{\n          id: 1,\n          title: \"Lean Go programming language\",\n          description: \"I want to learn Go so that I can build applications with it.\"\n        }, {\n          id: 2,\n          title: \"Finish Missing Kids Android application\",\n          description: \"Work on my Android application\"\n        }]\n      }, {\n        id: 2,\n        name: \"In Progress\",\n        cards: [{\n          id: 3,\n          title: \"Blog about Angular Dragula\",\n          description: \"Write week 25 blog on Angular Dragula\"\n        }]\n\n      }, {\n        id: 3,\n        name: \"Done\",\n        cards: [{\n          id: 5,\n          title: \"Blog about Jekyll to WordPress migration\",\n          description: \"Write week 24 blog on migrating from Jekyll to WordPress\"\n        }]\n      }]\n    }\n  }\n\n\n}\n"
  },
  {
    "path": "25-angular-dragula/trello/src/app/main/main.controller.spec.js",
    "content": "describe('controllers', () => {\n  let vm;\n\n  beforeEach(angular.mock.module('trello'));\n\n  beforeEach(inject(($controller, webDevTec, toastr) => {\n    spyOn(webDevTec, 'getTec').and.returnValue([{}, {}, {}, {}, {}]);\n    spyOn(toastr, 'info').and.callThrough();\n\n    vm = $controller('MainController');\n  }));\n\n  it('should have a timestamp creation date', () => {\n    expect(vm.creationDate).toEqual(jasmine.any(Number));\n  });\n\n  it('should define animate class after delaying timeout', inject($timeout => {\n    $timeout.flush();\n    expect(vm.classAnimation).toEqual('rubberBand');\n  }));\n\n  it('should show a Toastr info and stop animation when invoke showToastr()', inject(toastr => {\n    vm.showToastr();\n    expect(toastr.info).toHaveBeenCalled();\n    expect(vm.classAnimation).toEqual('');\n  }));\n\n  it('should define more than 5 awesome things', () => {\n    expect(angular.isArray(vm.awesomeThings)).toBeTruthy();\n    expect(vm.awesomeThings.length === 5).toBeTruthy();\n  });\n});\n"
  },
  {
    "path": "25-angular-dragula/trello/src/index.html",
    "content": "<!doctype html>\n<html ng-app=\"trello\" ng-strict-di>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>trello</title>\n    <meta name=\"description\" content=\"\">\n    <meta name=\"viewport\" content=\"width=device-width\">\n    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->\n\n    <!-- build:css({.tmp/serve,src}) styles/vendor.css -->\n    <!-- bower:css -->\n    <!-- run `gulp inject` to automatically populate bower styles dependencies -->\n    <!-- endbower -->\n    <!-- endbuild -->\n\n    <!-- build:css({.tmp/serve,src}) styles/app.css -->\n    <!-- inject:css -->\n    <!-- css files will be automatically insert here -->\n    <!-- endinject -->\n    <!-- endbuild -->\n  </head>\n  <body>\n    <!--[if lt IE 10]> <p class=\"browsehappy\">You are using an <strong>outdated</strong> browser. Please <a href=\"http://browsehappy.com/\">upgrade your browser</a> to improve your experience.</p> <![endif]-->\n\n    <div class=\"container\" ng-controller=\"MainController as main\">\n      <div class=\"row\">\n        <div class=\"col-sm-6 col-md-4\" ng-repeat=\"list in main.board.lists\">\n          <h2 class=\"text-center\">{{list.name}}</h2>\n          <div id=\"list-{{list.id}}\" dragula='\"bag\"' ng-repeat=\"card in list.cards\" dragula-scope=\"$parent.$parent\" style=\"min-height: 10px;\">\n            <div id=\"card-{{card.id}}\" class=\"thumbnail\">\n              <div class=\"caption\">\n                <h3>{{ card.title }}</h3>\n                <p>{{ card.description }}</p>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <!-- build:js(src) scripts/vendor.js -->\n    <!-- bower:js -->\n    <!-- run `gulp inject` to automatically populate bower script dependencies -->\n    <!-- endbower -->\n    <!-- endbuild -->\n\n    <!-- build:js({.tmp/serve,.tmp/partials}) scripts/app.js -->\n    <!-- inject:js -->\n    <!-- js files will be automatically insert here -->\n    <!-- endinject -->\n\n    <!-- inject:partials -->\n    <!-- angular templates will be automatically converted in js and inserted here -->\n    <!-- endinject -->\n    <!-- endbuild -->\n\n  </body>\n</html>\n"
  },
  {
    "path": "26-android-part2/README.md",
    "content": "Building An Android Application Part 2\n---\n\nWelcome to twenty sixth post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week we will extend the Android application that we started developing in [week 23](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/23-android-part1). By the end of part 1, our Android application could take a photo, store that photo in an application specific album, and finally preview the captured photo in the same activity. This week we will achieve the following:\n\n1. Create a new activity `PreviewActivity` that will be responsible for image preview.\n2. Use [Glide](https://github.com/bumptech/glide) library for preview.\n3. Add a share menu to `PreviewActivity` to allow sharing of the captured image.\n\n## Prerequisite\n\nBefore you start working with this blog make sure you have read [part 1](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/23-android-part1) blog. You need following on your machine:\n\n1. Your machine should have JDK 6 or above installed.\n\n2. Download and install [Android Studio](https://developer.android.com/studio/index.html) for your operating system. Please refer to documentation for more [information](https://developer.android.com/training/basics/firstapp/index.html).\n\n3. You will need source code of the part 1. The application source code is hosted on Github. To checkout part 1 source code, execute the following commands.\n\n  ```bash\n  $ git clone git@github.com:shekhargulati/missing-kid-tracker.git\n  $ git checkout -b part2 part1\n  ```\n\n\n## Feature 1: Create a new activity `PreviewActivity` that will be responsible for image preview.\n\nIn this section, we will cover how to create `PreviewActivity` that will be responsible for showing image preview.\n\n### Step 1: Create `PreviewActivity` for previewing captured image\n\nIn part 1, we rendered the captured image in the `MainActivity` itself. As discussed previously, Activity represents a single focussed thing that the user can do with your application. `MainActivity` will be the first screen that users will view when they will launch our application. Currently, `MainActivity` only has a menu with one option `Take Photo`. Later in the series, we will update `MainActivity` to show a list of missing kids. Create a new Activity by right clicking on the package and then selecting the `Empty Activity` as shown below in the image.\n\n![](images/new-empty-activity.png)\n\nNext, you will be asked to configure the activity. Change the name of the activity to `PreviewActivity` as shown below.\n\n![](images/configure-activity.png)\n\nPress the `Finish` button. This will add the `PreviewActivity.java` and other generated files to the project.\n\n\n### Step 2: Update `MainActivity` to start `PreviewActivity`\n\nNow, that we have created the `PreviewActivity`, let's update `MainActivity` to start `PreviewActivity` after we have successfully captured the photo. In the `MainActivity`, we have overridden a lifecycle method `onActivityResult`, that is called after taking the photo. Currently, `onActivityResult` is responsible for storing the captured image to gallery and then setting pic to the `MainActivity` `ImageView`. We will move the setting pic to `ImageView` concern to the `PreviewActivity` as shown below. In Android, you call one activity from another using the `Intent`.\n\n\n```java\n@Override\nprotected void onActivityResult(int requestCode, int resultCode, Intent data) {\n    final String tag = getString(R.string.app_name);\n    if (resultCode == RESULT_OK) {\n        Log.d(tag, String.format(\"Photo is successfully saved to [%s]\", capturedPhotoPath));\n        addPicToGallery();\n        Intent previewIntent = new Intent(this, PreviewActivity.class);\n        previewIntent.putExtra(PreviewActivity.CAPTURED_PHOTO_PATH, capturedPhotoPath);\n        startActivity(previewIntent);\n    }\n}\n```\n\nIn the code shown above, we created a new intent for `PreviewActivity`. We stored the `capturedPhotoPath` in the intent object so that `PreviewActivity` can use it. Finally, we started the activity using the `startActivity` method.\n\nThe `PreviewActivity` is shown below. The only thing that I have added so far is a constant `CAPTURED_PHOTO_PATH`.\n\n```java\nimport android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\n\npublic class PreviewActivity extends AppCompatActivity {\n\n    public static final String CAPTURED_PHOTO_PATH = \"capturedPhotoPath\";\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_preview);\n    }\n}\n```\n\n### Step 3: Render image preview in `PreviewActivity`\n\nNow, move the `setPic` and its dependent methods in the `PreviewActivity`. Don't worry about compilation errors for now.\n\n```java\nimport android.content.Intent;\nimport android.graphics.Bitmap;\nimport android.graphics.BitmapFactory;\nimport android.graphics.Matrix;\nimport android.media.ExifInterface;\nimport android.support.v7.app.AppCompatActivity;\nimport android.os.Bundle;\nimport android.util.Log;\nimport android.view.View;\nimport android.widget.ImageView;\n\nimport java.io.File;\nimport java.io.IOException;\n\npublic class PreviewActivity extends AppCompatActivity {\n\n    public static final String CAPTURED_PHOTO_PATH = \"capturedPhotoPath\";\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_preview);\n    }\n\n    private void setPic() {\n        final String tag = getString(R.string.app_name);\n        try {\n            ImageView imageView = (ImageView) this.findViewById(R.id.image_preview);\n            imageView.setVisibility(View.VISIBLE);\n            Bitmap bitmap = createScaledBitmap(capturedPhotoPath);\n            imageView.setImageBitmap(bitmap);\n        } catch (Exception e) {\n            Log.e(tag, \"Error encountered while doing image preview\", e);\n        }\n    }\n\n    public Bitmap createScaledBitmap(String pathName) throws IOException {\n        final BitmapFactory.Options opt = new BitmapFactory.Options();\n        opt.inSampleSize = 2;\n        opt.inJustDecodeBounds = false;\n        Bitmap bitmap = BitmapFactory.decodeFile(pathName, opt);\n        File file = new File(capturedPhotoPath);\n        Bitmap rotatedBitmap;\n        ExifInterface exif = new ExifInterface(file.getPath());\n        int rotation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);\n        int rotationInDegrees = exifToDegrees(rotation);\n        Matrix matrix = new Matrix();\n        if (rotation != 0f) {\n            matrix.preRotate(rotationInDegrees);\n        }\n        rotatedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);\n        return rotatedBitmap;\n    }\n\n    private static int exifToDegrees(int exifOrientation) {\n        if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_90) {\n            return 90;\n        } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_180) {\n            return 180;\n        } else if (exifOrientation == ExifInterface.ORIENTATION_ROTATE_270) {\n            return 270;\n        }\n        return 0;\n    }\n}\n\n```\n\nIn the code shown above, we moved `setPic`, `createScaledBitmap`, and `exifToDegrees` methods from `MainActivity` to `PreviewActivity`. Make sure to delete them from the `MainActivity` class.\n\nThe code shown above does not compile because it does not know about `capturedPhotoPath`. We stored `capturedPhotoPath` in the `Intent`. You use `getIntent` method to get the intent. Update the `onCreate` method with the one shown below.\n\n```java\nprivate String capturedPhotoPath;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.activity_preview);\n    Intent intent = getIntent();\n    this.capturedPhotoPath = intent.getStringExtra(CAPTURED_PHOTO_PATH);\n    setPic();\n}\n```\n\nAlso, you have to update `activity_preview.xml` so that can we can render image of the missing kid. Replace `activity_preview.xml` with the XML shown below.\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:tools=\"http://schemas.android.com/tools\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:paddingBottom=\"@dimen/activity_vertical_margin\"\n    android:paddingLeft=\"@dimen/activity_horizontal_margin\"\n    android:paddingRight=\"@dimen/activity_horizontal_margin\"\n    android:paddingTop=\"@dimen/activity_vertical_margin\"\n    tools:context=\"com.shekhargulati.missingkidtracker.PreviewActivity\">\n\n    <LinearLayout\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:orientation=\"vertical\">\n\n        <TextView\n            android:id=\"@+id/textView\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:text=\"Preview\"\n            android:gravity=\"center\"\n            android:textAppearance=\"?android:attr/textAppearanceLarge\" />\n\n        <ImageView\n            android:id=\"@+id/image_preview\"\n            android:layout_width=\"match_parent\"\n            android:layout_height=\"wrap_content\"\n            android:adjustViewBounds=\"true\"\n            android:scaleType=\"center\"\n            android:visibility=\"visible\" />\n\n    </LinearLayout>\n\n</RelativeLayout>\n```\n\n### Step 4: Run the application\n\nNow, you can run the application and see if everything works correctly. The preview screen will look like as shown below.\n\n![](images/preview-screen.jpg)\n\n\n## Feature 2: Use Glide library for preview\n\nIn the last section, we got preview functionality working. You will agree that we had to write a lot of code to render the captured image in an `ImageView`. We wrote code to scale the\nbitmap and handle image rotation. To me a lot of this code looks like boilerplate code and I would like some library to do this work for me. In my opinion, it is good to start with the manual approach of doing everything yourself to understand how all this works, but once you understand it makes sense to use a battle tested library to do the work. There are many Android libraries that one can use to work with images. Some of the popular libraries are Glide, Picasso, Fresco, etc. To understand the difference between these popular libraries, you should refer to [stackoverflow question](https://stackoverflow.com/questions/29363321/picasso-v-s-imageloader-v-s-fresco-vs-glide). I choose [Glide](https://github.com/bumptech/glide) because it is recommended by [Google](https://google-opensource.blogspot.in/2014/09/glide-30-media-management-library-for.html) and I found it very easy to get started with.\n\n[Glide](https://github.com/bumptech/glide) is an open source image loading and caching library for Android focused on smooth scrolling developed by bumptech. Glide supports large number of [features](https://github.com/bumptech/glide/wiki). Some of these are mentioned below:\n\n1. Animated GIF decoding\n2. Local video stills\n3. Thumbnail support\n4. Lifecycle integration\n5. Transcoding\n6. Animations\n7. OkHttp and Volley support\n8. Memory and disk caching\n\n### Step 1: Add glide dependency\n\nTo use any library, you have to add it to your application `build.gradle` file. The applications created using Android Studio uses Gradle as their build system.\n\n```groovy\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n    compile 'com.github.bumptech.glide:glide:3.7.0'\n    testCompile 'junit:junit:4.12'\n    compile 'com.android.support:appcompat-v7:22.2.1'\n}\n```\n\nYou will also have to sync the project after adding the dependency so that the classpath is updated.\n\n### Step 2: Using Glide for preview\n\nNow, that we have added dependency we can update the `PreviewActivity` to use glide instead of our own custom code.\n\n```java\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\nimport android.widget.ImageView;\n\nimport com.bumptech.glide.Glide;\nimport java.io.File;\n\npublic class PreviewActivity extends AppCompatActivity {\n\n    public static final String CAPTURED_PHOTO_PATH = \"capturedPhotoPath\";\n    private String capturedPhotoPath;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_preview);\n        Intent intent = getIntent();\n        this.capturedPhotoPath = intent.getStringExtra(CAPTURED_PHOTO_PATH);\n        setPic();\n    }\n\n    private void setPic() {\n        ImageView previewView = (ImageView) this.findViewById(R.id.image_preview);\n        File file = new File(capturedPhotoPath);\n        Glide\n                .with(this)\n                .load(file)\n                .into(previewView);\n    }\n\n}\n```\n\nDoesn't the code above look much cleaner? Let's understand what we did in the code shown above:\n\n1. In the `setPic` method instead of using our own custom code we used Glide library.\n2. Glide library has a `Glide` class  that provides all the methods that you will need. Glide has fluent interface that makes it very easy to use. You start by calling the `with` method, which creates an instance of `RequestManager` that handles the Glide requests. Once you have handle to `RequestManager`, you call `load` method, which as per its name load image from a source. In the example shown above source is a `File` but it could be a URI or a String URL as well. The loaded resource is then set into the `ImageView` provided in the `into` method argument.\n\n> **If you use Glide to load image from internet then make sure to set the permission to access the internet by adding `<uses-permission android:name=\"android.permission.INTERNET\"/>` to `AndroidManifest.xml`.**\n\nIf you run the application now, you will see the same behavior. This time preview functionality is handled by Glide.\n\n### Step 3: Handling failures\n\nWhen I first used Glide I was not able to get it working. The `ImageView` was not set and there was no error in the logs. It was very difficult to understand what has gone wrong without any exception stack trace. Let's suppose you are loading an image from the internet and the image was either removed or there was an issue with the internet connection, then you will get an empty `ImageView`. To get handle on exception, you have to subscribe a listener using the `listener` method as shown below. You have to provide your own implementation of `RequestListener` interface.\n\n```java\nprivate void setPic() {\n    ImageView previewView = (ImageView) this.findViewById(R.id.image_preview);\n    File file = new File(capturedPhotoPath);\n    Glide\n            .with(this)\n            .load(file)\n            .listener(new RequestListener<File, GlideDrawable>() {\n                @Override\n                public boolean onException(Exception e, File model, Target<GlideDrawable> target, boolean isFirstResource) {\n                    Log.e(getString(R.string.app_name), \"Exception occurred while loading image\", e);\n                    return false;\n                }\n\n                @Override\n                public boolean onResourceReady(GlideDrawable resource, File model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {\n                    return false;\n                }\n            })\n            .into(previewView);\n}\n```\n\nIn the code shown above, we logged the exception in the `onException` method of `RequestListener`. We have returned false to allow Glide to handle the request and update the target.\n\nLet's suppose in addition to logging the exception you would like to show a placeholder image in case application is unable to load the image. This can be achieved very easily using Glide's `error` function as shown below.\n\n```java\nprivate void setPic() {\n    ImageView previewView = (ImageView) this.findViewById(R.id.image_preview);\n    File file = new File(capturedPhotoPath);\n    Glide\n            .with(this)\n            .load(file)\n            .listener(new RequestListener<File, GlideDrawable>() {\n                @Override\n                public boolean onException(Exception e, File model, Target<GlideDrawable> target, boolean isFirstResource) {\n                    Log.e(getString(R.string.app_name), \"Exception occurred while loading image\", e);\n                    return false;\n                }\n\n                @Override\n                public boolean onResourceReady(GlideDrawable resource, File model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {\n                    return false;\n                }\n            })\n            .error(R.drawable.kid)\n            .into(previewView);\n}\n```\n\n\n## Feature 3: Add a share menu to `PreviewActivity`\n\nSharing is an important feature that most applications need in today's virtual social world. Android makes it very easy to add share action button to the action bar using the ActionProvider.\n\n\n### Step 1: Create menu for `PreviewActivity`\n\nCreate a new file `preview_menu.xml` in the `res/menu` directory. In the XML snippet shown below, we added `actionProviderClass` attribute to the menu item. `ShareActionProvider` will now be responsible for handling the look and feel of the item.\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<menu xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\">\n    <item\n        android:id=\"@+id/menu_share_photo\"\n        android:title=\"@string/share_photo\"\n        app:actionProviderClass=\"android.support.v7.widget.ShareActionProvider\"\n        app:showAsAction=\"ifRoom\" />\n</menu>\n```\n\n### Step 2: Add intent for sharing\n\nAfter you have updated the menu declaration to include `ShareActionProvider`, you have to provide it a share intent. Share intent uses action as `Intent.ACTION_SEND`. We provide this intent our image content as URI and set the mime type as shown below.\n\n```java\nprivate Intent shareIntent = new Intent();\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    setContentView(R.layout.activity_preview);\n    Intent intent = getIntent();\n    this.capturedPhotoPath = intent.getStringExtra(CAPTURED_PHOTO_PATH);\n    setPic();\n    shareIntent.setAction(Intent.ACTION_SEND);\n    shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(capturedPhotoPath)));\n    shareIntent.setType(\"image/jpeg\");\n\n}\n```\n\n### Step 3: Set share intent to menu item\n\nNext, we retrieve the action provider using the `getActionProvider` passing it the our menu item. Finally, we set the share intent in the provider.\n\n```java\nprivate ShareActionProvider shareActionProvider;\n\n@Override\npublic boolean onCreateOptionsMenu(Menu menu) {\n    MenuInflater menuInflater = getMenuInflater();\n    menuInflater.inflate(R.menu.preview_menu, menu);\n    MenuItem shareMenuItem = menu.findItem(R.id.menu_share_photo);\n    shareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareMenuItem);\n    setShareIntent(shareIntent);\n    return true;\n}\n\nprivate void setShareIntent(Intent shareIntent) {\n    if (shareActionProvider != null) {\n        shareActionProvider.setShareIntent(shareIntent);\n    }\n}\n```\n\nWhen you run the application now, you will see a share button.\n\n![](images/missing-kid.jpg)\n\nWhen you will press the share button, then you will see a list of applications that you can use to share the picture.\n\n------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/32](https://github.com/shekhargulati/52-technologies-in-2016/issues/32).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/26-android-part2)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "27-learn-golang-for-great-good/README.md",
    "content": "Learn GoLang For Great Good -- Part 1\n---------\n\nWelcome to twenty seventh post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. Last few months I was thinking of learning [Go programming language](https://golang.org/). Go is an open source, fast, general purpose programming language by Google. Go caught my attention back in 2013 when I learnt about Docker. Docker, a containerization platform is entirely written in Go. Since then I have seen many software tools written in Go programming language. Both Cloud Foundry and OpenShift were rewritten in Go. So, finally I decided to learn Go this month.\n\nGo is an object oriented programming language with memory management builtin. If you are coming from a language like C or C++ where your program needs to handle memory allocation and deallocation then you will be relieved that Go handles this error prone task for you. Go has [modern, low-pause, concurrent garbage collector](https://docs.google.com/document/d/1kBx98ulj5V5M9Zdeamy7v6ofZXX3yPziAf0V27A64Mo/preview?pli=10). Another feature that makes Go a popular choice is its powerful concurrency support. Go's concurrency support consists of goroutines and channels. GoRoutines are based on [Communicating Sequential Processes](https://en.wikipedia.org/wiki/Communicating_sequential_processes) or CSP. The basic premise is that goroutines run concurrently with other goroutines but they share a channel. Channels allow safer communication between goroutines, one goroutine can put data into the channel and other goroutine consumes that data. Later in the series we will cover concurrency aspect of Go in detail.\n\nThis week we will learn about Go basics covering simple data types, variable declaration, control statements, functions, and simple data structures like array, slice, and map. We will learn basics by writing a number of small programs. Let's get started.\n\n## Prerequisite\n\nBefore you can start with the hands-on tutorial please make sure you have following installed on your machine:\n\n1. Download and install Go programming language from [https://golang.org/dl/](https://golang.org/dl/). Set the `GOPATH` environment variable on your machine. Go uses `GOPATH` environment variable to find the Go source code. On OSX, you can set the GOPATH environment variable by executing the following command on your terminal.\n\n  ```bash\n  $ echo 'export GOPATH=$HOME\\n' >> ~/.bash_profile\n  ```\n  After setting the environment variable, close the terminal and open it again. You can check that environment variable is set correctly by running the `env |grep GOPATH`. It will point to your user's home directory.\n\n  ```bash\n  $ env |grep GOPATH\n  ```\n  ```\n  GOPATH=/Users/shekhargulati\n  ```\n\n2. Select a text editor of your choice for writing Go programs. You can find full listing on the [Go wiki](https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins). I personally prefer Atom.\n\n3. This tutorial assumes you already know programming.\n\n> **The source code for programs is in the [programs directory](./programs). If you feel a particular problem can be solved in a better manner than I did, please send me a PR.**\n\n## Program 1: Greeter\n\nLet's start by writing a simple Go program that will greet a user with a welcome message. This is a canonical \"Hello, World\" program. The program will print `Welcome, <user>` to the console. **`<user>` will be replaced by user's name like `Welcome, Shekhar Gulati`.**\n\nNow that we know what program we want to write let's spend some time thinking about how we might write such a program in any programming language. Think about it I am waiting!\n\nBack. Let's write all what we know from our previous programming experience.\n\n> To write Greeter program I need to do following:\n  1. I will create a new file that ends with an extension that denotes it is a Go program.\n  2. I will call an inbuilt function with a greeting message and it will write message to the console.\n  3. I will organize code in a class or a function so that Go can execute my code\n  4. I will run the program.\n\n\nLet's see how we can write greeter program in Go.\n\nIn Go, you create a file with an extension `.go`. Create a new directory `programs` under a convenient location on your filesystem. Then create a new file `greeter.go` inside the `programs` directory. Copy and paste the code shown below in the `greeter.go` file.\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n  fmt.Println(\"Welcome, Shekhar Gulati\")\n}\n```\n\nLet's understand the code written above:\n\n1. First, we wrote a `package` statement. This allows you to logically organize the source code. Package statement should be the first statement in your code. It is required by Go compiler else your code will not compile.\n\n2. Next, you imported a `fmt` package using the `import` declaration. By using an `import` statement, you tell Go compiler that your program depends on the imported package. `fmt` package is part of Go standard library so available to all programs.\n\n3. Finally, you defined a `main` function. The `main` function will be executed by Go when you run your application -- just like Java or C. In Go, functions are first class citizens so you don't need to encapsulate them in a class. A Go function is declared by `func` keyword followed by its name. The `main` function does not take any arguments and does not return anything. The `main` function uses the `fmt` package `Println` function to write a welcome message to the standard output.\n\nTo run the program, you will use the `go run` command shown below. The command shown below assumes that you are inside the `programs` directory where you have created `greeter.go` file.\n\n```bash\n$ go run greeter.go\n```\n```\nWelcome, Shekhar Gulati\n```\n\n> **You can build a binary for your program using the `go build` command and then execute the binary. For example, we can build greeter binary using the `go build greeter.go` and then run the program using `./greeter` command.**\n\nYou can also give aliases to the imported package and then use that in the code. For example, let's suppose we want to refer `fmt` package as `f` then we can write code as shown below.\n\n```go\npackage main\n\nimport f \"fmt\"\n\nfunc main() {\n  f.Println(\"Welcome, Shekhar Gulati\")\n}\n```\n\n------\n\n## Program 2: Concatenator\n\nWrite a program that concatenate your first name and last name and prints the full name to the console.\n\nJust like the previous problem let's think how we will do that in any programming language. Take your time and think about it..\n\n> To write Concatenator program we will need to do the following:\n  1. Create a new file `concatenator.go`.\n  2. Create two variables -- one for first name and another for last name.\n  3. Concatenate two string variables and store the result in another variable.\n  4. Call the `Println` function passing it the concatenation result.\n\nThe essence of this program is how to define variables in Go. This is the first thing you will learn after writing a `Hello, World!` program.\n\nCreate a new file `concatenator.go` inside the programs directory. Copy and paste the code shown below in the `concatenator.go` file.\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tvar fName string = \"Shekhar\"\n\tvar lName = \"Gulati\"\n\tvar fullName = fName + \" \" + lName\n\tfmt.Println(fullName)\n\tfmt.Println(fName, lName)\n}\n```\n\nLet's understand the code written above.\n\n1. We define two variables `fName` and `lName` with values `Shekhar` and `Gulati`. In Go, you use `var` keyword to declare a variable. The definition of a variable is `var <name> <type> = <value>`. The type is optional when variable is initialized. Go compiler using type inference to determine the type. You don't have to initialize a variable with value. For example, `var fName string` is a valid Go statement. When you don't initialize a variable then it is zero valued. For example, the zero value for string type is empty string.\n\n2. Next, we concatenated the two variables using the `+` operator. `+` is an overloaded method. Go compiler figures out what to do based on the type of the arguments. As we are working with strings, so concatenation is performed.\n\n3. Finally, we printed the `fullName` to the console using the `fmt.Println` function. One thing I liked about `Println` function is that if you pass it multiple arguments then it automatically add space between arguments. So, both the `fmt.Println` statements will print `Shekhar Gulati`.\n\n> There is also a shorthand notation for declaring and initializing a variable in one go as shown below.\n  ```go\n  name := \"Shekhar Gulati\"\n  ```\n\nTo run the program, we will use the `go run` command as shown below. The command shown below assumes that you are inside the `programs` directory where you have created `concatenator.go` file.\n\n```\n$ go run concatenator.go\n```\n```\nShekhar Gulati\nShekhar Gulati\n```\n\n------\n\n## Program 3: EqualOrNotEqual\n\nWrite a program that invokes a function that takes three integers as parameters and return `true` if all of the three are equal, otherwise it returns `false`.\n\nJust like the previous problem let's think how we will do that in any programming language. Take your time and think about it..\n\n> To write EqualOrNotEqual program I will do the following:\n  1. I will define a function that takes three integer arguments and return a boolean.\n  2. I will perform a condition check to verify that all the three integers are equal.\n    * If they are equal I will return true\n    * Else, I will return false\n\nSo, to write this program we will need to learn how to define functions in Go and how to write `if else` state in Go.\n\nCreate a new file `equalornotequal.go` inside the `programs` directory. Copy and paste the code shown below in the `equalornotequal.go` file.\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc equalOrNotEqual(first int, second int, third int) bool {\n  if first == second && second == third {\n    return true\n  }else{\n    return false\n  }\n}\n\nfunc main() {\n  fmt.Println(equalOrNotEqual(1,2,3))\n  fmt.Println(equalOrNotEqual(7,7,7))\n}\n```\n\nLet's understand the program shown above:\n\n1. First, we used package and import declaration just like we did in previous programs.\n\n2. Then, we wrote a function `equalOrNotEqual` that takes three ints and return a boolean. In Go, a function is defined using the `func` keyword. A function can take zero or more arguments and may return a value. You have to be explicit in specifying the return type of the function if function returns a value. When a function has multiple parameter of the same type then Go allows you to specify type only once on the final parameter as shown below.\n  ```go\n  func equalOrNotEqual(first, second, third int) bool {\n    if first == second && second == third {\n      return true\n    }else{\n      return false\n    }\n  }\n  ```\n\n3. Inside the `equalOrNotEqual` function, we used the `if else` control statement to make a decision. The `if` statement takes a condition and if condition evaluates to true then all the statements inside the if block are executed. Otherwise, else block is executed. Go also supports `else if` clauses so you can build the full control statement hierarchy using the `if else if else` blocks.\n\n4. Finally, in the `main` function we called the `equalOrNotEqual` a couple of times with different integer values.\n\nTo run the program, we will use the `go run` command as shown below. The command shown below assumes that you are inside the `programs` directory where you have created `equalornotequal.go` file.\n\n```bash\n$ go run equalornotequal.go\n```\n```\nfalse\ntrue\n```\n\n------\n\n## Program 4: FizzBuzz\n\nWrite a program that prints the numbers from 1 to 100. But for multiples of three print `Fizz` instead of the number and for the multiples of five print `Buzz`. For numbers which are multiples of both three and five the program print `FizzBuzz`.\n\nJust like the previous problem let's think how we will do that in any programming language. Take your time and think about it..\n\n\n> To write FizzBuzz program I will do the following:\n  1. I will iterate over 1 to 100 using the looping construct available in Go.\n  2. For each number I will check:\n    * If number is divisible by both 3 and 5 then I will print FizzBuzz\n    * Else if number is only divisible by 3 then I will print Fizz\n    * Else if number is only divisible by 5 I will print Buzz\n    * Else, I will print the number\n\nThis program will teach us how to use for loop in Go and how to perform simple arithmetic operations in Go.\n\nCreate a new file `fizzbuzz.go` inside the `programs` directory. Copy and paste the code shown below in the `fizzbuzz.go` file.\n\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tfor number := 1; number <= 100; number++ {\n\t\tif number%3 == 0 && number%5 == 0 {\n\t\t\tfmt.Println(\"FizzBuzz\")\n\t\t} else if number%3 == 0 {\n\t\t\tfmt.Println(\"Fizz\")\n\t\t} else if number%5 == 0 {\n\t\t\tfmt.Println(\"Buzz\")\n\t\t} else {\n\t\t\tfmt.Println(number)\n\t\t}\n\t}\n\n}\n```\n\nLet's understand the code shown above.\n\n1. In the `main` function, we ran a for loop from 1 to 100. In Go, for loop is created using the `for` keyword. This is a standard version of for loop that exists in programming languages like Java. We are incrementing a variable `number` by one each time we run the loop and checking if number is less than or equal to 100. When number becomes greater than 100 we exit the loop.\n\n2. for loop will run 100 times and for each run we check our conditions. If the condition in the `if` statement evaluates to true else if and else statements are not evaluated. We used `%` or remainder operator to check if number is divisible by 3 or 5.\n\n\n> Go does not have while or do while looping construct. There is only `for` statement for looping but you can use it in a variety of different ways. This is how you can use for loop like a while loop in other languages.\n  ```go\n  number := 1\n  for number <= 100 {\n    fmt.Println(number)\n    number = number + 1\n  }\n  ```\n\nTo run the program, we will use the `go run` command as shown below. The command shown below assumes that you are inside the `programs` directory where you have created `fizzbuzz.go` file.\n\n```\n$ go run fizzbuzz.go\n```\n```\n1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n....\n```\n\n------\n\n## Problem 5: ReverseNumbers\n\nWrite a program that reverse an array of numbers.\n\nJust like the previous problem let's think how we will do that in any programming language. Take your time and think about it..\n\n> To write ReverseNumbers program I will do the following:\n1. I will create a result array with size equal to input array\n2. I will iterate over the array in reverse direction.\n  * I will add each item to the result\n\nThis simple program teaches us how to iterate an array in opposite direction and how to store elements in an array.\n\nCreate a new file `reverse.go` inside the `programs` directory. Copy and paste the code shown below in the `reverse.go` file.\n\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc main() {\n\tinputArr := [5]int{1, 2, 3, 4, 5}\n\tvar reversedArr [len(inputArr)]int\n\tfor i, j := len(inputArr)-1, 0; i >= 0; i-- {\n\t\treversedArr[j] = inputArr[i]\n\t\tj++\n\t}\n\n\tfmt.Println(\"Input:\", inputArr)\n\tfmt.Println(\"Reversed:\", reversedArr)\n}\n```\n\nLet's understand the code shown above.\n\n1. We created an input array and initialized it with few numbers. This is a shorter and concise syntax to define and initialize arrays. You could also initialize array in multiple lines to improve readability. It is required to add `,` after the last value as well.\n  ```go\n  inputArr := [5]int{\n    1,\n    2,\n    3,\n    4,\n    5,\n  }\n  ```\n\n2. Next, we created a new array `reversedArr` for storing the reversed array. This time we only defined the array and it intialized with empty values `[0 0 0 0 0]`.\n\n3. Then, we iterated over the `inputArr` in reverse direction. Note that we initialized multiple variables in a for loop `i` and `j` and we used `i--`  to decrement value.\n\n4. In each loop, we added ith value of inputArr to to jth location of reversedArr. Also, we incremented j as well.\n\n5. Finally, we printed both input and reversed arrays.\n\nTo run the program, we will use the `go run` command as shown below. The command shown below assumes that you are inside the `programs` directory where you have created `reverse.go` file.\n\n```\n$ go run reverse.go\n```\n```\nInput: [1 2 3 4 5]\nReversed: [5 4 3 2 1]\n```\n\n------\n\n## Problem 6: ClosestPair\n\nGiven n numbers, find a pair which is closest to each other. For example, given `10, 6, 2, 5` numbers `5,6` is the closest pair.\n\nJust like the previous problem let's think how we will do that in any programming language. Take your time and think about it..\n\n> To write this program I will do following:\n  1. Create a new function `closestPair` that takes an array of integers\n  2. Sort the numbers\n    * After sorting closest pair will be next to each other.\n  3. Iterate over all the sorted numbers starting\n    * For each number find the difference between current and next number\n    * if difference is less than the previous pair difference then store the two numbers\n  4. Return the two numbers\n\nThis program will teach us how to use array functions like `sort` and `len`.\n\nCreate a new file `closestpair.go` inside the `programs` directory. Copy and paste the code shown below in the `closestpair.go` file.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"sort\"\n)\n\nfunc closestPair(numbers []int) (int, int) {\n\tsort.Ints(numbers)\n\tvar n1, n2 int\n\tvar diff int = math.MaxInt32\n\tfor index := 0; index < len(numbers)-1; index++ {\n\t\tcur := numbers[index]\n\t\tnext := numbers[index+1]\n\t\tif next-cur < diff {\n\t\t\tdiff = next - cur\n\t\t\tn1 = cur\n\t\t\tn2 = next\n\t\t}\n\t}\n\treturn n1, n2\n}\n\nfunc main() {\n\tnumbers := []int{10, 6, 2, 5}\n\tfmt.Println(closestPair(numbers))\n}\n```\n\nLet's understand the code we have written above:\n\n1. We imported three packages `fmt`,`math`, and `sort`. Rather than writing three import statements we used import declaration that allows us to import multiple packages using one declaration.\n2. Next, we defined the `closestPair` function that takes a slice of integers and return two integer. In Go, a function can return multiple values. Here, I have used it like a tuple. A slice is like an ArrayList if you know Java. Slice is a data structure based on array but it overcomes few short comings of array. As you might know, array are fixed size so you have to define their size before you can use them. This becomes very limiting so Go provides you slice which allow you to create dynamic length arrays. To covert an array to a slice, you can do following:\n  ```go\n  numbers := [3]int{1,2,3}\n  // to convert it to a slice\n  sliceOfNumbers := numbers[:]\n  ```\n  If we had used array then we have to write code as shown below.\n  ```go\n  func closestPair(numbers [4]int) (int, int) {\n  \tsort.Ints(numbers[:])\n  \tvar n1, n2 int\n  \tvar diff int = math.MaxInt32\n  \tfor index := 0; index < len(numbers)-1; index++ {\n  \t\tcur := numbers[index]\n  \t\tnext := numbers[index+1]\n  \t\tif next-cur < diff {\n  \t\t\tdiff = next - cur\n  \t\t\tn1 = cur\n  \t\t\tn2 = next\n  \t\t}\n  \t}\n  \treturn n1, n2\n  }\n  ```\n  As you can see hardcoded size of input numbers to 4 and we used `[:]` to covert numbers array to slice as `sort.Ints` accept a slice.\n3. Then, we sorted the numbers slice using the `sort` package `Ints` function. It will sort them in ascending order.\n4. Then we iterated over the sorted numbers slice comparing each consecutive pair difference with previous pair difference. If pair difference is less than previous pair difference then we stored the numbers and difference.\n5. Finally, we returned both the numbers.\n\nWhen you will run the program, you will see following result.\n\n```bash\n$ go run programs/closestpair.go\n```\n```\n5 6\n```\n\n------\n\n## Program 7: Deduplication\n\nWrite a function `dedup` that takes an int array and returns a sorted array with duplicates removed. For example, given numbers `2,6,5,2,5,3` we should get `2,3,5,6` as output.\n\nJust like the previous problem let's think how we will do that in any programming language. Take your time and think about it..\n\n> To write Deduplication program I will do the following:\n  1. Write a function `dedup` that takes an array of numbers and return an deduplicated array of numbers.\n  2. Sort the numbers.\n    * After sort, duplicates will be next to each other.\n  3. Create a new array for storing the unique numbers\n  4. Iterate over all sorted numbers\n    * Add the number to the result only if it is not equal to the last element or result was empty\n  5. Return the result\n\nThis program will teach us how to create a slice and add elements to it. Also, we will learn another style of writing for loop in Go.\n\nCreate a new file `dedup.go` inside the `programs` directory. Copy and paste the code shown below in the `dedup.go` file.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n)\n\nfunc dedup(numbers []int) []int {\n\tsort.Ints(numbers)\n\tresult := make([]int, 0)\n\tfor _, number := range numbers {\n\t\tlastIndex := len(result) - 1\n\t\tif len(result) == 0 || result[lastIndex] != number {\n\t\t\tresult = append(result, number)\n\t\t}\n\t}\n\treturn result\n}\n\nfunc main() {\n\tnumbers := []int{10, 9, 2, 2, 5, 4, 12, 3, 6, 7, 6, 4}\n\tfmt.Println(dedup(numbers))\n\tfmt.Println(dedup([]int{0, 1, 2, 3}))\n}\n```\n\nThe code shown above does the following:\n\n1. We create a `dedup` function that takes a slice and returns a slice of unique numbers.\n2. Next, we sorted the numbers using the sort package.\n3. Then, we create the slice `result` which will store the unique elements. We used Go's inbuilt make function to do that. This will create a slice that is associated with an underlying int array of length 0.\n4. Then, we  iterated over numbers slice using the `for range` loop construct. This form of for construct return the index and element. As we don't need index so we used `_` instead of giving it a proper name.\n5. For each iteration, we compared if the last element in the result is equal to the number. If yes then we ignore it otherwise we add element to the list using the `append` function.\n6. Finally, we return the result slice.\n\nWhen you will run the program, you will see following result.\n\n```\n$ go run programs/dedup.go\n```\n```\n[2 3 4 5 6 7 9 10 12]\n[0 1 2 3]\n```\n\n------\n\n## Problem 8: DuplicateElements\n\nDuplicate the elements of an array a given number of times. For example, given numbers `1,2,3` if we ask yo to duplicate three times then we should get `1,1,1,2,2,2,3,3,3`\n\nJust like the previous problem let's think how we will do that in any programming language. Take your time and think about it..\n\n> To write DuplicateElements program I will do the following:\n1. Create a new function that takes an array of numbers and number of times to duplicate. It returns an array with duplicates.\n2. Create an array to store result. The length will be equal to times to duplicate times input array length.\n2. For each element in the array\n  * Run another for loop from 0 to times to duplicate\n    * add element to the result array\n    * Increment the resulting array index\n\nCreate a new file `duplicate.go` inside the `programs` directory. Copy and paste the code shown below in the `duplicate.go` file.\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc duplicate(numbers []int, n int) []int  {\n  resultArrayLength := len(numbers)*n\n  result := make([]int, resultArrayLength)\n  resIdx := 0\n  for index := 0; index < len(numbers); index++ {\n    for j := 0;  j < n; j++ {\n      result[resIdx] = numbers[index]\n      resIdx++\n    }\n  }\n  return result\n}\n\nfunc main() {\n  numbers := []int{1,2,3}\n  fmt.Println(duplicate(numbers, 3))\n}\n```\n\n\nWhen you will run this program then you will see following output.\n\n```\n$ go run programs/duplicate.go\n```\n```\n[1 1 1 2 2 2 3 3 3]\n```\n\n------\n\n## Problem 9: DuplicateElements with Command Line Arguments\n\nDuplicate the elements of an Array a given number of times. This is a slight variation of the above program. This time we will take number of elements to duplicate as a command-line argument.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n)\n\nfunc duplicate(arr []int, n int) []int {\n\tresultArrayLength := len(arr) * n\n\tresult := make([]int, resultArrayLength)\n\tresultArrayIndex := 0\n\tfor index := 0; index < len(arr); index++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tresult[resultArrayIndex] = arr[index]\n\t\t\tresultArrayIndex++\n\t\t}\n\t}\n\treturn result\n}\n\nfunc main() {\n\tnumbers := []int{1, 2, 3}\n\targs := os.Args[1:]\n\tif n, err := strconv.Atoi(args[0]); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(2)\n\t} else {\n\t\tfmt.Println(duplicate(numbers, n))\n\t}\n\n}\n```\n\nRun the program passing the command line argument 10, you will see following output.\n\n```\n$ go run programs/duplicate-cli.go 10\n```\n```\n[1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3]\n```\n\nIf you pass invalid input then you will get error as shown below.\n\n```\n$ go run programs/duplicate-cli.go wdee\n```\n```\nstrconv.ParseInt: parsing \"wdee\": invalid syntax\nexit status 2\n```\n\n------\n\n## Problem 10: WordCount\n\n\nThe classic word-count algorithm: given an array of strings, return a Map<String, Integer> with a key for each different string, with the value the number of times that string appears in the array.\n\n```go\npackage main\n\nimport \"fmt\"\n\nfunc wordCount(words []string) map[string]int {\n\twordCountMap := make(map[string]int)\n\tfor _, word := range words {\n\t\tif count, ok := wordCountMap[word]; ok {\n\t\t\twordCountMap[word] = count + 1\n\t\t} else {\n\t\t\twordCountMap[word] = 1\n\t\t}\n\t}\n\treturn wordCountMap\n}\n\nfunc main() {\n\tfmt.Println(wordCount([]string{\"a\", \"b\", \"a\", \"c\", \"b\"}))\n\tfmt.Println(wordCount([]string{\"c\", \"b\", \"a\"}))\n\tfmt.Println(wordCount([]string{\"c\", \"c\", \"c\", \"c\"}))\n}\n```\n\nWhen you run this program then you will get following output.\n\n```\n$ go run programs/wordcount.go\n```\n```\nmap[a:2 b:2 c:1]\nmap[c:1 b:1 a:1]\nmap[c:4]\n```\n\n------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/36](https://github.com/shekhargulati/52-technologies-in-2016/issues/36).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/27-golang-part1)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/closestpair.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\t\"sort\"\n)\n\nfunc closestPair(numbers []int) (int, int) {\n\tsort.Ints(numbers)\n\tvar n1, n2 int\n\tvar diff int = math.MaxInt32\n\tfor index := 0; index < len(numbers)-1; index++ {\n\t\tcur := numbers[index]\n\t\tnext := numbers[index+1]\n\t\tif next - cur < diff {\n\t\t\tdiff = next - cur\n\t\t\tn1 = cur\n\t\t\tn2 = next\n\t\t}\n\t}\n\treturn n1, n2\n}\n\nfunc main() {\n\tnumbers := []int{10, 6, 2, 5}\n\tfmt.Println(closestPair(numbers))\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/concatenator.go",
    "content": "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tvar fName string = \"Shekhar\"\n\tvar lName = \"Gulati\"\n\tvar fullName = fName + \" \" + lName\n\tfmt.Println(fullName)\n\tfmt.Println(fName, lName)\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/dedup.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"sort\"\n)\n\nfunc dedup(numbers []int) []int {\n\tsort.Ints(numbers)\n\tresult := make([]int, 0)\n\tfor _, number := range numbers {\n\t\tlastIndex := len(result) - 1\n\t\tif len(result) == 0 || result[lastIndex] != number {\n\t\t\tresult = append(result, number)\n\t\t}\n\t}\n\treturn result\n}\n\nfunc main() {\n\tnumbers := []int{10, 9, 2, 2, 5, 4, 12, 3, 6, 7, 6, 4}\n\tfmt.Println(dedup(numbers))\n\tfmt.Println(dedup([]int{0, 1, 2, 3}))\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/duplicate-cli.go",
    "content": "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"strconv\"\n)\n\nfunc duplicate(arr []int, n int) []int {\n\tresultArrayLength := len(arr) * n\n\tresult := make([]int, resultArrayLength)\n\tresultArrayIndex := 0\n\tfor index := 0; index < len(arr); index++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tresult[resultArrayIndex] = arr[index]\n\t\t\tresultArrayIndex++\n\t\t}\n\t}\n\treturn result\n}\n\nfunc main() {\n\tnumbers := []int{1, 2, 3}\n\targs := os.Args[1:]\n\tif n, err := strconv.Atoi(args[0]); err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(2)\n\t} else {\n\t\tfmt.Println(duplicate(numbers, n))\n\t}\n\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/duplicate.go",
    "content": "package main\n\nimport \"fmt\"\n\nfunc duplicate(numbers []int, n int) []int  {\n  resultArrayLength := len(numbers)*n\n  result := make([]int, resultArrayLength)\n  resIdx := 0\n  for index := 0; index < len(numbers); index++ {\n    for j := 0;  j < n; j++ {\n      result[resIdx] = numbers[index]\n      resIdx++\n    }\n  }\n  return result\n}\n\nfunc main() {\n  numbers := []int{1,2,3}\n  fmt.Println(duplicate(numbers, 3))\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/equalornotequal.go",
    "content": "package main\n\nimport \"fmt\"\n\nfunc equalOrNotEqual(first, second, third int) bool {\n  if first == second && second == third {\n    return true\n  }else{\n    return false\n  }\n}\n\nfunc main() {\n  fmt.Println(equalOrNotEqual(1,2,3))\n  fmt.Println(equalOrNotEqual(7,7,7))\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/fizzbuzz.go",
    "content": "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tfor number := 1; number <= 100; number++ {\n\t\tif number%3 == 0 && number%5 == 0 {\n\t\t\tfmt.Println(\"FizzBuzz\")\n\t\t} else if number%3 == 0 {\n\t\t\tfmt.Println(\"Fizz\")\n\t\t} else if number%5 == 0 {\n\t\t\tfmt.Println(\"Buzz\")\n\t\t} else {\n\t\t\tfmt.Println(number)\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/greeter.go",
    "content": "package main\n\nimport \"fmt\"\n\nfunc main() {\n  fmt.Println(\"Welcome, Shekhar Gulati\")\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/import_examples.go",
    "content": "package main\n\nimport f \"fmt\"\n\nfunc main() {\n  f.Println(\"Welcome, Shekhar Gulati\")\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/reverse.go",
    "content": "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tinputArr := [5]int{\n\t\t1,\n\t\t2,\n\t\t3,\n\t\t4,\n\t\t5,\n\t}\n\tvar reversedArr [len(inputArr)]int\n\tfor i, j := len(inputArr)-1, 0; i >= 0; i-- {\n\t\treversedArr[j] = inputArr[i]\n\t\tj++\n\t}\n\n\tfmt.Println(\"Input:\", inputArr)\n\tfmt.Println(\"Reversed:\", reversedArr)\n}\n"
  },
  {
    "path": "27-learn-golang-for-great-good/programs/wordcount.go",
    "content": "package main\n\nimport \"fmt\"\n\nfunc wordCount(words []string) map[string]int {\n\twordCountMap := make(map[string]int)\n\tfor _, word := range words {\n\t\tif count, ok := wordCountMap[word]; ok {\n\t\t\twordCountMap[word] = count + 1\n\t\t} else {\n\t\t\twordCountMap[word] = 1\n\t\t}\n\t}\n\treturn wordCountMap\n}\n\nfunc main() {\n\tfmt.Println(wordCount([]string{\"a\", \"b\", \"a\", \"c\", \"b\"}))\n\tfmt.Println(wordCount([]string{\"c\", \"b\", \"a\"}))\n\tfmt.Println(wordCount([]string{\"c\", \"c\", \"c\", \"c\"}))\n}\n"
  },
  {
    "path": "28-ionic/README.md",
    "content": "Building `Read It Later` Mobile Application Using Ionic Framework\n----\n\nWelcome to twenty-eighth post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. The mobile application development space offers quite a range of development platforms. I am not going to talk about the pros and cons of each of these platforms. Instead, I will show you how to build a `Read It Later` hybrid mobile app using the [Ionic framework](http://ionicframework.com/). Hybrid mobile apps use mobile device browser to display its interface. Hybrid apps are built using web technologies like HTML, JavaScript, and CSS that most web programmers know and use. Ionic is a hybrid mobile application development framework and toolset that is built on top of [AngularJS](https://angularjs.org/) and [Apache Cordova](https://cordova.apache.org/). Ionic uses AngularJS as its web application framework of choice and Apache Cordova is used to access mobile features and packaging the native app.\n\nThe idea behind `Read It Later` application is very simple. These days many Twitter users like (or favorite) a tweet to mark it for later read. Our application will subscribe to a user like feed and store it in a database and expose the read it later feed using a nice to use REST API. Our ionic based mobile application will consume the REST API and render the user his/her read it later feed.\n\n> **This is a guest post by [Rahul Sharma](https://www.linkedin.com/in/rahul-sharma-72531111). 52 technologies series is now open for external contributions so if you would like to contribute a guest post send us a PR.**\n\n## Application components\n\nThe complete application will consist of two components:\n\n* **REST API Backend** : The server-side component listens to the Twitter API to know any tweets you `liked`. The complete application is built in Python using `tweepy` and `newspaper` libraries. The list of your `likes` is exposed via a JSON API.\n\n* **Mobile Application** : The mobile side component reads the `likes` from the server and presents them in the form of a simple list. Each item in the list consists of an image, summary text, and a title. The complete list can be updated using the `Pull to refresh` feature.\n\nThe complete source code for the tutorial is available on [Github](./dailyreads)\n\n## Building `Read It Later` REST API\n\nWe will reuse the python based [`Read It Later`](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/16-newspaper) web application developed few weeks back. As stated above, application is built using [tweepy](https://pypi.python.org/pypi/tweepy), [newspaper](https://pypi.python.org/pypi/newspaper), and [flask](https://pypi.python.org/pypi/flask). We will add JSON based API to the application. In this tutorial, we will discuss application backend briefly. Please refer to the [original tutorial](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/16-newspaper) for more details.\n\nThe application has a `LikedTweetsListener` which listens to tweets liked by a user. `LikedTweetsListener` is a sub class of `tweepy.streaming.StreamListener` provided by `tweepy` library. When an application receives a tweet, it builds a `newspaper.Article` and extracts information from it. Then, The complete info is saved in an in-memory list. When a user makes a GET request to the index `\\` page, then a web page is built using the list and rendered via flask `render_template` function.\n\nOur mobile application needs access to the information in the list. So, we will use Python's inbuilt JSON utilities to convert the data to a JSON document. We will use `json.dumps` to construct a JSON document and then construct a flask `Response` object. The response should have `application/json` as its mime type.\n\n```python\n@app.route(\"/api/bookmarks\")\ndef bookmarks():\n    return Response(json.dumps(sorted(articles, key=lambda article: article[\"liked_on\"], reverse=True)),  mimetype='application/json')\n```\n\nAlso, we have to update `extract_article` so that data can be serialized to JSON. In the previous post, `text` was saved as bytes which could not be converted to JSON. Also, we have removed `publish_date` as it was not required. The updated `extract_article` method is shown below.\n\n```python\ndef extract_article(story_url):\n    article = Article(story_url)\n    article.download()\n    article.parse()\n    title = article.title\n    img = article.top_image\n    text = article.text.split('\\n\\n')[0] if article.text else \"\"\n    return {\n        'title':title,\n        'img':img,\n        'text': text\n    }\n```\n\nNow run the application and access http://localhost:5000/api/bookmarks. It should send back a JSON array.\n\n```\n$ curl http://localhost:5000/api/bookmarks | jq '.'\n```\n```json\n[\n  {\n    \"text\": \"Another week, another police shooting in the United States. So far this year, 569 people have be killed by US police, according to The Guardian’s count. Police brutality is a horrific normality and, in more ways than one, black men being shot by police has become the modern-day equivalent of lynching.\",\n    \"story_url\": \"http://ift.tt/29u3OZp\",\n    \"liked_on\": 1468142910.676542,\n    \"img\": \"https://qzprod.files.wordpress.com/2016/07/rtr2ml9x.jpg?quality=80&strip=all&w=1600\",\n    \"title\": \"How do police handle violence in countries where officers don’t carry guns? — Quartz\"\n  },\n  {\n    \"text\": \"\",\n    \"story_url\": \"http://www.forbes.com/sites/brucelee/2016/07/06/could-brain-research-for-the-past-15-years-be-wrong/?utm_source=TWITTER&utm_medium=social&utm_content=511409081&utm_campaign=sprinklrForbesTech#77508e425836\",\n    \"liked_on\": 1468142649.838931,\n    \"img\": \"http://specials-images.forbesimg.com/imageserve/141951019/640x434.jpg?fit=scale\",\n    \"title\": \"Could Brain Research From The Past 15 Years Really Be Wrong?\"\n  }\n]\n```\n\n> **In the curl command shown above, we have used `jq` to pretty print JSON result. `jq` was covered in [week 20 post](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/20-json/README.md#project-2-jq).**\n\nThis concludes our section on REST API backend. Let's build our mobile application now.\n\n## Building `Read It Later` mobile application\n\nNow, let's embark on the journey to build a hybrid mobile application using Ionic. Ionic is based on AngularJS. So, knowledge of AngularJS is required. The application will be written in ECMAScript 6 that will be [transpiled](https://en.wikipedia.org/wiki/Source-to-source_compiler) using [BabelJS](https://babeljs.io/).\n\nAs mentioned in the introduction, Ionic depends on Apache Cordova for building and packaging the native app. So, let's start by installing `cordova` and  `ionic`  command line utilities using `npm`.\n\n```bash\n$ npm install -g cordova ionic\n```\n\nThe cli gives a host of features to generate, build, and run the project. Run the `ionic` command to get the list of tasks. Navigate to a convenient directory on your filesystem where you want to create the mobile application. The structure that I am using is shown below. We have a parent directory called `dailyreads` and inside we have two directories `backend` and `mobileapp`. The `backend` directory will house source code related to our REST API backend. The `mobileapp` directory will house source code for our mobile app source code.\n\n```\ndailyreads\n  backend\n  mobileapp\n```\n\nNow, we will generate an Ionic starter project by running the following command. Make sure you are inside the `dailyreads` directory.\n\n```bash\n$ ionic start mobileapp blank\n```\n\nAbove we have used `blank` template, this a prebuilt template provided by Ionic. Ionic offers a bunch of templates like `sidemenu`,`tabs`,`blank`, etc. that you can use to start off your app development. Besides these, you can use any custom template as well.\n\nThe above command will generate a bunch of source files in the `mobileapp` folder.\n\n![Project Structure](images/structure.png)\n\n- The `config.xml` contains configuration for the application. It can alter various behaviors of the project.\n- The `gulpfile.js`  defines gulp tasks for the project.\n- The `www` defines the bundle which contains html, js, css, libs, etc. is packaged with the application.\n- The `bower.json` and `package.json` define dependencies / dev-dependencies for the project.\n- The `plugins` describes the Cordova and ionic plugins being used.\n- The `platform` lists the application platforms being built.\n\nLet's go into the `mobileapp` directory and run the application by issuing the following command.\n\n```bash\n$ cd mobileapp\n$ ionic serve\n```\n\nThe server would start and would render a page at http://localhost:8100/\n\n![Blank Application](images/blank.png)\n\nThe application is now running in the `live` mode. If I make changes to the files inside the `www` folder, then they will be reloaded automatically thanks to the livereload feature.\n\nThe complete application is deployed from the `app.js` file inside the `www\\js` directory. Try making some changes to see the effect. The `app.js` is written using ECMAScript 5 syntax, but I will write this application using ECMAScript 6(or ES6). So, we have to setup the project so that we can use ES6 and transpile it to previous JavaScript versions using [Babel](https://babeljs.io/).\n\nI will write ES6 code and then ask `gulp` to convert it to previous versions of JavaScript using `babel`.  To do so, I will create a new directory `src` parallel to the `www` directory. Now, move the `app.js` from `www\\js` to the `src\\js` directory.\n\nBefore we can use gulp, we have to install `gulp-babel`.\n\n```bash\n$ npm install gulp-babel --save\n```\n\nLet's modify the `gulpfile.js` to define `babel` gulp task as shown below.\n\n```javascript\nvar babel = require('gulp-babel');\nvar paths = { es6: ['./src/js/*.js'],  sass: ['./scss/**/*.scss'] };\ngulp.task(\"babel\", function () {\n  return gulp.src(paths.es6)\n    .pipe(babel({presets: ['es2015']}))\n    .pipe(gulp.dest(\"www/js\"));\n});\n```\n\nAdd `babel` task as a dependency on `watch` and `default` tasks as shown below. This will make sure `babel` task is run whenever `default` and `watch` tasks are executed.\n\n```javascript\ngulp.task('default', ['babel','sass']);\ngulp.task('watch', function() {\n  gulp.watch(paths.es6, ['babel']);\n  gulp.watch(paths.sass, ['sass']);\n});\n```\n\nNow run the `gulp` command followed by `ionic serve` command. It should render the same blank page. This is all good, but writing two commands every time is painful. It is important to note the now `ionic` is  no longer listening to file changes to `src` folder and it will not refresh if we make any changes.\n\n> In order to use the latest methods like Array.find we need to bundle `babel-polyfill.js` with our application. We can install the same using `bower` : `bower install babel-polyfill --save`. Now include the script in `index.html` :\n  ```\n  <script src=\"lib/babel-polyfill/browser-polyfill.js\"></script>\n  ```\n\nTo fix the above issues, let's modify `ionic.project` file. As a first step we should define the correct `name` of the project. Post that, define `gulpDependantTasks` property, the property signified `gulp` tasks which need to be executed before a build. So we can say : `gulpDependantTasks : [\"babel\"]`\nAdd `gulpStartupTasks` property, it signifies the gulp tasks to keep alive during `ionic server`. Thus we can say `gulpStartupTasks : [\"watch\"]`\n\nNow do `ionic serve`. It should execute `gulp-babel` first. Try modifying `src/js/app.js` the server should detect the change.\n\n> As a personal preference, I will add `html` and `css` files to the `src` folder and additionally define `gulp` tasks to build them.\n\nThe project is now setup correctly, so let's start building our application.\n\nAs a starting point, rename the Angular module in `app.js` from 'starter' to `dailyReads`. Also modify `ng-app` attribute of `body` tag in `index.html` to reflect the same.\n\nAny usable app will consist of  multiple views each offering different things. Thus, we will build an app geared towards multi-views even though we will build a single view. In order to do so, remove the `ion-content` tag from `index.html` and replace it with `ion-nav-view`\n\nAlso, we will replace the `ion-header` with an `ion-nav-bar`. The bar will allow us to have navigation buttons and headers based on the rendered view. All the changes suggested above are shown below.\n\n```html\n<body ng-app=\"dailyReads\">\n  <ion-nav-bar class=\"bar-positive\">\n  </ion-nav-bar>\n  <ion-nav-view></ion-nav-view>\n</body>\n```\n\nLet's head back to `src\\js\\app.js` to construct the view. In order to do so we need to define a state in Angular routes.\n\n```javascript\n.config(($stateProvider,$urlRouterProvider) => {\n  $stateProvider.state(\"home\",{\n    cache: false,\n    url :'/home',\n    controller :'HomeController',\n    templateUrl : 'views/home/home.html'\n  });\n\n  $urlRouterProvider.otherwise('/home');\n})\n```\n\nIn the above code we defined the `home` state and configured the route provider to render it.\n\nNow let's build the `HomeController`. All we want to do is to use the `$http` service to call `http://localhost:5000/api/` and store the data in the `$scope` object as shown below.\n\n```javascript\n.controller('HomeController',($scope,$http) => {\n    $http.get(\"http://localhost:5000/api/bookmarks\")\n          .success(function(data){\n            $scope.news = data;\n         }).error(function(data, status, headers, config){\n           console.log('oops error occurred while retrieving data');\n         });\n  })\n```\n\nAll that is left now is to build the HTML page. For now we will keep the view simple. The news item will be rendered as [ionic cards](http://ionicframework.com/docs/components/#card-images), listing down the title, image and text.\n\n```html\n<ion-view view-title=\"Home\">\n  <ion-content>\n    <div class=\"list card\" ng-repeat=\"newsInfo in news track by $index\">\n      <div class=\"item item-body\">\n         <img src=\"{{newsInfo.img}}\">\n         <p>\n           {{ newsInfo.text }}\n         </p>\n       </div>\n    </div>\n  </<ion-content>  .\n</ion-view>\n```\n\nThe above code defines the view with a title `Home`.  Next we define the `ion-content`. The directive defines a content area which can be used for scrolling. The rest is a `div` which displays the individual item.\n\nLooks like we are done, so let's start Python server `python app.py` and do a `like` on twitter. The 'http://localhost:5000/' show the favorite. The 'http://localhost:5000/api/bookmarks' gives back a JSON.\n\nNow, run the mobile app using `ionic serve`. It works, but does not show the  favorite. Now, let's look into `Developer Console` in your browser. It lists out an error.\n\n```\nXMLHttpRequest cannot load http://localhost:5000/api/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access\n```\n\nOk! So looks like we are doing cross origin requests. There is a server running on port 8100 and another on 5000, so we need to configure proper set of headers to make it working. This needs to be done on the python server side.\n\nInstall the `flask-cors` extension using `pip`.\n\n```bash\n$ pip install -g flask-cors\n```\nNow configure the `flask` application to use the `cors` extension\n\n```python\nfrom flask.ext.cors import CORS\n\napp = Flask(__name__)\nCORS(app)\n```\n\nRun the server and the mobile application. The favorites should be rendered on the server page, JSON api and the mobile application.\n\nThe server shows all the `liked` tweets and updates the view as soon as on tweets are available. But the mobile app does not update the list. So now we will add the `Pull to refresh` feature which will update the list of favorites. Ionic provides the `ion-refresher` tag to do the same.\n\n```html\n<ion-refresher pulling-text=\"Pull to refresh...\" on-refresh=\"reloadFavs()\">\n</ion-refresher>\n```\n\nThe tag needs a method which it will call when dragged. Add `reloadFavs` method to `HomeController`. The method should specify when to stop showing loading indicator. This is done by sending `scroll.refreshComplete` event.\n\n```javascript\n$scope.reloadFavs = function(){\n  $http.get(\"http://localhost:5000/api/bookmarks\")\n        .success(function(data){\n          $scope.news = data;\n          $scope.$broadcast('scroll.refreshComplete');\n       }).error(function(data, status, headers, config){\n         console.log('oops error occured while refreshing data',JSON.stringify(data));\n          $scope.$broadcast('scroll.refreshComplete');\n       });\n}\n```\n\nLooks like we are done now !  But wait, we created the application but did not specify platforms(android/ios) for it. By default it will include `ios` platforms. To make a build on the same we would require `Xcode`. List the available platforms using cli :\n\n```bash\n$ ionic platform list\n```\n```\nInstalled platforms: ios 3.8.0\nAvailable platforms: amazon-fireos, android, blackberry10, browser, firefoxos, osx, webos\n```\n\nLet's add `android` platform using the cli :\n\n```bash\n$ ionic platform add android\n```\n\nNow build the `.apk` using `cordova compile android`. This should generate an `apk` file inside the `mobileapp/platforms/android/build/outputs/apk/` directory.\n\nNote, if we install the app to an Android device, it will not run as it is trying to load data from  `http://localhost:5000/api/bookmarks`. So make sure to replace the `localhost` with a server IP address. Even after we do, the application may not run various devices. This is due to the fact that android platform has a very strict control over what an app can perform. Since our application is trying to make calls to a server we need to whitelist the http calls. This is done by specifying the intent in `config.xml`.\n\n```xml\n<allow-intent href=\"http://*/*\" />\n```\n\nOur mobile app is now finally done! So some people might think that we can ship the app now to all kinds of online stores like google play. I would say that no, we are still a few steps away before we can accomplish that. We must release the app. The release process will optimize the build and add version it. Post that we need to have credentials for play store. I will leave this for a future post.\n\nThe application as of now offers a good test bed to learn and experiment more things like adding splash screens, icons or replacing the pull with a push(via ionic services). I will advise the readers to try out those features to learn more about the ionic framework.\n\n----------\n\nThat's all for this post. Please provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/37](https://github.com/shekhargulati/52-technologies-in-2016/issues/37).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/28-ionic)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "28-ionic/dailyreads/backend/.gitignore",
    "content": "venv/\n"
  },
  {
    "path": "28-ionic/dailyreads/backend/app.py",
    "content": "from __future__ import absolute_import, print_function\n\nfrom tweepy.streaming import StreamListener\nfrom tweepy import OAuthHandler\nfrom tweepy import Stream\nimport os\nimport json\nimport time\nfrom flask import Flask, render_template, Response\nfrom flask.ext.cors import CORS\n\napp = Flask(__name__)\nCORS(app)\n\n@app.route(\"/api/bookmarks\")\ndef bookmarks():\n    return Response(json.dumps(sorted(articles, key=lambda article: article[\"liked_on\"], reverse=True)),  mimetype='application/json')\n\n@app.route(\"/\")\ndef index():\n    return render_template(\"index.html\", articles=sorted(articles, key=lambda article: article[\"liked_on\"], reverse=True))\n\n\nconsumer_key=os.getenv(\"TWITTER_CONSUMER_KEY\")\nconsumer_secret=os.getenv(\"TWITTER_CONSUMER_SECRET\")\naccess_token=os.getenv(\"TWITTER_ACCESS_TOKEN\")\naccess_token_secret=os.getenv(\"TWITTER_ACCESS_SECRET\")\n\narticles = []\n\nclass LikedTweetsListener(StreamListener):\n    def on_data(self, data):\n        tweet = json.loads(data)\n        if 'event' in tweet and tweet['event'] == \"favorite\":\n            liked_tweet = tweet[\"target_object\"]\n            liked_tweet_text = liked_tweet[\"text\"]\n            story_url = extract_url(liked_tweet)\n            if story_url:\n                article = extract_article(story_url)\n                if article:\n                    article['story_url'] = story_url\n                    article['liked_on'] = time.time()\n                    articles.append(article)\n        return True\n\n    def on_error(self, status):\n        print(\"Error status received : {0}\".format(status))\n\n\ndef extract_url(liked_tweet):\n    url_entities = liked_tweet[\"entities\"][\"urls\"]\n    if url_entities and len(url_entities) > 0:\n        return url_entities[0]['expanded_url']\n    else:\n        return None\n\n\nfrom newspaper import Article\n\ndef extract_article(story_url):\n    article = Article(story_url)\n    article.download()\n    article.parse()\n    title = article.title\n    img = article.top_image\n    publish_date = article.publish_date\n    text = article.text.split('\\n\\n')[0] if article.text else \"\"\n    return {\n        'title':title,\n        'img':img,\n        'text': text\n    }\n\n\nif __name__ == '__main__':\n    l = LikedTweetsListener()\n    auth = OAuthHandler(consumer_key, consumer_secret)\n    auth.set_access_token(access_token, access_token_secret)\n\n    stream = Stream(auth, l)\n    stream.userstream(async=True)\n\n    app.run(debug=True)\n"
  },
  {
    "path": "28-ionic/dailyreads/backend/requirements.txt",
    "content": "Flask==0.11.1\nFlask-Cors==2.1.2\nJinja2==2.8\nMarkupSafe==0.23\nPillow==2.5.1\nPyYAML==3.11\nWerkzeug==0.11.10\nbeautifulsoup4==4.3.2\nclick==6.6\ncssselect==0.9.1\nfeedfinder2==0.0.1\nfeedparser==5.1.3\nitsdangerous==0.24\njieba==0.35\nlxml==3.3.5\nnewspaper==0.0.9.8\nnltk==2.0.5\noauthlib==1.1.2\npython-dateutil==2.4.0\nrequests==2.10.0\nrequests-oauthlib==0.6.1\nsix==1.10.0\ntldextract==1.5.1\ntweepy==3.5.0\nwsgiref==0.1.2\n"
  },
  {
    "path": "28-ionic/dailyreads/backend/static/css/1-col-portfolio.css",
    "content": "/*!\n * Start Bootstrap - 1 Col Portfolio HTML Template (http://startbootstrap.com)\n * Code licensed under the Apache License v2.0.\n * For details, see http://www.apache.org/licenses/LICENSE-2.0.\n */\n\nbody {\n    padding-top: 70px; /* Required padding for .navbar-fixed-top. Remove if using .navbar-static-top. Change if height of navigation changes. */\n}\n\nfooter {\n    margin: 50px 0;\n}"
  },
  {
    "path": "28-ionic/dailyreads/backend/static/css/bootstrap.css",
    "content": "/*!\n * Bootstrap v3.3.6 (http://getbootstrap.com)\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n */\n/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */\nhtml {\n  font-family: sans-serif;\n  -webkit-text-size-adjust: 100%;\n      -ms-text-size-adjust: 100%;\n}\nbody {\n  margin: 0;\n}\narticle,\naside,\ndetails,\nfigcaption,\nfigure,\nfooter,\nheader,\nhgroup,\nmain,\nmenu,\nnav,\nsection,\nsummary {\n  display: block;\n}\naudio,\ncanvas,\nprogress,\nvideo {\n  display: inline-block;\n  vertical-align: baseline;\n}\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n[hidden],\ntemplate {\n  display: none;\n}\na {\n  background-color: transparent;\n}\na:active,\na:hover {\n  outline: 0;\n}\nabbr[title] {\n  border-bottom: 1px dotted;\n}\nb,\nstrong {\n  font-weight: bold;\n}\ndfn {\n  font-style: italic;\n}\nh1 {\n  margin: .67em 0;\n  font-size: 2em;\n}\nmark {\n  color: #000;\n  background: #ff0;\n}\nsmall {\n  font-size: 80%;\n}\nsub,\nsup {\n  position: relative;\n  font-size: 75%;\n  line-height: 0;\n  vertical-align: baseline;\n}\nsup {\n  top: -.5em;\n}\nsub {\n  bottom: -.25em;\n}\nimg {\n  border: 0;\n}\nsvg:not(:root) {\n  overflow: hidden;\n}\nfigure {\n  margin: 1em 40px;\n}\nhr {\n  height: 0;\n  -webkit-box-sizing: content-box;\n     -moz-box-sizing: content-box;\n          box-sizing: content-box;\n}\npre {\n  overflow: auto;\n}\ncode,\nkbd,\npre,\nsamp {\n  font-family: monospace, monospace;\n  font-size: 1em;\n}\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n  margin: 0;\n  font: inherit;\n  color: inherit;\n}\nbutton {\n  overflow: visible;\n}\nbutton,\nselect {\n  text-transform: none;\n}\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  -webkit-appearance: button;\n  cursor: pointer;\n}\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  padding: 0;\n  border: 0;\n}\ninput {\n  line-height: normal;\n}\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n  -webkit-box-sizing: border-box;\n     -moz-box-sizing: border-box;\n          box-sizing: border-box;\n  padding: 0;\n}\ninput[type=\"number\"]::-webkit-inner-spin-button,\ninput[type=\"number\"]::-webkit-outer-spin-button {\n  height: auto;\n}\ninput[type=\"search\"] {\n  -webkit-box-sizing: content-box;\n     -moz-box-sizing: content-box;\n          box-sizing: content-box;\n  -webkit-appearance: textfield;\n}\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\nfieldset {\n  padding: .35em .625em .75em;\n  margin: 0 2px;\n  border: 1px solid #c0c0c0;\n}\nlegend {\n  padding: 0;\n  border: 0;\n}\ntextarea {\n  overflow: auto;\n}\noptgroup {\n  font-weight: bold;\n}\ntable {\n  border-spacing: 0;\n  border-collapse: collapse;\n}\ntd,\nth {\n  padding: 0;\n}\n/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */\n@media print {\n  *,\n  *:before,\n  *:after {\n    color: #000 !important;\n    text-shadow: none !important;\n    background: transparent !important;\n    -webkit-box-shadow: none !important;\n            box-shadow: none !important;\n  }\n  a,\n  a:visited {\n    text-decoration: underline;\n  }\n  a[href]:after {\n    content: \" (\" attr(href) \")\";\n  }\n  abbr[title]:after {\n    content: \" (\" attr(title) \")\";\n  }\n  a[href^=\"#\"]:after,\n  a[href^=\"javascript:\"]:after {\n    content: \"\";\n  }\n  pre,\n  blockquote {\n    border: 1px solid #999;\n\n    page-break-inside: avoid;\n  }\n  thead {\n    display: table-header-group;\n  }\n  tr,\n  img {\n    page-break-inside: avoid;\n  }\n  img {\n    max-width: 100% !important;\n  }\n  p,\n  h2,\n  h3 {\n    orphans: 3;\n    widows: 3;\n  }\n  h2,\n  h3 {\n    page-break-after: avoid;\n  }\n  .navbar {\n    display: none;\n  }\n  .btn > .caret,\n  .dropup > .btn > .caret {\n    border-top-color: #000 !important;\n  }\n  .label {\n    border: 1px solid #000;\n  }\n  .table {\n    border-collapse: collapse !important;\n  }\n  .table td,\n  .table th {\n    background-color: #fff !important;\n  }\n  .table-bordered th,\n  .table-bordered td {\n    border: 1px solid #ddd !important;\n  }\n}\n@font-face {\n  font-family: 'Glyphicons Halflings';\n\n  src: url('../fonts/glyphicons-halflings-regular.eot');\n  src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff2') format('woff2'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');\n}\n.glyphicon {\n  position: relative;\n  top: 1px;\n  display: inline-block;\n  font-family: 'Glyphicons Halflings';\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1;\n\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n.glyphicon-asterisk:before {\n  content: \"\\002a\";\n}\n.glyphicon-plus:before {\n  content: \"\\002b\";\n}\n.glyphicon-euro:before,\n.glyphicon-eur:before {\n  content: \"\\20ac\";\n}\n.glyphicon-minus:before {\n  content: \"\\2212\";\n}\n.glyphicon-cloud:before {\n  content: \"\\2601\";\n}\n.glyphicon-envelope:before {\n  content: \"\\2709\";\n}\n.glyphicon-pencil:before {\n  content: \"\\270f\";\n}\n.glyphicon-glass:before {\n  content: \"\\e001\";\n}\n.glyphicon-music:before {\n  content: \"\\e002\";\n}\n.glyphicon-search:before {\n  content: \"\\e003\";\n}\n.glyphicon-heart:before {\n  content: \"\\e005\";\n}\n.glyphicon-star:before {\n  content: \"\\e006\";\n}\n.glyphicon-star-empty:before {\n  content: \"\\e007\";\n}\n.glyphicon-user:before {\n  content: \"\\e008\";\n}\n.glyphicon-film:before {\n  content: \"\\e009\";\n}\n.glyphicon-th-large:before {\n  content: \"\\e010\";\n}\n.glyphicon-th:before {\n  content: \"\\e011\";\n}\n.glyphicon-th-list:before {\n  content: \"\\e012\";\n}\n.glyphicon-ok:before {\n  content: \"\\e013\";\n}\n.glyphicon-remove:before {\n  content: \"\\e014\";\n}\n.glyphicon-zoom-in:before {\n  content: \"\\e015\";\n}\n.glyphicon-zoom-out:before {\n  content: \"\\e016\";\n}\n.glyphicon-off:before {\n  content: \"\\e017\";\n}\n.glyphicon-signal:before {\n  content: \"\\e018\";\n}\n.glyphicon-cog:before {\n  content: \"\\e019\";\n}\n.glyphicon-trash:before {\n  content: \"\\e020\";\n}\n.glyphicon-home:before {\n  content: \"\\e021\";\n}\n.glyphicon-file:before {\n  content: \"\\e022\";\n}\n.glyphicon-time:before {\n  content: \"\\e023\";\n}\n.glyphicon-road:before {\n  content: \"\\e024\";\n}\n.glyphicon-download-alt:before {\n  content: \"\\e025\";\n}\n.glyphicon-download:before {\n  content: \"\\e026\";\n}\n.glyphicon-upload:before {\n  content: \"\\e027\";\n}\n.glyphicon-inbox:before {\n  content: \"\\e028\";\n}\n.glyphicon-play-circle:before {\n  content: \"\\e029\";\n}\n.glyphicon-repeat:before {\n  content: \"\\e030\";\n}\n.glyphicon-refresh:before {\n  content: \"\\e031\";\n}\n.glyphicon-list-alt:before {\n  content: \"\\e032\";\n}\n.glyphicon-lock:before {\n  content: \"\\e033\";\n}\n.glyphicon-flag:before {\n  content: \"\\e034\";\n}\n.glyphicon-headphones:before {\n  content: \"\\e035\";\n}\n.glyphicon-volume-off:before {\n  content: \"\\e036\";\n}\n.glyphicon-volume-down:before {\n  content: \"\\e037\";\n}\n.glyphicon-volume-up:before {\n  content: \"\\e038\";\n}\n.glyphicon-qrcode:before {\n  content: \"\\e039\";\n}\n.glyphicon-barcode:before {\n  content: \"\\e040\";\n}\n.glyphicon-tag:before {\n  content: \"\\e041\";\n}\n.glyphicon-tags:before {\n  content: \"\\e042\";\n}\n.glyphicon-book:before {\n  content: \"\\e043\";\n}\n.glyphicon-bookmark:before {\n  content: \"\\e044\";\n}\n.glyphicon-print:before {\n  content: \"\\e045\";\n}\n.glyphicon-camera:before {\n  content: \"\\e046\";\n}\n.glyphicon-font:before {\n  content: \"\\e047\";\n}\n.glyphicon-bold:before {\n  content: \"\\e048\";\n}\n.glyphicon-italic:before {\n  content: \"\\e049\";\n}\n.glyphicon-text-height:before {\n  content: \"\\e050\";\n}\n.glyphicon-text-width:before {\n  content: \"\\e051\";\n}\n.glyphicon-align-left:before {\n  content: \"\\e052\";\n}\n.glyphicon-align-center:before {\n  content: \"\\e053\";\n}\n.glyphicon-align-right:before {\n  content: \"\\e054\";\n}\n.glyphicon-align-justify:before {\n  content: \"\\e055\";\n}\n.glyphicon-list:before {\n  content: \"\\e056\";\n}\n.glyphicon-indent-left:before {\n  content: \"\\e057\";\n}\n.glyphicon-indent-right:before {\n  content: \"\\e058\";\n}\n.glyphicon-facetime-video:before {\n  content: \"\\e059\";\n}\n.glyphicon-picture:before {\n  content: \"\\e060\";\n}\n.glyphicon-map-marker:before {\n  content: \"\\e062\";\n}\n.glyphicon-adjust:before {\n  content: \"\\e063\";\n}\n.glyphicon-tint:before {\n  content: \"\\e064\";\n}\n.glyphicon-edit:before {\n  content: \"\\e065\";\n}\n.glyphicon-share:before {\n  content: \"\\e066\";\n}\n.glyphicon-check:before {\n  content: \"\\e067\";\n}\n.glyphicon-move:before {\n  content: \"\\e068\";\n}\n.glyphicon-step-backward:before {\n  content: \"\\e069\";\n}\n.glyphicon-fast-backward:before {\n  content: \"\\e070\";\n}\n.glyphicon-backward:before {\n  content: \"\\e071\";\n}\n.glyphicon-play:before {\n  content: \"\\e072\";\n}\n.glyphicon-pause:before {\n  content: \"\\e073\";\n}\n.glyphicon-stop:before {\n  content: \"\\e074\";\n}\n.glyphicon-forward:before {\n  content: \"\\e075\";\n}\n.glyphicon-fast-forward:before {\n  content: \"\\e076\";\n}\n.glyphicon-step-forward:before {\n  content: \"\\e077\";\n}\n.glyphicon-eject:before {\n  content: \"\\e078\";\n}\n.glyphicon-chevron-left:before {\n  content: \"\\e079\";\n}\n.glyphicon-chevron-right:before {\n  content: \"\\e080\";\n}\n.glyphicon-plus-sign:before {\n  content: \"\\e081\";\n}\n.glyphicon-minus-sign:before {\n  content: \"\\e082\";\n}\n.glyphicon-remove-sign:before {\n  content: \"\\e083\";\n}\n.glyphicon-ok-sign:before {\n  content: \"\\e084\";\n}\n.glyphicon-question-sign:before {\n  content: \"\\e085\";\n}\n.glyphicon-info-sign:before {\n  content: \"\\e086\";\n}\n.glyphicon-screenshot:before {\n  content: \"\\e087\";\n}\n.glyphicon-remove-circle:before {\n  content: \"\\e088\";\n}\n.glyphicon-ok-circle:before {\n  content: \"\\e089\";\n}\n.glyphicon-ban-circle:before {\n  content: \"\\e090\";\n}\n.glyphicon-arrow-left:before {\n  content: \"\\e091\";\n}\n.glyphicon-arrow-right:before {\n  content: \"\\e092\";\n}\n.glyphicon-arrow-up:before {\n  content: \"\\e093\";\n}\n.glyphicon-arrow-down:before {\n  content: \"\\e094\";\n}\n.glyphicon-share-alt:before {\n  content: \"\\e095\";\n}\n.glyphicon-resize-full:before {\n  content: \"\\e096\";\n}\n.glyphicon-resize-small:before {\n  content: \"\\e097\";\n}\n.glyphicon-exclamation-sign:before {\n  content: \"\\e101\";\n}\n.glyphicon-gift:before {\n  content: \"\\e102\";\n}\n.glyphicon-leaf:before {\n  content: \"\\e103\";\n}\n.glyphicon-fire:before {\n  content: \"\\e104\";\n}\n.glyphicon-eye-open:before {\n  content: \"\\e105\";\n}\n.glyphicon-eye-close:before {\n  content: \"\\e106\";\n}\n.glyphicon-warning-sign:before {\n  content: \"\\e107\";\n}\n.glyphicon-plane:before {\n  content: \"\\e108\";\n}\n.glyphicon-calendar:before {\n  content: \"\\e109\";\n}\n.glyphicon-random:before {\n  content: \"\\e110\";\n}\n.glyphicon-comment:before {\n  content: \"\\e111\";\n}\n.glyphicon-magnet:before {\n  content: \"\\e112\";\n}\n.glyphicon-chevron-up:before {\n  content: \"\\e113\";\n}\n.glyphicon-chevron-down:before {\n  content: \"\\e114\";\n}\n.glyphicon-retweet:before {\n  content: \"\\e115\";\n}\n.glyphicon-shopping-cart:before {\n  content: \"\\e116\";\n}\n.glyphicon-folder-close:before {\n  content: \"\\e117\";\n}\n.glyphicon-folder-open:before {\n  content: \"\\e118\";\n}\n.glyphicon-resize-vertical:before {\n  content: \"\\e119\";\n}\n.glyphicon-resize-horizontal:before {\n  content: \"\\e120\";\n}\n.glyphicon-hdd:before {\n  content: \"\\e121\";\n}\n.glyphicon-bullhorn:before {\n  content: \"\\e122\";\n}\n.glyphicon-bell:before {\n  content: \"\\e123\";\n}\n.glyphicon-certificate:before {\n  content: \"\\e124\";\n}\n.glyphicon-thumbs-up:before {\n  content: \"\\e125\";\n}\n.glyphicon-thumbs-down:before {\n  content: \"\\e126\";\n}\n.glyphicon-hand-right:before {\n  content: \"\\e127\";\n}\n.glyphicon-hand-left:before {\n  content: \"\\e128\";\n}\n.glyphicon-hand-up:before {\n  content: \"\\e129\";\n}\n.glyphicon-hand-down:before {\n  content: \"\\e130\";\n}\n.glyphicon-circle-arrow-right:before {\n  content: \"\\e131\";\n}\n.glyphicon-circle-arrow-left:before {\n  content: \"\\e132\";\n}\n.glyphicon-circle-arrow-up:before {\n  content: \"\\e133\";\n}\n.glyphicon-circle-arrow-down:before {\n  content: \"\\e134\";\n}\n.glyphicon-globe:before {\n  content: \"\\e135\";\n}\n.glyphicon-wrench:before {\n  content: \"\\e136\";\n}\n.glyphicon-tasks:before {\n  content: \"\\e137\";\n}\n.glyphicon-filter:before {\n  content: \"\\e138\";\n}\n.glyphicon-briefcase:before {\n  content: \"\\e139\";\n}\n.glyphicon-fullscreen:before {\n  content: \"\\e140\";\n}\n.glyphicon-dashboard:before {\n  content: \"\\e141\";\n}\n.glyphicon-paperclip:before {\n  content: \"\\e142\";\n}\n.glyphicon-heart-empty:before {\n  content: \"\\e143\";\n}\n.glyphicon-link:before {\n  content: \"\\e144\";\n}\n.glyphicon-phone:before {\n  content: \"\\e145\";\n}\n.glyphicon-pushpin:before {\n  content: \"\\e146\";\n}\n.glyphicon-usd:before {\n  content: \"\\e148\";\n}\n.glyphicon-gbp:before {\n  content: \"\\e149\";\n}\n.glyphicon-sort:before {\n  content: \"\\e150\";\n}\n.glyphicon-sort-by-alphabet:before {\n  content: \"\\e151\";\n}\n.glyphicon-sort-by-alphabet-alt:before {\n  content: \"\\e152\";\n}\n.glyphicon-sort-by-order:before {\n  content: \"\\e153\";\n}\n.glyphicon-sort-by-order-alt:before {\n  content: \"\\e154\";\n}\n.glyphicon-sort-by-attributes:before {\n  content: \"\\e155\";\n}\n.glyphicon-sort-by-attributes-alt:before {\n  content: \"\\e156\";\n}\n.glyphicon-unchecked:before {\n  content: \"\\e157\";\n}\n.glyphicon-expand:before {\n  content: \"\\e158\";\n}\n.glyphicon-collapse-down:before {\n  content: \"\\e159\";\n}\n.glyphicon-collapse-up:before {\n  content: \"\\e160\";\n}\n.glyphicon-log-in:before {\n  content: \"\\e161\";\n}\n.glyphicon-flash:before {\n  content: \"\\e162\";\n}\n.glyphicon-log-out:before {\n  content: \"\\e163\";\n}\n.glyphicon-new-window:before {\n  content: \"\\e164\";\n}\n.glyphicon-record:before {\n  content: \"\\e165\";\n}\n.glyphicon-save:before {\n  content: \"\\e166\";\n}\n.glyphicon-open:before {\n  content: \"\\e167\";\n}\n.glyphicon-saved:before {\n  content: \"\\e168\";\n}\n.glyphicon-import:before {\n  content: \"\\e169\";\n}\n.glyphicon-export:before {\n  content: \"\\e170\";\n}\n.glyphicon-send:before {\n  content: \"\\e171\";\n}\n.glyphicon-floppy-disk:before {\n  content: \"\\e172\";\n}\n.glyphicon-floppy-saved:before {\n  content: \"\\e173\";\n}\n.glyphicon-floppy-remove:before {\n  content: \"\\e174\";\n}\n.glyphicon-floppy-save:before {\n  content: \"\\e175\";\n}\n.glyphicon-floppy-open:before {\n  content: \"\\e176\";\n}\n.glyphicon-credit-card:before {\n  content: \"\\e177\";\n}\n.glyphicon-transfer:before {\n  content: \"\\e178\";\n}\n.glyphicon-cutlery:before {\n  content: \"\\e179\";\n}\n.glyphicon-header:before {\n  content: \"\\e180\";\n}\n.glyphicon-compressed:before {\n  content: \"\\e181\";\n}\n.glyphicon-earphone:before {\n  content: \"\\e182\";\n}\n.glyphicon-phone-alt:before {\n  content: \"\\e183\";\n}\n.glyphicon-tower:before {\n  content: \"\\e184\";\n}\n.glyphicon-stats:before {\n  content: \"\\e185\";\n}\n.glyphicon-sd-video:before {\n  content: \"\\e186\";\n}\n.glyphicon-hd-video:before {\n  content: \"\\e187\";\n}\n.glyphicon-subtitles:before {\n  content: \"\\e188\";\n}\n.glyphicon-sound-stereo:before {\n  content: \"\\e189\";\n}\n.glyphicon-sound-dolby:before {\n  content: \"\\e190\";\n}\n.glyphicon-sound-5-1:before {\n  content: \"\\e191\";\n}\n.glyphicon-sound-6-1:before {\n  content: \"\\e192\";\n}\n.glyphicon-sound-7-1:before {\n  content: \"\\e193\";\n}\n.glyphicon-copyright-mark:before {\n  content: \"\\e194\";\n}\n.glyphicon-registration-mark:before {\n  content: \"\\e195\";\n}\n.glyphicon-cloud-download:before {\n  content: \"\\e197\";\n}\n.glyphicon-cloud-upload:before {\n  content: \"\\e198\";\n}\n.glyphicon-tree-conifer:before {\n  content: \"\\e199\";\n}\n.glyphicon-tree-deciduous:before {\n  content: \"\\e200\";\n}\n.glyphicon-cd:before {\n  content: \"\\e201\";\n}\n.glyphicon-save-file:before {\n  content: \"\\e202\";\n}\n.glyphicon-open-file:before {\n  content: \"\\e203\";\n}\n.glyphicon-level-up:before {\n  content: \"\\e204\";\n}\n.glyphicon-copy:before {\n  content: \"\\e205\";\n}\n.glyphicon-paste:before {\n  content: \"\\e206\";\n}\n.glyphicon-alert:before {\n  content: \"\\e209\";\n}\n.glyphicon-equalizer:before {\n  content: \"\\e210\";\n}\n.glyphicon-king:before {\n  content: \"\\e211\";\n}\n.glyphicon-queen:before {\n  content: \"\\e212\";\n}\n.glyphicon-pawn:before {\n  content: \"\\e213\";\n}\n.glyphicon-bishop:before {\n  content: \"\\e214\";\n}\n.glyphicon-knight:before {\n  content: \"\\e215\";\n}\n.glyphicon-baby-formula:before {\n  content: \"\\e216\";\n}\n.glyphicon-tent:before {\n  content: \"\\26fa\";\n}\n.glyphicon-blackboard:before {\n  content: \"\\e218\";\n}\n.glyphicon-bed:before {\n  content: \"\\e219\";\n}\n.glyphicon-apple:before {\n  content: \"\\f8ff\";\n}\n.glyphicon-erase:before {\n  content: \"\\e221\";\n}\n.glyphicon-hourglass:before {\n  content: \"\\231b\";\n}\n.glyphicon-lamp:before {\n  content: \"\\e223\";\n}\n.glyphicon-duplicate:before {\n  content: \"\\e224\";\n}\n.glyphicon-piggy-bank:before {\n  content: \"\\e225\";\n}\n.glyphicon-scissors:before {\n  content: \"\\e226\";\n}\n.glyphicon-bitcoin:before {\n  content: \"\\e227\";\n}\n.glyphicon-btc:before {\n  content: \"\\e227\";\n}\n.glyphicon-xbt:before {\n  content: \"\\e227\";\n}\n.glyphicon-yen:before {\n  content: \"\\00a5\";\n}\n.glyphicon-jpy:before {\n  content: \"\\00a5\";\n}\n.glyphicon-ruble:before {\n  content: \"\\20bd\";\n}\n.glyphicon-rub:before {\n  content: \"\\20bd\";\n}\n.glyphicon-scale:before {\n  content: \"\\e230\";\n}\n.glyphicon-ice-lolly:before {\n  content: \"\\e231\";\n}\n.glyphicon-ice-lolly-tasted:before {\n  content: \"\\e232\";\n}\n.glyphicon-education:before {\n  content: \"\\e233\";\n}\n.glyphicon-option-horizontal:before {\n  content: \"\\e234\";\n}\n.glyphicon-option-vertical:before {\n  content: \"\\e235\";\n}\n.glyphicon-menu-hamburger:before {\n  content: \"\\e236\";\n}\n.glyphicon-modal-window:before {\n  content: \"\\e237\";\n}\n.glyphicon-oil:before {\n  content: \"\\e238\";\n}\n.glyphicon-grain:before {\n  content: \"\\e239\";\n}\n.glyphicon-sunglasses:before {\n  content: \"\\e240\";\n}\n.glyphicon-text-size:before {\n  content: \"\\e241\";\n}\n.glyphicon-text-color:before {\n  content: \"\\e242\";\n}\n.glyphicon-text-background:before {\n  content: \"\\e243\";\n}\n.glyphicon-object-align-top:before {\n  content: \"\\e244\";\n}\n.glyphicon-object-align-bottom:before {\n  content: \"\\e245\";\n}\n.glyphicon-object-align-horizontal:before {\n  content: \"\\e246\";\n}\n.glyphicon-object-align-left:before {\n  content: \"\\e247\";\n}\n.glyphicon-object-align-vertical:before {\n  content: \"\\e248\";\n}\n.glyphicon-object-align-right:before {\n  content: \"\\e249\";\n}\n.glyphicon-triangle-right:before {\n  content: \"\\e250\";\n}\n.glyphicon-triangle-left:before {\n  content: \"\\e251\";\n}\n.glyphicon-triangle-bottom:before {\n  content: \"\\e252\";\n}\n.glyphicon-triangle-top:before {\n  content: \"\\e253\";\n}\n.glyphicon-console:before {\n  content: \"\\e254\";\n}\n.glyphicon-superscript:before {\n  content: \"\\e255\";\n}\n.glyphicon-subscript:before {\n  content: \"\\e256\";\n}\n.glyphicon-menu-left:before {\n  content: \"\\e257\";\n}\n.glyphicon-menu-right:before {\n  content: \"\\e258\";\n}\n.glyphicon-menu-down:before {\n  content: \"\\e259\";\n}\n.glyphicon-menu-up:before {\n  content: \"\\e260\";\n}\n* {\n  -webkit-box-sizing: border-box;\n     -moz-box-sizing: border-box;\n          box-sizing: border-box;\n}\n*:before,\n*:after {\n  -webkit-box-sizing: border-box;\n     -moz-box-sizing: border-box;\n          box-sizing: border-box;\n}\nhtml {\n  font-size: 10px;\n\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n}\nbody {\n  font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-size: 14px;\n  line-height: 1.42857143;\n  color: #333;\n  background-color: #fff;\n}\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: inherit;\n  font-size: inherit;\n  line-height: inherit;\n}\na {\n  color: #337ab7;\n  text-decoration: none;\n}\na:hover,\na:focus {\n  color: #23527c;\n  text-decoration: underline;\n}\na:focus {\n  outline: thin dotted;\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\nfigure {\n  margin: 0;\n}\nimg {\n  vertical-align: middle;\n}\n.img-responsive,\n.thumbnail > img,\n.thumbnail a > img,\n.carousel-inner > .item > img,\n.carousel-inner > .item > a > img {\n  display: block;\n  max-width: 100%;\n  height: auto;\n}\n.img-rounded {\n  border-radius: 6px;\n}\n.img-thumbnail {\n  display: inline-block;\n  max-width: 100%;\n  height: auto;\n  padding: 4px;\n  line-height: 1.42857143;\n  background-color: #fff;\n  border: 1px solid #ddd;\n  border-radius: 4px;\n  -webkit-transition: all .2s ease-in-out;\n       -o-transition: all .2s ease-in-out;\n          transition: all .2s ease-in-out;\n}\n.img-circle {\n  border-radius: 50%;\n}\nhr {\n  margin-top: 20px;\n  margin-bottom: 20px;\n  border: 0;\n  border-top: 1px solid #eee;\n}\n.sr-only {\n  position: absolute;\n  width: 1px;\n  height: 1px;\n  padding: 0;\n  margin: -1px;\n  overflow: hidden;\n  clip: rect(0, 0, 0, 0);\n  border: 0;\n}\n.sr-only-focusable:active,\n.sr-only-focusable:focus {\n  position: static;\n  width: auto;\n  height: auto;\n  margin: 0;\n  overflow: visible;\n  clip: auto;\n}\n[role=\"button\"] {\n  cursor: pointer;\n}\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\n.h1,\n.h2,\n.h3,\n.h4,\n.h5,\n.h6 {\n  font-family: inherit;\n  font-weight: 500;\n  line-height: 1.1;\n  color: inherit;\n}\nh1 small,\nh2 small,\nh3 small,\nh4 small,\nh5 small,\nh6 small,\n.h1 small,\n.h2 small,\n.h3 small,\n.h4 small,\n.h5 small,\n.h6 small,\nh1 .small,\nh2 .small,\nh3 .small,\nh4 .small,\nh5 .small,\nh6 .small,\n.h1 .small,\n.h2 .small,\n.h3 .small,\n.h4 .small,\n.h5 .small,\n.h6 .small {\n  font-weight: normal;\n  line-height: 1;\n  color: #777;\n}\nh1,\n.h1,\nh2,\n.h2,\nh3,\n.h3 {\n  margin-top: 20px;\n  margin-bottom: 10px;\n}\nh1 small,\n.h1 small,\nh2 small,\n.h2 small,\nh3 small,\n.h3 small,\nh1 .small,\n.h1 .small,\nh2 .small,\n.h2 .small,\nh3 .small,\n.h3 .small {\n  font-size: 65%;\n}\nh4,\n.h4,\nh5,\n.h5,\nh6,\n.h6 {\n  margin-top: 10px;\n  margin-bottom: 10px;\n}\nh4 small,\n.h4 small,\nh5 small,\n.h5 small,\nh6 small,\n.h6 small,\nh4 .small,\n.h4 .small,\nh5 .small,\n.h5 .small,\nh6 .small,\n.h6 .small {\n  font-size: 75%;\n}\nh1,\n.h1 {\n  font-size: 36px;\n}\nh2,\n.h2 {\n  font-size: 30px;\n}\nh3,\n.h3 {\n  font-size: 24px;\n}\nh4,\n.h4 {\n  font-size: 18px;\n}\nh5,\n.h5 {\n  font-size: 14px;\n}\nh6,\n.h6 {\n  font-size: 12px;\n}\np {\n  margin: 0 0 10px;\n}\n.lead {\n  margin-bottom: 20px;\n  font-size: 16px;\n  font-weight: 300;\n  line-height: 1.4;\n}\n@media (min-width: 768px) {\n  .lead {\n    font-size: 21px;\n  }\n}\nsmall,\n.small {\n  font-size: 85%;\n}\nmark,\n.mark {\n  padding: .2em;\n  background-color: #fcf8e3;\n}\n.text-left {\n  text-align: left;\n}\n.text-right {\n  text-align: right;\n}\n.text-center {\n  text-align: center;\n}\n.text-justify {\n  text-align: justify;\n}\n.text-nowrap {\n  white-space: nowrap;\n}\n.text-lowercase {\n  text-transform: lowercase;\n}\n.text-uppercase {\n  text-transform: uppercase;\n}\n.text-capitalize {\n  text-transform: capitalize;\n}\n.text-muted {\n  color: #777;\n}\n.text-primary {\n  color: #337ab7;\n}\na.text-primary:hover,\na.text-primary:focus {\n  color: #286090;\n}\n.text-success {\n  color: #3c763d;\n}\na.text-success:hover,\na.text-success:focus {\n  color: #2b542c;\n}\n.text-info {\n  color: #31708f;\n}\na.text-info:hover,\na.text-info:focus {\n  color: #245269;\n}\n.text-warning {\n  color: #8a6d3b;\n}\na.text-warning:hover,\na.text-warning:focus {\n  color: #66512c;\n}\n.text-danger {\n  color: #a94442;\n}\na.text-danger:hover,\na.text-danger:focus {\n  color: #843534;\n}\n.bg-primary {\n  color: #fff;\n  background-color: #337ab7;\n}\na.bg-primary:hover,\na.bg-primary:focus {\n  background-color: #286090;\n}\n.bg-success {\n  background-color: #dff0d8;\n}\na.bg-success:hover,\na.bg-success:focus {\n  background-color: #c1e2b3;\n}\n.bg-info {\n  background-color: #d9edf7;\n}\na.bg-info:hover,\na.bg-info:focus {\n  background-color: #afd9ee;\n}\n.bg-warning {\n  background-color: #fcf8e3;\n}\na.bg-warning:hover,\na.bg-warning:focus {\n  background-color: #f7ecb5;\n}\n.bg-danger {\n  background-color: #f2dede;\n}\na.bg-danger:hover,\na.bg-danger:focus {\n  background-color: #e4b9b9;\n}\n.page-header {\n  padding-bottom: 9px;\n  margin: 40px 0 20px;\n  border-bottom: 1px solid #eee;\n}\nul,\nol {\n  margin-top: 0;\n  margin-bottom: 10px;\n}\nul ul,\nol ul,\nul ol,\nol ol {\n  margin-bottom: 0;\n}\n.list-unstyled {\n  padding-left: 0;\n  list-style: none;\n}\n.list-inline {\n  padding-left: 0;\n  margin-left: -5px;\n  list-style: none;\n}\n.list-inline > li {\n  display: inline-block;\n  padding-right: 5px;\n  padding-left: 5px;\n}\ndl {\n  margin-top: 0;\n  margin-bottom: 20px;\n}\ndt,\ndd {\n  line-height: 1.42857143;\n}\ndt {\n  font-weight: bold;\n}\ndd {\n  margin-left: 0;\n}\n@media (min-width: 768px) {\n  .dl-horizontal dt {\n    float: left;\n    width: 160px;\n    overflow: hidden;\n    clear: left;\n    text-align: right;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n  }\n  .dl-horizontal dd {\n    margin-left: 180px;\n  }\n}\nabbr[title],\nabbr[data-original-title] {\n  cursor: help;\n  border-bottom: 1px dotted #777;\n}\n.initialism {\n  font-size: 90%;\n  text-transform: uppercase;\n}\nblockquote {\n  padding: 10px 20px;\n  margin: 0 0 20px;\n  font-size: 17.5px;\n  border-left: 5px solid #eee;\n}\nblockquote p:last-child,\nblockquote ul:last-child,\nblockquote ol:last-child {\n  margin-bottom: 0;\n}\nblockquote footer,\nblockquote small,\nblockquote .small {\n  display: block;\n  font-size: 80%;\n  line-height: 1.42857143;\n  color: #777;\n}\nblockquote footer:before,\nblockquote small:before,\nblockquote .small:before {\n  content: '\\2014 \\00A0';\n}\n.blockquote-reverse,\nblockquote.pull-right {\n  padding-right: 15px;\n  padding-left: 0;\n  text-align: right;\n  border-right: 5px solid #eee;\n  border-left: 0;\n}\n.blockquote-reverse footer:before,\nblockquote.pull-right footer:before,\n.blockquote-reverse small:before,\nblockquote.pull-right small:before,\n.blockquote-reverse .small:before,\nblockquote.pull-right .small:before {\n  content: '';\n}\n.blockquote-reverse footer:after,\nblockquote.pull-right footer:after,\n.blockquote-reverse small:after,\nblockquote.pull-right small:after,\n.blockquote-reverse .small:after,\nblockquote.pull-right .small:after {\n  content: '\\00A0 \\2014';\n}\naddress {\n  margin-bottom: 20px;\n  font-style: normal;\n  line-height: 1.42857143;\n}\ncode,\nkbd,\npre,\nsamp {\n  font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\ncode {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: #c7254e;\n  background-color: #f9f2f4;\n  border-radius: 4px;\n}\nkbd {\n  padding: 2px 4px;\n  font-size: 90%;\n  color: #fff;\n  background-color: #333;\n  border-radius: 3px;\n  -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);\n          box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .25);\n}\nkbd kbd {\n  padding: 0;\n  font-size: 100%;\n  font-weight: bold;\n  -webkit-box-shadow: none;\n          box-shadow: none;\n}\npre {\n  display: block;\n  padding: 9.5px;\n  margin: 0 0 10px;\n  font-size: 13px;\n  line-height: 1.42857143;\n  color: #333;\n  word-break: break-all;\n  word-wrap: break-word;\n  background-color: #f5f5f5;\n  border: 1px solid #ccc;\n  border-radius: 4px;\n}\npre code {\n  padding: 0;\n  font-size: inherit;\n  color: inherit;\n  white-space: pre-wrap;\n  background-color: transparent;\n  border-radius: 0;\n}\n.pre-scrollable {\n  max-height: 340px;\n  overflow-y: scroll;\n}\n.container {\n  padding-right: 15px;\n  padding-left: 15px;\n  margin-right: auto;\n  margin-left: auto;\n}\n@media (min-width: 768px) {\n  .container {\n    width: 750px;\n  }\n}\n@media (min-width: 992px) {\n  .container {\n    width: 970px;\n  }\n}\n@media (min-width: 1200px) {\n  .container {\n    width: 1170px;\n  }\n}\n.container-fluid {\n  padding-right: 15px;\n  padding-left: 15px;\n  margin-right: auto;\n  margin-left: auto;\n}\n.row {\n  margin-right: -15px;\n  margin-left: -15px;\n}\n.col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {\n  position: relative;\n  min-height: 1px;\n  padding-right: 15px;\n  padding-left: 15px;\n}\n.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {\n  float: left;\n}\n.col-xs-12 {\n  width: 100%;\n}\n.col-xs-11 {\n  width: 91.66666667%;\n}\n.col-xs-10 {\n  width: 83.33333333%;\n}\n.col-xs-9 {\n  width: 75%;\n}\n.col-xs-8 {\n  width: 66.66666667%;\n}\n.col-xs-7 {\n  width: 58.33333333%;\n}\n.col-xs-6 {\n  width: 50%;\n}\n.col-xs-5 {\n  width: 41.66666667%;\n}\n.col-xs-4 {\n  width: 33.33333333%;\n}\n.col-xs-3 {\n  width: 25%;\n}\n.col-xs-2 {\n  width: 16.66666667%;\n}\n.col-xs-1 {\n  width: 8.33333333%;\n}\n.col-xs-pull-12 {\n  right: 100%;\n}\n.col-xs-pull-11 {\n  right: 91.66666667%;\n}\n.col-xs-pull-10 {\n  right: 83.33333333%;\n}\n.col-xs-pull-9 {\n  right: 75%;\n}\n.col-xs-pull-8 {\n  right: 66.66666667%;\n}\n.col-xs-pull-7 {\n  right: 58.33333333%;\n}\n.col-xs-pull-6 {\n  right: 50%;\n}\n.col-xs-pull-5 {\n  right: 41.66666667%;\n}\n.col-xs-pull-4 {\n  right: 33.33333333%;\n}\n.col-xs-pull-3 {\n  right: 25%;\n}\n.col-xs-pull-2 {\n  right: 16.66666667%;\n}\n.col-xs-pull-1 {\n  right: 8.33333333%;\n}\n.col-xs-pull-0 {\n  right: auto;\n}\n.col-xs-push-12 {\n  left: 100%;\n}\n.col-xs-push-11 {\n  left: 91.66666667%;\n}\n.col-xs-push-10 {\n  left: 83.33333333%;\n}\n.col-xs-push-9 {\n  left: 75%;\n}\n.col-xs-push-8 {\n  left: 66.66666667%;\n}\n.col-xs-push-7 {\n  left: 58.33333333%;\n}\n.col-xs-push-6 {\n  left: 50%;\n}\n.col-xs-push-5 {\n  left: 41.66666667%;\n}\n.col-xs-push-4 {\n  left: 33.33333333%;\n}\n.col-xs-push-3 {\n  left: 25%;\n}\n.col-xs-push-2 {\n  left: 16.66666667%;\n}\n.col-xs-push-1 {\n  left: 8.33333333%;\n}\n.col-xs-push-0 {\n  left: auto;\n}\n.col-xs-offset-12 {\n  margin-left: 100%;\n}\n.col-xs-offset-11 {\n  margin-left: 91.66666667%;\n}\n.col-xs-offset-10 {\n  margin-left: 83.33333333%;\n}\n.col-xs-offset-9 {\n  margin-left: 75%;\n}\n.col-xs-offset-8 {\n  margin-left: 66.66666667%;\n}\n.col-xs-offset-7 {\n  margin-left: 58.33333333%;\n}\n.col-xs-offset-6 {\n  margin-left: 50%;\n}\n.col-xs-offset-5 {\n  margin-left: 41.66666667%;\n}\n.col-xs-offset-4 {\n  margin-left: 33.33333333%;\n}\n.col-xs-offset-3 {\n  margin-left: 25%;\n}\n.col-xs-offset-2 {\n  margin-left: 16.66666667%;\n}\n.col-xs-offset-1 {\n  margin-left: 8.33333333%;\n}\n.col-xs-offset-0 {\n  margin-left: 0;\n}\n@media (min-width: 768px) {\n  .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {\n    float: left;\n  }\n  .col-sm-12 {\n    width: 100%;\n  }\n  .col-sm-11 {\n    width: 91.66666667%;\n  }\n  .col-sm-10 {\n    width: 83.33333333%;\n  }\n  .col-sm-9 {\n    width: 75%;\n  }\n  .col-sm-8 {\n    width: 66.66666667%;\n  }\n  .col-sm-7 {\n    width: 58.33333333%;\n  }\n  .col-sm-6 {\n    width: 50%;\n  }\n  .col-sm-5 {\n    width: 41.66666667%;\n  }\n  .col-sm-4 {\n    width: 33.33333333%;\n  }\n  .col-sm-3 {\n    width: 25%;\n  }\n  .col-sm-2 {\n    width: 16.66666667%;\n  }\n  .col-sm-1 {\n    width: 8.33333333%;\n  }\n  .col-sm-pull-12 {\n    right: 100%;\n  }\n  .col-sm-pull-11 {\n    right: 91.66666667%;\n  }\n  .col-sm-pull-10 {\n    right: 83.33333333%;\n  }\n  .col-sm-pull-9 {\n    right: 75%;\n  }\n  .col-sm-pull-8 {\n    right: 66.66666667%;\n  }\n  .col-sm-pull-7 {\n    right: 58.33333333%;\n  }\n  .col-sm-pull-6 {\n    right: 50%;\n  }\n  .col-sm-pull-5 {\n    right: 41.66666667%;\n  }\n  .col-sm-pull-4 {\n    right: 33.33333333%;\n  }\n  .col-sm-pull-3 {\n    right: 25%;\n  }\n  .col-sm-pull-2 {\n    right: 16.66666667%;\n  }\n  .col-sm-pull-1 {\n    right: 8.33333333%;\n  }\n  .col-sm-pull-0 {\n    right: auto;\n  }\n  .col-sm-push-12 {\n    left: 100%;\n  }\n  .col-sm-push-11 {\n    left: 91.66666667%;\n  }\n  .col-sm-push-10 {\n    left: 83.33333333%;\n  }\n  .col-sm-push-9 {\n    left: 75%;\n  }\n  .col-sm-push-8 {\n    left: 66.66666667%;\n  }\n  .col-sm-push-7 {\n    left: 58.33333333%;\n  }\n  .col-sm-push-6 {\n    left: 50%;\n  }\n  .col-sm-push-5 {\n    left: 41.66666667%;\n  }\n  .col-sm-push-4 {\n    left: 33.33333333%;\n  }\n  .col-sm-push-3 {\n    left: 25%;\n  }\n  .col-sm-push-2 {\n    left: 16.66666667%;\n  }\n  .col-sm-push-1 {\n    left: 8.33333333%;\n  }\n  .col-sm-push-0 {\n    left: auto;\n  }\n  .col-sm-offset-12 {\n    margin-left: 100%;\n  }\n  .col-sm-offset-11 {\n    margin-left: 91.66666667%;\n  }\n  .col-sm-offset-10 {\n    margin-left: 83.33333333%;\n  }\n  .col-sm-offset-9 {\n    margin-left: 75%;\n  }\n  .col-sm-offset-8 {\n    margin-left: 66.66666667%;\n  }\n  .col-sm-offset-7 {\n    margin-left: 58.33333333%;\n  }\n  .col-sm-offset-6 {\n    margin-left: 50%;\n  }\n  .col-sm-offset-5 {\n    margin-left: 41.66666667%;\n  }\n  .col-sm-offset-4 {\n    margin-left: 33.33333333%;\n  }\n  .col-sm-offset-3 {\n    margin-left: 25%;\n  }\n  .col-sm-offset-2 {\n    margin-left: 16.66666667%;\n  }\n  .col-sm-offset-1 {\n    margin-left: 8.33333333%;\n  }\n  .col-sm-offset-0 {\n    margin-left: 0;\n  }\n}\n@media (min-width: 992px) {\n  .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {\n    float: left;\n  }\n  .col-md-12 {\n    width: 100%;\n  }\n  .col-md-11 {\n    width: 91.66666667%;\n  }\n  .col-md-10 {\n    width: 83.33333333%;\n  }\n  .col-md-9 {\n    width: 75%;\n  }\n  .col-md-8 {\n    width: 66.66666667%;\n  }\n  .col-md-7 {\n    width: 58.33333333%;\n  }\n  .col-md-6 {\n    width: 50%;\n  }\n  .col-md-5 {\n    width: 41.66666667%;\n  }\n  .col-md-4 {\n    width: 33.33333333%;\n  }\n  .col-md-3 {\n    width: 25%;\n  }\n  .col-md-2 {\n    width: 16.66666667%;\n  }\n  .col-md-1 {\n    width: 8.33333333%;\n  }\n  .col-md-pull-12 {\n    right: 100%;\n  }\n  .col-md-pull-11 {\n    right: 91.66666667%;\n  }\n  .col-md-pull-10 {\n    right: 83.33333333%;\n  }\n  .col-md-pull-9 {\n    right: 75%;\n  }\n  .col-md-pull-8 {\n    right: 66.66666667%;\n  }\n  .col-md-pull-7 {\n    right: 58.33333333%;\n  }\n  .col-md-pull-6 {\n    right: 50%;\n  }\n  .col-md-pull-5 {\n    right: 41.66666667%;\n  }\n  .col-md-pull-4 {\n    right: 33.33333333%;\n  }\n  .col-md-pull-3 {\n    right: 25%;\n  }\n  .col-md-pull-2 {\n    right: 16.66666667%;\n  }\n  .col-md-pull-1 {\n    right: 8.33333333%;\n  }\n  .col-md-pull-0 {\n    right: auto;\n  }\n  .col-md-push-12 {\n    left: 100%;\n  }\n  .col-md-push-11 {\n    left: 91.66666667%;\n  }\n  .col-md-push-10 {\n    left: 83.33333333%;\n  }\n  .col-md-push-9 {\n    left: 75%;\n  }\n  .col-md-push-8 {\n    left: 66.66666667%;\n  }\n  .col-md-push-7 {\n    left: 58.33333333%;\n  }\n  .col-md-push-6 {\n    left: 50%;\n  }\n  .col-md-push-5 {\n    left: 41.66666667%;\n  }\n  .col-md-push-4 {\n    left: 33.33333333%;\n  }\n  .col-md-push-3 {\n    left: 25%;\n  }\n  .col-md-push-2 {\n    left: 16.66666667%;\n  }\n  .col-md-push-1 {\n    left: 8.33333333%;\n  }\n  .col-md-push-0 {\n    left: auto;\n  }\n  .col-md-offset-12 {\n    margin-left: 100%;\n  }\n  .col-md-offset-11 {\n    margin-left: 91.66666667%;\n  }\n  .col-md-offset-10 {\n    margin-left: 83.33333333%;\n  }\n  .col-md-offset-9 {\n    margin-left: 75%;\n  }\n  .col-md-offset-8 {\n    margin-left: 66.66666667%;\n  }\n  .col-md-offset-7 {\n    margin-left: 58.33333333%;\n  }\n  .col-md-offset-6 {\n    margin-left: 50%;\n  }\n  .col-md-offset-5 {\n    margin-left: 41.66666667%;\n  }\n  .col-md-offset-4 {\n    margin-left: 33.33333333%;\n  }\n  .col-md-offset-3 {\n    margin-left: 25%;\n  }\n  .col-md-offset-2 {\n    margin-left: 16.66666667%;\n  }\n  .col-md-offset-1 {\n    margin-left: 8.33333333%;\n  }\n  .col-md-offset-0 {\n    margin-left: 0;\n  }\n}\n@media (min-width: 1200px) {\n  .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 {\n    float: left;\n  }\n  .col-lg-12 {\n    width: 100%;\n  }\n  .col-lg-11 {\n    width: 91.66666667%;\n  }\n  .col-lg-10 {\n    width: 83.33333333%;\n  }\n  .col-lg-9 {\n    width: 75%;\n  }\n  .col-lg-8 {\n    width: 66.66666667%;\n  }\n  .col-lg-7 {\n    width: 58.33333333%;\n  }\n  .col-lg-6 {\n    width: 50%;\n  }\n  .col-lg-5 {\n    width: 41.66666667%;\n  }\n  .col-lg-4 {\n    width: 33.33333333%;\n  }\n  .col-lg-3 {\n    width: 25%;\n  }\n  .col-lg-2 {\n    width: 16.66666667%;\n  }\n  .col-lg-1 {\n    width: 8.33333333%;\n  }\n  .col-lg-pull-12 {\n    right: 100%;\n  }\n  .col-lg-pull-11 {\n    right: 91.66666667%;\n  }\n  .col-lg-pull-10 {\n    right: 83.33333333%;\n  }\n  .col-lg-pull-9 {\n    right: 75%;\n  }\n  .col-lg-pull-8 {\n    right: 66.66666667%;\n  }\n  .col-lg-pull-7 {\n    right: 58.33333333%;\n  }\n  .col-lg-pull-6 {\n    right: 50%;\n  }\n  .col-lg-pull-5 {\n    right: 41.66666667%;\n  }\n  .col-lg-pull-4 {\n    right: 33.33333333%;\n  }\n  .col-lg-pull-3 {\n    right: 25%;\n  }\n  .col-lg-pull-2 {\n    right: 16.66666667%;\n  }\n  .col-lg-pull-1 {\n    right: 8.33333333%;\n  }\n  .col-lg-pull-0 {\n    right: auto;\n  }\n  .col-lg-push-12 {\n    left: 100%;\n  }\n  .col-lg-push-11 {\n    left: 91.66666667%;\n  }\n  .col-lg-push-10 {\n    left: 83.33333333%;\n  }\n  .col-lg-push-9 {\n    left: 75%;\n  }\n  .col-lg-push-8 {\n    left: 66.66666667%;\n  }\n  .col-lg-push-7 {\n    left: 58.33333333%;\n  }\n  .col-lg-push-6 {\n    left: 50%;\n  }\n  .col-lg-push-5 {\n    left: 41.66666667%;\n  }\n  .col-lg-push-4 {\n    left: 33.33333333%;\n  }\n  .col-lg-push-3 {\n    left: 25%;\n  }\n  .col-lg-push-2 {\n    left: 16.66666667%;\n  }\n  .col-lg-push-1 {\n    left: 8.33333333%;\n  }\n  .col-lg-push-0 {\n    left: auto;\n  }\n  .col-lg-offset-12 {\n    margin-left: 100%;\n  }\n  .col-lg-offset-11 {\n    margin-left: 91.66666667%;\n  }\n  .col-lg-offset-10 {\n    margin-left: 83.33333333%;\n  }\n  .col-lg-offset-9 {\n    margin-left: 75%;\n  }\n  .col-lg-offset-8 {\n    margin-left: 66.66666667%;\n  }\n  .col-lg-offset-7 {\n    margin-left: 58.33333333%;\n  }\n  .col-lg-offset-6 {\n    margin-left: 50%;\n  }\n  .col-lg-offset-5 {\n    margin-left: 41.66666667%;\n  }\n  .col-lg-offset-4 {\n    margin-left: 33.33333333%;\n  }\n  .col-lg-offset-3 {\n    margin-left: 25%;\n  }\n  .col-lg-offset-2 {\n    margin-left: 16.66666667%;\n  }\n  .col-lg-offset-1 {\n    margin-left: 8.33333333%;\n  }\n  .col-lg-offset-0 {\n    margin-left: 0;\n  }\n}\ntable {\n  background-color: transparent;\n}\ncaption {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  color: #777;\n  text-align: left;\n}\nth {\n  text-align: left;\n}\n.table {\n  width: 100%;\n  max-width: 100%;\n  margin-bottom: 20px;\n}\n.table > thead > tr > th,\n.table > tbody > tr > th,\n.table > tfoot > tr > th,\n.table > thead > tr > td,\n.table > tbody > tr > td,\n.table > tfoot > tr > td {\n  padding: 8px;\n  line-height: 1.42857143;\n  vertical-align: top;\n  border-top: 1px solid #ddd;\n}\n.table > thead > tr > th {\n  vertical-align: bottom;\n  border-bottom: 2px solid #ddd;\n}\n.table > caption + thead > tr:first-child > th,\n.table > colgroup + thead > tr:first-child > th,\n.table > thead:first-child > tr:first-child > th,\n.table > caption + thead > tr:first-child > td,\n.table > colgroup + thead > tr:first-child > td,\n.table > thead:first-child > tr:first-child > td {\n  border-top: 0;\n}\n.table > tbody + tbody {\n  border-top: 2px solid #ddd;\n}\n.table .table {\n  background-color: #fff;\n}\n.table-condensed > thead > tr > th,\n.table-condensed > tbody > tr > th,\n.table-condensed > tfoot > tr > th,\n.table-condensed > thead > tr > td,\n.table-condensed > tbody > tr > td,\n.table-condensed > tfoot > tr > td {\n  padding: 5px;\n}\n.table-bordered {\n  border: 1px solid #ddd;\n}\n.table-bordered > thead > tr > th,\n.table-bordered > tbody > tr > th,\n.table-bordered > tfoot > tr > th,\n.table-bordered > thead > tr > td,\n.table-bordered > tbody > tr > td,\n.table-bordered > tfoot > tr > td {\n  border: 1px solid #ddd;\n}\n.table-bordered > thead > tr > th,\n.table-bordered > thead > tr > td {\n  border-bottom-width: 2px;\n}\n.table-striped > tbody > tr:nth-of-type(odd) {\n  background-color: #f9f9f9;\n}\n.table-hover > tbody > tr:hover {\n  background-color: #f5f5f5;\n}\ntable col[class*=\"col-\"] {\n  position: static;\n  display: table-column;\n  float: none;\n}\ntable td[class*=\"col-\"],\ntable th[class*=\"col-\"] {\n  position: static;\n  display: table-cell;\n  float: none;\n}\n.table > thead > tr > td.active,\n.table > tbody > tr > td.active,\n.table > tfoot > tr > td.active,\n.table > thead > tr > th.active,\n.table > tbody > tr > th.active,\n.table > tfoot > tr > th.active,\n.table > thead > tr.active > td,\n.table > tbody > tr.active > td,\n.table > tfoot > tr.active > td,\n.table > thead > tr.active > th,\n.table > tbody > tr.active > th,\n.table > tfoot > tr.active > th {\n  background-color: #f5f5f5;\n}\n.table-hover > tbody > tr > td.active:hover,\n.table-hover > tbody > tr > th.active:hover,\n.table-hover > tbody > tr.active:hover > td,\n.table-hover > tbody > tr:hover > .active,\n.table-hover > tbody > tr.active:hover > th {\n  background-color: #e8e8e8;\n}\n.table > thead > tr > td.success,\n.table > tbody > tr > td.success,\n.table > tfoot > tr > td.success,\n.table > thead > tr > th.success,\n.table > tbody > tr > th.success,\n.table > tfoot > tr > th.success,\n.table > thead > tr.success > td,\n.table > tbody > tr.success > td,\n.table > tfoot > tr.success > td,\n.table > thead > tr.success > th,\n.table > tbody > tr.success > th,\n.table > tfoot > tr.success > th {\n  background-color: #dff0d8;\n}\n.table-hover > tbody > tr > td.success:hover,\n.table-hover > tbody > tr > th.success:hover,\n.table-hover > tbody > tr.success:hover > td,\n.table-hover > tbody > tr:hover > .success,\n.table-hover > tbody > tr.success:hover > th {\n  background-color: #d0e9c6;\n}\n.table > thead > tr > td.info,\n.table > tbody > tr > td.info,\n.table > tfoot > tr > td.info,\n.table > thead > tr > th.info,\n.table > tbody > tr > th.info,\n.table > tfoot > tr > th.info,\n.table > thead > tr.info > td,\n.table > tbody > tr.info > td,\n.table > tfoot > tr.info > td,\n.table > thead > tr.info > th,\n.table > tbody > tr.info > th,\n.table > tfoot > tr.info > th {\n  background-color: #d9edf7;\n}\n.table-hover > tbody > tr > td.info:hover,\n.table-hover > tbody > tr > th.info:hover,\n.table-hover > tbody > tr.info:hover > td,\n.table-hover > tbody > tr:hover > .info,\n.table-hover > tbody > tr.info:hover > th {\n  background-color: #c4e3f3;\n}\n.table > thead > tr > td.warning,\n.table > tbody > tr > td.warning,\n.table > tfoot > tr > td.warning,\n.table > thead > tr > th.warning,\n.table > tbody > tr > th.warning,\n.table > tfoot > tr > th.warning,\n.table > thead > tr.warning > td,\n.table > tbody > tr.warning > td,\n.table > tfoot > tr.warning > td,\n.table > thead > tr.warning > th,\n.table > tbody > tr.warning > th,\n.table > tfoot > tr.warning > th {\n  background-color: #fcf8e3;\n}\n.table-hover > tbody > tr > td.warning:hover,\n.table-hover > tbody > tr > th.warning:hover,\n.table-hover > tbody > tr.warning:hover > td,\n.table-hover > tbody > tr:hover > .warning,\n.table-hover > tbody > tr.warning:hover > th {\n  background-color: #faf2cc;\n}\n.table > thead > tr > td.danger,\n.table > tbody > tr > td.danger,\n.table > tfoot > tr > td.danger,\n.table > thead > tr > th.danger,\n.table > tbody > tr > th.danger,\n.table > tfoot > tr > th.danger,\n.table > thead > tr.danger > td,\n.table > tbody > tr.danger > td,\n.table > tfoot > tr.danger > td,\n.table > thead > tr.danger > th,\n.table > tbody > tr.danger > th,\n.table > tfoot > tr.danger > th {\n  background-color: #f2dede;\n}\n.table-hover > tbody > tr > td.danger:hover,\n.table-hover > tbody > tr > th.danger:hover,\n.table-hover > tbody > tr.danger:hover > td,\n.table-hover > tbody > tr:hover > .danger,\n.table-hover > tbody > tr.danger:hover > th {\n  background-color: #ebcccc;\n}\n.table-responsive {\n  min-height: .01%;\n  overflow-x: auto;\n}\n@media screen and (max-width: 767px) {\n  .table-responsive {\n    width: 100%;\n    margin-bottom: 15px;\n    overflow-y: hidden;\n    -ms-overflow-style: -ms-autohiding-scrollbar;\n    border: 1px solid #ddd;\n  }\n  .table-responsive > .table {\n    margin-bottom: 0;\n  }\n  .table-responsive > .table > thead > tr > th,\n  .table-responsive > .table > tbody > tr > th,\n  .table-responsive > .table > tfoot > tr > th,\n  .table-responsive > .table > thead > tr > td,\n  .table-responsive > .table > tbody > tr > td,\n  .table-responsive > .table > tfoot > tr > td {\n    white-space: nowrap;\n  }\n  .table-responsive > .table-bordered {\n    border: 0;\n  }\n  .table-responsive > .table-bordered > thead > tr > th:first-child,\n  .table-responsive > .table-bordered > tbody > tr > th:first-child,\n  .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n  .table-responsive > .table-bordered > thead > tr > td:first-child,\n  .table-responsive > .table-bordered > tbody > tr > td:first-child,\n  .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n    border-left: 0;\n  }\n  .table-responsive > .table-bordered > thead > tr > th:last-child,\n  .table-responsive > .table-bordered > tbody > tr > th:last-child,\n  .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n  .table-responsive > .table-bordered > thead > tr > td:last-child,\n  .table-responsive > .table-bordered > tbody > tr > td:last-child,\n  .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n    border-right: 0;\n  }\n  .table-responsive > .table-bordered > tbody > tr:last-child > th,\n  .table-responsive > .table-bordered > tfoot > tr:last-child > th,\n  .table-responsive > .table-bordered > tbody > tr:last-child > td,\n  .table-responsive > .table-bordered > tfoot > tr:last-child > td {\n    border-bottom: 0;\n  }\n}\nfieldset {\n  min-width: 0;\n  padding: 0;\n  margin: 0;\n  border: 0;\n}\nlegend {\n  display: block;\n  width: 100%;\n  padding: 0;\n  margin-bottom: 20px;\n  font-size: 21px;\n  line-height: inherit;\n  color: #333;\n  border: 0;\n  border-bottom: 1px solid #e5e5e5;\n}\nlabel {\n  display: inline-block;\n  max-width: 100%;\n  margin-bottom: 5px;\n  font-weight: bold;\n}\ninput[type=\"search\"] {\n  -webkit-box-sizing: border-box;\n     -moz-box-sizing: border-box;\n          box-sizing: border-box;\n}\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 4px 0 0;\n  margin-top: 1px \\9;\n  line-height: normal;\n}\ninput[type=\"file\"] {\n  display: block;\n}\ninput[type=\"range\"] {\n  display: block;\n  width: 100%;\n}\nselect[multiple],\nselect[size] {\n  height: auto;\n}\ninput[type=\"file\"]:focus,\ninput[type=\"radio\"]:focus,\ninput[type=\"checkbox\"]:focus {\n  outline: thin dotted;\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\noutput {\n  display: block;\n  padding-top: 7px;\n  font-size: 14px;\n  line-height: 1.42857143;\n  color: #555;\n}\n.form-control {\n  display: block;\n  width: 100%;\n  height: 34px;\n  padding: 6px 12px;\n  font-size: 14px;\n  line-height: 1.42857143;\n  color: #555;\n  background-color: #fff;\n  background-image: none;\n  border: 1px solid #ccc;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n  -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;\n       -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n          transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;\n}\n.form-control:focus {\n  border-color: #66afe9;\n  outline: 0;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);\n          box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);\n}\n.form-control::-moz-placeholder {\n  color: #999;\n  opacity: 1;\n}\n.form-control:-ms-input-placeholder {\n  color: #999;\n}\n.form-control::-webkit-input-placeholder {\n  color: #999;\n}\n.form-control::-ms-expand {\n  background-color: transparent;\n  border: 0;\n}\n.form-control[disabled],\n.form-control[readonly],\nfieldset[disabled] .form-control {\n  background-color: #eee;\n  opacity: 1;\n}\n.form-control[disabled],\nfieldset[disabled] .form-control {\n  cursor: not-allowed;\n}\ntextarea.form-control {\n  height: auto;\n}\ninput[type=\"search\"] {\n  -webkit-appearance: none;\n}\n@media screen and (-webkit-min-device-pixel-ratio: 0) {\n  input[type=\"date\"].form-control,\n  input[type=\"time\"].form-control,\n  input[type=\"datetime-local\"].form-control,\n  input[type=\"month\"].form-control {\n    line-height: 34px;\n  }\n  input[type=\"date\"].input-sm,\n  input[type=\"time\"].input-sm,\n  input[type=\"datetime-local\"].input-sm,\n  input[type=\"month\"].input-sm,\n  .input-group-sm input[type=\"date\"],\n  .input-group-sm input[type=\"time\"],\n  .input-group-sm input[type=\"datetime-local\"],\n  .input-group-sm input[type=\"month\"] {\n    line-height: 30px;\n  }\n  input[type=\"date\"].input-lg,\n  input[type=\"time\"].input-lg,\n  input[type=\"datetime-local\"].input-lg,\n  input[type=\"month\"].input-lg,\n  .input-group-lg input[type=\"date\"],\n  .input-group-lg input[type=\"time\"],\n  .input-group-lg input[type=\"datetime-local\"],\n  .input-group-lg input[type=\"month\"] {\n    line-height: 46px;\n  }\n}\n.form-group {\n  margin-bottom: 15px;\n}\n.radio,\n.checkbox {\n  position: relative;\n  display: block;\n  margin-top: 10px;\n  margin-bottom: 10px;\n}\n.radio label,\n.checkbox label {\n  min-height: 20px;\n  padding-left: 20px;\n  margin-bottom: 0;\n  font-weight: normal;\n  cursor: pointer;\n}\n.radio input[type=\"radio\"],\n.radio-inline input[type=\"radio\"],\n.checkbox input[type=\"checkbox\"],\n.checkbox-inline input[type=\"checkbox\"] {\n  position: absolute;\n  margin-top: 4px \\9;\n  margin-left: -20px;\n}\n.radio + .radio,\n.checkbox + .checkbox {\n  margin-top: -5px;\n}\n.radio-inline,\n.checkbox-inline {\n  position: relative;\n  display: inline-block;\n  padding-left: 20px;\n  margin-bottom: 0;\n  font-weight: normal;\n  vertical-align: middle;\n  cursor: pointer;\n}\n.radio-inline + .radio-inline,\n.checkbox-inline + .checkbox-inline {\n  margin-top: 0;\n  margin-left: 10px;\n}\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\ninput[type=\"radio\"].disabled,\ninput[type=\"checkbox\"].disabled,\nfieldset[disabled] input[type=\"radio\"],\nfieldset[disabled] input[type=\"checkbox\"] {\n  cursor: not-allowed;\n}\n.radio-inline.disabled,\n.checkbox-inline.disabled,\nfieldset[disabled] .radio-inline,\nfieldset[disabled] .checkbox-inline {\n  cursor: not-allowed;\n}\n.radio.disabled label,\n.checkbox.disabled label,\nfieldset[disabled] .radio label,\nfieldset[disabled] .checkbox label {\n  cursor: not-allowed;\n}\n.form-control-static {\n  min-height: 34px;\n  padding-top: 7px;\n  padding-bottom: 7px;\n  margin-bottom: 0;\n}\n.form-control-static.input-lg,\n.form-control-static.input-sm {\n  padding-right: 0;\n  padding-left: 0;\n}\n.input-sm {\n  height: 30px;\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\nselect.input-sm {\n  height: 30px;\n  line-height: 30px;\n}\ntextarea.input-sm,\nselect[multiple].input-sm {\n  height: auto;\n}\n.form-group-sm .form-control {\n  height: 30px;\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n.form-group-sm select.form-control {\n  height: 30px;\n  line-height: 30px;\n}\n.form-group-sm textarea.form-control,\n.form-group-sm select[multiple].form-control {\n  height: auto;\n}\n.form-group-sm .form-control-static {\n  height: 30px;\n  min-height: 32px;\n  padding: 6px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n}\n.input-lg {\n  height: 46px;\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\nselect.input-lg {\n  height: 46px;\n  line-height: 46px;\n}\ntextarea.input-lg,\nselect[multiple].input-lg {\n  height: auto;\n}\n.form-group-lg .form-control {\n  height: 46px;\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\n.form-group-lg select.form-control {\n  height: 46px;\n  line-height: 46px;\n}\n.form-group-lg textarea.form-control,\n.form-group-lg select[multiple].form-control {\n  height: auto;\n}\n.form-group-lg .form-control-static {\n  height: 46px;\n  min-height: 38px;\n  padding: 11px 16px;\n  font-size: 18px;\n  line-height: 1.3333333;\n}\n.has-feedback {\n  position: relative;\n}\n.has-feedback .form-control {\n  padding-right: 42.5px;\n}\n.form-control-feedback {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 2;\n  display: block;\n  width: 34px;\n  height: 34px;\n  line-height: 34px;\n  text-align: center;\n  pointer-events: none;\n}\n.input-lg + .form-control-feedback,\n.input-group-lg + .form-control-feedback,\n.form-group-lg .form-control + .form-control-feedback {\n  width: 46px;\n  height: 46px;\n  line-height: 46px;\n}\n.input-sm + .form-control-feedback,\n.input-group-sm + .form-control-feedback,\n.form-group-sm .form-control + .form-control-feedback {\n  width: 30px;\n  height: 30px;\n  line-height: 30px;\n}\n.has-success .help-block,\n.has-success .control-label,\n.has-success .radio,\n.has-success .checkbox,\n.has-success .radio-inline,\n.has-success .checkbox-inline,\n.has-success.radio label,\n.has-success.checkbox label,\n.has-success.radio-inline label,\n.has-success.checkbox-inline label {\n  color: #3c763d;\n}\n.has-success .form-control {\n  border-color: #3c763d;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n}\n.has-success .form-control:focus {\n  border-color: #2b542c;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #67b168;\n}\n.has-success .input-group-addon {\n  color: #3c763d;\n  background-color: #dff0d8;\n  border-color: #3c763d;\n}\n.has-success .form-control-feedback {\n  color: #3c763d;\n}\n.has-warning .help-block,\n.has-warning .control-label,\n.has-warning .radio,\n.has-warning .checkbox,\n.has-warning .radio-inline,\n.has-warning .checkbox-inline,\n.has-warning.radio label,\n.has-warning.checkbox label,\n.has-warning.radio-inline label,\n.has-warning.checkbox-inline label {\n  color: #8a6d3b;\n}\n.has-warning .form-control {\n  border-color: #8a6d3b;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n}\n.has-warning .form-control:focus {\n  border-color: #66512c;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #c0a16b;\n}\n.has-warning .input-group-addon {\n  color: #8a6d3b;\n  background-color: #fcf8e3;\n  border-color: #8a6d3b;\n}\n.has-warning .form-control-feedback {\n  color: #8a6d3b;\n}\n.has-error .help-block,\n.has-error .control-label,\n.has-error .radio,\n.has-error .checkbox,\n.has-error .radio-inline,\n.has-error .checkbox-inline,\n.has-error.radio label,\n.has-error.checkbox label,\n.has-error.radio-inline label,\n.has-error.checkbox-inline label {\n  color: #a94442;\n}\n.has-error .form-control {\n  border-color: #a94442;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);\n}\n.has-error .form-control:focus {\n  border-color: #843534;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 6px #ce8483;\n}\n.has-error .input-group-addon {\n  color: #a94442;\n  background-color: #f2dede;\n  border-color: #a94442;\n}\n.has-error .form-control-feedback {\n  color: #a94442;\n}\n.has-feedback label ~ .form-control-feedback {\n  top: 25px;\n}\n.has-feedback label.sr-only ~ .form-control-feedback {\n  top: 0;\n}\n.help-block {\n  display: block;\n  margin-top: 5px;\n  margin-bottom: 10px;\n  color: #737373;\n}\n@media (min-width: 768px) {\n  .form-inline .form-group {\n    display: inline-block;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .form-inline .form-control {\n    display: inline-block;\n    width: auto;\n    vertical-align: middle;\n  }\n  .form-inline .form-control-static {\n    display: inline-block;\n  }\n  .form-inline .input-group {\n    display: inline-table;\n    vertical-align: middle;\n  }\n  .form-inline .input-group .input-group-addon,\n  .form-inline .input-group .input-group-btn,\n  .form-inline .input-group .form-control {\n    width: auto;\n  }\n  .form-inline .input-group > .form-control {\n    width: 100%;\n  }\n  .form-inline .control-label {\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .form-inline .radio,\n  .form-inline .checkbox {\n    display: inline-block;\n    margin-top: 0;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .form-inline .radio label,\n  .form-inline .checkbox label {\n    padding-left: 0;\n  }\n  .form-inline .radio input[type=\"radio\"],\n  .form-inline .checkbox input[type=\"checkbox\"] {\n    position: relative;\n    margin-left: 0;\n  }\n  .form-inline .has-feedback .form-control-feedback {\n    top: 0;\n  }\n}\n.form-horizontal .radio,\n.form-horizontal .checkbox,\n.form-horizontal .radio-inline,\n.form-horizontal .checkbox-inline {\n  padding-top: 7px;\n  margin-top: 0;\n  margin-bottom: 0;\n}\n.form-horizontal .radio,\n.form-horizontal .checkbox {\n  min-height: 27px;\n}\n.form-horizontal .form-group {\n  margin-right: -15px;\n  margin-left: -15px;\n}\n@media (min-width: 768px) {\n  .form-horizontal .control-label {\n    padding-top: 7px;\n    margin-bottom: 0;\n    text-align: right;\n  }\n}\n.form-horizontal .has-feedback .form-control-feedback {\n  right: 15px;\n}\n@media (min-width: 768px) {\n  .form-horizontal .form-group-lg .control-label {\n    padding-top: 11px;\n    font-size: 18px;\n  }\n}\n@media (min-width: 768px) {\n  .form-horizontal .form-group-sm .control-label {\n    padding-top: 6px;\n    font-size: 12px;\n  }\n}\n.btn {\n  display: inline-block;\n  padding: 6px 12px;\n  margin-bottom: 0;\n  font-size: 14px;\n  font-weight: normal;\n  line-height: 1.42857143;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: middle;\n  -ms-touch-action: manipulation;\n      touch-action: manipulation;\n  cursor: pointer;\n  -webkit-user-select: none;\n     -moz-user-select: none;\n      -ms-user-select: none;\n          user-select: none;\n  background-image: none;\n  border: 1px solid transparent;\n  border-radius: 4px;\n}\n.btn:focus,\n.btn:active:focus,\n.btn.active:focus,\n.btn.focus,\n.btn:active.focus,\n.btn.active.focus {\n  outline: thin dotted;\n  outline: 5px auto -webkit-focus-ring-color;\n  outline-offset: -2px;\n}\n.btn:hover,\n.btn:focus,\n.btn.focus {\n  color: #333;\n  text-decoration: none;\n}\n.btn:active,\n.btn.active {\n  background-image: none;\n  outline: 0;\n  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n          box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n}\n.btn.disabled,\n.btn[disabled],\nfieldset[disabled] .btn {\n  cursor: not-allowed;\n  filter: alpha(opacity=65);\n  -webkit-box-shadow: none;\n          box-shadow: none;\n  opacity: .65;\n}\na.btn.disabled,\nfieldset[disabled] a.btn {\n  pointer-events: none;\n}\n.btn-default {\n  color: #333;\n  background-color: #fff;\n  border-color: #ccc;\n}\n.btn-default:focus,\n.btn-default.focus {\n  color: #333;\n  background-color: #e6e6e6;\n  border-color: #8c8c8c;\n}\n.btn-default:hover {\n  color: #333;\n  background-color: #e6e6e6;\n  border-color: #adadad;\n}\n.btn-default:active,\n.btn-default.active,\n.open > .dropdown-toggle.btn-default {\n  color: #333;\n  background-color: #e6e6e6;\n  border-color: #adadad;\n}\n.btn-default:active:hover,\n.btn-default.active:hover,\n.open > .dropdown-toggle.btn-default:hover,\n.btn-default:active:focus,\n.btn-default.active:focus,\n.open > .dropdown-toggle.btn-default:focus,\n.btn-default:active.focus,\n.btn-default.active.focus,\n.open > .dropdown-toggle.btn-default.focus {\n  color: #333;\n  background-color: #d4d4d4;\n  border-color: #8c8c8c;\n}\n.btn-default:active,\n.btn-default.active,\n.open > .dropdown-toggle.btn-default {\n  background-image: none;\n}\n.btn-default.disabled:hover,\n.btn-default[disabled]:hover,\nfieldset[disabled] .btn-default:hover,\n.btn-default.disabled:focus,\n.btn-default[disabled]:focus,\nfieldset[disabled] .btn-default:focus,\n.btn-default.disabled.focus,\n.btn-default[disabled].focus,\nfieldset[disabled] .btn-default.focus {\n  background-color: #fff;\n  border-color: #ccc;\n}\n.btn-default .badge {\n  color: #fff;\n  background-color: #333;\n}\n.btn-primary {\n  color: #fff;\n  background-color: #337ab7;\n  border-color: #2e6da4;\n}\n.btn-primary:focus,\n.btn-primary.focus {\n  color: #fff;\n  background-color: #286090;\n  border-color: #122b40;\n}\n.btn-primary:hover {\n  color: #fff;\n  background-color: #286090;\n  border-color: #204d74;\n}\n.btn-primary:active,\n.btn-primary.active,\n.open > .dropdown-toggle.btn-primary {\n  color: #fff;\n  background-color: #286090;\n  border-color: #204d74;\n}\n.btn-primary:active:hover,\n.btn-primary.active:hover,\n.open > .dropdown-toggle.btn-primary:hover,\n.btn-primary:active:focus,\n.btn-primary.active:focus,\n.open > .dropdown-toggle.btn-primary:focus,\n.btn-primary:active.focus,\n.btn-primary.active.focus,\n.open > .dropdown-toggle.btn-primary.focus {\n  color: #fff;\n  background-color: #204d74;\n  border-color: #122b40;\n}\n.btn-primary:active,\n.btn-primary.active,\n.open > .dropdown-toggle.btn-primary {\n  background-image: none;\n}\n.btn-primary.disabled:hover,\n.btn-primary[disabled]:hover,\nfieldset[disabled] .btn-primary:hover,\n.btn-primary.disabled:focus,\n.btn-primary[disabled]:focus,\nfieldset[disabled] .btn-primary:focus,\n.btn-primary.disabled.focus,\n.btn-primary[disabled].focus,\nfieldset[disabled] .btn-primary.focus {\n  background-color: #337ab7;\n  border-color: #2e6da4;\n}\n.btn-primary .badge {\n  color: #337ab7;\n  background-color: #fff;\n}\n.btn-success {\n  color: #fff;\n  background-color: #5cb85c;\n  border-color: #4cae4c;\n}\n.btn-success:focus,\n.btn-success.focus {\n  color: #fff;\n  background-color: #449d44;\n  border-color: #255625;\n}\n.btn-success:hover {\n  color: #fff;\n  background-color: #449d44;\n  border-color: #398439;\n}\n.btn-success:active,\n.btn-success.active,\n.open > .dropdown-toggle.btn-success {\n  color: #fff;\n  background-color: #449d44;\n  border-color: #398439;\n}\n.btn-success:active:hover,\n.btn-success.active:hover,\n.open > .dropdown-toggle.btn-success:hover,\n.btn-success:active:focus,\n.btn-success.active:focus,\n.open > .dropdown-toggle.btn-success:focus,\n.btn-success:active.focus,\n.btn-success.active.focus,\n.open > .dropdown-toggle.btn-success.focus {\n  color: #fff;\n  background-color: #398439;\n  border-color: #255625;\n}\n.btn-success:active,\n.btn-success.active,\n.open > .dropdown-toggle.btn-success {\n  background-image: none;\n}\n.btn-success.disabled:hover,\n.btn-success[disabled]:hover,\nfieldset[disabled] .btn-success:hover,\n.btn-success.disabled:focus,\n.btn-success[disabled]:focus,\nfieldset[disabled] .btn-success:focus,\n.btn-success.disabled.focus,\n.btn-success[disabled].focus,\nfieldset[disabled] .btn-success.focus {\n  background-color: #5cb85c;\n  border-color: #4cae4c;\n}\n.btn-success .badge {\n  color: #5cb85c;\n  background-color: #fff;\n}\n.btn-info {\n  color: #fff;\n  background-color: #5bc0de;\n  border-color: #46b8da;\n}\n.btn-info:focus,\n.btn-info.focus {\n  color: #fff;\n  background-color: #31b0d5;\n  border-color: #1b6d85;\n}\n.btn-info:hover {\n  color: #fff;\n  background-color: #31b0d5;\n  border-color: #269abc;\n}\n.btn-info:active,\n.btn-info.active,\n.open > .dropdown-toggle.btn-info {\n  color: #fff;\n  background-color: #31b0d5;\n  border-color: #269abc;\n}\n.btn-info:active:hover,\n.btn-info.active:hover,\n.open > .dropdown-toggle.btn-info:hover,\n.btn-info:active:focus,\n.btn-info.active:focus,\n.open > .dropdown-toggle.btn-info:focus,\n.btn-info:active.focus,\n.btn-info.active.focus,\n.open > .dropdown-toggle.btn-info.focus {\n  color: #fff;\n  background-color: #269abc;\n  border-color: #1b6d85;\n}\n.btn-info:active,\n.btn-info.active,\n.open > .dropdown-toggle.btn-info {\n  background-image: none;\n}\n.btn-info.disabled:hover,\n.btn-info[disabled]:hover,\nfieldset[disabled] .btn-info:hover,\n.btn-info.disabled:focus,\n.btn-info[disabled]:focus,\nfieldset[disabled] .btn-info:focus,\n.btn-info.disabled.focus,\n.btn-info[disabled].focus,\nfieldset[disabled] .btn-info.focus {\n  background-color: #5bc0de;\n  border-color: #46b8da;\n}\n.btn-info .badge {\n  color: #5bc0de;\n  background-color: #fff;\n}\n.btn-warning {\n  color: #fff;\n  background-color: #f0ad4e;\n  border-color: #eea236;\n}\n.btn-warning:focus,\n.btn-warning.focus {\n  color: #fff;\n  background-color: #ec971f;\n  border-color: #985f0d;\n}\n.btn-warning:hover {\n  color: #fff;\n  background-color: #ec971f;\n  border-color: #d58512;\n}\n.btn-warning:active,\n.btn-warning.active,\n.open > .dropdown-toggle.btn-warning {\n  color: #fff;\n  background-color: #ec971f;\n  border-color: #d58512;\n}\n.btn-warning:active:hover,\n.btn-warning.active:hover,\n.open > .dropdown-toggle.btn-warning:hover,\n.btn-warning:active:focus,\n.btn-warning.active:focus,\n.open > .dropdown-toggle.btn-warning:focus,\n.btn-warning:active.focus,\n.btn-warning.active.focus,\n.open > .dropdown-toggle.btn-warning.focus {\n  color: #fff;\n  background-color: #d58512;\n  border-color: #985f0d;\n}\n.btn-warning:active,\n.btn-warning.active,\n.open > .dropdown-toggle.btn-warning {\n  background-image: none;\n}\n.btn-warning.disabled:hover,\n.btn-warning[disabled]:hover,\nfieldset[disabled] .btn-warning:hover,\n.btn-warning.disabled:focus,\n.btn-warning[disabled]:focus,\nfieldset[disabled] .btn-warning:focus,\n.btn-warning.disabled.focus,\n.btn-warning[disabled].focus,\nfieldset[disabled] .btn-warning.focus {\n  background-color: #f0ad4e;\n  border-color: #eea236;\n}\n.btn-warning .badge {\n  color: #f0ad4e;\n  background-color: #fff;\n}\n.btn-danger {\n  color: #fff;\n  background-color: #d9534f;\n  border-color: #d43f3a;\n}\n.btn-danger:focus,\n.btn-danger.focus {\n  color: #fff;\n  background-color: #c9302c;\n  border-color: #761c19;\n}\n.btn-danger:hover {\n  color: #fff;\n  background-color: #c9302c;\n  border-color: #ac2925;\n}\n.btn-danger:active,\n.btn-danger.active,\n.open > .dropdown-toggle.btn-danger {\n  color: #fff;\n  background-color: #c9302c;\n  border-color: #ac2925;\n}\n.btn-danger:active:hover,\n.btn-danger.active:hover,\n.open > .dropdown-toggle.btn-danger:hover,\n.btn-danger:active:focus,\n.btn-danger.active:focus,\n.open > .dropdown-toggle.btn-danger:focus,\n.btn-danger:active.focus,\n.btn-danger.active.focus,\n.open > .dropdown-toggle.btn-danger.focus {\n  color: #fff;\n  background-color: #ac2925;\n  border-color: #761c19;\n}\n.btn-danger:active,\n.btn-danger.active,\n.open > .dropdown-toggle.btn-danger {\n  background-image: none;\n}\n.btn-danger.disabled:hover,\n.btn-danger[disabled]:hover,\nfieldset[disabled] .btn-danger:hover,\n.btn-danger.disabled:focus,\n.btn-danger[disabled]:focus,\nfieldset[disabled] .btn-danger:focus,\n.btn-danger.disabled.focus,\n.btn-danger[disabled].focus,\nfieldset[disabled] .btn-danger.focus {\n  background-color: #d9534f;\n  border-color: #d43f3a;\n}\n.btn-danger .badge {\n  color: #d9534f;\n  background-color: #fff;\n}\n.btn-link {\n  font-weight: normal;\n  color: #337ab7;\n  border-radius: 0;\n}\n.btn-link,\n.btn-link:active,\n.btn-link.active,\n.btn-link[disabled],\nfieldset[disabled] .btn-link {\n  background-color: transparent;\n  -webkit-box-shadow: none;\n          box-shadow: none;\n}\n.btn-link,\n.btn-link:hover,\n.btn-link:focus,\n.btn-link:active {\n  border-color: transparent;\n}\n.btn-link:hover,\n.btn-link:focus {\n  color: #23527c;\n  text-decoration: underline;\n  background-color: transparent;\n}\n.btn-link[disabled]:hover,\nfieldset[disabled] .btn-link:hover,\n.btn-link[disabled]:focus,\nfieldset[disabled] .btn-link:focus {\n  color: #777;\n  text-decoration: none;\n}\n.btn-lg,\n.btn-group-lg > .btn {\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\n.btn-sm,\n.btn-group-sm > .btn {\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n.btn-xs,\n.btn-group-xs > .btn {\n  padding: 1px 5px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\n.btn-block {\n  display: block;\n  width: 100%;\n}\n.btn-block + .btn-block {\n  margin-top: 5px;\n}\ninput[type=\"submit\"].btn-block,\ninput[type=\"reset\"].btn-block,\ninput[type=\"button\"].btn-block {\n  width: 100%;\n}\n.fade {\n  opacity: 0;\n  -webkit-transition: opacity .15s linear;\n       -o-transition: opacity .15s linear;\n          transition: opacity .15s linear;\n}\n.fade.in {\n  opacity: 1;\n}\n.collapse {\n  display: none;\n}\n.collapse.in {\n  display: block;\n}\ntr.collapse.in {\n  display: table-row;\n}\ntbody.collapse.in {\n  display: table-row-group;\n}\n.collapsing {\n  position: relative;\n  height: 0;\n  overflow: hidden;\n  -webkit-transition-timing-function: ease;\n       -o-transition-timing-function: ease;\n          transition-timing-function: ease;\n  -webkit-transition-duration: .35s;\n       -o-transition-duration: .35s;\n          transition-duration: .35s;\n  -webkit-transition-property: height, visibility;\n       -o-transition-property: height, visibility;\n          transition-property: height, visibility;\n}\n.caret {\n  display: inline-block;\n  width: 0;\n  height: 0;\n  margin-left: 2px;\n  vertical-align: middle;\n  border-top: 4px dashed;\n  border-top: 4px solid \\9;\n  border-right: 4px solid transparent;\n  border-left: 4px solid transparent;\n}\n.dropup,\n.dropdown {\n  position: relative;\n}\n.dropdown-toggle:focus {\n  outline: 0;\n}\n.dropdown-menu {\n  position: absolute;\n  top: 100%;\n  left: 0;\n  z-index: 1000;\n  display: none;\n  float: left;\n  min-width: 160px;\n  padding: 5px 0;\n  margin: 2px 0 0;\n  font-size: 14px;\n  text-align: left;\n  list-style: none;\n  background-color: #fff;\n  -webkit-background-clip: padding-box;\n          background-clip: padding-box;\n  border: 1px solid #ccc;\n  border: 1px solid rgba(0, 0, 0, .15);\n  border-radius: 4px;\n  -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175);\n          box-shadow: 0 6px 12px rgba(0, 0, 0, .175);\n}\n.dropdown-menu.pull-right {\n  right: 0;\n  left: auto;\n}\n.dropdown-menu .divider {\n  height: 1px;\n  margin: 9px 0;\n  overflow: hidden;\n  background-color: #e5e5e5;\n}\n.dropdown-menu > li > a {\n  display: block;\n  padding: 3px 20px;\n  clear: both;\n  font-weight: normal;\n  line-height: 1.42857143;\n  color: #333;\n  white-space: nowrap;\n}\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n  color: #262626;\n  text-decoration: none;\n  background-color: #f5f5f5;\n}\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n  color: #fff;\n  text-decoration: none;\n  background-color: #337ab7;\n  outline: 0;\n}\n.dropdown-menu > .disabled > a,\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n  color: #777;\n}\n.dropdown-menu > .disabled > a:hover,\n.dropdown-menu > .disabled > a:focus {\n  text-decoration: none;\n  cursor: not-allowed;\n  background-color: transparent;\n  background-image: none;\n  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);\n}\n.open > .dropdown-menu {\n  display: block;\n}\n.open > a {\n  outline: 0;\n}\n.dropdown-menu-right {\n  right: 0;\n  left: auto;\n}\n.dropdown-menu-left {\n  right: auto;\n  left: 0;\n}\n.dropdown-header {\n  display: block;\n  padding: 3px 20px;\n  font-size: 12px;\n  line-height: 1.42857143;\n  color: #777;\n  white-space: nowrap;\n}\n.dropdown-backdrop {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 990;\n}\n.pull-right > .dropdown-menu {\n  right: 0;\n  left: auto;\n}\n.dropup .caret,\n.navbar-fixed-bottom .dropdown .caret {\n  content: \"\";\n  border-top: 0;\n  border-bottom: 4px dashed;\n  border-bottom: 4px solid \\9;\n}\n.dropup .dropdown-menu,\n.navbar-fixed-bottom .dropdown .dropdown-menu {\n  top: auto;\n  bottom: 100%;\n  margin-bottom: 2px;\n}\n@media (min-width: 768px) {\n  .navbar-right .dropdown-menu {\n    right: 0;\n    left: auto;\n  }\n  .navbar-right .dropdown-menu-left {\n    right: auto;\n    left: 0;\n  }\n}\n.btn-group,\n.btn-group-vertical {\n  position: relative;\n  display: inline-block;\n  vertical-align: middle;\n}\n.btn-group > .btn,\n.btn-group-vertical > .btn {\n  position: relative;\n  float: left;\n}\n.btn-group > .btn:hover,\n.btn-group-vertical > .btn:hover,\n.btn-group > .btn:focus,\n.btn-group-vertical > .btn:focus,\n.btn-group > .btn:active,\n.btn-group-vertical > .btn:active,\n.btn-group > .btn.active,\n.btn-group-vertical > .btn.active {\n  z-index: 2;\n}\n.btn-group .btn + .btn,\n.btn-group .btn + .btn-group,\n.btn-group .btn-group + .btn,\n.btn-group .btn-group + .btn-group {\n  margin-left: -1px;\n}\n.btn-toolbar {\n  margin-left: -5px;\n}\n.btn-toolbar .btn,\n.btn-toolbar .btn-group,\n.btn-toolbar .input-group {\n  float: left;\n}\n.btn-toolbar > .btn,\n.btn-toolbar > .btn-group,\n.btn-toolbar > .input-group {\n  margin-left: 5px;\n}\n.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {\n  border-radius: 0;\n}\n.btn-group > .btn:first-child {\n  margin-left: 0;\n}\n.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {\n  border-top-right-radius: 0;\n  border-bottom-right-radius: 0;\n}\n.btn-group > .btn:last-child:not(:first-child),\n.btn-group > .dropdown-toggle:not(:first-child) {\n  border-top-left-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.btn-group > .btn-group {\n  float: left;\n}\n.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child,\n.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle {\n  border-top-right-radius: 0;\n  border-bottom-right-radius: 0;\n}\n.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {\n  border-top-left-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.btn-group .dropdown-toggle:active,\n.btn-group.open .dropdown-toggle {\n  outline: 0;\n}\n.btn-group > .btn + .dropdown-toggle {\n  padding-right: 8px;\n  padding-left: 8px;\n}\n.btn-group > .btn-lg + .dropdown-toggle {\n  padding-right: 12px;\n  padding-left: 12px;\n}\n.btn-group.open .dropdown-toggle {\n  -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n          box-shadow: inset 0 3px 5px rgba(0, 0, 0, .125);\n}\n.btn-group.open .dropdown-toggle.btn-link {\n  -webkit-box-shadow: none;\n          box-shadow: none;\n}\n.btn .caret {\n  margin-left: 0;\n}\n.btn-lg .caret {\n  border-width: 5px 5px 0;\n  border-bottom-width: 0;\n}\n.dropup .btn-lg .caret {\n  border-width: 0 5px 5px;\n}\n.btn-group-vertical > .btn,\n.btn-group-vertical > .btn-group,\n.btn-group-vertical > .btn-group > .btn {\n  display: block;\n  float: none;\n  width: 100%;\n  max-width: 100%;\n}\n.btn-group-vertical > .btn-group > .btn {\n  float: none;\n}\n.btn-group-vertical > .btn + .btn,\n.btn-group-vertical > .btn + .btn-group,\n.btn-group-vertical > .btn-group + .btn,\n.btn-group-vertical > .btn-group + .btn-group {\n  margin-top: -1px;\n  margin-left: 0;\n}\n.btn-group-vertical > .btn:not(:first-child):not(:last-child) {\n  border-radius: 0;\n}\n.btn-group-vertical > .btn:first-child:not(:last-child) {\n  border-top-left-radius: 4px;\n  border-top-right-radius: 4px;\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.btn-group-vertical > .btn:last-child:not(:first-child) {\n  border-top-left-radius: 0;\n  border-top-right-radius: 0;\n  border-bottom-right-radius: 4px;\n  border-bottom-left-radius: 4px;\n}\n.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {\n  border-radius: 0;\n}\n.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child,\n.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {\n  border-top-left-radius: 0;\n  border-top-right-radius: 0;\n}\n.btn-group-justified {\n  display: table;\n  width: 100%;\n  table-layout: fixed;\n  border-collapse: separate;\n}\n.btn-group-justified > .btn,\n.btn-group-justified > .btn-group {\n  display: table-cell;\n  float: none;\n  width: 1%;\n}\n.btn-group-justified > .btn-group .btn {\n  width: 100%;\n}\n.btn-group-justified > .btn-group .dropdown-menu {\n  left: auto;\n}\n[data-toggle=\"buttons\"] > .btn input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn-group > .btn input[type=\"radio\"],\n[data-toggle=\"buttons\"] > .btn input[type=\"checkbox\"],\n[data-toggle=\"buttons\"] > .btn-group > .btn input[type=\"checkbox\"] {\n  position: absolute;\n  clip: rect(0, 0, 0, 0);\n  pointer-events: none;\n}\n.input-group {\n  position: relative;\n  display: table;\n  border-collapse: separate;\n}\n.input-group[class*=\"col-\"] {\n  float: none;\n  padding-right: 0;\n  padding-left: 0;\n}\n.input-group .form-control {\n  position: relative;\n  z-index: 2;\n  float: left;\n  width: 100%;\n  margin-bottom: 0;\n}\n.input-group .form-control:focus {\n  z-index: 3;\n}\n.input-group-lg > .form-control,\n.input-group-lg > .input-group-addon,\n.input-group-lg > .input-group-btn > .btn {\n  height: 46px;\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.3333333;\n  border-radius: 6px;\n}\nselect.input-group-lg > .form-control,\nselect.input-group-lg > .input-group-addon,\nselect.input-group-lg > .input-group-btn > .btn {\n  height: 46px;\n  line-height: 46px;\n}\ntextarea.input-group-lg > .form-control,\ntextarea.input-group-lg > .input-group-addon,\ntextarea.input-group-lg > .input-group-btn > .btn,\nselect[multiple].input-group-lg > .form-control,\nselect[multiple].input-group-lg > .input-group-addon,\nselect[multiple].input-group-lg > .input-group-btn > .btn {\n  height: auto;\n}\n.input-group-sm > .form-control,\n.input-group-sm > .input-group-addon,\n.input-group-sm > .input-group-btn > .btn {\n  height: 30px;\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n  border-radius: 3px;\n}\nselect.input-group-sm > .form-control,\nselect.input-group-sm > .input-group-addon,\nselect.input-group-sm > .input-group-btn > .btn {\n  height: 30px;\n  line-height: 30px;\n}\ntextarea.input-group-sm > .form-control,\ntextarea.input-group-sm > .input-group-addon,\ntextarea.input-group-sm > .input-group-btn > .btn,\nselect[multiple].input-group-sm > .form-control,\nselect[multiple].input-group-sm > .input-group-addon,\nselect[multiple].input-group-sm > .input-group-btn > .btn {\n  height: auto;\n}\n.input-group-addon,\n.input-group-btn,\n.input-group .form-control {\n  display: table-cell;\n}\n.input-group-addon:not(:first-child):not(:last-child),\n.input-group-btn:not(:first-child):not(:last-child),\n.input-group .form-control:not(:first-child):not(:last-child) {\n  border-radius: 0;\n}\n.input-group-addon,\n.input-group-btn {\n  width: 1%;\n  white-space: nowrap;\n  vertical-align: middle;\n}\n.input-group-addon {\n  padding: 6px 12px;\n  font-size: 14px;\n  font-weight: normal;\n  line-height: 1;\n  color: #555;\n  text-align: center;\n  background-color: #eee;\n  border: 1px solid #ccc;\n  border-radius: 4px;\n}\n.input-group-addon.input-sm {\n  padding: 5px 10px;\n  font-size: 12px;\n  border-radius: 3px;\n}\n.input-group-addon.input-lg {\n  padding: 10px 16px;\n  font-size: 18px;\n  border-radius: 6px;\n}\n.input-group-addon input[type=\"radio\"],\n.input-group-addon input[type=\"checkbox\"] {\n  margin-top: 0;\n}\n.input-group .form-control:first-child,\n.input-group-addon:first-child,\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group > .btn,\n.input-group-btn:first-child > .dropdown-toggle,\n.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),\n.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {\n  border-top-right-radius: 0;\n  border-bottom-right-radius: 0;\n}\n.input-group-addon:first-child {\n  border-right: 0;\n}\n.input-group .form-control:last-child,\n.input-group-addon:last-child,\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group > .btn,\n.input-group-btn:last-child > .dropdown-toggle,\n.input-group-btn:first-child > .btn:not(:first-child),\n.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {\n  border-top-left-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.input-group-addon:last-child {\n  border-left: 0;\n}\n.input-group-btn {\n  position: relative;\n  font-size: 0;\n  white-space: nowrap;\n}\n.input-group-btn > .btn {\n  position: relative;\n}\n.input-group-btn > .btn + .btn {\n  margin-left: -1px;\n}\n.input-group-btn > .btn:hover,\n.input-group-btn > .btn:focus,\n.input-group-btn > .btn:active {\n  z-index: 2;\n}\n.input-group-btn:first-child > .btn,\n.input-group-btn:first-child > .btn-group {\n  margin-right: -1px;\n}\n.input-group-btn:last-child > .btn,\n.input-group-btn:last-child > .btn-group {\n  z-index: 2;\n  margin-left: -1px;\n}\n.nav {\n  padding-left: 0;\n  margin-bottom: 0;\n  list-style: none;\n}\n.nav > li {\n  position: relative;\n  display: block;\n}\n.nav > li > a {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n}\n.nav > li > a:hover,\n.nav > li > a:focus {\n  text-decoration: none;\n  background-color: #eee;\n}\n.nav > li.disabled > a {\n  color: #777;\n}\n.nav > li.disabled > a:hover,\n.nav > li.disabled > a:focus {\n  color: #777;\n  text-decoration: none;\n  cursor: not-allowed;\n  background-color: transparent;\n}\n.nav .open > a,\n.nav .open > a:hover,\n.nav .open > a:focus {\n  background-color: #eee;\n  border-color: #337ab7;\n}\n.nav .nav-divider {\n  height: 1px;\n  margin: 9px 0;\n  overflow: hidden;\n  background-color: #e5e5e5;\n}\n.nav > li > a > img {\n  max-width: none;\n}\n.nav-tabs {\n  border-bottom: 1px solid #ddd;\n}\n.nav-tabs > li {\n  float: left;\n  margin-bottom: -1px;\n}\n.nav-tabs > li > a {\n  margin-right: 2px;\n  line-height: 1.42857143;\n  border: 1px solid transparent;\n  border-radius: 4px 4px 0 0;\n}\n.nav-tabs > li > a:hover {\n  border-color: #eee #eee #ddd;\n}\n.nav-tabs > li.active > a,\n.nav-tabs > li.active > a:hover,\n.nav-tabs > li.active > a:focus {\n  color: #555;\n  cursor: default;\n  background-color: #fff;\n  border: 1px solid #ddd;\n  border-bottom-color: transparent;\n}\n.nav-tabs.nav-justified {\n  width: 100%;\n  border-bottom: 0;\n}\n.nav-tabs.nav-justified > li {\n  float: none;\n}\n.nav-tabs.nav-justified > li > a {\n  margin-bottom: 5px;\n  text-align: center;\n}\n.nav-tabs.nav-justified > .dropdown .dropdown-menu {\n  top: auto;\n  left: auto;\n}\n@media (min-width: 768px) {\n  .nav-tabs.nav-justified > li {\n    display: table-cell;\n    width: 1%;\n  }\n  .nav-tabs.nav-justified > li > a {\n    margin-bottom: 0;\n  }\n}\n.nav-tabs.nav-justified > li > a {\n  margin-right: 0;\n  border-radius: 4px;\n}\n.nav-tabs.nav-justified > .active > a,\n.nav-tabs.nav-justified > .active > a:hover,\n.nav-tabs.nav-justified > .active > a:focus {\n  border: 1px solid #ddd;\n}\n@media (min-width: 768px) {\n  .nav-tabs.nav-justified > li > a {\n    border-bottom: 1px solid #ddd;\n    border-radius: 4px 4px 0 0;\n  }\n  .nav-tabs.nav-justified > .active > a,\n  .nav-tabs.nav-justified > .active > a:hover,\n  .nav-tabs.nav-justified > .active > a:focus {\n    border-bottom-color: #fff;\n  }\n}\n.nav-pills > li {\n  float: left;\n}\n.nav-pills > li > a {\n  border-radius: 4px;\n}\n.nav-pills > li + li {\n  margin-left: 2px;\n}\n.nav-pills > li.active > a,\n.nav-pills > li.active > a:hover,\n.nav-pills > li.active > a:focus {\n  color: #fff;\n  background-color: #337ab7;\n}\n.nav-stacked > li {\n  float: none;\n}\n.nav-stacked > li + li {\n  margin-top: 2px;\n  margin-left: 0;\n}\n.nav-justified {\n  width: 100%;\n}\n.nav-justified > li {\n  float: none;\n}\n.nav-justified > li > a {\n  margin-bottom: 5px;\n  text-align: center;\n}\n.nav-justified > .dropdown .dropdown-menu {\n  top: auto;\n  left: auto;\n}\n@media (min-width: 768px) {\n  .nav-justified > li {\n    display: table-cell;\n    width: 1%;\n  }\n  .nav-justified > li > a {\n    margin-bottom: 0;\n  }\n}\n.nav-tabs-justified {\n  border-bottom: 0;\n}\n.nav-tabs-justified > li > a {\n  margin-right: 0;\n  border-radius: 4px;\n}\n.nav-tabs-justified > .active > a,\n.nav-tabs-justified > .active > a:hover,\n.nav-tabs-justified > .active > a:focus {\n  border: 1px solid #ddd;\n}\n@media (min-width: 768px) {\n  .nav-tabs-justified > li > a {\n    border-bottom: 1px solid #ddd;\n    border-radius: 4px 4px 0 0;\n  }\n  .nav-tabs-justified > .active > a,\n  .nav-tabs-justified > .active > a:hover,\n  .nav-tabs-justified > .active > a:focus {\n    border-bottom-color: #fff;\n  }\n}\n.tab-content > .tab-pane {\n  display: none;\n}\n.tab-content > .active {\n  display: block;\n}\n.nav-tabs .dropdown-menu {\n  margin-top: -1px;\n  border-top-left-radius: 0;\n  border-top-right-radius: 0;\n}\n.navbar {\n  position: relative;\n  min-height: 50px;\n  margin-bottom: 20px;\n  border: 1px solid transparent;\n}\n@media (min-width: 768px) {\n  .navbar {\n    border-radius: 4px;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-header {\n    float: left;\n  }\n}\n.navbar-collapse {\n  padding-right: 15px;\n  padding-left: 15px;\n  overflow-x: visible;\n  -webkit-overflow-scrolling: touch;\n  border-top: 1px solid transparent;\n  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);\n          box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);\n}\n.navbar-collapse.in {\n  overflow-y: auto;\n}\n@media (min-width: 768px) {\n  .navbar-collapse {\n    width: auto;\n    border-top: 0;\n    -webkit-box-shadow: none;\n            box-shadow: none;\n  }\n  .navbar-collapse.collapse {\n    display: block !important;\n    height: auto !important;\n    padding-bottom: 0;\n    overflow: visible !important;\n  }\n  .navbar-collapse.in {\n    overflow-y: visible;\n  }\n  .navbar-fixed-top .navbar-collapse,\n  .navbar-static-top .navbar-collapse,\n  .navbar-fixed-bottom .navbar-collapse {\n    padding-right: 0;\n    padding-left: 0;\n  }\n}\n.navbar-fixed-top .navbar-collapse,\n.navbar-fixed-bottom .navbar-collapse {\n  max-height: 340px;\n}\n@media (max-device-width: 480px) and (orientation: landscape) {\n  .navbar-fixed-top .navbar-collapse,\n  .navbar-fixed-bottom .navbar-collapse {\n    max-height: 200px;\n  }\n}\n.container > .navbar-header,\n.container-fluid > .navbar-header,\n.container > .navbar-collapse,\n.container-fluid > .navbar-collapse {\n  margin-right: -15px;\n  margin-left: -15px;\n}\n@media (min-width: 768px) {\n  .container > .navbar-header,\n  .container-fluid > .navbar-header,\n  .container > .navbar-collapse,\n  .container-fluid > .navbar-collapse {\n    margin-right: 0;\n    margin-left: 0;\n  }\n}\n.navbar-static-top {\n  z-index: 1000;\n  border-width: 0 0 1px;\n}\n@media (min-width: 768px) {\n  .navbar-static-top {\n    border-radius: 0;\n  }\n}\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n  position: fixed;\n  right: 0;\n  left: 0;\n  z-index: 1030;\n}\n@media (min-width: 768px) {\n  .navbar-fixed-top,\n  .navbar-fixed-bottom {\n    border-radius: 0;\n  }\n}\n.navbar-fixed-top {\n  top: 0;\n  border-width: 0 0 1px;\n}\n.navbar-fixed-bottom {\n  bottom: 0;\n  margin-bottom: 0;\n  border-width: 1px 0 0;\n}\n.navbar-brand {\n  float: left;\n  height: 50px;\n  padding: 15px 15px;\n  font-size: 18px;\n  line-height: 20px;\n}\n.navbar-brand:hover,\n.navbar-brand:focus {\n  text-decoration: none;\n}\n.navbar-brand > img {\n  display: block;\n}\n@media (min-width: 768px) {\n  .navbar > .container .navbar-brand,\n  .navbar > .container-fluid .navbar-brand {\n    margin-left: -15px;\n  }\n}\n.navbar-toggle {\n  position: relative;\n  float: right;\n  padding: 9px 10px;\n  margin-top: 8px;\n  margin-right: 15px;\n  margin-bottom: 8px;\n  background-color: transparent;\n  background-image: none;\n  border: 1px solid transparent;\n  border-radius: 4px;\n}\n.navbar-toggle:focus {\n  outline: 0;\n}\n.navbar-toggle .icon-bar {\n  display: block;\n  width: 22px;\n  height: 2px;\n  border-radius: 1px;\n}\n.navbar-toggle .icon-bar + .icon-bar {\n  margin-top: 4px;\n}\n@media (min-width: 768px) {\n  .navbar-toggle {\n    display: none;\n  }\n}\n.navbar-nav {\n  margin: 7.5px -15px;\n}\n.navbar-nav > li > a {\n  padding-top: 10px;\n  padding-bottom: 10px;\n  line-height: 20px;\n}\n@media (max-width: 767px) {\n  .navbar-nav .open .dropdown-menu {\n    position: static;\n    float: none;\n    width: auto;\n    margin-top: 0;\n    background-color: transparent;\n    border: 0;\n    -webkit-box-shadow: none;\n            box-shadow: none;\n  }\n  .navbar-nav .open .dropdown-menu > li > a,\n  .navbar-nav .open .dropdown-menu .dropdown-header {\n    padding: 5px 15px 5px 25px;\n  }\n  .navbar-nav .open .dropdown-menu > li > a {\n    line-height: 20px;\n  }\n  .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-nav .open .dropdown-menu > li > a:focus {\n    background-image: none;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-nav {\n    float: left;\n    margin: 0;\n  }\n  .navbar-nav > li {\n    float: left;\n  }\n  .navbar-nav > li > a {\n    padding-top: 15px;\n    padding-bottom: 15px;\n  }\n}\n.navbar-form {\n  padding: 10px 15px;\n  margin-top: 8px;\n  margin-right: -15px;\n  margin-bottom: 8px;\n  margin-left: -15px;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid transparent;\n  -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);\n          box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 rgba(255, 255, 255, .1);\n}\n@media (min-width: 768px) {\n  .navbar-form .form-group {\n    display: inline-block;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .navbar-form .form-control {\n    display: inline-block;\n    width: auto;\n    vertical-align: middle;\n  }\n  .navbar-form .form-control-static {\n    display: inline-block;\n  }\n  .navbar-form .input-group {\n    display: inline-table;\n    vertical-align: middle;\n  }\n  .navbar-form .input-group .input-group-addon,\n  .navbar-form .input-group .input-group-btn,\n  .navbar-form .input-group .form-control {\n    width: auto;\n  }\n  .navbar-form .input-group > .form-control {\n    width: 100%;\n  }\n  .navbar-form .control-label {\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .navbar-form .radio,\n  .navbar-form .checkbox {\n    display: inline-block;\n    margin-top: 0;\n    margin-bottom: 0;\n    vertical-align: middle;\n  }\n  .navbar-form .radio label,\n  .navbar-form .checkbox label {\n    padding-left: 0;\n  }\n  .navbar-form .radio input[type=\"radio\"],\n  .navbar-form .checkbox input[type=\"checkbox\"] {\n    position: relative;\n    margin-left: 0;\n  }\n  .navbar-form .has-feedback .form-control-feedback {\n    top: 0;\n  }\n}\n@media (max-width: 767px) {\n  .navbar-form .form-group {\n    margin-bottom: 5px;\n  }\n  .navbar-form .form-group:last-child {\n    margin-bottom: 0;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-form {\n    width: auto;\n    padding-top: 0;\n    padding-bottom: 0;\n    margin-right: 0;\n    margin-left: 0;\n    border: 0;\n    -webkit-box-shadow: none;\n            box-shadow: none;\n  }\n}\n.navbar-nav > li > .dropdown-menu {\n  margin-top: 0;\n  border-top-left-radius: 0;\n  border-top-right-radius: 0;\n}\n.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {\n  margin-bottom: 0;\n  border-top-left-radius: 4px;\n  border-top-right-radius: 4px;\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.navbar-btn {\n  margin-top: 8px;\n  margin-bottom: 8px;\n}\n.navbar-btn.btn-sm {\n  margin-top: 10px;\n  margin-bottom: 10px;\n}\n.navbar-btn.btn-xs {\n  margin-top: 14px;\n  margin-bottom: 14px;\n}\n.navbar-text {\n  margin-top: 15px;\n  margin-bottom: 15px;\n}\n@media (min-width: 768px) {\n  .navbar-text {\n    float: left;\n    margin-right: 15px;\n    margin-left: 15px;\n  }\n}\n@media (min-width: 768px) {\n  .navbar-left {\n    float: left !important;\n  }\n  .navbar-right {\n    float: right !important;\n    margin-right: -15px;\n  }\n  .navbar-right ~ .navbar-right {\n    margin-right: 0;\n  }\n}\n.navbar-default {\n  background-color: #f8f8f8;\n  border-color: #e7e7e7;\n}\n.navbar-default .navbar-brand {\n  color: #777;\n}\n.navbar-default .navbar-brand:hover,\n.navbar-default .navbar-brand:focus {\n  color: #5e5e5e;\n  background-color: transparent;\n}\n.navbar-default .navbar-text {\n  color: #777;\n}\n.navbar-default .navbar-nav > li > a {\n  color: #777;\n}\n.navbar-default .navbar-nav > li > a:hover,\n.navbar-default .navbar-nav > li > a:focus {\n  color: #333;\n  background-color: transparent;\n}\n.navbar-default .navbar-nav > .active > a,\n.navbar-default .navbar-nav > .active > a:hover,\n.navbar-default .navbar-nav > .active > a:focus {\n  color: #555;\n  background-color: #e7e7e7;\n}\n.navbar-default .navbar-nav > .disabled > a,\n.navbar-default .navbar-nav > .disabled > a:hover,\n.navbar-default .navbar-nav > .disabled > a:focus {\n  color: #ccc;\n  background-color: transparent;\n}\n.navbar-default .navbar-toggle {\n  border-color: #ddd;\n}\n.navbar-default .navbar-toggle:hover,\n.navbar-default .navbar-toggle:focus {\n  background-color: #ddd;\n}\n.navbar-default .navbar-toggle .icon-bar {\n  background-color: #888;\n}\n.navbar-default .navbar-collapse,\n.navbar-default .navbar-form {\n  border-color: #e7e7e7;\n}\n.navbar-default .navbar-nav > .open > a,\n.navbar-default .navbar-nav > .open > a:hover,\n.navbar-default .navbar-nav > .open > a:focus {\n  color: #555;\n  background-color: #e7e7e7;\n}\n@media (max-width: 767px) {\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a {\n    color: #777;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {\n    color: #333;\n    background-color: transparent;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a,\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {\n    color: #555;\n    background-color: #e7e7e7;\n  }\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n  .navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n    color: #ccc;\n    background-color: transparent;\n  }\n}\n.navbar-default .navbar-link {\n  color: #777;\n}\n.navbar-default .navbar-link:hover {\n  color: #333;\n}\n.navbar-default .btn-link {\n  color: #777;\n}\n.navbar-default .btn-link:hover,\n.navbar-default .btn-link:focus {\n  color: #333;\n}\n.navbar-default .btn-link[disabled]:hover,\nfieldset[disabled] .navbar-default .btn-link:hover,\n.navbar-default .btn-link[disabled]:focus,\nfieldset[disabled] .navbar-default .btn-link:focus {\n  color: #ccc;\n}\n.navbar-inverse {\n  background-color: #222;\n  border-color: #080808;\n}\n.navbar-inverse .navbar-brand {\n  color: #9d9d9d;\n}\n.navbar-inverse .navbar-brand:hover,\n.navbar-inverse .navbar-brand:focus {\n  color: #fff;\n  background-color: transparent;\n}\n.navbar-inverse .navbar-text {\n  color: #9d9d9d;\n}\n.navbar-inverse .navbar-nav > li > a {\n  color: #9d9d9d;\n}\n.navbar-inverse .navbar-nav > li > a:hover,\n.navbar-inverse .navbar-nav > li > a:focus {\n  color: #fff;\n  background-color: transparent;\n}\n.navbar-inverse .navbar-nav > .active > a,\n.navbar-inverse .navbar-nav > .active > a:hover,\n.navbar-inverse .navbar-nav > .active > a:focus {\n  color: #fff;\n  background-color: #080808;\n}\n.navbar-inverse .navbar-nav > .disabled > a,\n.navbar-inverse .navbar-nav > .disabled > a:hover,\n.navbar-inverse .navbar-nav > .disabled > a:focus {\n  color: #444;\n  background-color: transparent;\n}\n.navbar-inverse .navbar-toggle {\n  border-color: #333;\n}\n.navbar-inverse .navbar-toggle:hover,\n.navbar-inverse .navbar-toggle:focus {\n  background-color: #333;\n}\n.navbar-inverse .navbar-toggle .icon-bar {\n  background-color: #fff;\n}\n.navbar-inverse .navbar-collapse,\n.navbar-inverse .navbar-form {\n  border-color: #101010;\n}\n.navbar-inverse .navbar-nav > .open > a,\n.navbar-inverse .navbar-nav > .open > a:hover,\n.navbar-inverse .navbar-nav > .open > a:focus {\n  color: #fff;\n  background-color: #080808;\n}\n@media (max-width: 767px) {\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {\n    border-color: #080808;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu .divider {\n    background-color: #080808;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a {\n    color: #9d9d9d;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {\n    color: #fff;\n    background-color: transparent;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {\n    color: #fff;\n    background-color: #080808;\n  }\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,\n  .navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {\n    color: #444;\n    background-color: transparent;\n  }\n}\n.navbar-inverse .navbar-link {\n  color: #9d9d9d;\n}\n.navbar-inverse .navbar-link:hover {\n  color: #fff;\n}\n.navbar-inverse .btn-link {\n  color: #9d9d9d;\n}\n.navbar-inverse .btn-link:hover,\n.navbar-inverse .btn-link:focus {\n  color: #fff;\n}\n.navbar-inverse .btn-link[disabled]:hover,\nfieldset[disabled] .navbar-inverse .btn-link:hover,\n.navbar-inverse .btn-link[disabled]:focus,\nfieldset[disabled] .navbar-inverse .btn-link:focus {\n  color: #444;\n}\n.breadcrumb {\n  padding: 8px 15px;\n  margin-bottom: 20px;\n  list-style: none;\n  background-color: #f5f5f5;\n  border-radius: 4px;\n}\n.breadcrumb > li {\n  display: inline-block;\n}\n.breadcrumb > li + li:before {\n  padding: 0 5px;\n  color: #ccc;\n  content: \"/\\00a0\";\n}\n.breadcrumb > .active {\n  color: #777;\n}\n.pagination {\n  display: inline-block;\n  padding-left: 0;\n  margin: 20px 0;\n  border-radius: 4px;\n}\n.pagination > li {\n  display: inline;\n}\n.pagination > li > a,\n.pagination > li > span {\n  position: relative;\n  float: left;\n  padding: 6px 12px;\n  margin-left: -1px;\n  line-height: 1.42857143;\n  color: #337ab7;\n  text-decoration: none;\n  background-color: #fff;\n  border: 1px solid #ddd;\n}\n.pagination > li:first-child > a,\n.pagination > li:first-child > span {\n  margin-left: 0;\n  border-top-left-radius: 4px;\n  border-bottom-left-radius: 4px;\n}\n.pagination > li:last-child > a,\n.pagination > li:last-child > span {\n  border-top-right-radius: 4px;\n  border-bottom-right-radius: 4px;\n}\n.pagination > li > a:hover,\n.pagination > li > span:hover,\n.pagination > li > a:focus,\n.pagination > li > span:focus {\n  z-index: 2;\n  color: #23527c;\n  background-color: #eee;\n  border-color: #ddd;\n}\n.pagination > .active > a,\n.pagination > .active > span,\n.pagination > .active > a:hover,\n.pagination > .active > span:hover,\n.pagination > .active > a:focus,\n.pagination > .active > span:focus {\n  z-index: 3;\n  color: #fff;\n  cursor: default;\n  background-color: #337ab7;\n  border-color: #337ab7;\n}\n.pagination > .disabled > span,\n.pagination > .disabled > span:hover,\n.pagination > .disabled > span:focus,\n.pagination > .disabled > a,\n.pagination > .disabled > a:hover,\n.pagination > .disabled > a:focus {\n  color: #777;\n  cursor: not-allowed;\n  background-color: #fff;\n  border-color: #ddd;\n}\n.pagination-lg > li > a,\n.pagination-lg > li > span {\n  padding: 10px 16px;\n  font-size: 18px;\n  line-height: 1.3333333;\n}\n.pagination-lg > li:first-child > a,\n.pagination-lg > li:first-child > span {\n  border-top-left-radius: 6px;\n  border-bottom-left-radius: 6px;\n}\n.pagination-lg > li:last-child > a,\n.pagination-lg > li:last-child > span {\n  border-top-right-radius: 6px;\n  border-bottom-right-radius: 6px;\n}\n.pagination-sm > li > a,\n.pagination-sm > li > span {\n  padding: 5px 10px;\n  font-size: 12px;\n  line-height: 1.5;\n}\n.pagination-sm > li:first-child > a,\n.pagination-sm > li:first-child > span {\n  border-top-left-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.pagination-sm > li:last-child > a,\n.pagination-sm > li:last-child > span {\n  border-top-right-radius: 3px;\n  border-bottom-right-radius: 3px;\n}\n.pager {\n  padding-left: 0;\n  margin: 20px 0;\n  text-align: center;\n  list-style: none;\n}\n.pager li {\n  display: inline;\n}\n.pager li > a,\n.pager li > span {\n  display: inline-block;\n  padding: 5px 14px;\n  background-color: #fff;\n  border: 1px solid #ddd;\n  border-radius: 15px;\n}\n.pager li > a:hover,\n.pager li > a:focus {\n  text-decoration: none;\n  background-color: #eee;\n}\n.pager .next > a,\n.pager .next > span {\n  float: right;\n}\n.pager .previous > a,\n.pager .previous > span {\n  float: left;\n}\n.pager .disabled > a,\n.pager .disabled > a:hover,\n.pager .disabled > a:focus,\n.pager .disabled > span {\n  color: #777;\n  cursor: not-allowed;\n  background-color: #fff;\n}\n.label {\n  display: inline;\n  padding: .2em .6em .3em;\n  font-size: 75%;\n  font-weight: bold;\n  line-height: 1;\n  color: #fff;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: baseline;\n  border-radius: .25em;\n}\na.label:hover,\na.label:focus {\n  color: #fff;\n  text-decoration: none;\n  cursor: pointer;\n}\n.label:empty {\n  display: none;\n}\n.btn .label {\n  position: relative;\n  top: -1px;\n}\n.label-default {\n  background-color: #777;\n}\n.label-default[href]:hover,\n.label-default[href]:focus {\n  background-color: #5e5e5e;\n}\n.label-primary {\n  background-color: #337ab7;\n}\n.label-primary[href]:hover,\n.label-primary[href]:focus {\n  background-color: #286090;\n}\n.label-success {\n  background-color: #5cb85c;\n}\n.label-success[href]:hover,\n.label-success[href]:focus {\n  background-color: #449d44;\n}\n.label-info {\n  background-color: #5bc0de;\n}\n.label-info[href]:hover,\n.label-info[href]:focus {\n  background-color: #31b0d5;\n}\n.label-warning {\n  background-color: #f0ad4e;\n}\n.label-warning[href]:hover,\n.label-warning[href]:focus {\n  background-color: #ec971f;\n}\n.label-danger {\n  background-color: #d9534f;\n}\n.label-danger[href]:hover,\n.label-danger[href]:focus {\n  background-color: #c9302c;\n}\n.badge {\n  display: inline-block;\n  min-width: 10px;\n  padding: 3px 7px;\n  font-size: 12px;\n  font-weight: bold;\n  line-height: 1;\n  color: #fff;\n  text-align: center;\n  white-space: nowrap;\n  vertical-align: middle;\n  background-color: #777;\n  border-radius: 10px;\n}\n.badge:empty {\n  display: none;\n}\n.btn .badge {\n  position: relative;\n  top: -1px;\n}\n.btn-xs .badge,\n.btn-group-xs > .btn .badge {\n  top: 0;\n  padding: 1px 5px;\n}\na.badge:hover,\na.badge:focus {\n  color: #fff;\n  text-decoration: none;\n  cursor: pointer;\n}\n.list-group-item.active > .badge,\n.nav-pills > .active > a > .badge {\n  color: #337ab7;\n  background-color: #fff;\n}\n.list-group-item > .badge {\n  float: right;\n}\n.list-group-item > .badge + .badge {\n  margin-right: 5px;\n}\n.nav-pills > li > a > .badge {\n  margin-left: 3px;\n}\n.jumbotron {\n  padding-top: 30px;\n  padding-bottom: 30px;\n  margin-bottom: 30px;\n  color: inherit;\n  background-color: #eee;\n}\n.jumbotron h1,\n.jumbotron .h1 {\n  color: inherit;\n}\n.jumbotron p {\n  margin-bottom: 15px;\n  font-size: 21px;\n  font-weight: 200;\n}\n.jumbotron > hr {\n  border-top-color: #d5d5d5;\n}\n.container .jumbotron,\n.container-fluid .jumbotron {\n  padding-right: 15px;\n  padding-left: 15px;\n  border-radius: 6px;\n}\n.jumbotron .container {\n  max-width: 100%;\n}\n@media screen and (min-width: 768px) {\n  .jumbotron {\n    padding-top: 48px;\n    padding-bottom: 48px;\n  }\n  .container .jumbotron,\n  .container-fluid .jumbotron {\n    padding-right: 60px;\n    padding-left: 60px;\n  }\n  .jumbotron h1,\n  .jumbotron .h1 {\n    font-size: 63px;\n  }\n}\n.thumbnail {\n  display: block;\n  padding: 4px;\n  margin-bottom: 20px;\n  line-height: 1.42857143;\n  background-color: #fff;\n  border: 1px solid #ddd;\n  border-radius: 4px;\n  -webkit-transition: border .2s ease-in-out;\n       -o-transition: border .2s ease-in-out;\n          transition: border .2s ease-in-out;\n}\n.thumbnail > img,\n.thumbnail a > img {\n  margin-right: auto;\n  margin-left: auto;\n}\na.thumbnail:hover,\na.thumbnail:focus,\na.thumbnail.active {\n  border-color: #337ab7;\n}\n.thumbnail .caption {\n  padding: 9px;\n  color: #333;\n}\n.alert {\n  padding: 15px;\n  margin-bottom: 20px;\n  border: 1px solid transparent;\n  border-radius: 4px;\n}\n.alert h4 {\n  margin-top: 0;\n  color: inherit;\n}\n.alert .alert-link {\n  font-weight: bold;\n}\n.alert > p,\n.alert > ul {\n  margin-bottom: 0;\n}\n.alert > p + p {\n  margin-top: 5px;\n}\n.alert-dismissable,\n.alert-dismissible {\n  padding-right: 35px;\n}\n.alert-dismissable .close,\n.alert-dismissible .close {\n  position: relative;\n  top: -2px;\n  right: -21px;\n  color: inherit;\n}\n.alert-success {\n  color: #3c763d;\n  background-color: #dff0d8;\n  border-color: #d6e9c6;\n}\n.alert-success hr {\n  border-top-color: #c9e2b3;\n}\n.alert-success .alert-link {\n  color: #2b542c;\n}\n.alert-info {\n  color: #31708f;\n  background-color: #d9edf7;\n  border-color: #bce8f1;\n}\n.alert-info hr {\n  border-top-color: #a6e1ec;\n}\n.alert-info .alert-link {\n  color: #245269;\n}\n.alert-warning {\n  color: #8a6d3b;\n  background-color: #fcf8e3;\n  border-color: #faebcc;\n}\n.alert-warning hr {\n  border-top-color: #f7e1b5;\n}\n.alert-warning .alert-link {\n  color: #66512c;\n}\n.alert-danger {\n  color: #a94442;\n  background-color: #f2dede;\n  border-color: #ebccd1;\n}\n.alert-danger hr {\n  border-top-color: #e4b9c0;\n}\n.alert-danger .alert-link {\n  color: #843534;\n}\n@-webkit-keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n@-o-keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n@keyframes progress-bar-stripes {\n  from {\n    background-position: 40px 0;\n  }\n  to {\n    background-position: 0 0;\n  }\n}\n.progress {\n  height: 20px;\n  margin-bottom: 20px;\n  overflow: hidden;\n  background-color: #f5f5f5;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);\n          box-shadow: inset 0 1px 2px rgba(0, 0, 0, .1);\n}\n.progress-bar {\n  float: left;\n  width: 0;\n  height: 100%;\n  font-size: 12px;\n  line-height: 20px;\n  color: #fff;\n  text-align: center;\n  background-color: #337ab7;\n  -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);\n          box-shadow: inset 0 -1px 0 rgba(0, 0, 0, .15);\n  -webkit-transition: width .6s ease;\n       -o-transition: width .6s ease;\n          transition: width .6s ease;\n}\n.progress-striped .progress-bar,\n.progress-bar-striped {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:      -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:         linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  -webkit-background-size: 40px 40px;\n          background-size: 40px 40px;\n}\n.progress.active .progress-bar,\n.progress-bar.active {\n  -webkit-animation: progress-bar-stripes 2s linear infinite;\n       -o-animation: progress-bar-stripes 2s linear infinite;\n          animation: progress-bar-stripes 2s linear infinite;\n}\n.progress-bar-success {\n  background-color: #5cb85c;\n}\n.progress-striped .progress-bar-success {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:      -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:         linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.progress-bar-info {\n  background-color: #5bc0de;\n}\n.progress-striped .progress-bar-info {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:      -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:         linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.progress-bar-warning {\n  background-color: #f0ad4e;\n}\n.progress-striped .progress-bar-warning {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:      -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:         linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.progress-bar-danger {\n  background-color: #d9534f;\n}\n.progress-striped .progress-bar-danger {\n  background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:      -o-linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n  background-image:         linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);\n}\n.media {\n  margin-top: 15px;\n}\n.media:first-child {\n  margin-top: 0;\n}\n.media,\n.media-body {\n  overflow: hidden;\n  zoom: 1;\n}\n.media-body {\n  width: 10000px;\n}\n.media-object {\n  display: block;\n}\n.media-object.img-thumbnail {\n  max-width: none;\n}\n.media-right,\n.media > .pull-right {\n  padding-left: 10px;\n}\n.media-left,\n.media > .pull-left {\n  padding-right: 10px;\n}\n.media-left,\n.media-right,\n.media-body {\n  display: table-cell;\n  vertical-align: top;\n}\n.media-middle {\n  vertical-align: middle;\n}\n.media-bottom {\n  vertical-align: bottom;\n}\n.media-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n.media-list {\n  padding-left: 0;\n  list-style: none;\n}\n.list-group {\n  padding-left: 0;\n  margin-bottom: 20px;\n}\n.list-group-item {\n  position: relative;\n  display: block;\n  padding: 10px 15px;\n  margin-bottom: -1px;\n  background-color: #fff;\n  border: 1px solid #ddd;\n}\n.list-group-item:first-child {\n  border-top-left-radius: 4px;\n  border-top-right-radius: 4px;\n}\n.list-group-item:last-child {\n  margin-bottom: 0;\n  border-bottom-right-radius: 4px;\n  border-bottom-left-radius: 4px;\n}\na.list-group-item,\nbutton.list-group-item {\n  color: #555;\n}\na.list-group-item .list-group-item-heading,\nbutton.list-group-item .list-group-item-heading {\n  color: #333;\n}\na.list-group-item:hover,\nbutton.list-group-item:hover,\na.list-group-item:focus,\nbutton.list-group-item:focus {\n  color: #555;\n  text-decoration: none;\n  background-color: #f5f5f5;\n}\nbutton.list-group-item {\n  width: 100%;\n  text-align: left;\n}\n.list-group-item.disabled,\n.list-group-item.disabled:hover,\n.list-group-item.disabled:focus {\n  color: #777;\n  cursor: not-allowed;\n  background-color: #eee;\n}\n.list-group-item.disabled .list-group-item-heading,\n.list-group-item.disabled:hover .list-group-item-heading,\n.list-group-item.disabled:focus .list-group-item-heading {\n  color: inherit;\n}\n.list-group-item.disabled .list-group-item-text,\n.list-group-item.disabled:hover .list-group-item-text,\n.list-group-item.disabled:focus .list-group-item-text {\n  color: #777;\n}\n.list-group-item.active,\n.list-group-item.active:hover,\n.list-group-item.active:focus {\n  z-index: 2;\n  color: #fff;\n  background-color: #337ab7;\n  border-color: #337ab7;\n}\n.list-group-item.active .list-group-item-heading,\n.list-group-item.active:hover .list-group-item-heading,\n.list-group-item.active:focus .list-group-item-heading,\n.list-group-item.active .list-group-item-heading > small,\n.list-group-item.active:hover .list-group-item-heading > small,\n.list-group-item.active:focus .list-group-item-heading > small,\n.list-group-item.active .list-group-item-heading > .small,\n.list-group-item.active:hover .list-group-item-heading > .small,\n.list-group-item.active:focus .list-group-item-heading > .small {\n  color: inherit;\n}\n.list-group-item.active .list-group-item-text,\n.list-group-item.active:hover .list-group-item-text,\n.list-group-item.active:focus .list-group-item-text {\n  color: #c7ddef;\n}\n.list-group-item-success {\n  color: #3c763d;\n  background-color: #dff0d8;\n}\na.list-group-item-success,\nbutton.list-group-item-success {\n  color: #3c763d;\n}\na.list-group-item-success .list-group-item-heading,\nbutton.list-group-item-success .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-success:hover,\nbutton.list-group-item-success:hover,\na.list-group-item-success:focus,\nbutton.list-group-item-success:focus {\n  color: #3c763d;\n  background-color: #d0e9c6;\n}\na.list-group-item-success.active,\nbutton.list-group-item-success.active,\na.list-group-item-success.active:hover,\nbutton.list-group-item-success.active:hover,\na.list-group-item-success.active:focus,\nbutton.list-group-item-success.active:focus {\n  color: #fff;\n  background-color: #3c763d;\n  border-color: #3c763d;\n}\n.list-group-item-info {\n  color: #31708f;\n  background-color: #d9edf7;\n}\na.list-group-item-info,\nbutton.list-group-item-info {\n  color: #31708f;\n}\na.list-group-item-info .list-group-item-heading,\nbutton.list-group-item-info .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-info:hover,\nbutton.list-group-item-info:hover,\na.list-group-item-info:focus,\nbutton.list-group-item-info:focus {\n  color: #31708f;\n  background-color: #c4e3f3;\n}\na.list-group-item-info.active,\nbutton.list-group-item-info.active,\na.list-group-item-info.active:hover,\nbutton.list-group-item-info.active:hover,\na.list-group-item-info.active:focus,\nbutton.list-group-item-info.active:focus {\n  color: #fff;\n  background-color: #31708f;\n  border-color: #31708f;\n}\n.list-group-item-warning {\n  color: #8a6d3b;\n  background-color: #fcf8e3;\n}\na.list-group-item-warning,\nbutton.list-group-item-warning {\n  color: #8a6d3b;\n}\na.list-group-item-warning .list-group-item-heading,\nbutton.list-group-item-warning .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-warning:hover,\nbutton.list-group-item-warning:hover,\na.list-group-item-warning:focus,\nbutton.list-group-item-warning:focus {\n  color: #8a6d3b;\n  background-color: #faf2cc;\n}\na.list-group-item-warning.active,\nbutton.list-group-item-warning.active,\na.list-group-item-warning.active:hover,\nbutton.list-group-item-warning.active:hover,\na.list-group-item-warning.active:focus,\nbutton.list-group-item-warning.active:focus {\n  color: #fff;\n  background-color: #8a6d3b;\n  border-color: #8a6d3b;\n}\n.list-group-item-danger {\n  color: #a94442;\n  background-color: #f2dede;\n}\na.list-group-item-danger,\nbutton.list-group-item-danger {\n  color: #a94442;\n}\na.list-group-item-danger .list-group-item-heading,\nbutton.list-group-item-danger .list-group-item-heading {\n  color: inherit;\n}\na.list-group-item-danger:hover,\nbutton.list-group-item-danger:hover,\na.list-group-item-danger:focus,\nbutton.list-group-item-danger:focus {\n  color: #a94442;\n  background-color: #ebcccc;\n}\na.list-group-item-danger.active,\nbutton.list-group-item-danger.active,\na.list-group-item-danger.active:hover,\nbutton.list-group-item-danger.active:hover,\na.list-group-item-danger.active:focus,\nbutton.list-group-item-danger.active:focus {\n  color: #fff;\n  background-color: #a94442;\n  border-color: #a94442;\n}\n.list-group-item-heading {\n  margin-top: 0;\n  margin-bottom: 5px;\n}\n.list-group-item-text {\n  margin-bottom: 0;\n  line-height: 1.3;\n}\n.panel {\n  margin-bottom: 20px;\n  background-color: #fff;\n  border: 1px solid transparent;\n  border-radius: 4px;\n  -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05);\n          box-shadow: 0 1px 1px rgba(0, 0, 0, .05);\n}\n.panel-body {\n  padding: 15px;\n}\n.panel-heading {\n  padding: 10px 15px;\n  border-bottom: 1px solid transparent;\n  border-top-left-radius: 3px;\n  border-top-right-radius: 3px;\n}\n.panel-heading > .dropdown .dropdown-toggle {\n  color: inherit;\n}\n.panel-title {\n  margin-top: 0;\n  margin-bottom: 0;\n  font-size: 16px;\n  color: inherit;\n}\n.panel-title > a,\n.panel-title > small,\n.panel-title > .small,\n.panel-title > small > a,\n.panel-title > .small > a {\n  color: inherit;\n}\n.panel-footer {\n  padding: 10px 15px;\n  background-color: #f5f5f5;\n  border-top: 1px solid #ddd;\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.panel > .list-group,\n.panel > .panel-collapse > .list-group {\n  margin-bottom: 0;\n}\n.panel > .list-group .list-group-item,\n.panel > .panel-collapse > .list-group .list-group-item {\n  border-width: 1px 0;\n  border-radius: 0;\n}\n.panel > .list-group:first-child .list-group-item:first-child,\n.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child {\n  border-top: 0;\n  border-top-left-radius: 3px;\n  border-top-right-radius: 3px;\n}\n.panel > .list-group:last-child .list-group-item:last-child,\n.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child {\n  border-bottom: 0;\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child {\n  border-top-left-radius: 0;\n  border-top-right-radius: 0;\n}\n.panel-heading + .list-group .list-group-item:first-child {\n  border-top-width: 0;\n}\n.list-group + .panel-footer {\n  border-top-width: 0;\n}\n.panel > .table,\n.panel > .table-responsive > .table,\n.panel > .panel-collapse > .table {\n  margin-bottom: 0;\n}\n.panel > .table caption,\n.panel > .table-responsive > .table caption,\n.panel > .panel-collapse > .table caption {\n  padding-right: 15px;\n  padding-left: 15px;\n}\n.panel > .table:first-child,\n.panel > .table-responsive:first-child > .table:first-child {\n  border-top-left-radius: 3px;\n  border-top-right-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child {\n  border-top-left-radius: 3px;\n  border-top-right-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,\n.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {\n  border-top-left-radius: 3px;\n}\n.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,\n.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,\n.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,\n.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,\n.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {\n  border-top-right-radius: 3px;\n}\n.panel > .table:last-child,\n.panel > .table-responsive:last-child > .table:last-child {\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child {\n  border-bottom-right-radius: 3px;\n  border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,\n.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {\n  border-bottom-left-radius: 3px;\n}\n.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,\n.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,\n.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,\n.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {\n  border-bottom-right-radius: 3px;\n}\n.panel > .panel-body + .table,\n.panel > .panel-body + .table-responsive,\n.panel > .table + .panel-body,\n.panel > .table-responsive + .panel-body {\n  border-top: 1px solid #ddd;\n}\n.panel > .table > tbody:first-child > tr:first-child th,\n.panel > .table > tbody:first-child > tr:first-child td {\n  border-top: 0;\n}\n.panel > .table-bordered,\n.panel > .table-responsive > .table-bordered {\n  border: 0;\n}\n.panel > .table-bordered > thead > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,\n.panel > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,\n.panel > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,\n.panel > .table-bordered > thead > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,\n.panel > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,\n.panel > .table-bordered > tfoot > tr > td:first-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {\n  border-left: 0;\n}\n.panel > .table-bordered > thead > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,\n.panel > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,\n.panel > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,\n.panel > .table-bordered > thead > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,\n.panel > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,\n.panel > .table-bordered > tfoot > tr > td:last-child,\n.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {\n  border-right: 0;\n}\n.panel > .table-bordered > thead > tr:first-child > td,\n.panel > .table-responsive > .table-bordered > thead > tr:first-child > td,\n.panel > .table-bordered > tbody > tr:first-child > td,\n.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,\n.panel > .table-bordered > thead > tr:first-child > th,\n.panel > .table-responsive > .table-bordered > thead > tr:first-child > th,\n.panel > .table-bordered > tbody > tr:first-child > th,\n.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th {\n  border-bottom: 0;\n}\n.panel > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,\n.panel > .table-bordered > tfoot > tr:last-child > td,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,\n.panel > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,\n.panel > .table-bordered > tfoot > tr:last-child > th,\n.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th {\n  border-bottom: 0;\n}\n.panel > .table-responsive {\n  margin-bottom: 0;\n  border: 0;\n}\n.panel-group {\n  margin-bottom: 20px;\n}\n.panel-group .panel {\n  margin-bottom: 0;\n  border-radius: 4px;\n}\n.panel-group .panel + .panel {\n  margin-top: 5px;\n}\n.panel-group .panel-heading {\n  border-bottom: 0;\n}\n.panel-group .panel-heading + .panel-collapse > .panel-body,\n.panel-group .panel-heading + .panel-collapse > .list-group {\n  border-top: 1px solid #ddd;\n}\n.panel-group .panel-footer {\n  border-top: 0;\n}\n.panel-group .panel-footer + .panel-collapse .panel-body {\n  border-bottom: 1px solid #ddd;\n}\n.panel-default {\n  border-color: #ddd;\n}\n.panel-default > .panel-heading {\n  color: #333;\n  background-color: #f5f5f5;\n  border-color: #ddd;\n}\n.panel-default > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #ddd;\n}\n.panel-default > .panel-heading .badge {\n  color: #f5f5f5;\n  background-color: #333;\n}\n.panel-default > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #ddd;\n}\n.panel-primary {\n  border-color: #337ab7;\n}\n.panel-primary > .panel-heading {\n  color: #fff;\n  background-color: #337ab7;\n  border-color: #337ab7;\n}\n.panel-primary > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #337ab7;\n}\n.panel-primary > .panel-heading .badge {\n  color: #337ab7;\n  background-color: #fff;\n}\n.panel-primary > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #337ab7;\n}\n.panel-success {\n  border-color: #d6e9c6;\n}\n.panel-success > .panel-heading {\n  color: #3c763d;\n  background-color: #dff0d8;\n  border-color: #d6e9c6;\n}\n.panel-success > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #d6e9c6;\n}\n.panel-success > .panel-heading .badge {\n  color: #dff0d8;\n  background-color: #3c763d;\n}\n.panel-success > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #d6e9c6;\n}\n.panel-info {\n  border-color: #bce8f1;\n}\n.panel-info > .panel-heading {\n  color: #31708f;\n  background-color: #d9edf7;\n  border-color: #bce8f1;\n}\n.panel-info > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #bce8f1;\n}\n.panel-info > .panel-heading .badge {\n  color: #d9edf7;\n  background-color: #31708f;\n}\n.panel-info > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #bce8f1;\n}\n.panel-warning {\n  border-color: #faebcc;\n}\n.panel-warning > .panel-heading {\n  color: #8a6d3b;\n  background-color: #fcf8e3;\n  border-color: #faebcc;\n}\n.panel-warning > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #faebcc;\n}\n.panel-warning > .panel-heading .badge {\n  color: #fcf8e3;\n  background-color: #8a6d3b;\n}\n.panel-warning > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #faebcc;\n}\n.panel-danger {\n  border-color: #ebccd1;\n}\n.panel-danger > .panel-heading {\n  color: #a94442;\n  background-color: #f2dede;\n  border-color: #ebccd1;\n}\n.panel-danger > .panel-heading + .panel-collapse > .panel-body {\n  border-top-color: #ebccd1;\n}\n.panel-danger > .panel-heading .badge {\n  color: #f2dede;\n  background-color: #a94442;\n}\n.panel-danger > .panel-footer + .panel-collapse > .panel-body {\n  border-bottom-color: #ebccd1;\n}\n.embed-responsive {\n  position: relative;\n  display: block;\n  height: 0;\n  padding: 0;\n  overflow: hidden;\n}\n.embed-responsive .embed-responsive-item,\n.embed-responsive iframe,\n.embed-responsive embed,\n.embed-responsive object,\n.embed-responsive video {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  border: 0;\n}\n.embed-responsive-16by9 {\n  padding-bottom: 56.25%;\n}\n.embed-responsive-4by3 {\n  padding-bottom: 75%;\n}\n.well {\n  min-height: 20px;\n  padding: 19px;\n  margin-bottom: 20px;\n  background-color: #f5f5f5;\n  border: 1px solid #e3e3e3;\n  border-radius: 4px;\n  -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);\n          box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);\n}\n.well blockquote {\n  border-color: #ddd;\n  border-color: rgba(0, 0, 0, .15);\n}\n.well-lg {\n  padding: 24px;\n  border-radius: 6px;\n}\n.well-sm {\n  padding: 9px;\n  border-radius: 3px;\n}\n.close {\n  float: right;\n  font-size: 21px;\n  font-weight: bold;\n  line-height: 1;\n  color: #000;\n  text-shadow: 0 1px 0 #fff;\n  filter: alpha(opacity=20);\n  opacity: .2;\n}\n.close:hover,\n.close:focus {\n  color: #000;\n  text-decoration: none;\n  cursor: pointer;\n  filter: alpha(opacity=50);\n  opacity: .5;\n}\nbutton.close {\n  -webkit-appearance: none;\n  padding: 0;\n  cursor: pointer;\n  background: transparent;\n  border: 0;\n}\n.modal-open {\n  overflow: hidden;\n}\n.modal {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1050;\n  display: none;\n  overflow: hidden;\n  -webkit-overflow-scrolling: touch;\n  outline: 0;\n}\n.modal.fade .modal-dialog {\n  -webkit-transition: -webkit-transform .3s ease-out;\n       -o-transition:      -o-transform .3s ease-out;\n          transition:         transform .3s ease-out;\n  -webkit-transform: translate(0, -25%);\n      -ms-transform: translate(0, -25%);\n       -o-transform: translate(0, -25%);\n          transform: translate(0, -25%);\n}\n.modal.in .modal-dialog {\n  -webkit-transform: translate(0, 0);\n      -ms-transform: translate(0, 0);\n       -o-transform: translate(0, 0);\n          transform: translate(0, 0);\n}\n.modal-open .modal {\n  overflow-x: hidden;\n  overflow-y: auto;\n}\n.modal-dialog {\n  position: relative;\n  width: auto;\n  margin: 10px;\n}\n.modal-content {\n  position: relative;\n  background-color: #fff;\n  -webkit-background-clip: padding-box;\n          background-clip: padding-box;\n  border: 1px solid #999;\n  border: 1px solid rgba(0, 0, 0, .2);\n  border-radius: 6px;\n  outline: 0;\n  -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5);\n          box-shadow: 0 3px 9px rgba(0, 0, 0, .5);\n}\n.modal-backdrop {\n  position: fixed;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  z-index: 1040;\n  background-color: #000;\n}\n.modal-backdrop.fade {\n  filter: alpha(opacity=0);\n  opacity: 0;\n}\n.modal-backdrop.in {\n  filter: alpha(opacity=50);\n  opacity: .5;\n}\n.modal-header {\n  padding: 15px;\n  border-bottom: 1px solid #e5e5e5;\n}\n.modal-header .close {\n  margin-top: -2px;\n}\n.modal-title {\n  margin: 0;\n  line-height: 1.42857143;\n}\n.modal-body {\n  position: relative;\n  padding: 15px;\n}\n.modal-footer {\n  padding: 15px;\n  text-align: right;\n  border-top: 1px solid #e5e5e5;\n}\n.modal-footer .btn + .btn {\n  margin-bottom: 0;\n  margin-left: 5px;\n}\n.modal-footer .btn-group .btn + .btn {\n  margin-left: -1px;\n}\n.modal-footer .btn-block + .btn-block {\n  margin-left: 0;\n}\n.modal-scrollbar-measure {\n  position: absolute;\n  top: -9999px;\n  width: 50px;\n  height: 50px;\n  overflow: scroll;\n}\n@media (min-width: 768px) {\n  .modal-dialog {\n    width: 600px;\n    margin: 30px auto;\n  }\n  .modal-content {\n    -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);\n            box-shadow: 0 5px 15px rgba(0, 0, 0, .5);\n  }\n  .modal-sm {\n    width: 300px;\n  }\n}\n@media (min-width: 992px) {\n  .modal-lg {\n    width: 900px;\n  }\n}\n.tooltip {\n  position: absolute;\n  z-index: 1070;\n  display: block;\n  font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-size: 12px;\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1.42857143;\n  text-align: left;\n  text-align: start;\n  text-decoration: none;\n  text-shadow: none;\n  text-transform: none;\n  letter-spacing: normal;\n  word-break: normal;\n  word-spacing: normal;\n  word-wrap: normal;\n  white-space: normal;\n  filter: alpha(opacity=0);\n  opacity: 0;\n\n  line-break: auto;\n}\n.tooltip.in {\n  filter: alpha(opacity=90);\n  opacity: .9;\n}\n.tooltip.top {\n  padding: 5px 0;\n  margin-top: -3px;\n}\n.tooltip.right {\n  padding: 0 5px;\n  margin-left: 3px;\n}\n.tooltip.bottom {\n  padding: 5px 0;\n  margin-top: 3px;\n}\n.tooltip.left {\n  padding: 0 5px;\n  margin-left: -3px;\n}\n.tooltip-inner {\n  max-width: 200px;\n  padding: 3px 8px;\n  color: #fff;\n  text-align: center;\n  background-color: #000;\n  border-radius: 4px;\n}\n.tooltip-arrow {\n  position: absolute;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n.tooltip.top .tooltip-arrow {\n  bottom: 0;\n  left: 50%;\n  margin-left: -5px;\n  border-width: 5px 5px 0;\n  border-top-color: #000;\n}\n.tooltip.top-left .tooltip-arrow {\n  right: 5px;\n  bottom: 0;\n  margin-bottom: -5px;\n  border-width: 5px 5px 0;\n  border-top-color: #000;\n}\n.tooltip.top-right .tooltip-arrow {\n  bottom: 0;\n  left: 5px;\n  margin-bottom: -5px;\n  border-width: 5px 5px 0;\n  border-top-color: #000;\n}\n.tooltip.right .tooltip-arrow {\n  top: 50%;\n  left: 0;\n  margin-top: -5px;\n  border-width: 5px 5px 5px 0;\n  border-right-color: #000;\n}\n.tooltip.left .tooltip-arrow {\n  top: 50%;\n  right: 0;\n  margin-top: -5px;\n  border-width: 5px 0 5px 5px;\n  border-left-color: #000;\n}\n.tooltip.bottom .tooltip-arrow {\n  top: 0;\n  left: 50%;\n  margin-left: -5px;\n  border-width: 0 5px 5px;\n  border-bottom-color: #000;\n}\n.tooltip.bottom-left .tooltip-arrow {\n  top: 0;\n  right: 5px;\n  margin-top: -5px;\n  border-width: 0 5px 5px;\n  border-bottom-color: #000;\n}\n.tooltip.bottom-right .tooltip-arrow {\n  top: 0;\n  left: 5px;\n  margin-top: -5px;\n  border-width: 0 5px 5px;\n  border-bottom-color: #000;\n}\n.popover {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 1060;\n  display: none;\n  max-width: 276px;\n  padding: 1px;\n  font-family: \"Helvetica Neue\", Helvetica, Arial, sans-serif;\n  font-size: 14px;\n  font-style: normal;\n  font-weight: normal;\n  line-height: 1.42857143;\n  text-align: left;\n  text-align: start;\n  text-decoration: none;\n  text-shadow: none;\n  text-transform: none;\n  letter-spacing: normal;\n  word-break: normal;\n  word-spacing: normal;\n  word-wrap: normal;\n  white-space: normal;\n  background-color: #fff;\n  -webkit-background-clip: padding-box;\n          background-clip: padding-box;\n  border: 1px solid #ccc;\n  border: 1px solid rgba(0, 0, 0, .2);\n  border-radius: 6px;\n  -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, .2);\n          box-shadow: 0 5px 10px rgba(0, 0, 0, .2);\n\n  line-break: auto;\n}\n.popover.top {\n  margin-top: -10px;\n}\n.popover.right {\n  margin-left: 10px;\n}\n.popover.bottom {\n  margin-top: 10px;\n}\n.popover.left {\n  margin-left: -10px;\n}\n.popover-title {\n  padding: 8px 14px;\n  margin: 0;\n  font-size: 14px;\n  background-color: #f7f7f7;\n  border-bottom: 1px solid #ebebeb;\n  border-radius: 5px 5px 0 0;\n}\n.popover-content {\n  padding: 9px 14px;\n}\n.popover > .arrow,\n.popover > .arrow:after {\n  position: absolute;\n  display: block;\n  width: 0;\n  height: 0;\n  border-color: transparent;\n  border-style: solid;\n}\n.popover > .arrow {\n  border-width: 11px;\n}\n.popover > .arrow:after {\n  content: \"\";\n  border-width: 10px;\n}\n.popover.top > .arrow {\n  bottom: -11px;\n  left: 50%;\n  margin-left: -11px;\n  border-top-color: #999;\n  border-top-color: rgba(0, 0, 0, .25);\n  border-bottom-width: 0;\n}\n.popover.top > .arrow:after {\n  bottom: 1px;\n  margin-left: -10px;\n  content: \" \";\n  border-top-color: #fff;\n  border-bottom-width: 0;\n}\n.popover.right > .arrow {\n  top: 50%;\n  left: -11px;\n  margin-top: -11px;\n  border-right-color: #999;\n  border-right-color: rgba(0, 0, 0, .25);\n  border-left-width: 0;\n}\n.popover.right > .arrow:after {\n  bottom: -10px;\n  left: 1px;\n  content: \" \";\n  border-right-color: #fff;\n  border-left-width: 0;\n}\n.popover.bottom > .arrow {\n  top: -11px;\n  left: 50%;\n  margin-left: -11px;\n  border-top-width: 0;\n  border-bottom-color: #999;\n  border-bottom-color: rgba(0, 0, 0, .25);\n}\n.popover.bottom > .arrow:after {\n  top: 1px;\n  margin-left: -10px;\n  content: \" \";\n  border-top-width: 0;\n  border-bottom-color: #fff;\n}\n.popover.left > .arrow {\n  top: 50%;\n  right: -11px;\n  margin-top: -11px;\n  border-right-width: 0;\n  border-left-color: #999;\n  border-left-color: rgba(0, 0, 0, .25);\n}\n.popover.left > .arrow:after {\n  right: 1px;\n  bottom: -10px;\n  content: \" \";\n  border-right-width: 0;\n  border-left-color: #fff;\n}\n.carousel {\n  position: relative;\n}\n.carousel-inner {\n  position: relative;\n  width: 100%;\n  overflow: hidden;\n}\n.carousel-inner > .item {\n  position: relative;\n  display: none;\n  -webkit-transition: .6s ease-in-out left;\n       -o-transition: .6s ease-in-out left;\n          transition: .6s ease-in-out left;\n}\n.carousel-inner > .item > img,\n.carousel-inner > .item > a > img {\n  line-height: 1;\n}\n@media all and (transform-3d), (-webkit-transform-3d) {\n  .carousel-inner > .item {\n    -webkit-transition: -webkit-transform .6s ease-in-out;\n         -o-transition:      -o-transform .6s ease-in-out;\n            transition:         transform .6s ease-in-out;\n\n    -webkit-backface-visibility: hidden;\n            backface-visibility: hidden;\n    -webkit-perspective: 1000px;\n            perspective: 1000px;\n  }\n  .carousel-inner > .item.next,\n  .carousel-inner > .item.active.right {\n    left: 0;\n    -webkit-transform: translate3d(100%, 0, 0);\n            transform: translate3d(100%, 0, 0);\n  }\n  .carousel-inner > .item.prev,\n  .carousel-inner > .item.active.left {\n    left: 0;\n    -webkit-transform: translate3d(-100%, 0, 0);\n            transform: translate3d(-100%, 0, 0);\n  }\n  .carousel-inner > .item.next.left,\n  .carousel-inner > .item.prev.right,\n  .carousel-inner > .item.active {\n    left: 0;\n    -webkit-transform: translate3d(0, 0, 0);\n            transform: translate3d(0, 0, 0);\n  }\n}\n.carousel-inner > .active,\n.carousel-inner > .next,\n.carousel-inner > .prev {\n  display: block;\n}\n.carousel-inner > .active {\n  left: 0;\n}\n.carousel-inner > .next,\n.carousel-inner > .prev {\n  position: absolute;\n  top: 0;\n  width: 100%;\n}\n.carousel-inner > .next {\n  left: 100%;\n}\n.carousel-inner > .prev {\n  left: -100%;\n}\n.carousel-inner > .next.left,\n.carousel-inner > .prev.right {\n  left: 0;\n}\n.carousel-inner > .active.left {\n  left: -100%;\n}\n.carousel-inner > .active.right {\n  left: 100%;\n}\n.carousel-control {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  left: 0;\n  width: 15%;\n  font-size: 20px;\n  color: #fff;\n  text-align: center;\n  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);\n  background-color: rgba(0, 0, 0, 0);\n  filter: alpha(opacity=50);\n  opacity: .5;\n}\n.carousel-control.left {\n  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);\n  background-image:      -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);\n  background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001)));\n  background-image:         linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%);\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);\n  background-repeat: repeat-x;\n}\n.carousel-control.right {\n  right: 0;\n  left: auto;\n  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);\n  background-image:      -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);\n  background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)), to(rgba(0, 0, 0, .5)));\n  background-image:         linear-gradient(to right, rgba(0, 0, 0, .0001) 0%, rgba(0, 0, 0, .5) 100%);\n  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);\n  background-repeat: repeat-x;\n}\n.carousel-control:hover,\n.carousel-control:focus {\n  color: #fff;\n  text-decoration: none;\n  filter: alpha(opacity=90);\n  outline: 0;\n  opacity: .9;\n}\n.carousel-control .icon-prev,\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-left,\n.carousel-control .glyphicon-chevron-right {\n  position: absolute;\n  top: 50%;\n  z-index: 5;\n  display: inline-block;\n  margin-top: -10px;\n}\n.carousel-control .icon-prev,\n.carousel-control .glyphicon-chevron-left {\n  left: 50%;\n  margin-left: -10px;\n}\n.carousel-control .icon-next,\n.carousel-control .glyphicon-chevron-right {\n  right: 50%;\n  margin-right: -10px;\n}\n.carousel-control .icon-prev,\n.carousel-control .icon-next {\n  width: 20px;\n  height: 20px;\n  font-family: serif;\n  line-height: 1;\n}\n.carousel-control .icon-prev:before {\n  content: '\\2039';\n}\n.carousel-control .icon-next:before {\n  content: '\\203a';\n}\n.carousel-indicators {\n  position: absolute;\n  bottom: 10px;\n  left: 50%;\n  z-index: 15;\n  width: 60%;\n  padding-left: 0;\n  margin-left: -30%;\n  text-align: center;\n  list-style: none;\n}\n.carousel-indicators li {\n  display: inline-block;\n  width: 10px;\n  height: 10px;\n  margin: 1px;\n  text-indent: -999px;\n  cursor: pointer;\n  background-color: #000 \\9;\n  background-color: rgba(0, 0, 0, 0);\n  border: 1px solid #fff;\n  border-radius: 10px;\n}\n.carousel-indicators .active {\n  width: 12px;\n  height: 12px;\n  margin: 0;\n  background-color: #fff;\n}\n.carousel-caption {\n  position: absolute;\n  right: 15%;\n  bottom: 20px;\n  left: 15%;\n  z-index: 10;\n  padding-top: 20px;\n  padding-bottom: 20px;\n  color: #fff;\n  text-align: center;\n  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);\n}\n.carousel-caption .btn {\n  text-shadow: none;\n}\n@media screen and (min-width: 768px) {\n  .carousel-control .glyphicon-chevron-left,\n  .carousel-control .glyphicon-chevron-right,\n  .carousel-control .icon-prev,\n  .carousel-control .icon-next {\n    width: 30px;\n    height: 30px;\n    margin-top: -10px;\n    font-size: 30px;\n  }\n  .carousel-control .glyphicon-chevron-left,\n  .carousel-control .icon-prev {\n    margin-left: -10px;\n  }\n  .carousel-control .glyphicon-chevron-right,\n  .carousel-control .icon-next {\n    margin-right: -10px;\n  }\n  .carousel-caption {\n    right: 20%;\n    left: 20%;\n    padding-bottom: 30px;\n  }\n  .carousel-indicators {\n    bottom: 20px;\n  }\n}\n.clearfix:before,\n.clearfix:after,\n.dl-horizontal dd:before,\n.dl-horizontal dd:after,\n.container:before,\n.container:after,\n.container-fluid:before,\n.container-fluid:after,\n.row:before,\n.row:after,\n.form-horizontal .form-group:before,\n.form-horizontal .form-group:after,\n.btn-toolbar:before,\n.btn-toolbar:after,\n.btn-group-vertical > .btn-group:before,\n.btn-group-vertical > .btn-group:after,\n.nav:before,\n.nav:after,\n.navbar:before,\n.navbar:after,\n.navbar-header:before,\n.navbar-header:after,\n.navbar-collapse:before,\n.navbar-collapse:after,\n.pager:before,\n.pager:after,\n.panel-body:before,\n.panel-body:after,\n.modal-header:before,\n.modal-header:after,\n.modal-footer:before,\n.modal-footer:after {\n  display: table;\n  content: \" \";\n}\n.clearfix:after,\n.dl-horizontal dd:after,\n.container:after,\n.container-fluid:after,\n.row:after,\n.form-horizontal .form-group:after,\n.btn-toolbar:after,\n.btn-group-vertical > .btn-group:after,\n.nav:after,\n.navbar:after,\n.navbar-header:after,\n.navbar-collapse:after,\n.pager:after,\n.panel-body:after,\n.modal-header:after,\n.modal-footer:after {\n  clear: both;\n}\n.center-block {\n  display: block;\n  margin-right: auto;\n  margin-left: auto;\n}\n.pull-right {\n  float: right !important;\n}\n.pull-left {\n  float: left !important;\n}\n.hide {\n  display: none !important;\n}\n.show {\n  display: block !important;\n}\n.invisible {\n  visibility: hidden;\n}\n.text-hide {\n  font: 0/0 a;\n  color: transparent;\n  text-shadow: none;\n  background-color: transparent;\n  border: 0;\n}\n.hidden {\n  display: none !important;\n}\n.affix {\n  position: fixed;\n}\n@-ms-viewport {\n  width: device-width;\n}\n.visible-xs,\n.visible-sm,\n.visible-md,\n.visible-lg {\n  display: none !important;\n}\n.visible-xs-block,\n.visible-xs-inline,\n.visible-xs-inline-block,\n.visible-sm-block,\n.visible-sm-inline,\n.visible-sm-inline-block,\n.visible-md-block,\n.visible-md-inline,\n.visible-md-inline-block,\n.visible-lg-block,\n.visible-lg-inline,\n.visible-lg-inline-block {\n  display: none !important;\n}\n@media (max-width: 767px) {\n  .visible-xs {\n    display: block !important;\n  }\n  table.visible-xs {\n    display: table !important;\n  }\n  tr.visible-xs {\n    display: table-row !important;\n  }\n  th.visible-xs,\n  td.visible-xs {\n    display: table-cell !important;\n  }\n}\n@media (max-width: 767px) {\n  .visible-xs-block {\n    display: block !important;\n  }\n}\n@media (max-width: 767px) {\n  .visible-xs-inline {\n    display: inline !important;\n  }\n}\n@media (max-width: 767px) {\n  .visible-xs-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm {\n    display: block !important;\n  }\n  table.visible-sm {\n    display: table !important;\n  }\n  tr.visible-sm {\n    display: table-row !important;\n  }\n  th.visible-sm,\n  td.visible-sm {\n    display: table-cell !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm-block {\n    display: block !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm-inline {\n    display: inline !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .visible-sm-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md {\n    display: block !important;\n  }\n  table.visible-md {\n    display: table !important;\n  }\n  tr.visible-md {\n    display: table-row !important;\n  }\n  th.visible-md,\n  td.visible-md {\n    display: table-cell !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md-block {\n    display: block !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md-inline {\n    display: inline !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .visible-md-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg {\n    display: block !important;\n  }\n  table.visible-lg {\n    display: table !important;\n  }\n  tr.visible-lg {\n    display: table-row !important;\n  }\n  th.visible-lg,\n  td.visible-lg {\n    display: table-cell !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg-block {\n    display: block !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg-inline {\n    display: inline !important;\n  }\n}\n@media (min-width: 1200px) {\n  .visible-lg-inline-block {\n    display: inline-block !important;\n  }\n}\n@media (max-width: 767px) {\n  .hidden-xs {\n    display: none !important;\n  }\n}\n@media (min-width: 768px) and (max-width: 991px) {\n  .hidden-sm {\n    display: none !important;\n  }\n}\n@media (min-width: 992px) and (max-width: 1199px) {\n  .hidden-md {\n    display: none !important;\n  }\n}\n@media (min-width: 1200px) {\n  .hidden-lg {\n    display: none !important;\n  }\n}\n.visible-print {\n  display: none !important;\n}\n@media print {\n  .visible-print {\n    display: block !important;\n  }\n  table.visible-print {\n    display: table !important;\n  }\n  tr.visible-print {\n    display: table-row !important;\n  }\n  th.visible-print,\n  td.visible-print {\n    display: table-cell !important;\n  }\n}\n.visible-print-block {\n  display: none !important;\n}\n@media print {\n  .visible-print-block {\n    display: block !important;\n  }\n}\n.visible-print-inline {\n  display: none !important;\n}\n@media print {\n  .visible-print-inline {\n    display: inline !important;\n  }\n}\n.visible-print-inline-block {\n  display: none !important;\n}\n@media print {\n  .visible-print-inline-block {\n    display: inline-block !important;\n  }\n}\n@media print {\n  .hidden-print {\n    display: none !important;\n  }\n}\n/*# sourceMappingURL=bootstrap.css.map */\n"
  },
  {
    "path": "28-ionic/dailyreads/backend/static/js/bootstrap.js",
    "content": "/*!\n * Bootstrap v3.3.6 (http://getbootstrap.com)\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under the MIT license\n */\n\nif (typeof jQuery === 'undefined') {\n  throw new Error('Bootstrap\\'s JavaScript requires jQuery')\n}\n\n+function ($) {\n  'use strict';\n  var version = $.fn.jquery.split(' ')[0].split('.')\n  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 2)) {\n    throw new Error('Bootstrap\\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')\n  }\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: transition.js v3.3.6\n * http://getbootstrap.com/javascript/#transitions\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)\n  // ============================================================\n\n  function transitionEnd() {\n    var el = document.createElement('bootstrap')\n\n    var transEndEventNames = {\n      WebkitTransition : 'webkitTransitionEnd',\n      MozTransition    : 'transitionend',\n      OTransition      : 'oTransitionEnd otransitionend',\n      transition       : 'transitionend'\n    }\n\n    for (var name in transEndEventNames) {\n      if (el.style[name] !== undefined) {\n        return { end: transEndEventNames[name] }\n      }\n    }\n\n    return false // explicit for ie8 (  ._.)\n  }\n\n  // http://blog.alexmaccaw.com/css-transitions\n  $.fn.emulateTransitionEnd = function (duration) {\n    var called = false\n    var $el = this\n    $(this).one('bsTransitionEnd', function () { called = true })\n    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }\n    setTimeout(callback, duration)\n    return this\n  }\n\n  $(function () {\n    $.support.transition = transitionEnd()\n\n    if (!$.support.transition) return\n\n    $.event.special.bsTransitionEnd = {\n      bindType: $.support.transition.end,\n      delegateType: $.support.transition.end,\n      handle: function (e) {\n        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)\n      }\n    }\n  })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: alert.js v3.3.6\n * http://getbootstrap.com/javascript/#alerts\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // ALERT CLASS DEFINITION\n  // ======================\n\n  var dismiss = '[data-dismiss=\"alert\"]'\n  var Alert   = function (el) {\n    $(el).on('click', dismiss, this.close)\n  }\n\n  Alert.VERSION = '3.3.6'\n\n  Alert.TRANSITION_DURATION = 150\n\n  Alert.prototype.close = function (e) {\n    var $this    = $(this)\n    var selector = $this.attr('data-target')\n\n    if (!selector) {\n      selector = $this.attr('href')\n      selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n    }\n\n    var $parent = $(selector)\n\n    if (e) e.preventDefault()\n\n    if (!$parent.length) {\n      $parent = $this.closest('.alert')\n    }\n\n    $parent.trigger(e = $.Event('close.bs.alert'))\n\n    if (e.isDefaultPrevented()) return\n\n    $parent.removeClass('in')\n\n    function removeElement() {\n      // detach from parent, fire event then clean up data\n      $parent.detach().trigger('closed.bs.alert').remove()\n    }\n\n    $.support.transition && $parent.hasClass('fade') ?\n      $parent\n        .one('bsTransitionEnd', removeElement)\n        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :\n      removeElement()\n  }\n\n\n  // ALERT PLUGIN DEFINITION\n  // =======================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this = $(this)\n      var data  = $this.data('bs.alert')\n\n      if (!data) $this.data('bs.alert', (data = new Alert(this)))\n      if (typeof option == 'string') data[option].call($this)\n    })\n  }\n\n  var old = $.fn.alert\n\n  $.fn.alert             = Plugin\n  $.fn.alert.Constructor = Alert\n\n\n  // ALERT NO CONFLICT\n  // =================\n\n  $.fn.alert.noConflict = function () {\n    $.fn.alert = old\n    return this\n  }\n\n\n  // ALERT DATA-API\n  // ==============\n\n  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: button.js v3.3.6\n * http://getbootstrap.com/javascript/#buttons\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // BUTTON PUBLIC CLASS DEFINITION\n  // ==============================\n\n  var Button = function (element, options) {\n    this.$element  = $(element)\n    this.options   = $.extend({}, Button.DEFAULTS, options)\n    this.isLoading = false\n  }\n\n  Button.VERSION  = '3.3.6'\n\n  Button.DEFAULTS = {\n    loadingText: 'loading...'\n  }\n\n  Button.prototype.setState = function (state) {\n    var d    = 'disabled'\n    var $el  = this.$element\n    var val  = $el.is('input') ? 'val' : 'html'\n    var data = $el.data()\n\n    state += 'Text'\n\n    if (data.resetText == null) $el.data('resetText', $el[val]())\n\n    // push to event loop to allow forms to submit\n    setTimeout($.proxy(function () {\n      $el[val](data[state] == null ? this.options[state] : data[state])\n\n      if (state == 'loadingText') {\n        this.isLoading = true\n        $el.addClass(d).attr(d, d)\n      } else if (this.isLoading) {\n        this.isLoading = false\n        $el.removeClass(d).removeAttr(d)\n      }\n    }, this), 0)\n  }\n\n  Button.prototype.toggle = function () {\n    var changed = true\n    var $parent = this.$element.closest('[data-toggle=\"buttons\"]')\n\n    if ($parent.length) {\n      var $input = this.$element.find('input')\n      if ($input.prop('type') == 'radio') {\n        if ($input.prop('checked')) changed = false\n        $parent.find('.active').removeClass('active')\n        this.$element.addClass('active')\n      } else if ($input.prop('type') == 'checkbox') {\n        if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false\n        this.$element.toggleClass('active')\n      }\n      $input.prop('checked', this.$element.hasClass('active'))\n      if (changed) $input.trigger('change')\n    } else {\n      this.$element.attr('aria-pressed', !this.$element.hasClass('active'))\n      this.$element.toggleClass('active')\n    }\n  }\n\n\n  // BUTTON PLUGIN DEFINITION\n  // ========================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.button')\n      var options = typeof option == 'object' && option\n\n      if (!data) $this.data('bs.button', (data = new Button(this, options)))\n\n      if (option == 'toggle') data.toggle()\n      else if (option) data.setState(option)\n    })\n  }\n\n  var old = $.fn.button\n\n  $.fn.button             = Plugin\n  $.fn.button.Constructor = Button\n\n\n  // BUTTON NO CONFLICT\n  // ==================\n\n  $.fn.button.noConflict = function () {\n    $.fn.button = old\n    return this\n  }\n\n\n  // BUTTON DATA-API\n  // ===============\n\n  $(document)\n    .on('click.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n      var $btn = $(e.target)\n      if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')\n      Plugin.call($btn, 'toggle')\n      if (!($(e.target).is('input[type=\"radio\"]') || $(e.target).is('input[type=\"checkbox\"]'))) e.preventDefault()\n    })\n    .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n      $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))\n    })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: carousel.js v3.3.6\n * http://getbootstrap.com/javascript/#carousel\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // CAROUSEL CLASS DEFINITION\n  // =========================\n\n  var Carousel = function (element, options) {\n    this.$element    = $(element)\n    this.$indicators = this.$element.find('.carousel-indicators')\n    this.options     = options\n    this.paused      = null\n    this.sliding     = null\n    this.interval    = null\n    this.$active     = null\n    this.$items      = null\n\n    this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))\n\n    this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element\n      .on('mouseenter.bs.carousel', $.proxy(this.pause, this))\n      .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))\n  }\n\n  Carousel.VERSION  = '3.3.6'\n\n  Carousel.TRANSITION_DURATION = 600\n\n  Carousel.DEFAULTS = {\n    interval: 5000,\n    pause: 'hover',\n    wrap: true,\n    keyboard: true\n  }\n\n  Carousel.prototype.keydown = function (e) {\n    if (/input|textarea/i.test(e.target.tagName)) return\n    switch (e.which) {\n      case 37: this.prev(); break\n      case 39: this.next(); break\n      default: return\n    }\n\n    e.preventDefault()\n  }\n\n  Carousel.prototype.cycle = function (e) {\n    e || (this.paused = false)\n\n    this.interval && clearInterval(this.interval)\n\n    this.options.interval\n      && !this.paused\n      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))\n\n    return this\n  }\n\n  Carousel.prototype.getItemIndex = function (item) {\n    this.$items = item.parent().children('.item')\n    return this.$items.index(item || this.$active)\n  }\n\n  Carousel.prototype.getItemForDirection = function (direction, active) {\n    var activeIndex = this.getItemIndex(active)\n    var willWrap = (direction == 'prev' && activeIndex === 0)\n                || (direction == 'next' && activeIndex == (this.$items.length - 1))\n    if (willWrap && !this.options.wrap) return active\n    var delta = direction == 'prev' ? -1 : 1\n    var itemIndex = (activeIndex + delta) % this.$items.length\n    return this.$items.eq(itemIndex)\n  }\n\n  Carousel.prototype.to = function (pos) {\n    var that        = this\n    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))\n\n    if (pos > (this.$items.length - 1) || pos < 0) return\n\n    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, \"slid\"\n    if (activeIndex == pos) return this.pause().cycle()\n\n    return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))\n  }\n\n  Carousel.prototype.pause = function (e) {\n    e || (this.paused = true)\n\n    if (this.$element.find('.next, .prev').length && $.support.transition) {\n      this.$element.trigger($.support.transition.end)\n      this.cycle(true)\n    }\n\n    this.interval = clearInterval(this.interval)\n\n    return this\n  }\n\n  Carousel.prototype.next = function () {\n    if (this.sliding) return\n    return this.slide('next')\n  }\n\n  Carousel.prototype.prev = function () {\n    if (this.sliding) return\n    return this.slide('prev')\n  }\n\n  Carousel.prototype.slide = function (type, next) {\n    var $active   = this.$element.find('.item.active')\n    var $next     = next || this.getItemForDirection(type, $active)\n    var isCycling = this.interval\n    var direction = type == 'next' ? 'left' : 'right'\n    var that      = this\n\n    if ($next.hasClass('active')) return (this.sliding = false)\n\n    var relatedTarget = $next[0]\n    var slideEvent = $.Event('slide.bs.carousel', {\n      relatedTarget: relatedTarget,\n      direction: direction\n    })\n    this.$element.trigger(slideEvent)\n    if (slideEvent.isDefaultPrevented()) return\n\n    this.sliding = true\n\n    isCycling && this.pause()\n\n    if (this.$indicators.length) {\n      this.$indicators.find('.active').removeClass('active')\n      var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])\n      $nextIndicator && $nextIndicator.addClass('active')\n    }\n\n    var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, \"slid\"\n    if ($.support.transition && this.$element.hasClass('slide')) {\n      $next.addClass(type)\n      $next[0].offsetWidth // force reflow\n      $active.addClass(direction)\n      $next.addClass(direction)\n      $active\n        .one('bsTransitionEnd', function () {\n          $next.removeClass([type, direction].join(' ')).addClass('active')\n          $active.removeClass(['active', direction].join(' '))\n          that.sliding = false\n          setTimeout(function () {\n            that.$element.trigger(slidEvent)\n          }, 0)\n        })\n        .emulateTransitionEnd(Carousel.TRANSITION_DURATION)\n    } else {\n      $active.removeClass('active')\n      $next.addClass('active')\n      this.sliding = false\n      this.$element.trigger(slidEvent)\n    }\n\n    isCycling && this.cycle()\n\n    return this\n  }\n\n\n  // CAROUSEL PLUGIN DEFINITION\n  // ==========================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.carousel')\n      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)\n      var action  = typeof option == 'string' ? option : options.slide\n\n      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))\n      if (typeof option == 'number') data.to(option)\n      else if (action) data[action]()\n      else if (options.interval) data.pause().cycle()\n    })\n  }\n\n  var old = $.fn.carousel\n\n  $.fn.carousel             = Plugin\n  $.fn.carousel.Constructor = Carousel\n\n\n  // CAROUSEL NO CONFLICT\n  // ====================\n\n  $.fn.carousel.noConflict = function () {\n    $.fn.carousel = old\n    return this\n  }\n\n\n  // CAROUSEL DATA-API\n  // =================\n\n  var clickHandler = function (e) {\n    var href\n    var $this   = $(this)\n    var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\\s]+$)/, '')) // strip for ie7\n    if (!$target.hasClass('carousel')) return\n    var options = $.extend({}, $target.data(), $this.data())\n    var slideIndex = $this.attr('data-slide-to')\n    if (slideIndex) options.interval = false\n\n    Plugin.call($target, options)\n\n    if (slideIndex) {\n      $target.data('bs.carousel').to(slideIndex)\n    }\n\n    e.preventDefault()\n  }\n\n  $(document)\n    .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)\n    .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)\n\n  $(window).on('load', function () {\n    $('[data-ride=\"carousel\"]').each(function () {\n      var $carousel = $(this)\n      Plugin.call($carousel, $carousel.data())\n    })\n  })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: collapse.js v3.3.6\n * http://getbootstrap.com/javascript/#collapse\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // COLLAPSE PUBLIC CLASS DEFINITION\n  // ================================\n\n  var Collapse = function (element, options) {\n    this.$element      = $(element)\n    this.options       = $.extend({}, Collapse.DEFAULTS, options)\n    this.$trigger      = $('[data-toggle=\"collapse\"][href=\"#' + element.id + '\"],' +\n                           '[data-toggle=\"collapse\"][data-target=\"#' + element.id + '\"]')\n    this.transitioning = null\n\n    if (this.options.parent) {\n      this.$parent = this.getParent()\n    } else {\n      this.addAriaAndCollapsedClass(this.$element, this.$trigger)\n    }\n\n    if (this.options.toggle) this.toggle()\n  }\n\n  Collapse.VERSION  = '3.3.6'\n\n  Collapse.TRANSITION_DURATION = 350\n\n  Collapse.DEFAULTS = {\n    toggle: true\n  }\n\n  Collapse.prototype.dimension = function () {\n    var hasWidth = this.$element.hasClass('width')\n    return hasWidth ? 'width' : 'height'\n  }\n\n  Collapse.prototype.show = function () {\n    if (this.transitioning || this.$element.hasClass('in')) return\n\n    var activesData\n    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')\n\n    if (actives && actives.length) {\n      activesData = actives.data('bs.collapse')\n      if (activesData && activesData.transitioning) return\n    }\n\n    var startEvent = $.Event('show.bs.collapse')\n    this.$element.trigger(startEvent)\n    if (startEvent.isDefaultPrevented()) return\n\n    if (actives && actives.length) {\n      Plugin.call(actives, 'hide')\n      activesData || actives.data('bs.collapse', null)\n    }\n\n    var dimension = this.dimension()\n\n    this.$element\n      .removeClass('collapse')\n      .addClass('collapsing')[dimension](0)\n      .attr('aria-expanded', true)\n\n    this.$trigger\n      .removeClass('collapsed')\n      .attr('aria-expanded', true)\n\n    this.transitioning = 1\n\n    var complete = function () {\n      this.$element\n        .removeClass('collapsing')\n        .addClass('collapse in')[dimension]('')\n      this.transitioning = 0\n      this.$element\n        .trigger('shown.bs.collapse')\n    }\n\n    if (!$.support.transition) return complete.call(this)\n\n    var scrollSize = $.camelCase(['scroll', dimension].join('-'))\n\n    this.$element\n      .one('bsTransitionEnd', $.proxy(complete, this))\n      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])\n  }\n\n  Collapse.prototype.hide = function () {\n    if (this.transitioning || !this.$element.hasClass('in')) return\n\n    var startEvent = $.Event('hide.bs.collapse')\n    this.$element.trigger(startEvent)\n    if (startEvent.isDefaultPrevented()) return\n\n    var dimension = this.dimension()\n\n    this.$element[dimension](this.$element[dimension]())[0].offsetHeight\n\n    this.$element\n      .addClass('collapsing')\n      .removeClass('collapse in')\n      .attr('aria-expanded', false)\n\n    this.$trigger\n      .addClass('collapsed')\n      .attr('aria-expanded', false)\n\n    this.transitioning = 1\n\n    var complete = function () {\n      this.transitioning = 0\n      this.$element\n        .removeClass('collapsing')\n        .addClass('collapse')\n        .trigger('hidden.bs.collapse')\n    }\n\n    if (!$.support.transition) return complete.call(this)\n\n    this.$element\n      [dimension](0)\n      .one('bsTransitionEnd', $.proxy(complete, this))\n      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)\n  }\n\n  Collapse.prototype.toggle = function () {\n    this[this.$element.hasClass('in') ? 'hide' : 'show']()\n  }\n\n  Collapse.prototype.getParent = function () {\n    return $(this.options.parent)\n      .find('[data-toggle=\"collapse\"][data-parent=\"' + this.options.parent + '\"]')\n      .each($.proxy(function (i, element) {\n        var $element = $(element)\n        this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)\n      }, this))\n      .end()\n  }\n\n  Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {\n    var isOpen = $element.hasClass('in')\n\n    $element.attr('aria-expanded', isOpen)\n    $trigger\n      .toggleClass('collapsed', !isOpen)\n      .attr('aria-expanded', isOpen)\n  }\n\n  function getTargetFromTrigger($trigger) {\n    var href\n    var target = $trigger.attr('data-target')\n      || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\\s]+$)/, '') // strip for ie7\n\n    return $(target)\n  }\n\n\n  // COLLAPSE PLUGIN DEFINITION\n  // ==========================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.collapse')\n      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)\n\n      if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false\n      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))\n      if (typeof option == 'string') data[option]()\n    })\n  }\n\n  var old = $.fn.collapse\n\n  $.fn.collapse             = Plugin\n  $.fn.collapse.Constructor = Collapse\n\n\n  // COLLAPSE NO CONFLICT\n  // ====================\n\n  $.fn.collapse.noConflict = function () {\n    $.fn.collapse = old\n    return this\n  }\n\n\n  // COLLAPSE DATA-API\n  // =================\n\n  $(document).on('click.bs.collapse.data-api', '[data-toggle=\"collapse\"]', function (e) {\n    var $this   = $(this)\n\n    if (!$this.attr('data-target')) e.preventDefault()\n\n    var $target = getTargetFromTrigger($this)\n    var data    = $target.data('bs.collapse')\n    var option  = data ? 'toggle' : $this.data()\n\n    Plugin.call($target, option)\n  })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: dropdown.js v3.3.6\n * http://getbootstrap.com/javascript/#dropdowns\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // DROPDOWN CLASS DEFINITION\n  // =========================\n\n  var backdrop = '.dropdown-backdrop'\n  var toggle   = '[data-toggle=\"dropdown\"]'\n  var Dropdown = function (element) {\n    $(element).on('click.bs.dropdown', this.toggle)\n  }\n\n  Dropdown.VERSION = '3.3.6'\n\n  function getParent($this) {\n    var selector = $this.attr('data-target')\n\n    if (!selector) {\n      selector = $this.attr('href')\n      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n    }\n\n    var $parent = selector && $(selector)\n\n    return $parent && $parent.length ? $parent : $this.parent()\n  }\n\n  function clearMenus(e) {\n    if (e && e.which === 3) return\n    $(backdrop).remove()\n    $(toggle).each(function () {\n      var $this         = $(this)\n      var $parent       = getParent($this)\n      var relatedTarget = { relatedTarget: this }\n\n      if (!$parent.hasClass('open')) return\n\n      if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return\n\n      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))\n\n      if (e.isDefaultPrevented()) return\n\n      $this.attr('aria-expanded', 'false')\n      $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))\n    })\n  }\n\n  Dropdown.prototype.toggle = function (e) {\n    var $this = $(this)\n\n    if ($this.is('.disabled, :disabled')) return\n\n    var $parent  = getParent($this)\n    var isActive = $parent.hasClass('open')\n\n    clearMenus()\n\n    if (!isActive) {\n      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {\n        // if mobile we use a backdrop because click events don't delegate\n        $(document.createElement('div'))\n          .addClass('dropdown-backdrop')\n          .insertAfter($(this))\n          .on('click', clearMenus)\n      }\n\n      var relatedTarget = { relatedTarget: this }\n      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))\n\n      if (e.isDefaultPrevented()) return\n\n      $this\n        .trigger('focus')\n        .attr('aria-expanded', 'true')\n\n      $parent\n        .toggleClass('open')\n        .trigger($.Event('shown.bs.dropdown', relatedTarget))\n    }\n\n    return false\n  }\n\n  Dropdown.prototype.keydown = function (e) {\n    if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return\n\n    var $this = $(this)\n\n    e.preventDefault()\n    e.stopPropagation()\n\n    if ($this.is('.disabled, :disabled')) return\n\n    var $parent  = getParent($this)\n    var isActive = $parent.hasClass('open')\n\n    if (!isActive && e.which != 27 || isActive && e.which == 27) {\n      if (e.which == 27) $parent.find(toggle).trigger('focus')\n      return $this.trigger('click')\n    }\n\n    var desc = ' li:not(.disabled):visible a'\n    var $items = $parent.find('.dropdown-menu' + desc)\n\n    if (!$items.length) return\n\n    var index = $items.index(e.target)\n\n    if (e.which == 38 && index > 0)                 index--         // up\n    if (e.which == 40 && index < $items.length - 1) index++         // down\n    if (!~index)                                    index = 0\n\n    $items.eq(index).trigger('focus')\n  }\n\n\n  // DROPDOWN PLUGIN DEFINITION\n  // ==========================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this = $(this)\n      var data  = $this.data('bs.dropdown')\n\n      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))\n      if (typeof option == 'string') data[option].call($this)\n    })\n  }\n\n  var old = $.fn.dropdown\n\n  $.fn.dropdown             = Plugin\n  $.fn.dropdown.Constructor = Dropdown\n\n\n  // DROPDOWN NO CONFLICT\n  // ====================\n\n  $.fn.dropdown.noConflict = function () {\n    $.fn.dropdown = old\n    return this\n  }\n\n\n  // APPLY TO STANDARD DROPDOWN ELEMENTS\n  // ===================================\n\n  $(document)\n    .on('click.bs.dropdown.data-api', clearMenus)\n    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })\n    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)\n    .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)\n    .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: modal.js v3.3.6\n * http://getbootstrap.com/javascript/#modals\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // MODAL CLASS DEFINITION\n  // ======================\n\n  var Modal = function (element, options) {\n    this.options             = options\n    this.$body               = $(document.body)\n    this.$element            = $(element)\n    this.$dialog             = this.$element.find('.modal-dialog')\n    this.$backdrop           = null\n    this.isShown             = null\n    this.originalBodyPad     = null\n    this.scrollbarWidth      = 0\n    this.ignoreBackdropClick = false\n\n    if (this.options.remote) {\n      this.$element\n        .find('.modal-content')\n        .load(this.options.remote, $.proxy(function () {\n          this.$element.trigger('loaded.bs.modal')\n        }, this))\n    }\n  }\n\n  Modal.VERSION  = '3.3.6'\n\n  Modal.TRANSITION_DURATION = 300\n  Modal.BACKDROP_TRANSITION_DURATION = 150\n\n  Modal.DEFAULTS = {\n    backdrop: true,\n    keyboard: true,\n    show: true\n  }\n\n  Modal.prototype.toggle = function (_relatedTarget) {\n    return this.isShown ? this.hide() : this.show(_relatedTarget)\n  }\n\n  Modal.prototype.show = function (_relatedTarget) {\n    var that = this\n    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })\n\n    this.$element.trigger(e)\n\n    if (this.isShown || e.isDefaultPrevented()) return\n\n    this.isShown = true\n\n    this.checkScrollbar()\n    this.setScrollbar()\n    this.$body.addClass('modal-open')\n\n    this.escape()\n    this.resize()\n\n    this.$element.on('click.dismiss.bs.modal', '[data-dismiss=\"modal\"]', $.proxy(this.hide, this))\n\n    this.$dialog.on('mousedown.dismiss.bs.modal', function () {\n      that.$element.one('mouseup.dismiss.bs.modal', function (e) {\n        if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true\n      })\n    })\n\n    this.backdrop(function () {\n      var transition = $.support.transition && that.$element.hasClass('fade')\n\n      if (!that.$element.parent().length) {\n        that.$element.appendTo(that.$body) // don't move modals dom position\n      }\n\n      that.$element\n        .show()\n        .scrollTop(0)\n\n      that.adjustDialog()\n\n      if (transition) {\n        that.$element[0].offsetWidth // force reflow\n      }\n\n      that.$element.addClass('in')\n\n      that.enforceFocus()\n\n      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })\n\n      transition ?\n        that.$dialog // wait for modal to slide in\n          .one('bsTransitionEnd', function () {\n            that.$element.trigger('focus').trigger(e)\n          })\n          .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n        that.$element.trigger('focus').trigger(e)\n    })\n  }\n\n  Modal.prototype.hide = function (e) {\n    if (e) e.preventDefault()\n\n    e = $.Event('hide.bs.modal')\n\n    this.$element.trigger(e)\n\n    if (!this.isShown || e.isDefaultPrevented()) return\n\n    this.isShown = false\n\n    this.escape()\n    this.resize()\n\n    $(document).off('focusin.bs.modal')\n\n    this.$element\n      .removeClass('in')\n      .off('click.dismiss.bs.modal')\n      .off('mouseup.dismiss.bs.modal')\n\n    this.$dialog.off('mousedown.dismiss.bs.modal')\n\n    $.support.transition && this.$element.hasClass('fade') ?\n      this.$element\n        .one('bsTransitionEnd', $.proxy(this.hideModal, this))\n        .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n      this.hideModal()\n  }\n\n  Modal.prototype.enforceFocus = function () {\n    $(document)\n      .off('focusin.bs.modal') // guard against infinite focus loop\n      .on('focusin.bs.modal', $.proxy(function (e) {\n        if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {\n          this.$element.trigger('focus')\n        }\n      }, this))\n  }\n\n  Modal.prototype.escape = function () {\n    if (this.isShown && this.options.keyboard) {\n      this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {\n        e.which == 27 && this.hide()\n      }, this))\n    } else if (!this.isShown) {\n      this.$element.off('keydown.dismiss.bs.modal')\n    }\n  }\n\n  Modal.prototype.resize = function () {\n    if (this.isShown) {\n      $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))\n    } else {\n      $(window).off('resize.bs.modal')\n    }\n  }\n\n  Modal.prototype.hideModal = function () {\n    var that = this\n    this.$element.hide()\n    this.backdrop(function () {\n      that.$body.removeClass('modal-open')\n      that.resetAdjustments()\n      that.resetScrollbar()\n      that.$element.trigger('hidden.bs.modal')\n    })\n  }\n\n  Modal.prototype.removeBackdrop = function () {\n    this.$backdrop && this.$backdrop.remove()\n    this.$backdrop = null\n  }\n\n  Modal.prototype.backdrop = function (callback) {\n    var that = this\n    var animate = this.$element.hasClass('fade') ? 'fade' : ''\n\n    if (this.isShown && this.options.backdrop) {\n      var doAnimate = $.support.transition && animate\n\n      this.$backdrop = $(document.createElement('div'))\n        .addClass('modal-backdrop ' + animate)\n        .appendTo(this.$body)\n\n      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {\n        if (this.ignoreBackdropClick) {\n          this.ignoreBackdropClick = false\n          return\n        }\n        if (e.target !== e.currentTarget) return\n        this.options.backdrop == 'static'\n          ? this.$element[0].focus()\n          : this.hide()\n      }, this))\n\n      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow\n\n      this.$backdrop.addClass('in')\n\n      if (!callback) return\n\n      doAnimate ?\n        this.$backdrop\n          .one('bsTransitionEnd', callback)\n          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n        callback()\n\n    } else if (!this.isShown && this.$backdrop) {\n      this.$backdrop.removeClass('in')\n\n      var callbackRemove = function () {\n        that.removeBackdrop()\n        callback && callback()\n      }\n      $.support.transition && this.$element.hasClass('fade') ?\n        this.$backdrop\n          .one('bsTransitionEnd', callbackRemove)\n          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n        callbackRemove()\n\n    } else if (callback) {\n      callback()\n    }\n  }\n\n  // these following methods are used to handle overflowing modals\n\n  Modal.prototype.handleUpdate = function () {\n    this.adjustDialog()\n  }\n\n  Modal.prototype.adjustDialog = function () {\n    var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight\n\n    this.$element.css({\n      paddingLeft:  !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',\n      paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''\n    })\n  }\n\n  Modal.prototype.resetAdjustments = function () {\n    this.$element.css({\n      paddingLeft: '',\n      paddingRight: ''\n    })\n  }\n\n  Modal.prototype.checkScrollbar = function () {\n    var fullWindowWidth = window.innerWidth\n    if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8\n      var documentElementRect = document.documentElement.getBoundingClientRect()\n      fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)\n    }\n    this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth\n    this.scrollbarWidth = this.measureScrollbar()\n  }\n\n  Modal.prototype.setScrollbar = function () {\n    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)\n    this.originalBodyPad = document.body.style.paddingRight || ''\n    if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)\n  }\n\n  Modal.prototype.resetScrollbar = function () {\n    this.$body.css('padding-right', this.originalBodyPad)\n  }\n\n  Modal.prototype.measureScrollbar = function () { // thx walsh\n    var scrollDiv = document.createElement('div')\n    scrollDiv.className = 'modal-scrollbar-measure'\n    this.$body.append(scrollDiv)\n    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth\n    this.$body[0].removeChild(scrollDiv)\n    return scrollbarWidth\n  }\n\n\n  // MODAL PLUGIN DEFINITION\n  // =======================\n\n  function Plugin(option, _relatedTarget) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.modal')\n      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)\n\n      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))\n      if (typeof option == 'string') data[option](_relatedTarget)\n      else if (options.show) data.show(_relatedTarget)\n    })\n  }\n\n  var old = $.fn.modal\n\n  $.fn.modal             = Plugin\n  $.fn.modal.Constructor = Modal\n\n\n  // MODAL NO CONFLICT\n  // =================\n\n  $.fn.modal.noConflict = function () {\n    $.fn.modal = old\n    return this\n  }\n\n\n  // MODAL DATA-API\n  // ==============\n\n  $(document).on('click.bs.modal.data-api', '[data-toggle=\"modal\"]', function (e) {\n    var $this   = $(this)\n    var href    = $this.attr('href')\n    var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\\s]+$)/, ''))) // strip for ie7\n    var option  = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())\n\n    if ($this.is('a')) e.preventDefault()\n\n    $target.one('show.bs.modal', function (showEvent) {\n      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown\n      $target.one('hidden.bs.modal', function () {\n        $this.is(':visible') && $this.trigger('focus')\n      })\n    })\n    Plugin.call($target, option, this)\n  })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: tooltip.js v3.3.6\n * http://getbootstrap.com/javascript/#tooltip\n * Inspired by the original jQuery.tipsy by Jason Frame\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // TOOLTIP PUBLIC CLASS DEFINITION\n  // ===============================\n\n  var Tooltip = function (element, options) {\n    this.type       = null\n    this.options    = null\n    this.enabled    = null\n    this.timeout    = null\n    this.hoverState = null\n    this.$element   = null\n    this.inState    = null\n\n    this.init('tooltip', element, options)\n  }\n\n  Tooltip.VERSION  = '3.3.6'\n\n  Tooltip.TRANSITION_DURATION = 150\n\n  Tooltip.DEFAULTS = {\n    animation: true,\n    placement: 'top',\n    selector: false,\n    template: '<div class=\"tooltip\" role=\"tooltip\"><div class=\"tooltip-arrow\"></div><div class=\"tooltip-inner\"></div></div>',\n    trigger: 'hover focus',\n    title: '',\n    delay: 0,\n    html: false,\n    container: false,\n    viewport: {\n      selector: 'body',\n      padding: 0\n    }\n  }\n\n  Tooltip.prototype.init = function (type, element, options) {\n    this.enabled   = true\n    this.type      = type\n    this.$element  = $(element)\n    this.options   = this.getOptions(options)\n    this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))\n    this.inState   = { click: false, hover: false, focus: false }\n\n    if (this.$element[0] instanceof document.constructor && !this.options.selector) {\n      throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')\n    }\n\n    var triggers = this.options.trigger.split(' ')\n\n    for (var i = triggers.length; i--;) {\n      var trigger = triggers[i]\n\n      if (trigger == 'click') {\n        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))\n      } else if (trigger != 'manual') {\n        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'\n        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'\n\n        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))\n        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))\n      }\n    }\n\n    this.options.selector ?\n      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :\n      this.fixTitle()\n  }\n\n  Tooltip.prototype.getDefaults = function () {\n    return Tooltip.DEFAULTS\n  }\n\n  Tooltip.prototype.getOptions = function (options) {\n    options = $.extend({}, this.getDefaults(), this.$element.data(), options)\n\n    if (options.delay && typeof options.delay == 'number') {\n      options.delay = {\n        show: options.delay,\n        hide: options.delay\n      }\n    }\n\n    return options\n  }\n\n  Tooltip.prototype.getDelegateOptions = function () {\n    var options  = {}\n    var defaults = this.getDefaults()\n\n    this._options && $.each(this._options, function (key, value) {\n      if (defaults[key] != value) options[key] = value\n    })\n\n    return options\n  }\n\n  Tooltip.prototype.enter = function (obj) {\n    var self = obj instanceof this.constructor ?\n      obj : $(obj.currentTarget).data('bs.' + this.type)\n\n    if (!self) {\n      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())\n      $(obj.currentTarget).data('bs.' + this.type, self)\n    }\n\n    if (obj instanceof $.Event) {\n      self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true\n    }\n\n    if (self.tip().hasClass('in') || self.hoverState == 'in') {\n      self.hoverState = 'in'\n      return\n    }\n\n    clearTimeout(self.timeout)\n\n    self.hoverState = 'in'\n\n    if (!self.options.delay || !self.options.delay.show) return self.show()\n\n    self.timeout = setTimeout(function () {\n      if (self.hoverState == 'in') self.show()\n    }, self.options.delay.show)\n  }\n\n  Tooltip.prototype.isInStateTrue = function () {\n    for (var key in this.inState) {\n      if (this.inState[key]) return true\n    }\n\n    return false\n  }\n\n  Tooltip.prototype.leave = function (obj) {\n    var self = obj instanceof this.constructor ?\n      obj : $(obj.currentTarget).data('bs.' + this.type)\n\n    if (!self) {\n      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())\n      $(obj.currentTarget).data('bs.' + this.type, self)\n    }\n\n    if (obj instanceof $.Event) {\n      self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false\n    }\n\n    if (self.isInStateTrue()) return\n\n    clearTimeout(self.timeout)\n\n    self.hoverState = 'out'\n\n    if (!self.options.delay || !self.options.delay.hide) return self.hide()\n\n    self.timeout = setTimeout(function () {\n      if (self.hoverState == 'out') self.hide()\n    }, self.options.delay.hide)\n  }\n\n  Tooltip.prototype.show = function () {\n    var e = $.Event('show.bs.' + this.type)\n\n    if (this.hasContent() && this.enabled) {\n      this.$element.trigger(e)\n\n      var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])\n      if (e.isDefaultPrevented() || !inDom) return\n      var that = this\n\n      var $tip = this.tip()\n\n      var tipId = this.getUID(this.type)\n\n      this.setContent()\n      $tip.attr('id', tipId)\n      this.$element.attr('aria-describedby', tipId)\n\n      if (this.options.animation) $tip.addClass('fade')\n\n      var placement = typeof this.options.placement == 'function' ?\n        this.options.placement.call(this, $tip[0], this.$element[0]) :\n        this.options.placement\n\n      var autoToken = /\\s?auto?\\s?/i\n      var autoPlace = autoToken.test(placement)\n      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'\n\n      $tip\n        .detach()\n        .css({ top: 0, left: 0, display: 'block' })\n        .addClass(placement)\n        .data('bs.' + this.type, this)\n\n      this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)\n      this.$element.trigger('inserted.bs.' + this.type)\n\n      var pos          = this.getPosition()\n      var actualWidth  = $tip[0].offsetWidth\n      var actualHeight = $tip[0].offsetHeight\n\n      if (autoPlace) {\n        var orgPlacement = placement\n        var viewportDim = this.getPosition(this.$viewport)\n\n        placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top'    :\n                    placement == 'top'    && pos.top    - actualHeight < viewportDim.top    ? 'bottom' :\n                    placement == 'right'  && pos.right  + actualWidth  > viewportDim.width  ? 'left'   :\n                    placement == 'left'   && pos.left   - actualWidth  < viewportDim.left   ? 'right'  :\n                    placement\n\n        $tip\n          .removeClass(orgPlacement)\n          .addClass(placement)\n      }\n\n      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)\n\n      this.applyPlacement(calculatedOffset, placement)\n\n      var complete = function () {\n        var prevHoverState = that.hoverState\n        that.$element.trigger('shown.bs.' + that.type)\n        that.hoverState = null\n\n        if (prevHoverState == 'out') that.leave(that)\n      }\n\n      $.support.transition && this.$tip.hasClass('fade') ?\n        $tip\n          .one('bsTransitionEnd', complete)\n          .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :\n        complete()\n    }\n  }\n\n  Tooltip.prototype.applyPlacement = function (offset, placement) {\n    var $tip   = this.tip()\n    var width  = $tip[0].offsetWidth\n    var height = $tip[0].offsetHeight\n\n    // manually read margins because getBoundingClientRect includes difference\n    var marginTop = parseInt($tip.css('margin-top'), 10)\n    var marginLeft = parseInt($tip.css('margin-left'), 10)\n\n    // we must check for NaN for ie 8/9\n    if (isNaN(marginTop))  marginTop  = 0\n    if (isNaN(marginLeft)) marginLeft = 0\n\n    offset.top  += marginTop\n    offset.left += marginLeft\n\n    // $.fn.offset doesn't round pixel values\n    // so we use setOffset directly with our own function B-0\n    $.offset.setOffset($tip[0], $.extend({\n      using: function (props) {\n        $tip.css({\n          top: Math.round(props.top),\n          left: Math.round(props.left)\n        })\n      }\n    }, offset), 0)\n\n    $tip.addClass('in')\n\n    // check to see if placing tip in new offset caused the tip to resize itself\n    var actualWidth  = $tip[0].offsetWidth\n    var actualHeight = $tip[0].offsetHeight\n\n    if (placement == 'top' && actualHeight != height) {\n      offset.top = offset.top + height - actualHeight\n    }\n\n    var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)\n\n    if (delta.left) offset.left += delta.left\n    else offset.top += delta.top\n\n    var isVertical          = /top|bottom/.test(placement)\n    var arrowDelta          = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight\n    var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'\n\n    $tip.offset(offset)\n    this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)\n  }\n\n  Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {\n    this.arrow()\n      .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')\n      .css(isVertical ? 'top' : 'left', '')\n  }\n\n  Tooltip.prototype.setContent = function () {\n    var $tip  = this.tip()\n    var title = this.getTitle()\n\n    $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)\n    $tip.removeClass('fade in top bottom left right')\n  }\n\n  Tooltip.prototype.hide = function (callback) {\n    var that = this\n    var $tip = $(this.$tip)\n    var e    = $.Event('hide.bs.' + this.type)\n\n    function complete() {\n      if (that.hoverState != 'in') $tip.detach()\n      that.$element\n        .removeAttr('aria-describedby')\n        .trigger('hidden.bs.' + that.type)\n      callback && callback()\n    }\n\n    this.$element.trigger(e)\n\n    if (e.isDefaultPrevented()) return\n\n    $tip.removeClass('in')\n\n    $.support.transition && $tip.hasClass('fade') ?\n      $tip\n        .one('bsTransitionEnd', complete)\n        .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :\n      complete()\n\n    this.hoverState = null\n\n    return this\n  }\n\n  Tooltip.prototype.fixTitle = function () {\n    var $e = this.$element\n    if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {\n      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')\n    }\n  }\n\n  Tooltip.prototype.hasContent = function () {\n    return this.getTitle()\n  }\n\n  Tooltip.prototype.getPosition = function ($element) {\n    $element   = $element || this.$element\n\n    var el     = $element[0]\n    var isBody = el.tagName == 'BODY'\n\n    var elRect    = el.getBoundingClientRect()\n    if (elRect.width == null) {\n      // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093\n      elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })\n    }\n    var elOffset  = isBody ? { top: 0, left: 0 } : $element.offset()\n    var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }\n    var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null\n\n    return $.extend({}, elRect, scroll, outerDims, elOffset)\n  }\n\n  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {\n    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2 } :\n           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :\n           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :\n        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }\n\n  }\n\n  Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {\n    var delta = { top: 0, left: 0 }\n    if (!this.$viewport) return delta\n\n    var viewportPadding = this.options.viewport && this.options.viewport.padding || 0\n    var viewportDimensions = this.getPosition(this.$viewport)\n\n    if (/right|left/.test(placement)) {\n      var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll\n      var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight\n      if (topEdgeOffset < viewportDimensions.top) { // top overflow\n        delta.top = viewportDimensions.top - topEdgeOffset\n      } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow\n        delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset\n      }\n    } else {\n      var leftEdgeOffset  = pos.left - viewportPadding\n      var rightEdgeOffset = pos.left + viewportPadding + actualWidth\n      if (leftEdgeOffset < viewportDimensions.left) { // left overflow\n        delta.left = viewportDimensions.left - leftEdgeOffset\n      } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow\n        delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset\n      }\n    }\n\n    return delta\n  }\n\n  Tooltip.prototype.getTitle = function () {\n    var title\n    var $e = this.$element\n    var o  = this.options\n\n    title = $e.attr('data-original-title')\n      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)\n\n    return title\n  }\n\n  Tooltip.prototype.getUID = function (prefix) {\n    do prefix += ~~(Math.random() * 1000000)\n    while (document.getElementById(prefix))\n    return prefix\n  }\n\n  Tooltip.prototype.tip = function () {\n    if (!this.$tip) {\n      this.$tip = $(this.options.template)\n      if (this.$tip.length != 1) {\n        throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')\n      }\n    }\n    return this.$tip\n  }\n\n  Tooltip.prototype.arrow = function () {\n    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))\n  }\n\n  Tooltip.prototype.enable = function () {\n    this.enabled = true\n  }\n\n  Tooltip.prototype.disable = function () {\n    this.enabled = false\n  }\n\n  Tooltip.prototype.toggleEnabled = function () {\n    this.enabled = !this.enabled\n  }\n\n  Tooltip.prototype.toggle = function (e) {\n    var self = this\n    if (e) {\n      self = $(e.currentTarget).data('bs.' + this.type)\n      if (!self) {\n        self = new this.constructor(e.currentTarget, this.getDelegateOptions())\n        $(e.currentTarget).data('bs.' + this.type, self)\n      }\n    }\n\n    if (e) {\n      self.inState.click = !self.inState.click\n      if (self.isInStateTrue()) self.enter(self)\n      else self.leave(self)\n    } else {\n      self.tip().hasClass('in') ? self.leave(self) : self.enter(self)\n    }\n  }\n\n  Tooltip.prototype.destroy = function () {\n    var that = this\n    clearTimeout(this.timeout)\n    this.hide(function () {\n      that.$element.off('.' + that.type).removeData('bs.' + that.type)\n      if (that.$tip) {\n        that.$tip.detach()\n      }\n      that.$tip = null\n      that.$arrow = null\n      that.$viewport = null\n    })\n  }\n\n\n  // TOOLTIP PLUGIN DEFINITION\n  // =========================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.tooltip')\n      var options = typeof option == 'object' && option\n\n      if (!data && /destroy|hide/.test(option)) return\n      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))\n      if (typeof option == 'string') data[option]()\n    })\n  }\n\n  var old = $.fn.tooltip\n\n  $.fn.tooltip             = Plugin\n  $.fn.tooltip.Constructor = Tooltip\n\n\n  // TOOLTIP NO CONFLICT\n  // ===================\n\n  $.fn.tooltip.noConflict = function () {\n    $.fn.tooltip = old\n    return this\n  }\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: popover.js v3.3.6\n * http://getbootstrap.com/javascript/#popovers\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // POPOVER PUBLIC CLASS DEFINITION\n  // ===============================\n\n  var Popover = function (element, options) {\n    this.init('popover', element, options)\n  }\n\n  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')\n\n  Popover.VERSION  = '3.3.6'\n\n  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {\n    placement: 'right',\n    trigger: 'click',\n    content: '',\n    template: '<div class=\"popover\" role=\"tooltip\"><div class=\"arrow\"></div><h3 class=\"popover-title\"></h3><div class=\"popover-content\"></div></div>'\n  })\n\n\n  // NOTE: POPOVER EXTENDS tooltip.js\n  // ================================\n\n  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)\n\n  Popover.prototype.constructor = Popover\n\n  Popover.prototype.getDefaults = function () {\n    return Popover.DEFAULTS\n  }\n\n  Popover.prototype.setContent = function () {\n    var $tip    = this.tip()\n    var title   = this.getTitle()\n    var content = this.getContent()\n\n    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)\n    $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events\n      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'\n    ](content)\n\n    $tip.removeClass('fade top bottom left right in')\n\n    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do\n    // this manually by checking the contents.\n    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()\n  }\n\n  Popover.prototype.hasContent = function () {\n    return this.getTitle() || this.getContent()\n  }\n\n  Popover.prototype.getContent = function () {\n    var $e = this.$element\n    var o  = this.options\n\n    return $e.attr('data-content')\n      || (typeof o.content == 'function' ?\n            o.content.call($e[0]) :\n            o.content)\n  }\n\n  Popover.prototype.arrow = function () {\n    return (this.$arrow = this.$arrow || this.tip().find('.arrow'))\n  }\n\n\n  // POPOVER PLUGIN DEFINITION\n  // =========================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.popover')\n      var options = typeof option == 'object' && option\n\n      if (!data && /destroy|hide/.test(option)) return\n      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))\n      if (typeof option == 'string') data[option]()\n    })\n  }\n\n  var old = $.fn.popover\n\n  $.fn.popover             = Plugin\n  $.fn.popover.Constructor = Popover\n\n\n  // POPOVER NO CONFLICT\n  // ===================\n\n  $.fn.popover.noConflict = function () {\n    $.fn.popover = old\n    return this\n  }\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: scrollspy.js v3.3.6\n * http://getbootstrap.com/javascript/#scrollspy\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // SCROLLSPY CLASS DEFINITION\n  // ==========================\n\n  function ScrollSpy(element, options) {\n    this.$body          = $(document.body)\n    this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)\n    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)\n    this.selector       = (this.options.target || '') + ' .nav li > a'\n    this.offsets        = []\n    this.targets        = []\n    this.activeTarget   = null\n    this.scrollHeight   = 0\n\n    this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))\n    this.refresh()\n    this.process()\n  }\n\n  ScrollSpy.VERSION  = '3.3.6'\n\n  ScrollSpy.DEFAULTS = {\n    offset: 10\n  }\n\n  ScrollSpy.prototype.getScrollHeight = function () {\n    return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)\n  }\n\n  ScrollSpy.prototype.refresh = function () {\n    var that          = this\n    var offsetMethod  = 'offset'\n    var offsetBase    = 0\n\n    this.offsets      = []\n    this.targets      = []\n    this.scrollHeight = this.getScrollHeight()\n\n    if (!$.isWindow(this.$scrollElement[0])) {\n      offsetMethod = 'position'\n      offsetBase   = this.$scrollElement.scrollTop()\n    }\n\n    this.$body\n      .find(this.selector)\n      .map(function () {\n        var $el   = $(this)\n        var href  = $el.data('target') || $el.attr('href')\n        var $href = /^#./.test(href) && $(href)\n\n        return ($href\n          && $href.length\n          && $href.is(':visible')\n          && [[$href[offsetMethod]().top + offsetBase, href]]) || null\n      })\n      .sort(function (a, b) { return a[0] - b[0] })\n      .each(function () {\n        that.offsets.push(this[0])\n        that.targets.push(this[1])\n      })\n  }\n\n  ScrollSpy.prototype.process = function () {\n    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset\n    var scrollHeight = this.getScrollHeight()\n    var maxScroll    = this.options.offset + scrollHeight - this.$scrollElement.height()\n    var offsets      = this.offsets\n    var targets      = this.targets\n    var activeTarget = this.activeTarget\n    var i\n\n    if (this.scrollHeight != scrollHeight) {\n      this.refresh()\n    }\n\n    if (scrollTop >= maxScroll) {\n      return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)\n    }\n\n    if (activeTarget && scrollTop < offsets[0]) {\n      this.activeTarget = null\n      return this.clear()\n    }\n\n    for (i = offsets.length; i--;) {\n      activeTarget != targets[i]\n        && scrollTop >= offsets[i]\n        && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])\n        && this.activate(targets[i])\n    }\n  }\n\n  ScrollSpy.prototype.activate = function (target) {\n    this.activeTarget = target\n\n    this.clear()\n\n    var selector = this.selector +\n      '[data-target=\"' + target + '\"],' +\n      this.selector + '[href=\"' + target + '\"]'\n\n    var active = $(selector)\n      .parents('li')\n      .addClass('active')\n\n    if (active.parent('.dropdown-menu').length) {\n      active = active\n        .closest('li.dropdown')\n        .addClass('active')\n    }\n\n    active.trigger('activate.bs.scrollspy')\n  }\n\n  ScrollSpy.prototype.clear = function () {\n    $(this.selector)\n      .parentsUntil(this.options.target, '.active')\n      .removeClass('active')\n  }\n\n\n  // SCROLLSPY PLUGIN DEFINITION\n  // ===========================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.scrollspy')\n      var options = typeof option == 'object' && option\n\n      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))\n      if (typeof option == 'string') data[option]()\n    })\n  }\n\n  var old = $.fn.scrollspy\n\n  $.fn.scrollspy             = Plugin\n  $.fn.scrollspy.Constructor = ScrollSpy\n\n\n  // SCROLLSPY NO CONFLICT\n  // =====================\n\n  $.fn.scrollspy.noConflict = function () {\n    $.fn.scrollspy = old\n    return this\n  }\n\n\n  // SCROLLSPY DATA-API\n  // ==================\n\n  $(window).on('load.bs.scrollspy.data-api', function () {\n    $('[data-spy=\"scroll\"]').each(function () {\n      var $spy = $(this)\n      Plugin.call($spy, $spy.data())\n    })\n  })\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: tab.js v3.3.6\n * http://getbootstrap.com/javascript/#tabs\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // TAB CLASS DEFINITION\n  // ====================\n\n  var Tab = function (element) {\n    // jscs:disable requireDollarBeforejQueryAssignment\n    this.element = $(element)\n    // jscs:enable requireDollarBeforejQueryAssignment\n  }\n\n  Tab.VERSION = '3.3.6'\n\n  Tab.TRANSITION_DURATION = 150\n\n  Tab.prototype.show = function () {\n    var $this    = this.element\n    var $ul      = $this.closest('ul:not(.dropdown-menu)')\n    var selector = $this.data('target')\n\n    if (!selector) {\n      selector = $this.attr('href')\n      selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n    }\n\n    if ($this.parent('li').hasClass('active')) return\n\n    var $previous = $ul.find('.active:last a')\n    var hideEvent = $.Event('hide.bs.tab', {\n      relatedTarget: $this[0]\n    })\n    var showEvent = $.Event('show.bs.tab', {\n      relatedTarget: $previous[0]\n    })\n\n    $previous.trigger(hideEvent)\n    $this.trigger(showEvent)\n\n    if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return\n\n    var $target = $(selector)\n\n    this.activate($this.closest('li'), $ul)\n    this.activate($target, $target.parent(), function () {\n      $previous.trigger({\n        type: 'hidden.bs.tab',\n        relatedTarget: $this[0]\n      })\n      $this.trigger({\n        type: 'shown.bs.tab',\n        relatedTarget: $previous[0]\n      })\n    })\n  }\n\n  Tab.prototype.activate = function (element, container, callback) {\n    var $active    = container.find('> .active')\n    var transition = callback\n      && $.support.transition\n      && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)\n\n    function next() {\n      $active\n        .removeClass('active')\n        .find('> .dropdown-menu > .active')\n          .removeClass('active')\n        .end()\n        .find('[data-toggle=\"tab\"]')\n          .attr('aria-expanded', false)\n\n      element\n        .addClass('active')\n        .find('[data-toggle=\"tab\"]')\n          .attr('aria-expanded', true)\n\n      if (transition) {\n        element[0].offsetWidth // reflow for transition\n        element.addClass('in')\n      } else {\n        element.removeClass('fade')\n      }\n\n      if (element.parent('.dropdown-menu').length) {\n        element\n          .closest('li.dropdown')\n            .addClass('active')\n          .end()\n          .find('[data-toggle=\"tab\"]')\n            .attr('aria-expanded', true)\n      }\n\n      callback && callback()\n    }\n\n    $active.length && transition ?\n      $active\n        .one('bsTransitionEnd', next)\n        .emulateTransitionEnd(Tab.TRANSITION_DURATION) :\n      next()\n\n    $active.removeClass('in')\n  }\n\n\n  // TAB PLUGIN DEFINITION\n  // =====================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this = $(this)\n      var data  = $this.data('bs.tab')\n\n      if (!data) $this.data('bs.tab', (data = new Tab(this)))\n      if (typeof option == 'string') data[option]()\n    })\n  }\n\n  var old = $.fn.tab\n\n  $.fn.tab             = Plugin\n  $.fn.tab.Constructor = Tab\n\n\n  // TAB NO CONFLICT\n  // ===============\n\n  $.fn.tab.noConflict = function () {\n    $.fn.tab = old\n    return this\n  }\n\n\n  // TAB DATA-API\n  // ============\n\n  var clickHandler = function (e) {\n    e.preventDefault()\n    Plugin.call($(this), 'show')\n  }\n\n  $(document)\n    .on('click.bs.tab.data-api', '[data-toggle=\"tab\"]', clickHandler)\n    .on('click.bs.tab.data-api', '[data-toggle=\"pill\"]', clickHandler)\n\n}(jQuery);\n\n/* ========================================================================\n * Bootstrap: affix.js v3.3.6\n * http://getbootstrap.com/javascript/#affix\n * ========================================================================\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n  'use strict';\n\n  // AFFIX CLASS DEFINITION\n  // ======================\n\n  var Affix = function (element, options) {\n    this.options = $.extend({}, Affix.DEFAULTS, options)\n\n    this.$target = $(this.options.target)\n      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))\n      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))\n\n    this.$element     = $(element)\n    this.affixed      = null\n    this.unpin        = null\n    this.pinnedOffset = null\n\n    this.checkPosition()\n  }\n\n  Affix.VERSION  = '3.3.6'\n\n  Affix.RESET    = 'affix affix-top affix-bottom'\n\n  Affix.DEFAULTS = {\n    offset: 0,\n    target: window\n  }\n\n  Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {\n    var scrollTop    = this.$target.scrollTop()\n    var position     = this.$element.offset()\n    var targetHeight = this.$target.height()\n\n    if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false\n\n    if (this.affixed == 'bottom') {\n      if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'\n      return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'\n    }\n\n    var initializing   = this.affixed == null\n    var colliderTop    = initializing ? scrollTop : position.top\n    var colliderHeight = initializing ? targetHeight : height\n\n    if (offsetTop != null && scrollTop <= offsetTop) return 'top'\n    if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'\n\n    return false\n  }\n\n  Affix.prototype.getPinnedOffset = function () {\n    if (this.pinnedOffset) return this.pinnedOffset\n    this.$element.removeClass(Affix.RESET).addClass('affix')\n    var scrollTop = this.$target.scrollTop()\n    var position  = this.$element.offset()\n    return (this.pinnedOffset = position.top - scrollTop)\n  }\n\n  Affix.prototype.checkPositionWithEventLoop = function () {\n    setTimeout($.proxy(this.checkPosition, this), 1)\n  }\n\n  Affix.prototype.checkPosition = function () {\n    if (!this.$element.is(':visible')) return\n\n    var height       = this.$element.height()\n    var offset       = this.options.offset\n    var offsetTop    = offset.top\n    var offsetBottom = offset.bottom\n    var scrollHeight = Math.max($(document).height(), $(document.body).height())\n\n    if (typeof offset != 'object')         offsetBottom = offsetTop = offset\n    if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)\n    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)\n\n    var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)\n\n    if (this.affixed != affix) {\n      if (this.unpin != null) this.$element.css('top', '')\n\n      var affixType = 'affix' + (affix ? '-' + affix : '')\n      var e         = $.Event(affixType + '.bs.affix')\n\n      this.$element.trigger(e)\n\n      if (e.isDefaultPrevented()) return\n\n      this.affixed = affix\n      this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null\n\n      this.$element\n        .removeClass(Affix.RESET)\n        .addClass(affixType)\n        .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')\n    }\n\n    if (affix == 'bottom') {\n      this.$element.offset({\n        top: scrollHeight - height - offsetBottom\n      })\n    }\n  }\n\n\n  // AFFIX PLUGIN DEFINITION\n  // =======================\n\n  function Plugin(option) {\n    return this.each(function () {\n      var $this   = $(this)\n      var data    = $this.data('bs.affix')\n      var options = typeof option == 'object' && option\n\n      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))\n      if (typeof option == 'string') data[option]()\n    })\n  }\n\n  var old = $.fn.affix\n\n  $.fn.affix             = Plugin\n  $.fn.affix.Constructor = Affix\n\n\n  // AFFIX NO CONFLICT\n  // =================\n\n  $.fn.affix.noConflict = function () {\n    $.fn.affix = old\n    return this\n  }\n\n\n  // AFFIX DATA-API\n  // ==============\n\n  $(window).on('load', function () {\n    $('[data-spy=\"affix\"]').each(function () {\n      var $spy = $(this)\n      var data = $spy.data()\n\n      data.offset = data.offset || {}\n\n      if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom\n      if (data.offsetTop    != null) data.offset.top    = data.offsetTop\n\n      Plugin.call($spy, data)\n    })\n  })\n\n}(jQuery);\n"
  },
  {
    "path": "28-ionic/dailyreads/backend/static/js/jquery.js",
    "content": "/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */\n!function(a,b){\"object\"==typeof module&&\"object\"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error(\"jQuery requires a window with a document\");return b(a)}:b(a)}(\"undefined\"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=\"1.11.1\",m=function(a,b){return new m.fn.init(a,b)},n=/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,o=/^-ms-/,p=/-([\\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:\"\",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for(\"boolean\"==typeof g&&(j=g,g=arguments[h]||{},h++),\"object\"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:\"jQuery\"+(l+Math.random()).replace(/\\D/g,\"\"),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return\"function\"===m.type(a)},isArray:Array.isArray||function(a){return\"array\"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||\"object\"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,\"constructor\")&&!j.call(a.constructor.prototype,\"isPrototypeOf\"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+\"\":\"object\"==typeof a||\"function\"==typeof a?h[i.call(a)]||\"object\":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,\"ms-\").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?\"\":(a+\"\").replace(n,\"\")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,\"string\"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return\"string\"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each(\"Boolean Number String Function Array Date RegExp Object Error\".split(\" \"),function(a,b){h[\"[object \"+b+\"]\"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return\"function\"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:\"array\"===c||0===b||\"number\"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=\"sizzle\"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C=\"undefined\",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L=\"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",M=\"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",N=\"(?:\\\\\\\\.|[\\\\w-]|[^\\\\x00-\\\\xa0])+\",O=N.replace(\"w\",\"w#\"),P=\"\\\\[\"+M+\"*(\"+N+\")(?:\"+M+\"*([*^$|!~]?=)\"+M+\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\"+O+\"))|)\"+M+\"*\\\\]\",Q=\":(\"+N+\")(?:\\\\((('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\"+P+\")*)|.*)\\\\)|)\",R=new RegExp(\"^\"+M+\"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\"+M+\"+$\",\"g\"),S=new RegExp(\"^\"+M+\"*,\"+M+\"*\"),T=new RegExp(\"^\"+M+\"*([>+~]|\"+M+\")\"+M+\"*\"),U=new RegExp(\"=\"+M+\"*([^\\\\]'\\\"]*?)\"+M+\"*\\\\]\",\"g\"),V=new RegExp(Q),W=new RegExp(\"^\"+O+\"$\"),X={ID:new RegExp(\"^#(\"+N+\")\"),CLASS:new RegExp(\"^\\\\.(\"+N+\")\"),TAG:new RegExp(\"^(\"+N.replace(\"w\",\"w*\")+\")\"),ATTR:new RegExp(\"^\"+P),PSEUDO:new RegExp(\"^\"+Q),CHILD:new RegExp(\"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\"+M+\"*(even|odd|(([+-]|)(\\\\d*)n|)\"+M+\"*(?:([+-]|)\"+M+\"*(\\\\d+)|))\"+M+\"*\\\\)|)\",\"i\"),bool:new RegExp(\"^(?:\"+L+\")$\",\"i\"),needsContext:new RegExp(\"^\"+M+\"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\"+M+\"*((?:-\\\\d)?\\\\d*)\"+M+\"*\\\\)|)(?=[^-]|$)\",\"i\")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\\d$/i,$=/^[^{]+\\{\\s*\\[native \\w/,_=/^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,ab=/[+~]/,bb=/'|\\\\/g,cb=new RegExp(\"\\\\\\\\([\\\\da-f]{1,6}\"+M+\"?|(\"+M+\")|.)\",\"ig\"),db=function(a,b,c){var d=\"0x\"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||\"string\"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&\"object\"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute(\"id\"))?s=r.replace(bb,\"\\\\$&\"):b.setAttribute(\"id\",s),s=\"[id='\"+s+\"'] \",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(\",\")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute(\"id\")}}}return i(a.replace(R,\"$1\"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+\" \")>d.cacheLength&&delete b[a.shift()],b[c+\" \"]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement(\"div\");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split(\"|\"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return\"input\"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return(\"input\"===c||\"button\"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?\"HTML\"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener(\"unload\",function(){m()},!1):g.attachEvent&&g.attachEvent(\"onunload\",function(){m()})),c.attributes=ib(function(a){return a.className=\"i\",!a.getAttribute(\"className\")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment(\"\")),!a.getElementsByTagName(\"*\").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML=\"<div class='a'></div><div class='a i'></div>\",a.firstChild.className=\"i\",2===a.getElementsByClassName(\"i\").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute(\"id\")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode(\"id\");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if(\"*\"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML=\"<select msallowclip=''><option selected=''></option></select>\",a.querySelectorAll(\"[msallowclip^='']\").length&&q.push(\"[*^$]=\"+M+\"*(?:''|\\\"\\\")\"),a.querySelectorAll(\"[selected]\").length||q.push(\"\\\\[\"+M+\"*(?:value|\"+L+\")\"),a.querySelectorAll(\":checked\").length||q.push(\":checked\")}),ib(function(a){var b=e.createElement(\"input\");b.setAttribute(\"type\",\"hidden\"),a.appendChild(b).setAttribute(\"name\",\"D\"),a.querySelectorAll(\"[name=d]\").length&&q.push(\"name\"+M+\"*[*^$|!~]?=\"),a.querySelectorAll(\":enabled\").length||q.push(\":enabled\",\":disabled\"),a.querySelectorAll(\"*,:x\"),q.push(\",.*:\")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,\"div\"),s.call(a,\"[s!='']:x\"),r.push(\"!=\",Q)}),q=q.length&&new RegExp(q.join(\"|\")),r=r.length&&new RegExp(r.join(\"|\")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,\"='$1']\"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error(\"Syntax error, unrecognized expression: \"+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c=\"\",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if(\"string\"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{\">\":{dir:\"parentNode\",first:!0},\" \":{dir:\"parentNode\"},\"+\":{dir:\"previousSibling\",first:!0},\"~\":{dir:\"previousSibling\"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||\"\").replace(cb,db),\"~=\"===a[2]&&(a[3]=\" \"+a[3]+\" \"),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),\"nth\"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*(\"even\"===a[3]||\"odd\"===a[3])),a[5]=+(a[7]+a[8]||\"odd\"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||\"\":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(\")\",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return\"*\"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+\" \"];return b||(b=new RegExp(\"(^|\"+M+\")\"+a+\"(\"+M+\"|$)\"))&&y(a,function(a){return b.test(\"string\"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute(\"class\")||\"\")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?\"!=\"===b:b?(e+=\"\",\"=\"===b?e===c:\"!=\"===b?e!==c:\"^=\"===b?c&&0===e.indexOf(c):\"*=\"===b?c&&e.indexOf(c)>-1:\"$=\"===b?c&&e.slice(-c.length)===c:\"~=\"===b?(\" \"+e+\" \").indexOf(c)>-1:\"|=\"===b?e===c||e.slice(0,c.length+1)===c+\"-\":!1):!0}},CHILD:function(a,b,c,d,e){var f=\"nth\"!==a.slice(0,3),g=\"last\"!==a.slice(-4),h=\"of-type\"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?\"nextSibling\":\"previousSibling\",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p=\"only\"===a&&!o&&\"nextSibling\"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error(\"unsupported pseudo: \"+a);return e[u]?e(b):e.length>1?(c=[a,a,\"\",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,\"$1\"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||\"\")||fb.error(\"unsupported lang: \"+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute(\"xml:lang\")||b.getAttribute(\"lang\"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+\"-\");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return\"input\"===b&&!!a.checked||\"option\"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return\"input\"===b&&\"button\"===a.type||\"button\"===b},text:function(a){var b;return\"input\"===a.nodeName.toLowerCase()&&\"text\"===a.type&&(null==(b=a.getAttribute(\"type\"))||\"text\"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+\" \"];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R,\" \")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d=\"\";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&\"parentNode\"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||\"*\",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[\" \"],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:\" \"===a[i-2].type?\"*\":\"\"})).replace(R,\"$1\"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q=\"0\",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG(\"*\",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+\" \"];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n=\"function\"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&\"ID\"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split(\"\").sort(B).join(\"\")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement(\"div\"))}),ib(function(a){return a.innerHTML=\"<a href='#'></a>\",\"#\"===a.firstChild.getAttribute(\"href\")})||jb(\"type|href|height|width\",function(a,b,c){return c?void 0:a.getAttribute(b,\"type\"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML=\"<input/>\",a.firstChild.setAttribute(\"value\",\"\"),\"\"===a.firstChild.getAttribute(\"value\")})||jb(\"value\",function(a,b,c){return c||\"input\"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute(\"disabled\")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[\":\"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,v=/^.[^:#\\[\\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if(\"string\"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=\":not(\"+a+\")\"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if(\"string\"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+\" \"+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,\"string\"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if(\"string\"==typeof a){if(c=\"<\"===a.charAt(0)&&\">\"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?\"undefined\"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||\"string\"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?\"string\"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,\"parentNode\")},parentsUntil:function(a,b,c){return m.dir(a,\"parentNode\",c)},next:function(a){return D(a,\"nextSibling\")},prev:function(a){return D(a,\"previousSibling\")},nextAll:function(a){return m.dir(a,\"nextSibling\")},prevAll:function(a){return m.dir(a,\"previousSibling\")},nextUntil:function(a,b,c){return m.dir(a,\"nextSibling\",c)},prevUntil:function(a,b,c){return m.dir(a,\"previousSibling\",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,\"iframe\")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return\"Until\"!==a.slice(-5)&&(d=c),d&&\"string\"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a=\"string\"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);\"function\"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&\"string\"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[[\"resolve\",\"done\",m.Callbacks(\"once memory\"),\"resolved\"],[\"reject\",\"fail\",m.Callbacks(\"once memory\"),\"rejected\"],[\"notify\",\"progress\",m.Callbacks(\"memory\")]],c=\"pending\",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+\"With\"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+\"With\"](this===e?d:this,arguments),this},e[f[0]+\"With\"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler(\"ready\"),m(y).off(\"ready\")))}}});function I(){y.addEventListener?(y.removeEventListener(\"DOMContentLoaded\",J,!1),a.removeEventListener(\"load\",J,!1)):(y.detachEvent(\"onreadystatechange\",J),a.detachEvent(\"onload\",J))}function J(){(y.addEventListener||\"load\"===event.type||\"complete\"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),\"complete\"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener(\"DOMContentLoaded\",J,!1),a.addEventListener(\"load\",J,!1);else{y.attachEvent(\"onreadystatechange\",J),a.attachEvent(\"onload\",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll(\"left\")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K=\"undefined\",L;for(L in m(k))break;k.ownLast=\"0\"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName(\"body\")[0],c&&c.style&&(b=y.createElement(\"div\"),d=y.createElement(\"div\"),d.style.cssText=\"position:absolute;border:0;width:0;height:0;top:0;left:-9999px\",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText=\"display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1\",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement(\"div\");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+\" \").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute(\"classid\")===b};var M=/^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d=\"data-\"+b.replace(N,\"-$1\").toLowerCase();if(c=a.getAttribute(d),\"string\"==typeof c){try{c=\"true\"===c?!0:\"false\"===c?!1:\"null\"===c?null:+c+\"\"===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if((\"data\"!==b||!m.isEmptyObject(a[b]))&&\"toJSON\"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;\nif(k&&j[k]&&(e||j[k].data)||void 0!==d||\"string\"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),(\"object\"==typeof b||\"function\"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),\"string\"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(\" \")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{\"applet \":!0,\"embed \":!0,\"object \":\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,\"parsedAttrs\"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf(\"data-\")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,\"parsedAttrs\",!0)}return e}return\"object\"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||\"fx\")+\"queue\",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||\"fx\";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};\"inprogress\"===e&&(e=c.shift(),d--),e&&(\"fx\"===b&&c.unshift(\"inprogress\"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+\"queueHooks\";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks(\"once memory\").add(function(){m._removeData(a,b+\"queue\"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return\"string\"!=typeof a&&(b=a,a=\"fx\",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),\"fx\"===a&&\"inprogress\"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||\"fx\",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};\"string\"!=typeof a&&(b=a,a=void 0),a=a||\"fx\";while(g--)c=m._data(f[g],a+\"queueHooks\"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/.source,T=[\"Top\",\"Right\",\"Bottom\",\"Left\"],U=function(a,b){return a=b||a,\"none\"===m.css(a,\"display\")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if(\"object\"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement(\"input\"),b=y.createElement(\"div\"),c=y.createDocumentFragment();if(b.innerHTML=\"  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>\",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName(\"tbody\").length,k.htmlSerialize=!!b.getElementsByTagName(\"link\").length,k.html5Clone=\"<:nav></:nav>\"!==y.createElement(\"nav\").cloneNode(!0).outerHTML,a.type=\"checkbox\",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML=\"<textarea>x</textarea>\",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML=\"<input type='radio' checked='checked' name='t'/>\",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent(\"onclick\",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement(\"div\");for(b in{submit:!0,change:!0,focusin:!0})c=\"on\"+b,(k[b+\"Bubbles\"]=c in a)||(d.setAttribute(c,\"t\"),k[b+\"Bubbles\"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||\"\").match(E)||[\"\"],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||\"\").split(\".\").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(\".\")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent(\"on\"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||\"\").match(E)||[\"\"],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||\"\").split(\".\").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp(\"(^|\\\\.)\"+p.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&(\"**\"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,\"events\"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,\"type\")?b.type:b,q=j.call(b,\"namespace\")?b.namespace.split(\".\"):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(\".\")>=0&&(q=p.split(\".\"),p=q.shift(),q.sort()),g=p.indexOf(\":\")<0&&\"on\"+p,b=b[m.expando]?b:new m.Event(p,\"object\"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join(\".\"),b.namespace_re=b.namespace?new RegExp(\"(^|\\\\.)\"+q.join(\"\\\\.(?:.*\\\\.|)\")+\"(\\\\.|$)\"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,\"events\")||{})[b.type]&&m._data(h,\"handle\"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,\"events\")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||\"click\"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||\"click\"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+\" \",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:\"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which\".split(\" \"),fixHooks:{},keyHooks:{props:\"char charCode key keyCode\".split(\" \"),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:\"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement\".split(\" \"),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:\"focusin\"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:\"focusout\"},click:{trigger:function(){return m.nodeName(this,\"input\")&&\"checkbox\"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,\"a\")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d=\"on\"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:\"mouseover\",mouseleave:\"mouseout\",pointerenter:\"pointerover\",pointerleave:\"pointerout\"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,\"form\")?!1:void m.event.add(this,\"click._submit keypress._submit\",function(a){var b=a.target,c=m.nodeName(b,\"input\")||m.nodeName(b,\"button\")?b.form:void 0;c&&!m._data(c,\"submitBubbles\")&&(m.event.add(c,\"submit._submit\",function(a){a._submit_bubble=!0}),m._data(c,\"submitBubbles\",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate(\"submit\",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,\"form\")?!1:void m.event.remove(this,\"._submit\")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?((\"checkbox\"===this.type||\"radio\"===this.type)&&(m.event.add(this,\"propertychange._change\",function(a){\"checked\"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,\"click._change\",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate(\"change\",this,a,!0)})),!1):void m.event.add(this,\"beforeactivate._change\",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,\"changeBubbles\")&&(m.event.add(b,\"change._change\",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate(\"change\",this.parentNode,a,!0)}),m._data(b,\"changeBubbles\",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||\"radio\"!==b.type&&\"checkbox\"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,\"._change\"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:\"focusin\",blur:\"focusout\"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if(\"object\"==typeof a){\"string\"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&(\"string\"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+\".\"+d.namespace:d.origType,d.selector,d.handler),this;if(\"object\"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||\"function\"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split(\"|\"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb=\"abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video\",fb=/ jQuery\\d+=\"(?:null|\\d+)\"/g,gb=new RegExp(\"<(?:\"+eb+\")[\\\\s/>]\",\"i\"),hb=/^\\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/gi,jb=/<([\\w:]+)/,kb=/<tbody/i,lb=/<|&#?\\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\\s*(?:[^=]|=\\s*.checked.)/i,ob=/^$|\\/(?:java|ecma)script/i,pb=/^true\\/(.*)/,qb=/^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g,rb={option:[1,\"<select multiple='multiple'>\",\"</select>\"],legend:[1,\"<fieldset>\",\"</fieldset>\"],area:[1,\"<map>\",\"</map>\"],param:[1,\"<object>\",\"</object>\"],thead:[1,\"<table>\",\"</table>\"],tr:[2,\"<table><tbody>\",\"</tbody></table>\"],col:[2,\"<table><tbody></tbody><colgroup>\",\"</colgroup></table>\"],td:[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],_default:k.htmlSerialize?[0,\"\",\"\"]:[1,\"X<div>\",\"</div>\"]},sb=db(y),tb=sb.appendChild(y.createElement(\"div\"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||\"*\"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||\"*\"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,\"table\")&&m.nodeName(11!==b.nodeType?b:b.firstChild,\"tr\")?a.getElementsByTagName(\"tbody\")[0]||a.appendChild(a.ownerDocument.createElement(\"tbody\")):a}function xb(a){return a.type=(null!==m.find.attr(a,\"type\"))+\"/\"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute(\"type\"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,\"globalEval\",!b||m._data(b[d],\"globalEval\"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}\"script\"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):\"object\"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):\"input\"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):\"option\"===c?b.defaultSelected=b.selected=a.defaultSelected:(\"input\"===c||\"textarea\"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test(\"<\"+a.nodeName+\">\")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,\"script\"),d.length>0&&zb(d,!i&&ub(a,\"script\")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if(\"object\"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement(\"div\")),i=(jb.exec(f)||[\"\",\"\"])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,\"<$1></$2>\")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f=\"table\"!==i||kb.test(f)?\"<table>\"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],\"tbody\")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent=\"\";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,\"input\"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),\"script\"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||\"\")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,\"script\")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,\"select\")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,\"\"):void 0;if(!(\"string\"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||[\"\",\"\"])[1].toLowerCase()])){a=a.replace(ib,\"<$1></$2>\");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&\"string\"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,\"script\"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,\"script\"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||\"\")&&!m._data(d,\"globalEval\")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||\"\").replace(qb,\"\")));i=c=null}return this}}),m.each({appendTo:\"append\",prependTo:\"prepend\",insertBefore:\"before\",insertAfter:\"after\",replaceAll:\"replaceWith\"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],\"display\");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),\"none\"!==c&&c||(Cb=(Cb||m(\"<iframe frameborder='0' width='0' height='0'/>\")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName(\"body\")[0],c&&c.style?(b=y.createElement(\"div\"),d=y.createElement(\"div\"),d.style.cssText=\"position:absolute;border:0;width:0;height:0;top:0;left:-9999px\",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText=\"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1\",b.appendChild(y.createElement(\"div\")).style.width=\"5px\",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp(\"^(\"+S+\")(?!px)[a-z%]+$\",\"i\"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(\"\"!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+\"\"}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left=\"fontSize\"===b?\"1em\":g,g=h.pixelLeft+\"px\",h.left=d,f&&(e.left=f)),void 0===g?g:g+\"\"||\"auto\"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement(\"div\"),b.innerHTML=\"  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>\",d=b.getElementsByTagName(\"a\")[0],c=d&&d.style){c.cssText=\"float:left;opacity:.5\",k.opacity=\"0.5\"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip=\"content-box\",b.cloneNode(!0).style.backgroundClip=\"\",k.clearCloneStyle=\"content-box\"===b.style.backgroundClip,k.boxSizing=\"\"===c.boxSizing||\"\"===c.MozBoxSizing||\"\"===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName(\"body\")[0],c&&c.style&&(b=y.createElement(\"div\"),d=y.createElement(\"div\"),d.style.cssText=\"position:absolute;border:0;width:0;height:0;top:0;left:-9999px\",c.appendChild(d).appendChild(b),b.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\",e=f=!1,h=!0,a.getComputedStyle&&(e=\"1%\"!==(a.getComputedStyle(b,null)||{}).top,f=\"4px\"===(a.getComputedStyle(b,null)||{width:\"4px\"}).width,i=b.appendChild(y.createElement(\"div\")),i.style.cssText=b.style.cssText=\"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0\",i.style.marginRight=i.style.width=\"0\",b.style.width=\"1px\",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML=\"<table><tr><td></td><td>t</td></tr></table>\",i=b.getElementsByTagName(\"td\"),i[0].style.cssText=\"margin:0;border:0;padding:0;display:none\",g=0===i[0].offsetHeight,g&&(i[0].style.display=\"\",i[1].style.display=\"none\",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\\([^)]*\\)/i,Nb=/opacity\\s*=\\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp(\"^(\"+S+\")(.*)$\",\"i\"),Qb=new RegExp(\"^([+-])=(\"+S+\")\",\"i\"),Rb={position:\"absolute\",visibility:\"hidden\",display:\"block\"},Sb={letterSpacing:\"0\",fontWeight:\"400\"},Tb=[\"Webkit\",\"O\",\"Moz\",\"ms\"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,\"olddisplay\"),c=d.style.display,b?(f[g]||\"none\"!==c||(d.style.display=\"\"),\"\"===d.style.display&&U(d)&&(f[g]=m._data(d,\"olddisplay\",Fb(d.nodeName)))):(e=U(d),(c&&\"none\"!==c||!e)&&m._data(d,\"olddisplay\",e?c:m.css(d,\"display\"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&\"none\"!==d.style.display&&\"\"!==d.style.display||(d.style.display=b?f[g]||\"\":\"none\"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||\"px\"):b}function Xb(a,b,c,d,e){for(var f=c===(d?\"border\":\"content\")?4:\"width\"===b?1:0,g=0;4>f;f+=2)\"margin\"===c&&(g+=m.css(a,c+T[f],!0,e)),d?(\"content\"===c&&(g-=m.css(a,\"padding\"+T[f],!0,e)),\"margin\"!==c&&(g-=m.css(a,\"border\"+T[f]+\"Width\",!0,e))):(g+=m.css(a,\"padding\"+T[f],!0,e),\"padding\"!==c&&(g+=m.css(a,\"border\"+T[f]+\"Width\",!0,e)));return g}function Yb(a,b,c){var d=!0,e=\"width\"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&\"border-box\"===m.css(a,\"boxSizing\",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?\"border\":\"content\"),d,f)+\"px\"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,\"opacity\");return\"\"===c?\"1\":c}}}},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\":k.cssFloat?\"cssFloat\":\"styleFloat\"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&\"get\"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,\"string\"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f=\"number\"),null!=c&&c===c&&(\"number\"!==f||m.cssNumber[h]||(c+=\"px\"),k.clearCloneStyle||\"\"!==c||0!==b.indexOf(\"background\")||(i[b]=\"inherit\"),!(g&&\"set\"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&\"get\"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),\"normal\"===f&&b in Sb&&(f=Sb[b]),\"\"===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each([\"height\",\"width\"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,\"display\"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&\"border-box\"===m.css(a,\"boxSizing\",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||\"\")?.01*parseFloat(RegExp.$1)+\"\":b?\"1\":\"\"},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?\"alpha(opacity=\"+100*b+\")\":\"\",f=d&&d.filter||c.filter||\"\";c.zoom=1,(b>=1||\"\"===b)&&\"\"===m.trim(f.replace(Mb,\"\"))&&c.removeAttribute&&(c.removeAttribute(\"filter\"),\"\"===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+\" \"+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:\"inline-block\"},Jb,[a,\"marginRight\"]):void 0}),m.each({margin:\"\",padding:\"\",border:\"Width\"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f=\"string\"==typeof c?c.split(\" \"):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return\"boolean\"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||\"swing\",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?\"\":\"px\")\n},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,\"\"),b&&\"auto\"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp(\"^(?:([+-])=|)(\"+S+\")([a-z%]*)$\",\"i\"),cc=/queueHooks$/,dc=[ic],ec={\"*\":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?\"\":\"px\"),g=(m.cssNumber[a]||\"px\"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||\".5\",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d[\"margin\"+c]=d[\"padding\"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec[\"*\"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,\"fxshow\");c.queue||(h=m._queueHooks(a,\"fx\"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,\"fx\").length||h.empty.fire()})})),1===a.nodeType&&(\"height\"in b||\"width\"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,\"display\"),l=\"none\"===j?m._data(a,\"olddisplay\")||Fb(a.nodeName):j,\"inline\"===l&&\"none\"===m.css(a,\"float\")&&(k.inlineBlockNeedsLayout&&\"inline\"!==Fb(a.nodeName)?p.zoom=1:p.display=\"inline-block\")),c.overflow&&(p.overflow=\"hidden\",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||\"toggle\"===e,e===(q?\"hide\":\"show\")){if(\"show\"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))\"inline\"===(\"none\"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?\"hidden\"in r&&(q=r.hidden):r=m._data(a,\"fxshow\",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,\"fxshow\");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start=\"width\"===d||\"height\"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&\"expand\"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=[\"*\"]):a=a.split(\" \");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&\"object\"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:\"number\"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue=\"fx\"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css(\"opacity\",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,\"finish\"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return\"string\"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||\"fx\",[]),this.each(function(){var b=!0,e=null!=a&&a+\"queueHooks\",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||\"fx\"),this.each(function(){var b,c=m._data(this),d=c[a+\"queue\"],e=c[a+\"queueHooks\"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each([\"toggle\",\"show\",\"hide\"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||\"boolean\"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc(\"show\"),slideUp:gc(\"hide\"),slideToggle:gc(\"toggle\"),fadeIn:{opacity:\"show\"},fadeOut:{opacity:\"hide\"},fadeToggle:{opacity:\"toggle\"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||\"fx\",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement(\"div\"),b.setAttribute(\"className\",\"t\"),b.innerHTML=\"  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>\",d=b.getElementsByTagName(\"a\")[0],c=y.createElement(\"select\"),e=c.appendChild(y.createElement(\"option\")),a=b.getElementsByTagName(\"input\")[0],d.style.cssText=\"top:1px\",k.getSetAttribute=\"t\"!==b.className,k.style=/top/.test(d.getAttribute(\"style\")),k.hrefNormalized=\"/a\"===d.getAttribute(\"href\"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement(\"form\").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement(\"input\"),a.setAttribute(\"value\",\"\"),k.input=\"\"===a.getAttribute(\"value\"),a.value=\"t\",a.setAttribute(\"type\",\"radio\"),k.radioValue=\"t\"===a.value}();var lc=/\\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e=\"\":\"number\"==typeof e?e+=\"\":m.isArray(e)&&(e=m.map(e,function(a){return null==a?\"\":a+\"\"})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&\"set\"in b&&void 0!==b.set(this,e,\"value\")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&\"get\"in b&&void 0!==(c=b.get(e,\"value\"))?c:(c=e.value,\"string\"==typeof c?c.replace(lc,\"\"):null==c?\"\":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,\"value\");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f=\"select-one\"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute(\"disabled\"))||c.parentNode.disabled&&m.nodeName(c.parentNode,\"optgroup\"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each([\"radio\",\"checkbox\"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute(\"value\")?\"on\":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&\"get\"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&\"set\"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+\"\"),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase(\"default-\"+c)]=a[d]=!1:m.attr(a,c,\"\"),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&\"radio\"===b&&m.nodeName(a,\"input\")){var c=a.value;return a.setAttribute(\"type\",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase(\"default-\"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase(\"default-\"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,\"input\")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+=\"\",\"value\"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&\"\"!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,\"\"===b?!1:b,c)}},m.each([\"width\",\"height\"],function(a,b){m.attrHooks[b]={set:function(a,c){return\"\"===c?(a.setAttribute(b,\"auto\"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+\"\"}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{\"for\":\"htmlFor\",\"class\":\"className\"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&\"set\"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&\"get\"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,\"tabindex\");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each([\"href\",\"src\"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each([\"tabIndex\",\"readOnly\",\"maxLength\",\"cellSpacing\",\"cellPadding\",\"rowSpan\",\"colSpan\",\"useMap\",\"frameBorder\",\"contentEditable\"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype=\"encoding\");var uc=/[\\t\\r\\n\\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=\"string\"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||\"\").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(\" \"+c.className+\" \").replace(uc,\" \"):\" \")){f=0;while(e=b[f++])d.indexOf(\" \"+e+\" \")<0&&(d+=e+\" \");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||\"string\"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||\"\").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(\" \"+c.className+\" \").replace(uc,\" \"):\"\")){f=0;while(e=b[f++])while(d.indexOf(\" \"+e+\" \")>=0)d=d.replace(\" \"+e+\" \",\" \");g=a?m.trim(d):\"\",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return\"boolean\"==typeof b&&\"string\"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if(\"string\"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||\"boolean\"===c)&&(this.className&&m._data(this,\"__className__\",this.className),this.className=this.className||a===!1?\"\":m._data(this,\"__className__\")||\"\")})},hasClass:function(a){for(var b=\" \"+a+\" \",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(\" \"+this[c].className+\" \").replace(uc,\" \").indexOf(b)>=0)return!0;return!1}}),m.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(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,\"**\"):this.off(b,a||\"**\",c)}});var vc=m.now(),wc=/\\?/,xc=/(,)|(\\[|{)|(}|])|\"(?:[^\"\\\\\\r\\n]|\\\\[\"\\\\\\/bfnrt]|\\\\u[\\da-fA-F]{4})*\"\\s*:?|true|false|null|-?(?!0\\d)\\d+(?:\\.\\d+|)(?:[eE][+-]?\\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+\"\");var c,d=null,e=m.trim(b+\"\");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,\"\")}))?Function(\"return \"+e)():m.error(\"Invalid JSON: \"+b)},m.parseXML=function(b){var c,d;if(!b||\"string\"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,\"text/xml\")):(c=new ActiveXObject(\"Microsoft.XMLDOM\"),c.async=\"false\",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName(\"parsererror\").length||m.error(\"Invalid XML: \"+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \\t]*([^\\r\\n]*)\\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\\/\\//,Gc=/^([\\w.+-]+:)(?:\\/\\/(?:[^\\/?#]*@|)([^\\/?#:]*)(?::(\\d+)|)|)/,Hc={},Ic={},Jc=\"*/\".concat(\"*\");try{zc=location.href}catch(Kc){zc=y.createElement(\"a\"),zc.href=\"\",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){\"string\"!=typeof b&&(c=b,b=\"*\");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])\"+\"===d.charAt(0)?(d=d.slice(1)||\"*\",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return\"string\"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e[\"*\"]&&g(\"*\")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while(\"*\"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader(\"Content-Type\"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+\" \"+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if(\"*\"===f)f=i;else if(\"*\"!==i&&i!==f){if(g=j[i+\" \"+f]||j[\"* \"+f],!g)for(e in j)if(h=e.split(\" \"),h[1]===f&&(g=j[i+\" \"+h[0]]||j[\"* \"+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a[\"throws\"])b=g(b);else try{b=g(b)}catch(l){return{state:\"parsererror\",error:g?l:\"No conversion from \"+i+\" to \"+f}}}return{state:\"success\",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:\"GET\",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:\"application/x-www-form-urlencoded; charset=UTF-8\",accepts:{\"*\":Jc,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\":m.parseJSON,\"text xml\":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){\"object\"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks(\"once memory\"),q=k.statusCode||{},r={},s={},t=0,u=\"canceled\",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+\"\").replace(Ac,\"\").replace(Fc,yc[1]+\"//\"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||\"*\").toLowerCase().match(E)||[\"\"],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||(\"http:\"===c[1]?\"80\":\"443\"))===(yc[3]||(\"http:\"===yc[1]?\"80\":\"443\")))),k.data&&k.processData&&\"string\"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger(\"ajaxStart\"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?\"&\":\"?\")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,\"$1_=\"+vc++):e+(wc.test(e)?\"&\":\"?\")+\"_=\"+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader(\"If-Modified-Since\",m.lastModified[e]),m.etag[e]&&v.setRequestHeader(\"If-None-Match\",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader(\"Content-Type\",k.contentType),v.setRequestHeader(\"Accept\",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+(\"*\"!==k.dataTypes[0]?\", \"+Jc+\"; q=0.01\":\"\"):k.accepts[\"*\"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u=\"abort\";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger(\"ajaxSend\",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort(\"timeout\")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,\"No Transport\");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||\"\",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader(\"Last-Modified\"),w&&(m.lastModified[e]=w),w=v.getResponseHeader(\"etag\"),w&&(m.etag[e]=w)),204===a||\"HEAD\"===k.type?x=\"nocontent\":304===a?x=\"notmodified\":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x=\"error\",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+\"\",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?\"ajaxSuccess\":\"ajaxError\",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger(\"ajaxComplete\",[v,k]),--m.active||m.event.trigger(\"ajaxStop\")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,\"json\")},getScript:function(a,b){return m.get(a,void 0,b,\"script\")}}),m.each([\"get\",\"post\"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each([\"ajaxStart\",\"ajaxStop\",\"ajaxComplete\",\"ajaxError\",\"ajaxSuccess\",\"ajaxSend\"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:\"GET\",dataType:\"script\",async:!1,global:!1,\"throws\":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,\"body\")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&\"none\"===(a.style&&a.style.display||m.css(a,\"display\"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\\[\\]$/,Sc=/\\r?\\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+\"[\"+(\"object\"==typeof e?b:\"\")+\"]\",e,c,d)});else if(c||\"object\"!==m.type(b))d(a,b);else for(e in b)Vc(a+\"[\"+e+\"]\",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?\"\":b,d[d.length]=encodeURIComponent(a)+\"=\"+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join(\"&\").replace(Qc,\"+\")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,\"elements\");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(\":disabled\")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,\"\\r\\n\")}}):{name:b.name,value:c.replace(Sc,\"\\r\\n\")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on(\"unload\",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&\"withCredentials\"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c[\"X-Requested-With\"]||(c[\"X-Requested-With\"]=\"XMLHttpRequest\");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+\"\");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,\"string\"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=\"\"}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject(\"Microsoft.XMLHTTP\")}catch(b){}}m.ajaxSetup({accepts:{script:\"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"},contents:{script:/(?:java|ecma)script/},converters:{\"text script\":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter(\"script\",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type=\"GET\",a.global=!1)}),m.ajaxTransport(\"script\",function(a){if(a.crossDomain){var b,c=y.head||m(\"head\")[0]||y.documentElement;return{send:function(d,e){b=y.createElement(\"script\"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,\"success\"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\\?(?=&|$)|\\?\\?/;m.ajaxSetup({jsonp:\"callback\",jsonpCallback:function(){var a=_c.pop()||m.expando+\"_\"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter(\"json jsonp\",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?\"url\":\"string\"==typeof b.data&&!(b.contentType||\"\").indexOf(\"application/x-www-form-urlencoded\")&&ad.test(b.data)&&\"data\");return h||\"jsonp\"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,\"$1\"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?\"&\":\"?\")+b.jsonp+\"=\"+e),b.converters[\"script json\"]=function(){return g||m.error(e+\" was not called\"),g[0]},b.dataTypes[0]=\"json\",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),\"script\"):void 0}),m.parseHTML=function(a,b,c){if(!a||\"string\"!=typeof a)return null;\"boolean\"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if(\"string\"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(\" \");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&\"object\"==typeof b&&(f=\"POST\"),g.length>0&&m.ajax({url:a,type:f,dataType:\"html\",data:b}).done(function(a){e=arguments,g.html(d?m(\"<div>\").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,\"position\"),l=m(a),n={};\"static\"===k&&(a.style.position=\"relative\"),h=l.offset(),f=m.css(a,\"top\"),i=m.css(a,\"left\"),j=(\"absolute\"===k||\"fixed\"===k)&&m.inArray(\"auto\",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),\"using\"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return\"fixed\"===m.css(d,\"position\")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],\"html\")||(c=a.offset()),c.top+=m.css(a[0],\"borderTopWidth\",!0),c.left+=m.css(a[0],\"borderLeftWidth\",!0)),{top:b.top-c.top-m.css(d,\"marginTop\",!0),left:b.left-c.left-m.css(d,\"marginLeft\",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,\"html\")&&\"static\"===m.css(a,\"position\"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:\"pageXOffset\",scrollTop:\"pageYOffset\"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each([\"top\",\"left\"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+\"px\":c):void 0})}),m.each({Height:\"height\",Width:\"width\"},function(a,b){m.each({padding:\"inner\"+a,content:b,\"\":\"outer\"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||\"boolean\"!=typeof d),g=c||(d===!0||e===!0?\"margin\":\"border\");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement[\"client\"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body[\"scroll\"+a],e[\"scroll\"+a],b.body[\"offset\"+a],e[\"offset\"+a],e[\"client\"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,\"function\"==typeof define&&define.amd&&define(\"jquery\",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});"
  },
  {
    "path": "28-ionic/dailyreads/backend/templates/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <meta name=\"description\" content=\"\">\n    <meta name=\"author\" content=\"\">\n\n    <title>Daily Reads</title>\n\n    <!-- Bootstrap Core CSS -->\n    <link href=\"{{ url_for('static', filename='css/bootstrap.min.css') }}\" rel=\"stylesheet\">\n\n    <!-- Custom CSS -->\n    <link href=\"{{ url_for('static', filename='css/1-col-portfolio.css') }}\" rel=\"stylesheet\">\n\n    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->\n    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->\n    <!--[if lt IE 9]>\n        <script src=\"https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js\"></script>\n        <script src=\"https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js\"></script>\n    <![endif]-->\n\n</head>\n\n<body>\n\n    <!-- Navigation -->\n    <nav class=\"navbar navbar-inverse navbar-fixed-top\" role=\"navigation\">\n        <div class=\"container\">\n            <!-- Brand and toggle get grouped for better mobile display -->\n            <div class=\"navbar-header\">\n                <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\"#bs-example-navbar-collapse-1\">\n                    <span class=\"sr-only\">Toggle navigation</span>\n                    <span class=\"icon-bar\"></span>\n                    <span class=\"icon-bar\"></span>\n                    <span class=\"icon-bar\"></span>\n                </button>\n                <a class=\"navbar-brand\" href=\"/\">DailyReads</a>\n            </div>\n            <!-- Collect the nav links, forms, and other content for toggling -->\n            <div class=\"collapse navbar-collapse\" id=\"bs-example-navbar-collapse-1\">\n                <ul class=\"nav navbar-nav\">\n                </ul>\n            </div>\n            <!-- /.navbar-collapse -->\n        </div>\n        <!-- /.container -->\n    </nav>\n\n    <!-- Page Content -->\n    <div class=\"container\">\n\n        <!-- Page Heading -->\n        <div class=\"row\">\n            <div class=\"col-lg-12\">\n                <h1 class=\"page-header\">Your Reading List\n                    <small>Based on Twitter likes!</small>\n                </h1>\n            </div>\n        </div>\n        <!-- /.row -->\n\n        <!-- Project One -->\n\n        {% for article in articles %}\n            <div class=\"row\">\n            <div class=\"col-md-7\">\n                <a href=\"#\">\n                    <img class=\"img-responsive\" src=\"{{ article.img }}\" alt=\"\">\n                </a>\n            </div>\n            <div class=\"col-md-5\">\n                <h3>{{ article.title }}</h3>\n                <p>{{ article.text }}</p>\n                <a class=\"btn btn-primary\" href=\"{{ article.story_url }}\" target=\"_blank\">Read Full Article <span class=\"glyphicon glyphicon-chevron-right\"></span></a>\n            </div>\n        </div>\n        <hr><hr>\n        {% endfor %}\n\n        <!-- Footer -->\n        <footer>\n            <div class=\"row\">\n                <div class=\"col-lg-12\">\n                    <p>Copyright &copy; Shekhar Gulati 2016</p>\n                </div>\n            </div>\n            <!-- /.row -->\n        </footer>\n\n    </div>\n    <!-- /.container -->\n\n    <!-- jQuery -->\n    <script src=\"{{ url_for('static', filename='js/jquery.js') }}\"></script>\n\n    <!-- Bootstrap Core JavaScript -->\n    <script src=\"{{ url_for('static', filename='js/bootstrap.min.js') }}\"></script>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/.bowerrc",
    "content": "{\n  \"directory\": \"www/lib\"\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/.editorconfig",
    "content": "# http://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = 2\nend_of_line = lf\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n\n[*.md]\ninsert_final_newline = false\ntrim_trailing_whitespace = false"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/.gitignore",
    "content": "# Specifies intentionally untracked files to ignore when using Git\n# http://git-scm.com/docs/gitignore\n\nnode_modules/\nplatforms/\nplugins/\n**/.DS_Store\n.DS_Store\nwww/js\nwww/views\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/README.md",
    "content": "Ionic App Base\n=====================\n\nA starting project for Ionic that optionally supports using custom SCSS.\n\n## Using this project\n\nWe recommend using the [Ionic CLI](https://github.com/driftyco/ionic-cli) to create new Ionic projects that are based on this project but use a ready-made starter template.\n\nFor example, to start a new Ionic project with the default tabs interface, make sure the `ionic` utility is installed:\n\n```bash\n$ npm install -g ionic\n```\n\nThen run: \n\n```bash\n$ ionic start myProject tabs\n```\n\nMore info on this can be found on the Ionic [Getting Started](http://ionicframework.com/getting-started) page and the [Ionic CLI](https://github.com/driftyco/ionic-cli) repo.\n\n## Issues\nIssues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/).  Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/submit-issue/) to the main Ionic repository.\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/bower.json",
    "content": "{\n  \"name\": \"Daily Reads\",\n  \"private\": \"true\",\n  \"devDependencies\": {\n    \"ionic\": \"driftyco/ionic-bower#1.3.1\"\n  },\n  \"dependencies\": {\n    \"babel-polyfill\": \"~0.0.1\"\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/config.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<widget id=\"com.ionicframework.starter\" version=\"0.0.1\" versionCode=\"1\" xmlns=\"http://www.w3.org/ns/widgets\" xmlns:cdv=\"http://cordova.apache.org/ns/1.0\">\n  <name>Daily Reads</name>\n  <description>\n        Lists Twitter likes\n    </description>\n  <author email=\"you@example.com\" href=\"http://example.com.com/\">\n      Your Name Here\n    </author>\n  <content src=\"index.html\"/>\n  <access origin=\"*\"/>\n  <allow-intent href=\"http://*/*\" />\n  <allow-intent href=\"https://*/*\" />\n  <preference name=\"webviewbounce\" value=\"false\"/>\n  <preference name=\"UIWebViewBounce\" value=\"false\"/>\n  <preference name=\"DisallowOverscroll\" value=\"true\"/>\n  <preference name=\"SplashScreenDelay\" value=\"2000\"/>\n  <preference name=\"FadeSplashScreenDuration\" value=\"2000\"/>\n  <preference name=\"android-minSdkVersion\" value=\"16\"/>\n  <preference name=\"BackupWebStorage\" value=\"none\"/>\n  <preference name=\"SplashScreen\" value=\"screen\"/>\n  <feature name=\"StatusBar\">\n    <param name=\"ios-package\" value=\"CDVStatusBar\" onload=\"true\"/>\n  </feature>\n  <platform name=\"android\">\n    <icon src=\"resources/android/icon/drawable-ldpi-icon.png\" density=\"ldpi\"/>\n    <icon src=\"resources/android/icon/drawable-mdpi-icon.png\" density=\"mdpi\"/>\n    <icon src=\"resources/android/icon/drawable-hdpi-icon.png\" density=\"hdpi\"/>\n    <icon src=\"resources/android/icon/drawable-xhdpi-icon.png\" density=\"xhdpi\"/>\n    <icon src=\"resources/android/icon/drawable-xxhdpi-icon.png\" density=\"xxhdpi\"/>\n    <icon src=\"resources/android/icon/drawable-xxxhdpi-icon.png\" density=\"xxxhdpi\"/>\n    <splash src=\"resources/android/splash/drawable-land-ldpi-screen.png\" density=\"land-ldpi\"/>\n    <splash src=\"resources/android/splash/drawable-land-mdpi-screen.png\" density=\"land-mdpi\"/>\n    <splash src=\"resources/android/splash/drawable-land-hdpi-screen.png\" density=\"land-hdpi\"/>\n    <splash src=\"resources/android/splash/drawable-land-xhdpi-screen.png\" density=\"land-xhdpi\"/>\n    <splash src=\"resources/android/splash/drawable-land-xxhdpi-screen.png\" density=\"land-xxhdpi\"/>\n    <splash src=\"resources/android/splash/drawable-land-xxxhdpi-screen.png\" density=\"land-xxxhdpi\"/>\n    <splash src=\"resources/android/splash/drawable-port-ldpi-screen.png\" density=\"port-ldpi\"/>\n    <splash src=\"resources/android/splash/drawable-port-mdpi-screen.png\" density=\"port-mdpi\"/>\n    <splash src=\"resources/android/splash/drawable-port-hdpi-screen.png\" density=\"port-hdpi\"/>\n    <splash src=\"resources/android/splash/drawable-port-xhdpi-screen.png\" density=\"port-xhdpi\"/>\n    <splash src=\"resources/android/splash/drawable-port-xxhdpi-screen.png\" density=\"port-xxhdpi\"/>\n    <splash src=\"resources/android/splash/drawable-port-xxxhdpi-screen.png\" density=\"port-xxxhdpi\"/>\n  </platform>\n</widget>\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/gulpfile.js",
    "content": "var gulp = require('gulp');\nvar gutil = require('gulp-util');\nvar bower = require('bower');\nvar concat = require('gulp-concat');\nvar sass = require('gulp-sass');\nvar minifyCss = require('gulp-minify-css');\nvar rename = require('gulp-rename');\nvar sh = require('shelljs');\nconst babel = require('gulp-babel');\n\nvar paths = {\n  es6: ['./src/js/*.js'],\n  views: ['./src/views/**'],\n  sass: ['./scss/**/*.scss']\n};\n\ngulp.task('default', ['babel',\"html\",'sass']);\n\ngulp.task('sass', function(done) {\n  gulp.src('./scss/ionic.app.scss')\n    .pipe(sass())\n    .on('error', sass.logError)\n    .pipe(gulp.dest('./www/css/'))\n    .pipe(minifyCss({\n      keepSpecialComments: 0\n    }))\n    .pipe(rename({ extname: '.min.css' }))\n    .pipe(gulp.dest('./www/css/'))\n    .on('end', done);\n});\n\ngulp.task(\"babel\", function () {\n  return gulp.src(paths.es6)\n    .pipe(babel({presets: ['es2015']}))\n    .pipe(gulp.dest(\"www/js\"));\n});\n\ngulp.task(\"views\", function () {\n  return gulp.src(paths.views)\n    .pipe(gulp.dest(\"www/views\"));\n});\n\ngulp.task('watch', function() {\n  gulp.watch(paths.es6, ['babel']);\n  gulp.watch(paths.views, ['views']);\n  gulp.watch(paths.sass, ['sass']);\n});\n\ngulp.task('install', ['git-check'], function() {\n  return bower.commands.install()\n    .on('log', function(data) {\n      gutil.log('bower', gutil.colors.cyan(data.id), data.message);\n    });\n});\n\ngulp.task('git-check', function(done) {\n  if (!sh.which('git')) {\n    console.log(\n      '  ' + gutil.colors.red('Git is not installed.'),\n      '\\n  Git, the version control system, is required to download Ionic.',\n      '\\n  Download git here:', gutil.colors.cyan('http://git-scm.com/downloads') + '.',\n      '\\n  Once git is installed, run \\'' + gutil.colors.cyan('gulp install') + '\\' again.'\n    );\n    process.exit(1);\n  }\n  done();\n});\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/hooks/README.md",
    "content": "<!--\n#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n#  KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n#\n-->\n# Cordova Hooks\n\nThis directory may contain scripts used to customize cordova commands. This\ndirectory used to exist at `.cordova/hooks`, but has now been moved to the\nproject root. Any scripts you add to these directories will be executed before\nand after the commands corresponding to the directory name. Useful for\nintegrating your own build systems or integrating with version control systems.\n\n__Remember__: Make your scripts executable.\n\n## Hook Directories\nThe following subdirectories will be used for hooks:\n\n    after_build/\n    after_compile/\n    after_docs/\n    after_emulate/\n    after_platform_add/\n    after_platform_rm/\n    after_platform_ls/\n    after_plugin_add/\n    after_plugin_ls/\n    after_plugin_rm/\n    after_plugin_search/\n    after_prepare/\n    after_run/\n    after_serve/\n    before_build/\n    before_compile/\n    before_docs/\n    before_emulate/\n    before_platform_add/\n    before_platform_rm/\n    before_platform_ls/\n    before_plugin_add/\n    before_plugin_ls/\n    before_plugin_rm/\n    before_plugin_search/\n    before_prepare/\n    before_run/\n    before_serve/\n    pre_package/ <-- Windows 8 and Windows Phone only.\n\n## Script Interface\n\nAll scripts are run from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables:\n\n* CORDOVA_VERSION - The version of the Cordova-CLI.\n* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios).\n* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer)\n* CORDOVA_HOOK - Path to the hook that is being executed.\n* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate)\n\nIf a script returns a non-zero exit code, then the parent cordova command will be aborted.\n\n\n## Writing hooks\n\nWe highly recommend writting your hooks using Node.js so that they are\ncross-platform. Some good examples are shown here:\n\n[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/)\n\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/hooks/after_prepare/010_add_platform_class.js",
    "content": "#!/usr/bin/env node\n\n// Add Platform Class\n// v1.0\n// Automatically adds the platform class to the body tag\n// after the `prepare` command. By placing the platform CSS classes\n// directly in the HTML built for the platform, it speeds up\n// rendering the correct layout/style for the specific platform\n// instead of waiting for the JS to figure out the correct classes.\n\nvar fs = require('fs');\nvar path = require('path');\n\nvar rootdir = process.argv[2];\n\nfunction addPlatformBodyTag(indexPath, platform) {\n  // add the platform class to the body tag\n  try {\n    var platformClass = 'platform-' + platform;\n    var cordovaClass = 'platform-cordova platform-webview';\n\n    var html = fs.readFileSync(indexPath, 'utf8');\n\n    var bodyTag = findBodyTag(html);\n    if(!bodyTag) return; // no opening body tag, something's wrong\n\n    if(bodyTag.indexOf(platformClass) > -1) return; // already added\n\n    var newBodyTag = bodyTag;\n\n    var classAttr = findClassAttr(bodyTag);\n    if(classAttr) {\n      // body tag has existing class attribute, add the classname\n      var endingQuote = classAttr.substring(classAttr.length-1);\n      var newClassAttr = classAttr.substring(0, classAttr.length-1);\n      newClassAttr += ' ' + platformClass + ' ' + cordovaClass + endingQuote;\n      newBodyTag = bodyTag.replace(classAttr, newClassAttr);\n\n    } else {\n      // add class attribute to the body tag\n      newBodyTag = bodyTag.replace('>', ' class=\"' + platformClass + ' ' + cordovaClass + '\">');\n    }\n\n    html = html.replace(bodyTag, newBodyTag);\n\n    fs.writeFileSync(indexPath, html, 'utf8');\n\n    process.stdout.write('add to body class: ' + platformClass + '\\n');\n  } catch(e) {\n    process.stdout.write(e);\n  }\n}\n\nfunction findBodyTag(html) {\n  // get the body tag\n  try{\n    return html.match(/<body(?=[\\s>])(.*?)>/gi)[0];\n  }catch(e){}\n}\n\nfunction findClassAttr(bodyTag) {\n  // get the body tag's class attribute\n  try{\n    return bodyTag.match(/ class=[\"|'](.*?)[\"|']/gi)[0];\n  }catch(e){}\n}\n\nif (rootdir) {\n\n  // go through each of the platform directories that have been prepared\n  var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);\n\n  for(var x=0; x<platforms.length; x++) {\n    // open up the index.html file at the www root\n    try {\n      var platform = platforms[x].trim().toLowerCase();\n      var indexPath;\n\n      if(platform == 'android') {\n        indexPath = path.join('platforms', platform, 'assets', 'www', 'index.html');\n      } else {\n        indexPath = path.join('platforms', platform, 'www', 'index.html');\n      }\n\n      if(fs.existsSync(indexPath)) {\n        addPlatformBodyTag(indexPath, platform);\n      }\n\n    } catch(e) {\n      process.stdout.write(e);\n    }\n  }\n\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/ionic.project",
    "content": "{\n  \"name\": \"DailyReadsApp\",\n  \"app_id\": \"\",\n  \"gulpDependantTasks\": [\"views\", \"babel\"],\n  \"gulpStartupTasks\": [\"watch\"]\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/package.json",
    "content": "{\n  \"name\": \"DailyReads\",\n  \"version\": \"1.0.0\",\n  \"description\": \"Lists Twitter likes\",\n  \"dependencies\": {\n    \"babel-preset-es2015\": \"^6.9.0\",\n    \"gulp\": \"^3.5.6\",\n    \"gulp-babel\": \"^6.1.2\",\n    \"gulp-concat\": \"^2.2.0\",\n    \"gulp-minify-css\": \"^0.3.0\",\n    \"gulp-rename\": \"^1.2.0\",\n    \"gulp-sass\": \"^2.0.4\"\n  },\n  \"devDependencies\": {\n    \"bower\": \"^1.7.9\",\n    \"gulp-util\": \"^2.2.14\",\n    \"shelljs\": \"^0.3.0\"\n  },\n  \"cordovaPlugins\": [\n    \"cordova-plugin-device\",\n    \"cordova-plugin-console\",\n    \"cordova-plugin-whitelist\",\n    \"cordova-plugin-splashscreen\",\n    \"cordova-plugin-statusbar\",\n    \"ionic-plugin-keyboard\"\n  ],\n  \"cordovaPlatforms\": [\n    \"android\"\n  ]\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/scss/ionic.app.scss",
    "content": "/*\nTo customize the look and feel of Ionic, you can override the variables\nin ionic's _variables.scss file.\n\nFor example, you might change some of the default colors:\n\n$light:                           #fff !default;\n$stable:                          #f8f8f8 !default;\n$positive:                        #387ef5 !default;\n$calm:                            #11c1f3 !default;\n$balanced:                        #33cd5f !default;\n$energized:                       #ffc900 !default;\n$assertive:                       #ef473a !default;\n$royal:                           #886aea !default;\n$dark:                            #444 !default;\n*/\n\n// The path for our ionicons font files, relative to the built CSS in www/css\n$ionicons-font-path: \"../lib/ionic/fonts\" !default;\n\n// Include all of Ionic\n@import \"www/lib/ionic/scss/ionic\";\n\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/src/js/app.js",
    "content": "// Ionic Starter App\n\n// angular.module is a global place for creating, registering and retrieving Angular modules\n// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)\n// the 2nd parameter is an array of 'requires'\nangular.module('dailyReads', ['ionic'])\n\n.run(($ionicPlatform) => {\n  $ionicPlatform.ready(() => {\n    if(window.cordova && window.cordova.plugins.Keyboard) {\n      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard\n      // for form inputs)\n      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);\n\n      // Don't remove this line unless you know what you are doing. It stops the viewport\n      // from snapping when text inputs are focused. Ionic handles this internally for\n      // a much nicer keyboard experience.\n      cordova.plugins.Keyboard.disableScroll(true);\n    }\n    if(window.StatusBar) {\n      StatusBar.styleDefault();\n    }\n  });\n})\n\n.config(($stateProvider,$urlRouterProvider) => {\n  $stateProvider.state(\"home\",{\n    cache: false,\n    url :'/home',\n    controller :'HomeController',\n    templateUrl : 'views/home/home.html'\n  });\n\n  $urlRouterProvider.otherwise('/home');\n})\n\n.controller('HomeController',($scope,$http) => {\n  $scope.news = []\n  $scope.reloadFavs = function(){\n    $http.get(\"http://localhost:5000/api/\")\n          .success(function(data){\n            $scope.news = data;\n            $scope.$broadcast('scroll.refreshComplete');\n         }).error(function(data, status, headers, config){\n           console.log('oops error occured while refreshing data',JSON.stringify(data));\n            $scope.$broadcast('scroll.refreshComplete');\n         });\n  }\n\n  $scope.reloadFavs();\n})\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/src/views/home/home.html",
    "content": "<ion-view view-title=\"Home\">\n  <ion-content>\n    <ion-refresher pulling-text=\"Pull to refresh...\" on-refresh=\"reloadFavs()\">\n    </ion-refresher>\n    <div class=\"list card\" ng-repeat=\"newsInfo in news track by $index\">\n      <div class=\"item item-body\">\n         <img src=\"{{newsInfo.img}}\">\n         <p>\n           {{ newsInfo.text }}\n         </p>\n       </div>\n    </div>\n  </<ion-content>  \n</ion-view>\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/README.md",
    "content": "This is an addon starter template for the [Ionic Framework](http://ionicframework.com/).\n\n## How to use this template\n\n*This template does not work on its own*. It is missing the Ionic library, and AngularJS.\n\nTo use this, either create a new ionic project using the ionic node.js utility, or copy and paste this into an existing Cordova project and download a release of Ionic separately.\n\n### With the Ionic tool:\n\nTake the name after `ionic-starter-`, and that is the name of the template to be used when using the `ionic start` command below:\n\n```bash\n$ sudo npm install -g ionic cordova\n$ ionic start myApp blank\n```\n\nThen, to run it, cd into `myApp` and run:\n\n```bash\n$ ionic platform add ios\n$ ionic build ios\n$ ionic emulate ios\n```\n\nSubstitute ios for android if not on a Mac, but if you can, the ios development toolchain is a lot easier to work with until you need to do anything custom to Android.\n\n## Demo\nhttp://plnkr.co/edit/tpl:IUU30p?p=preview\n\n## Issues\nIssues have been disabled on this repo, if you do find an issue or have a question consider posting it on the [Ionic Forum](http://forum.ionicframework.com/).  Or else if there is truly an error, follow our guidelines for [submitting an issue](http://ionicframework.com/contribute/#issues) to the main Ionic repository. On the other hand, pull requests are welcome here!\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/css/ionic.app.css",
    "content": "@charset \"UTF-8\";\n/*\nTo customize the look and feel of Ionic, you can override the variables\nin ionic's _variables.scss file.\n\nFor example, you might change some of the default colors:\n\n$light:                           #fff !default;\n$stable:                          #f8f8f8 !default;\n$positive:                        #387ef5 !default;\n$calm:                            #11c1f3 !default;\n$balanced:                        #33cd5f !default;\n$energized:                       #ffc900 !default;\n$assertive:                       #ef473a !default;\n$royal:                           #886aea !default;\n$dark:                            #444 !default;\n*/\n/*!\n  Ionicons, v2.0.1\n  Created by Ben Sperry for the Ionic Framework, http://ionicons.com/\n  https://twitter.com/benjsperry  https://twitter.com/ionicframework\n  MIT License: https://github.com/driftyco/ionicons\n\n  Android-style icons originally built by Google’s\n  Material Design Icons: https://github.com/google/material-design-icons\n  used under CC BY http://creativecommons.org/licenses/by/4.0/\n  Modified icons to fit ionicon’s grid from original.\n*/\n@font-face {\n  font-family: \"Ionicons\";\n  src: url(\"../lib/ionic/fonts/ionicons.eot?v=2.0.1\");\n  src: url(\"../lib/ionic/fonts/ionicons.eot?v=2.0.1#iefix\") format(\"embedded-opentype\"), url(\"../lib/ionic/fonts/ionicons.ttf?v=2.0.1\") format(\"truetype\"), url(\"../lib/ionic/fonts/ionicons.woff?v=2.0.1\") format(\"woff\"), url(\"../lib/ionic/fonts/ionicons.woff\") format(\"woff\"), url(\"../lib/ionic/fonts/ionicons.svg?v=2.0.1#Ionicons\") format(\"svg\");\n  font-weight: normal;\n  font-style: normal; }\n\n.ion, .ionicons,\n.ion-alert:before,\n.ion-alert-circled:before,\n.ion-android-add:before,\n.ion-android-add-circle:before,\n.ion-android-alarm-clock:before,\n.ion-android-alert:before,\n.ion-android-apps:before,\n.ion-android-archive:before,\n.ion-android-arrow-back:before,\n.ion-android-arrow-down:before,\n.ion-android-arrow-dropdown:before,\n.ion-android-arrow-dropdown-circle:before,\n.ion-android-arrow-dropleft:before,\n.ion-android-arrow-dropleft-circle:before,\n.ion-android-arrow-dropright:before,\n.ion-android-arrow-dropright-circle:before,\n.ion-android-arrow-dropup:before,\n.ion-android-arrow-dropup-circle:before,\n.ion-android-arrow-forward:before,\n.ion-android-arrow-up:before,\n.ion-android-attach:before,\n.ion-android-bar:before,\n.ion-android-bicycle:before,\n.ion-android-boat:before,\n.ion-android-bookmark:before,\n.ion-android-bulb:before,\n.ion-android-bus:before,\n.ion-android-calendar:before,\n.ion-android-call:before,\n.ion-android-camera:before,\n.ion-android-cancel:before,\n.ion-android-car:before,\n.ion-android-cart:before,\n.ion-android-chat:before,\n.ion-android-checkbox:before,\n.ion-android-checkbox-blank:before,\n.ion-android-checkbox-outline:before,\n.ion-android-checkbox-outline-blank:before,\n.ion-android-checkmark-circle:before,\n.ion-android-clipboard:before,\n.ion-android-close:before,\n.ion-android-cloud:before,\n.ion-android-cloud-circle:before,\n.ion-android-cloud-done:before,\n.ion-android-cloud-outline:before,\n.ion-android-color-palette:before,\n.ion-android-compass:before,\n.ion-android-contact:before,\n.ion-android-contacts:before,\n.ion-android-contract:before,\n.ion-android-create:before,\n.ion-android-delete:before,\n.ion-android-desktop:before,\n.ion-android-document:before,\n.ion-android-done:before,\n.ion-android-done-all:before,\n.ion-android-download:before,\n.ion-android-drafts:before,\n.ion-android-exit:before,\n.ion-android-expand:before,\n.ion-android-favorite:before,\n.ion-android-favorite-outline:before,\n.ion-android-film:before,\n.ion-android-folder:before,\n.ion-android-folder-open:before,\n.ion-android-funnel:before,\n.ion-android-globe:before,\n.ion-android-hand:before,\n.ion-android-hangout:before,\n.ion-android-happy:before,\n.ion-android-home:before,\n.ion-android-image:before,\n.ion-android-laptop:before,\n.ion-android-list:before,\n.ion-android-locate:before,\n.ion-android-lock:before,\n.ion-android-mail:before,\n.ion-android-map:before,\n.ion-android-menu:before,\n.ion-android-microphone:before,\n.ion-android-microphone-off:before,\n.ion-android-more-horizontal:before,\n.ion-android-more-vertical:before,\n.ion-android-navigate:before,\n.ion-android-notifications:before,\n.ion-android-notifications-none:before,\n.ion-android-notifications-off:before,\n.ion-android-open:before,\n.ion-android-options:before,\n.ion-android-people:before,\n.ion-android-person:before,\n.ion-android-person-add:before,\n.ion-android-phone-landscape:before,\n.ion-android-phone-portrait:before,\n.ion-android-pin:before,\n.ion-android-plane:before,\n.ion-android-playstore:before,\n.ion-android-print:before,\n.ion-android-radio-button-off:before,\n.ion-android-radio-button-on:before,\n.ion-android-refresh:before,\n.ion-android-remove:before,\n.ion-android-remove-circle:before,\n.ion-android-restaurant:before,\n.ion-android-sad:before,\n.ion-android-search:before,\n.ion-android-send:before,\n.ion-android-settings:before,\n.ion-android-share:before,\n.ion-android-share-alt:before,\n.ion-android-star:before,\n.ion-android-star-half:before,\n.ion-android-star-outline:before,\n.ion-android-stopwatch:before,\n.ion-android-subway:before,\n.ion-android-sunny:before,\n.ion-android-sync:before,\n.ion-android-textsms:before,\n.ion-android-time:before,\n.ion-android-train:before,\n.ion-android-unlock:before,\n.ion-android-upload:before,\n.ion-android-volume-down:before,\n.ion-android-volume-mute:before,\n.ion-android-volume-off:before,\n.ion-android-volume-up:before,\n.ion-android-walk:before,\n.ion-android-warning:before,\n.ion-android-watch:before,\n.ion-android-wifi:before,\n.ion-aperture:before,\n.ion-archive:before,\n.ion-arrow-down-a:before,\n.ion-arrow-down-b:before,\n.ion-arrow-down-c:before,\n.ion-arrow-expand:before,\n.ion-arrow-graph-down-left:before,\n.ion-arrow-graph-down-right:before,\n.ion-arrow-graph-up-left:before,\n.ion-arrow-graph-up-right:before,\n.ion-arrow-left-a:before,\n.ion-arrow-left-b:before,\n.ion-arrow-left-c:before,\n.ion-arrow-move:before,\n.ion-arrow-resize:before,\n.ion-arrow-return-left:before,\n.ion-arrow-return-right:before,\n.ion-arrow-right-a:before,\n.ion-arrow-right-b:before,\n.ion-arrow-right-c:before,\n.ion-arrow-shrink:before,\n.ion-arrow-swap:before,\n.ion-arrow-up-a:before,\n.ion-arrow-up-b:before,\n.ion-arrow-up-c:before,\n.ion-asterisk:before,\n.ion-at:before,\n.ion-backspace:before,\n.ion-backspace-outline:before,\n.ion-bag:before,\n.ion-battery-charging:before,\n.ion-battery-empty:before,\n.ion-battery-full:before,\n.ion-battery-half:before,\n.ion-battery-low:before,\n.ion-beaker:before,\n.ion-beer:before,\n.ion-bluetooth:before,\n.ion-bonfire:before,\n.ion-bookmark:before,\n.ion-bowtie:before,\n.ion-briefcase:before,\n.ion-bug:before,\n.ion-calculator:before,\n.ion-calendar:before,\n.ion-camera:before,\n.ion-card:before,\n.ion-cash:before,\n.ion-chatbox:before,\n.ion-chatbox-working:before,\n.ion-chatboxes:before,\n.ion-chatbubble:before,\n.ion-chatbubble-working:before,\n.ion-chatbubbles:before,\n.ion-checkmark:before,\n.ion-checkmark-circled:before,\n.ion-checkmark-round:before,\n.ion-chevron-down:before,\n.ion-chevron-left:before,\n.ion-chevron-right:before,\n.ion-chevron-up:before,\n.ion-clipboard:before,\n.ion-clock:before,\n.ion-close:before,\n.ion-close-circled:before,\n.ion-close-round:before,\n.ion-closed-captioning:before,\n.ion-cloud:before,\n.ion-code:before,\n.ion-code-download:before,\n.ion-code-working:before,\n.ion-coffee:before,\n.ion-compass:before,\n.ion-compose:before,\n.ion-connection-bars:before,\n.ion-contrast:before,\n.ion-crop:before,\n.ion-cube:before,\n.ion-disc:before,\n.ion-document:before,\n.ion-document-text:before,\n.ion-drag:before,\n.ion-earth:before,\n.ion-easel:before,\n.ion-edit:before,\n.ion-egg:before,\n.ion-eject:before,\n.ion-email:before,\n.ion-email-unread:before,\n.ion-erlenmeyer-flask:before,\n.ion-erlenmeyer-flask-bubbles:before,\n.ion-eye:before,\n.ion-eye-disabled:before,\n.ion-female:before,\n.ion-filing:before,\n.ion-film-marker:before,\n.ion-fireball:before,\n.ion-flag:before,\n.ion-flame:before,\n.ion-flash:before,\n.ion-flash-off:before,\n.ion-folder:before,\n.ion-fork:before,\n.ion-fork-repo:before,\n.ion-forward:before,\n.ion-funnel:before,\n.ion-gear-a:before,\n.ion-gear-b:before,\n.ion-grid:before,\n.ion-hammer:before,\n.ion-happy:before,\n.ion-happy-outline:before,\n.ion-headphone:before,\n.ion-heart:before,\n.ion-heart-broken:before,\n.ion-help:before,\n.ion-help-buoy:before,\n.ion-help-circled:before,\n.ion-home:before,\n.ion-icecream:before,\n.ion-image:before,\n.ion-images:before,\n.ion-information:before,\n.ion-information-circled:before,\n.ion-ionic:before,\n.ion-ios-alarm:before,\n.ion-ios-alarm-outline:before,\n.ion-ios-albums:before,\n.ion-ios-albums-outline:before,\n.ion-ios-americanfootball:before,\n.ion-ios-americanfootball-outline:before,\n.ion-ios-analytics:before,\n.ion-ios-analytics-outline:before,\n.ion-ios-arrow-back:before,\n.ion-ios-arrow-down:before,\n.ion-ios-arrow-forward:before,\n.ion-ios-arrow-left:before,\n.ion-ios-arrow-right:before,\n.ion-ios-arrow-thin-down:before,\n.ion-ios-arrow-thin-left:before,\n.ion-ios-arrow-thin-right:before,\n.ion-ios-arrow-thin-up:before,\n.ion-ios-arrow-up:before,\n.ion-ios-at:before,\n.ion-ios-at-outline:before,\n.ion-ios-barcode:before,\n.ion-ios-barcode-outline:before,\n.ion-ios-baseball:before,\n.ion-ios-baseball-outline:before,\n.ion-ios-basketball:before,\n.ion-ios-basketball-outline:before,\n.ion-ios-bell:before,\n.ion-ios-bell-outline:before,\n.ion-ios-body:before,\n.ion-ios-body-outline:before,\n.ion-ios-bolt:before,\n.ion-ios-bolt-outline:before,\n.ion-ios-book:before,\n.ion-ios-book-outline:before,\n.ion-ios-bookmarks:before,\n.ion-ios-bookmarks-outline:before,\n.ion-ios-box:before,\n.ion-ios-box-outline:before,\n.ion-ios-briefcase:before,\n.ion-ios-briefcase-outline:before,\n.ion-ios-browsers:before,\n.ion-ios-browsers-outline:before,\n.ion-ios-calculator:before,\n.ion-ios-calculator-outline:before,\n.ion-ios-calendar:before,\n.ion-ios-calendar-outline:before,\n.ion-ios-camera:before,\n.ion-ios-camera-outline:before,\n.ion-ios-cart:before,\n.ion-ios-cart-outline:before,\n.ion-ios-chatboxes:before,\n.ion-ios-chatboxes-outline:before,\n.ion-ios-chatbubble:before,\n.ion-ios-chatbubble-outline:before,\n.ion-ios-checkmark:before,\n.ion-ios-checkmark-empty:before,\n.ion-ios-checkmark-outline:before,\n.ion-ios-circle-filled:before,\n.ion-ios-circle-outline:before,\n.ion-ios-clock:before,\n.ion-ios-clock-outline:before,\n.ion-ios-close:before,\n.ion-ios-close-empty:before,\n.ion-ios-close-outline:before,\n.ion-ios-cloud:before,\n.ion-ios-cloud-download:before,\n.ion-ios-cloud-download-outline:before,\n.ion-ios-cloud-outline:before,\n.ion-ios-cloud-upload:before,\n.ion-ios-cloud-upload-outline:before,\n.ion-ios-cloudy:before,\n.ion-ios-cloudy-night:before,\n.ion-ios-cloudy-night-outline:before,\n.ion-ios-cloudy-outline:before,\n.ion-ios-cog:before,\n.ion-ios-cog-outline:before,\n.ion-ios-color-filter:before,\n.ion-ios-color-filter-outline:before,\n.ion-ios-color-wand:before,\n.ion-ios-color-wand-outline:before,\n.ion-ios-compose:before,\n.ion-ios-compose-outline:before,\n.ion-ios-contact:before,\n.ion-ios-contact-outline:before,\n.ion-ios-copy:before,\n.ion-ios-copy-outline:before,\n.ion-ios-crop:before,\n.ion-ios-crop-strong:before,\n.ion-ios-download:before,\n.ion-ios-download-outline:before,\n.ion-ios-drag:before,\n.ion-ios-email:before,\n.ion-ios-email-outline:before,\n.ion-ios-eye:before,\n.ion-ios-eye-outline:before,\n.ion-ios-fastforward:before,\n.ion-ios-fastforward-outline:before,\n.ion-ios-filing:before,\n.ion-ios-filing-outline:before,\n.ion-ios-film:before,\n.ion-ios-film-outline:before,\n.ion-ios-flag:before,\n.ion-ios-flag-outline:before,\n.ion-ios-flame:before,\n.ion-ios-flame-outline:before,\n.ion-ios-flask:before,\n.ion-ios-flask-outline:before,\n.ion-ios-flower:before,\n.ion-ios-flower-outline:before,\n.ion-ios-folder:before,\n.ion-ios-folder-outline:before,\n.ion-ios-football:before,\n.ion-ios-football-outline:before,\n.ion-ios-game-controller-a:before,\n.ion-ios-game-controller-a-outline:before,\n.ion-ios-game-controller-b:before,\n.ion-ios-game-controller-b-outline:before,\n.ion-ios-gear:before,\n.ion-ios-gear-outline:before,\n.ion-ios-glasses:before,\n.ion-ios-glasses-outline:before,\n.ion-ios-grid-view:before,\n.ion-ios-grid-view-outline:before,\n.ion-ios-heart:before,\n.ion-ios-heart-outline:before,\n.ion-ios-help:before,\n.ion-ios-help-empty:before,\n.ion-ios-help-outline:before,\n.ion-ios-home:before,\n.ion-ios-home-outline:before,\n.ion-ios-infinite:before,\n.ion-ios-infinite-outline:before,\n.ion-ios-information:before,\n.ion-ios-information-empty:before,\n.ion-ios-information-outline:before,\n.ion-ios-ionic-outline:before,\n.ion-ios-keypad:before,\n.ion-ios-keypad-outline:before,\n.ion-ios-lightbulb:before,\n.ion-ios-lightbulb-outline:before,\n.ion-ios-list:before,\n.ion-ios-list-outline:before,\n.ion-ios-location:before,\n.ion-ios-location-outline:before,\n.ion-ios-locked:before,\n.ion-ios-locked-outline:before,\n.ion-ios-loop:before,\n.ion-ios-loop-strong:before,\n.ion-ios-medical:before,\n.ion-ios-medical-outline:before,\n.ion-ios-medkit:before,\n.ion-ios-medkit-outline:before,\n.ion-ios-mic:before,\n.ion-ios-mic-off:before,\n.ion-ios-mic-outline:before,\n.ion-ios-minus:before,\n.ion-ios-minus-empty:before,\n.ion-ios-minus-outline:before,\n.ion-ios-monitor:before,\n.ion-ios-monitor-outline:before,\n.ion-ios-moon:before,\n.ion-ios-moon-outline:before,\n.ion-ios-more:before,\n.ion-ios-more-outline:before,\n.ion-ios-musical-note:before,\n.ion-ios-musical-notes:before,\n.ion-ios-navigate:before,\n.ion-ios-navigate-outline:before,\n.ion-ios-nutrition:before,\n.ion-ios-nutrition-outline:before,\n.ion-ios-paper:before,\n.ion-ios-paper-outline:before,\n.ion-ios-paperplane:before,\n.ion-ios-paperplane-outline:before,\n.ion-ios-partlysunny:before,\n.ion-ios-partlysunny-outline:before,\n.ion-ios-pause:before,\n.ion-ios-pause-outline:before,\n.ion-ios-paw:before,\n.ion-ios-paw-outline:before,\n.ion-ios-people:before,\n.ion-ios-people-outline:before,\n.ion-ios-person:before,\n.ion-ios-person-outline:before,\n.ion-ios-personadd:before,\n.ion-ios-personadd-outline:before,\n.ion-ios-photos:before,\n.ion-ios-photos-outline:before,\n.ion-ios-pie:before,\n.ion-ios-pie-outline:before,\n.ion-ios-pint:before,\n.ion-ios-pint-outline:before,\n.ion-ios-play:before,\n.ion-ios-play-outline:before,\n.ion-ios-plus:before,\n.ion-ios-plus-empty:before,\n.ion-ios-plus-outline:before,\n.ion-ios-pricetag:before,\n.ion-ios-pricetag-outline:before,\n.ion-ios-pricetags:before,\n.ion-ios-pricetags-outline:before,\n.ion-ios-printer:before,\n.ion-ios-printer-outline:before,\n.ion-ios-pulse:before,\n.ion-ios-pulse-strong:before,\n.ion-ios-rainy:before,\n.ion-ios-rainy-outline:before,\n.ion-ios-recording:before,\n.ion-ios-recording-outline:before,\n.ion-ios-redo:before,\n.ion-ios-redo-outline:before,\n.ion-ios-refresh:before,\n.ion-ios-refresh-empty:before,\n.ion-ios-refresh-outline:before,\n.ion-ios-reload:before,\n.ion-ios-reverse-camera:before,\n.ion-ios-reverse-camera-outline:before,\n.ion-ios-rewind:before,\n.ion-ios-rewind-outline:before,\n.ion-ios-rose:before,\n.ion-ios-rose-outline:before,\n.ion-ios-search:before,\n.ion-ios-search-strong:before,\n.ion-ios-settings:before,\n.ion-ios-settings-strong:before,\n.ion-ios-shuffle:before,\n.ion-ios-shuffle-strong:before,\n.ion-ios-skipbackward:before,\n.ion-ios-skipbackward-outline:before,\n.ion-ios-skipforward:before,\n.ion-ios-skipforward-outline:before,\n.ion-ios-snowy:before,\n.ion-ios-speedometer:before,\n.ion-ios-speedometer-outline:before,\n.ion-ios-star:before,\n.ion-ios-star-half:before,\n.ion-ios-star-outline:before,\n.ion-ios-stopwatch:before,\n.ion-ios-stopwatch-outline:before,\n.ion-ios-sunny:before,\n.ion-ios-sunny-outline:before,\n.ion-ios-telephone:before,\n.ion-ios-telephone-outline:before,\n.ion-ios-tennisball:before,\n.ion-ios-tennisball-outline:before,\n.ion-ios-thunderstorm:before,\n.ion-ios-thunderstorm-outline:before,\n.ion-ios-time:before,\n.ion-ios-time-outline:before,\n.ion-ios-timer:before,\n.ion-ios-timer-outline:before,\n.ion-ios-toggle:before,\n.ion-ios-toggle-outline:before,\n.ion-ios-trash:before,\n.ion-ios-trash-outline:before,\n.ion-ios-undo:before,\n.ion-ios-undo-outline:before,\n.ion-ios-unlocked:before,\n.ion-ios-unlocked-outline:before,\n.ion-ios-upload:before,\n.ion-ios-upload-outline:before,\n.ion-ios-videocam:before,\n.ion-ios-videocam-outline:before,\n.ion-ios-volume-high:before,\n.ion-ios-volume-low:before,\n.ion-ios-wineglass:before,\n.ion-ios-wineglass-outline:before,\n.ion-ios-world:before,\n.ion-ios-world-outline:before,\n.ion-ipad:before,\n.ion-iphone:before,\n.ion-ipod:before,\n.ion-jet:before,\n.ion-key:before,\n.ion-knife:before,\n.ion-laptop:before,\n.ion-leaf:before,\n.ion-levels:before,\n.ion-lightbulb:before,\n.ion-link:before,\n.ion-load-a:before,\n.ion-load-b:before,\n.ion-load-c:before,\n.ion-load-d:before,\n.ion-location:before,\n.ion-lock-combination:before,\n.ion-locked:before,\n.ion-log-in:before,\n.ion-log-out:before,\n.ion-loop:before,\n.ion-magnet:before,\n.ion-male:before,\n.ion-man:before,\n.ion-map:before,\n.ion-medkit:before,\n.ion-merge:before,\n.ion-mic-a:before,\n.ion-mic-b:before,\n.ion-mic-c:before,\n.ion-minus:before,\n.ion-minus-circled:before,\n.ion-minus-round:before,\n.ion-model-s:before,\n.ion-monitor:before,\n.ion-more:before,\n.ion-mouse:before,\n.ion-music-note:before,\n.ion-navicon:before,\n.ion-navicon-round:before,\n.ion-navigate:before,\n.ion-network:before,\n.ion-no-smoking:before,\n.ion-nuclear:before,\n.ion-outlet:before,\n.ion-paintbrush:before,\n.ion-paintbucket:before,\n.ion-paper-airplane:before,\n.ion-paperclip:before,\n.ion-pause:before,\n.ion-person:before,\n.ion-person-add:before,\n.ion-person-stalker:before,\n.ion-pie-graph:before,\n.ion-pin:before,\n.ion-pinpoint:before,\n.ion-pizza:before,\n.ion-plane:before,\n.ion-planet:before,\n.ion-play:before,\n.ion-playstation:before,\n.ion-plus:before,\n.ion-plus-circled:before,\n.ion-plus-round:before,\n.ion-podium:before,\n.ion-pound:before,\n.ion-power:before,\n.ion-pricetag:before,\n.ion-pricetags:before,\n.ion-printer:before,\n.ion-pull-request:before,\n.ion-qr-scanner:before,\n.ion-quote:before,\n.ion-radio-waves:before,\n.ion-record:before,\n.ion-refresh:before,\n.ion-reply:before,\n.ion-reply-all:before,\n.ion-ribbon-a:before,\n.ion-ribbon-b:before,\n.ion-sad:before,\n.ion-sad-outline:before,\n.ion-scissors:before,\n.ion-search:before,\n.ion-settings:before,\n.ion-share:before,\n.ion-shuffle:before,\n.ion-skip-backward:before,\n.ion-skip-forward:before,\n.ion-social-android:before,\n.ion-social-android-outline:before,\n.ion-social-angular:before,\n.ion-social-angular-outline:before,\n.ion-social-apple:before,\n.ion-social-apple-outline:before,\n.ion-social-bitcoin:before,\n.ion-social-bitcoin-outline:before,\n.ion-social-buffer:before,\n.ion-social-buffer-outline:before,\n.ion-social-chrome:before,\n.ion-social-chrome-outline:before,\n.ion-social-codepen:before,\n.ion-social-codepen-outline:before,\n.ion-social-css3:before,\n.ion-social-css3-outline:before,\n.ion-social-designernews:before,\n.ion-social-designernews-outline:before,\n.ion-social-dribbble:before,\n.ion-social-dribbble-outline:before,\n.ion-social-dropbox:before,\n.ion-social-dropbox-outline:before,\n.ion-social-euro:before,\n.ion-social-euro-outline:before,\n.ion-social-facebook:before,\n.ion-social-facebook-outline:before,\n.ion-social-foursquare:before,\n.ion-social-foursquare-outline:before,\n.ion-social-freebsd-devil:before,\n.ion-social-github:before,\n.ion-social-github-outline:before,\n.ion-social-google:before,\n.ion-social-google-outline:before,\n.ion-social-googleplus:before,\n.ion-social-googleplus-outline:before,\n.ion-social-hackernews:before,\n.ion-social-hackernews-outline:before,\n.ion-social-html5:before,\n.ion-social-html5-outline:before,\n.ion-social-instagram:before,\n.ion-social-instagram-outline:before,\n.ion-social-javascript:before,\n.ion-social-javascript-outline:before,\n.ion-social-linkedin:before,\n.ion-social-linkedin-outline:before,\n.ion-social-markdown:before,\n.ion-social-nodejs:before,\n.ion-social-octocat:before,\n.ion-social-pinterest:before,\n.ion-social-pinterest-outline:before,\n.ion-social-python:before,\n.ion-social-reddit:before,\n.ion-social-reddit-outline:before,\n.ion-social-rss:before,\n.ion-social-rss-outline:before,\n.ion-social-sass:before,\n.ion-social-skype:before,\n.ion-social-skype-outline:before,\n.ion-social-snapchat:before,\n.ion-social-snapchat-outline:before,\n.ion-social-tumblr:before,\n.ion-social-tumblr-outline:before,\n.ion-social-tux:before,\n.ion-social-twitch:before,\n.ion-social-twitch-outline:before,\n.ion-social-twitter:before,\n.ion-social-twitter-outline:before,\n.ion-social-usd:before,\n.ion-social-usd-outline:before,\n.ion-social-vimeo:before,\n.ion-social-vimeo-outline:before,\n.ion-social-whatsapp:before,\n.ion-social-whatsapp-outline:before,\n.ion-social-windows:before,\n.ion-social-windows-outline:before,\n.ion-social-wordpress:before,\n.ion-social-wordpress-outline:before,\n.ion-social-yahoo:before,\n.ion-social-yahoo-outline:before,\n.ion-social-yen:before,\n.ion-social-yen-outline:before,\n.ion-social-youtube:before,\n.ion-social-youtube-outline:before,\n.ion-soup-can:before,\n.ion-soup-can-outline:before,\n.ion-speakerphone:before,\n.ion-speedometer:before,\n.ion-spoon:before,\n.ion-star:before,\n.ion-stats-bars:before,\n.ion-steam:before,\n.ion-stop:before,\n.ion-thermometer:before,\n.ion-thumbsdown:before,\n.ion-thumbsup:before,\n.ion-toggle:before,\n.ion-toggle-filled:before,\n.ion-transgender:before,\n.ion-trash-a:before,\n.ion-trash-b:before,\n.ion-trophy:before,\n.ion-tshirt:before,\n.ion-tshirt-outline:before,\n.ion-umbrella:before,\n.ion-university:before,\n.ion-unlocked:before,\n.ion-upload:before,\n.ion-usb:before,\n.ion-videocamera:before,\n.ion-volume-high:before,\n.ion-volume-low:before,\n.ion-volume-medium:before,\n.ion-volume-mute:before,\n.ion-wand:before,\n.ion-waterdrop:before,\n.ion-wifi:before,\n.ion-wineglass:before,\n.ion-woman:before,\n.ion-wrench:before,\n.ion-xbox:before {\n  display: inline-block;\n  font-family: \"Ionicons\";\n  speak: none;\n  font-style: normal;\n  font-weight: normal;\n  font-variant: normal;\n  text-transform: none;\n  text-rendering: auto;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale; }\n\n.ion-alert:before {\n  content: \"\"; }\n\n.ion-alert-circled:before {\n  content: \"\"; }\n\n.ion-android-add:before {\n  content: \"\"; }\n\n.ion-android-add-circle:before {\n  content: \"\"; }\n\n.ion-android-alarm-clock:before {\n  content: \"\"; }\n\n.ion-android-alert:before {\n  content: \"\"; }\n\n.ion-android-apps:before {\n  content: \"\"; }\n\n.ion-android-archive:before {\n  content: \"\"; }\n\n.ion-android-arrow-back:before {\n  content: \"\"; }\n\n.ion-android-arrow-down:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropdown:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropdown-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropleft:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropleft-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropright:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropright-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropup:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropup-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-forward:before {\n  content: \"\"; }\n\n.ion-android-arrow-up:before {\n  content: \"\"; }\n\n.ion-android-attach:before {\n  content: \"\"; }\n\n.ion-android-bar:before {\n  content: \"\"; }\n\n.ion-android-bicycle:before {\n  content: \"\"; }\n\n.ion-android-boat:before {\n  content: \"\"; }\n\n.ion-android-bookmark:before {\n  content: \"\"; }\n\n.ion-android-bulb:before {\n  content: \"\"; }\n\n.ion-android-bus:before {\n  content: \"\"; }\n\n.ion-android-calendar:before {\n  content: \"\"; }\n\n.ion-android-call:before {\n  content: \"\"; }\n\n.ion-android-camera:before {\n  content: \"\"; }\n\n.ion-android-cancel:before {\n  content: \"\"; }\n\n.ion-android-car:before {\n  content: \"\"; }\n\n.ion-android-cart:before {\n  content: \"\"; }\n\n.ion-android-chat:before {\n  content: \"\"; }\n\n.ion-android-checkbox:before {\n  content: \"\"; }\n\n.ion-android-checkbox-blank:before {\n  content: \"\"; }\n\n.ion-android-checkbox-outline:before {\n  content: \"\"; }\n\n.ion-android-checkbox-outline-blank:before {\n  content: \"\"; }\n\n.ion-android-checkmark-circle:before {\n  content: \"\"; }\n\n.ion-android-clipboard:before {\n  content: \"\"; }\n\n.ion-android-close:before {\n  content: \"\"; }\n\n.ion-android-cloud:before {\n  content: \"\"; }\n\n.ion-android-cloud-circle:before {\n  content: \"\"; }\n\n.ion-android-cloud-done:before {\n  content: \"\"; }\n\n.ion-android-cloud-outline:before {\n  content: \"\"; }\n\n.ion-android-color-palette:before {\n  content: \"\"; }\n\n.ion-android-compass:before {\n  content: \"\"; }\n\n.ion-android-contact:before {\n  content: \"\"; }\n\n.ion-android-contacts:before {\n  content: \"\"; }\n\n.ion-android-contract:before {\n  content: \"\"; }\n\n.ion-android-create:before {\n  content: \"\"; }\n\n.ion-android-delete:before {\n  content: \"\"; }\n\n.ion-android-desktop:before {\n  content: \"\"; }\n\n.ion-android-document:before {\n  content: \"\"; }\n\n.ion-android-done:before {\n  content: \"\"; }\n\n.ion-android-done-all:before {\n  content: \"\"; }\n\n.ion-android-download:before {\n  content: \"\"; }\n\n.ion-android-drafts:before {\n  content: \"\"; }\n\n.ion-android-exit:before {\n  content: \"\"; }\n\n.ion-android-expand:before {\n  content: \"\"; }\n\n.ion-android-favorite:before {\n  content: \"\"; }\n\n.ion-android-favorite-outline:before {\n  content: \"\"; }\n\n.ion-android-film:before {\n  content: \"\"; }\n\n.ion-android-folder:before {\n  content: \"\"; }\n\n.ion-android-folder-open:before {\n  content: \"\"; }\n\n.ion-android-funnel:before {\n  content: \"\"; }\n\n.ion-android-globe:before {\n  content: \"\"; }\n\n.ion-android-hand:before {\n  content: \"\"; }\n\n.ion-android-hangout:before {\n  content: \"\"; }\n\n.ion-android-happy:before {\n  content: \"\"; }\n\n.ion-android-home:before {\n  content: \"\"; }\n\n.ion-android-image:before {\n  content: \"\"; }\n\n.ion-android-laptop:before {\n  content: \"\"; }\n\n.ion-android-list:before {\n  content: \"\"; }\n\n.ion-android-locate:before {\n  content: \"\"; }\n\n.ion-android-lock:before {\n  content: \"\"; }\n\n.ion-android-mail:before {\n  content: \"\"; }\n\n.ion-android-map:before {\n  content: \"\"; }\n\n.ion-android-menu:before {\n  content: \"\"; }\n\n.ion-android-microphone:before {\n  content: \"\"; }\n\n.ion-android-microphone-off:before {\n  content: \"\"; }\n\n.ion-android-more-horizontal:before {\n  content: \"\"; }\n\n.ion-android-more-vertical:before {\n  content: \"\"; }\n\n.ion-android-navigate:before {\n  content: \"\"; }\n\n.ion-android-notifications:before {\n  content: \"\"; }\n\n.ion-android-notifications-none:before {\n  content: \"\"; }\n\n.ion-android-notifications-off:before {\n  content: \"\"; }\n\n.ion-android-open:before {\n  content: \"\"; }\n\n.ion-android-options:before {\n  content: \"\"; }\n\n.ion-android-people:before {\n  content: \"\"; }\n\n.ion-android-person:before {\n  content: \"\"; }\n\n.ion-android-person-add:before {\n  content: \"\"; }\n\n.ion-android-phone-landscape:before {\n  content: \"\"; }\n\n.ion-android-phone-portrait:before {\n  content: \"\"; }\n\n.ion-android-pin:before {\n  content: \"\"; }\n\n.ion-android-plane:before {\n  content: \"\"; }\n\n.ion-android-playstore:before {\n  content: \"\"; }\n\n.ion-android-print:before {\n  content: \"\"; }\n\n.ion-android-radio-button-off:before {\n  content: \"\"; }\n\n.ion-android-radio-button-on:before {\n  content: \"\"; }\n\n.ion-android-refresh:before {\n  content: \"\"; }\n\n.ion-android-remove:before {\n  content: \"\"; }\n\n.ion-android-remove-circle:before {\n  content: \"\"; }\n\n.ion-android-restaurant:before {\n  content: \"\"; }\n\n.ion-android-sad:before {\n  content: \"\"; }\n\n.ion-android-search:before {\n  content: \"\"; }\n\n.ion-android-send:before {\n  content: \"\"; }\n\n.ion-android-settings:before {\n  content: \"\"; }\n\n.ion-android-share:before {\n  content: \"\"; }\n\n.ion-android-share-alt:before {\n  content: \"\"; }\n\n.ion-android-star:before {\n  content: \"\"; }\n\n.ion-android-star-half:before {\n  content: \"\"; }\n\n.ion-android-star-outline:before {\n  content: \"\"; }\n\n.ion-android-stopwatch:before {\n  content: \"\"; }\n\n.ion-android-subway:before {\n  content: \"\"; }\n\n.ion-android-sunny:before {\n  content: \"\"; }\n\n.ion-android-sync:before {\n  content: \"\"; }\n\n.ion-android-textsms:before {\n  content: \"\"; }\n\n.ion-android-time:before {\n  content: \"\"; }\n\n.ion-android-train:before {\n  content: \"\"; }\n\n.ion-android-unlock:before {\n  content: \"\"; }\n\n.ion-android-upload:before {\n  content: \"\"; }\n\n.ion-android-volume-down:before {\n  content: \"\"; }\n\n.ion-android-volume-mute:before {\n  content: \"\"; }\n\n.ion-android-volume-off:before {\n  content: \"\"; }\n\n.ion-android-volume-up:before {\n  content: \"\"; }\n\n.ion-android-walk:before {\n  content: \"\"; }\n\n.ion-android-warning:before {\n  content: \"\"; }\n\n.ion-android-watch:before {\n  content: \"\"; }\n\n.ion-android-wifi:before {\n  content: \"\"; }\n\n.ion-aperture:before {\n  content: \"\"; }\n\n.ion-archive:before {\n  content: \"\"; }\n\n.ion-arrow-down-a:before {\n  content: \"\"; }\n\n.ion-arrow-down-b:before {\n  content: \"\"; }\n\n.ion-arrow-down-c:before {\n  content: \"\"; }\n\n.ion-arrow-expand:before {\n  content: \"\"; }\n\n.ion-arrow-graph-down-left:before {\n  content: \"\"; }\n\n.ion-arrow-graph-down-right:before {\n  content: \"\"; }\n\n.ion-arrow-graph-up-left:before {\n  content: \"\"; }\n\n.ion-arrow-graph-up-right:before {\n  content: \"\"; }\n\n.ion-arrow-left-a:before {\n  content: \"\"; }\n\n.ion-arrow-left-b:before {\n  content: \"\"; }\n\n.ion-arrow-left-c:before {\n  content: \"\"; }\n\n.ion-arrow-move:before {\n  content: \"\"; }\n\n.ion-arrow-resize:before {\n  content: \"\"; }\n\n.ion-arrow-return-left:before {\n  content: \"\"; }\n\n.ion-arrow-return-right:before {\n  content: \"\"; }\n\n.ion-arrow-right-a:before {\n  content: \"\"; }\n\n.ion-arrow-right-b:before {\n  content: \"\"; }\n\n.ion-arrow-right-c:before {\n  content: \"\"; }\n\n.ion-arrow-shrink:before {\n  content: \"\"; }\n\n.ion-arrow-swap:before {\n  content: \"\"; }\n\n.ion-arrow-up-a:before {\n  content: \"\"; }\n\n.ion-arrow-up-b:before {\n  content: \"\"; }\n\n.ion-arrow-up-c:before {\n  content: \"\"; }\n\n.ion-asterisk:before {\n  content: \"\"; }\n\n.ion-at:before {\n  content: \"\"; }\n\n.ion-backspace:before {\n  content: \"\"; }\n\n.ion-backspace-outline:before {\n  content: \"\"; }\n\n.ion-bag:before {\n  content: \"\"; }\n\n.ion-battery-charging:before {\n  content: \"\"; }\n\n.ion-battery-empty:before {\n  content: \"\"; }\n\n.ion-battery-full:before {\n  content: \"\"; }\n\n.ion-battery-half:before {\n  content: \"\"; }\n\n.ion-battery-low:before {\n  content: \"\"; }\n\n.ion-beaker:before {\n  content: \"\"; }\n\n.ion-beer:before {\n  content: \"\"; }\n\n.ion-bluetooth:before {\n  content: \"\"; }\n\n.ion-bonfire:before {\n  content: \"\"; }\n\n.ion-bookmark:before {\n  content: \"\"; }\n\n.ion-bowtie:before {\n  content: \"\"; }\n\n.ion-briefcase:before {\n  content: \"\"; }\n\n.ion-bug:before {\n  content: \"\"; }\n\n.ion-calculator:before {\n  content: \"\"; }\n\n.ion-calendar:before {\n  content: \"\"; }\n\n.ion-camera:before {\n  content: \"\"; }\n\n.ion-card:before {\n  content: \"\"; }\n\n.ion-cash:before {\n  content: \"\"; }\n\n.ion-chatbox:before {\n  content: \"\"; }\n\n.ion-chatbox-working:before {\n  content: \"\"; }\n\n.ion-chatboxes:before {\n  content: \"\"; }\n\n.ion-chatbubble:before {\n  content: \"\"; }\n\n.ion-chatbubble-working:before {\n  content: \"\"; }\n\n.ion-chatbubbles:before {\n  content: \"\"; }\n\n.ion-checkmark:before {\n  content: \"\"; }\n\n.ion-checkmark-circled:before {\n  content: \"\"; }\n\n.ion-checkmark-round:before {\n  content: \"\"; }\n\n.ion-chevron-down:before {\n  content: \"\"; }\n\n.ion-chevron-left:before {\n  content: \"\"; }\n\n.ion-chevron-right:before {\n  content: \"\"; }\n\n.ion-chevron-up:before {\n  content: \"\"; }\n\n.ion-clipboard:before {\n  content: \"\"; }\n\n.ion-clock:before {\n  content: \"\"; }\n\n.ion-close:before {\n  content: \"\"; }\n\n.ion-close-circled:before {\n  content: \"\"; }\n\n.ion-close-round:before {\n  content: \"\"; }\n\n.ion-closed-captioning:before {\n  content: \"\"; }\n\n.ion-cloud:before {\n  content: \"\"; }\n\n.ion-code:before {\n  content: \"\"; }\n\n.ion-code-download:before {\n  content: \"\"; }\n\n.ion-code-working:before {\n  content: \"\"; }\n\n.ion-coffee:before {\n  content: \"\"; }\n\n.ion-compass:before {\n  content: \"\"; }\n\n.ion-compose:before {\n  content: \"\"; }\n\n.ion-connection-bars:before {\n  content: \"\"; }\n\n.ion-contrast:before {\n  content: \"\"; }\n\n.ion-crop:before {\n  content: \"\"; }\n\n.ion-cube:before {\n  content: \"\"; }\n\n.ion-disc:before {\n  content: \"\"; }\n\n.ion-document:before {\n  content: \"\"; }\n\n.ion-document-text:before {\n  content: \"\"; }\n\n.ion-drag:before {\n  content: \"\"; }\n\n.ion-earth:before {\n  content: \"\"; }\n\n.ion-easel:before {\n  content: \"\"; }\n\n.ion-edit:before {\n  content: \"\"; }\n\n.ion-egg:before {\n  content: \"\"; }\n\n.ion-eject:before {\n  content: \"\"; }\n\n.ion-email:before {\n  content: \"\"; }\n\n.ion-email-unread:before {\n  content: \"\"; }\n\n.ion-erlenmeyer-flask:before {\n  content: \"\"; }\n\n.ion-erlenmeyer-flask-bubbles:before {\n  content: \"\"; }\n\n.ion-eye:before {\n  content: \"\"; }\n\n.ion-eye-disabled:before {\n  content: \"\"; }\n\n.ion-female:before {\n  content: \"\"; }\n\n.ion-filing:before {\n  content: \"\"; }\n\n.ion-film-marker:before {\n  content: \"\"; }\n\n.ion-fireball:before {\n  content: \"\"; }\n\n.ion-flag:before {\n  content: \"\"; }\n\n.ion-flame:before {\n  content: \"\"; }\n\n.ion-flash:before {\n  content: \"\"; }\n\n.ion-flash-off:before {\n  content: \"\"; }\n\n.ion-folder:before {\n  content: \"\"; }\n\n.ion-fork:before {\n  content: \"\"; }\n\n.ion-fork-repo:before {\n  content: \"\"; }\n\n.ion-forward:before {\n  content: \"\"; }\n\n.ion-funnel:before {\n  content: \"\"; }\n\n.ion-gear-a:before {\n  content: \"\"; }\n\n.ion-gear-b:before {\n  content: \"\"; }\n\n.ion-grid:before {\n  content: \"\"; }\n\n.ion-hammer:before {\n  content: \"\"; }\n\n.ion-happy:before {\n  content: \"\"; }\n\n.ion-happy-outline:before {\n  content: \"\"; }\n\n.ion-headphone:before {\n  content: \"\"; }\n\n.ion-heart:before {\n  content: \"\"; }\n\n.ion-heart-broken:before {\n  content: \"\"; }\n\n.ion-help:before {\n  content: \"\"; }\n\n.ion-help-buoy:before {\n  content: \"\"; }\n\n.ion-help-circled:before {\n  content: \"\"; }\n\n.ion-home:before {\n  content: \"\"; }\n\n.ion-icecream:before {\n  content: \"\"; }\n\n.ion-image:before {\n  content: \"\"; }\n\n.ion-images:before {\n  content: \"\"; }\n\n.ion-information:before {\n  content: \"\"; }\n\n.ion-information-circled:before {\n  content: \"\"; }\n\n.ion-ionic:before {\n  content: \"\"; }\n\n.ion-ios-alarm:before {\n  content: \"\"; }\n\n.ion-ios-alarm-outline:before {\n  content: \"\"; }\n\n.ion-ios-albums:before {\n  content: \"\"; }\n\n.ion-ios-albums-outline:before {\n  content: \"\"; }\n\n.ion-ios-americanfootball:before {\n  content: \"\"; }\n\n.ion-ios-americanfootball-outline:before {\n  content: \"\"; }\n\n.ion-ios-analytics:before {\n  content: \"\"; }\n\n.ion-ios-analytics-outline:before {\n  content: \"\"; }\n\n.ion-ios-arrow-back:before {\n  content: \"\"; }\n\n.ion-ios-arrow-down:before {\n  content: \"\"; }\n\n.ion-ios-arrow-forward:before {\n  content: \"\"; }\n\n.ion-ios-arrow-left:before {\n  content: \"\"; }\n\n.ion-ios-arrow-right:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-down:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-left:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-right:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-up:before {\n  content: \"\"; }\n\n.ion-ios-arrow-up:before {\n  content: \"\"; }\n\n.ion-ios-at:before {\n  content: \"\"; }\n\n.ion-ios-at-outline:before {\n  content: \"\"; }\n\n.ion-ios-barcode:before {\n  content: \"\"; }\n\n.ion-ios-barcode-outline:before {\n  content: \"\"; }\n\n.ion-ios-baseball:before {\n  content: \"\"; }\n\n.ion-ios-baseball-outline:before {\n  content: \"\"; }\n\n.ion-ios-basketball:before {\n  content: \"\"; }\n\n.ion-ios-basketball-outline:before {\n  content: \"\"; }\n\n.ion-ios-bell:before {\n  content: \"\"; }\n\n.ion-ios-bell-outline:before {\n  content: \"\"; }\n\n.ion-ios-body:before {\n  content: \"\"; }\n\n.ion-ios-body-outline:before {\n  content: \"\"; }\n\n.ion-ios-bolt:before {\n  content: \"\"; }\n\n.ion-ios-bolt-outline:before {\n  content: \"\"; }\n\n.ion-ios-book:before {\n  content: \"\"; }\n\n.ion-ios-book-outline:before {\n  content: \"\"; }\n\n.ion-ios-bookmarks:before {\n  content: \"\"; }\n\n.ion-ios-bookmarks-outline:before {\n  content: \"\"; }\n\n.ion-ios-box:before {\n  content: \"\"; }\n\n.ion-ios-box-outline:before {\n  content: \"\"; }\n\n.ion-ios-briefcase:before {\n  content: \"\"; }\n\n.ion-ios-briefcase-outline:before {\n  content: \"\"; }\n\n.ion-ios-browsers:before {\n  content: \"\"; }\n\n.ion-ios-browsers-outline:before {\n  content: \"\"; }\n\n.ion-ios-calculator:before {\n  content: \"\"; }\n\n.ion-ios-calculator-outline:before {\n  content: \"\"; }\n\n.ion-ios-calendar:before {\n  content: \"\"; }\n\n.ion-ios-calendar-outline:before {\n  content: \"\"; }\n\n.ion-ios-camera:before {\n  content: \"\"; }\n\n.ion-ios-camera-outline:before {\n  content: \"\"; }\n\n.ion-ios-cart:before {\n  content: \"\"; }\n\n.ion-ios-cart-outline:before {\n  content: \"\"; }\n\n.ion-ios-chatboxes:before {\n  content: \"\"; }\n\n.ion-ios-chatboxes-outline:before {\n  content: \"\"; }\n\n.ion-ios-chatbubble:before {\n  content: \"\"; }\n\n.ion-ios-chatbubble-outline:before {\n  content: \"\"; }\n\n.ion-ios-checkmark:before {\n  content: \"\"; }\n\n.ion-ios-checkmark-empty:before {\n  content: \"\"; }\n\n.ion-ios-checkmark-outline:before {\n  content: \"\"; }\n\n.ion-ios-circle-filled:before {\n  content: \"\"; }\n\n.ion-ios-circle-outline:before {\n  content: \"\"; }\n\n.ion-ios-clock:before {\n  content: \"\"; }\n\n.ion-ios-clock-outline:before {\n  content: \"\"; }\n\n.ion-ios-close:before {\n  content: \"\"; }\n\n.ion-ios-close-empty:before {\n  content: \"\"; }\n\n.ion-ios-close-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloud:before {\n  content: \"\"; }\n\n.ion-ios-cloud-download:before {\n  content: \"\"; }\n\n.ion-ios-cloud-download-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloud-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloud-upload:before {\n  content: \"\"; }\n\n.ion-ios-cloud-upload-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloudy:before {\n  content: \"\"; }\n\n.ion-ios-cloudy-night:before {\n  content: \"\"; }\n\n.ion-ios-cloudy-night-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloudy-outline:before {\n  content: \"\"; }\n\n.ion-ios-cog:before {\n  content: \"\"; }\n\n.ion-ios-cog-outline:before {\n  content: \"\"; }\n\n.ion-ios-color-filter:before {\n  content: \"\"; }\n\n.ion-ios-color-filter-outline:before {\n  content: \"\"; }\n\n.ion-ios-color-wand:before {\n  content: \"\"; }\n\n.ion-ios-color-wand-outline:before {\n  content: \"\"; }\n\n.ion-ios-compose:before {\n  content: \"\"; }\n\n.ion-ios-compose-outline:before {\n  content: \"\"; }\n\n.ion-ios-contact:before {\n  content: \"\"; }\n\n.ion-ios-contact-outline:before {\n  content: \"\"; }\n\n.ion-ios-copy:before {\n  content: \"\"; }\n\n.ion-ios-copy-outline:before {\n  content: \"\"; }\n\n.ion-ios-crop:before {\n  content: \"\"; }\n\n.ion-ios-crop-strong:before {\n  content: \"\"; }\n\n.ion-ios-download:before {\n  content: \"\"; }\n\n.ion-ios-download-outline:before {\n  content: \"\"; }\n\n.ion-ios-drag:before {\n  content: \"\"; }\n\n.ion-ios-email:before {\n  content: \"\"; }\n\n.ion-ios-email-outline:before {\n  content: \"\"; }\n\n.ion-ios-eye:before {\n  content: \"\"; }\n\n.ion-ios-eye-outline:before {\n  content: \"\"; }\n\n.ion-ios-fastforward:before {\n  content: \"\"; }\n\n.ion-ios-fastforward-outline:before {\n  content: \"\"; }\n\n.ion-ios-filing:before {\n  content: \"\"; }\n\n.ion-ios-filing-outline:before {\n  content: \"\"; }\n\n.ion-ios-film:before {\n  content: \"\"; }\n\n.ion-ios-film-outline:before {\n  content: \"\"; }\n\n.ion-ios-flag:before {\n  content: \"\"; }\n\n.ion-ios-flag-outline:before {\n  content: \"\"; }\n\n.ion-ios-flame:before {\n  content: \"\"; }\n\n.ion-ios-flame-outline:before {\n  content: \"\"; }\n\n.ion-ios-flask:before {\n  content: \"\"; }\n\n.ion-ios-flask-outline:before {\n  content: \"\"; }\n\n.ion-ios-flower:before {\n  content: \"\"; }\n\n.ion-ios-flower-outline:before {\n  content: \"\"; }\n\n.ion-ios-folder:before {\n  content: \"\"; }\n\n.ion-ios-folder-outline:before {\n  content: \"\"; }\n\n.ion-ios-football:before {\n  content: \"\"; }\n\n.ion-ios-football-outline:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-a:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-a-outline:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-b:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-b-outline:before {\n  content: \"\"; }\n\n.ion-ios-gear:before {\n  content: \"\"; }\n\n.ion-ios-gear-outline:before {\n  content: \"\"; }\n\n.ion-ios-glasses:before {\n  content: \"\"; }\n\n.ion-ios-glasses-outline:before {\n  content: \"\"; }\n\n.ion-ios-grid-view:before {\n  content: \"\"; }\n\n.ion-ios-grid-view-outline:before {\n  content: \"\"; }\n\n.ion-ios-heart:before {\n  content: \"\"; }\n\n.ion-ios-heart-outline:before {\n  content: \"\"; }\n\n.ion-ios-help:before {\n  content: \"\"; }\n\n.ion-ios-help-empty:before {\n  content: \"\"; }\n\n.ion-ios-help-outline:before {\n  content: \"\"; }\n\n.ion-ios-home:before {\n  content: \"\"; }\n\n.ion-ios-home-outline:before {\n  content: \"\"; }\n\n.ion-ios-infinite:before {\n  content: \"\"; }\n\n.ion-ios-infinite-outline:before {\n  content: \"\"; }\n\n.ion-ios-information:before {\n  content: \"\"; }\n\n.ion-ios-information-empty:before {\n  content: \"\"; }\n\n.ion-ios-information-outline:before {\n  content: \"\"; }\n\n.ion-ios-ionic-outline:before {\n  content: \"\"; }\n\n.ion-ios-keypad:before {\n  content: \"\"; }\n\n.ion-ios-keypad-outline:before {\n  content: \"\"; }\n\n.ion-ios-lightbulb:before {\n  content: \"\"; }\n\n.ion-ios-lightbulb-outline:before {\n  content: \"\"; }\n\n.ion-ios-list:before {\n  content: \"\"; }\n\n.ion-ios-list-outline:before {\n  content: \"\"; }\n\n.ion-ios-location:before {\n  content: \"\"; }\n\n.ion-ios-location-outline:before {\n  content: \"\"; }\n\n.ion-ios-locked:before {\n  content: \"\"; }\n\n.ion-ios-locked-outline:before {\n  content: \"\"; }\n\n.ion-ios-loop:before {\n  content: \"\"; }\n\n.ion-ios-loop-strong:before {\n  content: \"\"; }\n\n.ion-ios-medical:before {\n  content: \"\"; }\n\n.ion-ios-medical-outline:before {\n  content: \"\"; }\n\n.ion-ios-medkit:before {\n  content: \"\"; }\n\n.ion-ios-medkit-outline:before {\n  content: \"\"; }\n\n.ion-ios-mic:before {\n  content: \"\"; }\n\n.ion-ios-mic-off:before {\n  content: \"\"; }\n\n.ion-ios-mic-outline:before {\n  content: \"\"; }\n\n.ion-ios-minus:before {\n  content: \"\"; }\n\n.ion-ios-minus-empty:before {\n  content: \"\"; }\n\n.ion-ios-minus-outline:before {\n  content: \"\"; }\n\n.ion-ios-monitor:before {\n  content: \"\"; }\n\n.ion-ios-monitor-outline:before {\n  content: \"\"; }\n\n.ion-ios-moon:before {\n  content: \"\"; }\n\n.ion-ios-moon-outline:before {\n  content: \"\"; }\n\n.ion-ios-more:before {\n  content: \"\"; }\n\n.ion-ios-more-outline:before {\n  content: \"\"; }\n\n.ion-ios-musical-note:before {\n  content: \"\"; }\n\n.ion-ios-musical-notes:before {\n  content: \"\"; }\n\n.ion-ios-navigate:before {\n  content: \"\"; }\n\n.ion-ios-navigate-outline:before {\n  content: \"\"; }\n\n.ion-ios-nutrition:before {\n  content: \"\"; }\n\n.ion-ios-nutrition-outline:before {\n  content: \"\"; }\n\n.ion-ios-paper:before {\n  content: \"\"; }\n\n.ion-ios-paper-outline:before {\n  content: \"\"; }\n\n.ion-ios-paperplane:before {\n  content: \"\"; }\n\n.ion-ios-paperplane-outline:before {\n  content: \"\"; }\n\n.ion-ios-partlysunny:before {\n  content: \"\"; }\n\n.ion-ios-partlysunny-outline:before {\n  content: \"\"; }\n\n.ion-ios-pause:before {\n  content: \"\"; }\n\n.ion-ios-pause-outline:before {\n  content: \"\"; }\n\n.ion-ios-paw:before {\n  content: \"\"; }\n\n.ion-ios-paw-outline:before {\n  content: \"\"; }\n\n.ion-ios-people:before {\n  content: \"\"; }\n\n.ion-ios-people-outline:before {\n  content: \"\"; }\n\n.ion-ios-person:before {\n  content: \"\"; }\n\n.ion-ios-person-outline:before {\n  content: \"\"; }\n\n.ion-ios-personadd:before {\n  content: \"\"; }\n\n.ion-ios-personadd-outline:before {\n  content: \"\"; }\n\n.ion-ios-photos:before {\n  content: \"\"; }\n\n.ion-ios-photos-outline:before {\n  content: \"\"; }\n\n.ion-ios-pie:before {\n  content: \"\"; }\n\n.ion-ios-pie-outline:before {\n  content: \"\"; }\n\n.ion-ios-pint:before {\n  content: \"\"; }\n\n.ion-ios-pint-outline:before {\n  content: \"\"; }\n\n.ion-ios-play:before {\n  content: \"\"; }\n\n.ion-ios-play-outline:before {\n  content: \"\"; }\n\n.ion-ios-plus:before {\n  content: \"\"; }\n\n.ion-ios-plus-empty:before {\n  content: \"\"; }\n\n.ion-ios-plus-outline:before {\n  content: \"\"; }\n\n.ion-ios-pricetag:before {\n  content: \"\"; }\n\n.ion-ios-pricetag-outline:before {\n  content: \"\"; }\n\n.ion-ios-pricetags:before {\n  content: \"\"; }\n\n.ion-ios-pricetags-outline:before {\n  content: \"\"; }\n\n.ion-ios-printer:before {\n  content: \"\"; }\n\n.ion-ios-printer-outline:before {\n  content: \"\"; }\n\n.ion-ios-pulse:before {\n  content: \"\"; }\n\n.ion-ios-pulse-strong:before {\n  content: \"\"; }\n\n.ion-ios-rainy:before {\n  content: \"\"; }\n\n.ion-ios-rainy-outline:before {\n  content: \"\"; }\n\n.ion-ios-recording:before {\n  content: \"\"; }\n\n.ion-ios-recording-outline:before {\n  content: \"\"; }\n\n.ion-ios-redo:before {\n  content: \"\"; }\n\n.ion-ios-redo-outline:before {\n  content: \"\"; }\n\n.ion-ios-refresh:before {\n  content: \"\"; }\n\n.ion-ios-refresh-empty:before {\n  content: \"\"; }\n\n.ion-ios-refresh-outline:before {\n  content: \"\"; }\n\n.ion-ios-reload:before {\n  content: \"\"; }\n\n.ion-ios-reverse-camera:before {\n  content: \"\"; }\n\n.ion-ios-reverse-camera-outline:before {\n  content: \"\"; }\n\n.ion-ios-rewind:before {\n  content: \"\"; }\n\n.ion-ios-rewind-outline:before {\n  content: \"\"; }\n\n.ion-ios-rose:before {\n  content: \"\"; }\n\n.ion-ios-rose-outline:before {\n  content: \"\"; }\n\n.ion-ios-search:before {\n  content: \"\"; }\n\n.ion-ios-search-strong:before {\n  content: \"\"; }\n\n.ion-ios-settings:before {\n  content: \"\"; }\n\n.ion-ios-settings-strong:before {\n  content: \"\"; }\n\n.ion-ios-shuffle:before {\n  content: \"\"; }\n\n.ion-ios-shuffle-strong:before {\n  content: \"\"; }\n\n.ion-ios-skipbackward:before {\n  content: \"\"; }\n\n.ion-ios-skipbackward-outline:before {\n  content: \"\"; }\n\n.ion-ios-skipforward:before {\n  content: \"\"; }\n\n.ion-ios-skipforward-outline:before {\n  content: \"\"; }\n\n.ion-ios-snowy:before {\n  content: \"\"; }\n\n.ion-ios-speedometer:before {\n  content: \"\"; }\n\n.ion-ios-speedometer-outline:before {\n  content: \"\"; }\n\n.ion-ios-star:before {\n  content: \"\"; }\n\n.ion-ios-star-half:before {\n  content: \"\"; }\n\n.ion-ios-star-outline:before {\n  content: \"\"; }\n\n.ion-ios-stopwatch:before {\n  content: \"\"; }\n\n.ion-ios-stopwatch-outline:before {\n  content: \"\"; }\n\n.ion-ios-sunny:before {\n  content: \"\"; }\n\n.ion-ios-sunny-outline:before {\n  content: \"\"; }\n\n.ion-ios-telephone:before {\n  content: \"\"; }\n\n.ion-ios-telephone-outline:before {\n  content: \"\"; }\n\n.ion-ios-tennisball:before {\n  content: \"\"; }\n\n.ion-ios-tennisball-outline:before {\n  content: \"\"; }\n\n.ion-ios-thunderstorm:before {\n  content: \"\"; }\n\n.ion-ios-thunderstorm-outline:before {\n  content: \"\"; }\n\n.ion-ios-time:before {\n  content: \"\"; }\n\n.ion-ios-time-outline:before {\n  content: \"\"; }\n\n.ion-ios-timer:before {\n  content: \"\"; }\n\n.ion-ios-timer-outline:before {\n  content: \"\"; }\n\n.ion-ios-toggle:before {\n  content: \"\"; }\n\n.ion-ios-toggle-outline:before {\n  content: \"\"; }\n\n.ion-ios-trash:before {\n  content: \"\"; }\n\n.ion-ios-trash-outline:before {\n  content: \"\"; }\n\n.ion-ios-undo:before {\n  content: \"\"; }\n\n.ion-ios-undo-outline:before {\n  content: \"\"; }\n\n.ion-ios-unlocked:before {\n  content: \"\"; }\n\n.ion-ios-unlocked-outline:before {\n  content: \"\"; }\n\n.ion-ios-upload:before {\n  content: \"\"; }\n\n.ion-ios-upload-outline:before {\n  content: \"\"; }\n\n.ion-ios-videocam:before {\n  content: \"\"; }\n\n.ion-ios-videocam-outline:before {\n  content: \"\"; }\n\n.ion-ios-volume-high:before {\n  content: \"\"; }\n\n.ion-ios-volume-low:before {\n  content: \"\"; }\n\n.ion-ios-wineglass:before {\n  content: \"\"; }\n\n.ion-ios-wineglass-outline:before {\n  content: \"\"; }\n\n.ion-ios-world:before {\n  content: \"\"; }\n\n.ion-ios-world-outline:before {\n  content: \"\"; }\n\n.ion-ipad:before {\n  content: \"\"; }\n\n.ion-iphone:before {\n  content: \"\"; }\n\n.ion-ipod:before {\n  content: \"\"; }\n\n.ion-jet:before {\n  content: \"\"; }\n\n.ion-key:before {\n  content: \"\"; }\n\n.ion-knife:before {\n  content: \"\"; }\n\n.ion-laptop:before {\n  content: \"\"; }\n\n.ion-leaf:before {\n  content: \"\"; }\n\n.ion-levels:before {\n  content: \"\"; }\n\n.ion-lightbulb:before {\n  content: \"\"; }\n\n.ion-link:before {\n  content: \"\"; }\n\n.ion-load-a:before {\n  content: \"\"; }\n\n.ion-load-b:before {\n  content: \"\"; }\n\n.ion-load-c:before {\n  content: \"\"; }\n\n.ion-load-d:before {\n  content: \"\"; }\n\n.ion-location:before {\n  content: \"\"; }\n\n.ion-lock-combination:before {\n  content: \"\"; }\n\n.ion-locked:before {\n  content: \"\"; }\n\n.ion-log-in:before {\n  content: \"\"; }\n\n.ion-log-out:before {\n  content: \"\"; }\n\n.ion-loop:before {\n  content: \"\"; }\n\n.ion-magnet:before {\n  content: \"\"; }\n\n.ion-male:before {\n  content: \"\"; }\n\n.ion-man:before {\n  content: \"\"; }\n\n.ion-map:before {\n  content: \"\"; }\n\n.ion-medkit:before {\n  content: \"\"; }\n\n.ion-merge:before {\n  content: \"\"; }\n\n.ion-mic-a:before {\n  content: \"\"; }\n\n.ion-mic-b:before {\n  content: \"\"; }\n\n.ion-mic-c:before {\n  content: \"\"; }\n\n.ion-minus:before {\n  content: \"\"; }\n\n.ion-minus-circled:before {\n  content: \"\"; }\n\n.ion-minus-round:before {\n  content: \"\"; }\n\n.ion-model-s:before {\n  content: \"\"; }\n\n.ion-monitor:before {\n  content: \"\"; }\n\n.ion-more:before {\n  content: \"\"; }\n\n.ion-mouse:before {\n  content: \"\"; }\n\n.ion-music-note:before {\n  content: \"\"; }\n\n.ion-navicon:before {\n  content: \"\"; }\n\n.ion-navicon-round:before {\n  content: \"\"; }\n\n.ion-navigate:before {\n  content: \"\"; }\n\n.ion-network:before {\n  content: \"\"; }\n\n.ion-no-smoking:before {\n  content: \"\"; }\n\n.ion-nuclear:before {\n  content: \"\"; }\n\n.ion-outlet:before {\n  content: \"\"; }\n\n.ion-paintbrush:before {\n  content: \"\"; }\n\n.ion-paintbucket:before {\n  content: \"\"; }\n\n.ion-paper-airplane:before {\n  content: \"\"; }\n\n.ion-paperclip:before {\n  content: \"\"; }\n\n.ion-pause:before {\n  content: \"\"; }\n\n.ion-person:before {\n  content: \"\"; }\n\n.ion-person-add:before {\n  content: \"\"; }\n\n.ion-person-stalker:before {\n  content: \"\"; }\n\n.ion-pie-graph:before {\n  content: \"\"; }\n\n.ion-pin:before {\n  content: \"\"; }\n\n.ion-pinpoint:before {\n  content: \"\"; }\n\n.ion-pizza:before {\n  content: \"\"; }\n\n.ion-plane:before {\n  content: \"\"; }\n\n.ion-planet:before {\n  content: \"\"; }\n\n.ion-play:before {\n  content: \"\"; }\n\n.ion-playstation:before {\n  content: \"\"; }\n\n.ion-plus:before {\n  content: \"\"; }\n\n.ion-plus-circled:before {\n  content: \"\"; }\n\n.ion-plus-round:before {\n  content: \"\"; }\n\n.ion-podium:before {\n  content: \"\"; }\n\n.ion-pound:before {\n  content: \"\"; }\n\n.ion-power:before {\n  content: \"\"; }\n\n.ion-pricetag:before {\n  content: \"\"; }\n\n.ion-pricetags:before {\n  content: \"\"; }\n\n.ion-printer:before {\n  content: \"\"; }\n\n.ion-pull-request:before {\n  content: \"\"; }\n\n.ion-qr-scanner:before {\n  content: \"\"; }\n\n.ion-quote:before {\n  content: \"\"; }\n\n.ion-radio-waves:before {\n  content: \"\"; }\n\n.ion-record:before {\n  content: \"\"; }\n\n.ion-refresh:before {\n  content: \"\"; }\n\n.ion-reply:before {\n  content: \"\"; }\n\n.ion-reply-all:before {\n  content: \"\"; }\n\n.ion-ribbon-a:before {\n  content: \"\"; }\n\n.ion-ribbon-b:before {\n  content: \"\"; }\n\n.ion-sad:before {\n  content: \"\"; }\n\n.ion-sad-outline:before {\n  content: \"\"; }\n\n.ion-scissors:before {\n  content: \"\"; }\n\n.ion-search:before {\n  content: \"\"; }\n\n.ion-settings:before {\n  content: \"\"; }\n\n.ion-share:before {\n  content: \"\"; }\n\n.ion-shuffle:before {\n  content: \"\"; }\n\n.ion-skip-backward:before {\n  content: \"\"; }\n\n.ion-skip-forward:before {\n  content: \"\"; }\n\n.ion-social-android:before {\n  content: \"\"; }\n\n.ion-social-android-outline:before {\n  content: \"\"; }\n\n.ion-social-angular:before {\n  content: \"\"; }\n\n.ion-social-angular-outline:before {\n  content: \"\"; }\n\n.ion-social-apple:before {\n  content: \"\"; }\n\n.ion-social-apple-outline:before {\n  content: \"\"; }\n\n.ion-social-bitcoin:before {\n  content: \"\"; }\n\n.ion-social-bitcoin-outline:before {\n  content: \"\"; }\n\n.ion-social-buffer:before {\n  content: \"\"; }\n\n.ion-social-buffer-outline:before {\n  content: \"\"; }\n\n.ion-social-chrome:before {\n  content: \"\"; }\n\n.ion-social-chrome-outline:before {\n  content: \"\"; }\n\n.ion-social-codepen:before {\n  content: \"\"; }\n\n.ion-social-codepen-outline:before {\n  content: \"\"; }\n\n.ion-social-css3:before {\n  content: \"\"; }\n\n.ion-social-css3-outline:before {\n  content: \"\"; }\n\n.ion-social-designernews:before {\n  content: \"\"; }\n\n.ion-social-designernews-outline:before {\n  content: \"\"; }\n\n.ion-social-dribbble:before {\n  content: \"\"; }\n\n.ion-social-dribbble-outline:before {\n  content: \"\"; }\n\n.ion-social-dropbox:before {\n  content: \"\"; }\n\n.ion-social-dropbox-outline:before {\n  content: \"\"; }\n\n.ion-social-euro:before {\n  content: \"\"; }\n\n.ion-social-euro-outline:before {\n  content: \"\"; }\n\n.ion-social-facebook:before {\n  content: \"\"; }\n\n.ion-social-facebook-outline:before {\n  content: \"\"; }\n\n.ion-social-foursquare:before {\n  content: \"\"; }\n\n.ion-social-foursquare-outline:before {\n  content: \"\"; }\n\n.ion-social-freebsd-devil:before {\n  content: \"\"; }\n\n.ion-social-github:before {\n  content: \"\"; }\n\n.ion-social-github-outline:before {\n  content: \"\"; }\n\n.ion-social-google:before {\n  content: \"\"; }\n\n.ion-social-google-outline:before {\n  content: \"\"; }\n\n.ion-social-googleplus:before {\n  content: \"\"; }\n\n.ion-social-googleplus-outline:before {\n  content: \"\"; }\n\n.ion-social-hackernews:before {\n  content: \"\"; }\n\n.ion-social-hackernews-outline:before {\n  content: \"\"; }\n\n.ion-social-html5:before {\n  content: \"\"; }\n\n.ion-social-html5-outline:before {\n  content: \"\"; }\n\n.ion-social-instagram:before {\n  content: \"\"; }\n\n.ion-social-instagram-outline:before {\n  content: \"\"; }\n\n.ion-social-javascript:before {\n  content: \"\"; }\n\n.ion-social-javascript-outline:before {\n  content: \"\"; }\n\n.ion-social-linkedin:before {\n  content: \"\"; }\n\n.ion-social-linkedin-outline:before {\n  content: \"\"; }\n\n.ion-social-markdown:before {\n  content: \"\"; }\n\n.ion-social-nodejs:before {\n  content: \"\"; }\n\n.ion-social-octocat:before {\n  content: \"\"; }\n\n.ion-social-pinterest:before {\n  content: \"\"; }\n\n.ion-social-pinterest-outline:before {\n  content: \"\"; }\n\n.ion-social-python:before {\n  content: \"\"; }\n\n.ion-social-reddit:before {\n  content: \"\"; }\n\n.ion-social-reddit-outline:before {\n  content: \"\"; }\n\n.ion-social-rss:before {\n  content: \"\"; }\n\n.ion-social-rss-outline:before {\n  content: \"\"; }\n\n.ion-social-sass:before {\n  content: \"\"; }\n\n.ion-social-skype:before {\n  content: \"\"; }\n\n.ion-social-skype-outline:before {\n  content: \"\"; }\n\n.ion-social-snapchat:before {\n  content: \"\"; }\n\n.ion-social-snapchat-outline:before {\n  content: \"\"; }\n\n.ion-social-tumblr:before {\n  content: \"\"; }\n\n.ion-social-tumblr-outline:before {\n  content: \"\"; }\n\n.ion-social-tux:before {\n  content: \"\"; }\n\n.ion-social-twitch:before {\n  content: \"\"; }\n\n.ion-social-twitch-outline:before {\n  content: \"\"; }\n\n.ion-social-twitter:before {\n  content: \"\"; }\n\n.ion-social-twitter-outline:before {\n  content: \"\"; }\n\n.ion-social-usd:before {\n  content: \"\"; }\n\n.ion-social-usd-outline:before {\n  content: \"\"; }\n\n.ion-social-vimeo:before {\n  content: \"\"; }\n\n.ion-social-vimeo-outline:before {\n  content: \"\"; }\n\n.ion-social-whatsapp:before {\n  content: \"\"; }\n\n.ion-social-whatsapp-outline:before {\n  content: \"\"; }\n\n.ion-social-windows:before {\n  content: \"\"; }\n\n.ion-social-windows-outline:before {\n  content: \"\"; }\n\n.ion-social-wordpress:before {\n  content: \"\"; }\n\n.ion-social-wordpress-outline:before {\n  content: \"\"; }\n\n.ion-social-yahoo:before {\n  content: \"\"; }\n\n.ion-social-yahoo-outline:before {\n  content: \"\"; }\n\n.ion-social-yen:before {\n  content: \"\"; }\n\n.ion-social-yen-outline:before {\n  content: \"\"; }\n\n.ion-social-youtube:before {\n  content: \"\"; }\n\n.ion-social-youtube-outline:before {\n  content: \"\"; }\n\n.ion-soup-can:before {\n  content: \"\"; }\n\n.ion-soup-can-outline:before {\n  content: \"\"; }\n\n.ion-speakerphone:before {\n  content: \"\"; }\n\n.ion-speedometer:before {\n  content: \"\"; }\n\n.ion-spoon:before {\n  content: \"\"; }\n\n.ion-star:before {\n  content: \"\"; }\n\n.ion-stats-bars:before {\n  content: \"\"; }\n\n.ion-steam:before {\n  content: \"\"; }\n\n.ion-stop:before {\n  content: \"\"; }\n\n.ion-thermometer:before {\n  content: \"\"; }\n\n.ion-thumbsdown:before {\n  content: \"\"; }\n\n.ion-thumbsup:before {\n  content: \"\"; }\n\n.ion-toggle:before {\n  content: \"\"; }\n\n.ion-toggle-filled:before {\n  content: \"\"; }\n\n.ion-transgender:before {\n  content: \"\"; }\n\n.ion-trash-a:before {\n  content: \"\"; }\n\n.ion-trash-b:before {\n  content: \"\"; }\n\n.ion-trophy:before {\n  content: \"\"; }\n\n.ion-tshirt:before {\n  content: \"\"; }\n\n.ion-tshirt-outline:before {\n  content: \"\"; }\n\n.ion-umbrella:before {\n  content: \"\"; }\n\n.ion-university:before {\n  content: \"\"; }\n\n.ion-unlocked:before {\n  content: \"\"; }\n\n.ion-upload:before {\n  content: \"\"; }\n\n.ion-usb:before {\n  content: \"\"; }\n\n.ion-videocamera:before {\n  content: \"\"; }\n\n.ion-volume-high:before {\n  content: \"\"; }\n\n.ion-volume-low:before {\n  content: \"\"; }\n\n.ion-volume-medium:before {\n  content: \"\"; }\n\n.ion-volume-mute:before {\n  content: \"\"; }\n\n.ion-wand:before {\n  content: \"\"; }\n\n.ion-waterdrop:before {\n  content: \"\"; }\n\n.ion-wifi:before {\n  content: \"\"; }\n\n.ion-wineglass:before {\n  content: \"\"; }\n\n.ion-woman:before {\n  content: \"\"; }\n\n.ion-wrench:before {\n  content: \"\"; }\n\n.ion-xbox:before {\n  content: \"\"; }\n\n/**\n * Resets\n * --------------------------------------------------\n * Adapted from normalize.css and some reset.css. We don't care even one\n * bit about old IE, so we don't need any hacks for that in here.\n *\n * There are probably other things we could remove here, as well.\n *\n * normalize.css v2.1.2 | MIT License | git.io/normalize\n\n * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)\n * http://cssreset.com\n */\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, i, u, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed, fieldset,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  vertical-align: baseline;\n  font: inherit;\n  font-size: 100%; }\n\nol, ul {\n  list-style: none; }\n\nblockquote, q {\n  quotes: none; }\n\nblockquote:before, blockquote:after,\nq:before, q:after {\n  content: '';\n  content: none; }\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\naudio:not([controls]) {\n  display: none;\n  height: 0; }\n\n/**\n * Hide the `template` element in IE, Safari, and Firefox < 22.\n */\n[hidden],\ntemplate {\n  display: none; }\n\nscript {\n  display: none !important; }\n\n/* ==========================================================================\n   Base\n   ========================================================================== */\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n *  user zoom.\n */\nhtml {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  font-family: sans-serif;\n  /* 1 */\n  -webkit-text-size-adjust: 100%;\n  -ms-text-size-adjust: 100%;\n  /* 2 */\n  -webkit-text-size-adjust: 100%;\n  /* 2 */ }\n\n/**\n * Remove default margin.\n */\nbody {\n  margin: 0;\n  line-height: 1; }\n\n/**\n * Remove default outlines.\n */\na,\nbutton,\n:focus,\na:focus,\nbutton:focus,\na:active,\na:hover {\n  outline: 0; }\n\n/* *\n * Remove tap highlight color\n */\na {\n  -webkit-user-drag: none;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-tap-highlight-color: transparent; }\n  a[href]:hover {\n    cursor: pointer; }\n\n/* ==========================================================================\n   Typography\n   ========================================================================== */\n/**\n * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n */\nb,\nstrong {\n  font-weight: bold; }\n\n/**\n * Address styling not present in Safari 5 and Chrome.\n */\ndfn {\n  font-style: italic; }\n\n/**\n * Address differences between Firefox and other browsers.\n */\nhr {\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  height: 0; }\n\n/**\n * Correct font family set oddly in Safari 5 and Chrome.\n */\ncode,\nkbd,\npre,\nsamp {\n  font-size: 1em;\n  font-family: monospace, serif; }\n\n/**\n * Improve readability of pre-formatted text in all browsers.\n */\npre {\n  white-space: pre-wrap; }\n\n/**\n * Set consistent quote types.\n */\nq {\n  quotes: \"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\"; }\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\nsmall {\n  font-size: 80%; }\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\nsub,\nsup {\n  position: relative;\n  vertical-align: baseline;\n  font-size: 75%;\n  line-height: 0; }\n\nsup {\n  top: -0.5em; }\n\nsub {\n  bottom: -0.25em; }\n\n/**\n * Define consistent border, margin, and padding.\n */\nfieldset {\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n  border: 1px solid #c0c0c0; }\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\nlegend {\n  padding: 0;\n  /* 2 */\n  border: 0;\n  /* 1 */ }\n\n/**\n * 1. Correct font family not being inherited in all browsers.\n * 2. Correct font size not being inherited in all browsers.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n * 4. Remove any default :focus styles\n * 5. Make sure webkit font smoothing is being inherited\n * 6. Remove default gradient in Android Firefox / FirefoxOS\n */\nbutton,\ninput,\nselect,\ntextarea {\n  margin: 0;\n  /* 3 */\n  font-size: 100%;\n  /* 2 */\n  font-family: inherit;\n  /* 1 */\n  outline-offset: 0;\n  /* 4 */\n  outline-style: none;\n  /* 4 */\n  outline-width: 0;\n  /* 4 */\n  -webkit-font-smoothing: inherit;\n  /* 5 */\n  background-image: none;\n  /* 6 */ }\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `importnt` in\n * the UA stylesheet.\n */\nbutton,\ninput {\n  line-height: normal; }\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\n */\nbutton,\nselect {\n  text-transform: none; }\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n *  and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n *  `input` and others.\n */\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  cursor: pointer;\n  /* 3 */\n  -webkit-appearance: button;\n  /* 2 */ }\n\n/**\n * Re-set default cursor for disabled elements.\n */\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default; }\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n *  (include `-moz` to future-proof).\n */\ninput[type=\"search\"] {\n  -webkit-box-sizing: content-box;\n  /* 2 */\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  -webkit-appearance: textfield;\n  /* 1 */ }\n\n/**\n * Remove inner padding and search cancel button in Safari 5 and Chrome\n * on OS X.\n */\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none; }\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  padding: 0;\n  border: 0; }\n\n/**\n * 1. Remove default vertical scrollbar in IE 8/9.\n * 2. Improve readability and alignment in all browsers.\n */\ntextarea {\n  overflow: auto;\n  /* 1 */\n  vertical-align: top;\n  /* 2 */ }\n\nimg {\n  -webkit-user-drag: none; }\n\n/* ==========================================================================\n   Tables\n   ========================================================================== */\n/**\n * Remove most spacing between table cells.\n */\ntable {\n  border-spacing: 0;\n  border-collapse: collapse; }\n\n/**\n * Scaffolding\n * --------------------------------------------------\n */\n*,\n*:before,\n*:after {\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box; }\n\nhtml {\n  overflow: hidden;\n  -ms-touch-action: pan-y;\n  touch-action: pan-y; }\n\nbody,\n.ionic-body {\n  -webkit-touch-callout: none;\n  -webkit-font-smoothing: antialiased;\n  font-smoothing: antialiased;\n  -webkit-text-size-adjust: none;\n  -moz-text-size-adjust: none;\n  text-size-adjust: none;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n  margin: 0;\n  padding: 0;\n  color: #000;\n  word-wrap: break-word;\n  font-size: 14px;\n  font-family: -apple-system;\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif;\n  line-height: 20px;\n  text-rendering: optimizeLegibility;\n  -webkit-backface-visibility: hidden;\n  -webkit-user-drag: none;\n  -ms-content-zooming: none; }\n\nbody.grade-b,\nbody.grade-c {\n  text-rendering: auto; }\n\n.content {\n  position: relative; }\n\n.scroll-content {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n  margin-top: -1px;\n  padding-top: 1px;\n  margin-bottom: -1px;\n  width: auto;\n  height: auto; }\n\n.menu .scroll-content.scroll-content-false {\n  z-index: 11; }\n\n.scroll-view {\n  position: relative;\n  display: block;\n  overflow: hidden;\n  margin-top: -1px; }\n  .scroll-view.overflow-scroll {\n    position: relative; }\n  .scroll-view.scroll-x {\n    overflow-x: scroll;\n    overflow-y: hidden; }\n  .scroll-view.scroll-y {\n    overflow-x: hidden;\n    overflow-y: scroll; }\n  .scroll-view.scroll-xy {\n    overflow-x: scroll;\n    overflow-y: scroll; }\n\n/**\n * Scroll is the scroll view component available for complex and custom\n * scroll view functionality.\n */\n.scroll {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  -webkit-touch-callout: none;\n  -webkit-text-size-adjust: none;\n  -moz-text-size-adjust: none;\n  text-size-adjust: none;\n  -webkit-transform-origin: left top;\n  transform-origin: left top; }\n\n/**\n * Set ms-viewport to prevent MS \"page squish\" and allow fluid scrolling\n * https://msdn.microsoft.com/en-us/library/ie/hh869615(v=vs.85).aspx\n */\n@-ms-viewport {\n  width: device-width; }\n\n.scroll-bar {\n  position: absolute;\n  z-index: 9999; }\n\n.ng-animate .scroll-bar {\n  visibility: hidden; }\n\n.scroll-bar-h {\n  right: 2px;\n  bottom: 3px;\n  left: 2px;\n  height: 3px; }\n  .scroll-bar-h .scroll-bar-indicator {\n    height: 100%; }\n\n.scroll-bar-v {\n  top: 2px;\n  right: 3px;\n  bottom: 2px;\n  width: 3px; }\n  .scroll-bar-v .scroll-bar-indicator {\n    width: 100%; }\n\n.scroll-bar-indicator {\n  position: absolute;\n  border-radius: 4px;\n  background: rgba(0, 0, 0, 0.3);\n  opacity: 1;\n  -webkit-transition: opacity 0.3s linear;\n  transition: opacity 0.3s linear; }\n  .scroll-bar-indicator.scroll-bar-fade-out {\n    opacity: 0; }\n\n.platform-android .scroll-bar-indicator {\n  border-radius: 0; }\n\n.grade-b .scroll-bar-indicator,\n.grade-c .scroll-bar-indicator {\n  background: #aaa; }\n  .grade-b .scroll-bar-indicator.scroll-bar-fade-out,\n  .grade-c .scroll-bar-indicator.scroll-bar-fade-out {\n    -webkit-transition: none;\n    transition: none; }\n\nion-infinite-scroll {\n  height: 60px;\n  width: 100%;\n  display: block;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: row;\n  -moz-flex-direction: row;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center; }\n  ion-infinite-scroll .icon {\n    color: #666666;\n    font-size: 30px;\n    color: #666666; }\n  ion-infinite-scroll:not(.active) .spinner,\n  ion-infinite-scroll:not(.active) .icon:before {\n    display: none; }\n\n.overflow-scroll {\n  overflow-x: hidden;\n  overflow-y: scroll;\n  -webkit-overflow-scrolling: touch;\n  -ms-overflow-style: -ms-autohiding-scrollbar;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  position: absolute; }\n  .overflow-scroll.pane {\n    overflow-x: hidden;\n    overflow-y: scroll; }\n  .overflow-scroll .scroll {\n    position: static;\n    height: 100%;\n    -webkit-transform: translate3d(0, 0, 0); }\n\n/* If you change these, change platform.scss as well */\n.has-header {\n  top: 44px; }\n\n.no-header {\n  top: 0; }\n\n.has-subheader {\n  top: 88px; }\n\n.has-tabs-top {\n  top: 93px; }\n\n.has-header.has-subheader.has-tabs-top {\n  top: 137px; }\n\n.has-footer {\n  bottom: 44px; }\n\n.has-subfooter {\n  bottom: 88px; }\n\n.has-tabs,\n.bar-footer.has-tabs {\n  bottom: 49px; }\n  .has-tabs.pane,\n  .bar-footer.has-tabs.pane {\n    bottom: 49px;\n    height: auto; }\n\n.bar-subfooter.has-tabs {\n  bottom: 93px; }\n\n.has-footer.has-tabs {\n  bottom: 93px; }\n\n.pane {\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  -webkit-transition-duration: 0;\n  transition-duration: 0;\n  z-index: 1; }\n\n.view {\n  z-index: 1; }\n\n.pane,\n.view {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background-color: #fff;\n  overflow: hidden; }\n\n.view-container {\n  position: absolute;\n  display: block;\n  width: 100%;\n  height: 100%; }\n\n/**\n * Typography\n * --------------------------------------------------\n */\np {\n  margin: 0 0 10px; }\n\nsmall {\n  font-size: 85%; }\n\ncite {\n  font-style: normal; }\n\n.text-left {\n  text-align: left; }\n\n.text-right {\n  text-align: right; }\n\n.text-center {\n  text-align: center; }\n\nh1, h2, h3, h4, h5, h6,\n.h1, .h2, .h3, .h4, .h5, .h6 {\n  color: #000;\n  font-weight: 500;\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif;\n  line-height: 1.2; }\n  h1 small, h2 small, h3 small, h4 small, h5 small, h6 small,\n  .h1 small, .h2 small, .h3 small, .h4 small, .h5 small, .h6 small {\n    font-weight: normal;\n    line-height: 1; }\n\nh1, .h1,\nh2, .h2,\nh3, .h3 {\n  margin-top: 20px;\n  margin-bottom: 10px; }\n  h1:first-child, .h1:first-child,\n  h2:first-child, .h2:first-child,\n  h3:first-child, .h3:first-child {\n    margin-top: 0; }\n  h1 + h1, h1 + .h1,\n  h1 + h2, h1 + .h2,\n  h1 + h3, h1 + .h3, .h1 + h1, .h1 + .h1,\n  .h1 + h2, .h1 + .h2,\n  .h1 + h3, .h1 + .h3,\n  h2 + h1,\n  h2 + .h1,\n  h2 + h2,\n  h2 + .h2,\n  h2 + h3,\n  h2 + .h3, .h2 + h1, .h2 + .h1,\n  .h2 + h2, .h2 + .h2,\n  .h2 + h3, .h2 + .h3,\n  h3 + h1,\n  h3 + .h1,\n  h3 + h2,\n  h3 + .h2,\n  h3 + h3,\n  h3 + .h3, .h3 + h1, .h3 + .h1,\n  .h3 + h2, .h3 + .h2,\n  .h3 + h3, .h3 + .h3 {\n    margin-top: 10px; }\n\nh4, .h4,\nh5, .h5,\nh6, .h6 {\n  margin-top: 10px;\n  margin-bottom: 10px; }\n\nh1, .h1 {\n  font-size: 36px; }\n\nh2, .h2 {\n  font-size: 30px; }\n\nh3, .h3 {\n  font-size: 24px; }\n\nh4, .h4 {\n  font-size: 18px; }\n\nh5, .h5 {\n  font-size: 14px; }\n\nh6, .h6 {\n  font-size: 12px; }\n\nh1 small, .h1 small {\n  font-size: 24px; }\n\nh2 small, .h2 small {\n  font-size: 18px; }\n\nh3 small, .h3 small,\nh4 small, .h4 small {\n  font-size: 14px; }\n\ndl {\n  margin-bottom: 20px; }\n\ndt,\ndd {\n  line-height: 1.42857; }\n\ndt {\n  font-weight: bold; }\n\nblockquote {\n  margin: 0 0 20px;\n  padding: 10px 20px;\n  border-left: 5px solid gray; }\n  blockquote p {\n    font-weight: 300;\n    font-size: 17.5px;\n    line-height: 1.25; }\n  blockquote p:last-child {\n    margin-bottom: 0; }\n  blockquote small {\n    display: block;\n    line-height: 1.42857; }\n    blockquote small:before {\n      content: '\\2014 \\00A0'; }\n\nq:before,\nq:after,\nblockquote:before,\nblockquote:after {\n  content: \"\"; }\n\naddress {\n  display: block;\n  margin-bottom: 20px;\n  font-style: normal;\n  line-height: 1.42857; }\n\na {\n  color: #387ef5; }\n\na.subdued {\n  padding-right: 10px;\n  color: #888;\n  text-decoration: none; }\n  a.subdued:hover {\n    text-decoration: none; }\n  a.subdued:last-child {\n    padding-right: 0; }\n\n/**\n * Action Sheets\n * --------------------------------------------------\n */\n.action-sheet-backdrop {\n  -webkit-transition: background-color 150ms ease-in-out;\n  transition: background-color 150ms ease-in-out;\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 11;\n  width: 100%;\n  height: 100%;\n  background-color: transparent; }\n  .action-sheet-backdrop.active {\n    background-color: rgba(0, 0, 0, 0.4); }\n\n.action-sheet-wrapper {\n  -webkit-transform: translate3d(0, 100%, 0);\n  transform: translate3d(0, 100%, 0);\n  -webkit-transition: all cubic-bezier(0.36, 0.66, 0.04, 1) 500ms;\n  transition: all cubic-bezier(0.36, 0.66, 0.04, 1) 500ms;\n  position: absolute;\n  bottom: 0;\n  left: 0;\n  right: 0;\n  width: 100%;\n  max-width: 500px;\n  margin: auto; }\n\n.action-sheet-up {\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n\n.action-sheet {\n  margin-left: 8px;\n  margin-right: 8px;\n  width: auto;\n  z-index: 11;\n  overflow: hidden; }\n  .action-sheet .button {\n    display: block;\n    padding: 1px;\n    width: 100%;\n    border-radius: 0;\n    border-color: #d1d3d6;\n    background-color: transparent;\n    color: #007aff;\n    font-size: 21px; }\n    .action-sheet .button:hover {\n      color: #007aff; }\n    .action-sheet .button.destructive {\n      color: #ff3b30; }\n      .action-sheet .button.destructive:hover {\n        color: #ff3b30; }\n  .action-sheet .button.active, .action-sheet .button.activated {\n    box-shadow: none;\n    border-color: #d1d3d6;\n    color: #007aff;\n    background: #e4e5e7; }\n\n.action-sheet-has-icons .icon {\n  position: absolute;\n  left: 16px; }\n\n.action-sheet-title {\n  padding: 16px;\n  color: #8f8f8f;\n  text-align: center;\n  font-size: 13px; }\n\n.action-sheet-group {\n  margin-bottom: 8px;\n  border-radius: 4px;\n  background-color: #fff;\n  overflow: hidden; }\n  .action-sheet-group .button {\n    border-width: 1px 0px 0px 0px; }\n  .action-sheet-group .button:first-child:last-child {\n    border-width: 0; }\n\n.action-sheet-options {\n  background: #f1f2f3; }\n\n.action-sheet-cancel .button {\n  font-weight: 500; }\n\n.action-sheet-open {\n  pointer-events: none; }\n  .action-sheet-open.modal-open .modal {\n    pointer-events: none; }\n  .action-sheet-open .action-sheet-backdrop {\n    pointer-events: auto; }\n\n.platform-android .action-sheet-backdrop.active {\n  background-color: rgba(0, 0, 0, 0.2); }\n\n.platform-android .action-sheet {\n  margin: 0; }\n  .platform-android .action-sheet .action-sheet-title,\n  .platform-android .action-sheet .button {\n    text-align: left;\n    border-color: transparent;\n    font-size: 16px;\n    color: inherit; }\n  .platform-android .action-sheet .action-sheet-title {\n    font-size: 14px;\n    padding: 16px;\n    color: #666; }\n  .platform-android .action-sheet .button.active,\n  .platform-android .action-sheet .button.activated {\n    background: #e8e8e8; }\n\n.platform-android .action-sheet-group {\n  margin: 0;\n  border-radius: 0;\n  background-color: #fafafa; }\n\n.platform-android .action-sheet-cancel {\n  display: none; }\n\n.platform-android .action-sheet-has-icons .button {\n  padding-left: 56px; }\n\n.backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 11;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0, 0, 0, 0.4);\n  visibility: hidden;\n  opacity: 0;\n  -webkit-transition: 0.1s opacity linear;\n  transition: 0.1s opacity linear; }\n  .backdrop.visible {\n    visibility: visible; }\n  .backdrop.active {\n    opacity: 1; }\n\n/**\n * Bar (Headers and Footers)\n * --------------------------------------------------\n */\n.bar {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  position: absolute;\n  right: 0;\n  left: 0;\n  z-index: 9;\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n  padding: 5px;\n  width: 100%;\n  height: 44px;\n  border-width: 0;\n  border-style: solid;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid #ddd;\n  background-color: white;\n  /* border-width: 1px will actually create 2 device pixels on retina */\n  /* this nifty trick sets an actual 1px border on hi-res displays */\n  background-size: 0; }\n  @media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx) {\n    .bar {\n      border: none;\n      background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n      background-position: bottom;\n      background-size: 100% 1px;\n      background-repeat: no-repeat; } }\n  .bar.bar-clear {\n    border: none;\n    background: none;\n    color: #fff; }\n    .bar.bar-clear .button {\n      color: #fff; }\n    .bar.bar-clear .title {\n      color: #fff; }\n  .bar.item-input-inset .item-input-wrapper {\n    margin-top: -1px; }\n    .bar.item-input-inset .item-input-wrapper input {\n      padding-left: 8px;\n      width: 94%;\n      height: 28px;\n      background: transparent; }\n  .bar.bar-light {\n    border-color: #ddd;\n    background-color: white;\n    background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n    color: #444; }\n    .bar.bar-light .title {\n      color: #444; }\n    .bar.bar-light.bar-footer {\n      background-image: linear-gradient(180deg, #ddd, #ddd 50%, transparent 50%); }\n  .bar.bar-stable {\n    border-color: #b2b2b2;\n    background-color: #f8f8f8;\n    background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n    color: #444; }\n    .bar.bar-stable .title {\n      color: #444; }\n    .bar.bar-stable.bar-footer {\n      background-image: linear-gradient(180deg, #b2b2b2, #b2b2b2 50%, transparent 50%); }\n  .bar.bar-positive {\n    border-color: #0c60ee;\n    background-color: #387ef5;\n    background-image: linear-gradient(0deg, #0c60ee, #0c60ee 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-positive .title {\n      color: #fff; }\n    .bar.bar-positive.bar-footer {\n      background-image: linear-gradient(180deg, #0c60ee, #0c60ee 50%, transparent 50%); }\n  .bar.bar-calm {\n    border-color: #0a9dc7;\n    background-color: #11c1f3;\n    background-image: linear-gradient(0deg, #0a9dc7, #0a9dc7 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-calm .title {\n      color: #fff; }\n    .bar.bar-calm.bar-footer {\n      background-image: linear-gradient(180deg, #0a9dc7, #0a9dc7 50%, transparent 50%); }\n  .bar.bar-assertive {\n    border-color: #e42112;\n    background-color: #ef473a;\n    background-image: linear-gradient(0deg, #e42112, #e42112 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-assertive .title {\n      color: #fff; }\n    .bar.bar-assertive.bar-footer {\n      background-image: linear-gradient(180deg, #e42112, #e42112 50%, transparent 50%); }\n  .bar.bar-balanced {\n    border-color: #28a54c;\n    background-color: #33cd5f;\n    background-image: linear-gradient(0deg, #28a54c, #28a54c 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-balanced .title {\n      color: #fff; }\n    .bar.bar-balanced.bar-footer {\n      background-image: linear-gradient(180deg, #28a54c, #28a54c 50%, transparent 50%); }\n  .bar.bar-energized {\n    border-color: #e6b500;\n    background-color: #ffc900;\n    background-image: linear-gradient(0deg, #e6b500, #e6b500 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-energized .title {\n      color: #fff; }\n    .bar.bar-energized.bar-footer {\n      background-image: linear-gradient(180deg, #e6b500, #e6b500 50%, transparent 50%); }\n  .bar.bar-royal {\n    border-color: #6b46e5;\n    background-color: #886aea;\n    background-image: linear-gradient(0deg, #6b46e5, #6b46e5 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-royal .title {\n      color: #fff; }\n    .bar.bar-royal.bar-footer {\n      background-image: linear-gradient(180deg, #6b46e5, #6b46e5 50%, transparent 50%); }\n  .bar.bar-dark {\n    border-color: #111;\n    background-color: #444444;\n    background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-dark .title {\n      color: #fff; }\n    .bar.bar-dark.bar-footer {\n      background-image: linear-gradient(180deg, #111, #111 50%, transparent 50%); }\n  .bar .title {\n    display: block;\n    position: absolute;\n    top: 0;\n    right: 0;\n    left: 0;\n    z-index: 0;\n    overflow: hidden;\n    margin: 0 10px;\n    min-width: 30px;\n    height: 43px;\n    text-align: center;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n    font-size: 17px;\n    font-weight: 500;\n    line-height: 44px; }\n    .bar .title.title-left {\n      text-align: left; }\n    .bar .title.title-right {\n      text-align: right; }\n  .bar .title a {\n    color: inherit; }\n  .bar .button, .bar button {\n    z-index: 1;\n    padding: 0 8px;\n    min-width: initial;\n    min-height: 31px;\n    font-weight: 400;\n    font-size: 13px;\n    line-height: 32px; }\n    .bar .button.button-icon:before,\n    .bar .button .icon:before, .bar .button.icon:before, .bar .button.icon-left:before, .bar .button.icon-right:before, .bar button.button-icon:before,\n    .bar button .icon:before, .bar button.icon:before, .bar button.icon-left:before, .bar button.icon-right:before {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-size: 20px;\n      line-height: 32px; }\n    .bar .button.button-icon, .bar button.button-icon {\n      font-size: 17px; }\n      .bar .button.button-icon .icon:before, .bar .button.button-icon:before, .bar .button.button-icon.icon-left:before, .bar .button.button-icon.icon-right:before, .bar button.button-icon .icon:before, .bar button.button-icon:before, .bar button.button-icon.icon-left:before, .bar button.button-icon.icon-right:before {\n        vertical-align: top;\n        font-size: 32px;\n        line-height: 32px; }\n    .bar .button.button-clear, .bar button.button-clear {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-weight: 300;\n      font-size: 17px; }\n      .bar .button.button-clear .icon:before, .bar .button.button-clear.icon:before, .bar .button.button-clear.icon-left:before, .bar .button.button-clear.icon-right:before, .bar button.button-clear .icon:before, .bar button.button-clear.icon:before, .bar button.button-clear.icon-left:before, .bar button.button-clear.icon-right:before {\n        font-size: 32px;\n        line-height: 32px; }\n    .bar .button.back-button, .bar button.back-button {\n      display: block;\n      margin-right: 5px;\n      padding: 0;\n      white-space: nowrap;\n      font-weight: 400; }\n    .bar .button.back-button.active, .bar .button.back-button.activated, .bar button.back-button.active, .bar button.back-button.activated {\n      opacity: 0.2; }\n  .bar .button-bar > .button,\n  .bar .buttons > .button {\n    min-height: 31px;\n    line-height: 32px; }\n  .bar .button-bar + .button,\n  .bar .button + .button-bar {\n    margin-left: 5px; }\n  .bar .buttons,\n  .bar .buttons.primary-buttons,\n  .bar .buttons.secondary-buttons {\n    display: inherit; }\n  .bar .buttons span {\n    display: inline-block; }\n  .bar .buttons-left span {\n    margin-right: 5px;\n    display: inherit; }\n  .bar .buttons-right span {\n    margin-left: 5px;\n    display: inherit; }\n  .bar .title + .button:last-child,\n  .bar > .button + .button:last-child,\n  .bar > .button.pull-right,\n  .bar .buttons.pull-right,\n  .bar .title + .buttons {\n    position: absolute;\n    top: 5px;\n    right: 5px;\n    bottom: 5px; }\n\n.platform-android .nav-bar-has-subheader .bar {\n  background-image: none; }\n\n.platform-android .bar .back-button .icon:before {\n  font-size: 24px; }\n\n.platform-android .bar .title {\n  font-size: 19px;\n  line-height: 44px; }\n\n.bar-light .button {\n  border-color: #ddd;\n  background-color: white;\n  color: #444; }\n  .bar-light .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .bar-light .button.active, .bar-light .button.activated {\n    border-color: #ccc;\n    background-color: #fafafa; }\n  .bar-light .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #444;\n    font-size: 17px; }\n  .bar-light .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-stable .button {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  color: #444; }\n  .bar-stable .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .bar-stable .button.active, .bar-stable .button.activated {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n  .bar-stable .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #444;\n    font-size: 17px; }\n  .bar-stable .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-positive .button {\n  border-color: #0c60ee;\n  background-color: #387ef5;\n  color: #fff; }\n  .bar-positive .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-positive .button.active, .bar-positive .button.activated {\n    border-color: #0c60ee;\n    background-color: #0c60ee; }\n  .bar-positive .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-positive .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-calm .button {\n  border-color: #0a9dc7;\n  background-color: #11c1f3;\n  color: #fff; }\n  .bar-calm .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-calm .button.active, .bar-calm .button.activated {\n    border-color: #0a9dc7;\n    background-color: #0a9dc7; }\n  .bar-calm .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-calm .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-assertive .button {\n  border-color: #e42112;\n  background-color: #ef473a;\n  color: #fff; }\n  .bar-assertive .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-assertive .button.active, .bar-assertive .button.activated {\n    border-color: #e42112;\n    background-color: #e42112; }\n  .bar-assertive .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-assertive .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-balanced .button {\n  border-color: #28a54c;\n  background-color: #33cd5f;\n  color: #fff; }\n  .bar-balanced .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-balanced .button.active, .bar-balanced .button.activated {\n    border-color: #28a54c;\n    background-color: #28a54c; }\n  .bar-balanced .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-balanced .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-energized .button {\n  border-color: #e6b500;\n  background-color: #ffc900;\n  color: #fff; }\n  .bar-energized .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-energized .button.active, .bar-energized .button.activated {\n    border-color: #e6b500;\n    background-color: #e6b500; }\n  .bar-energized .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-energized .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-royal .button {\n  border-color: #6b46e5;\n  background-color: #886aea;\n  color: #fff; }\n  .bar-royal .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-royal .button.active, .bar-royal .button.activated {\n    border-color: #6b46e5;\n    background-color: #6b46e5; }\n  .bar-royal .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-royal .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-dark .button {\n  border-color: #111;\n  background-color: #444444;\n  color: #fff; }\n  .bar-dark .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-dark .button.active, .bar-dark .button.activated {\n    border-color: #000;\n    background-color: #262626; }\n  .bar-dark .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-dark .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-header {\n  top: 0;\n  border-top-width: 0;\n  border-bottom-width: 1px; }\n  .bar-header.has-tabs-top {\n    border-bottom-width: 0px;\n    background-image: none; }\n\n.tabs-top .bar-header {\n  border-bottom-width: 0px;\n  background-image: none; }\n\n.bar-footer {\n  bottom: 0;\n  border-top-width: 1px;\n  border-bottom-width: 0;\n  background-position: top;\n  height: 44px; }\n  .bar-footer.item-input-inset {\n    position: absolute; }\n  .bar-footer .title {\n    height: 43px;\n    line-height: 44px; }\n\n.bar-tabs {\n  padding: 0; }\n\n.bar-subheader {\n  top: 44px;\n  height: 44px; }\n  .bar-subheader .title {\n    height: 43px;\n    line-height: 44px; }\n\n.bar-subfooter {\n  bottom: 44px;\n  height: 44px; }\n  .bar-subfooter .title {\n    height: 43px;\n    line-height: 44px; }\n\n.nav-bar-block {\n  position: absolute;\n  top: 0;\n  right: 0;\n  left: 0;\n  z-index: 9; }\n\n.bar .back-button.hide,\n.bar .buttons .hide {\n  display: none; }\n\n.nav-bar-tabs-top .bar {\n  background-image: none; }\n\n/**\n * Tabs\n * --------------------------------------------------\n * A navigation bar with any number of tab items supported.\n */\n.tabs {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: horizontal;\n  -moz-flex-direction: horizontal;\n  -ms-flex-direction: horizontal;\n  flex-direction: horizontal;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  color: #444;\n  position: absolute;\n  bottom: 0;\n  z-index: 5;\n  width: 100%;\n  height: 49px;\n  border-style: solid;\n  border-top-width: 1px;\n  background-size: 0;\n  line-height: 49px; }\n  .tabs .tab-item .badge {\n    background-color: #444;\n    color: #f8f8f8; }\n  @media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx) {\n    .tabs {\n      padding-top: 2px;\n      border-top: none !important;\n      border-bottom: none;\n      background-position: top;\n      background-size: 100% 1px;\n      background-repeat: no-repeat; } }\n\n/* Allow parent element of tabs to define color, or just the tab itself */\n.tabs-light > .tabs,\n.tabs.tabs-light {\n  border-color: #ddd;\n  background-color: #fff;\n  background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n  color: #444; }\n  .tabs-light > .tabs .tab-item .badge,\n  .tabs.tabs-light .tab-item .badge {\n    background-color: #444;\n    color: #fff; }\n\n.tabs-stable > .tabs,\n.tabs.tabs-stable {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  color: #444; }\n  .tabs-stable > .tabs .tab-item .badge,\n  .tabs.tabs-stable .tab-item .badge {\n    background-color: #444;\n    color: #f8f8f8; }\n\n.tabs-positive > .tabs,\n.tabs.tabs-positive {\n  border-color: #0c60ee;\n  background-color: #387ef5;\n  background-image: linear-gradient(0deg, #0c60ee, #0c60ee 50%, transparent 50%);\n  color: #fff; }\n  .tabs-positive > .tabs .tab-item .badge,\n  .tabs.tabs-positive .tab-item .badge {\n    background-color: #fff;\n    color: #387ef5; }\n\n.tabs-calm > .tabs,\n.tabs.tabs-calm {\n  border-color: #0a9dc7;\n  background-color: #11c1f3;\n  background-image: linear-gradient(0deg, #0a9dc7, #0a9dc7 50%, transparent 50%);\n  color: #fff; }\n  .tabs-calm > .tabs .tab-item .badge,\n  .tabs.tabs-calm .tab-item .badge {\n    background-color: #fff;\n    color: #11c1f3; }\n\n.tabs-assertive > .tabs,\n.tabs.tabs-assertive {\n  border-color: #e42112;\n  background-color: #ef473a;\n  background-image: linear-gradient(0deg, #e42112, #e42112 50%, transparent 50%);\n  color: #fff; }\n  .tabs-assertive > .tabs .tab-item .badge,\n  .tabs.tabs-assertive .tab-item .badge {\n    background-color: #fff;\n    color: #ef473a; }\n\n.tabs-balanced > .tabs,\n.tabs.tabs-balanced {\n  border-color: #28a54c;\n  background-color: #33cd5f;\n  background-image: linear-gradient(0deg, #28a54c, #28a54c 50%, transparent 50%);\n  color: #fff; }\n  .tabs-balanced > .tabs .tab-item .badge,\n  .tabs.tabs-balanced .tab-item .badge {\n    background-color: #fff;\n    color: #33cd5f; }\n\n.tabs-energized > .tabs,\n.tabs.tabs-energized {\n  border-color: #e6b500;\n  background-color: #ffc900;\n  background-image: linear-gradient(0deg, #e6b500, #e6b500 50%, transparent 50%);\n  color: #fff; }\n  .tabs-energized > .tabs .tab-item .badge,\n  .tabs.tabs-energized .tab-item .badge {\n    background-color: #fff;\n    color: #ffc900; }\n\n.tabs-royal > .tabs,\n.tabs.tabs-royal {\n  border-color: #6b46e5;\n  background-color: #886aea;\n  background-image: linear-gradient(0deg, #6b46e5, #6b46e5 50%, transparent 50%);\n  color: #fff; }\n  .tabs-royal > .tabs .tab-item .badge,\n  .tabs.tabs-royal .tab-item .badge {\n    background-color: #fff;\n    color: #886aea; }\n\n.tabs-dark > .tabs,\n.tabs.tabs-dark {\n  border-color: #111;\n  background-color: #444;\n  background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n  color: #fff; }\n  .tabs-dark > .tabs .tab-item .badge,\n  .tabs.tabs-dark .tab-item .badge {\n    background-color: #fff;\n    color: #444; }\n\n.tabs-striped .tabs {\n  background-color: white;\n  background-image: none;\n  border: none;\n  border-bottom: 1px solid #ddd;\n  padding-top: 2px; }\n\n.tabs-striped .tab-item.tab-item-active, .tabs-striped .tab-item.active, .tabs-striped .tab-item.activated {\n  margin-top: -2px;\n  border-style: solid;\n  border-width: 2px 0 0 0;\n  border-color: #444; }\n  .tabs-striped .tab-item.tab-item-active .badge, .tabs-striped .tab-item.active .badge, .tabs-striped .tab-item.activated .badge {\n    top: 2px;\n    opacity: 1; }\n\n.tabs-striped.tabs-light .tabs {\n  background-color: #fff; }\n\n.tabs-striped.tabs-light .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-light .tab-item.tab-item-active, .tabs-striped.tabs-light .tab-item.active, .tabs-striped.tabs-light .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #444; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-stable .tabs {\n  background-color: #f8f8f8; }\n\n.tabs-striped.tabs-stable .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-stable .tab-item.tab-item-active, .tabs-striped.tabs-stable .tab-item.active, .tabs-striped.tabs-stable .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #444; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-positive .tabs {\n  background-color: #387ef5; }\n\n.tabs-striped.tabs-positive .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-positive .tab-item.tab-item-active, .tabs-striped.tabs-positive .tab-item.active, .tabs-striped.tabs-positive .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-calm .tabs {\n  background-color: #11c1f3; }\n\n.tabs-striped.tabs-calm .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-calm .tab-item.tab-item-active, .tabs-striped.tabs-calm .tab-item.active, .tabs-striped.tabs-calm .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-assertive .tabs {\n  background-color: #ef473a; }\n\n.tabs-striped.tabs-assertive .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-assertive .tab-item.tab-item-active, .tabs-striped.tabs-assertive .tab-item.active, .tabs-striped.tabs-assertive .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-balanced .tabs {\n  background-color: #33cd5f; }\n\n.tabs-striped.tabs-balanced .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-balanced .tab-item.tab-item-active, .tabs-striped.tabs-balanced .tab-item.active, .tabs-striped.tabs-balanced .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-energized .tabs {\n  background-color: #ffc900; }\n\n.tabs-striped.tabs-energized .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-energized .tab-item.tab-item-active, .tabs-striped.tabs-energized .tab-item.active, .tabs-striped.tabs-energized .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-royal .tabs {\n  background-color: #886aea; }\n\n.tabs-striped.tabs-royal .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-royal .tab-item.tab-item-active, .tabs-striped.tabs-royal .tab-item.active, .tabs-striped.tabs-royal .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-dark .tabs {\n  background-color: #444; }\n\n.tabs-striped.tabs-dark .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-dark .tab-item.tab-item-active, .tabs-striped.tabs-dark .tab-item.active, .tabs-striped.tabs-dark .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-background-light .tabs {\n  background-color: #fff;\n  background-image: none; }\n\n.tabs-striped.tabs-background-stable .tabs {\n  background-color: #f8f8f8;\n  background-image: none; }\n\n.tabs-striped.tabs-background-positive .tabs {\n  background-color: #387ef5;\n  background-image: none; }\n\n.tabs-striped.tabs-background-calm .tabs {\n  background-color: #11c1f3;\n  background-image: none; }\n\n.tabs-striped.tabs-background-assertive .tabs {\n  background-color: #ef473a;\n  background-image: none; }\n\n.tabs-striped.tabs-background-balanced .tabs {\n  background-color: #33cd5f;\n  background-image: none; }\n\n.tabs-striped.tabs-background-energized .tabs {\n  background-color: #ffc900;\n  background-image: none; }\n\n.tabs-striped.tabs-background-royal .tabs {\n  background-color: #886aea;\n  background-image: none; }\n\n.tabs-striped.tabs-background-dark .tabs {\n  background-color: #444;\n  background-image: none; }\n\n.tabs-striped.tabs-color-light .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-light .tab-item.tab-item-active, .tabs-striped.tabs-color-light .tab-item.active, .tabs-striped.tabs-color-light .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border: 0 solid #fff;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-light .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-light .tab-item.active .badge, .tabs-striped.tabs-color-light .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-stable .tab-item {\n  color: rgba(248, 248, 248, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-stable .tab-item.tab-item-active, .tabs-striped.tabs-color-stable .tab-item.active, .tabs-striped.tabs-color-stable .tab-item.activated {\n    margin-top: -2px;\n    color: #f8f8f8;\n    border: 0 solid #f8f8f8;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-stable .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-stable .tab-item.active .badge, .tabs-striped.tabs-color-stable .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-positive .tab-item {\n  color: rgba(56, 126, 245, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-positive .tab-item.tab-item-active, .tabs-striped.tabs-color-positive .tab-item.active, .tabs-striped.tabs-color-positive .tab-item.activated {\n    margin-top: -2px;\n    color: #387ef5;\n    border: 0 solid #387ef5;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-positive .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-positive .tab-item.active .badge, .tabs-striped.tabs-color-positive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-calm .tab-item {\n  color: rgba(17, 193, 243, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-calm .tab-item.tab-item-active, .tabs-striped.tabs-color-calm .tab-item.active, .tabs-striped.tabs-color-calm .tab-item.activated {\n    margin-top: -2px;\n    color: #11c1f3;\n    border: 0 solid #11c1f3;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-calm .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-calm .tab-item.active .badge, .tabs-striped.tabs-color-calm .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-assertive .tab-item {\n  color: rgba(239, 71, 58, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-assertive .tab-item.tab-item-active, .tabs-striped.tabs-color-assertive .tab-item.active, .tabs-striped.tabs-color-assertive .tab-item.activated {\n    margin-top: -2px;\n    color: #ef473a;\n    border: 0 solid #ef473a;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-assertive .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-assertive .tab-item.active .badge, .tabs-striped.tabs-color-assertive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-balanced .tab-item {\n  color: rgba(51, 205, 95, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-balanced .tab-item.tab-item-active, .tabs-striped.tabs-color-balanced .tab-item.active, .tabs-striped.tabs-color-balanced .tab-item.activated {\n    margin-top: -2px;\n    color: #33cd5f;\n    border: 0 solid #33cd5f;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-balanced .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-balanced .tab-item.active .badge, .tabs-striped.tabs-color-balanced .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-energized .tab-item {\n  color: rgba(255, 201, 0, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-energized .tab-item.tab-item-active, .tabs-striped.tabs-color-energized .tab-item.active, .tabs-striped.tabs-color-energized .tab-item.activated {\n    margin-top: -2px;\n    color: #ffc900;\n    border: 0 solid #ffc900;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-energized .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-energized .tab-item.active .badge, .tabs-striped.tabs-color-energized .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-royal .tab-item {\n  color: rgba(136, 106, 234, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-royal .tab-item.tab-item-active, .tabs-striped.tabs-color-royal .tab-item.active, .tabs-striped.tabs-color-royal .tab-item.activated {\n    margin-top: -2px;\n    color: #886aea;\n    border: 0 solid #886aea;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-royal .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-royal .tab-item.active .badge, .tabs-striped.tabs-color-royal .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-dark .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-dark .tab-item.tab-item-active, .tabs-striped.tabs-color-dark .tab-item.active, .tabs-striped.tabs-color-dark .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border: 0 solid #444;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-dark .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-dark .tab-item.active .badge, .tabs-striped.tabs-color-dark .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-background-light .tabs,\n.tabs-background-light > .tabs {\n  background-color: #fff;\n  background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n  border-color: #ddd; }\n\n.tabs-background-stable .tabs,\n.tabs-background-stable > .tabs {\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  border-color: #b2b2b2; }\n\n.tabs-background-positive .tabs,\n.tabs-background-positive > .tabs {\n  background-color: #387ef5;\n  background-image: linear-gradient(0deg, #0c60ee, #0c60ee 50%, transparent 50%);\n  border-color: #0c60ee; }\n\n.tabs-background-calm .tabs,\n.tabs-background-calm > .tabs {\n  background-color: #11c1f3;\n  background-image: linear-gradient(0deg, #0a9dc7, #0a9dc7 50%, transparent 50%);\n  border-color: #0a9dc7; }\n\n.tabs-background-assertive .tabs,\n.tabs-background-assertive > .tabs {\n  background-color: #ef473a;\n  background-image: linear-gradient(0deg, #e42112, #e42112 50%, transparent 50%);\n  border-color: #e42112; }\n\n.tabs-background-balanced .tabs,\n.tabs-background-balanced > .tabs {\n  background-color: #33cd5f;\n  background-image: linear-gradient(0deg, #28a54c, #28a54c 50%, transparent 50%);\n  border-color: #28a54c; }\n\n.tabs-background-energized .tabs,\n.tabs-background-energized > .tabs {\n  background-color: #ffc900;\n  background-image: linear-gradient(0deg, #e6b500, #e6b500 50%, transparent 50%);\n  border-color: #e6b500; }\n\n.tabs-background-royal .tabs,\n.tabs-background-royal > .tabs {\n  background-color: #886aea;\n  background-image: linear-gradient(0deg, #6b46e5, #6b46e5 50%, transparent 50%);\n  border-color: #6b46e5; }\n\n.tabs-background-dark .tabs,\n.tabs-background-dark > .tabs {\n  background-color: #444;\n  background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n  border-color: #111; }\n\n.tabs-color-light .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-color-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-light .tab-item.tab-item-active, .tabs-color-light .tab-item.active, .tabs-color-light .tab-item.activated {\n    color: #fff;\n    border: 0 solid #fff; }\n    .tabs-color-light .tab-item.tab-item-active .badge, .tabs-color-light .tab-item.active .badge, .tabs-color-light .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-stable .tab-item {\n  color: rgba(248, 248, 248, 0.4);\n  opacity: 1; }\n  .tabs-color-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-stable .tab-item.tab-item-active, .tabs-color-stable .tab-item.active, .tabs-color-stable .tab-item.activated {\n    color: #f8f8f8;\n    border: 0 solid #f8f8f8; }\n    .tabs-color-stable .tab-item.tab-item-active .badge, .tabs-color-stable .tab-item.active .badge, .tabs-color-stable .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-positive .tab-item {\n  color: rgba(56, 126, 245, 0.4);\n  opacity: 1; }\n  .tabs-color-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-positive .tab-item.tab-item-active, .tabs-color-positive .tab-item.active, .tabs-color-positive .tab-item.activated {\n    color: #387ef5;\n    border: 0 solid #387ef5; }\n    .tabs-color-positive .tab-item.tab-item-active .badge, .tabs-color-positive .tab-item.active .badge, .tabs-color-positive .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-calm .tab-item {\n  color: rgba(17, 193, 243, 0.4);\n  opacity: 1; }\n  .tabs-color-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-calm .tab-item.tab-item-active, .tabs-color-calm .tab-item.active, .tabs-color-calm .tab-item.activated {\n    color: #11c1f3;\n    border: 0 solid #11c1f3; }\n    .tabs-color-calm .tab-item.tab-item-active .badge, .tabs-color-calm .tab-item.active .badge, .tabs-color-calm .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-assertive .tab-item {\n  color: rgba(239, 71, 58, 0.4);\n  opacity: 1; }\n  .tabs-color-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-assertive .tab-item.tab-item-active, .tabs-color-assertive .tab-item.active, .tabs-color-assertive .tab-item.activated {\n    color: #ef473a;\n    border: 0 solid #ef473a; }\n    .tabs-color-assertive .tab-item.tab-item-active .badge, .tabs-color-assertive .tab-item.active .badge, .tabs-color-assertive .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-balanced .tab-item {\n  color: rgba(51, 205, 95, 0.4);\n  opacity: 1; }\n  .tabs-color-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-balanced .tab-item.tab-item-active, .tabs-color-balanced .tab-item.active, .tabs-color-balanced .tab-item.activated {\n    color: #33cd5f;\n    border: 0 solid #33cd5f; }\n    .tabs-color-balanced .tab-item.tab-item-active .badge, .tabs-color-balanced .tab-item.active .badge, .tabs-color-balanced .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-energized .tab-item {\n  color: rgba(255, 201, 0, 0.4);\n  opacity: 1; }\n  .tabs-color-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-energized .tab-item.tab-item-active, .tabs-color-energized .tab-item.active, .tabs-color-energized .tab-item.activated {\n    color: #ffc900;\n    border: 0 solid #ffc900; }\n    .tabs-color-energized .tab-item.tab-item-active .badge, .tabs-color-energized .tab-item.active .badge, .tabs-color-energized .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-royal .tab-item {\n  color: rgba(136, 106, 234, 0.4);\n  opacity: 1; }\n  .tabs-color-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-royal .tab-item.tab-item-active, .tabs-color-royal .tab-item.active, .tabs-color-royal .tab-item.activated {\n    color: #886aea;\n    border: 0 solid #886aea; }\n    .tabs-color-royal .tab-item.tab-item-active .badge, .tabs-color-royal .tab-item.active .badge, .tabs-color-royal .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-dark .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-color-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-dark .tab-item.tab-item-active, .tabs-color-dark .tab-item.active, .tabs-color-dark .tab-item.activated {\n    color: #444;\n    border: 0 solid #444; }\n    .tabs-color-dark .tab-item.tab-item-active .badge, .tabs-color-dark .tab-item.active .badge, .tabs-color-dark .tab-item.activated .badge {\n      opacity: 1; }\n\nion-tabs.tabs-color-active-light .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-light .tab-item.tab-item-active, ion-tabs.tabs-color-active-light .tab-item.active, ion-tabs.tabs-color-active-light .tab-item.activated {\n    color: #fff; }\n\nion-tabs.tabs-striped.tabs-color-active-light .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-light .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-light .tab-item.activated {\n  border-color: #fff;\n  color: #fff; }\n\nion-tabs.tabs-color-active-stable .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-stable .tab-item.tab-item-active, ion-tabs.tabs-color-active-stable .tab-item.active, ion-tabs.tabs-color-active-stable .tab-item.activated {\n    color: #f8f8f8; }\n\nion-tabs.tabs-striped.tabs-color-active-stable .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-stable .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-stable .tab-item.activated {\n  border-color: #f8f8f8;\n  color: #f8f8f8; }\n\nion-tabs.tabs-color-active-positive .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-positive .tab-item.tab-item-active, ion-tabs.tabs-color-active-positive .tab-item.active, ion-tabs.tabs-color-active-positive .tab-item.activated {\n    color: #387ef5; }\n\nion-tabs.tabs-striped.tabs-color-active-positive .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-positive .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-positive .tab-item.activated {\n  border-color: #387ef5;\n  color: #387ef5; }\n\nion-tabs.tabs-color-active-calm .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-calm .tab-item.tab-item-active, ion-tabs.tabs-color-active-calm .tab-item.active, ion-tabs.tabs-color-active-calm .tab-item.activated {\n    color: #11c1f3; }\n\nion-tabs.tabs-striped.tabs-color-active-calm .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-calm .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-calm .tab-item.activated {\n  border-color: #11c1f3;\n  color: #11c1f3; }\n\nion-tabs.tabs-color-active-assertive .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-assertive .tab-item.tab-item-active, ion-tabs.tabs-color-active-assertive .tab-item.active, ion-tabs.tabs-color-active-assertive .tab-item.activated {\n    color: #ef473a; }\n\nion-tabs.tabs-striped.tabs-color-active-assertive .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-assertive .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-assertive .tab-item.activated {\n  border-color: #ef473a;\n  color: #ef473a; }\n\nion-tabs.tabs-color-active-balanced .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-balanced .tab-item.tab-item-active, ion-tabs.tabs-color-active-balanced .tab-item.active, ion-tabs.tabs-color-active-balanced .tab-item.activated {\n    color: #33cd5f; }\n\nion-tabs.tabs-striped.tabs-color-active-balanced .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-balanced .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-balanced .tab-item.activated {\n  border-color: #33cd5f;\n  color: #33cd5f; }\n\nion-tabs.tabs-color-active-energized .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-energized .tab-item.tab-item-active, ion-tabs.tabs-color-active-energized .tab-item.active, ion-tabs.tabs-color-active-energized .tab-item.activated {\n    color: #ffc900; }\n\nion-tabs.tabs-striped.tabs-color-active-energized .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-energized .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-energized .tab-item.activated {\n  border-color: #ffc900;\n  color: #ffc900; }\n\nion-tabs.tabs-color-active-royal .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-royal .tab-item.tab-item-active, ion-tabs.tabs-color-active-royal .tab-item.active, ion-tabs.tabs-color-active-royal .tab-item.activated {\n    color: #886aea; }\n\nion-tabs.tabs-striped.tabs-color-active-royal .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-royal .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-royal .tab-item.activated {\n  border-color: #886aea;\n  color: #886aea; }\n\nion-tabs.tabs-color-active-dark .tab-item {\n  color: #fff; }\n  ion-tabs.tabs-color-active-dark .tab-item.tab-item-active, ion-tabs.tabs-color-active-dark .tab-item.active, ion-tabs.tabs-color-active-dark .tab-item.activated {\n    color: #444; }\n\nion-tabs.tabs-striped.tabs-color-active-dark .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-dark .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-dark .tab-item.activated {\n  border-color: #444;\n  color: #444; }\n\n.tabs-top.tabs-striped {\n  padding-bottom: 0; }\n  .tabs-top.tabs-striped .tab-item {\n    background: transparent;\n    -webkit-transition: color .1s ease;\n    -moz-transition: color .1s ease;\n    -ms-transition: color .1s ease;\n    -o-transition: color .1s ease;\n    transition: color .1s ease; }\n    .tabs-top.tabs-striped .tab-item.tab-item-active, .tabs-top.tabs-striped .tab-item.active, .tabs-top.tabs-striped .tab-item.activated {\n      margin-top: 1px;\n      border-width: 0px 0px 2px 0px !important;\n      border-style: solid; }\n      .tabs-top.tabs-striped .tab-item.tab-item-active > .badge, .tabs-top.tabs-striped .tab-item.tab-item-active > i, .tabs-top.tabs-striped .tab-item.active > .badge, .tabs-top.tabs-striped .tab-item.active > i, .tabs-top.tabs-striped .tab-item.activated > .badge, .tabs-top.tabs-striped .tab-item.activated > i {\n        margin-top: -1px; }\n    .tabs-top.tabs-striped .tab-item .badge {\n      -webkit-transition: color .2s ease;\n      -moz-transition: color .2s ease;\n      -ms-transition: color .2s ease;\n      -o-transition: color .2s ease;\n      transition: color .2s ease; }\n  .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.tab-item-active .tab-title, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.tab-item-active i, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.active .tab-title, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.active i, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.activated .tab-title, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.activated i {\n    display: block;\n    margin-top: -1px; }\n  .tabs-top.tabs-striped.tabs-icon-left .tab-item {\n    margin-top: 1px; }\n    .tabs-top.tabs-striped.tabs-icon-left .tab-item.tab-item-active .tab-title, .tabs-top.tabs-striped.tabs-icon-left .tab-item.tab-item-active i, .tabs-top.tabs-striped.tabs-icon-left .tab-item.active .tab-title, .tabs-top.tabs-striped.tabs-icon-left .tab-item.active i, .tabs-top.tabs-striped.tabs-icon-left .tab-item.activated .tab-title, .tabs-top.tabs-striped.tabs-icon-left .tab-item.activated i {\n      margin-top: -0.1em; }\n\n/* Allow parent element to have tabs-top */\n/* If you change this, change platform.scss as well */\n.tabs-top > .tabs,\n.tabs.tabs-top {\n  top: 44px;\n  padding-top: 0;\n  background-position: bottom;\n  border-top-width: 0;\n  border-bottom-width: 1px; }\n  .tabs-top > .tabs .tab-item.tab-item-active .badge, .tabs-top > .tabs .tab-item.active .badge, .tabs-top > .tabs .tab-item.activated .badge,\n  .tabs.tabs-top .tab-item.tab-item-active .badge,\n  .tabs.tabs-top .tab-item.active .badge,\n  .tabs.tabs-top .tab-item.activated .badge {\n    top: 4%; }\n\n.tabs-top ~ .bar-header {\n  border-bottom-width: 0; }\n\n.tab-item {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  overflow: hidden;\n  max-width: 150px;\n  height: 100%;\n  color: inherit;\n  text-align: center;\n  text-decoration: none;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  font-weight: 400;\n  font-size: 14px;\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif;\n  opacity: 0.7; }\n  .tab-item:hover {\n    cursor: pointer; }\n  .tab-item.tab-hidden {\n    display: none; }\n\n.tabs-item-hide > .tabs,\n.tabs.tabs-item-hide {\n  display: none; }\n\n.tabs-icon-top > .tabs .tab-item,\n.tabs-icon-top.tabs .tab-item,\n.tabs-icon-bottom > .tabs .tab-item,\n.tabs-icon-bottom.tabs .tab-item {\n  font-size: 10px;\n  line-height: 14px; }\n\n.tab-item .icon {\n  display: block;\n  margin: 0 auto;\n  height: 32px;\n  font-size: 32px; }\n\n.tabs-icon-left.tabs .tab-item,\n.tabs-icon-left > .tabs .tab-item,\n.tabs-icon-right.tabs .tab-item,\n.tabs-icon-right > .tabs .tab-item {\n  font-size: 10px; }\n  .tabs-icon-left.tabs .tab-item .icon, .tabs-icon-left.tabs .tab-item .tab-title,\n  .tabs-icon-left > .tabs .tab-item .icon,\n  .tabs-icon-left > .tabs .tab-item .tab-title,\n  .tabs-icon-right.tabs .tab-item .icon,\n  .tabs-icon-right.tabs .tab-item .tab-title,\n  .tabs-icon-right > .tabs .tab-item .icon,\n  .tabs-icon-right > .tabs .tab-item .tab-title {\n    display: inline-block;\n    vertical-align: top;\n    margin-top: -.1em; }\n    .tabs-icon-left.tabs .tab-item .icon:before, .tabs-icon-left.tabs .tab-item .tab-title:before,\n    .tabs-icon-left > .tabs .tab-item .icon:before,\n    .tabs-icon-left > .tabs .tab-item .tab-title:before,\n    .tabs-icon-right.tabs .tab-item .icon:before,\n    .tabs-icon-right.tabs .tab-item .tab-title:before,\n    .tabs-icon-right > .tabs .tab-item .icon:before,\n    .tabs-icon-right > .tabs .tab-item .tab-title:before {\n      font-size: 24px;\n      line-height: 49px; }\n\n.tabs-icon-left > .tabs .tab-item .icon,\n.tabs-icon-left.tabs .tab-item .icon {\n  padding-right: 3px; }\n\n.tabs-icon-right > .tabs .tab-item .icon,\n.tabs-icon-right.tabs .tab-item .icon {\n  padding-left: 3px; }\n\n.tabs-icon-only > .tabs .icon,\n.tabs-icon-only.tabs .icon {\n  line-height: inherit; }\n\n.tab-item.has-badge {\n  position: relative; }\n\n.tab-item .badge {\n  position: absolute;\n  top: 4%;\n  right: 33%;\n  right: calc(50% - 26px);\n  padding: 1px 6px;\n  height: auto;\n  font-size: 12px;\n  line-height: 16px; }\n\n/* Navigational tab */\n/* Active state for tab */\n.tab-item.tab-item-active,\n.tab-item.active,\n.tab-item.activated {\n  opacity: 1; }\n  .tab-item.tab-item-active.tab-item-light,\n  .tab-item.active.tab-item-light,\n  .tab-item.activated.tab-item-light {\n    color: #fff; }\n  .tab-item.tab-item-active.tab-item-stable,\n  .tab-item.active.tab-item-stable,\n  .tab-item.activated.tab-item-stable {\n    color: #f8f8f8; }\n  .tab-item.tab-item-active.tab-item-positive,\n  .tab-item.active.tab-item-positive,\n  .tab-item.activated.tab-item-positive {\n    color: #387ef5; }\n  .tab-item.tab-item-active.tab-item-calm,\n  .tab-item.active.tab-item-calm,\n  .tab-item.activated.tab-item-calm {\n    color: #11c1f3; }\n  .tab-item.tab-item-active.tab-item-assertive,\n  .tab-item.active.tab-item-assertive,\n  .tab-item.activated.tab-item-assertive {\n    color: #ef473a; }\n  .tab-item.tab-item-active.tab-item-balanced,\n  .tab-item.active.tab-item-balanced,\n  .tab-item.activated.tab-item-balanced {\n    color: #33cd5f; }\n  .tab-item.tab-item-active.tab-item-energized,\n  .tab-item.active.tab-item-energized,\n  .tab-item.activated.tab-item-energized {\n    color: #ffc900; }\n  .tab-item.tab-item-active.tab-item-royal,\n  .tab-item.active.tab-item-royal,\n  .tab-item.activated.tab-item-royal {\n    color: #886aea; }\n  .tab-item.tab-item-active.tab-item-dark,\n  .tab-item.active.tab-item-dark,\n  .tab-item.activated.tab-item-dark {\n    color: #444; }\n\n.item.tabs {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  padding: 0; }\n  .item.tabs .icon:before {\n    position: relative; }\n\n.tab-item.disabled,\n.tab-item[disabled] {\n  opacity: .4;\n  cursor: default;\n  pointer-events: none; }\n\n.nav-bar-tabs-top.hide ~ .view-container .tabs-top .tabs {\n  top: 0; }\n\n.pane[hide-nav-bar=\"true\"] .has-tabs-top {\n  top: 49px; }\n\n/**\n * Menus\n * --------------------------------------------------\n * Side panel structure\n */\n.menu {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  z-index: 0;\n  overflow: hidden;\n  min-height: 100%;\n  max-height: 100%;\n  width: 275px;\n  background-color: #fff; }\n  .menu .scroll-content {\n    z-index: 10; }\n  .menu .bar-header {\n    z-index: 11; }\n\n.menu-content {\n  -webkit-transform: none;\n  transform: none;\n  box-shadow: -1px 0px 2px rgba(0, 0, 0, 0.2), 1px 0px 2px rgba(0, 0, 0, 0.2); }\n\n.menu-open .menu-content .pane,\n.menu-open .menu-content .scroll-content {\n  pointer-events: none; }\n\n.menu-open .menu-content .scroll-content .scroll {\n  pointer-events: none; }\n\n.menu-open .menu-content .scroll-content:not(.overflow-scroll) {\n  overflow: hidden; }\n\n.grade-b .menu-content,\n.grade-c .menu-content {\n  -webkit-box-sizing: content-box;\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  right: -1px;\n  left: -1px;\n  border-right: 1px solid #ccc;\n  border-left: 1px solid #ccc;\n  box-shadow: none; }\n\n.menu-left {\n  left: 0; }\n\n.menu-right {\n  right: 0; }\n\n.aside-open.aside-resizing .menu-right {\n  display: none; }\n\n.menu-animated {\n  -webkit-transition: -webkit-transform 200ms ease;\n  transition: transform 200ms ease; }\n\n/**\n * Modals\n * --------------------------------------------------\n * Modals are independent windows that slide in from off-screen.\n */\n.modal-backdrop,\n.modal-backdrop-bg {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 10;\n  width: 100%;\n  height: 100%; }\n\n.modal-backdrop-bg {\n  pointer-events: none; }\n\n.modal {\n  display: block;\n  position: absolute;\n  top: 0;\n  z-index: 10;\n  overflow: hidden;\n  min-height: 100%;\n  width: 100%;\n  background-color: #fff; }\n\n@media (min-width: 680px) {\n  .modal {\n    top: 20%;\n    right: 20%;\n    bottom: 20%;\n    left: 20%;\n    min-height: 240px;\n    width: 60%; }\n  .modal.ng-leave-active {\n    bottom: 0; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .bar-header:not(.bar-subheader) {\n    height: 44px; }\n    .platform-ios.platform-cordova .modal-wrapper .modal .bar-header:not(.bar-subheader) > * {\n      margin-top: 0; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .tabs-top > .tabs,\n  .platform-ios.platform-cordova .modal-wrapper .modal .tabs.tabs-top {\n    top: 44px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header,\n  .platform-ios.platform-cordova .modal-wrapper .modal .bar-subheader {\n    top: 44px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-subheader {\n    top: 88px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header.has-tabs-top {\n    top: 93px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header.has-subheader.has-tabs-top {\n    top: 137px; }\n  .modal-backdrop-bg {\n    -webkit-transition: opacity 300ms ease-in-out;\n    transition: opacity 300ms ease-in-out;\n    background-color: #000;\n    opacity: 0; }\n  .active .modal-backdrop-bg {\n    opacity: 0.5; } }\n\n.modal-open {\n  pointer-events: none; }\n  .modal-open .modal,\n  .modal-open .modal-backdrop {\n    pointer-events: auto; }\n  .modal-open.loading-active .modal,\n  .modal-open.loading-active .modal-backdrop {\n    pointer-events: none; }\n\n/**\n * Popovers\n * --------------------------------------------------\n * Popovers are independent views which float over content\n */\n.popover-backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 10;\n  width: 100%;\n  height: 100%;\n  background-color: transparent; }\n  .popover-backdrop.active {\n    background-color: rgba(0, 0, 0, 0.1); }\n\n.popover {\n  position: absolute;\n  top: 25%;\n  left: 50%;\n  z-index: 10;\n  display: block;\n  margin-top: 12px;\n  margin-left: -110px;\n  height: 280px;\n  width: 220px;\n  background-color: #fff;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n  opacity: 0; }\n  .popover .item:first-child {\n    border-top: 0; }\n  .popover .item:last-child {\n    border-bottom: 0; }\n  .popover.popover-bottom {\n    margin-top: -12px; }\n\n.popover,\n.popover .bar-header {\n  border-radius: 2px; }\n\n.popover .scroll-content {\n  z-index: 1;\n  margin: 2px 0; }\n\n.popover .bar-header {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0; }\n\n.popover .has-header {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0; }\n\n.popover-arrow {\n  display: none; }\n\n.platform-ios .popover {\n  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);\n  border-radius: 10px; }\n\n.platform-ios .popover .bar-header {\n  -webkit-border-top-right-radius: 10px;\n  border-top-right-radius: 10px;\n  -webkit-border-top-left-radius: 10px;\n  border-top-left-radius: 10px; }\n\n.platform-ios .popover .scroll-content {\n  margin: 8px 0;\n  border-radius: 10px; }\n\n.platform-ios .popover .scroll-content.has-header {\n  margin-top: 0; }\n\n.platform-ios .popover-arrow {\n  position: absolute;\n  display: block;\n  top: -17px;\n  width: 30px;\n  height: 19px;\n  overflow: hidden; }\n  .platform-ios .popover-arrow:after {\n    position: absolute;\n    top: 12px;\n    left: 5px;\n    width: 20px;\n    height: 20px;\n    background-color: #fff;\n    border-radius: 3px;\n    content: '';\n    -webkit-transform: rotate(-45deg);\n    transform: rotate(-45deg); }\n\n.platform-ios .popover-bottom .popover-arrow {\n  top: auto;\n  bottom: -10px; }\n  .platform-ios .popover-bottom .popover-arrow:after {\n    top: -6px; }\n\n.platform-android .popover {\n  margin-top: -32px;\n  background-color: #fafafa;\n  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }\n  .platform-android .popover .item {\n    border-color: #fafafa;\n    background-color: #fafafa;\n    color: #4d4d4d; }\n  .platform-android .popover.popover-bottom {\n    margin-top: 32px; }\n\n.platform-android .popover-backdrop,\n.platform-android .popover-backdrop.active {\n  background-color: transparent; }\n\n.popover-open {\n  pointer-events: none; }\n  .popover-open .popover,\n  .popover-open .popover-backdrop {\n    pointer-events: auto; }\n  .popover-open.loading-active .popover,\n  .popover-open.loading-active .popover-backdrop {\n    pointer-events: none; }\n\n@media (min-width: 680px) {\n  .popover {\n    width: 360px;\n    margin-left: -180px; } }\n\n/**\n * Popups\n * --------------------------------------------------\n */\n.popup-container {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  right: 0;\n  background: transparent;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  z-index: 12;\n  visibility: hidden; }\n  .popup-container.popup-showing {\n    visibility: visible; }\n  .popup-container.popup-hidden .popup {\n    -webkit-animation-name: scaleOut;\n    animation-name: scaleOut;\n    -webkit-animation-duration: 0.1s;\n    animation-duration: 0.1s;\n    -webkit-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .popup-container.active .popup {\n    -webkit-animation-name: superScaleIn;\n    animation-name: superScaleIn;\n    -webkit-animation-duration: 0.2s;\n    animation-duration: 0.2s;\n    -webkit-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .popup-container .popup {\n    width: 250px;\n    max-width: 100%;\n    max-height: 90%;\n    border-radius: 0px;\n    background-color: rgba(255, 255, 255, 0.9);\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -moz-box;\n    display: -moz-flex;\n    display: -ms-flexbox;\n    display: flex;\n    -webkit-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -moz-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n  .popup-container input,\n  .popup-container textarea {\n    width: 100%; }\n\n.popup-head {\n  padding: 15px 10px;\n  border-bottom: 1px solid #eee;\n  text-align: center; }\n\n.popup-title {\n  margin: 0;\n  padding: 0;\n  font-size: 15px; }\n\n.popup-sub-title {\n  margin: 5px 0 0 0;\n  padding: 0;\n  font-weight: normal;\n  font-size: 11px; }\n\n.popup-body {\n  padding: 10px;\n  overflow: auto; }\n\n.popup-buttons {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: row;\n  -moz-flex-direction: row;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  padding: 10px;\n  min-height: 65px; }\n  .popup-buttons .button {\n    -webkit-box-flex: 1;\n    -webkit-flex: 1;\n    -moz-box-flex: 1;\n    -moz-flex: 1;\n    -ms-flex: 1;\n    flex: 1;\n    display: block;\n    min-height: 45px;\n    border-radius: 2px;\n    line-height: 20px;\n    margin-right: 5px; }\n    .popup-buttons .button:last-child {\n      margin-right: 0px; }\n\n.popup-open {\n  pointer-events: none; }\n  .popup-open.modal-open .modal {\n    pointer-events: none; }\n  .popup-open .popup-backdrop, .popup-open .popup {\n    pointer-events: auto; }\n\n/**\n * Loading\n * --------------------------------------------------\n */\n.loading-container {\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  z-index: 13;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  -webkit-transition: 0.2s opacity linear;\n  transition: 0.2s opacity linear;\n  visibility: hidden;\n  opacity: 0; }\n  .loading-container:not(.visible) .icon,\n  .loading-container:not(.visible) .spinner {\n    display: none; }\n  .loading-container.visible {\n    visibility: visible; }\n  .loading-container.active {\n    opacity: 1; }\n  .loading-container .loading {\n    padding: 20px;\n    border-radius: 5px;\n    background-color: rgba(0, 0, 0, 0.7);\n    color: #fff;\n    text-align: center;\n    text-overflow: ellipsis;\n    font-size: 15px; }\n    .loading-container .loading h1, .loading-container .loading h2, .loading-container .loading h3, .loading-container .loading h4, .loading-container .loading h5, .loading-container .loading h6 {\n      color: #fff; }\n\n/**\n * Items\n * --------------------------------------------------\n */\n.item {\n  border-color: #ddd;\n  background-color: #fff;\n  color: #444;\n  position: relative;\n  z-index: 2;\n  display: block;\n  margin: -1px;\n  padding: 16px;\n  border-width: 1px;\n  border-style: solid;\n  font-size: 16px; }\n  .item h2 {\n    margin: 0 0 2px 0;\n    font-size: 16px;\n    font-weight: normal; }\n  .item h3 {\n    margin: 0 0 4px 0;\n    font-size: 14px; }\n  .item h4 {\n    margin: 0 0 4px 0;\n    font-size: 12px; }\n  .item h5, .item h6 {\n    margin: 0 0 3px 0;\n    font-size: 10px; }\n  .item p {\n    color: #666;\n    font-size: 14px;\n    margin-bottom: 2px; }\n  .item h1:last-child,\n  .item h2:last-child,\n  .item h3:last-child,\n  .item h4:last-child,\n  .item h5:last-child,\n  .item h6:last-child,\n  .item p:last-child {\n    margin-bottom: 0; }\n  .item .badge {\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -moz-box;\n    display: -moz-flex;\n    display: -ms-flexbox;\n    display: flex;\n    position: absolute;\n    top: 16px;\n    right: 32px; }\n  .item.item-button-right .badge {\n    right: 67px; }\n  .item.item-divider .badge {\n    top: 8px; }\n  .item .badge + .badge {\n    margin-right: 5px; }\n  .item.item-light {\n    border-color: #ddd;\n    background-color: #fff;\n    color: #444; }\n  .item.item-stable {\n    border-color: #b2b2b2;\n    background-color: #f8f8f8;\n    color: #444; }\n  .item.item-positive {\n    border-color: #0c60ee;\n    background-color: #387ef5;\n    color: #fff; }\n  .item.item-calm {\n    border-color: #0a9dc7;\n    background-color: #11c1f3;\n    color: #fff; }\n  .item.item-assertive {\n    border-color: #e42112;\n    background-color: #ef473a;\n    color: #fff; }\n  .item.item-balanced {\n    border-color: #28a54c;\n    background-color: #33cd5f;\n    color: #fff; }\n  .item.item-energized {\n    border-color: #e6b500;\n    background-color: #ffc900;\n    color: #fff; }\n  .item.item-royal {\n    border-color: #6b46e5;\n    background-color: #886aea;\n    color: #fff; }\n  .item.item-dark {\n    border-color: #111;\n    background-color: #444;\n    color: #fff; }\n  .item[ng-click]:hover {\n    cursor: pointer; }\n\n.list-borderless .item,\n.item-borderless {\n  border-width: 0; }\n\n.item.active,\n.item.activated,\n.item-complex.active .item-content,\n.item-complex.activated .item-content,\n.item .item-content.active,\n.item .item-content.activated {\n  border-color: #ccc;\n  background-color: #D9D9D9; }\n  .item.active.item-complex > .item-content,\n  .item.activated.item-complex > .item-content,\n  .item-complex.active .item-content.item-complex > .item-content,\n  .item-complex.activated .item-content.item-complex > .item-content,\n  .item .item-content.active.item-complex > .item-content,\n  .item .item-content.activated.item-complex > .item-content {\n    border-color: #ccc;\n    background-color: #D9D9D9; }\n  .item.active.item-light,\n  .item.activated.item-light,\n  .item-complex.active .item-content.item-light,\n  .item-complex.activated .item-content.item-light,\n  .item .item-content.active.item-light,\n  .item .item-content.activated.item-light {\n    border-color: #ccc;\n    background-color: #fafafa; }\n    .item.active.item-light.item-complex > .item-content,\n    .item.activated.item-light.item-complex > .item-content,\n    .item-complex.active .item-content.item-light.item-complex > .item-content,\n    .item-complex.activated .item-content.item-light.item-complex > .item-content,\n    .item .item-content.active.item-light.item-complex > .item-content,\n    .item .item-content.activated.item-light.item-complex > .item-content {\n      border-color: #ccc;\n      background-color: #fafafa; }\n  .item.active.item-stable,\n  .item.activated.item-stable,\n  .item-complex.active .item-content.item-stable,\n  .item-complex.activated .item-content.item-stable,\n  .item .item-content.active.item-stable,\n  .item .item-content.activated.item-stable {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n    .item.active.item-stable.item-complex > .item-content,\n    .item.activated.item-stable.item-complex > .item-content,\n    .item-complex.active .item-content.item-stable.item-complex > .item-content,\n    .item-complex.activated .item-content.item-stable.item-complex > .item-content,\n    .item .item-content.active.item-stable.item-complex > .item-content,\n    .item .item-content.activated.item-stable.item-complex > .item-content {\n      border-color: #a2a2a2;\n      background-color: #e5e5e5; }\n  .item.active.item-positive,\n  .item.activated.item-positive,\n  .item-complex.active .item-content.item-positive,\n  .item-complex.activated .item-content.item-positive,\n  .item .item-content.active.item-positive,\n  .item .item-content.activated.item-positive {\n    border-color: #0c60ee;\n    background-color: #0c60ee; }\n    .item.active.item-positive.item-complex > .item-content,\n    .item.activated.item-positive.item-complex > .item-content,\n    .item-complex.active .item-content.item-positive.item-complex > .item-content,\n    .item-complex.activated .item-content.item-positive.item-complex > .item-content,\n    .item .item-content.active.item-positive.item-complex > .item-content,\n    .item .item-content.activated.item-positive.item-complex > .item-content {\n      border-color: #0c60ee;\n      background-color: #0c60ee; }\n  .item.active.item-calm,\n  .item.activated.item-calm,\n  .item-complex.active .item-content.item-calm,\n  .item-complex.activated .item-content.item-calm,\n  .item .item-content.active.item-calm,\n  .item .item-content.activated.item-calm {\n    border-color: #0a9dc7;\n    background-color: #0a9dc7; }\n    .item.active.item-calm.item-complex > .item-content,\n    .item.activated.item-calm.item-complex > .item-content,\n    .item-complex.active .item-content.item-calm.item-complex > .item-content,\n    .item-complex.activated .item-content.item-calm.item-complex > .item-content,\n    .item .item-content.active.item-calm.item-complex > .item-content,\n    .item .item-content.activated.item-calm.item-complex > .item-content {\n      border-color: #0a9dc7;\n      background-color: #0a9dc7; }\n  .item.active.item-assertive,\n  .item.activated.item-assertive,\n  .item-complex.active .item-content.item-assertive,\n  .item-complex.activated .item-content.item-assertive,\n  .item .item-content.active.item-assertive,\n  .item .item-content.activated.item-assertive {\n    border-color: #e42112;\n    background-color: #e42112; }\n    .item.active.item-assertive.item-complex > .item-content,\n    .item.activated.item-assertive.item-complex > .item-content,\n    .item-complex.active .item-content.item-assertive.item-complex > .item-content,\n    .item-complex.activated .item-content.item-assertive.item-complex > .item-content,\n    .item .item-content.active.item-assertive.item-complex > .item-content,\n    .item .item-content.activated.item-assertive.item-complex > .item-content {\n      border-color: #e42112;\n      background-color: #e42112; }\n  .item.active.item-balanced,\n  .item.activated.item-balanced,\n  .item-complex.active .item-content.item-balanced,\n  .item-complex.activated .item-content.item-balanced,\n  .item .item-content.active.item-balanced,\n  .item .item-content.activated.item-balanced {\n    border-color: #28a54c;\n    background-color: #28a54c; }\n    .item.active.item-balanced.item-complex > .item-content,\n    .item.activated.item-balanced.item-complex > .item-content,\n    .item-complex.active .item-content.item-balanced.item-complex > .item-content,\n    .item-complex.activated .item-content.item-balanced.item-complex > .item-content,\n    .item .item-content.active.item-balanced.item-complex > .item-content,\n    .item .item-content.activated.item-balanced.item-complex > .item-content {\n      border-color: #28a54c;\n      background-color: #28a54c; }\n  .item.active.item-energized,\n  .item.activated.item-energized,\n  .item-complex.active .item-content.item-energized,\n  .item-complex.activated .item-content.item-energized,\n  .item .item-content.active.item-energized,\n  .item .item-content.activated.item-energized {\n    border-color: #e6b500;\n    background-color: #e6b500; }\n    .item.active.item-energized.item-complex > .item-content,\n    .item.activated.item-energized.item-complex > .item-content,\n    .item-complex.active .item-content.item-energized.item-complex > .item-content,\n    .item-complex.activated .item-content.item-energized.item-complex > .item-content,\n    .item .item-content.active.item-energized.item-complex > .item-content,\n    .item .item-content.activated.item-energized.item-complex > .item-content {\n      border-color: #e6b500;\n      background-color: #e6b500; }\n  .item.active.item-royal,\n  .item.activated.item-royal,\n  .item-complex.active .item-content.item-royal,\n  .item-complex.activated .item-content.item-royal,\n  .item .item-content.active.item-royal,\n  .item .item-content.activated.item-royal {\n    border-color: #6b46e5;\n    background-color: #6b46e5; }\n    .item.active.item-royal.item-complex > .item-content,\n    .item.activated.item-royal.item-complex > .item-content,\n    .item-complex.active .item-content.item-royal.item-complex > .item-content,\n    .item-complex.activated .item-content.item-royal.item-complex > .item-content,\n    .item .item-content.active.item-royal.item-complex > .item-content,\n    .item .item-content.activated.item-royal.item-complex > .item-content {\n      border-color: #6b46e5;\n      background-color: #6b46e5; }\n  .item.active.item-dark,\n  .item.activated.item-dark,\n  .item-complex.active .item-content.item-dark,\n  .item-complex.activated .item-content.item-dark,\n  .item .item-content.active.item-dark,\n  .item .item-content.activated.item-dark {\n    border-color: #000;\n    background-color: #262626; }\n    .item.active.item-dark.item-complex > .item-content,\n    .item.activated.item-dark.item-complex > .item-content,\n    .item-complex.active .item-content.item-dark.item-complex > .item-content,\n    .item-complex.activated .item-content.item-dark.item-complex > .item-content,\n    .item .item-content.active.item-dark.item-complex > .item-content,\n    .item .item-content.activated.item-dark.item-complex > .item-content {\n      border-color: #000;\n      background-color: #262626; }\n\n.item,\n.item h1,\n.item h2,\n.item h3,\n.item h4,\n.item h5,\n.item h6,\n.item p,\n.item-content,\n.item-content h1,\n.item-content h2,\n.item-content h3,\n.item-content h4,\n.item-content h5,\n.item-content h6,\n.item-content p {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap; }\n\na.item {\n  color: inherit;\n  text-decoration: none; }\n  a.item:hover, a.item:focus {\n    text-decoration: none; }\n\n/**\n * Complex Items\n * --------------------------------------------------\n * Adding .item-complex allows the .item to be slidable and\n * have options underneath the button, but also requires an\n * additional .item-content element inside .item.\n * Basically .item-complex removes any default settings which\n * .item added, so that .item-content looks them as just .item.\n */\n.item-complex,\na.item.item-complex,\nbutton.item.item-complex {\n  padding: 0; }\n\n.item-complex .item-content,\n.item-radio .item-content {\n  position: relative;\n  z-index: 2;\n  padding: 16px 49px 16px 16px;\n  border: none;\n  background-color: #fff; }\n\na.item-content {\n  display: block;\n  color: inherit;\n  text-decoration: none; }\n\n.item-text-wrap .item,\n.item-text-wrap .item-content,\n.item-text-wrap,\n.item-text-wrap h1,\n.item-text-wrap h2,\n.item-text-wrap h3,\n.item-text-wrap h4,\n.item-text-wrap h5,\n.item-text-wrap h6,\n.item-text-wrap p,\n.item-complex.item-text-wrap .item-content,\n.item-body h1,\n.item-body h2,\n.item-body h3,\n.item-body h4,\n.item-body h5,\n.item-body h6,\n.item-body p {\n  overflow: visible;\n  white-space: normal; }\n\n.item-complex.item-text-wrap,\n.item-complex.item-text-wrap h1,\n.item-complex.item-text-wrap h2,\n.item-complex.item-text-wrap h3,\n.item-complex.item-text-wrap h4,\n.item-complex.item-text-wrap h5,\n.item-complex.item-text-wrap h6,\n.item-complex.item-text-wrap p {\n  overflow: visible;\n  white-space: normal; }\n\n.item-complex.item-light > .item-content {\n  border-color: #ddd;\n  background-color: #fff;\n  color: #444; }\n  .item-complex.item-light > .item-content.active, .item-complex.item-light > .item-content:active {\n    border-color: #ccc;\n    background-color: #fafafa; }\n    .item-complex.item-light > .item-content.active.item-complex > .item-content, .item-complex.item-light > .item-content:active.item-complex > .item-content {\n      border-color: #ccc;\n      background-color: #fafafa; }\n\n.item-complex.item-stable > .item-content {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  color: #444; }\n  .item-complex.item-stable > .item-content.active, .item-complex.item-stable > .item-content:active {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n    .item-complex.item-stable > .item-content.active.item-complex > .item-content, .item-complex.item-stable > .item-content:active.item-complex > .item-content {\n      border-color: #a2a2a2;\n      background-color: #e5e5e5; }\n\n.item-complex.item-positive > .item-content {\n  border-color: #0c60ee;\n  background-color: #387ef5;\n  color: #fff; }\n  .item-complex.item-positive > .item-content.active, .item-complex.item-positive > .item-content:active {\n    border-color: #0c60ee;\n    background-color: #0c60ee; }\n    .item-complex.item-positive > .item-content.active.item-complex > .item-content, .item-complex.item-positive > .item-content:active.item-complex > .item-content {\n      border-color: #0c60ee;\n      background-color: #0c60ee; }\n\n.item-complex.item-calm > .item-content {\n  border-color: #0a9dc7;\n  background-color: #11c1f3;\n  color: #fff; }\n  .item-complex.item-calm > .item-content.active, .item-complex.item-calm > .item-content:active {\n    border-color: #0a9dc7;\n    background-color: #0a9dc7; }\n    .item-complex.item-calm > .item-content.active.item-complex > .item-content, .item-complex.item-calm > .item-content:active.item-complex > .item-content {\n      border-color: #0a9dc7;\n      background-color: #0a9dc7; }\n\n.item-complex.item-assertive > .item-content {\n  border-color: #e42112;\n  background-color: #ef473a;\n  color: #fff; }\n  .item-complex.item-assertive > .item-content.active, .item-complex.item-assertive > .item-content:active {\n    border-color: #e42112;\n    background-color: #e42112; }\n    .item-complex.item-assertive > .item-content.active.item-complex > .item-content, .item-complex.item-assertive > .item-content:active.item-complex > .item-content {\n      border-color: #e42112;\n      background-color: #e42112; }\n\n.item-complex.item-balanced > .item-content {\n  border-color: #28a54c;\n  background-color: #33cd5f;\n  color: #fff; }\n  .item-complex.item-balanced > .item-content.active, .item-complex.item-balanced > .item-content:active {\n    border-color: #28a54c;\n    background-color: #28a54c; }\n    .item-complex.item-balanced > .item-content.active.item-complex > .item-content, .item-complex.item-balanced > .item-content:active.item-complex > .item-content {\n      border-color: #28a54c;\n      background-color: #28a54c; }\n\n.item-complex.item-energized > .item-content {\n  border-color: #e6b500;\n  background-color: #ffc900;\n  color: #fff; }\n  .item-complex.item-energized > .item-content.active, .item-complex.item-energized > .item-content:active {\n    border-color: #e6b500;\n    background-color: #e6b500; }\n    .item-complex.item-energized > .item-content.active.item-complex > .item-content, .item-complex.item-energized > .item-content:active.item-complex > .item-content {\n      border-color: #e6b500;\n      background-color: #e6b500; }\n\n.item-complex.item-royal > .item-content {\n  border-color: #6b46e5;\n  background-color: #886aea;\n  color: #fff; }\n  .item-complex.item-royal > .item-content.active, .item-complex.item-royal > .item-content:active {\n    border-color: #6b46e5;\n    background-color: #6b46e5; }\n    .item-complex.item-royal > .item-content.active.item-complex > .item-content, .item-complex.item-royal > .item-content:active.item-complex > .item-content {\n      border-color: #6b46e5;\n      background-color: #6b46e5; }\n\n.item-complex.item-dark > .item-content {\n  border-color: #111;\n  background-color: #444;\n  color: #fff; }\n  .item-complex.item-dark > .item-content.active, .item-complex.item-dark > .item-content:active {\n    border-color: #000;\n    background-color: #262626; }\n    .item-complex.item-dark > .item-content.active.item-complex > .item-content, .item-complex.item-dark > .item-content:active.item-complex > .item-content {\n      border-color: #000;\n      background-color: #262626; }\n\n/**\n * Item Icons\n * --------------------------------------------------\n */\n.item-icon-left .icon,\n.item-icon-right .icon {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 0;\n  height: 100%;\n  font-size: 32px; }\n  .item-icon-left .icon:before,\n  .item-icon-right .icon:before {\n    display: block;\n    width: 32px;\n    text-align: center; }\n\n.item .fill-icon {\n  min-width: 30px;\n  min-height: 30px;\n  font-size: 28px; }\n\n.item-icon-left {\n  padding-left: 54px; }\n  .item-icon-left .icon {\n    left: 11px; }\n\n.item-complex.item-icon-left {\n  padding-left: 0; }\n  .item-complex.item-icon-left .item-content {\n    padding-left: 54px; }\n\n.item-icon-right {\n  padding-right: 54px; }\n  .item-icon-right .icon {\n    right: 11px; }\n\n.item-complex.item-icon-right {\n  padding-right: 0; }\n  .item-complex.item-icon-right .item-content {\n    padding-right: 54px; }\n\n.item-icon-left.item-icon-right .icon:first-child {\n  right: auto; }\n\n.item-icon-left.item-icon-right .icon:last-child,\n.item-icon-left .item-delete .icon {\n  left: auto; }\n\n.item-icon-left .icon-accessory,\n.item-icon-right .icon-accessory {\n  color: #ccc;\n  font-size: 16px; }\n\n.item-icon-left .icon-accessory {\n  left: 3px; }\n\n.item-icon-right .icon-accessory {\n  right: 3px; }\n\n/**\n * Item Button\n * --------------------------------------------------\n * An item button is a child button inside an .item (not the entire .item)\n */\n.item-button-left {\n  padding-left: 72px; }\n\n.item-button-left > .button,\n.item-button-left .item-content > .button {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 8px;\n  left: 11px;\n  min-width: 34px;\n  min-height: 34px;\n  font-size: 18px;\n  line-height: 32px; }\n  .item-button-left > .button .icon:before,\n  .item-button-left .item-content > .button .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: 31px; }\n  .item-button-left > .button > .button,\n  .item-button-left .item-content > .button > .button {\n    margin: 0px 2px;\n    min-height: 34px;\n    font-size: 18px;\n    line-height: 32px; }\n\n.item-button-right,\na.item.item-button-right,\nbutton.item.item-button-right {\n  padding-right: 80px; }\n\n.item-button-right > .button,\n.item-button-right .item-content > .button,\n.item-button-right > .buttons,\n.item-button-right .item-content > .buttons {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 8px;\n  right: 16px;\n  min-width: 34px;\n  min-height: 34px;\n  font-size: 18px;\n  line-height: 32px; }\n  .item-button-right > .button .icon:before,\n  .item-button-right .item-content > .button .icon:before,\n  .item-button-right > .buttons .icon:before,\n  .item-button-right .item-content > .buttons .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: 31px; }\n  .item-button-right > .button > .button,\n  .item-button-right .item-content > .button > .button,\n  .item-button-right > .buttons > .button,\n  .item-button-right .item-content > .buttons > .button {\n    margin: 0px 2px;\n    min-width: 34px;\n    min-height: 34px;\n    font-size: 18px;\n    line-height: 32px; }\n\n.item-button-left.item-button-right .button:first-child {\n  right: auto; }\n\n.item-button-left.item-button-right .button:last-child {\n  left: auto; }\n\n.item-avatar,\n.item-avatar .item-content,\n.item-avatar-left,\n.item-avatar-left .item-content {\n  padding-left: 72px;\n  min-height: 72px; }\n  .item-avatar > img:first-child,\n  .item-avatar .item-image,\n  .item-avatar .item-content > img:first-child,\n  .item-avatar .item-content .item-image,\n  .item-avatar-left > img:first-child,\n  .item-avatar-left .item-image,\n  .item-avatar-left .item-content > img:first-child,\n  .item-avatar-left .item-content .item-image {\n    position: absolute;\n    top: 16px;\n    left: 16px;\n    max-width: 40px;\n    max-height: 40px;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%; }\n\n.item-avatar-right,\n.item-avatar-right .item-content {\n  padding-right: 72px;\n  min-height: 72px; }\n  .item-avatar-right > img:first-child,\n  .item-avatar-right .item-image,\n  .item-avatar-right .item-content > img:first-child,\n  .item-avatar-right .item-content .item-image {\n    position: absolute;\n    top: 16px;\n    right: 16px;\n    max-width: 40px;\n    max-height: 40px;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%; }\n\n.item-thumbnail-left,\n.item-thumbnail-left .item-content {\n  padding-top: 8px;\n  padding-left: 106px;\n  min-height: 100px; }\n  .item-thumbnail-left > img:first-child,\n  .item-thumbnail-left .item-image,\n  .item-thumbnail-left .item-content > img:first-child,\n  .item-thumbnail-left .item-content .item-image {\n    position: absolute;\n    top: 10px;\n    left: 10px;\n    max-width: 80px;\n    max-height: 80px;\n    width: 100%;\n    height: 100%; }\n\n.item-avatar.item-complex,\n.item-avatar-left.item-complex,\n.item-thumbnail-left.item-complex {\n  padding-top: 0;\n  padding-left: 0; }\n\n.item-thumbnail-right,\n.item-thumbnail-right .item-content {\n  padding-top: 8px;\n  padding-right: 106px;\n  min-height: 100px; }\n  .item-thumbnail-right > img:first-child,\n  .item-thumbnail-right .item-image,\n  .item-thumbnail-right .item-content > img:first-child,\n  .item-thumbnail-right .item-content .item-image {\n    position: absolute;\n    top: 10px;\n    right: 10px;\n    max-width: 80px;\n    max-height: 80px;\n    width: 100%;\n    height: 100%; }\n\n.item-avatar-right.item-complex,\n.item-thumbnail-right.item-complex {\n  padding-top: 0;\n  padding-right: 0; }\n\n.item-image {\n  padding: 0;\n  text-align: center; }\n  .item-image img:first-child, .item-image .list-img {\n    width: 100%;\n    vertical-align: middle; }\n\n.item-body {\n  overflow: auto;\n  padding: 16px;\n  text-overflow: inherit;\n  white-space: normal; }\n  .item-body h1, .item-body h2, .item-body h3, .item-body h4, .item-body h5, .item-body h6, .item-body p {\n    margin-top: 16px;\n    margin-bottom: 16px; }\n\n.item-divider {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  min-height: 30px;\n  background-color: #f5f5f5;\n  color: #222;\n  font-weight: 500; }\n\n.platform-ios .item-divider-platform,\n.item-divider-ios {\n  padding-top: 26px;\n  text-transform: uppercase;\n  font-weight: 300;\n  font-size: 13px;\n  background-color: #efeff4;\n  color: #555; }\n\n.platform-android .item-divider-platform,\n.item-divider-android {\n  font-weight: 300;\n  font-size: 13px; }\n\n.item-note {\n  float: right;\n  color: #aaa;\n  font-size: 14px; }\n\n.item-left-editable .item-content,\n.item-right-editable .item-content {\n  -webkit-transition-duration: 250ms;\n  transition-duration: 250ms;\n  -webkit-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  -webkit-transition-property: -webkit-transform;\n  -moz-transition-property: -moz-transform;\n  transition-property: transform; }\n\n.list-left-editing .item-left-editable .item-content,\n.item-left-editing.item-left-editable .item-content {\n  -webkit-transform: translate3d(50px, 0, 0);\n  transform: translate3d(50px, 0, 0); }\n\n.item-remove-animate.ng-leave {\n  -webkit-transition-duration: 300ms;\n  transition-duration: 300ms; }\n\n.item-remove-animate.ng-leave .item-content, .item-remove-animate.ng-leave:last-of-type {\n  -webkit-transition-duration: 300ms;\n  transition-duration: 300ms;\n  -webkit-transition-timing-function: ease-in;\n  transition-timing-function: ease-in;\n  -webkit-transition-property: all;\n  transition-property: all; }\n\n.item-remove-animate.ng-leave.ng-leave-active .item-content {\n  opacity: 0;\n  -webkit-transform: translate3d(-100%, 0, 0) !important;\n  transform: translate3d(-100%, 0, 0) !important; }\n\n.item-remove-animate.ng-leave.ng-leave-active:last-of-type {\n  opacity: 0; }\n\n.item-remove-animate.ng-leave.ng-leave-active ~ ion-item:not(.ng-leave) {\n  -webkit-transform: translate3d(0, -webkit-calc(-100% + 1px), 0);\n  transform: translate3d(0, calc(-100% + 1px), 0);\n  -webkit-transition-duration: 300ms;\n  transition-duration: 300ms;\n  -webkit-transition-timing-function: cubic-bezier(0.25, 0.81, 0.24, 1);\n  transition-timing-function: cubic-bezier(0.25, 0.81, 0.24, 1);\n  -webkit-transition-property: all;\n  transition-property: all; }\n\n.item-left-edit {\n  -webkit-transition: all ease-in-out 125ms;\n  transition: all ease-in-out 125ms;\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 0;\n  width: 50px;\n  height: 100%;\n  line-height: 100%;\n  display: none;\n  opacity: 0;\n  -webkit-transform: translate3d(-21px, 0, 0);\n  transform: translate3d(-21px, 0, 0); }\n  .item-left-edit .button {\n    height: 100%; }\n    .item-left-edit .button.icon {\n      display: -webkit-box;\n      display: -webkit-flex;\n      display: -moz-box;\n      display: -moz-flex;\n      display: -ms-flexbox;\n      display: flex;\n      -webkit-box-align: center;\n      -ms-flex-align: center;\n      -webkit-align-items: center;\n      -moz-align-items: center;\n      align-items: center;\n      position: absolute;\n      top: 0;\n      height: 100%; }\n  .item-left-edit.visible {\n    display: block; }\n    .item-left-edit.visible.active {\n      opacity: 1;\n      -webkit-transform: translate3d(8px, 0, 0);\n      transform: translate3d(8px, 0, 0); }\n\n.list-left-editing .item-left-edit {\n  -webkit-transition-delay: 125ms;\n  transition-delay: 125ms; }\n\n.item-delete .button.icon {\n  color: #ef473a;\n  font-size: 24px; }\n  .item-delete .button.icon:hover {\n    opacity: .7; }\n\n.item-right-edit {\n  -webkit-transition: all ease-in-out 250ms;\n  transition: all ease-in-out 250ms;\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 3;\n  width: 75px;\n  height: 100%;\n  background: inherit;\n  padding-left: 20px;\n  display: block;\n  opacity: 0;\n  -webkit-transform: translate3d(75px, 0, 0);\n  transform: translate3d(75px, 0, 0); }\n  .item-right-edit .button {\n    min-width: 50px;\n    height: 100%; }\n    .item-right-edit .button.icon {\n      display: -webkit-box;\n      display: -webkit-flex;\n      display: -moz-box;\n      display: -moz-flex;\n      display: -ms-flexbox;\n      display: flex;\n      -webkit-box-align: center;\n      -ms-flex-align: center;\n      -webkit-align-items: center;\n      -moz-align-items: center;\n      align-items: center;\n      position: absolute;\n      top: 0;\n      height: 100%;\n      font-size: 32px; }\n  .item-right-edit.visible {\n    display: block; }\n    .item-right-edit.visible.active {\n      opacity: 1;\n      -webkit-transform: translate3d(0, 0, 0);\n      transform: translate3d(0, 0, 0); }\n\n.item-reorder .button.icon {\n  color: #444;\n  font-size: 32px; }\n\n.item-reordering {\n  position: absolute;\n  left: 0;\n  top: 0;\n  z-index: 9;\n  width: 100%;\n  box-shadow: 0px 0px 10px 0px #aaa; }\n  .item-reordering .item-reorder {\n    z-index: 9; }\n\n.item-placeholder {\n  opacity: 0.7; }\n\n/**\n * The hidden right-side buttons that can be exposed under a list item\n * with dragging.\n */\n.item-options {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 1;\n  height: 100%; }\n  .item-options .button {\n    height: 100%;\n    border: none;\n    border-radius: 0;\n    display: -webkit-inline-box;\n    display: -webkit-inline-flex;\n    display: -moz-inline-flex;\n    display: -ms-inline-flexbox;\n    display: inline-flex;\n    -webkit-box-align: center;\n    -ms-flex-align: center;\n    -webkit-align-items: center;\n    -moz-align-items: center;\n    align-items: center; }\n    .item-options .button:before {\n      margin: 0 auto; }\n\n/**\n * Lists\n * --------------------------------------------------\n */\n.list {\n  position: relative;\n  padding-top: 1px;\n  padding-bottom: 1px;\n  padding-left: 0;\n  margin-bottom: 20px; }\n\n.list:last-child {\n  margin-bottom: 0px; }\n  .list:last-child.card {\n    margin-bottom: 40px; }\n\n/**\n * List Header\n * --------------------------------------------------\n */\n.list-header {\n  margin-top: 20px;\n  padding: 5px 15px;\n  background-color: transparent;\n  color: #222;\n  font-weight: bold; }\n\n.card.list .list-item {\n  padding-right: 1px;\n  padding-left: 1px; }\n\n/**\n * Cards and Inset Lists\n * --------------------------------------------------\n * A card and list-inset are close to the same thing, except a card as a box shadow.\n */\n.card,\n.list-inset {\n  overflow: hidden;\n  margin: 20px 10px;\n  border-radius: 2px;\n  background-color: #fff; }\n\n.card {\n  padding-top: 1px;\n  padding-bottom: 1px;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }\n  .card .item {\n    border-left: 0;\n    border-right: 0; }\n  .card .item:first-child {\n    border-top: 0; }\n  .card .item:last-child {\n    border-bottom: 0; }\n\n.padding .card, .padding .list-inset {\n  margin-left: 0;\n  margin-right: 0; }\n\n.card .item:first-child,\n.list-inset .item:first-child,\n.padding > .list .item:first-child {\n  border-top-left-radius: 2px;\n  border-top-right-radius: 2px; }\n  .card .item:first-child .item-content,\n  .list-inset .item:first-child .item-content,\n  .padding > .list .item:first-child .item-content {\n    border-top-left-radius: 2px;\n    border-top-right-radius: 2px; }\n\n.card .item:last-child,\n.list-inset .item:last-child,\n.padding > .list .item:last-child {\n  border-bottom-right-radius: 2px;\n  border-bottom-left-radius: 2px; }\n  .card .item:last-child .item-content,\n  .list-inset .item:last-child .item-content,\n  .padding > .list .item:last-child .item-content {\n    border-bottom-right-radius: 2px;\n    border-bottom-left-radius: 2px; }\n\n.card .item:last-child,\n.list-inset .item:last-child {\n  margin-bottom: -1px; }\n\n.card .item,\n.list-inset .item,\n.padding > .list .item,\n.padding-horizontal > .list .item {\n  margin-right: 0;\n  margin-left: 0; }\n  .card .item.item-input input,\n  .list-inset .item.item-input input,\n  .padding > .list .item.item-input input,\n  .padding-horizontal > .list .item.item-input input {\n    padding-right: 44px; }\n\n.padding-left > .list .item {\n  margin-left: 0; }\n\n.padding-right > .list .item {\n  margin-right: 0; }\n\n/**\n * Badges\n * --------------------------------------------------\n */\n.badge {\n  background-color: transparent;\n  color: #AAAAAA;\n  z-index: 1;\n  display: inline-block;\n  padding: 3px 8px;\n  min-width: 10px;\n  border-radius: 10px;\n  vertical-align: baseline;\n  text-align: center;\n  white-space: nowrap;\n  font-weight: bold;\n  font-size: 14px;\n  line-height: 16px; }\n  .badge:empty {\n    display: none; }\n\n.tabs .tab-item .badge.badge-light,\n.badge.badge-light {\n  background-color: #fff;\n  color: #444; }\n\n.tabs .tab-item .badge.badge-stable,\n.badge.badge-stable {\n  background-color: #f8f8f8;\n  color: #444; }\n\n.tabs .tab-item .badge.badge-positive,\n.badge.badge-positive {\n  background-color: #387ef5;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-calm,\n.badge.badge-calm {\n  background-color: #11c1f3;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-assertive,\n.badge.badge-assertive {\n  background-color: #ef473a;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-balanced,\n.badge.badge-balanced {\n  background-color: #33cd5f;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-energized,\n.badge.badge-energized {\n  background-color: #ffc900;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-royal,\n.badge.badge-royal {\n  background-color: #886aea;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-dark,\n.badge.badge-dark {\n  background-color: #444;\n  color: #fff; }\n\n.button .badge {\n  position: relative;\n  top: -1px; }\n\n/**\n * Slide Box\n * --------------------------------------------------\n */\n.slider {\n  position: relative;\n  visibility: hidden;\n  overflow: hidden; }\n\n.slider-slides {\n  position: relative;\n  height: 100%; }\n\n.slider-slide {\n  position: relative;\n  display: block;\n  float: left;\n  width: 100%;\n  height: 100%;\n  vertical-align: top; }\n\n.slider-slide-image > img {\n  width: 100%; }\n\n.slider-pager {\n  position: absolute;\n  bottom: 20px;\n  z-index: 1;\n  width: 100%;\n  height: 15px;\n  text-align: center; }\n  .slider-pager .slider-pager-page {\n    display: inline-block;\n    margin: 0px 3px;\n    width: 15px;\n    color: #000;\n    text-decoration: none;\n    opacity: 0.3; }\n    .slider-pager .slider-pager-page.active {\n      -webkit-transition: opacity 0.4s ease-in;\n      transition: opacity 0.4s ease-in;\n      opacity: 1; }\n\n.slider-slide.ng-enter, .slider-slide.ng-leave, .slider-slide.ng-animate,\n.slider-pager-page.ng-enter,\n.slider-pager-page.ng-leave,\n.slider-pager-page.ng-animate {\n  -webkit-transition: none !important;\n  transition: none !important; }\n\n.slider-slide.ng-animate,\n.slider-pager-page.ng-animate {\n  -webkit-animation: none 0s;\n  animation: none 0s; }\n\n/**\n * Swiper 3.2.7\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n *\n * http://www.idangero.us/swiper/\n *\n * Copyright 2015, Vladimir Kharlampidi\n * The iDangero.us\n * http://www.idangero.us/\n *\n * Licensed under MIT\n *\n * Released on: December 7, 2015\n */\n.swiper-container {\n  margin: 0 auto;\n  position: relative;\n  overflow: hidden;\n  /* Fix of Webkit flickering */\n  z-index: 1; }\n\n.swiper-container-no-flexbox .swiper-slide {\n  float: left; }\n\n.swiper-container-vertical > .swiper-wrapper {\n  -webkit-box-orient: vertical;\n  -moz-box-orient: vertical;\n  -ms-flex-direction: column;\n  -webkit-flex-direction: column;\n  flex-direction: column; }\n\n.swiper-wrapper {\n  position: relative;\n  width: 100%;\n  height: 100%;\n  z-index: 1;\n  display: -webkit-box;\n  display: -moz-box;\n  display: -ms-flexbox;\n  display: -webkit-flex;\n  display: flex;\n  -webkit-transition-property: -webkit-transform;\n  -moz-transition-property: -moz-transform;\n  -o-transition-property: -o-transform;\n  -ms-transition-property: -ms-transform;\n  transition-property: transform;\n  -webkit-box-sizing: content-box;\n  -moz-box-sizing: content-box;\n  box-sizing: content-box; }\n\n.swiper-container-android .swiper-slide,\n.swiper-wrapper {\n  -webkit-transform: translate3d(0px, 0, 0);\n  -moz-transform: translate3d(0px, 0, 0);\n  -o-transform: translate(0px, 0px);\n  -ms-transform: translate3d(0px, 0, 0);\n  transform: translate3d(0px, 0, 0); }\n\n.swiper-container-multirow > .swiper-wrapper {\n  -webkit-box-lines: multiple;\n  -moz-box-lines: multiple;\n  -ms-flex-wrap: wrap;\n  -webkit-flex-wrap: wrap;\n  flex-wrap: wrap; }\n\n.swiper-container-free-mode > .swiper-wrapper {\n  -webkit-transition-timing-function: ease-out;\n  -moz-transition-timing-function: ease-out;\n  -ms-transition-timing-function: ease-out;\n  -o-transition-timing-function: ease-out;\n  transition-timing-function: ease-out;\n  margin: 0 auto; }\n\n.swiper-slide {\n  display: block;\n  -webkit-flex-shrink: 0;\n  -ms-flex: 0 0 auto;\n  flex-shrink: 0;\n  width: 100%;\n  height: 100%;\n  position: relative; }\n\n/* Auto Height */\n.swiper-container-autoheight,\n.swiper-container-autoheight .swiper-slide {\n  height: auto; }\n\n.swiper-container-autoheight .swiper-wrapper {\n  -webkit-box-align: start;\n  -ms-flex-align: start;\n  -webkit-align-items: flex-start;\n  align-items: flex-start;\n  -webkit-transition-property: -webkit-transform, height;\n  -moz-transition-property: -moz-transform;\n  -o-transition-property: -o-transform;\n  -ms-transition-property: -ms-transform;\n  transition-property: transform, height; }\n\n/* a11y */\n.swiper-container .swiper-notification {\n  position: absolute;\n  left: 0;\n  top: 0;\n  pointer-events: none;\n  opacity: 0;\n  z-index: -1000; }\n\n/* IE10 Windows Phone 8 Fixes */\n.swiper-wp8-horizontal {\n  -ms-touch-action: pan-y;\n  touch-action: pan-y; }\n\n.swiper-wp8-vertical {\n  -ms-touch-action: pan-x;\n  touch-action: pan-x; }\n\n/* Arrows */\n.swiper-button-prev,\n.swiper-button-next {\n  position: absolute;\n  top: 50%;\n  width: 27px;\n  height: 44px;\n  margin-top: -22px;\n  z-index: 10;\n  cursor: pointer;\n  -moz-background-size: 27px 44px;\n  -webkit-background-size: 27px 44px;\n  background-size: 27px 44px;\n  background-position: center;\n  background-repeat: no-repeat; }\n\n.swiper-button-prev.swiper-button-disabled,\n.swiper-button-next.swiper-button-disabled {\n  opacity: 0.35;\n  cursor: auto;\n  pointer-events: none; }\n\n.swiper-button-prev,\n.swiper-container-rtl .swiper-button-next {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E\");\n  left: 10px;\n  right: auto; }\n\n.swiper-button-prev.swiper-button-black,\n.swiper-container-rtl .swiper-button-next.swiper-button-black {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E\"); }\n\n.swiper-button-prev.swiper-button-white,\n.swiper-container-rtl .swiper-button-next.swiper-button-white {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E\"); }\n\n.swiper-button-next,\n.swiper-container-rtl .swiper-button-prev {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E\");\n  right: 10px;\n  left: auto; }\n\n.swiper-button-next.swiper-button-black,\n.swiper-container-rtl .swiper-button-prev.swiper-button-black {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E\"); }\n\n.swiper-button-next.swiper-button-white,\n.swiper-container-rtl .swiper-button-prev.swiper-button-white {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E\"); }\n\n/* Pagination Styles */\n.swiper-pagination {\n  position: absolute;\n  text-align: center;\n  -webkit-transition: 300ms;\n  -moz-transition: 300ms;\n  -o-transition: 300ms;\n  transition: 300ms;\n  -webkit-transform: translate3d(0, 0, 0);\n  -ms-transform: translate3d(0, 0, 0);\n  -o-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  z-index: 10; }\n\n.swiper-pagination.swiper-pagination-hidden {\n  opacity: 0; }\n\n.swiper-pagination-bullet {\n  width: 8px;\n  height: 8px;\n  display: inline-block;\n  border-radius: 100%;\n  background: #000;\n  opacity: 0.2; }\n\nbutton.swiper-pagination-bullet {\n  border: none;\n  margin: 0;\n  padding: 0;\n  box-shadow: none;\n  -moz-appearance: none;\n  -ms-appearance: none;\n  -webkit-appearance: none;\n  appearance: none; }\n\n.swiper-pagination-clickable .swiper-pagination-bullet {\n  cursor: pointer; }\n\n.swiper-pagination-white .swiper-pagination-bullet {\n  background: #fff; }\n\n.swiper-pagination-bullet-active {\n  opacity: 1; }\n\n.swiper-pagination-white .swiper-pagination-bullet-active {\n  background: #fff; }\n\n.swiper-pagination-black .swiper-pagination-bullet-active {\n  background: #000; }\n\n.swiper-container-vertical > .swiper-pagination {\n  right: 10px;\n  top: 50%;\n  -webkit-transform: translate3d(0px, -50%, 0);\n  -moz-transform: translate3d(0px, -50%, 0);\n  -o-transform: translate(0px, -50%);\n  -ms-transform: translate3d(0px, -50%, 0);\n  transform: translate3d(0px, -50%, 0); }\n\n.swiper-container-vertical > .swiper-pagination .swiper-pagination-bullet {\n  margin: 5px 0;\n  display: block; }\n\n.swiper-container-horizontal > .swiper-pagination {\n  bottom: 10px;\n  left: 0;\n  width: 100%; }\n\n.swiper-container-horizontal > .swiper-pagination .swiper-pagination-bullet {\n  margin: 0 5px; }\n\n/* 3D Container */\n.swiper-container-3d {\n  -webkit-perspective: 1200px;\n  -moz-perspective: 1200px;\n  -o-perspective: 1200px;\n  perspective: 1200px; }\n\n.swiper-container-3d .swiper-wrapper,\n.swiper-container-3d .swiper-slide,\n.swiper-container-3d .swiper-slide-shadow-left,\n.swiper-container-3d .swiper-slide-shadow-right,\n.swiper-container-3d .swiper-slide-shadow-top,\n.swiper-container-3d .swiper-slide-shadow-bottom,\n.swiper-container-3d .swiper-cube-shadow {\n  -webkit-transform-style: preserve-3d;\n  -moz-transform-style: preserve-3d;\n  -ms-transform-style: preserve-3d;\n  transform-style: preserve-3d; }\n\n.swiper-container-3d .swiper-slide-shadow-left,\n.swiper-container-3d .swiper-slide-shadow-right,\n.swiper-container-3d .swiper-slide-shadow-top,\n.swiper-container-3d .swiper-slide-shadow-bottom {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n  z-index: 10; }\n\n.swiper-container-3d .swiper-slide-shadow-left {\n  background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n.swiper-container-3d .swiper-slide-shadow-right {\n  background-image: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n.swiper-container-3d .swiper-slide-shadow-top {\n  background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n.swiper-container-3d .swiper-slide-shadow-bottom {\n  background-image: -webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n/* Coverflow */\n.swiper-container-coverflow .swiper-wrapper {\n  /* Windows 8 IE 10 fix */\n  -ms-perspective: 1200px; }\n\n/* Fade */\n.swiper-container-fade.swiper-container-free-mode .swiper-slide {\n  -webkit-transition-timing-function: ease-out;\n  -moz-transition-timing-function: ease-out;\n  -ms-transition-timing-function: ease-out;\n  -o-transition-timing-function: ease-out;\n  transition-timing-function: ease-out; }\n\n.swiper-container-fade .swiper-slide {\n  pointer-events: none; }\n\n.swiper-container-fade .swiper-slide .swiper-slide {\n  pointer-events: none; }\n\n.swiper-container-fade .swiper-slide-active,\n.swiper-container-fade .swiper-slide-active .swiper-slide-active {\n  pointer-events: auto; }\n\n/* Cube */\n.swiper-container-cube {\n  overflow: visible; }\n\n.swiper-container-cube .swiper-slide {\n  pointer-events: none;\n  visibility: hidden;\n  -webkit-transform-origin: 0 0;\n  -moz-transform-origin: 0 0;\n  -ms-transform-origin: 0 0;\n  transform-origin: 0 0;\n  -webkit-backface-visibility: hidden;\n  -moz-backface-visibility: hidden;\n  -ms-backface-visibility: hidden;\n  backface-visibility: hidden;\n  width: 100%;\n  height: 100%;\n  z-index: 1; }\n\n.swiper-container-cube.swiper-container-rtl .swiper-slide {\n  -webkit-transform-origin: 100% 0;\n  -moz-transform-origin: 100% 0;\n  -ms-transform-origin: 100% 0;\n  transform-origin: 100% 0; }\n\n.swiper-container-cube .swiper-slide-active,\n.swiper-container-cube .swiper-slide-next,\n.swiper-container-cube .swiper-slide-prev,\n.swiper-container-cube .swiper-slide-next + .swiper-slide {\n  pointer-events: auto;\n  visibility: visible; }\n\n.swiper-container-cube .swiper-slide-shadow-top,\n.swiper-container-cube .swiper-slide-shadow-bottom,\n.swiper-container-cube .swiper-slide-shadow-left,\n.swiper-container-cube .swiper-slide-shadow-right {\n  z-index: 0;\n  -webkit-backface-visibility: hidden;\n  -moz-backface-visibility: hidden;\n  -ms-backface-visibility: hidden;\n  backface-visibility: hidden; }\n\n.swiper-container-cube .swiper-cube-shadow {\n  position: absolute;\n  left: 0;\n  bottom: 0px;\n  width: 100%;\n  height: 100%;\n  background: #000;\n  opacity: 0.6;\n  -webkit-filter: blur(50px);\n  filter: blur(50px);\n  z-index: 0; }\n\n/* Scrollbar */\n.swiper-scrollbar {\n  border-radius: 10px;\n  position: relative;\n  -ms-touch-action: none;\n  background: rgba(0, 0, 0, 0.1); }\n\n.swiper-container-horizontal > .swiper-scrollbar {\n  position: absolute;\n  left: 1%;\n  bottom: 3px;\n  z-index: 50;\n  height: 5px;\n  width: 98%; }\n\n.swiper-container-vertical > .swiper-scrollbar {\n  position: absolute;\n  right: 3px;\n  top: 1%;\n  z-index: 50;\n  width: 5px;\n  height: 98%; }\n\n.swiper-scrollbar-drag {\n  height: 100%;\n  width: 100%;\n  position: relative;\n  background: rgba(0, 0, 0, 0.5);\n  border-radius: 10px;\n  left: 0;\n  top: 0; }\n\n.swiper-scrollbar-cursor-drag {\n  cursor: move; }\n\n/* Preloader */\n.swiper-lazy-preloader {\n  width: 42px;\n  height: 42px;\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  margin-left: -21px;\n  margin-top: -21px;\n  z-index: 10;\n  -webkit-transform-origin: 50%;\n  -moz-transform-origin: 50%;\n  transform-origin: 50%;\n  -webkit-animation: swiper-preloader-spin 1s steps(12, end) infinite;\n  -moz-animation: swiper-preloader-spin 1s steps(12, end) infinite;\n  animation: swiper-preloader-spin 1s steps(12, end) infinite; }\n\n.swiper-lazy-preloader:after {\n  display: block;\n  content: \"\";\n  width: 100%;\n  height: 100%;\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E\");\n  background-position: 50%;\n  -webkit-background-size: 100%;\n  background-size: 100%;\n  background-repeat: no-repeat; }\n\n.swiper-lazy-preloader-white:after {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%23fff'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E\"); }\n\n@-webkit-keyframes swiper-preloader-spin {\n  100% {\n    -webkit-transform: rotate(360deg); } }\n\n@keyframes swiper-preloader-spin {\n  100% {\n    transform: rotate(360deg); } }\n\nion-slides {\n  width: 100%;\n  height: 100%;\n  display: block; }\n\n.slide-zoom {\n  display: block;\n  width: 100%;\n  text-align: center; }\n\n.swiper-container {\n  width: 100%;\n  height: 100%;\n  padding: 0;\n  overflow: hidden; }\n\n.swiper-wrapper {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n  padding: 0; }\n\n.swiper-slide {\n  width: 100%;\n  height: 100%;\n  box-sizing: border-box;\n  /* Center slide text vertically */ }\n  .swiper-slide img {\n    width: auto;\n    height: auto;\n    max-width: 100%;\n    max-height: 100%; }\n\n.scroll-refresher {\n  position: absolute;\n  top: -60px;\n  right: 0;\n  left: 0;\n  overflow: hidden;\n  margin: auto;\n  height: 60px; }\n  .scroll-refresher .ionic-refresher-content {\n    position: absolute;\n    bottom: 15px;\n    left: 0;\n    width: 100%;\n    color: #666666;\n    text-align: center;\n    font-size: 30px; }\n    .scroll-refresher .ionic-refresher-content .text-refreshing,\n    .scroll-refresher .ionic-refresher-content .text-pulling {\n      font-size: 16px;\n      line-height: 16px; }\n    .scroll-refresher .ionic-refresher-content.ionic-refresher-with-text {\n      bottom: 10px; }\n  .scroll-refresher .icon-refreshing,\n  .scroll-refresher .icon-pulling {\n    width: 100%;\n    -webkit-backface-visibility: hidden;\n    backface-visibility: hidden;\n    -webkit-transform-style: preserve-3d;\n    transform-style: preserve-3d; }\n  .scroll-refresher .icon-pulling {\n    -webkit-animation-name: refresh-spin-back;\n    animation-name: refresh-spin-back;\n    -webkit-animation-duration: 200ms;\n    animation-duration: 200ms;\n    -webkit-animation-timing-function: linear;\n    animation-timing-function: linear;\n    -webkit-animation-fill-mode: none;\n    animation-fill-mode: none;\n    -webkit-transform: translate3d(0, 0, 0) rotate(0deg);\n    transform: translate3d(0, 0, 0) rotate(0deg); }\n  .scroll-refresher .icon-refreshing,\n  .scroll-refresher .text-refreshing {\n    display: none; }\n  .scroll-refresher .icon-refreshing {\n    -webkit-animation-duration: 1.5s;\n    animation-duration: 1.5s; }\n  .scroll-refresher.active .icon-pulling:not(.pulling-rotation-disabled) {\n    -webkit-animation-name: refresh-spin;\n    animation-name: refresh-spin;\n    -webkit-transform: translate3d(0, 0, 0) rotate(-180deg);\n    transform: translate3d(0, 0, 0) rotate(-180deg); }\n  .scroll-refresher.active.refreshing {\n    -webkit-transition: -webkit-transform 0.2s;\n    transition: -webkit-transform 0.2s;\n    -webkit-transition: transform 0.2s;\n    transition: transform 0.2s;\n    -webkit-transform: scale(1, 1);\n    transform: scale(1, 1); }\n    .scroll-refresher.active.refreshing .icon-pulling,\n    .scroll-refresher.active.refreshing .text-pulling {\n      display: none; }\n    .scroll-refresher.active.refreshing .icon-refreshing,\n    .scroll-refresher.active.refreshing .text-refreshing {\n      display: block; }\n    .scroll-refresher.active.refreshing.refreshing-tail {\n      -webkit-transform: scale(0, 0);\n      transform: scale(0, 0); }\n\n.overflow-scroll > .scroll {\n  -webkit-overflow-scrolling: touch;\n  width: 100%; }\n  .overflow-scroll > .scroll.overscroll {\n    position: fixed;\n    right: 0;\n    left: 0; }\n\n.overflow-scroll.padding > .scroll.overscroll {\n  padding: 10px; }\n\n@-webkit-keyframes refresh-spin {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(0); }\n  100% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(180deg); } }\n\n@keyframes refresh-spin {\n  0% {\n    transform: translate3d(0, 0, 0) rotate(0); }\n  100% {\n    transform: translate3d(0, 0, 0) rotate(180deg); } }\n\n@-webkit-keyframes refresh-spin-back {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(180deg); }\n  100% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(0); } }\n\n@keyframes refresh-spin-back {\n  0% {\n    transform: translate3d(0, 0, 0) rotate(180deg); }\n  100% {\n    transform: translate3d(0, 0, 0) rotate(0); } }\n\n/**\n * Spinners\n * --------------------------------------------------\n */\n.spinner {\n  stroke: #444;\n  fill: #444; }\n  .spinner svg {\n    width: 28px;\n    height: 28px; }\n  .spinner.spinner-light {\n    stroke: #fff;\n    fill: #fff; }\n  .spinner.spinner-stable {\n    stroke: #f8f8f8;\n    fill: #f8f8f8; }\n  .spinner.spinner-positive {\n    stroke: #387ef5;\n    fill: #387ef5; }\n  .spinner.spinner-calm {\n    stroke: #11c1f3;\n    fill: #11c1f3; }\n  .spinner.spinner-balanced {\n    stroke: #33cd5f;\n    fill: #33cd5f; }\n  .spinner.spinner-assertive {\n    stroke: #ef473a;\n    fill: #ef473a; }\n  .spinner.spinner-energized {\n    stroke: #ffc900;\n    fill: #ffc900; }\n  .spinner.spinner-royal {\n    stroke: #886aea;\n    fill: #886aea; }\n  .spinner.spinner-dark {\n    stroke: #444;\n    fill: #444; }\n\n.spinner-android {\n  stroke: #4b8bf4; }\n\n.spinner-ios,\n.spinner-ios-small {\n  stroke: #69717d; }\n\n.spinner-spiral .stop1 {\n  stop-color: #fff;\n  stop-opacity: 0; }\n\n.spinner-spiral.spinner-light .stop1 {\n  stop-color: #444; }\n\n.spinner-spiral.spinner-light .stop2 {\n  stop-color: #fff; }\n\n.spinner-spiral.spinner-stable .stop2 {\n  stop-color: #f8f8f8; }\n\n.spinner-spiral.spinner-positive .stop2 {\n  stop-color: #387ef5; }\n\n.spinner-spiral.spinner-calm .stop2 {\n  stop-color: #11c1f3; }\n\n.spinner-spiral.spinner-balanced .stop2 {\n  stop-color: #33cd5f; }\n\n.spinner-spiral.spinner-assertive .stop2 {\n  stop-color: #ef473a; }\n\n.spinner-spiral.spinner-energized .stop2 {\n  stop-color: #ffc900; }\n\n.spinner-spiral.spinner-royal .stop2 {\n  stop-color: #886aea; }\n\n.spinner-spiral.spinner-dark .stop2 {\n  stop-color: #444; }\n\n/**\n * Forms\n * --------------------------------------------------\n */\nform {\n  margin: 0 0 1.42857; }\n\nlegend {\n  display: block;\n  margin-bottom: 1.42857;\n  padding: 0;\n  width: 100%;\n  border: 1px solid #ddd;\n  color: #444;\n  font-size: 21px;\n  line-height: 2.85714; }\n  legend small {\n    color: #f8f8f8;\n    font-size: 1.07143; }\n\nlabel,\ninput,\nbutton,\nselect,\ntextarea {\n  font-weight: normal;\n  font-size: 14px;\n  line-height: 1.42857; }\n\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif; }\n\n.item-input {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: relative;\n  overflow: hidden;\n  padding: 6px 0 5px 16px; }\n  .item-input input {\n    -webkit-border-radius: 0;\n    border-radius: 0;\n    -webkit-box-flex: 1;\n    -webkit-flex: 1 220px;\n    -moz-box-flex: 1;\n    -moz-flex: 1 220px;\n    -ms-flex: 1 220px;\n    flex: 1 220px;\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    margin: 0;\n    padding-right: 24px;\n    background-color: transparent; }\n  .item-input .button .icon {\n    -webkit-box-flex: 0;\n    -webkit-flex: 0 0 24px;\n    -moz-box-flex: 0;\n    -moz-flex: 0 0 24px;\n    -ms-flex: 0 0 24px;\n    flex: 0 0 24px;\n    position: static;\n    display: inline-block;\n    height: auto;\n    text-align: center;\n    font-size: 16px; }\n  .item-input .button-bar {\n    -webkit-border-radius: 0;\n    border-radius: 0;\n    -webkit-box-flex: 1;\n    -webkit-flex: 1 0 220px;\n    -moz-box-flex: 1;\n    -moz-flex: 1 0 220px;\n    -ms-flex: 1 0 220px;\n    flex: 1 0 220px;\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none; }\n  .item-input .icon {\n    min-width: 14px; }\n\n.platform-windowsphone .item-input input {\n  flex-shrink: 1; }\n\n.item-input-inset {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: relative;\n  overflow: hidden;\n  padding: 10.66667px; }\n\n.item-input-wrapper {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-flex: 1;\n  -webkit-flex: 1 0;\n  -moz-box-flex: 1;\n  -moz-flex: 1 0;\n  -ms-flex: 1 0;\n  flex: 1 0;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  -webkit-border-radius: 4px;\n  border-radius: 4px;\n  padding-right: 8px;\n  padding-left: 8px;\n  background: #eee; }\n\n.item-input-inset .item-input-wrapper input {\n  padding-left: 4px;\n  height: 29px;\n  background: transparent;\n  line-height: 18px; }\n\n.item-input-wrapper ~ .button {\n  margin-left: 10.66667px; }\n\n.input-label {\n  display: table;\n  padding: 7px 10px 7px 0px;\n  max-width: 200px;\n  width: 35%;\n  color: #444;\n  font-size: 16px; }\n\n.placeholder-icon {\n  color: #aaa; }\n  .placeholder-icon:first-child {\n    padding-right: 6px; }\n  .placeholder-icon:last-child {\n    padding-left: 6px; }\n\n.item-stacked-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none; }\n  .item-stacked-label .input-label, .item-stacked-label .icon {\n    display: inline-block;\n    padding: 4px 0 0 0px;\n    vertical-align: middle; }\n\n.item-stacked-label input,\n.item-stacked-label textarea {\n  -webkit-border-radius: 2px;\n  border-radius: 2px;\n  padding: 4px 8px 3px 0;\n  border: none;\n  background-color: #fff; }\n\n.item-stacked-label input {\n  overflow: hidden;\n  height: 46px; }\n\n.item-select.item-stacked-label select {\n  position: relative;\n  padding: 0px;\n  max-width: 90%;\n  direction: ltr;\n  white-space: pre-wrap;\n  margin: -3px; }\n\n.item-floating-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none; }\n  .item-floating-label .input-label {\n    position: relative;\n    padding: 5px 0 0 0;\n    opacity: 0;\n    top: 10px;\n    -webkit-transition: opacity 0.15s ease-in, top 0.2s linear;\n    transition: opacity 0.15s ease-in, top 0.2s linear; }\n    .item-floating-label .input-label.has-input {\n      opacity: 1;\n      top: 0;\n      -webkit-transition: opacity 0.15s ease-in, top 0.2s linear;\n      transition: opacity 0.15s ease-in, top 0.2s linear; }\n\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  display: block;\n  padding-top: 2px;\n  padding-left: 0;\n  height: 34px;\n  color: #111;\n  vertical-align: middle;\n  font-size: 14px;\n  line-height: 16px; }\n\n.platform-ios input[type=\"datetime-local\"],\n.platform-ios input[type=\"date\"],\n.platform-ios input[type=\"month\"],\n.platform-ios input[type=\"time\"],\n.platform-ios input[type=\"week\"],\n.platform-android input[type=\"datetime-local\"],\n.platform-android input[type=\"date\"],\n.platform-android input[type=\"month\"],\n.platform-android input[type=\"time\"],\n.platform-android input[type=\"week\"] {\n  padding-top: 8px; }\n\n.item-input input,\n.item-input textarea {\n  width: 100%; }\n\ntextarea {\n  padding-left: 0; }\n  textarea::-moz-placeholder {\n    color: #aaaaaa; }\n  textarea:-ms-input-placeholder {\n    color: #aaaaaa; }\n  textarea::-webkit-input-placeholder {\n    color: #aaaaaa;\n    text-indent: -3px; }\n\ntextarea {\n  height: auto; }\n\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  border: 0; }\n\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 0;\n  line-height: normal; }\n\n.item-input input[type=\"file\"],\n.item-input input[type=\"image\"],\n.item-input input[type=\"submit\"],\n.item-input input[type=\"reset\"],\n.item-input input[type=\"button\"],\n.item-input input[type=\"radio\"],\n.item-input input[type=\"checkbox\"] {\n  width: auto; }\n\ninput[type=\"file\"] {\n  line-height: 34px; }\n\n.previous-input-focus,\n.cloned-text-input + input,\n.cloned-text-input + textarea {\n  position: absolute !important;\n  left: -9999px;\n  width: 200px; }\n\ninput::-moz-placeholder,\ntextarea::-moz-placeholder {\n  color: #aaaaaa; }\n\ninput:-ms-input-placeholder,\ntextarea:-ms-input-placeholder {\n  color: #aaaaaa; }\n\ninput::-webkit-input-placeholder,\ntextarea::-webkit-input-placeholder {\n  color: #aaaaaa;\n  text-indent: 0; }\n\ninput[disabled],\nselect[disabled],\ntextarea[disabled],\ninput[readonly]:not(.cloned-text-input),\ntextarea[readonly]:not(.cloned-text-input),\nselect[readonly] {\n  background-color: #f8f8f8;\n  cursor: not-allowed; }\n\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\ninput[type=\"radio\"][readonly],\ninput[type=\"checkbox\"][readonly] {\n  background-color: transparent; }\n\n/**\n * Checkbox\n * --------------------------------------------------\n */\n.checkbox {\n  position: relative;\n  display: inline-block;\n  padding: 7px 7px;\n  cursor: pointer; }\n  .checkbox input:before,\n  .checkbox .checkbox-icon:before {\n    border-color: #ddd; }\n  .checkbox input:checked:before,\n  .checkbox input:checked + .checkbox-icon:before {\n    background: #387ef5;\n    border-color: #387ef5; }\n\n.checkbox-light input:before,\n.checkbox-light .checkbox-icon:before {\n  border-color: #ddd; }\n\n.checkbox-light input:checked:before,\n.checkbox-light input:checked + .checkbox-icon:before {\n  background: #ddd;\n  border-color: #ddd; }\n\n.checkbox-stable input:before,\n.checkbox-stable .checkbox-icon:before {\n  border-color: #b2b2b2; }\n\n.checkbox-stable input:checked:before,\n.checkbox-stable input:checked + .checkbox-icon:before {\n  background: #b2b2b2;\n  border-color: #b2b2b2; }\n\n.checkbox-positive input:before,\n.checkbox-positive .checkbox-icon:before {\n  border-color: #387ef5; }\n\n.checkbox-positive input:checked:before,\n.checkbox-positive input:checked + .checkbox-icon:before {\n  background: #387ef5;\n  border-color: #387ef5; }\n\n.checkbox-calm input:before,\n.checkbox-calm .checkbox-icon:before {\n  border-color: #11c1f3; }\n\n.checkbox-calm input:checked:before,\n.checkbox-calm input:checked + .checkbox-icon:before {\n  background: #11c1f3;\n  border-color: #11c1f3; }\n\n.checkbox-assertive input:before,\n.checkbox-assertive .checkbox-icon:before {\n  border-color: #ef473a; }\n\n.checkbox-assertive input:checked:before,\n.checkbox-assertive input:checked + .checkbox-icon:before {\n  background: #ef473a;\n  border-color: #ef473a; }\n\n.checkbox-balanced input:before,\n.checkbox-balanced .checkbox-icon:before {\n  border-color: #33cd5f; }\n\n.checkbox-balanced input:checked:before,\n.checkbox-balanced input:checked + .checkbox-icon:before {\n  background: #33cd5f;\n  border-color: #33cd5f; }\n\n.checkbox-energized input:before,\n.checkbox-energized .checkbox-icon:before {\n  border-color: #ffc900; }\n\n.checkbox-energized input:checked:before,\n.checkbox-energized input:checked + .checkbox-icon:before {\n  background: #ffc900;\n  border-color: #ffc900; }\n\n.checkbox-royal input:before,\n.checkbox-royal .checkbox-icon:before {\n  border-color: #886aea; }\n\n.checkbox-royal input:checked:before,\n.checkbox-royal input:checked + .checkbox-icon:before {\n  background: #886aea;\n  border-color: #886aea; }\n\n.checkbox-dark input:before,\n.checkbox-dark .checkbox-icon:before {\n  border-color: #444; }\n\n.checkbox-dark input:checked:before,\n.checkbox-dark input:checked + .checkbox-icon:before {\n  background: #444;\n  border-color: #444; }\n\n.checkbox input:disabled:before,\n.checkbox input:disabled + .checkbox-icon:before {\n  border-color: #ddd; }\n\n.checkbox input:disabled:checked:before,\n.checkbox input:disabled:checked + .checkbox-icon:before {\n  background: #ddd; }\n\n.checkbox.checkbox-input-hidden input {\n  display: none !important; }\n\n.checkbox input,\n.checkbox-icon {\n  position: relative;\n  width: 28px;\n  height: 28px;\n  display: block;\n  border: 0;\n  background: transparent;\n  cursor: pointer;\n  -webkit-appearance: none; }\n  .checkbox input:before,\n  .checkbox-icon:before {\n    display: table;\n    width: 100%;\n    height: 100%;\n    border-width: 1px;\n    border-style: solid;\n    border-radius: 28px;\n    background: #fff;\n    content: ' ';\n    -webkit-transition: background-color 20ms ease-in-out;\n    transition: background-color 20ms ease-in-out; }\n\n.checkbox input:checked:before,\ninput:checked + .checkbox-icon:before {\n  border-width: 2px; }\n\n.checkbox input:after,\n.checkbox-icon:after {\n  -webkit-transition: opacity 0.05s ease-in-out;\n  transition: opacity 0.05s ease-in-out;\n  -webkit-transform: rotate(-45deg);\n  transform: rotate(-45deg);\n  position: absolute;\n  top: 33%;\n  left: 25%;\n  display: table;\n  width: 14px;\n  height: 6px;\n  border: 1px solid #fff;\n  border-top: 0;\n  border-right: 0;\n  content: ' ';\n  opacity: 0; }\n\n.platform-android .checkbox-platform input:before,\n.platform-android .checkbox-platform .checkbox-icon:before,\n.checkbox-square input:before,\n.checkbox-square .checkbox-icon:before {\n  border-radius: 2px;\n  width: 72%;\n  height: 72%;\n  margin-top: 14%;\n  margin-left: 14%;\n  border-width: 2px; }\n\n.platform-android .checkbox-platform input:after,\n.platform-android .checkbox-platform .checkbox-icon:after,\n.checkbox-square input:after,\n.checkbox-square .checkbox-icon:after {\n  border-width: 2px;\n  top: 19%;\n  left: 25%;\n  width: 13px;\n  height: 7px; }\n\n.platform-android .item-checkbox-right .checkbox-square .checkbox-icon::after {\n  top: 31%; }\n\n.grade-c .checkbox input:after,\n.grade-c .checkbox-icon:after {\n  -webkit-transform: rotate(0);\n  transform: rotate(0);\n  top: 3px;\n  left: 4px;\n  border: none;\n  color: #fff;\n  content: '\\2713';\n  font-weight: bold;\n  font-size: 20px; }\n\n.checkbox input:checked:after,\ninput:checked + .checkbox-icon:after {\n  opacity: 1; }\n\n.item-checkbox {\n  padding-left: 60px; }\n  .item-checkbox.active {\n    box-shadow: none; }\n\n.item-checkbox .checkbox {\n  position: absolute;\n  top: 50%;\n  right: 8px;\n  left: 8px;\n  z-index: 3;\n  margin-top: -21px; }\n\n.item-checkbox.item-checkbox-right {\n  padding-right: 60px;\n  padding-left: 16px; }\n\n.item-checkbox-right .checkbox input,\n.item-checkbox-right .checkbox-icon {\n  float: right; }\n\n/**\n * Toggle\n * --------------------------------------------------\n */\n.item-toggle {\n  pointer-events: none; }\n\n.toggle {\n  position: relative;\n  display: inline-block;\n  pointer-events: auto;\n  margin: -5px;\n  padding: 5px; }\n  .toggle input:checked + .track {\n    border-color: #4cd964;\n    background-color: #4cd964; }\n  .toggle.dragging .handle {\n    background-color: #f2f2f2 !important; }\n\n.toggle.toggle-light input:checked + .track {\n  border-color: #ddd;\n  background-color: #ddd; }\n\n.toggle.toggle-stable input:checked + .track {\n  border-color: #b2b2b2;\n  background-color: #b2b2b2; }\n\n.toggle.toggle-positive input:checked + .track {\n  border-color: #387ef5;\n  background-color: #387ef5; }\n\n.toggle.toggle-calm input:checked + .track {\n  border-color: #11c1f3;\n  background-color: #11c1f3; }\n\n.toggle.toggle-assertive input:checked + .track {\n  border-color: #ef473a;\n  background-color: #ef473a; }\n\n.toggle.toggle-balanced input:checked + .track {\n  border-color: #33cd5f;\n  background-color: #33cd5f; }\n\n.toggle.toggle-energized input:checked + .track {\n  border-color: #ffc900;\n  background-color: #ffc900; }\n\n.toggle.toggle-royal input:checked + .track {\n  border-color: #886aea;\n  background-color: #886aea; }\n\n.toggle.toggle-dark input:checked + .track {\n  border-color: #444;\n  background-color: #444; }\n\n.toggle input {\n  display: none; }\n\n/* the track appearance when the toggle is \"off\" */\n.toggle .track {\n  -webkit-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  -webkit-transition-duration: 0.3s;\n  transition-duration: 0.3s;\n  -webkit-transition-property: background-color, border;\n  transition-property: background-color, border;\n  display: inline-block;\n  box-sizing: border-box;\n  width: 51px;\n  height: 31px;\n  border: solid 2px #e6e6e6;\n  border-radius: 20px;\n  background-color: #fff;\n  content: ' ';\n  cursor: pointer;\n  pointer-events: none; }\n\n/* Fix to avoid background color bleeding */\n/* (occurred on (at least) Android 4.2, Asus MeMO Pad HD7 ME173X) */\n.platform-android4_2 .toggle .track {\n  -webkit-background-clip: padding-box; }\n\n/* the handle (circle) thats inside the toggle's track area */\n/* also the handle's appearance when it is \"off\" */\n.toggle .handle {\n  -webkit-transition: 0.3s cubic-bezier(0, 1.1, 1, 1.1);\n  transition: 0.3s cubic-bezier(0, 1.1, 1, 1.1);\n  -webkit-transition-property: background-color, transform;\n  transition-property: background-color, transform;\n  position: absolute;\n  display: block;\n  width: 27px;\n  height: 27px;\n  border-radius: 27px;\n  background-color: #fff;\n  top: 7px;\n  left: 7px;\n  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.15); }\n  .toggle .handle:before {\n    position: absolute;\n    top: -4px;\n    left: -21.5px;\n    padding: 18.5px 34px;\n    content: \" \"; }\n\n.toggle input:checked + .track .handle {\n  -webkit-transform: translate3d(20px, 0, 0);\n  transform: translate3d(20px, 0, 0);\n  background-color: #fff; }\n\n.item-toggle.active {\n  box-shadow: none; }\n\n.item-toggle,\n.item-toggle.item-complex .item-content {\n  padding-right: 99px; }\n\n.item-toggle.item-complex {\n  padding-right: 0; }\n\n.item-toggle .toggle {\n  position: absolute;\n  top: 10px;\n  right: 16px;\n  z-index: 3; }\n\n.toggle input:disabled + .track {\n  opacity: .6; }\n\n.toggle-small .track {\n  border: 0;\n  width: 34px;\n  height: 15px;\n  background: #9e9e9e; }\n\n.toggle-small input:checked + .track {\n  background: rgba(0, 150, 137, 0.5); }\n\n.toggle-small .handle {\n  top: 2px;\n  left: 4px;\n  width: 21px;\n  height: 21px;\n  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25); }\n\n.toggle-small input:checked + .track .handle {\n  -webkit-transform: translate3d(16px, 0, 0);\n  transform: translate3d(16px, 0, 0);\n  background: #009689; }\n\n.toggle-small.item-toggle .toggle {\n  top: 19px; }\n\n.toggle-small .toggle-light input:checked + .track {\n  background-color: rgba(221, 221, 221, 0.5); }\n\n.toggle-small .toggle-light input:checked + .track .handle {\n  background-color: #ddd; }\n\n.toggle-small .toggle-stable input:checked + .track {\n  background-color: rgba(178, 178, 178, 0.5); }\n\n.toggle-small .toggle-stable input:checked + .track .handle {\n  background-color: #b2b2b2; }\n\n.toggle-small .toggle-positive input:checked + .track {\n  background-color: rgba(56, 126, 245, 0.5); }\n\n.toggle-small .toggle-positive input:checked + .track .handle {\n  background-color: #387ef5; }\n\n.toggle-small .toggle-calm input:checked + .track {\n  background-color: rgba(17, 193, 243, 0.5); }\n\n.toggle-small .toggle-calm input:checked + .track .handle {\n  background-color: #11c1f3; }\n\n.toggle-small .toggle-assertive input:checked + .track {\n  background-color: rgba(239, 71, 58, 0.5); }\n\n.toggle-small .toggle-assertive input:checked + .track .handle {\n  background-color: #ef473a; }\n\n.toggle-small .toggle-balanced input:checked + .track {\n  background-color: rgba(51, 205, 95, 0.5); }\n\n.toggle-small .toggle-balanced input:checked + .track .handle {\n  background-color: #33cd5f; }\n\n.toggle-small .toggle-energized input:checked + .track {\n  background-color: rgba(255, 201, 0, 0.5); }\n\n.toggle-small .toggle-energized input:checked + .track .handle {\n  background-color: #ffc900; }\n\n.toggle-small .toggle-royal input:checked + .track {\n  background-color: rgba(136, 106, 234, 0.5); }\n\n.toggle-small .toggle-royal input:checked + .track .handle {\n  background-color: #886aea; }\n\n.toggle-small .toggle-dark input:checked + .track {\n  background-color: rgba(68, 68, 68, 0.5); }\n\n.toggle-small .toggle-dark input:checked + .track .handle {\n  background-color: #444; }\n\n/**\n * Radio Button Inputs\n * --------------------------------------------------\n */\n.item-radio {\n  padding: 0; }\n  .item-radio:hover {\n    cursor: pointer; }\n\n.item-radio .item-content {\n  /* give some room to the right for the checkmark icon */\n  padding-right: 64px; }\n\n.item-radio .radio-icon {\n  /* checkmark icon will be hidden by default */\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 3;\n  visibility: hidden;\n  padding: 14px;\n  height: 100%;\n  font-size: 24px; }\n\n.item-radio input {\n  /* hide any radio button inputs elements (the ugly circles) */\n  position: absolute;\n  left: -9999px; }\n  .item-radio input:checked + .radio-content .item-content {\n    /* style the item content when its checked */\n    background: #f7f7f7; }\n  .item-radio input:checked + .radio-content .radio-icon {\n    /* show the checkmark icon when its checked */\n    visibility: visible; }\n\n/**\n * Range\n * --------------------------------------------------\n */\n.range input {\n  display: inline-block;\n  overflow: hidden;\n  margin-top: 5px;\n  margin-bottom: 5px;\n  padding-right: 2px;\n  padding-left: 1px;\n  width: auto;\n  height: 43px;\n  outline: none;\n  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ccc), color-stop(100%, #ccc));\n  background: linear-gradient(to right, #ccc 0%, #ccc 100%);\n  background-position: center;\n  background-size: 99% 2px;\n  background-repeat: no-repeat;\n  -webkit-appearance: none;\n  /*\n   &::-ms-track{\n     background: transparent;\n     border-color: transparent;\n     border-width: 11px 0 16px;\n     color:transparent;\n     margin-top:20px;\n   }\n   &::-ms-thumb {\n     width: $range-slider-width;\n     height: $range-slider-height;\n     border-radius: $range-slider-border-radius;\n     background-color: $toggle-handle-off-bg-color;\n     border-color:$toggle-handle-off-bg-color;\n     box-shadow: $range-slider-box-shadow;\n     margin-left:1px;\n     margin-right:1px;\n     outline:none;\n   }\n   &::-ms-fill-upper {\n     height: $range-track-height;\n     background:$range-default-track-bg;\n   }\n   */ }\n  .range input::-moz-focus-outer {\n    /* hide the focus outline in Firefox */\n    border: 0; }\n  .range input::-webkit-slider-thumb {\n    position: relative;\n    width: 28px;\n    height: 28px;\n    border-radius: 50%;\n    background-color: #fff;\n    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2);\n    cursor: pointer;\n    -webkit-appearance: none;\n    border: 0; }\n  .range input::-webkit-slider-thumb:before {\n    /* what creates the colorful line on the left side of the slider */\n    position: absolute;\n    top: 13px;\n    left: -2001px;\n    width: 2000px;\n    height: 2px;\n    background: #444;\n    content: ' '; }\n  .range input::-webkit-slider-thumb:after {\n    /* create a larger (but hidden) hit area */\n    position: absolute;\n    top: -15px;\n    left: -15px;\n    padding: 30px;\n    content: ' '; }\n  .range input::-ms-fill-lower {\n    height: 2px;\n    background: #444; }\n\n.range {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  padding: 2px 11px; }\n  .range.range-light input::-webkit-slider-thumb:before {\n    background: #ddd; }\n  .range.range-light input::-ms-fill-lower {\n    background: #ddd; }\n  .range.range-stable input::-webkit-slider-thumb:before {\n    background: #b2b2b2; }\n  .range.range-stable input::-ms-fill-lower {\n    background: #b2b2b2; }\n  .range.range-positive input::-webkit-slider-thumb:before {\n    background: #387ef5; }\n  .range.range-positive input::-ms-fill-lower {\n    background: #387ef5; }\n  .range.range-calm input::-webkit-slider-thumb:before {\n    background: #11c1f3; }\n  .range.range-calm input::-ms-fill-lower {\n    background: #11c1f3; }\n  .range.range-balanced input::-webkit-slider-thumb:before {\n    background: #33cd5f; }\n  .range.range-balanced input::-ms-fill-lower {\n    background: #33cd5f; }\n  .range.range-assertive input::-webkit-slider-thumb:before {\n    background: #ef473a; }\n  .range.range-assertive input::-ms-fill-lower {\n    background: #ef473a; }\n  .range.range-energized input::-webkit-slider-thumb:before {\n    background: #ffc900; }\n  .range.range-energized input::-ms-fill-lower {\n    background: #ffc900; }\n  .range.range-royal input::-webkit-slider-thumb:before {\n    background: #886aea; }\n  .range.range-royal input::-ms-fill-lower {\n    background: #886aea; }\n  .range.range-dark input::-webkit-slider-thumb:before {\n    background: #444; }\n  .range.range-dark input::-ms-fill-lower {\n    background: #444; }\n\n.range .icon {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0;\n  -moz-box-flex: 0;\n  -moz-flex: 0;\n  -ms-flex: 0;\n  flex: 0;\n  display: block;\n  min-width: 24px;\n  text-align: center;\n  font-size: 24px; }\n\n.range input {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  margin-right: 10px;\n  margin-left: 10px; }\n\n.range-label {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 auto;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 auto;\n  -ms-flex: 0 0 auto;\n  flex: 0 0 auto;\n  display: block;\n  white-space: nowrap; }\n\n.range-label:first-child {\n  padding-left: 5px; }\n\n.range input + .range-label {\n  padding-right: 5px;\n  padding-left: 0; }\n\n.platform-windowsphone .range input {\n  height: auto; }\n\n/**\n * Select\n * --------------------------------------------------\n */\n.item-select {\n  position: relative; }\n  .item-select select {\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    position: absolute;\n    top: 0;\n    bottom: 0;\n    right: 0;\n    padding: 0 48px 0 16px;\n    max-width: 65%;\n    border: none;\n    background: #fff;\n    color: #333;\n    text-indent: .01px;\n    text-overflow: '';\n    white-space: nowrap;\n    font-size: 14px;\n    cursor: pointer;\n    direction: rtl; }\n  .item-select select::-ms-expand {\n    display: none; }\n  .item-select option {\n    direction: ltr; }\n  .item-select:after {\n    position: absolute;\n    top: 50%;\n    right: 16px;\n    margin-top: -3px;\n    width: 0;\n    height: 0;\n    border-top: 5px solid;\n    border-right: 5px solid transparent;\n    border-left: 5px solid transparent;\n    color: #999;\n    content: \"\";\n    pointer-events: none; }\n  .item-select.item-light select {\n    background: #fff;\n    color: #444; }\n  .item-select.item-stable select {\n    background: #f8f8f8;\n    color: #444; }\n  .item-select.item-stable:after, .item-select.item-stable .input-label {\n    color: #666666; }\n  .item-select.item-positive select {\n    background: #387ef5;\n    color: #fff; }\n  .item-select.item-positive:after, .item-select.item-positive .input-label {\n    color: #fff; }\n  .item-select.item-calm select {\n    background: #11c1f3;\n    color: #fff; }\n  .item-select.item-calm:after, .item-select.item-calm .input-label {\n    color: #fff; }\n  .item-select.item-assertive select {\n    background: #ef473a;\n    color: #fff; }\n  .item-select.item-assertive:after, .item-select.item-assertive .input-label {\n    color: #fff; }\n  .item-select.item-balanced select {\n    background: #33cd5f;\n    color: #fff; }\n  .item-select.item-balanced:after, .item-select.item-balanced .input-label {\n    color: #fff; }\n  .item-select.item-energized select {\n    background: #ffc900;\n    color: #fff; }\n  .item-select.item-energized:after, .item-select.item-energized .input-label {\n    color: #fff; }\n  .item-select.item-royal select {\n    background: #886aea;\n    color: #fff; }\n  .item-select.item-royal:after, .item-select.item-royal .input-label {\n    color: #fff; }\n  .item-select.item-dark select {\n    background: #444;\n    color: #fff; }\n  .item-select.item-dark:after, .item-select.item-dark .input-label {\n    color: #fff; }\n\nselect[multiple], select[size] {\n  height: auto; }\n\n/**\n * Progress\n * --------------------------------------------------\n */\nprogress {\n  display: block;\n  margin: 15px auto;\n  width: 100%; }\n\n/**\n * Buttons\n * --------------------------------------------------\n */\n.button {\n  border-color: transparent;\n  background-color: #f8f8f8;\n  color: #444;\n  position: relative;\n  display: inline-block;\n  margin: 0;\n  padding: 0 12px;\n  min-width: 52px;\n  min-height: 47px;\n  border-width: 1px;\n  border-style: solid;\n  border-radius: 4px;\n  vertical-align: top;\n  text-align: center;\n  text-overflow: ellipsis;\n  font-size: 16px;\n  line-height: 42px;\n  cursor: pointer; }\n  .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .button.active, .button.activated {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n  .button:after {\n    position: absolute;\n    top: -6px;\n    right: -6px;\n    bottom: -6px;\n    left: -6px;\n    content: ' '; }\n  .button .icon {\n    vertical-align: top;\n    pointer-events: none; }\n  .button .icon:before, .button.icon:before, .button.icon-left:before, .button.icon-right:before {\n    display: inline-block;\n    padding: 0 0 1px 0;\n    vertical-align: inherit;\n    font-size: 24px;\n    line-height: 41px;\n    pointer-events: none; }\n  .button.icon-left:before {\n    float: left;\n    padding-right: .2em;\n    padding-left: 0; }\n  .button.icon-right:before {\n    float: right;\n    padding-right: 0;\n    padding-left: .2em; }\n  .button.button-block, .button.button-full {\n    margin-top: 10px;\n    margin-bottom: 10px; }\n  .button.button-light {\n    border-color: transparent;\n    background-color: #fff;\n    color: #444; }\n    .button.button-light:hover {\n      color: #444;\n      text-decoration: none; }\n    .button.button-light.active, .button.button-light.activated {\n      border-color: #a2a2a2;\n      background-color: #fafafa; }\n    .button.button-light.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ddd; }\n    .button.button-light.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-light.button-outline {\n      border-color: #ddd;\n      background: transparent;\n      color: #ddd; }\n      .button.button-light.button-outline.active, .button.button-light.button-outline.activated {\n        background-color: #ddd;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-stable {\n    border-color: transparent;\n    background-color: #f8f8f8;\n    color: #444; }\n    .button.button-stable:hover {\n      color: #444;\n      text-decoration: none; }\n    .button.button-stable.active, .button.button-stable.activated {\n      border-color: #a2a2a2;\n      background-color: #e5e5e5; }\n    .button.button-stable.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #b2b2b2; }\n    .button.button-stable.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-stable.button-outline {\n      border-color: #b2b2b2;\n      background: transparent;\n      color: #b2b2b2; }\n      .button.button-stable.button-outline.active, .button.button-stable.button-outline.activated {\n        background-color: #b2b2b2;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-positive {\n    border-color: transparent;\n    background-color: #387ef5;\n    color: #fff; }\n    .button.button-positive:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-positive.active, .button.button-positive.activated {\n      border-color: #a2a2a2;\n      background-color: #0c60ee; }\n    .button.button-positive.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #387ef5; }\n    .button.button-positive.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-positive.button-outline {\n      border-color: #387ef5;\n      background: transparent;\n      color: #387ef5; }\n      .button.button-positive.button-outline.active, .button.button-positive.button-outline.activated {\n        background-color: #387ef5;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-calm {\n    border-color: transparent;\n    background-color: #11c1f3;\n    color: #fff; }\n    .button.button-calm:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-calm.active, .button.button-calm.activated {\n      border-color: #a2a2a2;\n      background-color: #0a9dc7; }\n    .button.button-calm.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #11c1f3; }\n    .button.button-calm.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-calm.button-outline {\n      border-color: #11c1f3;\n      background: transparent;\n      color: #11c1f3; }\n      .button.button-calm.button-outline.active, .button.button-calm.button-outline.activated {\n        background-color: #11c1f3;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-assertive {\n    border-color: transparent;\n    background-color: #ef473a;\n    color: #fff; }\n    .button.button-assertive:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-assertive.active, .button.button-assertive.activated {\n      border-color: #a2a2a2;\n      background-color: #e42112; }\n    .button.button-assertive.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ef473a; }\n    .button.button-assertive.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-assertive.button-outline {\n      border-color: #ef473a;\n      background: transparent;\n      color: #ef473a; }\n      .button.button-assertive.button-outline.active, .button.button-assertive.button-outline.activated {\n        background-color: #ef473a;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-balanced {\n    border-color: transparent;\n    background-color: #33cd5f;\n    color: #fff; }\n    .button.button-balanced:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-balanced.active, .button.button-balanced.activated {\n      border-color: #a2a2a2;\n      background-color: #28a54c; }\n    .button.button-balanced.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #33cd5f; }\n    .button.button-balanced.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-balanced.button-outline {\n      border-color: #33cd5f;\n      background: transparent;\n      color: #33cd5f; }\n      .button.button-balanced.button-outline.active, .button.button-balanced.button-outline.activated {\n        background-color: #33cd5f;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-energized {\n    border-color: transparent;\n    background-color: #ffc900;\n    color: #fff; }\n    .button.button-energized:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-energized.active, .button.button-energized.activated {\n      border-color: #a2a2a2;\n      background-color: #e6b500; }\n    .button.button-energized.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ffc900; }\n    .button.button-energized.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-energized.button-outline {\n      border-color: #ffc900;\n      background: transparent;\n      color: #ffc900; }\n      .button.button-energized.button-outline.active, .button.button-energized.button-outline.activated {\n        background-color: #ffc900;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-royal {\n    border-color: transparent;\n    background-color: #886aea;\n    color: #fff; }\n    .button.button-royal:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-royal.active, .button.button-royal.activated {\n      border-color: #a2a2a2;\n      background-color: #6b46e5; }\n    .button.button-royal.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #886aea; }\n    .button.button-royal.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-royal.button-outline {\n      border-color: #886aea;\n      background: transparent;\n      color: #886aea; }\n      .button.button-royal.button-outline.active, .button.button-royal.button-outline.activated {\n        background-color: #886aea;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-dark {\n    border-color: transparent;\n    background-color: #444;\n    color: #fff; }\n    .button.button-dark:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-dark.active, .button.button-dark.activated {\n      border-color: #a2a2a2;\n      background-color: #262626; }\n    .button.button-dark.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #444; }\n    .button.button-dark.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-dark.button-outline {\n      border-color: #444;\n      background: transparent;\n      color: #444; }\n      .button.button-dark.button-outline.active, .button.button-dark.button-outline.activated {\n        background-color: #444;\n        box-shadow: none;\n        color: #fff; }\n\n.button-small {\n  padding: 2px 4px 1px;\n  min-width: 28px;\n  min-height: 30px;\n  font-size: 12px;\n  line-height: 26px; }\n  .button-small .icon:before, .button-small.icon:before, .button-small.icon-left:before, .button-small.icon-right:before {\n    font-size: 16px;\n    line-height: 19px;\n    margin-top: 3px; }\n\n.button-large {\n  padding: 0 16px;\n  min-width: 68px;\n  min-height: 59px;\n  font-size: 20px;\n  line-height: 53px; }\n  .button-large .icon:before, .button-large.icon:before, .button-large.icon-left:before, .button-large.icon-right:before {\n    padding-bottom: 2px;\n    font-size: 32px;\n    line-height: 51px; }\n\n.button-icon {\n  -webkit-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  padding: 0 6px;\n  min-width: initial;\n  border-color: transparent;\n  background: none; }\n  .button-icon.button.active, .button-icon.button.activated {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    opacity: 0.3; }\n  .button-icon .icon:before, .button-icon.icon:before {\n    font-size: 32px; }\n\n.button-clear {\n  -webkit-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  padding: 0 6px;\n  max-height: 42px;\n  border-color: transparent;\n  background: none;\n  box-shadow: none; }\n  .button-clear.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: transparent; }\n  .button-clear.button-icon {\n    border-color: transparent;\n    background: none; }\n  .button-clear.active, .button-clear.activated {\n    opacity: 0.3; }\n\n.button-outline {\n  -webkit-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  background: none;\n  box-shadow: none; }\n  .button-outline.button-outline {\n    border-color: transparent;\n    background: transparent;\n    color: transparent; }\n    .button-outline.button-outline.active, .button-outline.button-outline.activated {\n      background-color: transparent;\n      box-shadow: none;\n      color: #fff; }\n\n.padding > .button.button-block:first-child {\n  margin-top: 0; }\n\n.button-block {\n  display: block;\n  clear: both; }\n  .button-block:after {\n    clear: both; }\n\n.button-full,\n.button-full > .button {\n  display: block;\n  margin-right: 0;\n  margin-left: 0;\n  border-right-width: 0;\n  border-left-width: 0;\n  border-radius: 0; }\n\nbutton.button-block,\nbutton.button-full,\n.button-full > button.button,\ninput.button.button-block {\n  width: 100%; }\n\na.button {\n  text-decoration: none; }\n  a.button .icon:before, a.button.icon:before, a.button.icon-left:before, a.button.icon-right:before {\n    margin-top: 2px; }\n\n.button.disabled,\n.button[disabled] {\n  opacity: .4;\n  cursor: default !important;\n  pointer-events: none; }\n\n/**\n * Button Bar\n * --------------------------------------------------\n */\n.button-bar {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  width: 100%; }\n  .button-bar.button-bar-inline {\n    display: block;\n    width: auto;\n    *zoom: 1; }\n    .button-bar.button-bar-inline:before, .button-bar.button-bar-inline:after {\n      display: table;\n      content: \"\";\n      line-height: 0; }\n    .button-bar.button-bar-inline:after {\n      clear: both; }\n    .button-bar.button-bar-inline > .button {\n      width: auto;\n      display: inline-block;\n      float: left; }\n  .button-bar.bar-light > .button {\n    border-color: #ddd; }\n  .button-bar.bar-stable > .button {\n    border-color: #b2b2b2; }\n  .button-bar.bar-positive > .button {\n    border-color: #0c60ee; }\n  .button-bar.bar-calm > .button {\n    border-color: #0a9dc7; }\n  .button-bar.bar-assertive > .button {\n    border-color: #e42112; }\n  .button-bar.bar-balanced > .button {\n    border-color: #28a54c; }\n  .button-bar.bar-energized > .button {\n    border-color: #e6b500; }\n  .button-bar.bar-royal > .button {\n    border-color: #6b46e5; }\n  .button-bar.bar-dark > .button {\n    border-color: #111; }\n\n.button-bar > .button {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  overflow: hidden;\n  padding: 0 16px;\n  width: 0;\n  border-width: 1px 0px 1px 1px;\n  border-radius: 0;\n  text-align: center;\n  text-overflow: ellipsis;\n  white-space: nowrap; }\n  .button-bar > .button:before,\n  .button-bar > .button .icon:before {\n    line-height: 44px; }\n  .button-bar > .button:first-child {\n    border-radius: 4px 0px 0px 4px; }\n  .button-bar > .button:last-child {\n    border-right-width: 1px;\n    border-radius: 0px 4px 4px 0px; }\n  .button-bar > .button:only-child {\n    border-radius: 4px; }\n\n.button-bar > .button-small:before,\n.button-bar > .button-small .icon:before {\n  line-height: 28px; }\n\n/**\n * Grid\n * --------------------------------------------------\n * Using flexbox for the grid, inspired by Philip Walton:\n * http://philipwalton.github.io/solved-by-flexbox/demos/grids/\n * By default each .col within a .row will evenly take up\n * available width, and the height of each .col with take\n * up the height of the tallest .col in the same .row.\n */\n.row {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  padding: 5px;\n  width: 100%; }\n\n.row-wrap {\n  -webkit-flex-wrap: wrap;\n  -moz-flex-wrap: wrap;\n  -ms-flex-wrap: wrap;\n  flex-wrap: wrap; }\n\n.row-no-padding {\n  padding: 0; }\n  .row-no-padding > .col {\n    padding: 0; }\n\n.row + .row {\n  margin-top: -5px;\n  padding-top: 0; }\n\n.col {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  padding: 5px;\n  width: 100%; }\n\n/* Vertically Align Columns */\n/* .row-* vertically aligns every .col in the .row */\n.row-top {\n  -webkit-box-align: start;\n  -ms-flex-align: start;\n  -webkit-align-items: flex-start;\n  -moz-align-items: flex-start;\n  align-items: flex-start; }\n\n.row-bottom {\n  -webkit-box-align: end;\n  -ms-flex-align: end;\n  -webkit-align-items: flex-end;\n  -moz-align-items: flex-end;\n  align-items: flex-end; }\n\n.row-center {\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center; }\n\n.row-stretch {\n  -webkit-box-align: stretch;\n  -ms-flex-align: stretch;\n  -webkit-align-items: stretch;\n  -moz-align-items: stretch;\n  align-items: stretch; }\n\n.row-baseline {\n  -webkit-box-align: baseline;\n  -ms-flex-align: baseline;\n  -webkit-align-items: baseline;\n  -moz-align-items: baseline;\n  align-items: baseline; }\n\n/* .col-* vertically aligns an individual .col */\n.col-top {\n  -webkit-align-self: flex-start;\n  -moz-align-self: flex-start;\n  -ms-flex-item-align: start;\n  align-self: flex-start; }\n\n.col-bottom {\n  -webkit-align-self: flex-end;\n  -moz-align-self: flex-end;\n  -ms-flex-item-align: end;\n  align-self: flex-end; }\n\n.col-center {\n  -webkit-align-self: center;\n  -moz-align-self: center;\n  -ms-flex-item-align: center;\n  align-self: center; }\n\n/* Column Offsets */\n.col-offset-10 {\n  margin-left: 10%; }\n\n.col-offset-20 {\n  margin-left: 20%; }\n\n.col-offset-25 {\n  margin-left: 25%; }\n\n.col-offset-33, .col-offset-34 {\n  margin-left: 33.3333%; }\n\n.col-offset-50 {\n  margin-left: 50%; }\n\n.col-offset-66, .col-offset-67 {\n  margin-left: 66.6666%; }\n\n.col-offset-75 {\n  margin-left: 75%; }\n\n.col-offset-80 {\n  margin-left: 80%; }\n\n.col-offset-90 {\n  margin-left: 90%; }\n\n/* Explicit Column Percent Sizes */\n/* By default each grid column will evenly distribute */\n/* across the grid. However, you can specify individual */\n/* columns to take up a certain size of the available area */\n.col-10 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 10%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 10%;\n  -ms-flex: 0 0 10%;\n  flex: 0 0 10%;\n  max-width: 10%; }\n\n.col-20 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 20%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 20%;\n  -ms-flex: 0 0 20%;\n  flex: 0 0 20%;\n  max-width: 20%; }\n\n.col-25 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 25%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 25%;\n  -ms-flex: 0 0 25%;\n  flex: 0 0 25%;\n  max-width: 25%; }\n\n.col-33, .col-34 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 33.3333%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 33.3333%;\n  -ms-flex: 0 0 33.3333%;\n  flex: 0 0 33.3333%;\n  max-width: 33.3333%; }\n\n.col-40 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 40%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 40%;\n  -ms-flex: 0 0 40%;\n  flex: 0 0 40%;\n  max-width: 40%; }\n\n.col-50 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 50%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 50%;\n  -ms-flex: 0 0 50%;\n  flex: 0 0 50%;\n  max-width: 50%; }\n\n.col-60 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 60%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 60%;\n  -ms-flex: 0 0 60%;\n  flex: 0 0 60%;\n  max-width: 60%; }\n\n.col-66, .col-67 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 66.6666%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 66.6666%;\n  -ms-flex: 0 0 66.6666%;\n  flex: 0 0 66.6666%;\n  max-width: 66.6666%; }\n\n.col-75 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 75%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 75%;\n  -ms-flex: 0 0 75%;\n  flex: 0 0 75%;\n  max-width: 75%; }\n\n.col-80 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 80%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 80%;\n  -ms-flex: 0 0 80%;\n  flex: 0 0 80%;\n  max-width: 80%; }\n\n.col-90 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 90%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 90%;\n  -ms-flex: 0 0 90%;\n  flex: 0 0 90%;\n  max-width: 90%; }\n\n/* Responsive Grid Classes */\n/* Adding a class of responsive-X to a row */\n/* will trigger the flex-direction to */\n/* change to column and add some margin */\n/* to any columns in the row for clearity */\n@media (max-width: 567px) {\n  .responsive-sm {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-sm .col, .responsive-sm .col-10, .responsive-sm .col-20, .responsive-sm .col-25, .responsive-sm .col-33, .responsive-sm .col-34, .responsive-sm .col-50, .responsive-sm .col-66, .responsive-sm .col-67, .responsive-sm .col-75, .responsive-sm .col-80, .responsive-sm .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n@media (max-width: 767px) {\n  .responsive-md {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-md .col, .responsive-md .col-10, .responsive-md .col-20, .responsive-md .col-25, .responsive-md .col-33, .responsive-md .col-34, .responsive-md .col-50, .responsive-md .col-66, .responsive-md .col-67, .responsive-md .col-75, .responsive-md .col-80, .responsive-md .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n@media (max-width: 1023px) {\n  .responsive-lg {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-lg .col, .responsive-lg .col-10, .responsive-lg .col-20, .responsive-lg .col-25, .responsive-lg .col-33, .responsive-lg .col-34, .responsive-lg .col-50, .responsive-lg .col-66, .responsive-lg .col-67, .responsive-lg .col-75, .responsive-lg .col-80, .responsive-lg .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n/**\n * Utility Classes\n * --------------------------------------------------\n */\n.hide {\n  display: none; }\n\n.opacity-hide {\n  opacity: 0; }\n\n.grade-b .opacity-hide,\n.grade-c .opacity-hide {\n  opacity: 1;\n  display: none; }\n\n.show {\n  display: block; }\n\n.opacity-show {\n  opacity: 1; }\n\n.invisible {\n  visibility: hidden; }\n\n.keyboard-open .hide-on-keyboard-open {\n  display: none; }\n\n.keyboard-open .tabs.hide-on-keyboard-open + .pane .has-tabs,\n.keyboard-open .bar-footer.hide-on-keyboard-open + .pane .has-footer {\n  bottom: 0; }\n\n.inline {\n  display: inline-block; }\n\n.disable-pointer-events {\n  pointer-events: none; }\n\n.enable-pointer-events {\n  pointer-events: auto; }\n\n.disable-user-behavior {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  -webkit-touch-callout: none;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-user-drag: none;\n  -ms-touch-action: none;\n  -ms-content-zooming: none; }\n\n.click-block {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  opacity: 0;\n  z-index: 99999;\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  overflow: hidden; }\n\n.click-block-hide {\n  -webkit-transform: translate3d(-9999px, 0, 0);\n  transform: translate3d(-9999px, 0, 0); }\n\n.no-resize {\n  resize: none; }\n\n.block {\n  display: block;\n  clear: both; }\n  .block:after {\n    display: block;\n    visibility: hidden;\n    clear: both;\n    height: 0;\n    content: \".\"; }\n\n.full-image {\n  width: 100%; }\n\n.clearfix {\n  *zoom: 1; }\n  .clearfix:before, .clearfix:after {\n    display: table;\n    content: \"\";\n    line-height: 0; }\n  .clearfix:after {\n    clear: both; }\n\n/**\n * Content Padding\n * --------------------------------------------------\n */\n.padding {\n  padding: 10px; }\n\n.padding-top,\n.padding-vertical {\n  padding-top: 10px; }\n\n.padding-right,\n.padding-horizontal {\n  padding-right: 10px; }\n\n.padding-bottom,\n.padding-vertical {\n  padding-bottom: 10px; }\n\n.padding-left,\n.padding-horizontal {\n  padding-left: 10px; }\n\n/**\n * Scrollable iFrames\n * --------------------------------------------------\n */\n.iframe-wrapper {\n  position: fixed;\n  -webkit-overflow-scrolling: touch;\n  overflow: scroll; }\n  .iframe-wrapper iframe {\n    height: 100%;\n    width: 100%; }\n\n/**\n * Rounded\n * --------------------------------------------------\n */\n.rounded {\n  border-radius: 4px; }\n\n/**\n * Utility Colors\n * --------------------------------------------------\n * Utility colors are added to help set a naming convention. You'll\n * notice we purposely do not use words like \"red\" or \"blue\", but\n * instead have colors which represent an emotion or generic theme.\n */\n.light, a.light {\n  color: #fff; }\n\n.light-bg {\n  background-color: #fff; }\n\n.light-border {\n  border-color: #ddd; }\n\n.stable, a.stable {\n  color: #f8f8f8; }\n\n.stable-bg {\n  background-color: #f8f8f8; }\n\n.stable-border {\n  border-color: #b2b2b2; }\n\n.positive, a.positive {\n  color: #387ef5; }\n\n.positive-bg {\n  background-color: #387ef5; }\n\n.positive-border {\n  border-color: #0c60ee; }\n\n.calm, a.calm {\n  color: #11c1f3; }\n\n.calm-bg {\n  background-color: #11c1f3; }\n\n.calm-border {\n  border-color: #0a9dc7; }\n\n.assertive, a.assertive {\n  color: #ef473a; }\n\n.assertive-bg {\n  background-color: #ef473a; }\n\n.assertive-border {\n  border-color: #e42112; }\n\n.balanced, a.balanced {\n  color: #33cd5f; }\n\n.balanced-bg {\n  background-color: #33cd5f; }\n\n.balanced-border {\n  border-color: #28a54c; }\n\n.energized, a.energized {\n  color: #ffc900; }\n\n.energized-bg {\n  background-color: #ffc900; }\n\n.energized-border {\n  border-color: #e6b500; }\n\n.royal, a.royal {\n  color: #886aea; }\n\n.royal-bg {\n  background-color: #886aea; }\n\n.royal-border {\n  border-color: #6b46e5; }\n\n.dark, a.dark {\n  color: #444; }\n\n.dark-bg {\n  background-color: #444; }\n\n.dark-border {\n  border-color: #111; }\n\n[collection-repeat] {\n  /* Position is set by transforms */\n  left: 0 !important;\n  top: 0 !important;\n  position: absolute !important;\n  z-index: 1; }\n\n.collection-repeat-container {\n  position: relative;\n  z-index: 1; }\n\n.collection-repeat-after-container {\n  z-index: 0;\n  display: block;\n  /* when scrolling horizontally, make sure the after container doesn't take up 100% width */ }\n  .collection-repeat-after-container.horizontal {\n    display: inline-block; }\n\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak,\n.x-ng-cloak, .ng-hide:not(.ng-hide-animate) {\n  display: none !important; }\n\n/**\n * Platform\n * --------------------------------------------------\n * Platform specific tweaks\n */\n.platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader) {\n  height: 64px; }\n  .platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader).item-input-inset .item-input-wrapper {\n    margin-top: 19px !important; }\n  .platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader) > * {\n    margin-top: 20px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .tabs-top > .tabs,\n.platform-ios.platform-cordova:not(.fullscreen) .tabs.tabs-top {\n  top: 64px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-header,\n.platform-ios.platform-cordova:not(.fullscreen) .bar-subheader {\n  top: 64px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-subheader {\n  top: 108px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-header.has-tabs-top {\n  top: 113px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-header.has-subheader.has-tabs-top {\n  top: 157px; }\n\n.platform-ios.platform-cordova .popover .bar-header:not(.bar-subheader) {\n  height: 44px; }\n  .platform-ios.platform-cordova .popover .bar-header:not(.bar-subheader).item-input-inset .item-input-wrapper {\n    margin-top: -1px; }\n  .platform-ios.platform-cordova .popover .bar-header:not(.bar-subheader) > * {\n    margin-top: 0; }\n\n.platform-ios.platform-cordova .popover .has-header,\n.platform-ios.platform-cordova .popover .bar-subheader {\n  top: 44px; }\n\n.platform-ios.platform-cordova .popover .has-subheader {\n  top: 88px; }\n\n.platform-ios.platform-cordova.status-bar-hide {\n  margin-bottom: 20px; }\n\n@media (orientation: landscape) {\n  .platform-ios.platform-browser.platform-ipad {\n    position: fixed; } }\n\n.platform-c:not(.enable-transitions) * {\n  -webkit-transition: none !important;\n  transition: none !important; }\n\n.slide-in-up {\n  -webkit-transform: translate3d(0, 100%, 0);\n  transform: translate3d(0, 100%, 0); }\n\n.slide-in-up.ng-enter,\n.slide-in-up > .ng-enter {\n  -webkit-transition: all cubic-bezier(0.1, 0.7, 0.1, 1) 400ms;\n  transition: all cubic-bezier(0.1, 0.7, 0.1, 1) 400ms; }\n\n.slide-in-up.ng-enter-active,\n.slide-in-up > .ng-enter-active {\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n\n.slide-in-up.ng-leave,\n.slide-in-up > .ng-leave {\n  -webkit-transition: all ease-in-out 250ms;\n  transition: all ease-in-out 250ms; }\n\n@-webkit-keyframes scaleOut {\n  from {\n    -webkit-transform: scale(1);\n    opacity: 1; }\n  to {\n    -webkit-transform: scale(0.8);\n    opacity: 0; } }\n\n@keyframes scaleOut {\n  from {\n    transform: scale(1);\n    opacity: 1; }\n  to {\n    transform: scale(0.8);\n    opacity: 0; } }\n\n@-webkit-keyframes superScaleIn {\n  from {\n    -webkit-transform: scale(1.2);\n    opacity: 0; }\n  to {\n    -webkit-transform: scale(1);\n    opacity: 1; } }\n\n@keyframes superScaleIn {\n  from {\n    transform: scale(1.2);\n    opacity: 0; }\n  to {\n    transform: scale(1);\n    opacity: 1; } }\n\n[nav-view-transition=\"ios\"] [nav-view=\"entering\"],\n[nav-view-transition=\"ios\"] [nav-view=\"leaving\"] {\n  -webkit-transition-duration: 500ms;\n  transition-duration: 500ms;\n  -webkit-transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  -webkit-transition-property: opacity, -webkit-transform, box-shadow;\n  transition-property: opacity, transform, box-shadow; }\n\n[nav-view-transition=\"ios\"][nav-view-direction=\"forward\"], [nav-view-transition=\"ios\"][nav-view-direction=\"back\"] {\n  background-color: #000; }\n\n[nav-view-transition=\"ios\"] [nav-view=\"active\"],\n[nav-view-transition=\"ios\"][nav-view-direction=\"forward\"] [nav-view=\"entering\"],\n[nav-view-transition=\"ios\"][nav-view-direction=\"back\"] [nav-view=\"leaving\"] {\n  z-index: 3; }\n\n[nav-view-transition=\"ios\"][nav-view-direction=\"back\"] [nav-view=\"entering\"],\n[nav-view-transition=\"ios\"][nav-view-direction=\"forward\"] [nav-view=\"leaving\"] {\n  z-index: 2; }\n\n[nav-bar-transition=\"ios\"] .title,\n[nav-bar-transition=\"ios\"] .buttons,\n[nav-bar-transition=\"ios\"] .back-text {\n  -webkit-transition-duration: 500ms;\n  transition-duration: 500ms;\n  -webkit-transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  -webkit-transition-property: opacity, -webkit-transform;\n  transition-property: opacity, transform; }\n\n[nav-bar-transition=\"ios\"] [nav-bar=\"active\"],\n[nav-bar-transition=\"ios\"] [nav-bar=\"entering\"] {\n  z-index: 10; }\n  [nav-bar-transition=\"ios\"] [nav-bar=\"active\"] .bar,\n  [nav-bar-transition=\"ios\"] [nav-bar=\"entering\"] .bar {\n    background: transparent; }\n\n[nav-bar-transition=\"ios\"] [nav-bar=\"cached\"] {\n  display: block; }\n  [nav-bar-transition=\"ios\"] [nav-bar=\"cached\"] .header-item {\n    display: none; }\n\n[nav-view-transition=\"android\"] [nav-view=\"entering\"],\n[nav-view-transition=\"android\"] [nav-view=\"leaving\"] {\n  -webkit-transition-duration: 200ms;\n  transition-duration: 200ms;\n  -webkit-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -webkit-transition-property: -webkit-transform;\n  transition-property: transform; }\n\n[nav-view-transition=\"android\"] [nav-view=\"active\"],\n[nav-view-transition=\"android\"][nav-view-direction=\"forward\"] [nav-view=\"entering\"],\n[nav-view-transition=\"android\"][nav-view-direction=\"back\"] [nav-view=\"leaving\"] {\n  z-index: 3; }\n\n[nav-view-transition=\"android\"][nav-view-direction=\"back\"] [nav-view=\"entering\"],\n[nav-view-transition=\"android\"][nav-view-direction=\"forward\"] [nav-view=\"leaving\"] {\n  z-index: 2; }\n\n[nav-bar-transition=\"android\"] .title,\n[nav-bar-transition=\"android\"] .buttons {\n  -webkit-transition-duration: 200ms;\n  transition-duration: 200ms;\n  -webkit-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -webkit-transition-property: opacity;\n  transition-property: opacity; }\n\n[nav-bar-transition=\"android\"] [nav-bar=\"active\"],\n[nav-bar-transition=\"android\"] [nav-bar=\"entering\"] {\n  z-index: 10; }\n  [nav-bar-transition=\"android\"] [nav-bar=\"active\"] .bar,\n  [nav-bar-transition=\"android\"] [nav-bar=\"entering\"] .bar {\n    background: transparent; }\n\n[nav-bar-transition=\"android\"] [nav-bar=\"cached\"] {\n  display: block; }\n  [nav-bar-transition=\"android\"] [nav-bar=\"cached\"] .header-item {\n    display: none; }\n\n[nav-swipe=\"fast\"] [nav-view],\n[nav-swipe=\"fast\"] .title,\n[nav-swipe=\"fast\"] .buttons,\n[nav-swipe=\"fast\"] .back-text {\n  -webkit-transition-duration: 50ms;\n  transition-duration: 50ms;\n  -webkit-transition-timing-function: linear;\n  transition-timing-function: linear; }\n\n[nav-swipe=\"slow\"] [nav-view],\n[nav-swipe=\"slow\"] .title,\n[nav-swipe=\"slow\"] .buttons,\n[nav-swipe=\"slow\"] .back-text {\n  -webkit-transition-duration: 160ms;\n  transition-duration: 160ms;\n  -webkit-transition-timing-function: linear;\n  transition-timing-function: linear; }\n\n[nav-view=\"cached\"],\n[nav-bar=\"cached\"] {\n  display: none; }\n\n[nav-view=\"stage\"] {\n  opacity: 0;\n  -webkit-transition-duration: 0;\n  transition-duration: 0; }\n\n[nav-bar=\"stage\"] .title,\n[nav-bar=\"stage\"] .buttons,\n[nav-bar=\"stage\"] .back-text {\n  position: absolute;\n  opacity: 0;\n  -webkit-transition-duration: 0s;\n  transition-duration: 0s; }\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/css/style.css",
    "content": "/* Empty. Add your own CSS if you like */\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <meta name=\"viewport\" content=\"initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width\">\n    <title></title>\n\n    <link href=\"lib/ionic/css/ionic.css\" rel=\"stylesheet\">\n    <link href=\"css/style.css\" rel=\"stylesheet\">\n\n    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above\n    <link href=\"css/ionic.app.css\" rel=\"stylesheet\">\n    -->\n\n    <!-- ionic/angularjs js -->\n    <script src=\"lib/ionic/js/ionic.bundle.js\"></script>\n\n    <!-- cordova script (this will be a 404 during development) -->\n    <script src=\"cordova.js\"></script>\n\n    <!-- your app's js -->\n    <script src=\"js/app.js\"></script>\n    <script src=\"lib/babel-polyfill/browser-polyfill.js\"></script>\n  </head>\n  <body ng-app=\"dailyReads\">\n    <ion-nav-bar class=\"bar-positive\">\n    </ion-nav-bar>\n    <ion-nav-view></ion-nav-view>\n  </body>\n</html>\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular/.bower.json",
    "content": "{\n  \"name\": \"angular\",\n  \"version\": \"1.5.3\",\n  \"license\": \"MIT\",\n  \"main\": \"./angular.js\",\n  \"ignore\": [],\n  \"dependencies\": {},\n  \"homepage\": \"https://github.com/angular/bower-angular\",\n  \"_release\": \"1.5.3\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.5.3\",\n    \"commit\": \"5a07c5107b4d24f41744a02b07717d55bad88e70\"\n  },\n  \"_source\": \"https://github.com/angular/bower-angular.git\",\n  \"_target\": \"1.5.3\",\n  \"_originalSource\": \"angular\"\n}"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular/README.md",
    "content": "# packaged angular\n\nThis repo is for distribution on `npm` and `bower`. The source for this module is in the\n[main AngularJS repo](https://github.com/angular/angular.js).\nPlease file issues and pull requests against that repo.\n\n## Install\n\nYou can install this package either with `npm` or with `bower`.\n\n### npm\n\n```shell\nnpm install angular\n```\n\nThen add a `<script>` to your `index.html`:\n\n```html\n<script src=\"/node_modules/angular/angular.js\"></script>\n```\n\nOr `require('angular')` from your code.\n\n### bower\n\n```shell\nbower install angular\n```\n\nThen add a `<script>` to your `index.html`:\n\n```html\n<script src=\"/bower_components/angular/angular.js\"></script>\n```\n\n## Documentation\n\nDocumentation is available on the\n[AngularJS docs site](http://docs.angularjs.org/).\n\n## License\n\nThe MIT License\n\nCopyright (c) 2010-2015 Google, Inc. http://angularjs.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular/angular-csp.css",
    "content": "/* Include this file in your html if you are using the CSP mode. */\n\n@charset \"UTF-8\";\n\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],\n.ng-cloak, .x-ng-cloak,\n.ng-hide:not(.ng-hide-animate) {\n  display: none !important;\n}\n\nng\\:form {\n  display: block;\n}\n\n.ng-animate-shim {\n  visibility:hidden;\n}\n\n.ng-anchor {\n  position:absolute;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular/angular.js",
    "content": "/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, document, undefined) {'use strict';\n\n/**\n * @description\n *\n * This object provides a utility for producing rich Error messages within\n * Angular. It can be called as follows:\n *\n * var exampleMinErr = minErr('example');\n * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);\n *\n * The above creates an instance of minErr in the example namespace. The\n * resulting error will have a namespaced error code of example.one.  The\n * resulting error will replace {0} with the value of foo, and {1} with the\n * value of bar. The object is not restricted in the number of arguments it can\n * take.\n *\n * If fewer arguments are specified than necessary for interpolation, the extra\n * interpolation markers will be preserved in the final string.\n *\n * Since data will be parsed statically during a build step, some restrictions\n * are applied with respect to how minErr instances are created and called.\n * Instances should have names of the form namespaceMinErr for a minErr created\n * using minErr('namespace') . Error codes, namespaces and template strings\n * should all be static strings, not variables or general expressions.\n *\n * @param {string} module The namespace to use for the new minErr instance.\n * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning\n *   error from returned function, for cases when a particular type of error is useful.\n * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance\n */\n\nfunction minErr(module, ErrorConstructor) {\n  ErrorConstructor = ErrorConstructor || Error;\n  return function() {\n    var SKIP_INDEXES = 2;\n\n    var templateArgs = arguments,\n      code = templateArgs[0],\n      message = '[' + (module ? module + ':' : '') + code + '] ',\n      template = templateArgs[1],\n      paramPrefix, i;\n\n    message += template.replace(/\\{\\d+\\}/g, function(match) {\n      var index = +match.slice(1, -1),\n        shiftedIndex = index + SKIP_INDEXES;\n\n      if (shiftedIndex < templateArgs.length) {\n        return toDebugString(templateArgs[shiftedIndex]);\n      }\n\n      return match;\n    });\n\n    message += '\\nhttp://errors.angularjs.org/1.5.3/' +\n      (module ? module + '/' : '') + code;\n\n    for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {\n      message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +\n        encodeURIComponent(toDebugString(templateArgs[i]));\n    }\n\n    return new ErrorConstructor(message);\n  };\n}\n\n/* We need to tell jshint what variables are being exported */\n/* global angular: true,\n  msie: true,\n  jqLite: true,\n  jQuery: true,\n  slice: true,\n  splice: true,\n  push: true,\n  toString: true,\n  ngMinErr: true,\n  angularModule: true,\n  uid: true,\n  REGEX_STRING_REGEXP: true,\n  VALIDITY_STATE_PROPERTY: true,\n\n  lowercase: true,\n  uppercase: true,\n  manualLowercase: true,\n  manualUppercase: true,\n  nodeName_: true,\n  isArrayLike: true,\n  forEach: true,\n  forEachSorted: true,\n  reverseParams: true,\n  nextUid: true,\n  setHashKey: true,\n  extend: true,\n  toInt: true,\n  inherit: true,\n  merge: true,\n  noop: true,\n  identity: true,\n  valueFn: true,\n  isUndefined: true,\n  isDefined: true,\n  isObject: true,\n  isBlankObject: true,\n  isString: true,\n  isNumber: true,\n  isDate: true,\n  isArray: true,\n  isFunction: true,\n  isRegExp: true,\n  isWindow: true,\n  isScope: true,\n  isFile: true,\n  isFormData: true,\n  isBlob: true,\n  isBoolean: true,\n  isPromiseLike: true,\n  trim: true,\n  escapeForRegexp: true,\n  isElement: true,\n  makeMap: true,\n  includes: true,\n  arrayRemove: true,\n  copy: true,\n  shallowCopy: true,\n  equals: true,\n  csp: true,\n  jq: true,\n  concat: true,\n  sliceArgs: true,\n  bind: true,\n  toJsonReplacer: true,\n  toJson: true,\n  fromJson: true,\n  convertTimezoneToLocal: true,\n  timezoneToOffset: true,\n  startingTag: true,\n  tryDecodeURIComponent: true,\n  parseKeyValue: true,\n  toKeyValue: true,\n  encodeUriSegment: true,\n  encodeUriQuery: true,\n  angularInit: true,\n  bootstrap: true,\n  getTestability: true,\n  snake_case: true,\n  bindJQuery: true,\n  assertArg: true,\n  assertArgFn: true,\n  assertNotHasOwnProperty: true,\n  getter: true,\n  getBlockNodes: true,\n  hasOwnProperty: true,\n  createMap: true,\n\n  NODE_TYPE_ELEMENT: true,\n  NODE_TYPE_ATTRIBUTE: true,\n  NODE_TYPE_TEXT: true,\n  NODE_TYPE_COMMENT: true,\n  NODE_TYPE_DOCUMENT: true,\n  NODE_TYPE_DOCUMENT_FRAGMENT: true,\n*/\n\n////////////////////////////////////\n\n/**\n * @ngdoc module\n * @name ng\n * @module ng\n * @description\n *\n * # ng (core module)\n * The ng module is loaded by default when an AngularJS application is started. The module itself\n * contains the essential components for an AngularJS application to function. The table below\n * lists a high level breakdown of each of the services/factories, filters, directives and testing\n * components available within this core module.\n *\n * <div doc-module-components=\"ng\"></div>\n */\n\nvar REGEX_STRING_REGEXP = /^\\/(.+)\\/([a-z]*)$/;\n\n// The name of a form control's ValidityState property.\n// This is used so that it's possible for internal tests to create mock ValidityStates.\nvar VALIDITY_STATE_PROPERTY = 'validity';\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};\nvar uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};\n\n\nvar manualLowercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})\n      : s;\n};\nvar manualUppercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})\n      : s;\n};\n\n\n// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish\n// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods\n// with correct but slower alternatives. See https://github.com/angular/angular.js/issues/11387\nif ('i' !== 'I'.toLowerCase()) {\n  lowercase = manualLowercase;\n  uppercase = manualUppercase;\n}\n\n\nvar\n    msie,             // holds major version number for IE, or NaN if UA is not IE.\n    jqLite,           // delay binding since jQuery could be loaded after us.\n    jQuery,           // delay binding\n    slice             = [].slice,\n    splice            = [].splice,\n    push              = [].push,\n    toString          = Object.prototype.toString,\n    getPrototypeOf    = Object.getPrototypeOf,\n    ngMinErr          = minErr('ng'),\n\n    /** @name angular */\n    angular           = window.angular || (window.angular = {}),\n    angularModule,\n    uid               = 0;\n\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nmsie = document.documentMode;\n\n\n/**\n * @private\n * @param {*} obj\n * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,\n *                   String ...)\n */\nfunction isArrayLike(obj) {\n\n  // `null`, `undefined` and `window` are not array-like\n  if (obj == null || isWindow(obj)) return false;\n\n  // arrays, strings and jQuery/jqLite objects are array like\n  // * jqLite is either the jQuery or jqLite constructor function\n  // * we have to check the existence of jqLite first as this method is called\n  //   via the forEach method when constructing the jqLite object in the first place\n  if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;\n\n  // Support: iOS 8.2 (not reproducible in simulator)\n  // \"length\" in obj used to prevent JIT error (gh-11508)\n  var length = \"length\" in Object(obj) && obj.length;\n\n  // NodeList objects (with `item` method) and\n  // other objects with suitable length characteristics are array-like\n  return isNumber(length) &&\n    (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');\n\n}\n\n/**\n * @ngdoc function\n * @name angular.forEach\n * @module ng\n * @kind function\n *\n * @description\n * Invokes the `iterator` function once for each item in `obj` collection, which can be either an\n * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`\n * is the value of an object property or an array element, `key` is the object property key or\n * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.\n *\n * It is worth noting that `.forEach` does not iterate over inherited properties because it filters\n * using the `hasOwnProperty` method.\n *\n * Unlike ES262's\n * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),\n * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just\n * return the value provided.\n *\n   ```js\n     var values = {name: 'misko', gender: 'male'};\n     var log = [];\n     angular.forEach(values, function(value, key) {\n       this.push(key + ': ' + value);\n     }, log);\n     expect(log).toEqual(['name: misko', 'gender: male']);\n   ```\n *\n * @param {Object|Array} obj Object to iterate over.\n * @param {Function} iterator Iterator function.\n * @param {Object=} context Object to become context (`this`) for the iterator function.\n * @returns {Object|Array} Reference to `obj`.\n */\n\nfunction forEach(obj, iterator, context) {\n  var key, length;\n  if (obj) {\n    if (isFunction(obj)) {\n      for (key in obj) {\n        // Need to check if hasOwnProperty exists,\n        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else if (isArray(obj) || isArrayLike(obj)) {\n      var isPrimitive = typeof obj !== 'object';\n      for (key = 0, length = obj.length; key < length; key++) {\n        if (isPrimitive || key in obj) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else if (obj.forEach && obj.forEach !== forEach) {\n        obj.forEach(iterator, context, obj);\n    } else if (isBlankObject(obj)) {\n      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n      for (key in obj) {\n        iterator.call(context, obj[key], key, obj);\n      }\n    } else if (typeof obj.hasOwnProperty === 'function') {\n      // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed\n      for (key in obj) {\n        if (obj.hasOwnProperty(key)) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else {\n      // Slow path for objects which do not have a method `hasOwnProperty`\n      for (key in obj) {\n        if (hasOwnProperty.call(obj, key)) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    }\n  }\n  return obj;\n}\n\nfunction forEachSorted(obj, iterator, context) {\n  var keys = Object.keys(obj).sort();\n  for (var i = 0; i < keys.length; i++) {\n    iterator.call(context, obj[keys[i]], keys[i]);\n  }\n  return keys;\n}\n\n\n/**\n * when using forEach the params are value, key, but it is often useful to have key, value.\n * @param {function(string, *)} iteratorFn\n * @returns {function(*, string)}\n */\nfunction reverseParams(iteratorFn) {\n  return function(value, key) {iteratorFn(key, value);};\n}\n\n/**\n * A consistent way of creating unique IDs in angular.\n *\n * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before\n * we hit number precision issues in JavaScript.\n *\n * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M\n *\n * @returns {number} an unique alpha-numeric string\n */\nfunction nextUid() {\n  return ++uid;\n}\n\n\n/**\n * Set or clear the hashkey for an object.\n * @param obj object\n * @param h the hashkey (!truthy to delete the hashkey)\n */\nfunction setHashKey(obj, h) {\n  if (h) {\n    obj.$$hashKey = h;\n  } else {\n    delete obj.$$hashKey;\n  }\n}\n\n\nfunction baseExtend(dst, objs, deep) {\n  var h = dst.$$hashKey;\n\n  for (var i = 0, ii = objs.length; i < ii; ++i) {\n    var obj = objs[i];\n    if (!isObject(obj) && !isFunction(obj)) continue;\n    var keys = Object.keys(obj);\n    for (var j = 0, jj = keys.length; j < jj; j++) {\n      var key = keys[j];\n      var src = obj[key];\n\n      if (deep && isObject(src)) {\n        if (isDate(src)) {\n          dst[key] = new Date(src.valueOf());\n        } else if (isRegExp(src)) {\n          dst[key] = new RegExp(src);\n        } else if (src.nodeName) {\n          dst[key] = src.cloneNode(true);\n        } else if (isElement(src)) {\n          dst[key] = src.clone();\n        } else {\n          if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};\n          baseExtend(dst[key], [src], true);\n        }\n      } else {\n        dst[key] = src;\n      }\n    }\n  }\n\n  setHashKey(dst, h);\n  return dst;\n}\n\n/**\n * @ngdoc function\n * @name angular.extend\n * @module ng\n * @kind function\n *\n * @description\n * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.\n *\n * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use\n * {@link angular.merge} for this.\n *\n * @param {Object} dst Destination object.\n * @param {...Object} src Source object(s).\n * @returns {Object} Reference to `dst`.\n */\nfunction extend(dst) {\n  return baseExtend(dst, slice.call(arguments, 1), false);\n}\n\n\n/**\n* @ngdoc function\n* @name angular.merge\n* @module ng\n* @kind function\n*\n* @description\n* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.\n*\n* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source\n* objects, performing a deep copy.\n*\n* @param {Object} dst Destination object.\n* @param {...Object} src Source object(s).\n* @returns {Object} Reference to `dst`.\n*/\nfunction merge(dst) {\n  return baseExtend(dst, slice.call(arguments, 1), true);\n}\n\n\n\nfunction toInt(str) {\n  return parseInt(str, 10);\n}\n\n\nfunction inherit(parent, extra) {\n  return extend(Object.create(parent), extra);\n}\n\n/**\n * @ngdoc function\n * @name angular.noop\n * @module ng\n * @kind function\n *\n * @description\n * A function that performs no operations. This function can be useful when writing code in the\n * functional style.\n   ```js\n     function foo(callback) {\n       var result = calculateResult();\n       (callback || angular.noop)(result);\n     }\n   ```\n */\nfunction noop() {}\nnoop.$inject = [];\n\n\n/**\n * @ngdoc function\n * @name angular.identity\n * @module ng\n * @kind function\n *\n * @description\n * A function that returns its first argument. This function is useful when writing code in the\n * functional style.\n *\n   ```js\n     function transformer(transformationFn, value) {\n       return (transformationFn || angular.identity)(value);\n     };\n   ```\n  * @param {*} value to be returned.\n  * @returns {*} the value passed in.\n */\nfunction identity($) {return $;}\nidentity.$inject = [];\n\n\nfunction valueFn(value) {return function valueRef() {return value;};}\n\nfunction hasCustomToString(obj) {\n  return isFunction(obj.toString) && obj.toString !== toString;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isUndefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is undefined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is undefined.\n */\nfunction isUndefined(value) {return typeof value === 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is defined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is defined.\n */\nfunction isDefined(value) {return typeof value !== 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isObject\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not\n * considered to be objects. Note that JavaScript arrays are objects.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Object` but not `null`.\n */\nfunction isObject(value) {\n  // http://jsperf.com/isobject4\n  return value !== null && typeof value === 'object';\n}\n\n\n/**\n * Determine if a value is an object with a null prototype\n *\n * @returns {boolean} True if `value` is an `Object` with a null prototype\n */\nfunction isBlankObject(value) {\n  return value !== null && typeof value === 'object' && !getPrototypeOf(value);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isString\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `String`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `String`.\n */\nfunction isString(value) {return typeof value === 'string';}\n\n\n/**\n * @ngdoc function\n * @name angular.isNumber\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Number`.\n *\n * This includes the \"special\" numbers `NaN`, `+Infinity` and `-Infinity`.\n *\n * If you wish to exclude these then you can use the native\n * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)\n * method.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Number`.\n */\nfunction isNumber(value) {return typeof value === 'number';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDate\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a value is a date.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Date`.\n */\nfunction isDate(value) {\n  return toString.call(value) === '[object Date]';\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isArray\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Array`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Array`.\n */\nvar isArray = Array.isArray;\n\n/**\n * @ngdoc function\n * @name angular.isFunction\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Function`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Function`.\n */\nfunction isFunction(value) {return typeof value === 'function';}\n\n\n/**\n * Determines if a value is a regular expression object.\n *\n * @private\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `RegExp`.\n */\nfunction isRegExp(value) {\n  return toString.call(value) === '[object RegExp]';\n}\n\n\n/**\n * Checks if `obj` is a window object.\n *\n * @private\n * @param {*} obj Object to check\n * @returns {boolean} True if `obj` is a window obj.\n */\nfunction isWindow(obj) {\n  return obj && obj.window === obj;\n}\n\n\nfunction isScope(obj) {\n  return obj && obj.$evalAsync && obj.$watch;\n}\n\n\nfunction isFile(obj) {\n  return toString.call(obj) === '[object File]';\n}\n\n\nfunction isFormData(obj) {\n  return toString.call(obj) === '[object FormData]';\n}\n\n\nfunction isBlob(obj) {\n  return toString.call(obj) === '[object Blob]';\n}\n\n\nfunction isBoolean(value) {\n  return typeof value === 'boolean';\n}\n\n\nfunction isPromiseLike(obj) {\n  return obj && isFunction(obj.then);\n}\n\n\nvar TYPED_ARRAY_REGEXP = /^\\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\\]$/;\nfunction isTypedArray(value) {\n  return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));\n}\n\nfunction isArrayBuffer(obj) {\n  return toString.call(obj) === '[object ArrayBuffer]';\n}\n\n\nvar trim = function(value) {\n  return isString(value) ? value.trim() : value;\n};\n\n// Copied from:\n// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021\n// Prereq: s is a string.\nvar escapeForRegexp = function(s) {\n  return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1').\n           replace(/\\x08/g, '\\\\x08');\n};\n\n\n/**\n * @ngdoc function\n * @name angular.isElement\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a DOM element (or wrapped jQuery element).\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).\n */\nfunction isElement(node) {\n  return !!(node &&\n    (node.nodeName  // we are a direct element\n    || (node.prop && node.attr && node.find)));  // we have an on and find method part of jQuery API\n}\n\n/**\n * @param str 'key1,key2,...'\n * @returns {object} in the form of {key1:true, key2:true, ...}\n */\nfunction makeMap(str) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) {\n    obj[items[i]] = true;\n  }\n  return obj;\n}\n\n\nfunction nodeName_(element) {\n  return lowercase(element.nodeName || (element[0] && element[0].nodeName));\n}\n\nfunction includes(array, obj) {\n  return Array.prototype.indexOf.call(array, obj) != -1;\n}\n\nfunction arrayRemove(array, value) {\n  var index = array.indexOf(value);\n  if (index >= 0) {\n    array.splice(index, 1);\n  }\n  return index;\n}\n\n/**\n * @ngdoc function\n * @name angular.copy\n * @module ng\n * @kind function\n *\n * @description\n * Creates a deep copy of `source`, which should be an object or an array.\n *\n * * If no destination is supplied, a copy of the object or array is created.\n * * If a destination is provided, all of its elements (for arrays) or properties (for objects)\n *   are deleted and then all elements/properties from the source are copied to it.\n * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.\n * * If `source` is identical to 'destination' an exception will be thrown.\n *\n * @param {*} source The source that will be used to make a copy.\n *                   Can be any type, including primitives, `null`, and `undefined`.\n * @param {(Object|Array)=} destination Destination into which the source is copied. If\n *     provided, must be of the same type as `source`.\n * @returns {*} The copy or updated `destination`, if `destination` was specified.\n *\n * @example\n <example module=\"copyExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form novalidate class=\"simple-form\">\n Name: <input type=\"text\" ng-model=\"user.name\" /><br />\n E-mail: <input type=\"email\" ng-model=\"user.email\" /><br />\n Gender: <input type=\"radio\" ng-model=\"user.gender\" value=\"male\" />male\n <input type=\"radio\" ng-model=\"user.gender\" value=\"female\" />female<br />\n <button ng-click=\"reset()\">RESET</button>\n <button ng-click=\"update(user)\">SAVE</button>\n </form>\n <pre>form = {{user | json}}</pre>\n <pre>master = {{master | json}}</pre>\n </div>\n\n <script>\n  angular.module('copyExample', [])\n    .controller('ExampleController', ['$scope', function($scope) {\n      $scope.master= {};\n\n      $scope.update = function(user) {\n        // Example with 1 argument\n        $scope.master= angular.copy(user);\n      };\n\n      $scope.reset = function() {\n        // Example with 2 arguments\n        angular.copy($scope.master, $scope.user);\n      };\n\n      $scope.reset();\n    }]);\n </script>\n </file>\n </example>\n */\nfunction copy(source, destination) {\n  var stackSource = [];\n  var stackDest = [];\n\n  if (destination) {\n    if (isTypedArray(destination) || isArrayBuffer(destination)) {\n      throw ngMinErr('cpta', \"Can't copy! TypedArray destination cannot be mutated.\");\n    }\n    if (source === destination) {\n      throw ngMinErr('cpi', \"Can't copy! Source and destination are identical.\");\n    }\n\n    // Empty the destination object\n    if (isArray(destination)) {\n      destination.length = 0;\n    } else {\n      forEach(destination, function(value, key) {\n        if (key !== '$$hashKey') {\n          delete destination[key];\n        }\n      });\n    }\n\n    stackSource.push(source);\n    stackDest.push(destination);\n    return copyRecurse(source, destination);\n  }\n\n  return copyElement(source);\n\n  function copyRecurse(source, destination) {\n    var h = destination.$$hashKey;\n    var key;\n    if (isArray(source)) {\n      for (var i = 0, ii = source.length; i < ii; i++) {\n        destination.push(copyElement(source[i]));\n      }\n    } else if (isBlankObject(source)) {\n      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n      for (key in source) {\n        destination[key] = copyElement(source[key]);\n      }\n    } else if (source && typeof source.hasOwnProperty === 'function') {\n      // Slow path, which must rely on hasOwnProperty\n      for (key in source) {\n        if (source.hasOwnProperty(key)) {\n          destination[key] = copyElement(source[key]);\n        }\n      }\n    } else {\n      // Slowest path --- hasOwnProperty can't be called as a method\n      for (key in source) {\n        if (hasOwnProperty.call(source, key)) {\n          destination[key] = copyElement(source[key]);\n        }\n      }\n    }\n    setHashKey(destination, h);\n    return destination;\n  }\n\n  function copyElement(source) {\n    // Simple values\n    if (!isObject(source)) {\n      return source;\n    }\n\n    // Already copied values\n    var index = stackSource.indexOf(source);\n    if (index !== -1) {\n      return stackDest[index];\n    }\n\n    if (isWindow(source) || isScope(source)) {\n      throw ngMinErr('cpws',\n        \"Can't copy! Making copies of Window or Scope instances is not supported.\");\n    }\n\n    var needsRecurse = false;\n    var destination = copyType(source);\n\n    if (destination === undefined) {\n      destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));\n      needsRecurse = true;\n    }\n\n    stackSource.push(source);\n    stackDest.push(destination);\n\n    return needsRecurse\n      ? copyRecurse(source, destination)\n      : destination;\n  }\n\n  function copyType(source) {\n    switch (toString.call(source)) {\n      case '[object Int8Array]':\n      case '[object Int16Array]':\n      case '[object Int32Array]':\n      case '[object Float32Array]':\n      case '[object Float64Array]':\n      case '[object Uint8Array]':\n      case '[object Uint8ClampedArray]':\n      case '[object Uint16Array]':\n      case '[object Uint32Array]':\n        return new source.constructor(copyElement(source.buffer));\n\n      case '[object ArrayBuffer]':\n        //Support: IE10\n        if (!source.slice) {\n          var copied = new ArrayBuffer(source.byteLength);\n          new Uint8Array(copied).set(new Uint8Array(source));\n          return copied;\n        }\n        return source.slice(0);\n\n      case '[object Boolean]':\n      case '[object Number]':\n      case '[object String]':\n      case '[object Date]':\n        return new source.constructor(source.valueOf());\n\n      case '[object RegExp]':\n        var re = new RegExp(source.source, source.toString().match(/[^\\/]*$/)[0]);\n        re.lastIndex = source.lastIndex;\n        return re;\n\n      case '[object Blob]':\n        return new source.constructor([source], {type: source.type});\n    }\n\n    if (isFunction(source.cloneNode)) {\n      return source.cloneNode(true);\n    }\n  }\n}\n\n/**\n * Creates a shallow copy of an object, an array or a primitive.\n *\n * Assumes that there are no proto properties for objects.\n */\nfunction shallowCopy(src, dst) {\n  if (isArray(src)) {\n    dst = dst || [];\n\n    for (var i = 0, ii = src.length; i < ii; i++) {\n      dst[i] = src[i];\n    }\n  } else if (isObject(src)) {\n    dst = dst || {};\n\n    for (var key in src) {\n      if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {\n        dst[key] = src[key];\n      }\n    }\n  }\n\n  return dst || src;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.equals\n * @module ng\n * @kind function\n *\n * @description\n * Determines if two objects or two values are equivalent. Supports value types, regular\n * expressions, arrays and objects.\n *\n * Two objects or values are considered equivalent if at least one of the following is true:\n *\n * * Both objects or values pass `===` comparison.\n * * Both objects or values are of the same type and all of their properties are equal by\n *   comparing them with `angular.equals`.\n * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)\n * * Both values represent the same regular expression (In JavaScript,\n *   /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual\n *   representation matches).\n *\n * During a property comparison, properties of `function` type and properties with names\n * that begin with `$` are ignored.\n *\n * Scope and DOMWindow objects are being compared only by identify (`===`).\n *\n * @param {*} o1 Object or value to compare.\n * @param {*} o2 Object or value to compare.\n * @returns {boolean} True if arguments are equal.\n */\nfunction equals(o1, o2) {\n  if (o1 === o2) return true;\n  if (o1 === null || o2 === null) return false;\n  if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n  var t1 = typeof o1, t2 = typeof o2, length, key, keySet;\n  if (t1 == t2 && t1 == 'object') {\n    if (isArray(o1)) {\n      if (!isArray(o2)) return false;\n      if ((length = o1.length) == o2.length) {\n        for (key = 0; key < length; key++) {\n          if (!equals(o1[key], o2[key])) return false;\n        }\n        return true;\n      }\n    } else if (isDate(o1)) {\n      if (!isDate(o2)) return false;\n      return equals(o1.getTime(), o2.getTime());\n    } else if (isRegExp(o1)) {\n      if (!isRegExp(o2)) return false;\n      return o1.toString() == o2.toString();\n    } else {\n      if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||\n        isArray(o2) || isDate(o2) || isRegExp(o2)) return false;\n      keySet = createMap();\n      for (key in o1) {\n        if (key.charAt(0) === '$' || isFunction(o1[key])) continue;\n        if (!equals(o1[key], o2[key])) return false;\n        keySet[key] = true;\n      }\n      for (key in o2) {\n        if (!(key in keySet) &&\n            key.charAt(0) !== '$' &&\n            isDefined(o2[key]) &&\n            !isFunction(o2[key])) return false;\n      }\n      return true;\n    }\n  }\n  return false;\n}\n\nvar csp = function() {\n  if (!isDefined(csp.rules)) {\n\n\n    var ngCspElement = (document.querySelector('[ng-csp]') ||\n                    document.querySelector('[data-ng-csp]'));\n\n    if (ngCspElement) {\n      var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||\n                    ngCspElement.getAttribute('data-ng-csp');\n      csp.rules = {\n        noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),\n        noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)\n      };\n    } else {\n      csp.rules = {\n        noUnsafeEval: noUnsafeEval(),\n        noInlineStyle: false\n      };\n    }\n  }\n\n  return csp.rules;\n\n  function noUnsafeEval() {\n    try {\n      /* jshint -W031, -W054 */\n      new Function('');\n      /* jshint +W031, +W054 */\n      return false;\n    } catch (e) {\n      return true;\n    }\n  }\n};\n\n/**\n * @ngdoc directive\n * @module ng\n * @name ngJq\n *\n * @element ANY\n * @param {string=} ngJq the name of the library available under `window`\n * to be used for angular.element\n * @description\n * Use this directive to force the angular.element library.  This should be\n * used to force either jqLite by leaving ng-jq blank or setting the name of\n * the jquery variable under window (eg. jQuery).\n *\n * Since angular looks for this directive when it is loaded (doesn't wait for the\n * DOMContentLoaded event), it must be placed on an element that comes before the script\n * which loads angular. Also, only the first instance of `ng-jq` will be used and all\n * others ignored.\n *\n * @example\n * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.\n ```html\n <!doctype html>\n <html ng-app ng-jq>\n ...\n ...\n </html>\n ```\n * @example\n * This example shows how to use a jQuery based library of a different name.\n * The library name must be available at the top most 'window'.\n ```html\n <!doctype html>\n <html ng-app ng-jq=\"jQueryLib\">\n ...\n ...\n </html>\n ```\n */\nvar jq = function() {\n  if (isDefined(jq.name_)) return jq.name_;\n  var el;\n  var i, ii = ngAttrPrefixes.length, prefix, name;\n  for (i = 0; i < ii; ++i) {\n    prefix = ngAttrPrefixes[i];\n    if (el = document.querySelector('[' + prefix.replace(':', '\\\\:') + 'jq]')) {\n      name = el.getAttribute(prefix + 'jq');\n      break;\n    }\n  }\n\n  return (jq.name_ = name);\n};\n\nfunction concat(array1, array2, index) {\n  return array1.concat(slice.call(array2, index));\n}\n\nfunction sliceArgs(args, startIndex) {\n  return slice.call(args, startIndex || 0);\n}\n\n\n/* jshint -W101 */\n/**\n * @ngdoc function\n * @name angular.bind\n * @module ng\n * @kind function\n *\n * @description\n * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for\n * `fn`). You can supply optional `args` that are prebound to the function. This feature is also\n * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as\n * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).\n *\n * @param {Object} self Context which `fn` should be evaluated in.\n * @param {function()} fn Function to be bound.\n * @param {...*} args Optional arguments to be prebound to the `fn` function call.\n * @returns {function()} Function that wraps the `fn` with all the specified bindings.\n */\n/* jshint +W101 */\nfunction bind(self, fn) {\n  var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];\n  if (isFunction(fn) && !(fn instanceof RegExp)) {\n    return curryArgs.length\n      ? function() {\n          return arguments.length\n            ? fn.apply(self, concat(curryArgs, arguments, 0))\n            : fn.apply(self, curryArgs);\n        }\n      : function() {\n          return arguments.length\n            ? fn.apply(self, arguments)\n            : fn.call(self);\n        };\n  } else {\n    // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)\n    return fn;\n  }\n}\n\n\nfunction toJsonReplacer(key, value) {\n  var val = value;\n\n  if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {\n    val = undefined;\n  } else if (isWindow(value)) {\n    val = '$WINDOW';\n  } else if (value &&  document === value) {\n    val = '$DOCUMENT';\n  } else if (isScope(value)) {\n    val = '$SCOPE';\n  }\n\n  return val;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.toJson\n * @module ng\n * @kind function\n *\n * @description\n * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be\n * stripped since angular uses this notation internally.\n *\n * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.\n * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.\n *    If set to an integer, the JSON output will contain that many spaces per indentation.\n * @returns {string|undefined} JSON-ified string representing `obj`.\n */\nfunction toJson(obj, pretty) {\n  if (isUndefined(obj)) return undefined;\n  if (!isNumber(pretty)) {\n    pretty = pretty ? 2 : null;\n  }\n  return JSON.stringify(obj, toJsonReplacer, pretty);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.fromJson\n * @module ng\n * @kind function\n *\n * @description\n * Deserializes a JSON string.\n *\n * @param {string} json JSON string to deserialize.\n * @returns {Object|Array|string|number} Deserialized JSON string.\n */\nfunction fromJson(json) {\n  return isString(json)\n      ? JSON.parse(json)\n      : json;\n}\n\n\nvar ALL_COLONS = /:/g;\nfunction timezoneToOffset(timezone, fallback) {\n  // IE/Edge do not \"understand\" colon (`:`) in timezone\n  timezone = timezone.replace(ALL_COLONS, '');\n  var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;\n  return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;\n}\n\n\nfunction addDateMinutes(date, minutes) {\n  date = new Date(date.getTime());\n  date.setMinutes(date.getMinutes() + minutes);\n  return date;\n}\n\n\nfunction convertTimezoneToLocal(date, timezone, reverse) {\n  reverse = reverse ? -1 : 1;\n  var dateTimezoneOffset = date.getTimezoneOffset();\n  var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n  return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));\n}\n\n\n/**\n * @returns {string} Returns the string representation of the element.\n */\nfunction startingTag(element) {\n  element = jqLite(element).clone();\n  try {\n    // turns out IE does not let you set .html() on elements which\n    // are not allowed to have children. So we just ignore it.\n    element.empty();\n  } catch (e) {}\n  var elemHtml = jqLite('<div>').append(element).html();\n  try {\n    return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :\n        elemHtml.\n          match(/^(<[^>]+>)/)[1].\n          replace(/^<([\\w\\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});\n  } catch (e) {\n    return lowercase(elemHtml);\n  }\n\n}\n\n\n/////////////////////////////////////////////////\n\n/**\n * Tries to decode the URI component without throwing an exception.\n *\n * @private\n * @param str value potential URI component to check.\n * @returns {boolean} True if `value` can be decoded\n * with the decodeURIComponent function.\n */\nfunction tryDecodeURIComponent(value) {\n  try {\n    return decodeURIComponent(value);\n  } catch (e) {\n    // Ignore any invalid uri component\n  }\n}\n\n\n/**\n * Parses an escaped url query string into key-value pairs.\n * @returns {Object.<string,boolean|Array>}\n */\nfunction parseKeyValue(/**string*/keyValue) {\n  var obj = {};\n  forEach((keyValue || \"\").split('&'), function(keyValue) {\n    var splitPoint, key, val;\n    if (keyValue) {\n      key = keyValue = keyValue.replace(/\\+/g,'%20');\n      splitPoint = keyValue.indexOf('=');\n      if (splitPoint !== -1) {\n        key = keyValue.substring(0, splitPoint);\n        val = keyValue.substring(splitPoint + 1);\n      }\n      key = tryDecodeURIComponent(key);\n      if (isDefined(key)) {\n        val = isDefined(val) ? tryDecodeURIComponent(val) : true;\n        if (!hasOwnProperty.call(obj, key)) {\n          obj[key] = val;\n        } else if (isArray(obj[key])) {\n          obj[key].push(val);\n        } else {\n          obj[key] = [obj[key],val];\n        }\n      }\n    }\n  });\n  return obj;\n}\n\nfunction toKeyValue(obj) {\n  var parts = [];\n  forEach(obj, function(value, key) {\n    if (isArray(value)) {\n      forEach(value, function(arrayValue) {\n        parts.push(encodeUriQuery(key, true) +\n                   (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));\n      });\n    } else {\n    parts.push(encodeUriQuery(key, true) +\n               (value === true ? '' : '=' + encodeUriQuery(value, true)));\n    }\n  });\n  return parts.length ? parts.join('&') : '';\n}\n\n\n/**\n * We need our custom method because encodeURIComponent is too aggressive and doesn't follow\n * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path\n * segments:\n *    segment       = *pchar\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriSegment(val) {\n  return encodeUriQuery(val, true).\n             replace(/%26/gi, '&').\n             replace(/%3D/gi, '=').\n             replace(/%2B/gi, '+');\n}\n\n\n/**\n * This method is intended for encoding *key* or *value* parts of query component. We need a custom\n * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be\n * encoded per http://tools.ietf.org/html/rfc3986:\n *    query       = *( pchar / \"/\" / \"?\" )\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriQuery(val, pctEncodeSpaces) {\n  return encodeURIComponent(val).\n             replace(/%40/gi, '@').\n             replace(/%3A/gi, ':').\n             replace(/%24/g, '$').\n             replace(/%2C/gi, ',').\n             replace(/%3B/gi, ';').\n             replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));\n}\n\nvar ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];\n\nfunction getNgAttribute(element, ngAttr) {\n  var attr, i, ii = ngAttrPrefixes.length;\n  for (i = 0; i < ii; ++i) {\n    attr = ngAttrPrefixes[i] + ngAttr;\n    if (isString(attr = element.getAttribute(attr))) {\n      return attr;\n    }\n  }\n  return null;\n}\n\n/**\n * @ngdoc directive\n * @name ngApp\n * @module ng\n *\n * @element ANY\n * @param {angular.Module} ngApp an optional application\n *   {@link angular.module module} name to load.\n * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be\n *   created in \"strict-di\" mode. This means that the application will fail to invoke functions which\n *   do not use explicit function annotation (and are thus unsuitable for minification), as described\n *   in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in\n *   tracking down the root of these bugs.\n *\n * @description\n *\n * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive\n * designates the **root element** of the application and is typically placed near the root element\n * of the page - e.g. on the `<body>` or `<html>` tags.\n *\n * There are a few things to keep in mind when using `ngApp`:\n * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`\n *   found in the document will be used to define the root element to auto-bootstrap as an\n *   application. To run multiple applications in an HTML document you must manually bootstrap them using\n *   {@link angular.bootstrap} instead.\n * - AngularJS applications cannot be nested within each other.\n * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.\n *   This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and\n *   {@link ngRoute.ngView `ngView`}.\n *   Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},\n *   causing animations to stop working and making the injector inaccessible from outside the app.\n *\n * You can specify an **AngularJS module** to be used as the root module for the application.  This\n * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It\n * should contain the application code needed or have dependencies on other modules that will\n * contain the code. See {@link angular.module} for more information.\n *\n * In the example below if the `ngApp` directive were not placed on the `html` element then the\n * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`\n * would not be resolved to `3`.\n *\n * `ngApp` is the easiest, and most common way to bootstrap an application.\n *\n <example module=\"ngAppDemo\">\n   <file name=\"index.html\">\n   <div ng-controller=\"ngAppDemoController\">\n     I can add: {{a}} + {{b}} =  {{ a+b }}\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {\n     $scope.a = 1;\n     $scope.b = 2;\n   });\n   </file>\n </example>\n *\n * Using `ngStrictDi`, you would see something like this:\n *\n <example ng-app-included=\"true\">\n   <file name=\"index.html\">\n   <div ng-app=\"ngAppStrictDemo\" ng-strict-di>\n       <div ng-controller=\"GoodController1\">\n           I can add: {{a}} + {{b}} =  {{ a+b }}\n\n           <p>This renders because the controller does not fail to\n              instantiate, by using explicit annotation style (see\n              script.js for details)\n           </p>\n       </div>\n\n       <div ng-controller=\"GoodController2\">\n           Name: <input ng-model=\"name\"><br />\n           Hello, {{name}}!\n\n           <p>This renders because the controller does not fail to\n              instantiate, by using explicit annotation style\n              (see script.js for details)\n           </p>\n       </div>\n\n       <div ng-controller=\"BadController\">\n           I can add: {{a}} + {{b}} =  {{ a+b }}\n\n           <p>The controller could not be instantiated, due to relying\n              on automatic function annotations (which are disabled in\n              strict mode). As such, the content of this section is not\n              interpolated, and there should be an error in your web console.\n           </p>\n       </div>\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppStrictDemo', [])\n     // BadController will fail to instantiate, due to relying on automatic function annotation,\n     // rather than an explicit annotation\n     .controller('BadController', function($scope) {\n       $scope.a = 1;\n       $scope.b = 2;\n     })\n     // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,\n     // due to using explicit annotations using the array style and $inject property, respectively.\n     .controller('GoodController1', ['$scope', function($scope) {\n       $scope.a = 1;\n       $scope.b = 2;\n     }])\n     .controller('GoodController2', GoodController2);\n     function GoodController2($scope) {\n       $scope.name = \"World\";\n     }\n     GoodController2.$inject = ['$scope'];\n   </file>\n   <file name=\"style.css\">\n   div[ng-controller] {\n       margin-bottom: 1em;\n       -webkit-border-radius: 4px;\n       border-radius: 4px;\n       border: 1px solid;\n       padding: .5em;\n   }\n   div[ng-controller^=Good] {\n       border-color: #d6e9c6;\n       background-color: #dff0d8;\n       color: #3c763d;\n   }\n   div[ng-controller^=Bad] {\n       border-color: #ebccd1;\n       background-color: #f2dede;\n       color: #a94442;\n       margin-bottom: 0;\n   }\n   </file>\n </example>\n */\nfunction angularInit(element, bootstrap) {\n  var appElement,\n      module,\n      config = {};\n\n  // The element `element` has priority over any other element\n  forEach(ngAttrPrefixes, function(prefix) {\n    var name = prefix + 'app';\n\n    if (!appElement && element.hasAttribute && element.hasAttribute(name)) {\n      appElement = element;\n      module = element.getAttribute(name);\n    }\n  });\n  forEach(ngAttrPrefixes, function(prefix) {\n    var name = prefix + 'app';\n    var candidate;\n\n    if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\\\:') + ']'))) {\n      appElement = candidate;\n      module = candidate.getAttribute(name);\n    }\n  });\n  if (appElement) {\n    config.strictDi = getNgAttribute(appElement, \"strict-di\") !== null;\n    bootstrap(appElement, module ? [module] : [], config);\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.bootstrap\n * @module ng\n * @description\n * Use this function to manually start up angular application.\n *\n * For more information, see the {@link guide/bootstrap Bootstrap guide}.\n *\n * Angular will detect if it has been loaded into the browser more than once and only allow the\n * first loaded script to be bootstrapped and will report a warning to the browser console for\n * each of the subsequent scripts. This prevents strange results in applications, where otherwise\n * multiple instances of Angular try to work on the DOM.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.\n * They must use {@link ng.directive:ngApp ngApp}.\n * </div>\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},\n * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.\n * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},\n * causing animations to stop working and making the injector inaccessible from outside the app.\n * </div>\n *\n * ```html\n * <!doctype html>\n * <html>\n * <body>\n * <div ng-controller=\"WelcomeController\">\n *   {{greeting}}\n * </div>\n *\n * <script src=\"angular.js\"></script>\n * <script>\n *   var app = angular.module('demo', [])\n *   .controller('WelcomeController', function($scope) {\n *       $scope.greeting = 'Welcome!';\n *   });\n *   angular.bootstrap(document, ['demo']);\n * </script>\n * </body>\n * </html>\n * ```\n *\n * @param {DOMElement} element DOM element which is the root of angular application.\n * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.\n *     Each item in the array should be the name of a predefined module or a (DI annotated)\n *     function that will be invoked by the injector as a `config` block.\n *     See: {@link angular.module modules}\n * @param {Object=} config an object for defining configuration options for the application. The\n *     following keys are supported:\n *\n * * `strictDi` - disable automatic function annotation for the application. This is meant to\n *   assist in finding bugs which break minified code. Defaults to `false`.\n *\n * @returns {auto.$injector} Returns the newly created injector for this app.\n */\nfunction bootstrap(element, modules, config) {\n  if (!isObject(config)) config = {};\n  var defaultConfig = {\n    strictDi: false\n  };\n  config = extend(defaultConfig, config);\n  var doBootstrap = function() {\n    element = jqLite(element);\n\n    if (element.injector()) {\n      var tag = (element[0] === document) ? 'document' : startingTag(element);\n      //Encode angle brackets to prevent input from being sanitized to empty string #8683\n      throw ngMinErr(\n          'btstrpd',\n          \"App Already Bootstrapped with this Element '{0}'\",\n          tag.replace(/</,'&lt;').replace(/>/,'&gt;'));\n    }\n\n    modules = modules || [];\n    modules.unshift(['$provide', function($provide) {\n      $provide.value('$rootElement', element);\n    }]);\n\n    if (config.debugInfoEnabled) {\n      // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.\n      modules.push(['$compileProvider', function($compileProvider) {\n        $compileProvider.debugInfoEnabled(true);\n      }]);\n    }\n\n    modules.unshift('ng');\n    var injector = createInjector(modules, config.strictDi);\n    injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',\n       function bootstrapApply(scope, element, compile, injector) {\n        scope.$apply(function() {\n          element.data('$injector', injector);\n          compile(element)(scope);\n        });\n      }]\n    );\n    return injector;\n  };\n\n  var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;\n  var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;\n\n  if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {\n    config.debugInfoEnabled = true;\n    window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');\n  }\n\n  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {\n    return doBootstrap();\n  }\n\n  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');\n  angular.resumeBootstrap = function(extraModules) {\n    forEach(extraModules, function(module) {\n      modules.push(module);\n    });\n    return doBootstrap();\n  };\n\n  if (isFunction(angular.resumeDeferredBootstrap)) {\n    angular.resumeDeferredBootstrap();\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.reloadWithDebugInfo\n * @module ng\n * @description\n * Use this function to reload the current application with debug information turned on.\n * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.\n *\n * See {@link ng.$compileProvider#debugInfoEnabled} for more.\n */\nfunction reloadWithDebugInfo() {\n  window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;\n  window.location.reload();\n}\n\n/**\n * @name angular.getTestability\n * @module ng\n * @description\n * Get the testability service for the instance of Angular on the given\n * element.\n * @param {DOMElement} element DOM element which is the root of angular application.\n */\nfunction getTestability(rootElement) {\n  var injector = angular.element(rootElement).injector();\n  if (!injector) {\n    throw ngMinErr('test',\n      'no injector found for element argument to getTestability');\n  }\n  return injector.get('$$testability');\n}\n\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nfunction snake_case(name, separator) {\n  separator = separator || '_';\n  return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n    return (pos ? separator : '') + letter.toLowerCase();\n  });\n}\n\nvar bindJQueryFired = false;\nfunction bindJQuery() {\n  var originalCleanData;\n\n  if (bindJQueryFired) {\n    return;\n  }\n\n  // bind to jQuery if present;\n  var jqName = jq();\n  jQuery = isUndefined(jqName) ? window.jQuery :   // use jQuery (if present)\n           !jqName             ? undefined     :   // use jqLite\n                                 window[jqName];   // use jQuery specified by `ngJq`\n\n  // Use jQuery if it exists with proper functionality, otherwise default to us.\n  // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.\n  // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older\n  // versions. It will not work for sure with jQuery <1.7, though.\n  if (jQuery && jQuery.fn.on) {\n    jqLite = jQuery;\n    extend(jQuery.fn, {\n      scope: JQLitePrototype.scope,\n      isolateScope: JQLitePrototype.isolateScope,\n      controller: JQLitePrototype.controller,\n      injector: JQLitePrototype.injector,\n      inheritedData: JQLitePrototype.inheritedData\n    });\n\n    // All nodes removed from the DOM via various jQuery APIs like .remove()\n    // are passed through jQuery.cleanData. Monkey-patch this method to fire\n    // the $destroy event on all removed nodes.\n    originalCleanData = jQuery.cleanData;\n    jQuery.cleanData = function(elems) {\n      var events;\n      for (var i = 0, elem; (elem = elems[i]) != null; i++) {\n        events = jQuery._data(elem, \"events\");\n        if (events && events.$destroy) {\n          jQuery(elem).triggerHandler('$destroy');\n        }\n      }\n      originalCleanData(elems);\n    };\n  } else {\n    jqLite = JQLite;\n  }\n\n  angular.element = jqLite;\n\n  // Prevent double-proxying.\n  bindJQueryFired = true;\n}\n\n/**\n * throw error if the argument is falsy.\n */\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction assertArgFn(arg, name, acceptArrayAnnotation) {\n  if (acceptArrayAnnotation && isArray(arg)) {\n      arg = arg[arg.length - 1];\n  }\n\n  assertArg(isFunction(arg), name, 'not a function, got ' +\n      (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));\n  return arg;\n}\n\n/**\n * throw error if the name given is hasOwnProperty\n * @param  {String} name    the name to test\n * @param  {String} context the context in which the name is used, such as module or directive\n */\nfunction assertNotHasOwnProperty(name, context) {\n  if (name === 'hasOwnProperty') {\n    throw ngMinErr('badname', \"hasOwnProperty is not a valid {0} name\", context);\n  }\n}\n\n/**\n * Return the value accessible from the object by path. Any undefined traversals are ignored\n * @param {Object} obj starting object\n * @param {String} path path to traverse\n * @param {boolean} [bindFnToScope=true]\n * @returns {Object} value as accessible by path\n */\n//TODO(misko): this function needs to be removed\nfunction getter(obj, path, bindFnToScope) {\n  if (!path) return obj;\n  var keys = path.split('.');\n  var key;\n  var lastInstance = obj;\n  var len = keys.length;\n\n  for (var i = 0; i < len; i++) {\n    key = keys[i];\n    if (obj) {\n      obj = (lastInstance = obj)[key];\n    }\n  }\n  if (!bindFnToScope && isFunction(obj)) {\n    return bind(lastInstance, obj);\n  }\n  return obj;\n}\n\n/**\n * Return the DOM siblings between the first and last node in the given array.\n * @param {Array} array like object\n * @returns {Array} the inputted object or a jqLite collection containing the nodes\n */\nfunction getBlockNodes(nodes) {\n  // TODO(perf): update `nodes` instead of creating a new object?\n  var node = nodes[0];\n  var endNode = nodes[nodes.length - 1];\n  var blockNodes;\n\n  for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {\n    if (blockNodes || nodes[i] !== node) {\n      if (!blockNodes) {\n        blockNodes = jqLite(slice.call(nodes, 0, i));\n      }\n      blockNodes.push(node);\n    }\n  }\n\n  return blockNodes || nodes;\n}\n\n\n/**\n * Creates a new object without a prototype. This object is useful for lookup without having to\n * guard against prototypically inherited properties via hasOwnProperty.\n *\n * Related micro-benchmarks:\n * - http://jsperf.com/object-create2\n * - http://jsperf.com/proto-map-lookup/2\n * - http://jsperf.com/for-in-vs-object-keys2\n *\n * @returns {Object}\n */\nfunction createMap() {\n  return Object.create(null);\n}\n\nvar NODE_TYPE_ELEMENT = 1;\nvar NODE_TYPE_ATTRIBUTE = 2;\nvar NODE_TYPE_TEXT = 3;\nvar NODE_TYPE_COMMENT = 8;\nvar NODE_TYPE_DOCUMENT = 9;\nvar NODE_TYPE_DOCUMENT_FRAGMENT = 11;\n\n/**\n * @ngdoc type\n * @name angular.Module\n * @module ng\n * @description\n *\n * Interface for configuring angular {@link angular.module modules}.\n */\n\nfunction setupModuleLoader(window) {\n\n  var $injectorMinErr = minErr('$injector');\n  var ngMinErr = minErr('ng');\n\n  function ensure(obj, name, factory) {\n    return obj[name] || (obj[name] = factory());\n  }\n\n  var angular = ensure(window, 'angular', Object);\n\n  // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap\n  angular.$$minErr = angular.$$minErr || minErr;\n\n  return ensure(angular, 'module', function() {\n    /** @type {Object.<string, angular.Module>} */\n    var modules = {};\n\n    /**\n     * @ngdoc function\n     * @name angular.module\n     * @module ng\n     * @description\n     *\n     * The `angular.module` is a global place for creating, registering and retrieving Angular\n     * modules.\n     * All modules (angular core or 3rd party) that should be available to an application must be\n     * registered using this mechanism.\n     *\n     * Passing one argument retrieves an existing {@link angular.Module},\n     * whereas passing more than one argument creates a new {@link angular.Module}\n     *\n     *\n     * # Module\n     *\n     * A module is a collection of services, directives, controllers, filters, and configuration information.\n     * `angular.module` is used to configure the {@link auto.$injector $injector}.\n     *\n     * ```js\n     * // Create a new module\n     * var myModule = angular.module('myModule', []);\n     *\n     * // register a new service\n     * myModule.value('appName', 'MyCoolApp');\n     *\n     * // configure existing services inside initialization blocks.\n     * myModule.config(['$locationProvider', function($locationProvider) {\n     *   // Configure existing providers\n     *   $locationProvider.hashPrefix('!');\n     * }]);\n     * ```\n     *\n     * Then you can create an injector and load your modules like this:\n     *\n     * ```js\n     * var injector = angular.injector(['ng', 'myModule'])\n     * ```\n     *\n     * However it's more likely that you'll just use\n     * {@link ng.directive:ngApp ngApp} or\n     * {@link angular.bootstrap} to simplify this process for you.\n     *\n     * @param {!string} name The name of the module to create or retrieve.\n     * @param {!Array.<string>=} requires If specified then new module is being created. If\n     *        unspecified then the module is being retrieved for further configuration.\n     * @param {Function=} configFn Optional configuration function for the module. Same as\n     *        {@link angular.Module#config Module#config()}.\n     * @returns {angular.Module} new module with the {@link angular.Module} api.\n     */\n    return function module(name, requires, configFn) {\n      var assertNotHasOwnProperty = function(name, context) {\n        if (name === 'hasOwnProperty') {\n          throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);\n        }\n      };\n\n      assertNotHasOwnProperty(name, 'module');\n      if (requires && modules.hasOwnProperty(name)) {\n        modules[name] = null;\n      }\n      return ensure(modules, name, function() {\n        if (!requires) {\n          throw $injectorMinErr('nomod', \"Module '{0}' is not available! You either misspelled \" +\n             \"the module name or forgot to load it. If registering a module ensure that you \" +\n             \"specify the dependencies as the second argument.\", name);\n        }\n\n        /** @type {!Array.<Array.<*>>} */\n        var invokeQueue = [];\n\n        /** @type {!Array.<Function>} */\n        var configBlocks = [];\n\n        /** @type {!Array.<Function>} */\n        var runBlocks = [];\n\n        var config = invokeLater('$injector', 'invoke', 'push', configBlocks);\n\n        /** @type {angular.Module} */\n        var moduleInstance = {\n          // Private state\n          _invokeQueue: invokeQueue,\n          _configBlocks: configBlocks,\n          _runBlocks: runBlocks,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#requires\n           * @module ng\n           *\n           * @description\n           * Holds the list of modules which the injector will load before the current module is\n           * loaded.\n           */\n          requires: requires,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#name\n           * @module ng\n           *\n           * @description\n           * Name of the module.\n           */\n          name: name,\n\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#provider\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerType Construction function for creating new instance of the\n           *                                service.\n           * @description\n           * See {@link auto.$provide#provider $provide.provider()}.\n           */\n          provider: invokeLaterAndSetModuleName('$provide', 'provider'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#factory\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerFunction Function for creating new instance of the service.\n           * @description\n           * See {@link auto.$provide#factory $provide.factory()}.\n           */\n          factory: invokeLaterAndSetModuleName('$provide', 'factory'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#service\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} constructor A constructor function that will be instantiated.\n           * @description\n           * See {@link auto.$provide#service $provide.service()}.\n           */\n          service: invokeLaterAndSetModuleName('$provide', 'service'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#value\n           * @module ng\n           * @param {string} name service name\n           * @param {*} object Service instance object.\n           * @description\n           * See {@link auto.$provide#value $provide.value()}.\n           */\n          value: invokeLater('$provide', 'value'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#constant\n           * @module ng\n           * @param {string} name constant name\n           * @param {*} object Constant value.\n           * @description\n           * Because the constants are fixed, they get applied before other provide methods.\n           * See {@link auto.$provide#constant $provide.constant()}.\n           */\n          constant: invokeLater('$provide', 'constant', 'unshift'),\n\n           /**\n           * @ngdoc method\n           * @name angular.Module#decorator\n           * @module ng\n           * @param {string} The name of the service to decorate.\n           * @param {Function} This function will be invoked when the service needs to be\n           *                                    instantiated and should return the decorated service instance.\n           * @description\n           * See {@link auto.$provide#decorator $provide.decorator()}.\n           */\n          decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#animation\n           * @module ng\n           * @param {string} name animation name\n           * @param {Function} animationFactory Factory function for creating new instance of an\n           *                                    animation.\n           * @description\n           *\n           * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.\n           *\n           *\n           * Defines an animation hook that can be later used with\n           * {@link $animate $animate} service and directives that use this service.\n           *\n           * ```js\n           * module.animation('.animation-name', function($inject1, $inject2) {\n           *   return {\n           *     eventName : function(element, done) {\n           *       //code to run the animation\n           *       //once complete, then run done()\n           *       return function cancellationFunction(element) {\n           *         //code to cancel the animation\n           *       }\n           *     }\n           *   }\n           * })\n           * ```\n           *\n           * See {@link ng.$animateProvider#register $animateProvider.register()} and\n           * {@link ngAnimate ngAnimate module} for more information.\n           */\n          animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#filter\n           * @module ng\n           * @param {string} name Filter name - this must be a valid angular expression identifier\n           * @param {Function} filterFactory Factory function for creating new instance of filter.\n           * @description\n           * See {@link ng.$filterProvider#register $filterProvider.register()}.\n           *\n           * <div class=\"alert alert-warning\">\n           * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n           * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n           * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n           * (`myapp_subsection_filterx`).\n           * </div>\n           */\n          filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#controller\n           * @module ng\n           * @param {string|Object} name Controller name, or an object map of controllers where the\n           *    keys are the names and the values are the constructors.\n           * @param {Function} constructor Controller constructor function.\n           * @description\n           * See {@link ng.$controllerProvider#register $controllerProvider.register()}.\n           */\n          controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#directive\n           * @module ng\n           * @param {string|Object} name Directive name, or an object map of directives where the\n           *    keys are the names and the values are the factories.\n           * @param {Function} directiveFactory Factory function for creating new instance of\n           * directives.\n           * @description\n           * See {@link ng.$compileProvider#directive $compileProvider.directive()}.\n           */\n          directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#component\n           * @module ng\n           * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)\n           * @param {Object} options Component definition object (a simplified\n           *    {@link ng.$compile#directive-definition-object directive definition object})\n           *\n           * @description\n           * See {@link ng.$compileProvider#component $compileProvider.component()}.\n           */\n          component: invokeLaterAndSetModuleName('$compileProvider', 'component'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#config\n           * @module ng\n           * @param {Function} configFn Execute this function on module load. Useful for service\n           *    configuration.\n           * @description\n           * Use this method to register work which needs to be performed on module loading.\n           * For more about how to configure services, see\n           * {@link providers#provider-recipe Provider Recipe}.\n           */\n          config: config,\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#run\n           * @module ng\n           * @param {Function} initializationFn Execute this function after injector creation.\n           *    Useful for application initialization.\n           * @description\n           * Use this method to register work which should be performed when the injector is done\n           * loading all modules.\n           */\n          run: function(block) {\n            runBlocks.push(block);\n            return this;\n          }\n        };\n\n        if (configFn) {\n          config(configFn);\n        }\n\n        return moduleInstance;\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @param {String=} insertMethod\n         * @returns {angular.Module}\n         */\n        function invokeLater(provider, method, insertMethod, queue) {\n          if (!queue) queue = invokeQueue;\n          return function() {\n            queue[insertMethod || 'push']([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @returns {angular.Module}\n         */\n        function invokeLaterAndSetModuleName(provider, method) {\n          return function(recipeName, factoryFunction) {\n            if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;\n            invokeQueue.push([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n      });\n    };\n  });\n\n}\n\n/* global: toDebugString: true */\n\nfunction serializeObject(obj) {\n  var seen = [];\n\n  return JSON.stringify(obj, function(key, val) {\n    val = toJsonReplacer(key, val);\n    if (isObject(val)) {\n\n      if (seen.indexOf(val) >= 0) return '...';\n\n      seen.push(val);\n    }\n    return val;\n  });\n}\n\nfunction toDebugString(obj) {\n  if (typeof obj === 'function') {\n    return obj.toString().replace(/ \\{[\\s\\S]*$/, '');\n  } else if (isUndefined(obj)) {\n    return 'undefined';\n  } else if (typeof obj !== 'string') {\n    return serializeObject(obj);\n  }\n  return obj;\n}\n\n/* global angularModule: true,\n  version: true,\n\n  $CompileProvider,\n\n  htmlAnchorDirective,\n  inputDirective,\n  inputDirective,\n  formDirective,\n  scriptDirective,\n  selectDirective,\n  styleDirective,\n  optionDirective,\n  ngBindDirective,\n  ngBindHtmlDirective,\n  ngBindTemplateDirective,\n  ngClassDirective,\n  ngClassEvenDirective,\n  ngClassOddDirective,\n  ngCloakDirective,\n  ngControllerDirective,\n  ngFormDirective,\n  ngHideDirective,\n  ngIfDirective,\n  ngIncludeDirective,\n  ngIncludeFillContentDirective,\n  ngInitDirective,\n  ngNonBindableDirective,\n  ngPluralizeDirective,\n  ngRepeatDirective,\n  ngShowDirective,\n  ngStyleDirective,\n  ngSwitchDirective,\n  ngSwitchWhenDirective,\n  ngSwitchDefaultDirective,\n  ngOptionsDirective,\n  ngTranscludeDirective,\n  ngModelDirective,\n  ngListDirective,\n  ngChangeDirective,\n  patternDirective,\n  patternDirective,\n  requiredDirective,\n  requiredDirective,\n  minlengthDirective,\n  minlengthDirective,\n  maxlengthDirective,\n  maxlengthDirective,\n  ngValueDirective,\n  ngModelOptionsDirective,\n  ngAttributeAliasDirectives,\n  ngEventDirectives,\n\n  $AnchorScrollProvider,\n  $AnimateProvider,\n  $CoreAnimateCssProvider,\n  $$CoreAnimateJsProvider,\n  $$CoreAnimateQueueProvider,\n  $$AnimateRunnerFactoryProvider,\n  $$AnimateAsyncRunFactoryProvider,\n  $BrowserProvider,\n  $CacheFactoryProvider,\n  $ControllerProvider,\n  $DateProvider,\n  $DocumentProvider,\n  $ExceptionHandlerProvider,\n  $FilterProvider,\n  $$ForceReflowProvider,\n  $InterpolateProvider,\n  $IntervalProvider,\n  $$HashMapProvider,\n  $HttpProvider,\n  $HttpParamSerializerProvider,\n  $HttpParamSerializerJQLikeProvider,\n  $HttpBackendProvider,\n  $xhrFactoryProvider,\n  $LocationProvider,\n  $LogProvider,\n  $ParseProvider,\n  $RootScopeProvider,\n  $QProvider,\n  $$QProvider,\n  $$SanitizeUriProvider,\n  $SceProvider,\n  $SceDelegateProvider,\n  $SnifferProvider,\n  $TemplateCacheProvider,\n  $TemplateRequestProvider,\n  $$TestabilityProvider,\n  $TimeoutProvider,\n  $$RAFProvider,\n  $WindowProvider,\n  $$jqLiteProvider,\n  $$CookieReaderProvider\n*/\n\n\n/**\n * @ngdoc object\n * @name angular.version\n * @module ng\n * @description\n * An object that contains information about the current AngularJS version.\n *\n * This object has the following properties:\n *\n * - `full` – `{string}` – Full version string, such as \"0.9.18\".\n * - `major` – `{number}` – Major version number, such as \"0\".\n * - `minor` – `{number}` – Minor version number, such as \"9\".\n * - `dot` – `{number}` – Dot version number, such as \"18\".\n * - `codeName` – `{string}` – Code name of the release, such as \"jiggling-armfat\".\n */\nvar version = {\n  full: '1.5.3',    // all of these placeholder strings will be replaced by grunt's\n  major: 1,    // package task\n  minor: 5,\n  dot: 3,\n  codeName: 'diplohaplontic-meiosis'\n};\n\n\nfunction publishExternalAPI(angular) {\n  extend(angular, {\n    'bootstrap': bootstrap,\n    'copy': copy,\n    'extend': extend,\n    'merge': merge,\n    'equals': equals,\n    'element': jqLite,\n    'forEach': forEach,\n    'injector': createInjector,\n    'noop': noop,\n    'bind': bind,\n    'toJson': toJson,\n    'fromJson': fromJson,\n    'identity': identity,\n    'isUndefined': isUndefined,\n    'isDefined': isDefined,\n    'isString': isString,\n    'isFunction': isFunction,\n    'isObject': isObject,\n    'isNumber': isNumber,\n    'isElement': isElement,\n    'isArray': isArray,\n    'version': version,\n    'isDate': isDate,\n    'lowercase': lowercase,\n    'uppercase': uppercase,\n    'callbacks': {counter: 0},\n    'getTestability': getTestability,\n    '$$minErr': minErr,\n    '$$csp': csp,\n    'reloadWithDebugInfo': reloadWithDebugInfo\n  });\n\n  angularModule = setupModuleLoader(window);\n\n  angularModule('ng', ['ngLocale'], ['$provide',\n    function ngModule($provide) {\n      // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.\n      $provide.provider({\n        $$sanitizeUri: $$SanitizeUriProvider\n      });\n      $provide.provider('$compile', $CompileProvider).\n        directive({\n            a: htmlAnchorDirective,\n            input: inputDirective,\n            textarea: inputDirective,\n            form: formDirective,\n            script: scriptDirective,\n            select: selectDirective,\n            style: styleDirective,\n            option: optionDirective,\n            ngBind: ngBindDirective,\n            ngBindHtml: ngBindHtmlDirective,\n            ngBindTemplate: ngBindTemplateDirective,\n            ngClass: ngClassDirective,\n            ngClassEven: ngClassEvenDirective,\n            ngClassOdd: ngClassOddDirective,\n            ngCloak: ngCloakDirective,\n            ngController: ngControllerDirective,\n            ngForm: ngFormDirective,\n            ngHide: ngHideDirective,\n            ngIf: ngIfDirective,\n            ngInclude: ngIncludeDirective,\n            ngInit: ngInitDirective,\n            ngNonBindable: ngNonBindableDirective,\n            ngPluralize: ngPluralizeDirective,\n            ngRepeat: ngRepeatDirective,\n            ngShow: ngShowDirective,\n            ngStyle: ngStyleDirective,\n            ngSwitch: ngSwitchDirective,\n            ngSwitchWhen: ngSwitchWhenDirective,\n            ngSwitchDefault: ngSwitchDefaultDirective,\n            ngOptions: ngOptionsDirective,\n            ngTransclude: ngTranscludeDirective,\n            ngModel: ngModelDirective,\n            ngList: ngListDirective,\n            ngChange: ngChangeDirective,\n            pattern: patternDirective,\n            ngPattern: patternDirective,\n            required: requiredDirective,\n            ngRequired: requiredDirective,\n            minlength: minlengthDirective,\n            ngMinlength: minlengthDirective,\n            maxlength: maxlengthDirective,\n            ngMaxlength: maxlengthDirective,\n            ngValue: ngValueDirective,\n            ngModelOptions: ngModelOptionsDirective\n        }).\n        directive({\n          ngInclude: ngIncludeFillContentDirective\n        }).\n        directive(ngAttributeAliasDirectives).\n        directive(ngEventDirectives);\n      $provide.provider({\n        $anchorScroll: $AnchorScrollProvider,\n        $animate: $AnimateProvider,\n        $animateCss: $CoreAnimateCssProvider,\n        $$animateJs: $$CoreAnimateJsProvider,\n        $$animateQueue: $$CoreAnimateQueueProvider,\n        $$AnimateRunner: $$AnimateRunnerFactoryProvider,\n        $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,\n        $browser: $BrowserProvider,\n        $cacheFactory: $CacheFactoryProvider,\n        $controller: $ControllerProvider,\n        $document: $DocumentProvider,\n        $exceptionHandler: $ExceptionHandlerProvider,\n        $filter: $FilterProvider,\n        $$forceReflow: $$ForceReflowProvider,\n        $interpolate: $InterpolateProvider,\n        $interval: $IntervalProvider,\n        $http: $HttpProvider,\n        $httpParamSerializer: $HttpParamSerializerProvider,\n        $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,\n        $httpBackend: $HttpBackendProvider,\n        $xhrFactory: $xhrFactoryProvider,\n        $location: $LocationProvider,\n        $log: $LogProvider,\n        $parse: $ParseProvider,\n        $rootScope: $RootScopeProvider,\n        $q: $QProvider,\n        $$q: $$QProvider,\n        $sce: $SceProvider,\n        $sceDelegate: $SceDelegateProvider,\n        $sniffer: $SnifferProvider,\n        $templateCache: $TemplateCacheProvider,\n        $templateRequest: $TemplateRequestProvider,\n        $$testability: $$TestabilityProvider,\n        $timeout: $TimeoutProvider,\n        $window: $WindowProvider,\n        $$rAF: $$RAFProvider,\n        $$jqLite: $$jqLiteProvider,\n        $$HashMap: $$HashMapProvider,\n        $$cookieReader: $$CookieReaderProvider\n      });\n    }\n  ]);\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* global JQLitePrototype: true,\n  addEventListenerFn: true,\n  removeEventListenerFn: true,\n  BOOLEAN_ATTR: true,\n  ALIASED_ATTR: true,\n*/\n\n//////////////////////////////////\n//JQLite\n//////////////////////////////////\n\n/**\n * @ngdoc function\n * @name angular.element\n * @module ng\n * @kind function\n *\n * @description\n * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.\n *\n * If jQuery is available, `angular.element` is an alias for the\n * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`\n * delegates to Angular's built-in subset of jQuery, called \"jQuery lite\" or **jqLite**.\n *\n * jqLite is a tiny, API-compatible subset of jQuery that allows\n * Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most\n * commonly needed functionality with the goal of having a very small footprint.\n *\n * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the\n * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a\n * specific version of jQuery if multiple versions exist on the page.\n *\n * <div class=\"alert alert-info\">**Note:** All element references in Angular are always wrapped with jQuery or\n * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>\n *\n * <div class=\"alert alert-warning\">**Note:** Keep in mind that this function will not find elements\n * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`\n * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>\n *\n * ## Angular's jqLite\n * jqLite provides only the following jQuery methods:\n *\n * - [`addClass()`](http://api.jquery.com/addClass/)\n * - [`after()`](http://api.jquery.com/after/)\n * - [`append()`](http://api.jquery.com/append/)\n * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters\n * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData\n * - [`children()`](http://api.jquery.com/children/) - Does not support selectors\n * - [`clone()`](http://api.jquery.com/clone/)\n * - [`contents()`](http://api.jquery.com/contents/)\n * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`.\n *   As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.\n * - [`data()`](http://api.jquery.com/data/)\n * - [`detach()`](http://api.jquery.com/detach/)\n * - [`empty()`](http://api.jquery.com/empty/)\n * - [`eq()`](http://api.jquery.com/eq/)\n * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name\n * - [`hasClass()`](http://api.jquery.com/hasClass/)\n * - [`html()`](http://api.jquery.com/html/)\n * - [`next()`](http://api.jquery.com/next/) - Does not support selectors\n * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData\n * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter\n * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors\n * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors\n * - [`prepend()`](http://api.jquery.com/prepend/)\n * - [`prop()`](http://api.jquery.com/prop/)\n * - [`ready()`](http://api.jquery.com/ready/)\n * - [`remove()`](http://api.jquery.com/remove/)\n * - [`removeAttr()`](http://api.jquery.com/removeAttr/)\n * - [`removeClass()`](http://api.jquery.com/removeClass/)\n * - [`removeData()`](http://api.jquery.com/removeData/)\n * - [`replaceWith()`](http://api.jquery.com/replaceWith/)\n * - [`text()`](http://api.jquery.com/text/)\n * - [`toggleClass()`](http://api.jquery.com/toggleClass/)\n * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.\n * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter\n * - [`val()`](http://api.jquery.com/val/)\n * - [`wrap()`](http://api.jquery.com/wrap/)\n *\n * ## jQuery/jqLite Extras\n * Angular also provides the following additional methods and events to both jQuery and jqLite:\n *\n * ### Events\n * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event\n *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM\n *    element before it is removed.\n *\n * ### Methods\n * - `controller(name)` - retrieves the controller of the current element or its parent. By default\n *   retrieves controller associated with the `ngController` directive. If `name` is provided as\n *   camelCase directive name, then the controller for this directive will be retrieved (e.g.\n *   `'ngModel'`).\n * - `injector()` - retrieves the injector of the current element or its parent.\n * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current\n *   element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to\n *   be enabled.\n * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the\n *   current element. This getter should be used only on elements that contain a directive which starts a new isolate\n *   scope. Calling `scope()` on this element always returns the original non-isolate scope.\n *   Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.\n * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top\n *   parent element is reached.\n *\n * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.\n * @returns {Object} jQuery object.\n */\n\nJQLite.expando = 'ng339';\n\nvar jqCache = JQLite.cache = {},\n    jqId = 1,\n    addEventListenerFn = function(element, type, fn) {\n      element.addEventListener(type, fn, false);\n    },\n    removeEventListenerFn = function(element, type, fn) {\n      element.removeEventListener(type, fn, false);\n    };\n\n/*\n * !!! This is an undocumented \"private\" function !!!\n */\nJQLite._data = function(node) {\n  //jQuery always returns an object on cache miss\n  return this.cache[node[this.expando]] || {};\n};\n\nfunction jqNextId() { return ++jqId; }\n\n\nvar SPECIAL_CHARS_REGEXP = /([\\:\\-\\_]+(.))/g;\nvar MOZ_HACK_REGEXP = /^moz([A-Z])/;\nvar MOUSE_EVENT_MAP= { mouseleave: \"mouseout\", mouseenter: \"mouseover\"};\nvar jqLiteMinErr = minErr('jqLite');\n\n/**\n * Converts snake_case to camelCase.\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction camelCase(name) {\n  return name.\n    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {\n      return offset ? letter.toUpperCase() : letter;\n    }).\n    replace(MOZ_HACK_REGEXP, 'Moz$1');\n}\n\nvar SINGLE_TAG_REGEXP = /^<([\\w-]+)\\s*\\/?>(?:<\\/\\1>|)$/;\nvar HTML_REGEXP = /<|&#?\\w+;/;\nvar TAG_NAME_REGEXP = /<([\\w:-]+)/;\nvar XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^>]*)\\/>/gi;\n\nvar wrapMap = {\n  'option': [1, '<select multiple=\"multiple\">', '</select>'],\n\n  'thead': [1, '<table>', '</table>'],\n  'col': [2, '<table><colgroup>', '</colgroup></table>'],\n  'tr': [2, '<table><tbody>', '</tbody></table>'],\n  'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n  '_default': [0, \"\", \"\"]\n};\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n\nfunction jqLiteIsTextNode(html) {\n  return !HTML_REGEXP.test(html);\n}\n\nfunction jqLiteAcceptsData(node) {\n  // The window object can accept data but has no nodeType\n  // Otherwise we are only interested in elements (1) and documents (9)\n  var nodeType = node.nodeType;\n  return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;\n}\n\nfunction jqLiteHasData(node) {\n  for (var key in jqCache[node.ng339]) {\n    return true;\n  }\n  return false;\n}\n\nfunction jqLiteCleanData(nodes) {\n  for (var i = 0, ii = nodes.length; i < ii; i++) {\n    jqLiteRemoveData(nodes[i]);\n  }\n}\n\nfunction jqLiteBuildFragment(html, context) {\n  var tmp, tag, wrap,\n      fragment = context.createDocumentFragment(),\n      nodes = [], i;\n\n  if (jqLiteIsTextNode(html)) {\n    // Convert non-html into a text node\n    nodes.push(context.createTextNode(html));\n  } else {\n    // Convert html into DOM nodes\n    tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n    tag = (TAG_NAME_REGEXP.exec(html) || [\"\", \"\"])[1].toLowerCase();\n    wrap = wrapMap[tag] || wrapMap._default;\n    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, \"<$1></$2>\") + wrap[2];\n\n    // Descend through wrappers to the right content\n    i = wrap[0];\n    while (i--) {\n      tmp = tmp.lastChild;\n    }\n\n    nodes = concat(nodes, tmp.childNodes);\n\n    tmp = fragment.firstChild;\n    tmp.textContent = \"\";\n  }\n\n  // Remove wrapper from fragment\n  fragment.textContent = \"\";\n  fragment.innerHTML = \"\"; // Clear inner HTML\n  forEach(nodes, function(node) {\n    fragment.appendChild(node);\n  });\n\n  return fragment;\n}\n\nfunction jqLiteParseHTML(html, context) {\n  context = context || document;\n  var parsed;\n\n  if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {\n    return [context.createElement(parsed[1])];\n  }\n\n  if ((parsed = jqLiteBuildFragment(html, context))) {\n    return parsed.childNodes;\n  }\n\n  return [];\n}\n\nfunction jqLiteWrapNode(node, wrapper) {\n  var parent = node.parentNode;\n\n  if (parent) {\n    parent.replaceChild(wrapper, node);\n  }\n\n  wrapper.appendChild(node);\n}\n\n\n// IE9-11 has no method \"contains\" in SVG element and in Node.prototype. Bug #10259.\nvar jqLiteContains = Node.prototype.contains || function(arg) {\n  // jshint bitwise: false\n  return !!(this.compareDocumentPosition(arg) & 16);\n  // jshint bitwise: true\n};\n\n/////////////////////////////////////////////\nfunction JQLite(element) {\n  if (element instanceof JQLite) {\n    return element;\n  }\n\n  var argIsString;\n\n  if (isString(element)) {\n    element = trim(element);\n    argIsString = true;\n  }\n  if (!(this instanceof JQLite)) {\n    if (argIsString && element.charAt(0) != '<') {\n      throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');\n    }\n    return new JQLite(element);\n  }\n\n  if (argIsString) {\n    jqLiteAddNodes(this, jqLiteParseHTML(element));\n  } else {\n    jqLiteAddNodes(this, element);\n  }\n}\n\nfunction jqLiteClone(element) {\n  return element.cloneNode(true);\n}\n\nfunction jqLiteDealoc(element, onlyDescendants) {\n  if (!onlyDescendants) jqLiteRemoveData(element);\n\n  if (element.querySelectorAll) {\n    var descendants = element.querySelectorAll('*');\n    for (var i = 0, l = descendants.length; i < l; i++) {\n      jqLiteRemoveData(descendants[i]);\n    }\n  }\n}\n\nfunction jqLiteOff(element, type, fn, unsupported) {\n  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');\n\n  var expandoStore = jqLiteExpandoStore(element);\n  var events = expandoStore && expandoStore.events;\n  var handle = expandoStore && expandoStore.handle;\n\n  if (!handle) return; //no listeners registered\n\n  if (!type) {\n    for (type in events) {\n      if (type !== '$destroy') {\n        removeEventListenerFn(element, type, handle);\n      }\n      delete events[type];\n    }\n  } else {\n\n    var removeHandler = function(type) {\n      var listenerFns = events[type];\n      if (isDefined(fn)) {\n        arrayRemove(listenerFns || [], fn);\n      }\n      if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {\n        removeEventListenerFn(element, type, handle);\n        delete events[type];\n      }\n    };\n\n    forEach(type.split(' '), function(type) {\n      removeHandler(type);\n      if (MOUSE_EVENT_MAP[type]) {\n        removeHandler(MOUSE_EVENT_MAP[type]);\n      }\n    });\n  }\n}\n\nfunction jqLiteRemoveData(element, name) {\n  var expandoId = element.ng339;\n  var expandoStore = expandoId && jqCache[expandoId];\n\n  if (expandoStore) {\n    if (name) {\n      delete expandoStore.data[name];\n      return;\n    }\n\n    if (expandoStore.handle) {\n      if (expandoStore.events.$destroy) {\n        expandoStore.handle({}, '$destroy');\n      }\n      jqLiteOff(element);\n    }\n    delete jqCache[expandoId];\n    element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it\n  }\n}\n\n\nfunction jqLiteExpandoStore(element, createIfNecessary) {\n  var expandoId = element.ng339,\n      expandoStore = expandoId && jqCache[expandoId];\n\n  if (createIfNecessary && !expandoStore) {\n    element.ng339 = expandoId = jqNextId();\n    expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};\n  }\n\n  return expandoStore;\n}\n\n\nfunction jqLiteData(element, key, value) {\n  if (jqLiteAcceptsData(element)) {\n\n    var isSimpleSetter = isDefined(value);\n    var isSimpleGetter = !isSimpleSetter && key && !isObject(key);\n    var massGetter = !key;\n    var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);\n    var data = expandoStore && expandoStore.data;\n\n    if (isSimpleSetter) { // data('key', value)\n      data[key] = value;\n    } else {\n      if (massGetter) {  // data()\n        return data;\n      } else {\n        if (isSimpleGetter) { // data('key')\n          // don't force creation of expandoStore if it doesn't exist yet\n          return data && data[key];\n        } else { // mass-setter: data({key1: val1, key2: val2})\n          extend(data, key);\n        }\n      }\n    }\n  }\n}\n\nfunction jqLiteHasClass(element, selector) {\n  if (!element.getAttribute) return false;\n  return ((\" \" + (element.getAttribute('class') || '') + \" \").replace(/[\\n\\t]/g, \" \").\n      indexOf(\" \" + selector + \" \") > -1);\n}\n\nfunction jqLiteRemoveClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    forEach(cssClasses.split(' '), function(cssClass) {\n      element.setAttribute('class', trim(\n          (\" \" + (element.getAttribute('class') || '') + \" \")\n          .replace(/[\\n\\t]/g, \" \")\n          .replace(\" \" + trim(cssClass) + \" \", \" \"))\n      );\n    });\n  }\n}\n\nfunction jqLiteAddClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')\n                            .replace(/[\\n\\t]/g, \" \");\n\n    forEach(cssClasses.split(' '), function(cssClass) {\n      cssClass = trim(cssClass);\n      if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n        existingClasses += cssClass + ' ';\n      }\n    });\n\n    element.setAttribute('class', trim(existingClasses));\n  }\n}\n\n\nfunction jqLiteAddNodes(root, elements) {\n  // THIS CODE IS VERY HOT. Don't make changes without benchmarking.\n\n  if (elements) {\n\n    // if a Node (the most common case)\n    if (elements.nodeType) {\n      root[root.length++] = elements;\n    } else {\n      var length = elements.length;\n\n      // if an Array or NodeList and not a Window\n      if (typeof length === 'number' && elements.window !== elements) {\n        if (length) {\n          for (var i = 0; i < length; i++) {\n            root[root.length++] = elements[i];\n          }\n        }\n      } else {\n        root[root.length++] = elements;\n      }\n    }\n  }\n}\n\n\nfunction jqLiteController(element, name) {\n  return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');\n}\n\nfunction jqLiteInheritedData(element, name, value) {\n  // if element is the document object work with the html element instead\n  // this makes $(document).scope() possible\n  if (element.nodeType == NODE_TYPE_DOCUMENT) {\n    element = element.documentElement;\n  }\n  var names = isArray(name) ? name : [name];\n\n  while (element) {\n    for (var i = 0, ii = names.length; i < ii; i++) {\n      if (isDefined(value = jqLite.data(element, names[i]))) return value;\n    }\n\n    // If dealing with a document fragment node with a host element, and no parent, use the host\n    // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM\n    // to lookup parent controllers.\n    element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);\n  }\n}\n\nfunction jqLiteEmpty(element) {\n  jqLiteDealoc(element, true);\n  while (element.firstChild) {\n    element.removeChild(element.firstChild);\n  }\n}\n\nfunction jqLiteRemove(element, keepData) {\n  if (!keepData) jqLiteDealoc(element);\n  var parent = element.parentNode;\n  if (parent) parent.removeChild(element);\n}\n\n\nfunction jqLiteDocumentLoaded(action, win) {\n  win = win || window;\n  if (win.document.readyState === 'complete') {\n    // Force the action to be run async for consistent behavior\n    // from the action's point of view\n    // i.e. it will definitely not be in a $apply\n    win.setTimeout(action);\n  } else {\n    // No need to unbind this handler as load is only ever called once\n    jqLite(win).on('load', action);\n  }\n}\n\n//////////////////////////////////////////\n// Functions which are declared directly.\n//////////////////////////////////////////\nvar JQLitePrototype = JQLite.prototype = {\n  ready: function(fn) {\n    var fired = false;\n\n    function trigger() {\n      if (fired) return;\n      fired = true;\n      fn();\n    }\n\n    // check if document is already loaded\n    if (document.readyState === 'complete') {\n      setTimeout(trigger);\n    } else {\n      this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9\n      // we can not use jqLite since we are not done loading and jQuery could be loaded later.\n      // jshint -W064\n      JQLite(window).on('load', trigger); // fallback to window.onload for others\n      // jshint +W064\n    }\n  },\n  toString: function() {\n    var value = [];\n    forEach(this, function(e) { value.push('' + e);});\n    return '[' + value.join(', ') + ']';\n  },\n\n  eq: function(index) {\n      return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);\n  },\n\n  length: 0,\n  push: push,\n  sort: [].sort,\n  splice: [].splice\n};\n\n//////////////////////////////////////////\n// Functions iterating getter/setters.\n// these functions return self on setter and\n// value on get.\n//////////////////////////////////////////\nvar BOOLEAN_ATTR = {};\nforEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {\n  BOOLEAN_ATTR[lowercase(value)] = value;\n});\nvar BOOLEAN_ELEMENTS = {};\nforEach('input,select,option,textarea,button,form,details'.split(','), function(value) {\n  BOOLEAN_ELEMENTS[value] = true;\n});\nvar ALIASED_ATTR = {\n  'ngMinlength': 'minlength',\n  'ngMaxlength': 'maxlength',\n  'ngMin': 'min',\n  'ngMax': 'max',\n  'ngPattern': 'pattern'\n};\n\nfunction getBooleanAttrName(element, name) {\n  // check dom last since we will most likely fail on name\n  var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];\n\n  // booleanAttr is here twice to minimize DOM access\n  return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;\n}\n\nfunction getAliasedAttrName(name) {\n  return ALIASED_ATTR[name];\n}\n\nforEach({\n  data: jqLiteData,\n  removeData: jqLiteRemoveData,\n  hasData: jqLiteHasData,\n  cleanData: jqLiteCleanData\n}, function(fn, name) {\n  JQLite[name] = fn;\n});\n\nforEach({\n  data: jqLiteData,\n  inheritedData: jqLiteInheritedData,\n\n  scope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);\n  },\n\n  isolateScope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');\n  },\n\n  controller: jqLiteController,\n\n  injector: function(element) {\n    return jqLiteInheritedData(element, '$injector');\n  },\n\n  removeAttr: function(element, name) {\n    element.removeAttribute(name);\n  },\n\n  hasClass: jqLiteHasClass,\n\n  css: function(element, name, value) {\n    name = camelCase(name);\n\n    if (isDefined(value)) {\n      element.style[name] = value;\n    } else {\n      return element.style[name];\n    }\n  },\n\n  attr: function(element, name, value) {\n    var nodeType = element.nodeType;\n    if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {\n      return;\n    }\n    var lowercasedName = lowercase(name);\n    if (BOOLEAN_ATTR[lowercasedName]) {\n      if (isDefined(value)) {\n        if (!!value) {\n          element[name] = true;\n          element.setAttribute(name, lowercasedName);\n        } else {\n          element[name] = false;\n          element.removeAttribute(lowercasedName);\n        }\n      } else {\n        return (element[name] ||\n                 (element.attributes.getNamedItem(name) || noop).specified)\n               ? lowercasedName\n               : undefined;\n      }\n    } else if (isDefined(value)) {\n      element.setAttribute(name, value);\n    } else if (element.getAttribute) {\n      // the extra argument \"2\" is to get the right thing for a.href in IE, see jQuery code\n      // some elements (e.g. Document) don't have get attribute, so return undefined\n      var ret = element.getAttribute(name, 2);\n      // normalize non-existing attributes to undefined (as jQuery)\n      return ret === null ? undefined : ret;\n    }\n  },\n\n  prop: function(element, name, value) {\n    if (isDefined(value)) {\n      element[name] = value;\n    } else {\n      return element[name];\n    }\n  },\n\n  text: (function() {\n    getText.$dv = '';\n    return getText;\n\n    function getText(element, value) {\n      if (isUndefined(value)) {\n        var nodeType = element.nodeType;\n        return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';\n      }\n      element.textContent = value;\n    }\n  })(),\n\n  val: function(element, value) {\n    if (isUndefined(value)) {\n      if (element.multiple && nodeName_(element) === 'select') {\n        var result = [];\n        forEach(element.options, function(option) {\n          if (option.selected) {\n            result.push(option.value || option.text);\n          }\n        });\n        return result.length === 0 ? null : result;\n      }\n      return element.value;\n    }\n    element.value = value;\n  },\n\n  html: function(element, value) {\n    if (isUndefined(value)) {\n      return element.innerHTML;\n    }\n    jqLiteDealoc(element, true);\n    element.innerHTML = value;\n  },\n\n  empty: jqLiteEmpty\n}, function(fn, name) {\n  /**\n   * Properties: writes return selection, reads return first value\n   */\n  JQLite.prototype[name] = function(arg1, arg2) {\n    var i, key;\n    var nodeCount = this.length;\n\n    // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it\n    // in a way that survives minification.\n    // jqLiteEmpty takes no arguments but is a setter.\n    if (fn !== jqLiteEmpty &&\n        (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {\n      if (isObject(arg1)) {\n\n        // we are a write, but the object properties are the key/values\n        for (i = 0; i < nodeCount; i++) {\n          if (fn === jqLiteData) {\n            // data() takes the whole object in jQuery\n            fn(this[i], arg1);\n          } else {\n            for (key in arg1) {\n              fn(this[i], key, arg1[key]);\n            }\n          }\n        }\n        // return self for chaining\n        return this;\n      } else {\n        // we are a read, so read the first child.\n        // TODO: do we still need this?\n        var value = fn.$dv;\n        // Only if we have $dv do we iterate over all, otherwise it is just the first element.\n        var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;\n        for (var j = 0; j < jj; j++) {\n          var nodeValue = fn(this[j], arg1, arg2);\n          value = value ? value + nodeValue : nodeValue;\n        }\n        return value;\n      }\n    } else {\n      // we are a write, so apply to all children\n      for (i = 0; i < nodeCount; i++) {\n        fn(this[i], arg1, arg2);\n      }\n      // return self for chaining\n      return this;\n    }\n  };\n});\n\nfunction createEventHandler(element, events) {\n  var eventHandler = function(event, type) {\n    // jQuery specific api\n    event.isDefaultPrevented = function() {\n      return event.defaultPrevented;\n    };\n\n    var eventFns = events[type || event.type];\n    var eventFnsLength = eventFns ? eventFns.length : 0;\n\n    if (!eventFnsLength) return;\n\n    if (isUndefined(event.immediatePropagationStopped)) {\n      var originalStopImmediatePropagation = event.stopImmediatePropagation;\n      event.stopImmediatePropagation = function() {\n        event.immediatePropagationStopped = true;\n\n        if (event.stopPropagation) {\n          event.stopPropagation();\n        }\n\n        if (originalStopImmediatePropagation) {\n          originalStopImmediatePropagation.call(event);\n        }\n      };\n    }\n\n    event.isImmediatePropagationStopped = function() {\n      return event.immediatePropagationStopped === true;\n    };\n\n    // Some events have special handlers that wrap the real handler\n    var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;\n\n    // Copy event handlers in case event handlers array is modified during execution.\n    if ((eventFnsLength > 1)) {\n      eventFns = shallowCopy(eventFns);\n    }\n\n    for (var i = 0; i < eventFnsLength; i++) {\n      if (!event.isImmediatePropagationStopped()) {\n        handlerWrapper(element, event, eventFns[i]);\n      }\n    }\n  };\n\n  // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all\n  //       events on `element`\n  eventHandler.elem = element;\n  return eventHandler;\n}\n\nfunction defaultHandlerWrapper(element, event, handler) {\n  handler.call(element, event);\n}\n\nfunction specialMouseHandlerWrapper(target, event, handler) {\n  // Refer to jQuery's implementation of mouseenter & mouseleave\n  // Read about mouseenter and mouseleave:\n  // http://www.quirksmode.org/js/events_mouse.html#link8\n  var related = event.relatedTarget;\n  // For mousenter/leave call the handler if related is outside the target.\n  // NB: No relatedTarget if the mouse left/entered the browser window\n  if (!related || (related !== target && !jqLiteContains.call(target, related))) {\n    handler.call(target, event);\n  }\n}\n\n//////////////////////////////////////////\n// Functions iterating traversal.\n// These functions chain results into a single\n// selector.\n//////////////////////////////////////////\nforEach({\n  removeData: jqLiteRemoveData,\n\n  on: function jqLiteOn(element, type, fn, unsupported) {\n    if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');\n\n    // Do not add event handlers to non-elements because they will not be cleaned up.\n    if (!jqLiteAcceptsData(element)) {\n      return;\n    }\n\n    var expandoStore = jqLiteExpandoStore(element, true);\n    var events = expandoStore.events;\n    var handle = expandoStore.handle;\n\n    if (!handle) {\n      handle = expandoStore.handle = createEventHandler(element, events);\n    }\n\n    // http://jsperf.com/string-indexof-vs-split\n    var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];\n    var i = types.length;\n\n    var addHandler = function(type, specialHandlerWrapper, noEventListener) {\n      var eventFns = events[type];\n\n      if (!eventFns) {\n        eventFns = events[type] = [];\n        eventFns.specialHandlerWrapper = specialHandlerWrapper;\n        if (type !== '$destroy' && !noEventListener) {\n          addEventListenerFn(element, type, handle);\n        }\n      }\n\n      eventFns.push(fn);\n    };\n\n    while (i--) {\n      type = types[i];\n      if (MOUSE_EVENT_MAP[type]) {\n        addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);\n        addHandler(type, undefined, true);\n      } else {\n        addHandler(type);\n      }\n    }\n  },\n\n  off: jqLiteOff,\n\n  one: function(element, type, fn) {\n    element = jqLite(element);\n\n    //add the listener twice so that when it is called\n    //you can remove the original function and still be\n    //able to call element.off(ev, fn) normally\n    element.on(type, function onFn() {\n      element.off(type, fn);\n      element.off(type, onFn);\n    });\n    element.on(type, fn);\n  },\n\n  replaceWith: function(element, replaceNode) {\n    var index, parent = element.parentNode;\n    jqLiteDealoc(element);\n    forEach(new JQLite(replaceNode), function(node) {\n      if (index) {\n        parent.insertBefore(node, index.nextSibling);\n      } else {\n        parent.replaceChild(node, element);\n      }\n      index = node;\n    });\n  },\n\n  children: function(element) {\n    var children = [];\n    forEach(element.childNodes, function(element) {\n      if (element.nodeType === NODE_TYPE_ELEMENT) {\n        children.push(element);\n      }\n    });\n    return children;\n  },\n\n  contents: function(element) {\n    return element.contentDocument || element.childNodes || [];\n  },\n\n  append: function(element, node) {\n    var nodeType = element.nodeType;\n    if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;\n\n    node = new JQLite(node);\n\n    for (var i = 0, ii = node.length; i < ii; i++) {\n      var child = node[i];\n      element.appendChild(child);\n    }\n  },\n\n  prepend: function(element, node) {\n    if (element.nodeType === NODE_TYPE_ELEMENT) {\n      var index = element.firstChild;\n      forEach(new JQLite(node), function(child) {\n        element.insertBefore(child, index);\n      });\n    }\n  },\n\n  wrap: function(element, wrapNode) {\n    jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);\n  },\n\n  remove: jqLiteRemove,\n\n  detach: function(element) {\n    jqLiteRemove(element, true);\n  },\n\n  after: function(element, newElement) {\n    var index = element, parent = element.parentNode;\n    newElement = new JQLite(newElement);\n\n    for (var i = 0, ii = newElement.length; i < ii; i++) {\n      var node = newElement[i];\n      parent.insertBefore(node, index.nextSibling);\n      index = node;\n    }\n  },\n\n  addClass: jqLiteAddClass,\n  removeClass: jqLiteRemoveClass,\n\n  toggleClass: function(element, selector, condition) {\n    if (selector) {\n      forEach(selector.split(' '), function(className) {\n        var classCondition = condition;\n        if (isUndefined(classCondition)) {\n          classCondition = !jqLiteHasClass(element, className);\n        }\n        (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);\n      });\n    }\n  },\n\n  parent: function(element) {\n    var parent = element.parentNode;\n    return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;\n  },\n\n  next: function(element) {\n    return element.nextElementSibling;\n  },\n\n  find: function(element, selector) {\n    if (element.getElementsByTagName) {\n      return element.getElementsByTagName(selector);\n    } else {\n      return [];\n    }\n  },\n\n  clone: jqLiteClone,\n\n  triggerHandler: function(element, event, extraParameters) {\n\n    var dummyEvent, eventFnsCopy, handlerArgs;\n    var eventName = event.type || event;\n    var expandoStore = jqLiteExpandoStore(element);\n    var events = expandoStore && expandoStore.events;\n    var eventFns = events && events[eventName];\n\n    if (eventFns) {\n      // Create a dummy event to pass to the handlers\n      dummyEvent = {\n        preventDefault: function() { this.defaultPrevented = true; },\n        isDefaultPrevented: function() { return this.defaultPrevented === true; },\n        stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },\n        isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },\n        stopPropagation: noop,\n        type: eventName,\n        target: element\n      };\n\n      // If a custom event was provided then extend our dummy event with it\n      if (event.type) {\n        dummyEvent = extend(dummyEvent, event);\n      }\n\n      // Copy event handlers in case event handlers array is modified during execution.\n      eventFnsCopy = shallowCopy(eventFns);\n      handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];\n\n      forEach(eventFnsCopy, function(fn) {\n        if (!dummyEvent.isImmediatePropagationStopped()) {\n          fn.apply(element, handlerArgs);\n        }\n      });\n    }\n  }\n}, function(fn, name) {\n  /**\n   * chaining functions\n   */\n  JQLite.prototype[name] = function(arg1, arg2, arg3) {\n    var value;\n\n    for (var i = 0, ii = this.length; i < ii; i++) {\n      if (isUndefined(value)) {\n        value = fn(this[i], arg1, arg2, arg3);\n        if (isDefined(value)) {\n          // any function which returns a value needs to be wrapped\n          value = jqLite(value);\n        }\n      } else {\n        jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));\n      }\n    }\n    return isDefined(value) ? value : this;\n  };\n\n  // bind legacy bind/unbind to on/off\n  JQLite.prototype.bind = JQLite.prototype.on;\n  JQLite.prototype.unbind = JQLite.prototype.off;\n});\n\n\n// Provider for private $$jqLite service\nfunction $$jqLiteProvider() {\n  this.$get = function $$jqLite() {\n    return extend(JQLite, {\n      hasClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteHasClass(node, classes);\n      },\n      addClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteAddClass(node, classes);\n      },\n      removeClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteRemoveClass(node, classes);\n      }\n    });\n  };\n}\n\n/**\n * Computes a hash of an 'obj'.\n * Hash of a:\n *  string is string\n *  number is number as string\n *  object is either result of calling $$hashKey function on the object or uniquely generated id,\n *         that is also assigned to the $$hashKey property of the object.\n *\n * @param obj\n * @returns {string} hash string such that the same input will have the same hash string.\n *         The resulting string key is in 'type:hashKey' format.\n */\nfunction hashKey(obj, nextUidFn) {\n  var key = obj && obj.$$hashKey;\n\n  if (key) {\n    if (typeof key === 'function') {\n      key = obj.$$hashKey();\n    }\n    return key;\n  }\n\n  var objType = typeof obj;\n  if (objType == 'function' || (objType == 'object' && obj !== null)) {\n    key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();\n  } else {\n    key = objType + ':' + obj;\n  }\n\n  return key;\n}\n\n/**\n * HashMap which can use objects as keys\n */\nfunction HashMap(array, isolatedUid) {\n  if (isolatedUid) {\n    var uid = 0;\n    this.nextUid = function() {\n      return ++uid;\n    };\n  }\n  forEach(array, this.put, this);\n}\nHashMap.prototype = {\n  /**\n   * Store key value pair\n   * @param key key to store can be any type\n   * @param value value to store can be any type\n   */\n  put: function(key, value) {\n    this[hashKey(key, this.nextUid)] = value;\n  },\n\n  /**\n   * @param key\n   * @returns {Object} the value for the key\n   */\n  get: function(key) {\n    return this[hashKey(key, this.nextUid)];\n  },\n\n  /**\n   * Remove the key/value pair\n   * @param key\n   */\n  remove: function(key) {\n    var value = this[key = hashKey(key, this.nextUid)];\n    delete this[key];\n    return value;\n  }\n};\n\nvar $$HashMapProvider = [function() {\n  this.$get = [function() {\n    return HashMap;\n  }];\n}];\n\n/**\n * @ngdoc function\n * @module ng\n * @name angular.injector\n * @kind function\n *\n * @description\n * Creates an injector object that can be used for retrieving services as well as for\n * dependency injection (see {@link guide/di dependency injection}).\n *\n * @param {Array.<string|Function>} modules A list of module functions or their aliases. See\n *     {@link angular.module}. The `ng` module must be explicitly added.\n * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which\n *     disallows argument name annotation inference.\n * @returns {injector} Injector object. See {@link auto.$injector $injector}.\n *\n * @example\n * Typical usage\n * ```js\n *   // create an injector\n *   var $injector = angular.injector(['ng']);\n *\n *   // use the injector to kick off your application\n *   // use the type inference to auto inject arguments, or use implicit injection\n *   $injector.invoke(function($rootScope, $compile, $document) {\n *     $compile($document)($rootScope);\n *     $rootScope.$digest();\n *   });\n * ```\n *\n * Sometimes you want to get access to the injector of a currently running Angular app\n * from outside Angular. Perhaps, you want to inject and compile some markup after the\n * application has been bootstrapped. You can do this using the extra `injector()` added\n * to JQuery/jqLite elements. See {@link angular.element}.\n *\n * *This is fairly rare but could be the case if a third party library is injecting the\n * markup.*\n *\n * In the following example a new block of HTML containing a `ng-controller`\n * directive is added to the end of the document body by JQuery. We then compile and link\n * it into the current AngularJS scope.\n *\n * ```js\n * var $div = $('<div ng-controller=\"MyCtrl\">{{content.label}}</div>');\n * $(document.body).append($div);\n *\n * angular.element(document).injector().invoke(function($compile) {\n *   var scope = angular.element($div).scope();\n *   $compile($div)(scope);\n * });\n * ```\n */\n\n\n/**\n * @ngdoc module\n * @name auto\n * @description\n *\n * Implicit module which gets automatically added to each {@link auto.$injector $injector}.\n */\n\nvar ARROW_ARG = /^([^\\(]+?)=>/;\nvar FN_ARGS = /^[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar FN_ARG_SPLIT = /,/;\nvar FN_ARG = /^\\s*(_?)(\\S+?)\\1\\s*$/;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nvar $injectorMinErr = minErr('$injector');\n\nfunction extractArgs(fn) {\n  var fnText = fn.toString().replace(STRIP_COMMENTS, ''),\n      args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);\n  return args;\n}\n\nfunction anonFn(fn) {\n  // For anonymous functions, showing at the very least the function signature can help in\n  // debugging.\n  var args = extractArgs(fn);\n  if (args) {\n    return 'function(' + (args[1] || '').replace(/[\\s\\r\\n]+/, ' ') + ')';\n  }\n  return 'fn';\n}\n\nfunction annotate(fn, strictDi, name) {\n  var $inject,\n      argDecl,\n      last;\n\n  if (typeof fn === 'function') {\n    if (!($inject = fn.$inject)) {\n      $inject = [];\n      if (fn.length) {\n        if (strictDi) {\n          if (!isString(name) || !name) {\n            name = fn.name || anonFn(fn);\n          }\n          throw $injectorMinErr('strictdi',\n            '{0} is not using explicit annotation and cannot be invoked in strict mode', name);\n        }\n        argDecl = extractArgs(fn);\n        forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {\n          arg.replace(FN_ARG, function(all, underscore, name) {\n            $inject.push(name);\n          });\n        });\n      }\n      fn.$inject = $inject;\n    }\n  } else if (isArray(fn)) {\n    last = fn.length - 1;\n    assertArgFn(fn[last], 'fn');\n    $inject = fn.slice(0, last);\n  } else {\n    assertArgFn(fn, 'fn', true);\n  }\n  return $inject;\n}\n\n///////////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $injector\n *\n * @description\n *\n * `$injector` is used to retrieve object instances as defined by\n * {@link auto.$provide provider}, instantiate types, invoke methods,\n * and load modules.\n *\n * The following always holds true:\n *\n * ```js\n *   var $injector = angular.injector();\n *   expect($injector.get('$injector')).toBe($injector);\n *   expect($injector.invoke(function($injector) {\n *     return $injector;\n *   })).toBe($injector);\n * ```\n *\n * # Injection Function Annotation\n *\n * JavaScript does not have annotations, and annotations are needed for dependency injection. The\n * following are all valid ways of annotating function with injection arguments and are equivalent.\n *\n * ```js\n *   // inferred (only works if code not minified/obfuscated)\n *   $injector.invoke(function(serviceA){});\n *\n *   // annotated\n *   function explicit(serviceA) {};\n *   explicit.$inject = ['serviceA'];\n *   $injector.invoke(explicit);\n *\n *   // inline\n *   $injector.invoke(['serviceA', function(serviceA){}]);\n * ```\n *\n * ## Inference\n *\n * In JavaScript calling `toString()` on a function returns the function definition. The definition\n * can then be parsed and the function arguments can be extracted. This method of discovering\n * annotations is disallowed when the injector is in strict mode.\n * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the\n * argument names.\n *\n * ## `$inject` Annotation\n * By adding an `$inject` property onto a function the injection parameters can be specified.\n *\n * ## Inline\n * As an array of injection names, where the last item in the array is the function to call.\n */\n\n/**\n * @ngdoc method\n * @name $injector#get\n *\n * @description\n * Return an instance of the service.\n *\n * @param {string} name The name of the instance to retrieve.\n * @param {string=} caller An optional string to provide the origin of the function call for error messages.\n * @return {*} The instance.\n */\n\n/**\n * @ngdoc method\n * @name $injector#invoke\n *\n * @description\n * Invoke the method and supply the method arguments from the `$injector`.\n *\n * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are\n *   injected according to the {@link guide/di $inject Annotation} rules.\n * @param {Object=} self The `this` for the invoked method.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n *                         object first, before the `$injector` is consulted.\n * @returns {*} the value returned by the invoked `fn` function.\n */\n\n/**\n * @ngdoc method\n * @name $injector#has\n *\n * @description\n * Allows the user to query if the particular service exists.\n *\n * @param {string} name Name of the service to query.\n * @returns {boolean} `true` if injector has given service.\n */\n\n/**\n * @ngdoc method\n * @name $injector#instantiate\n * @description\n * Create a new instance of JS type. The method takes a constructor function, invokes the new\n * operator, and supplies all of the arguments to the constructor function as specified by the\n * constructor annotation.\n *\n * @param {Function} Type Annotated constructor function.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n * object first, before the `$injector` is consulted.\n * @returns {Object} new instance of `Type`.\n */\n\n/**\n * @ngdoc method\n * @name $injector#annotate\n *\n * @description\n * Returns an array of service names which the function is requesting for injection. This API is\n * used by the injector to determine which services need to be injected into the function when the\n * function is invoked. There are three ways in which the function can be annotated with the needed\n * dependencies.\n *\n * # Argument names\n *\n * The simplest form is to extract the dependencies from the arguments of the function. This is done\n * by converting the function into a string using `toString()` method and extracting the argument\n * names.\n * ```js\n *   // Given\n *   function MyController($scope, $route) {\n *     // ...\n *   }\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * You can disallow this method by using strict injection mode.\n *\n * This method does not work with code minification / obfuscation. For this reason the following\n * annotation strategies are supported.\n *\n * # The `$inject` property\n *\n * If a function has an `$inject` property and its value is an array of strings, then the strings\n * represent names of services to be injected into the function.\n * ```js\n *   // Given\n *   var MyController = function(obfuscatedScope, obfuscatedRoute) {\n *     // ...\n *   }\n *   // Define function dependencies\n *   MyController['$inject'] = ['$scope', '$route'];\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * # The array notation\n *\n * It is often desirable to inline Injected functions and that's when setting the `$inject` property\n * is very inconvenient. In these situations using the array notation to specify the dependencies in\n * a way that survives minification is a better choice:\n *\n * ```js\n *   // We wish to write this (not minification / obfuscation safe)\n *   injector.invoke(function($compile, $rootScope) {\n *     // ...\n *   });\n *\n *   // We are forced to write break inlining\n *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {\n *     // ...\n *   };\n *   tmpFn.$inject = ['$compile', '$rootScope'];\n *   injector.invoke(tmpFn);\n *\n *   // To better support inline function the inline annotation is supported\n *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {\n *     // ...\n *   }]);\n *\n *   // Therefore\n *   expect(injector.annotate(\n *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])\n *    ).toEqual(['$compile', '$rootScope']);\n * ```\n *\n * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to\n * be retrieved as described above.\n *\n * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.\n *\n * @returns {Array.<string>} The names of the services which the function requires.\n */\n\n\n\n\n/**\n * @ngdoc service\n * @name $provide\n *\n * @description\n *\n * The {@link auto.$provide $provide} service has a number of methods for registering components\n * with the {@link auto.$injector $injector}. Many of these functions are also exposed on\n * {@link angular.Module}.\n *\n * An Angular **service** is a singleton object created by a **service factory**.  These **service\n * factories** are functions which, in turn, are created by a **service provider**.\n * The **service providers** are constructor functions. When instantiated they must contain a\n * property called `$get`, which holds the **service factory** function.\n *\n * When you request a service, the {@link auto.$injector $injector} is responsible for finding the\n * correct **service provider**, instantiating it and then calling its `$get` **service factory**\n * function to get the instance of the **service**.\n *\n * Often services have no configuration options and there is no need to add methods to the service\n * provider.  The provider will be no more than a constructor function with a `$get` property. For\n * these cases the {@link auto.$provide $provide} service has additional helper methods to register\n * services without specifying a provider.\n *\n * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the\n *     {@link auto.$injector $injector}\n * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by\n *     providers and services.\n * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by\n *     services, not providers.\n * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,\n *     that will be wrapped in a **service provider** object, whose `$get` property will contain the\n *     given factory function.\n * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`\n *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate\n *      a new object using the given constructor function.\n *\n * See the individual methods for more information and examples.\n */\n\n/**\n * @ngdoc method\n * @name $provide#provider\n * @description\n *\n * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions\n * are constructor functions, whose instances are responsible for \"providing\" a factory for a\n * service.\n *\n * Service provider names start with the name of the service they provide followed by `Provider`.\n * For example, the {@link ng.$log $log} service has a provider called\n * {@link ng.$logProvider $logProvider}.\n *\n * Service provider objects can have additional methods which allow configuration of the provider\n * and its service. Importantly, you can configure what kind of service is created by the `$get`\n * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a\n * method {@link ng.$logProvider#debugEnabled debugEnabled}\n * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the\n * console or not.\n *\n * @param {string} name The name of the instance. NOTE: the provider will be available under `name +\n                        'Provider'` key.\n * @param {(Object|function())} provider If the provider is:\n *\n *   - `Object`: then it should have a `$get` method. The `$get` method will be invoked using\n *     {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.\n *   - `Constructor`: a new instance of the provider will be created using\n *     {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.\n *\n * @returns {Object} registered provider instance\n\n * @example\n *\n * The following example shows how to create a simple event tracking service and register it using\n * {@link auto.$provide#provider $provide.provider()}.\n *\n * ```js\n *  // Define the eventTracker provider\n *  function EventTrackerProvider() {\n *    var trackingUrl = '/track';\n *\n *    // A provider method for configuring where the tracked events should been saved\n *    this.setTrackingUrl = function(url) {\n *      trackingUrl = url;\n *    };\n *\n *    // The service factory function\n *    this.$get = ['$http', function($http) {\n *      var trackedEvents = {};\n *      return {\n *        // Call this to track an event\n *        event: function(event) {\n *          var count = trackedEvents[event] || 0;\n *          count += 1;\n *          trackedEvents[event] = count;\n *          return count;\n *        },\n *        // Call this to save the tracked events to the trackingUrl\n *        save: function() {\n *          $http.post(trackingUrl, trackedEvents);\n *        }\n *      };\n *    }];\n *  }\n *\n *  describe('eventTracker', function() {\n *    var postSpy;\n *\n *    beforeEach(module(function($provide) {\n *      // Register the eventTracker provider\n *      $provide.provider('eventTracker', EventTrackerProvider);\n *    }));\n *\n *    beforeEach(module(function(eventTrackerProvider) {\n *      // Configure eventTracker provider\n *      eventTrackerProvider.setTrackingUrl('/custom-track');\n *    }));\n *\n *    it('tracks events', inject(function(eventTracker) {\n *      expect(eventTracker.event('login')).toEqual(1);\n *      expect(eventTracker.event('login')).toEqual(2);\n *    }));\n *\n *    it('saves to the tracking url', inject(function(eventTracker, $http) {\n *      postSpy = spyOn($http, 'post');\n *      eventTracker.event('login');\n *      eventTracker.save();\n *      expect(postSpy).toHaveBeenCalled();\n *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');\n *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');\n *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });\n *    }));\n *  });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $provide#factory\n * @description\n *\n * Register a **service factory**, which will be called to return the service instance.\n * This is short for registering a service where its provider consists of only a `$get` property,\n * which is the given service factory function.\n * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to\n * configure your service in a provider.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.\n *                      Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service\n * ```js\n *   $provide.factory('ping', ['$http', function($http) {\n *     return function ping() {\n *       return $http.send('/ping');\n *     };\n *   }]);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#service\n * @description\n *\n * Register a **service constructor**, which will be invoked with `new` to create the service\n * instance.\n * This is short for registering a service where its provider's `$get` property is a factory\n * function that returns an instance instantiated by the injector from the service constructor\n * function.\n *\n * Internally it looks a bit like this:\n *\n * ```\n * {\n *   $get: function() {\n *     return $injector.instantiate(constructor);\n *   }\n * }\n * ```\n *\n *\n * You should use {@link auto.$provide#service $provide.service(class)} if you define your service\n * as a type/class.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)\n *     that will be instantiated.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service using\n * {@link auto.$provide#service $provide.service(class)}.\n * ```js\n *   var Ping = function($http) {\n *     this.$http = $http;\n *   };\n *\n *   Ping.$inject = ['$http'];\n *\n *   Ping.prototype.send = function() {\n *     return this.$http.get('/ping');\n *   };\n *   $provide.service('ping', Ping);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping.send();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#value\n * @description\n *\n * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a\n * number, an array, an object or a function. This is short for registering a service where its\n * provider's `$get` property is a factory function that takes no arguments and returns the **value\n * service**. That also means it is not possible to inject other services into a value service.\n *\n * Value services are similar to constant services, except that they cannot be injected into a\n * module configuration function (see {@link angular.Module#config}) but they can be overridden by\n * an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the instance.\n * @param {*} value The value.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here are some examples of creating value services.\n * ```js\n *   $provide.value('ADMIN_USER', 'admin');\n *\n *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });\n *\n *   $provide.value('halfOf', function(value) {\n *     return value / 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#constant\n * @description\n *\n * Register a **constant service** with the {@link auto.$injector $injector}, such as a string,\n * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not\n * possible to inject other services into a constant.\n *\n * But unlike {@link auto.$provide#value value}, a constant can be\n * injected into a module configuration function (see {@link angular.Module#config}) and it cannot\n * be overridden by an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the constant.\n * @param {*} value The constant value.\n * @returns {Object} registered instance\n *\n * @example\n * Here a some examples of creating constants:\n * ```js\n *   $provide.constant('SHARD_HEIGHT', 306);\n *\n *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);\n *\n *   $provide.constant('double', function(value) {\n *     return value * 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#decorator\n * @description\n *\n * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator\n * intercepts the creation of a service, allowing it to override or modify the behavior of the\n * service. The object returned by the decorator may be the original service, or a new service\n * object which replaces or wraps and delegates to the original service.\n *\n * @param {string} name The name of the service to decorate.\n * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be\n *    instantiated and should return the decorated service instance. The function is called using\n *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.\n *    Local injection arguments:\n *\n *    * `$delegate` - The original service instance, which can be monkey patched, configured,\n *      decorated or delegated to.\n *\n * @example\n * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting\n * calls to {@link ng.$log#error $log.warn()}.\n * ```js\n *   $provide.decorator('$log', ['$delegate', function($delegate) {\n *     $delegate.warn = $delegate.error;\n *     return $delegate;\n *   }]);\n * ```\n */\n\n\nfunction createInjector(modulesToLoad, strictDi) {\n  strictDi = (strictDi === true);\n  var INSTANTIATING = {},\n      providerSuffix = 'Provider',\n      path = [],\n      loadedModules = new HashMap([], true),\n      providerCache = {\n        $provide: {\n            provider: supportObject(provider),\n            factory: supportObject(factory),\n            service: supportObject(service),\n            value: supportObject(value),\n            constant: supportObject(constant),\n            decorator: decorator\n          }\n      },\n      providerInjector = (providerCache.$injector =\n          createInternalInjector(providerCache, function(serviceName, caller) {\n            if (angular.isString(caller)) {\n              path.push(caller);\n            }\n            throw $injectorMinErr('unpr', \"Unknown provider: {0}\", path.join(' <- '));\n          })),\n      instanceCache = {},\n      protoInstanceInjector =\n          createInternalInjector(instanceCache, function(serviceName, caller) {\n            var provider = providerInjector.get(serviceName + providerSuffix, caller);\n            return instanceInjector.invoke(\n                provider.$get, provider, undefined, serviceName);\n          }),\n      instanceInjector = protoInstanceInjector;\n\n  providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };\n  var runBlocks = loadModules(modulesToLoad);\n  instanceInjector = protoInstanceInjector.get('$injector');\n  instanceInjector.strictDi = strictDi;\n  forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });\n\n  return instanceInjector;\n\n  ////////////////////////////////////\n  // $provider\n  ////////////////////////////////////\n\n  function supportObject(delegate) {\n    return function(key, value) {\n      if (isObject(key)) {\n        forEach(key, reverseParams(delegate));\n      } else {\n        return delegate(key, value);\n      }\n    };\n  }\n\n  function provider(name, provider_) {\n    assertNotHasOwnProperty(name, 'service');\n    if (isFunction(provider_) || isArray(provider_)) {\n      provider_ = providerInjector.instantiate(provider_);\n    }\n    if (!provider_.$get) {\n      throw $injectorMinErr('pget', \"Provider '{0}' must define $get factory method.\", name);\n    }\n    return providerCache[name + providerSuffix] = provider_;\n  }\n\n  function enforceReturnValue(name, factory) {\n    return function enforcedReturnValue() {\n      var result = instanceInjector.invoke(factory, this);\n      if (isUndefined(result)) {\n        throw $injectorMinErr('undef', \"Provider '{0}' must return a value from $get factory method.\", name);\n      }\n      return result;\n    };\n  }\n\n  function factory(name, factoryFn, enforce) {\n    return provider(name, {\n      $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn\n    });\n  }\n\n  function service(name, constructor) {\n    return factory(name, ['$injector', function($injector) {\n      return $injector.instantiate(constructor);\n    }]);\n  }\n\n  function value(name, val) { return factory(name, valueFn(val), false); }\n\n  function constant(name, value) {\n    assertNotHasOwnProperty(name, 'constant');\n    providerCache[name] = value;\n    instanceCache[name] = value;\n  }\n\n  function decorator(serviceName, decorFn) {\n    var origProvider = providerInjector.get(serviceName + providerSuffix),\n        orig$get = origProvider.$get;\n\n    origProvider.$get = function() {\n      var origInstance = instanceInjector.invoke(orig$get, origProvider);\n      return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});\n    };\n  }\n\n  ////////////////////////////////////\n  // Module Loading\n  ////////////////////////////////////\n  function loadModules(modulesToLoad) {\n    assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');\n    var runBlocks = [], moduleFn;\n    forEach(modulesToLoad, function(module) {\n      if (loadedModules.get(module)) return;\n      loadedModules.put(module, true);\n\n      function runInvokeQueue(queue) {\n        var i, ii;\n        for (i = 0, ii = queue.length; i < ii; i++) {\n          var invokeArgs = queue[i],\n              provider = providerInjector.get(invokeArgs[0]);\n\n          provider[invokeArgs[1]].apply(provider, invokeArgs[2]);\n        }\n      }\n\n      try {\n        if (isString(module)) {\n          moduleFn = angularModule(module);\n          runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);\n          runInvokeQueue(moduleFn._invokeQueue);\n          runInvokeQueue(moduleFn._configBlocks);\n        } else if (isFunction(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else if (isArray(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else {\n          assertArgFn(module, 'module');\n        }\n      } catch (e) {\n        if (isArray(module)) {\n          module = module[module.length - 1];\n        }\n        if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {\n          // Safari & FF's stack traces don't contain error.message content\n          // unlike those of Chrome and IE\n          // So if stack doesn't contain message, we create a new string that contains both.\n          // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.\n          /* jshint -W022 */\n          e = e.message + '\\n' + e.stack;\n        }\n        throw $injectorMinErr('modulerr', \"Failed to instantiate module {0} due to:\\n{1}\",\n                  module, e.stack || e.message || e);\n      }\n    });\n    return runBlocks;\n  }\n\n  ////////////////////////////////////\n  // internal Injector\n  ////////////////////////////////////\n\n  function createInternalInjector(cache, factory) {\n\n    function getService(serviceName, caller) {\n      if (cache.hasOwnProperty(serviceName)) {\n        if (cache[serviceName] === INSTANTIATING) {\n          throw $injectorMinErr('cdep', 'Circular dependency found: {0}',\n                    serviceName + ' <- ' + path.join(' <- '));\n        }\n        return cache[serviceName];\n      } else {\n        try {\n          path.unshift(serviceName);\n          cache[serviceName] = INSTANTIATING;\n          return cache[serviceName] = factory(serviceName, caller);\n        } catch (err) {\n          if (cache[serviceName] === INSTANTIATING) {\n            delete cache[serviceName];\n          }\n          throw err;\n        } finally {\n          path.shift();\n        }\n      }\n    }\n\n\n    function injectionArgs(fn, locals, serviceName) {\n      var args = [],\n          $inject = createInjector.$$annotate(fn, strictDi, serviceName);\n\n      for (var i = 0, length = $inject.length; i < length; i++) {\n        var key = $inject[i];\n        if (typeof key !== 'string') {\n          throw $injectorMinErr('itkn',\n                  'Incorrect injection token! Expected service name as string, got {0}', key);\n        }\n        args.push(locals && locals.hasOwnProperty(key) ? locals[key] :\n                                                         getService(key, serviceName));\n      }\n      return args;\n    }\n\n    function isClass(func) {\n      // IE 9-11 do not support classes and IE9 leaks with the code below.\n      if (msie <= 11) {\n        return false;\n      }\n      // Workaround for MS Edge.\n      // Check https://connect.microsoft.com/IE/Feedback/Details/2211653\n      return typeof func === 'function'\n        && /^(?:class\\s|constructor\\()/.test(Function.prototype.toString.call(func));\n    }\n\n    function invoke(fn, self, locals, serviceName) {\n      if (typeof locals === 'string') {\n        serviceName = locals;\n        locals = null;\n      }\n\n      var args = injectionArgs(fn, locals, serviceName);\n      if (isArray(fn)) {\n        fn = fn[fn.length - 1];\n      }\n\n      if (!isClass(fn)) {\n        // http://jsperf.com/angularjs-invoke-apply-vs-switch\n        // #5388\n        return fn.apply(self, args);\n      } else {\n        args.unshift(null);\n        return new (Function.prototype.bind.apply(fn, args))();\n      }\n    }\n\n\n    function instantiate(Type, locals, serviceName) {\n      // Check if Type is annotated and use just the given function at n-1 as parameter\n      // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);\n      var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);\n      var args = injectionArgs(Type, locals, serviceName);\n      // Empty object at position 0 is ignored for invocation with `new`, but required.\n      args.unshift(null);\n      return new (Function.prototype.bind.apply(ctor, args))();\n    }\n\n\n    return {\n      invoke: invoke,\n      instantiate: instantiate,\n      get: getService,\n      annotate: createInjector.$$annotate,\n      has: function(name) {\n        return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);\n      }\n    };\n  }\n}\n\ncreateInjector.$$annotate = annotate;\n\n/**\n * @ngdoc provider\n * @name $anchorScrollProvider\n *\n * @description\n * Use `$anchorScrollProvider` to disable automatic scrolling whenever\n * {@link ng.$location#hash $location.hash()} changes.\n */\nfunction $AnchorScrollProvider() {\n\n  var autoScrollingEnabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $anchorScrollProvider#disableAutoScrolling\n   *\n   * @description\n   * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to\n   * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />\n   * Use this method to disable automatic scrolling.\n   *\n   * If automatic scrolling is disabled, one must explicitly call\n   * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the\n   * current hash.\n   */\n  this.disableAutoScrolling = function() {\n    autoScrollingEnabled = false;\n  };\n\n  /**\n   * @ngdoc service\n   * @name $anchorScroll\n   * @kind function\n   * @requires $window\n   * @requires $location\n   * @requires $rootScope\n   *\n   * @description\n   * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the\n   * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified\n   * in the\n   * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-indicated-part-of-the-document).\n   *\n   * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to\n   * match any anchor whenever it changes. This can be disabled by calling\n   * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.\n   *\n   * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a\n   * vertical scroll-offset (either fixed or dynamic).\n   *\n   * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of\n   *                       {@link ng.$location#hash $location.hash()} will be used.\n   *\n   * @property {(number|function|jqLite)} yOffset\n   * If set, specifies a vertical scroll-offset. This is often useful when there are fixed\n   * positioned elements at the top of the page, such as navbars, headers etc.\n   *\n   * `yOffset` can be specified in various ways:\n   * - **number**: A fixed number of pixels to be used as offset.<br /><br />\n   * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return\n   *   a number representing the offset (in pixels).<br /><br />\n   * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from\n   *   the top of the page to the element's bottom will be used as offset.<br />\n   *   **Note**: The element will be taken into account only as long as its `position` is set to\n   *   `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust\n   *   their height and/or positioning according to the viewport's size.\n   *\n   * <br />\n   * <div class=\"alert alert-warning\">\n   * In order for `yOffset` to work properly, scrolling should take place on the document's root and\n   * not some child element.\n   * </div>\n   *\n   * @example\n     <example module=\"anchorScrollExample\">\n       <file name=\"index.html\">\n         <div id=\"scrollArea\" ng-controller=\"ScrollController\">\n           <a ng-click=\"gotoBottom()\">Go to bottom</a>\n           <a id=\"bottom\"></a> You're at the bottom!\n         </div>\n       </file>\n       <file name=\"script.js\">\n         angular.module('anchorScrollExample', [])\n           .controller('ScrollController', ['$scope', '$location', '$anchorScroll',\n             function ($scope, $location, $anchorScroll) {\n               $scope.gotoBottom = function() {\n                 // set the location.hash to the id of\n                 // the element you wish to scroll to.\n                 $location.hash('bottom');\n\n                 // call $anchorScroll()\n                 $anchorScroll();\n               };\n             }]);\n       </file>\n       <file name=\"style.css\">\n         #scrollArea {\n           height: 280px;\n           overflow: auto;\n         }\n\n         #bottom {\n           display: block;\n           margin-top: 2000px;\n         }\n       </file>\n     </example>\n   *\n   * <hr />\n   * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).\n   * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.\n   *\n   * @example\n     <example module=\"anchorScrollOffsetExample\">\n       <file name=\"index.html\">\n         <div class=\"fixed-header\" ng-controller=\"headerCtrl\">\n           <a href=\"\" ng-click=\"gotoAnchor(x)\" ng-repeat=\"x in [1,2,3,4,5]\">\n             Go to anchor {{x}}\n           </a>\n         </div>\n         <div id=\"anchor{{x}}\" class=\"anchor\" ng-repeat=\"x in [1,2,3,4,5]\">\n           Anchor {{x}} of 5\n         </div>\n       </file>\n       <file name=\"script.js\">\n         angular.module('anchorScrollOffsetExample', [])\n           .run(['$anchorScroll', function($anchorScroll) {\n             $anchorScroll.yOffset = 50;   // always scroll by 50 extra pixels\n           }])\n           .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',\n             function ($anchorScroll, $location, $scope) {\n               $scope.gotoAnchor = function(x) {\n                 var newHash = 'anchor' + x;\n                 if ($location.hash() !== newHash) {\n                   // set the $location.hash to `newHash` and\n                   // $anchorScroll will automatically scroll to it\n                   $location.hash('anchor' + x);\n                 } else {\n                   // call $anchorScroll() explicitly,\n                   // since $location.hash hasn't changed\n                   $anchorScroll();\n                 }\n               };\n             }\n           ]);\n       </file>\n       <file name=\"style.css\">\n         body {\n           padding-top: 50px;\n         }\n\n         .anchor {\n           border: 2px dashed DarkOrchid;\n           padding: 10px 10px 200px 10px;\n         }\n\n         .fixed-header {\n           background-color: rgba(0, 0, 0, 0.2);\n           height: 50px;\n           position: fixed;\n           top: 0; left: 0; right: 0;\n         }\n\n         .fixed-header > a {\n           display: inline-block;\n           margin: 5px 15px;\n         }\n       </file>\n     </example>\n   */\n  this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {\n    var document = $window.document;\n\n    // Helper function to get first anchor from a NodeList\n    // (using `Array#some()` instead of `angular#forEach()` since it's more performant\n    //  and working in all supported browsers.)\n    function getFirstAnchor(list) {\n      var result = null;\n      Array.prototype.some.call(list, function(element) {\n        if (nodeName_(element) === 'a') {\n          result = element;\n          return true;\n        }\n      });\n      return result;\n    }\n\n    function getYOffset() {\n\n      var offset = scroll.yOffset;\n\n      if (isFunction(offset)) {\n        offset = offset();\n      } else if (isElement(offset)) {\n        var elem = offset[0];\n        var style = $window.getComputedStyle(elem);\n        if (style.position !== 'fixed') {\n          offset = 0;\n        } else {\n          offset = elem.getBoundingClientRect().bottom;\n        }\n      } else if (!isNumber(offset)) {\n        offset = 0;\n      }\n\n      return offset;\n    }\n\n    function scrollTo(elem) {\n      if (elem) {\n        elem.scrollIntoView();\n\n        var offset = getYOffset();\n\n        if (offset) {\n          // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.\n          // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the\n          // top of the viewport.\n          //\n          // IF the number of pixels from the top of `elem` to the end of the page's content is less\n          // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some\n          // way down the page.\n          //\n          // This is often the case for elements near the bottom of the page.\n          //\n          // In such cases we do not need to scroll the whole `offset` up, just the difference between\n          // the top of the element and the offset, which is enough to align the top of `elem` at the\n          // desired position.\n          var elemTop = elem.getBoundingClientRect().top;\n          $window.scrollBy(0, elemTop - offset);\n        }\n      } else {\n        $window.scrollTo(0, 0);\n      }\n    }\n\n    function scroll(hash) {\n      hash = isString(hash) ? hash : $location.hash();\n      var elm;\n\n      // empty hash, scroll to the top of the page\n      if (!hash) scrollTo(null);\n\n      // element with given id\n      else if ((elm = document.getElementById(hash))) scrollTo(elm);\n\n      // first anchor with given name :-D\n      else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);\n\n      // no element and hash == 'top', scroll to the top of the page\n      else if (hash === 'top') scrollTo(null);\n    }\n\n    // does not scroll when user clicks on anchor link that is currently on\n    // (no url change, no $location.hash() change), browser native does scroll\n    if (autoScrollingEnabled) {\n      $rootScope.$watch(function autoScrollWatch() {return $location.hash();},\n        function autoScrollWatchAction(newVal, oldVal) {\n          // skip the initial scroll if $location.hash is empty\n          if (newVal === oldVal && newVal === '') return;\n\n          jqLiteDocumentLoaded(function() {\n            $rootScope.$evalAsync(scroll);\n          });\n        });\n    }\n\n    return scroll;\n  }];\n}\n\nvar $animateMinErr = minErr('$animate');\nvar ELEMENT_NODE = 1;\nvar NG_ANIMATE_CLASSNAME = 'ng-animate';\n\nfunction mergeClasses(a,b) {\n  if (!a && !b) return '';\n  if (!a) return b;\n  if (!b) return a;\n  if (isArray(a)) a = a.join(' ');\n  if (isArray(b)) b = b.join(' ');\n  return a + ' ' + b;\n}\n\nfunction extractElementNode(element) {\n  for (var i = 0; i < element.length; i++) {\n    var elm = element[i];\n    if (elm.nodeType === ELEMENT_NODE) {\n      return elm;\n    }\n  }\n}\n\nfunction splitClasses(classes) {\n  if (isString(classes)) {\n    classes = classes.split(' ');\n  }\n\n  // Use createMap() to prevent class assumptions involving property names in\n  // Object.prototype\n  var obj = createMap();\n  forEach(classes, function(klass) {\n    // sometimes the split leaves empty string values\n    // incase extra spaces were applied to the options\n    if (klass.length) {\n      obj[klass] = true;\n    }\n  });\n  return obj;\n}\n\n// if any other type of options value besides an Object value is\n// passed into the $animate.method() animation then this helper code\n// will be run which will ignore it. While this patch is not the\n// greatest solution to this, a lot of existing plugins depend on\n// $animate to either call the callback (< 1.2) or return a promise\n// that can be changed. This helper function ensures that the options\n// are wiped clean incase a callback function is provided.\nfunction prepareAnimateOptions(options) {\n  return isObject(options)\n      ? options\n      : {};\n}\n\nvar $$CoreAnimateJsProvider = function() {\n  this.$get = noop;\n};\n\n// this is prefixed with Core since it conflicts with\n// the animateQueueProvider defined in ngAnimate/animateQueue.js\nvar $$CoreAnimateQueueProvider = function() {\n  var postDigestQueue = new HashMap();\n  var postDigestElements = [];\n\n  this.$get = ['$$AnimateRunner', '$rootScope',\n       function($$AnimateRunner,   $rootScope) {\n    return {\n      enabled: noop,\n      on: noop,\n      off: noop,\n      pin: noop,\n\n      push: function(element, event, options, domOperation) {\n        domOperation        && domOperation();\n\n        options = options || {};\n        options.from        && element.css(options.from);\n        options.to          && element.css(options.to);\n\n        if (options.addClass || options.removeClass) {\n          addRemoveClassesPostDigest(element, options.addClass, options.removeClass);\n        }\n\n        var runner = new $$AnimateRunner(); // jshint ignore:line\n\n        // since there are no animations to run the runner needs to be\n        // notified that the animation call is complete.\n        runner.complete();\n        return runner;\n      }\n    };\n\n\n    function updateData(data, classes, value) {\n      var changed = false;\n      if (classes) {\n        classes = isString(classes) ? classes.split(' ') :\n                  isArray(classes) ? classes : [];\n        forEach(classes, function(className) {\n          if (className) {\n            changed = true;\n            data[className] = value;\n          }\n        });\n      }\n      return changed;\n    }\n\n    function handleCSSClassChanges() {\n      forEach(postDigestElements, function(element) {\n        var data = postDigestQueue.get(element);\n        if (data) {\n          var existing = splitClasses(element.attr('class'));\n          var toAdd = '';\n          var toRemove = '';\n          forEach(data, function(status, className) {\n            var hasClass = !!existing[className];\n            if (status !== hasClass) {\n              if (status) {\n                toAdd += (toAdd.length ? ' ' : '') + className;\n              } else {\n                toRemove += (toRemove.length ? ' ' : '') + className;\n              }\n            }\n          });\n\n          forEach(element, function(elm) {\n            toAdd    && jqLiteAddClass(elm, toAdd);\n            toRemove && jqLiteRemoveClass(elm, toRemove);\n          });\n          postDigestQueue.remove(element);\n        }\n      });\n      postDigestElements.length = 0;\n    }\n\n\n    function addRemoveClassesPostDigest(element, add, remove) {\n      var data = postDigestQueue.get(element) || {};\n\n      var classesAdded = updateData(data, add, true);\n      var classesRemoved = updateData(data, remove, false);\n\n      if (classesAdded || classesRemoved) {\n\n        postDigestQueue.put(element, data);\n        postDigestElements.push(element);\n\n        if (postDigestElements.length === 1) {\n          $rootScope.$$postDigest(handleCSSClassChanges);\n        }\n      }\n    }\n  }];\n};\n\n/**\n * @ngdoc provider\n * @name $animateProvider\n *\n * @description\n * Default implementation of $animate that doesn't perform any animations, instead just\n * synchronously performs DOM updates and resolves the returned runner promise.\n *\n * In order to enable animations the `ngAnimate` module has to be loaded.\n *\n * To see the functional implementation check out `src/ngAnimate/animate.js`.\n */\nvar $AnimateProvider = ['$provide', function($provide) {\n  var provider = this;\n\n  this.$$registeredAnimations = Object.create(null);\n\n   /**\n   * @ngdoc method\n   * @name $animateProvider#register\n   *\n   * @description\n   * Registers a new injectable animation factory function. The factory function produces the\n   * animation object which contains callback functions for each event that is expected to be\n   * animated.\n   *\n   *   * `eventFn`: `function(element, ... , doneFunction, options)`\n   *   The element to animate, the `doneFunction` and the options fed into the animation. Depending\n   *   on the type of animation additional arguments will be injected into the animation function. The\n   *   list below explains the function signatures for the different animation methods:\n   *\n   *   - setClass: function(element, addedClasses, removedClasses, doneFunction, options)\n   *   - addClass: function(element, addedClasses, doneFunction, options)\n   *   - removeClass: function(element, removedClasses, doneFunction, options)\n   *   - enter, leave, move: function(element, doneFunction, options)\n   *   - animate: function(element, fromStyles, toStyles, doneFunction, options)\n   *\n   *   Make sure to trigger the `doneFunction` once the animation is fully complete.\n   *\n   * ```js\n   *   return {\n   *     //enter, leave, move signature\n   *     eventFn : function(element, done, options) {\n   *       //code to run the animation\n   *       //once complete, then run done()\n   *       return function endFunction(wasCancelled) {\n   *         //code to cancel the animation\n   *       }\n   *     }\n   *   }\n   * ```\n   *\n   * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).\n   * @param {Function} factory The factory function that will be executed to return the animation\n   *                           object.\n   */\n  this.register = function(name, factory) {\n    if (name && name.charAt(0) !== '.') {\n      throw $animateMinErr('notcsel', \"Expecting class selector starting with '.' got '{0}'.\", name);\n    }\n\n    var key = name + '-animation';\n    provider.$$registeredAnimations[name.substr(1)] = key;\n    $provide.factory(key, factory);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $animateProvider#classNameFilter\n   *\n   * @description\n   * Sets and/or returns the CSS class regular expression that is checked when performing\n   * an animation. Upon bootstrap the classNameFilter value is not set at all and will\n   * therefore enable $animate to attempt to perform an animation on any element that is triggered.\n   * When setting the `classNameFilter` value, animations will only be performed on elements\n   * that successfully match the filter expression. This in turn can boost performance\n   * for low-powered devices as well as applications containing a lot of structural operations.\n   * @param {RegExp=} expression The className expression which will be checked against all animations\n   * @return {RegExp} The current CSS className expression value. If null then there is no expression value\n   */\n  this.classNameFilter = function(expression) {\n    if (arguments.length === 1) {\n      this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;\n      if (this.$$classNameFilter) {\n        var reservedRegex = new RegExp(\"(\\\\s+|\\\\/)\" + NG_ANIMATE_CLASSNAME + \"(\\\\s+|\\\\/)\");\n        if (reservedRegex.test(this.$$classNameFilter.toString())) {\n          throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the \"{0}\" CSS class.', NG_ANIMATE_CLASSNAME);\n\n        }\n      }\n    }\n    return this.$$classNameFilter;\n  };\n\n  this.$get = ['$$animateQueue', function($$animateQueue) {\n    function domInsert(element, parentElement, afterElement) {\n      // if for some reason the previous element was removed\n      // from the dom sometime before this code runs then let's\n      // just stick to using the parent element as the anchor\n      if (afterElement) {\n        var afterNode = extractElementNode(afterElement);\n        if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {\n          afterElement = null;\n        }\n      }\n      afterElement ? afterElement.after(element) : parentElement.prepend(element);\n    }\n\n    /**\n     * @ngdoc service\n     * @name $animate\n     * @description The $animate service exposes a series of DOM utility methods that provide support\n     * for animation hooks. The default behavior is the application of DOM operations, however,\n     * when an animation is detected (and animations are enabled), $animate will do the heavy lifting\n     * to ensure that animation runs with the triggered DOM operation.\n     *\n     * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't\n     * included and only when it is active then the animation hooks that `$animate` triggers will be\n     * functional. Once active then all structural `ng-` directives will trigger animations as they perform\n     * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,\n     * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.\n     *\n     * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.\n     *\n     * To learn more about enabling animation support, click here to visit the\n     * {@link ngAnimate ngAnimate module page}.\n     */\n    return {\n      // we don't call it directly since non-existant arguments may\n      // be interpreted as null within the sub enabled function\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#on\n       * @kind function\n       * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)\n       *    has fired on the given element or among any of its children. Once the listener is fired, the provided callback\n       *    is fired with the following params:\n       *\n       * ```js\n       * $animate.on('enter', container,\n       *    function callback(element, phase) {\n       *      // cool we detected an enter animation within the container\n       *    }\n       * );\n       * ```\n       *\n       * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)\n       * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself\n       *     as well as among its children\n       * @param {Function} callback the callback function that will be fired when the listener is triggered\n       *\n       * The arguments present in the callback function are:\n       * * `element` - The captured DOM element that the animation was fired on.\n       * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).\n       */\n      on: $$animateQueue.on,\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#off\n       * @kind function\n       * @description Deregisters an event listener based on the event which has been associated with the provided element. This method\n       * can be used in three different ways depending on the arguments:\n       *\n       * ```js\n       * // remove all the animation event listeners listening for `enter`\n       * $animate.off('enter');\n       *\n       * // remove all the animation event listeners listening for `enter` on the given element and its children\n       * $animate.off('enter', container);\n       *\n       * // remove the event listener function provided by `callback` that is set\n       * // to listen for `enter` on the given `container` as well as its children\n       * $animate.off('enter', container, callback);\n       * ```\n       *\n       * @param {string} event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)\n       * @param {DOMElement=} container the container element the event listener was placed on\n       * @param {Function=} callback the callback function that was registered as the listener\n       */\n      off: $$animateQueue.off,\n\n      /**\n       * @ngdoc method\n       * @name $animate#pin\n       * @kind function\n       * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists\n       *    outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the\n       *    element despite being outside the realm of the application or within another application. Say for example if the application\n       *    was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated\n       *    as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind\n       *    that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.\n       *\n       *    Note that this feature is only active when the `ngAnimate` module is used.\n       *\n       * @param {DOMElement} element the external element that will be pinned\n       * @param {DOMElement} parentElement the host parent element that will be associated with the external element\n       */\n      pin: $$animateQueue.pin,\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enabled\n       * @kind function\n       * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This\n       * function can be called in four ways:\n       *\n       * ```js\n       * // returns true or false\n       * $animate.enabled();\n       *\n       * // changes the enabled state for all animations\n       * $animate.enabled(false);\n       * $animate.enabled(true);\n       *\n       * // returns true or false if animations are enabled for an element\n       * $animate.enabled(element);\n       *\n       * // changes the enabled state for an element and its children\n       * $animate.enabled(element, true);\n       * $animate.enabled(element, false);\n       * ```\n       *\n       * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state\n       * @param {boolean=} enabled whether or not the animations will be enabled for the element\n       *\n       * @return {boolean} whether or not animations are enabled\n       */\n      enabled: $$animateQueue.enabled,\n\n      /**\n       * @ngdoc method\n       * @name $animate#cancel\n       * @kind function\n       * @description Cancels the provided animation.\n       *\n       * @param {Promise} animationPromise The animation promise that is returned when an animation is started.\n       */\n      cancel: function(runner) {\n        runner.end && runner.end();\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enter\n       * @kind function\n       * @description Inserts the element into the DOM either after the `after` element (if provided) or\n       *   as the first child within the `parent` element and then triggers an animation.\n       *   A promise is returned that will be resolved during the next digest once the animation\n       *   has completed.\n       *\n       * @param {DOMElement} element the element which will be inserted into the DOM\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (so long as the after element is not present)\n       * @param {DOMElement=} after the sibling element after which the element will be appended\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      enter: function(element, parent, after, options) {\n        parent = parent && jqLite(parent);\n        after = after && jqLite(after);\n        parent = parent || after.parent();\n        domInsert(element, parent, after);\n        return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#move\n       * @kind function\n       * @description Inserts (moves) the element into its new position in the DOM either after\n       *   the `after` element (if provided) or as the first child within the `parent` element\n       *   and then triggers an animation. A promise is returned that will be resolved\n       *   during the next digest once the animation has completed.\n       *\n       * @param {DOMElement} element the element which will be moved into the new DOM position\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (so long as the after element is not present)\n       * @param {DOMElement=} after the sibling element after which the element will be appended\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      move: function(element, parent, after, options) {\n        parent = parent && jqLite(parent);\n        after = after && jqLite(after);\n        parent = parent || after.parent();\n        domInsert(element, parent, after);\n        return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#leave\n       * @kind function\n       * @description Triggers an animation and then removes the element from the DOM.\n       * When the function is called a promise is returned that will be resolved during the next\n       * digest once the animation has completed.\n       *\n       * @param {DOMElement} element the element which will be removed from the DOM\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      leave: function(element, options) {\n        return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {\n          element.remove();\n        });\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#addClass\n       * @kind function\n       *\n       * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon\n       *   execution, the addClass operation will only be handled after the next digest and it will not trigger an\n       *   animation if element already contains the CSS class or if the class is removed at a later step.\n       *   Note that class-based animations are treated differently compared to structural animations\n       *   (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *   depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      addClass: function(element, className, options) {\n        options = prepareAnimateOptions(options);\n        options.addClass = mergeClasses(options.addclass, className);\n        return $$animateQueue.push(element, 'addClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#removeClass\n       * @kind function\n       *\n       * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon\n       *   execution, the removeClass operation will only be handled after the next digest and it will not trigger an\n       *   animation if element does not contain the CSS class or if the class is added at a later step.\n       *   Note that class-based animations are treated differently compared to structural animations\n       *   (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *   depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      removeClass: function(element, className, options) {\n        options = prepareAnimateOptions(options);\n        options.removeClass = mergeClasses(options.removeClass, className);\n        return $$animateQueue.push(element, 'removeClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#setClass\n       * @kind function\n       *\n       * @description Performs both the addition and removal of a CSS classes on an element and (during the process)\n       *    triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and\n       *    `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has\n       *    passed. Note that class-based animations are treated differently compared to structural animations\n       *    (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *    depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)\n       * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      setClass: function(element, add, remove, options) {\n        options = prepareAnimateOptions(options);\n        options.addClass = mergeClasses(options.addClass, add);\n        options.removeClass = mergeClasses(options.removeClass, remove);\n        return $$animateQueue.push(element, 'setClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#animate\n       * @kind function\n       *\n       * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.\n       * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take\n       * on the provided styles. For example, if a transition animation is set for the given classNamem, then the provided `from` and\n       * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding\n       * style in `to`, the style in `from` is applied immediately, and no animation is run.\n       * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`\n       * method (or as part of the `options` parameter):\n       *\n       * ```js\n       * ngModule.animation('.my-inline-animation', function() {\n       *   return {\n       *     animate : function(element, from, to, done, options) {\n       *       //animation\n       *       done();\n       *     }\n       *   }\n       * });\n       * ```\n       *\n       * @param {DOMElement} element the element which the CSS styles will be applied to\n       * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.\n       * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.\n       * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If\n       *    this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.\n       *    (Note that if no animation is detected then this value will not be applied to the element.)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      animate: function(element, from, to, className, options) {\n        options = prepareAnimateOptions(options);\n        options.from = options.from ? extend(options.from, from) : from;\n        options.to   = options.to   ? extend(options.to, to)     : to;\n\n        className = className || 'ng-inline-animate';\n        options.tempClasses = mergeClasses(options.tempClasses, className);\n        return $$animateQueue.push(element, 'animate', options);\n      }\n    };\n  }];\n}];\n\nvar $$AnimateAsyncRunFactoryProvider = function() {\n  this.$get = ['$$rAF', function($$rAF) {\n    var waitQueue = [];\n\n    function waitForTick(fn) {\n      waitQueue.push(fn);\n      if (waitQueue.length > 1) return;\n      $$rAF(function() {\n        for (var i = 0; i < waitQueue.length; i++) {\n          waitQueue[i]();\n        }\n        waitQueue = [];\n      });\n    }\n\n    return function() {\n      var passed = false;\n      waitForTick(function() {\n        passed = true;\n      });\n      return function(callback) {\n        passed ? callback() : waitForTick(callback);\n      };\n    };\n  }];\n};\n\nvar $$AnimateRunnerFactoryProvider = function() {\n  this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',\n       function($q,   $sniffer,   $$animateAsyncRun,   $document,   $timeout) {\n\n    var INITIAL_STATE = 0;\n    var DONE_PENDING_STATE = 1;\n    var DONE_COMPLETE_STATE = 2;\n\n    AnimateRunner.chain = function(chain, callback) {\n      var index = 0;\n\n      next();\n      function next() {\n        if (index === chain.length) {\n          callback(true);\n          return;\n        }\n\n        chain[index](function(response) {\n          if (response === false) {\n            callback(false);\n            return;\n          }\n          index++;\n          next();\n        });\n      }\n    };\n\n    AnimateRunner.all = function(runners, callback) {\n      var count = 0;\n      var status = true;\n      forEach(runners, function(runner) {\n        runner.done(onProgress);\n      });\n\n      function onProgress(response) {\n        status = status && response;\n        if (++count === runners.length) {\n          callback(status);\n        }\n      }\n    };\n\n    function AnimateRunner(host) {\n      this.setHost(host);\n\n      var rafTick = $$animateAsyncRun();\n      var timeoutTick = function(fn) {\n        $timeout(fn, 0, false);\n      };\n\n      this._doneCallbacks = [];\n      this._tick = function(fn) {\n        var doc = $document[0];\n\n        // the document may not be ready or attached\n        // to the module for some internal tests\n        if (doc && doc.hidden) {\n          timeoutTick(fn);\n        } else {\n          rafTick(fn);\n        }\n      };\n      this._state = 0;\n    }\n\n    AnimateRunner.prototype = {\n      setHost: function(host) {\n        this.host = host || {};\n      },\n\n      done: function(fn) {\n        if (this._state === DONE_COMPLETE_STATE) {\n          fn();\n        } else {\n          this._doneCallbacks.push(fn);\n        }\n      },\n\n      progress: noop,\n\n      getPromise: function() {\n        if (!this.promise) {\n          var self = this;\n          this.promise = $q(function(resolve, reject) {\n            self.done(function(status) {\n              status === false ? reject() : resolve();\n            });\n          });\n        }\n        return this.promise;\n      },\n\n      then: function(resolveHandler, rejectHandler) {\n        return this.getPromise().then(resolveHandler, rejectHandler);\n      },\n\n      'catch': function(handler) {\n        return this.getPromise()['catch'](handler);\n      },\n\n      'finally': function(handler) {\n        return this.getPromise()['finally'](handler);\n      },\n\n      pause: function() {\n        if (this.host.pause) {\n          this.host.pause();\n        }\n      },\n\n      resume: function() {\n        if (this.host.resume) {\n          this.host.resume();\n        }\n      },\n\n      end: function() {\n        if (this.host.end) {\n          this.host.end();\n        }\n        this._resolve(true);\n      },\n\n      cancel: function() {\n        if (this.host.cancel) {\n          this.host.cancel();\n        }\n        this._resolve(false);\n      },\n\n      complete: function(response) {\n        var self = this;\n        if (self._state === INITIAL_STATE) {\n          self._state = DONE_PENDING_STATE;\n          self._tick(function() {\n            self._resolve(response);\n          });\n        }\n      },\n\n      _resolve: function(response) {\n        if (this._state !== DONE_COMPLETE_STATE) {\n          forEach(this._doneCallbacks, function(fn) {\n            fn(response);\n          });\n          this._doneCallbacks.length = 0;\n          this._state = DONE_COMPLETE_STATE;\n        }\n      }\n    };\n\n    return AnimateRunner;\n  }];\n};\n\n/**\n * @ngdoc service\n * @name $animateCss\n * @kind object\n *\n * @description\n * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,\n * then the `$animateCss` service will actually perform animations.\n *\n * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.\n */\nvar $CoreAnimateCssProvider = function() {\n  this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {\n\n    return function(element, initialOptions) {\n      // all of the animation functions should create\n      // a copy of the options data, however, if a\n      // parent service has already created a copy then\n      // we should stick to using that\n      var options = initialOptions || {};\n      if (!options.$$prepared) {\n        options = copy(options);\n      }\n\n      // there is no point in applying the styles since\n      // there is no animation that goes on at all in\n      // this version of $animateCss.\n      if (options.cleanupStyles) {\n        options.from = options.to = null;\n      }\n\n      if (options.from) {\n        element.css(options.from);\n        options.from = null;\n      }\n\n      /* jshint newcap: false */\n      var closed, runner = new $$AnimateRunner();\n      return {\n        start: run,\n        end: run\n      };\n\n      function run() {\n        $$rAF(function() {\n          applyAnimationContents();\n          if (!closed) {\n            runner.complete();\n          }\n          closed = true;\n        });\n        return runner;\n      }\n\n      function applyAnimationContents() {\n        if (options.addClass) {\n          element.addClass(options.addClass);\n          options.addClass = null;\n        }\n        if (options.removeClass) {\n          element.removeClass(options.removeClass);\n          options.removeClass = null;\n        }\n        if (options.to) {\n          element.css(options.to);\n          options.to = null;\n        }\n      }\n    };\n  }];\n};\n\n/* global stripHash: true */\n\n/**\n * ! This is a private undocumented service !\n *\n * @name $browser\n * @requires $log\n * @description\n * This object has two goals:\n *\n * - hide all the global state in the browser caused by the window object\n * - abstract away all the browser specific features and inconsistencies\n *\n * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`\n * service, which can be used for convenient testing of the application without the interaction with\n * the real browser apis.\n */\n/**\n * @param {object} window The global window object.\n * @param {object} document jQuery wrapped document.\n * @param {object} $log window.console or an object with the same interface.\n * @param {object} $sniffer $sniffer service\n */\nfunction Browser(window, document, $log, $sniffer) {\n  var self = this,\n      location = window.location,\n      history = window.history,\n      setTimeout = window.setTimeout,\n      clearTimeout = window.clearTimeout,\n      pendingDeferIds = {};\n\n  self.isMock = false;\n\n  var outstandingRequestCount = 0;\n  var outstandingRequestCallbacks = [];\n\n  // TODO(vojta): remove this temporary api\n  self.$$completeOutstandingRequest = completeOutstandingRequest;\n  self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };\n\n  /**\n   * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`\n   * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.\n   */\n  function completeOutstandingRequest(fn) {\n    try {\n      fn.apply(null, sliceArgs(arguments, 1));\n    } finally {\n      outstandingRequestCount--;\n      if (outstandingRequestCount === 0) {\n        while (outstandingRequestCallbacks.length) {\n          try {\n            outstandingRequestCallbacks.pop()();\n          } catch (e) {\n            $log.error(e);\n          }\n        }\n      }\n    }\n  }\n\n  function getHash(url) {\n    var index = url.indexOf('#');\n    return index === -1 ? '' : url.substr(index);\n  }\n\n  /**\n   * @private\n   * Note: this method is used only by scenario runner\n   * TODO(vojta): prefix this method with $$ ?\n   * @param {function()} callback Function that will be called when no outstanding request\n   */\n  self.notifyWhenNoOutstandingRequests = function(callback) {\n    if (outstandingRequestCount === 0) {\n      callback();\n    } else {\n      outstandingRequestCallbacks.push(callback);\n    }\n  };\n\n  //////////////////////////////////////////////////////////////\n  // URL API\n  //////////////////////////////////////////////////////////////\n\n  var cachedState, lastHistoryState,\n      lastBrowserUrl = location.href,\n      baseElement = document.find('base'),\n      pendingLocation = null,\n      getCurrentState = !$sniffer.history ? noop : function getCurrentState() {\n        try {\n          return history.state;\n        } catch (e) {\n          // MSIE can reportedly throw when there is no state (UNCONFIRMED).\n        }\n      };\n\n  cacheState();\n  lastHistoryState = cachedState;\n\n  /**\n   * @name $browser#url\n   *\n   * @description\n   * GETTER:\n   * Without any argument, this method just returns current value of location.href.\n   *\n   * SETTER:\n   * With at least one argument, this method sets url to new value.\n   * If html5 history api supported, pushState/replaceState is used, otherwise\n   * location.href/location.replace is used.\n   * Returns its own instance to allow chaining\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to change url.\n   *\n   * @param {string} url New url (when used as setter)\n   * @param {boolean=} replace Should new url replace current history record?\n   * @param {object=} state object to use with pushState/replaceState\n   */\n  self.url = function(url, replace, state) {\n    // In modern browsers `history.state` is `null` by default; treating it separately\n    // from `undefined` would cause `$browser.url('/foo')` to change `history.state`\n    // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.\n    if (isUndefined(state)) {\n      state = null;\n    }\n\n    // Android Browser BFCache causes location, history reference to become stale.\n    if (location !== window.location) location = window.location;\n    if (history !== window.history) history = window.history;\n\n    // setter\n    if (url) {\n      var sameState = lastHistoryState === state;\n\n      // Don't change anything if previous and current URLs and states match. This also prevents\n      // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.\n      // See https://github.com/angular/angular.js/commit/ffb2701\n      if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {\n        return self;\n      }\n      var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);\n      lastBrowserUrl = url;\n      lastHistoryState = state;\n      // Don't use history API if only the hash changed\n      // due to a bug in IE10/IE11 which leads\n      // to not firing a `hashchange` nor `popstate` event\n      // in some cases (see #9143).\n      if ($sniffer.history && (!sameBase || !sameState)) {\n        history[replace ? 'replaceState' : 'pushState'](state, '', url);\n        cacheState();\n        // Do the assignment again so that those two variables are referentially identical.\n        lastHistoryState = cachedState;\n      } else {\n        if (!sameBase || pendingLocation) {\n          pendingLocation = url;\n        }\n        if (replace) {\n          location.replace(url);\n        } else if (!sameBase) {\n          location.href = url;\n        } else {\n          location.hash = getHash(url);\n        }\n        if (location.href !== url) {\n          pendingLocation = url;\n        }\n      }\n      return self;\n    // getter\n    } else {\n      // - pendingLocation is needed as browsers don't allow to read out\n      //   the new location.href if a reload happened or if there is a bug like in iOS 9 (see\n      //   https://openradar.appspot.com/22186109).\n      // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172\n      return pendingLocation || location.href.replace(/%27/g,\"'\");\n    }\n  };\n\n  /**\n   * @name $browser#state\n   *\n   * @description\n   * This method is a getter.\n   *\n   * Return history.state or null if history.state is undefined.\n   *\n   * @returns {object} state\n   */\n  self.state = function() {\n    return cachedState;\n  };\n\n  var urlChangeListeners = [],\n      urlChangeInit = false;\n\n  function cacheStateAndFireUrlChange() {\n    pendingLocation = null;\n    cacheState();\n    fireUrlChange();\n  }\n\n  // This variable should be used *only* inside the cacheState function.\n  var lastCachedState = null;\n  function cacheState() {\n    // This should be the only place in $browser where `history.state` is read.\n    cachedState = getCurrentState();\n    cachedState = isUndefined(cachedState) ? null : cachedState;\n\n    // Prevent callbacks fo fire twice if both hashchange & popstate were fired.\n    if (equals(cachedState, lastCachedState)) {\n      cachedState = lastCachedState;\n    }\n    lastCachedState = cachedState;\n  }\n\n  function fireUrlChange() {\n    if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {\n      return;\n    }\n\n    lastBrowserUrl = self.url();\n    lastHistoryState = cachedState;\n    forEach(urlChangeListeners, function(listener) {\n      listener(self.url(), cachedState);\n    });\n  }\n\n  /**\n   * @name $browser#onUrlChange\n   *\n   * @description\n   * Register callback function that will be called, when url changes.\n   *\n   * It's only called when the url is changed from outside of angular:\n   * - user types different url into address bar\n   * - user clicks on history (forward/back) button\n   * - user clicks on a link\n   *\n   * It's not called when url is changed by $browser.url() method\n   *\n   * The listener gets called with new url as parameter.\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to monitor url changes in angular apps.\n   *\n   * @param {function(string)} listener Listener function to be called when url changes.\n   * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.\n   */\n  self.onUrlChange = function(callback) {\n    // TODO(vojta): refactor to use node's syntax for events\n    if (!urlChangeInit) {\n      // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)\n      // don't fire popstate when user change the address bar and don't fire hashchange when url\n      // changed by push/replaceState\n\n      // html5 history api - popstate event\n      if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);\n      // hashchange event\n      jqLite(window).on('hashchange', cacheStateAndFireUrlChange);\n\n      urlChangeInit = true;\n    }\n\n    urlChangeListeners.push(callback);\n    return callback;\n  };\n\n  /**\n   * @private\n   * Remove popstate and hashchange handler from window.\n   *\n   * NOTE: this api is intended for use only by $rootScope.\n   */\n  self.$$applicationDestroyed = function() {\n    jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);\n  };\n\n  /**\n   * Checks whether the url has changed outside of Angular.\n   * Needs to be exported to be able to check for changes that have been done in sync,\n   * as hashchange/popstate events fire in async.\n   */\n  self.$$checkUrlChange = fireUrlChange;\n\n  //////////////////////////////////////////////////////////////\n  // Misc API\n  //////////////////////////////////////////////////////////////\n\n  /**\n   * @name $browser#baseHref\n   *\n   * @description\n   * Returns current <base href>\n   * (always relative - without domain)\n   *\n   * @returns {string} The current base href\n   */\n  self.baseHref = function() {\n    var href = baseElement.attr('href');\n    return href ? href.replace(/^(https?\\:)?\\/\\/[^\\/]*/, '') : '';\n  };\n\n  /**\n   * @name $browser#defer\n   * @param {function()} fn A function, who's execution should be deferred.\n   * @param {number=} [delay=0] of milliseconds to defer the function execution.\n   * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.\n   *\n   * @description\n   * Executes a fn asynchronously via `setTimeout(fn, delay)`.\n   *\n   * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using\n   * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed\n   * via `$browser.defer.flush()`.\n   *\n   */\n  self.defer = function(fn, delay) {\n    var timeoutId;\n    outstandingRequestCount++;\n    timeoutId = setTimeout(function() {\n      delete pendingDeferIds[timeoutId];\n      completeOutstandingRequest(fn);\n    }, delay || 0);\n    pendingDeferIds[timeoutId] = true;\n    return timeoutId;\n  };\n\n\n  /**\n   * @name $browser#defer.cancel\n   *\n   * @description\n   * Cancels a deferred task identified with `deferId`.\n   *\n   * @param {*} deferId Token returned by the `$browser.defer` function.\n   * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n   *                    canceled.\n   */\n  self.defer.cancel = function(deferId) {\n    if (pendingDeferIds[deferId]) {\n      delete pendingDeferIds[deferId];\n      clearTimeout(deferId);\n      completeOutstandingRequest(noop);\n      return true;\n    }\n    return false;\n  };\n\n}\n\nfunction $BrowserProvider() {\n  this.$get = ['$window', '$log', '$sniffer', '$document',\n      function($window, $log, $sniffer, $document) {\n        return new Browser($window, $document, $log, $sniffer);\n      }];\n}\n\n/**\n * @ngdoc service\n * @name $cacheFactory\n *\n * @description\n * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to\n * them.\n *\n * ```js\n *\n *  var cache = $cacheFactory('cacheId');\n *  expect($cacheFactory.get('cacheId')).toBe(cache);\n *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();\n *\n *  cache.put(\"key\", \"value\");\n *  cache.put(\"another key\", \"another value\");\n *\n *  // We've specified no options on creation\n *  expect(cache.info()).toEqual({id: 'cacheId', size: 2});\n *\n * ```\n *\n *\n * @param {string} cacheId Name or id of the newly created cache.\n * @param {object=} options Options object that specifies the cache behavior. Properties:\n *\n *   - `{number=}` `capacity` — turns the cache into LRU cache.\n *\n * @returns {object} Newly created cache object with the following set of methods:\n *\n * - `{object}` `info()` — Returns id, size, and options of cache.\n * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns\n *   it.\n * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.\n * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.\n * - `{void}` `removeAll()` — Removes all cached values.\n * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.\n *\n * @example\n   <example module=\"cacheExampleApp\">\n     <file name=\"index.html\">\n       <div ng-controller=\"CacheController\">\n         <input ng-model=\"newCacheKey\" placeholder=\"Key\">\n         <input ng-model=\"newCacheValue\" placeholder=\"Value\">\n         <button ng-click=\"put(newCacheKey, newCacheValue)\">Cache</button>\n\n         <p ng-if=\"keys.length\">Cached Values</p>\n         <div ng-repeat=\"key in keys\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"cache.get(key)\"></b>\n         </div>\n\n         <p>Cache Info</p>\n         <div ng-repeat=\"(key, value) in cache.info()\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"value\"></b>\n         </div>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('cacheExampleApp', []).\n         controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {\n           $scope.keys = [];\n           $scope.cache = $cacheFactory('cacheId');\n           $scope.put = function(key, value) {\n             if (angular.isUndefined($scope.cache.get(key))) {\n               $scope.keys.push(key);\n             }\n             $scope.cache.put(key, angular.isUndefined(value) ? null : value);\n           };\n         }]);\n     </file>\n     <file name=\"style.css\">\n       p {\n         margin: 10px 0 3px;\n       }\n     </file>\n   </example>\n */\nfunction $CacheFactoryProvider() {\n\n  this.$get = function() {\n    var caches = {};\n\n    function cacheFactory(cacheId, options) {\n      if (cacheId in caches) {\n        throw minErr('$cacheFactory')('iid', \"CacheId '{0}' is already taken!\", cacheId);\n      }\n\n      var size = 0,\n          stats = extend({}, options, {id: cacheId}),\n          data = createMap(),\n          capacity = (options && options.capacity) || Number.MAX_VALUE,\n          lruHash = createMap(),\n          freshEnd = null,\n          staleEnd = null;\n\n      /**\n       * @ngdoc type\n       * @name $cacheFactory.Cache\n       *\n       * @description\n       * A cache object used to store and retrieve data, primarily used by\n       * {@link $http $http} and the {@link ng.directive:script script} directive to cache\n       * templates and other data.\n       *\n       * ```js\n       *  angular.module('superCache')\n       *    .factory('superCache', ['$cacheFactory', function($cacheFactory) {\n       *      return $cacheFactory('super-cache');\n       *    }]);\n       * ```\n       *\n       * Example test:\n       *\n       * ```js\n       *  it('should behave like a cache', inject(function(superCache) {\n       *    superCache.put('key', 'value');\n       *    superCache.put('another key', 'another value');\n       *\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 2\n       *    });\n       *\n       *    superCache.remove('another key');\n       *    expect(superCache.get('another key')).toBeUndefined();\n       *\n       *    superCache.removeAll();\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 0\n       *    });\n       *  }));\n       * ```\n       */\n      return caches[cacheId] = {\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#put\n         * @kind function\n         *\n         * @description\n         * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be\n         * retrieved later, and incrementing the size of the cache if the key was not already\n         * present in the cache. If behaving like an LRU cache, it will also remove stale\n         * entries from the set.\n         *\n         * It will not insert undefined values into the cache.\n         *\n         * @param {string} key the key under which the cached data is stored.\n         * @param {*} value the value to store alongside the key. If it is undefined, the key\n         *    will not be stored.\n         * @returns {*} the value stored.\n         */\n        put: function(key, value) {\n          if (isUndefined(value)) return;\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key] || (lruHash[key] = {key: key});\n\n            refresh(lruEntry);\n          }\n\n          if (!(key in data)) size++;\n          data[key] = value;\n\n          if (size > capacity) {\n            this.remove(staleEnd.key);\n          }\n\n          return value;\n        },\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#get\n         * @kind function\n         *\n         * @description\n         * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the data to be retrieved\n         * @returns {*} the value stored.\n         */\n        get: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            refresh(lruEntry);\n          }\n\n          return data[key];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#remove\n         * @kind function\n         *\n         * @description\n         * Removes an entry from the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the entry to be removed\n         */\n        remove: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            if (lruEntry == freshEnd) freshEnd = lruEntry.p;\n            if (lruEntry == staleEnd) staleEnd = lruEntry.n;\n            link(lruEntry.n,lruEntry.p);\n\n            delete lruHash[key];\n          }\n\n          if (!(key in data)) return;\n\n          delete data[key];\n          size--;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#removeAll\n         * @kind function\n         *\n         * @description\n         * Clears the cache object of any entries.\n         */\n        removeAll: function() {\n          data = createMap();\n          size = 0;\n          lruHash = createMap();\n          freshEnd = staleEnd = null;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#destroy\n         * @kind function\n         *\n         * @description\n         * Destroys the {@link $cacheFactory.Cache Cache} object entirely,\n         * removing it from the {@link $cacheFactory $cacheFactory} set.\n         */\n        destroy: function() {\n          data = null;\n          stats = null;\n          lruHash = null;\n          delete caches[cacheId];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#info\n         * @kind function\n         *\n         * @description\n         * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.\n         *\n         * @returns {object} an object with the following properties:\n         *   <ul>\n         *     <li>**id**: the id of the cache instance</li>\n         *     <li>**size**: the number of entries kept in the cache instance</li>\n         *     <li>**...**: any additional properties from the options object when creating the\n         *       cache.</li>\n         *   </ul>\n         */\n        info: function() {\n          return extend({}, stats, {size: size});\n        }\n      };\n\n\n      /**\n       * makes the `entry` the freshEnd of the LRU linked list\n       */\n      function refresh(entry) {\n        if (entry != freshEnd) {\n          if (!staleEnd) {\n            staleEnd = entry;\n          } else if (staleEnd == entry) {\n            staleEnd = entry.n;\n          }\n\n          link(entry.n, entry.p);\n          link(entry, freshEnd);\n          freshEnd = entry;\n          freshEnd.n = null;\n        }\n      }\n\n\n      /**\n       * bidirectionally links two entries of the LRU linked list\n       */\n      function link(nextEntry, prevEntry) {\n        if (nextEntry != prevEntry) {\n          if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify\n          if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify\n        }\n      }\n    }\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#info\n   *\n   * @description\n   * Get information about all the caches that have been created\n   *\n   * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`\n   */\n    cacheFactory.info = function() {\n      var info = {};\n      forEach(caches, function(cache, cacheId) {\n        info[cacheId] = cache.info();\n      });\n      return info;\n    };\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#get\n   *\n   * @description\n   * Get access to a cache object by the `cacheId` used when it was created.\n   *\n   * @param {string} cacheId Name or id of a cache to access.\n   * @returns {object} Cache object identified by the cacheId or undefined if no such cache.\n   */\n    cacheFactory.get = function(cacheId) {\n      return caches[cacheId];\n    };\n\n\n    return cacheFactory;\n  };\n}\n\n/**\n * @ngdoc service\n * @name $templateCache\n *\n * @description\n * The first time a template is used, it is loaded in the template cache for quick retrieval. You\n * can load templates directly into the cache in a `script` tag, or by consuming the\n * `$templateCache` service directly.\n *\n * Adding via the `script` tag:\n *\n * ```html\n *   <script type=\"text/ng-template\" id=\"templateId.html\">\n *     <p>This is the content of the template</p>\n *   </script>\n * ```\n *\n * **Note:** the `script` tag containing the template does not need to be included in the `head` of\n * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,\n * element with ng-app attribute), otherwise the template will be ignored.\n *\n * Adding via the `$templateCache` service:\n *\n * ```js\n * var myApp = angular.module('myApp', []);\n * myApp.run(function($templateCache) {\n *   $templateCache.put('templateId.html', 'This is the content of the template');\n * });\n * ```\n *\n * To retrieve the template later, simply use it in your HTML:\n * ```html\n * <div ng-include=\" 'templateId.html' \"></div>\n * ```\n *\n * or get it via Javascript:\n * ```js\n * $templateCache.get('templateId.html')\n * ```\n *\n * See {@link ng.$cacheFactory $cacheFactory}.\n *\n */\nfunction $TemplateCacheProvider() {\n  this.$get = ['$cacheFactory', function($cacheFactory) {\n    return $cacheFactory('templates');\n  }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!\n *\n * DOM-related variables:\n *\n * - \"node\" - DOM Node\n * - \"element\" - DOM Element or Node\n * - \"$node\" or \"$element\" - jqLite-wrapped node or element\n *\n *\n * Compiler related stuff:\n *\n * - \"linkFn\" - linking fn of a single directive\n * - \"nodeLinkFn\" - function that aggregates all linking fns for a particular node\n * - \"childLinkFn\" -  function that aggregates all linking fns for child nodes of a particular node\n * - \"compositeLinkFn\" - function that aggregates all linking fns for a compilation root (nodeList)\n */\n\n\n/**\n * @ngdoc service\n * @name $compile\n * @kind function\n *\n * @description\n * Compiles an HTML string or DOM into a template and produces a template function, which\n * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.\n *\n * The compilation is a process of walking the DOM tree and matching DOM elements to\n * {@link ng.$compileProvider#directive directives}.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** This document is an in-depth reference of all directive options.\n * For a gentle introduction to directives with examples of common use cases,\n * see the {@link guide/directive directive guide}.\n * </div>\n *\n * ## Comprehensive Directive API\n *\n * There are many different options for a directive.\n *\n * The difference resides in the return value of the factory function.\n * You can either return a \"Directive Definition Object\" (see below) that defines the directive properties,\n * or just the `postLink` function (all other properties will have the default values).\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's recommended to use the \"directive definition object\" form.\n * </div>\n *\n * Here's an example directive declared with a Directive Definition Object:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       priority: 0,\n *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },\n *       // or\n *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },\n *       transclude: false,\n *       restrict: 'A',\n *       templateNamespace: 'html',\n *       scope: false,\n *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },\n *       controllerAs: 'stringIdentifier',\n *       bindToController: false,\n *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],\n *       compile: function compile(tElement, tAttrs, transclude) {\n *         return {\n *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *           post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *         }\n *         // or\n *         // return function postLink( ... ) { ... }\n *       },\n *       // or\n *       // link: {\n *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *       // }\n *       // or\n *       // link: function postLink( ... ) { ... }\n *     };\n *     return directiveDefinitionObject;\n *   });\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Any unspecified options will use the default value. You can see the default values below.\n * </div>\n *\n * Therefore the above can be simplified as:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       link: function postLink(scope, iElement, iAttrs) { ... }\n *     };\n *     return directiveDefinitionObject;\n *     // or\n *     // return function postLink(scope, iElement, iAttrs) { ... }\n *   });\n * ```\n *\n *\n *\n * ### Directive Definition Object\n *\n * The directive definition object provides instructions to the {@link ng.$compile\n * compiler}. The attributes are:\n *\n * #### `multiElement`\n * When this property is set to true, the HTML compiler will collect DOM nodes between\n * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them\n * together as the directive elements. It is recommended that this feature be used on directives\n * which are not strictly behavioral (such as {@link ngClick}), and which\n * do not manipulate or replace child nodes (such as {@link ngInclude}).\n *\n * #### `priority`\n * When there are multiple directives defined on a single DOM element, sometimes it\n * is necessary to specify the order in which the directives are applied. The `priority` is used\n * to sort the directives before their `compile` functions get called. Priority is defined as a\n * number. Directives with greater numerical `priority` are compiled first. Pre-link functions\n * are also run in priority order, but post-link functions are run in reverse order. The order\n * of directives with the same priority is undefined. The default priority is `0`.\n *\n * #### `terminal`\n * If set to true then the current `priority` will be the last set of directives\n * which will execute (any directives at the current priority will still execute\n * as the order of execution on same `priority` is undefined). Note that expressions\n * and other directives used in the directive's template will also be excluded from execution.\n *\n * #### `scope`\n * The scope property can be `true`, an object or a falsy value:\n *\n * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.\n *\n * * **`true`:** A new child scope that prototypically inherits from its parent will be created for\n * the directive's element. If multiple directives on the same element request a new scope,\n * only one new scope is created. The new scope rule does not apply for the root of the template\n * since the root of the template always gets a new scope.\n *\n * * **`{...}` (an object hash):** A new \"isolate\" scope is created for the directive's element. The\n * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent\n * scope. This is useful when creating reusable components, which should not accidentally read or modify\n * data in the parent scope.\n *\n * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the\n * directive's element. These local properties are useful for aliasing values for templates. The keys in\n * the object hash map to the name of the property on the isolate scope; the values define how the property\n * is bound to the parent scope, via matching attributes on the directive's element:\n *\n * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is\n *   always a string since DOM attributes are strings. If no `attr` name is specified then the\n *   attribute name is assumed to be the same as the local name. Given `<my-component\n *   my-attr=\"hello {{name}}\">` and the isolate scope definition `scope: { localName:'@myAttr' }`,\n *   the directive's scope property `localName` will reflect the interpolated value of `hello\n *   {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's\n *   scope. The `name` is read from the parent scope (not the directive's scope).\n *\n * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression\n *   passed via the attribute `attr`. The expression is evaluated in the context of the parent scope.\n *   If no `attr` name is specified then the attribute name is assumed to be the same as the local\n *   name. Given `<my-component my-attr=\"parentModel\">` and the isolate scope definition `scope: {\n *   localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the\n *   value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in\n *   `localModel` and vice versa. Optional attributes should be marked as such with a question mark:\n *   `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't\n *   optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`})\n *   will be thrown upon discovering changes to the local value, since it will be impossible to sync\n *   them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`}\n *   method is used for tracking changes, and the equality check is based on object identity.\n *   However, if an object literal or an array literal is passed as the binding expression, the\n *   equality check is done by value (using the {@link angular.equals} function). It's also possible\n *   to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection\n *   `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional).\n *\n  * * `<` or `<attr` - set up a one-way (one-directional) binding between a local scope property and an\n *   expression passed via the attribute `attr`. The expression is evaluated in the context of the\n *   parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the\n *   local name. You can also make the binding optional by adding `?`: `<?` or `<?attr`.\n *\n *   For example, given `<my-component my-attr=\"parentModel\">` and directive definition of\n *   `scope: { localModel:'<myAttr' }`, then the isolated scope property `localModel` will reflect the\n *   value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected\n *   in `localModel`, but changes in `localModel` will not reflect in `parentModel`. There are however\n *   two caveats:\n *     1. one-way binding does not copy the value from the parent to the isolate scope, it simply\n *     sets the same value. That means if your bound value is an object, changes to its properties\n *     in the isolated scope will be reflected in the parent scope (because both reference the same object).\n *     2. one-way binding watches changes to the **identity** of the parent value. That means the\n *     {@link ng.$rootScope.Scope#$watch `$watch`} on the parent value only fires if the reference\n *     to the value has changed. In most cases, this should not be of concern, but can be important\n *     to know if you one-way bind to an object, and then replace that object in the isolated scope.\n *     If you now change a property of the object in your parent scope, the change will not be\n *     propagated to the isolated scope, because the identity of the object on the parent scope\n *     has not changed. Instead you must assign a new object.\n *\n *   One-way binding is useful if you do not plan to propagate changes to your isolated scope bindings\n *   back to the parent. However, it does not make this completely impossible.\n *\n * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If\n *   no `attr` name is specified then the attribute name is assumed to be the same as the local name.\n *   Given `<my-component my-attr=\"count = count + value\">` and the isolate scope definition `scope: {\n *   localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for\n *   the `count = count + value` expression. Often it's desirable to pass data from the isolated scope\n *   via an expression to the parent scope. This can be done by passing a map of local variable names\n *   and values into the expression wrapper fn. For example, if the expression is `increment(amount)`\n *   then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.\n *\n * In general it's possible to apply more than one directive to one element, but there might be limitations\n * depending on the type of scope required by the directives. The following points will help explain these limitations.\n * For simplicity only two directives are taken into account, but it is also applicable for several directives:\n *\n * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope\n * * **child scope** + **no scope** =>  Both directives will share one single child scope\n * * **child scope** + **child scope** =>  Both directives will share one single child scope\n * * **isolated scope** + **no scope** =>  The isolated directive will use it's own created isolated scope. The other directive will use\n * its parent's scope\n * * **isolated scope** + **child scope** =>  **Won't work!** Only one scope can be related to one element. Therefore these directives cannot\n * be applied to the same element.\n * * **isolated scope** + **isolated scope**  =>  **Won't work!** Only one scope can be related to one element. Therefore these directives\n * cannot be applied to the same element.\n *\n *\n * #### `bindToController`\n * This property is used to bind scope properties directly to the controller. It can be either\n * `true` or an object hash with the same format as the `scope` property. Additionally, a controller\n * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller\n * definition: `controller: 'myCtrl as myAlias'`.\n *\n * When an isolate scope is used for a directive (see above), `bindToController: true` will\n * allow a component to have its properties bound to the controller, rather than to scope.\n *\n * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller\n * properties. You can access these bindings once they have been initialized by providing a controller method called\n * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings\n * initialized.\n *\n * <div class=\"alert alert-warning\">\n * **Deprecation warning:** although bindings for non-ES6 class controllers are currently\n * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization\n * code that relies upon bindings inside a `$onInit` method on the controller, instead.\n * </div>\n *\n * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.\n * This will set up the scope bindings to the controller directly. Note that `scope` can still be used\n * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate\n * scope (useful for component directives).\n *\n * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.\n *\n *\n * #### `controller`\n * Controller constructor function. The controller is instantiated before the\n * pre-linking phase and can be accessed by other directives (see\n * `require` attribute). This allows the directives to communicate with each other and augment\n * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:\n *\n * * `$scope` - Current scope associated with the element\n * * `$element` - Current element\n * * `$attrs` - Current attributes object for the element\n * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:\n *   `function([scope], cloneLinkingFn, futureParentElement, slotName)`:\n *    * `scope`: (optional) override the scope.\n *    * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content.\n *    * `futureParentElement` (optional):\n *        * defines the parent to which the `cloneLinkingFn` will add the cloned elements.\n *        * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.\n *        * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)\n *          and when the `cloneLinkinFn` is passed,\n *          as those elements need to created and cloned in a special way when they are defined outside their\n *          usual containers (e.g. like `<svg>`).\n *        * See also the `directive.templateNamespace` property.\n *    * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`)\n *      then the default translusion is provided.\n *    The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns\n *    `true` if the specified slot contains content (i.e. one or more DOM nodes).\n *\n * The controller can provide the following methods that act as life-cycle hooks:\n * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and\n *   had their bindings initialized (and before the pre &amp; post linking functions for the directives on\n *   this element). This is a good place to put initialization code for your controller.\n * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The\n *   `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an\n *   object of the form `{ currentValue: ..., previousValue: ... }`. Use this hook to trigger updates within a component\n *   such as cloning the bound value to prevent accidental mutation of the outer value.\n * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing\n *   external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in\n *   the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent\n *   components will have their `$onDestroy()` hook called before child components.\n * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link\n *   function this hook can be used to set up DOM event handlers and do direct DOM manipulation.\n *   Note that child elements that contain `templateUrl` directives will not have been compiled and linked since\n *   they are waiting for their template to load asynchronously and their own compilation and linking has been\n *   suspended until that occurs.\n *\n *\n * #### `require`\n * Require another directive and inject its controller as the fourth argument to the linking function. The\n * `require` property can be a string, an array or an object:\n * * a **string** containing the name of the directive to pass to the linking function\n * * an **array** containing the names of directives to pass to the linking function. The argument passed to the\n * linking function will be an array of controllers in the same order as the names in the `require` property\n * * an **object** whose property values are the names of the directives to pass to the linking function. The argument\n * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding\n * controllers.\n *\n * If the `require` property is an object and `bindToController` is truthy, then the required controllers are\n * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers\n * have been constructed but before `$onInit` is called.\n * See the {@link $compileProvider#component} helper for an example of how this can be used.\n *\n * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is\n * raised (unless no link function is specified and the required controllers are not being bound to the directive\n * controller, in which case error checking is skipped). The name can be prefixed with:\n *\n * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.\n * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.\n * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.\n * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.\n * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass\n *   `null` to the `link` fn if not found.\n * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass\n *   `null` to the `link` fn if not found.\n *\n *\n * #### `controllerAs`\n * Identifier name for a reference to the controller in the directive's scope.\n * This allows the controller to be referenced from the directive template. This is especially\n * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible\n * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the\n * `controllerAs` reference might overwrite a property that already exists on the parent scope.\n *\n *\n * #### `restrict`\n * String of subset of `EACM` which restricts the directive to a specific directive\n * declaration style. If omitted, the defaults (elements and attributes) are used.\n *\n * * `E` - Element name (default): `<my-directive></my-directive>`\n * * `A` - Attribute (default): `<div my-directive=\"exp\"></div>`\n * * `C` - Class: `<div class=\"my-directive: exp;\"></div>`\n * * `M` - Comment: `<!-- directive: my-directive exp -->`\n *\n *\n * #### `templateNamespace`\n * String representing the document type used by the markup in the template.\n * AngularJS needs this information as those elements need to be created and cloned\n * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.\n *\n * * `html` - All root nodes in the template are HTML. Root nodes may also be\n *   top-level elements such as `<svg>` or `<math>`.\n * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).\n * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).\n *\n * If no `templateNamespace` is specified, then the namespace is considered to be `html`.\n *\n * #### `template`\n * HTML markup that may:\n * * Replace the contents of the directive's element (default).\n * * Replace the directive's element itself (if `replace` is true - DEPRECATED).\n * * Wrap the contents of the directive's element (if `transclude` is true).\n *\n * Value may be:\n *\n * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.\n * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`\n *   function api below) and returns a string value.\n *\n *\n * #### `templateUrl`\n * This is similar to `template` but the template is loaded from the specified URL, asynchronously.\n *\n * Because template loading is asynchronous the compiler will suspend compilation of directives on that element\n * for later when the template has been resolved.  In the meantime it will continue to compile and link\n * sibling and parent elements as though this element had not contained any directives.\n *\n * The compiler does not suspend the entire compilation to wait for templates to be loaded because this\n * would result in the whole app \"stalling\" until all templates are loaded asynchronously - even in the\n * case when only one deeply nested directive has `templateUrl`.\n *\n * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}\n *\n * You can specify `templateUrl` as a string representing the URL or as a function which takes two\n * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns\n * a string value representing the url.  In either case, the template URL is passed through {@link\n * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.\n *\n *\n * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)\n * specify what the template should replace. Defaults to `false`.\n *\n * * `true` - the template will replace the directive's element.\n * * `false` - the template will replace the contents of the directive's element.\n *\n * The replacement process migrates all of the attributes / classes from the old element to the new\n * one. See the {@link guide/directive#template-expanding-directive\n * Directives Guide} for an example.\n *\n * There are very few scenarios where element replacement is required for the application function,\n * the main one being reusable custom components that are used within SVG contexts\n * (because SVG doesn't work with custom elements in the DOM tree).\n *\n * #### `transclude`\n * Extract the contents of the element where the directive appears and make it available to the directive.\n * The contents are compiled and provided to the directive as a **transclusion function**. See the\n * {@link $compile#transclusion Transclusion} section below.\n *\n *\n * #### `compile`\n *\n * ```js\n *   function compile(tElement, tAttrs, transclude) { ... }\n * ```\n *\n * The compile function deals with transforming the template DOM. Since most directives do not do\n * template transformation, it is not used often. The compile function takes the following arguments:\n *\n *   * `tElement` - template element - The element where the directive has been declared. It is\n *     safe to do template transformation on the element and child elements only.\n *\n *   * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared\n *     between all directive compile functions.\n *\n *   * `transclude` -  [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`\n *\n * <div class=\"alert alert-warning\">\n * **Note:** The template instance and the link instance may be different objects if the template has\n * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that\n * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration\n * should be done in a linking function rather than in a compile function.\n * </div>\n\n * <div class=\"alert alert-warning\">\n * **Note:** The compile function cannot handle directives that recursively use themselves in their\n * own templates or compile functions. Compiling these directives results in an infinite loop and\n * stack overflow errors.\n *\n * This can be avoided by manually using $compile in the postLink function to imperatively compile\n * a directive's template instead of relying on automatic template compilation via `template` or\n * `templateUrl` declaration or manual compilation inside the compile function.\n * </div>\n *\n * <div class=\"alert alert-danger\">\n * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it\n *   e.g. does not know about the right outer scope. Please use the transclude function that is passed\n *   to the link function instead.\n * </div>\n\n * A compile function can have a return value which can be either a function or an object.\n *\n * * returning a (post-link) function - is equivalent to registering the linking function via the\n *   `link` property of the config object when the compile function is empty.\n *\n * * returning an object with function(s) registered via `pre` and `post` properties - allows you to\n *   control when a linking function should be called during the linking phase. See info about\n *   pre-linking and post-linking functions below.\n *\n *\n * #### `link`\n * This property is used only if the `compile` property is not defined.\n *\n * ```js\n *   function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }\n * ```\n *\n * The link function is responsible for registering DOM listeners as well as updating the DOM. It is\n * executed after the template has been cloned. This is where most of the directive logic will be\n * put.\n *\n *   * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the\n *     directive for registering {@link ng.$rootScope.Scope#$watch watches}.\n *\n *   * `iElement` - instance element - The element where the directive is to be used. It is safe to\n *     manipulate the children of the element only in `postLink` function since the children have\n *     already been linked.\n *\n *   * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared\n *     between all directive linking functions.\n *\n *   * `controller` - the directive's required controller instance(s) - Instances are shared\n *     among all directives, which allows the directives to use the controllers as a communication\n *     channel. The exact value depends on the directive's `require` property:\n *       * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one\n *       * `string`: the controller instance\n *       * `array`: array of controller instances\n *\n *     If a required controller cannot be found, and it is optional, the instance is `null`,\n *     otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.\n *\n *     Note that you can also require the directive's own controller - it will be made available like\n *     any other controller.\n *\n *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.\n *     This is the same as the `$transclude`\n *     parameter of directive controllers, see there for details.\n *     `function([scope], cloneLinkingFn, futureParentElement)`.\n *\n * #### Pre-linking function\n *\n * Executed before the child elements are linked. Not safe to do DOM transformation since the\n * compiler linking function will fail to locate the correct elements for linking.\n *\n * #### Post-linking function\n *\n * Executed after the child elements are linked.\n *\n * Note that child elements that contain `templateUrl` directives will not have been compiled\n * and linked since they are waiting for their template to load asynchronously and their own\n * compilation and linking has been suspended until that occurs.\n *\n * It is safe to do DOM transformation in the post-linking function on elements that are not waiting\n * for their async templates to be resolved.\n *\n *\n * ### Transclusion\n *\n * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and\n * copying them to another part of the DOM, while maintaining their connection to the original AngularJS\n * scope from where they were taken.\n *\n * Transclusion is used (often with {@link ngTransclude}) to insert the\n * original contents of a directive's element into a specified place in the template of the directive.\n * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded\n * content has access to the properties on the scope from which it was taken, even if the directive\n * has isolated scope.\n * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.\n *\n * This makes it possible for the widget to have private state for its template, while the transcluded\n * content has access to its originating scope.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** When testing an element transclude directive you must not place the directive at the root of the\n * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives\n * Testing Transclusion Directives}.\n * </div>\n *\n * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the\n * directive's element, the entire element or multiple parts of the element contents:\n *\n * * `true` - transclude the content (i.e. the child nodes) of the directive's element.\n * * `'element'` - transclude the whole of the directive's element including any directives on this\n *   element that defined at a lower priority than this directive. When used, the `template`\n *   property is ignored.\n * * **`{...}` (an object hash):** - map elements of the content onto transclusion \"slots\" in the template.\n *\n * **Mult-slot transclusion** is declared by providing an object for the `transclude` property.\n *\n * This object is a map where the keys are the name of the slot to fill and the value is an element selector\n * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)\n * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).\n *\n * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}\n *\n * If the element selector is prefixed with a `?` then that slot is optional.\n *\n * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `<my-custom-element>` elements to\n * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive.\n *\n * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements\n * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call\n * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and\n * injectable into the directive's controller.\n *\n *\n * #### Transclusion Functions\n *\n * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion\n * function** to the directive's `link` function and `controller`. This transclusion function is a special\n * **linking function** that will return the compiled contents linked to a new transclusion scope.\n *\n * <div class=\"alert alert-info\">\n * If you are just using {@link ngTransclude} then you don't need to worry about this function, since\n * ngTransclude will deal with it for us.\n * </div>\n *\n * If you want to manually control the insertion and removal of the transcluded content in your directive\n * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery\n * object that contains the compiled DOM, which is linked to the correct transclusion scope.\n *\n * When you call a transclusion function you can pass in a **clone attach function**. This function accepts\n * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded\n * content and the `scope` is the newly created transclusion scope, to which the clone is bound.\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function\n * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.\n * </div>\n *\n * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone\n * attach function**:\n *\n * ```js\n * var transcludedContent, transclusionScope;\n *\n * $transclude(function(clone, scope) {\n *   element.append(clone);\n *   transcludedContent = clone;\n *   transclusionScope = scope;\n * });\n * ```\n *\n * Later, if you want to remove the transcluded content from your DOM then you should also destroy the\n * associated transclusion scope:\n *\n * ```js\n * transcludedContent.remove();\n * transclusionScope.$destroy();\n * ```\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: if you intend to add and remove transcluded content manually in your directive\n * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),\n * then you are also responsible for calling `$destroy` on the transclusion scope.\n * </div>\n *\n * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}\n * automatically destroy their transcluded clones as necessary so you do not need to worry about this if\n * you are simply using {@link ngTransclude} to inject the transclusion into your directive.\n *\n *\n * #### Transclusion Scopes\n *\n * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion\n * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed\n * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it\n * was taken.\n *\n * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look\n * like this:\n *\n * ```html\n * <div ng-app>\n *   <div isolate>\n *     <div transclusion>\n *     </div>\n *   </div>\n * </div>\n * ```\n *\n * The `$parent` scope hierarchy will look like this:\n *\n   ```\n   - $rootScope\n     - isolate\n       - transclusion\n   ```\n *\n * but the scopes will inherit prototypically from different scopes to their `$parent`.\n *\n   ```\n   - $rootScope\n     - transclusion\n   - isolate\n   ```\n *\n *\n * ### Attributes\n *\n * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the\n * `link()` or `compile()` functions. It has a variety of uses.\n *\n * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:\n *   'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access\n *   to the attributes.\n *\n * * *Directive inter-communication:* All directives share the same instance of the attributes\n *   object which allows the directives to use the attributes object as inter directive\n *   communication.\n *\n * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object\n *   allowing other directives to read the interpolated value.\n *\n * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes\n *   that contain interpolation (e.g. `src=\"{{bar}}\"`). Not only is this very efficient but it's also\n *   the only way to easily get the actual value because during the linking phase the interpolation\n *   hasn't been evaluated yet and so the value is at this time set to `undefined`.\n *\n * ```js\n * function linkingFn(scope, elm, attrs, ctrl) {\n *   // get the attribute value\n *   console.log(attrs.ngModel);\n *\n *   // change the attribute\n *   attrs.$set('ngModel', 'new value');\n *\n *   // observe changes to interpolated attribute\n *   attrs.$observe('ngModel', function(value) {\n *     console.log('ngModel has changed value to ' + value);\n *   });\n * }\n * ```\n *\n * ## Example\n *\n * <div class=\"alert alert-warning\">\n * **Note**: Typically directives are registered with `module.directive`. The example below is\n * to illustrate how `$compile` works.\n * </div>\n *\n <example module=\"compileExample\">\n   <file name=\"index.html\">\n    <script>\n      angular.module('compileExample', [], function($compileProvider) {\n        // configure new 'compile' directive by passing a directive\n        // factory function. The factory function injects the '$compile'\n        $compileProvider.directive('compile', function($compile) {\n          // directive factory creates a link function\n          return function(scope, element, attrs) {\n            scope.$watch(\n              function(scope) {\n                 // watch the 'compile' expression for changes\n                return scope.$eval(attrs.compile);\n              },\n              function(value) {\n                // when the 'compile' expression changes\n                // assign it into the current DOM\n                element.html(value);\n\n                // compile the new DOM and link it to the current\n                // scope.\n                // NOTE: we only compile .childNodes so that\n                // we don't get into infinite loop compiling ourselves\n                $compile(element.contents())(scope);\n              }\n            );\n          };\n        });\n      })\n      .controller('GreeterController', ['$scope', function($scope) {\n        $scope.name = 'Angular';\n        $scope.html = 'Hello {{name}}';\n      }]);\n    </script>\n    <div ng-controller=\"GreeterController\">\n      <input ng-model=\"name\"> <br/>\n      <textarea ng-model=\"html\"></textarea> <br/>\n      <div compile=\"html\"></div>\n    </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should auto compile', function() {\n       var textarea = $('textarea');\n       var output = $('div[compile]');\n       // The initial state reads 'Hello Angular'.\n       expect(output.getText()).toBe('Hello Angular');\n       textarea.clear();\n       textarea.sendKeys('{{name}}!');\n       expect(output.getText()).toBe('Angular!');\n     });\n   </file>\n </example>\n\n *\n *\n * @param {string|DOMElement} element Element or HTML string to compile into a template function.\n * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.\n *\n * <div class=\"alert alert-danger\">\n * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it\n *   e.g. will not use the right outer scope. Please pass the transclude function as a\n *   `parentBoundTranscludeFn` to the link function instead.\n * </div>\n *\n * @param {number} maxPriority only apply directives lower than given priority (Only effects the\n *                 root element(s), not their children)\n * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template\n * (a DOM element/tree) to a scope. Where:\n *\n *  * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.\n *  * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the\n *  `template` and call the `cloneAttachFn` function allowing the caller to attach the\n *  cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is\n *  called as: <br/> `cloneAttachFn(clonedElement, scope)` where:\n *\n *      * `clonedElement` - is a clone of the original `element` passed into the compiler.\n *      * `scope` - is the current scope with which the linking function is working with.\n *\n *  * `options` - An optional object hash with linking options. If `options` is provided, then the following\n *  keys may be used to control linking behavior:\n *\n *      * `parentBoundTranscludeFn` - the transclude function made available to\n *        directives; if given, it will be passed through to the link functions of\n *        directives found in `element` during compilation.\n *      * `transcludeControllers` - an object hash with keys that map controller names\n *        to a hash with the key `instance`, which maps to the controller instance;\n *        if given, it will make the controllers available to directives on the compileNode:\n *        ```\n *        {\n *          parent: {\n *            instance: parentControllerInstance\n *          }\n *        }\n *        ```\n *      * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add\n *        the cloned elements; only needed for transcludes that are allowed to contain non html\n *        elements (e.g. SVG elements). See also the directive.controller property.\n *\n * Calling the linking function returns the element of the template. It is either the original\n * element passed in, or the clone of the element if the `cloneAttachFn` is provided.\n *\n * After linking the view is not updated until after a call to $digest which typically is done by\n * Angular automatically.\n *\n * If you need access to the bound view, there are two ways to do it:\n *\n * - If you are not asking the linking function to clone the template, create the DOM element(s)\n *   before you send them to the compiler and keep this reference around.\n *   ```js\n *     var element = $compile('<p>{{total}}</p>')(scope);\n *   ```\n *\n * - if on the other hand, you need the element to be cloned, the view reference from the original\n *   example would not point to the clone, but rather to the original template that was cloned. In\n *   this case, you can access the clone via the cloneAttachFn:\n *   ```js\n *     var templateElement = angular.element('<p>{{total}}</p>'),\n *         scope = ....;\n *\n *     var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {\n *       //attach the clone to DOM document at the right place\n *     });\n *\n *     //now we have reference to the cloned DOM via `clonedElement`\n *   ```\n *\n *\n * For information on how the compiler works, see the\n * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.\n */\n\nvar $compileMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $compileProvider\n *\n * @description\n */\n$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];\nfunction $CompileProvider($provide, $$sanitizeUriProvider) {\n  var hasDirectives = {},\n      Suffix = 'Directive',\n      COMMENT_DIRECTIVE_REGEXP = /^\\s*directive\\:\\s*([\\w\\-]+)\\s+(.*)$/,\n      CLASS_DIRECTIVE_REGEXP = /(([\\w\\-]+)(?:\\:([^;]+))?;?)/,\n      ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),\n      REQUIRE_PREFIX_REGEXP = /^(?:(\\^\\^?)?(\\?)?(\\^\\^?)?)?/;\n\n  // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes\n  // The assumption is that future DOM event attribute names will begin with\n  // 'on' and be composed of only English letters.\n  var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;\n  var bindingCache = createMap();\n\n  function parseIsolateBindings(scope, directiveName, isController) {\n    var LOCAL_REGEXP = /^\\s*([@&<]|=(\\*?))(\\??)\\s*(\\w*)\\s*$/;\n\n    var bindings = {};\n\n    forEach(scope, function(definition, scopeName) {\n      if (definition in bindingCache) {\n        bindings[scopeName] = bindingCache[definition];\n        return;\n      }\n      var match = definition.match(LOCAL_REGEXP);\n\n      if (!match) {\n        throw $compileMinErr('iscp',\n            \"Invalid {3} for directive '{0}'.\" +\n            \" Definition: {... {1}: '{2}' ...}\",\n            directiveName, scopeName, definition,\n            (isController ? \"controller bindings definition\" :\n            \"isolate scope definition\"));\n      }\n\n      bindings[scopeName] = {\n        mode: match[1][0],\n        collection: match[2] === '*',\n        optional: match[3] === '?',\n        attrName: match[4] || scopeName\n      };\n      if (match[4]) {\n        bindingCache[definition] = bindings[scopeName];\n      }\n    });\n\n    return bindings;\n  }\n\n  function parseDirectiveBindings(directive, directiveName) {\n    var bindings = {\n      isolateScope: null,\n      bindToController: null\n    };\n    if (isObject(directive.scope)) {\n      if (directive.bindToController === true) {\n        bindings.bindToController = parseIsolateBindings(directive.scope,\n                                                         directiveName, true);\n        bindings.isolateScope = {};\n      } else {\n        bindings.isolateScope = parseIsolateBindings(directive.scope,\n                                                     directiveName, false);\n      }\n    }\n    if (isObject(directive.bindToController)) {\n      bindings.bindToController =\n          parseIsolateBindings(directive.bindToController, directiveName, true);\n    }\n    if (isObject(bindings.bindToController)) {\n      var controller = directive.controller;\n      var controllerAs = directive.controllerAs;\n      if (!controller) {\n        // There is no controller, there may or may not be a controllerAs property\n        throw $compileMinErr('noctrl',\n              \"Cannot bind to controller without directive '{0}'s controller.\",\n              directiveName);\n      } else if (!identifierForController(controller, controllerAs)) {\n        // There is a controller, but no identifier or controllerAs property\n        throw $compileMinErr('noident',\n              \"Cannot bind to controller without identifier for directive '{0}'.\",\n              directiveName);\n      }\n    }\n    return bindings;\n  }\n\n  function assertValidDirectiveName(name) {\n    var letter = name.charAt(0);\n    if (!letter || letter !== lowercase(letter)) {\n      throw $compileMinErr('baddir', \"Directive/Component name '{0}' is invalid. The first character must be a lowercase letter\", name);\n    }\n    if (name !== name.trim()) {\n      throw $compileMinErr('baddir',\n            \"Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces\",\n            name);\n    }\n  }\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#directive\n   * @kind function\n   *\n   * @description\n   * Register a new directive with the compiler.\n   *\n   * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which\n   *    will match as <code>ng-bind</code>), or an object map of directives where the keys are the\n   *    names and the values are the factories.\n   * @param {Function|Array} directiveFactory An injectable directive factory function. See the\n   *    {@link guide/directive directive guide} and the {@link $compile compile API} for more info.\n   * @returns {ng.$compileProvider} Self for chaining.\n   */\n  this.directive = function registerDirective(name, directiveFactory) {\n    assertNotHasOwnProperty(name, 'directive');\n    if (isString(name)) {\n      assertValidDirectiveName(name);\n      assertArg(directiveFactory, 'directiveFactory');\n      if (!hasDirectives.hasOwnProperty(name)) {\n        hasDirectives[name] = [];\n        $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',\n          function($injector, $exceptionHandler) {\n            var directives = [];\n            forEach(hasDirectives[name], function(directiveFactory, index) {\n              try {\n                var directive = $injector.invoke(directiveFactory);\n                if (isFunction(directive)) {\n                  directive = { compile: valueFn(directive) };\n                } else if (!directive.compile && directive.link) {\n                  directive.compile = valueFn(directive.link);\n                }\n                directive.priority = directive.priority || 0;\n                directive.index = index;\n                directive.name = directive.name || name;\n                directive.require = directive.require || (directive.controller && directive.name);\n                directive.restrict = directive.restrict || 'EA';\n                directive.$$moduleName = directiveFactory.$$moduleName;\n                directives.push(directive);\n              } catch (e) {\n                $exceptionHandler(e);\n              }\n            });\n            return directives;\n          }]);\n      }\n      hasDirectives[name].push(directiveFactory);\n    } else {\n      forEach(name, reverseParams(registerDirective));\n    }\n    return this;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#component\n   * @module ng\n   * @param {string} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`)\n   * @param {Object} options Component definition object (a simplified\n   *    {@link ng.$compile#directive-definition-object directive definition object}),\n   *    with the following properties (all optional):\n   *\n   *    - `controller` – `{(string|function()=}` – controller constructor function that should be\n   *      associated with newly created scope or the name of a {@link ng.$compile#-controller-\n   *      registered controller} if passed as a string. An empty `noop` function by default.\n   *    - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope.\n   *      If present, the controller will be published to scope under the `controllerAs` name.\n   *      If not present, this will default to be `$ctrl`.\n   *    - `template` – `{string=|function()=}` – html template as a string or a function that\n   *      returns an html template as a string which should be used as the contents of this component.\n   *      Empty string by default.\n   *\n   *      If `template` is a function, then it is {@link auto.$injector#invoke injected} with\n   *      the following locals:\n   *\n   *      - `$element` - Current element\n   *      - `$attrs` - Current attributes object for the element\n   *\n   *    - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html\n   *      template that should be used  as the contents of this component.\n   *\n   *      If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with\n   *      the following locals:\n   *\n   *      - `$element` - Current element\n   *      - `$attrs` - Current attributes object for the element\n   *\n   *    - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties.\n   *      Component properties are always bound to the component controller and not to the scope.\n   *      See {@link ng.$compile#-bindtocontroller- `bindToController`}.\n   *    - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.\n   *      Disabled by default.\n   *    - `$...` – additional properties to attach to the directive factory function and the controller\n   *      constructor function. (This is used by the component router to annotate)\n   *\n   * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls.\n   * @description\n   * Register a **component definition** with the compiler. This is a shorthand for registering a special\n   * type of directive, which represents a self-contained UI component in your application. Such components\n   * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).\n   *\n   * Component definitions are very simple and do not require as much configuration as defining general\n   * directives. Component definitions usually consist only of a template and a controller backing it.\n   *\n   * In order to make the definition easier, components enforce best practices like use of `controllerAs`,\n   * `bindToController`. They always have **isolate scope** and are restricted to elements.\n   *\n   * Here are a few examples of how you would usually define components:\n   *\n   * ```js\n   *   var myMod = angular.module(...);\n   *   myMod.component('myComp', {\n   *     template: '<div>My name is {{$ctrl.name}}</div>',\n   *     controller: function() {\n   *       this.name = 'shahar';\n   *     }\n   *   });\n   *\n   *   myMod.component('myComp', {\n   *     template: '<div>My name is {{$ctrl.name}}</div>',\n   *     bindings: {name: '@'}\n   *   });\n   *\n   *   myMod.component('myComp', {\n   *     templateUrl: 'views/my-comp.html',\n   *     controller: 'MyCtrl',\n   *     controllerAs: 'ctrl',\n   *     bindings: {name: '@'}\n   *   });\n   *\n   * ```\n   * For more examples, and an in-depth guide, see the {@link guide/component component guide}.\n   *\n   * <br />\n   * See also {@link ng.$compileProvider#directive $compileProvider.directive()}.\n   */\n  this.component = function registerComponent(name, options) {\n    var controller = options.controller || noop;\n\n    function factory($injector) {\n      function makeInjectable(fn) {\n        if (isFunction(fn) || isArray(fn)) {\n          return function(tElement, tAttrs) {\n            return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});\n          };\n        } else {\n          return fn;\n        }\n      }\n\n      var template = (!options.template && !options.templateUrl ? '' : options.template);\n      return {\n        controller: controller,\n        controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',\n        template: makeInjectable(template),\n        templateUrl: makeInjectable(options.templateUrl),\n        transclude: options.transclude,\n        scope: {},\n        bindToController: options.bindings || {},\n        restrict: 'E',\n        require: options.require\n      };\n    }\n\n    // Copy any annotation properties (starting with $) over to the factory function\n    // These could be used by libraries such as the new component router\n    forEach(options, function(val, key) {\n      if (key.charAt(0) === '$') {\n        factory[key] = val;\n        controller[key] = val;\n      }\n    });\n\n    factory.$inject = ['$injector'];\n\n    return this.directive(name, factory);\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#aHrefSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at preventing XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.aHrefSanitizationWhitelist();\n    }\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#imgSrcSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name  $compileProvider#debugInfoEnabled\n   *\n   * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the\n   * current debugInfoEnabled state\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   *\n   * @kind function\n   *\n   * @description\n   * Call this method to enable/disable various debug runtime information in the compiler such as adding\n   * binding information and a reference to the current scope on to DOM elements.\n   * If enabled, the compiler will add the following to DOM elements that have been bound to the scope\n   * * `ng-binding` CSS class\n   * * `$binding` data property containing an array of the binding expressions\n   *\n   * You may want to disable this in production for a significant performance boost. See\n   * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.\n   *\n   * The default value is true.\n   */\n  var debugInfoEnabled = true;\n  this.debugInfoEnabled = function(enabled) {\n    if (isDefined(enabled)) {\n      debugInfoEnabled = enabled;\n      return this;\n    }\n    return debugInfoEnabled;\n  };\n\n\n  var TTL = 10;\n  /**\n   * @ngdoc method\n   * @name $compileProvider#onChangesTtl\n   * @description\n   *\n   * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and\n   * assuming that the model is unstable.\n   *\n   * The current default is 10 iterations.\n   *\n   * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result\n   * in several iterations of calls to these hooks. However if an application needs more than the default 10\n   * iterations to stabilize then you should investigate what is causing the model to continuously change during\n   * the `$onChanges` hook execution.\n   *\n   * Increasing the TTL could have performance implications, so you should not change it without proper justification.\n   *\n   * @param {number} limit The number of `$onChanges` hook iterations.\n   * @returns {number|object} the current limit (or `this` if called as a setter for chaining)\n   */\n  this.onChangesTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n      return this;\n    }\n    return TTL;\n  };\n\n  this.$get = [\n            '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',\n            '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',\n    function($injector,   $interpolate,   $exceptionHandler,   $templateRequest,   $parse,\n             $controller,   $rootScope,   $sce,   $animate,   $$sanitizeUri) {\n\n    var SIMPLE_ATTR_NAME = /^\\w/;\n    var specialAttrHolder = document.createElement('div');\n\n\n\n    var onChangesTtl = TTL;\n    // The onChanges hooks should all be run together in a single digest\n    // When changes occur, the call to trigger their hooks will be added to this queue\n    var onChangesQueue;\n\n    // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest\n    function flushOnChangesQueue() {\n      try {\n        if (!(--onChangesTtl)) {\n          // We have hit the TTL limit so reset everything\n          onChangesQueue = undefined;\n          throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\\n', TTL);\n        }\n        // We must run this hook in an apply since the $$postDigest runs outside apply\n        $rootScope.$apply(function() {\n          for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) {\n            onChangesQueue[i]();\n          }\n          // Reset the queue to trigger a new schedule next time there is a change\n          onChangesQueue = undefined;\n        });\n      } finally {\n        onChangesTtl++;\n      }\n    }\n\n\n    function Attributes(element, attributesToCopy) {\n      if (attributesToCopy) {\n        var keys = Object.keys(attributesToCopy);\n        var i, l, key;\n\n        for (i = 0, l = keys.length; i < l; i++) {\n          key = keys[i];\n          this[key] = attributesToCopy[key];\n        }\n      } else {\n        this.$attr = {};\n      }\n\n      this.$$element = element;\n    }\n\n    Attributes.prototype = {\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$normalize\n       * @kind function\n       *\n       * @description\n       * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or\n       * `data-`) to its normalized, camelCase form.\n       *\n       * Also there is special case for Moz prefix starting with upper case letter.\n       *\n       * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}\n       *\n       * @param {string} name Name to normalize\n       */\n      $normalize: directiveNormalize,\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$addClass\n       * @kind function\n       *\n       * @description\n       * Adds the CSS class value specified by the classVal parameter to the element. If animations\n       * are enabled then an animation will be triggered for the class addition.\n       *\n       * @param {string} classVal The className value that will be added to the element\n       */\n      $addClass: function(classVal) {\n        if (classVal && classVal.length > 0) {\n          $animate.addClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$removeClass\n       * @kind function\n       *\n       * @description\n       * Removes the CSS class value specified by the classVal parameter from the element. If\n       * animations are enabled then an animation will be triggered for the class removal.\n       *\n       * @param {string} classVal The className value that will be removed from the element\n       */\n      $removeClass: function(classVal) {\n        if (classVal && classVal.length > 0) {\n          $animate.removeClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$updateClass\n       * @kind function\n       *\n       * @description\n       * Adds and removes the appropriate CSS class values to the element based on the difference\n       * between the new and old CSS class values (specified as newClasses and oldClasses).\n       *\n       * @param {string} newClasses The current CSS className value\n       * @param {string} oldClasses The former CSS className value\n       */\n      $updateClass: function(newClasses, oldClasses) {\n        var toAdd = tokenDifference(newClasses, oldClasses);\n        if (toAdd && toAdd.length) {\n          $animate.addClass(this.$$element, toAdd);\n        }\n\n        var toRemove = tokenDifference(oldClasses, newClasses);\n        if (toRemove && toRemove.length) {\n          $animate.removeClass(this.$$element, toRemove);\n        }\n      },\n\n      /**\n       * Set a normalized attribute on the element in a way such that all directives\n       * can share the attribute. This function properly handles boolean attributes.\n       * @param {string} key Normalized key. (ie ngAttribute)\n       * @param {string|boolean} value The value to set. If `null` attribute will be deleted.\n       * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.\n       *     Defaults to true.\n       * @param {string=} attrName Optional none normalized name. Defaults to key.\n       */\n      $set: function(key, value, writeAttr, attrName) {\n        // TODO: decide whether or not to throw an error if \"class\"\n        //is set through this function since it may cause $updateClass to\n        //become unstable.\n\n        var node = this.$$element[0],\n            booleanKey = getBooleanAttrName(node, key),\n            aliasedKey = getAliasedAttrName(key),\n            observer = key,\n            nodeName;\n\n        if (booleanKey) {\n          this.$$element.prop(key, value);\n          attrName = booleanKey;\n        } else if (aliasedKey) {\n          this[aliasedKey] = value;\n          observer = aliasedKey;\n        }\n\n        this[key] = value;\n\n        // translate normalized key to actual key\n        if (attrName) {\n          this.$attr[key] = attrName;\n        } else {\n          attrName = this.$attr[key];\n          if (!attrName) {\n            this.$attr[key] = attrName = snake_case(key, '-');\n          }\n        }\n\n        nodeName = nodeName_(this.$$element);\n\n        if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||\n            (nodeName === 'img' && key === 'src')) {\n          // sanitize a[href] and img[src] values\n          this[key] = value = $$sanitizeUri(value, key === 'src');\n        } else if (nodeName === 'img' && key === 'srcset') {\n          // sanitize img[srcset] values\n          var result = \"\";\n\n          // first check if there are spaces because it's not the same pattern\n          var trimmedSrcset = trim(value);\n          //                (   999x   ,|   999w   ,|   ,|,   )\n          var srcPattern = /(\\s+\\d+x\\s*,|\\s+\\d+w\\s*,|\\s+,|,\\s+)/;\n          var pattern = /\\s/.test(trimmedSrcset) ? srcPattern : /(,)/;\n\n          // split srcset into tuple of uri and descriptor except for the last item\n          var rawUris = trimmedSrcset.split(pattern);\n\n          // for each tuples\n          var nbrUrisWith2parts = Math.floor(rawUris.length / 2);\n          for (var i = 0; i < nbrUrisWith2parts; i++) {\n            var innerIdx = i * 2;\n            // sanitize the uri\n            result += $$sanitizeUri(trim(rawUris[innerIdx]), true);\n            // add the descriptor\n            result += (\" \" + trim(rawUris[innerIdx + 1]));\n          }\n\n          // split the last item into uri and descriptor\n          var lastTuple = trim(rawUris[i * 2]).split(/\\s/);\n\n          // sanitize the last uri\n          result += $$sanitizeUri(trim(lastTuple[0]), true);\n\n          // and add the last descriptor if any\n          if (lastTuple.length === 2) {\n            result += (\" \" + trim(lastTuple[1]));\n          }\n          this[key] = value = result;\n        }\n\n        if (writeAttr !== false) {\n          if (value === null || isUndefined(value)) {\n            this.$$element.removeAttr(attrName);\n          } else {\n            if (SIMPLE_ATTR_NAME.test(attrName)) {\n              this.$$element.attr(attrName, value);\n            } else {\n              setSpecialAttr(this.$$element[0], attrName, value);\n            }\n          }\n        }\n\n        // fire observers\n        var $$observers = this.$$observers;\n        $$observers && forEach($$observers[observer], function(fn) {\n          try {\n            fn(value);\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        });\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$observe\n       * @kind function\n       *\n       * @description\n       * Observes an interpolated attribute.\n       *\n       * The observer function will be invoked once during the next `$digest` following\n       * compilation. The observer is then invoked whenever the interpolated value\n       * changes.\n       *\n       * @param {string} key Normalized key. (ie ngAttribute) .\n       * @param {function(interpolatedValue)} fn Function that will be called whenever\n                the interpolated value of the attribute changes.\n       *        See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation\n       *        guide} for more info.\n       * @returns {function()} Returns a deregistration function for this observer.\n       */\n      $observe: function(key, fn) {\n        var attrs = this,\n            $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),\n            listeners = ($$observers[key] || ($$observers[key] = []));\n\n        listeners.push(fn);\n        $rootScope.$evalAsync(function() {\n          if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {\n            // no one registered attribute interpolation function, so lets call it manually\n            fn(attrs[key]);\n          }\n        });\n\n        return function() {\n          arrayRemove(listeners, fn);\n        };\n      }\n    };\n\n    function setSpecialAttr(element, attrName, value) {\n      // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`\n      // so we have to jump through some hoops to get such an attribute\n      // https://github.com/angular/angular.js/pull/13318\n      specialAttrHolder.innerHTML = \"<span \" + attrName + \">\";\n      var attributes = specialAttrHolder.firstChild.attributes;\n      var attribute = attributes[0];\n      // We have to remove the attribute from its container element before we can add it to the destination element\n      attributes.removeNamedItem(attribute.name);\n      attribute.value = value;\n      element.attributes.setNamedItem(attribute);\n    }\n\n    function safeAddClass($element, className) {\n      try {\n        $element.addClass(className);\n      } catch (e) {\n        // ignore, since it means that we are trying to set class on\n        // SVG element, where class name is read-only.\n      }\n    }\n\n\n    var startSymbol = $interpolate.startSymbol(),\n        endSymbol = $interpolate.endSymbol(),\n        denormalizeTemplate = (startSymbol == '{{' && endSymbol  == '}}')\n            ? identity\n            : function denormalizeTemplate(template) {\n              return template.replace(/\\{\\{/g, startSymbol).replace(/}}/g, endSymbol);\n        },\n        NG_ATTR_BINDING = /^ngAttr[A-Z]/;\n    var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;\n\n    compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {\n      var bindings = $element.data('$binding') || [];\n\n      if (isArray(binding)) {\n        bindings = bindings.concat(binding);\n      } else {\n        bindings.push(binding);\n      }\n\n      $element.data('$binding', bindings);\n    } : noop;\n\n    compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {\n      safeAddClass($element, 'ng-binding');\n    } : noop;\n\n    compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {\n      var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';\n      $element.data(dataName, scope);\n    } : noop;\n\n    compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {\n      safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');\n    } : noop;\n\n    compile.$$createComment = function(directiveName, comment) {\n      var content = '';\n      if (debugInfoEnabled) {\n        content = ' ' + (directiveName || '') + ': ' + (comment || '') + ' ';\n      }\n      return document.createComment(content);\n    };\n\n    return compile;\n\n    //================================\n\n    function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,\n                        previousCompileContext) {\n      if (!($compileNodes instanceof jqLite)) {\n        // jquery always rewraps, whereas we need to preserve the original selector so that we can\n        // modify it.\n        $compileNodes = jqLite($compileNodes);\n      }\n\n      var NOT_EMPTY = /\\S+/;\n\n      // We can not compile top level text elements since text nodes can be merged and we will\n      // not be able to attach scope data to them, so we will wrap them in <span>\n      for (var i = 0, len = $compileNodes.length; i < len; i++) {\n        var domNode = $compileNodes[i];\n\n        if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {\n          jqLiteWrapNode(domNode, $compileNodes[i] = document.createElement('span'));\n        }\n      }\n\n      var compositeLinkFn =\n              compileNodes($compileNodes, transcludeFn, $compileNodes,\n                           maxPriority, ignoreDirective, previousCompileContext);\n      compile.$$addScopeClass($compileNodes);\n      var namespace = null;\n      return function publicLinkFn(scope, cloneConnectFn, options) {\n        assertArg(scope, 'scope');\n\n        if (previousCompileContext && previousCompileContext.needsNewScope) {\n          // A parent directive did a replace and a directive on this element asked\n          // for transclusion, which caused us to lose a layer of element on which\n          // we could hold the new transclusion scope, so we will create it manually\n          // here.\n          scope = scope.$parent.$new();\n        }\n\n        options = options || {};\n        var parentBoundTranscludeFn = options.parentBoundTranscludeFn,\n          transcludeControllers = options.transcludeControllers,\n          futureParentElement = options.futureParentElement;\n\n        // When `parentBoundTranscludeFn` is passed, it is a\n        // `controllersBoundTransclude` function (it was previously passed\n        // as `transclude` to directive.link) so we must unwrap it to get\n        // its `boundTranscludeFn`\n        if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {\n          parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;\n        }\n\n        if (!namespace) {\n          namespace = detectNamespaceForChildElements(futureParentElement);\n        }\n        var $linkNode;\n        if (namespace !== 'html') {\n          // When using a directive with replace:true and templateUrl the $compileNodes\n          // (or a child element inside of them)\n          // might change, so we need to recreate the namespace adapted compileNodes\n          // for call to the link function.\n          // Note: This will already clone the nodes...\n          $linkNode = jqLite(\n            wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())\n          );\n        } else if (cloneConnectFn) {\n          // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart\n          // and sometimes changes the structure of the DOM.\n          $linkNode = JQLitePrototype.clone.call($compileNodes);\n        } else {\n          $linkNode = $compileNodes;\n        }\n\n        if (transcludeControllers) {\n          for (var controllerName in transcludeControllers) {\n            $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);\n          }\n        }\n\n        compile.$$addScopeInfo($linkNode, scope);\n\n        if (cloneConnectFn) cloneConnectFn($linkNode, scope);\n        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);\n        return $linkNode;\n      };\n    }\n\n    function detectNamespaceForChildElements(parentElement) {\n      // TODO: Make this detect MathML as well...\n      var node = parentElement && parentElement[0];\n      if (!node) {\n        return 'html';\n      } else {\n        return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html';\n      }\n    }\n\n    /**\n     * Compile function matches each node in nodeList against the directives. Once all directives\n     * for a particular node are collected their compile functions are executed. The compile\n     * functions return values - the linking functions - are combined into a composite linking\n     * function, which is the a linking function for the node.\n     *\n     * @param {NodeList} nodeList an array of nodes or NodeList to compile\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *        scope argument is auto-generated to the new child of the transcluded parent scope.\n     * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then\n     *        the rootElement must be set the jqLite collection of the compile root. This is\n     *        needed so that the jqLite collection items can be replaced with widgets.\n     * @param {number=} maxPriority Max directive priority.\n     * @returns {Function} A composite linking function of all of the matched directives or null.\n     */\n    function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,\n                            previousCompileContext) {\n      var linkFns = [],\n          attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;\n\n      for (var i = 0; i < nodeList.length; i++) {\n        attrs = new Attributes();\n\n        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.\n        directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,\n                                        ignoreDirective);\n\n        nodeLinkFn = (directives.length)\n            ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,\n                                      null, [], [], previousCompileContext)\n            : null;\n\n        if (nodeLinkFn && nodeLinkFn.scope) {\n          compile.$$addScopeClass(attrs.$$element);\n        }\n\n        childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||\n                      !(childNodes = nodeList[i].childNodes) ||\n                      !childNodes.length)\n            ? null\n            : compileNodes(childNodes,\n                 nodeLinkFn ? (\n                  (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)\n                     && nodeLinkFn.transclude) : transcludeFn);\n\n        if (nodeLinkFn || childLinkFn) {\n          linkFns.push(i, nodeLinkFn, childLinkFn);\n          linkFnFound = true;\n          nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;\n        }\n\n        //use the previous context only for the first element in the virtual group\n        previousCompileContext = null;\n      }\n\n      // return a linking function if we have found anything, null otherwise\n      return linkFnFound ? compositeLinkFn : null;\n\n      function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {\n        var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;\n        var stableNodeList;\n\n\n        if (nodeLinkFnFound) {\n          // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our\n          // offsets don't get screwed up\n          var nodeListLength = nodeList.length;\n          stableNodeList = new Array(nodeListLength);\n\n          // create a sparse array by only copying the elements which have a linkFn\n          for (i = 0; i < linkFns.length; i+=3) {\n            idx = linkFns[i];\n            stableNodeList[idx] = nodeList[idx];\n          }\n        } else {\n          stableNodeList = nodeList;\n        }\n\n        for (i = 0, ii = linkFns.length; i < ii;) {\n          node = stableNodeList[linkFns[i++]];\n          nodeLinkFn = linkFns[i++];\n          childLinkFn = linkFns[i++];\n\n          if (nodeLinkFn) {\n            if (nodeLinkFn.scope) {\n              childScope = scope.$new();\n              compile.$$addScopeInfo(jqLite(node), childScope);\n            } else {\n              childScope = scope;\n            }\n\n            if (nodeLinkFn.transcludeOnThisElement) {\n              childBoundTranscludeFn = createBoundTranscludeFn(\n                  scope, nodeLinkFn.transclude, parentBoundTranscludeFn);\n\n            } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {\n              childBoundTranscludeFn = parentBoundTranscludeFn;\n\n            } else if (!parentBoundTranscludeFn && transcludeFn) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);\n\n            } else {\n              childBoundTranscludeFn = null;\n            }\n\n            nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);\n\n          } else if (childLinkFn) {\n            childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);\n          }\n        }\n      }\n    }\n\n    function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {\n      function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {\n\n        if (!transcludedScope) {\n          transcludedScope = scope.$new(false, containingScope);\n          transcludedScope.$$transcluded = true;\n        }\n\n        return transcludeFn(transcludedScope, cloneFn, {\n          parentBoundTranscludeFn: previousBoundTranscludeFn,\n          transcludeControllers: controllers,\n          futureParentElement: futureParentElement\n        });\n      }\n\n      // We need  to attach the transclusion slots onto the `boundTranscludeFn`\n      // so that they are available inside the `controllersBoundTransclude` function\n      var boundSlots = boundTranscludeFn.$$slots = createMap();\n      for (var slotName in transcludeFn.$$slots) {\n        if (transcludeFn.$$slots[slotName]) {\n          boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);\n        } else {\n          boundSlots[slotName] = null;\n        }\n      }\n\n      return boundTranscludeFn;\n    }\n\n    /**\n     * Looks for directives on the given node and adds them to the directive collection which is\n     * sorted.\n     *\n     * @param node Node to search.\n     * @param directives An array to which the directives are added to. This array is sorted before\n     *        the function returns.\n     * @param attrs The shared attrs object which is used to populate the normalized attributes.\n     * @param {number=} maxPriority Max directive priority.\n     */\n    function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {\n      var nodeType = node.nodeType,\n          attrsMap = attrs.$attr,\n          match,\n          className;\n\n      switch (nodeType) {\n        case NODE_TYPE_ELEMENT: /* Element */\n          // use the node name: <directive>\n          addDirective(directives,\n              directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);\n\n          // iterate over the attributes\n          for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,\n                   j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {\n            var attrStartName = false;\n            var attrEndName = false;\n\n            attr = nAttrs[j];\n            name = attr.name;\n            value = trim(attr.value);\n\n            // support ngAttr attribute binding\n            ngAttrName = directiveNormalize(name);\n            if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {\n              name = name.replace(PREFIX_REGEXP, '')\n                .substr(8).replace(/_(.)/g, function(match, letter) {\n                  return letter.toUpperCase();\n                });\n            }\n\n            var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);\n            if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {\n              attrStartName = name;\n              attrEndName = name.substr(0, name.length - 5) + 'end';\n              name = name.substr(0, name.length - 6);\n            }\n\n            nName = directiveNormalize(name.toLowerCase());\n            attrsMap[nName] = name;\n            if (isNgAttr || !attrs.hasOwnProperty(nName)) {\n                attrs[nName] = value;\n                if (getBooleanAttrName(node, nName)) {\n                  attrs[nName] = true; // presence means true\n                }\n            }\n            addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);\n            addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,\n                          attrEndName);\n          }\n\n          // use class as directive\n          className = node.className;\n          if (isObject(className)) {\n              // Maybe SVGAnimatedString\n              className = className.animVal;\n          }\n          if (isString(className) && className !== '') {\n            while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {\n              nName = directiveNormalize(match[2]);\n              if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[3]);\n              }\n              className = className.substr(match.index + match[0].length);\n            }\n          }\n          break;\n        case NODE_TYPE_TEXT: /* Text Node */\n          if (msie === 11) {\n            // Workaround for #11781\n            while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {\n              node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;\n              node.parentNode.removeChild(node.nextSibling);\n            }\n          }\n          addTextInterpolateDirective(directives, node.nodeValue);\n          break;\n        case NODE_TYPE_COMMENT: /* Comment */\n          try {\n            match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);\n            if (match) {\n              nName = directiveNormalize(match[1]);\n              if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[2]);\n              }\n            }\n          } catch (e) {\n            // turns out that under some circumstances IE9 throws errors when one attempts to read\n            // comment's node value.\n            // Just ignore it and continue. (Can't seem to reproduce in test case.)\n          }\n          break;\n      }\n\n      directives.sort(byPriority);\n      return directives;\n    }\n\n    /**\n     * Given a node with an directive-start it collects all of the siblings until it finds\n     * directive-end.\n     * @param node\n     * @param attrStart\n     * @param attrEnd\n     * @returns {*}\n     */\n    function groupScan(node, attrStart, attrEnd) {\n      var nodes = [];\n      var depth = 0;\n      if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {\n        do {\n          if (!node) {\n            throw $compileMinErr('uterdir',\n                      \"Unterminated attribute, found '{0}' but no matching '{1}' found.\",\n                      attrStart, attrEnd);\n          }\n          if (node.nodeType == NODE_TYPE_ELEMENT) {\n            if (node.hasAttribute(attrStart)) depth++;\n            if (node.hasAttribute(attrEnd)) depth--;\n          }\n          nodes.push(node);\n          node = node.nextSibling;\n        } while (depth > 0);\n      } else {\n        nodes.push(node);\n      }\n\n      return jqLite(nodes);\n    }\n\n    /**\n     * Wrapper for linking function which converts normal linking function into a grouped\n     * linking function.\n     * @param linkFn\n     * @param attrStart\n     * @param attrEnd\n     * @returns {Function}\n     */\n    function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {\n      return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) {\n        element = groupScan(element[0], attrStart, attrEnd);\n        return linkFn(scope, element, attrs, controllers, transcludeFn);\n      };\n    }\n\n    /**\n     * A function generator that is used to support both eager and lazy compilation\n     * linking function.\n     * @param eager\n     * @param $compileNodes\n     * @param transcludeFn\n     * @param maxPriority\n     * @param ignoreDirective\n     * @param previousCompileContext\n     * @returns {Function}\n     */\n    function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {\n      var compiled;\n\n      if (eager) {\n        return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);\n      }\n      return function lazyCompilation() {\n        if (!compiled) {\n          compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);\n\n          // Null out all of these references in order to make them eligible for garbage collection\n          // since this is a potentially long lived closure\n          $compileNodes = transcludeFn = previousCompileContext = null;\n        }\n        return compiled.apply(this, arguments);\n      };\n    }\n\n    /**\n     * Once the directives have been collected, their compile functions are executed. This method\n     * is responsible for inlining directive templates as well as terminating the application\n     * of the directives if the terminal directive has been reached.\n     *\n     * @param {Array} directives Array of collected directives to execute their compile function.\n     *        this needs to be pre-sorted by priority order.\n     * @param {Node} compileNode The raw DOM node to apply the compile functions to\n     * @param {Object} templateAttrs The shared attribute function\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *                                                  scope argument is auto-generated to the new\n     *                                                  child of the transcluded parent scope.\n     * @param {JQLite} jqCollection If we are working on the root of the compile tree then this\n     *                              argument has the root jqLite array so that we can replace nodes\n     *                              on it.\n     * @param {Object=} originalReplaceDirective An optional directive that will be ignored when\n     *                                           compiling the transclusion.\n     * @param {Array.<Function>} preLinkFns\n     * @param {Array.<Function>} postLinkFns\n     * @param {Object} previousCompileContext Context used for previous compilation of the current\n     *                                        node\n     * @returns {Function} linkFn\n     */\n    function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,\n                                   jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,\n                                   previousCompileContext) {\n      previousCompileContext = previousCompileContext || {};\n\n      var terminalPriority = -Number.MAX_VALUE,\n          newScopeDirective = previousCompileContext.newScopeDirective,\n          controllerDirectives = previousCompileContext.controllerDirectives,\n          newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,\n          templateDirective = previousCompileContext.templateDirective,\n          nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,\n          hasTranscludeDirective = false,\n          hasTemplate = false,\n          hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,\n          $compileNode = templateAttrs.$$element = jqLite(compileNode),\n          directive,\n          directiveName,\n          $template,\n          replaceDirective = originalReplaceDirective,\n          childTranscludeFn = transcludeFn,\n          linkFn,\n          didScanForMultipleTransclusion = false,\n          mightHaveMultipleTransclusionError = false,\n          directiveValue;\n\n      // executes all directives on the current element\n      for (var i = 0, ii = directives.length; i < ii; i++) {\n        directive = directives[i];\n        var attrStart = directive.$$start;\n        var attrEnd = directive.$$end;\n\n        // collect multiblock sections\n        if (attrStart) {\n          $compileNode = groupScan(compileNode, attrStart, attrEnd);\n        }\n        $template = undefined;\n\n        if (terminalPriority > directive.priority) {\n          break; // prevent further processing of directives\n        }\n\n        if (directiveValue = directive.scope) {\n\n          // skip the check for directives with async templates, we'll check the derived sync\n          // directive when the template arrives\n          if (!directive.templateUrl) {\n            if (isObject(directiveValue)) {\n              // This directive is trying to add an isolated scope.\n              // Check that there is no scope of any kind already\n              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,\n                                directive, $compileNode);\n              newIsolateScopeDirective = directive;\n            } else {\n              // This directive is trying to add a child scope.\n              // Check that there is no isolated scope already\n              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,\n                                $compileNode);\n            }\n          }\n\n          newScopeDirective = newScopeDirective || directive;\n        }\n\n        directiveName = directive.name;\n\n        // If we encounter a condition that can result in transclusion on the directive,\n        // then scan ahead in the remaining directives for others that may cause a multiple\n        // transclusion error to be thrown during the compilation process.  If a matching directive\n        // is found, then we know that when we encounter a transcluded directive, we need to eagerly\n        // compile the `transclude` function rather than doing it lazily in order to throw\n        // exceptions at the correct time\n        if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))\n            || (directive.transclude && !directive.$$tlb))) {\n                var candidateDirective;\n\n                for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {\n                    if ((candidateDirective.transclude && !candidateDirective.$$tlb)\n                        || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {\n                        mightHaveMultipleTransclusionError = true;\n                        break;\n                    }\n                }\n\n                didScanForMultipleTransclusion = true;\n        }\n\n        if (!directive.templateUrl && directive.controller) {\n          directiveValue = directive.controller;\n          controllerDirectives = controllerDirectives || createMap();\n          assertNoDuplicate(\"'\" + directiveName + \"' controller\",\n              controllerDirectives[directiveName], directive, $compileNode);\n          controllerDirectives[directiveName] = directive;\n        }\n\n        if (directiveValue = directive.transclude) {\n          hasTranscludeDirective = true;\n\n          // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.\n          // This option should only be used by directives that know how to safely handle element transclusion,\n          // where the transcluded nodes are added or replaced after linking.\n          if (!directive.$$tlb) {\n            assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);\n            nonTlbTranscludeDirective = directive;\n          }\n\n          if (directiveValue == 'element') {\n            hasElementTranscludeDirective = true;\n            terminalPriority = directive.priority;\n            $template = $compileNode;\n            $compileNode = templateAttrs.$$element =\n                jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName]));\n            compileNode = $compileNode[0];\n            replaceWith(jqCollection, sliceArgs($template), compileNode);\n\n            // Support: Chrome < 50\n            // https://github.com/angular/angular.js/issues/14041\n\n            // In the versions of V8 prior to Chrome 50, the document fragment that is created\n            // in the `replaceWith` function is improperly garbage collected despite still\n            // being referenced by the `parentNode` property of all of the child nodes.  By adding\n            // a reference to the fragment via a different property, we can avoid that incorrect\n            // behavior.\n            // TODO: remove this line after Chrome 50 has been released\n            $template[0].$$parentNode = $template[0].parentNode;\n\n            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,\n                                        replaceDirective && replaceDirective.name, {\n                                          // Don't pass in:\n                                          // - controllerDirectives - otherwise we'll create duplicates controllers\n                                          // - newIsolateScopeDirective or templateDirective - combining templates with\n                                          //   element transclusion doesn't make sense.\n                                          //\n                                          // We need only nonTlbTranscludeDirective so that we prevent putting transclusion\n                                          // on the same element more than once.\n                                          nonTlbTranscludeDirective: nonTlbTranscludeDirective\n                                        });\n          } else {\n\n            var slots = createMap();\n\n            $template = jqLite(jqLiteClone(compileNode)).contents();\n\n            if (isObject(directiveValue)) {\n\n              // We have transclusion slots,\n              // collect them up, compile them and store their transclusion functions\n              $template = [];\n\n              var slotMap = createMap();\n              var filledSlots = createMap();\n\n              // Parse the element selectors\n              forEach(directiveValue, function(elementSelector, slotName) {\n                // If an element selector starts with a ? then it is optional\n                var optional = (elementSelector.charAt(0) === '?');\n                elementSelector = optional ? elementSelector.substring(1) : elementSelector;\n\n                slotMap[elementSelector] = slotName;\n\n                // We explicitly assign `null` since this implies that a slot was defined but not filled.\n                // Later when calling boundTransclusion functions with a slot name we only error if the\n                // slot is `undefined`\n                slots[slotName] = null;\n\n                // filledSlots contains `true` for all slots that are either optional or have been\n                // filled. This is used to check that we have not missed any required slots\n                filledSlots[slotName] = optional;\n              });\n\n              // Add the matching elements into their slot\n              forEach($compileNode.contents(), function(node) {\n                var slotName = slotMap[directiveNormalize(nodeName_(node))];\n                if (slotName) {\n                  filledSlots[slotName] = true;\n                  slots[slotName] = slots[slotName] || [];\n                  slots[slotName].push(node);\n                } else {\n                  $template.push(node);\n                }\n              });\n\n              // Check for required slots that were not filled\n              forEach(filledSlots, function(filled, slotName) {\n                if (!filled) {\n                  throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);\n                }\n              });\n\n              for (var slotName in slots) {\n                if (slots[slotName]) {\n                  // Only define a transclusion function if the slot was filled\n                  slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);\n                }\n              }\n            }\n\n            $compileNode.empty(); // clear contents\n            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,\n                undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});\n            childTranscludeFn.$$slots = slots;\n          }\n        }\n\n        if (directive.template) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          directiveValue = (isFunction(directive.template))\n              ? directive.template($compileNode, templateAttrs)\n              : directive.template;\n\n          directiveValue = denormalizeTemplate(directiveValue);\n\n          if (directive.replace) {\n            replaceDirective = directive;\n            if (jqLiteIsTextNode(directiveValue)) {\n              $template = [];\n            } else {\n              $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  directiveName, '');\n            }\n\n            replaceWith(jqCollection, $compileNode, compileNode);\n\n            var newTemplateAttrs = {$attr: {}};\n\n            // combine directives from the original node and from the template:\n            // - take the array of directives for this element\n            // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)\n            // - collect directives from the template and sort them by priority\n            // - combine directives as: processed + template + unprocessed\n            var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);\n            var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));\n\n            if (newIsolateScopeDirective || newScopeDirective) {\n              // The original directive caused the current element to be replaced but this element\n              // also needs to have a new scope, so we need to tell the template directives\n              // that they would need to get their scope from further up, if they require transclusion\n              markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);\n            }\n            directives = directives.concat(templateDirectives).concat(unprocessedDirectives);\n            mergeTemplateAttributes(templateAttrs, newTemplateAttrs);\n\n            ii = directives.length;\n          } else {\n            $compileNode.html(directiveValue);\n          }\n        }\n\n        if (directive.templateUrl) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          if (directive.replace) {\n            replaceDirective = directive;\n          }\n\n          nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,\n              templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {\n                controllerDirectives: controllerDirectives,\n                newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,\n                newIsolateScopeDirective: newIsolateScopeDirective,\n                templateDirective: templateDirective,\n                nonTlbTranscludeDirective: nonTlbTranscludeDirective\n              });\n          ii = directives.length;\n        } else if (directive.compile) {\n          try {\n            linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);\n            if (isFunction(linkFn)) {\n              addLinkFns(null, linkFn, attrStart, attrEnd);\n            } else if (linkFn) {\n              addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);\n            }\n          } catch (e) {\n            $exceptionHandler(e, startingTag($compileNode));\n          }\n        }\n\n        if (directive.terminal) {\n          nodeLinkFn.terminal = true;\n          terminalPriority = Math.max(terminalPriority, directive.priority);\n        }\n\n      }\n\n      nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;\n      nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;\n      nodeLinkFn.templateOnThisElement = hasTemplate;\n      nodeLinkFn.transclude = childTranscludeFn;\n\n      previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;\n\n      // might be normal or delayed nodeLinkFn depending on if templateUrl is present\n      return nodeLinkFn;\n\n      ////////////////////\n\n      function addLinkFns(pre, post, attrStart, attrEnd) {\n        if (pre) {\n          if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);\n          pre.require = directive.require;\n          pre.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            pre = cloneAndAnnotateFn(pre, {isolateScope: true});\n          }\n          preLinkFns.push(pre);\n        }\n        if (post) {\n          if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);\n          post.require = directive.require;\n          post.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            post = cloneAndAnnotateFn(post, {isolateScope: true});\n          }\n          postLinkFns.push(post);\n        }\n      }\n\n      function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {\n        var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,\n            attrs, removeScopeBindingWatches, removeControllerBindingWatches;\n\n        if (compileNode === linkNode) {\n          attrs = templateAttrs;\n          $element = templateAttrs.$$element;\n        } else {\n          $element = jqLite(linkNode);\n          attrs = new Attributes($element, templateAttrs);\n        }\n\n        controllerScope = scope;\n        if (newIsolateScopeDirective) {\n          isolateScope = scope.$new(true);\n        } else if (newScopeDirective) {\n          controllerScope = scope.$parent;\n        }\n\n        if (boundTranscludeFn) {\n          // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`\n          // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`\n          transcludeFn = controllersBoundTransclude;\n          transcludeFn.$$boundTransclude = boundTranscludeFn;\n          // expose the slots on the `$transclude` function\n          transcludeFn.isSlotFilled = function(slotName) {\n            return !!boundTranscludeFn.$$slots[slotName];\n          };\n        }\n\n        if (controllerDirectives) {\n          elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective);\n        }\n\n        if (newIsolateScopeDirective) {\n          // Initialize isolate scope bindings for new isolate scope directive.\n          compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||\n              templateDirective === newIsolateScopeDirective.$$originalDirective)));\n          compile.$$addScopeClass($element, true);\n          isolateScope.$$isolateBindings =\n              newIsolateScopeDirective.$$isolateBindings;\n          removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope,\n                                        isolateScope.$$isolateBindings,\n                                        newIsolateScopeDirective);\n          if (removeScopeBindingWatches) {\n            isolateScope.$on('$destroy', removeScopeBindingWatches);\n          }\n        }\n\n        // Initialize bindToController bindings\n        for (var name in elementControllers) {\n          var controllerDirective = controllerDirectives[name];\n          var controller = elementControllers[name];\n          var bindings = controllerDirective.$$bindings.bindToController;\n\n          if (controller.identifier && bindings) {\n            removeControllerBindingWatches =\n              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n          }\n\n          var controllerResult = controller();\n          if (controllerResult !== controller.instance) {\n            // If the controller constructor has a return value, overwrite the instance\n            // from setupControllers\n            controller.instance = controllerResult;\n            $element.data('$' + controllerDirective.name + 'Controller', controllerResult);\n            removeControllerBindingWatches && removeControllerBindingWatches();\n            removeControllerBindingWatches =\n              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n          }\n        }\n\n        // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy\n        forEach(controllerDirectives, function(controllerDirective, name) {\n          var require = controllerDirective.require;\n          if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {\n            extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));\n          }\n        });\n\n        // Handle the init and destroy lifecycle hooks on all controllers that have them\n        forEach(elementControllers, function(controller) {\n          var controllerInstance = controller.instance;\n          if (isFunction(controllerInstance.$onInit)) {\n            controllerInstance.$onInit();\n          }\n          if (isFunction(controllerInstance.$onDestroy)) {\n            controllerScope.$on('$destroy', function callOnDestroyHook() {\n              controllerInstance.$onDestroy();\n            });\n          }\n        });\n\n        // PRELINKING\n        for (i = 0, ii = preLinkFns.length; i < ii; i++) {\n          linkFn = preLinkFns[i];\n          invokeLinkFn(linkFn,\n              linkFn.isolateScope ? isolateScope : scope,\n              $element,\n              attrs,\n              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n              transcludeFn\n          );\n        }\n\n        // RECURSION\n        // We only pass the isolate scope, if the isolate directive has a template,\n        // otherwise the child elements do not belong to the isolate directive.\n        var scopeToChild = scope;\n        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {\n          scopeToChild = isolateScope;\n        }\n        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);\n\n        // POSTLINKING\n        for (i = postLinkFns.length - 1; i >= 0; i--) {\n          linkFn = postLinkFns[i];\n          invokeLinkFn(linkFn,\n              linkFn.isolateScope ? isolateScope : scope,\n              $element,\n              attrs,\n              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n              transcludeFn\n          );\n        }\n\n        // Trigger $postLink lifecycle hooks\n        forEach(elementControllers, function(controller) {\n          var controllerInstance = controller.instance;\n          if (isFunction(controllerInstance.$postLink)) {\n            controllerInstance.$postLink();\n          }\n        });\n\n        // This is the function that is injected as `$transclude`.\n        // Note: all arguments are optional!\n        function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {\n          var transcludeControllers;\n          // No scope passed in:\n          if (!isScope(scope)) {\n            slotName = futureParentElement;\n            futureParentElement = cloneAttachFn;\n            cloneAttachFn = scope;\n            scope = undefined;\n          }\n\n          if (hasElementTranscludeDirective) {\n            transcludeControllers = elementControllers;\n          }\n          if (!futureParentElement) {\n            futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;\n          }\n          if (slotName) {\n            // slotTranscludeFn can be one of three things:\n            //  * a transclude function - a filled slot\n            //  * `null` - an optional slot that was not filled\n            //  * `undefined` - a slot that was not declared (i.e. invalid)\n            var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];\n            if (slotTranscludeFn) {\n              return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);\n            } else if (isUndefined(slotTranscludeFn)) {\n              throw $compileMinErr('noslot',\n               'No parent directive that requires a transclusion with slot name \"{0}\". ' +\n               'Element: {1}',\n               slotName, startingTag($element));\n            }\n          } else {\n            return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);\n          }\n        }\n      }\n    }\n\n    function getControllers(directiveName, require, $element, elementControllers) {\n      var value;\n\n      if (isString(require)) {\n        var match = require.match(REQUIRE_PREFIX_REGEXP);\n        var name = require.substring(match[0].length);\n        var inheritType = match[1] || match[3];\n        var optional = match[2] === '?';\n\n        //If only parents then start at the parent element\n        if (inheritType === '^^') {\n          $element = $element.parent();\n        //Otherwise attempt getting the controller from elementControllers in case\n        //the element is transcluded (and has no data) and to avoid .data if possible\n        } else {\n          value = elementControllers && elementControllers[name];\n          value = value && value.instance;\n        }\n\n        if (!value) {\n          var dataName = '$' + name + 'Controller';\n          value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);\n        }\n\n        if (!value && !optional) {\n          throw $compileMinErr('ctreq',\n              \"Controller '{0}', required by directive '{1}', can't be found!\",\n              name, directiveName);\n        }\n      } else if (isArray(require)) {\n        value = [];\n        for (var i = 0, ii = require.length; i < ii; i++) {\n          value[i] = getControllers(directiveName, require[i], $element, elementControllers);\n        }\n      } else if (isObject(require)) {\n        value = {};\n        forEach(require, function(controller, property) {\n          value[property] = getControllers(directiveName, controller, $element, elementControllers);\n        });\n      }\n\n      return value || null;\n    }\n\n    function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {\n      var elementControllers = createMap();\n      for (var controllerKey in controllerDirectives) {\n        var directive = controllerDirectives[controllerKey];\n        var locals = {\n          $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,\n          $element: $element,\n          $attrs: attrs,\n          $transclude: transcludeFn\n        };\n\n        var controller = directive.controller;\n        if (controller == '@') {\n          controller = attrs[directive.name];\n        }\n\n        var controllerInstance = $controller(controller, locals, true, directive.controllerAs);\n\n        // For directives with element transclusion the element is a comment.\n        // In this case .data will not attach any data.\n        // Instead, we save the controllers for the element in a local hash and attach to .data\n        // later, once we have the actual element.\n        elementControllers[directive.name] = controllerInstance;\n        $element.data('$' + directive.name + 'Controller', controllerInstance.instance);\n      }\n      return elementControllers;\n    }\n\n    // Depending upon the context in which a directive finds itself it might need to have a new isolated\n    // or child scope created. For instance:\n    // * if the directive has been pulled into a template because another directive with a higher priority\n    // asked for element transclusion\n    // * if the directive itself asks for transclusion but it is at the root of a template and the original\n    // element was replaced. See https://github.com/angular/angular.js/issues/12936\n    function markDirectiveScope(directives, isolateScope, newScope) {\n      for (var j = 0, jj = directives.length; j < jj; j++) {\n        directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});\n      }\n    }\n\n    /**\n     * looks up the directive and decorates it with exception handling and proper parameters. We\n     * call this the boundDirective.\n     *\n     * @param {string} name name of the directive to look up.\n     * @param {string} location The directive must be found in specific format.\n     *   String containing any of theses characters:\n     *\n     *   * `E`: element name\n     *   * `A': attribute\n     *   * `C`: class\n     *   * `M`: comment\n     * @returns {boolean} true if directive was added.\n     */\n    function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,\n                          endAttrName) {\n      if (name === ignoreDirective) return null;\n      var match = null;\n      if (hasDirectives.hasOwnProperty(name)) {\n        for (var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i < ii; i++) {\n          try {\n            directive = directives[i];\n            if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&\n                 directive.restrict.indexOf(location) != -1) {\n              if (startAttrName) {\n                directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});\n              }\n              if (!directive.$$bindings) {\n                var bindings = directive.$$bindings =\n                    parseDirectiveBindings(directive, directive.name);\n                if (isObject(bindings.isolateScope)) {\n                  directive.$$isolateBindings = bindings.isolateScope;\n                }\n              }\n              tDirectives.push(directive);\n              match = directive;\n            }\n          } catch (e) { $exceptionHandler(e); }\n        }\n      }\n      return match;\n    }\n\n\n    /**\n     * looks up the directive and returns true if it is a multi-element directive,\n     * and therefore requires DOM nodes between -start and -end markers to be grouped\n     * together.\n     *\n     * @param {string} name name of the directive to look up.\n     * @returns true if directive was registered as multi-element.\n     */\n    function directiveIsMultiElement(name) {\n      if (hasDirectives.hasOwnProperty(name)) {\n        for (var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i < ii; i++) {\n          directive = directives[i];\n          if (directive.multiElement) {\n            return true;\n          }\n        }\n      }\n      return false;\n    }\n\n    /**\n     * When the element is replaced with HTML template then the new attributes\n     * on the template need to be merged with the existing attributes in the DOM.\n     * The desired effect is to have both of the attributes present.\n     *\n     * @param {object} dst destination attributes (original DOM)\n     * @param {object} src source attributes (from the directive template)\n     */\n    function mergeTemplateAttributes(dst, src) {\n      var srcAttr = src.$attr,\n          dstAttr = dst.$attr,\n          $element = dst.$$element;\n\n      // reapply the old attributes to the new element\n      forEach(dst, function(value, key) {\n        if (key.charAt(0) != '$') {\n          if (src[key] && src[key] !== value) {\n            value += (key === 'style' ? ';' : ' ') + src[key];\n          }\n          dst.$set(key, value, true, srcAttr[key]);\n        }\n      });\n\n      // copy the new attributes on the old attrs object\n      forEach(src, function(value, key) {\n        if (key == 'class') {\n          safeAddClass($element, value);\n          dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;\n        } else if (key == 'style') {\n          $element.attr('style', $element.attr('style') + ';' + value);\n          dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;\n          // `dst` will never contain hasOwnProperty as DOM parser won't let it.\n          // You will get an \"InvalidCharacterError: DOM Exception 5\" error if you\n          // have an attribute like \"has-own-property\" or \"data-has-own-property\", etc.\n        } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {\n          dst[key] = value;\n          dstAttr[key] = srcAttr[key];\n        }\n      });\n    }\n\n\n    function compileTemplateUrl(directives, $compileNode, tAttrs,\n        $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {\n      var linkQueue = [],\n          afterTemplateNodeLinkFn,\n          afterTemplateChildLinkFn,\n          beforeTemplateCompileNode = $compileNode[0],\n          origAsyncDirective = directives.shift(),\n          derivedSyncDirective = inherit(origAsyncDirective, {\n            templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective\n          }),\n          templateUrl = (isFunction(origAsyncDirective.templateUrl))\n              ? origAsyncDirective.templateUrl($compileNode, tAttrs)\n              : origAsyncDirective.templateUrl,\n          templateNamespace = origAsyncDirective.templateNamespace;\n\n      $compileNode.empty();\n\n      $templateRequest(templateUrl)\n        .then(function(content) {\n          var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;\n\n          content = denormalizeTemplate(content);\n\n          if (origAsyncDirective.replace) {\n            if (jqLiteIsTextNode(content)) {\n              $template = [];\n            } else {\n              $template = removeComments(wrapTemplate(templateNamespace, trim(content)));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  origAsyncDirective.name, templateUrl);\n            }\n\n            tempTemplateAttrs = {$attr: {}};\n            replaceWith($rootElement, $compileNode, compileNode);\n            var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);\n\n            if (isObject(origAsyncDirective.scope)) {\n              // the original directive that caused the template to be loaded async required\n              // an isolate scope\n              markDirectiveScope(templateDirectives, true);\n            }\n            directives = templateDirectives.concat(directives);\n            mergeTemplateAttributes(tAttrs, tempTemplateAttrs);\n          } else {\n            compileNode = beforeTemplateCompileNode;\n            $compileNode.html(content);\n          }\n\n          directives.unshift(derivedSyncDirective);\n\n          afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,\n              childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,\n              previousCompileContext);\n          forEach($rootElement, function(node, i) {\n            if (node == compileNode) {\n              $rootElement[i] = $compileNode[0];\n            }\n          });\n          afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);\n\n          while (linkQueue.length) {\n            var scope = linkQueue.shift(),\n                beforeTemplateLinkNode = linkQueue.shift(),\n                linkRootElement = linkQueue.shift(),\n                boundTranscludeFn = linkQueue.shift(),\n                linkNode = $compileNode[0];\n\n            if (scope.$$destroyed) continue;\n\n            if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {\n              var oldClasses = beforeTemplateLinkNode.className;\n\n              if (!(previousCompileContext.hasElementTranscludeDirective &&\n                  origAsyncDirective.replace)) {\n                // it was cloned therefore we have to clone as well.\n                linkNode = jqLiteClone(compileNode);\n              }\n              replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);\n\n              // Copy in CSS classes from original node\n              safeAddClass(jqLite(linkNode), oldClasses);\n            }\n            if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n            } else {\n              childBoundTranscludeFn = boundTranscludeFn;\n            }\n            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,\n              childBoundTranscludeFn);\n          }\n          linkQueue = null;\n        });\n\n      return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {\n        var childBoundTranscludeFn = boundTranscludeFn;\n        if (scope.$$destroyed) return;\n        if (linkQueue) {\n          linkQueue.push(scope,\n                         node,\n                         rootElement,\n                         childBoundTranscludeFn);\n        } else {\n          if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n            childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n          }\n          afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);\n        }\n      };\n    }\n\n\n    /**\n     * Sorting function for bound directives.\n     */\n    function byPriority(a, b) {\n      var diff = b.priority - a.priority;\n      if (diff !== 0) return diff;\n      if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;\n      return a.index - b.index;\n    }\n\n    function assertNoDuplicate(what, previousDirective, directive, element) {\n\n      function wrapModuleNameIfDefined(moduleName) {\n        return moduleName ?\n          (' (module: ' + moduleName + ')') :\n          '';\n      }\n\n      if (previousDirective) {\n        throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',\n            previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),\n            directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));\n      }\n    }\n\n\n    function addTextInterpolateDirective(directives, text) {\n      var interpolateFn = $interpolate(text, true);\n      if (interpolateFn) {\n        directives.push({\n          priority: 0,\n          compile: function textInterpolateCompileFn(templateNode) {\n            var templateNodeParent = templateNode.parent(),\n                hasCompileParent = !!templateNodeParent.length;\n\n            // When transcluding a template that has bindings in the root\n            // we don't have a parent and thus need to add the class during linking fn.\n            if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);\n\n            return function textInterpolateLinkFn(scope, node) {\n              var parent = node.parent();\n              if (!hasCompileParent) compile.$$addBindingClass(parent);\n              compile.$$addBindingInfo(parent, interpolateFn.expressions);\n              scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {\n                node[0].nodeValue = value;\n              });\n            };\n          }\n        });\n      }\n    }\n\n\n    function wrapTemplate(type, template) {\n      type = lowercase(type || 'html');\n      switch (type) {\n      case 'svg':\n      case 'math':\n        var wrapper = document.createElement('div');\n        wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';\n        return wrapper.childNodes[0].childNodes;\n      default:\n        return template;\n      }\n    }\n\n\n    function getTrustedContext(node, attrNormalizedName) {\n      if (attrNormalizedName == \"srcdoc\") {\n        return $sce.HTML;\n      }\n      var tag = nodeName_(node);\n      // maction[xlink:href] can source SVG.  It's not limited to <maction>.\n      if (attrNormalizedName == \"xlinkHref\" ||\n          (tag == \"form\" && attrNormalizedName == \"action\") ||\n          (tag != \"img\" && (attrNormalizedName == \"src\" ||\n                            attrNormalizedName == \"ngSrc\"))) {\n        return $sce.RESOURCE_URL;\n      }\n    }\n\n\n    function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {\n      var trustedContext = getTrustedContext(node, name);\n      allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;\n\n      var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);\n\n      // no interpolation found -> ignore\n      if (!interpolateFn) return;\n\n\n      if (name === \"multiple\" && nodeName_(node) === \"select\") {\n        throw $compileMinErr(\"selmulti\",\n            \"Binding to the 'multiple' attribute is not supported. Element: {0}\",\n            startingTag(node));\n      }\n\n      directives.push({\n        priority: 100,\n        compile: function() {\n            return {\n              pre: function attrInterpolatePreLinkFn(scope, element, attr) {\n                var $$observers = (attr.$$observers || (attr.$$observers = createMap()));\n\n                if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {\n                  throw $compileMinErr('nodomevents',\n                      \"Interpolations for HTML DOM event attributes are disallowed.  Please use the \" +\n                          \"ng- versions (such as ng-click instead of onclick) instead.\");\n                }\n\n                // If the attribute has changed since last $interpolate()ed\n                var newValue = attr[name];\n                if (newValue !== value) {\n                  // we need to interpolate again since the attribute value has been updated\n                  // (e.g. by another directive's compile function)\n                  // ensure unset/empty values make interpolateFn falsy\n                  interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);\n                  value = newValue;\n                }\n\n                // if attribute was updated so that there is no interpolation going on we don't want to\n                // register any observers\n                if (!interpolateFn) return;\n\n                // initialize attr object so that it's ready in case we need the value for isolate\n                // scope initialization, otherwise the value would not be available from isolate\n                // directive's linking fn during linking phase\n                attr[name] = interpolateFn(scope);\n\n                ($$observers[name] || ($$observers[name] = [])).$$inter = true;\n                (attr.$$observers && attr.$$observers[name].$$scope || scope).\n                  $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {\n                    //special case for class attribute addition + removal\n                    //so that class changes can tap into the animation\n                    //hooks provided by the $animate service. Be sure to\n                    //skip animations when the first digest occurs (when\n                    //both the new and the old values are the same) since\n                    //the CSS classes are the non-interpolated values\n                    if (name === 'class' && newValue != oldValue) {\n                      attr.$updateClass(newValue, oldValue);\n                    } else {\n                      attr.$set(name, newValue);\n                    }\n                  });\n              }\n            };\n          }\n      });\n    }\n\n\n    /**\n     * This is a special jqLite.replaceWith, which can replace items which\n     * have no parents, provided that the containing jqLite collection is provided.\n     *\n     * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes\n     *                               in the root of the tree.\n     * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep\n     *                                  the shell, but replace its DOM node reference.\n     * @param {Node} newNode The new DOM node.\n     */\n    function replaceWith($rootElement, elementsToRemove, newNode) {\n      var firstElementToRemove = elementsToRemove[0],\n          removeCount = elementsToRemove.length,\n          parent = firstElementToRemove.parentNode,\n          i, ii;\n\n      if ($rootElement) {\n        for (i = 0, ii = $rootElement.length; i < ii; i++) {\n          if ($rootElement[i] == firstElementToRemove) {\n            $rootElement[i++] = newNode;\n            for (var j = i, j2 = j + removeCount - 1,\n                     jj = $rootElement.length;\n                 j < jj; j++, j2++) {\n              if (j2 < jj) {\n                $rootElement[j] = $rootElement[j2];\n              } else {\n                delete $rootElement[j];\n              }\n            }\n            $rootElement.length -= removeCount - 1;\n\n            // If the replaced element is also the jQuery .context then replace it\n            // .context is a deprecated jQuery api, so we should set it only when jQuery set it\n            // http://api.jquery.com/context/\n            if ($rootElement.context === firstElementToRemove) {\n              $rootElement.context = newNode;\n            }\n            break;\n          }\n        }\n      }\n\n      if (parent) {\n        parent.replaceChild(newNode, firstElementToRemove);\n      }\n\n      // Append all the `elementsToRemove` to a fragment. This will...\n      // - remove them from the DOM\n      // - allow them to still be traversed with .nextSibling\n      // - allow a single fragment.qSA to fetch all elements being removed\n      var fragment = document.createDocumentFragment();\n      for (i = 0; i < removeCount; i++) {\n        fragment.appendChild(elementsToRemove[i]);\n      }\n\n      if (jqLite.hasData(firstElementToRemove)) {\n        // Copy over user data (that includes Angular's $scope etc.). Don't copy private\n        // data here because there's no public interface in jQuery to do that and copying over\n        // event listeners (which is the main use of private data) wouldn't work anyway.\n        jqLite.data(newNode, jqLite.data(firstElementToRemove));\n\n        // Remove $destroy event listeners from `firstElementToRemove`\n        jqLite(firstElementToRemove).off('$destroy');\n      }\n\n      // Cleanup any data/listeners on the elements and children.\n      // This includes invoking the $destroy event on any elements with listeners.\n      jqLite.cleanData(fragment.querySelectorAll('*'));\n\n      // Update the jqLite collection to only contain the `newNode`\n      for (i = 1; i < removeCount; i++) {\n        delete elementsToRemove[i];\n      }\n      elementsToRemove[0] = newNode;\n      elementsToRemove.length = 1;\n    }\n\n\n    function cloneAndAnnotateFn(fn, annotation) {\n      return extend(function() { return fn.apply(null, arguments); }, fn, annotation);\n    }\n\n\n    function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {\n      try {\n        linkFn(scope, $element, attrs, controllers, transcludeFn);\n      } catch (e) {\n        $exceptionHandler(e, startingTag($element));\n      }\n    }\n\n\n    // Set up $watches for isolate scope and controller bindings. This process\n    // only occurs for isolate scopes and new scopes with controllerAs.\n    function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {\n      var removeWatchCollection = [];\n      var changes;\n      forEach(bindings, function initializeBinding(definition, scopeName) {\n        var attrName = definition.attrName,\n        optional = definition.optional,\n        mode = definition.mode, // @, =, or &\n        lastValue,\n        parentGet, parentSet, compare, removeWatch;\n\n        switch (mode) {\n\n          case '@':\n            if (!optional && !hasOwnProperty.call(attrs, attrName)) {\n              destination[scopeName] = attrs[attrName] = void 0;\n            }\n            attrs.$observe(attrName, function(value) {\n              if (isString(value)) {\n                var oldValue = destination[scopeName];\n                recordChanges(scopeName, value, oldValue);\n                destination[scopeName] = value;\n              }\n            });\n            attrs.$$observers[attrName].$$scope = scope;\n            lastValue = attrs[attrName];\n            if (isString(lastValue)) {\n              // If the attribute has been provided then we trigger an interpolation to ensure\n              // the value is there for use in the link fn\n              destination[scopeName] = $interpolate(lastValue)(scope);\n            } else if (isBoolean(lastValue)) {\n              // If the attributes is one of the BOOLEAN_ATTR then Angular will have converted\n              // the value to boolean rather than a string, so we special case this situation\n              destination[scopeName] = lastValue;\n            }\n            break;\n\n          case '=':\n            if (!hasOwnProperty.call(attrs, attrName)) {\n              if (optional) break;\n              attrs[attrName] = void 0;\n            }\n            if (optional && !attrs[attrName]) break;\n\n            parentGet = $parse(attrs[attrName]);\n            if (parentGet.literal) {\n              compare = equals;\n            } else {\n              compare = function simpleCompare(a, b) { return a === b || (a !== a && b !== b); };\n            }\n            parentSet = parentGet.assign || function() {\n              // reset the change, or we will throw this exception on every $digest\n              lastValue = destination[scopeName] = parentGet(scope);\n              throw $compileMinErr('nonassign',\n                  \"Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!\",\n                  attrs[attrName], attrName, directive.name);\n            };\n            lastValue = destination[scopeName] = parentGet(scope);\n            var parentValueWatch = function parentValueWatch(parentValue) {\n              if (!compare(parentValue, destination[scopeName])) {\n                // we are out of sync and need to copy\n                if (!compare(parentValue, lastValue)) {\n                  // parent changed and it has precedence\n                  destination[scopeName] = parentValue;\n                } else {\n                  // if the parent can be assigned then do so\n                  parentSet(scope, parentValue = destination[scopeName]);\n                }\n              }\n              return lastValue = parentValue;\n            };\n            parentValueWatch.$stateful = true;\n            if (definition.collection) {\n              removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);\n            } else {\n              removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);\n            }\n            removeWatchCollection.push(removeWatch);\n            break;\n\n          case '<':\n            if (!hasOwnProperty.call(attrs, attrName)) {\n              if (optional) break;\n              attrs[attrName] = void 0;\n            }\n            if (optional && !attrs[attrName]) break;\n\n            parentGet = $parse(attrs[attrName]);\n\n            destination[scopeName] = parentGet(scope);\n\n            removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newParentValue) {\n              var oldValue = destination[scopeName];\n              recordChanges(scopeName, newParentValue, oldValue);\n              destination[scopeName] = newParentValue;\n            }, parentGet.literal);\n\n            removeWatchCollection.push(removeWatch);\n            break;\n\n          case '&':\n            // Don't assign Object.prototype method to scope\n            parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;\n\n            // Don't assign noop to destination if expression is not valid\n            if (parentGet === noop && optional) break;\n\n            destination[scopeName] = function(locals) {\n              return parentGet(scope, locals);\n            };\n            break;\n        }\n      });\n\n      function recordChanges(key, currentValue, previousValue) {\n        if (isFunction(destination.$onChanges) && currentValue !== previousValue) {\n          // If we have not already scheduled the top level onChangesQueue handler then do so now\n          if (!onChangesQueue) {\n            scope.$$postDigest(flushOnChangesQueue);\n            onChangesQueue = [];\n          }\n          // If we have not already queued a trigger of onChanges for this controller then do so now\n          if (!changes) {\n            changes = {};\n            onChangesQueue.push(triggerOnChangesHook);\n          }\n          // If the has been a change on this property already then we need to reuse the previous value\n          if (changes[key]) {\n            previousValue = changes[key].previousValue;\n          }\n          // Store this change\n          changes[key] = {previousValue: previousValue, currentValue: currentValue};\n        }\n      }\n\n      function triggerOnChangesHook() {\n        destination.$onChanges(changes);\n        // Now clear the changes so that we schedule onChanges when more changes arrive\n        changes = undefined;\n      }\n\n      return removeWatchCollection.length && function removeWatches() {\n        for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {\n          removeWatchCollection[i]();\n        }\n      };\n    }\n  }];\n}\n\nvar PREFIX_REGEXP = /^((?:x|data)[\\:\\-_])/i;\n/**\n * Converts all accepted directives format into proper directive name.\n * @param name Name to normalize\n */\nfunction directiveNormalize(name) {\n  return camelCase(name.replace(PREFIX_REGEXP, ''));\n}\n\n/**\n * @ngdoc type\n * @name $compile.directive.Attributes\n *\n * @description\n * A shared object between directive compile / linking functions which contains normalized DOM\n * element attributes. The values reflect current binding state `{{ }}`. The normalization is\n * needed since all of these are treated as equivalent in Angular:\n *\n * ```\n *    <span ng:bind=\"a\" ng-bind=\"a\" data-ng-bind=\"a\" x-ng-bind=\"a\">\n * ```\n */\n\n/**\n * @ngdoc property\n * @name $compile.directive.Attributes#$attr\n *\n * @description\n * A map of DOM element attribute names to the normalized name. This is\n * needed to do reverse lookup from normalized name back to actual name.\n */\n\n\n/**\n * @ngdoc method\n * @name $compile.directive.Attributes#$set\n * @kind function\n *\n * @description\n * Set DOM element attribute value.\n *\n *\n * @param {string} name Normalized element attribute name of the property to modify. The name is\n *          reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}\n *          property to the original name.\n * @param {string} value Value to set the attribute to. The value can be an interpolated string.\n */\n\n\n\n/**\n * Closure compiler type information\n */\n\nfunction nodesetLinkingFn(\n  /* angular.Scope */ scope,\n  /* NodeList */ nodeList,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction directiveLinkingFn(\n  /* nodesetLinkingFn */ nodesetLinkingFn,\n  /* angular.Scope */ scope,\n  /* Node */ node,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction tokenDifference(str1, str2) {\n  var values = '',\n      tokens1 = str1.split(/\\s+/),\n      tokens2 = str2.split(/\\s+/);\n\n  outer:\n  for (var i = 0; i < tokens1.length; i++) {\n    var token = tokens1[i];\n    for (var j = 0; j < tokens2.length; j++) {\n      if (token == tokens2[j]) continue outer;\n    }\n    values += (values.length > 0 ? ' ' : '') + token;\n  }\n  return values;\n}\n\nfunction removeComments(jqNodes) {\n  jqNodes = jqLite(jqNodes);\n  var i = jqNodes.length;\n\n  if (i <= 1) {\n    return jqNodes;\n  }\n\n  while (i--) {\n    var node = jqNodes[i];\n    if (node.nodeType === NODE_TYPE_COMMENT) {\n      splice.call(jqNodes, i, 1);\n    }\n  }\n  return jqNodes;\n}\n\nvar $controllerMinErr = minErr('$controller');\n\n\nvar CNTRL_REG = /^(\\S+)(\\s+as\\s+([\\w$]+))?$/;\nfunction identifierForController(controller, ident) {\n  if (ident && isString(ident)) return ident;\n  if (isString(controller)) {\n    var match = CNTRL_REG.exec(controller);\n    if (match) return match[3];\n  }\n}\n\n\n/**\n * @ngdoc provider\n * @name $controllerProvider\n * @description\n * The {@link ng.$controller $controller service} is used by Angular to create new\n * controllers.\n *\n * This provider allows controller registration via the\n * {@link ng.$controllerProvider#register register} method.\n */\nfunction $ControllerProvider() {\n  var controllers = {},\n      globals = false;\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#has\n   * @param {string} name Controller name to check.\n   */\n  this.has = function(name) {\n    return controllers.hasOwnProperty(name);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#register\n   * @param {string|Object} name Controller name, or an object map of controllers where the keys are\n   *    the names and the values are the constructors.\n   * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI\n   *    annotations in the array notation).\n   */\n  this.register = function(name, constructor) {\n    assertNotHasOwnProperty(name, 'controller');\n    if (isObject(name)) {\n      extend(controllers, name);\n    } else {\n      controllers[name] = constructor;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#allowGlobals\n   * @description If called, allows `$controller` to find controller constructors on `window`\n   */\n  this.allowGlobals = function() {\n    globals = true;\n  };\n\n\n  this.$get = ['$injector', '$window', function($injector, $window) {\n\n    /**\n     * @ngdoc service\n     * @name $controller\n     * @requires $injector\n     *\n     * @param {Function|string} constructor If called with a function then it's considered to be the\n     *    controller constructor function. Otherwise it's considered to be a string which is used\n     *    to retrieve the controller constructor using the following steps:\n     *\n     *    * check if a controller with given name is registered via `$controllerProvider`\n     *    * check if evaluating the string on the current scope returns a constructor\n     *    * if $controllerProvider#allowGlobals, check `window[constructor]` on the global\n     *      `window` object (not recommended)\n     *\n     *    The string can use the `controller as property` syntax, where the controller instance is published\n     *    as the specified property on the `scope`; the `scope` must be injected into `locals` param for this\n     *    to work correctly.\n     *\n     * @param {Object} locals Injection locals for Controller.\n     * @return {Object} Instance of given controller.\n     *\n     * @description\n     * `$controller` service is responsible for instantiating controllers.\n     *\n     * It's just a simple call to {@link auto.$injector $injector}, but extracted into\n     * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).\n     */\n    return function $controller(expression, locals, later, ident) {\n      // PRIVATE API:\n      //   param `later` --- indicates that the controller's constructor is invoked at a later time.\n      //                     If true, $controller will allocate the object with the correct\n      //                     prototype chain, but will not invoke the controller until a returned\n      //                     callback is invoked.\n      //   param `ident` --- An optional label which overrides the label parsed from the controller\n      //                     expression, if any.\n      var instance, match, constructor, identifier;\n      later = later === true;\n      if (ident && isString(ident)) {\n        identifier = ident;\n      }\n\n      if (isString(expression)) {\n        match = expression.match(CNTRL_REG);\n        if (!match) {\n          throw $controllerMinErr('ctrlfmt',\n            \"Badly formed controller string '{0}'. \" +\n            \"Must match `__name__ as __id__` or `__name__`.\", expression);\n        }\n        constructor = match[1],\n        identifier = identifier || match[3];\n        expression = controllers.hasOwnProperty(constructor)\n            ? controllers[constructor]\n            : getter(locals.$scope, constructor, true) ||\n                (globals ? getter($window, constructor, true) : undefined);\n\n        assertArgFn(expression, constructor, true);\n      }\n\n      if (later) {\n        // Instantiate controller later:\n        // This machinery is used to create an instance of the object before calling the\n        // controller's constructor itself.\n        //\n        // This allows properties to be added to the controller before the constructor is\n        // invoked. Primarily, this is used for isolate scope bindings in $compile.\n        //\n        // This feature is not intended for use by applications, and is thus not documented\n        // publicly.\n        // Object creation: http://jsperf.com/create-constructor/2\n        var controllerPrototype = (isArray(expression) ?\n          expression[expression.length - 1] : expression).prototype;\n        instance = Object.create(controllerPrototype || null);\n\n        if (identifier) {\n          addIdentifier(locals, identifier, instance, constructor || expression.name);\n        }\n\n        var instantiate;\n        return instantiate = extend(function $controllerInit() {\n          var result = $injector.invoke(expression, instance, locals, constructor);\n          if (result !== instance && (isObject(result) || isFunction(result))) {\n            instance = result;\n            if (identifier) {\n              // If result changed, re-assign controllerAs value to scope.\n              addIdentifier(locals, identifier, instance, constructor || expression.name);\n            }\n          }\n          return instance;\n        }, {\n          instance: instance,\n          identifier: identifier\n        });\n      }\n\n      instance = $injector.instantiate(expression, locals, constructor);\n\n      if (identifier) {\n        addIdentifier(locals, identifier, instance, constructor || expression.name);\n      }\n\n      return instance;\n    };\n\n    function addIdentifier(locals, identifier, instance, name) {\n      if (!(locals && isObject(locals.$scope))) {\n        throw minErr('$controller')('noscp',\n          \"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.\",\n          name, identifier);\n      }\n\n      locals.$scope[identifier] = instance;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $document\n * @requires $window\n *\n * @description\n * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.\n *\n * @example\n   <example module=\"documentExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <p>$document title: <b ng-bind=\"title\"></b></p>\n         <p>window.document title: <b ng-bind=\"windowTitle\"></b></p>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('documentExample', [])\n         .controller('ExampleController', ['$scope', '$document', function($scope, $document) {\n           $scope.title = $document[0].title;\n           $scope.windowTitle = angular.element(window.document)[0].title;\n         }]);\n     </file>\n   </example>\n */\nfunction $DocumentProvider() {\n  this.$get = ['$window', function(window) {\n    return jqLite(window.document);\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $exceptionHandler\n * @requires ng.$log\n *\n * @description\n * Any uncaught exception in angular expressions is delegated to this service.\n * The default implementation simply delegates to `$log.error` which logs it into\n * the browser console.\n *\n * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by\n * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.\n *\n * ## Example:\n *\n * ```js\n *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {\n *     return function(exception, cause) {\n *       exception.message += ' (caused by \"' + cause + '\")';\n *       throw exception;\n *     };\n *   });\n * ```\n *\n * This example will override the normal action of `$exceptionHandler`, to make angular\n * exceptions fail hard when they happen, instead of just logging to the console.\n *\n * <hr />\n * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`\n * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}\n * (unless executed during a digest).\n *\n * If you wish, you can manually delegate exceptions, e.g.\n * `try { ... } catch(e) { $exceptionHandler(e); }`\n *\n * @param {Error} exception Exception associated with the error.\n * @param {string=} cause optional information about the context in which\n *       the error was thrown.\n *\n */\nfunction $ExceptionHandlerProvider() {\n  this.$get = ['$log', function($log) {\n    return function(exception, cause) {\n      $log.error.apply($log, arguments);\n    };\n  }];\n}\n\nvar $$ForceReflowProvider = function() {\n  this.$get = ['$document', function($document) {\n    return function(domNode) {\n      //the line below will force the browser to perform a repaint so\n      //that all the animated elements within the animation frame will\n      //be properly updated and drawn on screen. This is required to\n      //ensure that the preparation animation is properly flushed so that\n      //the active state picks up from there. DO NOT REMOVE THIS LINE.\n      //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH\n      //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND\n      //WILL TAKE YEARS AWAY FROM YOUR LIFE.\n      if (domNode) {\n        if (!domNode.nodeType && domNode instanceof jqLite) {\n          domNode = domNode[0];\n        }\n      } else {\n        domNode = $document[0].body;\n      }\n      return domNode.offsetWidth + 1;\n    };\n  }];\n};\n\nvar APPLICATION_JSON = 'application/json';\nvar CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};\nvar JSON_START = /^\\[|^\\{(?!\\{)/;\nvar JSON_ENDS = {\n  '[': /]$/,\n  '{': /}$/\n};\nvar JSON_PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar $httpMinErr = minErr('$http');\nvar $httpMinErrLegacyFn = function(method) {\n  return function() {\n    throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);\n  };\n};\n\nfunction serializeValue(v) {\n  if (isObject(v)) {\n    return isDate(v) ? v.toISOString() : toJson(v);\n  }\n  return v;\n}\n\n\nfunction $HttpParamSerializerProvider() {\n  /**\n   * @ngdoc service\n   * @name $httpParamSerializer\n   * @description\n   *\n   * Default {@link $http `$http`} params serializer that converts objects to strings\n   * according to the following rules:\n   *\n   * * `{'foo': 'bar'}` results in `foo=bar`\n   * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)\n   * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)\n   * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D\"` (stringified and encoded representation of an object)\n   *\n   * Note that serializer will sort the request parameters alphabetically.\n   * */\n\n  this.$get = function() {\n    return function ngParamSerializer(params) {\n      if (!params) return '';\n      var parts = [];\n      forEachSorted(params, function(value, key) {\n        if (value === null || isUndefined(value)) return;\n        if (isArray(value)) {\n          forEach(value, function(v) {\n            parts.push(encodeUriQuery(key)  + '=' + encodeUriQuery(serializeValue(v)));\n          });\n        } else {\n          parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));\n        }\n      });\n\n      return parts.join('&');\n    };\n  };\n}\n\nfunction $HttpParamSerializerJQLikeProvider() {\n  /**\n   * @ngdoc service\n   * @name $httpParamSerializerJQLike\n   * @description\n   *\n   * Alternative {@link $http `$http`} params serializer that follows\n   * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.\n   * The serializer will also sort the params alphabetically.\n   *\n   * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:\n   *\n   * ```js\n   * $http({\n   *   url: myUrl,\n   *   method: 'GET',\n   *   params: myParams,\n   *   paramSerializer: '$httpParamSerializerJQLike'\n   * });\n   * ```\n   *\n   * It is also possible to set it as the default `paramSerializer` in the\n   * {@link $httpProvider#defaults `$httpProvider`}.\n   *\n   * Additionally, you can inject the serializer and use it explicitly, for example to serialize\n   * form data for submission:\n   *\n   * ```js\n   * .controller(function($http, $httpParamSerializerJQLike) {\n   *   //...\n   *\n   *   $http({\n   *     url: myUrl,\n   *     method: 'POST',\n   *     data: $httpParamSerializerJQLike(myData),\n   *     headers: {\n   *       'Content-Type': 'application/x-www-form-urlencoded'\n   *     }\n   *   });\n   *\n   * });\n   * ```\n   *\n   * */\n  this.$get = function() {\n    return function jQueryLikeParamSerializer(params) {\n      if (!params) return '';\n      var parts = [];\n      serialize(params, '', true);\n      return parts.join('&');\n\n      function serialize(toSerialize, prefix, topLevel) {\n        if (toSerialize === null || isUndefined(toSerialize)) return;\n        if (isArray(toSerialize)) {\n          forEach(toSerialize, function(value, index) {\n            serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');\n          });\n        } else if (isObject(toSerialize) && !isDate(toSerialize)) {\n          forEachSorted(toSerialize, function(value, key) {\n            serialize(value, prefix +\n                (topLevel ? '' : '[') +\n                key +\n                (topLevel ? '' : ']'));\n          });\n        } else {\n          parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));\n        }\n      }\n    };\n  };\n}\n\nfunction defaultHttpResponseTransform(data, headers) {\n  if (isString(data)) {\n    // Strip json vulnerability protection prefix and trim whitespace\n    var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();\n\n    if (tempData) {\n      var contentType = headers('Content-Type');\n      if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {\n        data = fromJson(tempData);\n      }\n    }\n  }\n\n  return data;\n}\n\nfunction isJsonLike(str) {\n    var jsonStart = str.match(JSON_START);\n    return jsonStart && JSON_ENDS[jsonStart[0]].test(str);\n}\n\n/**\n * Parse headers into key value object\n *\n * @param {string} headers Raw headers as a string\n * @returns {Object} Parsed headers as key value object\n */\nfunction parseHeaders(headers) {\n  var parsed = createMap(), i;\n\n  function fillInParsed(key, val) {\n    if (key) {\n      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n    }\n  }\n\n  if (isString(headers)) {\n    forEach(headers.split('\\n'), function(line) {\n      i = line.indexOf(':');\n      fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));\n    });\n  } else if (isObject(headers)) {\n    forEach(headers, function(headerVal, headerKey) {\n      fillInParsed(lowercase(headerKey), trim(headerVal));\n    });\n  }\n\n  return parsed;\n}\n\n\n/**\n * Returns a function that provides access to parsed headers.\n *\n * Headers are lazy parsed when first requested.\n * @see parseHeaders\n *\n * @param {(string|Object)} headers Headers to provide access to.\n * @returns {function(string=)} Returns a getter function which if called with:\n *\n *   - if called with single an argument returns a single header value or null\n *   - if called with no arguments returns an object containing all headers.\n */\nfunction headersGetter(headers) {\n  var headersObj;\n\n  return function(name) {\n    if (!headersObj) headersObj =  parseHeaders(headers);\n\n    if (name) {\n      var value = headersObj[lowercase(name)];\n      if (value === void 0) {\n        value = null;\n      }\n      return value;\n    }\n\n    return headersObj;\n  };\n}\n\n\n/**\n * Chain all given functions\n *\n * This function is used for both request and response transforming\n *\n * @param {*} data Data to transform.\n * @param {function(string=)} headers HTTP headers getter fn.\n * @param {number} status HTTP status code of the response.\n * @param {(Function|Array.<Function>)} fns Function or an array of functions.\n * @returns {*} Transformed data.\n */\nfunction transformData(data, headers, status, fns) {\n  if (isFunction(fns)) {\n    return fns(data, headers, status);\n  }\n\n  forEach(fns, function(fn) {\n    data = fn(data, headers, status);\n  });\n\n  return data;\n}\n\n\nfunction isSuccess(status) {\n  return 200 <= status && status < 300;\n}\n\n\n/**\n * @ngdoc provider\n * @name $httpProvider\n * @description\n * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.\n * */\nfunction $HttpProvider() {\n  /**\n   * @ngdoc property\n   * @name $httpProvider#defaults\n   * @description\n   *\n   * Object containing default values for all {@link ng.$http $http} requests.\n   *\n   * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with\n   * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses\n   * by default. See {@link $http#caching $http Caching} for more information.\n   *\n   * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.\n   * Defaults value is `'XSRF-TOKEN'`.\n   *\n   * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the\n   * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.\n   *\n   * - **`defaults.headers`** - {Object} - Default headers for all $http requests.\n   * Refer to {@link ng.$http#setting-http-headers $http} for documentation on\n   * setting default headers.\n   *     - **`defaults.headers.common`**\n   *     - **`defaults.headers.post`**\n   *     - **`defaults.headers.put`**\n   *     - **`defaults.headers.patch`**\n   *\n   *\n   * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function\n   *  used to the prepare string representation of request parameters (specified as an object).\n   *  If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.\n   *  Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.\n   *\n   **/\n  var defaults = this.defaults = {\n    // transform incoming response data\n    transformResponse: [defaultHttpResponseTransform],\n\n    // transform outgoing request data\n    transformRequest: [function(d) {\n      return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;\n    }],\n\n    // default headers\n    headers: {\n      common: {\n        'Accept': 'application/json, text/plain, */*'\n      },\n      post:   shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      put:    shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      patch:  shallowCopy(CONTENT_TYPE_APPLICATION_JSON)\n    },\n\n    xsrfCookieName: 'XSRF-TOKEN',\n    xsrfHeaderName: 'X-XSRF-TOKEN',\n\n    paramSerializer: '$httpParamSerializer'\n  };\n\n  var useApplyAsync = false;\n  /**\n   * @ngdoc method\n   * @name $httpProvider#useApplyAsync\n   * @description\n   *\n   * Configure $http service to combine processing of multiple http responses received at around\n   * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in\n   * significant performance improvement for bigger applications that make many HTTP requests\n   * concurrently (common during application bootstrap).\n   *\n   * Defaults to false. If no value is specified, returns the current configured value.\n   *\n   * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred\n   *    \"apply\" on the next tick, giving time for subsequent requests in a roughly ~10ms window\n   *    to load and share the same digest cycle.\n   *\n   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n   *    otherwise, returns the current configured value.\n   **/\n  this.useApplyAsync = function(value) {\n    if (isDefined(value)) {\n      useApplyAsync = !!value;\n      return this;\n    }\n    return useApplyAsync;\n  };\n\n  var useLegacyPromise = true;\n  /**\n   * @ngdoc method\n   * @name $httpProvider#useLegacyPromiseExtensions\n   * @description\n   *\n   * Configure `$http` service to return promises without the shorthand methods `success` and `error`.\n   * This should be used to make sure that applications work without these methods.\n   *\n   * Defaults to true. If no value is specified, returns the current configured value.\n   *\n   * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.\n   *\n   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n   *    otherwise, returns the current configured value.\n   **/\n  this.useLegacyPromiseExtensions = function(value) {\n    if (isDefined(value)) {\n      useLegacyPromise = !!value;\n      return this;\n    }\n    return useLegacyPromise;\n  };\n\n  /**\n   * @ngdoc property\n   * @name $httpProvider#interceptors\n   * @description\n   *\n   * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}\n   * pre-processing of request or postprocessing of responses.\n   *\n   * These service factories are ordered by request, i.e. they are applied in the same order as the\n   * array, on request, but reverse order, on response.\n   *\n   * {@link ng.$http#interceptors Interceptors detailed info}\n   **/\n  var interceptorFactories = this.interceptors = [];\n\n  this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',\n      function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {\n\n    var defaultCache = $cacheFactory('$http');\n\n    /**\n     * Make sure that default param serializer is exposed as a function\n     */\n    defaults.paramSerializer = isString(defaults.paramSerializer) ?\n      $injector.get(defaults.paramSerializer) : defaults.paramSerializer;\n\n    /**\n     * Interceptors stored in reverse order. Inner interceptors before outer interceptors.\n     * The reversal is needed so that we can build up the interception chain around the\n     * server request.\n     */\n    var reversedInterceptors = [];\n\n    forEach(interceptorFactories, function(interceptorFactory) {\n      reversedInterceptors.unshift(isString(interceptorFactory)\n          ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));\n    });\n\n    /**\n     * @ngdoc service\n     * @kind function\n     * @name $http\n     * @requires ng.$httpBackend\n     * @requires $cacheFactory\n     * @requires $rootScope\n     * @requires $q\n     * @requires $injector\n     *\n     * @description\n     * The `$http` service is a core Angular service that facilitates communication with the remote\n     * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)\n     * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).\n     *\n     * For unit testing applications that use `$http` service, see\n     * {@link ngMock.$httpBackend $httpBackend mock}.\n     *\n     * For a higher level of abstraction, please check out the {@link ngResource.$resource\n     * $resource} service.\n     *\n     * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by\n     * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage\n     * it is important to familiarize yourself with these APIs and the guarantees they provide.\n     *\n     *\n     * ## General usage\n     * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —\n     * that is used to generate an HTTP request and returns  a {@link ng.$q promise}.\n     *\n     * ```js\n     *   // Simple GET request example:\n     *   $http({\n     *     method: 'GET',\n     *     url: '/someUrl'\n     *   }).then(function successCallback(response) {\n     *       // this callback will be called asynchronously\n     *       // when the response is available\n     *     }, function errorCallback(response) {\n     *       // called asynchronously if an error occurs\n     *       // or server returns response with an error status.\n     *     });\n     * ```\n     *\n     * The response object has these properties:\n     *\n     *   - **data** – `{string|Object}` – The response body transformed with the transform\n     *     functions.\n     *   - **status** – `{number}` – HTTP status code of the response.\n     *   - **headers** – `{function([headerName])}` – Header getter function.\n     *   - **config** – `{Object}` – The configuration object that was used to generate the request.\n     *   - **statusText** – `{string}` – HTTP status text of the response.\n     *\n     * A response status code between 200 and 299 is considered a success status and\n     * will result in the success callback being called. Note that if the response is a redirect,\n     * XMLHttpRequest will transparently follow it, meaning that the error callback will not be\n     * called for such responses.\n     *\n     *\n     * ## Shortcut methods\n     *\n     * Shortcut methods are also available. All shortcut methods require passing in the URL, and\n     * request data must be passed in for POST/PUT requests. An optional config can be passed as the\n     * last argument.\n     *\n     * ```js\n     *   $http.get('/someUrl', config).then(successCallback, errorCallback);\n     *   $http.post('/someUrl', data, config).then(successCallback, errorCallback);\n     * ```\n     *\n     * Complete list of shortcut methods:\n     *\n     * - {@link ng.$http#get $http.get}\n     * - {@link ng.$http#head $http.head}\n     * - {@link ng.$http#post $http.post}\n     * - {@link ng.$http#put $http.put}\n     * - {@link ng.$http#delete $http.delete}\n     * - {@link ng.$http#jsonp $http.jsonp}\n     * - {@link ng.$http#patch $http.patch}\n     *\n     *\n     * ## Writing Unit Tests that use $http\n     * When unit testing (using {@link ngMock ngMock}), it is necessary to call\n     * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending\n     * request using trained responses.\n     *\n     * ```\n     * $httpBackend.expectGET(...);\n     * $http.get(...);\n     * $httpBackend.flush();\n     * ```\n     *\n     * ## Deprecation Notice\n     * <div class=\"alert alert-danger\">\n     *   The `$http` legacy promise methods `success` and `error` have been deprecated.\n     *   Use the standard `then` method instead.\n     *   If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to\n     *   `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.\n     * </div>\n     *\n     * ## Setting HTTP Headers\n     *\n     * The $http service will automatically add certain HTTP headers to all requests. These defaults\n     * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration\n     * object, which currently contains this default configuration:\n     *\n     * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):\n     *   - `Accept: application/json, text/plain, * / *`\n     * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)\n     *   - `Content-Type: application/json`\n     * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)\n     *   - `Content-Type: application/json`\n     *\n     * To add or overwrite these defaults, simply add or remove a property from these configuration\n     * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object\n     * with the lowercased HTTP method name as the key, e.g.\n     * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.\n     *\n     * The defaults can also be set at runtime via the `$http.defaults` object in the same\n     * fashion. For example:\n     *\n     * ```\n     * module.run(function($http) {\n     *   $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';\n     * });\n     * ```\n     *\n     * In addition, you can supply a `headers` property in the config object passed when\n     * calling `$http(config)`, which overrides the defaults without changing them globally.\n     *\n     * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,\n     * Use the `headers` property, setting the desired header to `undefined`. For example:\n     *\n     * ```js\n     * var req = {\n     *  method: 'POST',\n     *  url: 'http://example.com',\n     *  headers: {\n     *    'Content-Type': undefined\n     *  },\n     *  data: { test: 'test' }\n     * }\n     *\n     * $http(req).then(function(){...}, function(){...});\n     * ```\n     *\n     * ## Transforming Requests and Responses\n     *\n     * Both requests and responses can be transformed using transformation functions: `transformRequest`\n     * and `transformResponse`. These properties can be a single function that returns\n     * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,\n     * which allows you to `push` or `unshift` a new transformation function into the transformation chain.\n     *\n     * <div class=\"alert alert-warning\">\n     * **Note:** Angular does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline.\n     * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference).\n     * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest\n     * function will be reflected on the scope and in any templates where the object is data-bound.\n     * To prevent his, transform functions should have no side-effects.\n     * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return.\n     * </div>\n     *\n     * ### Default Transformations\n     *\n     * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and\n     * `defaults.transformResponse` properties. If a request does not provide its own transformations\n     * then these will be applied.\n     *\n     * You can augment or replace the default transformations by modifying these properties by adding to or\n     * replacing the array.\n     *\n     * Angular provides the following default transformations:\n     *\n     * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):\n     *\n     * - If the `data` property of the request configuration object contains an object, serialize it\n     *   into JSON format.\n     *\n     * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):\n     *\n     *  - If XSRF prefix is detected, strip it (see Security Considerations section below).\n     *  - If JSON response is detected, deserialize it using a JSON parser.\n     *\n     *\n     * ### Overriding the Default Transformations Per Request\n     *\n     * If you wish override the request/response transformations only for a single request then provide\n     * `transformRequest` and/or `transformResponse` properties on the configuration object passed\n     * into `$http`.\n     *\n     * Note that if you provide these properties on the config object the default transformations will be\n     * overwritten. If you wish to augment the default transformations then you must include them in your\n     * local transformation array.\n     *\n     * The following code demonstrates adding a new response transformation to be run after the default response\n     * transformations have been run.\n     *\n     * ```js\n     * function appendTransform(defaults, transform) {\n     *\n     *   // We can't guarantee that the default transformation is an array\n     *   defaults = angular.isArray(defaults) ? defaults : [defaults];\n     *\n     *   // Append the new transformation to the defaults\n     *   return defaults.concat(transform);\n     * }\n     *\n     * $http({\n     *   url: '...',\n     *   method: 'GET',\n     *   transformResponse: appendTransform($http.defaults.transformResponse, function(value) {\n     *     return doTransform(value);\n     *   })\n     * });\n     * ```\n     *\n     *\n     * ## Caching\n     *\n     * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must\n     * set the config.cache value or the default cache value to TRUE or to a cache object (created\n     * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes\n     * precedence over the default cache value.\n     *\n     * In order to:\n     *   * cache all responses - set the default cache value to TRUE or to a cache object\n     *   * cache a specific response - set config.cache value to TRUE or to a cache object\n     *\n     * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,\n     * then the default `$cacheFactory($http)` object is used.\n     *\n     * The default cache value can be set by updating the\n     * {@link ng.$http#defaults `$http.defaults.cache`} property or the\n     * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property.\n     *\n     * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using\n     * the relevant cache object. The next time the same request is made, the response is returned\n     * from the cache without sending a request to the server.\n     *\n     * Take note that:\n     *\n     *   * Only GET and JSONP requests are cached.\n     *   * The cache key is the request URL including search parameters; headers are not considered.\n     *   * Cached responses are returned asynchronously, in the same way as responses from the server.\n     *   * If multiple identical requests are made using the same cache, which is not yet populated,\n     *     one request will be made to the server and remaining requests will return the same response.\n     *   * A cache-control header on the response does not affect if or how responses are cached.\n     *\n     *\n     * ## Interceptors\n     *\n     * Before you start creating interceptors, be sure to understand the\n     * {@link ng.$q $q and deferred/promise APIs}.\n     *\n     * For purposes of global error handling, authentication, or any kind of synchronous or\n     * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be\n     * able to intercept requests before they are handed to the server and\n     * responses before they are handed over to the application code that\n     * initiated these requests. The interceptors leverage the {@link ng.$q\n     * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.\n     *\n     * The interceptors are service factories that are registered with the `$httpProvider` by\n     * adding them to the `$httpProvider.interceptors` array. The factory is called and\n     * injected with dependencies (if specified) and returns the interceptor.\n     *\n     * There are two kinds of interceptors (and two kinds of rejection interceptors):\n     *\n     *   * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to\n     *     modify the `config` object or create a new one. The function needs to return the `config`\n     *     object directly, or a promise containing the `config` or a new `config` object.\n     *   * `requestError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *   * `response`: interceptors get called with http `response` object. The function is free to\n     *     modify the `response` object or create a new one. The function needs to return the `response`\n     *     object directly, or as a promise containing the `response` or a new `response` object.\n     *   * `responseError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *\n     *\n     * ```js\n     *   // register the interceptor as a service\n     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n     *     return {\n     *       // optional method\n     *       'request': function(config) {\n     *         // do something on success\n     *         return config;\n     *       },\n     *\n     *       // optional method\n     *      'requestError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       },\n     *\n     *\n     *\n     *       // optional method\n     *       'response': function(response) {\n     *         // do something on success\n     *         return response;\n     *       },\n     *\n     *       // optional method\n     *      'responseError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       }\n     *     };\n     *   });\n     *\n     *   $httpProvider.interceptors.push('myHttpInterceptor');\n     *\n     *\n     *   // alternatively, register the interceptor via an anonymous factory\n     *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {\n     *     return {\n     *      'request': function(config) {\n     *          // same as above\n     *       },\n     *\n     *       'response': function(response) {\n     *          // same as above\n     *       }\n     *     };\n     *   });\n     * ```\n     *\n     * ## Security Considerations\n     *\n     * When designing web applications, consider security threats from:\n     *\n     * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)\n     *\n     * Both server and the client must cooperate in order to eliminate these threats. Angular comes\n     * pre-configured with strategies that address these issues, but for this to work backend server\n     * cooperation is required.\n     *\n     * ### JSON Vulnerability Protection\n     *\n     * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * allows third party website to turn your JSON resource URL into\n     * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To\n     * counter this your server can prefix all JSON requests with following string `\")]}',\\n\"`.\n     * Angular will automatically strip the prefix before processing it as JSON.\n     *\n     * For example if your server needs to return:\n     * ```js\n     * ['one','two']\n     * ```\n     *\n     * which is vulnerable to attack, your server can return:\n     * ```js\n     * )]}',\n     * ['one','two']\n     * ```\n     *\n     * Angular will strip the prefix, before processing the JSON.\n     *\n     *\n     * ### Cross Site Request Forgery (XSRF) Protection\n     *\n     * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by\n     * which the attacker can trick an authenticated user into unknowingly executing actions on your\n     * website. Angular provides a mechanism to counter XSRF. When performing XHR requests, the\n     * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP\n     * header (`X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the\n     * cookie, your server can be assured that the XHR came from JavaScript running on your domain.\n     * The header will not be set for cross-domain requests.\n     *\n     * To take advantage of this, your server needs to set a token in a JavaScript readable session\n     * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the\n     * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure\n     * that only JavaScript running on your domain could have sent the request. The token must be\n     * unique for each user and must be verifiable by the server (to prevent the JavaScript from\n     * making up its own tokens). We recommend that the token is a digest of your site's\n     * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)\n     * for added security.\n     *\n     * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName\n     * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,\n     * or the per-request config object.\n     *\n     * In order to prevent collisions in environments where multiple Angular apps share the\n     * same domain or subdomain, we recommend that each application uses unique cookie name.\n     *\n     * @param {object} config Object describing the request to be made and how it should be\n     *    processed. The object has following properties:\n     *\n     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)\n     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.\n     *    - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized\n     *      with the `paramSerializer` and appended as GET parameters.\n     *    - **data** – `{string|Object}` – Data to be sent as the request message data.\n     *    - **headers** – `{Object}` – Map of strings or functions which return strings representing\n     *      HTTP headers to send to the server. If the return value of a function is null, the\n     *      header will not be sent. Functions accept a config object as an argument.\n     *    - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.\n     *    - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.\n     *    - **transformRequest** –\n     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      request body and headers and returns its transformed (typically serialized) version.\n     *      See {@link ng.$http#overriding-the-default-transformations-per-request\n     *      Overriding the Default Transformations}\n     *    - **transformResponse** –\n     *      `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      response body, headers and status and returns its transformed (typically deserialized) version.\n     *      See {@link ng.$http#overriding-the-default-transformations-per-request\n     *      Overriding the Default Transformations}\n     *    - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to\n     *      prepare the string representation of request parameters (specified as an object).\n     *      If specified as string, it is interpreted as function registered with the\n     *      {@link $injector $injector}, which means you can create your own serializer\n     *      by registering it as a {@link auto.$provide#service service}.\n     *      The default serializer is the {@link $httpParamSerializer $httpParamSerializer};\n     *      alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}\n     *    - **cache** – `{boolean|Object}` – A boolean value or object created with\n     *      {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.\n     *      See {@link $http#caching $http Caching} for more information.\n     *    - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}\n     *      that should abort the request when resolved.\n     *    - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the\n     *      XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)\n     *      for more information.\n     *    - **responseType** - `{string}` - see\n     *      [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).\n     *\n     * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object\n     *                        when the request succeeds or fails.\n     *\n     *\n     * @property {Array.<Object>} pendingRequests Array of config objects for currently pending\n     *   requests. This is primarily meant to be used for debugging purposes.\n     *\n     *\n     * @example\n<example module=\"httpExample\">\n<file name=\"index.html\">\n  <div ng-controller=\"FetchController\">\n    <select ng-model=\"method\" aria-label=\"Request method\">\n      <option>GET</option>\n      <option>JSONP</option>\n    </select>\n    <input type=\"text\" ng-model=\"url\" size=\"80\" aria-label=\"URL\" />\n    <button id=\"fetchbtn\" ng-click=\"fetch()\">fetch</button><br>\n    <button id=\"samplegetbtn\" ng-click=\"updateModel('GET', 'http-hello.html')\">Sample GET</button>\n    <button id=\"samplejsonpbtn\"\n      ng-click=\"updateModel('JSONP',\n                    'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')\">\n      Sample JSONP\n    </button>\n    <button id=\"invalidjsonpbtn\"\n      ng-click=\"updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')\">\n        Invalid JSONP\n      </button>\n    <pre>http status code: {{status}}</pre>\n    <pre>http response data: {{data}}</pre>\n  </div>\n</file>\n<file name=\"script.js\">\n  angular.module('httpExample', [])\n    .controller('FetchController', ['$scope', '$http', '$templateCache',\n      function($scope, $http, $templateCache) {\n        $scope.method = 'GET';\n        $scope.url = 'http-hello.html';\n\n        $scope.fetch = function() {\n          $scope.code = null;\n          $scope.response = null;\n\n          $http({method: $scope.method, url: $scope.url, cache: $templateCache}).\n            then(function(response) {\n              $scope.status = response.status;\n              $scope.data = response.data;\n            }, function(response) {\n              $scope.data = response.data || \"Request failed\";\n              $scope.status = response.status;\n          });\n        };\n\n        $scope.updateModel = function(method, url) {\n          $scope.method = method;\n          $scope.url = url;\n        };\n      }]);\n</file>\n<file name=\"http-hello.html\">\n  Hello, $http!\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  var status = element(by.binding('status'));\n  var data = element(by.binding('data'));\n  var fetchBtn = element(by.id('fetchbtn'));\n  var sampleGetBtn = element(by.id('samplegetbtn'));\n  var sampleJsonpBtn = element(by.id('samplejsonpbtn'));\n  var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));\n\n  it('should make an xhr GET request', function() {\n    sampleGetBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('200');\n    expect(data.getText()).toMatch(/Hello, \\$http!/);\n  });\n\n// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185\n// it('should make a JSONP request to angularjs.org', function() {\n//   sampleJsonpBtn.click();\n//   fetchBtn.click();\n//   expect(status.getText()).toMatch('200');\n//   expect(data.getText()).toMatch(/Super Hero!/);\n// });\n\n  it('should make JSONP request to invalid URL and invoke the error handler',\n      function() {\n    invalidJsonpBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('0');\n    expect(data.getText()).toMatch('Request failed');\n  });\n</file>\n</example>\n     */\n    function $http(requestConfig) {\n\n      if (!isObject(requestConfig)) {\n        throw minErr('$http')('badreq', 'Http request configuration must be an object.  Received: {0}', requestConfig);\n      }\n\n      if (!isString(requestConfig.url)) {\n        throw minErr('$http')('badreq', 'Http request configuration url must be a string.  Received: {0}', requestConfig.url);\n      }\n\n      var config = extend({\n        method: 'get',\n        transformRequest: defaults.transformRequest,\n        transformResponse: defaults.transformResponse,\n        paramSerializer: defaults.paramSerializer\n      }, requestConfig);\n\n      config.headers = mergeHeaders(requestConfig);\n      config.method = uppercase(config.method);\n      config.paramSerializer = isString(config.paramSerializer) ?\n        $injector.get(config.paramSerializer) : config.paramSerializer;\n\n      var serverRequest = function(config) {\n        var headers = config.headers;\n        var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);\n\n        // strip content-type if data is undefined\n        if (isUndefined(reqData)) {\n          forEach(headers, function(value, header) {\n            if (lowercase(header) === 'content-type') {\n                delete headers[header];\n            }\n          });\n        }\n\n        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {\n          config.withCredentials = defaults.withCredentials;\n        }\n\n        // send request\n        return sendReq(config, reqData).then(transformResponse, transformResponse);\n      };\n\n      var chain = [serverRequest, undefined];\n      var promise = $q.when(config);\n\n      // apply interceptors\n      forEach(reversedInterceptors, function(interceptor) {\n        if (interceptor.request || interceptor.requestError) {\n          chain.unshift(interceptor.request, interceptor.requestError);\n        }\n        if (interceptor.response || interceptor.responseError) {\n          chain.push(interceptor.response, interceptor.responseError);\n        }\n      });\n\n      while (chain.length) {\n        var thenFn = chain.shift();\n        var rejectFn = chain.shift();\n\n        promise = promise.then(thenFn, rejectFn);\n      }\n\n      if (useLegacyPromise) {\n        promise.success = function(fn) {\n          assertArgFn(fn, 'fn');\n\n          promise.then(function(response) {\n            fn(response.data, response.status, response.headers, config);\n          });\n          return promise;\n        };\n\n        promise.error = function(fn) {\n          assertArgFn(fn, 'fn');\n\n          promise.then(null, function(response) {\n            fn(response.data, response.status, response.headers, config);\n          });\n          return promise;\n        };\n      } else {\n        promise.success = $httpMinErrLegacyFn('success');\n        promise.error = $httpMinErrLegacyFn('error');\n      }\n\n      return promise;\n\n      function transformResponse(response) {\n        // make a copy since the response must be cacheable\n        var resp = extend({}, response);\n        resp.data = transformData(response.data, response.headers, response.status,\n                                  config.transformResponse);\n        return (isSuccess(response.status))\n          ? resp\n          : $q.reject(resp);\n      }\n\n      function executeHeaderFns(headers, config) {\n        var headerContent, processedHeaders = {};\n\n        forEach(headers, function(headerFn, header) {\n          if (isFunction(headerFn)) {\n            headerContent = headerFn(config);\n            if (headerContent != null) {\n              processedHeaders[header] = headerContent;\n            }\n          } else {\n            processedHeaders[header] = headerFn;\n          }\n        });\n\n        return processedHeaders;\n      }\n\n      function mergeHeaders(config) {\n        var defHeaders = defaults.headers,\n            reqHeaders = extend({}, config.headers),\n            defHeaderName, lowercaseDefHeaderName, reqHeaderName;\n\n        defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);\n\n        // using for-in instead of forEach to avoid unnecessary iteration after header has been found\n        defaultHeadersIteration:\n        for (defHeaderName in defHeaders) {\n          lowercaseDefHeaderName = lowercase(defHeaderName);\n\n          for (reqHeaderName in reqHeaders) {\n            if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {\n              continue defaultHeadersIteration;\n            }\n          }\n\n          reqHeaders[defHeaderName] = defHeaders[defHeaderName];\n        }\n\n        // execute if header value is a function for merged headers\n        return executeHeaderFns(reqHeaders, shallowCopy(config));\n      }\n    }\n\n    $http.pendingRequests = [];\n\n    /**\n     * @ngdoc method\n     * @name $http#get\n     *\n     * @description\n     * Shortcut method to perform `GET` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#delete\n     *\n     * @description\n     * Shortcut method to perform `DELETE` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#head\n     *\n     * @description\n     * Shortcut method to perform `HEAD` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#jsonp\n     *\n     * @description\n     * Shortcut method to perform `JSONP` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request.\n     *                     The name of the callback should be the string `JSON_CALLBACK`.\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n    createShortMethods('get', 'delete', 'head', 'jsonp');\n\n    /**\n     * @ngdoc method\n     * @name $http#post\n     *\n     * @description\n     * Shortcut method to perform `POST` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#put\n     *\n     * @description\n     * Shortcut method to perform `PUT` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n     /**\n      * @ngdoc method\n      * @name $http#patch\n      *\n      * @description\n      * Shortcut method to perform `PATCH` request.\n      *\n      * @param {string} url Relative or absolute URL specifying the destination of the request\n      * @param {*} data Request content\n      * @param {Object=} config Optional configuration object\n      * @returns {HttpPromise} Future object\n      */\n    createShortMethodsWithData('post', 'put', 'patch');\n\n        /**\n         * @ngdoc property\n         * @name $http#defaults\n         *\n         * @description\n         * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of\n         * default headers, withCredentials as well as request and response transformations.\n         *\n         * See \"Setting HTTP Headers\" and \"Transforming Requests and Responses\" sections above.\n         */\n    $http.defaults = defaults;\n\n\n    return $http;\n\n\n    function createShortMethods(names) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, config) {\n          return $http(extend({}, config || {}, {\n            method: name,\n            url: url\n          }));\n        };\n      });\n    }\n\n\n    function createShortMethodsWithData(name) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, data, config) {\n          return $http(extend({}, config || {}, {\n            method: name,\n            url: url,\n            data: data\n          }));\n        };\n      });\n    }\n\n\n    /**\n     * Makes the request.\n     *\n     * !!! ACCESSES CLOSURE VARS:\n     * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests\n     */\n    function sendReq(config, reqData) {\n      var deferred = $q.defer(),\n          promise = deferred.promise,\n          cache,\n          cachedResp,\n          reqHeaders = config.headers,\n          url = buildUrl(config.url, config.paramSerializer(config.params));\n\n      $http.pendingRequests.push(config);\n      promise.then(removePendingReq, removePendingReq);\n\n\n      if ((config.cache || defaults.cache) && config.cache !== false &&\n          (config.method === 'GET' || config.method === 'JSONP')) {\n        cache = isObject(config.cache) ? config.cache\n              : isObject(defaults.cache) ? defaults.cache\n              : defaultCache;\n      }\n\n      if (cache) {\n        cachedResp = cache.get(url);\n        if (isDefined(cachedResp)) {\n          if (isPromiseLike(cachedResp)) {\n            // cached request has already been sent, but there is no response yet\n            cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);\n          } else {\n            // serving from cache\n            if (isArray(cachedResp)) {\n              resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);\n            } else {\n              resolvePromise(cachedResp, 200, {}, 'OK');\n            }\n          }\n        } else {\n          // put the promise for the non-transformed response into cache as a placeholder\n          cache.put(url, promise);\n        }\n      }\n\n\n      // if we won't have the response in cache, set the xsrf headers and\n      // send the request to the backend\n      if (isUndefined(cachedResp)) {\n        var xsrfValue = urlIsSameOrigin(config.url)\n            ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]\n            : undefined;\n        if (xsrfValue) {\n          reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;\n        }\n\n        $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,\n            config.withCredentials, config.responseType);\n      }\n\n      return promise;\n\n\n      /**\n       * Callback registered to $httpBackend():\n       *  - caches the response if desired\n       *  - resolves the raw $http promise\n       *  - calls $apply\n       */\n      function done(status, response, headersString, statusText) {\n        if (cache) {\n          if (isSuccess(status)) {\n            cache.put(url, [status, response, parseHeaders(headersString), statusText]);\n          } else {\n            // remove promise from the cache\n            cache.remove(url);\n          }\n        }\n\n        function resolveHttpPromise() {\n          resolvePromise(response, status, headersString, statusText);\n        }\n\n        if (useApplyAsync) {\n          $rootScope.$applyAsync(resolveHttpPromise);\n        } else {\n          resolveHttpPromise();\n          if (!$rootScope.$$phase) $rootScope.$apply();\n        }\n      }\n\n\n      /**\n       * Resolves the raw $http promise.\n       */\n      function resolvePromise(response, status, headers, statusText) {\n        //status: HTTP response status code, 0, -1 (aborted by timeout / promise)\n        status = status >= -1 ? status : 0;\n\n        (isSuccess(status) ? deferred.resolve : deferred.reject)({\n          data: response,\n          status: status,\n          headers: headersGetter(headers),\n          config: config,\n          statusText: statusText\n        });\n      }\n\n      function resolvePromiseWithResult(result) {\n        resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);\n      }\n\n      function removePendingReq() {\n        var idx = $http.pendingRequests.indexOf(config);\n        if (idx !== -1) $http.pendingRequests.splice(idx, 1);\n      }\n    }\n\n\n    function buildUrl(url, serializedParams) {\n      if (serializedParams.length > 0) {\n        url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;\n      }\n      return url;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $xhrFactory\n *\n * @description\n * Factory function used to create XMLHttpRequest objects.\n *\n * Replace or decorate this service to create your own custom XMLHttpRequest objects.\n *\n * ```\n * angular.module('myApp', [])\n * .factory('$xhrFactory', function() {\n *   return function createXhr(method, url) {\n *     return new window.XMLHttpRequest({mozSystem: true});\n *   };\n * });\n * ```\n *\n * @param {string} method HTTP method of the request (GET, POST, PUT, ..)\n * @param {string} url URL of the request.\n */\nfunction $xhrFactoryProvider() {\n  this.$get = function() {\n    return function createXhr() {\n      return new window.XMLHttpRequest();\n    };\n  };\n}\n\n/**\n * @ngdoc service\n * @name $httpBackend\n * @requires $window\n * @requires $document\n * @requires $xhrFactory\n *\n * @description\n * HTTP backend used by the {@link ng.$http service} that delegates to\n * XMLHttpRequest object or JSONP and deals with browser incompatibilities.\n *\n * You should never need to use this service directly, instead use the higher-level abstractions:\n * {@link ng.$http $http} or {@link ngResource.$resource $resource}.\n *\n * During testing this implementation is swapped with {@link ngMock.$httpBackend mock\n * $httpBackend} which can be trained with responses.\n */\nfunction $HttpBackendProvider() {\n  this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {\n    return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);\n  }];\n}\n\nfunction createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {\n  // TODO(vojta): fix the signature\n  return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {\n    $browser.$$incOutstandingRequestCount();\n    url = url || $browser.url();\n\n    if (lowercase(method) == 'jsonp') {\n      var callbackId = '_' + (callbacks.counter++).toString(36);\n      callbacks[callbackId] = function(data) {\n        callbacks[callbackId].data = data;\n        callbacks[callbackId].called = true;\n      };\n\n      var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),\n          callbackId, function(status, text) {\n        completeRequest(callback, status, callbacks[callbackId].data, \"\", text);\n        callbacks[callbackId] = noop;\n      });\n    } else {\n\n      var xhr = createXhr(method, url);\n\n      xhr.open(method, url, true);\n      forEach(headers, function(value, key) {\n        if (isDefined(value)) {\n            xhr.setRequestHeader(key, value);\n        }\n      });\n\n      xhr.onload = function requestLoaded() {\n        var statusText = xhr.statusText || '';\n\n        // responseText is the old-school way of retrieving response (supported by IE9)\n        // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n        var response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n        // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n        var status = xhr.status === 1223 ? 204 : xhr.status;\n\n        // fix status code when it is 0 (0 status is undocumented).\n        // Occurs when accessing file resources or on Android 4.1 stock browser\n        // while retrieving files from application cache.\n        if (status === 0) {\n          status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;\n        }\n\n        completeRequest(callback,\n            status,\n            response,\n            xhr.getAllResponseHeaders(),\n            statusText);\n      };\n\n      var requestError = function() {\n        // The response is always empty\n        // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error\n        completeRequest(callback, -1, null, null, '');\n      };\n\n      xhr.onerror = requestError;\n      xhr.onabort = requestError;\n\n      if (withCredentials) {\n        xhr.withCredentials = true;\n      }\n\n      if (responseType) {\n        try {\n          xhr.responseType = responseType;\n        } catch (e) {\n          // WebKit added support for the json responseType value on 09/03/2013\n          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n          // known to throw when setting the value \"json\" as the response type. Other older\n          // browsers implementing the responseType\n          //\n          // The json response type can be ignored if not supported, because JSON payloads are\n          // parsed on the client-side regardless.\n          if (responseType !== 'json') {\n            throw e;\n          }\n        }\n      }\n\n      xhr.send(isUndefined(post) ? null : post);\n    }\n\n    if (timeout > 0) {\n      var timeoutId = $browserDefer(timeoutRequest, timeout);\n    } else if (isPromiseLike(timeout)) {\n      timeout.then(timeoutRequest);\n    }\n\n\n    function timeoutRequest() {\n      jsonpDone && jsonpDone();\n      xhr && xhr.abort();\n    }\n\n    function completeRequest(callback, status, response, headersString, statusText) {\n      // cancel timeout and subsequent timeout promise resolution\n      if (isDefined(timeoutId)) {\n        $browserDefer.cancel(timeoutId);\n      }\n      jsonpDone = xhr = null;\n\n      callback(status, response, headersString, statusText);\n      $browser.$$completeOutstandingRequest(noop);\n    }\n  };\n\n  function jsonpReq(url, callbackId, done) {\n    // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:\n    // - fetches local scripts via XHR and evals them\n    // - adds and immediately removes script elements from the document\n    var script = rawDocument.createElement('script'), callback = null;\n    script.type = \"text/javascript\";\n    script.src = url;\n    script.async = true;\n\n    callback = function(event) {\n      removeEventListenerFn(script, \"load\", callback);\n      removeEventListenerFn(script, \"error\", callback);\n      rawDocument.body.removeChild(script);\n      script = null;\n      var status = -1;\n      var text = \"unknown\";\n\n      if (event) {\n        if (event.type === \"load\" && !callbacks[callbackId].called) {\n          event = { type: \"error\" };\n        }\n        text = event.type;\n        status = event.type === \"error\" ? 404 : 200;\n      }\n\n      if (done) {\n        done(status, text);\n      }\n    };\n\n    addEventListenerFn(script, \"load\", callback);\n    addEventListenerFn(script, \"error\", callback);\n    rawDocument.body.appendChild(script);\n    return callback;\n  }\n}\n\nvar $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');\n$interpolateMinErr.throwNoconcat = function(text) {\n  throw $interpolateMinErr('noconcat',\n      \"Error while interpolating: {0}\\nStrict Contextual Escaping disallows \" +\n      \"interpolations that concatenate multiple expressions when a trusted value is \" +\n      \"required.  See http://docs.angularjs.org/api/ng.$sce\", text);\n};\n\n$interpolateMinErr.interr = function(text, err) {\n  return $interpolateMinErr('interr', \"Can't interpolate: {0}\\n{1}\", text, err.toString());\n};\n\n/**\n * @ngdoc provider\n * @name $interpolateProvider\n *\n * @description\n *\n * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.\n *\n * <div class=\"alert alert-danger\">\n * This feature is sometimes used to mix different markup languages, e.g. to wrap an Angular\n * template within a Python Jinja template (or any other template language). Mixing templating\n * languages is **very dangerous**. The embedding template language will not safely escape Angular\n * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS)\n * security bugs!\n * </div>\n *\n * @example\n<example name=\"custom-interpolation-markup\" module=\"customInterpolationApp\">\n<file name=\"index.html\">\n<script>\n  var customInterpolationApp = angular.module('customInterpolationApp', []);\n\n  customInterpolationApp.config(function($interpolateProvider) {\n    $interpolateProvider.startSymbol('//');\n    $interpolateProvider.endSymbol('//');\n  });\n\n\n  customInterpolationApp.controller('DemoController', function() {\n      this.label = \"This binding is brought you by // interpolation symbols.\";\n  });\n</script>\n<div ng-controller=\"DemoController as demo\">\n    //demo.label//\n</div>\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  it('should interpolate binding with custom symbols', function() {\n    expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');\n  });\n</file>\n</example>\n */\nfunction $InterpolateProvider() {\n  var startSymbol = '{{';\n  var endSymbol = '}}';\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#startSymbol\n   * @description\n   * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.\n   *\n   * @param {string=} value new value to set the starting symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.startSymbol = function(value) {\n    if (value) {\n      startSymbol = value;\n      return this;\n    } else {\n      return startSymbol;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#endSymbol\n   * @description\n   * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n   *\n   * @param {string=} value new value to set the ending symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.endSymbol = function(value) {\n    if (value) {\n      endSymbol = value;\n      return this;\n    } else {\n      return endSymbol;\n    }\n  };\n\n\n  this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {\n    var startSymbolLength = startSymbol.length,\n        endSymbolLength = endSymbol.length,\n        escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),\n        escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');\n\n    function escape(ch) {\n      return '\\\\\\\\\\\\' + ch;\n    }\n\n    function unescapeText(text) {\n      return text.replace(escapedStartRegexp, startSymbol).\n        replace(escapedEndRegexp, endSymbol);\n    }\n\n    function stringify(value) {\n      if (value == null) { // null || undefined\n        return '';\n      }\n      switch (typeof value) {\n        case 'string':\n          break;\n        case 'number':\n          value = '' + value;\n          break;\n        default:\n          value = toJson(value);\n      }\n\n      return value;\n    }\n\n    //TODO: this is the same as the constantWatchDelegate in parse.js\n    function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {\n      var unwatch;\n      return unwatch = scope.$watch(function constantInterpolateWatch(scope) {\n        unwatch();\n        return constantInterp(scope);\n      }, listener, objectEquality);\n    }\n\n    /**\n     * @ngdoc service\n     * @name $interpolate\n     * @kind function\n     *\n     * @requires $parse\n     * @requires $sce\n     *\n     * @description\n     *\n     * Compiles a string with markup into an interpolation function. This service is used by the\n     * HTML {@link ng.$compile $compile} service for data binding. See\n     * {@link ng.$interpolateProvider $interpolateProvider} for configuring the\n     * interpolation markup.\n     *\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var exp = $interpolate('Hello {{name | uppercase}}!');\n     *   expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');\n     * ```\n     *\n     * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is\n     * `true`, the interpolation function will return `undefined` unless all embedded expressions\n     * evaluate to a value other than `undefined`.\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var context = {greeting: 'Hello', name: undefined };\n     *\n     *   // default \"forgiving\" mode\n     *   var exp = $interpolate('{{greeting}} {{name}}!');\n     *   expect(exp(context)).toEqual('Hello !');\n     *\n     *   // \"allOrNothing\" mode\n     *   exp = $interpolate('{{greeting}} {{name}}!', false, null, true);\n     *   expect(exp(context)).toBeUndefined();\n     *   context.name = 'Angular';\n     *   expect(exp(context)).toEqual('Hello Angular!');\n     * ```\n     *\n     * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.\n     *\n     * ####Escaped Interpolation\n     * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers\n     * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).\n     * It will be rendered as a regular start/end marker, and will not be interpreted as an expression\n     * or binding.\n     *\n     * This enables web-servers to prevent script injection attacks and defacing attacks, to some\n     * degree, while also enabling code examples to work without relying on the\n     * {@link ng.directive:ngNonBindable ngNonBindable} directive.\n     *\n     * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,\n     * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all\n     * interpolation start/end markers with their escaped counterparts.**\n     *\n     * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered\n     * output when the $interpolate service processes the text. So, for HTML elements interpolated\n     * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter\n     * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,\n     * this is typically useful only when user-data is used in rendering a template from the server, or\n     * when otherwise untrusted data is used by a directive.\n     *\n     * <example>\n     *  <file name=\"index.html\">\n     *    <div ng-init=\"username='A user'\">\n     *      <p ng-init=\"apptitle='Escaping demo'\">{{apptitle}}: \\{\\{ username = \"defaced value\"; \\}\\}\n     *        </p>\n     *      <p><strong>{{username}}</strong> attempts to inject code which will deface the\n     *        application, but fails to accomplish their task, because the server has correctly\n     *        escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)\n     *        characters.</p>\n     *      <p>Instead, the result of the attempted script injection is visible, and can be removed\n     *        from the database by an administrator.</p>\n     *    </div>\n     *  </file>\n     * </example>\n     *\n     * @param {string} text The text with markup to interpolate.\n     * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have\n     *    embedded expression in order to return an interpolation function. Strings with no\n     *    embedded expression will return null for the interpolation function.\n     * @param {string=} trustedContext when provided, the returned function passes the interpolated\n     *    result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,\n     *    trustedContext)} before returning it.  Refer to the {@link ng.$sce $sce} service that\n     *    provides Strict Contextual Escaping for details.\n     * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined\n     *    unless all embedded expressions evaluate to a value other than `undefined`.\n     * @returns {function(context)} an interpolation function which is used to compute the\n     *    interpolated string. The function has these parameters:\n     *\n     * - `context`: evaluation context for all expressions embedded in the interpolated text\n     */\n    function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {\n      // Provide a quick exit and simplified result function for text with no interpolation\n      if (!text.length || text.indexOf(startSymbol) === -1) {\n        var constantInterp;\n        if (!mustHaveExpression) {\n          var unescapedText = unescapeText(text);\n          constantInterp = valueFn(unescapedText);\n          constantInterp.exp = text;\n          constantInterp.expressions = [];\n          constantInterp.$$watchDelegate = constantWatchDelegate;\n        }\n        return constantInterp;\n      }\n\n      allOrNothing = !!allOrNothing;\n      var startIndex,\n          endIndex,\n          index = 0,\n          expressions = [],\n          parseFns = [],\n          textLength = text.length,\n          exp,\n          concat = [],\n          expressionPositions = [];\n\n      while (index < textLength) {\n        if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&\n             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {\n          if (index !== startIndex) {\n            concat.push(unescapeText(text.substring(index, startIndex)));\n          }\n          exp = text.substring(startIndex + startSymbolLength, endIndex);\n          expressions.push(exp);\n          parseFns.push($parse(exp, parseStringifyInterceptor));\n          index = endIndex + endSymbolLength;\n          expressionPositions.push(concat.length);\n          concat.push('');\n        } else {\n          // we did not find an interpolation, so we have to add the remainder to the separators array\n          if (index !== textLength) {\n            concat.push(unescapeText(text.substring(index)));\n          }\n          break;\n        }\n      }\n\n      // Concatenating expressions makes it hard to reason about whether some combination of\n      // concatenated values are unsafe to use and could easily lead to XSS.  By requiring that a\n      // single expression be used for iframe[src], object[src], etc., we ensure that the value\n      // that's used is assigned or constructed by some JS code somewhere that is more testable or\n      // make it obvious that you bound the value to some user controlled value.  This helps reduce\n      // the load when auditing for XSS issues.\n      if (trustedContext && concat.length > 1) {\n          $interpolateMinErr.throwNoconcat(text);\n      }\n\n      if (!mustHaveExpression || expressions.length) {\n        var compute = function(values) {\n          for (var i = 0, ii = expressions.length; i < ii; i++) {\n            if (allOrNothing && isUndefined(values[i])) return;\n            concat[expressionPositions[i]] = values[i];\n          }\n          return concat.join('');\n        };\n\n        var getValue = function(value) {\n          return trustedContext ?\n            $sce.getTrusted(trustedContext, value) :\n            $sce.valueOf(value);\n        };\n\n        return extend(function interpolationFn(context) {\n            var i = 0;\n            var ii = expressions.length;\n            var values = new Array(ii);\n\n            try {\n              for (; i < ii; i++) {\n                values[i] = parseFns[i](context);\n              }\n\n              return compute(values);\n            } catch (err) {\n              $exceptionHandler($interpolateMinErr.interr(text, err));\n            }\n\n          }, {\n          // all of these properties are undocumented for now\n          exp: text, //just for compatibility with regular watchers created via $watch\n          expressions: expressions,\n          $$watchDelegate: function(scope, listener) {\n            var lastValue;\n            return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {\n              var currValue = compute(values);\n              if (isFunction(listener)) {\n                listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);\n              }\n              lastValue = currValue;\n            });\n          }\n        });\n      }\n\n      function parseStringifyInterceptor(value) {\n        try {\n          value = getValue(value);\n          return allOrNothing && !isDefined(value) ? value : stringify(value);\n        } catch (err) {\n          $exceptionHandler($interpolateMinErr.interr(text, err));\n        }\n      }\n    }\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#startSymbol\n     * @description\n     * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.\n     *\n     * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} start symbol.\n     */\n    $interpolate.startSymbol = function() {\n      return startSymbol;\n    };\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#endSymbol\n     * @description\n     * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n     *\n     * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} end symbol.\n     */\n    $interpolate.endSymbol = function() {\n      return endSymbol;\n    };\n\n    return $interpolate;\n  }];\n}\n\nfunction $IntervalProvider() {\n  this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',\n       function($rootScope,   $window,   $q,   $$q,   $browser) {\n    var intervals = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $interval\n      *\n      * @description\n      * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`\n      * milliseconds.\n      *\n      * The return value of registering an interval function is a promise. This promise will be\n      * notified upon each tick of the interval, and will be resolved after `count` iterations, or\n      * run indefinitely if `count` is not defined. The value of the notification will be the\n      * number of iterations that have run.\n      * To cancel an interval, call `$interval.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to\n      * move forward by `millis` milliseconds and trigger any functions scheduled to run in that\n      * time.\n      *\n      * <div class=\"alert alert-warning\">\n      * **Note**: Intervals created by this service must be explicitly destroyed when you are finished\n      * with them.  In particular they are not automatically destroyed when a controller's scope or a\n      * directive's element are destroyed.\n      * You should take this into consideration and make sure to always cancel the interval at the\n      * appropriate moment.  See the example below for more details on how and when to do this.\n      * </div>\n      *\n      * @param {function()} fn A function that should be called repeatedly.\n      * @param {number} delay Number of milliseconds between each function call.\n      * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat\n      *   indefinitely.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @param {...*=} Pass additional parameters to the executed function.\n      * @returns {promise} A promise which will be notified on each iteration.\n      *\n      * @example\n      * <example module=\"intervalExample\">\n      * <file name=\"index.html\">\n      *   <script>\n      *     angular.module('intervalExample', [])\n      *       .controller('ExampleController', ['$scope', '$interval',\n      *         function($scope, $interval) {\n      *           $scope.format = 'M/d/yy h:mm:ss a';\n      *           $scope.blood_1 = 100;\n      *           $scope.blood_2 = 120;\n      *\n      *           var stop;\n      *           $scope.fight = function() {\n      *             // Don't start a new fight if we are already fighting\n      *             if ( angular.isDefined(stop) ) return;\n      *\n      *             stop = $interval(function() {\n      *               if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {\n      *                 $scope.blood_1 = $scope.blood_1 - 3;\n      *                 $scope.blood_2 = $scope.blood_2 - 4;\n      *               } else {\n      *                 $scope.stopFight();\n      *               }\n      *             }, 100);\n      *           };\n      *\n      *           $scope.stopFight = function() {\n      *             if (angular.isDefined(stop)) {\n      *               $interval.cancel(stop);\n      *               stop = undefined;\n      *             }\n      *           };\n      *\n      *           $scope.resetFight = function() {\n      *             $scope.blood_1 = 100;\n      *             $scope.blood_2 = 120;\n      *           };\n      *\n      *           $scope.$on('$destroy', function() {\n      *             // Make sure that the interval is destroyed too\n      *             $scope.stopFight();\n      *           });\n      *         }])\n      *       // Register the 'myCurrentTime' directive factory method.\n      *       // We inject $interval and dateFilter service since the factory method is DI.\n      *       .directive('myCurrentTime', ['$interval', 'dateFilter',\n      *         function($interval, dateFilter) {\n      *           // return the directive link function. (compile function not needed)\n      *           return function(scope, element, attrs) {\n      *             var format,  // date format\n      *                 stopTime; // so that we can cancel the time updates\n      *\n      *             // used to update the UI\n      *             function updateTime() {\n      *               element.text(dateFilter(new Date(), format));\n      *             }\n      *\n      *             // watch the expression, and update the UI on change.\n      *             scope.$watch(attrs.myCurrentTime, function(value) {\n      *               format = value;\n      *               updateTime();\n      *             });\n      *\n      *             stopTime = $interval(updateTime, 1000);\n      *\n      *             // listen on DOM destroy (removal) event, and cancel the next UI update\n      *             // to prevent updating time after the DOM element was removed.\n      *             element.on('$destroy', function() {\n      *               $interval.cancel(stopTime);\n      *             });\n      *           }\n      *         }]);\n      *   </script>\n      *\n      *   <div>\n      *     <div ng-controller=\"ExampleController\">\n      *       <label>Date format: <input ng-model=\"format\"></label> <hr/>\n      *       Current time is: <span my-current-time=\"format\"></span>\n      *       <hr/>\n      *       Blood 1 : <font color='red'>{{blood_1}}</font>\n      *       Blood 2 : <font color='red'>{{blood_2}}</font>\n      *       <button type=\"button\" data-ng-click=\"fight()\">Fight</button>\n      *       <button type=\"button\" data-ng-click=\"stopFight()\">StopFight</button>\n      *       <button type=\"button\" data-ng-click=\"resetFight()\">resetFight</button>\n      *     </div>\n      *   </div>\n      *\n      * </file>\n      * </example>\n      */\n    function interval(fn, delay, count, invokeApply) {\n      var hasParams = arguments.length > 4,\n          args = hasParams ? sliceArgs(arguments, 4) : [],\n          setInterval = $window.setInterval,\n          clearInterval = $window.clearInterval,\n          iteration = 0,\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          deferred = (skipApply ? $$q : $q).defer(),\n          promise = deferred.promise;\n\n      count = isDefined(count) ? count : 0;\n\n      promise.$$intervalId = setInterval(function tick() {\n        if (skipApply) {\n          $browser.defer(callback);\n        } else {\n          $rootScope.$evalAsync(callback);\n        }\n        deferred.notify(iteration++);\n\n        if (count > 0 && iteration >= count) {\n          deferred.resolve(iteration);\n          clearInterval(promise.$$intervalId);\n          delete intervals[promise.$$intervalId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n\n      }, delay);\n\n      intervals[promise.$$intervalId] = deferred;\n\n      return promise;\n\n      function callback() {\n        if (!hasParams) {\n          fn(iteration);\n        } else {\n          fn.apply(null, args);\n        }\n      }\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $interval#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`.\n      *\n      * @param {Promise=} promise returned by the `$interval` function.\n      * @returns {boolean} Returns `true` if the task was successfully canceled.\n      */\n    interval.cancel = function(promise) {\n      if (promise && promise.$$intervalId in intervals) {\n        intervals[promise.$$intervalId].reject('canceled');\n        $window.clearInterval(promise.$$intervalId);\n        delete intervals[promise.$$intervalId];\n        return true;\n      }\n      return false;\n    };\n\n    return interval;\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $locale\n *\n * @description\n * $locale service provides localization rules for various Angular components. As of right now the\n * only public api is:\n *\n * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)\n */\n\nvar PATH_MATCH = /^([^\\?#]*)(\\?([^#]*))?(#(.*))?$/,\n    DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};\nvar $locationMinErr = minErr('$location');\n\n\n/**\n * Encode path using encodeUriSegment, ignoring forward slashes\n *\n * @param {string} path Path to encode\n * @returns {string}\n */\nfunction encodePath(path) {\n  var segments = path.split('/'),\n      i = segments.length;\n\n  while (i--) {\n    segments[i] = encodeUriSegment(segments[i]);\n  }\n\n  return segments.join('/');\n}\n\nfunction parseAbsoluteUrl(absoluteUrl, locationObj) {\n  var parsedUrl = urlResolve(absoluteUrl);\n\n  locationObj.$$protocol = parsedUrl.protocol;\n  locationObj.$$host = parsedUrl.hostname;\n  locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;\n}\n\n\nfunction parseAppUrl(relativeUrl, locationObj) {\n  var prefixed = (relativeUrl.charAt(0) !== '/');\n  if (prefixed) {\n    relativeUrl = '/' + relativeUrl;\n  }\n  var match = urlResolve(relativeUrl);\n  locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?\n      match.pathname.substring(1) : match.pathname);\n  locationObj.$$search = parseKeyValue(match.search);\n  locationObj.$$hash = decodeURIComponent(match.hash);\n\n  // make sure path starts with '/';\n  if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {\n    locationObj.$$path = '/' + locationObj.$$path;\n  }\n}\n\n\n/**\n *\n * @param {string} begin\n * @param {string} whole\n * @returns {string} returns text from whole after begin or undefined if it does not begin with\n *                   expected string.\n */\nfunction beginsWith(begin, whole) {\n  if (whole.indexOf(begin) === 0) {\n    return whole.substr(begin.length);\n  }\n}\n\n\nfunction stripHash(url) {\n  var index = url.indexOf('#');\n  return index == -1 ? url : url.substr(0, index);\n}\n\nfunction trimEmptyHash(url) {\n  return url.replace(/(#.+)|#$/, '$1');\n}\n\n\nfunction stripFile(url) {\n  return url.substr(0, stripHash(url).lastIndexOf('/') + 1);\n}\n\n/* return the server only (scheme://host:port) */\nfunction serverBase(url) {\n  return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));\n}\n\n\n/**\n * LocationHtml5Url represents an url\n * This object is exposed as $location service when HTML5 mode is enabled and supported\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} basePrefix url path prefix\n */\nfunction LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {\n  this.$$html5 = true;\n  basePrefix = basePrefix || '';\n  parseAbsoluteUrl(appBase, this);\n\n\n  /**\n   * Parse given html5 (regular) url string into properties\n   * @param {string} url HTML5 url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var pathUrl = beginsWith(appBaseNoFile, url);\n    if (!isString(pathUrl)) {\n      throw $locationMinErr('ipthprfx', 'Invalid url \"{0}\", missing path prefix \"{1}\".', url,\n          appBaseNoFile);\n    }\n\n    parseAppUrl(pathUrl, this);\n\n    if (!this.$$path) {\n      this.$$path = '/';\n    }\n\n    this.$$compose();\n  };\n\n  /**\n   * Compose url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'\n  };\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (relHref && relHref[0] === '#') {\n      // special case for links to hash fragments:\n      // keep the old url and only replace the hash fragment\n      this.hash(relHref.slice(1));\n      return true;\n    }\n    var appUrl, prevAppUrl;\n    var rewrittenUrl;\n\n    if (isDefined(appUrl = beginsWith(appBase, url))) {\n      prevAppUrl = appUrl;\n      if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {\n        rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);\n      } else {\n        rewrittenUrl = appBase + prevAppUrl;\n      }\n    } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {\n      rewrittenUrl = appBaseNoFile + appUrl;\n    } else if (appBaseNoFile == url + '/') {\n      rewrittenUrl = appBaseNoFile;\n    }\n    if (rewrittenUrl) {\n      this.$$parse(rewrittenUrl);\n    }\n    return !!rewrittenUrl;\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when developer doesn't opt into html5 mode.\n * It also serves as the base class for html5 mode fallback on legacy browsers.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {\n\n  parseAbsoluteUrl(appBase, this);\n\n\n  /**\n   * Parse given hashbang url into properties\n   * @param {string} url Hashbang url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);\n    var withoutHashUrl;\n\n    if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {\n\n      // The rest of the url starts with a hash so we have\n      // got either a hashbang path or a plain hash fragment\n      withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);\n      if (isUndefined(withoutHashUrl)) {\n        // There was no hashbang prefix so we just have a hash fragment\n        withoutHashUrl = withoutBaseUrl;\n      }\n\n    } else {\n      // There was no hashbang path nor hash fragment:\n      // If we are in HTML5 mode we use what is left as the path;\n      // Otherwise we ignore what is left\n      if (this.$$html5) {\n        withoutHashUrl = withoutBaseUrl;\n      } else {\n        withoutHashUrl = '';\n        if (isUndefined(withoutBaseUrl)) {\n          appBase = url;\n          this.replace();\n        }\n      }\n    }\n\n    parseAppUrl(withoutHashUrl, this);\n\n    this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);\n\n    this.$$compose();\n\n    /*\n     * In Windows, on an anchor node on documents loaded from\n     * the filesystem, the browser will return a pathname\n     * prefixed with the drive name ('/C:/path') when a\n     * pathname without a drive is set:\n     *  * a.setAttribute('href', '/foo')\n     *   * a.pathname === '/C:/foo' //true\n     *\n     * Inside of Angular, we're always using pathnames that\n     * do not include drive names for routing.\n     */\n    function removeWindowsDriveName(path, url, base) {\n      /*\n      Matches paths for file protocol on windows,\n      such as /C:/foo/bar, and captures only /foo/bar.\n      */\n      var windowsFilePathExp = /^\\/[A-Z]:(\\/.*)/;\n\n      var firstPathSegmentMatch;\n\n      //Get the relative path from the input URL.\n      if (url.indexOf(base) === 0) {\n        url = url.replace(base, '');\n      }\n\n      // The input URL intentionally contains a first path segment that ends with a colon.\n      if (windowsFilePathExp.exec(url)) {\n        return path;\n      }\n\n      firstPathSegmentMatch = windowsFilePathExp.exec(path);\n      return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;\n    }\n  };\n\n  /**\n   * Compose hashbang url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');\n  };\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (stripHash(appBase) == stripHash(url)) {\n      this.$$parse(url);\n      return true;\n    }\n    return false;\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when html5 history api is enabled but the browser\n * does not support it.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {\n  this.$$html5 = true;\n  LocationHashbangUrl.apply(this, arguments);\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (relHref && relHref[0] === '#') {\n      // special case for links to hash fragments:\n      // keep the old url and only replace the hash fragment\n      this.hash(relHref.slice(1));\n      return true;\n    }\n\n    var rewrittenUrl;\n    var appUrl;\n\n    if (appBase == stripHash(url)) {\n      rewrittenUrl = url;\n    } else if ((appUrl = beginsWith(appBaseNoFile, url))) {\n      rewrittenUrl = appBase + hashPrefix + appUrl;\n    } else if (appBaseNoFile === url + '/') {\n      rewrittenUrl = appBaseNoFile;\n    }\n    if (rewrittenUrl) {\n      this.$$parse(rewrittenUrl);\n    }\n    return !!rewrittenUrl;\n  };\n\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'\n    this.$$absUrl = appBase + hashPrefix + this.$$url;\n  };\n\n}\n\n\nvar locationPrototype = {\n\n  /**\n   * Are we in html5 mode?\n   * @private\n   */\n  $$html5: false,\n\n  /**\n   * Has any change been replacing?\n   * @private\n   */\n  $$replace: false,\n\n  /**\n   * @ngdoc method\n   * @name $location#absUrl\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return full url representation with all segments encoded according to rules specified in\n   * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var absUrl = $location.absUrl();\n   * // => \"http://example.com/#/some/path?foo=bar&baz=xoxo\"\n   * ```\n   *\n   * @return {string} full url\n   */\n  absUrl: locationGetter('$$absUrl'),\n\n  /**\n   * @ngdoc method\n   * @name $location#url\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return url (e.g. `/path?a=b#hash`) when called without any parameter.\n   *\n   * Change path, search and hash, when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var url = $location.url();\n   * // => \"/some/path?foo=bar&baz=xoxo\"\n   * ```\n   *\n   * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)\n   * @return {string} url\n   */\n  url: function(url) {\n    if (isUndefined(url)) {\n      return this.$$url;\n    }\n\n    var match = PATH_MATCH.exec(url);\n    if (match[1] || url === '') this.path(decodeURIComponent(match[1]));\n    if (match[2] || match[1] || url === '') this.search(match[3] || '');\n    this.hash(match[5] || '');\n\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#protocol\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return protocol of current url.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var protocol = $location.protocol();\n   * // => \"http\"\n   * ```\n   *\n   * @return {string} protocol of current url\n   */\n  protocol: locationGetter('$$protocol'),\n\n  /**\n   * @ngdoc method\n   * @name $location#host\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return host of current url.\n   *\n   * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var host = $location.host();\n   * // => \"example.com\"\n   *\n   * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo\n   * host = $location.host();\n   * // => \"example.com\"\n   * host = location.host;\n   * // => \"example.com:8080\"\n   * ```\n   *\n   * @return {string} host of current url.\n   */\n  host: locationGetter('$$host'),\n\n  /**\n   * @ngdoc method\n   * @name $location#port\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return port of current url.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var port = $location.port();\n   * // => 80\n   * ```\n   *\n   * @return {Number} port\n   */\n  port: locationGetter('$$port'),\n\n  /**\n   * @ngdoc method\n   * @name $location#path\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return path of current url when called without any parameter.\n   *\n   * Change path when called with parameter and return `$location`.\n   *\n   * Note: Path should always begin with forward slash (/), this method will add the forward slash\n   * if it is missing.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var path = $location.path();\n   * // => \"/some/path\"\n   * ```\n   *\n   * @param {(string|number)=} path New path\n   * @return {string} path\n   */\n  path: locationGetterSetter('$$path', function(path) {\n    path = path !== null ? path.toString() : '';\n    return path.charAt(0) == '/' ? path : '/' + path;\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#search\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return search part (as object) of current url when called without any parameter.\n   *\n   * Change search part when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var searchObject = $location.search();\n   * // => {foo: 'bar', baz: 'xoxo'}\n   *\n   * // set foo to 'yipee'\n   * $location.search('foo', 'yipee');\n   * // $location.search() => {foo: 'yipee', baz: 'xoxo'}\n   * ```\n   *\n   * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or\n   * hash object.\n   *\n   * When called with a single argument the method acts as a setter, setting the `search` component\n   * of `$location` to the specified value.\n   *\n   * If the argument is a hash object containing an array of values, these values will be encoded\n   * as duplicate search parameters in the url.\n   *\n   * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`\n   * will override only a single search property.\n   *\n   * If `paramValue` is an array, it will override the property of the `search` component of\n   * `$location` specified via the first argument.\n   *\n   * If `paramValue` is `null`, the property specified via the first argument will be deleted.\n   *\n   * If `paramValue` is `true`, the property specified via the first argument will be added with no\n   * value nor trailing equal sign.\n   *\n   * @return {Object} If called with no arguments returns the parsed `search` object. If called with\n   * one or more arguments returns `$location` object itself.\n   */\n  search: function(search, paramValue) {\n    switch (arguments.length) {\n      case 0:\n        return this.$$search;\n      case 1:\n        if (isString(search) || isNumber(search)) {\n          search = search.toString();\n          this.$$search = parseKeyValue(search);\n        } else if (isObject(search)) {\n          search = copy(search, {});\n          // remove object undefined or null properties\n          forEach(search, function(value, key) {\n            if (value == null) delete search[key];\n          });\n\n          this.$$search = search;\n        } else {\n          throw $locationMinErr('isrcharg',\n              'The first argument of the `$location#search()` call must be a string or an object.');\n        }\n        break;\n      default:\n        if (isUndefined(paramValue) || paramValue === null) {\n          delete this.$$search[search];\n        } else {\n          this.$$search[search] = paramValue;\n        }\n    }\n\n    this.$$compose();\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#hash\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Returns the hash fragment when called without any parameters.\n   *\n   * Changes the hash fragment when called with a parameter and returns `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue\n   * var hash = $location.hash();\n   * // => \"hashValue\"\n   * ```\n   *\n   * @param {(string|number)=} hash New hash fragment\n   * @return {string} hash\n   */\n  hash: locationGetterSetter('$$hash', function(hash) {\n    return hash !== null ? hash.toString() : '';\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#replace\n   *\n   * @description\n   * If called, all changes to $location during the current `$digest` will replace the current history\n   * record, instead of adding a new one.\n   */\n  replace: function() {\n    this.$$replace = true;\n    return this;\n  }\n};\n\nforEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {\n  Location.prototype = Object.create(locationPrototype);\n\n  /**\n   * @ngdoc method\n   * @name $location#state\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return the history state object when called without any parameter.\n   *\n   * Change the history state object when called with one parameter and return `$location`.\n   * The state object is later passed to `pushState` or `replaceState`.\n   *\n   * NOTE: This method is supported only in HTML5 mode and only in browsers supporting\n   * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support\n   * older browsers (like IE9 or Android < 4.0), don't use this method.\n   *\n   * @param {object=} state State object for pushState or replaceState\n   * @return {object} state\n   */\n  Location.prototype.state = function(state) {\n    if (!arguments.length) {\n      return this.$$state;\n    }\n\n    if (Location !== LocationHtml5Url || !this.$$html5) {\n      throw $locationMinErr('nostate', 'History API state support is available only ' +\n        'in HTML5 mode and only in browsers supporting HTML5 History API');\n    }\n    // The user might modify `stateObject` after invoking `$location.state(stateObject)`\n    // but we're changing the $$state reference to $browser.state() during the $digest\n    // so the modification window is narrow.\n    this.$$state = isUndefined(state) ? null : state;\n\n    return this;\n  };\n});\n\n\nfunction locationGetter(property) {\n  return function() {\n    return this[property];\n  };\n}\n\n\nfunction locationGetterSetter(property, preprocess) {\n  return function(value) {\n    if (isUndefined(value)) {\n      return this[property];\n    }\n\n    this[property] = preprocess(value);\n    this.$$compose();\n\n    return this;\n  };\n}\n\n\n/**\n * @ngdoc service\n * @name $location\n *\n * @requires $rootElement\n *\n * @description\n * The $location service parses the URL in the browser address bar (based on the\n * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL\n * available to your application. Changes to the URL in the address bar are reflected into\n * $location service and changes to $location are reflected into the browser address bar.\n *\n * **The $location service:**\n *\n * - Exposes the current URL in the browser address bar, so you can\n *   - Watch and observe the URL.\n *   - Change the URL.\n * - Synchronizes the URL with the browser when the user\n *   - Changes the address bar.\n *   - Clicks the back or forward button (or clicks a History link).\n *   - Clicks on a link.\n * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).\n *\n * For more information see {@link guide/$location Developer Guide: Using $location}\n */\n\n/**\n * @ngdoc provider\n * @name $locationProvider\n * @description\n * Use the `$locationProvider` to configure how the application deep linking paths are stored.\n */\nfunction $LocationProvider() {\n  var hashPrefix = '',\n      html5Mode = {\n        enabled: false,\n        requireBase: true,\n        rewriteLinks: true\n      };\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#hashPrefix\n   * @description\n   * @param {string=} prefix Prefix for hash part (containing path and search)\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.hashPrefix = function(prefix) {\n    if (isDefined(prefix)) {\n      hashPrefix = prefix;\n      return this;\n    } else {\n      return hashPrefix;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#html5Mode\n   * @description\n   * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.\n   *   If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported\n   *   properties:\n   *   - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to\n   *     change urls where supported. Will fall back to hash-prefixed paths in browsers that do not\n   *     support `pushState`.\n   *   - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies\n   *     whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are\n   *     true, and a base tag is not present, an error will be thrown when `$location` is injected.\n   *     See the {@link guide/$location $location guide for more information}\n   *   - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,\n   *     enables/disables url rewriting for relative links.\n   *\n   * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter\n   */\n  this.html5Mode = function(mode) {\n    if (isBoolean(mode)) {\n      html5Mode.enabled = mode;\n      return this;\n    } else if (isObject(mode)) {\n\n      if (isBoolean(mode.enabled)) {\n        html5Mode.enabled = mode.enabled;\n      }\n\n      if (isBoolean(mode.requireBase)) {\n        html5Mode.requireBase = mode.requireBase;\n      }\n\n      if (isBoolean(mode.rewriteLinks)) {\n        html5Mode.rewriteLinks = mode.rewriteLinks;\n      }\n\n      return this;\n    } else {\n      return html5Mode;\n    }\n  };\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeStart\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted before a URL will change.\n   *\n   * This change can be prevented by calling\n   * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more\n   * details about event object. Upon successful change\n   * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.\n   *\n   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n   * the browser supports the HTML5 History API.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   * @param {string=} newState New history state object\n   * @param {string=} oldState History state object that was before it was changed.\n   */\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeSuccess\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted after a URL was changed.\n   *\n   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n   * the browser supports the HTML5 History API.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   * @param {string=} newState New history state object\n   * @param {string=} oldState History state object that was before it was changed.\n   */\n\n  this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',\n      function($rootScope, $browser, $sniffer, $rootElement, $window) {\n    var $location,\n        LocationMode,\n        baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''\n        initialUrl = $browser.url(),\n        appBase;\n\n    if (html5Mode.enabled) {\n      if (!baseHref && html5Mode.requireBase) {\n        throw $locationMinErr('nobase',\n          \"$location in HTML5 mode requires a <base> tag to be present!\");\n      }\n      appBase = serverBase(initialUrl) + (baseHref || '/');\n      LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;\n    } else {\n      appBase = stripHash(initialUrl);\n      LocationMode = LocationHashbangUrl;\n    }\n    var appBaseNoFile = stripFile(appBase);\n\n    $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);\n    $location.$$parseLinkUrl(initialUrl, initialUrl);\n\n    $location.$$state = $browser.state();\n\n    var IGNORE_URI_REGEXP = /^\\s*(javascript|mailto):/i;\n\n    function setBrowserUrlWithFallback(url, replace, state) {\n      var oldUrl = $location.url();\n      var oldState = $location.$$state;\n      try {\n        $browser.url(url, replace, state);\n\n        // Make sure $location.state() returns referentially identical (not just deeply equal)\n        // state object; this makes possible quick checking if the state changed in the digest\n        // loop. Checking deep equality would be too expensive.\n        $location.$$state = $browser.state();\n      } catch (e) {\n        // Restore old values if pushState fails\n        $location.url(oldUrl);\n        $location.$$state = oldState;\n\n        throw e;\n      }\n    }\n\n    $rootElement.on('click', function(event) {\n      // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)\n      // currently we open nice url link and redirect then\n\n      if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;\n\n      var elm = jqLite(event.target);\n\n      // traverse the DOM up to find first A tag\n      while (nodeName_(elm[0]) !== 'a') {\n        // ignore rewriting if no A tag (reached root element, or no parent - removed from document)\n        if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;\n      }\n\n      var absHref = elm.prop('href');\n      // get the actual href attribute - see\n      // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx\n      var relHref = elm.attr('href') || elm.attr('xlink:href');\n\n      if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {\n        // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during\n        // an animation.\n        absHref = urlResolve(absHref.animVal).href;\n      }\n\n      // Ignore when url is started with javascript: or mailto:\n      if (IGNORE_URI_REGEXP.test(absHref)) return;\n\n      if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {\n        if ($location.$$parseLinkUrl(absHref, relHref)) {\n          // We do a preventDefault for all urls that are part of the angular application,\n          // in html5mode and also without, so that we are able to abort navigation without\n          // getting double entries in the location history.\n          event.preventDefault();\n          // update location manually\n          if ($location.absUrl() != $browser.url()) {\n            $rootScope.$apply();\n            // hack to work around FF6 bug 684208 when scenario runner clicks on links\n            $window.angular['ff-684208-preventDefault'] = true;\n          }\n        }\n      }\n    });\n\n\n    // rewrite hashbang url <> html5 url\n    if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {\n      $browser.url($location.absUrl(), true);\n    }\n\n    var initializing = true;\n\n    // update $location when $browser url changes\n    $browser.onUrlChange(function(newUrl, newState) {\n\n      if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {\n        // If we are navigating outside of the app then force a reload\n        $window.location.href = newUrl;\n        return;\n      }\n\n      $rootScope.$evalAsync(function() {\n        var oldUrl = $location.absUrl();\n        var oldState = $location.$$state;\n        var defaultPrevented;\n        newUrl = trimEmptyHash(newUrl);\n        $location.$$parse(newUrl);\n        $location.$$state = newState;\n\n        defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n            newState, oldState).defaultPrevented;\n\n        // if the location was changed by a `$locationChangeStart` handler then stop\n        // processing this location change\n        if ($location.absUrl() !== newUrl) return;\n\n        if (defaultPrevented) {\n          $location.$$parse(oldUrl);\n          $location.$$state = oldState;\n          setBrowserUrlWithFallback(oldUrl, false, oldState);\n        } else {\n          initializing = false;\n          afterLocationChange(oldUrl, oldState);\n        }\n      });\n      if (!$rootScope.$$phase) $rootScope.$digest();\n    });\n\n    // update browser\n    $rootScope.$watch(function $locationWatch() {\n      var oldUrl = trimEmptyHash($browser.url());\n      var newUrl = trimEmptyHash($location.absUrl());\n      var oldState = $browser.state();\n      var currentReplace = $location.$$replace;\n      var urlOrStateChanged = oldUrl !== newUrl ||\n        ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);\n\n      if (initializing || urlOrStateChanged) {\n        initializing = false;\n\n        $rootScope.$evalAsync(function() {\n          var newUrl = $location.absUrl();\n          var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n              $location.$$state, oldState).defaultPrevented;\n\n          // if the location was changed by a `$locationChangeStart` handler then stop\n          // processing this location change\n          if ($location.absUrl() !== newUrl) return;\n\n          if (defaultPrevented) {\n            $location.$$parse(oldUrl);\n            $location.$$state = oldState;\n          } else {\n            if (urlOrStateChanged) {\n              setBrowserUrlWithFallback(newUrl, currentReplace,\n                                        oldState === $location.$$state ? null : $location.$$state);\n            }\n            afterLocationChange(oldUrl, oldState);\n          }\n        });\n      }\n\n      $location.$$replace = false;\n\n      // we don't need to return anything because $evalAsync will make the digest loop dirty when\n      // there is a change\n    });\n\n    return $location;\n\n    function afterLocationChange(oldUrl, oldState) {\n      $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,\n        $location.$$state, oldState);\n    }\n}];\n}\n\n/**\n * @ngdoc service\n * @name $log\n * @requires $window\n *\n * @description\n * Simple service for logging. Default implementation safely writes the message\n * into the browser's console (if present).\n *\n * The main purpose of this service is to simplify debugging and troubleshooting.\n *\n * The default is to log `debug` messages. You can use\n * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.\n *\n * @example\n   <example module=\"logExample\">\n     <file name=\"script.js\">\n       angular.module('logExample', [])\n         .controller('LogController', ['$scope', '$log', function($scope, $log) {\n           $scope.$log = $log;\n           $scope.message = 'Hello World!';\n         }]);\n     </file>\n     <file name=\"index.html\">\n       <div ng-controller=\"LogController\">\n         <p>Reload this page with open console, enter text and hit the log button...</p>\n         <label>Message:\n         <input type=\"text\" ng-model=\"message\" /></label>\n         <button ng-click=\"$log.log(message)\">log</button>\n         <button ng-click=\"$log.warn(message)\">warn</button>\n         <button ng-click=\"$log.info(message)\">info</button>\n         <button ng-click=\"$log.error(message)\">error</button>\n         <button ng-click=\"$log.debug(message)\">debug</button>\n       </div>\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc provider\n * @name $logProvider\n * @description\n * Use the `$logProvider` to configure how the application logs messages\n */\nfunction $LogProvider() {\n  var debug = true,\n      self = this;\n\n  /**\n   * @ngdoc method\n   * @name $logProvider#debugEnabled\n   * @description\n   * @param {boolean=} flag enable or disable debug level messages\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.debugEnabled = function(flag) {\n    if (isDefined(flag)) {\n      debug = flag;\n    return this;\n    } else {\n      return debug;\n    }\n  };\n\n  this.$get = ['$window', function($window) {\n    return {\n      /**\n       * @ngdoc method\n       * @name $log#log\n       *\n       * @description\n       * Write a log message\n       */\n      log: consoleLog('log'),\n\n      /**\n       * @ngdoc method\n       * @name $log#info\n       *\n       * @description\n       * Write an information message\n       */\n      info: consoleLog('info'),\n\n      /**\n       * @ngdoc method\n       * @name $log#warn\n       *\n       * @description\n       * Write a warning message\n       */\n      warn: consoleLog('warn'),\n\n      /**\n       * @ngdoc method\n       * @name $log#error\n       *\n       * @description\n       * Write an error message\n       */\n      error: consoleLog('error'),\n\n      /**\n       * @ngdoc method\n       * @name $log#debug\n       *\n       * @description\n       * Write a debug message\n       */\n      debug: (function() {\n        var fn = consoleLog('debug');\n\n        return function() {\n          if (debug) {\n            fn.apply(self, arguments);\n          }\n        };\n      }())\n    };\n\n    function formatError(arg) {\n      if (arg instanceof Error) {\n        if (arg.stack) {\n          arg = (arg.message && arg.stack.indexOf(arg.message) === -1)\n              ? 'Error: ' + arg.message + '\\n' + arg.stack\n              : arg.stack;\n        } else if (arg.sourceURL) {\n          arg = arg.message + '\\n' + arg.sourceURL + ':' + arg.line;\n        }\n      }\n      return arg;\n    }\n\n    function consoleLog(type) {\n      var console = $window.console || {},\n          logFn = console[type] || console.log || noop,\n          hasApply = false;\n\n      // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.\n      // The reason behind this is that console.log has type \"object\" in IE8...\n      try {\n        hasApply = !!logFn.apply;\n      } catch (e) {}\n\n      if (hasApply) {\n        return function() {\n          var args = [];\n          forEach(arguments, function(arg) {\n            args.push(formatError(arg));\n          });\n          return logFn.apply(console, args);\n        };\n      }\n\n      // we are IE which either doesn't have window.console => this is noop and we do nothing,\n      // or we are IE where console.log doesn't have apply so we log at least first 2 args\n      return function(arg1, arg2) {\n        logFn(arg1, arg2 == null ? '' : arg2);\n      };\n    }\n  }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $parseMinErr = minErr('$parse');\n\n// Sandboxing Angular Expressions\n// ------------------------------\n// Angular expressions are generally considered safe because these expressions only have direct\n// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by\n// obtaining a reference to native JS functions such as the Function constructor.\n//\n// As an example, consider the following Angular expression:\n//\n//   {}.toString.constructor('alert(\"evil JS code\")')\n//\n// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits\n// against the expression language, but not to prevent exploits that were enabled by exposing\n// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good\n// practice and therefore we are not even trying to protect against interaction with an object\n// explicitly exposed in this way.\n//\n// In general, it is not possible to access a Window object from an angular expression unless a\n// window or some DOM object that has a reference to window is published onto a Scope.\n// Similarly we prevent invocations of function known to be dangerous, as well as assignments to\n// native objects.\n//\n// See https://docs.angularjs.org/guide/security\n\n\nfunction ensureSafeMemberName(name, fullExpression) {\n  if (name === \"__defineGetter__\" || name === \"__defineSetter__\"\n      || name === \"__lookupGetter__\" || name === \"__lookupSetter__\"\n      || name === \"__proto__\") {\n    throw $parseMinErr('isecfld',\n        'Attempting to access a disallowed field in Angular expressions! '\n        + 'Expression: {0}', fullExpression);\n  }\n  return name;\n}\n\nfunction getStringValue(name) {\n  // Property names must be strings. This means that non-string objects cannot be used\n  // as keys in an object. Any non-string object, including a number, is typecasted\n  // into a string via the toString method.\n  // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names\n  //\n  // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it\n  // to a string. It's not always possible. If `name` is an object and its `toString` method is\n  // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown:\n  //\n  // TypeError: Cannot convert object to primitive value\n  //\n  // For performance reasons, we don't catch this error here and allow it to propagate up the call\n  // stack. Note that you'll get the same error in JavaScript if you try to access a property using\n  // such a 'broken' object as a key.\n  return name + '';\n}\n\nfunction ensureSafeObject(obj, fullExpression) {\n  // nifty check if obj is Function that is fast and works across iframes and other contexts\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n          'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isWindow(obj)\n        obj.window === obj) {\n      throw $parseMinErr('isecwindow',\n          'Referencing the Window in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isElement(obj)\n        obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {\n      throw $parseMinErr('isecdom',\n          'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// block Object so that we can't get hold of dangerous Object.* methods\n        obj === Object) {\n      throw $parseMinErr('isecobj',\n          'Referencing Object in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    }\n  }\n  return obj;\n}\n\nvar CALL = Function.prototype.call;\nvar APPLY = Function.prototype.apply;\nvar BIND = Function.prototype.bind;\n\nfunction ensureSafeFunction(obj, fullExpression) {\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n        'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    } else if (obj === CALL || obj === APPLY || obj === BIND) {\n      throw $parseMinErr('isecff',\n        'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    }\n  }\n}\n\nfunction ensureSafeAssignContext(obj, fullExpression) {\n  if (obj) {\n    if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||\n        obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {\n      throw $parseMinErr('isecaf',\n        'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);\n    }\n  }\n}\n\nvar OPERATORS = createMap();\nforEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });\nvar ESCAPE = {\"n\":\"\\n\", \"f\":\"\\f\", \"r\":\"\\r\", \"t\":\"\\t\", \"v\":\"\\v\", \"'\":\"'\", '\"':'\"'};\n\n\n/////////////////////////////////////////\n\n\n/**\n * @constructor\n */\nvar Lexer = function(options) {\n  this.options = options;\n};\n\nLexer.prototype = {\n  constructor: Lexer,\n\n  lex: function(text) {\n    this.text = text;\n    this.index = 0;\n    this.tokens = [];\n\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      if (ch === '\"' || ch === \"'\") {\n        this.readString(ch);\n      } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {\n        this.readNumber();\n      } else if (this.isIdent(ch)) {\n        this.readIdent();\n      } else if (this.is(ch, '(){}[].,;:?')) {\n        this.tokens.push({index: this.index, text: ch});\n        this.index++;\n      } else if (this.isWhitespace(ch)) {\n        this.index++;\n      } else {\n        var ch2 = ch + this.peek();\n        var ch3 = ch2 + this.peek(2);\n        var op1 = OPERATORS[ch];\n        var op2 = OPERATORS[ch2];\n        var op3 = OPERATORS[ch3];\n        if (op1 || op2 || op3) {\n          var token = op3 ? ch3 : (op2 ? ch2 : ch);\n          this.tokens.push({index: this.index, text: token, operator: true});\n          this.index += token.length;\n        } else {\n          this.throwError('Unexpected next character ', this.index, this.index + 1);\n        }\n      }\n    }\n    return this.tokens;\n  },\n\n  is: function(ch, chars) {\n    return chars.indexOf(ch) !== -1;\n  },\n\n  peek: function(i) {\n    var num = i || 1;\n    return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;\n  },\n\n  isNumber: function(ch) {\n    return ('0' <= ch && ch <= '9') && typeof ch === \"string\";\n  },\n\n  isWhitespace: function(ch) {\n    // IE treats non-breaking space as \\u00A0\n    return (ch === ' ' || ch === '\\r' || ch === '\\t' ||\n            ch === '\\n' || ch === '\\v' || ch === '\\u00A0');\n  },\n\n  isIdent: function(ch) {\n    return ('a' <= ch && ch <= 'z' ||\n            'A' <= ch && ch <= 'Z' ||\n            '_' === ch || ch === '$');\n  },\n\n  isExpOperator: function(ch) {\n    return (ch === '-' || ch === '+' || this.isNumber(ch));\n  },\n\n  throwError: function(error, start, end) {\n    end = end || this.index;\n    var colStr = (isDefined(start)\n            ? 's ' + start +  '-' + this.index + ' [' + this.text.substring(start, end) + ']'\n            : ' ' + end);\n    throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',\n        error, colStr, this.text);\n  },\n\n  readNumber: function() {\n    var number = '';\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = lowercase(this.text.charAt(this.index));\n      if (ch == '.' || this.isNumber(ch)) {\n        number += ch;\n      } else {\n        var peekCh = this.peek();\n        if (ch == 'e' && this.isExpOperator(peekCh)) {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            peekCh && this.isNumber(peekCh) &&\n            number.charAt(number.length - 1) == 'e') {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            (!peekCh || !this.isNumber(peekCh)) &&\n            number.charAt(number.length - 1) == 'e') {\n          this.throwError('Invalid exponent');\n        } else {\n          break;\n        }\n      }\n      this.index++;\n    }\n    this.tokens.push({\n      index: start,\n      text: number,\n      constant: true,\n      value: Number(number)\n    });\n  },\n\n  readIdent: function() {\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      if (!(this.isIdent(ch) || this.isNumber(ch))) {\n        break;\n      }\n      this.index++;\n    }\n    this.tokens.push({\n      index: start,\n      text: this.text.slice(start, this.index),\n      identifier: true\n    });\n  },\n\n  readString: function(quote) {\n    var start = this.index;\n    this.index++;\n    var string = '';\n    var rawString = quote;\n    var escape = false;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      rawString += ch;\n      if (escape) {\n        if (ch === 'u') {\n          var hex = this.text.substring(this.index + 1, this.index + 5);\n          if (!hex.match(/[\\da-f]{4}/i)) {\n            this.throwError('Invalid unicode escape [\\\\u' + hex + ']');\n          }\n          this.index += 4;\n          string += String.fromCharCode(parseInt(hex, 16));\n        } else {\n          var rep = ESCAPE[ch];\n          string = string + (rep || ch);\n        }\n        escape = false;\n      } else if (ch === '\\\\') {\n        escape = true;\n      } else if (ch === quote) {\n        this.index++;\n        this.tokens.push({\n          index: start,\n          text: rawString,\n          constant: true,\n          value: string\n        });\n        return;\n      } else {\n        string += ch;\n      }\n      this.index++;\n    }\n    this.throwError('Unterminated quote', start);\n  }\n};\n\nvar AST = function(lexer, options) {\n  this.lexer = lexer;\n  this.options = options;\n};\n\nAST.Program = 'Program';\nAST.ExpressionStatement = 'ExpressionStatement';\nAST.AssignmentExpression = 'AssignmentExpression';\nAST.ConditionalExpression = 'ConditionalExpression';\nAST.LogicalExpression = 'LogicalExpression';\nAST.BinaryExpression = 'BinaryExpression';\nAST.UnaryExpression = 'UnaryExpression';\nAST.CallExpression = 'CallExpression';\nAST.MemberExpression = 'MemberExpression';\nAST.Identifier = 'Identifier';\nAST.Literal = 'Literal';\nAST.ArrayExpression = 'ArrayExpression';\nAST.Property = 'Property';\nAST.ObjectExpression = 'ObjectExpression';\nAST.ThisExpression = 'ThisExpression';\nAST.LocalsExpression = 'LocalsExpression';\n\n// Internal use only\nAST.NGValueParameter = 'NGValueParameter';\n\nAST.prototype = {\n  ast: function(text) {\n    this.text = text;\n    this.tokens = this.lexer.lex(text);\n\n    var value = this.program();\n\n    if (this.tokens.length !== 0) {\n      this.throwError('is an unexpected token', this.tokens[0]);\n    }\n\n    return value;\n  },\n\n  program: function() {\n    var body = [];\n    while (true) {\n      if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))\n        body.push(this.expressionStatement());\n      if (!this.expect(';')) {\n        return { type: AST.Program, body: body};\n      }\n    }\n  },\n\n  expressionStatement: function() {\n    return { type: AST.ExpressionStatement, expression: this.filterChain() };\n  },\n\n  filterChain: function() {\n    var left = this.expression();\n    var token;\n    while ((token = this.expect('|'))) {\n      left = this.filter(left);\n    }\n    return left;\n  },\n\n  expression: function() {\n    return this.assignment();\n  },\n\n  assignment: function() {\n    var result = this.ternary();\n    if (this.expect('=')) {\n      result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};\n    }\n    return result;\n  },\n\n  ternary: function() {\n    var test = this.logicalOR();\n    var alternate;\n    var consequent;\n    if (this.expect('?')) {\n      alternate = this.expression();\n      if (this.consume(':')) {\n        consequent = this.expression();\n        return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};\n      }\n    }\n    return test;\n  },\n\n  logicalOR: function() {\n    var left = this.logicalAND();\n    while (this.expect('||')) {\n      left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };\n    }\n    return left;\n  },\n\n  logicalAND: function() {\n    var left = this.equality();\n    while (this.expect('&&')) {\n      left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};\n    }\n    return left;\n  },\n\n  equality: function() {\n    var left = this.relational();\n    var token;\n    while ((token = this.expect('==','!=','===','!=='))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };\n    }\n    return left;\n  },\n\n  relational: function() {\n    var left = this.additive();\n    var token;\n    while ((token = this.expect('<', '>', '<=', '>='))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };\n    }\n    return left;\n  },\n\n  additive: function() {\n    var left = this.multiplicative();\n    var token;\n    while ((token = this.expect('+','-'))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };\n    }\n    return left;\n  },\n\n  multiplicative: function() {\n    var left = this.unary();\n    var token;\n    while ((token = this.expect('*','/','%'))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };\n    }\n    return left;\n  },\n\n  unary: function() {\n    var token;\n    if ((token = this.expect('+', '-', '!'))) {\n      return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };\n    } else {\n      return this.primary();\n    }\n  },\n\n  primary: function() {\n    var primary;\n    if (this.expect('(')) {\n      primary = this.filterChain();\n      this.consume(')');\n    } else if (this.expect('[')) {\n      primary = this.arrayDeclaration();\n    } else if (this.expect('{')) {\n      primary = this.object();\n    } else if (this.selfReferential.hasOwnProperty(this.peek().text)) {\n      primary = copy(this.selfReferential[this.consume().text]);\n    } else if (this.options.literals.hasOwnProperty(this.peek().text)) {\n      primary = { type: AST.Literal, value: this.options.literals[this.consume().text]};\n    } else if (this.peek().identifier) {\n      primary = this.identifier();\n    } else if (this.peek().constant) {\n      primary = this.constant();\n    } else {\n      this.throwError('not a primary expression', this.peek());\n    }\n\n    var next;\n    while ((next = this.expect('(', '[', '.'))) {\n      if (next.text === '(') {\n        primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };\n        this.consume(')');\n      } else if (next.text === '[') {\n        primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };\n        this.consume(']');\n      } else if (next.text === '.') {\n        primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };\n      } else {\n        this.throwError('IMPOSSIBLE');\n      }\n    }\n    return primary;\n  },\n\n  filter: function(baseExpression) {\n    var args = [baseExpression];\n    var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};\n\n    while (this.expect(':')) {\n      args.push(this.expression());\n    }\n\n    return result;\n  },\n\n  parseArguments: function() {\n    var args = [];\n    if (this.peekToken().text !== ')') {\n      do {\n        args.push(this.expression());\n      } while (this.expect(','));\n    }\n    return args;\n  },\n\n  identifier: function() {\n    var token = this.consume();\n    if (!token.identifier) {\n      this.throwError('is not a valid identifier', token);\n    }\n    return { type: AST.Identifier, name: token.text };\n  },\n\n  constant: function() {\n    // TODO check that it is a constant\n    return { type: AST.Literal, value: this.consume().value };\n  },\n\n  arrayDeclaration: function() {\n    var elements = [];\n    if (this.peekToken().text !== ']') {\n      do {\n        if (this.peek(']')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        elements.push(this.expression());\n      } while (this.expect(','));\n    }\n    this.consume(']');\n\n    return { type: AST.ArrayExpression, elements: elements };\n  },\n\n  object: function() {\n    var properties = [], property;\n    if (this.peekToken().text !== '}') {\n      do {\n        if (this.peek('}')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        property = {type: AST.Property, kind: 'init'};\n        if (this.peek().constant) {\n          property.key = this.constant();\n        } else if (this.peek().identifier) {\n          property.key = this.identifier();\n        } else {\n          this.throwError(\"invalid key\", this.peek());\n        }\n        this.consume(':');\n        property.value = this.expression();\n        properties.push(property);\n      } while (this.expect(','));\n    }\n    this.consume('}');\n\n    return {type: AST.ObjectExpression, properties: properties };\n  },\n\n  throwError: function(msg, token) {\n    throw $parseMinErr('syntax',\n        'Syntax Error: Token \\'{0}\\' {1} at column {2} of the expression [{3}] starting at [{4}].',\n          token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));\n  },\n\n  consume: function(e1) {\n    if (this.tokens.length === 0) {\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    }\n\n    var token = this.expect(e1);\n    if (!token) {\n      this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());\n    }\n    return token;\n  },\n\n  peekToken: function() {\n    if (this.tokens.length === 0) {\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    }\n    return this.tokens[0];\n  },\n\n  peek: function(e1, e2, e3, e4) {\n    return this.peekAhead(0, e1, e2, e3, e4);\n  },\n\n  peekAhead: function(i, e1, e2, e3, e4) {\n    if (this.tokens.length > i) {\n      var token = this.tokens[i];\n      var t = token.text;\n      if (t === e1 || t === e2 || t === e3 || t === e4 ||\n          (!e1 && !e2 && !e3 && !e4)) {\n        return token;\n      }\n    }\n    return false;\n  },\n\n  expect: function(e1, e2, e3, e4) {\n    var token = this.peek(e1, e2, e3, e4);\n    if (token) {\n      this.tokens.shift();\n      return token;\n    }\n    return false;\n  },\n\n  selfReferential: {\n    'this': {type: AST.ThisExpression },\n    '$locals': {type: AST.LocalsExpression }\n  }\n};\n\nfunction ifDefined(v, d) {\n  return typeof v !== 'undefined' ? v : d;\n}\n\nfunction plusFn(l, r) {\n  if (typeof l === 'undefined') return r;\n  if (typeof r === 'undefined') return l;\n  return l + r;\n}\n\nfunction isStateless($filter, filterName) {\n  var fn = $filter(filterName);\n  return !fn.$stateful;\n}\n\nfunction findConstantAndWatchExpressions(ast, $filter) {\n  var allConstants;\n  var argsToWatch;\n  switch (ast.type) {\n  case AST.Program:\n    allConstants = true;\n    forEach(ast.body, function(expr) {\n      findConstantAndWatchExpressions(expr.expression, $filter);\n      allConstants = allConstants && expr.expression.constant;\n    });\n    ast.constant = allConstants;\n    break;\n  case AST.Literal:\n    ast.constant = true;\n    ast.toWatch = [];\n    break;\n  case AST.UnaryExpression:\n    findConstantAndWatchExpressions(ast.argument, $filter);\n    ast.constant = ast.argument.constant;\n    ast.toWatch = ast.argument.toWatch;\n    break;\n  case AST.BinaryExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);\n    break;\n  case AST.LogicalExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = ast.constant ? [] : [ast];\n    break;\n  case AST.ConditionalExpression:\n    findConstantAndWatchExpressions(ast.test, $filter);\n    findConstantAndWatchExpressions(ast.alternate, $filter);\n    findConstantAndWatchExpressions(ast.consequent, $filter);\n    ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;\n    ast.toWatch = ast.constant ? [] : [ast];\n    break;\n  case AST.Identifier:\n    ast.constant = false;\n    ast.toWatch = [ast];\n    break;\n  case AST.MemberExpression:\n    findConstantAndWatchExpressions(ast.object, $filter);\n    if (ast.computed) {\n      findConstantAndWatchExpressions(ast.property, $filter);\n    }\n    ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);\n    ast.toWatch = [ast];\n    break;\n  case AST.CallExpression:\n    allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;\n    argsToWatch = [];\n    forEach(ast.arguments, function(expr) {\n      findConstantAndWatchExpressions(expr, $filter);\n      allConstants = allConstants && expr.constant;\n      if (!expr.constant) {\n        argsToWatch.push.apply(argsToWatch, expr.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];\n    break;\n  case AST.AssignmentExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = [ast];\n    break;\n  case AST.ArrayExpression:\n    allConstants = true;\n    argsToWatch = [];\n    forEach(ast.elements, function(expr) {\n      findConstantAndWatchExpressions(expr, $filter);\n      allConstants = allConstants && expr.constant;\n      if (!expr.constant) {\n        argsToWatch.push.apply(argsToWatch, expr.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = argsToWatch;\n    break;\n  case AST.ObjectExpression:\n    allConstants = true;\n    argsToWatch = [];\n    forEach(ast.properties, function(property) {\n      findConstantAndWatchExpressions(property.value, $filter);\n      allConstants = allConstants && property.value.constant;\n      if (!property.value.constant) {\n        argsToWatch.push.apply(argsToWatch, property.value.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = argsToWatch;\n    break;\n  case AST.ThisExpression:\n    ast.constant = false;\n    ast.toWatch = [];\n    break;\n  case AST.LocalsExpression:\n    ast.constant = false;\n    ast.toWatch = [];\n    break;\n  }\n}\n\nfunction getInputs(body) {\n  if (body.length != 1) return;\n  var lastExpression = body[0].expression;\n  var candidate = lastExpression.toWatch;\n  if (candidate.length !== 1) return candidate;\n  return candidate[0] !== lastExpression ? candidate : undefined;\n}\n\nfunction isAssignable(ast) {\n  return ast.type === AST.Identifier || ast.type === AST.MemberExpression;\n}\n\nfunction assignableAST(ast) {\n  if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {\n    return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};\n  }\n}\n\nfunction isLiteral(ast) {\n  return ast.body.length === 0 ||\n      ast.body.length === 1 && (\n      ast.body[0].expression.type === AST.Literal ||\n      ast.body[0].expression.type === AST.ArrayExpression ||\n      ast.body[0].expression.type === AST.ObjectExpression);\n}\n\nfunction isConstant(ast) {\n  return ast.constant;\n}\n\nfunction ASTCompiler(astBuilder, $filter) {\n  this.astBuilder = astBuilder;\n  this.$filter = $filter;\n}\n\nASTCompiler.prototype = {\n  compile: function(expression, expensiveChecks) {\n    var self = this;\n    var ast = this.astBuilder.ast(expression);\n    this.state = {\n      nextId: 0,\n      filters: {},\n      expensiveChecks: expensiveChecks,\n      fn: {vars: [], body: [], own: {}},\n      assign: {vars: [], body: [], own: {}},\n      inputs: []\n    };\n    findConstantAndWatchExpressions(ast, self.$filter);\n    var extra = '';\n    var assignable;\n    this.stage = 'assign';\n    if ((assignable = assignableAST(ast))) {\n      this.state.computing = 'assign';\n      var result = this.nextId();\n      this.recurse(assignable, result);\n      this.return_(result);\n      extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');\n    }\n    var toWatch = getInputs(ast.body);\n    self.stage = 'inputs';\n    forEach(toWatch, function(watch, key) {\n      var fnKey = 'fn' + key;\n      self.state[fnKey] = {vars: [], body: [], own: {}};\n      self.state.computing = fnKey;\n      var intoId = self.nextId();\n      self.recurse(watch, intoId);\n      self.return_(intoId);\n      self.state.inputs.push(fnKey);\n      watch.watchId = key;\n    });\n    this.state.computing = 'fn';\n    this.stage = 'main';\n    this.recurse(ast);\n    var fnString =\n      // The build and minification steps remove the string \"use strict\" from the code, but this is done using a regex.\n      // This is a workaround for this until we do a better job at only removing the prefix only when we should.\n      '\"' + this.USE + ' ' + this.STRICT + '\";\\n' +\n      this.filterPrefix() +\n      'var fn=' + this.generateFunction('fn', 's,l,a,i') +\n      extra +\n      this.watchFns() +\n      'return fn;';\n\n    /* jshint -W054 */\n    var fn = (new Function('$filter',\n        'ensureSafeMemberName',\n        'ensureSafeObject',\n        'ensureSafeFunction',\n        'getStringValue',\n        'ensureSafeAssignContext',\n        'ifDefined',\n        'plus',\n        'text',\n        fnString))(\n          this.$filter,\n          ensureSafeMemberName,\n          ensureSafeObject,\n          ensureSafeFunction,\n          getStringValue,\n          ensureSafeAssignContext,\n          ifDefined,\n          plusFn,\n          expression);\n    /* jshint +W054 */\n    this.state = this.stage = undefined;\n    fn.literal = isLiteral(ast);\n    fn.constant = isConstant(ast);\n    return fn;\n  },\n\n  USE: 'use',\n\n  STRICT: 'strict',\n\n  watchFns: function() {\n    var result = [];\n    var fns = this.state.inputs;\n    var self = this;\n    forEach(fns, function(name) {\n      result.push('var ' + name + '=' + self.generateFunction(name, 's'));\n    });\n    if (fns.length) {\n      result.push('fn.inputs=[' + fns.join(',') + '];');\n    }\n    return result.join('');\n  },\n\n  generateFunction: function(name, params) {\n    return 'function(' + params + '){' +\n        this.varsPrefix(name) +\n        this.body(name) +\n        '};';\n  },\n\n  filterPrefix: function() {\n    var parts = [];\n    var self = this;\n    forEach(this.state.filters, function(id, filter) {\n      parts.push(id + '=$filter(' + self.escape(filter) + ')');\n    });\n    if (parts.length) return 'var ' + parts.join(',') + ';';\n    return '';\n  },\n\n  varsPrefix: function(section) {\n    return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';\n  },\n\n  body: function(section) {\n    return this.state[section].body.join('');\n  },\n\n  recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n    var left, right, self = this, args, expression;\n    recursionFn = recursionFn || noop;\n    if (!skipWatchIdCheck && isDefined(ast.watchId)) {\n      intoId = intoId || this.nextId();\n      this.if_('i',\n        this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),\n        this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)\n      );\n      return;\n    }\n    switch (ast.type) {\n    case AST.Program:\n      forEach(ast.body, function(expression, pos) {\n        self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });\n        if (pos !== ast.body.length - 1) {\n          self.current().body.push(right, ';');\n        } else {\n          self.return_(right);\n        }\n      });\n      break;\n    case AST.Literal:\n      expression = this.escape(ast.value);\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.UnaryExpression:\n      this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });\n      expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.BinaryExpression:\n      this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });\n      this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });\n      if (ast.operator === '+') {\n        expression = this.plus(left, right);\n      } else if (ast.operator === '-') {\n        expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);\n      } else {\n        expression = '(' + left + ')' + ast.operator + '(' + right + ')';\n      }\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.LogicalExpression:\n      intoId = intoId || this.nextId();\n      self.recurse(ast.left, intoId);\n      self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));\n      recursionFn(intoId);\n      break;\n    case AST.ConditionalExpression:\n      intoId = intoId || this.nextId();\n      self.recurse(ast.test, intoId);\n      self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));\n      recursionFn(intoId);\n      break;\n    case AST.Identifier:\n      intoId = intoId || this.nextId();\n      if (nameId) {\n        nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');\n        nameId.computed = false;\n        nameId.name = ast.name;\n      }\n      ensureSafeMemberName(ast.name);\n      self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),\n        function() {\n          self.if_(self.stage === 'inputs' || 's', function() {\n            if (create && create !== 1) {\n              self.if_(\n                self.not(self.nonComputedMember('s', ast.name)),\n                self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));\n            }\n            self.assign(intoId, self.nonComputedMember('s', ast.name));\n          });\n        }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))\n        );\n      if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {\n        self.addEnsureSafeObject(intoId);\n      }\n      recursionFn(intoId);\n      break;\n    case AST.MemberExpression:\n      left = nameId && (nameId.context = this.nextId()) || this.nextId();\n      intoId = intoId || this.nextId();\n      self.recurse(ast.object, left, undefined, function() {\n        self.if_(self.notNull(left), function() {\n          if (create && create !== 1) {\n            self.addEnsureSafeAssignContext(left);\n          }\n          if (ast.computed) {\n            right = self.nextId();\n            self.recurse(ast.property, right);\n            self.getStringValue(right);\n            self.addEnsureSafeMemberName(right);\n            if (create && create !== 1) {\n              self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));\n            }\n            expression = self.ensureSafeObject(self.computedMember(left, right));\n            self.assign(intoId, expression);\n            if (nameId) {\n              nameId.computed = true;\n              nameId.name = right;\n            }\n          } else {\n            ensureSafeMemberName(ast.property.name);\n            if (create && create !== 1) {\n              self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));\n            }\n            expression = self.nonComputedMember(left, ast.property.name);\n            if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {\n              expression = self.ensureSafeObject(expression);\n            }\n            self.assign(intoId, expression);\n            if (nameId) {\n              nameId.computed = false;\n              nameId.name = ast.property.name;\n            }\n          }\n        }, function() {\n          self.assign(intoId, 'undefined');\n        });\n        recursionFn(intoId);\n      }, !!create);\n      break;\n    case AST.CallExpression:\n      intoId = intoId || this.nextId();\n      if (ast.filter) {\n        right = self.filter(ast.callee.name);\n        args = [];\n        forEach(ast.arguments, function(expr) {\n          var argument = self.nextId();\n          self.recurse(expr, argument);\n          args.push(argument);\n        });\n        expression = right + '(' + args.join(',') + ')';\n        self.assign(intoId, expression);\n        recursionFn(intoId);\n      } else {\n        right = self.nextId();\n        left = {};\n        args = [];\n        self.recurse(ast.callee, right, left, function() {\n          self.if_(self.notNull(right), function() {\n            self.addEnsureSafeFunction(right);\n            forEach(ast.arguments, function(expr) {\n              self.recurse(expr, self.nextId(), undefined, function(argument) {\n                args.push(self.ensureSafeObject(argument));\n              });\n            });\n            if (left.name) {\n              if (!self.state.expensiveChecks) {\n                self.addEnsureSafeObject(left.context);\n              }\n              expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';\n            } else {\n              expression = right + '(' + args.join(',') + ')';\n            }\n            expression = self.ensureSafeObject(expression);\n            self.assign(intoId, expression);\n          }, function() {\n            self.assign(intoId, 'undefined');\n          });\n          recursionFn(intoId);\n        });\n      }\n      break;\n    case AST.AssignmentExpression:\n      right = this.nextId();\n      left = {};\n      if (!isAssignable(ast.left)) {\n        throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');\n      }\n      this.recurse(ast.left, undefined, left, function() {\n        self.if_(self.notNull(left.context), function() {\n          self.recurse(ast.right, right);\n          self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));\n          self.addEnsureSafeAssignContext(left.context);\n          expression = self.member(left.context, left.name, left.computed) + ast.operator + right;\n          self.assign(intoId, expression);\n          recursionFn(intoId || expression);\n        });\n      }, 1);\n      break;\n    case AST.ArrayExpression:\n      args = [];\n      forEach(ast.elements, function(expr) {\n        self.recurse(expr, self.nextId(), undefined, function(argument) {\n          args.push(argument);\n        });\n      });\n      expression = '[' + args.join(',') + ']';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.ObjectExpression:\n      args = [];\n      forEach(ast.properties, function(property) {\n        self.recurse(property.value, self.nextId(), undefined, function(expr) {\n          args.push(self.escape(\n              property.key.type === AST.Identifier ? property.key.name :\n                ('' + property.key.value)) +\n              ':' + expr);\n        });\n      });\n      expression = '{' + args.join(',') + '}';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.ThisExpression:\n      this.assign(intoId, 's');\n      recursionFn('s');\n      break;\n    case AST.LocalsExpression:\n      this.assign(intoId, 'l');\n      recursionFn('l');\n      break;\n    case AST.NGValueParameter:\n      this.assign(intoId, 'v');\n      recursionFn('v');\n      break;\n    }\n  },\n\n  getHasOwnProperty: function(element, property) {\n    var key = element + '.' + property;\n    var own = this.current().own;\n    if (!own.hasOwnProperty(key)) {\n      own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');\n    }\n    return own[key];\n  },\n\n  assign: function(id, value) {\n    if (!id) return;\n    this.current().body.push(id, '=', value, ';');\n    return id;\n  },\n\n  filter: function(filterName) {\n    if (!this.state.filters.hasOwnProperty(filterName)) {\n      this.state.filters[filterName] = this.nextId(true);\n    }\n    return this.state.filters[filterName];\n  },\n\n  ifDefined: function(id, defaultValue) {\n    return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';\n  },\n\n  plus: function(left, right) {\n    return 'plus(' + left + ',' + right + ')';\n  },\n\n  return_: function(id) {\n    this.current().body.push('return ', id, ';');\n  },\n\n  if_: function(test, alternate, consequent) {\n    if (test === true) {\n      alternate();\n    } else {\n      var body = this.current().body;\n      body.push('if(', test, '){');\n      alternate();\n      body.push('}');\n      if (consequent) {\n        body.push('else{');\n        consequent();\n        body.push('}');\n      }\n    }\n  },\n\n  not: function(expression) {\n    return '!(' + expression + ')';\n  },\n\n  notNull: function(expression) {\n    return expression + '!=null';\n  },\n\n  nonComputedMember: function(left, right) {\n    return left + '.' + right;\n  },\n\n  computedMember: function(left, right) {\n    return left + '[' + right + ']';\n  },\n\n  member: function(left, right, computed) {\n    if (computed) return this.computedMember(left, right);\n    return this.nonComputedMember(left, right);\n  },\n\n  addEnsureSafeObject: function(item) {\n    this.current().body.push(this.ensureSafeObject(item), ';');\n  },\n\n  addEnsureSafeMemberName: function(item) {\n    this.current().body.push(this.ensureSafeMemberName(item), ';');\n  },\n\n  addEnsureSafeFunction: function(item) {\n    this.current().body.push(this.ensureSafeFunction(item), ';');\n  },\n\n  addEnsureSafeAssignContext: function(item) {\n    this.current().body.push(this.ensureSafeAssignContext(item), ';');\n  },\n\n  ensureSafeObject: function(item) {\n    return 'ensureSafeObject(' + item + ',text)';\n  },\n\n  ensureSafeMemberName: function(item) {\n    return 'ensureSafeMemberName(' + item + ',text)';\n  },\n\n  ensureSafeFunction: function(item) {\n    return 'ensureSafeFunction(' + item + ',text)';\n  },\n\n  getStringValue: function(item) {\n    this.assign(item, 'getStringValue(' + item + ')');\n  },\n\n  ensureSafeAssignContext: function(item) {\n    return 'ensureSafeAssignContext(' + item + ',text)';\n  },\n\n  lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n    var self = this;\n    return function() {\n      self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);\n    };\n  },\n\n  lazyAssign: function(id, value) {\n    var self = this;\n    return function() {\n      self.assign(id, value);\n    };\n  },\n\n  stringEscapeRegex: /[^ a-zA-Z0-9]/g,\n\n  stringEscapeFn: function(c) {\n    return '\\\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);\n  },\n\n  escape: function(value) {\n    if (isString(value)) return \"'\" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + \"'\";\n    if (isNumber(value)) return value.toString();\n    if (value === true) return 'true';\n    if (value === false) return 'false';\n    if (value === null) return 'null';\n    if (typeof value === 'undefined') return 'undefined';\n\n    throw $parseMinErr('esc', 'IMPOSSIBLE');\n  },\n\n  nextId: function(skip, init) {\n    var id = 'v' + (this.state.nextId++);\n    if (!skip) {\n      this.current().vars.push(id + (init ? '=' + init : ''));\n    }\n    return id;\n  },\n\n  current: function() {\n    return this.state[this.state.computing];\n  }\n};\n\n\nfunction ASTInterpreter(astBuilder, $filter) {\n  this.astBuilder = astBuilder;\n  this.$filter = $filter;\n}\n\nASTInterpreter.prototype = {\n  compile: function(expression, expensiveChecks) {\n    var self = this;\n    var ast = this.astBuilder.ast(expression);\n    this.expression = expression;\n    this.expensiveChecks = expensiveChecks;\n    findConstantAndWatchExpressions(ast, self.$filter);\n    var assignable;\n    var assign;\n    if ((assignable = assignableAST(ast))) {\n      assign = this.recurse(assignable);\n    }\n    var toWatch = getInputs(ast.body);\n    var inputs;\n    if (toWatch) {\n      inputs = [];\n      forEach(toWatch, function(watch, key) {\n        var input = self.recurse(watch);\n        watch.input = input;\n        inputs.push(input);\n        watch.watchId = key;\n      });\n    }\n    var expressions = [];\n    forEach(ast.body, function(expression) {\n      expressions.push(self.recurse(expression.expression));\n    });\n    var fn = ast.body.length === 0 ? noop :\n             ast.body.length === 1 ? expressions[0] :\n             function(scope, locals) {\n               var lastValue;\n               forEach(expressions, function(exp) {\n                 lastValue = exp(scope, locals);\n               });\n               return lastValue;\n             };\n    if (assign) {\n      fn.assign = function(scope, value, locals) {\n        return assign(scope, locals, value);\n      };\n    }\n    if (inputs) {\n      fn.inputs = inputs;\n    }\n    fn.literal = isLiteral(ast);\n    fn.constant = isConstant(ast);\n    return fn;\n  },\n\n  recurse: function(ast, context, create) {\n    var left, right, self = this, args, expression;\n    if (ast.input) {\n      return this.inputs(ast.input, ast.watchId);\n    }\n    switch (ast.type) {\n    case AST.Literal:\n      return this.value(ast.value, context);\n    case AST.UnaryExpression:\n      right = this.recurse(ast.argument);\n      return this['unary' + ast.operator](right, context);\n    case AST.BinaryExpression:\n      left = this.recurse(ast.left);\n      right = this.recurse(ast.right);\n      return this['binary' + ast.operator](left, right, context);\n    case AST.LogicalExpression:\n      left = this.recurse(ast.left);\n      right = this.recurse(ast.right);\n      return this['binary' + ast.operator](left, right, context);\n    case AST.ConditionalExpression:\n      return this['ternary?:'](\n        this.recurse(ast.test),\n        this.recurse(ast.alternate),\n        this.recurse(ast.consequent),\n        context\n      );\n    case AST.Identifier:\n      ensureSafeMemberName(ast.name, self.expression);\n      return self.identifier(ast.name,\n                             self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),\n                             context, create, self.expression);\n    case AST.MemberExpression:\n      left = this.recurse(ast.object, false, !!create);\n      if (!ast.computed) {\n        ensureSafeMemberName(ast.property.name, self.expression);\n        right = ast.property.name;\n      }\n      if (ast.computed) right = this.recurse(ast.property);\n      return ast.computed ?\n        this.computedMember(left, right, context, create, self.expression) :\n        this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);\n    case AST.CallExpression:\n      args = [];\n      forEach(ast.arguments, function(expr) {\n        args.push(self.recurse(expr));\n      });\n      if (ast.filter) right = this.$filter(ast.callee.name);\n      if (!ast.filter) right = this.recurse(ast.callee, true);\n      return ast.filter ?\n        function(scope, locals, assign, inputs) {\n          var values = [];\n          for (var i = 0; i < args.length; ++i) {\n            values.push(args[i](scope, locals, assign, inputs));\n          }\n          var value = right.apply(undefined, values, inputs);\n          return context ? {context: undefined, name: undefined, value: value} : value;\n        } :\n        function(scope, locals, assign, inputs) {\n          var rhs = right(scope, locals, assign, inputs);\n          var value;\n          if (rhs.value != null) {\n            ensureSafeObject(rhs.context, self.expression);\n            ensureSafeFunction(rhs.value, self.expression);\n            var values = [];\n            for (var i = 0; i < args.length; ++i) {\n              values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));\n            }\n            value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);\n          }\n          return context ? {value: value} : value;\n        };\n    case AST.AssignmentExpression:\n      left = this.recurse(ast.left, true, 1);\n      right = this.recurse(ast.right);\n      return function(scope, locals, assign, inputs) {\n        var lhs = left(scope, locals, assign, inputs);\n        var rhs = right(scope, locals, assign, inputs);\n        ensureSafeObject(lhs.value, self.expression);\n        ensureSafeAssignContext(lhs.context);\n        lhs.context[lhs.name] = rhs;\n        return context ? {value: rhs} : rhs;\n      };\n    case AST.ArrayExpression:\n      args = [];\n      forEach(ast.elements, function(expr) {\n        args.push(self.recurse(expr));\n      });\n      return function(scope, locals, assign, inputs) {\n        var value = [];\n        for (var i = 0; i < args.length; ++i) {\n          value.push(args[i](scope, locals, assign, inputs));\n        }\n        return context ? {value: value} : value;\n      };\n    case AST.ObjectExpression:\n      args = [];\n      forEach(ast.properties, function(property) {\n        args.push({key: property.key.type === AST.Identifier ?\n                        property.key.name :\n                        ('' + property.key.value),\n                   value: self.recurse(property.value)\n        });\n      });\n      return function(scope, locals, assign, inputs) {\n        var value = {};\n        for (var i = 0; i < args.length; ++i) {\n          value[args[i].key] = args[i].value(scope, locals, assign, inputs);\n        }\n        return context ? {value: value} : value;\n      };\n    case AST.ThisExpression:\n      return function(scope) {\n        return context ? {value: scope} : scope;\n      };\n    case AST.LocalsExpression:\n      return function(scope, locals) {\n        return context ? {value: locals} : locals;\n      };\n    case AST.NGValueParameter:\n      return function(scope, locals, assign) {\n        return context ? {value: assign} : assign;\n      };\n    }\n  },\n\n  'unary+': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = argument(scope, locals, assign, inputs);\n      if (isDefined(arg)) {\n        arg = +arg;\n      } else {\n        arg = 0;\n      }\n      return context ? {value: arg} : arg;\n    };\n  },\n  'unary-': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = argument(scope, locals, assign, inputs);\n      if (isDefined(arg)) {\n        arg = -arg;\n      } else {\n        arg = 0;\n      }\n      return context ? {value: arg} : arg;\n    };\n  },\n  'unary!': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = !argument(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary+': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs = right(scope, locals, assign, inputs);\n      var arg = plusFn(lhs, rhs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary-': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs = right(scope, locals, assign, inputs);\n      var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary*': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary/': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary%': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary===': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary!==': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary==': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary!=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary<': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary>': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary<=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary>=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary&&': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary||': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'ternary?:': function(test, alternate, consequent, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  value: function(value, context) {\n    return function() { return context ? {context: undefined, name: undefined, value: value} : value; };\n  },\n  identifier: function(name, expensiveChecks, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var base = locals && (name in locals) ? locals : scope;\n      if (create && create !== 1 && base && !(base[name])) {\n        base[name] = {};\n      }\n      var value = base ? base[name] : undefined;\n      if (expensiveChecks) {\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: base, name: name, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  computedMember: function(left, right, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs;\n      var value;\n      if (lhs != null) {\n        rhs = right(scope, locals, assign, inputs);\n        rhs = getStringValue(rhs);\n        ensureSafeMemberName(rhs, expression);\n        if (create && create !== 1) {\n          ensureSafeAssignContext(lhs);\n          if (lhs && !(lhs[rhs])) {\n            lhs[rhs] = {};\n          }\n        }\n        value = lhs[rhs];\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: lhs, name: rhs, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      if (create && create !== 1) {\n        ensureSafeAssignContext(lhs);\n        if (lhs && !(lhs[right])) {\n          lhs[right] = {};\n        }\n      }\n      var value = lhs != null ? lhs[right] : undefined;\n      if (expensiveChecks || isPossiblyDangerousMemberName(right)) {\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: lhs, name: right, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  inputs: function(input, watchId) {\n    return function(scope, value, locals, inputs) {\n      if (inputs) return inputs[watchId];\n      return input(scope, value, locals);\n    };\n  }\n};\n\n/**\n * @constructor\n */\nvar Parser = function(lexer, $filter, options) {\n  this.lexer = lexer;\n  this.$filter = $filter;\n  this.options = options;\n  this.ast = new AST(lexer, options);\n  this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :\n                                   new ASTCompiler(this.ast, $filter);\n};\n\nParser.prototype = {\n  constructor: Parser,\n\n  parse: function(text) {\n    return this.astCompiler.compile(text, this.options.expensiveChecks);\n  }\n};\n\nfunction isPossiblyDangerousMemberName(name) {\n  return name == 'constructor';\n}\n\nvar objectValueOf = Object.prototype.valueOf;\n\nfunction getValueOf(value) {\n  return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);\n}\n\n///////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $parse\n * @kind function\n *\n * @description\n *\n * Converts Angular {@link guide/expression expression} into a function.\n *\n * ```js\n *   var getter = $parse('user.name');\n *   var setter = getter.assign;\n *   var context = {user:{name:'angular'}};\n *   var locals = {user:{name:'local'}};\n *\n *   expect(getter(context)).toEqual('angular');\n *   setter(context, 'newValue');\n *   expect(context.user.name).toEqual('newValue');\n *   expect(getter(context, locals)).toEqual('local');\n * ```\n *\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n *      are evaluated against (typically a scope object).\n *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n *      `context`.\n *\n *    The returned function also has the following properties:\n *      * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript\n *        literal.\n *      * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript\n *        constant literals.\n *      * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be\n *        set to a function to change its value on the given context.\n *\n */\n\n\n/**\n * @ngdoc provider\n * @name $parseProvider\n *\n * @description\n * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}\n *  service.\n */\nfunction $ParseProvider() {\n  var cacheDefault = createMap();\n  var cacheExpensive = createMap();\n  var literals = {\n    'true': true,\n    'false': false,\n    'null': null,\n    'undefined': undefined\n  };\n\n  /**\n   * @ngdoc method\n   * @name $parseProvider#addLiteral\n   * @description\n   *\n   * Configure $parse service to add literal values that will be present as literal at expressions.\n   *\n   * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.\n   * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.\n   *\n   **/\n  this.addLiteral = function(literalName, literalValue) {\n    literals[literalName] = literalValue;\n  };\n\n  this.$get = ['$filter', function($filter) {\n    var noUnsafeEval = csp().noUnsafeEval;\n    var $parseOptions = {\n          csp: noUnsafeEval,\n          expensiveChecks: false,\n          literals: copy(literals)\n        },\n        $parseOptionsExpensive = {\n          csp: noUnsafeEval,\n          expensiveChecks: true,\n          literals: copy(literals)\n        };\n    var runningChecksEnabled = false;\n\n    $parse.$$runningExpensiveChecks = function() {\n      return runningChecksEnabled;\n    };\n\n    return $parse;\n\n    function $parse(exp, interceptorFn, expensiveChecks) {\n      var parsedExpression, oneTime, cacheKey;\n\n      expensiveChecks = expensiveChecks || runningChecksEnabled;\n\n      switch (typeof exp) {\n        case 'string':\n          exp = exp.trim();\n          cacheKey = exp;\n\n          var cache = (expensiveChecks ? cacheExpensive : cacheDefault);\n          parsedExpression = cache[cacheKey];\n\n          if (!parsedExpression) {\n            if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {\n              oneTime = true;\n              exp = exp.substring(2);\n            }\n            var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;\n            var lexer = new Lexer(parseOptions);\n            var parser = new Parser(lexer, $filter, parseOptions);\n            parsedExpression = parser.parse(exp);\n            if (parsedExpression.constant) {\n              parsedExpression.$$watchDelegate = constantWatchDelegate;\n            } else if (oneTime) {\n              parsedExpression.$$watchDelegate = parsedExpression.literal ?\n                  oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;\n            } else if (parsedExpression.inputs) {\n              parsedExpression.$$watchDelegate = inputsWatchDelegate;\n            }\n            if (expensiveChecks) {\n              parsedExpression = expensiveChecksInterceptor(parsedExpression);\n            }\n            cache[cacheKey] = parsedExpression;\n          }\n          return addInterceptor(parsedExpression, interceptorFn);\n\n        case 'function':\n          return addInterceptor(exp, interceptorFn);\n\n        default:\n          return addInterceptor(noop, interceptorFn);\n      }\n    }\n\n    function expensiveChecksInterceptor(fn) {\n      if (!fn) return fn;\n      expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;\n      expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);\n      expensiveCheckFn.constant = fn.constant;\n      expensiveCheckFn.literal = fn.literal;\n      for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {\n        fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);\n      }\n      expensiveCheckFn.inputs = fn.inputs;\n\n      return expensiveCheckFn;\n\n      function expensiveCheckFn(scope, locals, assign, inputs) {\n        var expensiveCheckOldValue = runningChecksEnabled;\n        runningChecksEnabled = true;\n        try {\n          return fn(scope, locals, assign, inputs);\n        } finally {\n          runningChecksEnabled = expensiveCheckOldValue;\n        }\n      }\n    }\n\n    function expressionInputDirtyCheck(newValue, oldValueOfValue) {\n\n      if (newValue == null || oldValueOfValue == null) { // null/undefined\n        return newValue === oldValueOfValue;\n      }\n\n      if (typeof newValue === 'object') {\n\n        // attempt to convert the value to a primitive type\n        // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can\n        //             be cheaply dirty-checked\n        newValue = getValueOf(newValue);\n\n        if (typeof newValue === 'object') {\n          // objects/arrays are not supported - deep-watching them would be too expensive\n          return false;\n        }\n\n        // fall-through to the primitive equality check\n      }\n\n      //Primitive or NaN\n      return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);\n    }\n\n    function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {\n      var inputExpressions = parsedExpression.inputs;\n      var lastResult;\n\n      if (inputExpressions.length === 1) {\n        var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails\n        inputExpressions = inputExpressions[0];\n        return scope.$watch(function expressionInputWatch(scope) {\n          var newInputValue = inputExpressions(scope);\n          if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {\n            lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);\n            oldInputValueOf = newInputValue && getValueOf(newInputValue);\n          }\n          return lastResult;\n        }, listener, objectEquality, prettyPrintExpression);\n      }\n\n      var oldInputValueOfValues = [];\n      var oldInputValues = [];\n      for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n        oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails\n        oldInputValues[i] = null;\n      }\n\n      return scope.$watch(function expressionInputsWatch(scope) {\n        var changed = false;\n\n        for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n          var newInputValue = inputExpressions[i](scope);\n          if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {\n            oldInputValues[i] = newInputValue;\n            oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);\n          }\n        }\n\n        if (changed) {\n          lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);\n        }\n\n        return lastResult;\n      }, listener, objectEquality, prettyPrintExpression);\n    }\n\n    function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch, lastValue;\n      return unwatch = scope.$watch(function oneTimeWatch(scope) {\n        return parsedExpression(scope);\n      }, function oneTimeListener(value, old, scope) {\n        lastValue = value;\n        if (isFunction(listener)) {\n          listener.apply(this, arguments);\n        }\n        if (isDefined(value)) {\n          scope.$$postDigest(function() {\n            if (isDefined(lastValue)) {\n              unwatch();\n            }\n          });\n        }\n      }, objectEquality);\n    }\n\n    function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch, lastValue;\n      return unwatch = scope.$watch(function oneTimeWatch(scope) {\n        return parsedExpression(scope);\n      }, function oneTimeListener(value, old, scope) {\n        lastValue = value;\n        if (isFunction(listener)) {\n          listener.call(this, value, old, scope);\n        }\n        if (isAllDefined(value)) {\n          scope.$$postDigest(function() {\n            if (isAllDefined(lastValue)) unwatch();\n          });\n        }\n      }, objectEquality);\n\n      function isAllDefined(value) {\n        var allDefined = true;\n        forEach(value, function(val) {\n          if (!isDefined(val)) allDefined = false;\n        });\n        return allDefined;\n      }\n    }\n\n    function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch;\n      return unwatch = scope.$watch(function constantWatch(scope) {\n        unwatch();\n        return parsedExpression(scope);\n      }, listener, objectEquality);\n    }\n\n    function addInterceptor(parsedExpression, interceptorFn) {\n      if (!interceptorFn) return parsedExpression;\n      var watchDelegate = parsedExpression.$$watchDelegate;\n      var useInputs = false;\n\n      var regularWatch =\n          watchDelegate !== oneTimeLiteralWatchDelegate &&\n          watchDelegate !== oneTimeWatchDelegate;\n\n      var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {\n        var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);\n        return interceptorFn(value, scope, locals);\n      } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {\n        var value = parsedExpression(scope, locals, assign, inputs);\n        var result = interceptorFn(value, scope, locals);\n        // we only return the interceptor's result if the\n        // initial value is defined (for bind-once)\n        return isDefined(value) ? result : value;\n      };\n\n      // Propagate $$watchDelegates other then inputsWatchDelegate\n      if (parsedExpression.$$watchDelegate &&\n          parsedExpression.$$watchDelegate !== inputsWatchDelegate) {\n        fn.$$watchDelegate = parsedExpression.$$watchDelegate;\n      } else if (!interceptorFn.$stateful) {\n        // If there is an interceptor, but no watchDelegate then treat the interceptor like\n        // we treat filters - it is assumed to be a pure function unless flagged with $stateful\n        fn.$$watchDelegate = inputsWatchDelegate;\n        useInputs = !parsedExpression.inputs;\n        fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];\n      }\n\n      return fn;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $q\n * @requires $rootScope\n *\n * @description\n * A service that helps you run functions asynchronously, and use their return values (or exceptions)\n * when they are done processing.\n *\n * This is an implementation of promises/deferred objects inspired by\n * [Kris Kowal's Q](https://github.com/kriskowal/q).\n *\n * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred\n * implementations, and the other which resembles ES6 (ES2015) promises to some degree.\n *\n * # $q constructor\n *\n * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`\n * function as the first argument. This is similar to the native Promise implementation from ES6,\n * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n *\n * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are\n * available yet.\n *\n * It can be used like so:\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     // perform some asynchronous operation, resolve or reject the promise when appropriate.\n *     return $q(function(resolve, reject) {\n *       setTimeout(function() {\n *         if (okToGreet(name)) {\n *           resolve('Hello, ' + name + '!');\n *         } else {\n *           reject('Greeting ' + name + ' is not allowed.');\n *         }\n *       }, 1000);\n *     });\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   });\n * ```\n *\n * Note: progress/notify callbacks are not currently supported via the ES6-style interface.\n *\n * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.\n *\n * However, the more traditional CommonJS-style usage is still available, and documented below.\n *\n * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an\n * interface for interacting with an object that represents the result of an action that is\n * performed asynchronously, and may or may not be finished at any given point in time.\n *\n * From the perspective of dealing with error handling, deferred and promise APIs are to\n * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     var deferred = $q.defer();\n *\n *     setTimeout(function() {\n *       deferred.notify('About to greet ' + name + '.');\n *\n *       if (okToGreet(name)) {\n *         deferred.resolve('Hello, ' + name + '!');\n *       } else {\n *         deferred.reject('Greeting ' + name + ' is not allowed.');\n *       }\n *     }, 1000);\n *\n *     return deferred.promise;\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   }, function(update) {\n *     alert('Got notification: ' + update);\n *   });\n * ```\n *\n * At first it might not be obvious why this extra complexity is worth the trouble. The payoff\n * comes in the way of guarantees that promise and deferred APIs make, see\n * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.\n *\n * Additionally the promise api allows for composition that is very hard to do with the\n * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.\n * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the\n * section on serial or parallel joining of promises.\n *\n * # The Deferred API\n *\n * A new instance of deferred is constructed by calling `$q.defer()`.\n *\n * The purpose of the deferred object is to expose the associated Promise instance as well as APIs\n * that can be used for signaling the successful or unsuccessful completion, as well as the status\n * of the task.\n *\n * **Methods**\n *\n * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection\n *   constructed via `$q.reject`, the promise will be rejected instead.\n * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to\n *   resolving it with a rejection constructed via `$q.reject`.\n * - `notify(value)` - provides updates on the status of the promise's execution. This may be called\n *   multiple times before the promise is either resolved or rejected.\n *\n * **Properties**\n *\n * - promise – `{Promise}` – promise object associated with this deferred.\n *\n *\n * # The Promise API\n *\n * A new promise instance is created when a deferred instance is created and can be retrieved by\n * calling `deferred.promise`.\n *\n * The purpose of the promise object is to allow for interested parties to get access to the result\n * of the deferred task when it completes.\n *\n * **Methods**\n *\n * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or\n *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously\n *   as soon as the result is available. The callbacks are called with a single argument: the result\n *   or rejection reason. Additionally, the notify callback may be called zero or more times to\n *   provide a progress indication, before the promise is resolved or rejected.\n *\n *   This method *returns a new promise* which is resolved or rejected via the return value of the\n *   `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved\n *   with the value which is resolved in that promise using\n *   [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).\n *   It also notifies via the return value of the `notifyCallback` method. The promise cannot be\n *   resolved or rejected from the notifyCallback method.\n *\n * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`\n *\n * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,\n *   but to do so without modifying the final value. This is useful to release resources or do some\n *   clean-up that needs to be done whether the promise was rejected or resolved. See the [full\n *   specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for\n *   more information.\n *\n * # Chaining promises\n *\n * Because calling the `then` method of a promise returns a new derived promise, it is easily\n * possible to create a chain of promises:\n *\n * ```js\n *   promiseB = promiseA.then(function(result) {\n *     return result + 1;\n *   });\n *\n *   // promiseB will be resolved immediately after promiseA is resolved and its value\n *   // will be the result of promiseA incremented by 1\n * ```\n *\n * It is possible to create chains of any length and since a promise can be resolved with another\n * promise (which will defer its resolution further), it is possible to pause/defer resolution of\n * the promises at any point in the chain. This makes it possible to implement powerful APIs like\n * $http's response interceptors.\n *\n *\n * # Differences between Kris Kowal's Q and $q\n *\n *  There are two main differences:\n *\n * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation\n *   mechanism in angular, which means faster propagation of resolution or rejection into your\n *   models and avoiding unnecessary browser repaints, which would result in flickering UI.\n * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains\n *   all the important functionality needed for common async tasks.\n *\n * # Testing\n *\n *  ```js\n *    it('should simulate promise', inject(function($q, $rootScope) {\n *      var deferred = $q.defer();\n *      var promise = deferred.promise;\n *      var resolvedValue;\n *\n *      promise.then(function(value) { resolvedValue = value; });\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Simulate resolving of promise\n *      deferred.resolve(123);\n *      // Note that the 'then' function does not get called synchronously.\n *      // This is because we want the promise API to always be async, whether or not\n *      // it got called synchronously or asynchronously.\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Propagate promise resolution to 'then' functions using $apply().\n *      $rootScope.$apply();\n *      expect(resolvedValue).toEqual(123);\n *    }));\n *  ```\n *\n * @param {function(function, function)} resolver Function which is responsible for resolving or\n *   rejecting the newly created promise. The first parameter is a function which resolves the\n *   promise, the second parameter is a function which rejects the promise.\n *\n * @returns {Promise} The newly created promise.\n */\nfunction $QProvider() {\n\n  this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $rootScope.$evalAsync(callback);\n    }, $exceptionHandler);\n  }];\n}\n\nfunction $$QProvider() {\n  this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $browser.defer(callback);\n    }, $exceptionHandler);\n  }];\n}\n\n/**\n * Constructs a promise manager.\n *\n * @param {function(function)} nextTick Function for executing functions in the next turn.\n * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for\n *     debugging purposes.\n * @returns {object} Promise manager.\n */\nfunction qFactory(nextTick, exceptionHandler) {\n  var $qMinErr = minErr('$q', TypeError);\n\n  /**\n   * @ngdoc method\n   * @name ng.$q#defer\n   * @kind function\n   *\n   * @description\n   * Creates a `Deferred` object which represents a task which will finish in the future.\n   *\n   * @returns {Deferred} Returns a new instance of deferred.\n   */\n  var defer = function() {\n    var d = new Deferred();\n    //Necessary to support unbound execution :/\n    d.resolve = simpleBind(d, d.resolve);\n    d.reject = simpleBind(d, d.reject);\n    d.notify = simpleBind(d, d.notify);\n    return d;\n  };\n\n  function Promise() {\n    this.$$state = { status: 0 };\n  }\n\n  extend(Promise.prototype, {\n    then: function(onFulfilled, onRejected, progressBack) {\n      if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {\n        return this;\n      }\n      var result = new Deferred();\n\n      this.$$state.pending = this.$$state.pending || [];\n      this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);\n      if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);\n\n      return result.promise;\n    },\n\n    \"catch\": function(callback) {\n      return this.then(null, callback);\n    },\n\n    \"finally\": function(callback, progressBack) {\n      return this.then(function(value) {\n        return handleCallback(value, true, callback);\n      }, function(error) {\n        return handleCallback(error, false, callback);\n      }, progressBack);\n    }\n  });\n\n  //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native\n  function simpleBind(context, fn) {\n    return function(value) {\n      fn.call(context, value);\n    };\n  }\n\n  function processQueue(state) {\n    var fn, deferred, pending;\n\n    pending = state.pending;\n    state.processScheduled = false;\n    state.pending = undefined;\n    for (var i = 0, ii = pending.length; i < ii; ++i) {\n      deferred = pending[i][0];\n      fn = pending[i][state.status];\n      try {\n        if (isFunction(fn)) {\n          deferred.resolve(fn(state.value));\n        } else if (state.status === 1) {\n          deferred.resolve(state.value);\n        } else {\n          deferred.reject(state.value);\n        }\n      } catch (e) {\n        deferred.reject(e);\n        exceptionHandler(e);\n      }\n    }\n  }\n\n  function scheduleProcessQueue(state) {\n    if (state.processScheduled || !state.pending) return;\n    state.processScheduled = true;\n    nextTick(function() { processQueue(state); });\n  }\n\n  function Deferred() {\n    this.promise = new Promise();\n  }\n\n  extend(Deferred.prototype, {\n    resolve: function(val) {\n      if (this.promise.$$state.status) return;\n      if (val === this.promise) {\n        this.$$reject($qMinErr(\n          'qcycle',\n          \"Expected promise to be resolved with value other than itself '{0}'\",\n          val));\n      } else {\n        this.$$resolve(val);\n      }\n\n    },\n\n    $$resolve: function(val) {\n      var then;\n      var that = this;\n      var done = false;\n      try {\n        if ((isObject(val) || isFunction(val))) then = val && val.then;\n        if (isFunction(then)) {\n          this.promise.$$state.status = -1;\n          then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));\n        } else {\n          this.promise.$$state.value = val;\n          this.promise.$$state.status = 1;\n          scheduleProcessQueue(this.promise.$$state);\n        }\n      } catch (e) {\n        rejectPromise(e);\n        exceptionHandler(e);\n      }\n\n      function resolvePromise(val) {\n        if (done) return;\n        done = true;\n        that.$$resolve(val);\n      }\n      function rejectPromise(val) {\n        if (done) return;\n        done = true;\n        that.$$reject(val);\n      }\n    },\n\n    reject: function(reason) {\n      if (this.promise.$$state.status) return;\n      this.$$reject(reason);\n    },\n\n    $$reject: function(reason) {\n      this.promise.$$state.value = reason;\n      this.promise.$$state.status = 2;\n      scheduleProcessQueue(this.promise.$$state);\n    },\n\n    notify: function(progress) {\n      var callbacks = this.promise.$$state.pending;\n\n      if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {\n        nextTick(function() {\n          var callback, result;\n          for (var i = 0, ii = callbacks.length; i < ii; i++) {\n            result = callbacks[i][0];\n            callback = callbacks[i][3];\n            try {\n              result.notify(isFunction(callback) ? callback(progress) : progress);\n            } catch (e) {\n              exceptionHandler(e);\n            }\n          }\n        });\n      }\n    }\n  });\n\n  /**\n   * @ngdoc method\n   * @name $q#reject\n   * @kind function\n   *\n   * @description\n   * Creates a promise that is resolved as rejected with the specified `reason`. This api should be\n   * used to forward rejection in a chain of promises. If you are dealing with the last promise in\n   * a promise chain, you don't need to worry about it.\n   *\n   * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of\n   * `reject` as the `throw` keyword in JavaScript. This also means that if you \"catch\" an error via\n   * a promise error callback and you want to forward the error to the promise derived from the\n   * current promise, you have to \"rethrow\" the error by returning a rejection constructed via\n   * `reject`.\n   *\n   * ```js\n   *   promiseB = promiseA.then(function(result) {\n   *     // success: do something and resolve promiseB\n   *     //          with the old or a new result\n   *     return result;\n   *   }, function(reason) {\n   *     // error: handle the error if possible and\n   *     //        resolve promiseB with newPromiseOrValue,\n   *     //        otherwise forward the rejection to promiseB\n   *     if (canHandle(reason)) {\n   *      // handle the error and recover\n   *      return newPromiseOrValue;\n   *     }\n   *     return $q.reject(reason);\n   *   });\n   * ```\n   *\n   * @param {*} reason Constant, message, exception or an object representing the rejection reason.\n   * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.\n   */\n  var reject = function(reason) {\n    var result = new Deferred();\n    result.reject(reason);\n    return result.promise;\n  };\n\n  var makePromise = function makePromise(value, resolved) {\n    var result = new Deferred();\n    if (resolved) {\n      result.resolve(value);\n    } else {\n      result.reject(value);\n    }\n    return result.promise;\n  };\n\n  var handleCallback = function handleCallback(value, isResolved, callback) {\n    var callbackOutput = null;\n    try {\n      if (isFunction(callback)) callbackOutput = callback();\n    } catch (e) {\n      return makePromise(e, false);\n    }\n    if (isPromiseLike(callbackOutput)) {\n      return callbackOutput.then(function() {\n        return makePromise(value, isResolved);\n      }, function(error) {\n        return makePromise(error, false);\n      });\n    } else {\n      return makePromise(value, isResolved);\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $q#when\n   * @kind function\n   *\n   * @description\n   * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.\n   * This is useful when you are dealing with an object that might or might not be a promise, or if\n   * the promise comes from a source that can't be trusted.\n   *\n   * @param {*} value Value or a promise\n   * @param {Function=} successCallback\n   * @param {Function=} errorCallback\n   * @param {Function=} progressCallback\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n\n\n  var when = function(value, callback, errback, progressBack) {\n    var result = new Deferred();\n    result.resolve(value);\n    return result.promise.then(callback, errback, progressBack);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $q#resolve\n   * @kind function\n   *\n   * @description\n   * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.\n   *\n   * @param {*} value Value or a promise\n   * @param {Function=} successCallback\n   * @param {Function=} errorCallback\n   * @param {Function=} progressCallback\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n  var resolve = when;\n\n  /**\n   * @ngdoc method\n   * @name $q#all\n   * @kind function\n   *\n   * @description\n   * Combines multiple promises into a single promise that is resolved when all of the input\n   * promises are resolved.\n   *\n   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.\n   * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,\n   *   each value corresponding to the promise at the same index/key in the `promises` array/hash.\n   *   If any of the promises is resolved with a rejection, this resulting promise will be rejected\n   *   with the same rejection value.\n   */\n\n  function all(promises) {\n    var deferred = new Deferred(),\n        counter = 0,\n        results = isArray(promises) ? [] : {};\n\n    forEach(promises, function(promise, key) {\n      counter++;\n      when(promise).then(function(value) {\n        if (results.hasOwnProperty(key)) return;\n        results[key] = value;\n        if (!(--counter)) deferred.resolve(results);\n      }, function(reason) {\n        if (results.hasOwnProperty(key)) return;\n        deferred.reject(reason);\n      });\n    });\n\n    if (counter === 0) {\n      deferred.resolve(results);\n    }\n\n    return deferred.promise;\n  }\n\n  var $Q = function Q(resolver) {\n    if (!isFunction(resolver)) {\n      throw $qMinErr('norslvr', \"Expected resolverFn, got '{0}'\", resolver);\n    }\n\n    var deferred = new Deferred();\n\n    function resolveFn(value) {\n      deferred.resolve(value);\n    }\n\n    function rejectFn(reason) {\n      deferred.reject(reason);\n    }\n\n    resolver(resolveFn, rejectFn);\n\n    return deferred.promise;\n  };\n\n  // Let's make the instanceof operator work for promises, so that\n  // `new $q(fn) instanceof $q` would evaluate to true.\n  $Q.prototype = Promise.prototype;\n\n  $Q.defer = defer;\n  $Q.reject = reject;\n  $Q.when = when;\n  $Q.resolve = resolve;\n  $Q.all = all;\n\n  return $Q;\n}\n\nfunction $$RAFProvider() { //rAF\n  this.$get = ['$window', '$timeout', function($window, $timeout) {\n    var requestAnimationFrame = $window.requestAnimationFrame ||\n                                $window.webkitRequestAnimationFrame;\n\n    var cancelAnimationFrame = $window.cancelAnimationFrame ||\n                               $window.webkitCancelAnimationFrame ||\n                               $window.webkitCancelRequestAnimationFrame;\n\n    var rafSupported = !!requestAnimationFrame;\n    var raf = rafSupported\n      ? function(fn) {\n          var id = requestAnimationFrame(fn);\n          return function() {\n            cancelAnimationFrame(id);\n          };\n        }\n      : function(fn) {\n          var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666\n          return function() {\n            $timeout.cancel(timer);\n          };\n        };\n\n    raf.supported = rafSupported;\n\n    return raf;\n  }];\n}\n\n/**\n * DESIGN NOTES\n *\n * The design decisions behind the scope are heavily favored for speed and memory consumption.\n *\n * The typical use of scope is to watch the expressions, which most of the time return the same\n * value as last time so we optimize the operation.\n *\n * Closures construction is expensive in terms of speed as well as memory:\n *   - No closures, instead use prototypical inheritance for API\n *   - Internal state needs to be stored on scope directly, which means that private state is\n *     exposed as $$____ properties\n *\n * Loop operations are optimized by using while(count--) { ... }\n *   - This means that in order to keep the same order of execution as addition we have to add\n *     items to the array at the beginning (unshift) instead of at the end (push)\n *\n * Child scopes are created and removed often\n *   - Using an array would be slow since inserts in the middle are expensive; so we use linked lists\n *\n * There are fewer watches than observers. This is why you don't want the observer to be implemented\n * in the same way as watch. Watch requires return of the initialization function which is expensive\n * to construct.\n */\n\n\n/**\n * @ngdoc provider\n * @name $rootScopeProvider\n * @description\n *\n * Provider for the $rootScope service.\n */\n\n/**\n * @ngdoc method\n * @name $rootScopeProvider#digestTtl\n * @description\n *\n * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and\n * assuming that the model is unstable.\n *\n * The current default is 10 iterations.\n *\n * In complex applications it's possible that the dependencies between `$watch`s will result in\n * several digest iterations. However if an application needs more than the default 10 digest\n * iterations for its model to stabilize then you should investigate what is causing the model to\n * continuously change during the digest.\n *\n * Increasing the TTL could have performance implications, so you should not change it without\n * proper justification.\n *\n * @param {number} limit The number of digest iterations.\n */\n\n\n/**\n * @ngdoc service\n * @name $rootScope\n * @description\n *\n * Every application has a single root {@link ng.$rootScope.Scope scope}.\n * All other scopes are descendant scopes of the root scope. Scopes provide separation\n * between the model and the view, via a mechanism for watching the model for changes.\n * They also provide event emission/broadcast and subscription facility. See the\n * {@link guide/scope developer guide on scopes}.\n */\nfunction $RootScopeProvider() {\n  var TTL = 10;\n  var $rootScopeMinErr = minErr('$rootScope');\n  var lastDirtyWatch = null;\n  var applyAsyncId = null;\n\n  this.digestTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n    }\n    return TTL;\n  };\n\n  function createChildScopeClass(parent) {\n    function ChildScope() {\n      this.$$watchers = this.$$nextSibling =\n          this.$$childHead = this.$$childTail = null;\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$watchersCount = 0;\n      this.$id = nextUid();\n      this.$$ChildScope = null;\n    }\n    ChildScope.prototype = parent;\n    return ChildScope;\n  }\n\n  this.$get = ['$exceptionHandler', '$parse', '$browser',\n      function($exceptionHandler, $parse, $browser) {\n\n    function destroyChildScope($event) {\n        $event.currentScope.$$destroyed = true;\n    }\n\n    function cleanUpScope($scope) {\n\n      if (msie === 9) {\n        // There is a memory leak in IE9 if all child scopes are not disconnected\n        // completely when a scope is destroyed. So this code will recurse up through\n        // all this scopes children\n        //\n        // See issue https://github.com/angular/angular.js/issues/10706\n        $scope.$$childHead && cleanUpScope($scope.$$childHead);\n        $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);\n      }\n\n      // The code below works around IE9 and V8's memory leaks\n      //\n      // See:\n      // - https://code.google.com/p/v8/issues/detail?id=2073#c26\n      // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909\n      // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451\n\n      $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =\n          $scope.$$childTail = $scope.$root = $scope.$$watchers = null;\n    }\n\n    /**\n     * @ngdoc type\n     * @name $rootScope.Scope\n     *\n     * @description\n     * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the\n     * {@link auto.$injector $injector}. Child scopes are created using the\n     * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when\n     * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for\n     * an in-depth introduction and usage examples.\n     *\n     *\n     * # Inheritance\n     * A scope can inherit from a parent scope, as in this example:\n     * ```js\n         var parent = $rootScope;\n         var child = parent.$new();\n\n         parent.salutation = \"Hello\";\n         expect(child.salutation).toEqual('Hello');\n\n         child.salutation = \"Welcome\";\n         expect(child.salutation).toEqual('Welcome');\n         expect(parent.salutation).toEqual('Hello');\n     * ```\n     *\n     * When interacting with `Scope` in tests, additional helper methods are available on the\n     * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional\n     * details.\n     *\n     *\n     * @param {Object.<string, function()>=} providers Map of service factory which need to be\n     *                                       provided for the current scope. Defaults to {@link ng}.\n     * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should\n     *                              append/override services provided by `providers`. This is handy\n     *                              when unit-testing and having the need to override a default\n     *                              service.\n     * @returns {Object} Newly created scope.\n     *\n     */\n    function Scope() {\n      this.$id = nextUid();\n      this.$$phase = this.$parent = this.$$watchers =\n                     this.$$nextSibling = this.$$prevSibling =\n                     this.$$childHead = this.$$childTail = null;\n      this.$root = this;\n      this.$$destroyed = false;\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$watchersCount = 0;\n      this.$$isolateBindings = null;\n    }\n\n    /**\n     * @ngdoc property\n     * @name $rootScope.Scope#$id\n     *\n     * @description\n     * Unique scope ID (monotonically increasing) useful for debugging.\n     */\n\n     /**\n      * @ngdoc property\n      * @name $rootScope.Scope#$parent\n      *\n      * @description\n      * Reference to the parent scope.\n      */\n\n      /**\n       * @ngdoc property\n       * @name $rootScope.Scope#$root\n       *\n       * @description\n       * Reference to the root scope.\n       */\n\n    Scope.prototype = {\n      constructor: Scope,\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$new\n       * @kind function\n       *\n       * @description\n       * Creates a new child {@link ng.$rootScope.Scope scope}.\n       *\n       * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.\n       * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.\n       *\n       * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is\n       * desired for the scope and its child scopes to be permanently detached from the parent and\n       * thus stop participating in model change detection and listener notification by invoking.\n       *\n       * @param {boolean} isolate If true, then the scope does not prototypically inherit from the\n       *         parent scope. The scope is isolated, as it can not see parent scope properties.\n       *         When creating widgets, it is useful for the widget to not accidentally read parent\n       *         state.\n       *\n       * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`\n       *                              of the newly created scope. Defaults to `this` scope if not provided.\n       *                              This is used when creating a transclude scope to correctly place it\n       *                              in the scope hierarchy while maintaining the correct prototypical\n       *                              inheritance.\n       *\n       * @returns {Object} The newly created child scope.\n       *\n       */\n      $new: function(isolate, parent) {\n        var child;\n\n        parent = parent || this;\n\n        if (isolate) {\n          child = new Scope();\n          child.$root = this.$root;\n        } else {\n          // Only create a child scope class if somebody asks for one,\n          // but cache it to allow the VM to optimize lookups.\n          if (!this.$$ChildScope) {\n            this.$$ChildScope = createChildScopeClass(this);\n          }\n          child = new this.$$ChildScope();\n        }\n        child.$parent = parent;\n        child.$$prevSibling = parent.$$childTail;\n        if (parent.$$childHead) {\n          parent.$$childTail.$$nextSibling = child;\n          parent.$$childTail = child;\n        } else {\n          parent.$$childHead = parent.$$childTail = child;\n        }\n\n        // When the new scope is not isolated or we inherit from `this`, and\n        // the parent scope is destroyed, the property `$$destroyed` is inherited\n        // prototypically. In all other cases, this property needs to be set\n        // when the parent scope is destroyed.\n        // The listener needs to be added after the parent is set\n        if (isolate || parent != this) child.$on('$destroy', destroyChildScope);\n\n        return child;\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watch\n       * @kind function\n       *\n       * @description\n       * Registers a `listener` callback to be executed whenever the `watchExpression` changes.\n       *\n       * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest\n       *   $digest()} and should return the value that will be watched. (`watchExpression` should not change\n       *   its value when executed multiple times with the same input because it may be executed multiple\n       *   times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be\n       *   [idempotent](http://en.wikipedia.org/wiki/Idempotence).\n       * - The `listener` is called only when the value from the current `watchExpression` and the\n       *   previous call to `watchExpression` are not equal (with the exception of the initial run,\n       *   see below). Inequality is determined according to reference inequality,\n       *   [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)\n       *    via the `!==` Javascript operator, unless `objectEquality == true`\n       *   (see next point)\n       * - When `objectEquality == true`, inequality of the `watchExpression` is determined\n       *   according to the {@link angular.equals} function. To save the value of the object for\n       *   later comparison, the {@link angular.copy} function is used. This therefore means that\n       *   watching complex objects will have adverse memory and performance implications.\n       * - The watch `listener` may change the model, which may trigger other `listener`s to fire.\n       *   This is achieved by rerunning the watchers until no changes are detected. The rerun\n       *   iteration limit is 10 to prevent an infinite loop deadlock.\n       *\n       *\n       * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,\n       * you can register a `watchExpression` function with no `listener`. (Be prepared for\n       * multiple calls to your `watchExpression` because it will execute multiple times in a\n       * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)\n       *\n       * After a watcher is registered with the scope, the `listener` fn is called asynchronously\n       * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the\n       * watcher. In rare cases, this is undesirable because the listener is called when the result\n       * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you\n       * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the\n       * listener was called due to initialization.\n       *\n       *\n       *\n       * # Example\n       * ```js\n           // let's assume that scope was dependency injected as the $rootScope\n           var scope = $rootScope;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n\n\n\n           // Using a function as a watchExpression\n           var food;\n           scope.foodCounter = 0;\n           expect(scope.foodCounter).toEqual(0);\n           scope.$watch(\n             // This function returns the value being watched. It is called for each turn of the $digest loop\n             function() { return food; },\n             // This is the change listener, called when the value returned from the above function changes\n             function(newValue, oldValue) {\n               if ( newValue !== oldValue ) {\n                 // Only increment the counter if the value changed\n                 scope.foodCounter = scope.foodCounter + 1;\n               }\n             }\n           );\n           // No digest has been run so the counter will be zero\n           expect(scope.foodCounter).toEqual(0);\n\n           // Run the digest but since food has not changed count will still be zero\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(0);\n\n           // Update food and run digest.  Now the counter will increment\n           food = 'cheeseburger';\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(1);\n\n       * ```\n       *\n       *\n       *\n       * @param {(function()|string)} watchExpression Expression that is evaluated on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers\n       *    a call to the `listener`.\n       *\n       *    - `string`: Evaluated as {@link guide/expression expression}\n       *    - `function(scope)`: called with current `scope` as a parameter.\n       * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value\n       *    of `watchExpression` changes.\n       *\n       *    - `newVal` contains the current value of the `watchExpression`\n       *    - `oldVal` contains the previous value of the `watchExpression`\n       *    - `scope` refers to the current scope\n       * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of\n       *     comparing for reference equality.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {\n        var get = $parse(watchExp);\n\n        if (get.$$watchDelegate) {\n          return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);\n        }\n        var scope = this,\n            array = scope.$$watchers,\n            watcher = {\n              fn: listener,\n              last: initWatchVal,\n              get: get,\n              exp: prettyPrintExpression || watchExp,\n              eq: !!objectEquality\n            };\n\n        lastDirtyWatch = null;\n\n        if (!isFunction(listener)) {\n          watcher.fn = noop;\n        }\n\n        if (!array) {\n          array = scope.$$watchers = [];\n        }\n        // we use unshift since we use a while loop in $digest for speed.\n        // the while loop reads in reverse order.\n        array.unshift(watcher);\n        incrementWatchersCount(this, 1);\n\n        return function deregisterWatch() {\n          if (arrayRemove(array, watcher) >= 0) {\n            incrementWatchersCount(scope, -1);\n          }\n          lastDirtyWatch = null;\n        };\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchGroup\n       * @kind function\n       *\n       * @description\n       * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.\n       * If any one expression in the collection changes the `listener` is executed.\n       *\n       * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every\n       *   call to $digest() to see if any items changes.\n       * - The `listener` is called whenever any expression in the `watchExpressions` array changes.\n       *\n       * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually\n       * watched using {@link ng.$rootScope.Scope#$watch $watch()}\n       *\n       * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any\n       *    expression in `watchExpressions` changes\n       *    The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching\n       *    those of `watchExpression`\n       *    and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching\n       *    those of `watchExpression`\n       *    The `scope` refers to the current scope.\n       * @returns {function()} Returns a de-registration function for all listeners.\n       */\n      $watchGroup: function(watchExpressions, listener) {\n        var oldValues = new Array(watchExpressions.length);\n        var newValues = new Array(watchExpressions.length);\n        var deregisterFns = [];\n        var self = this;\n        var changeReactionScheduled = false;\n        var firstRun = true;\n\n        if (!watchExpressions.length) {\n          // No expressions means we call the listener ASAP\n          var shouldCall = true;\n          self.$evalAsync(function() {\n            if (shouldCall) listener(newValues, newValues, self);\n          });\n          return function deregisterWatchGroup() {\n            shouldCall = false;\n          };\n        }\n\n        if (watchExpressions.length === 1) {\n          // Special case size of one\n          return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {\n            newValues[0] = value;\n            oldValues[0] = oldValue;\n            listener(newValues, (value === oldValue) ? newValues : oldValues, scope);\n          });\n        }\n\n        forEach(watchExpressions, function(expr, i) {\n          var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {\n            newValues[i] = value;\n            oldValues[i] = oldValue;\n            if (!changeReactionScheduled) {\n              changeReactionScheduled = true;\n              self.$evalAsync(watchGroupAction);\n            }\n          });\n          deregisterFns.push(unwatchFn);\n        });\n\n        function watchGroupAction() {\n          changeReactionScheduled = false;\n\n          if (firstRun) {\n            firstRun = false;\n            listener(newValues, newValues, self);\n          } else {\n            listener(newValues, oldValues, self);\n          }\n        }\n\n        return function deregisterWatchGroup() {\n          while (deregisterFns.length) {\n            deregisterFns.shift()();\n          }\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchCollection\n       * @kind function\n       *\n       * @description\n       * Shallow watches the properties of an object and fires whenever any of the properties change\n       * (for arrays, this implies watching the array items; for object maps, this implies watching\n       * the properties). If a change is detected, the `listener` callback is fired.\n       *\n       * - The `obj` collection is observed via standard $watch operation and is examined on every\n       *   call to $digest() to see if any items have been added, removed, or moved.\n       * - The `listener` is called whenever anything within the `obj` has changed. Examples include\n       *   adding, removing, and moving items belonging to an object or array.\n       *\n       *\n       * # Example\n       * ```js\n          $scope.names = ['igor', 'matias', 'misko', 'james'];\n          $scope.dataCount = 4;\n\n          $scope.$watchCollection('names', function(newNames, oldNames) {\n            $scope.dataCount = newNames.length;\n          });\n\n          expect($scope.dataCount).toEqual(4);\n          $scope.$digest();\n\n          //still at 4 ... no changes\n          expect($scope.dataCount).toEqual(4);\n\n          $scope.names.pop();\n          $scope.$digest();\n\n          //now there's been a change\n          expect($scope.dataCount).toEqual(3);\n       * ```\n       *\n       *\n       * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The\n       *    expression value should evaluate to an object or an array which is observed on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the\n       *    collection will trigger a call to the `listener`.\n       *\n       * @param {function(newCollection, oldCollection, scope)} listener a callback function called\n       *    when a change is detected.\n       *    - The `newCollection` object is the newly modified data obtained from the `obj` expression\n       *    - The `oldCollection` object is a copy of the former collection data.\n       *      Due to performance considerations, the`oldCollection` value is computed only if the\n       *      `listener` function declares two or more arguments.\n       *    - The `scope` argument refers to the current scope.\n       *\n       * @returns {function()} Returns a de-registration function for this listener. When the\n       *    de-registration function is executed, the internal watch operation is terminated.\n       */\n      $watchCollection: function(obj, listener) {\n        $watchCollectionInterceptor.$stateful = true;\n\n        var self = this;\n        // the current value, updated on each dirty-check run\n        var newValue;\n        // a shallow copy of the newValue from the last dirty-check run,\n        // updated to match newValue during dirty-check run\n        var oldValue;\n        // a shallow copy of the newValue from when the last change happened\n        var veryOldValue;\n        // only track veryOldValue if the listener is asking for it\n        var trackVeryOldValue = (listener.length > 1);\n        var changeDetected = 0;\n        var changeDetector = $parse(obj, $watchCollectionInterceptor);\n        var internalArray = [];\n        var internalObject = {};\n        var initRun = true;\n        var oldLength = 0;\n\n        function $watchCollectionInterceptor(_value) {\n          newValue = _value;\n          var newLength, key, bothNaN, newItem, oldItem;\n\n          // If the new value is undefined, then return undefined as the watch may be a one-time watch\n          if (isUndefined(newValue)) return;\n\n          if (!isObject(newValue)) { // if primitive\n            if (oldValue !== newValue) {\n              oldValue = newValue;\n              changeDetected++;\n            }\n          } else if (isArrayLike(newValue)) {\n            if (oldValue !== internalArray) {\n              // we are transitioning from something which was not an array into array.\n              oldValue = internalArray;\n              oldLength = oldValue.length = 0;\n              changeDetected++;\n            }\n\n            newLength = newValue.length;\n\n            if (oldLength !== newLength) {\n              // if lengths do not match we need to trigger change notification\n              changeDetected++;\n              oldValue.length = oldLength = newLength;\n            }\n            // copy the items to oldValue and look for changes.\n            for (var i = 0; i < newLength; i++) {\n              oldItem = oldValue[i];\n              newItem = newValue[i];\n\n              bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n              if (!bothNaN && (oldItem !== newItem)) {\n                changeDetected++;\n                oldValue[i] = newItem;\n              }\n            }\n          } else {\n            if (oldValue !== internalObject) {\n              // we are transitioning from something which was not an object into object.\n              oldValue = internalObject = {};\n              oldLength = 0;\n              changeDetected++;\n            }\n            // copy the items to oldValue and look for changes.\n            newLength = 0;\n            for (key in newValue) {\n              if (hasOwnProperty.call(newValue, key)) {\n                newLength++;\n                newItem = newValue[key];\n                oldItem = oldValue[key];\n\n                if (key in oldValue) {\n                  bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n                  if (!bothNaN && (oldItem !== newItem)) {\n                    changeDetected++;\n                    oldValue[key] = newItem;\n                  }\n                } else {\n                  oldLength++;\n                  oldValue[key] = newItem;\n                  changeDetected++;\n                }\n              }\n            }\n            if (oldLength > newLength) {\n              // we used to have more keys, need to find them and destroy them.\n              changeDetected++;\n              for (key in oldValue) {\n                if (!hasOwnProperty.call(newValue, key)) {\n                  oldLength--;\n                  delete oldValue[key];\n                }\n              }\n            }\n          }\n          return changeDetected;\n        }\n\n        function $watchCollectionAction() {\n          if (initRun) {\n            initRun = false;\n            listener(newValue, newValue, self);\n          } else {\n            listener(newValue, veryOldValue, self);\n          }\n\n          // make a copy for the next time a collection is changed\n          if (trackVeryOldValue) {\n            if (!isObject(newValue)) {\n              //primitive\n              veryOldValue = newValue;\n            } else if (isArrayLike(newValue)) {\n              veryOldValue = new Array(newValue.length);\n              for (var i = 0; i < newValue.length; i++) {\n                veryOldValue[i] = newValue[i];\n              }\n            } else { // if object\n              veryOldValue = {};\n              for (var key in newValue) {\n                if (hasOwnProperty.call(newValue, key)) {\n                  veryOldValue[key] = newValue[key];\n                }\n              }\n            }\n          }\n        }\n\n        return this.$watch(changeDetector, $watchCollectionAction);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$digest\n       * @kind function\n       *\n       * @description\n       * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and\n       * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change\n       * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}\n       * until no more listeners are firing. This means that it is possible to get into an infinite\n       * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of\n       * iterations exceeds 10.\n       *\n       * Usually, you don't call `$digest()` directly in\n       * {@link ng.directive:ngController controllers} or in\n       * {@link ng.$compileProvider#directive directives}.\n       * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within\n       * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.\n       *\n       * If you want to be notified whenever `$digest()` is called,\n       * you can register a `watchExpression` function with\n       * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.\n       *\n       * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.\n       *\n       * # Example\n       * ```js\n           var scope = ...;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n       * ```\n       *\n       */\n      $digest: function() {\n        var watch, value, last, fn, get,\n            watchers,\n            length,\n            dirty, ttl = TTL,\n            next, current, target = this,\n            watchLog = [],\n            logIdx, asyncTask;\n\n        beginPhase('$digest');\n        // Check for changes to browser url that happened in sync before the call to $digest\n        $browser.$$checkUrlChange();\n\n        if (this === $rootScope && applyAsyncId !== null) {\n          // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then\n          // cancel the scheduled $apply and flush the queue of expressions to be evaluated.\n          $browser.defer.cancel(applyAsyncId);\n          flushApplyAsync();\n        }\n\n        lastDirtyWatch = null;\n\n        do { // \"while dirty\" loop\n          dirty = false;\n          current = target;\n\n          while (asyncQueue.length) {\n            try {\n              asyncTask = asyncQueue.shift();\n              asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n            lastDirtyWatch = null;\n          }\n\n          traverseScopesLoop:\n          do { // \"traverse the scopes\" loop\n            if ((watchers = current.$$watchers)) {\n              // process our watches\n              length = watchers.length;\n              while (length--) {\n                try {\n                  watch = watchers[length];\n                  // Most common watches are on primitives, in which case we can short\n                  // circuit it with === operator, only when === fails do we use .equals\n                  if (watch) {\n                    get = watch.get;\n                    if ((value = get(current)) !== (last = watch.last) &&\n                        !(watch.eq\n                            ? equals(value, last)\n                            : (typeof value === 'number' && typeof last === 'number'\n                               && isNaN(value) && isNaN(last)))) {\n                      dirty = true;\n                      lastDirtyWatch = watch;\n                      watch.last = watch.eq ? copy(value, null) : value;\n                      fn = watch.fn;\n                      fn(value, ((last === initWatchVal) ? value : last), current);\n                      if (ttl < 5) {\n                        logIdx = 4 - ttl;\n                        if (!watchLog[logIdx]) watchLog[logIdx] = [];\n                        watchLog[logIdx].push({\n                          msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,\n                          newVal: value,\n                          oldVal: last\n                        });\n                      }\n                    } else if (watch === lastDirtyWatch) {\n                      // If the most recently dirty watcher is now clean, short circuit since the remaining watchers\n                      // have already been tested.\n                      dirty = false;\n                      break traverseScopesLoop;\n                    }\n                  }\n                } catch (e) {\n                  $exceptionHandler(e);\n                }\n              }\n            }\n\n            // Insanity Warning: scope depth-first traversal\n            // yes, this code is a bit crazy, but it works and we have tests to prove it!\n            // this piece should be kept in sync with the traversal in $broadcast\n            if (!(next = ((current.$$watchersCount && current.$$childHead) ||\n                (current !== target && current.$$nextSibling)))) {\n              while (current !== target && !(next = current.$$nextSibling)) {\n                current = current.$parent;\n              }\n            }\n          } while ((current = next));\n\n          // `break traverseScopesLoop;` takes us to here\n\n          if ((dirty || asyncQueue.length) && !(ttl--)) {\n            clearPhase();\n            throw $rootScopeMinErr('infdig',\n                '{0} $digest() iterations reached. Aborting!\\n' +\n                'Watchers fired in the last 5 iterations: {1}',\n                TTL, watchLog);\n          }\n\n        } while (dirty || asyncQueue.length);\n\n        clearPhase();\n\n        while (postDigestQueue.length) {\n          try {\n            postDigestQueue.shift()();\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        }\n      },\n\n\n      /**\n       * @ngdoc event\n       * @name $rootScope.Scope#$destroy\n       * @eventType broadcast on scope being destroyed\n       *\n       * @description\n       * Broadcasted when a scope and its children are being destroyed.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$destroy\n       * @kind function\n       *\n       * @description\n       * Removes the current scope (and all of its children) from the parent scope. Removal implies\n       * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer\n       * propagate to the current scope and its children. Removal also implies that the current\n       * scope is eligible for garbage collection.\n       *\n       * The `$destroy()` is usually used by directives such as\n       * {@link ng.directive:ngRepeat ngRepeat} for managing the\n       * unrolling of the loop.\n       *\n       * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.\n       * Application code can register a `$destroy` event handler that will give it a chance to\n       * perform any necessary cleanup.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n      $destroy: function() {\n        // We can't destroy a scope that has been already destroyed.\n        if (this.$$destroyed) return;\n        var parent = this.$parent;\n\n        this.$broadcast('$destroy');\n        this.$$destroyed = true;\n\n        if (this === $rootScope) {\n          //Remove handlers attached to window when $rootScope is removed\n          $browser.$$applicationDestroyed();\n        }\n\n        incrementWatchersCount(this, -this.$$watchersCount);\n        for (var eventName in this.$$listenerCount) {\n          decrementListenerCount(this, this.$$listenerCount[eventName], eventName);\n        }\n\n        // sever all the references to parent scopes (after this cleanup, the current scope should\n        // not be retained by any of our references and should be eligible for garbage collection)\n        if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;\n        if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;\n        if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;\n        if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;\n\n        // Disable listeners, watchers and apply/digest methods\n        this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;\n        this.$on = this.$watch = this.$watchGroup = function() { return noop; };\n        this.$$listeners = {};\n\n        // Disconnect the next sibling to prevent `cleanUpScope` destroying those too\n        this.$$nextSibling = null;\n        cleanUpScope(this);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$eval\n       * @kind function\n       *\n       * @description\n       * Executes the `expression` on the current scope and returns the result. Any exceptions in\n       * the expression are propagated (uncaught). This is useful when evaluating Angular\n       * expressions.\n       *\n       * # Example\n       * ```js\n           var scope = ng.$rootScope.Scope();\n           scope.a = 1;\n           scope.b = 2;\n\n           expect(scope.$eval('a+b')).toEqual(3);\n           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);\n       * ```\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in  {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       * @returns {*} The result of evaluating the expression.\n       */\n      $eval: function(expr, locals) {\n        return $parse(expr)(this, locals);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$evalAsync\n       * @kind function\n       *\n       * @description\n       * Executes the expression on the current scope at a later point in time.\n       *\n       * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only\n       * that:\n       *\n       *   - it will execute after the function that scheduled the evaluation (preferably before DOM\n       *     rendering).\n       *   - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after\n       *     `expression` execution.\n       *\n       * Any exceptions from the execution of the expression are forwarded to the\n       * {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle\n       * will be scheduled. However, it is encouraged to always call code that changes the model\n       * from within an `$apply` call. That includes code evaluated via `$evalAsync`.\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       */\n      $evalAsync: function(expr, locals) {\n        // if we are outside of an $digest loop and this is the first time we are scheduling async\n        // task also schedule async auto-flush\n        if (!$rootScope.$$phase && !asyncQueue.length) {\n          $browser.defer(function() {\n            if (asyncQueue.length) {\n              $rootScope.$digest();\n            }\n          });\n        }\n\n        asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});\n      },\n\n      $$postDigest: function(fn) {\n        postDigestQueue.push(fn);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$apply\n       * @kind function\n       *\n       * @description\n       * `$apply()` is used to execute an expression in angular from outside of the angular\n       * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).\n       * Because we are calling into the angular framework we need to perform proper scope life\n       * cycle of {@link ng.$exceptionHandler exception handling},\n       * {@link ng.$rootScope.Scope#$digest executing watches}.\n       *\n       * ## Life cycle\n       *\n       * # Pseudo-Code of `$apply()`\n       * ```js\n           function $apply(expr) {\n             try {\n               return $eval(expr);\n             } catch (e) {\n               $exceptionHandler(e);\n             } finally {\n               $root.$digest();\n             }\n           }\n       * ```\n       *\n       *\n       * Scope's `$apply()` method transitions through the following stages:\n       *\n       * 1. The {@link guide/expression expression} is executed using the\n       *    {@link ng.$rootScope.Scope#$eval $eval()} method.\n       * 2. Any exceptions from the execution of the expression are forwarded to the\n       *    {@link ng.$exceptionHandler $exceptionHandler} service.\n       * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the\n       *    expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.\n       *\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       *\n       * @returns {*} The result of evaluating the expression.\n       */\n      $apply: function(expr) {\n        try {\n          beginPhase('$apply');\n          try {\n            return this.$eval(expr);\n          } finally {\n            clearPhase();\n          }\n        } catch (e) {\n          $exceptionHandler(e);\n        } finally {\n          try {\n            $rootScope.$digest();\n          } catch (e) {\n            $exceptionHandler(e);\n            throw e;\n          }\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$applyAsync\n       * @kind function\n       *\n       * @description\n       * Schedule the invocation of $apply to occur at a later time. The actual time difference\n       * varies across browsers, but is typically around ~10 milliseconds.\n       *\n       * This can be used to queue up multiple expressions which need to be evaluated in the same\n       * digest.\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       */\n      $applyAsync: function(expr) {\n        var scope = this;\n        expr && applyAsyncQueue.push($applyAsyncExpression);\n        expr = $parse(expr);\n        scheduleApplyAsync();\n\n        function $applyAsyncExpression() {\n          scope.$eval(expr);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$on\n       * @kind function\n       *\n       * @description\n       * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for\n       * discussion of event life cycle.\n       *\n       * The event listener function format is: `function(event, args...)`. The `event` object\n       * passed into the listener has the following attributes:\n       *\n       *   - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or\n       *     `$broadcast`-ed.\n       *   - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the\n       *     event propagates through the scope hierarchy, this property is set to null.\n       *   - `name` - `{string}`: name of the event.\n       *   - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel\n       *     further event propagation (available only for events that were `$emit`-ed).\n       *   - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag\n       *     to true.\n       *   - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.\n       *\n       * @param {string} name Event name to listen on.\n       * @param {function(event, ...args)} listener Function to call when the event is emitted.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $on: function(name, listener) {\n        var namedListeners = this.$$listeners[name];\n        if (!namedListeners) {\n          this.$$listeners[name] = namedListeners = [];\n        }\n        namedListeners.push(listener);\n\n        var current = this;\n        do {\n          if (!current.$$listenerCount[name]) {\n            current.$$listenerCount[name] = 0;\n          }\n          current.$$listenerCount[name]++;\n        } while ((current = current.$parent));\n\n        var self = this;\n        return function() {\n          var indexOfListener = namedListeners.indexOf(listener);\n          if (indexOfListener !== -1) {\n            namedListeners[indexOfListener] = null;\n            decrementListenerCount(self, 1, name);\n          }\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$emit\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` upwards through the scope hierarchy notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$emit` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event traverses upwards toward the root scope and calls all\n       * registered listeners along the way. The event will stop propagating if one of the listeners\n       * cancels it.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to emit.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).\n       */\n      $emit: function(name, args) {\n        var empty = [],\n            namedListeners,\n            scope = this,\n            stopPropagation = false,\n            event = {\n              name: name,\n              targetScope: scope,\n              stopPropagation: function() {stopPropagation = true;},\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            },\n            listenerArgs = concat([event], arguments, 1),\n            i, length;\n\n        do {\n          namedListeners = scope.$$listeners[name] || empty;\n          event.currentScope = scope;\n          for (i = 0, length = namedListeners.length; i < length; i++) {\n\n            // if listeners were deregistered, defragment the array\n            if (!namedListeners[i]) {\n              namedListeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n            try {\n              //allow all listeners attached to the current scope to run\n              namedListeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n          //if any listener on the current scope stops propagation, prevent bubbling\n          if (stopPropagation) {\n            event.currentScope = null;\n            return event;\n          }\n          //traverse upwards\n          scope = scope.$parent;\n        } while (scope);\n\n        event.currentScope = null;\n\n        return event;\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$broadcast\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` downwards to all child scopes (and their children) notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$broadcast` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event propagates to all direct and indirect scopes of the current\n       * scope and calls all registered listeners along the way. The event cannot be canceled.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to broadcast.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}\n       */\n      $broadcast: function(name, args) {\n        var target = this,\n            current = target,\n            next = target,\n            event = {\n              name: name,\n              targetScope: target,\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            };\n\n        if (!target.$$listenerCount[name]) return event;\n\n        var listenerArgs = concat([event], arguments, 1),\n            listeners, i, length;\n\n        //down while you can, then up and next sibling or up and next sibling until back at root\n        while ((current = next)) {\n          event.currentScope = current;\n          listeners = current.$$listeners[name] || [];\n          for (i = 0, length = listeners.length; i < length; i++) {\n            // if listeners were deregistered, defragment the array\n            if (!listeners[i]) {\n              listeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n\n            try {\n              listeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n\n          // Insanity Warning: scope depth-first traversal\n          // yes, this code is a bit crazy, but it works and we have tests to prove it!\n          // this piece should be kept in sync with the traversal in $digest\n          // (though it differs due to having the extra check for $$listenerCount)\n          if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||\n              (current !== target && current.$$nextSibling)))) {\n            while (current !== target && !(next = current.$$nextSibling)) {\n              current = current.$parent;\n            }\n          }\n        }\n\n        event.currentScope = null;\n        return event;\n      }\n    };\n\n    var $rootScope = new Scope();\n\n    //The internal queues. Expose them on the $rootScope for debugging/testing purposes.\n    var asyncQueue = $rootScope.$$asyncQueue = [];\n    var postDigestQueue = $rootScope.$$postDigestQueue = [];\n    var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];\n\n    return $rootScope;\n\n\n    function beginPhase(phase) {\n      if ($rootScope.$$phase) {\n        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);\n      }\n\n      $rootScope.$$phase = phase;\n    }\n\n    function clearPhase() {\n      $rootScope.$$phase = null;\n    }\n\n    function incrementWatchersCount(current, count) {\n      do {\n        current.$$watchersCount += count;\n      } while ((current = current.$parent));\n    }\n\n    function decrementListenerCount(current, count, name) {\n      do {\n        current.$$listenerCount[name] -= count;\n\n        if (current.$$listenerCount[name] === 0) {\n          delete current.$$listenerCount[name];\n        }\n      } while ((current = current.$parent));\n    }\n\n    /**\n     * function used as an initial value for watchers.\n     * because it's unique we can easily tell it apart from other values\n     */\n    function initWatchVal() {}\n\n    function flushApplyAsync() {\n      while (applyAsyncQueue.length) {\n        try {\n          applyAsyncQueue.shift()();\n        } catch (e) {\n          $exceptionHandler(e);\n        }\n      }\n      applyAsyncId = null;\n    }\n\n    function scheduleApplyAsync() {\n      if (applyAsyncId === null) {\n        applyAsyncId = $browser.defer(function() {\n          $rootScope.$apply(flushApplyAsync);\n        });\n      }\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $rootElement\n *\n * @description\n * The root element of Angular application. This is either the element where {@link\n * ng.directive:ngApp ngApp} was declared or the element passed into\n * {@link angular.bootstrap}. The element represents the root element of application. It is also the\n * location where the application's {@link auto.$injector $injector} service gets\n * published, and can be retrieved using `$rootElement.injector()`.\n */\n\n\n// the implementation is in angular.bootstrap\n\n/**\n * @description\n * Private service to sanitize uris for links and images. Used by $compile and $sanitize.\n */\nfunction $$SanitizeUriProvider() {\n  var aHrefSanitizationWhitelist = /^\\s*(https?|ftp|mailto|tel|file):/,\n    imgSrcSanitizationWhitelist = /^\\s*((https?|ftp|file|blob):|data:image\\/)/;\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      aHrefSanitizationWhitelist = regexp;\n      return this;\n    }\n    return aHrefSanitizationWhitelist;\n  };\n\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      imgSrcSanitizationWhitelist = regexp;\n      return this;\n    }\n    return imgSrcSanitizationWhitelist;\n  };\n\n  this.$get = function() {\n    return function sanitizeUri(uri, isImage) {\n      var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;\n      var normalizedVal;\n      normalizedVal = urlResolve(uri).href;\n      if (normalizedVal !== '' && !normalizedVal.match(regex)) {\n        return 'unsafe:' + normalizedVal;\n      }\n      return uri;\n    };\n  };\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sceMinErr = minErr('$sce');\n\nvar SCE_CONTEXTS = {\n  HTML: 'html',\n  CSS: 'css',\n  URL: 'url',\n  // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a\n  // url.  (e.g. ng-include, script src, templateUrl)\n  RESOURCE_URL: 'resourceUrl',\n  JS: 'js'\n};\n\n// Helper functions follow.\n\nfunction adjustMatcher(matcher) {\n  if (matcher === 'self') {\n    return matcher;\n  } else if (isString(matcher)) {\n    // Strings match exactly except for 2 wildcards - '*' and '**'.\n    // '*' matches any character except those from the set ':/.?&'.\n    // '**' matches any character (like .* in a RegExp).\n    // More than 2 *'s raises an error as it's ill defined.\n    if (matcher.indexOf('***') > -1) {\n      throw $sceMinErr('iwcard',\n          'Illegal sequence *** in string matcher.  String: {0}', matcher);\n    }\n    matcher = escapeForRegexp(matcher).\n                  replace('\\\\*\\\\*', '.*').\n                  replace('\\\\*', '[^:/.?&;]*');\n    return new RegExp('^' + matcher + '$');\n  } else if (isRegExp(matcher)) {\n    // The only other type of matcher allowed is a Regexp.\n    // Match entire URL / disallow partial matches.\n    // Flags are reset (i.e. no global, ignoreCase or multiline)\n    return new RegExp('^' + matcher.source + '$');\n  } else {\n    throw $sceMinErr('imatcher',\n        'Matchers may only be \"self\", string patterns or RegExp objects');\n  }\n}\n\n\nfunction adjustMatchers(matchers) {\n  var adjustedMatchers = [];\n  if (isDefined(matchers)) {\n    forEach(matchers, function(matcher) {\n      adjustedMatchers.push(adjustMatcher(matcher));\n    });\n  }\n  return adjustedMatchers;\n}\n\n\n/**\n * @ngdoc service\n * @name $sceDelegate\n * @kind function\n *\n * @description\n *\n * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict\n * Contextual Escaping (SCE)} services to AngularJS.\n *\n * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of\n * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is\n * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to\n * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things\n * work because `$sce` delegates to `$sceDelegate` for these operations.\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.\n *\n * The default instance of `$sceDelegate` should work out of the box with little pain.  While you\n * can override it completely to change the behavior of `$sce`, the common case would\n * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting\n * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as\n * templates.  Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist\n * $sceDelegateProvider.resourceUrlWhitelist} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n */\n\n/**\n * @ngdoc provider\n * @name $sceDelegateProvider\n * @description\n *\n * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate\n * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure\n * that the URLs used for sourcing Angular templates are safe.  Refer {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and\n * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n *\n * For the general details about this service in Angular, read the main page for {@link ng.$sce\n * Strict Contextual Escaping (SCE)}.\n *\n * **Example**:  Consider the following case. <a name=\"example\"></a>\n *\n * - your app is hosted at url `http://myapp.example.com/`\n * - but some of your templates are hosted on other domains you control such as\n *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.\n * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.\n *\n * Here is what a secure configuration for this scenario might look like:\n *\n * ```\n *  angular.module('myApp', []).config(function($sceDelegateProvider) {\n *    $sceDelegateProvider.resourceUrlWhitelist([\n *      // Allow same origin resource loads.\n *      'self',\n *      // Allow loading from our assets domain.  Notice the difference between * and **.\n *      'http://srv*.assets.example.com/**'\n *    ]);\n *\n *    // The blacklist overrides the whitelist so the open redirect here is blocked.\n *    $sceDelegateProvider.resourceUrlBlacklist([\n *      'http://myapp.example.com/clickThru**'\n *    ]);\n *  });\n * ```\n */\n\nfunction $SceDelegateProvider() {\n  this.SCE_CONTEXTS = SCE_CONTEXTS;\n\n  // Resource URLs can also be trusted by policy.\n  var resourceUrlWhitelist = ['self'],\n      resourceUrlBlacklist = [];\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlWhitelist\n   * @kind function\n   *\n   * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value\n   *    provided.  This must be an array or null.  A snapshot of this array is used so further\n   *    changes to the array are ignored.\n   *\n   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *    allowed in this array.\n   *\n   *    <div class=\"alert alert-warning\">\n   *    **Note:** an empty whitelist array will block all URLs!\n   *    </div>\n   *\n   * @return {Array} the currently set whitelist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is `['self']` allowing only\n   * same origin resource requests.\n   *\n   * @description\n   * Sets/Gets the whitelist of trusted resource URLs.\n   */\n  this.resourceUrlWhitelist = function(value) {\n    if (arguments.length) {\n      resourceUrlWhitelist = adjustMatchers(value);\n    }\n    return resourceUrlWhitelist;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlBlacklist\n   * @kind function\n   *\n   * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value\n   *    provided.  This must be an array or null.  A snapshot of this array is used so further\n   *    changes to the array are ignored.\n   *\n   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *    allowed in this array.\n   *\n   *    The typical usage for the blacklist is to **block\n   *    [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as\n   *    these would otherwise be trusted but actually return content from the redirected domain.\n   *\n   *    Finally, **the blacklist overrides the whitelist** and has the final say.\n   *\n   * @return {Array} the currently set blacklist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there\n   * is no blacklist.)\n   *\n   * @description\n   * Sets/Gets the blacklist of trusted resource URLs.\n   */\n\n  this.resourceUrlBlacklist = function(value) {\n    if (arguments.length) {\n      resourceUrlBlacklist = adjustMatchers(value);\n    }\n    return resourceUrlBlacklist;\n  };\n\n  this.$get = ['$injector', function($injector) {\n\n    var htmlSanitizer = function htmlSanitizer(html) {\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    };\n\n    if ($injector.has('$sanitize')) {\n      htmlSanitizer = $injector.get('$sanitize');\n    }\n\n\n    function matchUrl(matcher, parsedUrl) {\n      if (matcher === 'self') {\n        return urlIsSameOrigin(parsedUrl);\n      } else {\n        // definitely a regex.  See adjustMatchers()\n        return !!matcher.exec(parsedUrl.href);\n      }\n    }\n\n    function isResourceUrlAllowedByPolicy(url) {\n      var parsedUrl = urlResolve(url.toString());\n      var i, n, allowed = false;\n      // Ensure that at least one item from the whitelist allows this url.\n      for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {\n        if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {\n          allowed = true;\n          break;\n        }\n      }\n      if (allowed) {\n        // Ensure that no item from the blacklist blocked this url.\n        for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {\n          if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {\n            allowed = false;\n            break;\n          }\n        }\n      }\n      return allowed;\n    }\n\n    function generateHolderType(Base) {\n      var holderType = function TrustedValueHolderType(trustedValue) {\n        this.$$unwrapTrustedValue = function() {\n          return trustedValue;\n        };\n      };\n      if (Base) {\n        holderType.prototype = new Base();\n      }\n      holderType.prototype.valueOf = function sceValueOf() {\n        return this.$$unwrapTrustedValue();\n      };\n      holderType.prototype.toString = function sceToString() {\n        return this.$$unwrapTrustedValue().toString();\n      };\n      return holderType;\n    }\n\n    var trustedValueHolderBase = generateHolderType(),\n        byType = {};\n\n    byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#trustAs\n     *\n     * @description\n     * Returns an object that is trusted by angular for use in specified strict\n     * contextual escaping contexts (such as ng-bind-html, ng-include, any src\n     * attribute interpolation, any dom event binding attribute interpolation\n     * such as for onclick,  etc.) that uses the provided value.\n     * See {@link ng.$sce $sce} for enabling strict contextual escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n    function trustAs(type, trustedValue) {\n      var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (!Constructor) {\n        throw $sceMinErr('icontext',\n            'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',\n            type, trustedValue);\n      }\n      if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {\n        return trustedValue;\n      }\n      // All the current contexts in SCE_CONTEXTS happen to be strings.  In order to avoid trusting\n      // mutable objects, we ensure here that the value passed in is actually a string.\n      if (typeof trustedValue !== 'string') {\n        throw $sceMinErr('itype',\n            'Attempted to trust a non-string value in a content requiring a string: Context: {0}',\n            type);\n      }\n      return new Constructor(trustedValue);\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#valueOf\n     *\n     * @description\n     * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs\n     * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.\n     *\n     * If the passed parameter is not a value that had been returned by {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.\n     *\n     * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}\n     *      call or anything else.\n     * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns\n     *     `value` unchanged.\n     */\n    function valueOf(maybeTrusted) {\n      if (maybeTrusted instanceof trustedValueHolderBase) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      } else {\n        return maybeTrusted;\n      }\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#getTrusted\n     *\n     * @description\n     * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and\n     * returns the originally supplied value if the queried context type is a supertype of the\n     * created type.  If this condition isn't satisfied, throws an exception.\n     *\n     * <div class=\"alert alert-danger\">\n     * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting\n     * (XSS) vulnerability in your application.\n     * </div>\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} call.\n     * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.\n     */\n    function getTrusted(type, maybeTrusted) {\n      if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {\n        return maybeTrusted;\n      }\n      var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (constructor && maybeTrusted instanceof constructor) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      }\n      // If we get here, then we may only take one of two actions.\n      // 1. sanitize the value for the requested type, or\n      // 2. throw an exception.\n      if (type === SCE_CONTEXTS.RESOURCE_URL) {\n        if (isResourceUrlAllowedByPolicy(maybeTrusted)) {\n          return maybeTrusted;\n        } else {\n          throw $sceMinErr('insecurl',\n              'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}',\n              maybeTrusted.toString());\n        }\n      } else if (type === SCE_CONTEXTS.HTML) {\n        return htmlSanitizer(maybeTrusted);\n      }\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    }\n\n    return { trustAs: trustAs,\n             getTrusted: getTrusted,\n             valueOf: valueOf };\n  }];\n}\n\n\n/**\n * @ngdoc provider\n * @name $sceProvider\n * @description\n *\n * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.\n * -   enable/disable Strict Contextual Escaping (SCE) in a module\n * -   override the default implementation with a custom delegate\n *\n * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.\n */\n\n/* jshint maxlen: false*/\n\n/**\n * @ngdoc service\n * @name $sce\n * @kind function\n *\n * @description\n *\n * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.\n *\n * # Strict Contextual Escaping\n *\n * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain\n * contexts to result in a value that is marked as safe to use for that context.  One example of\n * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer\n * to these contexts as privileged or SCE contexts.\n *\n * As of version 1.2, Angular ships with SCE enabled by default.\n *\n * Note:  When enabled (the default), IE<11 in quirks mode is not supported.  In this mode, IE<11 allow\n * one to execute arbitrary javascript by the use of the expression() syntax.  Refer\n * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.\n * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`\n * to the top of your HTML document.\n *\n * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for\n * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.\n *\n * Here's an example of a binding in a privileged context:\n *\n * ```\n * <input ng-model=\"userHtml\" aria-label=\"User input\">\n * <div ng-bind-html=\"userHtml\"></div>\n * ```\n *\n * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE\n * disabled, this application allows the user to render arbitrary HTML into the DIV.\n * In a more realistic example, one may be rendering user comments, blog articles, etc. via\n * bindings.  (HTML is just one example of a context where rendering user controlled input creates\n * security vulnerabilities.)\n *\n * For the case of HTML, you might use a library, either on the client side, or on the server side,\n * to sanitize unsafe HTML before binding to the value and rendering it in the document.\n *\n * How would you ensure that every place that used these types of bindings was bound to a value that\n * was sanitized by your library (or returned as safe for rendering by your server?)  How can you\n * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some\n * properties/fields and forgot to update the binding to the sanitized value?\n *\n * To be secure by default, you want to ensure that any such bindings are disallowed unless you can\n * determine that something explicitly says it's safe to use a value for binding in that\n * context.  You can then audit your code (a simple grep would do) to ensure that this is only done\n * for those values that you can easily tell are safe - because they were received from your server,\n * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps\n * allowing only the files in a specific directory to do this.  Ensuring that the internal API\n * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.\n *\n * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}\n * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to\n * obtain values that will be accepted by SCE / privileged contexts.\n *\n *\n * ## How does it work?\n *\n * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted\n * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link\n * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the\n * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.\n *\n * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link\n * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly\n * simplified):\n *\n * ```\n * var ngBindHtmlDirective = ['$sce', function($sce) {\n *   return function(scope, element, attr) {\n *     scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {\n *       element.html(value || '');\n *     });\n *   };\n * }];\n * ```\n *\n * ## Impact on loading templates\n *\n * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as\n * `templateUrl`'s specified by {@link guide/directive directives}.\n *\n * By default, Angular only loads templates from the same domain and protocol as the application\n * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or\n * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist\n * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.\n *\n * *Please note*:\n * The browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy apply in addition to this and may further restrict whether the template is successfully\n * loaded.  This means that without the right CORS policy, loading templates from a different domain\n * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some\n * browsers.\n *\n * ## This feels like too much overhead\n *\n * It's important to remember that SCE only applies to interpolation expressions.\n *\n * If your expressions are constant literals, they're automatically trusted and you don't need to\n * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.\n * `<div ng-bind-html=\"'<b>implicitly trusted</b>'\"></div>`) just works.\n *\n * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them\n * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.\n *\n * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load\n * templates in `ng-include` from your application's domain without having to even know about SCE.\n * It blocks loading templates from other domains or loading templates over http from an https\n * served document.  You can change these by setting your own custom {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.\n *\n * This significantly reduces the overhead.  It is far easier to pay the small overhead and have an\n * application that's secure and can be audited to verify that with much more ease than bolting\n * security onto an application later.\n *\n * <a name=\"contexts\"></a>\n * ## What trusted context types are supported?\n *\n * | Context             | Notes          |\n * |---------------------|----------------|\n * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |\n * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |\n * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |\n * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |\n * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |\n *\n * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name=\"resourceUrlPatternItem\"></a>\n *\n *  Each element in these arrays must be one of the following:\n *\n *  - **'self'**\n *    - The special **string**, `'self'`, can be used to match against all URLs of the **same\n *      domain** as the application document using the **same protocol**.\n *  - **String** (except the special value `'self'`)\n *    - The string is matched against the full *normalized / absolute URL* of the resource\n *      being tested (substring matches are not good enough.)\n *    - There are exactly **two wildcard sequences** - `*` and `**`.  All other characters\n *      match themselves.\n *    - `*`: matches zero or more occurrences of any character other than one of the following 6\n *      characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'.  It's a useful wildcard for use\n *      in a whitelist.\n *    - `**`: matches zero or more occurrences of *any* character.  As such, it's not\n *      appropriate for use in a scheme, domain, etc. as it would match too much.  (e.g.\n *      http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might\n *      not have been the intention.)  Its usage at the very end of the path is ok.  (e.g.\n *      http://foo.example.com/templates/**).\n *  - **RegExp** (*see caveat below*)\n *    - *Caveat*:  While regular expressions are powerful and offer great flexibility,  their syntax\n *      (and all the inevitable escaping) makes them *harder to maintain*.  It's easy to\n *      accidentally introduce a bug when one updates a complex expression (imho, all regexes should\n *      have good test coverage).  For instance, the use of `.` in the regex is correct only in a\n *      small number of cases.  A `.` character in the regex used when matching the scheme or a\n *      subdomain could be matched against a `:` or literal `.` that was likely not intended.   It\n *      is highly recommended to use the string patterns and only fall back to regular expressions\n *      as a last resort.\n *    - The regular expression must be an instance of RegExp (i.e. not a string.)  It is\n *      matched against the **entire** *normalized / absolute URL* of the resource being tested\n *      (even when the RegExp did not have the `^` and `$` codes.)  In addition, any flags\n *      present on the RegExp (such as multiline, global, ignoreCase) are ignored.\n *    - If you are generating your JavaScript from some other templating engine (not\n *      recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),\n *      remember to escape your regular expression (and be aware that you might need more than\n *      one level of escaping depending on your templating engine and the way you interpolated\n *      the value.)  Do make use of your platform's escaping mechanism as it might be good\n *      enough before coding your own.  E.g. Ruby has\n *      [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)\n *      and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).\n *      Javascript lacks a similar built in function for escaping.  Take a look at Google\n *      Closure library's [goog.string.regExpEscape(s)](\n *      http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.\n *\n * ## Show me an example using SCE.\n *\n * <example module=\"mySceApp\" deps=\"angular-sanitize.js\">\n * <file name=\"index.html\">\n *   <div ng-controller=\"AppController as myCtrl\">\n *     <i ng-bind-html=\"myCtrl.explicitlyTrustedHtml\" id=\"explicitlyTrustedHtml\"></i><br><br>\n *     <b>User comments</b><br>\n *     By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when\n *     $sanitize is available.  If $sanitize isn't available, this results in an error instead of an\n *     exploit.\n *     <div class=\"well\">\n *       <div ng-repeat=\"userComment in myCtrl.userComments\">\n *         <b>{{userComment.name}}</b>:\n *         <span ng-bind-html=\"userComment.htmlComment\" class=\"htmlComment\"></span>\n *         <br>\n *       </div>\n *     </div>\n *   </div>\n * </file>\n *\n * <file name=\"script.js\">\n *   angular.module('mySceApp', ['ngSanitize'])\n *     .controller('AppController', ['$http', '$templateCache', '$sce',\n *       function($http, $templateCache, $sce) {\n *         var self = this;\n *         $http.get(\"test_data.json\", {cache: $templateCache}).success(function(userComments) {\n *           self.userComments = userComments;\n *         });\n *         self.explicitlyTrustedHtml = $sce.trustAsHtml(\n *             '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *             'sanitization.&quot;\">Hover over this text.</span>');\n *       }]);\n * </file>\n *\n * <file name=\"test_data.json\">\n * [\n *   { \"name\": \"Alice\",\n *     \"htmlComment\":\n *         \"<span onmouseover='this.textContent=\\\"PWN3D!\\\"'>Is <i>anyone</i> reading this?</span>\"\n *   },\n *   { \"name\": \"Bob\",\n *     \"htmlComment\": \"<i>Yes!</i>  Am I the only other one?\"\n *   }\n * ]\n * </file>\n *\n * <file name=\"protractor.js\" type=\"protractor\">\n *   describe('SCE doc demo', function() {\n *     it('should sanitize untrusted values', function() {\n *       expect(element.all(by.css('.htmlComment')).first().getInnerHtml())\n *           .toBe('<span>Is <i>anyone</i> reading this?</span>');\n *     });\n *\n *     it('should NOT sanitize explicitly trusted values', function() {\n *       expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(\n *           '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *           'sanitization.&quot;\">Hover over this text.</span>');\n *     });\n *   });\n * </file>\n * </example>\n *\n *\n *\n * ## Can I disable SCE completely?\n *\n * Yes, you can.  However, this is strongly discouraged.  SCE gives you a lot of security benefits\n * for little coding overhead.  It will be much harder to take an SCE disabled application and\n * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE\n * for cases where you have a lot of existing code that was written before SCE was introduced and\n * you're migrating them a module at a time.\n *\n * That said, here's how you can completely disable SCE:\n *\n * ```\n * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {\n *   // Completely disable SCE.  For demonstration purposes only!\n *   // Do not use in new projects.\n *   $sceProvider.enabled(false);\n * });\n * ```\n *\n */\n/* jshint maxlen: 100 */\n\nfunction $SceProvider() {\n  var enabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $sceProvider#enabled\n   * @kind function\n   *\n   * @param {boolean=} value If provided, then enables/disables SCE.\n   * @return {boolean} true if SCE is enabled, false otherwise.\n   *\n   * @description\n   * Enables/disables SCE and returns the current value.\n   */\n  this.enabled = function(value) {\n    if (arguments.length) {\n      enabled = !!value;\n    }\n    return enabled;\n  };\n\n\n  /* Design notes on the default implementation for SCE.\n   *\n   * The API contract for the SCE delegate\n   * -------------------------------------\n   * The SCE delegate object must provide the following 3 methods:\n   *\n   * - trustAs(contextEnum, value)\n   *     This method is used to tell the SCE service that the provided value is OK to use in the\n   *     contexts specified by contextEnum.  It must return an object that will be accepted by\n   *     getTrusted() for a compatible contextEnum and return this value.\n   *\n   * - valueOf(value)\n   *     For values that were not produced by trustAs(), return them as is.  For values that were\n   *     produced by trustAs(), return the corresponding input value to trustAs.  Basically, if\n   *     trustAs is wrapping the given values into some type, this operation unwraps it when given\n   *     such a value.\n   *\n   * - getTrusted(contextEnum, value)\n   *     This function should return the a value that is safe to use in the context specified by\n   *     contextEnum or throw and exception otherwise.\n   *\n   * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be\n   * opaque or wrapped in some holder object.  That happens to be an implementation detail.  For\n   * instance, an implementation could maintain a registry of all trusted objects by context.  In\n   * such a case, trustAs() would return the same object that was passed in.  getTrusted() would\n   * return the same object passed in if it was found in the registry under a compatible context or\n   * throw an exception otherwise.  An implementation might only wrap values some of the time based\n   * on some criteria.  getTrusted() might return a value and not throw an exception for special\n   * constants or objects even if not wrapped.  All such implementations fulfill this contract.\n   *\n   *\n   * A note on the inheritance model for SCE contexts\n   * ------------------------------------------------\n   * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types.  This\n   * is purely an implementation details.\n   *\n   * The contract is simply this:\n   *\n   *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)\n   *     will also succeed.\n   *\n   * Inheritance happens to capture this in a natural way.  In some future, we\n   * may not use inheritance anymore.  That is OK because no code outside of\n   * sce.js and sceSpecs.js would need to be aware of this detail.\n   */\n\n  this.$get = ['$parse', '$sceDelegate', function(\n                $parse,   $sceDelegate) {\n    // Prereq: Ensure that we're not running in IE<11 quirks mode.  In that mode, IE < 11 allow\n    // the \"expression(javascript expression)\" syntax which is insecure.\n    if (enabled && msie < 8) {\n      throw $sceMinErr('iequirks',\n        'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +\n        'mode.  You can fix this by adding the text <!doctype html> to the top of your HTML ' +\n        'document.  See http://docs.angularjs.org/api/ng.$sce for more information.');\n    }\n\n    var sce = shallowCopy(SCE_CONTEXTS);\n\n    /**\n     * @ngdoc method\n     * @name $sce#isEnabled\n     * @kind function\n     *\n     * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you\n     * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.\n     *\n     * @description\n     * Returns a boolean indicating if SCE is enabled.\n     */\n    sce.isEnabled = function() {\n      return enabled;\n    };\n    sce.trustAs = $sceDelegate.trustAs;\n    sce.getTrusted = $sceDelegate.getTrusted;\n    sce.valueOf = $sceDelegate.valueOf;\n\n    if (!enabled) {\n      sce.trustAs = sce.getTrusted = function(type, value) { return value; };\n      sce.valueOf = identity;\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAs\n     *\n     * @description\n     * Converts Angular {@link guide/expression expression} into a function.  This is like {@link\n     * ng.$parse $parse} and is identical when the expression is a literal constant.  Otherwise, it\n     * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,\n     * *result*)}\n     *\n     * @param {string} type The kind of SCE context in which this result will be used.\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n    sce.parseAs = function sceParseAs(type, expr) {\n      var parsed = $parse(expr);\n      if (parsed.literal && parsed.constant) {\n        return parsed;\n      } else {\n        return $parse(expr, function(value) {\n          return sce.getTrusted(type, value);\n        });\n      }\n    };\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAs\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,\n     * returns an object that is trusted by angular for use in specified strict contextual\n     * escaping contexts (such as ng-bind-html, ng-include, any src attribute\n     * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)\n     * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual\n     * escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsHtml(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml\n     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl\n     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl\n     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the return\n     *     value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsJs(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs\n     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrusted\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,\n     * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the\n     * originally supplied value if the queried context type is a supertype of the created type.\n     * If this condition isn't satisfied, throws an exception.\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}\n     *                         call.\n     * @returns {*} The value the was originally provided to\n     *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.\n     *              Otherwise, throws an exception.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedHtml(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedCss\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedCss(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sceDelegate.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedJs\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedJs(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsHtml(expression string)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsCss\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsCss(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsUrl(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsResourceUrl(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsJs(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    // Shorthand delegations.\n    var parse = sce.parseAs,\n        getTrusted = sce.getTrusted,\n        trustAs = sce.trustAs;\n\n    forEach(SCE_CONTEXTS, function(enumValue, name) {\n      var lName = lowercase(name);\n      sce[camelCase(\"parse_as_\" + lName)] = function(expr) {\n        return parse(enumValue, expr);\n      };\n      sce[camelCase(\"get_trusted_\" + lName)] = function(value) {\n        return getTrusted(enumValue, value);\n      };\n      sce[camelCase(\"trust_as_\" + lName)] = function(value) {\n        return trustAs(enumValue, value);\n      };\n    });\n\n    return sce;\n  }];\n}\n\n/**\n * !!! This is an undocumented \"private\" service !!!\n *\n * @name $sniffer\n * @requires $window\n * @requires $document\n *\n * @property {boolean} history Does the browser support html5 history api ?\n * @property {boolean} transitions Does the browser support CSS transition events ?\n * @property {boolean} animations Does the browser support CSS animation events ?\n *\n * @description\n * This is very simple implementation of testing browser's features.\n */\nfunction $SnifferProvider() {\n  this.$get = ['$window', '$document', function($window, $document) {\n    var eventSupport = {},\n        // Chrome Packaged Apps are not allowed to access `history.pushState`. They can be detected by\n        // the presence of `chrome.app.runtime` (see https://developer.chrome.com/apps/api_index)\n        isChromePackagedApp = $window.chrome && $window.chrome.app && $window.chrome.app.runtime,\n        hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState,\n        android =\n          toInt((/android (\\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),\n        boxee = /Boxee/i.test(($window.navigator || {}).userAgent),\n        document = $document[0] || {},\n        vendorPrefix,\n        vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,\n        bodyStyle = document.body && document.body.style,\n        transitions = false,\n        animations = false,\n        match;\n\n    if (bodyStyle) {\n      for (var prop in bodyStyle) {\n        if (match = vendorRegex.exec(prop)) {\n          vendorPrefix = match[0];\n          vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);\n          break;\n        }\n      }\n\n      if (!vendorPrefix) {\n        vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';\n      }\n\n      transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));\n      animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));\n\n      if (android && (!transitions ||  !animations)) {\n        transitions = isString(bodyStyle.webkitTransition);\n        animations = isString(bodyStyle.webkitAnimation);\n      }\n    }\n\n\n    return {\n      // Android has history.pushState, but it does not update location correctly\n      // so let's not use the history API at all.\n      // http://code.google.com/p/android/issues/detail?id=17471\n      // https://github.com/angular/angular.js/issues/904\n\n      // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has\n      // so let's not use the history API also\n      // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined\n      // jshint -W018\n      history: !!(hasHistoryPushState && !(android < 4) && !boxee),\n      // jshint +W018\n      hasEvent: function(event) {\n        // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have\n        // it. In particular the event is not fired when backspace or delete key are pressed or\n        // when cut operation is performed.\n        // IE10+ implements 'input' event but it erroneously fires under various situations,\n        // e.g. when placeholder changes, or a form is focused.\n        if (event === 'input' && msie <= 11) return false;\n\n        if (isUndefined(eventSupport[event])) {\n          var divElm = document.createElement('div');\n          eventSupport[event] = 'on' + event in divElm;\n        }\n\n        return eventSupport[event];\n      },\n      csp: csp(),\n      vendorPrefix: vendorPrefix,\n      transitions: transitions,\n      animations: animations,\n      android: android\n    };\n  }];\n}\n\nvar $templateRequestMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $templateRequestProvider\n * @description\n * Used to configure the options passed to the {@link $http} service when making a template request.\n *\n * For example, it can be used for specifying the \"Accept\" header that is sent to the server, when\n * requesting a template.\n */\nfunction $TemplateRequestProvider() {\n\n  var httpOptions;\n\n  /**\n   * @ngdoc method\n   * @name $templateRequestProvider#httpOptions\n   * @description\n   * The options to be passed to the {@link $http} service when making the request.\n   * You can use this to override options such as the \"Accept\" header for template requests.\n   *\n   * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the\n   * options if not overridden here.\n   *\n   * @param {string=} value new value for the {@link $http} options.\n   * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.\n   */\n  this.httpOptions = function(val) {\n    if (val) {\n      httpOptions = val;\n      return this;\n    }\n    return httpOptions;\n  };\n\n  /**\n   * @ngdoc service\n   * @name $templateRequest\n   *\n   * @description\n   * The `$templateRequest` service runs security checks then downloads the provided template using\n   * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request\n   * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the\n   * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the\n   * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted\n   * when `tpl` is of type string and `$templateCache` has the matching entry.\n   *\n   * If you want to pass custom options to the `$http` service, such as setting the Accept header you\n   * can configure this via {@link $templateRequestProvider#httpOptions}.\n   *\n   * @param {string|TrustedResourceUrl} tpl The HTTP request template URL\n   * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty\n   *\n   * @return {Promise} a promise for the HTTP response data of the given URL.\n   *\n   * @property {number} totalPendingRequests total amount of pending template requests being downloaded.\n   */\n  this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {\n\n    function handleRequestFn(tpl, ignoreRequestError) {\n      handleRequestFn.totalPendingRequests++;\n\n      // We consider the template cache holds only trusted templates, so\n      // there's no need to go through whitelisting again for keys that already\n      // are included in there. This also makes Angular accept any script\n      // directive, no matter its name. However, we still need to unwrap trusted\n      // types.\n      if (!isString(tpl) || !$templateCache.get(tpl)) {\n        tpl = $sce.getTrustedResourceUrl(tpl);\n      }\n\n      var transformResponse = $http.defaults && $http.defaults.transformResponse;\n\n      if (isArray(transformResponse)) {\n        transformResponse = transformResponse.filter(function(transformer) {\n          return transformer !== defaultHttpResponseTransform;\n        });\n      } else if (transformResponse === defaultHttpResponseTransform) {\n        transformResponse = null;\n      }\n\n      return $http.get(tpl, extend({\n          cache: $templateCache,\n          transformResponse: transformResponse\n        }, httpOptions))\n        ['finally'](function() {\n          handleRequestFn.totalPendingRequests--;\n        })\n        .then(function(response) {\n          $templateCache.put(tpl, response.data);\n          return response.data;\n        }, handleError);\n\n      function handleError(resp) {\n        if (!ignoreRequestError) {\n          throw $templateRequestMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',\n            tpl, resp.status, resp.statusText);\n        }\n        return $q.reject(resp);\n      }\n    }\n\n    handleRequestFn.totalPendingRequests = 0;\n\n    return handleRequestFn;\n  }];\n}\n\nfunction $$TestabilityProvider() {\n  this.$get = ['$rootScope', '$browser', '$location',\n       function($rootScope,   $browser,   $location) {\n\n    /**\n     * @name $testability\n     *\n     * @description\n     * The private $$testability service provides a collection of methods for use when debugging\n     * or by automated test and debugging tools.\n     */\n    var testability = {};\n\n    /**\n     * @name $$testability#findBindings\n     *\n     * @description\n     * Returns an array of elements that are bound (via ng-bind or {{}})\n     * to expressions matching the input.\n     *\n     * @param {Element} element The element root to search from.\n     * @param {string} expression The binding expression to match.\n     * @param {boolean} opt_exactMatch If true, only returns exact matches\n     *     for the expression. Filters and whitespace are ignored.\n     */\n    testability.findBindings = function(element, expression, opt_exactMatch) {\n      var bindings = element.getElementsByClassName('ng-binding');\n      var matches = [];\n      forEach(bindings, function(binding) {\n        var dataBinding = angular.element(binding).data('$binding');\n        if (dataBinding) {\n          forEach(dataBinding, function(bindingName) {\n            if (opt_exactMatch) {\n              var matcher = new RegExp('(^|\\\\s)' + escapeForRegexp(expression) + '(\\\\s|\\\\||$)');\n              if (matcher.test(bindingName)) {\n                matches.push(binding);\n              }\n            } else {\n              if (bindingName.indexOf(expression) != -1) {\n                matches.push(binding);\n              }\n            }\n          });\n        }\n      });\n      return matches;\n    };\n\n    /**\n     * @name $$testability#findModels\n     *\n     * @description\n     * Returns an array of elements that are two-way found via ng-model to\n     * expressions matching the input.\n     *\n     * @param {Element} element The element root to search from.\n     * @param {string} expression The model expression to match.\n     * @param {boolean} opt_exactMatch If true, only returns exact matches\n     *     for the expression.\n     */\n    testability.findModels = function(element, expression, opt_exactMatch) {\n      var prefixes = ['ng-', 'data-ng-', 'ng\\\\:'];\n      for (var p = 0; p < prefixes.length; ++p) {\n        var attributeEquals = opt_exactMatch ? '=' : '*=';\n        var selector = '[' + prefixes[p] + 'model' + attributeEquals + '\"' + expression + '\"]';\n        var elements = element.querySelectorAll(selector);\n        if (elements.length) {\n          return elements;\n        }\n      }\n    };\n\n    /**\n     * @name $$testability#getLocation\n     *\n     * @description\n     * Shortcut for getting the location in a browser agnostic way. Returns\n     *     the path, search, and hash. (e.g. /path?a=b#hash)\n     */\n    testability.getLocation = function() {\n      return $location.url();\n    };\n\n    /**\n     * @name $$testability#setLocation\n     *\n     * @description\n     * Shortcut for navigating to a location without doing a full page reload.\n     *\n     * @param {string} url The location url (path, search and hash,\n     *     e.g. /path?a=b#hash) to go to.\n     */\n    testability.setLocation = function(url) {\n      if (url !== $location.url()) {\n        $location.url(url);\n        $rootScope.$digest();\n      }\n    };\n\n    /**\n     * @name $$testability#whenStable\n     *\n     * @description\n     * Calls the callback when $timeout and $http requests are completed.\n     *\n     * @param {function} callback\n     */\n    testability.whenStable = function(callback) {\n      $browser.notifyWhenNoOutstandingRequests(callback);\n    };\n\n    return testability;\n  }];\n}\n\nfunction $TimeoutProvider() {\n  this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',\n       function($rootScope,   $browser,   $q,   $$q,   $exceptionHandler) {\n\n    var deferreds = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $timeout\n      *\n      * @description\n      * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch\n      * block and delegates any exceptions to\n      * {@link ng.$exceptionHandler $exceptionHandler} service.\n      *\n      * The return value of calling `$timeout` is a promise, which will be resolved when\n      * the delay has passed and the timeout function, if provided, is executed.\n      *\n      * To cancel a timeout request, call `$timeout.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to\n      * synchronously flush the queue of deferred functions.\n      *\n      * If you only want a promise that will be resolved after some specified delay\n      * then you can call `$timeout` without the `fn` function.\n      *\n      * @param {function()=} fn A function, whose execution should be delayed.\n      * @param {number=} [delay=0] Delay in milliseconds.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @param {...*=} Pass additional parameters to the executed function.\n      * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise\n      *   will be resolved with the return value of the `fn` function.\n      *\n      */\n    function timeout(fn, delay, invokeApply) {\n      if (!isFunction(fn)) {\n        invokeApply = delay;\n        delay = fn;\n        fn = noop;\n      }\n\n      var args = sliceArgs(arguments, 3),\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          deferred = (skipApply ? $$q : $q).defer(),\n          promise = deferred.promise,\n          timeoutId;\n\n      timeoutId = $browser.defer(function() {\n        try {\n          deferred.resolve(fn.apply(null, args));\n        } catch (e) {\n          deferred.reject(e);\n          $exceptionHandler(e);\n        }\n        finally {\n          delete deferreds[promise.$$timeoutId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n      }, delay);\n\n      promise.$$timeoutId = timeoutId;\n      deferreds[timeoutId] = deferred;\n\n      return promise;\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $timeout#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`. As a result of this, the promise will be\n      * resolved with a rejection.\n      *\n      * @param {Promise=} promise Promise returned by the `$timeout` function.\n      * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n      *   canceled.\n      */\n    timeout.cancel = function(promise) {\n      if (promise && promise.$$timeoutId in deferreds) {\n        deferreds[promise.$$timeoutId].reject('canceled');\n        delete deferreds[promise.$$timeoutId];\n        return $browser.defer.cancel(promise.$$timeoutId);\n      }\n      return false;\n    };\n\n    return timeout;\n  }];\n}\n\n// NOTE:  The usage of window and document instead of $window and $document here is\n// deliberate.  This service depends on the specific behavior of anchor nodes created by the\n// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and\n// cause us to break tests.  In addition, when the browser resolves a URL for XHR, it\n// doesn't know about mocked locations and resolves URLs to the real document - which is\n// exactly the behavior needed here.  There is little value is mocking these out for this\n// service.\nvar urlParsingNode = document.createElement(\"a\");\nvar originUrl = urlResolve(window.location.href);\n\n\n/**\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL.  Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL.  This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers.  However, the parsed components will not be set if the URL assigned did not specify\n * them.  (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.)  We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again.  This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * References:\n *   http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n *   http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *   http://url.spec.whatwg.org/#urlutils\n *   https://github.com/angular/angular.js/pull/2902\n *   http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n *   | member name   | Description    |\n *   |---------------|----------------|\n *   | href          | A normalized version of the provided URL if it was not an absolute URL |\n *   | protocol      | The protocol including the trailing colon                              |\n *   | host          | The host and port (if the port is non-default) of the normalizedUrl    |\n *   | search        | The search params, minus the question mark                             |\n *   | hash          | The hash string, minus the hash symbol\n *   | hostname      | The hostname\n *   | port          | The port, without \":\"\n *   | pathname      | The pathname, beginning with \"/\"\n *\n */\nfunction urlResolve(url) {\n  var href = url;\n\n  if (msie) {\n    // Normalize before parse.  Refer Implementation Notes on why this is\n    // done in two steps on IE.\n    urlParsingNode.setAttribute(\"href\", href);\n    href = urlParsingNode.href;\n  }\n\n  urlParsingNode.setAttribute('href', href);\n\n  // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n  return {\n    href: urlParsingNode.href,\n    protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n    host: urlParsingNode.host,\n    search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n    hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n    hostname: urlParsingNode.hostname,\n    port: urlParsingNode.port,\n    pathname: (urlParsingNode.pathname.charAt(0) === '/')\n      ? urlParsingNode.pathname\n      : '/' + urlParsingNode.pathname\n  };\n}\n\n/**\n * Parse a request URL and determine whether this is a same-origin request as the application document.\n *\n * @param {string|object} requestUrl The url of the request as a string that will be resolved\n * or a parsed URL object.\n * @returns {boolean} Whether the request is for the same origin as the application document.\n */\nfunction urlIsSameOrigin(requestUrl) {\n  var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;\n  return (parsed.protocol === originUrl.protocol &&\n          parsed.host === originUrl.host);\n}\n\n/**\n * @ngdoc service\n * @name $window\n *\n * @description\n * A reference to the browser's `window` object. While `window`\n * is globally available in JavaScript, it causes testability problems, because\n * it is a global variable. In angular we always refer to it through the\n * `$window` service, so it may be overridden, removed or mocked for testing.\n *\n * Expressions, like the one defined for the `ngClick` directive in the example\n * below, are evaluated with respect to the current scope.  Therefore, there is\n * no risk of inadvertently coding in a dependency on a global value in such an\n * expression.\n *\n * @example\n   <example module=\"windowExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('windowExample', [])\n           .controller('ExampleController', ['$scope', '$window', function($scope, $window) {\n             $scope.greeting = 'Hello, World!';\n             $scope.doGreeting = function(greeting) {\n               $window.alert(greeting);\n             };\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"text\" ng-model=\"greeting\" aria-label=\"greeting\" />\n         <button ng-click=\"doGreeting(greeting)\">ALERT</button>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n      it('should display the greeting in the input box', function() {\n       element(by.model('greeting')).sendKeys('Hello, E2E Tests');\n       // If we click the button it will block the test runner\n       // element(':button').click();\n      });\n     </file>\n   </example>\n */\nfunction $WindowProvider() {\n  this.$get = valueFn(window);\n}\n\n/**\n * @name $$cookieReader\n * @requires $document\n *\n * @description\n * This is a private service for reading cookies used by $http and ngCookies\n *\n * @return {Object} a key/value map of the current cookies\n */\nfunction $$CookieReader($document) {\n  var rawDocument = $document[0] || {};\n  var lastCookies = {};\n  var lastCookieString = '';\n\n  function safeDecodeURIComponent(str) {\n    try {\n      return decodeURIComponent(str);\n    } catch (e) {\n      return str;\n    }\n  }\n\n  return function() {\n    var cookieArray, cookie, i, index, name;\n    var currentCookieString = rawDocument.cookie || '';\n\n    if (currentCookieString !== lastCookieString) {\n      lastCookieString = currentCookieString;\n      cookieArray = lastCookieString.split('; ');\n      lastCookies = {};\n\n      for (i = 0; i < cookieArray.length; i++) {\n        cookie = cookieArray[i];\n        index = cookie.indexOf('=');\n        if (index > 0) { //ignore nameless cookies\n          name = safeDecodeURIComponent(cookie.substring(0, index));\n          // the first value that is seen for a cookie is the most\n          // specific one.  values for the same cookie name that\n          // follow are for less specific paths.\n          if (isUndefined(lastCookies[name])) {\n            lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));\n          }\n        }\n      }\n    }\n    return lastCookies;\n  };\n}\n\n$$CookieReader.$inject = ['$document'];\n\nfunction $$CookieReaderProvider() {\n  this.$get = $$CookieReader;\n}\n\n/* global currencyFilter: true,\n dateFilter: true,\n filterFilter: true,\n jsonFilter: true,\n limitToFilter: true,\n lowercaseFilter: true,\n numberFilter: true,\n orderByFilter: true,\n uppercaseFilter: true,\n */\n\n/**\n * @ngdoc provider\n * @name $filterProvider\n * @description\n *\n * Filters are just functions which transform input to an output. However filters need to be\n * Dependency Injected. To achieve this a filter definition consists of a factory function which is\n * annotated with dependencies and is responsible for creating a filter function.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n * (`myapp_subsection_filterx`).\n * </div>\n *\n * ```js\n *   // Filter registration\n *   function MyModule($provide, $filterProvider) {\n *     // create a service to demonstrate injection (not always needed)\n *     $provide.value('greet', function(name){\n *       return 'Hello ' + name + '!';\n *     });\n *\n *     // register a filter factory which uses the\n *     // greet service to demonstrate DI.\n *     $filterProvider.register('greet', function(greet){\n *       // return the filter function which uses the greet service\n *       // to generate salutation\n *       return function(text) {\n *         // filters need to be forgiving so check input validity\n *         return text && greet(text) || text;\n *       };\n *     });\n *   }\n * ```\n *\n * The filter function is registered with the `$injector` under the filter name suffix with\n * `Filter`.\n *\n * ```js\n *   it('should be the same instance', inject(\n *     function($filterProvider) {\n *       $filterProvider.register('reverse', function(){\n *         return ...;\n *       });\n *     },\n *     function($filter, reverseFilter) {\n *       expect($filter('reverse')).toBe(reverseFilter);\n *     });\n * ```\n *\n *\n * For more information about how angular filters work, and how to create your own filters, see\n * {@link guide/filter Filters} in the Angular Developer Guide.\n */\n\n/**\n * @ngdoc service\n * @name $filter\n * @kind function\n * @description\n * Filters are used for formatting data displayed to the user.\n *\n * The general syntax in templates is as follows:\n *\n *         {{ expression [| filter_name[:parameter_value] ... ] }}\n *\n * @param {String} name Name of the filter function to retrieve\n * @return {Function} the filter function\n * @example\n   <example name=\"$filter\" module=\"filterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"MainCtrl\">\n        <h3>{{ originalText }}</h3>\n        <h3>{{ filteredText }}</h3>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n      angular.module('filterExample', [])\n      .controller('MainCtrl', function($scope, $filter) {\n        $scope.originalText = 'hello';\n        $scope.filteredText = $filter('uppercase')($scope.originalText);\n      });\n     </file>\n   </example>\n  */\n$FilterProvider.$inject = ['$provide'];\nfunction $FilterProvider($provide) {\n  var suffix = 'Filter';\n\n  /**\n   * @ngdoc method\n   * @name $filterProvider#register\n   * @param {string|Object} name Name of the filter function, or an object map of filters where\n   *    the keys are the filter names and the values are the filter factories.\n   *\n   *    <div class=\"alert alert-warning\">\n   *    **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n   *    Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n   *    your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n   *    (`myapp_subsection_filterx`).\n   *    </div>\n    * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.\n   * @returns {Object} Registered filter instance, or if a map of filters was provided then a map\n   *    of the registered filter instances.\n   */\n  function register(name, factory) {\n    if (isObject(name)) {\n      var filters = {};\n      forEach(name, function(filter, key) {\n        filters[key] = register(key, filter);\n      });\n      return filters;\n    } else {\n      return $provide.factory(name + suffix, factory);\n    }\n  }\n  this.register = register;\n\n  this.$get = ['$injector', function($injector) {\n    return function(name) {\n      return $injector.get(name + suffix);\n    };\n  }];\n\n  ////////////////////////////////////////\n\n  /* global\n    currencyFilter: false,\n    dateFilter: false,\n    filterFilter: false,\n    jsonFilter: false,\n    limitToFilter: false,\n    lowercaseFilter: false,\n    numberFilter: false,\n    orderByFilter: false,\n    uppercaseFilter: false,\n  */\n\n  register('currency', currencyFilter);\n  register('date', dateFilter);\n  register('filter', filterFilter);\n  register('json', jsonFilter);\n  register('limitTo', limitToFilter);\n  register('lowercase', lowercaseFilter);\n  register('number', numberFilter);\n  register('orderBy', orderByFilter);\n  register('uppercase', uppercaseFilter);\n}\n\n/**\n * @ngdoc filter\n * @name filter\n * @kind function\n *\n * @description\n * Selects a subset of items from `array` and returns it as a new array.\n *\n * @param {Array} array The source array.\n * @param {string|Object|function()} expression The predicate to be used for selecting items from\n *   `array`.\n *\n *   Can be one of:\n *\n *   - `string`: The string is used for matching against the contents of the `array`. All strings or\n *     objects with string properties in `array` that match this string will be returned. This also\n *     applies to nested object properties.\n *     The predicate can be negated by prefixing the string with `!`.\n *\n *   - `Object`: A pattern object can be used to filter specific properties on objects contained\n *     by `array`. For example `{name:\"M\", phone:\"1\"}` predicate will return an array of items\n *     which have property `name` containing \"M\" and property `phone` containing \"1\". A special\n *     property name `$` can be used (as in `{$:\"text\"}`) to accept a match against any\n *     property of the object or its nested object properties. That's equivalent to the simple\n *     substring match with a `string` as described above. The predicate can be negated by prefixing\n *     the string with `!`.\n *     For example `{name: \"!M\"}` predicate will return an array of items which have property `name`\n *     not containing \"M\".\n *\n *     Note that a named property will match properties on the same level only, while the special\n *     `$` property will match properties on the same level or deeper. E.g. an array item like\n *     `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but\n *     **will** be matched by `{$: 'John'}`.\n *\n *   - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.\n *     The function is called for each element of the array, with the element, its index, and\n *     the entire array itself as arguments.\n *\n *     The final result is an array of those elements that the predicate returned true for.\n *\n * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in\n *     determining if the expected value (from the filter expression) and actual value (from\n *     the object in the array) should be considered a match.\n *\n *   Can be one of:\n *\n *   - `function(actual, expected)`:\n *     The function will be given the object value and the predicate value to compare and\n *     should return true if both values should be considered equal.\n *\n *   - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.\n *     This is essentially strict comparison of expected and actual.\n *\n *   - `false|undefined`: A short hand for a function which will look for a substring match in case\n *     insensitive way.\n *\n *     Primitive values are converted to strings. Objects are not compared against primitives,\n *     unless they have a custom `toString` method (e.g. `Date` objects).\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div ng-init=\"friends = [{name:'John', phone:'555-1276'},\n                                {name:'Mary', phone:'800-BIG-MARY'},\n                                {name:'Mike', phone:'555-4321'},\n                                {name:'Adam', phone:'555-5678'},\n                                {name:'Julie', phone:'555-8765'},\n                                {name:'Juliette', phone:'555-5678'}]\"></div>\n\n       <label>Search: <input ng-model=\"searchText\"></label>\n       <table id=\"searchTextResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friend in friends | filter:searchText\">\n           <td>{{friend.name}}</td>\n           <td>{{friend.phone}}</td>\n         </tr>\n       </table>\n       <hr>\n       <label>Any: <input ng-model=\"search.$\"></label> <br>\n       <label>Name only <input ng-model=\"search.name\"></label><br>\n       <label>Phone only <input ng-model=\"search.phone\"></label><br>\n       <label>Equality <input type=\"checkbox\" ng-model=\"strict\"></label><br>\n       <table id=\"searchObjResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friendObj in friends | filter:search:strict\">\n           <td>{{friendObj.name}}</td>\n           <td>{{friendObj.phone}}</td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var expectFriendNames = function(expectedNames, key) {\n         element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {\n           arr.forEach(function(wd, i) {\n             expect(wd.getText()).toMatch(expectedNames[i]);\n           });\n         });\n       };\n\n       it('should search across all fields when filtering with a string', function() {\n         var searchText = element(by.model('searchText'));\n         searchText.clear();\n         searchText.sendKeys('m');\n         expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');\n\n         searchText.clear();\n         searchText.sendKeys('76');\n         expectFriendNames(['John', 'Julie'], 'friend');\n       });\n\n       it('should search in specific fields when filtering with a predicate object', function() {\n         var searchAny = element(by.model('search.$'));\n         searchAny.clear();\n         searchAny.sendKeys('i');\n         expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');\n       });\n       it('should use a equal comparison when comparator is true', function() {\n         var searchName = element(by.model('search.name'));\n         var strict = element(by.model('strict'));\n         searchName.clear();\n         searchName.sendKeys('Julie');\n         strict.click();\n         expectFriendNames(['Julie'], 'friendObj');\n       });\n     </file>\n   </example>\n */\nfunction filterFilter() {\n  return function(array, expression, comparator) {\n    if (!isArrayLike(array)) {\n      if (array == null) {\n        return array;\n      } else {\n        throw minErr('filter')('notarray', 'Expected array but received: {0}', array);\n      }\n    }\n\n    var expressionType = getTypeForFilter(expression);\n    var predicateFn;\n    var matchAgainstAnyProp;\n\n    switch (expressionType) {\n      case 'function':\n        predicateFn = expression;\n        break;\n      case 'boolean':\n      case 'null':\n      case 'number':\n      case 'string':\n        matchAgainstAnyProp = true;\n        //jshint -W086\n      case 'object':\n        //jshint +W086\n        predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);\n        break;\n      default:\n        return array;\n    }\n\n    return Array.prototype.filter.call(array, predicateFn);\n  };\n}\n\n// Helper functions for `filterFilter`\nfunction createPredicateFn(expression, comparator, matchAgainstAnyProp) {\n  var shouldMatchPrimitives = isObject(expression) && ('$' in expression);\n  var predicateFn;\n\n  if (comparator === true) {\n    comparator = equals;\n  } else if (!isFunction(comparator)) {\n    comparator = function(actual, expected) {\n      if (isUndefined(actual)) {\n        // No substring matching against `undefined`\n        return false;\n      }\n      if ((actual === null) || (expected === null)) {\n        // No substring matching against `null`; only match against `null`\n        return actual === expected;\n      }\n      if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {\n        // Should not compare primitives against objects, unless they have custom `toString` method\n        return false;\n      }\n\n      actual = lowercase('' + actual);\n      expected = lowercase('' + expected);\n      return actual.indexOf(expected) !== -1;\n    };\n  }\n\n  predicateFn = function(item) {\n    if (shouldMatchPrimitives && !isObject(item)) {\n      return deepCompare(item, expression.$, comparator, false);\n    }\n    return deepCompare(item, expression, comparator, matchAgainstAnyProp);\n  };\n\n  return predicateFn;\n}\n\nfunction deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {\n  var actualType = getTypeForFilter(actual);\n  var expectedType = getTypeForFilter(expected);\n\n  if ((expectedType === 'string') && (expected.charAt(0) === '!')) {\n    return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);\n  } else if (isArray(actual)) {\n    // In case `actual` is an array, consider it a match\n    // if ANY of it's items matches `expected`\n    return actual.some(function(item) {\n      return deepCompare(item, expected, comparator, matchAgainstAnyProp);\n    });\n  }\n\n  switch (actualType) {\n    case 'object':\n      var key;\n      if (matchAgainstAnyProp) {\n        for (key in actual) {\n          if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {\n            return true;\n          }\n        }\n        return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);\n      } else if (expectedType === 'object') {\n        for (key in expected) {\n          var expectedVal = expected[key];\n          if (isFunction(expectedVal) || isUndefined(expectedVal)) {\n            continue;\n          }\n\n          var matchAnyProperty = key === '$';\n          var actualVal = matchAnyProperty ? actual : actual[key];\n          if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {\n            return false;\n          }\n        }\n        return true;\n      } else {\n        return comparator(actual, expected);\n      }\n      break;\n    case 'function':\n      return false;\n    default:\n      return comparator(actual, expected);\n  }\n}\n\n// Used for easily differentiating between `null` and actual `object`\nfunction getTypeForFilter(val) {\n  return (val === null) ? 'null' : typeof val;\n}\n\nvar MAX_DIGITS = 22;\nvar DECIMAL_SEP = '.';\nvar ZERO_CHAR = '0';\n\n/**\n * @ngdoc filter\n * @name currency\n * @kind function\n *\n * @description\n * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default\n * symbol for current locale is used.\n *\n * @param {number} amount Input to filter.\n * @param {string=} symbol Currency symbol or identifier to be displayed.\n * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale\n * @returns {string} Formatted number.\n *\n *\n * @example\n   <example module=\"currencyExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('currencyExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.amount = 1234.56;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"number\" ng-model=\"amount\" aria-label=\"amount\"> <br>\n         default currency symbol ($): <span id=\"currency-default\">{{amount | currency}}</span><br>\n         custom currency identifier (USD$): <span id=\"currency-custom\">{{amount | currency:\"USD$\"}}</span>\n         no fractions (0): <span id=\"currency-no-fractions\">{{amount | currency:\"USD$\":0}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should init with 1234.56', function() {\n         expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');\n         expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');\n         expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');\n       });\n       it('should update', function() {\n         if (browser.params.browser == 'safari') {\n           // Safari does not understand the minus key. See\n           // https://github.com/angular/protractor/issues/481\n           return;\n         }\n         element(by.model('amount')).clear();\n         element(by.model('amount')).sendKeys('-1234');\n         expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');\n         expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');\n         expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');\n       });\n     </file>\n   </example>\n */\ncurrencyFilter.$inject = ['$locale'];\nfunction currencyFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(amount, currencySymbol, fractionSize) {\n    if (isUndefined(currencySymbol)) {\n      currencySymbol = formats.CURRENCY_SYM;\n    }\n\n    if (isUndefined(fractionSize)) {\n      fractionSize = formats.PATTERNS[1].maxFrac;\n    }\n\n    // if null or undefined pass it through\n    return (amount == null)\n        ? amount\n        : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).\n            replace(/\\u00A4/g, currencySymbol);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name number\n * @kind function\n *\n * @description\n * Formats a number as text.\n *\n * If the input is null or undefined, it will just be returned.\n * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively.\n * If the input is not a number an empty string is returned.\n *\n *\n * @param {number|string} number Number to format.\n * @param {(number|string)=} fractionSize Number of decimal places to round the number to.\n * If this is not provided then the fraction size is computed from the current locale's number\n * formatting pattern. In the case of the default locale, it will be 3.\n * @returns {string} Number rounded to fractionSize and places a “,” after each third digit.\n *\n * @example\n   <example module=\"numberFilterExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('numberFilterExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.val = 1234.56789;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>Enter number: <input ng-model='val'></label><br>\n         Default formatting: <span id='number-default'>{{val | number}}</span><br>\n         No fractions: <span>{{val | number:0}}</span><br>\n         Negative number: <span>{{-val | number:4}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format numbers', function() {\n         expect(element(by.id('number-default')).getText()).toBe('1,234.568');\n         expect(element(by.binding('val | number:0')).getText()).toBe('1,235');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');\n       });\n\n       it('should update', function() {\n         element(by.model('val')).clear();\n         element(by.model('val')).sendKeys('3374.333');\n         expect(element(by.id('number-default')).getText()).toBe('3,374.333');\n         expect(element(by.binding('val | number:0')).getText()).toBe('3,374');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');\n      });\n     </file>\n   </example>\n */\nnumberFilter.$inject = ['$locale'];\nfunction numberFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(number, fractionSize) {\n\n    // if null or undefined pass it through\n    return (number == null)\n        ? number\n        : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,\n                       fractionSize);\n  };\n}\n\n/**\n * Parse a number (as a string) into three components that can be used\n * for formatting the number.\n *\n * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)\n *\n * @param  {string} numStr The number to parse\n * @return {object} An object describing this number, containing the following keys:\n *  - d : an array of digits containing leading zeros as necessary\n *  - i : the number of the digits in `d` that are to the left of the decimal point\n *  - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d`\n *\n */\nfunction parse(numStr) {\n  var exponent = 0, digits, numberOfIntegerDigits;\n  var i, j, zeros;\n\n  // Decimal point?\n  if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {\n    numStr = numStr.replace(DECIMAL_SEP, '');\n  }\n\n  // Exponential form?\n  if ((i = numStr.search(/e/i)) > 0) {\n    // Work out the exponent.\n    if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;\n    numberOfIntegerDigits += +numStr.slice(i + 1);\n    numStr = numStr.substring(0, i);\n  } else if (numberOfIntegerDigits < 0) {\n    // There was no decimal point or exponent so it is an integer.\n    numberOfIntegerDigits = numStr.length;\n  }\n\n  // Count the number of leading zeros.\n  for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++) {/* jshint noempty: false */}\n\n  if (i == (zeros = numStr.length)) {\n    // The digits are all zero.\n    digits = [0];\n    numberOfIntegerDigits = 1;\n  } else {\n    // Count the number of trailing zeros\n    zeros--;\n    while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;\n\n    // Trailing zeros are insignificant so ignore them\n    numberOfIntegerDigits -= i;\n    digits = [];\n    // Convert string to array of digits without leading/trailing zeros.\n    for (j = 0; i <= zeros; i++, j++) {\n      digits[j] = +numStr.charAt(i);\n    }\n  }\n\n  // If the number overflows the maximum allowed digits then use an exponent.\n  if (numberOfIntegerDigits > MAX_DIGITS) {\n    digits = digits.splice(0, MAX_DIGITS - 1);\n    exponent = numberOfIntegerDigits - 1;\n    numberOfIntegerDigits = 1;\n  }\n\n  return { d: digits, e: exponent, i: numberOfIntegerDigits };\n}\n\n/**\n * Round the parsed number to the specified number of decimal places\n * This function changed the parsedNumber in-place\n */\nfunction roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {\n    var digits = parsedNumber.d;\n    var fractionLen = digits.length - parsedNumber.i;\n\n    // determine fractionSize if it is not specified; `+fractionSize` converts it to a number\n    fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;\n\n    // The index of the digit to where rounding is to occur\n    var roundAt = fractionSize + parsedNumber.i;\n    var digit = digits[roundAt];\n\n    if (roundAt > 0) {\n      // Drop fractional digits beyond `roundAt`\n      digits.splice(Math.max(parsedNumber.i, roundAt));\n\n      // Set non-fractional digits beyond `roundAt` to 0\n      for (var j = roundAt; j < digits.length; j++) {\n        digits[j] = 0;\n      }\n    } else {\n      // We rounded to zero so reset the parsedNumber\n      fractionLen = Math.max(0, fractionLen);\n      parsedNumber.i = 1;\n      digits.length = Math.max(1, roundAt = fractionSize + 1);\n      digits[0] = 0;\n      for (var i = 1; i < roundAt; i++) digits[i] = 0;\n    }\n\n    if (digit >= 5) {\n      if (roundAt - 1 < 0) {\n        for (var k = 0; k > roundAt; k--) {\n          digits.unshift(0);\n          parsedNumber.i++;\n        }\n        digits.unshift(1);\n        parsedNumber.i++;\n      } else {\n        digits[roundAt - 1]++;\n      }\n    }\n\n    // Pad out with zeros to get the required fraction length\n    for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);\n\n\n    // Do any carrying, e.g. a digit was rounded up to 10\n    var carry = digits.reduceRight(function(carry, d, i, digits) {\n      d = d + carry;\n      digits[i] = d % 10;\n      return Math.floor(d / 10);\n    }, 0);\n    if (carry) {\n      digits.unshift(carry);\n      parsedNumber.i++;\n    }\n}\n\n/**\n * Format a number into a string\n * @param  {number} number       The number to format\n * @param  {{\n *           minFrac, // the minimum number of digits required in the fraction part of the number\n *           maxFrac, // the maximum number of digits required in the fraction part of the number\n *           gSize,   // number of digits in each group of separated digits\n *           lgSize,  // number of digits in the last group of digits before the decimal separator\n *           negPre,  // the string to go in front of a negative number (e.g. `-` or `(`))\n *           posPre,  // the string to go in front of a positive number\n *           negSuf,  // the string to go after a negative number (e.g. `)`)\n *           posSuf   // the string to go after a positive number\n *         }} pattern\n * @param  {string} groupSep     The string to separate groups of number (e.g. `,`)\n * @param  {string} decimalSep   The string to act as the decimal separator (e.g. `.`)\n * @param  {[type]} fractionSize The size of the fractional part of the number\n * @return {string}              The number formatted as a string\n */\nfunction formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {\n\n  if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';\n\n  var isInfinity = !isFinite(number);\n  var isZero = false;\n  var numStr = Math.abs(number) + '',\n      formattedText = '',\n      parsedNumber;\n\n  if (isInfinity) {\n    formattedText = '\\u221e';\n  } else {\n    parsedNumber = parse(numStr);\n\n    roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);\n\n    var digits = parsedNumber.d;\n    var integerLen = parsedNumber.i;\n    var exponent = parsedNumber.e;\n    var decimals = [];\n    isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);\n\n    // pad zeros for small numbers\n    while (integerLen < 0) {\n      digits.unshift(0);\n      integerLen++;\n    }\n\n    // extract decimals digits\n    if (integerLen > 0) {\n      decimals = digits.splice(integerLen);\n    } else {\n      decimals = digits;\n      digits = [0];\n    }\n\n    // format the integer digits with grouping separators\n    var groups = [];\n    if (digits.length >= pattern.lgSize) {\n      groups.unshift(digits.splice(-pattern.lgSize).join(''));\n    }\n    while (digits.length > pattern.gSize) {\n      groups.unshift(digits.splice(-pattern.gSize).join(''));\n    }\n    if (digits.length) {\n      groups.unshift(digits.join(''));\n    }\n    formattedText = groups.join(groupSep);\n\n    // append the decimal digits\n    if (decimals.length) {\n      formattedText += decimalSep + decimals.join('');\n    }\n\n    if (exponent) {\n      formattedText += 'e+' + exponent;\n    }\n  }\n  if (number < 0 && !isZero) {\n    return pattern.negPre + formattedText + pattern.negSuf;\n  } else {\n    return pattern.posPre + formattedText + pattern.posSuf;\n  }\n}\n\nfunction padNumber(num, digits, trim, negWrap) {\n  var neg = '';\n  if (num < 0 || (negWrap && num <= 0)) {\n    if (negWrap) {\n      num = -num + 1;\n    } else {\n      num = -num;\n      neg = '-';\n    }\n  }\n  num = '' + num;\n  while (num.length < digits) num = ZERO_CHAR + num;\n  if (trim) {\n    num = num.substr(num.length - digits);\n  }\n  return neg + num;\n}\n\n\nfunction dateGetter(name, size, offset, trim, negWrap) {\n  offset = offset || 0;\n  return function(date) {\n    var value = date['get' + name]();\n    if (offset > 0 || value > -offset) {\n      value += offset;\n    }\n    if (value === 0 && offset == -12) value = 12;\n    return padNumber(value, size, trim, negWrap);\n  };\n}\n\nfunction dateStrGetter(name, shortForm, standAlone) {\n  return function(date, formats) {\n    var value = date['get' + name]();\n    var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : '');\n    var get = uppercase(propPrefix + name);\n\n    return formats[get][value];\n  };\n}\n\nfunction timeZoneGetter(date, formats, offset) {\n  var zone = -1 * offset;\n  var paddedZone = (zone >= 0) ? \"+\" : \"\";\n\n  paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +\n                padNumber(Math.abs(zone % 60), 2);\n\n  return paddedZone;\n}\n\nfunction getFirstThursdayOfYear(year) {\n    // 0 = index of January\n    var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();\n    // 4 = index of Thursday (+1 to account for 1st = 5)\n    // 11 = index of *next* Thursday (+1 account for 1st = 12)\n    return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);\n}\n\nfunction getThursdayThisWeek(datetime) {\n    return new Date(datetime.getFullYear(), datetime.getMonth(),\n      // 4 = index of Thursday\n      datetime.getDate() + (4 - datetime.getDay()));\n}\n\nfunction weekGetter(size) {\n   return function(date) {\n      var firstThurs = getFirstThursdayOfYear(date.getFullYear()),\n         thisThurs = getThursdayThisWeek(date);\n\n      var diff = +thisThurs - +firstThurs,\n         result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week\n\n      return padNumber(result, size);\n   };\n}\n\nfunction ampmGetter(date, formats) {\n  return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];\n}\n\nfunction eraGetter(date, formats) {\n  return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];\n}\n\nfunction longEraGetter(date, formats) {\n  return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];\n}\n\nvar DATE_FORMATS = {\n  yyyy: dateGetter('FullYear', 4, 0, false, true),\n    yy: dateGetter('FullYear', 2, 0, true, true),\n     y: dateGetter('FullYear', 1, 0, false, true),\n  MMMM: dateStrGetter('Month'),\n   MMM: dateStrGetter('Month', true),\n    MM: dateGetter('Month', 2, 1),\n     M: dateGetter('Month', 1, 1),\n  LLLL: dateStrGetter('Month', false, true),\n    dd: dateGetter('Date', 2),\n     d: dateGetter('Date', 1),\n    HH: dateGetter('Hours', 2),\n     H: dateGetter('Hours', 1),\n    hh: dateGetter('Hours', 2, -12),\n     h: dateGetter('Hours', 1, -12),\n    mm: dateGetter('Minutes', 2),\n     m: dateGetter('Minutes', 1),\n    ss: dateGetter('Seconds', 2),\n     s: dateGetter('Seconds', 1),\n     // while ISO 8601 requires fractions to be prefixed with `.` or `,`\n     // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions\n   sss: dateGetter('Milliseconds', 3),\n  EEEE: dateStrGetter('Day'),\n   EEE: dateStrGetter('Day', true),\n     a: ampmGetter,\n     Z: timeZoneGetter,\n    ww: weekGetter(2),\n     w: weekGetter(1),\n     G: eraGetter,\n     GG: eraGetter,\n     GGG: eraGetter,\n     GGGG: longEraGetter\n};\n\nvar DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,\n    NUMBER_STRING = /^\\-?\\d+$/;\n\n/**\n * @ngdoc filter\n * @name date\n * @kind function\n *\n * @description\n *   Formats `date` to a string based on the requested `format`.\n *\n *   `format` string can be composed of the following elements:\n *\n *   * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)\n *   * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)\n *   * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)\n *   * `'MMMM'`: Month in year (January-December)\n *   * `'MMM'`: Month in year (Jan-Dec)\n *   * `'MM'`: Month in year, padded (01-12)\n *   * `'M'`: Month in year (1-12)\n *   * `'LLLL'`: Stand-alone month in year (January-December)\n *   * `'dd'`: Day in month, padded (01-31)\n *   * `'d'`: Day in month (1-31)\n *   * `'EEEE'`: Day in Week,(Sunday-Saturday)\n *   * `'EEE'`: Day in Week, (Sun-Sat)\n *   * `'HH'`: Hour in day, padded (00-23)\n *   * `'H'`: Hour in day (0-23)\n *   * `'hh'`: Hour in AM/PM, padded (01-12)\n *   * `'h'`: Hour in AM/PM, (1-12)\n *   * `'mm'`: Minute in hour, padded (00-59)\n *   * `'m'`: Minute in hour (0-59)\n *   * `'ss'`: Second in minute, padded (00-59)\n *   * `'s'`: Second in minute (0-59)\n *   * `'sss'`: Millisecond in second, padded (000-999)\n *   * `'a'`: AM/PM marker\n *   * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)\n *   * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year\n *   * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year\n *   * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')\n *   * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')\n *\n *   `format` string can also be one of the following predefined\n *   {@link guide/i18n localizable formats}:\n *\n *   * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale\n *     (e.g. Sep 3, 2010 12:05:08 PM)\n *   * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US  locale (e.g. 9/3/10 12:05 PM)\n *   * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US  locale\n *     (e.g. Friday, September 3, 2010)\n *   * `'longDate'`: equivalent to `'MMMM d, y'` for en_US  locale (e.g. September 3, 2010)\n *   * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US  locale (e.g. Sep 3, 2010)\n *   * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)\n *   * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)\n *   * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)\n *\n *   `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.\n *   `\"h 'in the morning'\"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence\n *   (e.g. `\"h 'o''clock'\"`).\n *\n * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or\n *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its\n *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is\n *    specified in the string input, the time is considered to be in the local timezone.\n * @param {string=} format Formatting rules (see Description). If not specified,\n *    `mediumDate` is used.\n * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the\n *    continental US time zone abbreviations, but for general use, use a time zone offset, for\n *    example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n *    If not specified, the timezone of the browser will be used.\n * @returns {string} Formatted string or the input if input is not recognized as date/millis.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:\n           <span>{{1288323623006 | date:'medium'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:\n          <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:\n          <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:\"MM/dd/yyyy 'at' h:mma\"}}</span>:\n          <span>{{'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"}}</span><br>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format date', function() {\n         expect(element(by.binding(\"1288323623006 | date:'medium'\")).getText()).\n            toMatch(/Oct 2\\d, 2010 \\d{1,2}:\\d{2}:\\d{2} (AM|PM)/);\n         expect(element(by.binding(\"1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'\")).getText()).\n            toMatch(/2010\\-10\\-2\\d \\d{2}:\\d{2}:\\d{2} (\\-|\\+)?\\d{4}/);\n         expect(element(by.binding(\"'1288323623006' | date:'MM/dd/yyyy @ h:mma'\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 @ \\d{1,2}:\\d{2}(AM|PM)/);\n         expect(element(by.binding(\"'1288323623006' | date:\\\"MM/dd/yyyy 'at' h:mma\\\"\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 at \\d{1,2}:\\d{2}(AM|PM)/);\n       });\n     </file>\n   </example>\n */\ndateFilter.$inject = ['$locale'];\nfunction dateFilter($locale) {\n\n\n  var R_ISO8601_STR = /^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;\n                     // 1        2       3         4          5          6          7          8  9     10      11\n  function jsonStringToDate(string) {\n    var match;\n    if (match = string.match(R_ISO8601_STR)) {\n      var date = new Date(0),\n          tzHour = 0,\n          tzMin  = 0,\n          dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,\n          timeSetter = match[8] ? date.setUTCHours : date.setHours;\n\n      if (match[9]) {\n        tzHour = toInt(match[9] + match[10]);\n        tzMin = toInt(match[9] + match[11]);\n      }\n      dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));\n      var h = toInt(match[4] || 0) - tzHour;\n      var m = toInt(match[5] || 0) - tzMin;\n      var s = toInt(match[6] || 0);\n      var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n      timeSetter.call(date, h, m, s, ms);\n      return date;\n    }\n    return string;\n  }\n\n\n  return function(date, format, timezone) {\n    var text = '',\n        parts = [],\n        fn, match;\n\n    format = format || 'mediumDate';\n    format = $locale.DATETIME_FORMATS[format] || format;\n    if (isString(date)) {\n      date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);\n    }\n\n    if (isNumber(date)) {\n      date = new Date(date);\n    }\n\n    if (!isDate(date) || !isFinite(date.getTime())) {\n      return date;\n    }\n\n    while (format) {\n      match = DATE_FORMATS_SPLIT.exec(format);\n      if (match) {\n        parts = concat(parts, match, 1);\n        format = parts.pop();\n      } else {\n        parts.push(format);\n        format = null;\n      }\n    }\n\n    var dateTimezoneOffset = date.getTimezoneOffset();\n    if (timezone) {\n      dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n      date = convertTimezoneToLocal(date, timezone, true);\n    }\n    forEach(parts, function(value) {\n      fn = DATE_FORMATS[value];\n      text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)\n                 : value === \"''\" ? \"'\" : value.replace(/(^'|'$)/g, '').replace(/''/g, \"'\");\n    });\n\n    return text;\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name json\n * @kind function\n *\n * @description\n *   Allows you to convert a JavaScript object into JSON string.\n *\n *   This filter is mostly useful for debugging. When using the double curly {{value}} notation\n *   the binding is automatically converted to JSON.\n *\n * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.\n * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.\n * @returns {string} JSON string.\n *\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <pre id=\"default-spacing\">{{ {'name':'value'} | json }}</pre>\n       <pre id=\"custom-spacing\">{{ {'name':'value'} | json:4 }}</pre>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should jsonify filtered objects', function() {\n         expect(element(by.id('default-spacing')).getText()).toMatch(/\\{\\n  \"name\": ?\"value\"\\n}/);\n         expect(element(by.id('custom-spacing')).getText()).toMatch(/\\{\\n    \"name\": ?\"value\"\\n}/);\n       });\n     </file>\n   </example>\n *\n */\nfunction jsonFilter() {\n  return function(object, spacing) {\n    if (isUndefined(spacing)) {\n        spacing = 2;\n    }\n    return toJson(object, spacing);\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name lowercase\n * @kind function\n * @description\n * Converts string to lowercase.\n * @see angular.lowercase\n */\nvar lowercaseFilter = valueFn(lowercase);\n\n\n/**\n * @ngdoc filter\n * @name uppercase\n * @kind function\n * @description\n * Converts string to uppercase.\n * @see angular.uppercase\n */\nvar uppercaseFilter = valueFn(uppercase);\n\n/**\n * @ngdoc filter\n * @name limitTo\n * @kind function\n *\n * @description\n * Creates a new array or string containing only a specified number of elements. The elements\n * are taken from either the beginning or the end of the source array, string or number, as specified by\n * the value and sign (positive or negative) of `limit`. If a number is used as input, it is\n * converted to a string.\n *\n * @param {Array|string|number} input Source array, string or number to be limited.\n * @param {string|number} limit The length of the returned array or string. If the `limit` number\n *     is positive, `limit` number of items from the beginning of the source array/string are copied.\n *     If the number is negative, `limit` number  of items from the end of the source array/string\n *     are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,\n *     the input will be returned unchanged.\n * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`\n *     indicates an offset from the end of `input`. Defaults to `0`.\n * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array\n *     had less than `limit` elements.\n *\n * @example\n   <example module=\"limitToExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('limitToExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.numbers = [1,2,3,4,5,6,7,8,9];\n             $scope.letters = \"abcdefghi\";\n             $scope.longNumber = 2345432342;\n             $scope.numLimit = 3;\n             $scope.letterLimit = 3;\n             $scope.longNumberLimit = 3;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>\n            Limit {{numbers}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"numLimit\">\n         </label>\n         <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>\n         <label>\n            Limit {{letters}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"letterLimit\">\n         </label>\n         <p>Output letters: {{ letters | limitTo:letterLimit }}</p>\n         <label>\n            Limit {{longNumber}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"longNumberLimit\">\n         </label>\n         <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var numLimitInput = element(by.model('numLimit'));\n       var letterLimitInput = element(by.model('letterLimit'));\n       var longNumberLimitInput = element(by.model('longNumberLimit'));\n       var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));\n       var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));\n       var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));\n\n       it('should limit the number array to first three items', function() {\n         expect(numLimitInput.getAttribute('value')).toBe('3');\n         expect(letterLimitInput.getAttribute('value')).toBe('3');\n         expect(longNumberLimitInput.getAttribute('value')).toBe('3');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abc');\n         expect(limitedLongNumber.getText()).toEqual('Output long number: 234');\n       });\n\n       // There is a bug in safari and protractor that doesn't like the minus key\n       // it('should update the output when -3 is entered', function() {\n       //   numLimitInput.clear();\n       //   numLimitInput.sendKeys('-3');\n       //   letterLimitInput.clear();\n       //   letterLimitInput.sendKeys('-3');\n       //   longNumberLimitInput.clear();\n       //   longNumberLimitInput.sendKeys('-3');\n       //   expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');\n       //   expect(limitedLetters.getText()).toEqual('Output letters: ghi');\n       //   expect(limitedLongNumber.getText()).toEqual('Output long number: 342');\n       // });\n\n       it('should not exceed the maximum size of input array', function() {\n         numLimitInput.clear();\n         numLimitInput.sendKeys('100');\n         letterLimitInput.clear();\n         letterLimitInput.sendKeys('100');\n         longNumberLimitInput.clear();\n         longNumberLimitInput.sendKeys('100');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');\n         expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');\n       });\n     </file>\n   </example>\n*/\nfunction limitToFilter() {\n  return function(input, limit, begin) {\n    if (Math.abs(Number(limit)) === Infinity) {\n      limit = Number(limit);\n    } else {\n      limit = toInt(limit);\n    }\n    if (isNaN(limit)) return input;\n\n    if (isNumber(input)) input = input.toString();\n    if (!isArray(input) && !isString(input)) return input;\n\n    begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);\n    begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;\n\n    if (limit >= 0) {\n      return input.slice(begin, begin + limit);\n    } else {\n      if (begin === 0) {\n        return input.slice(limit, input.length);\n      } else {\n        return input.slice(Math.max(0, begin + limit), begin);\n      }\n    }\n  };\n}\n\n/**\n * @ngdoc filter\n * @name orderBy\n * @kind function\n *\n * @description\n * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically\n * for strings and numerically for numbers. Note: if you notice numbers are not being sorted\n * as expected, make sure they are actually being saved as numbers and not strings.\n * Array-like values (e.g. NodeLists, jQuery objects, TypedArrays, Strings, etc) are also supported.\n *\n * @param {Array} array The array (or array-like object) to sort.\n * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be\n *    used by the comparator to determine the order of elements.\n *\n *    Can be one of:\n *\n *    - `function`: Getter function. The result of this function will be sorted using the\n *      `<`, `===`, `>` operator.\n *    - `string`: An Angular expression. The result of this expression is used to compare elements\n *      (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by\n *      3 first characters of a property called `name`). The result of a constant expression\n *      is interpreted as a property name to be used in comparisons (for example `\"special name\"`\n *      to sort object by the value of their `special name` property). An expression can be\n *      optionally prefixed with `+` or `-` to control ascending or descending sort order\n *      (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array\n *      element itself is used to compare where sorting.\n *    - `Array`: An array of function or string predicates. The first predicate in the array\n *      is used for sorting, but when two items are equivalent, the next predicate is used.\n *\n *    If the predicate is missing or empty then it defaults to `'+'`.\n *\n * @param {boolean=} reverse Reverse the order of the array.\n * @returns {Array} Sorted copy of the source array.\n *\n *\n * @example\n * The example below demonstrates a simple ngRepeat, where the data is sorted\n * by age in descending order (predicate is set to `'-age'`).\n * `reverse` is not set, which means it defaults to `false`.\n   <example module=\"orderByExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <table class=\"friend\">\n           <tr>\n             <th>Name</th>\n             <th>Phone Number</th>\n             <th>Age</th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:'-age'\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('orderByExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.friends =\n               [{name:'John', phone:'555-1212', age:10},\n                {name:'Mary', phone:'555-9876', age:19},\n                {name:'Mike', phone:'555-4321', age:21},\n                {name:'Adam', phone:'555-5678', age:35},\n                {name:'Julie', phone:'555-8765', age:29}];\n         }]);\n     </file>\n   </example>\n *\n * The predicate and reverse parameters can be controlled dynamically through scope properties,\n * as shown in the next example.\n * @example\n   <example module=\"orderByExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n         <hr/>\n         <button ng-click=\"predicate=''\">Set to unsorted</button>\n         <table class=\"friend\">\n           <tr>\n            <th>\n                <button ng-click=\"order('name')\">Name</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n            <th>\n                <button ng-click=\"order('phone')\">Phone Number</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n            <th>\n                <button ng-click=\"order('age')\">Age</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:predicate:reverse\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('orderByExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.friends =\n               [{name:'John', phone:'555-1212', age:10},\n                {name:'Mary', phone:'555-9876', age:19},\n                {name:'Mike', phone:'555-4321', age:21},\n                {name:'Adam', phone:'555-5678', age:35},\n                {name:'Julie', phone:'555-8765', age:29}];\n           $scope.predicate = 'age';\n           $scope.reverse = true;\n           $scope.order = function(predicate) {\n             $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n             $scope.predicate = predicate;\n           };\n         }]);\n      </file>\n     <file name=\"style.css\">\n       .sortorder:after {\n         content: '\\25b2';\n       }\n       .sortorder.reverse:after {\n         content: '\\25bc';\n       }\n     </file>\n   </example>\n *\n * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the\n * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the\n * desired parameters.\n *\n * Example:\n *\n * @example\n  <example module=\"orderByExample\">\n    <file name=\"index.html\">\n    <div ng-controller=\"ExampleController\">\n      <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n      <table class=\"friend\">\n        <tr>\n          <th>\n              <button ng-click=\"order('name')\">Name</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n          <th>\n              <button ng-click=\"order('phone')\">Phone Number</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n          <th>\n              <button ng-click=\"order('age')\">Age</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n        </tr>\n        <tr ng-repeat=\"friend in friends\">\n          <td>{{friend.name}}</td>\n          <td>{{friend.phone}}</td>\n          <td>{{friend.age}}</td>\n        </tr>\n      </table>\n    </div>\n    </file>\n\n    <file name=\"script.js\">\n      angular.module('orderByExample', [])\n        .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {\n          var orderBy = $filter('orderBy');\n          $scope.friends = [\n            { name: 'John',    phone: '555-1212',    age: 10 },\n            { name: 'Mary',    phone: '555-9876',    age: 19 },\n            { name: 'Mike',    phone: '555-4321',    age: 21 },\n            { name: 'Adam',    phone: '555-5678',    age: 35 },\n            { name: 'Julie',   phone: '555-8765',    age: 29 }\n          ];\n          $scope.order = function(predicate) {\n            $scope.predicate = predicate;\n            $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n            $scope.friends = orderBy($scope.friends, predicate, $scope.reverse);\n          };\n          $scope.order('age', true);\n        }]);\n    </file>\n\n    <file name=\"style.css\">\n       .sortorder:after {\n         content: '\\25b2';\n       }\n       .sortorder.reverse:after {\n         content: '\\25bc';\n       }\n    </file>\n</example>\n */\norderByFilter.$inject = ['$parse'];\nfunction orderByFilter($parse) {\n  return function(array, sortPredicate, reverseOrder) {\n\n    if (array == null) return array;\n    if (!isArrayLike(array)) {\n      throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);\n    }\n\n    if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }\n    if (sortPredicate.length === 0) { sortPredicate = ['+']; }\n\n    var predicates = processPredicates(sortPredicate, reverseOrder);\n    // Add a predicate at the end that evaluates to the element index. This makes the\n    // sort stable as it works as a tie-breaker when all the input predicates cannot\n    // distinguish between two elements.\n    predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});\n\n    // The next three lines are a version of a Swartzian Transform idiom from Perl\n    // (sometimes called the Decorate-Sort-Undecorate idiom)\n    // See https://en.wikipedia.org/wiki/Schwartzian_transform\n    var compareValues = Array.prototype.map.call(array, getComparisonObject);\n    compareValues.sort(doComparison);\n    array = compareValues.map(function(item) { return item.value; });\n\n    return array;\n\n    function getComparisonObject(value, index) {\n      return {\n        value: value,\n        predicateValues: predicates.map(function(predicate) {\n          return getPredicateValue(predicate.get(value), index);\n        })\n      };\n    }\n\n    function doComparison(v1, v2) {\n      var result = 0;\n      for (var index=0, length = predicates.length; index < length; ++index) {\n        result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;\n        if (result) break;\n      }\n      return result;\n    }\n  };\n\n  function processPredicates(sortPredicate, reverseOrder) {\n    reverseOrder = reverseOrder ? -1 : 1;\n    return sortPredicate.map(function(predicate) {\n      var descending = 1, get = identity;\n\n      if (isFunction(predicate)) {\n        get = predicate;\n      } else if (isString(predicate)) {\n        if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {\n          descending = predicate.charAt(0) == '-' ? -1 : 1;\n          predicate = predicate.substring(1);\n        }\n        if (predicate !== '') {\n          get = $parse(predicate);\n          if (get.constant) {\n            var key = get();\n            get = function(value) { return value[key]; };\n          }\n        }\n      }\n      return { get: get, descending: descending * reverseOrder };\n    });\n  }\n\n  function isPrimitive(value) {\n    switch (typeof value) {\n      case 'number': /* falls through */\n      case 'boolean': /* falls through */\n      case 'string':\n        return true;\n      default:\n        return false;\n    }\n  }\n\n  function objectValue(value, index) {\n    // If `valueOf` is a valid function use that\n    if (typeof value.valueOf === 'function') {\n      value = value.valueOf();\n      if (isPrimitive(value)) return value;\n    }\n    // If `toString` is a valid function and not the one from `Object.prototype` use that\n    if (hasCustomToString(value)) {\n      value = value.toString();\n      if (isPrimitive(value)) return value;\n    }\n    // We have a basic object so we use the position of the object in the collection\n    return index;\n  }\n\n  function getPredicateValue(value, index) {\n    var type = typeof value;\n    if (value === null) {\n      type = 'string';\n      value = 'null';\n    } else if (type === 'string') {\n      value = value.toLowerCase();\n    } else if (type === 'object') {\n      value = objectValue(value, index);\n    }\n    return { value: value, type: type };\n  }\n\n  function compare(v1, v2) {\n    var result = 0;\n    if (v1.type === v2.type) {\n      if (v1.value !== v2.value) {\n        result = v1.value < v2.value ? -1 : 1;\n      }\n    } else {\n      result = v1.type < v2.type ? -1 : 1;\n    }\n    return result;\n  }\n}\n\nfunction ngDirective(directive) {\n  if (isFunction(directive)) {\n    directive = {\n      link: directive\n    };\n  }\n  directive.restrict = directive.restrict || 'AC';\n  return valueFn(directive);\n}\n\n/**\n * @ngdoc directive\n * @name a\n * @restrict E\n *\n * @description\n * Modifies the default behavior of the html A tag so that the default action is prevented when\n * the href attribute is empty.\n *\n * This change permits the easy creation of action links with the `ngClick` directive\n * without changing the location or causing page reloads, e.g.:\n * `<a href=\"\" ng-click=\"list.addItem()\">Add Item</a>`\n */\nvar htmlAnchorDirective = valueFn({\n  restrict: 'E',\n  compile: function(element, attr) {\n    if (!attr.href && !attr.xlinkHref) {\n      return function(scope, element) {\n        // If the linked element is not an anchor tag anymore, do nothing\n        if (element[0].nodeName.toLowerCase() !== 'a') return;\n\n        // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n        var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?\n                   'xlink:href' : 'href';\n        element.on('click', function(event) {\n          // if we have no href url, then don't navigate anywhere.\n          if (!element.attr(href)) {\n            event.preventDefault();\n          }\n        });\n      };\n    }\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngHref\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in an href attribute will\n * make the link go to the wrong URL if the user clicks it before\n * Angular has a chance to replace the `{{hash}}` markup with its\n * value. Until Angular replaces the markup the link will be broken\n * and will most likely return a 404 error. The `ngHref` directive\n * solves this problem.\n *\n * The wrong way to write it:\n * ```html\n * <a href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <a ng-href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * @element A\n * @param {template} ngHref any string which can contain `{{}}` markup.\n *\n * @example\n * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes\n * in links and their different behaviors:\n    <example>\n      <file name=\"index.html\">\n        <input ng-model=\"value\" /><br />\n        <a id=\"link-1\" href ng-click=\"value = 1\">link 1</a> (link, don't reload)<br />\n        <a id=\"link-2\" href=\"\" ng-click=\"value = 2\">link 2</a> (link, don't reload)<br />\n        <a id=\"link-3\" ng-href=\"/{{'123'}}\">link 3</a> (link, reload!)<br />\n        <a id=\"link-4\" href=\"\" name=\"xx\" ng-click=\"value = 4\">anchor</a> (link, don't reload)<br />\n        <a id=\"link-5\" name=\"xxx\" ng-click=\"value = 5\">anchor</a> (no link)<br />\n        <a id=\"link-6\" ng-href=\"{{value}}\">link</a> (link, change location)\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should execute ng-click but not reload when href without value', function() {\n          element(by.id('link-1')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('1');\n          expect(element(by.id('link-1')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when href empty string', function() {\n          element(by.id('link-2')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('2');\n          expect(element(by.id('link-2')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click and change url when ng-href specified', function() {\n          expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\\/123$/);\n\n          element(by.id('link-3')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/123$/);\n            });\n          }, 5000, 'page should navigate to /123');\n        });\n\n        it('should execute ng-click but not reload when href empty string and name specified', function() {\n          element(by.id('link-4')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('4');\n          expect(element(by.id('link-4')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when no href but name specified', function() {\n          element(by.id('link-5')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('5');\n          expect(element(by.id('link-5')).getAttribute('href')).toBe(null);\n        });\n\n        it('should only change url when only ng-href', function() {\n          element(by.model('value')).clear();\n          element(by.model('value')).sendKeys('6');\n          expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\\/6$/);\n\n          element(by.id('link-6')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/6$/);\n            });\n          }, 5000, 'page should navigate to /6');\n        });\n      </file>\n    </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngSrc\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `src` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrc` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrc any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngSrcset\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrcset` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrcset any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngDisabled\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * This directive sets the `disabled` attribute on the element if the\n * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `disabled`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Click me to toggle: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n        <button ng-model=\"button\" ng-disabled=\"checked\">Button</button>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle button', function() {\n          expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,\n *     then the `disabled` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngChecked\n * @restrict A\n * @priority 100\n *\n * @description\n * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.\n *\n * Note that this directive should not be used together with {@link ngModel `ngModel`},\n * as this can lead to unexpected behavior.\n *\n * A special directive is necessary because we cannot use interpolation inside the `checked`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to check both: <input type=\"checkbox\" ng-model=\"master\"></label><br/>\n        <input id=\"checkSlave\" type=\"checkbox\" ng-checked=\"master\" aria-label=\"Slave input\">\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should check both checkBoxes', function() {\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();\n          element(by.model('master')).click();\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,\n *     then the `checked` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngReadonly\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `readOnly` attribute on the element, if the expression inside `ngReadonly` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `readOnly`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to make text readonly: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n        <input type=\"text\" ng-readonly=\"checked\" value=\"I'm Angular\" aria-label=\"Readonly field\" />\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle readonly attr', function() {\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,\n *     then special attribute \"readonly\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSelected\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `selected`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to select: <input type=\"checkbox\" ng-model=\"selected\"></label><br/>\n        <select aria-label=\"ngSelected demo\">\n          <option>Hello!</option>\n          <option id=\"greet\" ng-selected=\"selected\">Greetings!</option>\n        </select>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should select Greetings!', function() {\n          expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();\n          element(by.model('selected')).click();\n          expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element OPTION\n * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,\n *     then special attribute \"selected\" will be set on the element\n */\n\n/**\n * @ngdoc directive\n * @name ngOpen\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `open`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n     <example>\n       <file name=\"index.html\">\n         <label>Check me check multiple: <input type=\"checkbox\" ng-model=\"open\"></label><br/>\n         <details id=\"details\" ng-open=\"open\">\n            <summary>Show/Hide me</summary>\n         </details>\n       </file>\n       <file name=\"protractor.js\" type=\"protractor\">\n         it('should toggle open', function() {\n           expect(element(by.id('details')).getAttribute('open')).toBeFalsy();\n           element(by.model('open')).click();\n           expect(element(by.id('details')).getAttribute('open')).toBeTruthy();\n         });\n       </file>\n     </example>\n *\n * @element DETAILS\n * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,\n *     then special attribute \"open\" will be set on the element\n */\n\nvar ngAttributeAliasDirectives = {};\n\n// boolean attrs are evaluated\nforEach(BOOLEAN_ATTR, function(propName, attrName) {\n  // binding to multiple is not supported\n  if (propName == \"multiple\") return;\n\n  function defaultLinkFn(scope, element, attr) {\n    scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {\n      attr.$set(attrName, !!value);\n    });\n  }\n\n  var normalized = directiveNormalize('ng-' + attrName);\n  var linkFn = defaultLinkFn;\n\n  if (propName === 'checked') {\n    linkFn = function(scope, element, attr) {\n      // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input\n      if (attr.ngModel !== attr[normalized]) {\n        defaultLinkFn(scope, element, attr);\n      }\n    };\n  }\n\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      restrict: 'A',\n      priority: 100,\n      link: linkFn\n    };\n  };\n});\n\n// aliased input attrs are evaluated\nforEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {\n  ngAttributeAliasDirectives[ngAttr] = function() {\n    return {\n      priority: 100,\n      link: function(scope, element, attr) {\n        //special case ngPattern when a literal regular expression value\n        //is used as the expression (this way we don't have to watch anything).\n        if (ngAttr === \"ngPattern\" && attr.ngPattern.charAt(0) == \"/\") {\n          var match = attr.ngPattern.match(REGEX_STRING_REGEXP);\n          if (match) {\n            attr.$set(\"ngPattern\", new RegExp(match[1], match[2]));\n            return;\n          }\n        }\n\n        scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {\n          attr.$set(ngAttr, value);\n        });\n      }\n    };\n  };\n});\n\n// ng-src, ng-srcset, ng-href are interpolated\nforEach(['src', 'srcset', 'href'], function(attrName) {\n  var normalized = directiveNormalize('ng-' + attrName);\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      priority: 99, // it needs to run after the attributes are interpolated\n      link: function(scope, element, attr) {\n        var propName = attrName,\n            name = attrName;\n\n        if (attrName === 'href' &&\n            toString.call(element.prop('href')) === '[object SVGAnimatedString]') {\n          name = 'xlinkHref';\n          attr.$attr[name] = 'xlink:href';\n          propName = null;\n        }\n\n        attr.$observe(normalized, function(value) {\n          if (!value) {\n            if (attrName === 'href') {\n              attr.$set(name, null);\n            }\n            return;\n          }\n\n          attr.$set(name, value);\n\n          // on IE, if \"ng:src\" directive declaration is used and \"src\" attribute doesn't exist\n          // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need\n          // to set the property as well to achieve the desired effect.\n          // we use attr[attrName] value since $set can sanitize the url.\n          if (msie && propName) element.prop(propName, attr[name]);\n        });\n      }\n    };\n  };\n});\n\n/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true\n */\nvar nullFormCtrl = {\n  $addControl: noop,\n  $$renameControl: nullFormRenameControl,\n  $removeControl: noop,\n  $setValidity: noop,\n  $setDirty: noop,\n  $setPristine: noop,\n  $setSubmitted: noop\n},\nSUBMITTED_CLASS = 'ng-submitted';\n\nfunction nullFormRenameControl(control, name) {\n  control.$name = name;\n}\n\n/**\n * @ngdoc type\n * @name form.FormController\n *\n * @property {boolean} $pristine True if user has not interacted with the form yet.\n * @property {boolean} $dirty True if user has already interacted with the form.\n * @property {boolean} $valid True if all of the containing forms and controls are valid.\n * @property {boolean} $invalid True if at least one containing control or form is invalid.\n * @property {boolean} $pending True if at least one containing control or form is pending.\n * @property {boolean} $submitted True if user has submitted the form even if its invalid.\n *\n * @property {Object} $error Is an object hash, containing references to controls or\n *  forms with failing validators, where:\n *\n *  - keys are validation tokens (error names),\n *  - values are arrays of controls or forms that have a failing validator for given error name.\n *\n *  Built-in validation tokens:\n *\n *  - `email`\n *  - `max`\n *  - `maxlength`\n *  - `min`\n *  - `minlength`\n *  - `number`\n *  - `pattern`\n *  - `required`\n *  - `url`\n *  - `date`\n *  - `datetimelocal`\n *  - `time`\n *  - `week`\n *  - `month`\n *\n * @description\n * `FormController` keeps track of all its controls and nested forms as well as the state of them,\n * such as being valid/invalid or dirty/pristine.\n *\n * Each {@link ng.directive:form form} directive creates an instance\n * of `FormController`.\n *\n */\n//asks for $scope to fool the BC controller module\nFormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];\nfunction FormController(element, attrs, $scope, $animate, $interpolate) {\n  var form = this,\n      controls = [];\n\n  // init state\n  form.$error = {};\n  form.$$success = {};\n  form.$pending = undefined;\n  form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);\n  form.$dirty = false;\n  form.$pristine = true;\n  form.$valid = true;\n  form.$invalid = false;\n  form.$submitted = false;\n  form.$$parentForm = nullFormCtrl;\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$rollbackViewValue\n   *\n   * @description\n   * Rollback all form controls pending updates to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. This method is typically needed by the reset button of\n   * a form that uses `ng-model-options` to pend updates.\n   */\n  form.$rollbackViewValue = function() {\n    forEach(controls, function(control) {\n      control.$rollbackViewValue();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$commitViewValue\n   *\n   * @description\n   * Commit all form controls pending updates to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`\n   * usually handles calling this in response to input events.\n   */\n  form.$commitViewValue = function() {\n    forEach(controls, function(control) {\n      control.$commitViewValue();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$addControl\n   * @param {object} control control object, either a {@link form.FormController} or an\n   * {@link ngModel.NgModelController}\n   *\n   * @description\n   * Register a control with the form. Input elements using ngModelController do this automatically\n   * when they are linked.\n   *\n   * Note that the current state of the control will not be reflected on the new parent form. This\n   * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`\n   * state.\n   *\n   * However, if the method is used programmatically, for example by adding dynamically created controls,\n   * or controls that have been previously removed without destroying their corresponding DOM element,\n   * it's the developers responsibility to make sure the current state propagates to the parent form.\n   *\n   * For example, if an input control is added that is already `$dirty` and has `$error` properties,\n   * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.\n   */\n  form.$addControl = function(control) {\n    // Breaking change - before, inputs whose name was \"hasOwnProperty\" were quietly ignored\n    // and not added to the scope.  Now we throw an error.\n    assertNotHasOwnProperty(control.$name, 'input');\n    controls.push(control);\n\n    if (control.$name) {\n      form[control.$name] = control;\n    }\n\n    control.$$parentForm = form;\n  };\n\n  // Private API: rename a form control\n  form.$$renameControl = function(control, newName) {\n    var oldName = control.$name;\n\n    if (form[oldName] === control) {\n      delete form[oldName];\n    }\n    form[newName] = control;\n    control.$name = newName;\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$removeControl\n   * @param {object} control control object, either a {@link form.FormController} or an\n   * {@link ngModel.NgModelController}\n   *\n   * @description\n   * Deregister a control from the form.\n   *\n   * Input elements using ngModelController do this automatically when they are destroyed.\n   *\n   * Note that only the removed control's validation state (`$errors`etc.) will be removed from the\n   * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be\n   * different from case to case. For example, removing the only `$dirty` control from a form may or\n   * may not mean that the form is still `$dirty`.\n   */\n  form.$removeControl = function(control) {\n    if (control.$name && form[control.$name] === control) {\n      delete form[control.$name];\n    }\n    forEach(form.$pending, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n    forEach(form.$error, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n    forEach(form.$$success, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n\n    arrayRemove(controls, control);\n    control.$$parentForm = nullFormCtrl;\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setValidity\n   *\n   * @description\n   * Sets the validity of a form control.\n   *\n   * This method will also propagate to parent forms.\n   */\n  addSetValidityMethod({\n    ctrl: this,\n    $element: element,\n    set: function(object, property, controller) {\n      var list = object[property];\n      if (!list) {\n        object[property] = [controller];\n      } else {\n        var index = list.indexOf(controller);\n        if (index === -1) {\n          list.push(controller);\n        }\n      }\n    },\n    unset: function(object, property, controller) {\n      var list = object[property];\n      if (!list) {\n        return;\n      }\n      arrayRemove(list, controller);\n      if (list.length === 0) {\n        delete object[property];\n      }\n    },\n    $animate: $animate\n  });\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setDirty\n   *\n   * @description\n   * Sets the form to a dirty state.\n   *\n   * This method can be called to add the 'ng-dirty' class and set the form to a dirty\n   * state (ng-dirty class). This method will also propagate to parent forms.\n   */\n  form.$setDirty = function() {\n    $animate.removeClass(element, PRISTINE_CLASS);\n    $animate.addClass(element, DIRTY_CLASS);\n    form.$dirty = true;\n    form.$pristine = false;\n    form.$$parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setPristine\n   *\n   * @description\n   * Sets the form to its pristine state.\n   *\n   * This method can be called to remove the 'ng-dirty' class and set the form to its pristine\n   * state (ng-pristine class). This method will also propagate to all the controls contained\n   * in this form.\n   *\n   * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after\n   * saving or resetting it.\n   */\n  form.$setPristine = function() {\n    $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);\n    form.$dirty = false;\n    form.$pristine = true;\n    form.$submitted = false;\n    forEach(controls, function(control) {\n      control.$setPristine();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setUntouched\n   *\n   * @description\n   * Sets the form to its untouched state.\n   *\n   * This method can be called to remove the 'ng-touched' class and set the form controls to their\n   * untouched state (ng-untouched class).\n   *\n   * Setting a form controls back to their untouched state is often useful when setting the form\n   * back to its pristine state.\n   */\n  form.$setUntouched = function() {\n    forEach(controls, function(control) {\n      control.$setUntouched();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setSubmitted\n   *\n   * @description\n   * Sets the form to its submitted state.\n   */\n  form.$setSubmitted = function() {\n    $animate.addClass(element, SUBMITTED_CLASS);\n    form.$submitted = true;\n    form.$$parentForm.$setSubmitted();\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ngForm\n * @restrict EAC\n *\n * @description\n * Nestable alias of {@link ng.directive:form `form`} directive. HTML\n * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a\n * sub-group of controls needs to be determined.\n *\n * Note: the purpose of `ngForm` is to group controls,\n * but not to be a replacement for the `<form>` tag with all of its capabilities\n * (e.g. posting to the server, ...).\n *\n * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n *\n */\n\n /**\n * @ngdoc directive\n * @name form\n * @restrict E\n *\n * @description\n * Directive that instantiates\n * {@link form.FormController FormController}.\n *\n * If the `name` attribute is specified, the form controller is published onto the current scope under\n * this name.\n *\n * # Alias: {@link ng.directive:ngForm `ngForm`}\n *\n * In Angular, forms can be nested. This means that the outer form is valid when all of the child\n * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so\n * Angular provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to\n * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group\n * of controls needs to be determined.\n *\n * # CSS classes\n *  - `ng-valid` is set if the form is valid.\n *  - `ng-invalid` is set if the form is invalid.\n *  - `ng-pending` is set if the form is pending.\n *  - `ng-pristine` is set if the form is pristine.\n *  - `ng-dirty` is set if the form is dirty.\n *  - `ng-submitted` is set if the form was submitted.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n *\n * # Submitting a form and preventing the default action\n *\n * Since the role of forms in client-side Angular applications is different than in classical\n * roundtrip apps, it is desirable for the browser not to translate the form submission into a full\n * page reload that sends the data to the server. Instead some javascript logic should be triggered\n * to handle the form submission in an application-specific way.\n *\n * For this reason, Angular prevents the default action (form submission to the server) unless the\n * `<form>` element has an `action` attribute specified.\n *\n * You can use one of the following two ways to specify what javascript method should be called when\n * a form is submitted:\n *\n * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element\n * - {@link ng.directive:ngClick ngClick} directive on the first\n  *  button or input field of type submit (input[type=submit])\n *\n * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}\n * or {@link ng.directive:ngClick ngClick} directives.\n * This is because of the following form submission rules in the HTML specification:\n *\n * - If a form has only one input field then hitting enter in this field triggers form submit\n * (`ngSubmit`)\n * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter\n * doesn't trigger submit\n * - if a form has one or more input fields and one or more buttons or input[type=submit] then\n * hitting enter in any of the input fields will trigger the click handler on the *first* button or\n * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)\n *\n * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is\n * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * ## Animation Hooks\n *\n * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.\n * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any\n * other validations that are performed within the form. Animations in ngForm are similar to how\n * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well\n * as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style a form element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-form {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-form.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n    <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"formExample\">\n      <file name=\"index.html\">\n       <script>\n         angular.module('formExample', [])\n           .controller('FormController', ['$scope', function($scope) {\n             $scope.userType = 'guest';\n           }]);\n       </script>\n       <style>\n        .my-form {\n          transition:all linear 0.5s;\n          background: transparent;\n        }\n        .my-form.ng-invalid {\n          background: red;\n        }\n       </style>\n       <form name=\"myForm\" ng-controller=\"FormController\" class=\"my-form\">\n         userType: <input name=\"input\" ng-model=\"userType\" required>\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">Required!</span><br>\n         <code>userType = {{userType}}</code><br>\n         <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>\n         <code>myForm.input.$error = {{myForm.input.$error}}</code><br>\n         <code>myForm.$valid = {{myForm.$valid}}</code><br>\n         <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should initialize to model', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n\n          expect(userType.getText()).toContain('guest');\n          expect(valid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var userInput = element(by.model('userType'));\n\n          userInput.clear();\n          userInput.sendKeys('');\n\n          expect(userType.getText()).toEqual('userType =');\n          expect(valid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n *\n * @param {string=} name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n */\nvar formDirectiveFactory = function(isNgForm) {\n  return ['$timeout', '$parse', function($timeout, $parse) {\n    var formDirective = {\n      name: 'form',\n      restrict: isNgForm ? 'EAC' : 'E',\n      require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form\n      controller: FormController,\n      compile: function ngFormCompile(formElement, attr) {\n        // Setup initial state of the control\n        formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);\n\n        var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);\n\n        return {\n          pre: function ngFormPreLink(scope, formElement, attr, ctrls) {\n            var controller = ctrls[0];\n\n            // if `action` attr is not present on the form, prevent the default action (submission)\n            if (!('action' in attr)) {\n              // we can't use jq events because if a form is destroyed during submission the default\n              // action is not prevented. see #1238\n              //\n              // IE 9 is not affected because it doesn't fire a submit event and try to do a full\n              // page reload if the form was destroyed by submission of the form via a click handler\n              // on a button in the form. Looks like an IE9 specific bug.\n              var handleFormSubmission = function(event) {\n                scope.$apply(function() {\n                  controller.$commitViewValue();\n                  controller.$setSubmitted();\n                });\n\n                event.preventDefault();\n              };\n\n              addEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n\n              // unregister the preventDefault listener so that we don't not leak memory but in a\n              // way that will achieve the prevention of the default action.\n              formElement.on('$destroy', function() {\n                $timeout(function() {\n                  removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n                }, 0, false);\n              });\n            }\n\n            var parentFormCtrl = ctrls[1] || controller.$$parentForm;\n            parentFormCtrl.$addControl(controller);\n\n            var setter = nameAttr ? getSetter(controller.$name) : noop;\n\n            if (nameAttr) {\n              setter(scope, controller);\n              attr.$observe(nameAttr, function(newValue) {\n                if (controller.$name === newValue) return;\n                setter(scope, undefined);\n                controller.$$parentForm.$$renameControl(controller, newValue);\n                setter = getSetter(controller.$name);\n                setter(scope, controller);\n              });\n            }\n            formElement.on('$destroy', function() {\n              controller.$$parentForm.$removeControl(controller);\n              setter(scope, undefined);\n              extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards\n            });\n          }\n        };\n      }\n    };\n\n    return formDirective;\n\n    function getSetter(expression) {\n      if (expression === '') {\n        //create an assignable expression, so forms with an empty name can be renamed later\n        return $parse('this[\"\"]').assign;\n      }\n      return $parse(expression).assign || noop;\n    }\n  }];\n};\n\nvar formDirective = formDirectiveFactory();\nvar ngFormDirective = formDirectiveFactory(true);\n\n/* global VALID_CLASS: false,\n  INVALID_CLASS: false,\n  PRISTINE_CLASS: false,\n  DIRTY_CLASS: false,\n  UNTOUCHED_CLASS: false,\n  TOUCHED_CLASS: false,\n  ngModelMinErr: false,\n*/\n\n// Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231\nvar ISO_DATE_REGEXP = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/;\n// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)\n// Note: We are being more lenient, because browsers are too.\n//   1. Scheme\n//   2. Slashes\n//   3. Username\n//   4. Password\n//   5. Hostname\n//   6. Port\n//   7. Path\n//   8. Query\n//   9. Fragment\n//                 1111111111111111 222   333333    44444        555555555555555555555555    666     77777777     8888888     999\nvar URL_REGEXP = /^[a-z][a-z\\d.+-]*:\\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\\s:/?#]+|\\[[a-f\\d:]+\\])(?::\\d+)?(?:\\/[^?#]*)?(?:\\?[^#]*)?(?:#.*)?$/i;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;\nvar NUMBER_REGEXP = /^\\s*(\\-|\\+)?(\\d+|(\\d*(\\.\\d*)))([eE][+-]?\\d+)?\\s*$/;\nvar DATE_REGEXP = /^(\\d{4,})-(\\d{2})-(\\d{2})$/;\nvar DATETIMELOCAL_REGEXP = /^(\\d{4,})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\nvar WEEK_REGEXP = /^(\\d{4,})-W(\\d\\d)$/;\nvar MONTH_REGEXP = /^(\\d{4,})-(\\d\\d)$/;\nvar TIME_REGEXP = /^(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\n\nvar PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown';\nvar PARTIAL_VALIDATION_TYPES = createMap();\nforEach('date,datetime-local,month,time,week'.split(','), function(type) {\n  PARTIAL_VALIDATION_TYPES[type] = true;\n});\n\nvar inputType = {\n\n  /**\n   * @ngdoc input\n   * @name input[text]\n   *\n   * @description\n   * Standard HTML text input with angular data binding, inherited by most of the `input` elements.\n   *\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Adds `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n   *    This parameter is ignored for input[type=password] controls, which will never trim the\n   *    input.\n   *\n   * @example\n      <example name=\"text-input-directive\" module=\"textInputExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('textInputExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.example = {\n                 text: 'guest',\n                 word: /^\\s*\\w*\\s*$/\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Single word:\n             <input type=\"text\" name=\"input\" ng-model=\"example.text\"\n                    ng-pattern=\"example.word\" required ng-trim=\"false\">\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.pattern\">\n               Single word only!</span>\n           </div>\n           <tt>text = {{example.text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('example.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('example.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('guest');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if multi word', function() {\n            input.clear();\n            input.sendKeys('hello world');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'text': textInputType,\n\n    /**\n     * @ngdoc input\n     * @name input[date]\n     *\n     * @description\n     * Input with date validation and transformation. In browsers that do not yet support\n     * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601\n     * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many\n     * modern browsers do not yet support this input type, it is important to provide cues to users on the\n     * expected input format via a placeholder or label.\n     *\n     * The model must always be a Date object, otherwise Angular will throw an error.\n     * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n     *\n     * The timezone to be used to read/write the `Date` instance in the model can be defined using\n     * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n     *\n     * @param {string} ngModel Assignable angular expression to data-bind to.\n     * @param {string=} name Property name of the form under which the control is published.\n     * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a\n     *   valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n     *   (e.g. `min=\"{{minDate | date:'yyyy-MM-dd'}}\"`). Note that `min` will also add native HTML5\n     *   constraint validation.\n     * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be\n     *   a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n     *   (e.g. `max=\"{{maxDate | date:'yyyy-MM-dd'}}\"`). Note that `max` will also add native HTML5\n     *   constraint validation.\n     * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string\n     *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n     * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string\n     *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n     * @param {string=} required Sets `required` validation error key if the value is not entered.\n     * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n     *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n     *    `required` when you want to data-bind to the `required` attribute.\n     * @param {string=} ngChange Angular expression to be executed when input changes due to user\n     *    interaction with the input element.\n     *\n     * @example\n     <example name=\"date-input-directive\" module=\"dateInputExample\">\n     <file name=\"index.html\">\n       <script>\n          angular.module('dateInputExample', [])\n            .controller('DateController', ['$scope', function($scope) {\n              $scope.example = {\n                value: new Date(2013, 9, 22)\n              };\n            }]);\n       </script>\n       <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n          <label for=\"exampleInput\">Pick a date in 2013:</label>\n          <input type=\"date\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n              placeholder=\"yyyy-MM-dd\" min=\"2013-01-01\" max=\"2013-12-31\" required />\n          <div role=\"alert\">\n            <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n                Required!</span>\n            <span class=\"error\" ng-show=\"myForm.input.$error.date\">\n                Not a valid date!</span>\n           </div>\n           <tt>value = {{example.value | date: \"yyyy-MM-dd\"}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n       </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n        var value = element(by.binding('example.value | date: \"yyyy-MM-dd\"'));\n        var valid = element(by.binding('myForm.input.$valid'));\n        var input = element(by.model('example.value'));\n\n        // currently protractor/webdriver does not support\n        // sending keys to all known HTML5 input controls\n        // for various browsers (see https://github.com/angular/protractor/issues/562).\n        function setInput(val) {\n          // set the value of the element and force validation.\n          var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n          \"ipt.value = '\" + val + \"';\" +\n          \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n          browser.executeScript(scr);\n        }\n\n        it('should initialize to model', function() {\n          expect(value.getText()).toContain('2013-10-22');\n          expect(valid.getText()).toContain('myForm.input.$valid = true');\n        });\n\n        it('should be invalid if empty', function() {\n          setInput('');\n          expect(value.getText()).toEqual('value =');\n          expect(valid.getText()).toContain('myForm.input.$valid = false');\n        });\n\n        it('should be invalid if over max', function() {\n          setInput('2015-01-01');\n          expect(value.getText()).toContain('');\n          expect(valid.getText()).toContain('myForm.input.$valid = false');\n        });\n     </file>\n     </example>\n     */\n  'date': createDateInputType('date', DATE_REGEXP,\n         createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),\n         'yyyy-MM-dd'),\n\n   /**\n    * @ngdoc input\n    * @name input[datetime-local]\n    *\n    * @description\n    * Input with datetime validation and transformation. In browsers that do not yet support\n    * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n    * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.\n    *\n    * The model must always be a Date object, otherwise Angular will throw an error.\n    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n    *\n    * The timezone to be used to read/write the `Date` instance in the model can be defined using\n    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n    *\n    * @param {string} ngModel Assignable angular expression to data-bind to.\n    * @param {string=} name Property name of the form under which the control is published.\n    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n    *   inside this attribute (e.g. `min=\"{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n    *   Note that `min` will also add native HTML5 constraint validation.\n    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n    *   inside this attribute (e.g. `max=\"{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n    *   Note that `max` will also add native HTML5 constraint validation.\n    * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string\n    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n    * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string\n    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n    * @param {string=} required Sets `required` validation error key if the value is not entered.\n    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n    *    `required` when you want to data-bind to the `required` attribute.\n    * @param {string=} ngChange Angular expression to be executed when input changes due to user\n    *    interaction with the input element.\n    *\n    * @example\n    <example name=\"datetimelocal-input-directive\" module=\"dateExample\">\n    <file name=\"index.html\">\n      <script>\n        angular.module('dateExample', [])\n          .controller('DateController', ['$scope', function($scope) {\n            $scope.example = {\n              value: new Date(2010, 11, 28, 14, 57)\n            };\n          }]);\n      </script>\n      <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label for=\"exampleInput\">Pick a date between in 2013:</label>\n        <input type=\"datetime-local\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n            placeholder=\"yyyy-MM-ddTHH:mm:ss\" min=\"2001-01-01T00:00:00\" max=\"2013-12-31T00:00:00\" required />\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.datetimelocal\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"yyyy-MM-ddTHH:mm:ss\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-MM-ddTHH:mm:ss\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2010-12-28T14:57:00');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-01-01T23:59:00');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n    </file>\n    </example>\n    */\n  'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,\n      createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),\n      'yyyy-MM-ddTHH:mm:ss.sss'),\n\n  /**\n   * @ngdoc input\n   * @name input[time]\n   *\n   * @description\n   * Input with time validation and transformation. In browsers that do not yet support\n   * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n   * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a\n   * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.\n   *\n   * The model must always be a Date object, otherwise Angular will throw an error.\n   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n   *\n   * The timezone to be used to read/write the `Date` instance in the model can be defined using\n   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n   *   attribute (e.g. `min=\"{{minTime | date:'HH:mm:ss'}}\"`). Note that `min` will also add\n   *   native HTML5 constraint validation.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n   *   attribute (e.g. `max=\"{{maxTime | date:'HH:mm:ss'}}\"`). Note that `max` will also add\n   *   native HTML5 constraint validation.\n   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the\n   *   `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the\n   *   `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n   <example name=\"time-input-directive\" module=\"timeExample\">\n   <file name=\"index.html\">\n     <script>\n      angular.module('timeExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(1970, 0, 1, 14, 57, 0)\n          };\n        }]);\n     </script>\n     <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label for=\"exampleInput\">Pick a time between 8am and 5pm:</label>\n        <input type=\"time\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n            placeholder=\"HH:mm:ss\" min=\"08:00:00\" max=\"17:00:00\" required />\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.time\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"HH:mm:ss\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n     </form>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"HH:mm:ss\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('14:57:00');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('23:59:00');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n   </file>\n   </example>\n   */\n  'time': createDateInputType('time', TIME_REGEXP,\n      createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),\n     'HH:mm:ss.sss'),\n\n   /**\n    * @ngdoc input\n    * @name input[week]\n    *\n    * @description\n    * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support\n    * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n    * week format (yyyy-W##), for example: `2013-W02`.\n    *\n    * The model must always be a Date object, otherwise Angular will throw an error.\n    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n    *\n    * The timezone to be used to read/write the `Date` instance in the model can be defined using\n    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n    *\n    * @param {string} ngModel Assignable angular expression to data-bind to.\n    * @param {string=} name Property name of the form under which the control is published.\n    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n    *   attribute (e.g. `min=\"{{minWeek | date:'yyyy-Www'}}\"`). Note that `min` will also add\n    *   native HTML5 constraint validation.\n    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n    *   attribute (e.g. `max=\"{{maxWeek | date:'yyyy-Www'}}\"`). Note that `max` will also add\n    *   native HTML5 constraint validation.\n    * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n    * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n    * @param {string=} required Sets `required` validation error key if the value is not entered.\n    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n    *    `required` when you want to data-bind to the `required` attribute.\n    * @param {string=} ngChange Angular expression to be executed when input changes due to user\n    *    interaction with the input element.\n    *\n    * @example\n    <example name=\"week-input-directive\" module=\"weekExample\">\n    <file name=\"index.html\">\n      <script>\n      angular.module('weekExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(2013, 0, 3)\n          };\n        }]);\n      </script>\n      <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label>Pick a date between in 2013:\n          <input id=\"exampleInput\" type=\"week\" name=\"input\" ng-model=\"example.value\"\n                 placeholder=\"YYYY-W##\" min=\"2012-W32\"\n                 max=\"2013-W52\" required />\n        </label>\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.week\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"yyyy-Www\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-Www\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2013-W01');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-W01');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n    </file>\n    </example>\n    */\n  'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),\n\n  /**\n   * @ngdoc input\n   * @name input[month]\n   *\n   * @description\n   * Input with month validation and transformation. In browsers that do not yet support\n   * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n   * month format (yyyy-MM), for example: `2009-01`.\n   *\n   * The model must always be a Date object, otherwise Angular will throw an error.\n   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n   * If the model is not set to the first of the month, the next view to model update will set it\n   * to the first of the month.\n   *\n   * The timezone to be used to read/write the `Date` instance in the model can be defined using\n   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n   *   attribute (e.g. `min=\"{{minMonth | date:'yyyy-MM'}}\"`). Note that `min` will also add\n   *   native HTML5 constraint validation.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n   *   attribute (e.g. `max=\"{{maxMonth | date:'yyyy-MM'}}\"`). Note that `max` will also add\n   *   native HTML5 constraint validation.\n   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n   *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n   *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n   <example name=\"month-input-directive\" module=\"monthExample\">\n   <file name=\"index.html\">\n     <script>\n      angular.module('monthExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(2013, 9, 1)\n          };\n        }]);\n     </script>\n     <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n       <label for=\"exampleInput\">Pick a month in 2013:</label>\n       <input id=\"exampleInput\" type=\"month\" name=\"input\" ng-model=\"example.value\"\n          placeholder=\"yyyy-MM\" min=\"2013-01\" max=\"2013-12\" required />\n       <div role=\"alert\">\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n            Required!</span>\n         <span class=\"error\" ng-show=\"myForm.input.$error.month\">\n            Not a valid month!</span>\n       </div>\n       <tt>value = {{example.value | date: \"yyyy-MM\"}}</tt><br/>\n       <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n       <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n       <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n       <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n     </form>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-MM\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2013-10');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-01');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n   </file>\n   </example>\n   */\n  'month': createDateInputType('month', MONTH_REGEXP,\n     createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),\n     'yyyy-MM'),\n\n  /**\n   * @ngdoc input\n   * @name input[number]\n   *\n   * @description\n   * Text input with number validation and transformation. Sets the `number` validation\n   * error if not a valid number.\n   *\n   * <div class=\"alert alert-warning\">\n   * The model must always be of type `number` otherwise Angular will throw an error.\n   * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}\n   * error docs for more information and an example of how to convert your model if necessary.\n   * </div>\n   *\n   * ## Issues with HTML5 constraint validation\n   *\n   * In browsers that follow the\n   * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),\n   * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.\n   * If a non-number is entered in the input, the browser will report the value as an empty string,\n   * which means the view / model values in `ngModel` and subsequently the scope value\n   * will also be an empty string.\n   *\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"number-input-directive\" module=\"numberExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('numberExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.example = {\n                 value: 12\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Number:\n             <input type=\"number\" name=\"input\" ng-model=\"example.value\"\n                    min=\"0\" max=\"99\" required>\n          </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.number\">\n               Not valid number!</span>\n           </div>\n           <tt>value = {{example.value}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var value = element(by.binding('example.value'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('example.value'));\n\n          it('should initialize to model', function() {\n            expect(value.getText()).toContain('12');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if over max', function() {\n            input.clear();\n            input.sendKeys('123');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'number': numberInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[url]\n   *\n   * @description\n   * Text input with URL validation. Sets the `url` validation error key if the content is not a\n   * valid URL.\n   *\n   * <div class=\"alert alert-warning\">\n   * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex\n   * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify\n   * the built-in validators (see the {@link guide/forms Forms guide})\n   * </div>\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"url-input-directive\" module=\"urlExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('urlExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.url = {\n                 text: 'http://google.com'\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>URL:\n             <input type=\"url\" name=\"input\" ng-model=\"url.text\" required>\n           <label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.url\">\n               Not valid url!</span>\n           </div>\n           <tt>text = {{url.text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n           <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('url.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('url.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('http://google.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not url', function() {\n            input.clear();\n            input.sendKeys('box');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'url': urlInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[email]\n   *\n   * @description\n   * Text input with email validation. Sets the `email` validation error key if not a valid email\n   * address.\n   *\n   * <div class=\"alert alert-warning\">\n   * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex\n   * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can\n   * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})\n   * </div>\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"email-input-directive\" module=\"emailExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('emailExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.email = {\n                 text: 'me@example.com'\n               };\n             }]);\n         </script>\n           <form name=\"myForm\" ng-controller=\"ExampleController\">\n             <label>Email:\n               <input type=\"email\" name=\"input\" ng-model=\"email.text\" required>\n             </label>\n             <div role=\"alert\">\n               <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n                 Required!</span>\n               <span class=\"error\" ng-show=\"myForm.input.$error.email\">\n                 Not valid email!</span>\n             </div>\n             <tt>text = {{email.text}}</tt><br/>\n             <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n             <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n             <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n             <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n             <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>\n           </form>\n         </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('email.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('email.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('me@example.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not email', function() {\n            input.clear();\n            input.sendKeys('xxx');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'email': emailInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[radio]\n   *\n   * @description\n   * HTML radio button.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string} value The value to which the `ngModel` expression should be set when selected.\n   *    Note that `value` only supports `string` values, i.e. the scope model needs to be a string,\n   *    too. Use `ngValue` if you need complex models (`number`, `object`, ...).\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio\n   *    is selected. Should be used instead of the `value` attribute if you need\n   *    a non-string `ngModel` (`boolean`, `array`, ...).\n   *\n   * @example\n      <example name=\"radio-input-directive\" module=\"radioExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('radioExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.color = {\n                 name: 'blue'\n               };\n               $scope.specialValue = {\n                 \"id\": \"12345\",\n                 \"value\": \"green\"\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" value=\"red\">\n             Red\n           </label><br/>\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" ng-value=\"specialValue\">\n             Green\n           </label><br/>\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" value=\"blue\">\n             Blue\n           </label><br/>\n           <tt>color = {{color.name | json}}</tt><br/>\n          </form>\n          Note that `ng-value=\"specialValue\"` sets radio item's value to be the value of `$scope.specialValue`.\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var color = element(by.binding('color.name'));\n\n            expect(color.getText()).toContain('blue');\n\n            element.all(by.model('color.name')).get(0).click();\n\n            expect(color.getText()).toContain('red');\n          });\n        </file>\n      </example>\n   */\n  'radio': radioInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[checkbox]\n   *\n   * @description\n   * HTML checkbox.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {expression=} ngTrueValue The value to which the expression should be set when selected.\n   * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"checkbox-input-directive\" module=\"checkboxExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('checkboxExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.checkboxModel = {\n                value1 : true,\n                value2 : 'YES'\n              };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Value1:\n             <input type=\"checkbox\" ng-model=\"checkboxModel.value1\">\n           </label><br/>\n           <label>Value2:\n             <input type=\"checkbox\" ng-model=\"checkboxModel.value2\"\n                    ng-true-value=\"'YES'\" ng-false-value=\"'NO'\">\n            </label><br/>\n           <tt>value1 = {{checkboxModel.value1}}</tt><br/>\n           <tt>value2 = {{checkboxModel.value2}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var value1 = element(by.binding('checkboxModel.value1'));\n            var value2 = element(by.binding('checkboxModel.value2'));\n\n            expect(value1.getText()).toContain('true');\n            expect(value2.getText()).toContain('YES');\n\n            element(by.model('checkboxModel.value1')).click();\n            element(by.model('checkboxModel.value2')).click();\n\n            expect(value1.getText()).toContain('false');\n            expect(value2.getText()).toContain('NO');\n          });\n        </file>\n      </example>\n   */\n  'checkbox': checkboxInputType,\n\n  'hidden': noop,\n  'button': noop,\n  'submit': noop,\n  'reset': noop,\n  'file': noop\n};\n\nfunction stringBasedInputType(ctrl) {\n  ctrl.$formatters.push(function(value) {\n    return ctrl.$isEmpty(value) ? value : value.toString();\n  });\n}\n\nfunction textInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n}\n\nfunction baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  var type = lowercase(element[0].type);\n\n  // In composition mode, users are still inputing intermediate text buffer,\n  // hold the listener until composition is done.\n  // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent\n  if (!$sniffer.android) {\n    var composing = false;\n\n    element.on('compositionstart', function() {\n      composing = true;\n    });\n\n    element.on('compositionend', function() {\n      composing = false;\n      listener();\n    });\n  }\n\n  var timeout;\n\n  var listener = function(ev) {\n    if (timeout) {\n      $browser.defer.cancel(timeout);\n      timeout = null;\n    }\n    if (composing) return;\n    var value = element.val(),\n        event = ev && ev.type;\n\n    // By default we will trim the value\n    // If the attribute ng-trim exists we will avoid trimming\n    // If input type is 'password', the value is never trimmed\n    if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {\n      value = trim(value);\n    }\n\n    // If a control is suffering from bad input (due to native validators), browsers discard its\n    // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the\n    // control's value is the same empty value twice in a row.\n    if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {\n      ctrl.$setViewValue(value, event);\n    }\n  };\n\n  // if the browser does support \"input\" event, we are fine - except on IE9 which doesn't fire the\n  // input event on backspace, delete or cut\n  if ($sniffer.hasEvent('input')) {\n    element.on('input', listener);\n  } else {\n    var deferListener = function(ev, input, origValue) {\n      if (!timeout) {\n        timeout = $browser.defer(function() {\n          timeout = null;\n          if (!input || input.value !== origValue) {\n            listener(ev);\n          }\n        });\n      }\n    };\n\n    element.on('keydown', function(event) {\n      var key = event.keyCode;\n\n      // ignore\n      //    command            modifiers                   arrows\n      if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;\n\n      deferListener(event, this, this.value);\n    });\n\n    // if user modifies input value using context menu in IE, we need \"paste\" and \"cut\" events to catch it\n    if ($sniffer.hasEvent('paste')) {\n      element.on('paste cut', deferListener);\n    }\n  }\n\n  // if user paste into input using mouse on older browser\n  // or form autocomplete on newer browser, we need \"change\" event to catch it\n  element.on('change', listener);\n\n  // Some native input types (date-family) have the ability to change validity without\n  // firing any input/change events.\n  // For these event types, when native validators are present and the browser supports the type,\n  // check for validity changes on various DOM events.\n  if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) {\n    element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {\n      if (!timeout) {\n        var validity = this[VALIDITY_STATE_PROPERTY];\n        var origBadInput = validity.badInput;\n        var origTypeMismatch = validity.typeMismatch;\n        timeout = $browser.defer(function() {\n          timeout = null;\n          if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) {\n            listener(ev);\n          }\n        });\n      }\n    });\n  }\n\n  ctrl.$render = function() {\n    // Workaround for Firefox validation #12102.\n    var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;\n    if (element.val() !== value) {\n      element.val(value);\n    }\n  };\n}\n\nfunction weekParser(isoWeek, existingDate) {\n  if (isDate(isoWeek)) {\n    return isoWeek;\n  }\n\n  if (isString(isoWeek)) {\n    WEEK_REGEXP.lastIndex = 0;\n    var parts = WEEK_REGEXP.exec(isoWeek);\n    if (parts) {\n      var year = +parts[1],\n          week = +parts[2],\n          hours = 0,\n          minutes = 0,\n          seconds = 0,\n          milliseconds = 0,\n          firstThurs = getFirstThursdayOfYear(year),\n          addDays = (week - 1) * 7;\n\n      if (existingDate) {\n        hours = existingDate.getHours();\n        minutes = existingDate.getMinutes();\n        seconds = existingDate.getSeconds();\n        milliseconds = existingDate.getMilliseconds();\n      }\n\n      return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);\n    }\n  }\n\n  return NaN;\n}\n\nfunction createDateParser(regexp, mapping) {\n  return function(iso, date) {\n    var parts, map;\n\n    if (isDate(iso)) {\n      return iso;\n    }\n\n    if (isString(iso)) {\n      // When a date is JSON'ified to wraps itself inside of an extra\n      // set of double quotes. This makes the date parsing code unable\n      // to match the date string and parse it as a date.\n      if (iso.charAt(0) == '\"' && iso.charAt(iso.length - 1) == '\"') {\n        iso = iso.substring(1, iso.length - 1);\n      }\n      if (ISO_DATE_REGEXP.test(iso)) {\n        return new Date(iso);\n      }\n      regexp.lastIndex = 0;\n      parts = regexp.exec(iso);\n\n      if (parts) {\n        parts.shift();\n        if (date) {\n          map = {\n            yyyy: date.getFullYear(),\n            MM: date.getMonth() + 1,\n            dd: date.getDate(),\n            HH: date.getHours(),\n            mm: date.getMinutes(),\n            ss: date.getSeconds(),\n            sss: date.getMilliseconds() / 1000\n          };\n        } else {\n          map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };\n        }\n\n        forEach(parts, function(part, index) {\n          if (index < mapping.length) {\n            map[mapping[index]] = +part;\n          }\n        });\n        return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);\n      }\n    }\n\n    return NaN;\n  };\n}\n\nfunction createDateInputType(type, regexp, parseDate, format) {\n  return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {\n    badInputChecker(scope, element, attr, ctrl);\n    baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n    var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;\n    var previousDate;\n\n    ctrl.$$parserName = type;\n    ctrl.$parsers.push(function(value) {\n      if (ctrl.$isEmpty(value)) return null;\n      if (regexp.test(value)) {\n        // Note: We cannot read ctrl.$modelValue, as there might be a different\n        // parser/formatter in the processing chain so that the model\n        // contains some different data format!\n        var parsedDate = parseDate(value, previousDate);\n        if (timezone) {\n          parsedDate = convertTimezoneToLocal(parsedDate, timezone);\n        }\n        return parsedDate;\n      }\n      return undefined;\n    });\n\n    ctrl.$formatters.push(function(value) {\n      if (value && !isDate(value)) {\n        throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);\n      }\n      if (isValidDate(value)) {\n        previousDate = value;\n        if (previousDate && timezone) {\n          previousDate = convertTimezoneToLocal(previousDate, timezone, true);\n        }\n        return $filter('date')(value, format, timezone);\n      } else {\n        previousDate = null;\n        return '';\n      }\n    });\n\n    if (isDefined(attr.min) || attr.ngMin) {\n      var minVal;\n      ctrl.$validators.min = function(value) {\n        return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;\n      };\n      attr.$observe('min', function(val) {\n        minVal = parseObservedDateValue(val);\n        ctrl.$validate();\n      });\n    }\n\n    if (isDefined(attr.max) || attr.ngMax) {\n      var maxVal;\n      ctrl.$validators.max = function(value) {\n        return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;\n      };\n      attr.$observe('max', function(val) {\n        maxVal = parseObservedDateValue(val);\n        ctrl.$validate();\n      });\n    }\n\n    function isValidDate(value) {\n      // Invalid Date: getTime() returns NaN\n      return value && !(value.getTime && value.getTime() !== value.getTime());\n    }\n\n    function parseObservedDateValue(val) {\n      return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;\n    }\n  };\n}\n\nfunction badInputChecker(scope, element, attr, ctrl) {\n  var node = element[0];\n  var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);\n  if (nativeValidation) {\n    ctrl.$parsers.push(function(value) {\n      var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};\n      return validity.badInput || validity.typeMismatch ? undefined : value;\n    });\n  }\n}\n\nfunction numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  badInputChecker(scope, element, attr, ctrl);\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  ctrl.$$parserName = 'number';\n  ctrl.$parsers.push(function(value) {\n    if (ctrl.$isEmpty(value))      return null;\n    if (NUMBER_REGEXP.test(value)) return parseFloat(value);\n    return undefined;\n  });\n\n  ctrl.$formatters.push(function(value) {\n    if (!ctrl.$isEmpty(value)) {\n      if (!isNumber(value)) {\n        throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);\n      }\n      value = value.toString();\n    }\n    return value;\n  });\n\n  if (isDefined(attr.min) || attr.ngMin) {\n    var minVal;\n    ctrl.$validators.min = function(value) {\n      return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;\n    };\n\n    attr.$observe('min', function(val) {\n      if (isDefined(val) && !isNumber(val)) {\n        val = parseFloat(val, 10);\n      }\n      minVal = isNumber(val) && !isNaN(val) ? val : undefined;\n      // TODO(matsko): implement validateLater to reduce number of validations\n      ctrl.$validate();\n    });\n  }\n\n  if (isDefined(attr.max) || attr.ngMax) {\n    var maxVal;\n    ctrl.$validators.max = function(value) {\n      return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;\n    };\n\n    attr.$observe('max', function(val) {\n      if (isDefined(val) && !isNumber(val)) {\n        val = parseFloat(val, 10);\n      }\n      maxVal = isNumber(val) && !isNaN(val) ? val : undefined;\n      // TODO(matsko): implement validateLater to reduce number of validations\n      ctrl.$validate();\n    });\n  }\n}\n\nfunction urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  // Note: no badInputChecker here by purpose as `url` is only a validation\n  // in browsers, i.e. we can always read out input.value even if it is not valid!\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n\n  ctrl.$$parserName = 'url';\n  ctrl.$validators.url = function(modelValue, viewValue) {\n    var value = modelValue || viewValue;\n    return ctrl.$isEmpty(value) || URL_REGEXP.test(value);\n  };\n}\n\nfunction emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  // Note: no badInputChecker here by purpose as `url` is only a validation\n  // in browsers, i.e. we can always read out input.value even if it is not valid!\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n\n  ctrl.$$parserName = 'email';\n  ctrl.$validators.email = function(modelValue, viewValue) {\n    var value = modelValue || viewValue;\n    return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);\n  };\n}\n\nfunction radioInputType(scope, element, attr, ctrl) {\n  // make the name unique, if not defined\n  if (isUndefined(attr.name)) {\n    element.attr('name', nextUid());\n  }\n\n  var listener = function(ev) {\n    if (element[0].checked) {\n      ctrl.$setViewValue(attr.value, ev && ev.type);\n    }\n  };\n\n  element.on('click', listener);\n\n  ctrl.$render = function() {\n    var value = attr.value;\n    element[0].checked = (value == ctrl.$viewValue);\n  };\n\n  attr.$observe('value', ctrl.$render);\n}\n\nfunction parseConstantExpr($parse, context, name, expression, fallback) {\n  var parseFn;\n  if (isDefined(expression)) {\n    parseFn = $parse(expression);\n    if (!parseFn.constant) {\n      throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +\n                                   '`{1}`.', name, expression);\n    }\n    return parseFn(context);\n  }\n  return fallback;\n}\n\nfunction checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {\n  var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);\n  var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);\n\n  var listener = function(ev) {\n    ctrl.$setViewValue(element[0].checked, ev && ev.type);\n  };\n\n  element.on('click', listener);\n\n  ctrl.$render = function() {\n    element[0].checked = ctrl.$viewValue;\n  };\n\n  // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`\n  // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert\n  // it to a boolean.\n  ctrl.$isEmpty = function(value) {\n    return value === false;\n  };\n\n  ctrl.$formatters.push(function(value) {\n    return equals(value, trueValue);\n  });\n\n  ctrl.$parsers.push(function(value) {\n    return value ? trueValue : falseValue;\n  });\n}\n\n\n/**\n * @ngdoc directive\n * @name textarea\n * @restrict E\n *\n * @description\n * HTML textarea element control with angular data-binding. The data-binding and validation\n * properties of this element are exactly the same as those of the\n * {@link ng.directive:input input element}.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n *    length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n *    If the expression evaluates to a RegExp object, then this is used directly.\n *    If the expression evaluates to a string, then it will be converted to a RegExp\n *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n *    `new RegExp('^abc$')`.<br />\n *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n *    start at the index of the last search's match, thus not taking the whole input value into\n *    account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n */\n\n\n/**\n * @ngdoc directive\n * @name input\n * @restrict E\n *\n * @description\n * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,\n * input state control, and validation.\n * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Not every feature offered is available for all input types.\n * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {boolean=} ngRequired Sets `required` attribute if set to true\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n *    length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n *    value does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n *    If the expression evaluates to a RegExp object, then this is used directly.\n *    If the expression evaluates to a string, then it will be converted to a RegExp\n *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n *    `new RegExp('^abc$')`.<br />\n *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n *    start at the index of the last search's match, thus not taking the whole input value into\n *    account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n *    This parameter is ignored for input[type=password] controls, which will never trim the\n *    input.\n *\n * @example\n    <example name=\"input-directive\" module=\"inputExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('inputExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.user = {name: 'guest', last: 'visitor'};\n            }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <form name=\"myForm\">\n           <label>\n              User name:\n              <input type=\"text\" name=\"userName\" ng-model=\"user.name\" required>\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.userName.$error.required\">\n              Required!</span>\n           </div>\n           <label>\n              Last name:\n              <input type=\"text\" name=\"lastName\" ng-model=\"user.last\"\n              ng-minlength=\"3\" ng-maxlength=\"10\">\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.lastName.$error.minlength\">\n               Too short!</span>\n             <span class=\"error\" ng-show=\"myForm.lastName.$error.maxlength\">\n               Too long!</span>\n           </div>\n         </form>\n         <hr>\n         <tt>user = {{user}}</tt><br/>\n         <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>\n         <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>\n         <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>\n         <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n         <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>\n         <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>\n       </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var user = element(by.exactBinding('user'));\n        var userNameValid = element(by.binding('myForm.userName.$valid'));\n        var lastNameValid = element(by.binding('myForm.lastName.$valid'));\n        var lastNameError = element(by.binding('myForm.lastName.$error'));\n        var formValid = element(by.binding('myForm.$valid'));\n        var userNameInput = element(by.model('user.name'));\n        var userLastInput = element(by.model('user.last'));\n\n        it('should initialize to model', function() {\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty when required', function() {\n          userNameInput.clear();\n          userNameInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('false');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be valid if empty when min length is set', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"\"}');\n          expect(lastNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if less than required min length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('xx');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('minlength');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be invalid if longer than max length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('some ridiculously long name');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('maxlength');\n          expect(formValid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n */\nvar inputDirective = ['$browser', '$sniffer', '$filter', '$parse',\n    function($browser, $sniffer, $filter, $parse) {\n  return {\n    restrict: 'E',\n    require: ['?ngModel'],\n    link: {\n      pre: function(scope, element, attr, ctrls) {\n        if (ctrls[0]) {\n          (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,\n                                                              $browser, $filter, $parse);\n        }\n      }\n    }\n  };\n}];\n\n\n\nvar CONSTANT_VALUE_REGEXP = /^(true|false|\\d+)$/;\n/**\n * @ngdoc directive\n * @name ngValue\n *\n * @description\n * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},\n * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to\n * the bound value.\n *\n * `ngValue` is useful when dynamically generating lists of radio buttons using\n * {@link ngRepeat `ngRepeat`}, as shown below.\n *\n * Likewise, `ngValue` can be used to generate `<option>` elements for\n * the {@link select `select`} element. In that case however, only strings are supported\n * for the `value `attribute, so the resulting `ngModel` will always be a string.\n * Support for `select` models with non-string values is available via `ngOptions`.\n *\n * @element input\n * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute\n *   of the `input` element\n *\n * @example\n    <example name=\"ngValue-directive\" module=\"valueExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('valueExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.names = ['pizza', 'unicorns', 'robots'];\n              $scope.my = { favorite: 'unicorns' };\n            }]);\n       </script>\n        <form ng-controller=\"ExampleController\">\n          <h2>Which is your favorite?</h2>\n            <label ng-repeat=\"name in names\" for=\"{{name}}\">\n              {{name}}\n              <input type=\"radio\"\n                     ng-model=\"my.favorite\"\n                     ng-value=\"name\"\n                     id=\"{{name}}\"\n                     name=\"favorite\">\n            </label>\n          <div>You chose {{my.favorite}}</div>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var favorite = element(by.binding('my.favorite'));\n\n        it('should initialize to model', function() {\n          expect(favorite.getText()).toContain('unicorns');\n        });\n        it('should bind the values to the inputs', function() {\n          element.all(by.model('my.favorite')).get(0).click();\n          expect(favorite.getText()).toContain('pizza');\n        });\n      </file>\n    </example>\n */\nvar ngValueDirective = function() {\n  return {\n    restrict: 'A',\n    priority: 100,\n    compile: function(tpl, tplAttr) {\n      if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {\n        return function ngValueConstantLink(scope, elm, attr) {\n          attr.$set('value', scope.$eval(attr.ngValue));\n        };\n      } else {\n        return function ngValueLink(scope, elm, attr) {\n          scope.$watch(attr.ngValue, function valueWatchAction(value) {\n            attr.$set('value', value);\n          });\n        };\n      }\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngBind\n * @restrict AC\n *\n * @description\n * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element\n * with the value of a given expression, and to update the text content when the value of that\n * expression changes.\n *\n * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like\n * `{{ expression }}` which is similar but less verbose.\n *\n * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily\n * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an\n * element attribute, it makes the bindings invisible to the user while the page is loading.\n *\n * An alternative solution to this problem would be using the\n * {@link ng.directive:ngCloak ngCloak} directive.\n *\n *\n * @element ANY\n * @param {expression} ngBind {@link guide/expression Expression} to evaluate.\n *\n * @example\n * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.name = 'Whirled';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>Enter name: <input type=\"text\" ng-model=\"name\"></label><br>\n         Hello <span ng-bind=\"name\"></span>!\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var nameInput = element(by.model('name'));\n\n         expect(element(by.binding('name')).getText()).toBe('Whirled');\n         nameInput.clear();\n         nameInput.sendKeys('world');\n         expect(element(by.binding('name')).getText()).toBe('world');\n       });\n     </file>\n   </example>\n */\nvar ngBindDirective = ['$compile', function($compile) {\n  return {\n    restrict: 'AC',\n    compile: function ngBindCompile(templateElement) {\n      $compile.$$addBindingClass(templateElement);\n      return function ngBindLink(scope, element, attr) {\n        $compile.$$addBindingInfo(element, attr.ngBind);\n        element = element[0];\n        scope.$watch(attr.ngBind, function ngBindWatchAction(value) {\n          element.textContent = isUndefined(value) ? '' : value;\n        });\n      };\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindTemplate\n *\n * @description\n * The `ngBindTemplate` directive specifies that the element\n * text content should be replaced with the interpolation of the template\n * in the `ngBindTemplate` attribute.\n * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`\n * expressions. This directive is needed since some HTML elements\n * (such as TITLE and OPTION) cannot contain SPAN elements.\n *\n * @element ANY\n * @param {string} ngBindTemplate template of form\n *   <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.\n *\n * @example\n * Try it here: enter text in text box and watch the greeting change.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.salutation = 'Hello';\n             $scope.name = 'World';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n        <label>Salutation: <input type=\"text\" ng-model=\"salutation\"></label><br>\n        <label>Name: <input type=\"text\" ng-model=\"name\"></label><br>\n        <pre ng-bind-template=\"{{salutation}} {{name}}!\"></pre>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var salutationElem = element(by.binding('salutation'));\n         var salutationInput = element(by.model('salutation'));\n         var nameInput = element(by.model('name'));\n\n         expect(salutationElem.getText()).toBe('Hello World!');\n\n         salutationInput.clear();\n         salutationInput.sendKeys('Greetings');\n         nameInput.clear();\n         nameInput.sendKeys('user');\n\n         expect(salutationElem.getText()).toBe('Greetings user!');\n       });\n     </file>\n   </example>\n */\nvar ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {\n  return {\n    compile: function ngBindTemplateCompile(templateElement) {\n      $compile.$$addBindingClass(templateElement);\n      return function ngBindTemplateLink(scope, element, attr) {\n        var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));\n        $compile.$$addBindingInfo(element, interpolateFn.expressions);\n        element = element[0];\n        attr.$observe('ngBindTemplate', function(value) {\n          element.textContent = isUndefined(value) ? '' : value;\n        });\n      };\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindHtml\n *\n * @description\n * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,\n * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.\n * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link\n * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}\n * in your module's dependencies, you need to include \"angular-sanitize.js\" in your application.\n *\n * You may also bypass sanitization for values you know are safe. To do so, bind to\n * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}.  See the example\n * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.\n *\n * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you\n * will have an exception (instead of an exploit.)\n *\n * @element ANY\n * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.\n *\n * @example\n\n   <example module=\"bindHtmlExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n        <p ng-bind-html=\"myHTML\"></p>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n       angular.module('bindHtmlExample', ['ngSanitize'])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.myHTML =\n              'I am an <code>HTML</code>string with ' +\n              '<a href=\"#\">links!</a> and other <em>stuff</em>';\n         }]);\n     </file>\n\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind-html', function() {\n         expect(element(by.binding('myHTML')).getText()).toBe(\n             'I am an HTMLstring with links! and other stuff');\n       });\n     </file>\n   </example>\n */\nvar ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {\n  return {\n    restrict: 'A',\n    compile: function ngBindHtmlCompile(tElement, tAttrs) {\n      var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);\n      var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) {\n        return (value || '').toString();\n      });\n      $compile.$$addBindingClass(tElement);\n\n      return function ngBindHtmlLink(scope, element, attr) {\n        $compile.$$addBindingInfo(element, attr.ngBindHtml);\n\n        scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {\n          // we re-evaluate the expr because we want a TrustedValueHolderType\n          // for $sce, not a string\n          element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');\n        });\n      };\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngChange\n *\n * @description\n * Evaluate the given expression when the user changes the input.\n * The expression is evaluated immediately, unlike the JavaScript onchange event\n * which only triggers at the end of a change (usually, when the user leaves the\n * form element or presses the return key).\n *\n * The `ngChange` expression is only evaluated when a change in the input value causes\n * a new value to be committed to the model.\n *\n * It will not be evaluated:\n * * if the value returned from the `$parsers` transformation pipeline has not changed\n * * if the input has continued to be invalid since the model will stay `null`\n * * if the model is changed programmatically and not by a change to the input value\n *\n *\n * Note, this directive requires `ngModel` to be present.\n *\n * @element input\n * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change\n * in input value.\n *\n * @example\n * <example name=\"ngChange-directive\" module=\"changeExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('changeExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.counter = 0;\n *           $scope.change = function() {\n *             $scope.counter++;\n *           };\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <input type=\"checkbox\" ng-model=\"confirmed\" ng-change=\"change()\" id=\"ng-change-example1\" />\n *       <input type=\"checkbox\" ng-model=\"confirmed\" id=\"ng-change-example2\" />\n *       <label for=\"ng-change-example2\">Confirmed</label><br />\n *       <tt>debug = {{confirmed}}</tt><br/>\n *       <tt>counter = {{counter}}</tt><br/>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var counter = element(by.binding('counter'));\n *     var debug = element(by.binding('confirmed'));\n *\n *     it('should evaluate the expression if changing from view', function() {\n *       expect(counter.getText()).toContain('0');\n *\n *       element(by.id('ng-change-example1')).click();\n *\n *       expect(counter.getText()).toContain('1');\n *       expect(debug.getText()).toContain('true');\n *     });\n *\n *     it('should not evaluate the expression if changing from model', function() {\n *       element(by.id('ng-change-example2')).click();\n\n *       expect(counter.getText()).toContain('0');\n *       expect(debug.getText()).toContain('true');\n *     });\n *   </file>\n * </example>\n */\nvar ngChangeDirective = valueFn({\n  restrict: 'A',\n  require: 'ngModel',\n  link: function(scope, element, attr, ctrl) {\n    ctrl.$viewChangeListeners.push(function() {\n      scope.$eval(attr.ngChange);\n    });\n  }\n});\n\nfunction classDirective(name, selector) {\n  name = 'ngClass' + name;\n  return ['$animate', function($animate) {\n    return {\n      restrict: 'AC',\n      link: function(scope, element, attr) {\n        var oldVal;\n\n        scope.$watch(attr[name], ngClassWatchAction, true);\n\n        attr.$observe('class', function(value) {\n          ngClassWatchAction(scope.$eval(attr[name]));\n        });\n\n\n        if (name !== 'ngClass') {\n          scope.$watch('$index', function($index, old$index) {\n            // jshint bitwise: false\n            var mod = $index & 1;\n            if (mod !== (old$index & 1)) {\n              var classes = arrayClasses(scope.$eval(attr[name]));\n              mod === selector ?\n                addClasses(classes) :\n                removeClasses(classes);\n            }\n          });\n        }\n\n        function addClasses(classes) {\n          var newClasses = digestClassCounts(classes, 1);\n          attr.$addClass(newClasses);\n        }\n\n        function removeClasses(classes) {\n          var newClasses = digestClassCounts(classes, -1);\n          attr.$removeClass(newClasses);\n        }\n\n        function digestClassCounts(classes, count) {\n          // Use createMap() to prevent class assumptions involving property\n          // names in Object.prototype\n          var classCounts = element.data('$classCounts') || createMap();\n          var classesToUpdate = [];\n          forEach(classes, function(className) {\n            if (count > 0 || classCounts[className]) {\n              classCounts[className] = (classCounts[className] || 0) + count;\n              if (classCounts[className] === +(count > 0)) {\n                classesToUpdate.push(className);\n              }\n            }\n          });\n          element.data('$classCounts', classCounts);\n          return classesToUpdate.join(' ');\n        }\n\n        function updateClasses(oldClasses, newClasses) {\n          var toAdd = arrayDifference(newClasses, oldClasses);\n          var toRemove = arrayDifference(oldClasses, newClasses);\n          toAdd = digestClassCounts(toAdd, 1);\n          toRemove = digestClassCounts(toRemove, -1);\n          if (toAdd && toAdd.length) {\n            $animate.addClass(element, toAdd);\n          }\n          if (toRemove && toRemove.length) {\n            $animate.removeClass(element, toRemove);\n          }\n        }\n\n        function ngClassWatchAction(newVal) {\n          if (selector === true || scope.$index % 2 === selector) {\n            var newClasses = arrayClasses(newVal || []);\n            if (!oldVal) {\n              addClasses(newClasses);\n            } else if (!equals(newVal,oldVal)) {\n              var oldClasses = arrayClasses(oldVal);\n              updateClasses(oldClasses, newClasses);\n            }\n          }\n          oldVal = shallowCopy(newVal);\n        }\n      }\n    };\n\n    function arrayDifference(tokens1, tokens2) {\n      var values = [];\n\n      outer:\n      for (var i = 0; i < tokens1.length; i++) {\n        var token = tokens1[i];\n        for (var j = 0; j < tokens2.length; j++) {\n          if (token == tokens2[j]) continue outer;\n        }\n        values.push(token);\n      }\n      return values;\n    }\n\n    function arrayClasses(classVal) {\n      var classes = [];\n      if (isArray(classVal)) {\n        forEach(classVal, function(v) {\n          classes = classes.concat(arrayClasses(v));\n        });\n        return classes;\n      } else if (isString(classVal)) {\n        return classVal.split(' ');\n      } else if (isObject(classVal)) {\n        forEach(classVal, function(v, k) {\n          if (v) {\n            classes = classes.concat(k.split(' '));\n          }\n        });\n        return classes;\n      }\n      return classVal;\n    }\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ngClass\n * @restrict AC\n *\n * @description\n * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding\n * an expression that represents all classes to be added.\n *\n * The directive operates in three different ways, depending on which of three types the expression\n * evaluates to:\n *\n * 1. If the expression evaluates to a string, the string should be one or more space-delimited class\n * names.\n *\n * 2. If the expression evaluates to an object, then for each key-value pair of the\n * object with a truthy value the corresponding key is used as a class name.\n *\n * 3. If the expression evaluates to an array, each element of the array should either be a string as in\n * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array\n * to give you more control over what CSS classes appear. See the code below for an example of this.\n *\n *\n * The directive won't add duplicate classes if a particular class was already set.\n *\n * When the expression changes, the previously added classes are removed and only then are the\n * new classes added.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#addClass addClass}       | just before the class is applied to the element   |\n * | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |\n *\n * @element ANY\n * @param {expression} ngClass {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class\n *   names, an array, or a map of class names to boolean values. In the case of a map, the\n *   names of the properties whose values are truthy will be added as css classes to the\n *   element.\n *\n * @example Example that demonstrates basic bindings via ngClass directive.\n   <example>\n     <file name=\"index.html\">\n       <p ng-class=\"{strike: deleted, bold: important, 'has-error': error}\">Map Syntax Example</p>\n       <label>\n          <input type=\"checkbox\" ng-model=\"deleted\">\n          deleted (apply \"strike\" class)\n       </label><br>\n       <label>\n          <input type=\"checkbox\" ng-model=\"important\">\n          important (apply \"bold\" class)\n       </label><br>\n       <label>\n          <input type=\"checkbox\" ng-model=\"error\">\n          error (apply \"has-error\" class)\n       </label>\n       <hr>\n       <p ng-class=\"style\">Using String Syntax</p>\n       <input type=\"text\" ng-model=\"style\"\n              placeholder=\"Type: bold strike red\" aria-label=\"Type: bold strike red\">\n       <hr>\n       <p ng-class=\"[style1, style2, style3]\">Using Array Syntax</p>\n       <input ng-model=\"style1\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red\"><br>\n       <input ng-model=\"style2\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 2\"><br>\n       <input ng-model=\"style3\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 3\"><br>\n       <hr>\n       <p ng-class=\"[style4, {orange: warning}]\">Using Array and Map Syntax</p>\n       <input ng-model=\"style4\" placeholder=\"Type: bold, strike\" aria-label=\"Type: bold, strike\"><br>\n       <label><input type=\"checkbox\" ng-model=\"warning\"> warning (apply \"orange\" class)</label>\n     </file>\n     <file name=\"style.css\">\n       .strike {\n           text-decoration: line-through;\n       }\n       .bold {\n           font-weight: bold;\n       }\n       .red {\n           color: red;\n       }\n       .has-error {\n           color: red;\n           background-color: yellow;\n       }\n       .orange {\n           color: orange;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var ps = element.all(by.css('p'));\n\n       it('should let you toggle the class', function() {\n\n         expect(ps.first().getAttribute('class')).not.toMatch(/bold/);\n         expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);\n\n         element(by.model('important')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/bold/);\n\n         element(by.model('error')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/has-error/);\n       });\n\n       it('should let you toggle string example', function() {\n         expect(ps.get(1).getAttribute('class')).toBe('');\n         element(by.model('style')).clear();\n         element(by.model('style')).sendKeys('red');\n         expect(ps.get(1).getAttribute('class')).toBe('red');\n       });\n\n       it('array example should have 3 classes', function() {\n         expect(ps.get(2).getAttribute('class')).toBe('');\n         element(by.model('style1')).sendKeys('bold');\n         element(by.model('style2')).sendKeys('strike');\n         element(by.model('style3')).sendKeys('red');\n         expect(ps.get(2).getAttribute('class')).toBe('bold strike red');\n       });\n\n       it('array with map example should have 2 classes', function() {\n         expect(ps.last().getAttribute('class')).toBe('');\n         element(by.model('style4')).sendKeys('bold');\n         element(by.model('warning')).click();\n         expect(ps.last().getAttribute('class')).toBe('bold orange');\n       });\n     </file>\n   </example>\n\n   ## Animations\n\n   The example below demonstrates how to perform animations using ngClass.\n\n   <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n      <input id=\"setbtn\" type=\"button\" value=\"set\" ng-click=\"myVar='my-class'\">\n      <input id=\"clearbtn\" type=\"button\" value=\"clear\" ng-click=\"myVar=''\">\n      <br>\n      <span class=\"base-class\" ng-class=\"myVar\">Sample Text</span>\n     </file>\n     <file name=\"style.css\">\n       .base-class {\n         transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n       }\n\n       .base-class.my-class {\n         color: red;\n         font-size:3em;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class', function() {\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n\n         element(by.id('setbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).\n           toMatch(/my-class/);\n\n         element(by.id('clearbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n       });\n     </file>\n   </example>\n\n\n   ## ngClass and pre-existing CSS3 Transitions/Animations\n   The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.\n   Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder\n   any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure\n   to view the step by step details of {@link $animate#addClass $animate.addClass} and\n   {@link $animate#removeClass $animate.removeClass}.\n */\nvar ngClassDirective = classDirective('', true);\n\n/**\n * @ngdoc directive\n * @name ngClassOdd\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}}\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassOddDirective = classDirective('Odd', 0);\n\n/**\n * @ngdoc directive\n * @name ngClassEven\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The\n *   result of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}} &nbsp; &nbsp; &nbsp;\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassEvenDirective = classDirective('Even', 1);\n\n/**\n * @ngdoc directive\n * @name ngCloak\n * @restrict AC\n *\n * @description\n * The `ngCloak` directive is used to prevent the Angular html template from being briefly\n * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this\n * directive to avoid the undesirable flicker effect caused by the html template display.\n *\n * The directive can be applied to the `<body>` element, but the preferred usage is to apply\n * multiple `ngCloak` directives to small portions of the page to permit progressive rendering\n * of the browser view.\n *\n * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and\n * `angular.min.js`.\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```css\n * [ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {\n *   display: none !important;\n * }\n * ```\n *\n * When this css rule is loaded by the browser, all html elements (including their children) that\n * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive\n * during the compilation of the template it deletes the `ngCloak` element attribute, making\n * the compiled element visible.\n *\n * For the best result, the `angular.js` script must be loaded in the head section of the html\n * document; alternatively, the css rule above must be included in the external stylesheet of the\n * application.\n *\n * @element ANY\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <div id=\"template1\" ng-cloak>{{ 'hello' }}</div>\n        <div id=\"template2\" class=\"ng-cloak\">{{ 'world' }}</div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should remove the template directive and css class', function() {\n         expect($('#template1').getAttribute('ng-cloak')).\n           toBeNull();\n         expect($('#template2').getAttribute('ng-cloak')).\n           toBeNull();\n       });\n     </file>\n   </example>\n *\n */\nvar ngCloakDirective = ngDirective({\n  compile: function(element, attr) {\n    attr.$set('ngCloak', undefined);\n    element.removeClass('ng-cloak');\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngController\n *\n * @description\n * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular\n * supports the principles behind the Model-View-Controller design pattern.\n *\n * MVC components in angular:\n *\n * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties\n *   are accessed through bindings.\n * * View — The template (HTML with data bindings) that is rendered into the View.\n * * Controller — The `ngController` directive specifies a Controller class; the class contains business\n *   logic behind the application to decorate the scope with functions and values\n *\n * Note that you can also attach controllers to the DOM by declaring it in a route definition\n * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller\n * again using `ng-controller` in the template itself.  This will cause the controller to be attached\n * and executed twice.\n *\n * @element ANY\n * @scope\n * @priority 500\n * @param {expression} ngController Name of a constructor function registered with the current\n * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}\n * that on the current scope evaluates to a constructor function.\n *\n * The controller instance can be published into a scope property by specifying\n * `ng-controller=\"as propertyName\"`.\n *\n * If the current `$controllerProvider` is configured to use globals (via\n * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may\n * also be the name of a globally accessible constructor function (not recommended).\n *\n * @example\n * Here is a simple form for editing user contact information. Adding, removing, clearing, and\n * greeting are methods declared on the controller (see source tab). These methods can\n * easily be called from the angular markup. Any changes to the data are automatically reflected\n * in the View without the need for a manual update.\n *\n * Two different declaration styles are included below:\n *\n * * one binds methods and properties directly onto the controller using `this`:\n * `ng-controller=\"SettingsController1 as settings\"`\n * * one injects `$scope` into the controller:\n * `ng-controller=\"SettingsController2\"`\n *\n * The second option is more common in the Angular community, and is generally used in boilerplates\n * and in this guide. However, there are advantages to binding properties directly to the controller\n * and avoiding scope.\n *\n * * Using `controller as` makes it obvious which controller you are accessing in the template when\n * multiple controllers apply to an element.\n * * If you are writing your controllers as classes you have easier access to the properties and\n * methods, which will appear on the scope, from inside the controller code.\n * * Since there is always a `.` in the bindings, you don't have to worry about prototypal\n * inheritance masking primitives.\n *\n * This example demonstrates the `controller as` syntax.\n *\n * <example name=\"ngControllerAs\" module=\"controllerAsExample\">\n *   <file name=\"index.html\">\n *    <div id=\"ctrl-as-exmpl\" ng-controller=\"SettingsController1 as settings\">\n *      <label>Name: <input type=\"text\" ng-model=\"settings.name\"/></label>\n *      <button ng-click=\"settings.greet()\">greet</button><br/>\n *      Contact:\n *      <ul>\n *        <li ng-repeat=\"contact in settings.contacts\">\n *          <select ng-model=\"contact.type\" aria-label=\"Contact method\" id=\"select_{{$index}}\">\n *             <option>phone</option>\n *             <option>email</option>\n *          </select>\n *          <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n *          <button ng-click=\"settings.clearContact(contact)\">clear</button>\n *          <button ng-click=\"settings.removeContact(contact)\" aria-label=\"Remove\">X</button>\n *        </li>\n *        <li><button ng-click=\"settings.addContact()\">add</button></li>\n *     </ul>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    angular.module('controllerAsExample', [])\n *      .controller('SettingsController1', SettingsController1);\n *\n *    function SettingsController1() {\n *      this.name = \"John Smith\";\n *      this.contacts = [\n *        {type: 'phone', value: '408 555 1212'},\n *        {type: 'email', value: 'john.smith@example.org'} ];\n *    }\n *\n *    SettingsController1.prototype.greet = function() {\n *      alert(this.name);\n *    };\n *\n *    SettingsController1.prototype.addContact = function() {\n *      this.contacts.push({type: 'email', value: 'yourname@example.org'});\n *    };\n *\n *    SettingsController1.prototype.removeContact = function(contactToRemove) {\n *     var index = this.contacts.indexOf(contactToRemove);\n *      this.contacts.splice(index, 1);\n *    };\n *\n *    SettingsController1.prototype.clearContact = function(contact) {\n *      contact.type = 'phone';\n *      contact.value = '';\n *    };\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should check controller as', function() {\n *       var container = element(by.id('ctrl-as-exmpl'));\n *         expect(container.element(by.model('settings.name'))\n *           .getAttribute('value')).toBe('John Smith');\n *\n *       var firstRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(0));\n *       var secondRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(1));\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('408 555 1212');\n *\n *       expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('john.smith@example.org');\n *\n *       firstRepeat.element(by.buttonText('clear')).click();\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('');\n *\n *       container.element(by.buttonText('add')).click();\n *\n *       expect(container.element(by.repeater('contact in settings.contacts').row(2))\n *           .element(by.model('contact.value'))\n *           .getAttribute('value'))\n *           .toBe('yourname@example.org');\n *     });\n *   </file>\n * </example>\n *\n * This example demonstrates the \"attach to `$scope`\" style of controller.\n *\n * <example name=\"ngController\" module=\"controllerExample\">\n *  <file name=\"index.html\">\n *   <div id=\"ctrl-exmpl\" ng-controller=\"SettingsController2\">\n *     <label>Name: <input type=\"text\" ng-model=\"name\"/></label>\n *     <button ng-click=\"greet()\">greet</button><br/>\n *     Contact:\n *     <ul>\n *       <li ng-repeat=\"contact in contacts\">\n *         <select ng-model=\"contact.type\" id=\"select_{{$index}}\">\n *            <option>phone</option>\n *            <option>email</option>\n *         </select>\n *         <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n *         <button ng-click=\"clearContact(contact)\">clear</button>\n *         <button ng-click=\"removeContact(contact)\">X</button>\n *       </li>\n *       <li>[ <button ng-click=\"addContact()\">add</button> ]</li>\n *    </ul>\n *   </div>\n *  </file>\n *  <file name=\"app.js\">\n *   angular.module('controllerExample', [])\n *     .controller('SettingsController2', ['$scope', SettingsController2]);\n *\n *   function SettingsController2($scope) {\n *     $scope.name = \"John Smith\";\n *     $scope.contacts = [\n *       {type:'phone', value:'408 555 1212'},\n *       {type:'email', value:'john.smith@example.org'} ];\n *\n *     $scope.greet = function() {\n *       alert($scope.name);\n *     };\n *\n *     $scope.addContact = function() {\n *       $scope.contacts.push({type:'email', value:'yourname@example.org'});\n *     };\n *\n *     $scope.removeContact = function(contactToRemove) {\n *       var index = $scope.contacts.indexOf(contactToRemove);\n *       $scope.contacts.splice(index, 1);\n *     };\n *\n *     $scope.clearContact = function(contact) {\n *       contact.type = 'phone';\n *       contact.value = '';\n *     };\n *   }\n *  </file>\n *  <file name=\"protractor.js\" type=\"protractor\">\n *    it('should check controller', function() {\n *      var container = element(by.id('ctrl-exmpl'));\n *\n *      expect(container.element(by.model('name'))\n *          .getAttribute('value')).toBe('John Smith');\n *\n *      var firstRepeat =\n *          container.element(by.repeater('contact in contacts').row(0));\n *      var secondRepeat =\n *          container.element(by.repeater('contact in contacts').row(1));\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('408 555 1212');\n *      expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('john.smith@example.org');\n *\n *      firstRepeat.element(by.buttonText('clear')).click();\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('');\n *\n *      container.element(by.buttonText('add')).click();\n *\n *      expect(container.element(by.repeater('contact in contacts').row(2))\n *          .element(by.model('contact.value'))\n *          .getAttribute('value'))\n *          .toBe('yourname@example.org');\n *    });\n *  </file>\n *</example>\n\n */\nvar ngControllerDirective = [function() {\n  return {\n    restrict: 'A',\n    scope: true,\n    controller: '@',\n    priority: 500\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngCsp\n *\n * @element html\n * @description\n *\n * Angular has some features that can break certain\n * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.\n *\n * If you intend to implement these rules then you must tell Angular not to use these features.\n *\n * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.\n *\n *\n * The following rules affect Angular:\n *\n * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions\n * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%\n * increase in the speed of evaluating Angular expressions.\n *\n * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular\n * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).\n * To make these directives work when a CSP rule is blocking inline styles, you must link to the\n * `angular-csp.css` in your HTML manually.\n *\n * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval\n * and automatically deactivates this feature in the {@link $parse} service. This autodetection,\n * however, triggers a CSP error to be logged in the console:\n *\n * ```\n * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of\n * script in the following Content Security Policy directive: \"default-src 'self'\". Note that\n * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.\n * ```\n *\n * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`\n * directive on an element of the HTML document that appears before the `<script>` tag that loads\n * the `angular.js` file.\n *\n * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*\n *\n * You can specify which of the CSP related Angular features should be deactivated by providing\n * a value for the `ng-csp` attribute. The options are as follows:\n *\n * * no-inline-style: this stops Angular from injecting CSS styles into the DOM\n *\n * * no-unsafe-eval: this stops Angular from optimizing $parse with unsafe eval of strings\n *\n * You can use these values in the following combinations:\n *\n *\n * * No declaration means that Angular will assume that you can do inline styles, but it will do\n * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline\n * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject\n * inline styles. E.g. `<body ng-csp=\"no-unsafe-eval\">`.\n *\n * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can\n * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp=\"no-inline-style\">`\n *\n * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject\n * styles nor use eval, which is the same as an empty: ng-csp.\n * E.g.`<body ng-csp=\"no-inline-style;no-unsafe-eval\">`\n *\n * @example\n * This example shows how to apply the `ngCsp` directive to the `html` tag.\n   ```html\n     <!doctype html>\n     <html ng-app ng-csp>\n     ...\n     ...\n     </html>\n   ```\n  * @example\n      // Note: the suffix `.csp` in the example name triggers\n      // csp mode in our http server!\n      <example name=\"example.csp\" module=\"cspExample\" ng-csp=\"true\">\n        <file name=\"index.html\">\n          <div ng-controller=\"MainController as ctrl\">\n            <div>\n              <button ng-click=\"ctrl.inc()\" id=\"inc\">Increment</button>\n              <span id=\"counter\">\n                {{ctrl.counter}}\n              </span>\n            </div>\n\n            <div>\n              <button ng-click=\"ctrl.evil()\" id=\"evil\">Evil</button>\n              <span id=\"evilError\">\n                {{ctrl.evilError}}\n              </span>\n            </div>\n          </div>\n        </file>\n        <file name=\"script.js\">\n           angular.module('cspExample', [])\n             .controller('MainController', function() {\n                this.counter = 0;\n                this.inc = function() {\n                  this.counter++;\n                };\n                this.evil = function() {\n                  // jshint evil:true\n                  try {\n                    eval('1+2');\n                  } catch (e) {\n                    this.evilError = e.message;\n                  }\n                };\n              });\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var util, webdriver;\n\n          var incBtn = element(by.id('inc'));\n          var counter = element(by.id('counter'));\n          var evilBtn = element(by.id('evil'));\n          var evilError = element(by.id('evilError'));\n\n          function getAndClearSevereErrors() {\n            return browser.manage().logs().get('browser').then(function(browserLog) {\n              return browserLog.filter(function(logEntry) {\n                return logEntry.level.value > webdriver.logging.Level.WARNING.value;\n              });\n            });\n          }\n\n          function clearErrors() {\n            getAndClearSevereErrors();\n          }\n\n          function expectNoErrors() {\n            getAndClearSevereErrors().then(function(filteredLog) {\n              expect(filteredLog.length).toEqual(0);\n              if (filteredLog.length) {\n                console.log('browser console errors: ' + util.inspect(filteredLog));\n              }\n            });\n          }\n\n          function expectError(regex) {\n            getAndClearSevereErrors().then(function(filteredLog) {\n              var found = false;\n              filteredLog.forEach(function(log) {\n                if (log.message.match(regex)) {\n                  found = true;\n                }\n              });\n              if (!found) {\n                throw new Error('expected an error that matches ' + regex);\n              }\n            });\n          }\n\n          beforeEach(function() {\n            util = require('util');\n            webdriver = require('protractor/node_modules/selenium-webdriver');\n          });\n\n          // For now, we only test on Chrome,\n          // as Safari does not load the page with Protractor's injected scripts,\n          // and Firefox webdriver always disables content security policy (#6358)\n          if (browser.params.browser !== 'chrome') {\n            return;\n          }\n\n          it('should not report errors when the page is loaded', function() {\n            // clear errors so we are not dependent on previous tests\n            clearErrors();\n            // Need to reload the page as the page is already loaded when\n            // we come here\n            browser.driver.getCurrentUrl().then(function(url) {\n              browser.get(url);\n            });\n            expectNoErrors();\n          });\n\n          it('should evaluate expressions', function() {\n            expect(counter.getText()).toEqual('0');\n            incBtn.click();\n            expect(counter.getText()).toEqual('1');\n            expectNoErrors();\n          });\n\n          it('should throw and report an error when using \"eval\"', function() {\n            evilBtn.click();\n            expect(evilError.getText()).toMatch(/Content Security Policy/);\n            expectError(/Content Security Policy/);\n          });\n        </file>\n      </example>\n  */\n\n// ngCsp is not implemented as a proper directive any more, because we need it be processed while we\n// bootstrap the system (before $parse is instantiated), for this reason we just have\n// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc\n\n/**\n * @ngdoc directive\n * @name ngClick\n *\n * @description\n * The ngClick directive allows you to specify custom behavior when\n * an element is clicked.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon\n * click. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-click=\"count = count + 1\" ng-init=\"count=0\">\n        Increment\n      </button>\n      <span>\n        count: {{count}}\n      </span>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-click', function() {\n         expect(element(by.binding('count')).getText()).toMatch('0');\n         element(by.css('button')).click();\n         expect(element(by.binding('count')).getText()).toMatch('1');\n       });\n     </file>\n   </example>\n */\n/*\n * A collection of directives that allows creation of custom event handlers that are defined as\n * angular expressions and are compiled and executed within the current scope.\n */\nvar ngEventDirectives = {};\n\n// For events that might fire synchronously during DOM manipulation\n// we need to execute their event handlers asynchronously using $evalAsync,\n// so that they are not executed in an inconsistent state.\nvar forceAsyncEvents = {\n  'blur': true,\n  'focus': true\n};\nforEach(\n  'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),\n  function(eventName) {\n    var directiveName = directiveNormalize('ng-' + eventName);\n    ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {\n      return {\n        restrict: 'A',\n        compile: function($element, attr) {\n          // We expose the powerful $event object on the scope that provides access to the Window,\n          // etc. that isn't protected by the fast paths in $parse.  We explicitly request better\n          // checks at the cost of speed since event handler expressions are not executed as\n          // frequently as regular change detection.\n          var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);\n          return function ngEventHandler(scope, element) {\n            element.on(eventName, function(event) {\n              var callback = function() {\n                fn(scope, {$event:event});\n              };\n              if (forceAsyncEvents[eventName] && $rootScope.$$phase) {\n                scope.$evalAsync(callback);\n              } else {\n                scope.$apply(callback);\n              }\n            });\n          };\n        }\n      };\n    }];\n  }\n);\n\n/**\n * @ngdoc directive\n * @name ngDblclick\n *\n * @description\n * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon\n * a dblclick. (The Event object is available as `$event`)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-dblclick=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on double click)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousedown\n *\n * @description\n * The ngMousedown directive allows you to specify custom behavior on mousedown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon\n * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousedown=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse down)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseup\n *\n * @description\n * Specify custom behavior on mouseup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon\n * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseup=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse up)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngMouseover\n *\n * @description\n * Specify custom behavior on mouseover event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon\n * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseover=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse is over)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseenter\n *\n * @description\n * Specify custom behavior on mouseenter event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon\n * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseenter=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse enters)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseleave\n *\n * @description\n * Specify custom behavior on mouseleave event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon\n * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseleave=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse leaves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousemove\n *\n * @description\n * Specify custom behavior on mousemove event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon\n * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousemove=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse moves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeydown\n *\n * @description\n * Specify custom behavior on keydown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon\n * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keydown=\"count = count + 1\" ng-init=\"count=0\">\n      key down count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeyup\n *\n * @description\n * Specify custom behavior on keyup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon\n * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <p>Typing in the input box below updates the key count</p>\n       <input ng-keyup=\"count = count + 1\" ng-init=\"count=0\"> key up count: {{count}}\n\n       <p>Typing in the input box below updates the keycode</p>\n       <input ng-keyup=\"event=$event\">\n       <p>event keyCode: {{ event.keyCode }}</p>\n       <p>event altKey: {{ event.altKey }}</p>\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeypress\n *\n * @description\n * Specify custom behavior on keypress event.\n *\n * @element ANY\n * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon\n * keypress. ({@link guide/expression#-event- Event object is available as `$event`}\n * and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keypress=\"count = count + 1\" ng-init=\"count=0\">\n      key press count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSubmit\n *\n * @description\n * Enables binding angular expressions to onsubmit events.\n *\n * Additionally it prevents the default action (which for form means sending the request to the\n * server and reloading the current page), but only if the form does not contain `action`,\n * `data-action`, or `x-action` attributes.\n *\n * <div class=\"alert alert-warning\">\n * **Warning:** Be careful not to cause \"double-submission\" by using both the `ngClick` and\n * `ngSubmit` handlers together. See the\n * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}\n * for a detailed discussion of when `ngSubmit` may be triggered.\n * </div>\n *\n * @element form\n * @priority 0\n * @param {expression} ngSubmit {@link guide/expression Expression} to eval.\n * ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example module=\"submitExample\">\n     <file name=\"index.html\">\n      <script>\n        angular.module('submitExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.list = [];\n            $scope.text = 'hello';\n            $scope.submit = function() {\n              if ($scope.text) {\n                $scope.list.push(this.text);\n                $scope.text = '';\n              }\n            };\n          }]);\n      </script>\n      <form ng-submit=\"submit()\" ng-controller=\"ExampleController\">\n        Enter text and hit enter:\n        <input type=\"text\" ng-model=\"text\" name=\"text\" />\n        <input type=\"submit\" id=\"submit\" value=\"Submit\" />\n        <pre>list={{list}}</pre>\n      </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-submit', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n         expect(element(by.model('text')).getAttribute('value')).toBe('');\n       });\n       it('should ignore empty strings', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n        });\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngFocus\n *\n * @description\n * Specify custom behavior on focus event.\n *\n * Note: As the `focus` event is executed synchronously when calling `input.focus()`\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon\n * focus. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngBlur\n *\n * @description\n * Specify custom behavior on blur event.\n *\n * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when\n * an element has lost focus.\n *\n * Note: As the `blur` event is executed synchronously also during DOM manipulations\n * (e.g. removing a focussed input),\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon\n * blur. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngCopy\n *\n * @description\n * Specify custom behavior on copy event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon\n * copy. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-copy=\"copied=true\" ng-init=\"copied=false; value='copy me'\" ng-model=\"value\">\n      copied: {{copied}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngCut\n *\n * @description\n * Specify custom behavior on cut event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon\n * cut. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-cut=\"cut=true\" ng-init=\"cut=false; value='cut me'\" ng-model=\"value\">\n      cut: {{cut}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngPaste\n *\n * @description\n * Specify custom behavior on paste event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon\n * paste. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-paste=\"paste=true\" ng-init=\"paste=false\" placeholder='paste here'>\n      pasted: {{paste}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngIf\n * @restrict A\n * @multiElement\n *\n * @description\n * The `ngIf` directive removes or recreates a portion of the DOM tree based on an\n * {expression}. If the expression assigned to `ngIf` evaluates to a false\n * value then the element is removed from the DOM, otherwise a clone of the\n * element is reinserted into the DOM.\n *\n * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the\n * element in the DOM rather than changing its visibility via the `display` css property.  A common\n * case when this difference is significant is when using css selectors that rely on an element's\n * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.\n *\n * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope\n * is created when the element is restored.  The scope created within `ngIf` inherits from\n * its parent scope using\n * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).\n * An important implication of this is if `ngModel` is used within `ngIf` to bind to\n * a javascript primitive defined in the parent scope. In this case any modifications made to the\n * variable within the child scope will override (hide) the value in the parent scope.\n *\n * Also, `ngIf` recreates elements using their compiled state. An example of this behavior\n * is if an element's class attribute is directly modified after it's compiled, using something like\n * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element\n * the added class will be lost because the original compiled state is used to regenerate the element.\n *\n * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`\n * and `leave` effects.\n *\n * @animations\n * | Animation                        | Occurs                               |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container |\n * | {@link ng.$animate#leave leave}  | just before the `ngIf` contents are removed from the DOM |\n *\n * @element ANY\n * @scope\n * @priority 600\n * @param {expression} ngIf If the {@link guide/expression expression} is falsy then\n *     the element is removed from the DOM tree. If it is truthy a copy of the compiled\n *     element is added to the DOM tree.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <label>Click me: <input type=\"checkbox\" ng-model=\"checked\" ng-init=\"checked=true\" /></label><br/>\n      Show when checked:\n      <span ng-if=\"checked\" class=\"animate-if\">\n        This is removed when the checkbox is unchecked.\n      </span>\n    </file>\n    <file name=\"animations.css\">\n      .animate-if {\n        background:white;\n        border:1px solid black;\n        padding:10px;\n      }\n\n      .animate-if.ng-enter, .animate-if.ng-leave {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n      }\n\n      .animate-if.ng-enter,\n      .animate-if.ng-leave.ng-leave-active {\n        opacity:0;\n      }\n\n      .animate-if.ng-leave,\n      .animate-if.ng-enter.ng-enter-active {\n        opacity:1;\n      }\n    </file>\n  </example>\n */\nvar ngIfDirective = ['$animate', '$compile', function($animate, $compile) {\n  return {\n    multiElement: true,\n    transclude: 'element',\n    priority: 600,\n    terminal: true,\n    restrict: 'A',\n    $$tlb: true,\n    link: function($scope, $element, $attr, ctrl, $transclude) {\n        var block, childScope, previousElements;\n        $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {\n\n          if (value) {\n            if (!childScope) {\n              $transclude(function(clone, newScope) {\n                childScope = newScope;\n                clone[clone.length++] = $compile.$$createComment('end ngIf', $attr.ngIf);\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block = {\n                  clone: clone\n                };\n                $animate.enter(clone, $element.parent(), $element);\n              });\n            }\n          } else {\n            if (previousElements) {\n              previousElements.remove();\n              previousElements = null;\n            }\n            if (childScope) {\n              childScope.$destroy();\n              childScope = null;\n            }\n            if (block) {\n              previousElements = getBlockNodes(block.clone);\n              $animate.leave(previousElements).then(function() {\n                previousElements = null;\n              });\n              block = null;\n            }\n          }\n        });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngInclude\n * @restrict ECA\n *\n * @description\n * Fetches, compiles and includes an external HTML fragment.\n *\n * By default, the template URL is restricted to the same domain and protocol as the\n * application document. This is done by calling {@link $sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols\n * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or\n * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link\n * ng.$sce Strict Contextual Escaping}.\n *\n * In addition, the browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy may further restrict whether the template is successfully loaded.\n * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`\n * access on some browsers.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | when the expression changes, on the new include |\n * | {@link ng.$animate#leave leave}  | when the expression changes, on the old include |\n *\n * The enter and leave animation occur concurrently.\n *\n * @scope\n * @priority 400\n *\n * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,\n *                 make sure you wrap it in **single** quotes, e.g. `src=\"'myPartialTemplate.html'\"`.\n * @param {string=} onload Expression to evaluate when a new partial is loaded.\n *                  <div class=\"alert alert-warning\">\n *                  **Note:** When using onload on SVG elements in IE11, the browser will try to call\n *                  a function with the name on the window element, which will usually throw a\n *                  \"function is undefined\" error. To fix this, you can instead use `data-onload` or a\n *                  different form that {@link guide/directive#normalization matches} `onload`.\n *                  </div>\n   *\n * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll\n *                  $anchorScroll} to scroll the viewport after the content is loaded.\n *\n *                  - If the attribute is not set, disable scrolling.\n *                  - If the attribute is set without value, enable scrolling.\n *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.\n *\n * @example\n  <example module=\"includeExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n     <div ng-controller=\"ExampleController\">\n       <select ng-model=\"template\" ng-options=\"t.name for t in templates\">\n        <option value=\"\">(blank)</option>\n       </select>\n       url of the template: <code>{{template.url}}</code>\n       <hr/>\n       <div class=\"slide-animate-container\">\n         <div class=\"slide-animate\" ng-include=\"template.url\"></div>\n       </div>\n     </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('includeExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.templates =\n            [ { name: 'template1.html', url: 'template1.html'},\n              { name: 'template2.html', url: 'template2.html'} ];\n          $scope.template = $scope.templates[0];\n        }]);\n     </file>\n    <file name=\"template1.html\">\n      Content of template1.html\n    </file>\n    <file name=\"template2.html\">\n      Content of template2.html\n    </file>\n    <file name=\"animations.css\">\n      .slide-animate-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .slide-animate {\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter, .slide-animate.ng-leave {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n        display:block;\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter {\n        top:-50px;\n      }\n      .slide-animate.ng-enter.ng-enter-active {\n        top:0;\n      }\n\n      .slide-animate.ng-leave {\n        top:0;\n      }\n      .slide-animate.ng-leave.ng-leave-active {\n        top:50px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var templateSelect = element(by.model('template'));\n      var includeElem = element(by.css('[ng-include]'));\n\n      it('should load template1.html', function() {\n        expect(includeElem.getText()).toMatch(/Content of template1.html/);\n      });\n\n      it('should load template2.html', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          // See https://github.com/angular/protractor/issues/480\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(2).click();\n        expect(includeElem.getText()).toMatch(/Content of template2.html/);\n      });\n\n      it('should change to blank', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(0).click();\n        expect(includeElem.isPresent()).toBe(false);\n      });\n    </file>\n  </example>\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentRequested\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted every time the ngInclude content is requested.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentLoaded\n * @eventType emit on the current ngInclude scope\n * @description\n * Emitted every time the ngInclude content is reloaded.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentError\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\nvar ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',\n                  function($templateRequest,   $anchorScroll,   $animate) {\n  return {\n    restrict: 'ECA',\n    priority: 400,\n    terminal: true,\n    transclude: 'element',\n    controller: angular.noop,\n    compile: function(element, attr) {\n      var srcExp = attr.ngInclude || attr.src,\n          onloadExp = attr.onload || '',\n          autoScrollExp = attr.autoscroll;\n\n      return function(scope, $element, $attr, ctrl, $transclude) {\n        var changeCounter = 0,\n            currentScope,\n            previousElement,\n            currentElement;\n\n        var cleanupLastIncludeContent = function() {\n          if (previousElement) {\n            previousElement.remove();\n            previousElement = null;\n          }\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n          if (currentElement) {\n            $animate.leave(currentElement).then(function() {\n              previousElement = null;\n            });\n            previousElement = currentElement;\n            currentElement = null;\n          }\n        };\n\n        scope.$watch(srcExp, function ngIncludeWatchAction(src) {\n          var afterAnimation = function() {\n            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {\n              $anchorScroll();\n            }\n          };\n          var thisChangeId = ++changeCounter;\n\n          if (src) {\n            //set the 2nd param to true to ignore the template request error so that the inner\n            //contents and scope can be cleaned up.\n            $templateRequest(src, true).then(function(response) {\n              if (scope.$$destroyed) return;\n\n              if (thisChangeId !== changeCounter) return;\n              var newScope = scope.$new();\n              ctrl.template = response;\n\n              // Note: This will also link all children of ng-include that were contained in the original\n              // html. If that content contains controllers, ... they could pollute/change the scope.\n              // However, using ng-include on an element with additional content does not make sense...\n              // Note: We can't remove them in the cloneAttchFn of $transclude as that\n              // function is called before linking the content, which would apply child\n              // directives to non existing elements.\n              var clone = $transclude(newScope, function(clone) {\n                cleanupLastIncludeContent();\n                $animate.enter(clone, null, $element).then(afterAnimation);\n              });\n\n              currentScope = newScope;\n              currentElement = clone;\n\n              currentScope.$emit('$includeContentLoaded', src);\n              scope.$eval(onloadExp);\n            }, function() {\n              if (scope.$$destroyed) return;\n\n              if (thisChangeId === changeCounter) {\n                cleanupLastIncludeContent();\n                scope.$emit('$includeContentError', src);\n              }\n            });\n            scope.$emit('$includeContentRequested', src);\n          } else {\n            cleanupLastIncludeContent();\n            ctrl.template = null;\n          }\n        });\n      };\n    }\n  };\n}];\n\n// This directive is called during the $transclude call of the first `ngInclude` directive.\n// It will replace and compile the content of the element with the loaded template.\n// We need this directive so that the element content is already filled when\n// the link function of another directive on the same element as ngInclude\n// is called.\nvar ngIncludeFillContentDirective = ['$compile',\n  function($compile) {\n    return {\n      restrict: 'ECA',\n      priority: -400,\n      require: 'ngInclude',\n      link: function(scope, $element, $attr, ctrl) {\n        if (toString.call($element[0]).match(/SVG/)) {\n          // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not\n          // support innerHTML, so detect this here and try to generate the contents\n          // specially.\n          $element.empty();\n          $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope,\n              function namespaceAdaptedClone(clone) {\n            $element.append(clone);\n          }, {futureParentElement: $element});\n          return;\n        }\n\n        $element.html(ctrl.template);\n        $compile($element.contents())(scope);\n      }\n    };\n  }];\n\n/**\n * @ngdoc directive\n * @name ngInit\n * @restrict AC\n *\n * @description\n * The `ngInit` directive allows you to evaluate an expression in the\n * current scope.\n *\n * <div class=\"alert alert-danger\">\n * This directive can be abused to add unnecessary amounts of logic into your templates.\n * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of\n * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via\n * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}\n * rather than `ngInit` to initialize values on a scope.\n * </div>\n *\n * <div class=\"alert alert-warning\">\n * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make\n * sure you have parentheses to ensure correct operator precedence:\n * <pre class=\"prettyprint\">\n * `<div ng-init=\"test1 = ($index | toString)\"></div>`\n * </pre>\n * </div>\n *\n * @priority 450\n *\n * @element ANY\n * @param {expression} ngInit {@link guide/expression Expression} to eval.\n *\n * @example\n   <example module=\"initExample\">\n     <file name=\"index.html\">\n   <script>\n     angular.module('initExample', [])\n       .controller('ExampleController', ['$scope', function($scope) {\n         $scope.list = [['a', 'b'], ['c', 'd']];\n       }]);\n   </script>\n   <div ng-controller=\"ExampleController\">\n     <div ng-repeat=\"innerList in list\" ng-init=\"outerIndex = $index\">\n       <div ng-repeat=\"value in innerList\" ng-init=\"innerIndex = $index\">\n          <span class=\"example-init\">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>\n       </div>\n     </div>\n   </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should alias index positions', function() {\n         var elements = element.all(by.css('.example-init'));\n         expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');\n         expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');\n         expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');\n         expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');\n       });\n     </file>\n   </example>\n */\nvar ngInitDirective = ngDirective({\n  priority: 450,\n  compile: function() {\n    return {\n      pre: function(scope, element, attrs) {\n        scope.$eval(attrs.ngInit);\n      }\n    };\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngList\n *\n * @description\n * Text input that converts between a delimited string and an array of strings. The default\n * delimiter is a comma followed by a space - equivalent to `ng-list=\", \"`. You can specify a custom\n * delimiter as the value of the `ngList` attribute - for example, `ng-list=\" | \"`.\n *\n * The behaviour of the directive is affected by the use of the `ngTrim` attribute.\n * * If `ngTrim` is set to `\"false\"` then whitespace around both the separator and each\n *   list item is respected. This implies that the user of the directive is responsible for\n *   dealing with whitespace but also allows you to use whitespace as a delimiter, such as a\n *   tab or newline character.\n * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected\n *   when joining the list items back together) and whitespace around each list item is stripped\n *   before it is added to the model.\n *\n * ### Example with Validation\n *\n * <example name=\"ngList-directive\" module=\"listExample\">\n *   <file name=\"app.js\">\n *      angular.module('listExample', [])\n *        .controller('ExampleController', ['$scope', function($scope) {\n *          $scope.names = ['morpheus', 'neo', 'trinity'];\n *        }]);\n *   </file>\n *   <file name=\"index.html\">\n *    <form name=\"myForm\" ng-controller=\"ExampleController\">\n *      <label>List: <input name=\"namesInput\" ng-model=\"names\" ng-list required></label>\n *      <span role=\"alert\">\n *        <span class=\"error\" ng-show=\"myForm.namesInput.$error.required\">\n *        Required!</span>\n *      </span>\n *      <br>\n *      <tt>names = {{names}}</tt><br/>\n *      <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>\n *      <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>\n *      <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n *      <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n *     </form>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var listInput = element(by.model('names'));\n *     var names = element(by.exactBinding('names'));\n *     var valid = element(by.binding('myForm.namesInput.$valid'));\n *     var error = element(by.css('span.error'));\n *\n *     it('should initialize to model', function() {\n *       expect(names.getText()).toContain('[\"morpheus\",\"neo\",\"trinity\"]');\n *       expect(valid.getText()).toContain('true');\n *       expect(error.getCssValue('display')).toBe('none');\n *     });\n *\n *     it('should be invalid if empty', function() {\n *       listInput.clear();\n *       listInput.sendKeys('');\n *\n *       expect(names.getText()).toContain('');\n *       expect(valid.getText()).toContain('false');\n *       expect(error.getCssValue('display')).not.toBe('none');\n *     });\n *   </file>\n * </example>\n *\n * ### Example - splitting on newline\n * <example name=\"ngList-directive-newlines\">\n *   <file name=\"index.html\">\n *    <textarea ng-model=\"list\" ng-list=\"&#10;\" ng-trim=\"false\"></textarea>\n *    <pre>{{ list | json }}</pre>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it(\"should split the text by newlines\", function() {\n *       var listInput = element(by.model('list'));\n *       var output = element(by.binding('list | json'));\n *       listInput.sendKeys('abc\\ndef\\nghi');\n *       expect(output.getText()).toContain('[\\n  \"abc\",\\n  \"def\",\\n  \"ghi\"\\n]');\n *     });\n *   </file>\n * </example>\n *\n * @element input\n * @param {string=} ngList optional delimiter that should be used to split the value.\n */\nvar ngListDirective = function() {\n  return {\n    restrict: 'A',\n    priority: 100,\n    require: 'ngModel',\n    link: function(scope, element, attr, ctrl) {\n      // We want to control whitespace trimming so we use this convoluted approach\n      // to access the ngList attribute, which doesn't pre-trim the attribute\n      var ngList = element.attr(attr.$attr.ngList) || ', ';\n      var trimValues = attr.ngTrim !== 'false';\n      var separator = trimValues ? trim(ngList) : ngList;\n\n      var parse = function(viewValue) {\n        // If the viewValue is invalid (say required but empty) it will be `undefined`\n        if (isUndefined(viewValue)) return;\n\n        var list = [];\n\n        if (viewValue) {\n          forEach(viewValue.split(separator), function(value) {\n            if (value) list.push(trimValues ? trim(value) : value);\n          });\n        }\n\n        return list;\n      };\n\n      ctrl.$parsers.push(parse);\n      ctrl.$formatters.push(function(value) {\n        if (isArray(value)) {\n          return value.join(ngList);\n        }\n\n        return undefined;\n      });\n\n      // Override the standard $isEmpty because an empty array means the input is empty.\n      ctrl.$isEmpty = function(value) {\n        return !value || !value.length;\n      };\n    }\n  };\n};\n\n/* global VALID_CLASS: true,\n  INVALID_CLASS: true,\n  PRISTINE_CLASS: true,\n  DIRTY_CLASS: true,\n  UNTOUCHED_CLASS: true,\n  TOUCHED_CLASS: true,\n*/\n\nvar VALID_CLASS = 'ng-valid',\n    INVALID_CLASS = 'ng-invalid',\n    PRISTINE_CLASS = 'ng-pristine',\n    DIRTY_CLASS = 'ng-dirty',\n    UNTOUCHED_CLASS = 'ng-untouched',\n    TOUCHED_CLASS = 'ng-touched',\n    PENDING_CLASS = 'ng-pending',\n    EMPTY_CLASS = 'ng-empty',\n    NOT_EMPTY_CLASS = 'ng-not-empty';\n\nvar ngModelMinErr = minErr('ngModel');\n\n/**\n * @ngdoc type\n * @name ngModel.NgModelController\n *\n * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a\n * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue\n * is set.\n * @property {*} $modelValue The value in the model that the control is bound to.\n * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever\n       the control reads value from the DOM. The functions are called in array order, each passing\n       its return value through to the next. The last return value is forwarded to the\n       {@link ngModel.NgModelController#$validators `$validators`} collection.\n\nParsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue\n`$viewValue`}.\n\nReturning `undefined` from a parser means a parse error occurred. In that case,\nno {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`\nwill be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}\nis set to `true`. The parse error is stored in `ngModel.$error.parse`.\n\n *\n * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever\n       the model value changes. The functions are called in reverse array order, each passing the value through to the\n       next. The last return value is used as the actual DOM value.\n       Used to format / convert values for display in the control.\n * ```js\n * function formatter(value) {\n *   if (value) {\n *     return value.toUpperCase();\n *   }\n * }\n * ngModel.$formatters.push(formatter);\n * ```\n *\n * @property {Object.<string, function>} $validators A collection of validators that are applied\n *      whenever the model value changes. The key value within the object refers to the name of the\n *      validator while the function refers to the validation operation. The validation operation is\n *      provided with the model value as an argument and must return a true or false value depending\n *      on the response of that validation.\n *\n * ```js\n * ngModel.$validators.validCharacters = function(modelValue, viewValue) {\n *   var value = modelValue || viewValue;\n *   return /[0-9]+/.test(value) &&\n *          /[a-z]+/.test(value) &&\n *          /[A-Z]+/.test(value) &&\n *          /\\W+/.test(value);\n * };\n * ```\n *\n * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to\n *      perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided\n *      is expected to return a promise when it is run during the model validation process. Once the promise\n *      is delivered then the validation status will be set to true when fulfilled and false when rejected.\n *      When the asynchronous validators are triggered, each of the validators will run in parallel and the model\n *      value will only be updated once all validators have been fulfilled. As long as an asynchronous validator\n *      is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators\n *      will only run once all synchronous validators have passed.\n *\n * Please note that if $http is used then it is important that the server returns a success HTTP response code\n * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.\n *\n * ```js\n * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {\n *   var value = modelValue || viewValue;\n *\n *   // Lookup user by username\n *   return $http.get('/api/users/' + value).\n *      then(function resolved() {\n *        //username exists, this means validation fails\n *        return $q.reject('exists');\n *      }, function rejected() {\n *        //username does not exist, therefore this validation passes\n *        return true;\n *      });\n * };\n * ```\n *\n * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the\n *     view value has changed. It is called with no arguments, and its return value is ignored.\n *     This can be used in place of additional $watches against the model value.\n *\n * @property {Object} $error An object hash with all failing validator ids as keys.\n * @property {Object} $pending An object hash with all pending validator ids as keys.\n *\n * @property {boolean} $untouched True if control has not lost focus yet.\n * @property {boolean} $touched True if control has lost focus.\n * @property {boolean} $pristine True if user has not interacted with the control yet.\n * @property {boolean} $dirty True if user has already interacted with the control.\n * @property {boolean} $valid True if there is no error.\n * @property {boolean} $invalid True if at least one error on the control.\n * @property {string} $name The name attribute of the control.\n *\n * @description\n *\n * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.\n * The controller contains services for data-binding, validation, CSS updates, and value formatting\n * and parsing. It purposefully does not contain any logic which deals with DOM rendering or\n * listening to DOM events.\n * Such DOM related logic should be provided by other directives which make use of\n * `NgModelController` for data-binding to control elements.\n * Angular provides this DOM logic for most {@link input `input`} elements.\n * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example\n * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.\n *\n * @example\n * ### Custom Control Example\n * This example shows how to use `NgModelController` with a custom control to achieve\n * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)\n * collaborate together to achieve the desired result.\n *\n * `contenteditable` is an HTML5 attribute, which tells the browser to let the element\n * contents be edited in place by the user.\n *\n * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}\n * module to automatically remove \"bad\" content like inline event listener (e.g. `<span onclick=\"...\">`).\n * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks\n * that content using the `$sce` service.\n *\n * <example name=\"NgModelController\" module=\"customControl\" deps=\"angular-sanitize.js\">\n    <file name=\"style.css\">\n      [contenteditable] {\n        border: 1px solid black;\n        background-color: white;\n        min-height: 20px;\n      }\n\n      .ng-invalid {\n        border: 1px solid red;\n      }\n\n    </file>\n    <file name=\"script.js\">\n      angular.module('customControl', ['ngSanitize']).\n        directive('contenteditable', ['$sce', function($sce) {\n          return {\n            restrict: 'A', // only activate on element attribute\n            require: '?ngModel', // get a hold of NgModelController\n            link: function(scope, element, attrs, ngModel) {\n              if (!ngModel) return; // do nothing if no ng-model\n\n              // Specify how UI should be updated\n              ngModel.$render = function() {\n                element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));\n              };\n\n              // Listen for change events to enable binding\n              element.on('blur keyup change', function() {\n                scope.$evalAsync(read);\n              });\n              read(); // initialize\n\n              // Write data to the model\n              function read() {\n                var html = element.html();\n                // When we clear the content editable the browser leaves a <br> behind\n                // If strip-br attribute is provided then we strip this out\n                if ( attrs.stripBr && html == '<br>' ) {\n                  html = '';\n                }\n                ngModel.$setViewValue(html);\n              }\n            }\n          };\n        }]);\n    </file>\n    <file name=\"index.html\">\n      <form name=\"myForm\">\n       <div contenteditable\n            name=\"myWidget\" ng-model=\"userContent\"\n            strip-br=\"true\"\n            required>Change me!</div>\n        <span ng-show=\"myForm.myWidget.$error.required\">Required!</span>\n       <hr>\n       <textarea ng-model=\"userContent\" aria-label=\"Dynamic textarea\"></textarea>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n    it('should data-bind and become invalid', function() {\n      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {\n        // SafariDriver can't handle contenteditable\n        // and Firefox driver can't clear contenteditables very well\n        return;\n      }\n      var contentEditable = element(by.css('[contenteditable]'));\n      var content = 'Change me!';\n\n      expect(contentEditable.getText()).toEqual(content);\n\n      contentEditable.clear();\n      contentEditable.sendKeys(protractor.Key.BACK_SPACE);\n      expect(contentEditable.getText()).toEqual('');\n      expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);\n    });\n    </file>\n * </example>\n *\n *\n */\nvar NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',\n    function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {\n  this.$viewValue = Number.NaN;\n  this.$modelValue = Number.NaN;\n  this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.\n  this.$validators = {};\n  this.$asyncValidators = {};\n  this.$parsers = [];\n  this.$formatters = [];\n  this.$viewChangeListeners = [];\n  this.$untouched = true;\n  this.$touched = false;\n  this.$pristine = true;\n  this.$dirty = false;\n  this.$valid = true;\n  this.$invalid = false;\n  this.$error = {}; // keep invalid keys here\n  this.$$success = {}; // keep valid keys here\n  this.$pending = undefined; // keep pending keys here\n  this.$name = $interpolate($attr.name || '', false)($scope);\n  this.$$parentForm = nullFormCtrl;\n\n  var parsedNgModel = $parse($attr.ngModel),\n      parsedNgModelAssign = parsedNgModel.assign,\n      ngModelGet = parsedNgModel,\n      ngModelSet = parsedNgModelAssign,\n      pendingDebounce = null,\n      parserValid,\n      ctrl = this;\n\n  this.$$setOptions = function(options) {\n    ctrl.$options = options;\n    if (options && options.getterSetter) {\n      var invokeModelGetter = $parse($attr.ngModel + '()'),\n          invokeModelSetter = $parse($attr.ngModel + '($$$p)');\n\n      ngModelGet = function($scope) {\n        var modelValue = parsedNgModel($scope);\n        if (isFunction(modelValue)) {\n          modelValue = invokeModelGetter($scope);\n        }\n        return modelValue;\n      };\n      ngModelSet = function($scope, newValue) {\n        if (isFunction(parsedNgModel($scope))) {\n          invokeModelSetter($scope, {$$$p: newValue});\n        } else {\n          parsedNgModelAssign($scope, newValue);\n        }\n      };\n    } else if (!parsedNgModel.assign) {\n      throw ngModelMinErr('nonassign', \"Expression '{0}' is non-assignable. Element: {1}\",\n          $attr.ngModel, startingTag($element));\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$render\n   *\n   * @description\n   * Called when the view needs to be updated. It is expected that the user of the ng-model\n   * directive will implement this method.\n   *\n   * The `$render()` method is invoked in the following situations:\n   *\n   * * `$rollbackViewValue()` is called.  If we are rolling back the view value to the last\n   *   committed value then `$render()` is called to update the input control.\n   * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and\n   *   the `$viewValue` are different from last time.\n   *\n   * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of\n   * `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue`\n   * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be\n   * invoked if you only change a property on the objects.\n   */\n  this.$render = noop;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$isEmpty\n   *\n   * @description\n   * This is called when we need to determine if the value of an input is empty.\n   *\n   * For instance, the required directive does this to work out if the input has data or not.\n   *\n   * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.\n   *\n   * You can override this for input directives whose concept of being empty is different from the\n   * default. The `checkboxInputType` directive does this because in its case a value of `false`\n   * implies empty.\n   *\n   * @param {*} value The value of the input to check for emptiness.\n   * @returns {boolean} True if `value` is \"empty\".\n   */\n  this.$isEmpty = function(value) {\n    return isUndefined(value) || value === '' || value === null || value !== value;\n  };\n\n  this.$$updateEmptyClasses = function(value) {\n    if (ctrl.$isEmpty(value)) {\n      $animate.removeClass($element, NOT_EMPTY_CLASS);\n      $animate.addClass($element, EMPTY_CLASS);\n    } else {\n      $animate.removeClass($element, EMPTY_CLASS);\n      $animate.addClass($element, NOT_EMPTY_CLASS);\n    }\n  };\n\n\n  var currentValidationRunId = 0;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setValidity\n   *\n   * @description\n   * Change the validity state, and notify the form.\n   *\n   * This method can be called within $parsers/$formatters or a custom validation implementation.\n   * However, in most cases it should be sufficient to use the `ngModel.$validators` and\n   * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.\n   *\n   * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned\n   *        to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`\n   *        (for unfulfilled `$asyncValidators`), so that it is available for data-binding.\n   *        The `validationErrorKey` should be in camelCase and will get converted into dash-case\n   *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`\n   *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .\n   * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),\n   *                          or skipped (null). Pending is used for unfulfilled `$asyncValidators`.\n   *                          Skipped is used by Angular when validators do not run because of parse errors and\n   *                          when `$asyncValidators` do not run because any of the `$validators` failed.\n   */\n  addSetValidityMethod({\n    ctrl: this,\n    $element: $element,\n    set: function(object, property) {\n      object[property] = true;\n    },\n    unset: function(object, property) {\n      delete object[property];\n    },\n    $animate: $animate\n  });\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setPristine\n   *\n   * @description\n   * Sets the control to its pristine state.\n   *\n   * This method can be called to remove the `ng-dirty` class and set the control to its pristine\n   * state (`ng-pristine` class). A model is considered to be pristine when the control\n   * has not been changed from when first compiled.\n   */\n  this.$setPristine = function() {\n    ctrl.$dirty = false;\n    ctrl.$pristine = true;\n    $animate.removeClass($element, DIRTY_CLASS);\n    $animate.addClass($element, PRISTINE_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setDirty\n   *\n   * @description\n   * Sets the control to its dirty state.\n   *\n   * This method can be called to remove the `ng-pristine` class and set the control to its dirty\n   * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed\n   * from when first compiled.\n   */\n  this.$setDirty = function() {\n    ctrl.$dirty = true;\n    ctrl.$pristine = false;\n    $animate.removeClass($element, PRISTINE_CLASS);\n    $animate.addClass($element, DIRTY_CLASS);\n    ctrl.$$parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setUntouched\n   *\n   * @description\n   * Sets the control to its untouched state.\n   *\n   * This method can be called to remove the `ng-touched` class and set the control to its\n   * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched\n   * by default, however this function can be used to restore that state if the model has\n   * already been touched by the user.\n   */\n  this.$setUntouched = function() {\n    ctrl.$touched = false;\n    ctrl.$untouched = true;\n    $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setTouched\n   *\n   * @description\n   * Sets the control to its touched state.\n   *\n   * This method can be called to remove the `ng-untouched` class and set the control to its\n   * touched state (`ng-touched` class). A model is considered to be touched when the user has\n   * first focused the control element and then shifted focus away from the control (blur event).\n   */\n  this.$setTouched = function() {\n    ctrl.$touched = true;\n    ctrl.$untouched = false;\n    $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$rollbackViewValue\n   *\n   * @description\n   * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,\n   * which may be caused by a pending debounced event or because the input is waiting for a some\n   * future event.\n   *\n   * If you have an input that uses `ng-model-options` to set up debounced updates or updates that\n   * depend on special events such as blur, you can have a situation where there is a period when\n   * the `$viewValue` is out of sync with the ngModel's `$modelValue`.\n   *\n   * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update\n   * and reset the input to the last committed view value.\n   *\n   * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`\n   * programmatically before these debounced/future events have resolved/occurred, because Angular's\n   * dirty checking mechanism is not able to tell whether the model has actually changed or not.\n   *\n   * The `$rollbackViewValue()` method should be called before programmatically changing the model of an\n   * input which may have such events pending. This is important in order to make sure that the\n   * input field will be updated with the new model value and any pending operations are cancelled.\n   *\n   * <example name=\"ng-model-cancel-update\" module=\"cancel-update-example\">\n   *   <file name=\"app.js\">\n   *     angular.module('cancel-update-example', [])\n   *\n   *     .controller('CancelUpdateController', ['$scope', function($scope) {\n   *       $scope.model = {};\n   *\n   *       $scope.setEmpty = function(e, value, rollback) {\n   *         if (e.keyCode == 27) {\n   *           e.preventDefault();\n   *           if (rollback) {\n   *             $scope.myForm[value].$rollbackViewValue();\n   *           }\n   *           $scope.model[value] = '';\n   *         }\n   *       };\n   *     }]);\n   *   </file>\n   *   <file name=\"index.html\">\n   *     <div ng-controller=\"CancelUpdateController\">\n   *        <p>Both of these inputs are only updated if they are blurred. Hitting escape should\n   *        empty them. Follow these steps and observe the difference:</p>\n   *       <ol>\n   *         <li>Type something in the input. You will see that the model is not yet updated</li>\n   *         <li>Press the Escape key.\n   *           <ol>\n   *             <li> In the first example, nothing happens, because the model is already '', and no\n   *             update is detected. If you blur the input, the model will be set to the current view.\n   *             </li>\n   *             <li> In the second example, the pending update is cancelled, and the input is set back\n   *             to the last committed view value (''). Blurring the input does nothing.\n   *             </li>\n   *           </ol>\n   *         </li>\n   *       </ol>\n   *\n   *       <form name=\"myForm\" ng-model-options=\"{ updateOn: 'blur' }\">\n   *         <div>\n   *        <p id=\"inputDescription1\">Without $rollbackViewValue():</p>\n   *         <input name=\"value1\" aria-describedby=\"inputDescription1\" ng-model=\"model.value1\"\n   *                ng-keydown=\"setEmpty($event, 'value1')\">\n   *         value1: \"{{ model.value1 }}\"\n   *         </div>\n   *\n   *         <div>\n   *        <p id=\"inputDescription2\">With $rollbackViewValue():</p>\n   *         <input name=\"value2\" aria-describedby=\"inputDescription2\" ng-model=\"model.value2\"\n   *                ng-keydown=\"setEmpty($event, 'value2', true)\">\n   *         value2: \"{{ model.value2 }}\"\n   *         </div>\n   *       </form>\n   *     </div>\n   *   </file>\n       <file name=\"style.css\">\n          div {\n            display: table-cell;\n          }\n          div:nth-child(1) {\n            padding-right: 30px;\n          }\n\n        </file>\n   * </example>\n   */\n  this.$rollbackViewValue = function() {\n    $timeout.cancel(pendingDebounce);\n    ctrl.$viewValue = ctrl.$$lastCommittedViewValue;\n    ctrl.$render();\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$validate\n   *\n   * @description\n   * Runs each of the registered validators (first synchronous validators and then\n   * asynchronous validators).\n   * If the validity changes to invalid, the model will be set to `undefined`,\n   * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.\n   * If the validity changes to valid, it will set the model to the last available valid\n   * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.\n   */\n  this.$validate = function() {\n    // ignore $validate before model is initialized\n    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n      return;\n    }\n\n    var viewValue = ctrl.$$lastCommittedViewValue;\n    // Note: we use the $$rawModelValue as $modelValue might have been\n    // set to undefined during a view -> model update that found validation\n    // errors. We can't parse the view here, since that could change\n    // the model although neither viewValue nor the model on the scope changed\n    var modelValue = ctrl.$$rawModelValue;\n\n    var prevValid = ctrl.$valid;\n    var prevModelValue = ctrl.$modelValue;\n\n    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n\n    ctrl.$$runValidators(modelValue, viewValue, function(allValid) {\n      // If there was no change in validity, don't update the model\n      // This prevents changing an invalid modelValue to undefined\n      if (!allowInvalid && prevValid !== allValid) {\n        // Note: Don't check ctrl.$valid here, as we could have\n        // external validators (e.g. calculated on the server),\n        // that just call $setValidity and need the model value\n        // to calculate their validity.\n        ctrl.$modelValue = allValid ? modelValue : undefined;\n\n        if (ctrl.$modelValue !== prevModelValue) {\n          ctrl.$$writeModelToScope();\n        }\n      }\n    });\n\n  };\n\n  this.$$runValidators = function(modelValue, viewValue, doneCallback) {\n    currentValidationRunId++;\n    var localValidationRunId = currentValidationRunId;\n\n    // check parser error\n    if (!processParseErrors()) {\n      validationDone(false);\n      return;\n    }\n    if (!processSyncValidators()) {\n      validationDone(false);\n      return;\n    }\n    processAsyncValidators();\n\n    function processParseErrors() {\n      var errorKey = ctrl.$$parserName || 'parse';\n      if (isUndefined(parserValid)) {\n        setValidity(errorKey, null);\n      } else {\n        if (!parserValid) {\n          forEach(ctrl.$validators, function(v, name) {\n            setValidity(name, null);\n          });\n          forEach(ctrl.$asyncValidators, function(v, name) {\n            setValidity(name, null);\n          });\n        }\n        // Set the parse error last, to prevent unsetting it, should a $validators key == parserName\n        setValidity(errorKey, parserValid);\n        return parserValid;\n      }\n      return true;\n    }\n\n    function processSyncValidators() {\n      var syncValidatorsValid = true;\n      forEach(ctrl.$validators, function(validator, name) {\n        var result = validator(modelValue, viewValue);\n        syncValidatorsValid = syncValidatorsValid && result;\n        setValidity(name, result);\n      });\n      if (!syncValidatorsValid) {\n        forEach(ctrl.$asyncValidators, function(v, name) {\n          setValidity(name, null);\n        });\n        return false;\n      }\n      return true;\n    }\n\n    function processAsyncValidators() {\n      var validatorPromises = [];\n      var allValid = true;\n      forEach(ctrl.$asyncValidators, function(validator, name) {\n        var promise = validator(modelValue, viewValue);\n        if (!isPromiseLike(promise)) {\n          throw ngModelMinErr('nopromise',\n            \"Expected asynchronous validator to return a promise but got '{0}' instead.\", promise);\n        }\n        setValidity(name, undefined);\n        validatorPromises.push(promise.then(function() {\n          setValidity(name, true);\n        }, function() {\n          allValid = false;\n          setValidity(name, false);\n        }));\n      });\n      if (!validatorPromises.length) {\n        validationDone(true);\n      } else {\n        $q.all(validatorPromises).then(function() {\n          validationDone(allValid);\n        }, noop);\n      }\n    }\n\n    function setValidity(name, isValid) {\n      if (localValidationRunId === currentValidationRunId) {\n        ctrl.$setValidity(name, isValid);\n      }\n    }\n\n    function validationDone(allValid) {\n      if (localValidationRunId === currentValidationRunId) {\n\n        doneCallback(allValid);\n      }\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$commitViewValue\n   *\n   * @description\n   * Commit a pending update to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`\n   * usually handles calling this in response to input events.\n   */\n  this.$commitViewValue = function() {\n    var viewValue = ctrl.$viewValue;\n\n    $timeout.cancel(pendingDebounce);\n\n    // If the view value has not changed then we should just exit, except in the case where there is\n    // a native validator on the element. In this case the validation state may have changed even though\n    // the viewValue has stayed empty.\n    if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {\n      return;\n    }\n    ctrl.$$updateEmptyClasses(viewValue);\n    ctrl.$$lastCommittedViewValue = viewValue;\n\n    // change to dirty\n    if (ctrl.$pristine) {\n      this.$setDirty();\n    }\n    this.$$parseAndValidate();\n  };\n\n  this.$$parseAndValidate = function() {\n    var viewValue = ctrl.$$lastCommittedViewValue;\n    var modelValue = viewValue;\n    parserValid = isUndefined(modelValue) ? undefined : true;\n\n    if (parserValid) {\n      for (var i = 0; i < ctrl.$parsers.length; i++) {\n        modelValue = ctrl.$parsers[i](modelValue);\n        if (isUndefined(modelValue)) {\n          parserValid = false;\n          break;\n        }\n      }\n    }\n    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n      // ctrl.$modelValue has not been touched yet...\n      ctrl.$modelValue = ngModelGet($scope);\n    }\n    var prevModelValue = ctrl.$modelValue;\n    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n    ctrl.$$rawModelValue = modelValue;\n\n    if (allowInvalid) {\n      ctrl.$modelValue = modelValue;\n      writeToModelIfNeeded();\n    }\n\n    // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.\n    // This can happen if e.g. $setViewValue is called from inside a parser\n    ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {\n      if (!allowInvalid) {\n        // Note: Don't check ctrl.$valid here, as we could have\n        // external validators (e.g. calculated on the server),\n        // that just call $setValidity and need the model value\n        // to calculate their validity.\n        ctrl.$modelValue = allValid ? modelValue : undefined;\n        writeToModelIfNeeded();\n      }\n    });\n\n    function writeToModelIfNeeded() {\n      if (ctrl.$modelValue !== prevModelValue) {\n        ctrl.$$writeModelToScope();\n      }\n    }\n  };\n\n  this.$$writeModelToScope = function() {\n    ngModelSet($scope, ctrl.$modelValue);\n    forEach(ctrl.$viewChangeListeners, function(listener) {\n      try {\n        listener();\n      } catch (e) {\n        $exceptionHandler(e);\n      }\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setViewValue\n   *\n   * @description\n   * Update the view value.\n   *\n   * This method should be called when a control wants to change the view value; typically,\n   * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}\n   * directive calls it when the value of the input changes and {@link ng.directive:select select}\n   * calls it when an option is selected.\n   *\n   * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`\n   * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged\n   * value sent directly for processing, finally to be applied to `$modelValue` and then the\n   * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,\n   * in the `$viewChangeListeners` list, are called.\n   *\n   * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`\n   * and the `default` trigger is not listed, all those actions will remain pending until one of the\n   * `updateOn` events is triggered on the DOM element.\n   * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}\n   * directive is used with a custom debounce for this particular event.\n   * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`\n   * is specified, once the timer runs out.\n   *\n   * When used with standard inputs, the view value will always be a string (which is in some cases\n   * parsed into another type, such as a `Date` object for `input[date]`.)\n   * However, custom controls might also pass objects to this method. In this case, we should make\n   * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not\n   * perform a deep watch of objects, it only looks for a change of identity. If you only change\n   * the property of the object then ngModel will not realize that the object has changed and\n   * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should\n   * not change properties of the copy once it has been passed to `$setViewValue`.\n   * Otherwise you may cause the model value on the scope to change incorrectly.\n   *\n   * <div class=\"alert alert-info\">\n   * In any case, the value passed to the method should always reflect the current value\n   * of the control. For example, if you are calling `$setViewValue` for an input element,\n   * you should pass the input DOM value. Otherwise, the control and the scope model become\n   * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change\n   * the control's DOM value in any way. If we want to change the control's DOM value\n   * programmatically, we should update the `ngModel` scope expression. Its new value will be\n   * picked up by the model controller, which will run it through the `$formatters`, `$render` it\n   * to update the DOM, and finally call `$validate` on it.\n   * </div>\n   *\n   * @param {*} value value from the view.\n   * @param {string} trigger Event that triggered the update.\n   */\n  this.$setViewValue = function(value, trigger) {\n    ctrl.$viewValue = value;\n    if (!ctrl.$options || ctrl.$options.updateOnDefault) {\n      ctrl.$$debounceViewValueCommit(trigger);\n    }\n  };\n\n  this.$$debounceViewValueCommit = function(trigger) {\n    var debounceDelay = 0,\n        options = ctrl.$options,\n        debounce;\n\n    if (options && isDefined(options.debounce)) {\n      debounce = options.debounce;\n      if (isNumber(debounce)) {\n        debounceDelay = debounce;\n      } else if (isNumber(debounce[trigger])) {\n        debounceDelay = debounce[trigger];\n      } else if (isNumber(debounce['default'])) {\n        debounceDelay = debounce['default'];\n      }\n    }\n\n    $timeout.cancel(pendingDebounce);\n    if (debounceDelay) {\n      pendingDebounce = $timeout(function() {\n        ctrl.$commitViewValue();\n      }, debounceDelay);\n    } else if ($rootScope.$$phase) {\n      ctrl.$commitViewValue();\n    } else {\n      $scope.$apply(function() {\n        ctrl.$commitViewValue();\n      });\n    }\n  };\n\n  // model -> value\n  // Note: we cannot use a normal scope.$watch as we want to detect the following:\n  // 1. scope value is 'a'\n  // 2. user enters 'b'\n  // 3. ng-change kicks in and reverts scope value to 'a'\n  //    -> scope value did not change since the last digest as\n  //       ng-change executes in apply phase\n  // 4. view should be changed back to 'a'\n  $scope.$watch(function ngModelWatch() {\n    var modelValue = ngModelGet($scope);\n\n    // if scope model value and ngModel value are out of sync\n    // TODO(perf): why not move this to the action fn?\n    if (modelValue !== ctrl.$modelValue &&\n       // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator\n       (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)\n    ) {\n      ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;\n      parserValid = undefined;\n\n      var formatters = ctrl.$formatters,\n          idx = formatters.length;\n\n      var viewValue = modelValue;\n      while (idx--) {\n        viewValue = formatters[idx](viewValue);\n      }\n      if (ctrl.$viewValue !== viewValue) {\n        ctrl.$$updateEmptyClasses(viewValue);\n        ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;\n        ctrl.$render();\n\n        ctrl.$$runValidators(modelValue, viewValue, noop);\n      }\n    }\n\n    return modelValue;\n  });\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngModel\n *\n * @element input\n * @priority 1\n *\n * @description\n * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a\n * property on the scope using {@link ngModel.NgModelController NgModelController},\n * which is created and exposed by this directive.\n *\n * `ngModel` is responsible for:\n *\n * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`\n *   require.\n * - Providing validation behavior (i.e. required, number, email, url).\n * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).\n * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,\n *   `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.\n * - Registering the control with its parent {@link ng.directive:form form}.\n *\n * Note: `ngModel` will try to bind to the property given by evaluating the expression on the\n * current scope. If the property doesn't already exist on this scope, it will be created\n * implicitly and added to the scope.\n *\n * For best practices on using `ngModel`, see:\n *\n *  - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)\n *\n * For basic examples, how to use `ngModel`, see:\n *\n *  - {@link ng.directive:input input}\n *    - {@link input[text] text}\n *    - {@link input[checkbox] checkbox}\n *    - {@link input[radio] radio}\n *    - {@link input[number] number}\n *    - {@link input[email] email}\n *    - {@link input[url] url}\n *    - {@link input[date] date}\n *    - {@link input[datetime-local] datetime-local}\n *    - {@link input[time] time}\n *    - {@link input[month] month}\n *    - {@link input[week] week}\n *  - {@link ng.directive:select select}\n *  - {@link ng.directive:textarea textarea}\n *\n * # Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the\n * object or collection change, `ngModel` will not be notified and so the input will not be  re-rendered.\n *\n * The model must be assigned an entirely new object or collection before a re-rendering will occur.\n *\n * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression\n * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or\n * if the select is given the `multiple` attribute.\n *\n * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the\n * first level of the object (or only changing the properties of an item in the collection if it's an array) will still\n * not trigger a re-rendering of the model.\n *\n * # CSS classes\n * The following CSS classes are added and removed on the associated input/select/textarea element\n * depending on the validity of the model.\n *\n *  - `ng-valid`: the model is valid\n *  - `ng-invalid`: the model is invalid\n *  - `ng-valid-[key]`: for each valid key added by `$setValidity`\n *  - `ng-invalid-[key]`: for each invalid key added by `$setValidity`\n *  - `ng-pristine`: the control hasn't been interacted with yet\n *  - `ng-dirty`: the control has been interacted with\n *  - `ng-touched`: the control has been blurred\n *  - `ng-untouched`: the control hasn't been blurred\n *  - `ng-pending`: any `$asyncValidators` are unfulfilled\n *  - `ng-empty`: the view does not contain a value or the value is deemed \"empty\", as defined\n *     by the {@link ngModel.NgModelController#$isEmpty} method\n *  - `ng-not-empty`: the view contains a non-empty value\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n * ## Animation Hooks\n *\n * Animations within models are triggered when any of the associated CSS classes are added and removed\n * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,\n * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.\n * The animations that are triggered within ngModel are similar to how they work in ngClass and\n * animations can be hooked into using CSS transitions, keyframes as well as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style an input element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-input {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-input.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n * <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"inputExample\">\n     <file name=\"index.html\">\n       <script>\n        angular.module('inputExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.val = '1';\n          }]);\n       </script>\n       <style>\n         .my-input {\n           transition:all linear 0.5s;\n           background: transparent;\n         }\n         .my-input.ng-invalid {\n           color:white;\n           background: red;\n         }\n       </style>\n       <p id=\"inputDescription\">\n        Update input to see transitions when valid/invalid.\n        Integer is a valid value.\n       </p>\n       <form name=\"testForm\" ng-controller=\"ExampleController\">\n         <input ng-model=\"val\" ng-pattern=\"/^\\d+$/\" name=\"anim\" class=\"my-input\"\n                aria-describedby=\"inputDescription\" />\n       </form>\n     </file>\n * </example>\n *\n * ## Binding to a getter/setter\n *\n * Sometimes it's helpful to bind `ngModel` to a getter/setter function.  A getter/setter is a\n * function that returns a representation of the model when called with zero arguments, and sets\n * the internal state of a model when called with an argument. It's sometimes useful to use this\n * for models that have an internal representation that's different from what the model exposes\n * to the view.\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more\n * frequently than other parts of your code.\n * </div>\n *\n * You use this behavior by adding `ng-model-options=\"{ getterSetter: true }\"` to an element that\n * has `ng-model` attached to it. You can also add `ng-model-options=\"{ getterSetter: true }\"` to\n * a `<form>`, which will enable this behavior for all `<input>`s within it. See\n * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.\n *\n * The following example shows how to use `ngModel` with a getter/setter:\n *\n * @example\n * <example name=\"ngModel-getter-setter\" module=\"getterSetterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <form name=\"userForm\">\n           <label>Name:\n             <input type=\"text\" name=\"userName\"\n                    ng-model=\"user.name\"\n                    ng-model-options=\"{ getterSetter: true }\" />\n           </label>\n         </form>\n         <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n       </div>\n     </file>\n     <file name=\"app.js\">\n       angular.module('getterSetterExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           var _name = 'Brian';\n           $scope.user = {\n             name: function(newName) {\n              // Note that newName can be undefined for two reasons:\n              // 1. Because it is called as a getter and thus called with no arguments\n              // 2. Because the property should actually be set to undefined. This happens e.g. if the\n              //    input is invalid\n              return arguments.length ? (_name = newName) : _name;\n             }\n           };\n         }]);\n     </file>\n * </example>\n */\nvar ngModelDirective = ['$rootScope', function($rootScope) {\n  return {\n    restrict: 'A',\n    require: ['ngModel', '^?form', '^?ngModelOptions'],\n    controller: NgModelController,\n    // Prelink needs to run before any input directive\n    // so that we can set the NgModelOptions in NgModelController\n    // before anyone else uses it.\n    priority: 1,\n    compile: function ngModelCompile(element) {\n      // Setup initial state of the control\n      element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);\n\n      return {\n        pre: function ngModelPreLink(scope, element, attr, ctrls) {\n          var modelCtrl = ctrls[0],\n              formCtrl = ctrls[1] || modelCtrl.$$parentForm;\n\n          modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);\n\n          // notify others, especially parent forms\n          formCtrl.$addControl(modelCtrl);\n\n          attr.$observe('name', function(newValue) {\n            if (modelCtrl.$name !== newValue) {\n              modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);\n            }\n          });\n\n          scope.$on('$destroy', function() {\n            modelCtrl.$$parentForm.$removeControl(modelCtrl);\n          });\n        },\n        post: function ngModelPostLink(scope, element, attr, ctrls) {\n          var modelCtrl = ctrls[0];\n          if (modelCtrl.$options && modelCtrl.$options.updateOn) {\n            element.on(modelCtrl.$options.updateOn, function(ev) {\n              modelCtrl.$$debounceViewValueCommit(ev && ev.type);\n            });\n          }\n\n          element.on('blur', function() {\n            if (modelCtrl.$touched) return;\n\n            if ($rootScope.$$phase) {\n              scope.$evalAsync(modelCtrl.$setTouched);\n            } else {\n              scope.$apply(modelCtrl.$setTouched);\n            }\n          });\n        }\n      };\n    }\n  };\n}];\n\nvar DEFAULT_REGEXP = /(\\s+|^)default(\\s+|$)/;\n\n/**\n * @ngdoc directive\n * @name ngModelOptions\n *\n * @description\n * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of\n * events that will trigger a model update and/or a debouncing delay so that the actual update only\n * takes place when a timer expires; this timer will be reset after another change takes place.\n *\n * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might\n * be different from the value in the actual model. This means that if you update the model you\n * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in\n * order to make sure it is synchronized with the model and that any debounced action is canceled.\n *\n * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}\n * method is by making sure the input is placed inside a form that has a `name` attribute. This is\n * important because `form` controllers are published to the related scope under the name in their\n * `name` attribute.\n *\n * Any pending changes will take place immediately when an enclosing form is submitted via the\n * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * `ngModelOptions` has an effect on the element it's declared on and its descendants.\n *\n * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:\n *   - `updateOn`: string specifying which event should the input be bound to. You can set several\n *     events using an space delimited list. There is a special event called `default` that\n *     matches the default events belonging of the control.\n *   - `debounce`: integer value which contains the debounce model update value in milliseconds. A\n *     value of 0 triggers an immediate update. If an object is supplied instead, you can specify a\n *     custom value for each event. For example:\n *     `ng-model-options=\"{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }\"`\n *   - `allowInvalid`: boolean value which indicates that the model can be set with values that did\n *     not validate correctly instead of the default behavior of setting the model to undefined.\n *   - `getterSetter`: boolean value which determines whether or not to treat functions bound to\n       `ngModel` as getters/setters.\n *   - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for\n *     `<input type=\"date\">`, `<input type=\"time\">`, ... . It understands UTC/GMT and the\n *     continental US time zone abbreviations, but for general use, use a time zone offset, for\n *     example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n *     If not specified, the timezone of the browser will be used.\n *\n * @example\n\n  The following example shows how to override immediate updates. Changes on the inputs within the\n  form will update the model only when the control loses focus (blur event). If `escape` key is\n  pressed while the input field is focused, the value is reset to the value in the current model.\n\n  <example name=\"ngModelOptions-directive-blur\" module=\"optionsExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ updateOn: 'blur' }\"\n                   ng-keyup=\"cancel($event)\" />\n          </label><br />\n          <label>Other data:\n            <input type=\"text\" ng-model=\"user.data\" />\n          </label><br />\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n        <pre>user.data = <span ng-bind=\"user.data\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('optionsExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.user = { name: 'John', data: '' };\n\n          $scope.cancel = function(e) {\n            if (e.keyCode == 27) {\n              $scope.userForm.userName.$rollbackViewValue();\n            }\n          };\n        }]);\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var model = element(by.binding('user.name'));\n      var input = element(by.model('user.name'));\n      var other = element(by.model('user.data'));\n\n      it('should allow custom events', function() {\n        input.sendKeys(' Doe');\n        input.click();\n        expect(model.getText()).toEqual('John');\n        other.click();\n        expect(model.getText()).toEqual('John Doe');\n      });\n\n      it('should $rollbackViewValue when model changes', function() {\n        input.sendKeys(' Doe');\n        expect(input.getAttribute('value')).toEqual('John Doe');\n        input.sendKeys(protractor.Key.ESCAPE);\n        expect(input.getAttribute('value')).toEqual('John');\n        other.click();\n        expect(model.getText()).toEqual('John');\n      });\n    </file>\n  </example>\n\n  This one shows how to debounce model changes. Model will be updated only 1 sec after last change.\n  If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.\n\n  <example name=\"ngModelOptions-directive-debounce\" module=\"optionsExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ debounce: 1000 }\" />\n          </label>\n          <button ng-click=\"userForm.userName.$rollbackViewValue(); user.name=''\">Clear</button>\n          <br />\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('optionsExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.user = { name: 'Igor' };\n        }]);\n    </file>\n  </example>\n\n  This one shows how to bind to getter/setters:\n\n  <example name=\"ngModelOptions-directive-getter-setter\" module=\"getterSetterExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ getterSetter: true }\" />\n          </label>\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('getterSetterExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          var _name = 'Brian';\n          $scope.user = {\n            name: function(newName) {\n              // Note that newName can be undefined for two reasons:\n              // 1. Because it is called as a getter and thus called with no arguments\n              // 2. Because the property should actually be set to undefined. This happens e.g. if the\n              //    input is invalid\n              return arguments.length ? (_name = newName) : _name;\n            }\n          };\n        }]);\n    </file>\n  </example>\n */\nvar ngModelOptionsDirective = function() {\n  return {\n    restrict: 'A',\n    controller: ['$scope', '$attrs', function($scope, $attrs) {\n      var that = this;\n      this.$options = copy($scope.$eval($attrs.ngModelOptions));\n      // Allow adding/overriding bound events\n      if (isDefined(this.$options.updateOn)) {\n        this.$options.updateOnDefault = false;\n        // extract \"default\" pseudo-event from list of events that can trigger a model update\n        this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {\n          that.$options.updateOnDefault = true;\n          return ' ';\n        }));\n      } else {\n        this.$options.updateOnDefault = true;\n      }\n    }]\n  };\n};\n\n\n\n// helper methods\nfunction addSetValidityMethod(context) {\n  var ctrl = context.ctrl,\n      $element = context.$element,\n      classCache = {},\n      set = context.set,\n      unset = context.unset,\n      $animate = context.$animate;\n\n  classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));\n\n  ctrl.$setValidity = setValidity;\n\n  function setValidity(validationErrorKey, state, controller) {\n    if (isUndefined(state)) {\n      createAndSet('$pending', validationErrorKey, controller);\n    } else {\n      unsetAndCleanup('$pending', validationErrorKey, controller);\n    }\n    if (!isBoolean(state)) {\n      unset(ctrl.$error, validationErrorKey, controller);\n      unset(ctrl.$$success, validationErrorKey, controller);\n    } else {\n      if (state) {\n        unset(ctrl.$error, validationErrorKey, controller);\n        set(ctrl.$$success, validationErrorKey, controller);\n      } else {\n        set(ctrl.$error, validationErrorKey, controller);\n        unset(ctrl.$$success, validationErrorKey, controller);\n      }\n    }\n    if (ctrl.$pending) {\n      cachedToggleClass(PENDING_CLASS, true);\n      ctrl.$valid = ctrl.$invalid = undefined;\n      toggleValidationCss('', null);\n    } else {\n      cachedToggleClass(PENDING_CLASS, false);\n      ctrl.$valid = isObjectEmpty(ctrl.$error);\n      ctrl.$invalid = !ctrl.$valid;\n      toggleValidationCss('', ctrl.$valid);\n    }\n\n    // re-read the state as the set/unset methods could have\n    // combined state in ctrl.$error[validationError] (used for forms),\n    // where setting/unsetting only increments/decrements the value,\n    // and does not replace it.\n    var combinedState;\n    if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {\n      combinedState = undefined;\n    } else if (ctrl.$error[validationErrorKey]) {\n      combinedState = false;\n    } else if (ctrl.$$success[validationErrorKey]) {\n      combinedState = true;\n    } else {\n      combinedState = null;\n    }\n\n    toggleValidationCss(validationErrorKey, combinedState);\n    ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);\n  }\n\n  function createAndSet(name, value, controller) {\n    if (!ctrl[name]) {\n      ctrl[name] = {};\n    }\n    set(ctrl[name], value, controller);\n  }\n\n  function unsetAndCleanup(name, value, controller) {\n    if (ctrl[name]) {\n      unset(ctrl[name], value, controller);\n    }\n    if (isObjectEmpty(ctrl[name])) {\n      ctrl[name] = undefined;\n    }\n  }\n\n  function cachedToggleClass(className, switchValue) {\n    if (switchValue && !classCache[className]) {\n      $animate.addClass($element, className);\n      classCache[className] = true;\n    } else if (!switchValue && classCache[className]) {\n      $animate.removeClass($element, className);\n      classCache[className] = false;\n    }\n  }\n\n  function toggleValidationCss(validationErrorKey, isValid) {\n    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n\n    cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);\n    cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);\n  }\n}\n\nfunction isObjectEmpty(obj) {\n  if (obj) {\n    for (var prop in obj) {\n      if (obj.hasOwnProperty(prop)) {\n        return false;\n      }\n    }\n  }\n  return true;\n}\n\n/**\n * @ngdoc directive\n * @name ngNonBindable\n * @restrict AC\n * @priority 1000\n *\n * @description\n * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current\n * DOM element. This is useful if the element contains what appears to be Angular directives and\n * bindings but which should be ignored by Angular. This could be the case if you have a site that\n * displays snippets of code, for instance.\n *\n * @element ANY\n *\n * @example\n * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,\n * but the one wrapped in `ngNonBindable` is left alone.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <div>Normal: {{1 + 2}}</div>\n        <div ng-non-bindable>Ignored: {{1 + 2}}</div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-non-bindable', function() {\n         expect(element(by.binding('1 + 2')).getText()).toContain('3');\n         expect(element.all(by.css('div')).last().getText()).toMatch(/1 \\+ 2/);\n       });\n      </file>\n    </example>\n */\nvar ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });\n\n/* global jqLiteRemove */\n\nvar ngOptionsMinErr = minErr('ngOptions');\n\n/**\n * @ngdoc directive\n * @name ngOptions\n * @restrict A\n *\n * @description\n *\n * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`\n * elements for the `<select>` element using the array or object obtained by evaluating the\n * `ngOptions` comprehension expression.\n *\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a\n * similar result. However, `ngOptions` provides some benefits such as reducing memory and\n * increasing speed by not creating a new scope for each repeated instance, as well as providing\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound\n *  to a non-string value. This is because an option element can only be bound to string values at\n * present.\n *\n * When an item in the `<select>` menu is selected, the array element or object property\n * represented by the selected option will be bound to the model identified by the `ngModel`\n * directive.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * ## Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding the select to a model that is an object or a collection.\n *\n * One issue occurs if you want to preselect an option. For example, if you set\n * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,\n * because the objects are not identical. So by default, you should always reference the item in your collection\n * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.\n *\n * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity\n * of the item not by reference, but by the result of the `track by` expression. For example, if your\n * collection items have an id property, you would `track by item.id`.\n *\n * A different issue with objects or collections is that ngModel won't detect if an object property or\n * a collection item changes. For that reason, `ngOptions` additionally watches the model using\n * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.\n * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection\n * has not changed identity, but only a property on the object or an item in the collection changes.\n *\n * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection\n * if the model is an array). This means that changing a property deeper than the first level inside the\n * object/collection will not trigger a re-rendering.\n *\n * ## `select` **`as`**\n *\n * Using `select` **`as`** will bind the result of the `select` expression to the model, but\n * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)\n * or property name (for object data sources) of the value within the collection. If a **`track by`** expression\n * is used, the result of that expression will be set as the value of the `option` and `select` elements.\n *\n *\n * ### `select` **`as`** and **`track by`**\n *\n * <div class=\"alert alert-warning\">\n * Be careful when using `select` **`as`** and **`track by`** in the same expression.\n * </div>\n *\n * Given this array of items on the $scope:\n *\n * ```js\n * $scope.items = [{\n *   id: 1,\n *   label: 'aLabel',\n *   subItem: { name: 'aSubItem' }\n * }, {\n *   id: 2,\n *   label: 'bLabel',\n *   subItem: { name: 'bSubItem' }\n * }];\n * ```\n *\n * This will work:\n *\n * ```html\n * <select ng-options=\"item as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0];\n * ```\n *\n * but this will not work:\n *\n * ```html\n * <select ng-options=\"item.subItem as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0].subItem;\n * ```\n *\n * In both examples, the **`track by`** expression is applied successfully to each `item` in the\n * `items` array. Because the selected option has been set programmatically in the controller, the\n * **`track by`** expression is also applied to the `ngModel` value. In the first example, the\n * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with\n * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**\n * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value\n * is not matched against any `<option>` and the `<select>` appears as having no selected value.\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required The control is considered valid only if value is entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {comprehension_expression=} ngOptions in one of the following forms:\n *\n *   * for array data sources:\n *     * `label` **`for`** `value` **`in`** `array`\n *     * `select` **`as`** `label` **`for`** `value` **`in`** `array`\n *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array`\n *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`\n *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *     * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`\n *        (for including a filter with `track by`)\n *   * for object data sources:\n *     * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`group by`** `group`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`disable when`** `disable`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *\n * Where:\n *\n *   * `array` / `object`: an expression which evaluates to an array / object to iterate over.\n *   * `value`: local variable which will refer to each item in the `array` or each property value\n *      of `object` during iteration.\n *   * `key`: local variable which will refer to a property name in `object` during iteration.\n *   * `label`: The result of this expression will be the label for `<option>` element. The\n *     `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).\n *   * `select`: The result of this expression will be bound to the model of the parent `<select>`\n *      element. If not specified, `select` expression will default to `value`.\n *   * `group`: The result of this expression will be used to group options using the `<optgroup>`\n *      DOM element.\n *   * `disable`: The result of this expression will be used to disable the rendered `<option>`\n *      element. Return `true` to disable.\n *   * `trackexpr`: Used when working with an array of objects. The result of this expression will be\n *      used to identify the objects in the array. The `trackexpr` will most likely refer to the\n *     `value` variable (e.g. `value.propertyName`). With this the selection is preserved\n *      even when the options are recreated (e.g. reloaded from the server).\n *\n * @example\n    <example module=\"selectExample\">\n      <file name=\"index.html\">\n        <script>\n        angular.module('selectExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.colors = [\n              {name:'black', shade:'dark'},\n              {name:'white', shade:'light', notAnOption: true},\n              {name:'red', shade:'dark'},\n              {name:'blue', shade:'dark', notAnOption: true},\n              {name:'yellow', shade:'light', notAnOption: false}\n            ];\n            $scope.myColor = $scope.colors[2]; // red\n          }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          <ul>\n            <li ng-repeat=\"color in colors\">\n              <label>Name: <input ng-model=\"color.name\"></label>\n              <label><input type=\"checkbox\" ng-model=\"color.notAnOption\"> Disabled?</label>\n              <button ng-click=\"colors.splice($index, 1)\" aria-label=\"Remove\">X</button>\n            </li>\n            <li>\n              <button ng-click=\"colors.push({})\">add</button>\n            </li>\n          </ul>\n          <hr/>\n          <label>Color (null not allowed):\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\"></select>\n          </label><br/>\n          <label>Color (null allowed):\n          <span  class=\"nullable\">\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\">\n              <option value=\"\">-- choose color --</option>\n            </select>\n          </span></label><br/>\n\n          <label>Color grouped by shade:\n            <select ng-model=\"myColor\" ng-options=\"color.name group by color.shade for color in colors\">\n            </select>\n          </label><br/>\n\n          <label>Color grouped by shade, with some disabled:\n            <select ng-model=\"myColor\"\n                  ng-options=\"color.name group by color.shade disable when color.notAnOption for color in colors\">\n            </select>\n          </label><br/>\n\n\n\n          Select <button ng-click=\"myColor = { name:'not in list', shade: 'other' }\">bogus</button>.\n          <br/>\n          <hr/>\n          Currently selected: {{ {selected_color:myColor} }}\n          <div style=\"border:solid 1px black; height:20px\"\n               ng-style=\"{'background-color':myColor.name}\">\n          </div>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n         it('should check ng-options', function() {\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');\n           element.all(by.model('myColor')).first().click();\n           element.all(by.css('select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');\n           element(by.css('.nullable select[ng-model=\"myColor\"]')).click();\n           element.all(by.css('.nullable select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');\n         });\n      </file>\n    </example>\n */\n\n// jshint maxlen: false\n//                     //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999\nvar NG_OPTIONS_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+group\\s+by\\s+([\\s\\S]+?))?(?:\\s+disable\\s+when\\s+([\\s\\S]+?))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?$/;\n                        // 1: value expression (valueFn)\n                        // 2: label expression (displayFn)\n                        // 3: group by expression (groupByFn)\n                        // 4: disable when expression (disableWhenFn)\n                        // 5: array item variable name\n                        // 6: object item key variable name\n                        // 7: object item value variable name\n                        // 8: collection expression\n                        // 9: track by expression\n// jshint maxlen: 100\n\n\nvar ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {\n\n  function parseOptionsExpression(optionsExp, selectElement, scope) {\n\n    var match = optionsExp.match(NG_OPTIONS_REGEXP);\n    if (!(match)) {\n      throw ngOptionsMinErr('iexp',\n        \"Expected expression in form of \" +\n        \"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'\" +\n        \" but got '{0}'. Element: {1}\",\n        optionsExp, startingTag(selectElement));\n    }\n\n    // Extract the parts from the ngOptions expression\n\n    // The variable name for the value of the item in the collection\n    var valueName = match[5] || match[7];\n    // The variable name for the key of the item in the collection\n    var keyName = match[6];\n\n    // An expression that generates the viewValue for an option if there is a label expression\n    var selectAs = / as /.test(match[0]) && match[1];\n    // An expression that is used to track the id of each object in the options collection\n    var trackBy = match[9];\n    // An expression that generates the viewValue for an option if there is no label expression\n    var valueFn = $parse(match[2] ? match[1] : valueName);\n    var selectAsFn = selectAs && $parse(selectAs);\n    var viewValueFn = selectAsFn || valueFn;\n    var trackByFn = trackBy && $parse(trackBy);\n\n    // Get the value by which we are going to track the option\n    // if we have a trackFn then use that (passing scope and locals)\n    // otherwise just hash the given viewValue\n    var getTrackByValueFn = trackBy ?\n                              function(value, locals) { return trackByFn(scope, locals); } :\n                              function getHashOfValue(value) { return hashKey(value); };\n    var getTrackByValue = function(value, key) {\n      return getTrackByValueFn(value, getLocals(value, key));\n    };\n\n    var displayFn = $parse(match[2] || match[1]);\n    var groupByFn = $parse(match[3] || '');\n    var disableWhenFn = $parse(match[4] || '');\n    var valuesFn = $parse(match[8]);\n\n    var locals = {};\n    var getLocals = keyName ? function(value, key) {\n      locals[keyName] = key;\n      locals[valueName] = value;\n      return locals;\n    } : function(value) {\n      locals[valueName] = value;\n      return locals;\n    };\n\n\n    function Option(selectValue, viewValue, label, group, disabled) {\n      this.selectValue = selectValue;\n      this.viewValue = viewValue;\n      this.label = label;\n      this.group = group;\n      this.disabled = disabled;\n    }\n\n    function getOptionValuesKeys(optionValues) {\n      var optionValuesKeys;\n\n      if (!keyName && isArrayLike(optionValues)) {\n        optionValuesKeys = optionValues;\n      } else {\n        // if object, extract keys, in enumeration order, unsorted\n        optionValuesKeys = [];\n        for (var itemKey in optionValues) {\n          if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {\n            optionValuesKeys.push(itemKey);\n          }\n        }\n      }\n      return optionValuesKeys;\n    }\n\n    return {\n      trackBy: trackBy,\n      getTrackByValue: getTrackByValue,\n      getWatchables: $parse(valuesFn, function(optionValues) {\n        // Create a collection of things that we would like to watch (watchedArray)\n        // so that they can all be watched using a single $watchCollection\n        // that only runs the handler once if anything changes\n        var watchedArray = [];\n        optionValues = optionValues || [];\n\n        var optionValuesKeys = getOptionValuesKeys(optionValues);\n        var optionValuesLength = optionValuesKeys.length;\n        for (var index = 0; index < optionValuesLength; index++) {\n          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n          var value = optionValues[key];\n\n          var locals = getLocals(value, key);\n          var selectValue = getTrackByValueFn(value, locals);\n          watchedArray.push(selectValue);\n\n          // Only need to watch the displayFn if there is a specific label expression\n          if (match[2] || match[1]) {\n            var label = displayFn(scope, locals);\n            watchedArray.push(label);\n          }\n\n          // Only need to watch the disableWhenFn if there is a specific disable expression\n          if (match[4]) {\n            var disableWhen = disableWhenFn(scope, locals);\n            watchedArray.push(disableWhen);\n          }\n        }\n        return watchedArray;\n      }),\n\n      getOptions: function() {\n\n        var optionItems = [];\n        var selectValueMap = {};\n\n        // The option values were already computed in the `getWatchables` fn,\n        // which must have been called to trigger `getOptions`\n        var optionValues = valuesFn(scope) || [];\n        var optionValuesKeys = getOptionValuesKeys(optionValues);\n        var optionValuesLength = optionValuesKeys.length;\n\n        for (var index = 0; index < optionValuesLength; index++) {\n          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n          var value = optionValues[key];\n          var locals = getLocals(value, key);\n          var viewValue = viewValueFn(scope, locals);\n          var selectValue = getTrackByValueFn(viewValue, locals);\n          var label = displayFn(scope, locals);\n          var group = groupByFn(scope, locals);\n          var disabled = disableWhenFn(scope, locals);\n          var optionItem = new Option(selectValue, viewValue, label, group, disabled);\n\n          optionItems.push(optionItem);\n          selectValueMap[selectValue] = optionItem;\n        }\n\n        return {\n          items: optionItems,\n          selectValueMap: selectValueMap,\n          getOptionFromViewValue: function(value) {\n            return selectValueMap[getTrackByValue(value)];\n          },\n          getViewValueFromOption: function(option) {\n            // If the viewValue could be an object that may be mutated by the application,\n            // we need to make a copy and not return the reference to the value on the option.\n            return trackBy ? angular.copy(option.viewValue) : option.viewValue;\n          }\n        };\n      }\n    };\n  }\n\n\n  // we can't just jqLite('<option>') since jqLite is not smart enough\n  // to create it in <select> and IE barfs otherwise.\n  var optionTemplate = document.createElement('option'),\n      optGroupTemplate = document.createElement('optgroup');\n\n    function ngOptionsPostLink(scope, selectElement, attr, ctrls) {\n\n      var selectCtrl = ctrls[0];\n      var ngModelCtrl = ctrls[1];\n      var multiple = attr.multiple;\n\n      // The emptyOption allows the application developer to provide their own custom \"empty\"\n      // option when the viewValue does not match any of the option values.\n      var emptyOption;\n      for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {\n        if (children[i].value === '') {\n          emptyOption = children.eq(i);\n          break;\n        }\n      }\n\n      var providedEmptyOption = !!emptyOption;\n\n      var unknownOption = jqLite(optionTemplate.cloneNode(false));\n      unknownOption.val('?');\n\n      var options;\n      var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);\n\n\n      var renderEmptyOption = function() {\n        if (!providedEmptyOption) {\n          selectElement.prepend(emptyOption);\n        }\n        selectElement.val('');\n        emptyOption.prop('selected', true); // needed for IE\n        emptyOption.attr('selected', true);\n      };\n\n      var removeEmptyOption = function() {\n        if (!providedEmptyOption) {\n          emptyOption.remove();\n        }\n      };\n\n\n      var renderUnknownOption = function() {\n        selectElement.prepend(unknownOption);\n        selectElement.val('?');\n        unknownOption.prop('selected', true); // needed for IE\n        unknownOption.attr('selected', true);\n      };\n\n      var removeUnknownOption = function() {\n        unknownOption.remove();\n      };\n\n      // Update the controller methods for multiple selectable options\n      if (!multiple) {\n\n        selectCtrl.writeValue = function writeNgOptionsValue(value) {\n          var option = options.getOptionFromViewValue(value);\n\n          if (option && !option.disabled) {\n            // Don't update the option when it is already selected.\n            // For example, the browser will select the first option by default. In that case,\n            // most properties are set automatically - except the `selected` attribute, which we\n            // set always\n\n            if (selectElement[0].value !== option.selectValue) {\n              removeUnknownOption();\n              removeEmptyOption();\n\n              selectElement[0].value = option.selectValue;\n              option.element.selected = true;\n            }\n\n            option.element.setAttribute('selected', 'selected');\n          } else {\n            if (value === null || providedEmptyOption) {\n              removeUnknownOption();\n              renderEmptyOption();\n            } else {\n              removeEmptyOption();\n              renderUnknownOption();\n            }\n          }\n        };\n\n        selectCtrl.readValue = function readNgOptionsValue() {\n\n          var selectedOption = options.selectValueMap[selectElement.val()];\n\n          if (selectedOption && !selectedOption.disabled) {\n            removeEmptyOption();\n            removeUnknownOption();\n            return options.getViewValueFromOption(selectedOption);\n          }\n          return null;\n        };\n\n        // If we are using `track by` then we must watch the tracked value on the model\n        // since ngModel only watches for object identity change\n        if (ngOptions.trackBy) {\n          scope.$watch(\n            function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },\n            function() { ngModelCtrl.$render(); }\n          );\n        }\n\n      } else {\n\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n\n\n        selectCtrl.writeValue = function writeNgOptionsMultiple(value) {\n          options.items.forEach(function(option) {\n            option.element.selected = false;\n          });\n\n          if (value) {\n            value.forEach(function(item) {\n              var option = options.getOptionFromViewValue(item);\n              if (option && !option.disabled) option.element.selected = true;\n            });\n          }\n        };\n\n\n        selectCtrl.readValue = function readNgOptionsMultiple() {\n          var selectedValues = selectElement.val() || [],\n              selections = [];\n\n          forEach(selectedValues, function(value) {\n            var option = options.selectValueMap[value];\n            if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));\n          });\n\n          return selections;\n        };\n\n        // If we are using `track by` then we must watch these tracked values on the model\n        // since ngModel only watches for object identity change\n        if (ngOptions.trackBy) {\n\n          scope.$watchCollection(function() {\n            if (isArray(ngModelCtrl.$viewValue)) {\n              return ngModelCtrl.$viewValue.map(function(value) {\n                return ngOptions.getTrackByValue(value);\n              });\n            }\n          }, function() {\n            ngModelCtrl.$render();\n          });\n\n        }\n      }\n\n\n      if (providedEmptyOption) {\n\n        // we need to remove it before calling selectElement.empty() because otherwise IE will\n        // remove the label from the element. wtf?\n        emptyOption.remove();\n\n        // compile the element since there might be bindings in it\n        $compile(emptyOption)(scope);\n\n        // remove the class, which is added automatically because we recompile the element and it\n        // becomes the compilation root\n        emptyOption.removeClass('ng-scope');\n      } else {\n        emptyOption = jqLite(optionTemplate.cloneNode(false));\n      }\n\n      // We need to do this here to ensure that the options object is defined\n      // when we first hit it in writeNgOptionsValue\n      updateOptions();\n\n      // We will re-render the option elements if the option values or labels change\n      scope.$watchCollection(ngOptions.getWatchables, updateOptions);\n\n      // ------------------------------------------------------------------ //\n\n\n      function updateOptionElement(option, element) {\n        option.element = element;\n        element.disabled = option.disabled;\n        // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive\n        // selects in certain circumstances when multiple selects are next to each other and display\n        // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].\n        // See https://github.com/angular/angular.js/issues/11314 for more info.\n        // This is unfortunately untestable with unit / e2e tests\n        if (option.label !== element.label) {\n          element.label = option.label;\n          element.textContent = option.label;\n        }\n        if (option.value !== element.value) element.value = option.selectValue;\n      }\n\n      function addOrReuseElement(parent, current, type, templateElement) {\n        var element;\n        // Check whether we can reuse the next element\n        if (current && lowercase(current.nodeName) === type) {\n          // The next element is the right type so reuse it\n          element = current;\n        } else {\n          // The next element is not the right type so create a new one\n          element = templateElement.cloneNode(false);\n          if (!current) {\n            // There are no more elements so just append it to the select\n            parent.appendChild(element);\n          } else {\n            // The next element is not a group so insert the new one\n            parent.insertBefore(element, current);\n          }\n        }\n        return element;\n      }\n\n\n      function removeExcessElements(current) {\n        var next;\n        while (current) {\n          next = current.nextSibling;\n          jqLiteRemove(current);\n          current = next;\n        }\n      }\n\n\n      function skipEmptyAndUnknownOptions(current) {\n        var emptyOption_ = emptyOption && emptyOption[0];\n        var unknownOption_ = unknownOption && unknownOption[0];\n\n        // We cannot rely on the extracted empty option being the same as the compiled empty option,\n        // because the compiled empty option might have been replaced by a comment because\n        // it had an \"element\" transclusion directive on it (such as ngIf)\n        if (emptyOption_ || unknownOption_) {\n          while (current &&\n                (current === emptyOption_ ||\n                current === unknownOption_ ||\n                current.nodeType === NODE_TYPE_COMMENT ||\n                (nodeName_(current) === 'option' && current.value === ''))) {\n            current = current.nextSibling;\n          }\n        }\n        return current;\n      }\n\n\n      function updateOptions() {\n\n        var previousValue = options && selectCtrl.readValue();\n\n        options = ngOptions.getOptions();\n\n        var groupMap = {};\n        var currentElement = selectElement[0].firstChild;\n\n        // Ensure that the empty option is always there if it was explicitly provided\n        if (providedEmptyOption) {\n          selectElement.prepend(emptyOption);\n        }\n\n        currentElement = skipEmptyAndUnknownOptions(currentElement);\n\n        options.items.forEach(function updateOption(option) {\n          var group;\n          var groupElement;\n          var optionElement;\n\n          if (isDefined(option.group)) {\n\n            // This option is to live in a group\n            // See if we have already created this group\n            group = groupMap[option.group];\n\n            if (!group) {\n\n              // We have not already created this group\n              groupElement = addOrReuseElement(selectElement[0],\n                                               currentElement,\n                                               'optgroup',\n                                               optGroupTemplate);\n              // Move to the next element\n              currentElement = groupElement.nextSibling;\n\n              // Update the label on the group element\n              groupElement.label = option.group;\n\n              // Store it for use later\n              group = groupMap[option.group] = {\n                groupElement: groupElement,\n                currentOptionElement: groupElement.firstChild\n              };\n\n            }\n\n            // So now we have a group for this option we add the option to the group\n            optionElement = addOrReuseElement(group.groupElement,\n                                              group.currentOptionElement,\n                                              'option',\n                                              optionTemplate);\n            updateOptionElement(option, optionElement);\n            // Move to the next element\n            group.currentOptionElement = optionElement.nextSibling;\n\n          } else {\n\n            // This option is not in a group\n            optionElement = addOrReuseElement(selectElement[0],\n                                              currentElement,\n                                              'option',\n                                              optionTemplate);\n            updateOptionElement(option, optionElement);\n            // Move to the next element\n            currentElement = optionElement.nextSibling;\n          }\n        });\n\n\n        // Now remove all excess options and group\n        Object.keys(groupMap).forEach(function(key) {\n          removeExcessElements(groupMap[key].currentOptionElement);\n        });\n        removeExcessElements(currentElement);\n\n        ngModelCtrl.$render();\n\n        // Check to see if the value has changed due to the update to the options\n        if (!ngModelCtrl.$isEmpty(previousValue)) {\n          var nextValue = selectCtrl.readValue();\n          var isNotPrimitive = ngOptions.trackBy || multiple;\n          if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {\n            ngModelCtrl.$setViewValue(nextValue);\n            ngModelCtrl.$render();\n          }\n        }\n\n      }\n  }\n\n  return {\n    restrict: 'A',\n    terminal: true,\n    require: ['select', 'ngModel'],\n    link: {\n      pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {\n        // Deactivate the SelectController.register method to prevent\n        // option directives from accidentally registering themselves\n        // (and unwanted $destroy handlers etc.)\n        ctrls[0].registerOption = noop;\n      },\n      post: ngOptionsPostLink\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngPluralize\n * @restrict EA\n *\n * @description\n * `ngPluralize` is a directive that displays messages according to en-US localization rules.\n * These rules are bundled with angular.js, but can be overridden\n * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive\n * by specifying the mappings between\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * and the strings to be displayed.\n *\n * # Plural categories and explicit number rules\n * There are two\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * in Angular's default en-US locale: \"one\" and \"other\".\n *\n * While a plural category may match many numbers (for example, in en-US locale, \"other\" can match\n * any number that is not 1), an explicit number rule can only match one number. For example, the\n * explicit number rule for \"3\" matches the number 3. There are examples of plural categories\n * and explicit number rules throughout the rest of this documentation.\n *\n * # Configuring ngPluralize\n * You configure ngPluralize by providing 2 attributes: `count` and `when`.\n * You can also provide an optional attribute, `offset`.\n *\n * The value of the `count` attribute can be either a string or an {@link guide/expression\n * Angular expression}; these are evaluated on the current scope for its bound value.\n *\n * The `when` attribute specifies the mappings between plural categories and the actual\n * string to be displayed. The value of the attribute should be a JSON object.\n *\n * The following example shows how to configure ngPluralize:\n *\n * ```html\n * <ng-pluralize count=\"personCount\"\n                 when=\"{'0': 'Nobody is viewing.',\n *                      'one': '1 person is viewing.',\n *                      'other': '{} people are viewing.'}\">\n * </ng-pluralize>\n *```\n *\n * In the example, `\"0: Nobody is viewing.\"` is an explicit number rule. If you did not\n * specify this rule, 0 would be matched to the \"other\" category and \"0 people are viewing\"\n * would be shown instead of \"Nobody is viewing\". You can specify an explicit number rule for\n * other numbers, for example 12, so that instead of showing \"12 people are viewing\", you can\n * show \"a dozen people are viewing\".\n *\n * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted\n * into pluralized strings. In the previous example, Angular will replace `{}` with\n * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder\n * for <span ng-non-bindable>{{numberExpression}}</span>.\n *\n * If no rule is defined for a category, then an empty string is displayed and a warning is generated.\n * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.\n *\n * # Configuring ngPluralize with offset\n * The `offset` attribute allows further customization of pluralized text, which can result in\n * a better user experience. For example, instead of the message \"4 people are viewing this document\",\n * you might display \"John, Kate and 2 others are viewing this document\".\n * The offset attribute allows you to offset a number by any desired value.\n * Let's take a look at an example:\n *\n * ```html\n * <ng-pluralize count=\"personCount\" offset=2\n *               when=\"{'0': 'Nobody is viewing.',\n *                      '1': '{{person1}} is viewing.',\n *                      '2': '{{person1}} and {{person2}} are viewing.',\n *                      'one': '{{person1}}, {{person2}} and one other person are viewing.',\n *                      'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n * </ng-pluralize>\n * ```\n *\n * Notice that we are still using two plural categories(one, other), but we added\n * three explicit number rules 0, 1 and 2.\n * When one person, perhaps John, views the document, \"John is viewing\" will be shown.\n * When three people view the document, no explicit number rule is found, so\n * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.\n * In this case, plural category 'one' is matched and \"John, Mary and one other person are viewing\"\n * is shown.\n *\n * Note that when you specify offsets, you must provide explicit number rules for\n * numbers from 0 up to and including the offset. If you use an offset of 3, for example,\n * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for\n * plural categories \"one\" and \"other\".\n *\n * @param {string|expression} count The variable to be bound to.\n * @param {string} when The mapping between plural category to its corresponding strings.\n * @param {number=} offset Offset to deduct from the total number.\n *\n * @example\n    <example module=\"pluralizeExample\">\n      <file name=\"index.html\">\n        <script>\n          angular.module('pluralizeExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.person1 = 'Igor';\n              $scope.person2 = 'Misko';\n              $scope.personCount = 1;\n            }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          <label>Person 1:<input type=\"text\" ng-model=\"person1\" value=\"Igor\" /></label><br/>\n          <label>Person 2:<input type=\"text\" ng-model=\"person2\" value=\"Misko\" /></label><br/>\n          <label>Number of People:<input type=\"text\" ng-model=\"personCount\" value=\"1\" /></label><br/>\n\n          <!--- Example with simple pluralization rules for en locale --->\n          Without Offset:\n          <ng-pluralize count=\"personCount\"\n                        when=\"{'0': 'Nobody is viewing.',\n                               'one': '1 person is viewing.',\n                               'other': '{} people are viewing.'}\">\n          </ng-pluralize><br>\n\n          <!--- Example with offset --->\n          With Offset(2):\n          <ng-pluralize count=\"personCount\" offset=2\n                        when=\"{'0': 'Nobody is viewing.',\n                               '1': '{{person1}} is viewing.',\n                               '2': '{{person1}} and {{person2}} are viewing.',\n                               'one': '{{person1}}, {{person2}} and one other person are viewing.',\n                               'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n          </ng-pluralize>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should show correct pluralized string', function() {\n          var withoutOffset = element.all(by.css('ng-pluralize')).get(0);\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var countInput = element(by.model('personCount'));\n\n          expect(withoutOffset.getText()).toEqual('1 person is viewing.');\n          expect(withOffset.getText()).toEqual('Igor is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('0');\n\n          expect(withoutOffset.getText()).toEqual('Nobody is viewing.');\n          expect(withOffset.getText()).toEqual('Nobody is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('2');\n\n          expect(withoutOffset.getText()).toEqual('2 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('3');\n\n          expect(withoutOffset.getText()).toEqual('3 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('4');\n\n          expect(withoutOffset.getText()).toEqual('4 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');\n        });\n        it('should show data-bound names', function() {\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var personCount = element(by.model('personCount'));\n          var person1 = element(by.model('person1'));\n          var person2 = element(by.model('person2'));\n          personCount.clear();\n          personCount.sendKeys('4');\n          person1.clear();\n          person1.sendKeys('Di');\n          person2.clear();\n          person2.sendKeys('Vojta');\n          expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');\n        });\n      </file>\n    </example>\n */\nvar ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {\n  var BRACE = /{}/g,\n      IS_WHEN = /^when(Minus)?(.+)$/;\n\n  return {\n    link: function(scope, element, attr) {\n      var numberExp = attr.count,\n          whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs\n          offset = attr.offset || 0,\n          whens = scope.$eval(whenExp) || {},\n          whensExpFns = {},\n          startSymbol = $interpolate.startSymbol(),\n          endSymbol = $interpolate.endSymbol(),\n          braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,\n          watchRemover = angular.noop,\n          lastCount;\n\n      forEach(attr, function(expression, attributeName) {\n        var tmpMatch = IS_WHEN.exec(attributeName);\n        if (tmpMatch) {\n          var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);\n          whens[whenKey] = element.attr(attr.$attr[attributeName]);\n        }\n      });\n      forEach(whens, function(expression, key) {\n        whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));\n\n      });\n\n      scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {\n        var count = parseFloat(newVal);\n        var countIsNaN = isNaN(count);\n\n        if (!countIsNaN && !(count in whens)) {\n          // If an explicit number rule such as 1, 2, 3... is defined, just use it.\n          // Otherwise, check it against pluralization rules in $locale service.\n          count = $locale.pluralCat(count - offset);\n        }\n\n        // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.\n        // In JS `NaN !== NaN`, so we have to explicitly check.\n        if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {\n          watchRemover();\n          var whenExpFn = whensExpFns[count];\n          if (isUndefined(whenExpFn)) {\n            if (newVal != null) {\n              $log.debug(\"ngPluralize: no rule defined for '\" + count + \"' in \" + whenExp);\n            }\n            watchRemover = noop;\n            updateElementText();\n          } else {\n            watchRemover = scope.$watch(whenExpFn, updateElementText);\n          }\n          lastCount = count;\n        }\n      });\n\n      function updateElementText(newText) {\n        element.text(newText || '');\n      }\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngRepeat\n * @multiElement\n *\n * @description\n * The `ngRepeat` directive instantiates a template once per item from a collection. Each template\n * instance gets its own scope, where the given loop variable is set to the current collection item,\n * and `$index` is set to the item index or key.\n *\n * Special properties are exposed on the local scope of each template instance, including:\n *\n * | Variable  | Type            | Details                                                                     |\n * |-----------|-----------------|-----------------------------------------------------------------------------|\n * | `$index`  | {@type number}  | iterator offset of the repeated element (0..length-1)                       |\n * | `$first`  | {@type boolean} | true if the repeated element is first in the iterator.                      |\n * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |\n * | `$last`   | {@type boolean} | true if the repeated element is last in the iterator.                       |\n * | `$even`   | {@type boolean} | true if the iterator position `$index` is even (otherwise false).           |\n * | `$odd`    | {@type boolean} | true if the iterator position `$index` is odd (otherwise false).            |\n *\n * <div class=\"alert alert-info\">\n *   Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.\n *   This may be useful when, for instance, nesting ngRepeats.\n * </div>\n *\n *\n * # Iterating over object properties\n *\n * It is possible to get `ngRepeat` to iterate over the properties of an object using the following\n * syntax:\n *\n * ```js\n * <div ng-repeat=\"(key, value) in myObj\"> ... </div>\n * ```\n *\n * However, there are a limitations compared to array iteration:\n *\n * - The JavaScript specification does not define the order of keys\n *   returned for an object, so Angular relies on the order returned by the browser\n *   when running `for key in myObj`. Browsers generally follow the strategy of providing\n *   keys in the order in which they were defined, although there are exceptions when keys are deleted\n *   and reinstated. See the\n *   [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).\n *\n * - `ngRepeat` will silently *ignore* object keys starting with `$`, because\n *   it's a prefix used by Angular for public (`$`) and private (`$$`) properties.\n *\n * - The built-in filters {@link ng.orderBy orderBy} and {@link ng.filter filter} do not work with\n *   objects, and will throw if used with one.\n *\n * If you are hitting any of these limitations, the recommended workaround is to convert your object into an array\n * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could\n * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)\n * or implement a `$watch` on the object yourself.\n *\n *\n * # Tracking and Duplicates\n *\n * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in\n * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:\n *\n * * When an item is added, a new instance of the template is added to the DOM.\n * * When an item is removed, its template instance is removed from the DOM.\n * * When items are reordered, their respective templates are reordered in the DOM.\n *\n * To minimize creation of DOM elements, `ngRepeat` uses a function\n * to \"keep track\" of all items in the collection and their corresponding DOM elements.\n * For example, if an item is added to the collection, ngRepeat will know that all other items\n * already have DOM elements, and will not re-render them.\n *\n * The default tracking function (which tracks items by their identity) does not allow\n * duplicate items in arrays. This is because when there are duplicates, it is not possible\n * to maintain a one-to-one mapping between collection items and DOM elements.\n *\n * If you do need to repeat duplicate items, you can substitute the default tracking behavior\n * with your own using the `track by` expression.\n *\n * For example, you may track items by the index of each item in the collection, using the\n * special scope property `$index`:\n * ```html\n *    <div ng-repeat=\"n in [42, 42, 43, 43] track by $index\">\n *      {{n}}\n *    </div>\n * ```\n *\n * You may also use arbitrary expressions in `track by`, including references to custom functions\n * on the scope:\n * ```html\n *    <div ng-repeat=\"n in [42, 42, 43, 43] track by myTrackingFunction(n)\">\n *      {{n}}\n *    </div>\n * ```\n *\n * <div class=\"alert alert-success\">\n * If you are working with objects that have an identifier property, you should track\n * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`\n * will not have to rebuild the DOM elements for items it has already rendered, even if the\n * JavaScript objects in the collection have been substituted for new ones. For large collections,\n * this significantly improves rendering performance. If you don't have a unique identifier,\n * `track by $index` can also provide a performance boost.\n * </div>\n * ```html\n *    <div ng-repeat=\"model in collection track by model.id\">\n *      {{model.name}}\n *    </div>\n * ```\n *\n * When no `track by` expression is provided, it is equivalent to tracking by the built-in\n * `$id` function, which tracks items by their identity:\n * ```html\n *    <div ng-repeat=\"obj in collection track by $id(obj)\">\n *      {{obj.prop}}\n *    </div>\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `track by` must always be the last expression:\n * </div>\n * ```\n * <div ng-repeat=\"model in collection | orderBy: 'id' as filtered_result track by model.id\">\n *     {{model.name}}\n * </div>\n * ```\n *\n * # Special repeat start and end points\n * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending\n * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.\n * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)\n * up to and including the ending HTML tag where **ng-repeat-end** is placed.\n *\n * The example below makes use of this feature:\n * ```html\n *   <header ng-repeat-start=\"item in items\">\n *     Header {{ item }}\n *   </header>\n *   <div class=\"body\">\n *     Body {{ item }}\n *   </div>\n *   <footer ng-repeat-end>\n *     Footer {{ item }}\n *   </footer>\n * ```\n *\n * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:\n * ```html\n *   <header>\n *     Header A\n *   </header>\n *   <div class=\"body\">\n *     Body A\n *   </div>\n *   <footer>\n *     Footer A\n *   </footer>\n *   <header>\n *     Header B\n *   </header>\n *   <div class=\"body\">\n *     Body B\n *   </div>\n *   <footer>\n *     Footer B\n *   </footer>\n * ```\n *\n * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such\n * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter} | when a new item is added to the list or when an item is revealed after a filter |\n * | {@link ng.$animate#leave leave} | when an item is removed from the list or when an item is filtered out |\n * | {@link ng.$animate#move move } | when an adjacent item is filtered out causing a reorder or when the item contents are reordered |\n *\n * See the example below for defining CSS animations with ngRepeat.\n *\n * @element ANY\n * @scope\n * @priority 1000\n * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These\n *   formats are currently supported:\n *\n *   * `variable in expression` – where variable is the user defined loop variable and `expression`\n *     is a scope expression giving the collection to enumerate.\n *\n *     For example: `album in artist.albums`.\n *\n *   * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,\n *     and `expression` is the scope expression giving the collection to enumerate.\n *\n *     For example: `(name, age) in {'adam':10, 'amalie':12}`.\n *\n *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking expression\n *     which can be used to associate the objects in the collection with the DOM elements. If no tracking expression\n *     is specified, ng-repeat associates elements by identity. It is an error to have\n *     more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are\n *     mapped to the same DOM element, which is not possible.)\n *\n *     Note that the tracking expression must come last, after any filters, and the alias expression.\n *\n *     For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements\n *     will be associated by item identity in the array.\n *\n *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n *     element in the same way in the DOM.\n *\n *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n *     property is same.\n *\n *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n *     to items in conjunction with a tracking expression.\n *\n *   * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the\n *     intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message\n *     when a filter is active on the repeater, but the filtered result set is empty.\n *\n *     For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after\n *     the items have been processed through the filter.\n *\n *     Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end\n *     (and not as operator, inside an expression).\n *\n *     For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .\n *\n * @example\n * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed\n * results by name. New (entering) and removed (leaving) items are animated.\n  <example module=\"ngRepeat\" name=\"ngRepeat\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"repeatController\">\n        I have {{friends.length}} friends. They are:\n        <input type=\"search\" ng-model=\"q\" placeholder=\"filter friends...\" aria-label=\"filter friends\" />\n        <ul class=\"example-animate-container\">\n          <li class=\"animate-repeat\" ng-repeat=\"friend in friends | filter:q as results\">\n            [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.\n          </li>\n          <li class=\"animate-repeat\" ng-if=\"results.length == 0\">\n            <strong>No results found...</strong>\n          </li>\n        </ul>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('ngRepeat', ['ngAnimate']).controller('repeatController', function($scope) {\n        $scope.friends = [\n          {name:'John', age:25, gender:'boy'},\n          {name:'Jessie', age:30, gender:'girl'},\n          {name:'Johanna', age:28, gender:'girl'},\n          {name:'Joy', age:15, gender:'girl'},\n          {name:'Mary', age:28, gender:'girl'},\n          {name:'Peter', age:95, gender:'boy'},\n          {name:'Sebastian', age:50, gender:'boy'},\n          {name:'Erika', age:27, gender:'girl'},\n          {name:'Patrick', age:40, gender:'boy'},\n          {name:'Samantha', age:60, gender:'girl'}\n        ];\n      });\n    </file>\n    <file name=\"animations.css\">\n      .example-animate-container {\n        background:white;\n        border:1px solid black;\n        list-style:none;\n        margin:0;\n        padding:0 10px;\n      }\n\n      .animate-repeat {\n        line-height:30px;\n        list-style:none;\n        box-sizing:border-box;\n      }\n\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter,\n      .animate-repeat.ng-leave {\n        transition:all linear 0.5s;\n      }\n\n      .animate-repeat.ng-leave.ng-leave-active,\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter {\n        opacity:0;\n        max-height:0;\n      }\n\n      .animate-repeat.ng-leave,\n      .animate-repeat.ng-move.ng-move-active,\n      .animate-repeat.ng-enter.ng-enter-active {\n        opacity:1;\n        max-height:30px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var friends = element.all(by.repeater('friend in friends'));\n\n      it('should render initial data set', function() {\n        expect(friends.count()).toBe(10);\n        expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');\n        expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');\n        expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');\n        expect(element(by.binding('friends.length')).getText())\n            .toMatch(\"I have 10 friends. They are:\");\n      });\n\n       it('should update repeater when filter predicate changes', function() {\n         expect(friends.count()).toBe(10);\n\n         element(by.model('q')).sendKeys('ma');\n\n         expect(friends.count()).toBe(2);\n         expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');\n         expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');\n       });\n      </file>\n    </example>\n */\nvar ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $animate, $compile) {\n  var NG_REMOVED = '$$NG_REMOVED';\n  var ngRepeatMinErr = minErr('ngRepeat');\n\n  var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {\n    // TODO(perf): generate setters to shave off ~40ms or 1-1.5%\n    scope[valueIdentifier] = value;\n    if (keyIdentifier) scope[keyIdentifier] = key;\n    scope.$index = index;\n    scope.$first = (index === 0);\n    scope.$last = (index === (arrayLength - 1));\n    scope.$middle = !(scope.$first || scope.$last);\n    // jshint bitwise: false\n    scope.$odd = !(scope.$even = (index&1) === 0);\n    // jshint bitwise: true\n  };\n\n  var getBlockStart = function(block) {\n    return block.clone[0];\n  };\n\n  var getBlockEnd = function(block) {\n    return block.clone[block.clone.length - 1];\n  };\n\n\n  return {\n    restrict: 'A',\n    multiElement: true,\n    transclude: 'element',\n    priority: 1000,\n    terminal: true,\n    $$tlb: true,\n    compile: function ngRepeatCompile($element, $attr) {\n      var expression = $attr.ngRepeat;\n      var ngRepeatEndComment = $compile.$$createComment('end ngRepeat', expression);\n\n      var match = expression.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n\n      if (!match) {\n        throw ngRepeatMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n            expression);\n      }\n\n      var lhs = match[1];\n      var rhs = match[2];\n      var aliasAs = match[3];\n      var trackByExp = match[4];\n\n      match = lhs.match(/^(?:(\\s*[\\$\\w]+)|\\(\\s*([\\$\\w]+)\\s*,\\s*([\\$\\w]+)\\s*\\))$/);\n\n      if (!match) {\n        throw ngRepeatMinErr('iidexp', \"'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.\",\n            lhs);\n      }\n      var valueIdentifier = match[3] || match[1];\n      var keyIdentifier = match[2];\n\n      if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||\n          /^(null|undefined|this|\\$index|\\$first|\\$middle|\\$last|\\$even|\\$odd|\\$parent|\\$root|\\$id)$/.test(aliasAs))) {\n        throw ngRepeatMinErr('badident', \"alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.\",\n          aliasAs);\n      }\n\n      var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;\n      var hashFnLocals = {$id: hashKey};\n\n      if (trackByExp) {\n        trackByExpGetter = $parse(trackByExp);\n      } else {\n        trackByIdArrayFn = function(key, value) {\n          return hashKey(value);\n        };\n        trackByIdObjFn = function(key) {\n          return key;\n        };\n      }\n\n      return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {\n\n        if (trackByExpGetter) {\n          trackByIdExpFn = function(key, value, index) {\n            // assign key, value, and $index to the locals so that they can be used in hash functions\n            if (keyIdentifier) hashFnLocals[keyIdentifier] = key;\n            hashFnLocals[valueIdentifier] = value;\n            hashFnLocals.$index = index;\n            return trackByExpGetter($scope, hashFnLocals);\n          };\n        }\n\n        // Store a list of elements from previous run. This is a hash where key is the item from the\n        // iterator, and the value is objects with following properties.\n        //   - scope: bound scope\n        //   - element: previous element.\n        //   - index: position\n        //\n        // We are using no-proto object so that we don't need to guard against inherited props via\n        // hasOwnProperty.\n        var lastBlockMap = createMap();\n\n        //watch props\n        $scope.$watchCollection(rhs, function ngRepeatAction(collection) {\n          var index, length,\n              previousNode = $element[0],     // node that cloned nodes should be inserted after\n                                              // initialized to the comment node anchor\n              nextNode,\n              // Same as lastBlockMap but it has the current state. It will become the\n              // lastBlockMap on the next iteration.\n              nextBlockMap = createMap(),\n              collectionLength,\n              key, value, // key/value of iteration\n              trackById,\n              trackByIdFn,\n              collectionKeys,\n              block,       // last object information {scope, element, id}\n              nextBlockOrder,\n              elementsToRemove;\n\n          if (aliasAs) {\n            $scope[aliasAs] = collection;\n          }\n\n          if (isArrayLike(collection)) {\n            collectionKeys = collection;\n            trackByIdFn = trackByIdExpFn || trackByIdArrayFn;\n          } else {\n            trackByIdFn = trackByIdExpFn || trackByIdObjFn;\n            // if object, extract keys, in enumeration order, unsorted\n            collectionKeys = [];\n            for (var itemKey in collection) {\n              if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {\n                collectionKeys.push(itemKey);\n              }\n            }\n          }\n\n          collectionLength = collectionKeys.length;\n          nextBlockOrder = new Array(collectionLength);\n\n          // locate existing items\n          for (index = 0; index < collectionLength; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            trackById = trackByIdFn(key, value, index);\n            if (lastBlockMap[trackById]) {\n              // found previously seen block\n              block = lastBlockMap[trackById];\n              delete lastBlockMap[trackById];\n              nextBlockMap[trackById] = block;\n              nextBlockOrder[index] = block;\n            } else if (nextBlockMap[trackById]) {\n              // if collision detected. restore lastBlockMap and throw an error\n              forEach(nextBlockOrder, function(block) {\n                if (block && block.scope) lastBlockMap[block.id] = block;\n              });\n              throw ngRepeatMinErr('dupes',\n                  \"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}\",\n                  expression, trackById, value);\n            } else {\n              // new never before seen block\n              nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};\n              nextBlockMap[trackById] = true;\n            }\n          }\n\n          // remove leftover items\n          for (var blockKey in lastBlockMap) {\n            block = lastBlockMap[blockKey];\n            elementsToRemove = getBlockNodes(block.clone);\n            $animate.leave(elementsToRemove);\n            if (elementsToRemove[0].parentNode) {\n              // if the element was not removed yet because of pending animation, mark it as deleted\n              // so that we can ignore it later\n              for (index = 0, length = elementsToRemove.length; index < length; index++) {\n                elementsToRemove[index][NG_REMOVED] = true;\n              }\n            }\n            block.scope.$destroy();\n          }\n\n          // we are not using forEach for perf reasons (trying to avoid #call)\n          for (index = 0; index < collectionLength; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            block = nextBlockOrder[index];\n\n            if (block.scope) {\n              // if we have already seen this object, then we need to reuse the\n              // associated scope/element\n\n              nextNode = previousNode;\n\n              // skip nodes that are already pending removal via leave animation\n              do {\n                nextNode = nextNode.nextSibling;\n              } while (nextNode && nextNode[NG_REMOVED]);\n\n              if (getBlockStart(block) != nextNode) {\n                // existing item which got moved\n                $animate.move(getBlockNodes(block.clone), null, previousNode);\n              }\n              previousNode = getBlockEnd(block);\n              updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n            } else {\n              // new item which we don't know about\n              $transclude(function ngRepeatTransclude(clone, scope) {\n                block.scope = scope;\n                // http://jsperf.com/clone-vs-createcomment\n                var endNode = ngRepeatEndComment.cloneNode(false);\n                clone[clone.length++] = endNode;\n\n                $animate.enter(clone, null, previousNode);\n                previousNode = endNode;\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block.clone = clone;\n                nextBlockMap[block.id] = block;\n                updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n              });\n            }\n          }\n          lastBlockMap = nextBlockMap;\n        });\n      };\n    }\n  };\n}];\n\nvar NG_HIDE_CLASS = 'ng-hide';\nvar NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';\n/**\n * @ngdoc directive\n * @name ngShow\n * @multiElement\n *\n * @description\n * The `ngShow` directive shows or hides the given HTML element based on the expression\n * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding\n * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is visible) -->\n * <div ng-show=\"myValue\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is hidden) -->\n * <div ng-show=\"myValue\" class=\"ng-hide\"></div>\n * ```\n *\n * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope\n * with extra animation classes that can be added.\n *\n * ```css\n * .ng-hide:not(.ng-hide-animate) {\n *   /&#42; this is just another form of hiding an element &#42;/\n *   display: block!important;\n *   position: absolute;\n *   top: -9999px;\n *   left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngShow`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass except that\n * you must also include the !important flag to override the display property\n * so that you can perform an animation when the element is hidden during the time of the animation.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   /&#42; this is required as of 1.3x to properly\n *      apply all styling in a show/hide animation &#42;/\n *   transition: 0s linear all;\n * }\n *\n * .my-element.ng-hide-add-active,\n * .my-element.ng-hide-remove-active {\n *   /&#42; the transition is defined in the active class &#42;/\n *   transition: 1s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden |\n * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngShow` expression evaluates to a truthy value and just before contents are set to visible |\n *\n * @element ANY\n * @param {expression} ngShow If the {@link guide/expression expression} is truthy\n *     then the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngHide\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-show\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-show\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-show {\n        line-height: 20px;\n        opacity: 1;\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n\n      .animate-show.ng-hide-add, .animate-show.ng-hide-remove {\n        transition: all linear 0.5s;\n      }\n\n      .animate-show.ng-hide {\n        line-height: 0;\n        opacity: 0;\n        padding: 0 10px;\n      }\n\n      .check-element {\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngShowDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'A',\n    multiElement: true,\n    link: function(scope, element, attr) {\n      scope.$watch(attr.ngShow, function ngShowWatchAction(value) {\n        // we're adding a temporary, animation-specific class for ng-hide since this way\n        // we can control when the element is actually displayed on screen without having\n        // to have a global/greedy CSS selector that breaks when other animations are run.\n        // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845\n        $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {\n          tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n        });\n      });\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngHide\n * @multiElement\n *\n * @description\n * The `ngHide` directive shows or hides the given HTML element based on the expression\n * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is hidden) -->\n * <div ng-hide=\"myValue\" class=\"ng-hide\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is visible) -->\n * <div ng-hide=\"myValue\"></div>\n * ```\n *\n * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n *   /&#42; this is just another form of hiding an element &#42;/\n *   display: block!important;\n *   position: absolute;\n *   top: -9999px;\n *   left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngHide`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`\n * CSS class is added and removed for you instead of your own CSS class.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   transition: 0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden |\n * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible |\n *\n *\n * @element ANY\n * @param {expression} ngHide If the {@link guide/expression expression} is truthy then\n *     the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngShow\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-hide\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-hide\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-hide {\n        transition: all linear 0.5s;\n        line-height: 20px;\n        opacity: 1;\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n\n      .animate-hide.ng-hide {\n        line-height: 0;\n        opacity: 0;\n        padding: 0 10px;\n      }\n\n      .check-element {\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngHideDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'A',\n    multiElement: true,\n    link: function(scope, element, attr) {\n      scope.$watch(attr.ngHide, function ngHideWatchAction(value) {\n        // The comment inside of the ngShowDirective explains why we add and\n        // remove a temporary class for the show/hide animation\n        $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {\n          tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n        });\n      });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngStyle\n * @restrict AC\n *\n * @description\n * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.\n *\n * @element ANY\n * @param {expression} ngStyle\n *\n * {@link guide/expression Expression} which evals to an\n * object whose keys are CSS style names and values are corresponding values for those CSS\n * keys.\n *\n * Since some CSS style names are not valid keys for an object, they must be quoted.\n * See the 'background-color' style in the example below.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <input type=\"button\" value=\"set color\" ng-click=\"myStyle={color:'red'}\">\n        <input type=\"button\" value=\"set background\" ng-click=\"myStyle={'background-color':'blue'}\">\n        <input type=\"button\" value=\"clear\" ng-click=\"myStyle={}\">\n        <br/>\n        <span ng-style=\"myStyle\">Sample Text</span>\n        <pre>myStyle={{myStyle}}</pre>\n     </file>\n     <file name=\"style.css\">\n       span {\n         color: black;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var colorSpan = element(by.css('span'));\n\n       it('should check ng-style', function() {\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n         element(by.css('input[value=\\'set color\\']')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');\n         element(by.css('input[value=clear]')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n       });\n     </file>\n   </example>\n */\nvar ngStyleDirective = ngDirective(function(scope, element, attr) {\n  scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {\n    if (oldStyles && (newStyles !== oldStyles)) {\n      forEach(oldStyles, function(val, style) { element.css(style, '');});\n    }\n    if (newStyles) element.css(newStyles);\n  }, true);\n});\n\n/**\n * @ngdoc directive\n * @name ngSwitch\n * @restrict EA\n *\n * @description\n * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.\n * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location\n * as specified in the template.\n *\n * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it\n * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element\n * matches the value obtained from the evaluated expression. In other words, you define a container element\n * (where you place the directive), place an expression on the **`on=\"...\"` attribute**\n * (or the **`ng-switch=\"...\"` attribute**), define any inner elements inside of the directive and place\n * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on\n * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default\n * attribute is displayed.\n *\n * <div class=\"alert alert-info\">\n * Be aware that the attribute values to match against cannot be expressions. They are interpreted\n * as literal string values to match against.\n * For example, **`ng-switch-when=\"someVal\"`** will match against the string `\"someVal\"` not against the\n * value of the expression `$scope.someVal`.\n * </div>\n\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | after the ngSwitch contents change and the matched child element is placed inside the container |\n * | {@link ng.$animate#leave leave}  | after the ngSwitch contents change and just before the former contents are removed from the DOM |\n *\n * @usage\n *\n * ```\n * <ANY ng-switch=\"expression\">\n *   <ANY ng-switch-when=\"matchValue1\">...</ANY>\n *   <ANY ng-switch-when=\"matchValue2\">...</ANY>\n *   <ANY ng-switch-default>...</ANY>\n * </ANY>\n * ```\n *\n *\n * @scope\n * @priority 1200\n * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.\n * On child elements add:\n *\n * * `ngSwitchWhen`: the case statement to match against. If match then this\n *   case will be displayed. If the same match appears multiple times, all the\n *   elements will be displayed.\n * * `ngSwitchDefault`: the default case when no other case match. If there\n *   are multiple default cases, all of them will be displayed when no other\n *   case match.\n *\n *\n * @example\n  <example module=\"switchExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <select ng-model=\"selection\" ng-options=\"item for item in items\">\n        </select>\n        <code>selection={{selection}}</code>\n        <hr/>\n        <div class=\"animate-switch-container\"\n          ng-switch on=\"selection\">\n            <div class=\"animate-switch\" ng-switch-when=\"settings\">Settings Div</div>\n            <div class=\"animate-switch\" ng-switch-when=\"home\">Home Span</div>\n            <div class=\"animate-switch\" ng-switch-default>default</div>\n        </div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('switchExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.items = ['settings', 'home', 'other'];\n          $scope.selection = $scope.items[0];\n        }]);\n    </file>\n    <file name=\"animations.css\">\n      .animate-switch-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .animate-switch {\n        padding:10px;\n      }\n\n      .animate-switch.ng-animate {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n      }\n\n      .animate-switch.ng-leave.ng-leave-active,\n      .animate-switch.ng-enter {\n        top:-50px;\n      }\n      .animate-switch.ng-leave,\n      .animate-switch.ng-enter.ng-enter-active {\n        top:0;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var switchElem = element(by.css('[ng-switch]'));\n      var select = element(by.model('selection'));\n\n      it('should start in settings', function() {\n        expect(switchElem.getText()).toMatch(/Settings Div/);\n      });\n      it('should change to home', function() {\n        select.all(by.css('option')).get(1).click();\n        expect(switchElem.getText()).toMatch(/Home Span/);\n      });\n      it('should select default', function() {\n        select.all(by.css('option')).get(2).click();\n        expect(switchElem.getText()).toMatch(/default/);\n      });\n    </file>\n  </example>\n */\nvar ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {\n  return {\n    require: 'ngSwitch',\n\n    // asks for $scope to fool the BC controller module\n    controller: ['$scope', function ngSwitchController() {\n     this.cases = {};\n    }],\n    link: function(scope, element, attr, ngSwitchController) {\n      var watchExpr = attr.ngSwitch || attr.on,\n          selectedTranscludes = [],\n          selectedElements = [],\n          previousLeaveAnimations = [],\n          selectedScopes = [];\n\n      var spliceFactory = function(array, index) {\n          return function() { array.splice(index, 1); };\n      };\n\n      scope.$watch(watchExpr, function ngSwitchWatchAction(value) {\n        var i, ii;\n        for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {\n          $animate.cancel(previousLeaveAnimations[i]);\n        }\n        previousLeaveAnimations.length = 0;\n\n        for (i = 0, ii = selectedScopes.length; i < ii; ++i) {\n          var selected = getBlockNodes(selectedElements[i].clone);\n          selectedScopes[i].$destroy();\n          var promise = previousLeaveAnimations[i] = $animate.leave(selected);\n          promise.then(spliceFactory(previousLeaveAnimations, i));\n        }\n\n        selectedElements.length = 0;\n        selectedScopes.length = 0;\n\n        if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {\n          forEach(selectedTranscludes, function(selectedTransclude) {\n            selectedTransclude.transclude(function(caseElement, selectedScope) {\n              selectedScopes.push(selectedScope);\n              var anchor = selectedTransclude.element;\n              caseElement[caseElement.length++] = $compile.$$createComment('end ngSwitchWhen');\n              var block = { clone: caseElement };\n\n              selectedElements.push(block);\n              $animate.enter(caseElement, anchor.parent(), anchor);\n            });\n          });\n        }\n      });\n    }\n  };\n}];\n\nvar ngSwitchWhenDirective = ngDirective({\n  transclude: 'element',\n  priority: 1200,\n  require: '^ngSwitch',\n  multiElement: true,\n  link: function(scope, element, attrs, ctrl, $transclude) {\n    ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);\n    ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });\n  }\n});\n\nvar ngSwitchDefaultDirective = ngDirective({\n  transclude: 'element',\n  priority: 1200,\n  require: '^ngSwitch',\n  multiElement: true,\n  link: function(scope, element, attr, ctrl, $transclude) {\n    ctrl.cases['?'] = (ctrl.cases['?'] || []);\n    ctrl.cases['?'].push({ transclude: $transclude, element: element });\n   }\n});\n\n/**\n * @ngdoc directive\n * @name ngTransclude\n * @restrict EAC\n *\n * @description\n * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.\n *\n * You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name\n * as the value of the `ng-transclude` or `ng-transclude-slot` attribute.\n *\n * If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing\n * content of this element will be removed before the transcluded content is inserted.\n * If the transcluded content is empty, the existing content is left intact. This lets you provide fallback content in the case\n * that no transcluded content is provided.\n *\n * @element ANY\n *\n * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided, is empty\n *                                               or its value is the same as the name of the attribute then the default slot is used.\n *\n * @example\n * ### Basic transclusion\n * This example demonstrates basic transclusion of content into a component directive.\n * <example name=\"simpleTranscludeExample\" module=\"transcludeExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('transcludeExample', [])\n *        .directive('pane', function(){\n *           return {\n *             restrict: 'E',\n *             transclude: true,\n *             scope: { title:'@' },\n *             template: '<div style=\"border: 1px solid black;\">' +\n *                         '<div style=\"background-color: gray\">{{title}}</div>' +\n *                         '<ng-transclude></ng-transclude>' +\n *                       '</div>'\n *           };\n *       })\n *       .controller('ExampleController', ['$scope', function($scope) {\n *         $scope.title = 'Lorem Ipsum';\n *         $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n *       }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <input ng-model=\"title\" aria-label=\"title\"> <br/>\n *       <textarea ng-model=\"text\" aria-label=\"text\"></textarea> <br/>\n *       <pane title=\"{{title}}\">{{text}}</pane>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *      it('should have transcluded', function() {\n *        var titleElement = element(by.model('title'));\n *        titleElement.clear();\n *        titleElement.sendKeys('TITLE');\n *        var textElement = element(by.model('text'));\n *        textElement.clear();\n *        textElement.sendKeys('TEXT');\n *        expect(element(by.binding('title')).getText()).toEqual('TITLE');\n *        expect(element(by.binding('text')).getText()).toEqual('TEXT');\n *      });\n *   </file>\n * </example>\n *\n * @example\n * ### Transclude fallback content\n * This example shows how to use `NgTransclude` with fallback content, that\n * is displayed if no transcluded content is provided.\n *\n * <example module=\"transcludeFallbackContentExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('transcludeFallbackContentExample', [])\n * .directive('myButton', function(){\n *             return {\n *               restrict: 'E',\n *               transclude: true,\n *               scope: true,\n *               template: '<button style=\"cursor: pointer;\">' +\n *                           '<ng-transclude>' +\n *                             '<b style=\"color: red;\">Button1</b>' +\n *                           '</ng-transclude>' +\n *                         '</button>'\n *             };\n *         });\n * </script>\n * <!-- fallback button content -->\n * <my-button id=\"fallback\"></my-button>\n * <!-- modified button content -->\n * <my-button id=\"modified\">\n *   <i style=\"color: green;\">Button2</i>\n * </my-button>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should have different transclude element content', function() {\n *          expect(element(by.id('fallback')).getText()).toBe('Button1');\n *          expect(element(by.id('modified')).getText()).toBe('Button2');\n *        });\n * </file>\n * </example>\n *\n * @example\n * ### Multi-slot transclusion\n * This example demonstrates using multi-slot transclusion in a component directive.\n * <example name=\"multiSlotTranscludeExample\" module=\"multiSlotTranscludeExample\">\n *   <file name=\"index.html\">\n *    <style>\n *      .title, .footer {\n *        background-color: gray\n *      }\n *    </style>\n *    <div ng-controller=\"ExampleController\">\n *      <input ng-model=\"title\" aria-label=\"title\"> <br/>\n *      <textarea ng-model=\"text\" aria-label=\"text\"></textarea> <br/>\n *      <pane>\n *        <pane-title><a ng-href=\"{{link}}\">{{title}}</a></pane-title>\n *        <pane-body><p>{{text}}</p></pane-body>\n *      </pane>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    angular.module('multiSlotTranscludeExample', [])\n *     .directive('pane', function(){\n *        return {\n *          restrict: 'E',\n *          transclude: {\n *            'title': '?paneTitle',\n *            'body': 'paneBody',\n *            'footer': '?paneFooter'\n *          },\n *          template: '<div style=\"border: 1px solid black;\">' +\n *                      '<div class=\"title\" ng-transclude=\"title\">Fallback Title</div>' +\n *                      '<div ng-transclude=\"body\"></div>' +\n *                      '<div class=\"footer\" ng-transclude=\"footer\">Fallback Footer</div>' +\n *                    '</div>'\n *        };\n *    })\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.title = 'Lorem Ipsum';\n *      $scope.link = \"https://google.com\";\n *      $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n *    }]);\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *      it('should have transcluded the title and the body', function() {\n *        var titleElement = element(by.model('title'));\n *        titleElement.clear();\n *        titleElement.sendKeys('TITLE');\n *        var textElement = element(by.model('text'));\n *        textElement.clear();\n *        textElement.sendKeys('TEXT');\n *        expect(element(by.css('.title')).getText()).toEqual('TITLE');\n *        expect(element(by.binding('text')).getText()).toEqual('TEXT');\n *        expect(element(by.css('.footer')).getText()).toEqual('Fallback Footer');\n *      });\n *   </file>\n * </example>\n */\nvar ngTranscludeMinErr = minErr('ngTransclude');\nvar ngTranscludeDirective = ngDirective({\n  restrict: 'EAC',\n  link: function($scope, $element, $attrs, controller, $transclude) {\n\n    if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {\n      // If the attribute is of the form: `ng-transclude=\"ng-transclude\"`\n      // then treat it like the default\n      $attrs.ngTransclude = '';\n    }\n\n    function ngTranscludeCloneAttachFn(clone) {\n      if (clone.length) {\n        $element.empty();\n        $element.append(clone);\n      }\n    }\n\n    if (!$transclude) {\n      throw ngTranscludeMinErr('orphan',\n       'Illegal use of ngTransclude directive in the template! ' +\n       'No parent directive that requires a transclusion found. ' +\n       'Element: {0}',\n       startingTag($element));\n    }\n\n    // If there is no slot name defined or the slot name is not optional\n    // then transclude the slot\n    var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;\n    $transclude(ngTranscludeCloneAttachFn, null, slotName);\n  }\n});\n\n/**\n * @ngdoc directive\n * @name script\n * @restrict E\n *\n * @description\n * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the\n * template can be used by {@link ng.directive:ngInclude `ngInclude`},\n * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the\n * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be\n * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.\n *\n * @param {string} type Must be set to `'text/ng-template'`.\n * @param {string} id Cache name of the template.\n *\n * @example\n  <example>\n    <file name=\"index.html\">\n      <script type=\"text/ng-template\" id=\"/tpl.html\">\n        Content of the template.\n      </script>\n\n      <a ng-click=\"currentTpl='/tpl.html'\" id=\"tpl-link\">Load inlined template</a>\n      <div id=\"tpl-content\" ng-include src=\"currentTpl\"></div>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      it('should load template defined inside script tag', function() {\n        element(by.css('#tpl-link')).click();\n        expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);\n      });\n    </file>\n  </example>\n */\nvar scriptDirective = ['$templateCache', function($templateCache) {\n  return {\n    restrict: 'E',\n    terminal: true,\n    compile: function(element, attr) {\n      if (attr.type == 'text/ng-template') {\n        var templateUrl = attr.id,\n            text = element[0].text;\n\n        $templateCache.put(templateUrl, text);\n      }\n    }\n  };\n}];\n\nvar noopNgModelController = { $setViewValue: noop, $render: noop };\n\nfunction chromeHack(optionElement) {\n  // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459\n  // Adding an <option selected=\"selected\"> element to a <select required=\"required\"> should\n  // automatically select the new element\n  if (optionElement[0].hasAttribute('selected')) {\n    optionElement[0].selected = true;\n  }\n}\n\n/**\n * @ngdoc type\n * @name  select.SelectController\n * @description\n * The controller for the `<select>` directive. This provides support for reading\n * and writing the selected value(s) of the control and also coordinates dynamically\n * added `<option>` elements, perhaps by an `ngRepeat` directive.\n */\nvar SelectController =\n        ['$element', '$scope', function($element, $scope) {\n\n  var self = this,\n      optionsMap = new HashMap();\n\n  // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors\n  self.ngModelCtrl = noopNgModelController;\n\n  // The \"unknown\" option is one that is prepended to the list if the viewValue\n  // does not match any of the options. When it is rendered the value of the unknown\n  // option is '? XXX ?' where XXX is the hashKey of the value that is not known.\n  //\n  // We can't just jqLite('<option>') since jqLite is not smart enough\n  // to create it in <select> and IE barfs otherwise.\n  self.unknownOption = jqLite(document.createElement('option'));\n  self.renderUnknownOption = function(val) {\n    var unknownVal = '? ' + hashKey(val) + ' ?';\n    self.unknownOption.val(unknownVal);\n    $element.prepend(self.unknownOption);\n    $element.val(unknownVal);\n  };\n\n  $scope.$on('$destroy', function() {\n    // disable unknown option so that we don't do work when the whole select is being destroyed\n    self.renderUnknownOption = noop;\n  });\n\n  self.removeUnknownOption = function() {\n    if (self.unknownOption.parent()) self.unknownOption.remove();\n  };\n\n\n  // Read the value of the select control, the implementation of this changes depending\n  // upon whether the select can have multiple values and whether ngOptions is at work.\n  self.readValue = function readSingleValue() {\n    self.removeUnknownOption();\n    return $element.val();\n  };\n\n\n  // Write the value to the select control, the implementation of this changes depending\n  // upon whether the select can have multiple values and whether ngOptions is at work.\n  self.writeValue = function writeSingleValue(value) {\n    if (self.hasOption(value)) {\n      self.removeUnknownOption();\n      $element.val(value);\n      if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy\n    } else {\n      if (value == null && self.emptyOption) {\n        self.removeUnknownOption();\n        $element.val('');\n      } else {\n        self.renderUnknownOption(value);\n      }\n    }\n  };\n\n\n  // Tell the select control that an option, with the given value, has been added\n  self.addOption = function(value, element) {\n    // Skip comment nodes, as they only pollute the `optionsMap`\n    if (element[0].nodeType === NODE_TYPE_COMMENT) return;\n\n    assertNotHasOwnProperty(value, '\"option value\"');\n    if (value === '') {\n      self.emptyOption = element;\n    }\n    var count = optionsMap.get(value) || 0;\n    optionsMap.put(value, count + 1);\n    self.ngModelCtrl.$render();\n    chromeHack(element);\n  };\n\n  // Tell the select control that an option, with the given value, has been removed\n  self.removeOption = function(value) {\n    var count = optionsMap.get(value);\n    if (count) {\n      if (count === 1) {\n        optionsMap.remove(value);\n        if (value === '') {\n          self.emptyOption = undefined;\n        }\n      } else {\n        optionsMap.put(value, count - 1);\n      }\n    }\n  };\n\n  // Check whether the select control has an option matching the given value\n  self.hasOption = function(value) {\n    return !!optionsMap.get(value);\n  };\n\n\n  self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {\n\n    if (interpolateValueFn) {\n      // The value attribute is interpolated\n      var oldVal;\n      optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {\n        if (isDefined(oldVal)) {\n          self.removeOption(oldVal);\n        }\n        oldVal = newVal;\n        self.addOption(newVal, optionElement);\n      });\n    } else if (interpolateTextFn) {\n      // The text content is interpolated\n      optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {\n        optionAttrs.$set('value', newVal);\n        if (oldVal !== newVal) {\n          self.removeOption(oldVal);\n        }\n        self.addOption(newVal, optionElement);\n      });\n    } else {\n      // The value attribute is static\n      self.addOption(optionAttrs.value, optionElement);\n    }\n\n    optionElement.on('$destroy', function() {\n      self.removeOption(optionAttrs.value);\n      self.ngModelCtrl.$render();\n    });\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name select\n * @restrict E\n *\n * @description\n * HTML `SELECT` element with angular data-binding.\n *\n * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding\n * between the scope and the `<select>` control (including setting default values).\n * It also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or\n * {@link ngOptions `ngOptions`} directives.\n *\n * When an item in the `<select>` menu is selected, the value of the selected option will be bound\n * to the model identified by the `ngModel` directive. With static or repeated options, this is\n * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.\n * If you want dynamic value attributes, you can use interpolation inside the value attribute.\n *\n * <div class=\"alert alert-warning\">\n * Note that the value of a `select` directive used without `ngOptions` is always a string.\n * When the model needs to be bound to a non-string value, you must either explicitly convert it\n * using a directive (see example below) or use `ngOptions` to specify the set of options.\n * This is because an option element can only be bound to string values at present.\n * </div>\n *\n * If the viewValue of `ngModel` does not match any of the options, then the control\n * will automatically add an \"unknown\" option, which it then removes when the mismatch is resolved.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * <div class=\"alert alert-info\">\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions\n * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression, and additionally in reducing memory and increasing speed by not creating\n * a new scope for each repeated instance.\n * </div>\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} multiple Allows multiple options to be selected. The selected values will be\n *     bound to the model as an array.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds required attribute and required validation constraint to\n * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required\n * when you want to data-bind to the required attribute.\n * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user\n *    interaction with the select element.\n * @param {string=} ngOptions sets the options that the select is populated with and defines what is\n * set on the model on selection. See {@link ngOptions `ngOptions`}.\n *\n * @example\n * ### Simple `select` elements with static options\n *\n * <example name=\"static-select\" module=\"staticSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"singleSelect\"> Single select: </label><br>\n *     <select name=\"singleSelect\" ng-model=\"data.singleSelect\">\n *       <option value=\"option-1\">Option 1</option>\n *       <option value=\"option-2\">Option 2</option>\n *     </select><br>\n *\n *     <label for=\"singleSelect\"> Single select with \"not selected\" option and dynamic option values: </label><br>\n *     <select name=\"singleSelect\" id=\"singleSelect\" ng-model=\"data.singleSelect\">\n *       <option value=\"\">---Please select---</option> <!-- not selected / blank option -->\n *       <option value=\"{{data.option1}}\">Option 1</option> <!-- interpolation -->\n *       <option value=\"option-2\">Option 2</option>\n *     </select><br>\n *     <button ng-click=\"forceUnknownOption()\">Force unknown option</button><br>\n *     <tt>singleSelect = {{data.singleSelect}}</tt>\n *\n *     <hr>\n *     <label for=\"multipleSelect\"> Multiple select: </label><br>\n *     <select name=\"multipleSelect\" id=\"multipleSelect\" ng-model=\"data.multipleSelect\" multiple>\n *       <option value=\"option-1\">Option 1</option>\n *       <option value=\"option-2\">Option 2</option>\n *       <option value=\"option-3\">Option 3</option>\n *     </select><br>\n *     <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>\n *   </form>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('staticSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       singleSelect: null,\n *       multipleSelect: [],\n *       option1: 'option-1',\n *      };\n *\n *      $scope.forceUnknownOption = function() {\n *        $scope.data.singleSelect = 'nonsense';\n *      };\n *   }]);\n * </file>\n *</example>\n *\n * ### Using `ngRepeat` to generate `select` options\n * <example name=\"ngrepeat-select\" module=\"ngrepeatSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"repeatSelect\"> Repeat select: </label>\n *     <select name=\"repeatSelect\" id=\"repeatSelect\" ng-model=\"data.repeatSelect\">\n *       <option ng-repeat=\"option in data.availableOptions\" value=\"{{option.id}}\">{{option.name}}</option>\n *     </select>\n *   </form>\n *   <hr>\n *   <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('ngrepeatSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       repeatSelect: null,\n *       availableOptions: [\n *         {id: '1', name: 'Option A'},\n *         {id: '2', name: 'Option B'},\n *         {id: '3', name: 'Option C'}\n *       ],\n *      };\n *   }]);\n * </file>\n *</example>\n *\n *\n * ### Using `select` with `ngOptions` and setting a default value\n * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.\n *\n * <example name=\"select-with-default-values\" module=\"defaultValueSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"mySelect\">Make a choice:</label>\n *     <select name=\"mySelect\" id=\"mySelect\"\n *       ng-options=\"option.name for option in data.availableOptions track by option.id\"\n *       ng-model=\"data.selectedOption\"></select>\n *   </form>\n *   <hr>\n *   <tt>option = {{data.selectedOption}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('defaultValueSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       availableOptions: [\n *         {id: '1', name: 'Option A'},\n *         {id: '2', name: 'Option B'},\n *         {id: '3', name: 'Option C'}\n *       ],\n *       selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui\n *       };\n *   }]);\n * </file>\n *</example>\n *\n *\n * ### Binding `select` to a non-string value via `ngModel` parsing / formatting\n *\n * <example name=\"select-with-non-string-options\" module=\"nonStringSelect\">\n *   <file name=\"index.html\">\n *     <select ng-model=\"model.id\" convert-to-number>\n *       <option value=\"0\">Zero</option>\n *       <option value=\"1\">One</option>\n *       <option value=\"2\">Two</option>\n *     </select>\n *     {{ model }}\n *   </file>\n *   <file name=\"app.js\">\n *     angular.module('nonStringSelect', [])\n *       .run(function($rootScope) {\n *         $rootScope.model = { id: 2 };\n *       })\n *       .directive('convertToNumber', function() {\n *         return {\n *           require: 'ngModel',\n *           link: function(scope, element, attrs, ngModel) {\n *             ngModel.$parsers.push(function(val) {\n *               return parseInt(val, 10);\n *             });\n *             ngModel.$formatters.push(function(val) {\n *               return '' + val;\n *             });\n *           }\n *         };\n *       });\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should initialize to model', function() {\n *       var select = element(by.css('select'));\n *       expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');\n *     });\n *   </file>\n * </example>\n *\n */\nvar selectDirective = function() {\n\n  return {\n    restrict: 'E',\n    require: ['select', '?ngModel'],\n    controller: SelectController,\n    priority: 1,\n    link: {\n      pre: selectPreLink,\n      post: selectPostLink\n    }\n  };\n\n  function selectPreLink(scope, element, attr, ctrls) {\n\n      // if ngModel is not defined, we don't need to do anything\n      var ngModelCtrl = ctrls[1];\n      if (!ngModelCtrl) return;\n\n      var selectCtrl = ctrls[0];\n\n      selectCtrl.ngModelCtrl = ngModelCtrl;\n\n      // When the selected item(s) changes we delegate getting the value of the select control\n      // to the `readValue` method, which can be changed if the select can have multiple\n      // selected values or if the options are being generated by `ngOptions`\n      element.on('change', function() {\n        scope.$apply(function() {\n          ngModelCtrl.$setViewValue(selectCtrl.readValue());\n        });\n      });\n\n      // If the select allows multiple values then we need to modify how we read and write\n      // values from and to the control; also what it means for the value to be empty and\n      // we have to add an extra watch since ngModel doesn't work well with arrays - it\n      // doesn't trigger rendering if only an item in the array changes.\n      if (attr.multiple) {\n\n        // Read value now needs to check each option to see if it is selected\n        selectCtrl.readValue = function readMultipleValue() {\n          var array = [];\n          forEach(element.find('option'), function(option) {\n            if (option.selected) {\n              array.push(option.value);\n            }\n          });\n          return array;\n        };\n\n        // Write value now needs to set the selected property of each matching option\n        selectCtrl.writeValue = function writeMultipleValue(value) {\n          var items = new HashMap(value);\n          forEach(element.find('option'), function(option) {\n            option.selected = isDefined(items.get(option.value));\n          });\n        };\n\n        // we have to do it on each watch since ngModel watches reference, but\n        // we need to work of an array, so we need to see if anything was inserted/removed\n        var lastView, lastViewRef = NaN;\n        scope.$watch(function selectMultipleWatch() {\n          if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {\n            lastView = shallowCopy(ngModelCtrl.$viewValue);\n            ngModelCtrl.$render();\n          }\n          lastViewRef = ngModelCtrl.$viewValue;\n        });\n\n        // If we are a multiple select then value is now a collection\n        // so the meaning of $isEmpty changes\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n\n      }\n    }\n\n    function selectPostLink(scope, element, attrs, ctrls) {\n      // if ngModel is not defined, we don't need to do anything\n      var ngModelCtrl = ctrls[1];\n      if (!ngModelCtrl) return;\n\n      var selectCtrl = ctrls[0];\n\n      // We delegate rendering to the `writeValue` method, which can be changed\n      // if the select can have multiple selected values or if the options are being\n      // generated by `ngOptions`.\n      // This must be done in the postLink fn to prevent $render to be called before\n      // all nodes have been linked correctly.\n      ngModelCtrl.$render = function() {\n        selectCtrl.writeValue(ngModelCtrl.$viewValue);\n      };\n    }\n};\n\n\n// The option directive is purely designed to communicate the existence (or lack of)\n// of dynamically created (and destroyed) option elements to their containing select\n// directive via its controller.\nvar optionDirective = ['$interpolate', function($interpolate) {\n  return {\n    restrict: 'E',\n    priority: 100,\n    compile: function(element, attr) {\n      if (isDefined(attr.value)) {\n        // If the value attribute is defined, check if it contains an interpolation\n        var interpolateValueFn = $interpolate(attr.value, true);\n      } else {\n        // If the value attribute is not defined then we fall back to the\n        // text content of the option element, which may be interpolated\n        var interpolateTextFn = $interpolate(element.text(), true);\n        if (!interpolateTextFn) {\n          attr.$set('value', element.text());\n        }\n      }\n\n      return function(scope, element, attr) {\n        // This is an optimization over using ^^ since we don't want to have to search\n        // all the way to the root of the DOM for every single option element\n        var selectCtrlName = '$selectController',\n            parent = element.parent(),\n            selectCtrl = parent.data(selectCtrlName) ||\n              parent.parent().data(selectCtrlName); // in case we are in optgroup\n\n        if (selectCtrl) {\n          selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);\n        }\n      };\n    }\n  };\n}];\n\nvar styleDirective = valueFn({\n  restrict: 'E',\n  terminal: false\n});\n\n/**\n * @ngdoc directive\n * @name ngRequired\n *\n * @description\n *\n * ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for {@link input `input`} and {@link select `select`} controls, but can also be\n * applied to custom controls.\n *\n * The directive sets the `required` attribute on the element if the Angular expression inside\n * `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we\n * cannot use interpolation inside `required`. See the {@link guide/interpolation interpolation guide}\n * for more info.\n *\n * The validator will set the `required` error key to true if the `required` attribute is set and\n * calling {@link ngModel.NgModelController#$isEmpty `NgModelController.$isEmpty`} with the\n * {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`} returns `true`. For example, the\n * `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing\n * custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.\n *\n * @example\n * <example name=\"ngRequiredDirective\" module=\"ngRequiredExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngRequiredExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.required = true;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"required\">Toggle required: </label>\n *         <input type=\"checkbox\" ng-model=\"required\" id=\"required\" />\n *         <br>\n *         <label for=\"input\">This input must be filled if `required` is true: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-required=\"required\" /><br>\n *         <hr>\n *         required error set? = <code>{{form.input.$error.required}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var required = element(by.binding('form.input.$error.required'));\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should set the required error', function() {\n         expect(required.getText()).toContain('true');\n\n         input.sendKeys('123');\n         expect(required.getText()).not.toContain('true');\n         expect(model.getText()).toContain('123');\n       });\n *   </file>\n * </example>\n */\nvar requiredDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n      attr.required = true; // force truthy in case we are on non input element\n\n      ctrl.$validators.required = function(modelValue, viewValue) {\n        return !attr.required || !ctrl.$isEmpty(viewValue);\n      };\n\n      attr.$observe('required', function() {\n        ctrl.$validate();\n      });\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngPattern\n *\n * @description\n *\n * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * does not match a RegExp which is obtained by evaluating the Angular expression given in the\n * `ngPattern` attribute value:\n * * If the expression evaluates to a RegExp object, then this is used directly.\n * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it\n * in `^` and `$` characters. For instance, `\"abc\"` will be converted to `new RegExp('^abc$')`.\n *\n * <div class=\"alert alert-info\">\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * </div>\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `pattern` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is\n *     not available.\n *   </li>\n *   <li>\n *     The `ngPattern` attribute must be an expression, while the `pattern` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngPatternDirective\" module=\"ngPatternExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngPatternExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.regex = '\\\\d+';\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"regex\">Set a pattern (regex string): </label>\n *         <input type=\"text\" ng-model=\"regex\" id=\"regex\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current pattern: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-pattern=\"regex\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default pattern', function() {\n         input.sendKeys('aaa');\n         expect(model.getText()).not.toContain('aaa');\n\n         input.clear().then(function() {\n           input.sendKeys('123');\n           expect(model.getText()).toContain('123');\n         });\n       });\n *   </file>\n * </example>\n */\nvar patternDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var regexp, patternExp = attr.ngPattern || attr.pattern;\n      attr.$observe('pattern', function(regex) {\n        if (isString(regex) && regex.length > 0) {\n          regex = new RegExp('^' + regex + '$');\n        }\n\n        if (regex && !regex.test) {\n          throw minErr('ngPattern')('noregexp',\n            'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,\n            regex, startingTag(elm));\n        }\n\n        regexp = regex || undefined;\n        ctrl.$validate();\n      });\n\n      ctrl.$validators.pattern = function(modelValue, viewValue) {\n        // HTML5 pattern constraint validates the input value, so we validate the viewValue\n        return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);\n      };\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngMaxlength\n *\n * @description\n *\n * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is longer than the integer obtained by evaluating the Angular expression given in the\n * `ngMaxlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `maxlength` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint\n *     validation is not available.\n *   </li>\n *   <li>\n *     The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMaxlengthDirective\" module=\"ngMaxlengthExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngMaxlengthExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.maxlength = 5;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"maxlength\">Set a maxlength: </label>\n *         <input type=\"number\" ng-model=\"maxlength\" id=\"maxlength\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current maxlength: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-maxlength=\"maxlength\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default maxlength', function() {\n         input.sendKeys('abcdef');\n         expect(model.getText()).not.toContain('abcdef');\n\n         input.clear().then(function() {\n           input.sendKeys('abcde');\n           expect(model.getText()).toContain('abcde');\n         });\n       });\n *   </file>\n * </example>\n */\nvar maxlengthDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var maxlength = -1;\n      attr.$observe('maxlength', function(value) {\n        var intVal = toInt(value);\n        maxlength = isNaN(intVal) ? -1 : intVal;\n        ctrl.$validate();\n      });\n      ctrl.$validators.maxlength = function(modelValue, viewValue) {\n        return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);\n      };\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngMinlength\n *\n * @description\n *\n * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is shorter than the integer obtained by evaluating the Angular expression given in the\n * `ngMinlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `minlength` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint\n *     validation is not available.\n *   </li>\n *   <li>\n *     The `ngMinlength` value must be an expression, while the `minlength` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMinlengthDirective\" module=\"ngMinlengthExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngMinlengthExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.minlength = 3;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"minlength\">Set a minlength: </label>\n *         <input type=\"number\" ng-model=\"minlength\" id=\"minlength\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current minlength: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-minlength=\"minlength\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default minlength', function() {\n         input.sendKeys('ab');\n         expect(model.getText()).not.toContain('ab');\n\n         input.sendKeys('abc');\n         expect(model.getText()).toContain('abc');\n       });\n *   </file>\n * </example>\n */\nvar minlengthDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var minlength = 0;\n      attr.$observe('minlength', function(value) {\n        minlength = toInt(value) || 0;\n        ctrl.$validate();\n      });\n      ctrl.$validators.minlength = function(modelValue, viewValue) {\n        return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;\n      };\n    }\n  };\n};\n\nif (window.angular.bootstrap) {\n  //AngularJS is already loaded, so we can return here...\n  if (window.console) {\n    console.log('WARNING: Tried to load angular more than once.');\n  }\n  return;\n}\n\n//try to bind to jquery now so that one can write jqLite(document).ready()\n//but we will rebind on bootstrap again.\nbindJQuery();\n\npublishExternalAPI(angular);\n\nangular.module(\"ngLocale\", [], [\"$provide\", function($provide) {\nvar PLURAL_CATEGORY = {ZERO: \"zero\", ONE: \"one\", TWO: \"two\", FEW: \"few\", MANY: \"many\", OTHER: \"other\"};\nfunction getDecimals(n) {\n  n = n + '';\n  var i = n.indexOf('.');\n  return (i == -1) ? 0 : n.length - i - 1;\n}\n\nfunction getVF(n, opt_precision) {\n  var v = opt_precision;\n\n  if (undefined === v) {\n    v = Math.min(getDecimals(n), 3);\n  }\n\n  var base = Math.pow(10, v);\n  var f = ((n * base) | 0) % base;\n  return {v: v, f: f};\n}\n\n$provide.value(\"$locale\", {\n  \"DATETIME_FORMATS\": {\n    \"AMPMS\": [\n      \"AM\",\n      \"PM\"\n    ],\n    \"DAY\": [\n      \"Sunday\",\n      \"Monday\",\n      \"Tuesday\",\n      \"Wednesday\",\n      \"Thursday\",\n      \"Friday\",\n      \"Saturday\"\n    ],\n    \"ERANAMES\": [\n      \"Before Christ\",\n      \"Anno Domini\"\n    ],\n    \"ERAS\": [\n      \"BC\",\n      \"AD\"\n    ],\n    \"FIRSTDAYOFWEEK\": 6,\n    \"MONTH\": [\n      \"January\",\n      \"February\",\n      \"March\",\n      \"April\",\n      \"May\",\n      \"June\",\n      \"July\",\n      \"August\",\n      \"September\",\n      \"October\",\n      \"November\",\n      \"December\"\n    ],\n    \"SHORTDAY\": [\n      \"Sun\",\n      \"Mon\",\n      \"Tue\",\n      \"Wed\",\n      \"Thu\",\n      \"Fri\",\n      \"Sat\"\n    ],\n    \"SHORTMONTH\": [\n      \"Jan\",\n      \"Feb\",\n      \"Mar\",\n      \"Apr\",\n      \"May\",\n      \"Jun\",\n      \"Jul\",\n      \"Aug\",\n      \"Sep\",\n      \"Oct\",\n      \"Nov\",\n      \"Dec\"\n    ],\n    \"STANDALONEMONTH\": [\n      \"January\",\n      \"February\",\n      \"March\",\n      \"April\",\n      \"May\",\n      \"June\",\n      \"July\",\n      \"August\",\n      \"September\",\n      \"October\",\n      \"November\",\n      \"December\"\n    ],\n    \"WEEKENDRANGE\": [\n      5,\n      6\n    ],\n    \"fullDate\": \"EEEE, MMMM d, y\",\n    \"longDate\": \"MMMM d, y\",\n    \"medium\": \"MMM d, y h:mm:ss a\",\n    \"mediumDate\": \"MMM d, y\",\n    \"mediumTime\": \"h:mm:ss a\",\n    \"short\": \"M/d/yy h:mm a\",\n    \"shortDate\": \"M/d/yy\",\n    \"shortTime\": \"h:mm a\"\n  },\n  \"NUMBER_FORMATS\": {\n    \"CURRENCY_SYM\": \"$\",\n    \"DECIMAL_SEP\": \".\",\n    \"GROUP_SEP\": \",\",\n    \"PATTERNS\": [\n      {\n        \"gSize\": 3,\n        \"lgSize\": 3,\n        \"maxFrac\": 3,\n        \"minFrac\": 0,\n        \"minInt\": 1,\n        \"negPre\": \"-\",\n        \"negSuf\": \"\",\n        \"posPre\": \"\",\n        \"posSuf\": \"\"\n      },\n      {\n        \"gSize\": 3,\n        \"lgSize\": 3,\n        \"maxFrac\": 2,\n        \"minFrac\": 2,\n        \"minInt\": 1,\n        \"negPre\": \"-\\u00a4\",\n        \"negSuf\": \"\",\n        \"posPre\": \"\\u00a4\",\n        \"posSuf\": \"\"\n      }\n    ]\n  },\n  \"id\": \"en-us\",\n  \"localeID\": \"en_US\",\n  \"pluralCat\": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (i == 1 && vf.v == 0) {    return PLURAL_CATEGORY.ONE;  }  return PLURAL_CATEGORY.OTHER;}\n});\n}]);\n\n  jqLite(document).ready(function() {\n    angularInit(document, bootstrap);\n  });\n\n})(window, document);\n\n!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type=\"text/css\">@charset \"UTF-8\";[ng\\\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular/bower.json",
    "content": "{\n  \"name\": \"angular\",\n  \"version\": \"1.5.3\",\n  \"license\": \"MIT\",\n  \"main\": \"./angular.js\",\n  \"ignore\": [],\n  \"dependencies\": {\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular/index.js",
    "content": "require('./angular');\nmodule.exports = angular;\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular/package.json",
    "content": "{\n  \"name\": \"angular\",\n  \"version\": \"1.5.3\",\n  \"description\": \"HTML enhanced for web apps\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/angular/angular.js.git\"\n  },\n  \"keywords\": [\n    \"angular\",\n    \"framework\",\n    \"browser\",\n    \"client-side\"\n  ],\n  \"author\": \"Angular Core Team <angular-core+npm@google.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/angular/angular.js/issues\"\n  },\n  \"homepage\": \"http://angularjs.org\"\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-animate/.bower.json",
    "content": "{\n  \"name\": \"angular-animate\",\n  \"version\": \"1.5.3\",\n  \"license\": \"MIT\",\n  \"main\": \"./angular-animate.js\",\n  \"ignore\": [],\n  \"dependencies\": {\n    \"angular\": \"1.5.3\"\n  },\n  \"homepage\": \"https://github.com/angular/bower-angular-animate\",\n  \"_release\": \"1.5.3\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.5.3\",\n    \"commit\": \"671c738980fb0509b2b494716ccd8c004c39f368\"\n  },\n  \"_source\": \"https://github.com/angular/bower-angular-animate.git\",\n  \"_target\": \"1.5.3\",\n  \"_originalSource\": \"angular-animate\"\n}"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-animate/README.md",
    "content": "# packaged angular-animate\n\nThis repo is for distribution on `npm` and `bower`. The source for this module is in the\n[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate).\nPlease file issues and pull requests against that repo.\n\n## Install\n\nYou can install this package either with `npm` or with `bower`.\n\n### npm\n\n```shell\nnpm install angular-animate\n```\n\nThen add `ngAnimate` as a dependency for your app:\n\n```javascript\nangular.module('myApp', [require('angular-animate')]);\n```\n\n### bower\n\n```shell\nbower install angular-animate\n```\n\nThen add a `<script>` to your `index.html`:\n\n```html\n<script src=\"/bower_components/angular-animate/angular-animate.js\"></script>\n```\n\nThen add `ngAnimate` as a dependency for your app:\n\n```javascript\nangular.module('myApp', ['ngAnimate']);\n```\n\n## Documentation\n\nDocumentation is available on the\n[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate).\n\n## License\n\nThe MIT License\n\nCopyright (c) 2010-2015 Google, Inc. http://angularjs.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-animate/angular-animate.js",
    "content": "/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* jshint ignore:start */\nvar noop        = angular.noop;\nvar copy        = angular.copy;\nvar extend      = angular.extend;\nvar jqLite      = angular.element;\nvar forEach     = angular.forEach;\nvar isArray     = angular.isArray;\nvar isString    = angular.isString;\nvar isObject    = angular.isObject;\nvar isUndefined = angular.isUndefined;\nvar isDefined   = angular.isDefined;\nvar isFunction  = angular.isFunction;\nvar isElement   = angular.isElement;\n\nvar ELEMENT_NODE = 1;\nvar COMMENT_NODE = 8;\n\nvar ADD_CLASS_SUFFIX = '-add';\nvar REMOVE_CLASS_SUFFIX = '-remove';\nvar EVENT_CLASS_PREFIX = 'ng-';\nvar ACTIVE_CLASS_SUFFIX = '-active';\nvar PREPARE_CLASS_SUFFIX = '-prepare';\n\nvar NG_ANIMATE_CLASSNAME = 'ng-animate';\nvar NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren';\n\n// Detect proper transitionend/animationend event names.\nvar CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;\n\n// If unprefixed events are not supported but webkit-prefixed are, use the latter.\n// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.\n// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`\n// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.\n// Register both events in case `window.onanimationend` is not supported because of that,\n// do the same for `transitionend` as Safari is likely to exhibit similar behavior.\n// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit\n// therefore there is no reason to test anymore for other vendor prefixes:\n// http://caniuse.com/#search=transition\nif (isUndefined(window.ontransitionend) && isDefined(window.onwebkittransitionend)) {\n  CSS_PREFIX = '-webkit-';\n  TRANSITION_PROP = 'WebkitTransition';\n  TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';\n} else {\n  TRANSITION_PROP = 'transition';\n  TRANSITIONEND_EVENT = 'transitionend';\n}\n\nif (isUndefined(window.onanimationend) && isDefined(window.onwebkitanimationend)) {\n  CSS_PREFIX = '-webkit-';\n  ANIMATION_PROP = 'WebkitAnimation';\n  ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';\n} else {\n  ANIMATION_PROP = 'animation';\n  ANIMATIONEND_EVENT = 'animationend';\n}\n\nvar DURATION_KEY = 'Duration';\nvar PROPERTY_KEY = 'Property';\nvar DELAY_KEY = 'Delay';\nvar TIMING_KEY = 'TimingFunction';\nvar ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';\nvar ANIMATION_PLAYSTATE_KEY = 'PlayState';\nvar SAFE_FAST_FORWARD_DURATION_VALUE = 9999;\n\nvar ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;\nvar ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;\nvar TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;\nvar TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;\n\nvar isPromiseLike = function(p) {\n  return p && p.then ? true : false;\n};\n\nvar ngMinErr = angular.$$minErr('ng');\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction mergeClasses(a,b) {\n  if (!a && !b) return '';\n  if (!a) return b;\n  if (!b) return a;\n  if (isArray(a)) a = a.join(' ');\n  if (isArray(b)) b = b.join(' ');\n  return a + ' ' + b;\n}\n\nfunction packageStyles(options) {\n  var styles = {};\n  if (options && (options.to || options.from)) {\n    styles.to = options.to;\n    styles.from = options.from;\n  }\n  return styles;\n}\n\nfunction pendClasses(classes, fix, isPrefix) {\n  var className = '';\n  classes = isArray(classes)\n      ? classes\n      : classes && isString(classes) && classes.length\n          ? classes.split(/\\s+/)\n          : [];\n  forEach(classes, function(klass, i) {\n    if (klass && klass.length > 0) {\n      className += (i > 0) ? ' ' : '';\n      className += isPrefix ? fix + klass\n                            : klass + fix;\n    }\n  });\n  return className;\n}\n\nfunction removeFromArray(arr, val) {\n  var index = arr.indexOf(val);\n  if (val >= 0) {\n    arr.splice(index, 1);\n  }\n}\n\nfunction stripCommentsFromElement(element) {\n  if (element instanceof jqLite) {\n    switch (element.length) {\n      case 0:\n        return [];\n        break;\n\n      case 1:\n        // there is no point of stripping anything if the element\n        // is the only element within the jqLite wrapper.\n        // (it's important that we retain the element instance.)\n        if (element[0].nodeType === ELEMENT_NODE) {\n          return element;\n        }\n        break;\n\n      default:\n        return jqLite(extractElementNode(element));\n        break;\n    }\n  }\n\n  if (element.nodeType === ELEMENT_NODE) {\n    return jqLite(element);\n  }\n}\n\nfunction extractElementNode(element) {\n  if (!element[0]) return element;\n  for (var i = 0; i < element.length; i++) {\n    var elm = element[i];\n    if (elm.nodeType == ELEMENT_NODE) {\n      return elm;\n    }\n  }\n}\n\nfunction $$addClass($$jqLite, element, className) {\n  forEach(element, function(elm) {\n    $$jqLite.addClass(elm, className);\n  });\n}\n\nfunction $$removeClass($$jqLite, element, className) {\n  forEach(element, function(elm) {\n    $$jqLite.removeClass(elm, className);\n  });\n}\n\nfunction applyAnimationClassesFactory($$jqLite) {\n  return function(element, options) {\n    if (options.addClass) {\n      $$addClass($$jqLite, element, options.addClass);\n      options.addClass = null;\n    }\n    if (options.removeClass) {\n      $$removeClass($$jqLite, element, options.removeClass);\n      options.removeClass = null;\n    }\n  }\n}\n\nfunction prepareAnimationOptions(options) {\n  options = options || {};\n  if (!options.$$prepared) {\n    var domOperation = options.domOperation || noop;\n    options.domOperation = function() {\n      options.$$domOperationFired = true;\n      domOperation();\n      domOperation = noop;\n    };\n    options.$$prepared = true;\n  }\n  return options;\n}\n\nfunction applyAnimationStyles(element, options) {\n  applyAnimationFromStyles(element, options);\n  applyAnimationToStyles(element, options);\n}\n\nfunction applyAnimationFromStyles(element, options) {\n  if (options.from) {\n    element.css(options.from);\n    options.from = null;\n  }\n}\n\nfunction applyAnimationToStyles(element, options) {\n  if (options.to) {\n    element.css(options.to);\n    options.to = null;\n  }\n}\n\nfunction mergeAnimationDetails(element, oldAnimation, newAnimation) {\n  var target = oldAnimation.options || {};\n  var newOptions = newAnimation.options || {};\n\n  var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || '');\n  var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || '');\n  var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove);\n\n  if (newOptions.preparationClasses) {\n    target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses);\n    delete newOptions.preparationClasses;\n  }\n\n  // noop is basically when there is no callback; otherwise something has been set\n  var realDomOperation = target.domOperation !== noop ? target.domOperation : null;\n\n  extend(target, newOptions);\n\n  // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this.\n  if (realDomOperation) {\n    target.domOperation = realDomOperation;\n  }\n\n  if (classes.addClass) {\n    target.addClass = classes.addClass;\n  } else {\n    target.addClass = null;\n  }\n\n  if (classes.removeClass) {\n    target.removeClass = classes.removeClass;\n  } else {\n    target.removeClass = null;\n  }\n\n  oldAnimation.addClass = target.addClass;\n  oldAnimation.removeClass = target.removeClass;\n\n  return target;\n}\n\nfunction resolveElementClasses(existing, toAdd, toRemove) {\n  var ADD_CLASS = 1;\n  var REMOVE_CLASS = -1;\n\n  var flags = {};\n  existing = splitClassesToLookup(existing);\n\n  toAdd = splitClassesToLookup(toAdd);\n  forEach(toAdd, function(value, key) {\n    flags[key] = ADD_CLASS;\n  });\n\n  toRemove = splitClassesToLookup(toRemove);\n  forEach(toRemove, function(value, key) {\n    flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;\n  });\n\n  var classes = {\n    addClass: '',\n    removeClass: ''\n  };\n\n  forEach(flags, function(val, klass) {\n    var prop, allow;\n    if (val === ADD_CLASS) {\n      prop = 'addClass';\n      allow = !existing[klass];\n    } else if (val === REMOVE_CLASS) {\n      prop = 'removeClass';\n      allow = existing[klass];\n    }\n    if (allow) {\n      if (classes[prop].length) {\n        classes[prop] += ' ';\n      }\n      classes[prop] += klass;\n    }\n  });\n\n  function splitClassesToLookup(classes) {\n    if (isString(classes)) {\n      classes = classes.split(' ');\n    }\n\n    var obj = {};\n    forEach(classes, function(klass) {\n      // sometimes the split leaves empty string values\n      // incase extra spaces were applied to the options\n      if (klass.length) {\n        obj[klass] = true;\n      }\n    });\n    return obj;\n  }\n\n  return classes;\n}\n\nfunction getDomNode(element) {\n  return (element instanceof angular.element) ? element[0] : element;\n}\n\nfunction applyGeneratedPreparationClasses(element, event, options) {\n  var classes = '';\n  if (event) {\n    classes = pendClasses(event, EVENT_CLASS_PREFIX, true);\n  }\n  if (options.addClass) {\n    classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX));\n  }\n  if (options.removeClass) {\n    classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX));\n  }\n  if (classes.length) {\n    options.preparationClasses = classes;\n    element.addClass(classes);\n  }\n}\n\nfunction clearGeneratedClasses(element, options) {\n  if (options.preparationClasses) {\n    element.removeClass(options.preparationClasses);\n    options.preparationClasses = null;\n  }\n  if (options.activeClasses) {\n    element.removeClass(options.activeClasses);\n    options.activeClasses = null;\n  }\n}\n\nfunction blockTransitions(node, duration) {\n  // we use a negative delay value since it performs blocking\n  // yet it doesn't kill any existing transitions running on the\n  // same element which makes this safe for class-based animations\n  var value = duration ? '-' + duration + 's' : '';\n  applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]);\n  return [TRANSITION_DELAY_PROP, value];\n}\n\nfunction blockKeyframeAnimations(node, applyBlock) {\n  var value = applyBlock ? 'paused' : '';\n  var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;\n  applyInlineStyle(node, [key, value]);\n  return [key, value];\n}\n\nfunction applyInlineStyle(node, styleTuple) {\n  var prop = styleTuple[0];\n  var value = styleTuple[1];\n  node.style[prop] = value;\n}\n\nfunction concatWithSpace(a,b) {\n  if (!a) return b;\n  if (!b) return a;\n  return a + ' ' + b;\n}\n\nvar $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {\n  var queue, cancelFn;\n\n  function scheduler(tasks) {\n    // we make a copy since RAFScheduler mutates the state\n    // of the passed in array variable and this would be difficult\n    // to track down on the outside code\n    queue = queue.concat(tasks);\n    nextTick();\n  }\n\n  queue = scheduler.queue = [];\n\n  /* waitUntilQuiet does two things:\n   * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through\n   * 2. It will delay the next wave of tasks from running until the quiet `fn` has run.\n   *\n   * The motivation here is that animation code can request more time from the scheduler\n   * before the next wave runs. This allows for certain DOM properties such as classes to\n   * be resolved in time for the next animation to run.\n   */\n  scheduler.waitUntilQuiet = function(fn) {\n    if (cancelFn) cancelFn();\n\n    cancelFn = $$rAF(function() {\n      cancelFn = null;\n      fn();\n      nextTick();\n    });\n  };\n\n  return scheduler;\n\n  function nextTick() {\n    if (!queue.length) return;\n\n    var items = queue.shift();\n    for (var i = 0; i < items.length; i++) {\n      items[i]();\n    }\n\n    if (!cancelFn) {\n      $$rAF(function() {\n        if (!cancelFn) nextTick();\n      });\n    }\n  }\n}];\n\n/**\n * @ngdoc directive\n * @name ngAnimateChildren\n * @restrict AE\n * @element ANY\n *\n * @description\n *\n * ngAnimateChildren allows you to specify that children of this element should animate even if any\n * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move`\n * (structural) animation, child elements that also have an active structural animation are not animated.\n *\n * Note that even if `ngAnimteChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation).\n *\n *\n * @param {string} ngAnimateChildren If the value is empty, `true` or `on`,\n *     then child animations are allowed. If the value is `false`, child animations are not allowed.\n *\n * @example\n * <example module=\"ngAnimateChildren\" name=\"ngAnimateChildren\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n       <div ng-controller=\"mainController as main\">\n         <label>Show container? <input type=\"checkbox\" ng-model=\"main.enterElement\" /></label>\n         <label>Animate children? <input type=\"checkbox\" ng-model=\"main.animateChildren\" /></label>\n         <hr>\n         <div ng-animate-children=\"{{main.animateChildren}}\">\n           <div ng-if=\"main.enterElement\" class=\"container\">\n             List of items:\n             <div ng-repeat=\"item in [0, 1, 2, 3]\" class=\"item\">Item {{item}}</div>\n           </div>\n         </div>\n       </div>\n     </file>\n     <file name=\"animations.css\">\n\n      .container.ng-enter,\n      .container.ng-leave {\n        transition: all ease 1.5s;\n      }\n\n      .container.ng-enter,\n      .container.ng-leave-active {\n        opacity: 0;\n      }\n\n      .container.ng-leave,\n      .container.ng-enter-active {\n        opacity: 1;\n      }\n\n      .item {\n        background: firebrick;\n        color: #FFF;\n        margin-bottom: 10px;\n      }\n\n      .item.ng-enter,\n      .item.ng-leave {\n        transition: transform 1.5s ease;\n      }\n\n      .item.ng-enter {\n        transform: translateX(50px);\n      }\n\n      .item.ng-enter-active {\n        transform: translateX(0);\n      }\n    </file>\n    <file name=\"script.js\">\n      angular.module('ngAnimateChildren', ['ngAnimate'])\n        .controller('mainController', function() {\n          this.animateChildren = false;\n          this.enterElement = false;\n        });\n    </file>\n  </example>\n */\nvar $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {\n  return {\n    link: function(scope, element, attrs) {\n      var val = attrs.ngAnimateChildren;\n      if (angular.isString(val) && val.length === 0) { //empty attribute\n        element.data(NG_ANIMATE_CHILDREN_DATA, true);\n      } else {\n        // Interpolate and set the value, so that it is available to\n        // animations that run right after compilation\n        setData($interpolate(val)(scope));\n        attrs.$observe('ngAnimateChildren', setData);\n      }\n\n      function setData(value) {\n        value = value === 'on' || value === 'true';\n        element.data(NG_ANIMATE_CHILDREN_DATA, value);\n      }\n    }\n  };\n}];\n\nvar ANIMATE_TIMER_KEY = '$$animateCss';\n\n/**\n * @ngdoc service\n * @name $animateCss\n * @kind object\n *\n * @description\n * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes\n * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT\n * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or\n * directives to create more complex animations that can be purely driven using CSS code.\n *\n * Note that only browsers that support CSS transitions and/or keyframe animations are capable of\n * rendering animations triggered via `$animateCss` (bad news for IE9 and lower).\n *\n * ## Usage\n * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that\n * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however,\n * any automatic control over cancelling animations and/or preventing animations from being run on\n * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to\n * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger\n * the CSS animation.\n *\n * The example below shows how we can create a folding animation on an element using `ng-if`:\n *\n * ```html\n * <!-- notice the `fold-animation` CSS class -->\n * <div ng-if=\"onOff\" class=\"fold-animation\">\n *   This element will go BOOM\n * </div>\n * <button ng-click=\"onOff=true\">Fold In</button>\n * ```\n *\n * Now we create the **JavaScript animation** that will trigger the CSS transition:\n *\n * ```js\n * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element, doneFn) {\n *       var height = element[0].offsetHeight;\n *       return $animateCss(element, {\n *         from: { height:'0px' },\n *         to: { height:height + 'px' },\n *         duration: 1 // one second\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * ## More Advanced Uses\n *\n * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks\n * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code.\n *\n * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation,\n * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with\n * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order\n * to provide a working animation that will run in CSS.\n *\n * The example below showcases a more advanced version of the `.fold-animation` from the example above:\n *\n * ```js\n * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element, doneFn) {\n *       var height = element[0].offsetHeight;\n *       return $animateCss(element, {\n *         addClass: 'red large-text pulse-twice',\n *         easing: 'ease-out',\n *         from: { height:'0px' },\n *         to: { height:height + 'px' },\n *         duration: 1 // one second\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * Since we're adding/removing CSS classes then the CSS transition will also pick those up:\n *\n * ```css\n * /&#42; since a hardcoded duration value of 1 was provided in the JavaScript animation code,\n * the CSS classes below will be transitioned despite them being defined as regular CSS classes &#42;/\n * .red { background:red; }\n * .large-text { font-size:20px; }\n *\n * /&#42; we can also use a keyframe animation and $animateCss will make it work alongside the transition &#42;/\n * .pulse-twice {\n *   animation: 0.5s pulse linear 2;\n *   -webkit-animation: 0.5s pulse linear 2;\n * }\n *\n * @keyframes pulse {\n *   from { transform: scale(0.5); }\n *   to { transform: scale(1.5); }\n * }\n *\n * @-webkit-keyframes pulse {\n *   from { -webkit-transform: scale(0.5); }\n *   to { -webkit-transform: scale(1.5); }\n * }\n * ```\n *\n * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen.\n *\n * ## How the Options are handled\n *\n * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation\n * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline\n * styles using the `from` and `to` properties.\n *\n * ```js\n * var animator = $animateCss(element, {\n *   from: { background:'red' },\n *   to: { background:'blue' }\n * });\n * animator.start();\n * ```\n *\n * ```css\n * .rotating-animation {\n *   animation:0.5s rotate linear;\n *   -webkit-animation:0.5s rotate linear;\n * }\n *\n * @keyframes rotate {\n *   from { transform: rotate(0deg); }\n *   to { transform: rotate(360deg); }\n * }\n *\n * @-webkit-keyframes rotate {\n *   from { -webkit-transform: rotate(0deg); }\n *   to { -webkit-transform: rotate(360deg); }\n * }\n * ```\n *\n * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is\n * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition\n * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition\n * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied\n * and spread across the transition and keyframe animation.\n *\n * ## What is returned\n *\n * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually\n * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are\n * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties:\n *\n * ```js\n * var animator = $animateCss(element, { ... });\n * ```\n *\n * Now what do the contents of our `animator` variable look like:\n *\n * ```js\n * {\n *   // starts the animation\n *   start: Function,\n *\n *   // ends (aborts) the animation\n *   end: Function\n * }\n * ```\n *\n * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends.\n * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been\n * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties\n * and that changing them will not reconfigure the parameters of the animation.\n *\n * ### runner.done() vs runner.then()\n * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the\n * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**.\n * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()`\n * unless you really need a digest to kick off afterwards.\n *\n * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss\n * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code).\n * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works.\n *\n * @param {DOMElement} element the element that will be animated\n * @param {object} options the animation-related options that will be applied during the animation\n *\n * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied\n * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.)\n * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and\n * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted.\n * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both).\n * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`).\n * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`).\n * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation.\n * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.\n * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation.\n * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation.\n * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0`\n * is provided then the animation will be skipped entirely.\n * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is\n * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value\n * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same\n * CSS delay value.\n * * `stagger` - A numeric time value representing the delay between successively animated elements\n * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.})\n * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a\n *   `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)\n * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.)\n * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once\n *    the animation is closed. This is useful for when the styles are used purely for the sake of\n *    the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation).\n *    By default this value is set to `false`.\n *\n * @return {object} an object with start and end methods and details about the animation.\n *\n * * `start` - The method to start the animation. This will return a `Promise` when called.\n * * `end` - This method will cancel the animation and remove all applied CSS classes and styles.\n */\nvar ONE_SECOND = 1000;\nvar BASE_TEN = 10;\n\nvar ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;\nvar CLOSING_TIME_BUFFER = 1.5;\n\nvar DETECT_CSS_PROPERTIES = {\n  transitionDuration:      TRANSITION_DURATION_PROP,\n  transitionDelay:         TRANSITION_DELAY_PROP,\n  transitionProperty:      TRANSITION_PROP + PROPERTY_KEY,\n  animationDuration:       ANIMATION_DURATION_PROP,\n  animationDelay:          ANIMATION_DELAY_PROP,\n  animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY\n};\n\nvar DETECT_STAGGER_CSS_PROPERTIES = {\n  transitionDuration:      TRANSITION_DURATION_PROP,\n  transitionDelay:         TRANSITION_DELAY_PROP,\n  animationDuration:       ANIMATION_DURATION_PROP,\n  animationDelay:          ANIMATION_DELAY_PROP\n};\n\nfunction getCssKeyframeDurationStyle(duration) {\n  return [ANIMATION_DURATION_PROP, duration + 's'];\n}\n\nfunction getCssDelayStyle(delay, isKeyframeAnimation) {\n  var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP;\n  return [prop, delay + 's'];\n}\n\nfunction computeCssStyles($window, element, properties) {\n  var styles = Object.create(null);\n  var detectedStyles = $window.getComputedStyle(element) || {};\n  forEach(properties, function(formalStyleName, actualStyleName) {\n    var val = detectedStyles[formalStyleName];\n    if (val) {\n      var c = val.charAt(0);\n\n      // only numerical-based values have a negative sign or digit as the first value\n      if (c === '-' || c === '+' || c >= 0) {\n        val = parseMaxTime(val);\n      }\n\n      // by setting this to null in the event that the delay is not set or is set directly as 0\n      // then we can still allow for negative values to be used later on and not mistake this\n      // value for being greater than any other negative value.\n      if (val === 0) {\n        val = null;\n      }\n      styles[actualStyleName] = val;\n    }\n  });\n\n  return styles;\n}\n\nfunction parseMaxTime(str) {\n  var maxValue = 0;\n  var values = str.split(/\\s*,\\s*/);\n  forEach(values, function(value) {\n    // it's always safe to consider only second values and omit `ms` values since\n    // getComputedStyle will always handle the conversion for us\n    if (value.charAt(value.length - 1) == 's') {\n      value = value.substring(0, value.length - 1);\n    }\n    value = parseFloat(value) || 0;\n    maxValue = maxValue ? Math.max(value, maxValue) : value;\n  });\n  return maxValue;\n}\n\nfunction truthyTimingValue(val) {\n  return val === 0 || val != null;\n}\n\nfunction getCssTransitionDurationStyle(duration, applyOnlyDuration) {\n  var style = TRANSITION_PROP;\n  var value = duration + 's';\n  if (applyOnlyDuration) {\n    style += DURATION_KEY;\n  } else {\n    value += ' linear all';\n  }\n  return [style, value];\n}\n\nfunction createLocalCacheLookup() {\n  var cache = Object.create(null);\n  return {\n    flush: function() {\n      cache = Object.create(null);\n    },\n\n    count: function(key) {\n      var entry = cache[key];\n      return entry ? entry.total : 0;\n    },\n\n    get: function(key) {\n      var entry = cache[key];\n      return entry && entry.value;\n    },\n\n    put: function(key, value) {\n      if (!cache[key]) {\n        cache[key] = { total: 1, value: value };\n      } else {\n        cache[key].total++;\n      }\n    }\n  };\n}\n\n// we do not reassign an already present style value since\n// if we detect the style property value again we may be\n// detecting styles that were added via the `from` styles.\n// We make use of `isDefined` here since an empty string\n// or null value (which is what getPropertyValue will return\n// for a non-existing style) will still be marked as a valid\n// value for the style (a falsy value implies that the style\n// is to be removed at the end of the animation). If we had a simple\n// \"OR\" statement then it would not be enough to catch that.\nfunction registerRestorableStyles(backup, node, properties) {\n  forEach(properties, function(prop) {\n    backup[prop] = isDefined(backup[prop])\n        ? backup[prop]\n        : node.style.getPropertyValue(prop);\n  });\n}\n\nvar $AnimateCssProvider = ['$animateProvider', function($animateProvider) {\n  var gcsLookup = createLocalCacheLookup();\n  var gcsStaggerLookup = createLocalCacheLookup();\n\n  this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',\n               '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue',\n       function($window,   $$jqLite,   $$AnimateRunner,   $timeout,\n                $$forceReflow,   $sniffer,   $$rAFScheduler, $$animateQueue) {\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    var parentCounter = 0;\n    function gcsHashFn(node, extraClasses) {\n      var KEY = \"$$ngAnimateParentKey\";\n      var parentNode = node.parentNode;\n      var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter);\n      return parentID + '-' + node.getAttribute('class') + '-' + extraClasses;\n    }\n\n    function computeCachedCssStyles(node, className, cacheKey, properties) {\n      var timings = gcsLookup.get(cacheKey);\n\n      if (!timings) {\n        timings = computeCssStyles($window, node, properties);\n        if (timings.animationIterationCount === 'infinite') {\n          timings.animationIterationCount = 1;\n        }\n      }\n\n      // we keep putting this in multiple times even though the value and the cacheKey are the same\n      // because we're keeping an internal tally of how many duplicate animations are detected.\n      gcsLookup.put(cacheKey, timings);\n      return timings;\n    }\n\n    function computeCachedCssStaggerStyles(node, className, cacheKey, properties) {\n      var stagger;\n\n      // if we have one or more existing matches of matching elements\n      // containing the same parent + CSS styles (which is how cacheKey works)\n      // then staggering is possible\n      if (gcsLookup.count(cacheKey) > 0) {\n        stagger = gcsStaggerLookup.get(cacheKey);\n\n        if (!stagger) {\n          var staggerClassName = pendClasses(className, '-stagger');\n\n          $$jqLite.addClass(node, staggerClassName);\n\n          stagger = computeCssStyles($window, node, properties);\n\n          // force the conversion of a null value to zero incase not set\n          stagger.animationDuration = Math.max(stagger.animationDuration, 0);\n          stagger.transitionDuration = Math.max(stagger.transitionDuration, 0);\n\n          $$jqLite.removeClass(node, staggerClassName);\n\n          gcsStaggerLookup.put(cacheKey, stagger);\n        }\n      }\n\n      return stagger || {};\n    }\n\n    var cancelLastRAFRequest;\n    var rafWaitQueue = [];\n    function waitUntilQuiet(callback) {\n      rafWaitQueue.push(callback);\n      $$rAFScheduler.waitUntilQuiet(function() {\n        gcsLookup.flush();\n        gcsStaggerLookup.flush();\n\n        // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable.\n        // PLEASE EXAMINE THE `$$forceReflow` service to understand why.\n        var pageWidth = $$forceReflow();\n\n        // we use a for loop to ensure that if the queue is changed\n        // during this looping then it will consider new requests\n        for (var i = 0; i < rafWaitQueue.length; i++) {\n          rafWaitQueue[i](pageWidth);\n        }\n        rafWaitQueue.length = 0;\n      });\n    }\n\n    function computeTimings(node, className, cacheKey) {\n      var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES);\n      var aD = timings.animationDelay;\n      var tD = timings.transitionDelay;\n      timings.maxDelay = aD && tD\n          ? Math.max(aD, tD)\n          : (aD || tD);\n      timings.maxDuration = Math.max(\n          timings.animationDuration * timings.animationIterationCount,\n          timings.transitionDuration);\n\n      return timings;\n    }\n\n    return function init(element, initialOptions) {\n      // all of the animation functions should create\n      // a copy of the options data, however, if a\n      // parent service has already created a copy then\n      // we should stick to using that\n      var options = initialOptions || {};\n      if (!options.$$prepared) {\n        options = prepareAnimationOptions(copy(options));\n      }\n\n      var restoreStyles = {};\n      var node = getDomNode(element);\n      if (!node\n          || !node.parentNode\n          || !$$animateQueue.enabled()) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var temporaryStyles = [];\n      var classes = element.attr('class');\n      var styles = packageStyles(options);\n      var animationClosed;\n      var animationPaused;\n      var animationCompleted;\n      var runner;\n      var runnerHost;\n      var maxDelay;\n      var maxDelayTime;\n      var maxDuration;\n      var maxDurationTime;\n      var startTime;\n      var events = [];\n\n      if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var method = options.event && isArray(options.event)\n            ? options.event.join(' ')\n            : options.event;\n\n      var isStructural = method && options.structural;\n      var structuralClassName = '';\n      var addRemoveClassName = '';\n\n      if (isStructural) {\n        structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true);\n      } else if (method) {\n        structuralClassName = method;\n      }\n\n      if (options.addClass) {\n        addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX);\n      }\n\n      if (options.removeClass) {\n        if (addRemoveClassName.length) {\n          addRemoveClassName += ' ';\n        }\n        addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX);\n      }\n\n      // there may be a situation where a structural animation is combined together\n      // with CSS classes that need to resolve before the animation is computed.\n      // However this means that there is no explicit CSS code to block the animation\n      // from happening (by setting 0s none in the class name). If this is the case\n      // we need to apply the classes before the first rAF so we know to continue if\n      // there actually is a detected transition or keyframe animation\n      if (options.applyClassesEarly && addRemoveClassName.length) {\n        applyAnimationClasses(element, options);\n      }\n\n      var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim();\n      var fullClassName = classes + ' ' + preparationClasses;\n      var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);\n      var hasToStyles = styles.to && Object.keys(styles.to).length > 0;\n      var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0;\n\n      // there is no way we can trigger an animation if no styles and\n      // no classes are being applied which would then trigger a transition,\n      // unless there a is raw keyframe value that is applied to the element.\n      if (!containsKeyframeAnimation\n           && !hasToStyles\n           && !preparationClasses) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var cacheKey, stagger;\n      if (options.stagger > 0) {\n        var staggerVal = parseFloat(options.stagger);\n        stagger = {\n          transitionDelay: staggerVal,\n          animationDelay: staggerVal,\n          transitionDuration: 0,\n          animationDuration: 0\n        };\n      } else {\n        cacheKey = gcsHashFn(node, fullClassName);\n        stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES);\n      }\n\n      if (!options.$$skipPreparationClasses) {\n        $$jqLite.addClass(element, preparationClasses);\n      }\n\n      var applyOnlyDuration;\n\n      if (options.transitionStyle) {\n        var transitionStyle = [TRANSITION_PROP, options.transitionStyle];\n        applyInlineStyle(node, transitionStyle);\n        temporaryStyles.push(transitionStyle);\n      }\n\n      if (options.duration >= 0) {\n        applyOnlyDuration = node.style[TRANSITION_PROP].length > 0;\n        var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration);\n\n        // we set the duration so that it will be picked up by getComputedStyle later\n        applyInlineStyle(node, durationStyle);\n        temporaryStyles.push(durationStyle);\n      }\n\n      if (options.keyframeStyle) {\n        var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle];\n        applyInlineStyle(node, keyframeStyle);\n        temporaryStyles.push(keyframeStyle);\n      }\n\n      var itemIndex = stagger\n          ? options.staggerIndex >= 0\n              ? options.staggerIndex\n              : gcsLookup.count(cacheKey)\n          : 0;\n\n      var isFirst = itemIndex === 0;\n\n      // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY\n      // without causing any combination of transitions to kick in. By adding a negative delay value\n      // it forces the setup class' transition to end immediately. We later then remove the negative\n      // transition delay to allow for the transition to naturally do it's thing. The beauty here is\n      // that if there is no transition defined then nothing will happen and this will also allow\n      // other transitions to be stacked on top of each other without any chopping them out.\n      if (isFirst && !options.skipBlocking) {\n        blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);\n      }\n\n      var timings = computeTimings(node, fullClassName, cacheKey);\n      var relativeDelay = timings.maxDelay;\n      maxDelay = Math.max(relativeDelay, 0);\n      maxDuration = timings.maxDuration;\n\n      var flags = {};\n      flags.hasTransitions          = timings.transitionDuration > 0;\n      flags.hasAnimations           = timings.animationDuration > 0;\n      flags.hasTransitionAll        = flags.hasTransitions && timings.transitionProperty == 'all';\n      flags.applyTransitionDuration = hasToStyles && (\n                                        (flags.hasTransitions && !flags.hasTransitionAll)\n                                         || (flags.hasAnimations && !flags.hasTransitions));\n      flags.applyAnimationDuration  = options.duration && flags.hasAnimations;\n      flags.applyTransitionDelay    = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions);\n      flags.applyAnimationDelay     = truthyTimingValue(options.delay) && flags.hasAnimations;\n      flags.recalculateTimingStyles = addRemoveClassName.length > 0;\n\n      if (flags.applyTransitionDuration || flags.applyAnimationDuration) {\n        maxDuration = options.duration ? parseFloat(options.duration) : maxDuration;\n\n        if (flags.applyTransitionDuration) {\n          flags.hasTransitions = true;\n          timings.transitionDuration = maxDuration;\n          applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0;\n          temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration));\n        }\n\n        if (flags.applyAnimationDuration) {\n          flags.hasAnimations = true;\n          timings.animationDuration = maxDuration;\n          temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration));\n        }\n      }\n\n      if (maxDuration === 0 && !flags.recalculateTimingStyles) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      if (options.delay != null) {\n        var delayStyle;\n        if (typeof options.delay !== \"boolean\") {\n          delayStyle = parseFloat(options.delay);\n          // number in options.delay means we have to recalculate the delay for the closing timeout\n          maxDelay = Math.max(delayStyle, 0);\n        }\n\n        if (flags.applyTransitionDelay) {\n          temporaryStyles.push(getCssDelayStyle(delayStyle));\n        }\n\n        if (flags.applyAnimationDelay) {\n          temporaryStyles.push(getCssDelayStyle(delayStyle, true));\n        }\n      }\n\n      // we need to recalculate the delay value since we used a pre-emptive negative\n      // delay value and the delay value is required for the final event checking. This\n      // property will ensure that this will happen after the RAF phase has passed.\n      if (options.duration == null && timings.transitionDuration > 0) {\n        flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst;\n      }\n\n      maxDelayTime = maxDelay * ONE_SECOND;\n      maxDurationTime = maxDuration * ONE_SECOND;\n      if (!options.skipBlocking) {\n        flags.blockTransition = timings.transitionDuration > 0;\n        flags.blockKeyframeAnimation = timings.animationDuration > 0 &&\n                                       stagger.animationDelay > 0 &&\n                                       stagger.animationDuration === 0;\n      }\n\n      if (options.from) {\n        if (options.cleanupStyles) {\n          registerRestorableStyles(restoreStyles, node, Object.keys(options.from));\n        }\n        applyAnimationFromStyles(element, options);\n      }\n\n      if (flags.blockTransition || flags.blockKeyframeAnimation) {\n        applyBlocking(maxDuration);\n      } else if (!options.skipBlocking) {\n        blockTransitions(node, false);\n      }\n\n      // TODO(matsko): for 1.5 change this code to have an animator object for better debugging\n      return {\n        $$willAnimate: true,\n        end: endFn,\n        start: function() {\n          if (animationClosed) return;\n\n          runnerHost = {\n            end: endFn,\n            cancel: cancelFn,\n            resume: null, //this will be set during the start() phase\n            pause: null\n          };\n\n          runner = new $$AnimateRunner(runnerHost);\n\n          waitUntilQuiet(start);\n\n          // we don't have access to pause/resume the animation\n          // since it hasn't run yet. AnimateRunner will therefore\n          // set noop functions for resume and pause and they will\n          // later be overridden once the animation is triggered\n          return runner;\n        }\n      };\n\n      function endFn() {\n        close();\n      }\n\n      function cancelFn() {\n        close(true);\n      }\n\n      function close(rejected) { // jshint ignore:line\n        // if the promise has been called already then we shouldn't close\n        // the animation again\n        if (animationClosed || (animationCompleted && animationPaused)) return;\n        animationClosed = true;\n        animationPaused = false;\n\n        if (!options.$$skipPreparationClasses) {\n          $$jqLite.removeClass(element, preparationClasses);\n        }\n        $$jqLite.removeClass(element, activeClasses);\n\n        blockKeyframeAnimations(node, false);\n        blockTransitions(node, false);\n\n        forEach(temporaryStyles, function(entry) {\n          // There is only one way to remove inline style properties entirely from elements.\n          // By using `removeProperty` this works, but we need to convert camel-cased CSS\n          // styles down to hyphenated values.\n          node.style[entry[0]] = '';\n        });\n\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n\n        if (Object.keys(restoreStyles).length) {\n          forEach(restoreStyles, function(value, prop) {\n            value ? node.style.setProperty(prop, value)\n                  : node.style.removeProperty(prop);\n          });\n        }\n\n        // the reason why we have this option is to allow a synchronous closing callback\n        // that is fired as SOON as the animation ends (when the CSS is removed) or if\n        // the animation never takes off at all. A good example is a leave animation since\n        // the element must be removed just after the animation is over or else the element\n        // will appear on screen for one animation frame causing an overbearing flicker.\n        if (options.onDone) {\n          options.onDone();\n        }\n\n        if (events && events.length) {\n          // Remove the transitionend / animationend listener(s)\n          element.off(events.join(' '), onAnimationProgress);\n        }\n\n        //Cancel the fallback closing timeout and remove the timer data\n        var animationTimerData = element.data(ANIMATE_TIMER_KEY);\n        if (animationTimerData) {\n          $timeout.cancel(animationTimerData[0].timer);\n          element.removeData(ANIMATE_TIMER_KEY);\n        }\n\n        // if the preparation function fails then the promise is not setup\n        if (runner) {\n          runner.complete(!rejected);\n        }\n      }\n\n      function applyBlocking(duration) {\n        if (flags.blockTransition) {\n          blockTransitions(node, duration);\n        }\n\n        if (flags.blockKeyframeAnimation) {\n          blockKeyframeAnimations(node, !!duration);\n        }\n      }\n\n      function closeAndReturnNoopAnimator() {\n        runner = new $$AnimateRunner({\n          end: endFn,\n          cancel: cancelFn\n        });\n\n        // should flush the cache animation\n        waitUntilQuiet(noop);\n        close();\n\n        return {\n          $$willAnimate: false,\n          start: function() {\n            return runner;\n          },\n          end: endFn\n        };\n      }\n\n      function onAnimationProgress(event) {\n        event.stopPropagation();\n        var ev = event.originalEvent || event;\n\n        // we now always use `Date.now()` due to the recent changes with\n        // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info)\n        var timeStamp = ev.$manualTimeStamp || Date.now();\n\n        /* Firefox (or possibly just Gecko) likes to not round values up\n         * when a ms measurement is used for the animation */\n        var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));\n\n        /* $manualTimeStamp is a mocked timeStamp value which is set\n         * within browserTrigger(). This is only here so that tests can\n         * mock animations properly. Real events fallback to event.timeStamp,\n         * or, if they don't, then a timeStamp is automatically created for them.\n         * We're checking to see if the timeStamp surpasses the expected delay,\n         * but we're using elapsedTime instead of the timeStamp on the 2nd\n         * pre-condition since animationPauseds sometimes close off early */\n        if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {\n          // we set this flag to ensure that if the transition is paused then, when resumed,\n          // the animation will automatically close itself since transitions cannot be paused.\n          animationCompleted = true;\n          close();\n        }\n      }\n\n      function start() {\n        if (animationClosed) return;\n        if (!node.parentNode) {\n          close();\n          return;\n        }\n\n        // even though we only pause keyframe animations here the pause flag\n        // will still happen when transitions are used. Only the transition will\n        // not be paused since that is not possible. If the animation ends when\n        // paused then it will not complete until unpaused or cancelled.\n        var playPause = function(playAnimation) {\n          if (!animationCompleted) {\n            animationPaused = !playAnimation;\n            if (timings.animationDuration) {\n              var value = blockKeyframeAnimations(node, animationPaused);\n              animationPaused\n                  ? temporaryStyles.push(value)\n                  : removeFromArray(temporaryStyles, value);\n            }\n          } else if (animationPaused && playAnimation) {\n            animationPaused = false;\n            close();\n          }\n        };\n\n        // checking the stagger duration prevents an accidentally cascade of the CSS delay style\n        // being inherited from the parent. If the transition duration is zero then we can safely\n        // rely that the delay value is an intentional stagger delay style.\n        var maxStagger = itemIndex > 0\n                         && ((timings.transitionDuration && stagger.transitionDuration === 0) ||\n                            (timings.animationDuration && stagger.animationDuration === 0))\n                         && Math.max(stagger.animationDelay, stagger.transitionDelay);\n        if (maxStagger) {\n          $timeout(triggerAnimationStart,\n                   Math.floor(maxStagger * itemIndex * ONE_SECOND),\n                   false);\n        } else {\n          triggerAnimationStart();\n        }\n\n        // this will decorate the existing promise runner with pause/resume methods\n        runnerHost.resume = function() {\n          playPause(true);\n        };\n\n        runnerHost.pause = function() {\n          playPause(false);\n        };\n\n        function triggerAnimationStart() {\n          // just incase a stagger animation kicks in when the animation\n          // itself was cancelled entirely\n          if (animationClosed) return;\n\n          applyBlocking(false);\n\n          forEach(temporaryStyles, function(entry) {\n            var key = entry[0];\n            var value = entry[1];\n            node.style[key] = value;\n          });\n\n          applyAnimationClasses(element, options);\n          $$jqLite.addClass(element, activeClasses);\n\n          if (flags.recalculateTimingStyles) {\n            fullClassName = node.className + ' ' + preparationClasses;\n            cacheKey = gcsHashFn(node, fullClassName);\n\n            timings = computeTimings(node, fullClassName, cacheKey);\n            relativeDelay = timings.maxDelay;\n            maxDelay = Math.max(relativeDelay, 0);\n            maxDuration = timings.maxDuration;\n\n            if (maxDuration === 0) {\n              close();\n              return;\n            }\n\n            flags.hasTransitions = timings.transitionDuration > 0;\n            flags.hasAnimations = timings.animationDuration > 0;\n          }\n\n          if (flags.applyAnimationDelay) {\n            relativeDelay = typeof options.delay !== \"boolean\" && truthyTimingValue(options.delay)\n                  ? parseFloat(options.delay)\n                  : relativeDelay;\n\n            maxDelay = Math.max(relativeDelay, 0);\n            timings.animationDelay = relativeDelay;\n            delayStyle = getCssDelayStyle(relativeDelay, true);\n            temporaryStyles.push(delayStyle);\n            node.style[delayStyle[0]] = delayStyle[1];\n          }\n\n          maxDelayTime = maxDelay * ONE_SECOND;\n          maxDurationTime = maxDuration * ONE_SECOND;\n\n          if (options.easing) {\n            var easeProp, easeVal = options.easing;\n            if (flags.hasTransitions) {\n              easeProp = TRANSITION_PROP + TIMING_KEY;\n              temporaryStyles.push([easeProp, easeVal]);\n              node.style[easeProp] = easeVal;\n            }\n            if (flags.hasAnimations) {\n              easeProp = ANIMATION_PROP + TIMING_KEY;\n              temporaryStyles.push([easeProp, easeVal]);\n              node.style[easeProp] = easeVal;\n            }\n          }\n\n          if (timings.transitionDuration) {\n            events.push(TRANSITIONEND_EVENT);\n          }\n\n          if (timings.animationDuration) {\n            events.push(ANIMATIONEND_EVENT);\n          }\n\n          startTime = Date.now();\n          var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime;\n          var endTime = startTime + timerTime;\n\n          var animationsData = element.data(ANIMATE_TIMER_KEY) || [];\n          var setupFallbackTimer = true;\n          if (animationsData.length) {\n            var currentTimerData = animationsData[0];\n            setupFallbackTimer = endTime > currentTimerData.expectedEndTime;\n            if (setupFallbackTimer) {\n              $timeout.cancel(currentTimerData.timer);\n            } else {\n              animationsData.push(close);\n            }\n          }\n\n          if (setupFallbackTimer) {\n            var timer = $timeout(onAnimationExpired, timerTime, false);\n            animationsData[0] = {\n              timer: timer,\n              expectedEndTime: endTime\n            };\n            animationsData.push(close);\n            element.data(ANIMATE_TIMER_KEY, animationsData);\n          }\n\n          if (events.length) {\n            element.on(events.join(' '), onAnimationProgress);\n          }\n\n          if (options.to) {\n            if (options.cleanupStyles) {\n              registerRestorableStyles(restoreStyles, node, Object.keys(options.to));\n            }\n            applyAnimationToStyles(element, options);\n          }\n        }\n\n        function onAnimationExpired() {\n          var animationsData = element.data(ANIMATE_TIMER_KEY);\n\n          // this will be false in the event that the element was\n          // removed from the DOM (via a leave animation or something\n          // similar)\n          if (animationsData) {\n            for (var i = 1; i < animationsData.length; i++) {\n              animationsData[i]();\n            }\n            element.removeData(ANIMATE_TIMER_KEY);\n          }\n        }\n      }\n    };\n  }];\n}];\n\nvar $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) {\n  $$animationProvider.drivers.push('$$animateCssDriver');\n\n  var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim';\n  var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor';\n\n  var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out';\n  var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in';\n\n  function isDocumentFragment(node) {\n    return node.parentNode && node.parentNode.nodeType === 11;\n  }\n\n  this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document',\n       function($animateCss,   $rootScope,   $$AnimateRunner,   $rootElement,   $sniffer,   $$jqLite,   $document) {\n\n    // only browsers that support these properties can render animations\n    if (!$sniffer.animations && !$sniffer.transitions) return noop;\n\n    var bodyNode = $document[0].body;\n    var rootNode = getDomNode($rootElement);\n\n    var rootBodyElement = jqLite(\n      // this is to avoid using something that exists outside of the body\n      // we also special case the doc fragment case because our unit test code\n      // appends the $rootElement to the body after the app has been bootstrapped\n      isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode\n    );\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    return function initDriverFn(animationDetails) {\n      return animationDetails.from && animationDetails.to\n          ? prepareFromToAnchorAnimation(animationDetails.from,\n                                         animationDetails.to,\n                                         animationDetails.classes,\n                                         animationDetails.anchors)\n          : prepareRegularAnimation(animationDetails);\n    };\n\n    function filterCssClasses(classes) {\n      //remove all the `ng-` stuff\n      return classes.replace(/\\bng-\\S+\\b/g, '');\n    }\n\n    function getUniqueValues(a, b) {\n      if (isString(a)) a = a.split(' ');\n      if (isString(b)) b = b.split(' ');\n      return a.filter(function(val) {\n        return b.indexOf(val) === -1;\n      }).join(' ');\n    }\n\n    function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {\n      var clone = jqLite(getDomNode(outAnchor).cloneNode(true));\n      var startingClasses = filterCssClasses(getClassVal(clone));\n\n      outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);\n      inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);\n\n      clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);\n\n      rootBodyElement.append(clone);\n\n      var animatorIn, animatorOut = prepareOutAnimation();\n\n      // the user may not end up using the `out` animation and\n      // only making use of the `in` animation or vice-versa.\n      // In either case we should allow this and not assume the\n      // animation is over unless both animations are not used.\n      if (!animatorOut) {\n        animatorIn = prepareInAnimation();\n        if (!animatorIn) {\n          return end();\n        }\n      }\n\n      var startingAnimator = animatorOut || animatorIn;\n\n      return {\n        start: function() {\n          var runner;\n\n          var currentAnimation = startingAnimator.start();\n          currentAnimation.done(function() {\n            currentAnimation = null;\n            if (!animatorIn) {\n              animatorIn = prepareInAnimation();\n              if (animatorIn) {\n                currentAnimation = animatorIn.start();\n                currentAnimation.done(function() {\n                  currentAnimation = null;\n                  end();\n                  runner.complete();\n                });\n                return currentAnimation;\n              }\n            }\n            // in the event that there is no `in` animation\n            end();\n            runner.complete();\n          });\n\n          runner = new $$AnimateRunner({\n            end: endFn,\n            cancel: endFn\n          });\n\n          return runner;\n\n          function endFn() {\n            if (currentAnimation) {\n              currentAnimation.end();\n            }\n          }\n        }\n      };\n\n      function calculateAnchorStyles(anchor) {\n        var styles = {};\n\n        var coords = getDomNode(anchor).getBoundingClientRect();\n\n        // we iterate directly since safari messes up and doesn't return\n        // all the keys for the coords object when iterated\n        forEach(['width','height','top','left'], function(key) {\n          var value = coords[key];\n          switch (key) {\n            case 'top':\n              value += bodyNode.scrollTop;\n              break;\n            case 'left':\n              value += bodyNode.scrollLeft;\n              break;\n          }\n          styles[key] = Math.floor(value) + 'px';\n        });\n        return styles;\n      }\n\n      function prepareOutAnimation() {\n        var animator = $animateCss(clone, {\n          addClass: NG_OUT_ANCHOR_CLASS_NAME,\n          delay: true,\n          from: calculateAnchorStyles(outAnchor)\n        });\n\n        // read the comment within `prepareRegularAnimation` to understand\n        // why this check is necessary\n        return animator.$$willAnimate ? animator : null;\n      }\n\n      function getClassVal(element) {\n        return element.attr('class') || '';\n      }\n\n      function prepareInAnimation() {\n        var endingClasses = filterCssClasses(getClassVal(inAnchor));\n        var toAdd = getUniqueValues(endingClasses, startingClasses);\n        var toRemove = getUniqueValues(startingClasses, endingClasses);\n\n        var animator = $animateCss(clone, {\n          to: calculateAnchorStyles(inAnchor),\n          addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd,\n          removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove,\n          delay: true\n        });\n\n        // read the comment within `prepareRegularAnimation` to understand\n        // why this check is necessary\n        return animator.$$willAnimate ? animator : null;\n      }\n\n      function end() {\n        clone.remove();\n        outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);\n        inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);\n      }\n    }\n\n    function prepareFromToAnchorAnimation(from, to, classes, anchors) {\n      var fromAnimation = prepareRegularAnimation(from, noop);\n      var toAnimation = prepareRegularAnimation(to, noop);\n\n      var anchorAnimations = [];\n      forEach(anchors, function(anchor) {\n        var outElement = anchor['out'];\n        var inElement = anchor['in'];\n        var animator = prepareAnchoredAnimation(classes, outElement, inElement);\n        if (animator) {\n          anchorAnimations.push(animator);\n        }\n      });\n\n      // no point in doing anything when there are no elements to animate\n      if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return;\n\n      return {\n        start: function() {\n          var animationRunners = [];\n\n          if (fromAnimation) {\n            animationRunners.push(fromAnimation.start());\n          }\n\n          if (toAnimation) {\n            animationRunners.push(toAnimation.start());\n          }\n\n          forEach(anchorAnimations, function(animation) {\n            animationRunners.push(animation.start());\n          });\n\n          var runner = new $$AnimateRunner({\n            end: endFn,\n            cancel: endFn // CSS-driven animations cannot be cancelled, only ended\n          });\n\n          $$AnimateRunner.all(animationRunners, function(status) {\n            runner.complete(status);\n          });\n\n          return runner;\n\n          function endFn() {\n            forEach(animationRunners, function(runner) {\n              runner.end();\n            });\n          }\n        }\n      };\n    }\n\n    function prepareRegularAnimation(animationDetails) {\n      var element = animationDetails.element;\n      var options = animationDetails.options || {};\n\n      if (animationDetails.structural) {\n        options.event = animationDetails.event;\n        options.structural = true;\n        options.applyClassesEarly = true;\n\n        // we special case the leave animation since we want to ensure that\n        // the element is removed as soon as the animation is over. Otherwise\n        // a flicker might appear or the element may not be removed at all\n        if (animationDetails.event === 'leave') {\n          options.onDone = options.domOperation;\n        }\n      }\n\n      // We assign the preparationClasses as the actual animation event since\n      // the internals of $animateCss will just suffix the event token values\n      // with `-active` to trigger the animation.\n      if (options.preparationClasses) {\n        options.event = concatWithSpace(options.event, options.preparationClasses);\n      }\n\n      var animator = $animateCss(element, options);\n\n      // the driver lookup code inside of $$animation attempts to spawn a\n      // driver one by one until a driver returns a.$$willAnimate animator object.\n      // $animateCss will always return an object, however, it will pass in\n      // a flag as a hint as to whether an animation was detected or not\n      return animator.$$willAnimate ? animator : null;\n    }\n  }];\n}];\n\n// TODO(matsko): use caching here to speed things up for detection\n// TODO(matsko): add documentation\n//  by the time...\n\nvar $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {\n  this.$get = ['$injector', '$$AnimateRunner', '$$jqLite',\n       function($injector,   $$AnimateRunner,   $$jqLite) {\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n         // $animateJs(element, 'enter');\n    return function(element, event, classes, options) {\n      var animationClosed = false;\n\n      // the `classes` argument is optional and if it is not used\n      // then the classes will be resolved from the element's className\n      // property as well as options.addClass/options.removeClass.\n      if (arguments.length === 3 && isObject(classes)) {\n        options = classes;\n        classes = null;\n      }\n\n      options = prepareAnimationOptions(options);\n      if (!classes) {\n        classes = element.attr('class') || '';\n        if (options.addClass) {\n          classes += ' ' + options.addClass;\n        }\n        if (options.removeClass) {\n          classes += ' ' + options.removeClass;\n        }\n      }\n\n      var classesToAdd = options.addClass;\n      var classesToRemove = options.removeClass;\n\n      // the lookupAnimations function returns a series of animation objects that are\n      // matched up with one or more of the CSS classes. These animation objects are\n      // defined via the module.animation factory function. If nothing is detected then\n      // we don't return anything which then makes $animation query the next driver.\n      var animations = lookupAnimations(classes);\n      var before, after;\n      if (animations.length) {\n        var afterFn, beforeFn;\n        if (event == 'leave') {\n          beforeFn = 'leave';\n          afterFn = 'afterLeave'; // TODO(matsko): get rid of this\n        } else {\n          beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1);\n          afterFn = event;\n        }\n\n        if (event !== 'enter' && event !== 'move') {\n          before = packageAnimations(element, event, options, animations, beforeFn);\n        }\n        after  = packageAnimations(element, event, options, animations, afterFn);\n      }\n\n      // no matching animations\n      if (!before && !after) return;\n\n      function applyOptions() {\n        options.domOperation();\n        applyAnimationClasses(element, options);\n      }\n\n      function close() {\n        animationClosed = true;\n        applyOptions();\n        applyAnimationStyles(element, options);\n      }\n\n      var runner;\n\n      return {\n        $$willAnimate: true,\n        end: function() {\n          if (runner) {\n            runner.end();\n          } else {\n            close();\n            runner = new $$AnimateRunner();\n            runner.complete(true);\n          }\n          return runner;\n        },\n        start: function() {\n          if (runner) {\n            return runner;\n          }\n\n          runner = new $$AnimateRunner();\n          var closeActiveAnimations;\n          var chain = [];\n\n          if (before) {\n            chain.push(function(fn) {\n              closeActiveAnimations = before(fn);\n            });\n          }\n\n          if (chain.length) {\n            chain.push(function(fn) {\n              applyOptions();\n              fn(true);\n            });\n          } else {\n            applyOptions();\n          }\n\n          if (after) {\n            chain.push(function(fn) {\n              closeActiveAnimations = after(fn);\n            });\n          }\n\n          runner.setHost({\n            end: function() {\n              endAnimations();\n            },\n            cancel: function() {\n              endAnimations(true);\n            }\n          });\n\n          $$AnimateRunner.chain(chain, onComplete);\n          return runner;\n\n          function onComplete(success) {\n            close(success);\n            runner.complete(success);\n          }\n\n          function endAnimations(cancelled) {\n            if (!animationClosed) {\n              (closeActiveAnimations || noop)(cancelled);\n              onComplete(cancelled);\n            }\n          }\n        }\n      };\n\n      function executeAnimationFn(fn, element, event, options, onDone) {\n        var args;\n        switch (event) {\n          case 'animate':\n            args = [element, options.from, options.to, onDone];\n            break;\n\n          case 'setClass':\n            args = [element, classesToAdd, classesToRemove, onDone];\n            break;\n\n          case 'addClass':\n            args = [element, classesToAdd, onDone];\n            break;\n\n          case 'removeClass':\n            args = [element, classesToRemove, onDone];\n            break;\n\n          default:\n            args = [element, onDone];\n            break;\n        }\n\n        args.push(options);\n\n        var value = fn.apply(fn, args);\n        if (value) {\n          if (isFunction(value.start)) {\n            value = value.start();\n          }\n\n          if (value instanceof $$AnimateRunner) {\n            value.done(onDone);\n          } else if (isFunction(value)) {\n            // optional onEnd / onCancel callback\n            return value;\n          }\n        }\n\n        return noop;\n      }\n\n      function groupEventedAnimations(element, event, options, animations, fnName) {\n        var operations = [];\n        forEach(animations, function(ani) {\n          var animation = ani[fnName];\n          if (!animation) return;\n\n          // note that all of these animations will run in parallel\n          operations.push(function() {\n            var runner;\n            var endProgressCb;\n\n            var resolved = false;\n            var onAnimationComplete = function(rejected) {\n              if (!resolved) {\n                resolved = true;\n                (endProgressCb || noop)(rejected);\n                runner.complete(!rejected);\n              }\n            };\n\n            runner = new $$AnimateRunner({\n              end: function() {\n                onAnimationComplete();\n              },\n              cancel: function() {\n                onAnimationComplete(true);\n              }\n            });\n\n            endProgressCb = executeAnimationFn(animation, element, event, options, function(result) {\n              var cancelled = result === false;\n              onAnimationComplete(cancelled);\n            });\n\n            return runner;\n          });\n        });\n\n        return operations;\n      }\n\n      function packageAnimations(element, event, options, animations, fnName) {\n        var operations = groupEventedAnimations(element, event, options, animations, fnName);\n        if (operations.length === 0) {\n          var a,b;\n          if (fnName === 'beforeSetClass') {\n            a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass');\n            b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass');\n          } else if (fnName === 'setClass') {\n            a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass');\n            b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass');\n          }\n\n          if (a) {\n            operations = operations.concat(a);\n          }\n          if (b) {\n            operations = operations.concat(b);\n          }\n        }\n\n        if (operations.length === 0) return;\n\n        // TODO(matsko): add documentation\n        return function startAnimation(callback) {\n          var runners = [];\n          if (operations.length) {\n            forEach(operations, function(animateFn) {\n              runners.push(animateFn());\n            });\n          }\n\n          runners.length ? $$AnimateRunner.all(runners, callback) : callback();\n\n          return function endFn(reject) {\n            forEach(runners, function(runner) {\n              reject ? runner.cancel() : runner.end();\n            });\n          };\n        };\n      }\n    };\n\n    function lookupAnimations(classes) {\n      classes = isArray(classes) ? classes : classes.split(' ');\n      var matches = [], flagMap = {};\n      for (var i=0; i < classes.length; i++) {\n        var klass = classes[i],\n            animationFactory = $animateProvider.$$registeredAnimations[klass];\n        if (animationFactory && !flagMap[klass]) {\n          matches.push($injector.get(animationFactory));\n          flagMap[klass] = true;\n        }\n      }\n      return matches;\n    }\n  }];\n}];\n\nvar $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) {\n  $$animationProvider.drivers.push('$$animateJsDriver');\n  this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {\n    return function initDriverFn(animationDetails) {\n      if (animationDetails.from && animationDetails.to) {\n        var fromAnimation = prepareAnimation(animationDetails.from);\n        var toAnimation = prepareAnimation(animationDetails.to);\n        if (!fromAnimation && !toAnimation) return;\n\n        return {\n          start: function() {\n            var animationRunners = [];\n\n            if (fromAnimation) {\n              animationRunners.push(fromAnimation.start());\n            }\n\n            if (toAnimation) {\n              animationRunners.push(toAnimation.start());\n            }\n\n            $$AnimateRunner.all(animationRunners, done);\n\n            var runner = new $$AnimateRunner({\n              end: endFnFactory(),\n              cancel: endFnFactory()\n            });\n\n            return runner;\n\n            function endFnFactory() {\n              return function() {\n                forEach(animationRunners, function(runner) {\n                  // at this point we cannot cancel animations for groups just yet. 1.5+\n                  runner.end();\n                });\n              };\n            }\n\n            function done(status) {\n              runner.complete(status);\n            }\n          }\n        };\n      } else {\n        return prepareAnimation(animationDetails);\n      }\n    };\n\n    function prepareAnimation(animationDetails) {\n      // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations\n      var element = animationDetails.element;\n      var event = animationDetails.event;\n      var options = animationDetails.options;\n      var classes = animationDetails.classes;\n      return $$animateJs(element, event, classes, options);\n    }\n  }];\n}];\n\nvar NG_ANIMATE_ATTR_NAME = 'data-ng-animate';\nvar NG_ANIMATE_PIN_DATA = '$ngAnimatePin';\nvar $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {\n  var PRE_DIGEST_STATE = 1;\n  var RUNNING_STATE = 2;\n  var ONE_SPACE = ' ';\n\n  var rules = this.rules = {\n    skip: [],\n    cancel: [],\n    join: []\n  };\n\n  function makeTruthyCssClassMap(classString) {\n    if (!classString) {\n      return null;\n    }\n\n    var keys = classString.split(ONE_SPACE);\n    var map = Object.create(null);\n\n    forEach(keys, function(key) {\n      map[key] = true;\n    });\n    return map;\n  }\n\n  function hasMatchingClasses(newClassString, currentClassString) {\n    if (newClassString && currentClassString) {\n      var currentClassMap = makeTruthyCssClassMap(currentClassString);\n      return newClassString.split(ONE_SPACE).some(function(className) {\n        return currentClassMap[className];\n      });\n    }\n  }\n\n  function isAllowed(ruleType, element, currentAnimation, previousAnimation) {\n    return rules[ruleType].some(function(fn) {\n      return fn(element, currentAnimation, previousAnimation);\n    });\n  }\n\n  function hasAnimationClasses(animation, and) {\n    var a = (animation.addClass || '').length > 0;\n    var b = (animation.removeClass || '').length > 0;\n    return and ? a && b : a || b;\n  }\n\n  rules.join.push(function(element, newAnimation, currentAnimation) {\n    // if the new animation is class-based then we can just tack that on\n    return !newAnimation.structural && hasAnimationClasses(newAnimation);\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // there is no need to animate anything if no classes are being added and\n    // there is no structural animation that will be triggered\n    return !newAnimation.structural && !hasAnimationClasses(newAnimation);\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // why should we trigger a new structural animation if the element will\n    // be removed from the DOM anyway?\n    return currentAnimation.event == 'leave' && newAnimation.structural;\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // if there is an ongoing current animation then don't even bother running the class-based animation\n    return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // there can never be two structural animations running at the same time\n    return currentAnimation.structural && newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // if the previous animation is already running, but the new animation will\n    // be triggered, but the new animation is structural\n    return currentAnimation.state === RUNNING_STATE && newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // cancel the animation if classes added / removed in both animation cancel each other out,\n    // but only if the current animation isn't structural\n\n    if (currentAnimation.structural) return false;\n\n    var nA = newAnimation.addClass;\n    var nR = newAnimation.removeClass;\n    var cA = currentAnimation.addClass;\n    var cR = currentAnimation.removeClass;\n\n    // early detection to save the global CPU shortage :)\n    if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) {\n      return false;\n    }\n\n    return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA);\n  });\n\n  this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',\n               '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow',\n       function($$rAF,   $rootScope,   $rootElement,   $document,   $$HashMap,\n                $$animation,   $$AnimateRunner,   $templateRequest,   $$jqLite,   $$forceReflow) {\n\n    var activeAnimationsLookup = new $$HashMap();\n    var disabledElementsLookup = new $$HashMap();\n    var animationsEnabled = null;\n\n    function postDigestTaskFactory() {\n      var postDigestCalled = false;\n      return function(fn) {\n        // we only issue a call to postDigest before\n        // it has first passed. This prevents any callbacks\n        // from not firing once the animation has completed\n        // since it will be out of the digest cycle.\n        if (postDigestCalled) {\n          fn();\n        } else {\n          $rootScope.$$postDigest(function() {\n            postDigestCalled = true;\n            fn();\n          });\n        }\n      };\n    }\n\n    // Wait until all directive and route-related templates are downloaded and\n    // compiled. The $templateRequest.totalPendingRequests variable keeps track of\n    // all of the remote templates being currently downloaded. If there are no\n    // templates currently downloading then the watcher will still fire anyway.\n    var deregisterWatch = $rootScope.$watch(\n      function() { return $templateRequest.totalPendingRequests === 0; },\n      function(isEmpty) {\n        if (!isEmpty) return;\n        deregisterWatch();\n\n        // Now that all templates have been downloaded, $animate will wait until\n        // the post digest queue is empty before enabling animations. By having two\n        // calls to $postDigest calls we can ensure that the flag is enabled at the\n        // very end of the post digest queue. Since all of the animations in $animate\n        // use $postDigest, it's important that the code below executes at the end.\n        // This basically means that the page is fully downloaded and compiled before\n        // any animations are triggered.\n        $rootScope.$$postDigest(function() {\n          $rootScope.$$postDigest(function() {\n            // we check for null directly in the event that the application already called\n            // .enabled() with whatever arguments that it provided it with\n            if (animationsEnabled === null) {\n              animationsEnabled = true;\n            }\n          });\n        });\n      }\n    );\n\n    var callbackRegistry = {};\n\n    // remember that the classNameFilter is set during the provider/config\n    // stage therefore we can optimize here and setup a helper function\n    var classNameFilter = $animateProvider.classNameFilter();\n    var isAnimatableClassName = !classNameFilter\n              ? function() { return true; }\n              : function(className) {\n                return classNameFilter.test(className);\n              };\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    function normalizeAnimationDetails(element, animation) {\n      return mergeAnimationDetails(element, animation, {});\n    }\n\n    // IE9-11 has no method \"contains\" in SVG element and in Node.prototype. Bug #10259.\n    var contains = Node.prototype.contains || function(arg) {\n      // jshint bitwise: false\n      return this === arg || !!(this.compareDocumentPosition(arg) & 16);\n      // jshint bitwise: true\n    };\n\n    function findCallbacks(parent, element, event) {\n      var targetNode = getDomNode(element);\n      var targetParentNode = getDomNode(parent);\n\n      var matches = [];\n      var entries = callbackRegistry[event];\n      if (entries) {\n        forEach(entries, function(entry) {\n          if (contains.call(entry.node, targetNode)) {\n            matches.push(entry.callback);\n          } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) {\n            matches.push(entry.callback);\n          }\n        });\n      }\n\n      return matches;\n    }\n\n    var $animate = {\n      on: function(event, container, callback) {\n        var node = extractElementNode(container);\n        callbackRegistry[event] = callbackRegistry[event] || [];\n        callbackRegistry[event].push({\n          node: node,\n          callback: callback\n        });\n\n        // Remove the callback when the element is removed from the DOM\n        jqLite(container).on('$destroy', function() {\n          $animate.off(event, container, callback);\n        });\n      },\n\n      off: function(event, container, callback) {\n        var entries = callbackRegistry[event];\n        if (!entries) return;\n\n        callbackRegistry[event] = arguments.length === 1\n            ? null\n            : filterFromRegistry(entries, container, callback);\n\n        function filterFromRegistry(list, matchContainer, matchCallback) {\n          var containerNode = extractElementNode(matchContainer);\n          return list.filter(function(entry) {\n            var isMatch = entry.node === containerNode &&\n                            (!matchCallback || entry.callback === matchCallback);\n            return !isMatch;\n          });\n        }\n      },\n\n      pin: function(element, parentElement) {\n        assertArg(isElement(element), 'element', 'not an element');\n        assertArg(isElement(parentElement), 'parentElement', 'not an element');\n        element.data(NG_ANIMATE_PIN_DATA, parentElement);\n      },\n\n      push: function(element, event, options, domOperation) {\n        options = options || {};\n        options.domOperation = domOperation;\n        return queueAnimation(element, event, options);\n      },\n\n      // this method has four signatures:\n      //  () - global getter\n      //  (bool) - global setter\n      //  (element) - element getter\n      //  (element, bool) - element setter<F37>\n      enabled: function(element, bool) {\n        var argCount = arguments.length;\n\n        if (argCount === 0) {\n          // () - Global getter\n          bool = !!animationsEnabled;\n        } else {\n          var hasElement = isElement(element);\n\n          if (!hasElement) {\n            // (bool) - Global setter\n            bool = animationsEnabled = !!element;\n          } else {\n            var node = getDomNode(element);\n            var recordExists = disabledElementsLookup.get(node);\n\n            if (argCount === 1) {\n              // (element) - Element getter\n              bool = !recordExists;\n            } else {\n              // (element, bool) - Element setter\n              disabledElementsLookup.put(node, !bool);\n            }\n          }\n        }\n\n        return bool;\n      }\n    };\n\n    return $animate;\n\n    function queueAnimation(element, event, initialOptions) {\n      // we always make a copy of the options since\n      // there should never be any side effects on\n      // the input data when running `$animateCss`.\n      var options = copy(initialOptions);\n\n      var node, parent;\n      element = stripCommentsFromElement(element);\n      if (element) {\n        node = getDomNode(element);\n        parent = element.parent();\n      }\n\n      options = prepareAnimationOptions(options);\n\n      // we create a fake runner with a working promise.\n      // These methods will become available after the digest has passed\n      var runner = new $$AnimateRunner();\n\n      // this is used to trigger callbacks in postDigest mode\n      var runInNextPostDigestOrNow = postDigestTaskFactory();\n\n      if (isArray(options.addClass)) {\n        options.addClass = options.addClass.join(' ');\n      }\n\n      if (options.addClass && !isString(options.addClass)) {\n        options.addClass = null;\n      }\n\n      if (isArray(options.removeClass)) {\n        options.removeClass = options.removeClass.join(' ');\n      }\n\n      if (options.removeClass && !isString(options.removeClass)) {\n        options.removeClass = null;\n      }\n\n      if (options.from && !isObject(options.from)) {\n        options.from = null;\n      }\n\n      if (options.to && !isObject(options.to)) {\n        options.to = null;\n      }\n\n      // there are situations where a directive issues an animation for\n      // a jqLite wrapper that contains only comment nodes... If this\n      // happens then there is no way we can perform an animation\n      if (!node) {\n        close();\n        return runner;\n      }\n\n      var className = [node.className, options.addClass, options.removeClass].join(' ');\n      if (!isAnimatableClassName(className)) {\n        close();\n        return runner;\n      }\n\n      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;\n\n      // this is a hard disable of all animations for the application or on\n      // the element itself, therefore  there is no need to continue further\n      // past this point if not enabled\n      // Animations are also disabled if the document is currently hidden (page is not visible\n      // to the user), because browsers slow down or do not flush calls to requestAnimationFrame\n      var skipAnimations = !animationsEnabled || $document[0].hidden || disabledElementsLookup.get(node);\n      var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {};\n      var hasExistingAnimation = !!existingAnimation.state;\n\n      // there is no point in traversing the same collection of parent ancestors if a followup\n      // animation will be run on the same element that already did all that checking work\n      if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) {\n        skipAnimations = !areAnimationsAllowed(element, parent, event);\n      }\n\n      if (skipAnimations) {\n        close();\n        return runner;\n      }\n\n      if (isStructural) {\n        closeChildAnimations(element);\n      }\n\n      var newAnimation = {\n        structural: isStructural,\n        element: element,\n        event: event,\n        addClass: options.addClass,\n        removeClass: options.removeClass,\n        close: close,\n        options: options,\n        runner: runner\n      };\n\n      if (hasExistingAnimation) {\n        var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation);\n        if (skipAnimationFlag) {\n          if (existingAnimation.state === RUNNING_STATE) {\n            close();\n            return runner;\n          } else {\n            mergeAnimationDetails(element, existingAnimation, newAnimation);\n            return existingAnimation.runner;\n          }\n        }\n        var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation);\n        if (cancelAnimationFlag) {\n          if (existingAnimation.state === RUNNING_STATE) {\n            // this will end the animation right away and it is safe\n            // to do so since the animation is already running and the\n            // runner callback code will run in async\n            existingAnimation.runner.end();\n          } else if (existingAnimation.structural) {\n            // this means that the animation is queued into a digest, but\n            // hasn't started yet. Therefore it is safe to run the close\n            // method which will call the runner methods in async.\n            existingAnimation.close();\n          } else {\n            // this will merge the new animation options into existing animation options\n            mergeAnimationDetails(element, existingAnimation, newAnimation);\n\n            return existingAnimation.runner;\n          }\n        } else {\n          // a joined animation means that this animation will take over the existing one\n          // so an example would involve a leave animation taking over an enter. Then when\n          // the postDigest kicks in the enter will be ignored.\n          var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation);\n          if (joinAnimationFlag) {\n            if (existingAnimation.state === RUNNING_STATE) {\n              normalizeAnimationDetails(element, newAnimation);\n            } else {\n              applyGeneratedPreparationClasses(element, isStructural ? event : null, options);\n\n              event = newAnimation.event = existingAnimation.event;\n              options = mergeAnimationDetails(element, existingAnimation, newAnimation);\n\n              //we return the same runner since only the option values of this animation will\n              //be fed into the `existingAnimation`.\n              return existingAnimation.runner;\n            }\n          }\n        }\n      } else {\n        // normalization in this case means that it removes redundant CSS classes that\n        // already exist (addClass) or do not exist (removeClass) on the element\n        normalizeAnimationDetails(element, newAnimation);\n      }\n\n      // when the options are merged and cleaned up we may end up not having to do\n      // an animation at all, therefore we should check this before issuing a post\n      // digest callback. Structural animations will always run no matter what.\n      var isValidAnimation = newAnimation.structural;\n      if (!isValidAnimation) {\n        // animate (from/to) can be quickly checked first, otherwise we check if any classes are present\n        isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0)\n                            || hasAnimationClasses(newAnimation);\n      }\n\n      if (!isValidAnimation) {\n        close();\n        clearElementAnimationState(element);\n        return runner;\n      }\n\n      // the counter keeps track of cancelled animations\n      var counter = (existingAnimation.counter || 0) + 1;\n      newAnimation.counter = counter;\n\n      markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation);\n\n      $rootScope.$$postDigest(function() {\n        var animationDetails = activeAnimationsLookup.get(node);\n        var animationCancelled = !animationDetails;\n        animationDetails = animationDetails || {};\n\n        // if addClass/removeClass is called before something like enter then the\n        // registered parent element may not be present. The code below will ensure\n        // that a final value for parent element is obtained\n        var parentElement = element.parent() || [];\n\n        // animate/structural/class-based animations all have requirements. Otherwise there\n        // is no point in performing an animation. The parent node must also be set.\n        var isValidAnimation = parentElement.length > 0\n                                && (animationDetails.event === 'animate'\n                                    || animationDetails.structural\n                                    || hasAnimationClasses(animationDetails));\n\n        // this means that the previous animation was cancelled\n        // even if the follow-up animation is the same event\n        if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) {\n          // if another animation did not take over then we need\n          // to make sure that the domOperation and options are\n          // handled accordingly\n          if (animationCancelled) {\n            applyAnimationClasses(element, options);\n            applyAnimationStyles(element, options);\n          }\n\n          // if the event changed from something like enter to leave then we do\n          // it, otherwise if it's the same then the end result will be the same too\n          if (animationCancelled || (isStructural && animationDetails.event !== event)) {\n            options.domOperation();\n            runner.end();\n          }\n\n          // in the event that the element animation was not cancelled or a follow-up animation\n          // isn't allowed to animate from here then we need to clear the state of the element\n          // so that any future animations won't read the expired animation data.\n          if (!isValidAnimation) {\n            clearElementAnimationState(element);\n          }\n\n          return;\n        }\n\n        // this combined multiple class to addClass / removeClass into a setClass event\n        // so long as a structural event did not take over the animation\n        event = !animationDetails.structural && hasAnimationClasses(animationDetails, true)\n            ? 'setClass'\n            : animationDetails.event;\n\n        markElementAnimationState(element, RUNNING_STATE);\n        var realRunner = $$animation(element, event, animationDetails.options);\n\n        realRunner.done(function(status) {\n          close(!status);\n          var animationDetails = activeAnimationsLookup.get(node);\n          if (animationDetails && animationDetails.counter === counter) {\n            clearElementAnimationState(getDomNode(element));\n          }\n          notifyProgress(runner, event, 'close', {});\n        });\n\n        // this will update the runner's flow-control events based on\n        // the `realRunner` object.\n        runner.setHost(realRunner);\n        notifyProgress(runner, event, 'start', {});\n      });\n\n      return runner;\n\n      function notifyProgress(runner, event, phase, data) {\n        runInNextPostDigestOrNow(function() {\n          var callbacks = findCallbacks(parent, element, event);\n          if (callbacks.length) {\n            // do not optimize this call here to RAF because\n            // we don't know how heavy the callback code here will\n            // be and if this code is buffered then this can\n            // lead to a performance regression.\n            $$rAF(function() {\n              forEach(callbacks, function(callback) {\n                callback(element, phase, data);\n              });\n            });\n          }\n        });\n        runner.progress(event, phase, data);\n      }\n\n      function close(reject) { // jshint ignore:line\n        clearGeneratedClasses(element, options);\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n        options.domOperation();\n        runner.complete(!reject);\n      }\n    }\n\n    function closeChildAnimations(element) {\n      var node = getDomNode(element);\n      var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']');\n      forEach(children, function(child) {\n        var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));\n        var animationDetails = activeAnimationsLookup.get(child);\n        if (animationDetails) {\n          switch (state) {\n            case RUNNING_STATE:\n              animationDetails.runner.end();\n              /* falls through */\n            case PRE_DIGEST_STATE:\n              activeAnimationsLookup.remove(child);\n              break;\n          }\n        }\n      });\n    }\n\n    function clearElementAnimationState(element) {\n      var node = getDomNode(element);\n      node.removeAttribute(NG_ANIMATE_ATTR_NAME);\n      activeAnimationsLookup.remove(node);\n    }\n\n    function isMatchingElement(nodeOrElmA, nodeOrElmB) {\n      return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB);\n    }\n\n    /**\n     * This fn returns false if any of the following is true:\n     * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed\n     * b) a parent element has an ongoing structural animation, and animateChildren is false\n     * c) the element is not a child of the body\n     * d) the element is not a child of the $rootElement\n     */\n    function areAnimationsAllowed(element, parentElement, event) {\n      var bodyElement = jqLite($document[0].body);\n      var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML';\n      var rootElementDetected = isMatchingElement(element, $rootElement);\n      var parentAnimationDetected = false;\n      var animateChildren;\n      var elementDisabled = disabledElementsLookup.get(getDomNode(element));\n\n      var parentHost = jqLite.data(element[0], NG_ANIMATE_PIN_DATA);\n      if (parentHost) {\n        parentElement = parentHost;\n      }\n\n      parentElement = getDomNode(parentElement);\n\n      while (parentElement) {\n        if (!rootElementDetected) {\n          // angular doesn't want to attempt to animate elements outside of the application\n          // therefore we need to ensure that the rootElement is an ancestor of the current element\n          rootElementDetected = isMatchingElement(parentElement, $rootElement);\n        }\n\n        if (parentElement.nodeType !== ELEMENT_NODE) {\n          // no point in inspecting the #document element\n          break;\n        }\n\n        var details = activeAnimationsLookup.get(parentElement) || {};\n        // either an enter, leave or move animation will commence\n        // therefore we can't allow any animations to take place\n        // but if a parent animation is class-based then that's ok\n        if (!parentAnimationDetected) {\n          var parentElementDisabled = disabledElementsLookup.get(parentElement);\n\n          if (parentElementDisabled === true && elementDisabled !== false) {\n            // disable animations if the user hasn't explicitly enabled animations on the\n            // current element\n            elementDisabled = true;\n            // element is disabled via parent element, no need to check anything else\n            break;\n          } else if (parentElementDisabled === false) {\n            elementDisabled = false;\n          }\n          parentAnimationDetected = details.structural;\n        }\n\n        if (isUndefined(animateChildren) || animateChildren === true) {\n          var value = jqLite.data(parentElement, NG_ANIMATE_CHILDREN_DATA);\n          if (isDefined(value)) {\n            animateChildren = value;\n          }\n        }\n\n        // there is no need to continue traversing at this point\n        if (parentAnimationDetected && animateChildren === false) break;\n\n        if (!bodyElementDetected) {\n          // we also need to ensure that the element is or will be a part of the body element\n          // otherwise it is pointless to even issue an animation to be rendered\n          bodyElementDetected = isMatchingElement(parentElement, bodyElement);\n        }\n\n        if (bodyElementDetected && rootElementDetected) {\n          // If both body and root have been found, any other checks are pointless,\n          // as no animation data should live outside the application\n          break;\n        }\n\n        if (!rootElementDetected) {\n          // If no rootElement is detected, check if the parentElement is pinned to another element\n          parentHost = jqLite.data(parentElement, NG_ANIMATE_PIN_DATA);\n          if (parentHost) {\n            // The pin target element becomes the next parent element\n            parentElement = getDomNode(parentHost);\n            continue;\n          }\n        }\n\n        parentElement = parentElement.parentNode;\n      }\n\n      var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true;\n      return allowAnimation && rootElementDetected && bodyElementDetected;\n    }\n\n    function markElementAnimationState(element, state, details) {\n      details = details || {};\n      details.state = state;\n\n      var node = getDomNode(element);\n      node.setAttribute(NG_ANIMATE_ATTR_NAME, state);\n\n      var oldValue = activeAnimationsLookup.get(node);\n      var newValue = oldValue\n          ? extend(oldValue, details)\n          : details;\n      activeAnimationsLookup.put(node, newValue);\n    }\n  }];\n}];\n\nvar $$AnimationProvider = ['$animateProvider', function($animateProvider) {\n  var NG_ANIMATE_REF_ATTR = 'ng-animate-ref';\n\n  var drivers = this.drivers = [];\n\n  var RUNNER_STORAGE_KEY = '$$animationRunner';\n\n  function setRunner(element, runner) {\n    element.data(RUNNER_STORAGE_KEY, runner);\n  }\n\n  function removeRunner(element) {\n    element.removeData(RUNNER_STORAGE_KEY);\n  }\n\n  function getRunner(element) {\n    return element.data(RUNNER_STORAGE_KEY);\n  }\n\n  this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$HashMap', '$$rAFScheduler',\n       function($$jqLite,   $rootScope,   $injector,   $$AnimateRunner,   $$HashMap,   $$rAFScheduler) {\n\n    var animationQueue = [];\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    function sortAnimations(animations) {\n      var tree = { children: [] };\n      var i, lookup = new $$HashMap();\n\n      // this is done first beforehand so that the hashmap\n      // is filled with a list of the elements that will be animated\n      for (i = 0; i < animations.length; i++) {\n        var animation = animations[i];\n        lookup.put(animation.domNode, animations[i] = {\n          domNode: animation.domNode,\n          fn: animation.fn,\n          children: []\n        });\n      }\n\n      for (i = 0; i < animations.length; i++) {\n        processNode(animations[i]);\n      }\n\n      return flatten(tree);\n\n      function processNode(entry) {\n        if (entry.processed) return entry;\n        entry.processed = true;\n\n        var elementNode = entry.domNode;\n        var parentNode = elementNode.parentNode;\n        lookup.put(elementNode, entry);\n\n        var parentEntry;\n        while (parentNode) {\n          parentEntry = lookup.get(parentNode);\n          if (parentEntry) {\n            if (!parentEntry.processed) {\n              parentEntry = processNode(parentEntry);\n            }\n            break;\n          }\n          parentNode = parentNode.parentNode;\n        }\n\n        (parentEntry || tree).children.push(entry);\n        return entry;\n      }\n\n      function flatten(tree) {\n        var result = [];\n        var queue = [];\n        var i;\n\n        for (i = 0; i < tree.children.length; i++) {\n          queue.push(tree.children[i]);\n        }\n\n        var remainingLevelEntries = queue.length;\n        var nextLevelEntries = 0;\n        var row = [];\n\n        for (i = 0; i < queue.length; i++) {\n          var entry = queue[i];\n          if (remainingLevelEntries <= 0) {\n            remainingLevelEntries = nextLevelEntries;\n            nextLevelEntries = 0;\n            result.push(row);\n            row = [];\n          }\n          row.push(entry.fn);\n          entry.children.forEach(function(childEntry) {\n            nextLevelEntries++;\n            queue.push(childEntry);\n          });\n          remainingLevelEntries--;\n        }\n\n        if (row.length) {\n          result.push(row);\n        }\n\n        return result;\n      }\n    }\n\n    // TODO(matsko): document the signature in a better way\n    return function(element, event, options) {\n      options = prepareAnimationOptions(options);\n      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;\n\n      // there is no animation at the current moment, however\n      // these runner methods will get later updated with the\n      // methods leading into the driver's end/cancel methods\n      // for now they just stop the animation from starting\n      var runner = new $$AnimateRunner({\n        end: function() { close(); },\n        cancel: function() { close(true); }\n      });\n\n      if (!drivers.length) {\n        close();\n        return runner;\n      }\n\n      setRunner(element, runner);\n\n      var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass));\n      var tempClasses = options.tempClasses;\n      if (tempClasses) {\n        classes += ' ' + tempClasses;\n        options.tempClasses = null;\n      }\n\n      var prepareClassName;\n      if (isStructural) {\n        prepareClassName = 'ng-' + event + PREPARE_CLASS_SUFFIX;\n        $$jqLite.addClass(element, prepareClassName);\n      }\n\n      animationQueue.push({\n        // this data is used by the postDigest code and passed into\n        // the driver step function\n        element: element,\n        classes: classes,\n        event: event,\n        structural: isStructural,\n        options: options,\n        beforeStart: beforeStart,\n        close: close\n      });\n\n      element.on('$destroy', handleDestroyedElement);\n\n      // we only want there to be one function called within the post digest\n      // block. This way we can group animations for all the animations that\n      // were apart of the same postDigest flush call.\n      if (animationQueue.length > 1) return runner;\n\n      $rootScope.$$postDigest(function() {\n        var animations = [];\n        forEach(animationQueue, function(entry) {\n          // the element was destroyed early on which removed the runner\n          // form its storage. This means we can't animate this element\n          // at all and it already has been closed due to destruction.\n          if (getRunner(entry.element)) {\n            animations.push(entry);\n          } else {\n            entry.close();\n          }\n        });\n\n        // now any future animations will be in another postDigest\n        animationQueue.length = 0;\n\n        var groupedAnimations = groupAnimations(animations);\n        var toBeSortedAnimations = [];\n\n        forEach(groupedAnimations, function(animationEntry) {\n          toBeSortedAnimations.push({\n            domNode: getDomNode(animationEntry.from ? animationEntry.from.element : animationEntry.element),\n            fn: function triggerAnimationStart() {\n              // it's important that we apply the `ng-animate` CSS class and the\n              // temporary classes before we do any driver invoking since these\n              // CSS classes may be required for proper CSS detection.\n              animationEntry.beforeStart();\n\n              var startAnimationFn, closeFn = animationEntry.close;\n\n              // in the event that the element was removed before the digest runs or\n              // during the RAF sequencing then we should not trigger the animation.\n              var targetElement = animationEntry.anchors\n                  ? (animationEntry.from.element || animationEntry.to.element)\n                  : animationEntry.element;\n\n              if (getRunner(targetElement)) {\n                var operation = invokeFirstDriver(animationEntry);\n                if (operation) {\n                  startAnimationFn = operation.start;\n                }\n              }\n\n              if (!startAnimationFn) {\n                closeFn();\n              } else {\n                var animationRunner = startAnimationFn();\n                animationRunner.done(function(status) {\n                  closeFn(!status);\n                });\n                updateAnimationRunners(animationEntry, animationRunner);\n              }\n            }\n          });\n        });\n\n        // we need to sort each of the animations in order of parent to child\n        // relationships. This ensures that the child classes are applied at the\n        // right time.\n        $$rAFScheduler(sortAnimations(toBeSortedAnimations));\n      });\n\n      return runner;\n\n      // TODO(matsko): change to reference nodes\n      function getAnchorNodes(node) {\n        var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']';\n        var items = node.hasAttribute(NG_ANIMATE_REF_ATTR)\n              ? [node]\n              : node.querySelectorAll(SELECTOR);\n        var anchors = [];\n        forEach(items, function(node) {\n          var attr = node.getAttribute(NG_ANIMATE_REF_ATTR);\n          if (attr && attr.length) {\n            anchors.push(node);\n          }\n        });\n        return anchors;\n      }\n\n      function groupAnimations(animations) {\n        var preparedAnimations = [];\n        var refLookup = {};\n        forEach(animations, function(animation, index) {\n          var element = animation.element;\n          var node = getDomNode(element);\n          var event = animation.event;\n          var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;\n          var anchorNodes = animation.structural ? getAnchorNodes(node) : [];\n\n          if (anchorNodes.length) {\n            var direction = enterOrMove ? 'to' : 'from';\n\n            forEach(anchorNodes, function(anchor) {\n              var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);\n              refLookup[key] = refLookup[key] || {};\n              refLookup[key][direction] = {\n                animationID: index,\n                element: jqLite(anchor)\n              };\n            });\n          } else {\n            preparedAnimations.push(animation);\n          }\n        });\n\n        var usedIndicesLookup = {};\n        var anchorGroups = {};\n        forEach(refLookup, function(operations, key) {\n          var from = operations.from;\n          var to = operations.to;\n\n          if (!from || !to) {\n            // only one of these is set therefore we can't have an\n            // anchor animation since all three pieces are required\n            var index = from ? from.animationID : to.animationID;\n            var indexKey = index.toString();\n            if (!usedIndicesLookup[indexKey]) {\n              usedIndicesLookup[indexKey] = true;\n              preparedAnimations.push(animations[index]);\n            }\n            return;\n          }\n\n          var fromAnimation = animations[from.animationID];\n          var toAnimation = animations[to.animationID];\n          var lookupKey = from.animationID.toString();\n          if (!anchorGroups[lookupKey]) {\n            var group = anchorGroups[lookupKey] = {\n              structural: true,\n              beforeStart: function() {\n                fromAnimation.beforeStart();\n                toAnimation.beforeStart();\n              },\n              close: function() {\n                fromAnimation.close();\n                toAnimation.close();\n              },\n              classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes),\n              from: fromAnimation,\n              to: toAnimation,\n              anchors: [] // TODO(matsko): change to reference nodes\n            };\n\n            // the anchor animations require that the from and to elements both have at least\n            // one shared CSS class which effectively marries the two elements together to use\n            // the same animation driver and to properly sequence the anchor animation.\n            if (group.classes.length) {\n              preparedAnimations.push(group);\n            } else {\n              preparedAnimations.push(fromAnimation);\n              preparedAnimations.push(toAnimation);\n            }\n          }\n\n          anchorGroups[lookupKey].anchors.push({\n            'out': from.element, 'in': to.element\n          });\n        });\n\n        return preparedAnimations;\n      }\n\n      function cssClassesIntersection(a,b) {\n        a = a.split(' ');\n        b = b.split(' ');\n        var matches = [];\n\n        for (var i = 0; i < a.length; i++) {\n          var aa = a[i];\n          if (aa.substring(0,3) === 'ng-') continue;\n\n          for (var j = 0; j < b.length; j++) {\n            if (aa === b[j]) {\n              matches.push(aa);\n              break;\n            }\n          }\n        }\n\n        return matches.join(' ');\n      }\n\n      function invokeFirstDriver(animationDetails) {\n        // we loop in reverse order since the more general drivers (like CSS and JS)\n        // may attempt more elements, but custom drivers are more particular\n        for (var i = drivers.length - 1; i >= 0; i--) {\n          var driverName = drivers[i];\n          if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check\n\n          var factory = $injector.get(driverName);\n          var driver = factory(animationDetails);\n          if (driver) {\n            return driver;\n          }\n        }\n      }\n\n      function beforeStart() {\n        element.addClass(NG_ANIMATE_CLASSNAME);\n        if (tempClasses) {\n          $$jqLite.addClass(element, tempClasses);\n        }\n        if (prepareClassName) {\n          $$jqLite.removeClass(element, prepareClassName);\n          prepareClassName = null;\n        }\n      }\n\n      function updateAnimationRunners(animation, newRunner) {\n        if (animation.from && animation.to) {\n          update(animation.from.element);\n          update(animation.to.element);\n        } else {\n          update(animation.element);\n        }\n\n        function update(element) {\n          getRunner(element).setHost(newRunner);\n        }\n      }\n\n      function handleDestroyedElement() {\n        var runner = getRunner(element);\n        if (runner && (event !== 'leave' || !options.$$domOperationFired)) {\n          runner.end();\n        }\n      }\n\n      function close(rejected) { // jshint ignore:line\n        element.off('$destroy', handleDestroyedElement);\n        removeRunner(element);\n\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n        options.domOperation();\n\n        if (tempClasses) {\n          $$jqLite.removeClass(element, tempClasses);\n        }\n\n        element.removeClass(NG_ANIMATE_CLASSNAME);\n        runner.complete(!rejected);\n      }\n    };\n  }];\n}];\n\n/**\n * @ngdoc directive\n * @name ngAnimateSwap\n * @restrict A\n * @scope\n *\n * @description\n *\n * ngAnimateSwap is a animation-oriented directive that allows for the container to\n * be removed and entered in whenever the associated expression changes. A\n * common usecase for this directive is a rotating banner or slider component which\n * contains one image being present at a time. When the active image changes\n * then the old image will perform a `leave` animation and the new element\n * will be inserted via an `enter` animation.\n *\n * @animations\n * | Animation                        | Occurs                               |\n * |----------------------------------|--------------------------------------|\n * | {@link ng.$animate#enter enter}  | when the new element is inserted to the DOM  |\n * | {@link ng.$animate#leave leave}  | when the old element is removed from the DOM |\n *\n * @example\n * <example name=\"ngAnimateSwap-directive\" module=\"ngAnimateSwapExample\"\n *          deps=\"angular-animate.js\"\n *          animations=\"true\" fixBase=\"true\">\n *   <file name=\"index.html\">\n *     <div class=\"container\" ng-controller=\"AppCtrl\">\n *       <div ng-animate-swap=\"number\" class=\"cell swap-animation\" ng-class=\"colorClass(number)\">\n *         {{ number }}\n *       </div>\n *     </div>\n *   </file>\n *   <file name=\"script.js\">\n *     angular.module('ngAnimateSwapExample', ['ngAnimate'])\n *       .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {\n *         $scope.number = 0;\n *         $interval(function() {\n *           $scope.number++;\n *         }, 1000);\n *\n *         var colors = ['red','blue','green','yellow','orange'];\n *         $scope.colorClass = function(number) {\n *           return colors[number % colors.length];\n *         };\n *       }]);\n *   </file>\n *  <file name=\"animations.css\">\n *  .container {\n *    height:250px;\n *    width:250px;\n *    position:relative;\n *    overflow:hidden;\n *    border:2px solid black;\n *  }\n *  .container .cell {\n *    font-size:150px;\n *    text-align:center;\n *    line-height:250px;\n *    position:absolute;\n *    top:0;\n *    left:0;\n *    right:0;\n *    border-bottom:2px solid black;\n *  }\n *  .swap-animation.ng-enter, .swap-animation.ng-leave {\n *    transition:0.5s linear all;\n *  }\n *  .swap-animation.ng-enter {\n *    top:-250px;\n *  }\n *  .swap-animation.ng-enter-active {\n *    top:0px;\n *  }\n *  .swap-animation.ng-leave {\n *    top:0px;\n *  }\n *  .swap-animation.ng-leave-active {\n *    top:250px;\n *  }\n *  .red { background:red; }\n *  .green { background:green; }\n *  .blue { background:blue; }\n *  .yellow { background:yellow; }\n *  .orange { background:orange; }\n *  </file>\n * </example>\n */\nvar ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $rootScope) {\n  return {\n    restrict: 'A',\n    transclude: 'element',\n    terminal: true,\n    priority: 600, // we use 600 here to ensure that the directive is caught before others\n    link: function(scope, $element, attrs, ctrl, $transclude) {\n      var previousElement, previousScope;\n      scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) {\n        if (previousElement) {\n          $animate.leave(previousElement);\n        }\n        if (previousScope) {\n          previousScope.$destroy();\n          previousScope = null;\n        }\n        if (value || value === 0) {\n          previousScope = scope.$new();\n          $transclude(previousScope, function(element) {\n            previousElement = element;\n            $animate.enter(element, null, $element);\n          });\n        }\n      });\n    }\n  };\n}];\n\n/* global angularAnimateModule: true,\n\n   ngAnimateSwapDirective,\n   $$AnimateAsyncRunFactory,\n   $$rAFSchedulerFactory,\n   $$AnimateChildrenDirective,\n   $$AnimateQueueProvider,\n   $$AnimationProvider,\n   $AnimateCssProvider,\n   $$AnimateCssDriverProvider,\n   $$AnimateJsProvider,\n   $$AnimateJsDriverProvider,\n*/\n\n/**\n * @ngdoc module\n * @name ngAnimate\n * @description\n *\n * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via\n * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an Angular app.\n *\n * <div doc-module-components=\"ngAnimate\"></div>\n *\n * # Usage\n * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based\n * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For\n * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within\n * the HTML element that the animation will be triggered on.\n *\n * ## Directive Support\n * The following directives are \"animation aware\":\n *\n * | Directive                                                                                                | Supported Animations                                                     |\n * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n * | {@link ng.directive:ngRepeat#animations ngRepeat}                                                        | enter, leave and move                                                    |\n * | {@link ngRoute.directive:ngView#animations ngView}                                                       | enter and leave                                                          |\n * | {@link ng.directive:ngInclude#animations ngInclude}                                                      | enter and leave                                                          |\n * | {@link ng.directive:ngSwitch#animations ngSwitch}                                                        | enter and leave                                                          |\n * | {@link ng.directive:ngIf#animations ngIf}                                                                | enter and leave                                                          |\n * | {@link ng.directive:ngClass#animations ngClass}                                                          | add and remove (the CSS class(es) present)                               |\n * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide}            | add and remove (the ng-hide class value)                                 |\n * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel}    | add and remove (dirty, pristine, valid, invalid & all other validations) |\n * | {@link module:ngMessages#animations ngMessages}                                                          | add and remove (ng-active & ng-inactive)                                 |\n * | {@link module:ngMessages#animations ngMessage}                                                           | enter and leave                                                          |\n *\n * (More information can be found by visiting each the documentation associated with each directive.)\n *\n * ## CSS-based Animations\n *\n * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML\n * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation.\n *\n * The example below shows how an `enter` animation can be made possible on an element using `ng-if`:\n *\n * ```html\n * <div ng-if=\"bool\" class=\"fade\">\n *    Fade me in out\n * </div>\n * <button ng-click=\"bool=true\">Fade In!</button>\n * <button ng-click=\"bool=false\">Fade Out!</button>\n * ```\n *\n * Notice the CSS class **fade**? We can now create the CSS transition code that references this class:\n *\n * ```css\n * /&#42; The starting CSS styles for the enter animation &#42;/\n * .fade.ng-enter {\n *   transition:0.5s linear all;\n *   opacity:0;\n * }\n *\n * /&#42; The finishing CSS styles for the enter animation &#42;/\n * .fade.ng-enter.ng-enter-active {\n *   opacity:1;\n * }\n * ```\n *\n * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two\n * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition\n * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards.\n *\n * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions:\n *\n * ```css\n * /&#42; now the element will fade out before it is removed from the DOM &#42;/\n * .fade.ng-leave {\n *   transition:0.5s linear all;\n *   opacity:1;\n * }\n * .fade.ng-leave.ng-leave-active {\n *   opacity:0;\n * }\n * ```\n *\n * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class:\n *\n * ```css\n * /&#42; there is no need to define anything inside of the destination\n * CSS class since the keyframe will take charge of the animation &#42;/\n * .fade.ng-leave {\n *   animation: my_fade_animation 0.5s linear;\n *   -webkit-animation: my_fade_animation 0.5s linear;\n * }\n *\n * @keyframes my_fade_animation {\n *   from { opacity:1; }\n *   to { opacity:0; }\n * }\n *\n * @-webkit-keyframes my_fade_animation {\n *   from { opacity:1; }\n *   to { opacity:0; }\n * }\n * ```\n *\n * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element.\n *\n * ### CSS Class-based Animations\n *\n * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different\n * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added\n * and removed.\n *\n * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class:\n *\n * ```html\n * <div ng-show=\"bool\" class=\"fade\">\n *   Show and hide me\n * </div>\n * <button ng-click=\"bool=true\">Toggle</button>\n *\n * <style>\n * .fade.ng-hide {\n *   transition:0.5s linear all;\n *   opacity:0;\n * }\n * </style>\n * ```\n *\n * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since\n * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest.\n *\n * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation\n * with CSS styles.\n *\n * ```html\n * <div ng-class=\"{on:onOff}\" class=\"highlight\">\n *   Highlight this box\n * </div>\n * <button ng-click=\"onOff=!onOff\">Toggle</button>\n *\n * <style>\n * .highlight {\n *   transition:0.5s linear all;\n * }\n * .highlight.on-add {\n *   background:white;\n * }\n * .highlight.on {\n *   background:yellow;\n * }\n * .highlight.on-remove {\n *   background:black;\n * }\n * </style>\n * ```\n *\n * We can also make use of CSS keyframes by placing them within the CSS classes.\n *\n *\n * ### CSS Staggering Animations\n * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a\n * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be\n * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for\n * the animation. The style property expected within the stagger class can either be a **transition-delay** or an\n * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).\n *\n * ```css\n * .my-animation.ng-enter {\n *   /&#42; standard transition code &#42;/\n *   transition: 1s linear all;\n *   opacity:0;\n * }\n * .my-animation.ng-enter-stagger {\n *   /&#42; this will have a 100ms delay between each successive leave animation &#42;/\n *   transition-delay: 0.1s;\n *\n *   /&#42; As of 1.4.4, this must always be set: it signals ngAnimate\n *     to not accidentally inherit a delay property from another CSS class &#42;/\n *   transition-duration: 0s;\n * }\n * .my-animation.ng-enter.ng-enter-active {\n *   /&#42; standard transition styles &#42;/\n *   opacity:1;\n * }\n * ```\n *\n * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations\n * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this\n * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation\n * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired.\n *\n * The following code will issue the **ng-leave-stagger** event on the element provided:\n *\n * ```js\n * var kids = parent.children();\n *\n * $animate.leave(kids[0]); //stagger index=0\n * $animate.leave(kids[1]); //stagger index=1\n * $animate.leave(kids[2]); //stagger index=2\n * $animate.leave(kids[3]); //stagger index=3\n * $animate.leave(kids[4]); //stagger index=4\n *\n * window.requestAnimationFrame(function() {\n *   //stagger has reset itself\n *   $animate.leave(kids[5]); //stagger index=0\n *   $animate.leave(kids[6]); //stagger index=1\n *\n *   $scope.$digest();\n * });\n * ```\n *\n * Stagger animations are currently only supported within CSS-defined animations.\n *\n * ### The `ng-animate` CSS class\n *\n * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation.\n * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations).\n *\n * Therefore, animations can be applied to an element using this temporary class directly via CSS.\n *\n * ```css\n * .zipper.ng-animate {\n *   transition:0.5s linear all;\n * }\n * .zipper.ng-enter {\n *   opacity:0;\n * }\n * .zipper.ng-enter.ng-enter-active {\n *   opacity:1;\n * }\n * .zipper.ng-leave {\n *   opacity:1;\n * }\n * .zipper.ng-leave.ng-leave-active {\n *   opacity:0;\n * }\n * ```\n *\n * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove\n * the CSS class once an animation has completed.)\n *\n *\n * ### The `ng-[event]-prepare` class\n *\n * This is a special class that can be used to prevent unwanted flickering / flash of content before\n * the actual animation starts. The class is added as soon as an animation is initialized, but removed\n * before the actual animation starts (after waiting for a $digest).\n * It is also only added for *structural* animations (`enter`, `move`, and `leave`).\n *\n * In practice, flickering can appear when nesting elements with structural animations such as `ngIf`\n * into elements that have class-based animations such as `ngClass`.\n *\n * ```html\n * <div ng-class=\"{red: myProp}\">\n *   <div ng-class=\"{blue: myProp}\">\n *     <div class=\"message\" ng-if=\"myProp\"></div>\n *   </div>\n * </div>\n * ```\n *\n * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating.\n * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:\n *\n * ```css\n * .message.ng-enter-prepare {\n *   opacity: 0;\n * }\n *\n * ```\n *\n * ## JavaScript-based Animations\n *\n * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared\n * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the\n * `module.animation()` module function we can register the animation.\n *\n * Let's see an example of a enter/leave animation using `ngRepeat`:\n *\n * ```html\n * <div ng-repeat=\"item in items\" class=\"slide\">\n *   {{ item }}\n * </div>\n * ```\n *\n * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`:\n *\n * ```js\n * myModule.animation('.slide', [function() {\n *   return {\n *     // make note that other events (like addClass/removeClass)\n *     // have different function input parameters\n *     enter: function(element, doneFn) {\n *       jQuery(element).fadeIn(1000, doneFn);\n *\n *       // remember to call doneFn so that angular\n *       // knows that the animation has concluded\n *     },\n *\n *     move: function(element, doneFn) {\n *       jQuery(element).fadeIn(1000, doneFn);\n *     },\n *\n *     leave: function(element, doneFn) {\n *       jQuery(element).fadeOut(1000, doneFn);\n *     }\n *   }\n * }]);\n * ```\n *\n * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as\n * greensock.js and velocity.js.\n *\n * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define\n * our animations inside of the same registered animation, however, the function input arguments are a bit different:\n *\n * ```html\n * <div ng-class=\"color\" class=\"colorful\">\n *   this box is moody\n * </div>\n * <button ng-click=\"color='red'\">Change to red</button>\n * <button ng-click=\"color='blue'\">Change to blue</button>\n * <button ng-click=\"color='green'\">Change to green</button>\n * ```\n *\n * ```js\n * myModule.animation('.colorful', [function() {\n *   return {\n *     addClass: function(element, className, doneFn) {\n *       // do some cool animation and call the doneFn\n *     },\n *     removeClass: function(element, className, doneFn) {\n *       // do some cool animation and call the doneFn\n *     },\n *     setClass: function(element, addedClass, removedClass, doneFn) {\n *       // do some cool animation and call the doneFn\n *     }\n *   }\n * }]);\n * ```\n *\n * ## CSS + JS Animations Together\n *\n * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular,\n * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking\n * charge of the animation**:\n *\n * ```html\n * <div ng-if=\"bool\" class=\"slide\">\n *   Slide in and out\n * </div>\n * ```\n *\n * ```js\n * myModule.animation('.slide', [function() {\n *   return {\n *     enter: function(element, doneFn) {\n *       jQuery(element).slideIn(1000, doneFn);\n *     }\n *   }\n * }]);\n * ```\n *\n * ```css\n * .slide.ng-enter {\n *   transition:0.5s linear all;\n *   transform:translateY(-100px);\n * }\n * .slide.ng-enter.ng-enter-active {\n *   transform:translateY(0);\n * }\n * ```\n *\n * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the\n * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from\n * our own JS-based animation code:\n *\n * ```js\n * myModule.animation('.slide', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element) {\n*        // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`.\n *       return $animateCss(element, {\n *         event: 'enter',\n *         structural: true\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework.\n *\n * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or\n * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that\n * data into `$animateCss` directly:\n *\n * ```js\n * myModule.animation('.slide', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element) {\n *       return $animateCss(element, {\n *         event: 'enter',\n *         structural: true,\n *         addClass: 'maroon-setting',\n *         from: { height:0 },\n *         to: { height: 200 }\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * Now we can fill in the rest via our transition CSS code:\n *\n * ```css\n * /&#42; the transition tells ngAnimate to make the animation happen &#42;/\n * .slide.ng-enter { transition:0.5s linear all; }\n *\n * /&#42; this extra CSS class will be absorbed into the transition\n * since the $animateCss code is adding the class &#42;/\n * .maroon-setting { background:red; }\n * ```\n *\n * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over.\n *\n * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}.\n *\n * ## Animation Anchoring (via `ng-animate-ref`)\n *\n * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between\n * structural areas of an application (like views) by pairing up elements using an attribute\n * called `ng-animate-ref`.\n *\n * Let's say for example we have two views that are managed by `ng-view` and we want to show\n * that there is a relationship between two components situated in within these views. By using the\n * `ng-animate-ref` attribute we can identify that the two components are paired together and we\n * can then attach an animation, which is triggered when the view changes.\n *\n * Say for example we have the following template code:\n *\n * ```html\n * <!-- index.html -->\n * <div ng-view class=\"view-animation\">\n * </div>\n *\n * <!-- home.html -->\n * <a href=\"#/banner-page\">\n *   <img src=\"./banner.jpg\" class=\"banner\" ng-animate-ref=\"banner\">\n * </a>\n *\n * <!-- banner-page.html -->\n * <img src=\"./banner.jpg\" class=\"banner\" ng-animate-ref=\"banner\">\n * ```\n *\n * Now, when the view changes (once the link is clicked), ngAnimate will examine the\n * HTML contents to see if there is a match reference between any components in the view\n * that is leaving and the view that is entering. It will scan both the view which is being\n * removed (leave) and inserted (enter) to see if there are any paired DOM elements that\n * contain a matching ref value.\n *\n * The two images match since they share the same ref value. ngAnimate will now create a\n * transport element (which is a clone of the first image element) and it will then attempt\n * to animate to the position of the second image element in the next view. For the animation to\n * work a special CSS class called `ng-anchor` will be added to the transported element.\n *\n * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then\n * ngAnimate will handle the entire transition for us as well as the addition and removal of\n * any changes of CSS classes between the elements:\n *\n * ```css\n * .banner.ng-anchor {\n *   /&#42; this animation will last for 1 second since there are\n *          two phases to the animation (an `in` and an `out` phase) &#42;/\n *   transition:0.5s linear all;\n * }\n * ```\n *\n * We also **must** include animations for the views that are being entered and removed\n * (otherwise anchoring wouldn't be possible since the new view would be inserted right away).\n *\n * ```css\n * .view-animation.ng-enter, .view-animation.ng-leave {\n *   transition:0.5s linear all;\n *   position:fixed;\n *   left:0;\n *   top:0;\n *   width:100%;\n * }\n * .view-animation.ng-enter {\n *   transform:translateX(100%);\n * }\n * .view-animation.ng-leave,\n * .view-animation.ng-enter.ng-enter-active {\n *   transform:translateX(0%);\n * }\n * .view-animation.ng-leave.ng-leave-active {\n *   transform:translateX(-100%);\n * }\n * ```\n *\n * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur:\n * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away\n * from its origin. Once that animation is over then the `in` stage occurs which animates the\n * element to its destination. The reason why there are two animations is to give enough time\n * for the enter animation on the new element to be ready.\n *\n * The example above sets up a transition for both the in and out phases, but we can also target the out or\n * in phases directly via `ng-anchor-out` and `ng-anchor-in`.\n *\n * ```css\n * .banner.ng-anchor-out {\n *   transition: 0.5s linear all;\n *\n *   /&#42; the scale will be applied during the out animation,\n *          but will be animated away when the in animation runs &#42;/\n *   transform: scale(1.2);\n * }\n *\n * .banner.ng-anchor-in {\n *   transition: 1s linear all;\n * }\n * ```\n *\n *\n *\n *\n * ### Anchoring Demo\n *\n  <example module=\"anchoringExample\"\n           name=\"anchoringExample\"\n           id=\"anchoringExample\"\n           deps=\"angular-animate.js;angular-route.js\"\n           animations=\"true\">\n    <file name=\"index.html\">\n      <a href=\"#/\">Home</a>\n      <hr />\n      <div class=\"view-container\">\n        <div ng-view class=\"view\"></div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('anchoringExample', ['ngAnimate', 'ngRoute'])\n        .config(['$routeProvider', function($routeProvider) {\n          $routeProvider.when('/', {\n            templateUrl: 'home.html',\n            controller: 'HomeController as home'\n          });\n          $routeProvider.when('/profile/:id', {\n            templateUrl: 'profile.html',\n            controller: 'ProfileController as profile'\n          });\n        }])\n        .run(['$rootScope', function($rootScope) {\n          $rootScope.records = [\n            { id:1, title: \"Miss Beulah Roob\" },\n            { id:2, title: \"Trent Morissette\" },\n            { id:3, title: \"Miss Ava Pouros\" },\n            { id:4, title: \"Rod Pouros\" },\n            { id:5, title: \"Abdul Rice\" },\n            { id:6, title: \"Laurie Rutherford Sr.\" },\n            { id:7, title: \"Nakia McLaughlin\" },\n            { id:8, title: \"Jordon Blanda DVM\" },\n            { id:9, title: \"Rhoda Hand\" },\n            { id:10, title: \"Alexandrea Sauer\" }\n          ];\n        }])\n        .controller('HomeController', [function() {\n          //empty\n        }])\n        .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) {\n          var index = parseInt($routeParams.id, 10);\n          var record = $rootScope.records[index - 1];\n\n          this.title = record.title;\n          this.id = record.id;\n        }]);\n    </file>\n    <file name=\"home.html\">\n      <h2>Welcome to the home page</h1>\n      <p>Please click on an element</p>\n      <a class=\"record\"\n         ng-href=\"#/profile/{{ record.id }}\"\n         ng-animate-ref=\"{{ record.id }}\"\n         ng-repeat=\"record in records\">\n        {{ record.title }}\n      </a>\n    </file>\n    <file name=\"profile.html\">\n      <div class=\"profile record\" ng-animate-ref=\"{{ profile.id }}\">\n        {{ profile.title }}\n      </div>\n    </file>\n    <file name=\"animations.css\">\n      .record {\n        display:block;\n        font-size:20px;\n      }\n      .profile {\n        background:black;\n        color:white;\n        font-size:100px;\n      }\n      .view-container {\n        position:relative;\n      }\n      .view-container > .view.ng-animate {\n        position:absolute;\n        top:0;\n        left:0;\n        width:100%;\n        min-height:500px;\n      }\n      .view.ng-enter, .view.ng-leave,\n      .record.ng-anchor {\n        transition:0.5s linear all;\n      }\n      .view.ng-enter {\n        transform:translateX(100%);\n      }\n      .view.ng-enter.ng-enter-active, .view.ng-leave {\n        transform:translateX(0%);\n      }\n      .view.ng-leave.ng-leave-active {\n        transform:translateX(-100%);\n      }\n      .record.ng-anchor-out {\n        background:red;\n      }\n    </file>\n  </example>\n *\n * ### How is the element transported?\n *\n * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting\n * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element\n * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The\n * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match\n * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied\n * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class\n * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element\n * will become visible since the shim class will be removed.\n *\n * ### How is the morphing handled?\n *\n * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out\n * what CSS classes differ between the starting element and the destination element. These different CSS classes\n * will be added/removed on the anchor element and a transition will be applied (the transition that is provided\n * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will\n * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that\n * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since\n * the cloned element is placed inside of root element which is likely close to the body element).\n *\n * Note that if the root element is on the `<html>` element then the cloned node will be placed inside of body.\n *\n *\n * ## Using $animate in your directive code\n *\n * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application?\n * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's\n * imagine we have a greeting box that shows and hides itself when the data changes\n *\n * ```html\n * <greeting-box active=\"onOrOff\">Hi there</greeting-box>\n * ```\n *\n * ```js\n * ngModule.directive('greetingBox', ['$animate', function($animate) {\n *   return function(scope, element, attrs) {\n *     attrs.$observe('active', function(value) {\n *       value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');\n *     });\n *   });\n * }]);\n * ```\n *\n * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element\n * in our HTML code then we can trigger a CSS or JS animation to happen.\n *\n * ```css\n * /&#42; normally we would create a CSS class to reference on the element &#42;/\n * greeting-box.on { transition:0.5s linear all; background:green; color:white; }\n * ```\n *\n * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's\n * possible be sure to visit the {@link ng.$animate $animate service API page}.\n *\n *\n * ## Callbacks and Promises\n *\n * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger\n * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has\n * ended by chaining onto the returned promise that animation method returns.\n *\n * ```js\n * // somewhere within the depths of the directive\n * $animate.enter(element, parent).then(function() {\n *   //the animation has completed\n * });\n * ```\n *\n * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case\n * anymore.)\n *\n * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering\n * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view\n * routing controller to hook into that:\n *\n * ```js\n * ngModule.controller('HomePageController', ['$animate', function($animate) {\n *   $animate.on('enter', ngViewElement, function(element) {\n *     // the animation for this route has completed\n *   }]);\n * }])\n * ```\n *\n * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.)\n */\n\n/**\n * @ngdoc service\n * @name $animate\n * @kind object\n *\n * @description\n * The ngAnimate `$animate` service documentation is the same for the core `$animate` service.\n *\n * Click here {@link ng.$animate to learn more about animations with `$animate`}.\n */\nangular.module('ngAnimate', [])\n  .directive('ngAnimateSwap', ngAnimateSwapDirective)\n\n  .directive('ngAnimateChildren', $$AnimateChildrenDirective)\n  .factory('$$rAFScheduler', $$rAFSchedulerFactory)\n\n  .provider('$$animateQueue', $$AnimateQueueProvider)\n  .provider('$$animation', $$AnimationProvider)\n\n  .provider('$animateCss', $AnimateCssProvider)\n  .provider('$$animateCssDriver', $$AnimateCssDriverProvider)\n\n  .provider('$$animateJs', $$AnimateJsProvider)\n  .provider('$$animateJsDriver', $$AnimateJsDriverProvider);\n\n\n})(window, window.angular);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-animate/bower.json",
    "content": "{\n  \"name\": \"angular-animate\",\n  \"version\": \"1.5.3\",\n  \"license\": \"MIT\",\n  \"main\": \"./angular-animate.js\",\n  \"ignore\": [],\n  \"dependencies\": {\n    \"angular\": \"1.5.3\"\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-animate/index.js",
    "content": "require('./angular-animate');\nmodule.exports = 'ngAnimate';\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-animate/package.json",
    "content": "{\n  \"name\": \"angular-animate\",\n  \"version\": \"1.5.3\",\n  \"description\": \"AngularJS module for animations\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/angular/angular.js.git\"\n  },\n  \"keywords\": [\n    \"angular\",\n    \"framework\",\n    \"browser\",\n    \"animation\",\n    \"client-side\"\n  ],\n  \"author\": \"Angular Core Team <angular-core+npm@google.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/angular/angular.js/issues\"\n  },\n  \"homepage\": \"http://angularjs.org\"\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-sanitize/.bower.json",
    "content": "{\n  \"name\": \"angular-sanitize\",\n  \"version\": \"1.5.3\",\n  \"license\": \"MIT\",\n  \"main\": \"./angular-sanitize.js\",\n  \"ignore\": [],\n  \"dependencies\": {\n    \"angular\": \"1.5.3\"\n  },\n  \"homepage\": \"https://github.com/angular/bower-angular-sanitize\",\n  \"_release\": \"1.5.3\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v1.5.3\",\n    \"commit\": \"d62a5eecedc71828f6f935fbde6c07217a95988a\"\n  },\n  \"_source\": \"https://github.com/angular/bower-angular-sanitize.git\",\n  \"_target\": \"1.5.3\",\n  \"_originalSource\": \"angular-sanitize\"\n}"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-sanitize/README.md",
    "content": "# packaged angular-sanitize\n\nThis repo is for distribution on `npm` and `bower`. The source for this module is in the\n[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngSanitize).\nPlease file issues and pull requests against that repo.\n\n## Install\n\nYou can install this package either with `npm` or with `bower`.\n\n### npm\n\n```shell\nnpm install angular-sanitize\n```\n\nThen add `ngSanitize` as a dependency for your app:\n\n```javascript\nangular.module('myApp', [require('angular-sanitize')]);\n```\n\n### bower\n\n```shell\nbower install angular-sanitize\n```\n\nAdd a `<script>` to your `index.html`:\n\n```html\n<script src=\"/bower_components/angular-sanitize/angular-sanitize.js\"></script>\n```\n\nThen add `ngSanitize` as a dependency for your app:\n\n```javascript\nangular.module('myApp', ['ngSanitize']);\n```\n\n## Documentation\n\nDocumentation is available on the\n[AngularJS docs site](http://docs.angularjs.org/api/ngSanitize).\n\n## License\n\nThe MIT License\n\nCopyright (c) 2010-2015 Google, Inc. http://angularjs.org\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-sanitize/angular-sanitize.js",
    "content": "/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sanitizeMinErr = angular.$$minErr('$sanitize');\n\n/**\n * @ngdoc module\n * @name ngSanitize\n * @description\n *\n * # ngSanitize\n *\n * The `ngSanitize` module provides functionality to sanitize HTML.\n *\n *\n * <div doc-module-components=\"ngSanitize\"></div>\n *\n * See {@link ngSanitize.$sanitize `$sanitize`} for usage.\n */\n\n/**\n * @ngdoc service\n * @name $sanitize\n * @kind function\n *\n * @description\n *   Sanitizes an html string by stripping all potentially dangerous tokens.\n *\n *   The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are\n *   then serialized back to properly escaped html string. This means that no unsafe input can make\n *   it into the returned string.\n *\n *   The whitelist for URL sanitization of attribute values is configured using the functions\n *   `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider\n *   `$compileProvider`}.\n *\n *   The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.\n *\n * @param {string} html HTML input.\n * @returns {string} Sanitized HTML.\n *\n * @example\n   <example module=\"sanitizeExample\" deps=\"angular-sanitize.js\">\n   <file name=\"index.html\">\n     <script>\n         angular.module('sanitizeExample', ['ngSanitize'])\n           .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {\n             $scope.snippet =\n               '<p style=\"color:blue\">an html\\n' +\n               '<em onmouseover=\"this.textContent=\\'PWN3D!\\'\">click here</em>\\n' +\n               'snippet</p>';\n             $scope.deliberatelyTrustDangerousSnippet = function() {\n               return $sce.trustAsHtml($scope.snippet);\n             };\n           }]);\n     </script>\n     <div ng-controller=\"ExampleController\">\n        Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <td>Directive</td>\n           <td>How</td>\n           <td>Source</td>\n           <td>Rendered</td>\n         </tr>\n         <tr id=\"bind-html-with-sanitize\">\n           <td>ng-bind-html</td>\n           <td>Automatically uses $sanitize</td>\n           <td><pre>&lt;div ng-bind-html=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind-html=\"snippet\"></div></td>\n         </tr>\n         <tr id=\"bind-html-with-trust\">\n           <td>ng-bind-html</td>\n           <td>Bypass $sanitize by explicitly trusting the dangerous value</td>\n           <td>\n           <pre>&lt;div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"&gt;\n&lt;/div&gt;</pre>\n           </td>\n           <td><div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"></div></td>\n         </tr>\n         <tr id=\"bind-default\">\n           <td>ng-bind</td>\n           <td>Automatically escapes</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n       </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should sanitize the html snippet by default', function() {\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('<p>an html\\n<em>click here</em>\\nsnippet</p>');\n     });\n\n     it('should inline raw snippet if bound to a trusted value', function() {\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).\n         toBe(\"<p style=\\\"color:blue\\\">an html\\n\" +\n              \"<em onmouseover=\\\"this.textContent='PWN3D!'\\\">click here</em>\\n\" +\n              \"snippet</p>\");\n     });\n\n     it('should escape snippet without any filter', function() {\n       expect(element(by.css('#bind-default div')).getInnerHtml()).\n         toBe(\"&lt;p style=\\\"color:blue\\\"&gt;an html\\n\" +\n              \"&lt;em onmouseover=\\\"this.textContent='PWN3D!'\\\"&gt;click here&lt;/em&gt;\\n\" +\n              \"snippet&lt;/p&gt;\");\n     });\n\n     it('should update', function() {\n       element(by.model('snippet')).clear();\n       element(by.model('snippet')).sendKeys('new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('new <b>text</b>');\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(\n         'new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(\n         \"new &lt;b onclick=\\\"alert(1)\\\"&gt;text&lt;/b&gt;\");\n     });\n   </file>\n   </example>\n */\n\n\n/**\n * @ngdoc provider\n * @name $sanitizeProvider\n *\n * @description\n * Creates and configures {@link $sanitize} instance.\n */\nfunction $SanitizeProvider() {\n  var svgEnabled = false;\n\n  this.$get = ['$$sanitizeUri', function($$sanitizeUri) {\n    if (svgEnabled) {\n      angular.extend(validElements, svgElements);\n    }\n    return function(html) {\n      var buf = [];\n      htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {\n        return !/^unsafe:/.test($$sanitizeUri(uri, isImage));\n      }));\n      return buf.join('');\n    };\n  }];\n\n\n  /**\n   * @ngdoc method\n   * @name $sanitizeProvider#enableSvg\n   * @kind function\n   *\n   * @description\n   * Enables a subset of svg to be supported by the sanitizer.\n   *\n   * <div class=\"alert alert-warning\">\n   *   <p>By enabling this setting without taking other precautions, you might expose your\n   *   application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned\n   *   outside of the containing element and be rendered over other elements on the page (e.g. a login\n   *   link). Such behavior can then result in phishing incidents.</p>\n   *\n   *   <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg\n   *   tags within the sanitized content:</p>\n   *\n   *   <br>\n   *\n   *   <pre><code>\n   *   .rootOfTheIncludedContent svg {\n   *     overflow: hidden !important;\n   *   }\n   *   </code></pre>\n   * </div>\n   *\n   * @param {boolean=} regexp New regexp to whitelist urls with.\n   * @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called\n   *    without an argument or self for chaining otherwise.\n   */\n  this.enableSvg = function(enableSvg) {\n    if (angular.isDefined(enableSvg)) {\n      svgEnabled = enableSvg;\n      return this;\n    } else {\n      return svgEnabled;\n    }\n  };\n}\n\nfunction sanitizeText(chars) {\n  var buf = [];\n  var writer = htmlSanitizeWriter(buf, angular.noop);\n  writer.chars(chars);\n  return buf.join('');\n}\n\n\n// Regular Expressions for parsing tags and attributes\nvar SURROGATE_PAIR_REGEXP = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n  // Match everything outside of normal chars and \" (quote character)\n  NON_ALPHANUMERIC_REGEXP = /([^\\#-~ |!])/g;\n\n\n// Good source of info about elements and attributes\n// http://dev.w3.org/html5/spec/Overview.html#semantics\n// http://simon.html5.org/html-elements\n\n// Safe Void Elements - HTML5\n// http://dev.w3.org/html5/spec/Overview.html#void-elements\nvar voidElements = toMap(\"area,br,col,hr,img,wbr\");\n\n// Elements that you can, intentionally, leave open (and which close themselves)\n// http://dev.w3.org/html5/spec/Overview.html#optional-tags\nvar optionalEndTagBlockElements = toMap(\"colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr\"),\n    optionalEndTagInlineElements = toMap(\"rp,rt\"),\n    optionalEndTagElements = angular.extend({},\n                                            optionalEndTagInlineElements,\n                                            optionalEndTagBlockElements);\n\n// Safe Block Elements - HTML5\nvar blockElements = angular.extend({}, optionalEndTagBlockElements, toMap(\"address,article,\" +\n        \"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,\" +\n        \"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul\"));\n\n// Inline Elements - HTML5\nvar inlineElements = angular.extend({}, optionalEndTagInlineElements, toMap(\"a,abbr,acronym,b,\" +\n        \"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,\" +\n        \"samp,small,span,strike,strong,sub,sup,time,tt,u,var\"));\n\n// SVG Elements\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements\n// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.\n// They can potentially allow for arbitrary javascript to be executed. See #11290\nvar svgElements = toMap(\"circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,\" +\n        \"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,\" +\n        \"radialGradient,rect,stop,svg,switch,text,title,tspan\");\n\n// Blocked Elements (will be stripped)\nvar blockedElements = toMap(\"script,style\");\n\nvar validElements = angular.extend({},\n                                   voidElements,\n                                   blockElements,\n                                   inlineElements,\n                                   optionalEndTagElements);\n\n//Attributes that have href and hence need to be sanitized\nvar uriAttrs = toMap(\"background,cite,href,longdesc,src,xlink:href\");\n\nvar htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +\n    'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +\n    'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +\n    'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +\n    'valign,value,vspace,width');\n\n// SVG attributes (without \"id\" and \"name\" attributes)\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes\nvar svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +\n    'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +\n    'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +\n    'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +\n    'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +\n    'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +\n    'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +\n    'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +\n    'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +\n    'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +\n    'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +\n    'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +\n    'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +\n    'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +\n    'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);\n\nvar validAttrs = angular.extend({},\n                                uriAttrs,\n                                svgAttrs,\n                                htmlAttrs);\n\nfunction toMap(str, lowercaseKeys) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) {\n    obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;\n  }\n  return obj;\n}\n\nvar inertBodyElement;\n(function(window) {\n  var doc;\n  if (window.document && window.document.implementation) {\n    doc = window.document.implementation.createHTMLDocument(\"inert\");\n  } else {\n    throw $sanitizeMinErr('noinert', \"Can't create an inert html document\");\n  }\n  var docElement = doc.documentElement || doc.getDocumentElement();\n  var bodyElements = docElement.getElementsByTagName('body');\n\n  // usually there should be only one body element in the document, but IE doesn't have any, so we need to create one\n  if (bodyElements.length === 1) {\n    inertBodyElement = bodyElements[0];\n  } else {\n    var html = doc.createElement('html');\n    inertBodyElement = doc.createElement('body');\n    html.appendChild(inertBodyElement);\n    doc.appendChild(html);\n  }\n})(window);\n\n/**\n * @example\n * htmlParser(htmlString, {\n *     start: function(tag, attrs) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * });\n *\n * @param {string} html string\n * @param {object} handler\n */\nfunction htmlParser(html, handler) {\n  if (html === null || html === undefined) {\n    html = '';\n  } else if (typeof html !== 'string') {\n    html = '' + html;\n  }\n  inertBodyElement.innerHTML = html;\n\n  //mXSS protection\n  var mXSSAttempts = 5;\n  do {\n    if (mXSSAttempts === 0) {\n      throw $sanitizeMinErr('uinput', \"Failed to sanitize html because the input is unstable\");\n    }\n    mXSSAttempts--;\n\n    // strip custom-namespaced attributes on IE<=11\n    if (document.documentMode <= 11) {\n      stripCustomNsAttrs(inertBodyElement);\n    }\n    html = inertBodyElement.innerHTML; //trigger mXSS\n    inertBodyElement.innerHTML = html;\n  } while (html !== inertBodyElement.innerHTML);\n\n  var node = inertBodyElement.firstChild;\n  while (node) {\n    switch (node.nodeType) {\n      case 1: // ELEMENT_NODE\n        handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));\n        break;\n      case 3: // TEXT NODE\n        handler.chars(node.textContent);\n        break;\n    }\n\n    var nextNode;\n    if (!(nextNode = node.firstChild)) {\n      if (node.nodeType == 1) {\n        handler.end(node.nodeName.toLowerCase());\n      }\n      nextNode = node.nextSibling;\n      if (!nextNode) {\n        while (nextNode == null) {\n          node = node.parentNode;\n          if (node === inertBodyElement) break;\n          nextNode = node.nextSibling;\n          if (node.nodeType == 1) {\n            handler.end(node.nodeName.toLowerCase());\n          }\n        }\n      }\n    }\n    node = nextNode;\n  }\n\n  while (node = inertBodyElement.firstChild) {\n    inertBodyElement.removeChild(node);\n  }\n}\n\nfunction attrToMap(attrs) {\n  var map = {};\n  for (var i = 0, ii = attrs.length; i < ii; i++) {\n    var attr = attrs[i];\n    map[attr.name] = attr.value;\n  }\n  return map;\n}\n\n\n/**\n * Escapes all potentially dangerous characters, so that the\n * resulting string can be safely inserted into attribute or\n * element text.\n * @param value\n * @returns {string} escaped text\n */\nfunction encodeEntities(value) {\n  return value.\n    replace(/&/g, '&amp;').\n    replace(SURROGATE_PAIR_REGEXP, function(value) {\n      var hi = value.charCodeAt(0);\n      var low = value.charCodeAt(1);\n      return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';\n    }).\n    replace(NON_ALPHANUMERIC_REGEXP, function(value) {\n      return '&#' + value.charCodeAt(0) + ';';\n    }).\n    replace(/</g, '&lt;').\n    replace(/>/g, '&gt;');\n}\n\n/**\n * create an HTML/XML writer which writes to buffer\n * @param {Array} buf use buf.join('') to get out sanitized html string\n * @returns {object} in the form of {\n *     start: function(tag, attrs) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * }\n */\nfunction htmlSanitizeWriter(buf, uriValidator) {\n  var ignoreCurrentElement = false;\n  var out = angular.bind(buf, buf.push);\n  return {\n    start: function(tag, attrs) {\n      tag = angular.lowercase(tag);\n      if (!ignoreCurrentElement && blockedElements[tag]) {\n        ignoreCurrentElement = tag;\n      }\n      if (!ignoreCurrentElement && validElements[tag] === true) {\n        out('<');\n        out(tag);\n        angular.forEach(attrs, function(value, key) {\n          var lkey=angular.lowercase(key);\n          var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');\n          if (validAttrs[lkey] === true &&\n            (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {\n            out(' ');\n            out(key);\n            out('=\"');\n            out(encodeEntities(value));\n            out('\"');\n          }\n        });\n        out('>');\n      }\n    },\n    end: function(tag) {\n      tag = angular.lowercase(tag);\n      if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {\n        out('</');\n        out(tag);\n        out('>');\n      }\n      if (tag == ignoreCurrentElement) {\n        ignoreCurrentElement = false;\n      }\n    },\n    chars: function(chars) {\n      if (!ignoreCurrentElement) {\n        out(encodeEntities(chars));\n      }\n    }\n  };\n}\n\n\n/**\n * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare\n * ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want\n * to allow any of these custom attributes. This method strips them all.\n *\n * @param node Root element to process\n */\nfunction stripCustomNsAttrs(node) {\n  if (node.nodeType === Node.ELEMENT_NODE) {\n    var attrs = node.attributes;\n    for (var i = 0, l = attrs.length; i < l; i++) {\n      var attrNode = attrs[i];\n      var attrName = attrNode.name.toLowerCase();\n      if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {\n        node.removeAttributeNode(attrNode);\n        i--;\n        l--;\n      }\n    }\n  }\n\n  var nextNode = node.firstChild;\n  if (nextNode) {\n    stripCustomNsAttrs(nextNode);\n  }\n\n  nextNode = node.nextSibling;\n  if (nextNode) {\n    stripCustomNsAttrs(nextNode);\n  }\n}\n\n\n\n// define ngSanitize module and register $sanitize service\nangular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);\n\n/* global sanitizeText: false */\n\n/**\n * @ngdoc filter\n * @name linky\n * @kind function\n *\n * @description\n * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and\n * plain email address links.\n *\n * Requires the {@link ngSanitize `ngSanitize`} module to be installed.\n *\n * @param {string} text Input text.\n * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.\n * @param {object|function(url)} [attributes] Add custom attributes to the link element.\n *\n *    Can be one of:\n *\n *    - `object`: A map of attributes\n *    - `function`: Takes the url as a parameter and returns a map of attributes\n *\n *    If the map of attributes contains a value for `target`, it overrides the value of\n *    the target parameter.\n *\n *\n * @returns {string} Html-linkified and {@link $sanitize sanitized} text.\n *\n * @usage\n   <span ng-bind-html=\"linky_expression | linky\"></span>\n *\n * @example\n   <example module=\"linkyExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n       Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <th>Filter</th>\n           <th>Source</th>\n           <th>Rendered</th>\n         </tr>\n         <tr id=\"linky-filter\">\n           <td>linky filter</td>\n           <td>\n             <pre>&lt;div ng-bind-html=\"snippet | linky\"&gt;<br>&lt;/div&gt;</pre>\n           </td>\n           <td>\n             <div ng-bind-html=\"snippet | linky\"></div>\n           </td>\n         </tr>\n         <tr id=\"linky-target\">\n          <td>linky target</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithSingleURL | linky:'_blank'\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithSingleURL | linky:'_blank'\"></div>\n          </td>\n         </tr>\n         <tr id=\"linky-custom-attributes\">\n          <td>linky custom attributes</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\"></div>\n          </td>\n         </tr>\n         <tr id=\"escaped-html\">\n           <td>no filter</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"script.js\">\n       angular.module('linkyExample', ['ngSanitize'])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.snippet =\n             'Pretty text with some links:\\n'+\n             'http://angularjs.org/,\\n'+\n             'mailto:us@somewhere.org,\\n'+\n             'another@somewhere.org,\\n'+\n             'and one more: ftp://127.0.0.1/.';\n           $scope.snippetWithSingleURL = 'http://angularjs.org/';\n         }]);\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should linkify the snippet with urls', function() {\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);\n       });\n\n       it('should not linkify snippet without the linky filter', function() {\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);\n       });\n\n       it('should update', function() {\n         element(by.model('snippet')).clear();\n         element(by.model('snippet')).sendKeys('new http://link.');\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('new http://link.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())\n             .toBe('new http://link.');\n       });\n\n       it('should work with the target property', function() {\n        expect(element(by.id('linky-target')).\n            element(by.binding(\"snippetWithSingleURL | linky:'_blank'\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');\n       });\n\n       it('should optionally add custom attributes', function() {\n        expect(element(by.id('linky-custom-attributes')).\n            element(by.binding(\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');\n       });\n     </file>\n   </example>\n */\nangular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {\n  var LINKY_URL_REGEXP =\n        /((ftp|https?):\\/\\/|(www\\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\\S*[^\\s.;,(){}<>\"\\u201d\\u2019]/i,\n      MAILTO_REGEXP = /^mailto:/i;\n\n  var linkyMinErr = angular.$$minErr('linky');\n  var isString = angular.isString;\n\n  return function(text, target, attributes) {\n    if (text == null || text === '') return text;\n    if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);\n\n    var match;\n    var raw = text;\n    var html = [];\n    var url;\n    var i;\n    while ((match = raw.match(LINKY_URL_REGEXP))) {\n      // We can not end in these as they are sometimes found at the end of the sentence\n      url = match[0];\n      // if we did not match ftp/http/www/mailto then assume mailto\n      if (!match[2] && !match[4]) {\n        url = (match[3] ? 'http://' : 'mailto:') + url;\n      }\n      i = match.index;\n      addText(raw.substr(0, i));\n      addLink(url, match[0].replace(MAILTO_REGEXP, ''));\n      raw = raw.substring(i + match[0].length);\n    }\n    addText(raw);\n    return $sanitize(html.join(''));\n\n    function addText(text) {\n      if (!text) {\n        return;\n      }\n      html.push(sanitizeText(text));\n    }\n\n    function addLink(url, text) {\n      var key;\n      html.push('<a ');\n      if (angular.isFunction(attributes)) {\n        attributes = attributes(url);\n      }\n      if (angular.isObject(attributes)) {\n        for (key in attributes) {\n          html.push(key + '=\"' + attributes[key] + '\" ');\n        }\n      } else {\n        attributes = {};\n      }\n      if (angular.isDefined(target) && !('target' in attributes)) {\n        html.push('target=\"',\n                  target,\n                  '\" ');\n      }\n      html.push('href=\"',\n                url.replace(/\"/g, '&quot;'),\n                '\">');\n      addText(text);\n      html.push('</a>');\n    }\n  };\n}]);\n\n\n})(window, window.angular);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-sanitize/bower.json",
    "content": "{\n  \"name\": \"angular-sanitize\",\n  \"version\": \"1.5.3\",\n  \"license\": \"MIT\",\n  \"main\": \"./angular-sanitize.js\",\n  \"ignore\": [],\n  \"dependencies\": {\n    \"angular\": \"1.5.3\"\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-sanitize/index.js",
    "content": "require('./angular-sanitize');\nmodule.exports = 'ngSanitize';\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-sanitize/package.json",
    "content": "{\n  \"name\": \"angular-sanitize\",\n  \"version\": \"1.5.3\",\n  \"description\": \"AngularJS module for sanitizing HTML\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/angular/angular.js.git\"\n  },\n  \"keywords\": [\n    \"angular\",\n    \"framework\",\n    \"browser\",\n    \"html\",\n    \"client-side\"\n  ],\n  \"author\": \"Angular Core Team <angular-core+npm@google.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/angular/angular.js/issues\"\n  },\n  \"homepage\": \"http://angularjs.org\"\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/.bower.json",
    "content": "{\n  \"name\": \"angular-ui-router\",\n  \"version\": \"0.2.13\",\n  \"main\": \"./release/angular-ui-router.js\",\n  \"dependencies\": {\n    \"angular\": \">= 1.0.8\"\n  },\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"component.json\",\n    \"package.json\",\n    \"lib\",\n    \"config\",\n    \"sample\",\n    \"test\",\n    \"tests\",\n    \"ngdoc_assets\",\n    \"Gruntfile.js\",\n    \"files.js\"\n  ],\n  \"homepage\": \"https://github.com/angular-ui/angular-ui-router-bower\",\n  \"_release\": \"0.2.13\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"0.2.13\",\n    \"commit\": \"2e580f271defdec34f464aab0cca519e41d1ee33\"\n  },\n  \"_source\": \"https://github.com/angular-ui/angular-ui-router-bower.git\",\n  \"_target\": \"0.2.13\",\n  \"_originalSource\": \"angular-ui-router\"\n}"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/CHANGELOG.md",
    "content": "<a name=\"0.2.13\"></a>\n### 0.2.13 (2014-11-20)\n\nThis release primarily fixes issues reported against 0.2.12\n\n#### Bug Fixes\n\n* **$state:** fix $state.includes/.is to apply param types before comparisions fix(uiSref): ma ([19715d15](https://github.com/angular-ui/ui-router/commit/19715d15e3cbfff724519e9febedd05b49c75baa), closes [#1513](https://github.com/angular-ui/ui-router/issues/1513))\n  * Avoid re-synchronizing from url after .transitionTo ([b267ecd3](https://github.com/angular-ui/ui-router/commit/b267ecd348e5c415233573ef95ebdbd051875f52), closes [#1573](https://github.com/angular-ui/ui-router/issues/1573))\n* **$urlMatcherFactory:**\n  * Built-in date type uses local time zone ([d726bedc](https://github.com/angular-ui/ui-router/commit/d726bedcbb5f70a5660addf43fd52ec730790293))\n  * make date type fn check .is before running ([aa94ce3b](https://github.com/angular-ui/ui-router/commit/aa94ce3b86632ad05301530a2213099da73a3dc0), closes [#1564](https://github.com/angular-ui/ui-router/issues/1564))\n  * early binding of array handler bypasses type resolution ([ada4bc27](https://github.com/angular-ui/ui-router/commit/ada4bc27df5eff3ba3ab0de94a09bd91b0f7a28c))\n  * add 'any' Type for non-encoding non-url params ([3bfd75ab](https://github.com/angular-ui/ui-router/commit/3bfd75ab445ee2f1dd55275465059ed116b10b27), closes [#1562](https://github.com/angular-ui/ui-router/issues/1562))\n  * fix encoding slashes in params ([0c983a08](https://github.com/angular-ui/ui-router/commit/0c983a08e2947f999683571477debd73038e95cf), closes [#1119](https://github.com/angular-ui/ui-router/issues/1119))\n  * fix mixed path/query params ordering problem ([a479fbd0](https://github.com/angular-ui/ui-router/commit/a479fbd0b8eb393a94320973e5b9a62d83912ee2), closes [#1543](https://github.com/angular-ui/ui-router/issues/1543))\n* **ArrayType:**\n  * specify empty array mapping corner case ([74aa6091](https://github.com/angular-ui/ui-router/commit/74aa60917e996b0b4e27bbb4eb88c3c03832021d), closes [#1511](https://github.com/angular-ui/ui-router/issues/1511))\n  * fix .equals for array types ([5e6783b7](https://github.com/angular-ui/ui-router/commit/5e6783b77af9a90ddff154f990b43dbb17eeda6e), closes [#1538](https://github.com/angular-ui/ui-router/issues/1538))\n* **Param:** fix default value shorthand declaration ([831d812a](https://github.com/angular-ui/ui-router/commit/831d812a524524c71f0ee1c9afaf0487a5a66230), closes [#1554](https://github.com/angular-ui/ui-router/issues/1554))\n* **common:** fixed the _.filter clone to not create sparse arrays ([750f5cf5](https://github.com/angular-ui/ui-router/commit/750f5cf5fd91f9ada96f39e50d39aceb2caf22b6), closes [#1563](https://github.com/angular-ui/ui-router/issues/1563))\n* **ie8:** fix calls to indexOf and filter ([dcb31b84](https://github.com/angular-ui/ui-router/commit/dcb31b843391b3e61dee4de13f368c109541813e), closes [#1556](https://github.com/angular-ui/ui-router/issues/1556))\n\n\n#### Features\n\n* add json parameter Type ([027f1fcf](https://github.com/angular-ui/ui-router/commit/027f1fcf9c0916cea651e88981345da6f9ff214a))\n\n\n<a name=\"0.2.12\"></a>\n### 0.2.12 (2014-11-13)\n\n#### Bug Fixes\n\n* **$resolve:** use resolve fn result, not parent resolved value of same name ([67f5e00c](https://github.com/angular-ui/ui-router/commit/67f5e00cc9aa006ce3fe6cde9dff261c28eab70a), closes [#1317], [#1353])\n* **$state:**\n  * populate default params in .transitionTo. ([3f60fbe6](https://github.com/angular-ui/ui-router/commit/3f60fbe6d65ebeca8d97952c05aa1d269f1b7ba1), closes [#1396])\n  * reload() now reinvokes controllers ([73443420](https://github.com/angular-ui/ui-router/commit/7344342018847902594dc1fc62d30a5c30f01763), closes [#582])\n  * do not emit $viewContentLoading if notify: false ([74255feb](https://github.com/angular-ui/ui-router/commit/74255febdf48ae082a02ca1e735165f2c369a463), closes [#1387](https://github.com/angular-ui/ui-router/issues/1387))\n  * register states at config-time ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a))\n  * handle parent.name when parent is obj ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a))\n* **$urlMatcherFactory:**\n  * register types at config ([4533fe36](https://github.com/angular-ui/ui-router/commit/4533fe36e0ab2f0143edd854a4145deaa013915a), closes [#1476])\n  * made path params default value \"\" for backwards compat ([8f998e71](https://github.com/angular-ui/ui-router/commit/8f998e71e43a0b31293331c981f5db0f0097b8ba))\n  * Pre-replace certain param values for better mapping ([6374a3e2](https://github.com/angular-ui/ui-router/commit/6374a3e29ab932014a7c77d2e1ab884cc841a2e3))\n  * fixed ParamSet.$$keys() ordering ([9136fecb](https://github.com/angular-ui/ui-router/commit/9136fecbc2bfd4fda748a9914f0225a46c933860))\n  * empty string policy now respected in Param.value() ([db12c85c](https://github.com/angular-ui/ui-router/commit/db12c85c16f2d105415f9bbbdeb11863f64728e0))\n  * \"string\" type now encodes/decodes slashes ([3045e415](https://github.com/angular-ui/ui-router/commit/3045e41577a8b8b8afc6039f42adddf5f3c061ec), closes [#1119])\n  * allow arrays in both path and query params ([fdd2f2c1](https://github.com/angular-ui/ui-router/commit/fdd2f2c191c4a67c874fdb9ec9a34f8dde9ad180), closes [#1073], [#1045], [#1486], [#1394])\n  * typed params in search ([8d4cab69](https://github.com/angular-ui/ui-router/commit/8d4cab69dd67058e1a716892cc37b7d80a57037f), closes [#1488](https://github.com/angular-ui/ui-router/issues/1488))\n  * no longer generate unroutable urls ([cb9fd9d8](https://github.com/angular-ui/ui-router/commit/cb9fd9d8943cb26c7223f6990db29c82ae8740f8), closes [#1487](https://github.com/angular-ui/ui-router/issues/1487))\n  * handle optional parameter followed by required parameter in url format. ([efc72106](https://github.com/angular-ui/ui-router/commit/efc72106ddcc4774b48ea176a505ef9e95193b41))\n  * default to parameter string coersion. ([13a468a7](https://github.com/angular-ui/ui-router/commit/13a468a7d54c2fb0751b94c0c1841d580b71e6dc), closes [#1414](https://github.com/angular-ui/ui-router/issues/1414))\n  * concat respects strictMode/caseInsensitive ([dd72e103](https://github.com/angular-ui/ui-router/commit/dd72e103edb342d9cf802816fe127e1bbd68fd5f), closes [#1395])\n* **ui-sref:**\n  * Allow sref state options to take a scope object ([b5f7b596](https://github.com/angular-ui/ui-router/commit/b5f7b59692ce4933e2d63eb5df3f50a4ba68ccc0))\n  * replace raw href modification with attrs. ([08c96782](https://github.com/angular-ui/ui-router/commit/08c96782faf881b0c7ab00afc233ee6729548fa0))\n  * nagivate to state when url is \"\" fix($state.href): generate href for state with  ([656b5aab](https://github.com/angular-ui/ui-router/commit/656b5aab906e5749db9b5a080c6a83b95f50fd91), closes [#1363](https://github.com/angular-ui/ui-router/issues/1363))\n  * Check that state is defined in isMatch() ([92aebc75](https://github.com/angular-ui/ui-router/commit/92aebc7520f88babdc6e266536086e07263514c3), closes [#1314](https://github.com/angular-ui/ui-router/issues/1314), [#1332](https://github.com/angular-ui/ui-router/issues/1332))\n* **uiView:**\n  * allow inteprolated ui-view names ([81f6a19a](https://github.com/angular-ui/ui-router/commit/81f6a19a432dac9198fd33243855bfd3b4fea8c0), closes [#1324](https://github.com/angular-ui/ui-router/issues/1324))\n  * Made anim work with angular 1.3 ([c3bb7ad9](https://github.com/angular-ui/ui-router/commit/c3bb7ad903da1e1f3c91019cfd255be8489ff4ef), closes [#1367](https://github.com/angular-ui/ui-router/issues/1367), [#1345](https://github.com/angular-ui/ui-router/issues/1345))\n* **urlRouter:** html5Mode accepts an object from angular v1.3.0-rc.3 ([7fea1e9d](https://github.com/angular-ui/ui-router/commit/7fea1e9d0d8c6e09cc6c895ecb93d4221e9adf48))\n* **stateFilters:** mark state filters as stateful. ([a00b353e](https://github.com/angular-ui/ui-router/commit/a00b353e3036f64a81245c4e7898646ba218f833), closes [#1479])\n* **ui-router:** re-add IE8 compatibility for map/filter/keys ([8ce69d9f](https://github.com/angular-ui/ui-router/commit/8ce69d9f7c886888ab53eca7e53536f36b428aae), closes [#1518], [#1383])\n* **package:** point 'main' to a valid filename ([ac903350](https://github.com/angular-ui/ui-router/commit/ac9033501debb63364539d91fbf3a0cba4579f8e))\n* **travis:** make CI build faster ([0531de05](https://github.com/angular-ui/ui-router/commit/0531de052e414a8d839fbb4e7635e923e94865b3))\n\n\n#### Features\n\n##### Default and Typed params\n\nThis release includes a lot of bug fixes around default/optional and typed parameters.  As such, 0.2.12 is the first release where we recommend those features be used.\n\n* **$state:**\n  * add state params validation ([b1379e6a](https://github.com/angular-ui/ui-router/commit/b1379e6a4d38f7ed7436e05873932d7c279af578), closes [#1433](https://github.com/angular-ui/ui-router/issues/1433))\n  * is/includes/get work on relative stateOrName ([232e94b3](https://github.com/angular-ui/ui-router/commit/232e94b3c2ca2c764bb9510046e4b61690c87852))\n  * .reload() returns state transition promise ([639e0565](https://github.com/angular-ui/ui-router/commit/639e0565dece9d5544cc93b3eee6e11c99bd7373))\n* **$templateFactory:** request templateURL as text/html ([ccd60769](https://github.com/angular-ui/ui-router/commit/ccd6076904a4b801d77b47f6e2de4c06ce9962f8), closes [#1287])\n* **$urlMatcherFactory:** Made a Params and ParamSet class ([0cc1e6cc](https://github.com/angular-ui/ui-router/commit/0cc1e6cc461a4640618e2bb594566551c54834e2))\n\n\n\n<a name=\"0.2.11\"></a>\n### 0.2.11 (2014-08-26)\n\n\n#### Bug Fixes\n\n* **$resolve:** Resolves only inherit from immediate parent fixes #702 ([df34e20c](https://github.com/angular-ui/ui-router/commit/df34e20c576299e7a3c8bd4ebc68d42341c0ace9))\n* **$state:**\n  * change $state.href default options.inherit to true ([deea695f](https://github.com/angular-ui/ui-router/commit/deea695f5cacc55de351ab985144fd233c02a769))\n  * sanity-check state lookups ([456fd5ae](https://github.com/angular-ui/ui-router/commit/456fd5aec9ea507518927bfabd62b4afad4cf714), closes [#980](https://github.com/angular-ui/ui-router/issues/980))\n  * didn't comply to inherit parameter ([09836781](https://github.com/angular-ui/ui-router/commit/09836781f126c1c485b06551eb9cfd4fa0f45c35))\n  * allow view content loading broadcast ([7b78edee](https://github.com/angular-ui/ui-router/commit/7b78edeeb52a74abf4d3f00f79534033d5a08d1a))\n* **$urlMatcherFactory:**\n  * detect injected functions ([91f75ae6](https://github.com/angular-ui/ui-router/commit/91f75ae66c4d129f6f69e53bd547594e9661f5d5))\n  * syntax ([1ebed370](https://github.com/angular-ui/ui-router/commit/1ebed37069bae8614d41541d56521f5c45f703f3))\n* **UrlMatcher:**\n  * query param function defaults ([f9c20530](https://github.com/angular-ui/ui-router/commit/f9c205304f10d8a4ebe7efe9025e642016479a51))\n  * don't decode default values ([63607bdb](https://github.com/angular-ui/ui-router/commit/63607bdbbcb432d3fb37856a1cb3da0cd496804e))\n* **travis:** update Node version to fix build ([d6b95ef2](https://github.com/angular-ui/ui-router/commit/d6b95ef23d9dacb4eba08897f5190a0bcddb3a48))\n* **uiSref:**\n  * Generate an href for states with a blank url. closes #1293 ([691745b1](https://github.com/angular-ui/ui-router/commit/691745b12fa05d3700dd28f0c8d25f8a105074ad))\n  * should inherit params by default ([b973dad1](https://github.com/angular-ui/ui-router/commit/b973dad155ad09a7975e1476bd096f7b2c758eeb))\n  * cancel transition if preventDefault() has been called ([2e6d9167](https://github.com/angular-ui/ui-router/commit/2e6d9167d3afbfbca6427e53e012f94fb5fb8022))\n* **uiView:** Fixed infinite loop when is called .go() from a controller. ([e13988b8](https://github.com/angular-ui/ui-router/commit/e13988b8cd6231d75c78876ee9d012cc87f4a8d9), closes [#1194](https://github.com/angular-ui/ui-router/issues/1194))\n* **docs:**\n  * Fixed link to milestones ([6c0ae500](https://github.com/angular-ui/ui-router/commit/6c0ae500cc238ea9fc95adcc15415c55fc9e1f33))\n  * fix bug in decorator example ([4bd00af5](https://github.com/angular-ui/ui-router/commit/4bd00af50b8b88a49d1545a76290731cb8e0feb1))\n  * Removed an incorrect semi-colon ([af97cef8](https://github.com/angular-ui/ui-router/commit/af97cef8b967f2e32177e539ef41450dca131a7d))\n  * Explain return value of rule as function ([5e887890](https://github.com/angular-ui/ui-router/commit/5e8878900a6ffe59a81aed531a3925e34a297377))\n\n\n#### Features\n\n* **$state:**\n  * allow parameters to pass unharmed ([8939d057](https://github.com/angular-ui/ui-router/commit/8939d0572ab1316e458ef016317ecff53131a822))\n    * **BREAKING CHANGE**: state parameters are no longer automatically coerced to strings, and unspecified parameter values are now set to undefined rather than null.\n  * allow prevent syncUrl on failure ([753060b9](https://github.com/angular-ui/ui-router/commit/753060b910d5d2da600a6fa0757976e401c33172))\n* **typescript:** Add typescript definitions for component builds ([521ceb3f](https://github.com/angular-ui/ui-router/commit/521ceb3fd7850646422f411921e21ce5e7d82e0f))\n* **uiSref:** extend syntax for ui-sref ([71cad3d6](https://github.com/angular-ui/ui-router/commit/71cad3d636508b5a9fe004775ad1f1adc0c80c3e))\n* **uiSrefActive:** \n  * Also activate for child states. ([bf163ad6](https://github.com/angular-ui/ui-router/commit/bf163ad6ce176ce28792696c8302d7cdf5c05a01), closes [#818](https://github.com/angular-ui/ui-router/issues/818))\n    * **BREAKING CHANGE** Since ui-sref-active now activates even when child states are active you may need to swap out your ui-sref-active with ui-sref-active-eq, thought typically we think devs want the auto inheritance.\n\n  * uiSrefActiveEq: new directive with old ui-sref-active behavior\n* **$urlRouter:**\n  * defer URL change interception ([c72d8ce1](https://github.com/angular-ui/ui-router/commit/c72d8ce11916d0ac22c81b409c9e61d7048554d7))\n  * force URLs to have valid params ([d48505cd](https://github.com/angular-ui/ui-router/commit/d48505cd328d83e39d5706e085ba319715f999a6))\n  * abstract $location handling ([08b4636b](https://github.com/angular-ui/ui-router/commit/08b4636b294611f08db35f00641eb5211686fb50))\n* **$urlMatcherFactory:**\n  * fail on bad parameters ([d8f124c1](https://github.com/angular-ui/ui-router/commit/d8f124c10d00c7e5dde88c602d966db261aea221))\n  * date type support ([b7f074ff](https://github.com/angular-ui/ui-router/commit/b7f074ff65ca150a3cdbda4d5ad6cb17107300eb))\n  * implement type support ([450b1f0e](https://github.com/angular-ui/ui-router/commit/450b1f0e8e03c738174ff967f688b9a6373290f4))\n* **UrlMatcher:**\n  * handle query string arrays ([9cf764ef](https://github.com/angular-ui/ui-router/commit/9cf764efab45fa9309368688d535ddf6e96d6449), closes [#373](https://github.com/angular-ui/ui-router/issues/373))\n  * injectable functions as defaults ([00966ecd](https://github.com/angular-ui/ui-router/commit/00966ecd91fb745846039160cab707bfca8b3bec))\n  * default values & type decoding for query params ([a472b301](https://github.com/angular-ui/ui-router/commit/a472b301389fbe84d1c1fa9f24852b492a569d11))\n  * allow shorthand definitions ([5b724304](https://github.com/angular-ui/ui-router/commit/5b7243049793505e44b6608ea09878c37c95b1f5))\n  * validates whole interface ([32b27db1](https://github.com/angular-ui/ui-router/commit/32b27db173722e9194ef1d5c0ea7d93f25a98d11))\n  * implement non-strict matching ([a3e21366](https://github.com/angular-ui/ui-router/commit/a3e21366bee0475c9795a1ec76f70eec41c5b4e3))\n  * add per-param config support ([07b3029f](https://github.com/angular-ui/ui-router/commit/07b3029f4d409cf955780113df92e36401b47580))\n    * **BREAKING CHANGE**: the `params` option in state configurations must now be an object keyed by parameter name.\n\n### 0.2.10 (2014-03-12)\n\n\n#### Bug Fixes\n\n* **$state:** use $browser.baseHref() when generating urls with .href() ([cbcc8488](https://github.com/angular-ui/ui-router/commit/cbcc84887d6b6d35258adabb97c714cd9c1e272d))\n* **bower.json:** JS files should not be ignored ([ccdab193](https://github.com/angular-ui/ui-router/commit/ccdab193315f304eb3be5f5b97c47a926c79263e))\n* **dev:** karma:background task is missing, can't run grunt:dev. ([d9f7b898](https://github.com/angular-ui/ui-router/commit/d9f7b898e8e3abb8c846b0faa16a382913d7b22b))\n* **sample:** Contacts menu button not staying active when navigating to detail states. Need t ([2fcb8443](https://github.com/angular-ui/ui-router/commit/2fcb84437cb43ade12682a92b764f13cac77dfe7))\n* **uiSref:** support mock-clicks/events with no data ([717d3ff7](https://github.com/angular-ui/ui-router/commit/717d3ff7d0ba72d239892dee562b401cdf90e418))\n* **uiView:**\n  * Do NOT autoscroll when autoscroll attr is missing ([affe5bd7](https://github.com/angular-ui/ui-router/commit/affe5bd785cdc3f02b7a9f64a52e3900386ec3a0), closes [#807](https://github.com/angular-ui/ui-router/issues/807))\n  * Refactoring uiView directive to copy ngView logic ([548fab6a](https://github.com/angular-ui/ui-router/commit/548fab6ab9debc9904c5865c8bc68b4fc3271dd0), closes [#857](https://github.com/angular-ui/ui-router/issues/857), [#552](https://github.com/angular-ui/ui-router/issues/552))\n\n\n#### Features\n\n* **$state:** includes() allows glob patterns for state matching. ([2d5f6b37](https://github.com/angular-ui/ui-router/commit/2d5f6b37191a3135f4a6d9e8f344c54edcdc065b))\n* **UrlMatcher:** Add support for case insensitive url matching ([642d5247](https://github.com/angular-ui/ui-router/commit/642d524799f604811e680331002feec7199a1fb5))\n* **uiSref:** add support for transition options ([2ed7a728](https://github.com/angular-ui/ui-router/commit/2ed7a728cee6854b38501fbc1df6139d3de5b28a))\n* **uiView:** add controllerAs config with function ([1ee7334a](https://github.com/angular-ui/ui-router/commit/1ee7334a73efeccc9b95340e315cdfd59944762d))\n\n\n### 0.2.9 (2014-01-17)\n\n\nThis release is identical to 0.2.8. 0.2.8 was re-tagged in git to fix a problem with bower.\n\n\n### 0.2.8 (2014-01-16)\n\n\n#### Bug Fixes\n\n* **$state:** allow null to be passed as 'params' param ([094dc30e](https://github.com/angular-ui/ui-router/commit/094dc30e883e1bd14e50a475553bafeaade3b178))\n* **$state.go:** param inheritance shouldn't inherit from siblings ([aea872e0](https://github.com/angular-ui/ui-router/commit/aea872e0b983cb433436ce5875df10c838fccedb))\n* **bower.json:** fixes bower.json ([eed3cc4d](https://github.com/angular-ui/ui-router/commit/eed3cc4d4dfef1d3ef84b9fd063127538ebf59d3))\n* **uiSrefActive:** annotate controller injection ([85921422](https://github.com/angular-ui/ui-router/commit/85921422ff7fb0effed358136426d616cce3d583), closes [#671](https://github.com/angular-ui/ui-router/issues/671))\n* **uiView:**\n  * autoscroll tests pass on 1.2.4 & 1.1.5 ([86eacac0](https://github.com/angular-ui/ui-router/commit/86eacac09ca5e9000bd3b9c7ba6e2cc95d883a3a))\n  * don't animate initial load ([83b6634d](https://github.com/angular-ui/ui-router/commit/83b6634d27942ca74766b2b1244a7fc52c5643d9))\n  * test pass against 1.0.8 and 1.2.4 ([a402415a](https://github.com/angular-ui/ui-router/commit/a402415a2a28b360c43b9fe8f4f54c540f6c33de))\n  * it should autoscroll when expr is missing. ([8bb9e27a](https://github.com/angular-ui/ui-router/commit/8bb9e27a2986725f45daf44c4c9f846385095aff))\n\n\n#### Features\n\n* **uiSref:** add target attribute behaviour ([c12bf9a5](https://github.com/angular-ui/ui-router/commit/c12bf9a520d30d70294e3d82de7661900f8e394e))\n* **uiView:**\n  * merge autoscroll expression test. ([b89e0f87](https://github.com/angular-ui/ui-router/commit/b89e0f871d5cc35c10925ede986c10684d5c9252))\n  * cache and test autoscroll expression ([ee262282](https://github.com/angular-ui/ui-router/commit/ee2622828c2ce83807f006a459ac4e11406d9258))\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/CONTRIBUTING.md",
    "content": "\n# Report an Issue\n\nHelp us make UI-Router better! If you think you might have found a bug, or some other weirdness, start by making sure\nit hasn't already been reported. You can [search through existing issues](https://github.com/angular-ui/ui-router/search?q=wat%3F&type=Issues)\nto see if someone's reported one similar to yours.\n\nIf not, then [create a plunkr](http://bit.ly/UIR-Plunk) that demonstrates the problem (try to use as little code\nas possible: the more minimalist, the faster we can debug it).\n\nNext, [create a new issue](https://github.com/angular-ui/ui-router/issues/new) that briefly explains the problem,\nand provides a bit of background as to the circumstances that triggered it. Don't forget to include the link to\nthat plunkr you created!\n\n**Note**: If you're unsure how a feature is used, or are encountering some unexpected behavior that you aren't sure\nis a bug, it's best to talk it out on\n[StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) before reporting it. This\nkeeps development streamlined, and helps us focus on building great software.\n\n\nIssues only! |\n-------------|\nPlease keep in mind that the issue tracker is for *issues*. Please do *not* post an issue if you need help or support. Instead, see one of the above-mentioned forums or [IRC](irc://irc.freenode.net/#angularjs). |\n\n####Purple Labels\nA purple label means that **you** need to take some further action.  \n - ![Not Actionable - Need Info](http://angular-ui.github.io/ui-router/images/notactionable.png): Your issue is not specific enough, or there is no clear action that we can take. Please clarify and refine your issue.\n - ![Plunkr Please](http://angular-ui.github.io/ui-router/images/plunkrplease.png): Please [create a plunkr](http://bit.ly/UIR-Plunk)\n - ![StackOverflow](http://angular-ui.github.io/ui-router/images/stackoverflow.png): We suspect your issue is really a help request, or could be answered by the community.  Please ask your question on [StackOverflow](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router).  If you determine that is an actual issue, please explain why.\n \nIf your issue gets labeled with purple label, no further action will be taken until you respond to the label appropriately.\n\n# Contribute\n\n**(1)** See the **[Developing](#developing)** section below, to get the development version of UI-Router up and running on your local machine.\n\n**(2)** Check out the [roadmap](https://github.com/angular-ui/ui-router/milestones) to see where the project is headed, and if your feature idea fits with where we're headed.\n\n**(3)** If you're not sure, [open an RFC](https://github.com/angular-ui/ui-router/issues/new?title=RFC:%20My%20idea) to get some feedback on your idea.\n\n**(4)** Finally, commit some code and open a pull request. Code & commits should abide by the following rules:\n\n- *Always* have test coverage for new features (or regression tests for bug fixes), and *never* break existing tests\n- Commits should represent one logical change each; if a feature goes through multiple iterations, squash your commits down to one\n- Make sure to follow the [Angular commit message format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format) so your change will appear in the changelog of the next release.\n- Changes should always respect the coding style of the project\n\n\n\n# Developing\n\nUI-Router uses <code>grunt >= 0.4.x</code>. Make sure to upgrade your environment and read the\n[Migration Guide](http://gruntjs.com/upgrading-from-0.3-to-0.4).\n\nDependencies for building from source and running tests:\n\n* [grunt-cli](https://github.com/gruntjs/grunt-cli) - run: `$ npm install -g grunt-cli`\n* Then, install the development dependencies by running `$ npm install` from the project directory\n\nThere are a number of targets in the gruntfile that are used to generating different builds:\n\n* `grunt`: Perform a normal build, runs jshint and karma tests\n* `grunt build`: Perform a normal build\n* `grunt dist`: Perform a clean build and generate documentation\n* `grunt dev`: Run dev server (sample app) and watch for changes, builds and runs karma tests on changes.\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/LICENSE",
    "content": "The MIT License\n\nCopyright (c) 2014 The AngularUI Team, Karsten Sperling\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/README.md",
    "content": "# AngularUI Router &nbsp;[![Build Status](https://travis-ci.org/angular-ui/ui-router.svg?branch=master)](https://travis-ci.org/angular-ui/ui-router)\n\n#### The de-facto solution to flexible routing with nested views\n---\n**[Download 0.2.11](http://angular-ui.github.io/ui-router/release/angular-ui-router.js)** (or **[Minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js)**) **|**\n**[Guide](https://github.com/angular-ui/ui-router/wiki) |**\n**[API](http://angular-ui.github.io/ui-router/site) |**\n**[Sample](http://angular-ui.github.com/ui-router/sample/) ([Src](https://github.com/angular-ui/ui-router/tree/gh-pages/sample)) |**\n**[FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions) |**\n**[Resources](#resources) |**\n**[Report an Issue](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#report-an-issue) |**\n**[Contribute](https://github.com/angular-ui/ui-router/blob/master/CONTRIBUTING.md#contribute) |**\n**[Help!](http://stackoverflow.com/questions/ask?tags=angularjs,angular-ui-router) |**\n**[Discuss](https://groups.google.com/forum/#!categories/angular-ui/router)**\n\n---\n\nAngularUI Router is a routing framework for [AngularJS](http://angularjs.org), which allows you to organize the\nparts of your interface into a [*state machine*](https://en.wikipedia.org/wiki/Finite-state_machine). Unlike the\n[`$route` service](http://docs.angularjs.org/api/ngRoute.$route) in the Angular ngRoute module, which is organized around URL\nroutes, UI-Router is organized around [*states*](https://github.com/angular-ui/ui-router/wiki),\nwhich may optionally have routes, as well as other behavior, attached.\n\nStates are bound to *named*, *nested* and *parallel views*, allowing you to powerfully manage your application's interface.\n\nCheck out the sample app: http://angular-ui.github.io/ui-router/sample/\n\n-\n**Note:** *UI-Router is under active development. As such, while this library is well-tested, the API may change. Consider using it in production applications only if you're comfortable following a changelog and updating your usage accordingly.*\n\n\n## Get Started\n\n**(1)** Get UI-Router in one of the following ways:\n - clone & [build](CONTRIBUTING.md#developing) this repository\n - [download the release](http://angular-ui.github.io/ui-router/release/angular-ui-router.js) (or [minified](http://angular-ui.github.io/ui-router/release/angular-ui-router.min.js))\n - via **[Bower](http://bower.io/)**: by running `$ bower install angular-ui-router` from your console\n - or via **[npm](https://www.npmjs.org/)**: by running `$ npm install angular-ui-router` from your console\n - or via **[Component](https://github.com/component/component)**: by running `$ component install angular-ui/ui-router` from your console\n\n**(2)** Include `angular-ui-router.js` (or `angular-ui-router.min.js`) in your `index.html`, after including Angular itself (For Component users: ignore this step)\n\n**(3)** Add `'ui.router'` to your main module's list of dependencies (For Component users: replace `'ui.router'` with `require('angular-ui-router')`)\n\nWhen you're done, your setup should look similar to the following:\n\n>\n```html\n<!doctype html>\n<html ng-app=\"myApp\">\n<head>\n    <script src=\"//ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js\"></script>\n    <script src=\"js/angular-ui-router.min.js\"></script>\n    <script>\n        var myApp = angular.module('myApp', ['ui.router']);\n        // For Component users, it should look like this:\n        // var myApp = angular.module('myApp', [require('angular-ui-router')]);\n    </script>\n    ...\n</head>\n<body>\n    ...\n</body>\n</html>\n```\n\n### [Nested States & Views](http://plnkr.co/edit/u18KQc?p=preview)\n\nThe majority of UI-Router's power is in its ability to nest states & views.\n\n**(1)** First, follow the [setup](#get-started) instructions detailed above.\n\n**(2)** Then, add a [`ui-view` directive](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-view) to the `<body />` of your app.\n\n>\n```html\n<!-- index.html -->\n<body>\n    <div ui-view></div>\n    <!-- We'll also add some navigation: -->\n    <a ui-sref=\"state1\">State 1</a>\n    <a ui-sref=\"state2\">State 2</a>\n</body>\n```\n\n**(3)** You'll notice we also added some links with [`ui-sref` directives](https://github.com/angular-ui/ui-router/wiki/Quick-Reference#ui-sref). In addition to managing state transitions, this directive auto-generates the `href` attribute of the `<a />` element it's attached to, if the corresponding state has a URL. Next we'll add some templates. These will plug into the `ui-view` within `index.html`. Notice that they have their own `ui-view` as well! That is the key to nesting states and views.\n\n>\n```html\n<!-- partials/state1.html -->\n<h1>State 1</h1>\n<hr/>\n<a ui-sref=\"state1.list\">Show List</a>\n<div ui-view></div>\n```\n```html\n<!-- partials/state2.html -->\n<h1>State 2</h1>\n<hr/>\n<a ui-sref=\"state2.list\">Show List</a>\n<div ui-view></div>\n```\n\n**(4)** Next, we'll add some child templates. *These* will get plugged into the `ui-view` of their parent state templates.\n\n>\n```html\n<!-- partials/state1.list.html -->\n<h3>List of State 1 Items</h3>\n<ul>\n  <li ng-repeat=\"item in items\">{{ item }}</li>\n</ul>\n```\n\n>\n```html\n<!-- partials/state2.list.html -->\n<h3>List of State 2 Things</h3>\n<ul>\n  <li ng-repeat=\"thing in things\">{{ thing }}</li>\n</ul>\n```\n\n**(5)** Finally, we'll wire it all up with `$stateProvider`. Set up your states in the module config, as in the following:\n\n\n>\n```javascript\nmyApp.config(function($stateProvider, $urlRouterProvider) {\n  //\n  // For any unmatched url, redirect to /state1\n  $urlRouterProvider.otherwise(\"/state1\");\n  //\n  // Now set up the states\n  $stateProvider\n    .state('state1', {\n      url: \"/state1\",\n      templateUrl: \"partials/state1.html\"\n    })\n    .state('state1.list', {\n      url: \"/list\",\n      templateUrl: \"partials/state1.list.html\",\n      controller: function($scope) {\n        $scope.items = [\"A\", \"List\", \"Of\", \"Items\"];\n      }\n    })\n    .state('state2', {\n      url: \"/state2\",\n      templateUrl: \"partials/state2.html\"\n    })\n    .state('state2.list', {\n      url: \"/list\",\n      templateUrl: \"partials/state2.list.html\",\n      controller: function($scope) {\n        $scope.things = [\"A\", \"Set\", \"Of\", \"Things\"];\n      }\n    });\n});\n```\n\n**(6)** See this quick start example in action.\n>**[Go to Quick Start Plunker for Nested States & Views](http://plnkr.co/edit/u18KQc?p=preview)**\n\n**(7)** This only scratches the surface\n>**[Dive Deeper!](https://github.com/angular-ui/ui-router/wiki)**\n\n\n### [Multiple & Named Views](http://plnkr.co/edit/SDOcGS?p=preview)\n\nAnother great feature is the ability to have multiple `ui-view`s view per template.\n\n**Pro Tip:** *While multiple parallel views are a powerful feature, you'll often be able to manage your\ninterfaces more effectively by nesting your views, and pairing those views with nested states.*\n\n**(1)** Follow the [setup](#get-started) instructions detailed above.\n\n**(2)** Add one or more `ui-view` to your app, give them names.\n>\n```html\n<!-- index.html -->\n<body>\n    <div ui-view=\"viewA\"></div>\n    <div ui-view=\"viewB\"></div>\n    <!-- Also a way to navigate -->\n    <a ui-sref=\"route1\">Route 1</a>\n    <a ui-sref=\"route2\">Route 2</a>\n</body>\n```\n\n**(3)** Set up your states in the module config:\n>\n```javascript\nmyApp.config(function($stateProvider) {\n  $stateProvider\n    .state('index', {\n      url: \"\",\n      views: {\n        \"viewA\": { template: \"index.viewA\" },\n        \"viewB\": { template: \"index.viewB\" }\n      }\n    })\n    .state('route1', {\n      url: \"/route1\",\n      views: {\n        \"viewA\": { template: \"route1.viewA\" },\n        \"viewB\": { template: \"route1.viewB\" }\n      }\n    })\n    .state('route2', {\n      url: \"/route2\",\n      views: {\n        \"viewA\": { template: \"route2.viewA\" },\n        \"viewB\": { template: \"route2.viewB\" }\n      }\n    })\n});\n```\n\n**(4)** See this quick start example in action.\n>**[Go to Quick Start Plunker for Multiple & Named Views](http://plnkr.co/edit/SDOcGS?p=preview)**\n\n\n## Resources\n\n* [In-Depth Guide](https://github.com/angular-ui/ui-router/wiki)\n* [API Reference](http://angular-ui.github.io/ui-router/site)\n* [Sample App](http://angular-ui.github.com/ui-router/sample/) ([Source](https://github.com/angular-ui/ui-router/tree/gh-pages/sample))\n* [FAQ](https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions)\n* [Slides comparing ngRoute to ui-router](http://slid.es/timkindberg/ui-router#/)\n* [UI-Router Extras / Addons](http://christopherthielen.github.io/ui-router-extras/#/home) (@christopherthielen)\n \n### Videos\n\n* [Introduction Video](https://egghead.io/lessons/angularjs-introduction-ui-router) (egghead.io)\n* [Tim Kindberg on Angular UI-Router](https://www.youtube.com/watch?v=lBqiZSemrqg)\n* [Activating States](https://egghead.io/lessons/angularjs-ui-router-activating-states) (egghead.io)\n* [Learn Angular.js using UI-Router](http://youtu.be/QETUuZ27N0w) (LearnCode.academy)\n\n\n\n## Reporting issues and Contributing\n\nPlease read our [Contributor guidelines](CONTRIBUTING.md) before reporting an issue or creating a pull request.\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/api/angular-ui-router.d.ts",
    "content": "// Type definitions for Angular JS 1.1.5+ (ui.router module)\n// Project: https://github.com/angular-ui/ui-router\n// Definitions by: Michel Salib <https://github.com/michelsalib>\n// Definitions: https://github.com/borisyankov/DefinitelyTyped\n\ndeclare module ng.ui {\n\n    interface IState {\n        name?: string;\n        template?: string;\n        templateUrl?: any; // string || () => string\n        templateProvider?: any; // () => string || IPromise<string>\n        controller?: any;\n        controllerAs?: string;    \n        controllerProvider?: any;\n        resolve?: {};\n        url?: string;\n        params?: any;\n        views?: {};\n        abstract?: boolean;\n        onEnter?: (...args: any[]) => void;\n        onExit?: (...args: any[]) => void;\n        data?: any;\n        reloadOnSearch?: boolean;\n    }\n\n    interface ITypedState<T> extends IState {\n        data?: T;\n    }\n\n    interface IStateProvider extends IServiceProvider {\n        state(name: string, config: IState): IStateProvider;\n        state(config: IState): IStateProvider;\n        decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;\n    }\n\n    interface IUrlMatcher {\n        concat(pattern: string): IUrlMatcher;\n        exec(path: string, searchParams: {}): {};\n        parameters(): string[];\n        format(values: {}): string;\n    }\n\n    interface IUrlMatcherFactory {\n        compile(pattern: string): IUrlMatcher;\n        isMatcher(o: any): boolean;\n    }\n\n    interface IUrlRouterProvider extends IServiceProvider {\n        when(whenPath: RegExp, handler: Function): IUrlRouterProvider;\n        when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;\n        when(whenPath: RegExp, toPath: string): IUrlRouterProvider;\n        when(whenPath: IUrlMatcher, hanlder: Function): IUrlRouterProvider;\n        when(whenPath: IUrlMatcher, handler: any[]): IUrlRouterProvider;\n        when(whenPath: IUrlMatcher, toPath: string): IUrlRouterProvider;\n        when(whenPath: string, handler: Function): IUrlRouterProvider;\n        when(whenPath: string, handler: any[]): IUrlRouterProvider;\n        when(whenPath: string, toPath: string): IUrlRouterProvider;\n        otherwise(handler: Function): IUrlRouterProvider;\n        otherwise(handler: any[]): IUrlRouterProvider;\n        otherwise(path: string): IUrlRouterProvider;\n        rule(handler: Function): IUrlRouterProvider;\n        rule(handler: any[]): IUrlRouterProvider;\n    }\n\n    interface IStateOptions {\n        location?: any;\n        inherit?: boolean;\n        relative?: IState;\n        notify?: boolean;\n        reload?: boolean;\n    }\n\n    interface IHrefOptions {\n        lossy?: boolean;\n        inherit?: boolean;\n        relative?: IState;\n        absolute?: boolean;\n    }\n\n    interface IStateService {\n        go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;\n        transitionTo(state: string, params?: {}, updateLocation?: boolean): void;\n        transitionTo(state: string, params?: {}, options?: IStateOptions): void;\n        includes(state: string, params?: {}): boolean;\n        is(state:string, params?: {}): boolean;\n        is(state: IState, params?: {}): boolean;\n        href(state: IState, params?: {}, options?: IHrefOptions): string;\n        href(state: string, params?: {}, options?: IHrefOptions): string;\n        get(state: string): IState;\n        get(): IState[];\n        current: IState;\n        params: any;\n        reload(): void;\n    }\n\n    interface IStateParamsService {\n        [key: string]: any;\n    }\n\n    interface IStateParams {\n        [key: string]: any;\n    }\n\n    interface IUrlRouterService {\n        /*\n         * Triggers an update; the same update that happens when the address bar\n         * url changes, aka $locationChangeSuccess.\n         *\n         * This method is useful when you need to use preventDefault() on the\n         * $locationChangeSuccess event, perform some custom logic (route protection,\n         * auth, config, redirection, etc) and then finally proceed with the transition\n         * by calling $urlRouter.sync().\n         *\n         */\n        sync(): void;\n    }\n\n    interface IUiViewScrollProvider {\n        /*\n         * Reverts back to using the core $anchorScroll service for scrolling \n         * based on the url anchor.\n         */\n        useAnchorScroll(): void;\n    }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/bower.json",
    "content": "{\n  \"name\": \"angular-ui-router\",\n  \"version\": \"0.2.13\",\n  \"main\": \"./release/angular-ui-router.js\",\n  \"dependencies\": {\n    \"angular\": \">= 1.0.8\"\n  },\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"component.json\",\n    \"package.json\",\n    \"lib\",\n    \"config\",\n    \"sample\",\n    \"test\",\n    \"tests\",\n    \"ngdoc_assets\",\n    \"Gruntfile.js\",\n    \"files.js\"\n  ]\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/release/angular-ui-router.js",
    "content": "/**\n * State-based routing for AngularJS\n * @version v0.2.13\n * @link http://angular-ui.github.com/\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n\n/* commonjs package manager support (eg componentjs) */\nif (typeof module !== \"undefined\" && typeof exports !== \"undefined\" && module.exports === exports){\n  module.exports = 'ui.router';\n}\n\n(function (window, angular, undefined) {\n/*jshint globalstrict:true*/\n/*global angular:false*/\n'use strict';\n\nvar isDefined = angular.isDefined,\n    isFunction = angular.isFunction,\n    isString = angular.isString,\n    isObject = angular.isObject,\n    isArray = angular.isArray,\n    forEach = angular.forEach,\n    extend = angular.extend,\n    copy = angular.copy;\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, { prototype: parent }))(), extra);\n}\n\nfunction merge(dst) {\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        if (!dst.hasOwnProperty(key)) dst[key] = value;\n      });\n    }\n  });\n  return dst;\n}\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nfunction ancestors(first, second) {\n  var path = [];\n\n  for (var n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * IE8-safe wrapper for `Object.keys()`.\n *\n * @param {Object} object A JavaScript object.\n * @return {Array} Returns the keys of the object as an array.\n */\nfunction objectKeys(object) {\n  if (Object.keys) {\n    return Object.keys(object);\n  }\n  var result = [];\n\n  angular.forEach(object, function(val, key) {\n    result.push(key);\n  });\n  return result;\n}\n\n/**\n * IE8-safe wrapper for `Array.prototype.indexOf()`.\n *\n * @param {Array} array A JavaScript array.\n * @param {*} value A value to search the array for.\n * @return {Number} Returns the array index value of `value`, or `-1` if not present.\n */\nfunction indexOf(array, value) {\n  if (Array.prototype.indexOf) {\n    return array.indexOf(value, Number(arguments[2]) || 0);\n  }\n  var len = array.length >>> 0, from = Number(arguments[2]) || 0;\n  from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n\n  if (from < 0) from += len;\n\n  for (; from < len; from++) {\n    if (from in array && array[from] === value) return from;\n  }\n  return -1;\n}\n\n/**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} currentParams The value of the current state parameters ($stateParams).\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\nfunction inheritParams(currentParams, newParams, $current, $to) {\n  var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];\n\n  for (var i in parents) {\n    if (!parents[i].params) continue;\n    parentParams = objectKeys(parents[i].params);\n    if (!parentParams.length) continue;\n\n    for (var j in parentParams) {\n      if (indexOf(inheritList, parentParams[j]) >= 0) continue;\n      inheritList.push(parentParams[j]);\n      inherited[parentParams[j]] = currentParams[parentParams[j]];\n    }\n  }\n  return extend({}, inherited, newParams);\n}\n\n/**\n * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.\n *\n * @param {Object} a The first object.\n * @param {Object} b The second object.\n * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,\n *                     it defaults to the list of keys in `a`.\n * @return {Boolean} Returns `true` if the keys match, otherwise `false`.\n */\nfunction equalForKeys(a, b, keys) {\n  if (!keys) {\n    keys = [];\n    for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility\n  }\n\n  for (var i=0; i<keys.length; i++) {\n    var k = keys[i];\n    if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized\n  }\n  return true;\n}\n\n/**\n * Returns the subset of an object, based on a list of keys.\n *\n * @param {Array} keys\n * @param {Object} values\n * @return {Boolean} Returns a subset of `values`.\n */\nfunction filterByKeys(keys, values) {\n  var filtered = {};\n\n  forEach(keys, function (name) {\n    filtered[name] = values[name];\n  });\n  return filtered;\n}\n\n// like _.indexBy\n// when you know that your index values will be unique, or you want last-one-in to win\nfunction indexBy(array, propName) {\n  var result = {};\n  forEach(array, function(item) {\n    result[item[propName]] = item;\n  });\n  return result;\n}\n\n// extracted from underscore.js\n// Return a copy of the object only containing the whitelisted properties.\nfunction pick(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  forEach(keys, function(key) {\n    if (key in obj) copy[key] = obj[key];\n  });\n  return copy;\n}\n\n// extracted from underscore.js\n// Return a copy of the object omitting the blacklisted properties.\nfunction omit(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  for (var key in obj) {\n    if (indexOf(keys, key) == -1) copy[key] = obj[key];\n  }\n  return copy;\n}\n\nfunction pluck(collection, key) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = isFunction(key) ? key(val) : val[key];\n  });\n  return result;\n}\n\nfunction filter(collection, callback) {\n  var array = isArray(collection);\n  var result = array ? [] : {};\n  forEach(collection, function(val, i) {\n    if (callback(val, i)) {\n      result[array ? result.length : i] = val;\n    }\n  });\n  return result;\n}\n\nfunction map(collection, callback) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = callback(val, i);\n  });\n  return result;\n}\n\n/**\n * @ngdoc overview\n * @name ui.router.util\n *\n * @description\n * # ui.router.util sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n *\n */\nangular.module('ui.router.util', ['ng']);\n\n/**\n * @ngdoc overview\n * @name ui.router.router\n * \n * @requires ui.router.util\n *\n * @description\n * # ui.router.router sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n */\nangular.module('ui.router.router', ['ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router.state\n * \n * @requires ui.router.router\n * @requires ui.router.util\n *\n * @description\n * # ui.router.state sub-module\n *\n * This module is a dependency of the main ui.router module. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n * \n */\nangular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router\n *\n * @requires ui.router.state\n *\n * @description\n * # ui.router\n * \n * ## The main module for ui.router \n * There are several sub-modules included with the ui.router module, however only this module is needed\n * as a dependency within your angular app. The other modules are for organization purposes. \n *\n * The modules are:\n * * ui.router - the main \"umbrella\" module\n * * ui.router.router - \n * \n * *You'll need to include **only** this module as the dependency within your angular app.*\n * \n * <pre>\n * <!doctype html>\n * <html ng-app=\"myApp\">\n * <head>\n *   <script src=\"js/angular.js\"></script>\n *   <!-- Include the ui-router script -->\n *   <script src=\"js/angular-ui-router.min.js\"></script>\n *   <script>\n *     // ...and add 'ui.router' as a dependency\n *     var myApp = angular.module('myApp', ['ui.router']);\n *   </script>\n * </head>\n * <body>\n * </body>\n * </html>\n * </pre>\n */\nangular.module('ui.router', ['ui.router.state']);\n\nangular.module('ui.router.compat', ['ui.router']);\n\n/**\n * @ngdoc object\n * @name ui.router.util.$resolve\n *\n * @requires $q\n * @requires $injector\n *\n * @description\n * Manages resolution of (acyclic) graphs of promises.\n */\n$Resolve.$inject = ['$q', '$injector'];\nfunction $Resolve(  $q,    $injector) {\n  \n  var VISIT_IN_PROGRESS = 1,\n      VISIT_DONE = 2,\n      NOTHING = {},\n      NO_DEPENDENCIES = [],\n      NO_LOCALS = NOTHING,\n      NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });\n  \n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#study\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Studies a set of invocables that are likely to be used multiple times.\n   * <pre>\n   * $resolve.study(invocables)(locals, parent, self)\n   * </pre>\n   * is equivalent to\n   * <pre>\n   * $resolve.resolve(invocables, locals, parent, self)\n   * </pre>\n   * but the former is more efficient (in fact `resolve` just calls `study` \n   * internally).\n   *\n   * @param {object} invocables Invocable objects\n   * @return {function} a function to pass in locals, parent and self\n   */\n  this.study = function (invocables) {\n    if (!isObject(invocables)) throw new Error(\"'invocables' must be an object\");\n    var invocableKeys = objectKeys(invocables || {});\n    \n    // Perform a topological sort of invocables to build an ordered plan\n    var plan = [], cycle = [], visited = {};\n    function visit(value, key) {\n      if (visited[key] === VISIT_DONE) return;\n      \n      cycle.push(key);\n      if (visited[key] === VISIT_IN_PROGRESS) {\n        cycle.splice(0, indexOf(cycle, key));\n        throw new Error(\"Cyclic dependency: \" + cycle.join(\" -> \"));\n      }\n      visited[key] = VISIT_IN_PROGRESS;\n      \n      if (isString(value)) {\n        plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);\n      } else {\n        var params = $injector.annotate(value);\n        forEach(params, function (param) {\n          if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);\n        });\n        plan.push(key, value, params);\n      }\n      \n      cycle.pop();\n      visited[key] = VISIT_DONE;\n    }\n    forEach(invocables, visit);\n    invocables = cycle = visited = null; // plan is all that's required\n    \n    function isResolve(value) {\n      return isObject(value) && value.then && value.$$promises;\n    }\n    \n    return function (locals, parent, self) {\n      if (isResolve(locals) && self === undefined) {\n        self = parent; parent = locals; locals = null;\n      }\n      if (!locals) locals = NO_LOCALS;\n      else if (!isObject(locals)) {\n        throw new Error(\"'locals' must be an object\");\n      }       \n      if (!parent) parent = NO_PARENT;\n      else if (!isResolve(parent)) {\n        throw new Error(\"'parent' must be a promise returned by $resolve.resolve()\");\n      }\n      \n      // To complete the overall resolution, we have to wait for the parent\n      // promise and for the promise for each invokable in our plan.\n      var resolution = $q.defer(),\n          result = resolution.promise,\n          promises = result.$$promises = {},\n          values = extend({}, locals),\n          wait = 1 + plan.length/3,\n          merged = false;\n          \n      function done() {\n        // Merge parent values we haven't got yet and publish our own $$values\n        if (!--wait) {\n          if (!merged) merge(values, parent.$$values); \n          result.$$values = values;\n          result.$$promises = result.$$promises || true; // keep for isResolve()\n          delete result.$$inheritedValues;\n          resolution.resolve(values);\n        }\n      }\n      \n      function fail(reason) {\n        result.$$failure = reason;\n        resolution.reject(reason);\n      }\n\n      // Short-circuit if parent has already failed\n      if (isDefined(parent.$$failure)) {\n        fail(parent.$$failure);\n        return result;\n      }\n      \n      if (parent.$$inheritedValues) {\n        merge(values, omit(parent.$$inheritedValues, invocableKeys));\n      }\n\n      // Merge parent values if the parent has already resolved, or merge\n      // parent promises and wait if the parent resolve is still in progress.\n      extend(promises, parent.$$promises);\n      if (parent.$$values) {\n        merged = merge(values, omit(parent.$$values, invocableKeys));\n        result.$$inheritedValues = omit(parent.$$values, invocableKeys);\n        done();\n      } else {\n        if (parent.$$inheritedValues) {\n          result.$$inheritedValues = omit(parent.$$inheritedValues, invocableKeys);\n        }        \n        parent.then(done, fail);\n      }\n      \n      // Process each invocable in the plan, but ignore any where a local of the same name exists.\n      for (var i=0, ii=plan.length; i<ii; i+=3) {\n        if (locals.hasOwnProperty(plan[i])) done();\n        else invoke(plan[i], plan[i+1], plan[i+2]);\n      }\n      \n      function invoke(key, invocable, params) {\n        // Create a deferred for this invocation. Failures will propagate to the resolution as well.\n        var invocation = $q.defer(), waitParams = 0;\n        function onfailure(reason) {\n          invocation.reject(reason);\n          fail(reason);\n        }\n        // Wait for any parameter that we have a promise for (either from parent or from this\n        // resolve; in that case study() will have made sure it's ordered before us in the plan).\n        forEach(params, function (dep) {\n          if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {\n            waitParams++;\n            promises[dep].then(function (result) {\n              values[dep] = result;\n              if (!(--waitParams)) proceed();\n            }, onfailure);\n          }\n        });\n        if (!waitParams) proceed();\n        function proceed() {\n          if (isDefined(result.$$failure)) return;\n          try {\n            invocation.resolve($injector.invoke(invocable, self, values));\n            invocation.promise.then(function (result) {\n              values[key] = result;\n              done();\n            }, onfailure);\n          } catch (e) {\n            onfailure(e);\n          }\n        }\n        // Publish promise synchronously; invocations further down in the plan may depend on it.\n        promises[key] = invocation.promise;\n      }\n      \n      return result;\n    };\n  };\n  \n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#resolve\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Resolves a set of invocables. An invocable is a function to be invoked via \n   * `$injector.invoke()`, and can have an arbitrary number of dependencies. \n   * An invocable can either return a value directly,\n   * or a `$q` promise. If a promise is returned it will be resolved and the \n   * resulting value will be used instead. Dependencies of invocables are resolved \n   * (in this order of precedence)\n   *\n   * - from the specified `locals`\n   * - from another invocable that is part of this `$resolve` call\n   * - from an invocable that is inherited from a `parent` call to `$resolve` \n   *   (or recursively\n   * - from any ancestor `$resolve` of that parent).\n   *\n   * The return value of `$resolve` is a promise for an object that contains \n   * (in this order of precedence)\n   *\n   * - any `locals` (if specified)\n   * - the resolved return values of all injectables\n   * - any values inherited from a `parent` call to `$resolve` (if specified)\n   *\n   * The promise will resolve after the `parent` promise (if any) and all promises \n   * returned by injectables have been resolved. If any invocable \n   * (or `$injector.invoke`) throws an exception, or if a promise returned by an \n   * invocable is rejected, the `$resolve` promise is immediately rejected with the \n   * same error. A rejection of a `parent` promise (if specified) will likewise be \n   * propagated immediately. Once the `$resolve` promise has been rejected, no \n   * further invocables will be called.\n   * \n   * Cyclic dependencies between invocables are not permitted and will caues `$resolve`\n   * to throw an error. As a special case, an injectable can depend on a parameter \n   * with the same name as the injectable, which will be fulfilled from the `parent` \n   * injectable of the same name. This allows inherited values to be decorated. \n   * Note that in this case any other injectable in the same `$resolve` with the same\n   * dependency would see the decorated value, not the inherited value.\n   *\n   * Note that missing dependencies -- unlike cyclic dependencies -- will cause an \n   * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) \n   * exception.\n   *\n   * Invocables are invoked eagerly as soon as all dependencies are available. \n   * This is true even for dependencies inherited from a `parent` call to `$resolve`.\n   *\n   * As a special case, an invocable can be a string, in which case it is taken to \n   * be a service name to be passed to `$injector.get()`. This is supported primarily \n   * for backwards-compatibility with the `resolve` property of `$routeProvider` \n   * routes.\n   *\n   * @param {object} invocables functions to invoke or \n   * `$injector` services to fetch.\n   * @param {object} locals  values to make available to the injectables\n   * @param {object} parent  a promise returned by another call to `$resolve`.\n   * @param {object} self  the `this` for the invoked methods\n   * @return {object} Promise for an object that contains the resolved return value\n   * of all invocables, as well as any inherited and local values.\n   */\n  this.resolve = function (invocables, locals, parent, self) {\n    return this.study(invocables)(locals, parent, self);\n  };\n}\n\nangular.module('ui.router.util').service('$resolve', $Resolve);\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$templateFactory\n *\n * @requires $http\n * @requires $templateCache\n * @requires $injector\n *\n * @description\n * Service. Manages loading of templates.\n */\n$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];\nfunction $TemplateFactory(  $http,   $templateCache,   $injector) {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromConfig\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a configuration object. \n   *\n   * @param {object} config Configuration object for which to load a template. \n   * The following properties are search in the specified order, and the first one \n   * that is defined is used to create the template:\n   *\n   * @param {string|object} config.template html string template or function to \n   * load via {@link ui.router.util.$templateFactory#fromString fromString}.\n   * @param {string|object} config.templateUrl url to load or a function returning \n   * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.\n   * @param {Function} config.templateProvider function to invoke via \n   * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.\n   * @param {object} params  Parameters to pass to the template function.\n   * @param {object} locals Locals to pass to `invoke` if the template is loaded \n   * via a `templateProvider`. Defaults to `{ params: params }`.\n   *\n   * @return {string|object}  The template html as a string, or a promise for \n   * that string,or `null` if no template is configured.\n   */\n  this.fromConfig = function (config, params, locals) {\n    return (\n      isDefined(config.template) ? this.fromString(config.template, params) :\n      isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :\n      isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :\n      null\n    );\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromString\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param {string|object} template html template as a string or function that \n   * returns an html template as a string.\n   * @param {object} params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that \n   * string.\n   */\n  this.fromString = function (template, params) {\n    return isFunction(template) ? template(params) : template;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   * \n   * @description\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function \n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromUrl = function (url, params) {\n    if (isFunction(url)) url = url(params);\n    if (url == null) return null;\n    else return $http\n        .get(url, { cache: $templateCache, headers: { Accept: 'text/html' }})\n        .then(function(response) { return response.data; });\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromProvider\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param {Function} provider Function to invoke via `$injector.invoke`\n   * @param {Object} params Parameters for the template.\n   * @param {Object} locals Locals to pass to `invoke`. Defaults to \n   * `{ params: params }`.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromProvider = function (provider, params, locals) {\n    return $injector.invoke(provider, null, locals || { params: params });\n  };\n}\n\nangular.module('ui.router.util').service('$templateFactory', $TemplateFactory);\n\nvar $$UMFP; // reference to $UrlMatcherFactoryProvider\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:UrlMatcher\n *\n * @description\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list\n * of search parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.\n * \n * Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace\n * syntax, which optionally allows a regular expression for the parameter to be specified:\n *\n * * `':'` name - colon placeholder\n * * `'*'` name - catch-all placeholder\n * * `'{' name '}'` - curly placeholder\n * * `'{' name ':' regexp|type '}'` - curly placeholder with regexp or type name. Should the\n *   regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters). For colon \n * placeholders or curly placeholders without an explicit regexp, a path parameter matches any\n * number of characters other than '/'. For catch-all placeholders the path parameter matches\n * any number of characters.\n * \n * Examples:\n * \n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n *   in the built-in  `date` Type matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n * @param {string} pattern  The pattern to compile into a matcher.\n * @param {Object} config  A configuration object hash:\n * @param {Object=} parentMatcher Used to concatenate the pattern/config onto\n *   an existing UrlMatcher\n *\n * * `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * * `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n *\n * @property {string} prefix  A static prefix of this pattern. The matcher guarantees that any\n *   URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns\n *   non-null) will start with this prefix.\n *\n * @property {string} source  The pattern that was passed into the constructor\n *\n * @property {string} sourcePath  The path portion of the source property\n *\n * @property {string} sourceSearch  The search portion of the source property\n *\n * @property {string} regex  The constructed regex that will be used to match against the url when \n *   it is time to determine which url will match.\n *\n * @returns {Object}  New `UrlMatcher` object\n */\nfunction UrlMatcher(pattern, config, parentMatcher) {\n  config = extend({ params: {} }, isObject(config) ? config : {});\n\n  // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n  //   '*' name\n  //   ':' name\n  //   '{' name '}'\n  //   '{' name ':' regexp '}'\n  // The regular expression is somewhat complicated due to the need to allow curly braces\n  // inside the regular expression. The placeholder regexp breaks down as follows:\n  //    ([:*])([\\w\\[\\]]+)              - classic placeholder ($1 / $2) (search version has - for snake-case)\n  //    \\{([\\w\\[\\]]+)(?:\\:( ... ))?\\}  - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n  //    (?: ... | ... | ... )+         - the regexp consists of any number of atoms, an atom being either\n  //    [^{}\\\\]+                       - anything other than curly braces or backslash\n  //    \\\\.                            - a backslash escape\n  //    \\{(?:[^{}\\\\]+|\\\\.)*\\}          - a matched set of curly braces containing other atoms\n  var placeholder       = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      searchPlaceholder = /([:]?)([\\w\\[\\]-]+)|\\{([\\w\\[\\]-]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      compiled = '^', last = 0, m,\n      segments = this.segments = [],\n      parentParams = parentMatcher ? parentMatcher.params : {},\n      params = this.params = parentMatcher ? parentMatcher.params.$$new() : new $$UMFP.ParamSet(),\n      paramNames = [];\n\n  function addParameter(id, type, config, location) {\n    paramNames.push(id);\n    if (parentParams[id]) return parentParams[id];\n    if (!/^\\w+(-+\\w+)*(?:\\[\\])?$/.test(id)) throw new Error(\"Invalid parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    if (params[id]) throw new Error(\"Duplicate parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    params[id] = new $$UMFP.Param(id, type, config, location);\n    return params[id];\n  }\n\n  function quoteRegExp(string, pattern, squash) {\n    var surroundPattern = ['',''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n    if (!pattern) return result;\n    switch(squash) {\n      case false: surroundPattern = ['(', ')'];   break;\n      case true:  surroundPattern = ['?(', ')?']; break;\n      default:    surroundPattern = ['(' + squash + \"|\", ')?'];  break;\n    }\n    return result + surroundPattern[0] + pattern + surroundPattern[1];\n  }\n\n  this.source = pattern;\n\n  // Split into static segments separated by path parameter placeholders.\n  // The number of segments is always 1 more than the number of parameters.\n  function matchDetails(m, isSearch) {\n    var id, regexp, segment, type, cfg, arrayMode;\n    id          = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null\n    cfg         = config.params[id];\n    segment     = pattern.substring(last, m.index);\n    regexp      = isSearch ? m[4] : m[4] || (m[1] == '*' ? '.*' : null);\n    type        = $$UMFP.type(regexp || \"string\") || inherit($$UMFP.type(\"string\"), { pattern: new RegExp(regexp) });\n    return {\n      id: id, regexp: regexp, segment: segment, type: type, cfg: cfg\n    };\n  }\n\n  var p, param, segment;\n  while ((m = placeholder.exec(pattern))) {\n    p = matchDetails(m, false);\n    if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n    param = addParameter(p.id, p.type, p.cfg, \"path\");\n    compiled += quoteRegExp(p.segment, param.type.pattern.source, param.squash);\n    segments.push(p.segment);\n    last = placeholder.lastIndex;\n  }\n  segment = pattern.substring(last);\n\n  // Find any search parameter names and remove them from the last segment\n  var i = segment.indexOf('?');\n\n  if (i >= 0) {\n    var search = this.sourceSearch = segment.substring(i);\n    segment = segment.substring(0, i);\n    this.sourcePath = pattern.substring(0, last + i);\n\n    if (search.length > 0) {\n      last = 0;\n      while ((m = searchPlaceholder.exec(search))) {\n        p = matchDetails(m, true);\n        param = addParameter(p.id, p.type, p.cfg, \"search\");\n        last = placeholder.lastIndex;\n        // check if ?&\n      }\n    }\n  } else {\n    this.sourcePath = pattern;\n    this.sourceSearch = '';\n  }\n\n  compiled += quoteRegExp(segment) + (config.strict === false ? '\\/?' : '') + '$';\n  segments.push(segment);\n\n  this.regexp = new RegExp(compiled, config.caseInsensitive ? 'i' : undefined);\n  this.prefix = segments[0];\n  this.$$paramNames = paramNames;\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#concat\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns a new matcher for a pattern constructed by appending the path part and adding the\n * search parameters of the specified pattern to this pattern. The current pattern is not\n * modified. This can be understood as creating a pattern for URLs that are relative to (or\n * suffixes of) the current pattern.\n *\n * @example\n * The following two matchers are equivalent:\n * <pre>\n * new UrlMatcher('/user/{id}?q').concat('/details?date');\n * new UrlMatcher('/user/{id}/details?q&date');\n * </pre>\n *\n * @param {string} pattern  The pattern to append.\n * @param {Object} config  An object hash of the configuration for the matcher.\n * @returns {UrlMatcher}  A matcher for the concatenated pattern.\n */\nUrlMatcher.prototype.concat = function (pattern, config) {\n  // Because order of search parameters is irrelevant, we can add our own search\n  // parameters to the end of the new pattern. Parse the new pattern by itself\n  // and then join the bits together, but it's much easier to do this on a string level.\n  var defaultConfig = {\n    caseInsensitive: $$UMFP.caseInsensitive(),\n    strict: $$UMFP.strictMode(),\n    squash: $$UMFP.defaultSquashPolicy()\n  };\n  return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch, extend(defaultConfig, config), this);\n};\n\nUrlMatcher.prototype.toString = function () {\n  return this.source;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#exec\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Tests the specified path against this matcher, and returns an object containing the captured\n * parameter values, or null if the path does not match. The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `searchParams`. This means that search parameters are always treated\n * as optional.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n *   x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * </pre>\n *\n * @param {string} path  The URL path to match, e.g. `$location.path()`.\n * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.\n * @returns {Object}  The captured parameter values.\n */\nUrlMatcher.prototype.exec = function (path, searchParams) {\n  var m = this.regexp.exec(path);\n  if (!m) return null;\n  searchParams = searchParams || {};\n\n  var paramNames = this.parameters(), nTotal = paramNames.length,\n    nPath = this.segments.length - 1,\n    values = {}, i, j, cfg, paramName;\n\n  if (nPath !== m.length - 1) throw new Error(\"Unbalanced capture group in route '\" + this.source + \"'\");\n\n  function decodePathArray(string) {\n    function reverseString(str) { return str.split(\"\").reverse().join(\"\"); }\n    function unquoteDashes(str) { return str.replace(/\\\\-/, \"-\"); }\n\n    var split = reverseString(string).split(/-(?!\\\\)/);\n    var allReversed = map(split, reverseString);\n    return map(allReversed, unquoteDashes).reverse();\n  }\n\n  for (i = 0; i < nPath; i++) {\n    paramName = paramNames[i];\n    var param = this.params[paramName];\n    var paramVal = m[i+1];\n    // if the param value matches a pre-replace pair, replace the value before decoding.\n    for (j = 0; j < param.replace; j++) {\n      if (param.replace[j].from === paramVal) paramVal = param.replace[j].to;\n    }\n    if (paramVal && param.array === true) paramVal = decodePathArray(paramVal);\n    values[paramName] = param.value(paramVal);\n  }\n  for (/**/; i < nTotal; i++) {\n    paramName = paramNames[i];\n    values[paramName] = this.params[paramName].value(searchParams[paramName]);\n  }\n\n  return values;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#parameters\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns the names of all path and search parameters of this pattern in an unspecified order.\n * \n * @returns {Array.<string>}  An array of parameter names. Must be treated as read-only. If the\n *    pattern has no parameters, an empty array is returned.\n */\nUrlMatcher.prototype.parameters = function (param) {\n  if (!isDefined(param)) return this.$$paramNames;\n  return this.params[param] || null;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#validate\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param {Object} params The object hash of parameters to validate.\n * @returns {boolean} Returns `true` if `params` validates, otherwise `false`.\n */\nUrlMatcher.prototype.validates = function (params) {\n  return this.params.$$validates(params);\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#format\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters. Null values for path parameters are\n * treated as empty strings.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * </pre>\n *\n * @param {Object} values  the values to substitute for the parameters in this pattern.\n * @returns {string}  the formatted URL (path and optionally search part).\n */\nUrlMatcher.prototype.format = function (values) {\n  values = values || {};\n  var segments = this.segments, params = this.parameters(), paramset = this.params;\n  if (!this.validates(values)) return null;\n\n  var i, search = false, nPath = segments.length - 1, nTotal = params.length, result = segments[0];\n\n  function encodeDashes(str) { // Replace dashes with encoded \"\\-\"\n    return encodeURIComponent(str).replace(/-/g, function(c) { return '%5C%' + c.charCodeAt(0).toString(16).toUpperCase(); });\n  }\n\n  for (i = 0; i < nTotal; i++) {\n    var isPathParam = i < nPath;\n    var name = params[i], param = paramset[name], value = param.value(values[name]);\n    var isDefaultValue = param.isOptional && param.type.equals(param.value(), value);\n    var squash = isDefaultValue ? param.squash : false;\n    var encoded = param.type.encode(value);\n\n    if (isPathParam) {\n      var nextSegment = segments[i + 1];\n      if (squash === false) {\n        if (encoded != null) {\n          if (isArray(encoded)) {\n            result += map(encoded, encodeDashes).join(\"-\");\n          } else {\n            result += encodeURIComponent(encoded);\n          }\n        }\n        result += nextSegment;\n      } else if (squash === true) {\n        var capture = result.match(/\\/$/) ? /\\/?(.*)/ : /(.*)/;\n        result += nextSegment.match(capture)[1];\n      } else if (isString(squash)) {\n        result += squash + nextSegment;\n      }\n    } else {\n      if (encoded == null || (isDefaultValue && squash !== false)) continue;\n      if (!isArray(encoded)) encoded = [ encoded ];\n      encoded = map(encoded, encodeURIComponent).join('&' + name + '=');\n      result += (search ? '&' : '?') + (name + '=' + encoded);\n      search = true;\n    }\n  }\n\n  return result;\n};\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:Type\n *\n * @description\n * Implements an interface to define custom parameter types that can be decoded from and encoded to\n * string parameters matched in a URL. Used by {@link ui.router.util.type:UrlMatcher `UrlMatcher`}\n * objects when matching or formatting URLs, or comparing or validating parameter values.\n *\n * See {@link ui.router.util.$urlMatcherFactory#methods_type `$urlMatcherFactory#type()`} for more\n * information on registering custom types.\n *\n * @param {Object} config  A configuration object which contains the custom type definition.  The object's\n *        properties will override the default methods and/or pattern in `Type`'s public interface.\n * @example\n * <pre>\n * {\n *   decode: function(val) { return parseInt(val, 10); },\n *   encode: function(val) { return val && val.toString(); },\n *   equals: function(a, b) { return this.is(a) && a === b; },\n *   is: function(val) { return angular.isNumber(val) isFinite(val) && val % 1 === 0; },\n *   pattern: /\\d+/\n * }\n * </pre>\n *\n * @property {RegExp} pattern The regular expression pattern used to match values of this type when\n *           coming from a substring of a URL.\n *\n * @returns {Object}  Returns a new `Type` object.\n */\nfunction Type(config) {\n  extend(this, config);\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#is\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Detects whether a value is of a particular type. Accepts a native (decoded) value\n * and determines whether it matches the current `Type` object.\n *\n * @param {*} val  The value to check.\n * @param {string} key  Optional. If the type check is happening in the context of a specific\n *        {@link ui.router.util.type:UrlMatcher `UrlMatcher`} object, this is the name of the\n *        parameter in which `val` is stored. Can be used for meta-programming of `Type` objects.\n * @returns {Boolean}  Returns `true` if the value matches the type, otherwise `false`.\n */\nType.prototype.is = function(val, key) {\n  return true;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#encode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Encodes a custom/native type value to a string that can be embedded in a URL. Note that the\n * return value does *not* need to be URL-safe (i.e. passed through `encodeURIComponent()`), it\n * only needs to be a representation of `val` that has been coerced to a string.\n *\n * @param {*} val  The value to encode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {string}  Returns a string representation of `val` that can be encoded in a URL.\n */\nType.prototype.encode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#decode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Converts a parameter value (from URL string or transition param) to a custom/native value.\n *\n * @param {string} val  The URL parameter value to decode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {*}  Returns a custom representation of the URL parameter value.\n */\nType.prototype.decode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#equals\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Determines whether two decoded values are equivalent.\n *\n * @param {*} a  A value to compare against.\n * @param {*} b  A value to compare against.\n * @returns {Boolean}  Returns `true` if the values are equivalent/equal, otherwise `false`.\n */\nType.prototype.equals = function(a, b) {\n  return a == b;\n};\n\nType.prototype.$subPattern = function() {\n  var sub = this.pattern.toString();\n  return sub.substr(1, sub.length - 2);\n};\n\nType.prototype.pattern = /.*/;\n\nType.prototype.toString = function() { return \"{Type:\" + this.name + \"}\"; };\n\n/*\n * Wraps an existing custom Type as an array of Type, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\nType.prototype.$asArray = function(mode, isSearch) {\n  if (!mode) return this;\n  if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n  return new ArrayType(this, mode);\n\n  function ArrayType(type, mode) {\n    function bindTo(type, callbackName) {\n      return function() {\n        return type[callbackName].apply(type, arguments);\n      };\n    }\n\n    // Wrap non-array value as array\n    function arrayWrap(val) { return isArray(val) ? val : (isDefined(val) ? [ val ] : []); }\n    // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n    function arrayUnwrap(val) {\n      switch(val.length) {\n        case 0: return undefined;\n        case 1: return mode === \"auto\" ? val[0] : val;\n        default: return val;\n      }\n    }\n    function falsey(val) { return !val; }\n\n    // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n    function arrayHandler(callback, allTruthyMode) {\n      return function handleArray(val) {\n        val = arrayWrap(val);\n        var result = map(val, callback);\n        if (allTruthyMode === true)\n          return filter(result, falsey).length === 0;\n        return arrayUnwrap(result);\n      };\n    }\n\n    // Wraps type (.equals) functions to operate on each value of an array\n    function arrayEqualsHandler(callback) {\n      return function handleArray(val1, val2) {\n        var left = arrayWrap(val1), right = arrayWrap(val2);\n        if (left.length !== right.length) return false;\n        for (var i = 0; i < left.length; i++) {\n          if (!callback(left[i], right[i])) return false;\n        }\n        return true;\n      };\n    }\n\n    this.encode = arrayHandler(bindTo(type, 'encode'));\n    this.decode = arrayHandler(bindTo(type, 'decode'));\n    this.is     = arrayHandler(bindTo(type, 'is'), true);\n    this.equals = arrayEqualsHandler(bindTo(type, 'equals'));\n    this.pattern = type.pattern;\n    this.$arrayMode = mode;\n  }\n};\n\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$urlMatcherFactory\n *\n * @description\n * Factory for {@link ui.router.util.type:UrlMatcher `UrlMatcher`} instances. The factory\n * is also available to providers under the name `$urlMatcherFactoryProvider`.\n */\nfunction $UrlMatcherFactory() {\n  $$UMFP = this;\n\n  var isCaseInsensitive = false, isStrictMode = true, defaultSquashPolicy = false;\n\n  function valToString(val) { return val != null ? val.toString().replace(/\\//g, \"%2F\") : val; }\n  function valFromString(val) { return val != null ? val.toString().replace(/%2F/g, \"/\") : val; }\n//  TODO: in 1.0, make string .is() return false if value is undefined by default.\n//  function regexpMatches(val) { /*jshint validthis:true */ return isDefined(val) && this.pattern.test(val); }\n  function regexpMatches(val) { /*jshint validthis:true */ return this.pattern.test(val); }\n\n  var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = {\n    string: {\n      encode: valToString,\n      decode: valFromString,\n      is: regexpMatches,\n      pattern: /[^/]*/\n    },\n    int: {\n      encode: valToString,\n      decode: function(val) { return parseInt(val, 10); },\n      is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; },\n      pattern: /\\d+/\n    },\n    bool: {\n      encode: function(val) { return val ? 1 : 0; },\n      decode: function(val) { return parseInt(val, 10) !== 0; },\n      is: function(val) { return val === true || val === false; },\n      pattern: /0|1/\n    },\n    date: {\n      encode: function (val) {\n        if (!this.is(val))\n          return undefined;\n        return [ val.getFullYear(),\n          ('0' + (val.getMonth() + 1)).slice(-2),\n          ('0' + val.getDate()).slice(-2)\n        ].join(\"-\");\n      },\n      decode: function (val) {\n        if (this.is(val)) return val;\n        var match = this.capture.exec(val);\n        return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n      },\n      is: function(val) { return val instanceof Date && !isNaN(val.valueOf()); },\n      equals: function (a, b) { return this.is(a) && this.is(b) && a.toISOString() === b.toISOString(); },\n      pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n      capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/\n    },\n    json: {\n      encode: angular.toJson,\n      decode: angular.fromJson,\n      is: angular.isObject,\n      equals: angular.equals,\n      pattern: /[^/]*/\n    },\n    any: { // does not encode/decode\n      encode: angular.identity,\n      decode: angular.identity,\n      is: angular.identity,\n      equals: angular.equals,\n      pattern: /.*/\n    }\n  };\n\n  function getDefaultConfig() {\n    return {\n      strict: isStrictMode,\n      caseInsensitive: isCaseInsensitive\n    };\n  }\n\n  function isInjectable(value) {\n    return (isFunction(value) || (isArray(value) && isFunction(value[value.length - 1])));\n  }\n\n  /**\n   * [Internal] Get the default value of a parameter, which may be an injectable function.\n   */\n  $UrlMatcherFactory.$$getDefaultValue = function(config) {\n    if (!isInjectable(config.value)) return config.value;\n    if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n    return injector.invoke(config.value);\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#caseInsensitive\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URL matching should be case sensitive (the default behavior), or not.\n   *\n   * @param {boolean} value `false` to match URL in a case sensitive manner; otherwise `true`;\n   * @returns {boolean} the current value of caseInsensitive\n   */\n  this.caseInsensitive = function(value) {\n    if (isDefined(value))\n      isCaseInsensitive = value;\n    return isCaseInsensitive;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#strictMode\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URLs should match trailing slashes, or not (the default behavior).\n   *\n   * @param {boolean=} value `false` to match trailing slashes in URLs, otherwise `true`.\n   * @returns {boolean} the current value of strictMode\n   */\n  this.strictMode = function(value) {\n    if (isDefined(value))\n      isStrictMode = value;\n    return isStrictMode;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#defaultSquashPolicy\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Sets the default behavior when generating or matching URLs with default parameter values.\n   *\n   * @param {string} value A string that defines the default parameter URL squashing behavior.\n   *    `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL\n   *    `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the\n   *             parameter is surrounded by slashes, squash (remove) one slash from the URL\n   *    any other string, e.g. \"~\": When generating an href with a default parameter value, squash (remove)\n   *             the parameter value from the URL and replace it with this string.\n   */\n  this.defaultSquashPolicy = function(value) {\n    if (!isDefined(value)) return defaultSquashPolicy;\n    if (value !== true && value !== false && !isString(value))\n      throw new Error(\"Invalid squash policy: \" + value + \". Valid policies: false, true, arbitrary-string\");\n    defaultSquashPolicy = value;\n    return value;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#compile\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Creates a {@link ui.router.util.type:UrlMatcher `UrlMatcher`} for the specified pattern.\n   *\n   * @param {string} pattern  The URL pattern.\n   * @param {Object} config  The config object hash.\n   * @returns {UrlMatcher}  The UrlMatcher.\n   */\n  this.compile = function (pattern, config) {\n    return new UrlMatcher(pattern, extend(getDefaultConfig(), config));\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#isMatcher\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Returns true if the specified object is a `UrlMatcher`, or false otherwise.\n   *\n   * @param {Object} object  The object to perform the type check against.\n   * @returns {Boolean}  Returns `true` if the object matches the `UrlMatcher` interface, by\n   *          implementing all the same methods.\n   */\n  this.isMatcher = function (o) {\n    if (!isObject(o)) return false;\n    var result = true;\n\n    forEach(UrlMatcher.prototype, function(val, name) {\n      if (isFunction(val)) {\n        result = result && (isDefined(o[name]) && isFunction(o[name]));\n      }\n    });\n    return result;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#type\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Registers a custom {@link ui.router.util.type:Type `Type`} object that can be used to\n   * generate URLs with typed parameters.\n   *\n   * @param {string} name  The type name.\n   * @param {Object|Function} definition   The type definition. See\n   *        {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   * @param {Object|Function} definitionFn (optional) A function that is injected before the app\n   *        runtime starts.  The result of this function is merged into the existing `definition`.\n   *        See {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   *\n   * @returns {Object}  Returns `$urlMatcherFactoryProvider`.\n   *\n   * @example\n   * This is a simple example of a custom type that encodes and decodes items from an\n   * array, using the array index as the URL-encoded value:\n   *\n   * <pre>\n   * var list = ['John', 'Paul', 'George', 'Ringo'];\n   *\n   * $urlMatcherFactoryProvider.type('listItem', {\n   *   encode: function(item) {\n   *     // Represent the list item in the URL using its corresponding index\n   *     return list.indexOf(item);\n   *   },\n   *   decode: function(item) {\n   *     // Look up the list item by index\n   *     return list[parseInt(item, 10)];\n   *   },\n   *   is: function(item) {\n   *     // Ensure the item is valid by checking to see that it appears\n   *     // in the list\n   *     return list.indexOf(item) > -1;\n   *   }\n   * });\n   *\n   * $stateProvider.state('list', {\n   *   url: \"/list/{item:listItem}\",\n   *   controller: function($scope, $stateParams) {\n   *     console.log($stateParams.item);\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * // Changes URL to '/list/3', logs \"Ringo\" to the console\n   * $state.go('list', { item: \"Ringo\" });\n   * </pre>\n   *\n   * This is a more complex example of a type that relies on dependency injection to\n   * interact with services, and uses the parameter name from the URL to infer how to\n   * handle encoding and decoding parameter values:\n   *\n   * <pre>\n   * // Defines a custom type that gets a value from a service,\n   * // where each service gets different types of values from\n   * // a backend API:\n   * $urlMatcherFactoryProvider.type('dbObject', {}, function(Users, Posts) {\n   *\n   *   // Matches up services to URL parameter names\n   *   var services = {\n   *     user: Users,\n   *     post: Posts\n   *   };\n   *\n   *   return {\n   *     encode: function(object) {\n   *       // Represent the object in the URL using its unique ID\n   *       return object.id;\n   *     },\n   *     decode: function(value, key) {\n   *       // Look up the object by ID, using the parameter\n   *       // name (key) to call the correct service\n   *       return services[key].findById(value);\n   *     },\n   *     is: function(object, key) {\n   *       // Check that object is a valid dbObject\n   *       return angular.isObject(object) && object.id && services[key];\n   *     }\n   *     equals: function(a, b) {\n   *       // Check the equality of decoded objects by comparing\n   *       // their unique IDs\n   *       return a.id === b.id;\n   *     }\n   *   };\n   * });\n   *\n   * // In a config() block, you can then attach URLs with\n   * // type-annotated parameters:\n   * $stateProvider.state('users', {\n   *   url: \"/users\",\n   *   // ...\n   * }).state('users.item', {\n   *   url: \"/{user:dbObject}\",\n   *   controller: function($scope, $stateParams) {\n   *     // $stateParams.user will now be an object returned from\n   *     // the Users service\n   *   },\n   *   // ...\n   * });\n   * </pre>\n   */\n  this.type = function (name, definition, definitionFn) {\n    if (!isDefined(definition)) return $types[name];\n    if ($types.hasOwnProperty(name)) throw new Error(\"A type named '\" + name + \"' has already been defined.\");\n\n    $types[name] = new Type(extend({ name: name }, definition));\n    if (definitionFn) {\n      typeQueue.push({ name: name, def: definitionFn });\n      if (!enqueue) flushTypeQueue();\n    }\n    return this;\n  };\n\n  // `flushTypeQueue()` waits until `$urlMatcherFactory` is injected before invoking the queued `definitionFn`s\n  function flushTypeQueue() {\n    while(typeQueue.length) {\n      var type = typeQueue.shift();\n      if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n      angular.extend($types[type.name], injector.invoke(type.def));\n    }\n  }\n\n  // Register default types. Store them in the prototype of $types.\n  forEach(defaultTypes, function(type, name) { $types[name] = new Type(extend({name: name}, type)); });\n  $types = inherit($types, {});\n\n  /* No need to document $get, since it returns this */\n  this.$get = ['$injector', function ($injector) {\n    injector = $injector;\n    enqueue = false;\n    flushTypeQueue();\n\n    forEach(defaultTypes, function(type, name) {\n      if (!$types[name]) $types[name] = new Type(type);\n    });\n    return this;\n  }];\n\n  this.Param = function Param(id, type, config, location) {\n    var self = this;\n    config = unwrapShorthand(config);\n    type = getType(config, type, location);\n    var arrayMode = getArrayMode();\n    type = arrayMode ? type.$asArray(arrayMode, location === \"search\") : type;\n    if (type.name === \"string\" && !arrayMode && location === \"path\" && config.value === undefined)\n      config.value = \"\"; // for 0.2.x; in 0.3.0+ do not automatically default to \"\"\n    var isOptional = config.value !== undefined;\n    var squash = getSquashPolicy(config, isOptional);\n    var replace = getReplace(config, arrayMode, isOptional, squash);\n\n    function unwrapShorthand(config) {\n      var keys = isObject(config) ? objectKeys(config) : [];\n      var isShorthand = indexOf(keys, \"value\") === -1 && indexOf(keys, \"type\") === -1 &&\n                        indexOf(keys, \"squash\") === -1 && indexOf(keys, \"array\") === -1;\n      if (isShorthand) config = { value: config };\n      config.$$fn = isInjectable(config.value) ? config.value : function () { return config.value; };\n      return config;\n    }\n\n    function getType(config, urlType, location) {\n      if (config.type && urlType) throw new Error(\"Param '\"+id+\"' has two type configurations.\");\n      if (urlType) return urlType;\n      if (!config.type) return (location === \"config\" ? $types.any : $types.string);\n      return config.type instanceof Type ? config.type : new Type(config.type);\n    }\n\n    // array config: param name (param[]) overrides default settings.  explicit config overrides param name.\n    function getArrayMode() {\n      var arrayDefaults = { array: (location === \"search\" ? \"auto\" : false) };\n      var arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n      return extend(arrayDefaults, arrayParamNomenclature, config).array;\n    }\n\n    /**\n     * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n     */\n    function getSquashPolicy(config, isOptional) {\n      var squash = config.squash;\n      if (!isOptional || squash === false) return false;\n      if (!isDefined(squash) || squash == null) return defaultSquashPolicy;\n      if (squash === true || isString(squash)) return squash;\n      throw new Error(\"Invalid squash policy: '\" + squash + \"'. Valid policies: false, true, or arbitrary string\");\n    }\n\n    function getReplace(config, arrayMode, isOptional, squash) {\n      var replace, configuredKeys, defaultPolicy = [\n        { from: \"\",   to: (isOptional || arrayMode ? undefined : \"\") },\n        { from: null, to: (isOptional || arrayMode ? undefined : \"\") }\n      ];\n      replace = isArray(config.replace) ? config.replace : [];\n      if (isString(squash))\n        replace.push({ from: squash, to: undefined });\n      configuredKeys = map(replace, function(item) { return item.from; } );\n      return filter(defaultPolicy, function(item) { return indexOf(configuredKeys, item.from) === -1; }).concat(replace);\n    }\n\n    /**\n     * [Internal] Get the default value of a parameter, which may be an injectable function.\n     */\n    function $$getDefaultValue() {\n      if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n      return injector.invoke(config.$$fn);\n    }\n\n    /**\n     * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n     * default value, which may be the result of an injectable function.\n     */\n    function $value(value) {\n      function hasReplaceVal(val) { return function(obj) { return obj.from === val; }; }\n      function $replace(value) {\n        var replacement = map(filter(self.replace, hasReplaceVal(value)), function(obj) { return obj.to; });\n        return replacement.length ? replacement[0] : value;\n      }\n      value = $replace(value);\n      return isDefined(value) ? self.type.decode(value) : $$getDefaultValue();\n    }\n\n    function toString() { return \"{Param:\" + id + \" \" + type + \" squash: '\" + squash + \"' optional: \" + isOptional + \"}\"; }\n\n    extend(this, {\n      id: id,\n      type: type,\n      location: location,\n      array: arrayMode,\n      squash: squash,\n      replace: replace,\n      isOptional: isOptional,\n      value: $value,\n      dynamic: undefined,\n      config: config,\n      toString: toString\n    });\n  };\n\n  function ParamSet(params) {\n    extend(this, params || {});\n  }\n\n  ParamSet.prototype = {\n    $$new: function() {\n      return inherit(this, extend(new ParamSet(), { $$parent: this}));\n    },\n    $$keys: function () {\n      var keys = [], chain = [], parent = this,\n        ignore = objectKeys(ParamSet.prototype);\n      while (parent) { chain.push(parent); parent = parent.$$parent; }\n      chain.reverse();\n      forEach(chain, function(paramset) {\n        forEach(objectKeys(paramset), function(key) {\n            if (indexOf(keys, key) === -1 && indexOf(ignore, key) === -1) keys.push(key);\n        });\n      });\n      return keys;\n    },\n    $$values: function(paramValues) {\n      var values = {}, self = this;\n      forEach(self.$$keys(), function(key) {\n        values[key] = self[key].value(paramValues && paramValues[key]);\n      });\n      return values;\n    },\n    $$equals: function(paramValues1, paramValues2) {\n      var equal = true, self = this;\n      forEach(self.$$keys(), function(key) {\n        var left = paramValues1 && paramValues1[key], right = paramValues2 && paramValues2[key];\n        if (!self[key].type.equals(left, right)) equal = false;\n      });\n      return equal;\n    },\n    $$validates: function $$validate(paramValues) {\n      var result = true, isOptional, val, param, self = this;\n\n      forEach(this.$$keys(), function(key) {\n        param = self[key];\n        val = paramValues[key];\n        isOptional = !val && param.isOptional;\n        result = result && (isOptional || !!param.type.is(val));\n      });\n      return result;\n    },\n    $$parent: undefined\n  };\n\n  this.ParamSet = ParamSet;\n}\n\n// Register as a provider so it's available to other providers\nangular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);\nangular.module('ui.router.util').run(['$urlMatcherFactory', function($urlMatcherFactory) { }]);\n\n/**\n * @ngdoc object\n * @name ui.router.router.$urlRouterProvider\n *\n * @requires ui.router.util.$urlMatcherFactoryProvider\n * @requires $locationProvider\n *\n * @description\n * `$urlRouterProvider` has the responsibility of watching `$location`. \n * When `$location` changes it runs through a list of rules one by one until a \n * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify \n * a url in a state configuration. All urls are compiled into a UrlMatcher object.\n *\n * There are several methods on `$urlRouterProvider` that make it useful to use directly\n * in your module config.\n */\n$UrlRouterProvider.$inject = ['$locationProvider', '$urlMatcherFactoryProvider'];\nfunction $UrlRouterProvider(   $locationProvider,   $urlMatcherFactory) {\n  var rules = [], otherwise = null, interceptDeferred = false, listener;\n\n  // Returns a string that is a prefix of all strings matching the RegExp\n  function regExpPrefix(re) {\n    var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n    return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n  }\n\n  // Interpolates matched values into a String.replace()-style pattern\n  function interpolate(pattern, match) {\n    return pattern.replace(/\\$(\\$|\\d{1,2})/, function (m, what) {\n      return match[what === '$' ? 0 : Number(what)];\n    });\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#rule\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines rules that are used by `$urlRouterProvider` to find matches for\n   * specific URLs.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {object} rule Handler function that takes `$injector` and `$location`\n   * services as arguments. You can use them to return a valid path as a string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.rule = function (rule) {\n    if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    rules.push(rule);\n    return this;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouterProvider#otherwise\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines a path that is used when an invalid route is requested.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     return '/a/valid/url';\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} rule The url path you want to redirect to or a function \n   * rule that returns the url path. The function version is passed two params: \n   * `$injector` and `$location` services, and must return a url string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.otherwise = function (rule) {\n    if (isString(rule)) {\n      var redirect = rule;\n      rule = function () { return redirect; };\n    }\n    else if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    otherwise = rule;\n    return this;\n  };\n\n\n  function handleIfMatch($injector, handler, match) {\n    if (!match) return false;\n    var result = $injector.invoke(handler, handler, { $match: match });\n    return isDefined(result) ? result : true;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#when\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Registers a handler for a given url matching. if handle is a string, it is\n   * treated as a redirect, and is interpolated according to the syntax of match\n   * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n   *\n   * If the handler is a function, it is injectable. It gets invoked if `$location`\n   * matches. You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when = function (what, handler) {\n    var redirect, handlerIsString = isString(handler);\n    if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n    if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n      throw new Error(\"invalid 'handler' in when()\");\n\n    var strategies = {\n      matcher: function (what, handler) {\n        if (handlerIsString) {\n          redirect = $urlMatcherFactory.compile(handler);\n          handler = ['$match', function ($match) { return redirect.format($match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n        }, {\n          prefix: isString(what.prefix) ? what.prefix : ''\n        });\n      },\n      regex: function (what, handler) {\n        if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n        if (handlerIsString) {\n          redirect = handler;\n          handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path()));\n        }, {\n          prefix: regExpPrefix(what)\n        });\n      }\n    };\n\n    var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n    for (var n in check) {\n      if (check[n]) return this.rule(strategies[n](what, handler));\n    }\n\n    throw new Error(\"invalid 'what' in when()\");\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#deferIntercept\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Disables (or enables) deferring location change interception.\n   *\n   * If you wish to customize the behavior of syncing the URL (for example, if you wish to\n   * defer a transition but maintain the current URL), call this method at configuration time.\n   * Then, at run time, call `$urlRouter.listen()` after you have configured your own\n   * `$locationChangeSuccess` event handler.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *\n   *   // Prevent $urlRouter from automatically intercepting URL changes;\n   *   // this allows you to configure custom behavior in between\n   *   // location changes and route synchronization:\n   *   $urlRouterProvider.deferIntercept();\n   *\n   * }).run(function ($rootScope, $urlRouter, UserService) {\n   *\n   *   $rootScope.$on('$locationChangeSuccess', function(e) {\n   *     // UserService is an example service for managing user state\n   *     if (UserService.isLoggedIn()) return;\n   *\n   *     // Prevent $urlRouter's default handler from firing\n   *     e.preventDefault();\n   *\n   *     UserService.handleLogin().then(function() {\n   *       // Once the user has logged in, sync the current URL\n   *       // to the router:\n   *       $urlRouter.sync();\n   *     });\n   *   });\n   *\n   *   // Configures $urlRouter's listener *after* your custom listener\n   *   $urlRouter.listen();\n   * });\n   * </pre>\n   *\n   * @param {boolean} defer Indicates whether to defer location change interception. Passing\n            no parameter is equivalent to `true`.\n   */\n  this.deferIntercept = function (defer) {\n    if (defer === undefined) defer = true;\n    interceptDeferred = defer;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouter\n   *\n   * @requires $location\n   * @requires $rootScope\n   * @requires $injector\n   * @requires $browser\n   *\n   * @description\n   *\n   */\n  this.$get = $get;\n  $get.$inject = ['$location', '$rootScope', '$injector', '$browser'];\n  function $get(   $location,   $rootScope,   $injector,   $browser) {\n\n    var baseHref = $browser.baseHref(), location = $location.url(), lastPushedUrl;\n\n    function appendBasePath(url, isHtml5, absolute) {\n      if (baseHref === '/') return url;\n      if (isHtml5) return baseHref.slice(0, -1) + url;\n      if (absolute) return baseHref.slice(1) + url;\n      return url;\n    }\n\n    // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree\n    function update(evt) {\n      if (evt && evt.defaultPrevented) return;\n      var ignoreUpdate = lastPushedUrl && $location.url() === lastPushedUrl;\n      lastPushedUrl = undefined;\n      if (ignoreUpdate) return true;\n\n      function check(rule) {\n        var handled = rule($injector, $location);\n\n        if (!handled) return false;\n        if (isString(handled)) $location.replace().url(handled);\n        return true;\n      }\n      var n = rules.length, i;\n\n      for (i = 0; i < n; i++) {\n        if (check(rules[i])) return;\n      }\n      // always check otherwise last to allow dynamic updates to the set of rules\n      if (otherwise) check(otherwise);\n    }\n\n    function listen() {\n      listener = listener || $rootScope.$on('$locationChangeSuccess', update);\n      return listener;\n    }\n\n    if (!interceptDeferred) listen();\n\n    return {\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#sync\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.\n       * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event,\n       * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed\n       * with the transition by calling `$urlRouter.sync()`.\n       *\n       * @example\n       * <pre>\n       * angular.module('app', ['ui.router'])\n       *   .run(function($rootScope, $urlRouter) {\n       *     $rootScope.$on('$locationChangeSuccess', function(evt) {\n       *       // Halt state change from even starting\n       *       evt.preventDefault();\n       *       // Perform custom logic\n       *       var meetsRequirement = ...\n       *       // Continue with the update and state transition if logic allows\n       *       if (meetsRequirement) $urlRouter.sync();\n       *     });\n       * });\n       * </pre>\n       */\n      sync: function() {\n        update();\n      },\n\n      listen: function() {\n        return listen();\n      },\n\n      update: function(read) {\n        if (read) {\n          location = $location.url();\n          return;\n        }\n        if ($location.url() === location) return;\n\n        $location.url(location);\n        $location.replace();\n      },\n\n      push: function(urlMatcher, params, options) {\n        $location.url(urlMatcher.format(params || {}));\n        lastPushedUrl = options && options.$$avoidResync ? $location.url() : undefined;\n        if (options && options.replace) $location.replace();\n      },\n\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#href\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * A URL generation method that returns the compiled URL for a given\n       * {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters.\n       *\n       * @example\n       * <pre>\n       * $bob = $urlRouter.href(new UrlMatcher(\"/about/:person\"), {\n       *   person: \"bob\"\n       * });\n       * // $bob == \"/about/bob\";\n       * </pre>\n       *\n       * @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate.\n       * @param {object=} params An object of parameter values to fill the matcher's required parameters.\n       * @param {object=} options Options object. The options are:\n       *\n       * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n       *\n       * @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n       */\n      href: function(urlMatcher, params, options) {\n        if (!urlMatcher.validates(params)) return null;\n\n        var isHtml5 = $locationProvider.html5Mode();\n        if (angular.isObject(isHtml5)) {\n          isHtml5 = isHtml5.enabled;\n        }\n        \n        var url = urlMatcher.format(params);\n        options = options || {};\n\n        if (!isHtml5 && url !== null) {\n          url = \"#\" + $locationProvider.hashPrefix() + url;\n        }\n        url = appendBasePath(url, isHtml5, options.absolute);\n\n        if (!options.absolute || !url) {\n          return url;\n        }\n\n        var slash = (!isHtml5 && url ? '/' : ''), port = $location.port();\n        port = (port === 80 || port === 443 ? '' : ':' + port);\n\n        return [$location.protocol(), '://', $location.host(), port, slash, url].join('');\n      }\n    };\n  }\n}\n\nangular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$stateProvider\n *\n * @requires ui.router.router.$urlRouterProvider\n * @requires ui.router.util.$urlMatcherFactoryProvider\n *\n * @description\n * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\n$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider'];\nfunction $StateProvider(   $urlRouterProvider,   $urlMatcherFactory) {\n\n  var root, states = {}, $state, queue = {}, abstractKey = 'abstract';\n\n  // Builds state properties from definition passed to registerState()\n  var stateBuilder = {\n\n    // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.\n    // state.children = [];\n    // if (parent) parent.children.push(state);\n    parent: function(state) {\n      if (isDefined(state.parent) && state.parent) return findState(state.parent);\n      // regex matches any valid composite state name\n      // would match \"contact.list\" but not \"contacts\"\n      var compositeName = /^(.+)\\.[^.]+$/.exec(state.name);\n      return compositeName ? findState(compositeName[1]) : root;\n    },\n\n    // inherit 'data' from parent and override by own values (if any)\n    data: function(state) {\n      if (state.parent && state.parent.data) {\n        state.data = state.self.data = extend({}, state.parent.data, state.data);\n      }\n      return state.data;\n    },\n\n    // Build a URLMatcher if necessary, either via a relative or absolute URL\n    url: function(state) {\n      var url = state.url, config = { params: state.params || {} };\n\n      if (isString(url)) {\n        if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);\n        return (state.parent.navigable || root).url.concat(url, config);\n      }\n\n      if (!url || $urlMatcherFactory.isMatcher(url)) return url;\n      throw new Error(\"Invalid url '\" + url + \"' in state '\" + state + \"'\");\n    },\n\n    // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n    navigable: function(state) {\n      return state.url ? state : (state.parent ? state.parent.navigable : null);\n    },\n\n    // Own parameters for this state. state.url.params is already built at this point. Create and add non-url params\n    ownParams: function(state) {\n      var params = state.url && state.url.params || new $$UMFP.ParamSet();\n      forEach(state.params || {}, function(config, id) {\n        if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, \"config\");\n      });\n      return params;\n    },\n\n    // Derive parameters for this state and ensure they're a super-set of parent's parameters\n    params: function(state) {\n      return state.parent && state.parent.params ? extend(state.parent.params.$$new(), state.ownParams) : new $$UMFP.ParamSet();\n    },\n\n    // If there is no explicit multi-view configuration, make one up so we don't have\n    // to handle both cases in the view directive later. Note that having an explicit\n    // 'views' property will mean the default unnamed view properties are ignored. This\n    // is also a good time to resolve view names to absolute names, so everything is a\n    // straight lookup at link time.\n    views: function(state) {\n      var views = {};\n\n      forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {\n        if (name.indexOf('@') < 0) name += '@' + state.parent.name;\n        views[name] = view;\n      });\n      return views;\n    },\n\n    // Keep a full path from the root down to this state as this is needed for state activation.\n    path: function(state) {\n      return state.parent ? state.parent.path.concat(state) : []; // exclude root from path\n    },\n\n    // Speed up $state.contains() as it's used a lot\n    includes: function(state) {\n      var includes = state.parent ? extend({}, state.parent.includes) : {};\n      includes[state.name] = true;\n      return includes;\n    },\n\n    $delegates: {}\n  };\n\n  function isRelative(stateName) {\n    return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n  }\n\n  function findState(stateOrName, base) {\n    if (!stateOrName) return undefined;\n\n    var isStr = isString(stateOrName),\n        name  = isStr ? stateOrName : stateOrName.name,\n        path  = isRelative(name);\n\n    if (path) {\n      if (!base) throw new Error(\"No reference point given for path '\"  + name + \"'\");\n      base = findState(base);\n      \n      var rel = name.split(\".\"), i = 0, pathLength = rel.length, current = base;\n\n      for (; i < pathLength; i++) {\n        if (rel[i] === \"\" && i === 0) {\n          current = base;\n          continue;\n        }\n        if (rel[i] === \"^\") {\n          if (!current.parent) throw new Error(\"Path '\" + name + \"' not valid for state '\" + base.name + \"'\");\n          current = current.parent;\n          continue;\n        }\n        break;\n      }\n      rel = rel.slice(i).join(\".\");\n      name = current.name + (current.name && rel ? \".\" : \"\") + rel;\n    }\n    var state = states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    }\n    return undefined;\n  }\n\n  function queueState(parentName, state) {\n    if (!queue[parentName]) {\n      queue[parentName] = [];\n    }\n    queue[parentName].push(state);\n  }\n\n  function flushQueuedChildren(parentName) {\n    var queued = queue[parentName] || [];\n    while(queued.length) {\n      registerState(queued.shift());\n    }\n  }\n\n  function registerState(state) {\n    // Wrap a new object around the state so we can store our private details easily.\n    state = inherit(state, {\n      self: state,\n      resolve: state.resolve || {},\n      toString: function() { return this.name; }\n    });\n\n    var name = state.name;\n    if (!isString(name) || name.indexOf('@') >= 0) throw new Error(\"State must have a valid name\");\n    if (states.hasOwnProperty(name)) throw new Error(\"State '\" + name + \"'' is already defined\");\n\n    // Get parent name\n    var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))\n        : (isString(state.parent)) ? state.parent\n        : (isObject(state.parent) && isString(state.parent.name)) ? state.parent.name\n        : '';\n\n    // If parent is not registered yet, add state to queue and register later\n    if (parentName && !states[parentName]) {\n      return queueState(parentName, state.self);\n    }\n\n    for (var key in stateBuilder) {\n      if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);\n    }\n    states[name] = state;\n\n    // Register the state in the global state list and with $urlRouter if necessary.\n    if (!state[abstractKey] && state.url) {\n      $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {\n        if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {\n          $state.transitionTo(state, $match, { inherit: true, location: false });\n        }\n      }]);\n    }\n\n    // Register any queued children\n    flushQueuedChildren(name);\n\n    return state;\n  }\n\n  // Checks text to see if it looks like a glob.\n  function isGlob (text) {\n    return text.indexOf('*') > -1;\n  }\n\n  // Returns true if glob matches current $state name.\n  function doesStateMatchGlob (glob) {\n    var globSegments = glob.split('.'),\n        segments = $state.$current.name.split('.');\n\n    //match greedy starts\n    if (globSegments[0] === '**') {\n       segments = segments.slice(indexOf(segments, globSegments[1]));\n       segments.unshift('**');\n    }\n    //match greedy ends\n    if (globSegments[globSegments.length - 1] === '**') {\n       segments.splice(indexOf(segments, globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);\n       segments.push('**');\n    }\n\n    if (globSegments.length != segments.length) {\n      return false;\n    }\n\n    //match single stars\n    for (var i = 0, l = globSegments.length; i < l; i++) {\n      if (globSegments[i] === '*') {\n        segments[i] = '*';\n      }\n    }\n\n    return segments.join('') === globSegments.join('');\n  }\n\n\n  // Implicit root state that is always active\n  root = registerState({\n    name: '',\n    url: '^',\n    views: null,\n    'abstract': true\n  });\n  root.navigable = null;\n\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#decorator\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Allows you to extend (carefully) or override (at your own peril) the \n   * `stateBuilder` object used internally by `$stateProvider`. This can be used \n   * to add custom functionality to ui-router, for example inferring templateUrl \n   * based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new \n   * properties within the state's internal definition. There is currently no clear \n   * use-case for this beyond accessing internal states (i.e. $state.$current), \n   * however, expect this to become increasingly relevant as we introduce additional \n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of \n   * execution of the builder functions in non-deterministic. Builder functions \n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n   *   or `null`.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is \n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to \n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view \n   *   name (i.e. \"viewName@stateName\") and each value is the config object \n   *   (template, controller) for the view. Even when you don't use the views object \n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template \n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state, \n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state. \n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that \n   *   would pass a `$state.includes()` test.\n   *\n   * @example\n   * <pre>\n   * // Override the internal 'views' builder with a function that takes the state\n   * // definition, and a reference to the internal function being overridden:\n   * $stateProvider.decorator('views', function (state, parent) {\n   *   var result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(views, function (config, name) {\n   *     var autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * $state.go('home');\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * </pre>\n   *\n   * @param {string} name The name of the builder function to decorate. \n   * @param {object} func A function that is responsible for decorating the original \n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  this.decorator = decorator;\n  function decorator(name, func) {\n    /*jshint validthis: true */\n    if (isString(name) && !isDefined(func)) {\n      return stateBuilder[name];\n    }\n    if (!isFunction(func) || !isString(name)) {\n      return this;\n    }\n    if (stateBuilder[name] && !stateBuilder.$delegates[name]) {\n      stateBuilder.$delegates[name] = stateBuilder[name];\n    }\n    stateBuilder[name] = func;\n    return this;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#state\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Registers a state configuration under a given state name. The stateConfig object\n   * has the following acceptable properties.\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} stateConfig State configuration object.\n   * @param {string|function=} stateConfig.template\n   * <a id='template'></a>\n   *   html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property \n   *   takes precedence over templateUrl.\n   *   \n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <pre>template:\n   *   \"<h1>inline template definition</h1>\" +\n   *   \"<div ui-view></div>\"</pre>\n   * <pre>template: function(params) {\n   *       return \"<h1>generated template</h1>\"; }</pre>\n   * </div>\n   *\n   * @param {string|function=} stateConfig.templateUrl\n   * <a id='templateUrl'></a>\n   *\n   *   path or function that returns a path to an html\n   *   template that should be used by uiView.\n   *   \n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by \n   *     applying the current state\n   *\n   * <pre>templateUrl: \"home.html\"</pre>\n   * <pre>templateUrl: function(params) {\n   *     return myTemplates[params.pageId]; }</pre>\n   *\n   * @param {function=} stateConfig.templateProvider\n   * <a id='templateProvider'></a>\n   *    Provider function that returns HTML content string.\n   * <pre> templateProvider:\n   *       function(MyTemplateService, params) {\n   *         return MyTemplateService.getTemplate(params.pageId);\n   *       }</pre>\n   *\n   * @param {string|function=} stateConfig.controller\n   * <a id='controller'></a>\n   *\n   *  Controller fn that should be associated with newly\n   *   related scope or the name of a registered controller if passed as a string.\n   *   Optionally, the ControllerAs may be declared here.\n   * <pre>controller: \"MyRegisteredController\"</pre>\n   * <pre>controller:\n   *     \"MyRegisteredController as fooCtrl\"}</pre>\n   * <pre>controller: function($scope, MyService) {\n   *     $scope.data = MyService.getData(); }</pre>\n   *\n   * @param {function=} stateConfig.controllerProvider\n   * <a id='controllerProvider'></a>\n   *\n   * Injectable provider function that returns the actual controller or string.\n   * <pre>controllerProvider:\n   *   function(MyResolveData) {\n   *     if (MyResolveData.foo)\n   *       return \"FooCtrl\"\n   *     else if (MyResolveData.bar)\n   *       return \"BarCtrl\";\n   *     else return function($scope) {\n   *       $scope.baz = \"Qux\";\n   *     }\n   *   }</pre>\n   *\n   * @param {string=} stateConfig.controllerAs\n   * <a id='controllerAs'></a>\n   * \n   * A controller alias name. If present the controller will be\n   *   published to scope under the controllerAs name.\n   * <pre>controllerAs: \"myCtrl\"</pre>\n   *\n   * @param {object=} stateConfig.resolve\n   * <a id='resolve'></a>\n   *\n   * An optional map&lt;string, function&gt; of dependencies which\n   *   should be injected into the controller. If any of these dependencies are promises, \n   *   the router will wait for them all to be resolved before the controller is instantiated.\n   *   If all the promises are resolved successfully, the $stateChangeSuccess event is fired\n   *   and the values of the resolved promises are injected into any controllers that reference them.\n   *   If any  of the promises are rejected the $stateChangeError event is fired.\n   *\n   *   The map object is:\n   *   \n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function, \n   *     it is injected and return value it treated as dependency. If result is a promise, it is \n   *     resolved before its value is injected into controller.\n   *\n   * <pre>resolve: {\n   *     myResolve1:\n   *       function($http, $stateParams) {\n   *         return $http.get(\"/api/foos/\"+stateParams.fooID);\n   *       }\n   *     }</pre>\n   *\n   * @param {string=} stateConfig.url\n   * <a id='url'></a>\n   *\n   *   A url fragment with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any \n   *   parameters that were passed.\n   *\n   * examples:\n   * <pre>url: \"/home\"\n   * url: \"/users/:userid\"\n   * url: \"/books/{bookid:[a-zA-Z_-]}\"\n   * url: \"/books/{categoryid:int}\"\n   * url: \"/books/{publishername:string}/{categoryid:int}\"\n   * url: \"/messages?before&after\"\n   * url: \"/messages?{before:date}&{after:date}\"</pre>\n   * url: \"/messages/:mailboxid?{before:date}&{after:date}\"\n   *\n   * @param {object=} stateConfig.views\n   * <a id='views'></a>\n   * an optional map&lt;string, object&gt; which defined multiple views, or targets views\n   * manually/explicitly.\n   *\n   * Examples:\n   *\n   * Targets three named `ui-view`s in the parent state's template\n   * <pre>views: {\n   *     header: {\n   *       controller: \"headerCtrl\",\n   *       templateUrl: \"header.html\"\n   *     }, body: {\n   *       controller: \"bodyCtrl\",\n   *       templateUrl: \"body.html\"\n   *     }, footer: {\n   *       controller: \"footCtrl\",\n   *       templateUrl: \"footer.html\"\n   *     }\n   *   }</pre>\n   *\n   * Targets named `ui-view=\"header\"` from grandparent state 'top''s template, and named `ui-view=\"body\" from parent state's template.\n   * <pre>views: {\n   *     'header@top': {\n   *       controller: \"msgHeaderCtrl\",\n   *       templateUrl: \"msgHeader.html\"\n   *     }, 'body': {\n   *       controller: \"messagesCtrl\",\n   *       templateUrl: \"messages.html\"\n   *     }\n   *   }</pre>\n   *\n   * @param {boolean=} [stateConfig.abstract=false]\n   * <a id='abstract'></a>\n   * An abstract state will never be directly activated,\n   *   but can provide inherited properties to its common children states.\n   * <pre>abstract: true</pre>\n   *\n   * @param {function=} stateConfig.onEnter\n   * <a id='onEnter'></a>\n   *\n   * Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onEnter: function(MyService, $stateParams) {\n   *     MyService.foo($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {function=} stateConfig.onExit\n   * <a id='onExit'></a>\n   *\n   * Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onExit: function(MyService, $stateParams) {\n   *     MyService.cleanup($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {boolean=} [stateConfig.reloadOnSearch=true]\n   * <a id='reloadOnSearch'></a>\n   *\n   * If `false`, will not retrigger the same state\n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()). \n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   * <pre>reloadOnSearch: false</pre>\n   *\n   * @param {object=} stateConfig.data\n   * <a id='data'></a>\n   *\n   * Arbitrary data object, useful for custom configuration.  The parent state's `data` is\n   *   prototypally inherited.  In other words, adding a data property to a state adds it to\n   *   the entire subtree via prototypal inheritance.\n   *\n   * <pre>data: {\n   *     requiredRole: 'foo'\n   * } </pre>\n   *\n   * @param {object=} stateConfig.params\n   * <a id='params'></a>\n   *\n   * A map which optionally configures parameters declared in the `url`, or\n   *   defines additional non-url parameters.  For each parameter being\n   *   configured, add a configuration object keyed to the name of the parameter.\n   *\n   *   Each parameter configuration object may contain the following properties:\n   *\n   *   - ** value ** - {object|function=}: specifies the default value for this\n   *     parameter.  This implicitly sets this parameter as optional.\n   *\n   *     When UI-Router routes to a state and no value is\n   *     specified for this parameter in the URL or transition, the\n   *     default value will be used instead.  If `value` is a function,\n   *     it will be injected and invoked, and the return value used.\n   *\n   *     *Note*: `undefined` is treated as \"no default value\" while `null`\n   *     is treated as \"the default value is `null`\".\n   *\n   *     *Shorthand*: If you only need to configure the default value of the\n   *     parameter, you may use a shorthand syntax.   In the **`params`**\n   *     map, instead mapping the param name to a full parameter configuration\n   *     object, simply set map it to the default parameter value, e.g.:\n   *\n   * <pre>// define a parameter's default value\n   * params: {\n   *     param1: { value: \"defaultValue\" }\n   * }\n   * // shorthand default values\n   * params: {\n   *     param1: \"defaultValue\",\n   *     param2: \"param2Default\"\n   * }</pre>\n   *\n   *   - ** array ** - {boolean=}: *(default: false)* If true, the param value will be\n   *     treated as an array of values.  If you specified a Type, the value will be\n   *     treated as an array of the specified Type.  Note: query parameter values\n   *     default to a special `\"auto\"` mode.\n   *\n   *     For query parameters in `\"auto\"` mode, if multiple  values for a single parameter\n   *     are present in the URL (e.g.: `/foo?bar=1&bar=2&bar=3`) then the values\n   *     are mapped to an array (e.g.: `{ foo: [ '1', '2', '3' ] }`).  However, if\n   *     only one value is present (e.g.: `/foo?bar=1`) then the value is treated as single\n   *     value (e.g.: `{ foo: '1' }`).\n   *\n   * <pre>params: {\n   *     param1: { array: true }\n   * }</pre>\n   *\n   *   - ** squash ** - {bool|string=}: `squash` configures how a default parameter value is represented in the URL when\n   *     the current parameter value is the same as the default value. If `squash` is not set, it uses the\n   *     configured default squash policy.\n   *     (See {@link ui.router.util.$urlMatcherFactory#methods_defaultSquashPolicy `defaultSquashPolicy()`})\n   *\n   *   There are three squash settings:\n   *\n   *     - false: The parameter's default value is not squashed.  It is encoded and included in the URL\n   *     - true: The parameter's default value is omitted from the URL.  If the parameter is preceeded and followed\n   *       by slashes in the state's `url` declaration, then one of those slashes are omitted.\n   *       This can allow for cleaner looking URLs.\n   *     - `\"<arbitrary string>\"`: The parameter's default value is replaced with an arbitrary placeholder of  your choice.\n   *\n   * <pre>params: {\n   *     param1: {\n   *       value: \"defaultId\",\n   *       squash: true\n   * } }\n   * // squash \"defaultValue\" to \"~\"\n   * params: {\n   *     param1: {\n   *       value: \"defaultValue\",\n   *       squash: \"~\"\n   * } }\n   * </pre>\n   *\n   *\n   * @example\n   * <pre>\n   * // Some state name examples\n   *\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the\n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * </pre>\n   *\n   */\n  this.state = state;\n  function state(name, definition) {\n    /*jshint validthis: true */\n    if (isObject(name)) definition = name;\n    else definition.name = name;\n    registerState(definition);\n    return this;\n  }\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$state\n   *\n   * @requires $rootScope\n   * @requires $q\n   * @requires ui.router.state.$view\n   * @requires $injector\n   * @requires ui.router.util.$resolve\n   * @requires ui.router.state.$stateParams\n   * @requires ui.router.router.$urlRouter\n   *\n   * @property {object} params A param object, e.g. {sectionId: section.id)}, that \n   * you'd like to test against the current active state.\n   * @property {object} current A reference to the state's config object. However \n   * you passed it in. Useful for accessing custom data.\n   * @property {object} transition Currently pending transition. A promise that'll \n   * resolve or reject.\n   *\n   * @description\n   * `$state` service is responsible for representing states as well as transitioning\n   * between them. It also provides interfaces to ask for current state or even states\n   * you're coming from.\n   */\n  this.$get = $get;\n  $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$urlRouter', '$location', '$urlMatcherFactory'];\n  function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $urlRouter,   $location,   $urlMatcherFactory) {\n\n    var TransitionSuperseded = $q.reject(new Error('transition superseded'));\n    var TransitionPrevented = $q.reject(new Error('transition prevented'));\n    var TransitionAborted = $q.reject(new Error('transition aborted'));\n    var TransitionFailed = $q.reject(new Error('transition failed'));\n\n    // Handles the case where a state which is the target of a transition is not found, and the user\n    // can optionally retry or defer the transition\n    function handleRedirect(redirect, state, params, options) {\n      /**\n       * @ngdoc event\n       * @name ui.router.state.$state#$stateNotFound\n       * @eventOf ui.router.state.$state\n       * @eventType broadcast on root scope\n       * @description\n       * Fired when a requested state **cannot be found** using the provided state name during transition.\n       * The event is broadcast allowing any handlers a single chance to deal with the error (usually by\n       * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,\n       * you can see its three properties in the example. You can use `event.preventDefault()` to abort the\n       * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.\n       *\n       * @param {Object} event Event object.\n       * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.\n       * @param {State} fromState Current state object.\n       * @param {Object} fromParams Current state params.\n       *\n       * @example\n       *\n       * <pre>\n       * // somewhere, assume lazy.state has not been defined\n       * $state.go(\"lazy.state\", {a:1, b:2}, {inherit:false});\n       *\n       * // somewhere else\n       * $scope.$on('$stateNotFound',\n       * function(event, unfoundState, fromState, fromParams){\n       *     console.log(unfoundState.to); // \"lazy.state\"\n       *     console.log(unfoundState.toParams); // {a:1, b:2}\n       *     console.log(unfoundState.options); // {inherit:false} + default options\n       * })\n       * </pre>\n       */\n      var evt = $rootScope.$broadcast('$stateNotFound', redirect, state, params);\n\n      if (evt.defaultPrevented) {\n        $urlRouter.update();\n        return TransitionAborted;\n      }\n\n      if (!evt.retry) {\n        return null;\n      }\n\n      // Allow the handler to return a promise to defer state lookup retry\n      if (options.$retry) {\n        $urlRouter.update();\n        return TransitionFailed;\n      }\n      var retryTransition = $state.transition = $q.when(evt.retry);\n\n      retryTransition.then(function() {\n        if (retryTransition !== $state.transition) return TransitionSuperseded;\n        redirect.options.$retry = true;\n        return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);\n      }, function() {\n        return TransitionAborted;\n      });\n      $urlRouter.update();\n\n      return retryTransition;\n    }\n\n    root.locals = { resolve: null, globals: { $stateParams: {} } };\n\n    $state = {\n      params: {},\n      current: root.self,\n      $current: root,\n      transition: null\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#reload\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, \n     * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).\n     *\n     * @example\n     * <pre>\n     * var app angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.reload = function(){\n     *     $state.reload();\n     *   }\n     * });\n     * </pre>\n     *\n     * `reload()` is just an alias for:\n     * <pre>\n     * $state.transitionTo($state.current, $stateParams, { \n     *   reload: true, inherit: false, notify: true\n     * });\n     * </pre>\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.reload = function reload() {\n      return $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: true });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#go\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Convenience method for transitioning to a new state. `$state.go` calls \n     * `$state.transitionTo` internally but automatically sets options to \n     * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. \n     * This allows you to easily use an absolute or relative to path and specify \n     * only the parameters you'd like to update (while letting unspecified parameters \n     * inherit from the currently active ancestor states).\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.go('contact.detail');\n     *   };\n     * });\n     * </pre>\n     * <img src='../ngdoc_assets/StateGoExamples.png'/>\n     *\n     * @param {string} to Absolute state name or relative state path. Some examples:\n     *\n     * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n     * - `$state.go('^')` - will go to a parent state\n     * - `$state.go('^.sibling')` - will go to a sibling state\n     * - `$state.go('.child.grandchild')` - will go to grandchild state\n     *\n     * @param {object=} params A map of the parameters that will be sent to the state, \n     * will populate $stateParams. Any parameters that are not specified will be inherited from currently \n     * defined parameters. This allows, for example, going to a sibling state that shares parameters\n     * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.\n     * transitioning to a sibling will get you the parameters for all parents, transitioning to a child\n     * will get you all current parameters, etc.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition.\n     *\n     * Possible success values:\n     *\n     * - $state.current\n     *\n     * <br/>Possible rejection values:\n     *\n     * - 'transition superseded' - when a newer transition has been started after this one\n     * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener\n     * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or\n     *   when a `$stateNotFound` `event.retry` promise errors.\n     * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.\n     * - *resolve error* - when an error has occurred with a `resolve`\n     *\n     */\n    $state.go = function go(to, params, options) {\n      return $state.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#transitionTo\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}\n     * uses `transitionTo` internally. `$state.go` is recommended in most situations.\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.transitionTo('contact.detail');\n     *   };\n     * });\n     * </pre>\n     *\n     * @param {string} to State name.\n     * @param {object=} toParams A map of the parameters that will be sent to the state,\n     * will populate $stateParams.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.transitionTo = function transitionTo(to, toParams, options) {\n      toParams = toParams || {};\n      options = extend({\n        location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false\n      }, options || {});\n\n      var from = $state.$current, fromParams = $state.params, fromPath = from.path;\n      var evt, toState = findState(to, options.relative);\n\n      if (!isDefined(toState)) {\n        var redirect = { to: to, toParams: toParams, options: options };\n        var redirectResult = handleRedirect(redirect, from.self, fromParams, options);\n\n        if (redirectResult) {\n          return redirectResult;\n        }\n\n        // Always retry once if the $stateNotFound was not prevented\n        // (handles either redirect changed or state lazy-definition)\n        to = redirect.to;\n        toParams = redirect.toParams;\n        options = redirect.options;\n        toState = findState(to, options.relative);\n\n        if (!isDefined(toState)) {\n          if (!options.relative) throw new Error(\"No such state '\" + to + \"'\");\n          throw new Error(\"Could not resolve '\" + to + \"' from state '\" + options.relative + \"'\");\n        }\n      }\n      if (toState[abstractKey]) throw new Error(\"Cannot transition to abstract state '\" + to + \"'\");\n      if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);\n      if (!toState.params.$$validates(toParams)) return TransitionFailed;\n\n      toParams = toState.params.$$values(toParams);\n      to = toState;\n\n      var toPath = to.path;\n\n      // Starting from the root of the path, keep all levels that haven't changed\n      var keep = 0, state = toPath[keep], locals = root.locals, toLocals = [];\n\n      if (!options.reload) {\n        while (state && state === fromPath[keep] && state.ownParams.$$equals(toParams, fromParams)) {\n          locals = toLocals[keep] = state.locals;\n          keep++;\n          state = toPath[keep];\n        }\n      }\n\n      // If we're going to the same state and all locals are kept, we've got nothing to do.\n      // But clear 'transition', as we still want to cancel any other pending transitions.\n      // TODO: We may not want to bump 'transition' if we're called from a location change\n      // that we've initiated ourselves, because we might accidentally abort a legitimate\n      // transition initiated from code?\n      if (shouldTriggerReload(to, from, locals, options)) {\n        if (to.self.reloadOnSearch !== false) $urlRouter.update();\n        $state.transition = null;\n        return $q.when($state.current);\n      }\n\n      // Filter parameters before we pass them to event handlers etc.\n      toParams = filterByKeys(to.params.$$keys(), toParams || {});\n\n      // Broadcast start event and cancel the transition if requested\n      if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeStart\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when the state transition **begins**. You can use `event.preventDefault()`\n         * to prevent the transition from happening and then the transition promise will be\n         * rejected with a `'transition prevented'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         *\n         * @example\n         *\n         * <pre>\n         * $rootScope.$on('$stateChangeStart',\n         * function(event, toState, toParams, fromState, fromParams){\n         *     event.preventDefault();\n         *     // transitionTo() promise will be rejected with\n         *     // a 'transition prevented' error\n         * })\n         * </pre>\n         */\n        if ($rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams).defaultPrevented) {\n          $urlRouter.update();\n          return TransitionPrevented;\n        }\n      }\n\n      // Resolve locals for the remaining states, but don't update any global state just\n      // yet -- if anything fails to resolve the current state needs to remain untouched.\n      // We also set up an inheritance chain for the locals here. This allows the view directive\n      // to quickly look up the correct definition for each view in the current state. Even\n      // though we create the locals object itself outside resolveState(), it is initially\n      // empty and gets filled asynchronously. We need to keep track of the promise for the\n      // (fully resolved) current locals, and pass this down the chain.\n      var resolved = $q.when(locals);\n\n      for (var l = keep; l < toPath.length; l++, state = toPath[l]) {\n        locals = toLocals[l] = inherit(locals);\n        resolved = resolveState(state, toParams, state === to, resolved, locals, options);\n      }\n\n      // Once everything is resolved, we are ready to perform the actual transition\n      // and return a promise for the new state. We also keep track of what the\n      // current promise is, so that we can detect overlapping transitions and\n      // keep only the outcome of the last transition.\n      var transition = $state.transition = resolved.then(function () {\n        var l, entering, exiting;\n\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Exit 'from' states not kept\n        for (l = fromPath.length - 1; l >= keep; l--) {\n          exiting = fromPath[l];\n          if (exiting.self.onExit) {\n            $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);\n          }\n          exiting.locals = null;\n        }\n\n        // Enter 'to' states not kept\n        for (l = keep; l < toPath.length; l++) {\n          entering = toPath[l];\n          entering.locals = toLocals[l];\n          if (entering.self.onEnter) {\n            $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);\n          }\n        }\n\n        // Run it again, to catch any transitions in callbacks\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Update globals in $state\n        $state.$current = to;\n        $state.current = to.self;\n        $state.params = toParams;\n        copy($state.params, $stateParams);\n        $state.transition = null;\n\n        if (options.location && to.navigable) {\n          $urlRouter.push(to.navigable.url, to.navigable.locals.globals.$stateParams, {\n            $$avoidResync: true, replace: options.location === 'replace'\n          });\n        }\n\n        if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeSuccess\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired once the state transition is **complete**.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         */\n          $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);\n        }\n        $urlRouter.update(true);\n\n        return $state.current;\n      }, function (error) {\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        $state.transition = null;\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeError\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when an **error occurs** during transition. It's important to note that if you\n         * have any errors in your resolve functions (javascript errors, non-existent services, etc)\n         * they will not throw traditionally. You must listen for this $stateChangeError event to\n         * catch **ALL** errors.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         * @param {Error} error The resolve error object.\n         */\n        evt = $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);\n\n        if (!evt.defaultPrevented) {\n            $urlRouter.update();\n        }\n\n        return $q.reject(error);\n      });\n\n      return transition;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#is\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Similar to {@link ui.router.state.$state#methods_includes $state.includes},\n     * but only checks for the full state name. If params is supplied then it will be\n     * tested for strict equality against the current active params object, so all params\n     * must match with none missing and no extras.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // absolute name\n     * $state.is('contact.details.item'); // returns true\n     * $state.is(contactDetailItemStateObject); // returns true\n     *\n     * // relative name (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.is('.item')}\">Item</div>\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name (absolute or relative) or state object you'd like to check.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like\n     * to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object} -  If `stateOrName` is a relative state name and `options.relative` is set, .is will\n     * test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it is the state.\n     */\n    $state.is = function is(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) { return undefined; }\n      if ($state.$current !== state) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams) : true;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#includes\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method to determine if the current active state is equal to or is the child of the\n     * state stateName. If any params are passed then they will be tested for a match as well.\n     * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n     *\n     * @example\n     * Partial and relative names\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // Using partial names\n     * $state.includes(\"contacts\"); // returns true\n     * $state.includes(\"contacts.details\"); // returns true\n     * $state.includes(\"contacts.details.item\"); // returns true\n     * $state.includes(\"contacts.list\"); // returns false\n     * $state.includes(\"about\"); // returns false\n     *\n     * // Using relative names (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.includes('.item')}\">Item</div>\n     * </pre>\n     *\n     * Basic globbing patterns\n     * <pre>\n     * $state.$current.name = 'contacts.details.item.url';\n     *\n     * $state.includes(\"*.details.*.*\"); // returns true\n     * $state.includes(\"*.details.**\"); // returns true\n     * $state.includes(\"**.item.**\"); // returns true\n     * $state.includes(\"*.details.item.url\"); // returns true\n     * $state.includes(\"*.details.*.url\"); // returns true\n     * $state.includes(\"*.details.*\"); // returns false\n     * $state.includes(\"item.**\"); // returns false\n     * </pre>\n     *\n     * @param {string} stateOrName A partial name, relative name, or glob pattern\n     * to be searched for within the current state name.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`,\n     * that you'd like to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object=} -  If `stateOrName` is a relative state reference and `options.relative` is set,\n     * .includes will test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it does include the state\n     */\n    $state.includes = function includes(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      if (isString(stateOrName) && isGlob(stateOrName)) {\n        if (!doesStateMatchGlob(stateOrName)) {\n          return false;\n        }\n        stateOrName = $state.$current.name;\n      }\n\n      var state = findState(stateOrName, options.relative);\n      if (!isDefined(state)) { return undefined; }\n      if (!isDefined($state.$current.includes[state.name])) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams, objectKeys(params)) : true;\n    };\n\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#href\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A url generation method that returns the compiled url for the given state populated with the given params.\n     *\n     * @example\n     * <pre>\n     * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.\n     * @param {object=} params An object of parameter values to fill the state's required parameters.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`lossy`** - {boolean=true} -  If true, and if there is no url associated with the state provided in the\n     *    first parameter, then the constructed href url will be built from the first navigable ancestor (aka\n     *    ancestor with a valid url).\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n     * \n     * @returns {string} compiled state url\n     */\n    $state.href = function href(stateOrName, params, options) {\n      options = extend({\n        lossy:    true,\n        inherit:  true,\n        absolute: false,\n        relative: $state.$current\n      }, options || {});\n\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) return null;\n      if (options.inherit) params = inheritParams($stateParams, params || {}, $state.$current, state);\n      \n      var nav = (state && options.lossy) ? state.navigable : state;\n\n      if (!nav || nav.url === undefined || nav.url === null) {\n        return null;\n      }\n      return $urlRouter.href(nav.url, filterByKeys(state.params.$$keys(), params || {}), {\n        absolute: options.absolute\n      });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#get\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Returns the state configuration object for any specific state or all states.\n     *\n     * @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for\n     * the requested state. If not provided, returns an array of ALL state configs.\n     * @param {string|object=} context When stateOrName is a relative state reference, the state will be retrieved relative to context.\n     * @returns {Object|Array} State configuration object or array of all objects.\n     */\n    $state.get = function (stateOrName, context) {\n      if (arguments.length === 0) return map(objectKeys(states), function(name) { return states[name].self; });\n      var state = findState(stateOrName, context || $state.$current);\n      return (state && state.self) ? state.self : null;\n    };\n\n    function resolveState(state, params, paramsAreFiltered, inherited, dst, options) {\n      // Make a restricted $stateParams with only the parameters that apply to this state if\n      // necessary. In addition to being available to the controller and onEnter/onExit callbacks,\n      // we also need $stateParams to be available for any $injector calls we make during the\n      // dependency resolution process.\n      var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params.$$keys(), params);\n      var locals = { $stateParams: $stateParams };\n\n      // Resolve 'global' dependencies for the state, i.e. those not specific to a view.\n      // We're also including $stateParams in this; that way the parameters are restricted\n      // to the set that should be visible to the state, and are independent of when we update\n      // the global $state and $stateParams values.\n      dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);\n      var promises = [dst.resolve.then(function (globals) {\n        dst.globals = globals;\n      })];\n      if (inherited) promises.push(inherited);\n\n      // Resolve template and dependencies for all views.\n      forEach(state.views, function (view, name) {\n        var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});\n        injectables.$template = [ function () {\n          return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: options.notify }) || '';\n        }];\n\n        promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {\n          // References to the controller (only instantiated at link time)\n          if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {\n            var injectLocals = angular.extend({}, injectables, locals);\n            result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);\n          } else {\n            result.$$controller = view.controller;\n          }\n          // Provide access to the state itself for internal use\n          result.$$state = state;\n          result.$$controllerAs = view.controllerAs;\n          dst[name] = result;\n        }));\n      });\n\n      // Wait for all the promises and then return the activation object\n      return $q.all(promises).then(function (values) {\n        return dst;\n      });\n    }\n\n    return $state;\n  }\n\n  function shouldTriggerReload(to, from, locals, options) {\n    if (to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false))) {\n      return true;\n    }\n  }\n}\n\nangular.module('ui.router.state')\n  .value('$stateParams', {})\n  .provider('$state', $StateProvider);\n\n\n$ViewProvider.$inject = [];\nfunction $ViewProvider() {\n\n  this.$get = $get;\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$view\n   *\n   * @requires ui.router.util.$templateFactory\n   * @requires $rootScope\n   *\n   * @description\n   *\n   */\n  $get.$inject = ['$rootScope', '$templateFactory'];\n  function $get(   $rootScope,   $templateFactory) {\n    return {\n      // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })\n      /**\n       * @ngdoc function\n       * @name ui.router.state.$view#load\n       * @methodOf ui.router.state.$view\n       *\n       * @description\n       *\n       * @param {string} name name\n       * @param {object} options option object.\n       */\n      load: function load(name, options) {\n        var result, defaults = {\n          template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}\n        };\n        options = extend(defaults, options);\n\n        if (options.view) {\n          result = $templateFactory.fromConfig(options.view, options.params, options.locals);\n        }\n        if (result && options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$viewContentLoading\n         * @eventOf ui.router.state.$view\n         * @eventType broadcast on root scope\n         * @description\n         *\n         * Fired once the view **begins loading**, *before* the DOM is rendered.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} viewConfig The view config properties (template, controller, etc).\n         *\n         * @example\n         *\n         * <pre>\n         * $scope.$on('$viewContentLoading',\n         * function(event, viewConfig){\n         *     // Access to all the view config properties.\n         *     // and one special property 'targetView'\n         *     // viewConfig.targetView\n         * });\n         * </pre>\n         */\n          $rootScope.$broadcast('$viewContentLoading', options);\n        }\n        return result;\n      }\n    };\n  }\n}\n\nangular.module('ui.router.state').provider('$view', $ViewProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$uiViewScrollProvider\n *\n * @description\n * Provider that returns the {@link ui.router.state.$uiViewScroll} service function.\n */\nfunction $ViewScrollProvider() {\n\n  var useAnchorScroll = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll\n   * @methodOf ui.router.state.$uiViewScrollProvider\n   *\n   * @description\n   * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for\n   * scrolling based on the url anchor.\n   */\n  this.useAnchorScroll = function () {\n    useAnchorScroll = true;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$uiViewScroll\n   *\n   * @requires $anchorScroll\n   * @requires $timeout\n   *\n   * @description\n   * When called with a jqLite element, it scrolls the element into view (after a\n   * `$timeout` so the DOM has time to refresh).\n   *\n   * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n   * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.\n   */\n  this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {\n    if (useAnchorScroll) {\n      return $anchorScroll;\n    }\n\n    return function ($element) {\n      $timeout(function () {\n        $element[0].scrollIntoView();\n      }, 0, false);\n    };\n  }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-view\n *\n * @requires ui.router.state.$state\n * @requires $compile\n * @requires $controller\n * @requires $injector\n * @requires ui.router.state.$uiViewScroll\n * @requires $document\n *\n * @restrict ECA\n *\n * @description\n * The ui-view directive tells $state where to place your templates.\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states.\n *\n * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window\n * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll\n * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you\n * scroll ui-view elements into view when they are populated during a state activation.\n *\n * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*\n *\n * @param {string=} onload Expression to evaluate whenever the view updates.\n * \n * @example\n * A view can be unnamed or named. \n * <pre>\n * <!-- Unnamed -->\n * <div ui-view></div> \n * \n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n * </pre>\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a \n * single view and it is unnamed then you can populate it like so:\n * <pre>\n * <div ui-view></div> \n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * </pre>\n * \n * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}\n * config property, by name, in this case an empty name:\n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * But typically you'll only use the views property if you name your view or have more than one view \n * in the same template. There's not really a compelling reason to name a view if its the only one, \n * but you could if you wanted, like so:\n * <pre>\n * <div ui-view=\"main\"></div>\n * </pre> \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * Really though, you'll use views to set up multiple views:\n * <pre>\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div> \n * <div ui-view=\"data\"></div> \n * </pre>\n * \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }    \n * })\n * </pre>\n *\n * Examples for `autoscroll`:\n *\n * <pre>\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * </pre>\n */\n$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate'];\nfunction $ViewDirective(   $state,   $injector,   $uiViewScroll,   $interpolate) {\n\n  function getService() {\n    return ($injector.has) ? function(service) {\n      return $injector.has(service) ? $injector.get(service) : null;\n    } : function(service) {\n      try {\n        return $injector.get(service);\n      } catch (e) {\n        return null;\n      }\n    };\n  }\n\n  var service = getService(),\n      $animator = service('$animator'),\n      $animate = service('$animate');\n\n  // Returns a set of DOM manipulation functions based on which Angular version\n  // it should use\n  function getRenderer(attrs, scope) {\n    var statics = function() {\n      return {\n        enter: function (element, target, cb) { target.after(element); cb(); },\n        leave: function (element, cb) { element.remove(); cb(); }\n      };\n    };\n\n    if ($animate) {\n      return {\n        enter: function(element, target, cb) {\n          var promise = $animate.enter(element, null, target, cb);\n          if (promise && promise.then) promise.then(cb);\n        },\n        leave: function(element, cb) {\n          var promise = $animate.leave(element, cb);\n          if (promise && promise.then) promise.then(cb);\n        }\n      };\n    }\n\n    if ($animator) {\n      var animate = $animator && $animator(scope, attrs);\n\n      return {\n        enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },\n        leave: function(element, cb) { animate.leave(element); cb(); }\n      };\n    }\n\n    return statics();\n  }\n\n  var directive = {\n    restrict: 'ECA',\n    terminal: true,\n    priority: 400,\n    transclude: 'element',\n    compile: function (tElement, tAttrs, $transclude) {\n      return function (scope, $element, attrs) {\n        var previousEl, currentEl, currentScope, latestLocals,\n            onloadExp     = attrs.onload || '',\n            autoScrollExp = attrs.autoscroll,\n            renderer      = getRenderer(attrs, scope);\n\n        scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        updateView(true);\n\n        function cleanupLastView() {\n          if (previousEl) {\n            previousEl.remove();\n            previousEl = null;\n          }\n\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n\n          if (currentEl) {\n            renderer.leave(currentEl, function() {\n              previousEl = null;\n            });\n\n            previousEl = currentEl;\n            currentEl = null;\n          }\n        }\n\n        function updateView(firstTime) {\n          var newScope,\n              name            = getUiViewName(scope, attrs, $element, $interpolate),\n              previousLocals  = name && $state.$current && $state.$current.locals[name];\n\n          if (!firstTime && previousLocals === latestLocals) return; // nothing to do\n          newScope = scope.$new();\n          latestLocals = $state.$current.locals[name];\n\n          var clone = $transclude(newScope, function(clone) {\n            renderer.enter(clone, $element, function onUiViewEnter() {\n              if(currentScope) {\n                currentScope.$emit('$viewContentAnimationEnded');\n              }\n\n              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n                $uiViewScroll(clone);\n              }\n            });\n            cleanupLastView();\n          });\n\n          currentEl = clone;\n          currentScope = newScope;\n          /**\n           * @ngdoc event\n           * @name ui.router.state.directive:ui-view#$viewContentLoaded\n           * @eventOf ui.router.state.directive:ui-view\n           * @eventType emits on ui-view directive scope\n           * @description           *\n           * Fired once the view is **loaded**, *after* the DOM is rendered.\n           *\n           * @param {Object} event Event object.\n           */\n          currentScope.$emit('$viewContentLoaded');\n          currentScope.$eval(onloadExp);\n        }\n      };\n    }\n  };\n\n  return directive;\n}\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state', '$interpolate'];\nfunction $ViewDirectiveFill (  $compile,   $controller,   $state,   $interpolate) {\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function (tElement) {\n      var initial = tElement.html();\n      return function (scope, $element, attrs) {\n        var current = $state.$current,\n            name = getUiViewName(scope, attrs, $element, $interpolate),\n            locals  = current && current.locals[name];\n\n        if (! locals) {\n          return;\n        }\n\n        $element.data('$uiView', { name: name, state: locals.$$state });\n        $element.html(locals.$template ? locals.$template : initial);\n\n        var link = $compile($element.contents());\n\n        if (locals.$$controller) {\n          locals.$scope = scope;\n          var controller = $controller(locals.$$controller, locals);\n          if (locals.$$controllerAs) {\n            scope[locals.$$controllerAs] = controller;\n          }\n          $element.data('$ngControllerController', controller);\n          $element.children().data('$ngControllerController', controller);\n        }\n\n        link(scope);\n      };\n    }\n  };\n}\n\n/**\n * Shared ui-view code for both directives:\n * Given scope, element, and its attributes, return the view's name\n */\nfunction getUiViewName(scope, attrs, element, $interpolate) {\n  var name = $interpolate(attrs.uiView || attrs.name || '')(scope);\n  var inherited = element.inheritedData('$uiView');\n  return name.indexOf('@') >= 0 ?  name :  (name + '@' + (inherited ? inherited.state.name : ''));\n}\n\nangular.module('ui.router.state').directive('uiView', $ViewDirective);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n\nfunction parseStateRef(ref, current) {\n  var preparsed = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n  if (preparsed) ref = current + '(' + preparsed[1] + ')';\n  parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1], paramExpr: parsed[3] || null };\n}\n\nfunction stateContext(el) {\n  var stateData = el.parent().inheritedData('$uiView');\n\n  if (stateData && stateData.state && stateData.state.name) {\n    return stateData.state;\n  }\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref\n *\n * @requires ui.router.state.$state\n * @requires $timeout\n *\n * @restrict A\n *\n * @description\n * A directive that binds a link (`<a>` tag) to a state. If the state has an associated \n * URL, the directive will automatically generate & update the `href` attribute via \n * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking \n * the link will trigger a state transition with optional parameters. \n *\n * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be \n * handled natively by the browser.\n *\n * You can also use relative state paths within ui-sref, just like the relative \n * paths passed to `$state.go()`. You just need to be aware that the path is relative\n * to the state that the link lives in, in other words the state that loaded the \n * template containing the link.\n *\n * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}\n * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,\n * and `reload`.\n *\n * @example\n * Here's an example of how you'd use ui-sref and how it would compile. If you have the \n * following template:\n * <pre>\n * <a ui-sref=\"home\">Home</a> | <a ui-sref=\"about\">About</a> | <a ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * </pre>\n * \n * Then the compiled html would be (assuming Html5Mode is off and current state is contacts):\n * <pre>\n * <a href=\"#/home\" ui-sref=\"home\">Home</a> | <a href=\"#/about\" ui-sref=\"about\">About</a> | <a href=\"#/contacts?page=2\" ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * </pre>\n *\n * @param {string} ui-sref 'stateName' can be any valid absolute or relative state\n * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}\n */\n$StateRefDirective.$inject = ['$state', '$timeout'];\nfunction $StateRefDirective($state, $timeout) {\n  var allowedOptions = ['location', 'inherit', 'reload'];\n\n  return {\n    restrict: 'A',\n    require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n    link: function(scope, element, attrs, uiSrefActive) {\n      var ref = parseStateRef(attrs.uiSref, $state.current.name);\n      var params = null, url = null, base = stateContext(element) || $state.$current;\n      var newHref = null, isAnchor = element.prop(\"tagName\") === \"A\";\n      var isForm = element[0].nodeName === \"FORM\";\n      var attr = isForm ? \"action\" : \"href\", nav = true;\n\n      var options = { relative: base, inherit: true };\n      var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};\n\n      angular.forEach(allowedOptions, function(option) {\n        if (option in optionsOverride) {\n          options[option] = optionsOverride[option];\n        }\n      });\n\n      var update = function(newVal) {\n        if (newVal) params = angular.copy(newVal);\n        if (!nav) return;\n\n        newHref = $state.href(ref.state, params, options);\n\n        var activeDirective = uiSrefActive[1] || uiSrefActive[0];\n        if (activeDirective) {\n          activeDirective.$$setStateInfo(ref.state, params);\n        }\n        if (newHref === null) {\n          nav = false;\n          return false;\n        }\n        attrs.$set(attr, newHref);\n      };\n\n      if (ref.paramExpr) {\n        scope.$watch(ref.paramExpr, function(newVal, oldVal) {\n          if (newVal !== params) update(newVal);\n        }, true);\n        params = angular.copy(scope.$eval(ref.paramExpr));\n      }\n      update();\n\n      if (isForm) return;\n\n      element.bind(\"click\", function(e) {\n        var button = e.which || e.button;\n        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {\n          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n          var transition = $timeout(function() {\n            $state.go(ref.state, params, options);\n          });\n          e.preventDefault();\n\n          // if the state has no URL, ignore one preventDefault from the <a> directive.\n          var ignorePreventDefaultCount = isAnchor && !newHref ? 1: 0;\n          e.preventDefault = function() {\n            if (ignorePreventDefaultCount-- <= 0)\n              $timeout.cancel(transition);\n          };\n        }\n      });\n    }\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * A directive working alongside ui-sref to add classes to an element when the\n * related ui-sref directive's state is active, and removing them when it is inactive.\n * The primary use-case is to simplify the special appearance of navigation menus\n * relying on `ui-sref`, by having the \"active\" state's menu button appear different,\n * distinguishing it from the inactive menu items.\n *\n * ui-sref-active can live on the same element as ui-sref or on a parent element. The first\n * ui-sref-active found at the same level or above the ui-sref will be used.\n *\n * Will activate when the ui-sref's target state or any child state is active. If you\n * need to activate only when the ui-sref target state is active and *not* any of\n * it's children, then you will use\n * {@link ui.router.state.directive:ui-sref-active-eq ui-sref-active-eq}\n *\n * @example\n * Given the following template:\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n *\n * When the app state is \"app.user\" (or any children states), and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n * The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * Multiple classes may be specified in a space-separated format:\n * <pre>\n * <ul>\n *   <li ui-sref-active='class1 class2 class3'>\n *     <a ui-sref=\"app.user\">link</a>\n *   </li>\n * </ul>\n * </pre>\n */\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active-eq\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * The same as {@link ui.router.state.directive:ui-sref-active ui-sref-active} but will only activate\n * when the exact target state used in the `ui-sref` is active; no child states.\n *\n */\n$StateRefActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateRefActiveDirective($state, $stateParams, $interpolate) {\n  return  {\n    restrict: \"A\",\n    controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {\n      var state, params, activeClass;\n\n      // There probably isn't much point in $observing this\n      // uiSrefActive and uiSrefActiveEq share the same directive object with some\n      // slight difference in logic routing\n      activeClass = $interpolate($attrs.uiSrefActiveEq || $attrs.uiSrefActive || '', false)($scope);\n\n      // Allow uiSref to communicate with uiSrefActive[Equals]\n      this.$$setStateInfo = function (newState, newParams) {\n        state = $state.get(newState, stateContext($element));\n        params = newParams;\n        update();\n      };\n\n      $scope.$on('$stateChangeSuccess', update);\n\n      // Update route state\n      function update() {\n        if (isMatch()) {\n          $element.addClass(activeClass);\n        } else {\n          $element.removeClass(activeClass);\n        }\n      }\n\n      function isMatch() {\n        if (typeof $attrs.uiSrefActiveEq !== 'undefined') {\n          return state && $state.is(state.name, params);\n        } else {\n          return state && $state.includes(state.name, params);\n        }\n      }\n    }]\n  };\n}\n\nangular.module('ui.router.state')\n  .directive('uiSref', $StateRefDirective)\n  .directive('uiSrefActive', $StateRefActiveDirective)\n  .directive('uiSrefActiveEq', $StateRefActiveDirective);\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n  var isFilter = function (state) {\n    return $state.is(state);\n  };\n  isFilter.$stateful = true;\n  return isFilter;\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n  var includesFilter = function (state) {\n    return $state.includes(state);\n  };\n  includesFilter.$stateful = true;\n  return  includesFilter;\n}\n\nangular.module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n})(window, window.angular);"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/common.js",
    "content": "/*jshint globalstrict:true*/\n/*global angular:false*/\n'use strict';\n\nvar isDefined = angular.isDefined,\n    isFunction = angular.isFunction,\n    isString = angular.isString,\n    isObject = angular.isObject,\n    isArray = angular.isArray,\n    forEach = angular.forEach,\n    extend = angular.extend,\n    copy = angular.copy;\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, { prototype: parent }))(), extra);\n}\n\nfunction merge(dst) {\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        if (!dst.hasOwnProperty(key)) dst[key] = value;\n      });\n    }\n  });\n  return dst;\n}\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nfunction ancestors(first, second) {\n  var path = [];\n\n  for (var n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * IE8-safe wrapper for `Object.keys()`.\n *\n * @param {Object} object A JavaScript object.\n * @return {Array} Returns the keys of the object as an array.\n */\nfunction objectKeys(object) {\n  if (Object.keys) {\n    return Object.keys(object);\n  }\n  var result = [];\n\n  angular.forEach(object, function(val, key) {\n    result.push(key);\n  });\n  return result;\n}\n\n/**\n * IE8-safe wrapper for `Array.prototype.indexOf()`.\n *\n * @param {Array} array A JavaScript array.\n * @param {*} value A value to search the array for.\n * @return {Number} Returns the array index value of `value`, or `-1` if not present.\n */\nfunction indexOf(array, value) {\n  if (Array.prototype.indexOf) {\n    return array.indexOf(value, Number(arguments[2]) || 0);\n  }\n  var len = array.length >>> 0, from = Number(arguments[2]) || 0;\n  from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n\n  if (from < 0) from += len;\n\n  for (; from < len; from++) {\n    if (from in array && array[from] === value) return from;\n  }\n  return -1;\n}\n\n/**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} currentParams The value of the current state parameters ($stateParams).\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\nfunction inheritParams(currentParams, newParams, $current, $to) {\n  var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];\n\n  for (var i in parents) {\n    if (!parents[i].params) continue;\n    parentParams = objectKeys(parents[i].params);\n    if (!parentParams.length) continue;\n\n    for (var j in parentParams) {\n      if (indexOf(inheritList, parentParams[j]) >= 0) continue;\n      inheritList.push(parentParams[j]);\n      inherited[parentParams[j]] = currentParams[parentParams[j]];\n    }\n  }\n  return extend({}, inherited, newParams);\n}\n\n/**\n * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.\n *\n * @param {Object} a The first object.\n * @param {Object} b The second object.\n * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,\n *                     it defaults to the list of keys in `a`.\n * @return {Boolean} Returns `true` if the keys match, otherwise `false`.\n */\nfunction equalForKeys(a, b, keys) {\n  if (!keys) {\n    keys = [];\n    for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility\n  }\n\n  for (var i=0; i<keys.length; i++) {\n    var k = keys[i];\n    if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized\n  }\n  return true;\n}\n\n/**\n * Returns the subset of an object, based on a list of keys.\n *\n * @param {Array} keys\n * @param {Object} values\n * @return {Boolean} Returns a subset of `values`.\n */\nfunction filterByKeys(keys, values) {\n  var filtered = {};\n\n  forEach(keys, function (name) {\n    filtered[name] = values[name];\n  });\n  return filtered;\n}\n\n// like _.indexBy\n// when you know that your index values will be unique, or you want last-one-in to win\nfunction indexBy(array, propName) {\n  var result = {};\n  forEach(array, function(item) {\n    result[item[propName]] = item;\n  });\n  return result;\n}\n\n// extracted from underscore.js\n// Return a copy of the object only containing the whitelisted properties.\nfunction pick(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  forEach(keys, function(key) {\n    if (key in obj) copy[key] = obj[key];\n  });\n  return copy;\n}\n\n// extracted from underscore.js\n// Return a copy of the object omitting the blacklisted properties.\nfunction omit(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  for (var key in obj) {\n    if (indexOf(keys, key) == -1) copy[key] = obj[key];\n  }\n  return copy;\n}\n\nfunction pluck(collection, key) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = isFunction(key) ? key(val) : val[key];\n  });\n  return result;\n}\n\nfunction filter(collection, callback) {\n  var array = isArray(collection);\n  var result = array ? [] : {};\n  forEach(collection, function(val, i) {\n    if (callback(val, i)) {\n      result[array ? result.length : i] = val;\n    }\n  });\n  return result;\n}\n\nfunction map(collection, callback) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = callback(val, i);\n  });\n  return result;\n}\n\n/**\n * @ngdoc overview\n * @name ui.router.util\n *\n * @description\n * # ui.router.util sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n *\n */\nangular.module('ui.router.util', ['ng']);\n\n/**\n * @ngdoc overview\n * @name ui.router.router\n * \n * @requires ui.router.util\n *\n * @description\n * # ui.router.router sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n */\nangular.module('ui.router.router', ['ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router.state\n * \n * @requires ui.router.router\n * @requires ui.router.util\n *\n * @description\n * # ui.router.state sub-module\n *\n * This module is a dependency of the main ui.router module. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n * \n */\nangular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router\n *\n * @requires ui.router.state\n *\n * @description\n * # ui.router\n * \n * ## The main module for ui.router \n * There are several sub-modules included with the ui.router module, however only this module is needed\n * as a dependency within your angular app. The other modules are for organization purposes. \n *\n * The modules are:\n * * ui.router - the main \"umbrella\" module\n * * ui.router.router - \n * \n * *You'll need to include **only** this module as the dependency within your angular app.*\n * \n * <pre>\n * <!doctype html>\n * <html ng-app=\"myApp\">\n * <head>\n *   <script src=\"js/angular.js\"></script>\n *   <!-- Include the ui-router script -->\n *   <script src=\"js/angular-ui-router.min.js\"></script>\n *   <script>\n *     // ...and add 'ui.router' as a dependency\n *     var myApp = angular.module('myApp', ['ui.router']);\n *   </script>\n * </head>\n * <body>\n * </body>\n * </html>\n * </pre>\n */\nangular.module('ui.router', ['ui.router.state']);\n\nangular.module('ui.router.compat', ['ui.router']);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/resolve.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.util.$resolve\n *\n * @requires $q\n * @requires $injector\n *\n * @description\n * Manages resolution of (acyclic) graphs of promises.\n */\n$Resolve.$inject = ['$q', '$injector'];\nfunction $Resolve(  $q,    $injector) {\n  \n  var VISIT_IN_PROGRESS = 1,\n      VISIT_DONE = 2,\n      NOTHING = {},\n      NO_DEPENDENCIES = [],\n      NO_LOCALS = NOTHING,\n      NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });\n  \n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#study\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Studies a set of invocables that are likely to be used multiple times.\n   * <pre>\n   * $resolve.study(invocables)(locals, parent, self)\n   * </pre>\n   * is equivalent to\n   * <pre>\n   * $resolve.resolve(invocables, locals, parent, self)\n   * </pre>\n   * but the former is more efficient (in fact `resolve` just calls `study` \n   * internally).\n   *\n   * @param {object} invocables Invocable objects\n   * @return {function} a function to pass in locals, parent and self\n   */\n  this.study = function (invocables) {\n    if (!isObject(invocables)) throw new Error(\"'invocables' must be an object\");\n    var invocableKeys = objectKeys(invocables || {});\n    \n    // Perform a topological sort of invocables to build an ordered plan\n    var plan = [], cycle = [], visited = {};\n    function visit(value, key) {\n      if (visited[key] === VISIT_DONE) return;\n      \n      cycle.push(key);\n      if (visited[key] === VISIT_IN_PROGRESS) {\n        cycle.splice(0, indexOf(cycle, key));\n        throw new Error(\"Cyclic dependency: \" + cycle.join(\" -> \"));\n      }\n      visited[key] = VISIT_IN_PROGRESS;\n      \n      if (isString(value)) {\n        plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);\n      } else {\n        var params = $injector.annotate(value);\n        forEach(params, function (param) {\n          if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);\n        });\n        plan.push(key, value, params);\n      }\n      \n      cycle.pop();\n      visited[key] = VISIT_DONE;\n    }\n    forEach(invocables, visit);\n    invocables = cycle = visited = null; // plan is all that's required\n    \n    function isResolve(value) {\n      return isObject(value) && value.then && value.$$promises;\n    }\n    \n    return function (locals, parent, self) {\n      if (isResolve(locals) && self === undefined) {\n        self = parent; parent = locals; locals = null;\n      }\n      if (!locals) locals = NO_LOCALS;\n      else if (!isObject(locals)) {\n        throw new Error(\"'locals' must be an object\");\n      }       \n      if (!parent) parent = NO_PARENT;\n      else if (!isResolve(parent)) {\n        throw new Error(\"'parent' must be a promise returned by $resolve.resolve()\");\n      }\n      \n      // To complete the overall resolution, we have to wait for the parent\n      // promise and for the promise for each invokable in our plan.\n      var resolution = $q.defer(),\n          result = resolution.promise,\n          promises = result.$$promises = {},\n          values = extend({}, locals),\n          wait = 1 + plan.length/3,\n          merged = false;\n          \n      function done() {\n        // Merge parent values we haven't got yet and publish our own $$values\n        if (!--wait) {\n          if (!merged) merge(values, parent.$$values); \n          result.$$values = values;\n          result.$$promises = result.$$promises || true; // keep for isResolve()\n          delete result.$$inheritedValues;\n          resolution.resolve(values);\n        }\n      }\n      \n      function fail(reason) {\n        result.$$failure = reason;\n        resolution.reject(reason);\n      }\n\n      // Short-circuit if parent has already failed\n      if (isDefined(parent.$$failure)) {\n        fail(parent.$$failure);\n        return result;\n      }\n      \n      if (parent.$$inheritedValues) {\n        merge(values, omit(parent.$$inheritedValues, invocableKeys));\n      }\n\n      // Merge parent values if the parent has already resolved, or merge\n      // parent promises and wait if the parent resolve is still in progress.\n      extend(promises, parent.$$promises);\n      if (parent.$$values) {\n        merged = merge(values, omit(parent.$$values, invocableKeys));\n        result.$$inheritedValues = omit(parent.$$values, invocableKeys);\n        done();\n      } else {\n        if (parent.$$inheritedValues) {\n          result.$$inheritedValues = omit(parent.$$inheritedValues, invocableKeys);\n        }        \n        parent.then(done, fail);\n      }\n      \n      // Process each invocable in the plan, but ignore any where a local of the same name exists.\n      for (var i=0, ii=plan.length; i<ii; i+=3) {\n        if (locals.hasOwnProperty(plan[i])) done();\n        else invoke(plan[i], plan[i+1], plan[i+2]);\n      }\n      \n      function invoke(key, invocable, params) {\n        // Create a deferred for this invocation. Failures will propagate to the resolution as well.\n        var invocation = $q.defer(), waitParams = 0;\n        function onfailure(reason) {\n          invocation.reject(reason);\n          fail(reason);\n        }\n        // Wait for any parameter that we have a promise for (either from parent or from this\n        // resolve; in that case study() will have made sure it's ordered before us in the plan).\n        forEach(params, function (dep) {\n          if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {\n            waitParams++;\n            promises[dep].then(function (result) {\n              values[dep] = result;\n              if (!(--waitParams)) proceed();\n            }, onfailure);\n          }\n        });\n        if (!waitParams) proceed();\n        function proceed() {\n          if (isDefined(result.$$failure)) return;\n          try {\n            invocation.resolve($injector.invoke(invocable, self, values));\n            invocation.promise.then(function (result) {\n              values[key] = result;\n              done();\n            }, onfailure);\n          } catch (e) {\n            onfailure(e);\n          }\n        }\n        // Publish promise synchronously; invocations further down in the plan may depend on it.\n        promises[key] = invocation.promise;\n      }\n      \n      return result;\n    };\n  };\n  \n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#resolve\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Resolves a set of invocables. An invocable is a function to be invoked via \n   * `$injector.invoke()`, and can have an arbitrary number of dependencies. \n   * An invocable can either return a value directly,\n   * or a `$q` promise. If a promise is returned it will be resolved and the \n   * resulting value will be used instead. Dependencies of invocables are resolved \n   * (in this order of precedence)\n   *\n   * - from the specified `locals`\n   * - from another invocable that is part of this `$resolve` call\n   * - from an invocable that is inherited from a `parent` call to `$resolve` \n   *   (or recursively\n   * - from any ancestor `$resolve` of that parent).\n   *\n   * The return value of `$resolve` is a promise for an object that contains \n   * (in this order of precedence)\n   *\n   * - any `locals` (if specified)\n   * - the resolved return values of all injectables\n   * - any values inherited from a `parent` call to `$resolve` (if specified)\n   *\n   * The promise will resolve after the `parent` promise (if any) and all promises \n   * returned by injectables have been resolved. If any invocable \n   * (or `$injector.invoke`) throws an exception, or if a promise returned by an \n   * invocable is rejected, the `$resolve` promise is immediately rejected with the \n   * same error. A rejection of a `parent` promise (if specified) will likewise be \n   * propagated immediately. Once the `$resolve` promise has been rejected, no \n   * further invocables will be called.\n   * \n   * Cyclic dependencies between invocables are not permitted and will caues `$resolve`\n   * to throw an error. As a special case, an injectable can depend on a parameter \n   * with the same name as the injectable, which will be fulfilled from the `parent` \n   * injectable of the same name. This allows inherited values to be decorated. \n   * Note that in this case any other injectable in the same `$resolve` with the same\n   * dependency would see the decorated value, not the inherited value.\n   *\n   * Note that missing dependencies -- unlike cyclic dependencies -- will cause an \n   * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) \n   * exception.\n   *\n   * Invocables are invoked eagerly as soon as all dependencies are available. \n   * This is true even for dependencies inherited from a `parent` call to `$resolve`.\n   *\n   * As a special case, an invocable can be a string, in which case it is taken to \n   * be a service name to be passed to `$injector.get()`. This is supported primarily \n   * for backwards-compatibility with the `resolve` property of `$routeProvider` \n   * routes.\n   *\n   * @param {object} invocables functions to invoke or \n   * `$injector` services to fetch.\n   * @param {object} locals  values to make available to the injectables\n   * @param {object} parent  a promise returned by another call to `$resolve`.\n   * @param {object} self  the `this` for the invoked methods\n   * @return {object} Promise for an object that contains the resolved return value\n   * of all invocables, as well as any inherited and local values.\n   */\n  this.resolve = function (invocables, locals, parent, self) {\n    return this.study(invocables)(locals, parent, self);\n  };\n}\n\nangular.module('ui.router.util').service('$resolve', $Resolve);\n\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/state.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.state.$stateProvider\n *\n * @requires ui.router.router.$urlRouterProvider\n * @requires ui.router.util.$urlMatcherFactoryProvider\n *\n * @description\n * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\n$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider'];\nfunction $StateProvider(   $urlRouterProvider,   $urlMatcherFactory) {\n\n  var root, states = {}, $state, queue = {}, abstractKey = 'abstract';\n\n  // Builds state properties from definition passed to registerState()\n  var stateBuilder = {\n\n    // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.\n    // state.children = [];\n    // if (parent) parent.children.push(state);\n    parent: function(state) {\n      if (isDefined(state.parent) && state.parent) return findState(state.parent);\n      // regex matches any valid composite state name\n      // would match \"contact.list\" but not \"contacts\"\n      var compositeName = /^(.+)\\.[^.]+$/.exec(state.name);\n      return compositeName ? findState(compositeName[1]) : root;\n    },\n\n    // inherit 'data' from parent and override by own values (if any)\n    data: function(state) {\n      if (state.parent && state.parent.data) {\n        state.data = state.self.data = extend({}, state.parent.data, state.data);\n      }\n      return state.data;\n    },\n\n    // Build a URLMatcher if necessary, either via a relative or absolute URL\n    url: function(state) {\n      var url = state.url, config = { params: state.params || {} };\n\n      if (isString(url)) {\n        if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);\n        return (state.parent.navigable || root).url.concat(url, config);\n      }\n\n      if (!url || $urlMatcherFactory.isMatcher(url)) return url;\n      throw new Error(\"Invalid url '\" + url + \"' in state '\" + state + \"'\");\n    },\n\n    // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n    navigable: function(state) {\n      return state.url ? state : (state.parent ? state.parent.navigable : null);\n    },\n\n    // Own parameters for this state. state.url.params is already built at this point. Create and add non-url params\n    ownParams: function(state) {\n      var params = state.url && state.url.params || new $$UMFP.ParamSet();\n      forEach(state.params || {}, function(config, id) {\n        if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, \"config\");\n      });\n      return params;\n    },\n\n    // Derive parameters for this state and ensure they're a super-set of parent's parameters\n    params: function(state) {\n      return state.parent && state.parent.params ? extend(state.parent.params.$$new(), state.ownParams) : new $$UMFP.ParamSet();\n    },\n\n    // If there is no explicit multi-view configuration, make one up so we don't have\n    // to handle both cases in the view directive later. Note that having an explicit\n    // 'views' property will mean the default unnamed view properties are ignored. This\n    // is also a good time to resolve view names to absolute names, so everything is a\n    // straight lookup at link time.\n    views: function(state) {\n      var views = {};\n\n      forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {\n        if (name.indexOf('@') < 0) name += '@' + state.parent.name;\n        views[name] = view;\n      });\n      return views;\n    },\n\n    // Keep a full path from the root down to this state as this is needed for state activation.\n    path: function(state) {\n      return state.parent ? state.parent.path.concat(state) : []; // exclude root from path\n    },\n\n    // Speed up $state.contains() as it's used a lot\n    includes: function(state) {\n      var includes = state.parent ? extend({}, state.parent.includes) : {};\n      includes[state.name] = true;\n      return includes;\n    },\n\n    $delegates: {}\n  };\n\n  function isRelative(stateName) {\n    return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n  }\n\n  function findState(stateOrName, base) {\n    if (!stateOrName) return undefined;\n\n    var isStr = isString(stateOrName),\n        name  = isStr ? stateOrName : stateOrName.name,\n        path  = isRelative(name);\n\n    if (path) {\n      if (!base) throw new Error(\"No reference point given for path '\"  + name + \"'\");\n      base = findState(base);\n      \n      var rel = name.split(\".\"), i = 0, pathLength = rel.length, current = base;\n\n      for (; i < pathLength; i++) {\n        if (rel[i] === \"\" && i === 0) {\n          current = base;\n          continue;\n        }\n        if (rel[i] === \"^\") {\n          if (!current.parent) throw new Error(\"Path '\" + name + \"' not valid for state '\" + base.name + \"'\");\n          current = current.parent;\n          continue;\n        }\n        break;\n      }\n      rel = rel.slice(i).join(\".\");\n      name = current.name + (current.name && rel ? \".\" : \"\") + rel;\n    }\n    var state = states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    }\n    return undefined;\n  }\n\n  function queueState(parentName, state) {\n    if (!queue[parentName]) {\n      queue[parentName] = [];\n    }\n    queue[parentName].push(state);\n  }\n\n  function flushQueuedChildren(parentName) {\n    var queued = queue[parentName] || [];\n    while(queued.length) {\n      registerState(queued.shift());\n    }\n  }\n\n  function registerState(state) {\n    // Wrap a new object around the state so we can store our private details easily.\n    state = inherit(state, {\n      self: state,\n      resolve: state.resolve || {},\n      toString: function() { return this.name; }\n    });\n\n    var name = state.name;\n    if (!isString(name) || name.indexOf('@') >= 0) throw new Error(\"State must have a valid name\");\n    if (states.hasOwnProperty(name)) throw new Error(\"State '\" + name + \"'' is already defined\");\n\n    // Get parent name\n    var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))\n        : (isString(state.parent)) ? state.parent\n        : (isObject(state.parent) && isString(state.parent.name)) ? state.parent.name\n        : '';\n\n    // If parent is not registered yet, add state to queue and register later\n    if (parentName && !states[parentName]) {\n      return queueState(parentName, state.self);\n    }\n\n    for (var key in stateBuilder) {\n      if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);\n    }\n    states[name] = state;\n\n    // Register the state in the global state list and with $urlRouter if necessary.\n    if (!state[abstractKey] && state.url) {\n      $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {\n        if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {\n          $state.transitionTo(state, $match, { inherit: true, location: false });\n        }\n      }]);\n    }\n\n    // Register any queued children\n    flushQueuedChildren(name);\n\n    return state;\n  }\n\n  // Checks text to see if it looks like a glob.\n  function isGlob (text) {\n    return text.indexOf('*') > -1;\n  }\n\n  // Returns true if glob matches current $state name.\n  function doesStateMatchGlob (glob) {\n    var globSegments = glob.split('.'),\n        segments = $state.$current.name.split('.');\n\n    //match greedy starts\n    if (globSegments[0] === '**') {\n       segments = segments.slice(indexOf(segments, globSegments[1]));\n       segments.unshift('**');\n    }\n    //match greedy ends\n    if (globSegments[globSegments.length - 1] === '**') {\n       segments.splice(indexOf(segments, globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);\n       segments.push('**');\n    }\n\n    if (globSegments.length != segments.length) {\n      return false;\n    }\n\n    //match single stars\n    for (var i = 0, l = globSegments.length; i < l; i++) {\n      if (globSegments[i] === '*') {\n        segments[i] = '*';\n      }\n    }\n\n    return segments.join('') === globSegments.join('');\n  }\n\n\n  // Implicit root state that is always active\n  root = registerState({\n    name: '',\n    url: '^',\n    views: null,\n    'abstract': true\n  });\n  root.navigable = null;\n\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#decorator\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Allows you to extend (carefully) or override (at your own peril) the \n   * `stateBuilder` object used internally by `$stateProvider`. This can be used \n   * to add custom functionality to ui-router, for example inferring templateUrl \n   * based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new \n   * properties within the state's internal definition. There is currently no clear \n   * use-case for this beyond accessing internal states (i.e. $state.$current), \n   * however, expect this to become increasingly relevant as we introduce additional \n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of \n   * execution of the builder functions in non-deterministic. Builder functions \n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n   *   or `null`.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is \n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to \n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view \n   *   name (i.e. \"viewName@stateName\") and each value is the config object \n   *   (template, controller) for the view. Even when you don't use the views object \n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template \n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state, \n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state. \n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that \n   *   would pass a `$state.includes()` test.\n   *\n   * @example\n   * <pre>\n   * // Override the internal 'views' builder with a function that takes the state\n   * // definition, and a reference to the internal function being overridden:\n   * $stateProvider.decorator('views', function (state, parent) {\n   *   var result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(views, function (config, name) {\n   *     var autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * $state.go('home');\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * </pre>\n   *\n   * @param {string} name The name of the builder function to decorate. \n   * @param {object} func A function that is responsible for decorating the original \n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  this.decorator = decorator;\n  function decorator(name, func) {\n    /*jshint validthis: true */\n    if (isString(name) && !isDefined(func)) {\n      return stateBuilder[name];\n    }\n    if (!isFunction(func) || !isString(name)) {\n      return this;\n    }\n    if (stateBuilder[name] && !stateBuilder.$delegates[name]) {\n      stateBuilder.$delegates[name] = stateBuilder[name];\n    }\n    stateBuilder[name] = func;\n    return this;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#state\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Registers a state configuration under a given state name. The stateConfig object\n   * has the following acceptable properties.\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} stateConfig State configuration object.\n   * @param {string|function=} stateConfig.template\n   * <a id='template'></a>\n   *   html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property \n   *   takes precedence over templateUrl.\n   *   \n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <pre>template:\n   *   \"<h1>inline template definition</h1>\" +\n   *   \"<div ui-view></div>\"</pre>\n   * <pre>template: function(params) {\n   *       return \"<h1>generated template</h1>\"; }</pre>\n   * </div>\n   *\n   * @param {string|function=} stateConfig.templateUrl\n   * <a id='templateUrl'></a>\n   *\n   *   path or function that returns a path to an html\n   *   template that should be used by uiView.\n   *   \n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by \n   *     applying the current state\n   *\n   * <pre>templateUrl: \"home.html\"</pre>\n   * <pre>templateUrl: function(params) {\n   *     return myTemplates[params.pageId]; }</pre>\n   *\n   * @param {function=} stateConfig.templateProvider\n   * <a id='templateProvider'></a>\n   *    Provider function that returns HTML content string.\n   * <pre> templateProvider:\n   *       function(MyTemplateService, params) {\n   *         return MyTemplateService.getTemplate(params.pageId);\n   *       }</pre>\n   *\n   * @param {string|function=} stateConfig.controller\n   * <a id='controller'></a>\n   *\n   *  Controller fn that should be associated with newly\n   *   related scope or the name of a registered controller if passed as a string.\n   *   Optionally, the ControllerAs may be declared here.\n   * <pre>controller: \"MyRegisteredController\"</pre>\n   * <pre>controller:\n   *     \"MyRegisteredController as fooCtrl\"}</pre>\n   * <pre>controller: function($scope, MyService) {\n   *     $scope.data = MyService.getData(); }</pre>\n   *\n   * @param {function=} stateConfig.controllerProvider\n   * <a id='controllerProvider'></a>\n   *\n   * Injectable provider function that returns the actual controller or string.\n   * <pre>controllerProvider:\n   *   function(MyResolveData) {\n   *     if (MyResolveData.foo)\n   *       return \"FooCtrl\"\n   *     else if (MyResolveData.bar)\n   *       return \"BarCtrl\";\n   *     else return function($scope) {\n   *       $scope.baz = \"Qux\";\n   *     }\n   *   }</pre>\n   *\n   * @param {string=} stateConfig.controllerAs\n   * <a id='controllerAs'></a>\n   * \n   * A controller alias name. If present the controller will be\n   *   published to scope under the controllerAs name.\n   * <pre>controllerAs: \"myCtrl\"</pre>\n   *\n   * @param {object=} stateConfig.resolve\n   * <a id='resolve'></a>\n   *\n   * An optional map&lt;string, function&gt; of dependencies which\n   *   should be injected into the controller. If any of these dependencies are promises, \n   *   the router will wait for them all to be resolved before the controller is instantiated.\n   *   If all the promises are resolved successfully, the $stateChangeSuccess event is fired\n   *   and the values of the resolved promises are injected into any controllers that reference them.\n   *   If any  of the promises are rejected the $stateChangeError event is fired.\n   *\n   *   The map object is:\n   *   \n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function, \n   *     it is injected and return value it treated as dependency. If result is a promise, it is \n   *     resolved before its value is injected into controller.\n   *\n   * <pre>resolve: {\n   *     myResolve1:\n   *       function($http, $stateParams) {\n   *         return $http.get(\"/api/foos/\"+stateParams.fooID);\n   *       }\n   *     }</pre>\n   *\n   * @param {string=} stateConfig.url\n   * <a id='url'></a>\n   *\n   *   A url fragment with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any \n   *   parameters that were passed.\n   *\n   * examples:\n   * <pre>url: \"/home\"\n   * url: \"/users/:userid\"\n   * url: \"/books/{bookid:[a-zA-Z_-]}\"\n   * url: \"/books/{categoryid:int}\"\n   * url: \"/books/{publishername:string}/{categoryid:int}\"\n   * url: \"/messages?before&after\"\n   * url: \"/messages?{before:date}&{after:date}\"</pre>\n   * url: \"/messages/:mailboxid?{before:date}&{after:date}\"\n   *\n   * @param {object=} stateConfig.views\n   * <a id='views'></a>\n   * an optional map&lt;string, object&gt; which defined multiple views, or targets views\n   * manually/explicitly.\n   *\n   * Examples:\n   *\n   * Targets three named `ui-view`s in the parent state's template\n   * <pre>views: {\n   *     header: {\n   *       controller: \"headerCtrl\",\n   *       templateUrl: \"header.html\"\n   *     }, body: {\n   *       controller: \"bodyCtrl\",\n   *       templateUrl: \"body.html\"\n   *     }, footer: {\n   *       controller: \"footCtrl\",\n   *       templateUrl: \"footer.html\"\n   *     }\n   *   }</pre>\n   *\n   * Targets named `ui-view=\"header\"` from grandparent state 'top''s template, and named `ui-view=\"body\" from parent state's template.\n   * <pre>views: {\n   *     'header@top': {\n   *       controller: \"msgHeaderCtrl\",\n   *       templateUrl: \"msgHeader.html\"\n   *     }, 'body': {\n   *       controller: \"messagesCtrl\",\n   *       templateUrl: \"messages.html\"\n   *     }\n   *   }</pre>\n   *\n   * @param {boolean=} [stateConfig.abstract=false]\n   * <a id='abstract'></a>\n   * An abstract state will never be directly activated,\n   *   but can provide inherited properties to its common children states.\n   * <pre>abstract: true</pre>\n   *\n   * @param {function=} stateConfig.onEnter\n   * <a id='onEnter'></a>\n   *\n   * Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onEnter: function(MyService, $stateParams) {\n   *     MyService.foo($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {function=} stateConfig.onExit\n   * <a id='onExit'></a>\n   *\n   * Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onExit: function(MyService, $stateParams) {\n   *     MyService.cleanup($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {boolean=} [stateConfig.reloadOnSearch=true]\n   * <a id='reloadOnSearch'></a>\n   *\n   * If `false`, will not retrigger the same state\n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()). \n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   * <pre>reloadOnSearch: false</pre>\n   *\n   * @param {object=} stateConfig.data\n   * <a id='data'></a>\n   *\n   * Arbitrary data object, useful for custom configuration.  The parent state's `data` is\n   *   prototypally inherited.  In other words, adding a data property to a state adds it to\n   *   the entire subtree via prototypal inheritance.\n   *\n   * <pre>data: {\n   *     requiredRole: 'foo'\n   * } </pre>\n   *\n   * @param {object=} stateConfig.params\n   * <a id='params'></a>\n   *\n   * A map which optionally configures parameters declared in the `url`, or\n   *   defines additional non-url parameters.  For each parameter being\n   *   configured, add a configuration object keyed to the name of the parameter.\n   *\n   *   Each parameter configuration object may contain the following properties:\n   *\n   *   - ** value ** - {object|function=}: specifies the default value for this\n   *     parameter.  This implicitly sets this parameter as optional.\n   *\n   *     When UI-Router routes to a state and no value is\n   *     specified for this parameter in the URL or transition, the\n   *     default value will be used instead.  If `value` is a function,\n   *     it will be injected and invoked, and the return value used.\n   *\n   *     *Note*: `undefined` is treated as \"no default value\" while `null`\n   *     is treated as \"the default value is `null`\".\n   *\n   *     *Shorthand*: If you only need to configure the default value of the\n   *     parameter, you may use a shorthand syntax.   In the **`params`**\n   *     map, instead mapping the param name to a full parameter configuration\n   *     object, simply set map it to the default parameter value, e.g.:\n   *\n   * <pre>// define a parameter's default value\n   * params: {\n   *     param1: { value: \"defaultValue\" }\n   * }\n   * // shorthand default values\n   * params: {\n   *     param1: \"defaultValue\",\n   *     param2: \"param2Default\"\n   * }</pre>\n   *\n   *   - ** array ** - {boolean=}: *(default: false)* If true, the param value will be\n   *     treated as an array of values.  If you specified a Type, the value will be\n   *     treated as an array of the specified Type.  Note: query parameter values\n   *     default to a special `\"auto\"` mode.\n   *\n   *     For query parameters in `\"auto\"` mode, if multiple  values for a single parameter\n   *     are present in the URL (e.g.: `/foo?bar=1&bar=2&bar=3`) then the values\n   *     are mapped to an array (e.g.: `{ foo: [ '1', '2', '3' ] }`).  However, if\n   *     only one value is present (e.g.: `/foo?bar=1`) then the value is treated as single\n   *     value (e.g.: `{ foo: '1' }`).\n   *\n   * <pre>params: {\n   *     param1: { array: true }\n   * }</pre>\n   *\n   *   - ** squash ** - {bool|string=}: `squash` configures how a default parameter value is represented in the URL when\n   *     the current parameter value is the same as the default value. If `squash` is not set, it uses the\n   *     configured default squash policy.\n   *     (See {@link ui.router.util.$urlMatcherFactory#methods_defaultSquashPolicy `defaultSquashPolicy()`})\n   *\n   *   There are three squash settings:\n   *\n   *     - false: The parameter's default value is not squashed.  It is encoded and included in the URL\n   *     - true: The parameter's default value is omitted from the URL.  If the parameter is preceeded and followed\n   *       by slashes in the state's `url` declaration, then one of those slashes are omitted.\n   *       This can allow for cleaner looking URLs.\n   *     - `\"<arbitrary string>\"`: The parameter's default value is replaced with an arbitrary placeholder of  your choice.\n   *\n   * <pre>params: {\n   *     param1: {\n   *       value: \"defaultId\",\n   *       squash: true\n   * } }\n   * // squash \"defaultValue\" to \"~\"\n   * params: {\n   *     param1: {\n   *       value: \"defaultValue\",\n   *       squash: \"~\"\n   * } }\n   * </pre>\n   *\n   *\n   * @example\n   * <pre>\n   * // Some state name examples\n   *\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the\n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * </pre>\n   *\n   */\n  this.state = state;\n  function state(name, definition) {\n    /*jshint validthis: true */\n    if (isObject(name)) definition = name;\n    else definition.name = name;\n    registerState(definition);\n    return this;\n  }\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$state\n   *\n   * @requires $rootScope\n   * @requires $q\n   * @requires ui.router.state.$view\n   * @requires $injector\n   * @requires ui.router.util.$resolve\n   * @requires ui.router.state.$stateParams\n   * @requires ui.router.router.$urlRouter\n   *\n   * @property {object} params A param object, e.g. {sectionId: section.id)}, that \n   * you'd like to test against the current active state.\n   * @property {object} current A reference to the state's config object. However \n   * you passed it in. Useful for accessing custom data.\n   * @property {object} transition Currently pending transition. A promise that'll \n   * resolve or reject.\n   *\n   * @description\n   * `$state` service is responsible for representing states as well as transitioning\n   * between them. It also provides interfaces to ask for current state or even states\n   * you're coming from.\n   */\n  this.$get = $get;\n  $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$urlRouter', '$location', '$urlMatcherFactory'];\n  function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $urlRouter,   $location,   $urlMatcherFactory) {\n\n    var TransitionSuperseded = $q.reject(new Error('transition superseded'));\n    var TransitionPrevented = $q.reject(new Error('transition prevented'));\n    var TransitionAborted = $q.reject(new Error('transition aborted'));\n    var TransitionFailed = $q.reject(new Error('transition failed'));\n\n    // Handles the case where a state which is the target of a transition is not found, and the user\n    // can optionally retry or defer the transition\n    function handleRedirect(redirect, state, params, options) {\n      /**\n       * @ngdoc event\n       * @name ui.router.state.$state#$stateNotFound\n       * @eventOf ui.router.state.$state\n       * @eventType broadcast on root scope\n       * @description\n       * Fired when a requested state **cannot be found** using the provided state name during transition.\n       * The event is broadcast allowing any handlers a single chance to deal with the error (usually by\n       * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,\n       * you can see its three properties in the example. You can use `event.preventDefault()` to abort the\n       * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.\n       *\n       * @param {Object} event Event object.\n       * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.\n       * @param {State} fromState Current state object.\n       * @param {Object} fromParams Current state params.\n       *\n       * @example\n       *\n       * <pre>\n       * // somewhere, assume lazy.state has not been defined\n       * $state.go(\"lazy.state\", {a:1, b:2}, {inherit:false});\n       *\n       * // somewhere else\n       * $scope.$on('$stateNotFound',\n       * function(event, unfoundState, fromState, fromParams){\n       *     console.log(unfoundState.to); // \"lazy.state\"\n       *     console.log(unfoundState.toParams); // {a:1, b:2}\n       *     console.log(unfoundState.options); // {inherit:false} + default options\n       * })\n       * </pre>\n       */\n      var evt = $rootScope.$broadcast('$stateNotFound', redirect, state, params);\n\n      if (evt.defaultPrevented) {\n        $urlRouter.update();\n        return TransitionAborted;\n      }\n\n      if (!evt.retry) {\n        return null;\n      }\n\n      // Allow the handler to return a promise to defer state lookup retry\n      if (options.$retry) {\n        $urlRouter.update();\n        return TransitionFailed;\n      }\n      var retryTransition = $state.transition = $q.when(evt.retry);\n\n      retryTransition.then(function() {\n        if (retryTransition !== $state.transition) return TransitionSuperseded;\n        redirect.options.$retry = true;\n        return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);\n      }, function() {\n        return TransitionAborted;\n      });\n      $urlRouter.update();\n\n      return retryTransition;\n    }\n\n    root.locals = { resolve: null, globals: { $stateParams: {} } };\n\n    $state = {\n      params: {},\n      current: root.self,\n      $current: root,\n      transition: null\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#reload\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, \n     * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).\n     *\n     * @example\n     * <pre>\n     * var app angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.reload = function(){\n     *     $state.reload();\n     *   }\n     * });\n     * </pre>\n     *\n     * `reload()` is just an alias for:\n     * <pre>\n     * $state.transitionTo($state.current, $stateParams, { \n     *   reload: true, inherit: false, notify: true\n     * });\n     * </pre>\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.reload = function reload() {\n      return $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: true });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#go\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Convenience method for transitioning to a new state. `$state.go` calls \n     * `$state.transitionTo` internally but automatically sets options to \n     * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. \n     * This allows you to easily use an absolute or relative to path and specify \n     * only the parameters you'd like to update (while letting unspecified parameters \n     * inherit from the currently active ancestor states).\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.go('contact.detail');\n     *   };\n     * });\n     * </pre>\n     * <img src='../ngdoc_assets/StateGoExamples.png'/>\n     *\n     * @param {string} to Absolute state name or relative state path. Some examples:\n     *\n     * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n     * - `$state.go('^')` - will go to a parent state\n     * - `$state.go('^.sibling')` - will go to a sibling state\n     * - `$state.go('.child.grandchild')` - will go to grandchild state\n     *\n     * @param {object=} params A map of the parameters that will be sent to the state, \n     * will populate $stateParams. Any parameters that are not specified will be inherited from currently \n     * defined parameters. This allows, for example, going to a sibling state that shares parameters\n     * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.\n     * transitioning to a sibling will get you the parameters for all parents, transitioning to a child\n     * will get you all current parameters, etc.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition.\n     *\n     * Possible success values:\n     *\n     * - $state.current\n     *\n     * <br/>Possible rejection values:\n     *\n     * - 'transition superseded' - when a newer transition has been started after this one\n     * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener\n     * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or\n     *   when a `$stateNotFound` `event.retry` promise errors.\n     * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.\n     * - *resolve error* - when an error has occurred with a `resolve`\n     *\n     */\n    $state.go = function go(to, params, options) {\n      return $state.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#transitionTo\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}\n     * uses `transitionTo` internally. `$state.go` is recommended in most situations.\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.transitionTo('contact.detail');\n     *   };\n     * });\n     * </pre>\n     *\n     * @param {string} to State name.\n     * @param {object=} toParams A map of the parameters that will be sent to the state,\n     * will populate $stateParams.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.transitionTo = function transitionTo(to, toParams, options) {\n      toParams = toParams || {};\n      options = extend({\n        location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false\n      }, options || {});\n\n      var from = $state.$current, fromParams = $state.params, fromPath = from.path;\n      var evt, toState = findState(to, options.relative);\n\n      if (!isDefined(toState)) {\n        var redirect = { to: to, toParams: toParams, options: options };\n        var redirectResult = handleRedirect(redirect, from.self, fromParams, options);\n\n        if (redirectResult) {\n          return redirectResult;\n        }\n\n        // Always retry once if the $stateNotFound was not prevented\n        // (handles either redirect changed or state lazy-definition)\n        to = redirect.to;\n        toParams = redirect.toParams;\n        options = redirect.options;\n        toState = findState(to, options.relative);\n\n        if (!isDefined(toState)) {\n          if (!options.relative) throw new Error(\"No such state '\" + to + \"'\");\n          throw new Error(\"Could not resolve '\" + to + \"' from state '\" + options.relative + \"'\");\n        }\n      }\n      if (toState[abstractKey]) throw new Error(\"Cannot transition to abstract state '\" + to + \"'\");\n      if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);\n      if (!toState.params.$$validates(toParams)) return TransitionFailed;\n\n      toParams = toState.params.$$values(toParams);\n      to = toState;\n\n      var toPath = to.path;\n\n      // Starting from the root of the path, keep all levels that haven't changed\n      var keep = 0, state = toPath[keep], locals = root.locals, toLocals = [];\n\n      if (!options.reload) {\n        while (state && state === fromPath[keep] && state.ownParams.$$equals(toParams, fromParams)) {\n          locals = toLocals[keep] = state.locals;\n          keep++;\n          state = toPath[keep];\n        }\n      }\n\n      // If we're going to the same state and all locals are kept, we've got nothing to do.\n      // But clear 'transition', as we still want to cancel any other pending transitions.\n      // TODO: We may not want to bump 'transition' if we're called from a location change\n      // that we've initiated ourselves, because we might accidentally abort a legitimate\n      // transition initiated from code?\n      if (shouldTriggerReload(to, from, locals, options)) {\n        if (to.self.reloadOnSearch !== false) $urlRouter.update();\n        $state.transition = null;\n        return $q.when($state.current);\n      }\n\n      // Filter parameters before we pass them to event handlers etc.\n      toParams = filterByKeys(to.params.$$keys(), toParams || {});\n\n      // Broadcast start event and cancel the transition if requested\n      if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeStart\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when the state transition **begins**. You can use `event.preventDefault()`\n         * to prevent the transition from happening and then the transition promise will be\n         * rejected with a `'transition prevented'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         *\n         * @example\n         *\n         * <pre>\n         * $rootScope.$on('$stateChangeStart',\n         * function(event, toState, toParams, fromState, fromParams){\n         *     event.preventDefault();\n         *     // transitionTo() promise will be rejected with\n         *     // a 'transition prevented' error\n         * })\n         * </pre>\n         */\n        if ($rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams).defaultPrevented) {\n          $urlRouter.update();\n          return TransitionPrevented;\n        }\n      }\n\n      // Resolve locals for the remaining states, but don't update any global state just\n      // yet -- if anything fails to resolve the current state needs to remain untouched.\n      // We also set up an inheritance chain for the locals here. This allows the view directive\n      // to quickly look up the correct definition for each view in the current state. Even\n      // though we create the locals object itself outside resolveState(), it is initially\n      // empty and gets filled asynchronously. We need to keep track of the promise for the\n      // (fully resolved) current locals, and pass this down the chain.\n      var resolved = $q.when(locals);\n\n      for (var l = keep; l < toPath.length; l++, state = toPath[l]) {\n        locals = toLocals[l] = inherit(locals);\n        resolved = resolveState(state, toParams, state === to, resolved, locals, options);\n      }\n\n      // Once everything is resolved, we are ready to perform the actual transition\n      // and return a promise for the new state. We also keep track of what the\n      // current promise is, so that we can detect overlapping transitions and\n      // keep only the outcome of the last transition.\n      var transition = $state.transition = resolved.then(function () {\n        var l, entering, exiting;\n\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Exit 'from' states not kept\n        for (l = fromPath.length - 1; l >= keep; l--) {\n          exiting = fromPath[l];\n          if (exiting.self.onExit) {\n            $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);\n          }\n          exiting.locals = null;\n        }\n\n        // Enter 'to' states not kept\n        for (l = keep; l < toPath.length; l++) {\n          entering = toPath[l];\n          entering.locals = toLocals[l];\n          if (entering.self.onEnter) {\n            $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);\n          }\n        }\n\n        // Run it again, to catch any transitions in callbacks\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Update globals in $state\n        $state.$current = to;\n        $state.current = to.self;\n        $state.params = toParams;\n        copy($state.params, $stateParams);\n        $state.transition = null;\n\n        if (options.location && to.navigable) {\n          $urlRouter.push(to.navigable.url, to.navigable.locals.globals.$stateParams, {\n            $$avoidResync: true, replace: options.location === 'replace'\n          });\n        }\n\n        if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeSuccess\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired once the state transition is **complete**.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         */\n          $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);\n        }\n        $urlRouter.update(true);\n\n        return $state.current;\n      }, function (error) {\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        $state.transition = null;\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeError\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when an **error occurs** during transition. It's important to note that if you\n         * have any errors in your resolve functions (javascript errors, non-existent services, etc)\n         * they will not throw traditionally. You must listen for this $stateChangeError event to\n         * catch **ALL** errors.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         * @param {Error} error The resolve error object.\n         */\n        evt = $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);\n\n        if (!evt.defaultPrevented) {\n            $urlRouter.update();\n        }\n\n        return $q.reject(error);\n      });\n\n      return transition;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#is\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Similar to {@link ui.router.state.$state#methods_includes $state.includes},\n     * but only checks for the full state name. If params is supplied then it will be\n     * tested for strict equality against the current active params object, so all params\n     * must match with none missing and no extras.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // absolute name\n     * $state.is('contact.details.item'); // returns true\n     * $state.is(contactDetailItemStateObject); // returns true\n     *\n     * // relative name (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.is('.item')}\">Item</div>\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name (absolute or relative) or state object you'd like to check.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like\n     * to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object} -  If `stateOrName` is a relative state name and `options.relative` is set, .is will\n     * test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it is the state.\n     */\n    $state.is = function is(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) { return undefined; }\n      if ($state.$current !== state) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams) : true;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#includes\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method to determine if the current active state is equal to or is the child of the\n     * state stateName. If any params are passed then they will be tested for a match as well.\n     * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n     *\n     * @example\n     * Partial and relative names\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // Using partial names\n     * $state.includes(\"contacts\"); // returns true\n     * $state.includes(\"contacts.details\"); // returns true\n     * $state.includes(\"contacts.details.item\"); // returns true\n     * $state.includes(\"contacts.list\"); // returns false\n     * $state.includes(\"about\"); // returns false\n     *\n     * // Using relative names (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.includes('.item')}\">Item</div>\n     * </pre>\n     *\n     * Basic globbing patterns\n     * <pre>\n     * $state.$current.name = 'contacts.details.item.url';\n     *\n     * $state.includes(\"*.details.*.*\"); // returns true\n     * $state.includes(\"*.details.**\"); // returns true\n     * $state.includes(\"**.item.**\"); // returns true\n     * $state.includes(\"*.details.item.url\"); // returns true\n     * $state.includes(\"*.details.*.url\"); // returns true\n     * $state.includes(\"*.details.*\"); // returns false\n     * $state.includes(\"item.**\"); // returns false\n     * </pre>\n     *\n     * @param {string} stateOrName A partial name, relative name, or glob pattern\n     * to be searched for within the current state name.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`,\n     * that you'd like to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object=} -  If `stateOrName` is a relative state reference and `options.relative` is set,\n     * .includes will test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it does include the state\n     */\n    $state.includes = function includes(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      if (isString(stateOrName) && isGlob(stateOrName)) {\n        if (!doesStateMatchGlob(stateOrName)) {\n          return false;\n        }\n        stateOrName = $state.$current.name;\n      }\n\n      var state = findState(stateOrName, options.relative);\n      if (!isDefined(state)) { return undefined; }\n      if (!isDefined($state.$current.includes[state.name])) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams, objectKeys(params)) : true;\n    };\n\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#href\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A url generation method that returns the compiled url for the given state populated with the given params.\n     *\n     * @example\n     * <pre>\n     * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.\n     * @param {object=} params An object of parameter values to fill the state's required parameters.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`lossy`** - {boolean=true} -  If true, and if there is no url associated with the state provided in the\n     *    first parameter, then the constructed href url will be built from the first navigable ancestor (aka\n     *    ancestor with a valid url).\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n     * \n     * @returns {string} compiled state url\n     */\n    $state.href = function href(stateOrName, params, options) {\n      options = extend({\n        lossy:    true,\n        inherit:  true,\n        absolute: false,\n        relative: $state.$current\n      }, options || {});\n\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) return null;\n      if (options.inherit) params = inheritParams($stateParams, params || {}, $state.$current, state);\n      \n      var nav = (state && options.lossy) ? state.navigable : state;\n\n      if (!nav || nav.url === undefined || nav.url === null) {\n        return null;\n      }\n      return $urlRouter.href(nav.url, filterByKeys(state.params.$$keys(), params || {}), {\n        absolute: options.absolute\n      });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#get\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Returns the state configuration object for any specific state or all states.\n     *\n     * @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for\n     * the requested state. If not provided, returns an array of ALL state configs.\n     * @param {string|object=} context When stateOrName is a relative state reference, the state will be retrieved relative to context.\n     * @returns {Object|Array} State configuration object or array of all objects.\n     */\n    $state.get = function (stateOrName, context) {\n      if (arguments.length === 0) return map(objectKeys(states), function(name) { return states[name].self; });\n      var state = findState(stateOrName, context || $state.$current);\n      return (state && state.self) ? state.self : null;\n    };\n\n    function resolveState(state, params, paramsAreFiltered, inherited, dst, options) {\n      // Make a restricted $stateParams with only the parameters that apply to this state if\n      // necessary. In addition to being available to the controller and onEnter/onExit callbacks,\n      // we also need $stateParams to be available for any $injector calls we make during the\n      // dependency resolution process.\n      var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params.$$keys(), params);\n      var locals = { $stateParams: $stateParams };\n\n      // Resolve 'global' dependencies for the state, i.e. those not specific to a view.\n      // We're also including $stateParams in this; that way the parameters are restricted\n      // to the set that should be visible to the state, and are independent of when we update\n      // the global $state and $stateParams values.\n      dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);\n      var promises = [dst.resolve.then(function (globals) {\n        dst.globals = globals;\n      })];\n      if (inherited) promises.push(inherited);\n\n      // Resolve template and dependencies for all views.\n      forEach(state.views, function (view, name) {\n        var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});\n        injectables.$template = [ function () {\n          return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: options.notify }) || '';\n        }];\n\n        promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {\n          // References to the controller (only instantiated at link time)\n          if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {\n            var injectLocals = angular.extend({}, injectables, locals);\n            result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);\n          } else {\n            result.$$controller = view.controller;\n          }\n          // Provide access to the state itself for internal use\n          result.$$state = state;\n          result.$$controllerAs = view.controllerAs;\n          dst[name] = result;\n        }));\n      });\n\n      // Wait for all the promises and then return the activation object\n      return $q.all(promises).then(function (values) {\n        return dst;\n      });\n    }\n\n    return $state;\n  }\n\n  function shouldTriggerReload(to, from, locals, options) {\n    if (to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false))) {\n      return true;\n    }\n  }\n}\n\nangular.module('ui.router.state')\n  .value('$stateParams', {})\n  .provider('$state', $StateProvider);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/stateDirectives.js",
    "content": "function parseStateRef(ref, current) {\n  var preparsed = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n  if (preparsed) ref = current + '(' + preparsed[1] + ')';\n  parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1], paramExpr: parsed[3] || null };\n}\n\nfunction stateContext(el) {\n  var stateData = el.parent().inheritedData('$uiView');\n\n  if (stateData && stateData.state && stateData.state.name) {\n    return stateData.state;\n  }\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref\n *\n * @requires ui.router.state.$state\n * @requires $timeout\n *\n * @restrict A\n *\n * @description\n * A directive that binds a link (`<a>` tag) to a state. If the state has an associated \n * URL, the directive will automatically generate & update the `href` attribute via \n * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking \n * the link will trigger a state transition with optional parameters. \n *\n * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be \n * handled natively by the browser.\n *\n * You can also use relative state paths within ui-sref, just like the relative \n * paths passed to `$state.go()`. You just need to be aware that the path is relative\n * to the state that the link lives in, in other words the state that loaded the \n * template containing the link.\n *\n * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}\n * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,\n * and `reload`.\n *\n * @example\n * Here's an example of how you'd use ui-sref and how it would compile. If you have the \n * following template:\n * <pre>\n * <a ui-sref=\"home\">Home</a> | <a ui-sref=\"about\">About</a> | <a ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * </pre>\n * \n * Then the compiled html would be (assuming Html5Mode is off and current state is contacts):\n * <pre>\n * <a href=\"#/home\" ui-sref=\"home\">Home</a> | <a href=\"#/about\" ui-sref=\"about\">About</a> | <a href=\"#/contacts?page=2\" ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * </pre>\n *\n * @param {string} ui-sref 'stateName' can be any valid absolute or relative state\n * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}\n */\n$StateRefDirective.$inject = ['$state', '$timeout'];\nfunction $StateRefDirective($state, $timeout) {\n  var allowedOptions = ['location', 'inherit', 'reload'];\n\n  return {\n    restrict: 'A',\n    require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n    link: function(scope, element, attrs, uiSrefActive) {\n      var ref = parseStateRef(attrs.uiSref, $state.current.name);\n      var params = null, url = null, base = stateContext(element) || $state.$current;\n      var newHref = null, isAnchor = element.prop(\"tagName\") === \"A\";\n      var isForm = element[0].nodeName === \"FORM\";\n      var attr = isForm ? \"action\" : \"href\", nav = true;\n\n      var options = { relative: base, inherit: true };\n      var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};\n\n      angular.forEach(allowedOptions, function(option) {\n        if (option in optionsOverride) {\n          options[option] = optionsOverride[option];\n        }\n      });\n\n      var update = function(newVal) {\n        if (newVal) params = angular.copy(newVal);\n        if (!nav) return;\n\n        newHref = $state.href(ref.state, params, options);\n\n        var activeDirective = uiSrefActive[1] || uiSrefActive[0];\n        if (activeDirective) {\n          activeDirective.$$setStateInfo(ref.state, params);\n        }\n        if (newHref === null) {\n          nav = false;\n          return false;\n        }\n        attrs.$set(attr, newHref);\n      };\n\n      if (ref.paramExpr) {\n        scope.$watch(ref.paramExpr, function(newVal, oldVal) {\n          if (newVal !== params) update(newVal);\n        }, true);\n        params = angular.copy(scope.$eval(ref.paramExpr));\n      }\n      update();\n\n      if (isForm) return;\n\n      element.bind(\"click\", function(e) {\n        var button = e.which || e.button;\n        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {\n          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n          var transition = $timeout(function() {\n            $state.go(ref.state, params, options);\n          });\n          e.preventDefault();\n\n          // if the state has no URL, ignore one preventDefault from the <a> directive.\n          var ignorePreventDefaultCount = isAnchor && !newHref ? 1: 0;\n          e.preventDefault = function() {\n            if (ignorePreventDefaultCount-- <= 0)\n              $timeout.cancel(transition);\n          };\n        }\n      });\n    }\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * A directive working alongside ui-sref to add classes to an element when the\n * related ui-sref directive's state is active, and removing them when it is inactive.\n * The primary use-case is to simplify the special appearance of navigation menus\n * relying on `ui-sref`, by having the \"active\" state's menu button appear different,\n * distinguishing it from the inactive menu items.\n *\n * ui-sref-active can live on the same element as ui-sref or on a parent element. The first\n * ui-sref-active found at the same level or above the ui-sref will be used.\n *\n * Will activate when the ui-sref's target state or any child state is active. If you\n * need to activate only when the ui-sref target state is active and *not* any of\n * it's children, then you will use\n * {@link ui.router.state.directive:ui-sref-active-eq ui-sref-active-eq}\n *\n * @example\n * Given the following template:\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n *\n * When the app state is \"app.user\" (or any children states), and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n * The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * Multiple classes may be specified in a space-separated format:\n * <pre>\n * <ul>\n *   <li ui-sref-active='class1 class2 class3'>\n *     <a ui-sref=\"app.user\">link</a>\n *   </li>\n * </ul>\n * </pre>\n */\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active-eq\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * The same as {@link ui.router.state.directive:ui-sref-active ui-sref-active} but will only activate\n * when the exact target state used in the `ui-sref` is active; no child states.\n *\n */\n$StateRefActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateRefActiveDirective($state, $stateParams, $interpolate) {\n  return  {\n    restrict: \"A\",\n    controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {\n      var state, params, activeClass;\n\n      // There probably isn't much point in $observing this\n      // uiSrefActive and uiSrefActiveEq share the same directive object with some\n      // slight difference in logic routing\n      activeClass = $interpolate($attrs.uiSrefActiveEq || $attrs.uiSrefActive || '', false)($scope);\n\n      // Allow uiSref to communicate with uiSrefActive[Equals]\n      this.$$setStateInfo = function (newState, newParams) {\n        state = $state.get(newState, stateContext($element));\n        params = newParams;\n        update();\n      };\n\n      $scope.$on('$stateChangeSuccess', update);\n\n      // Update route state\n      function update() {\n        if (isMatch()) {\n          $element.addClass(activeClass);\n        } else {\n          $element.removeClass(activeClass);\n        }\n      }\n\n      function isMatch() {\n        if (typeof $attrs.uiSrefActiveEq !== 'undefined') {\n          return state && $state.is(state.name, params);\n        } else {\n          return state && $state.includes(state.name, params);\n        }\n      }\n    }]\n  };\n}\n\nangular.module('ui.router.state')\n  .directive('uiSref', $StateRefDirective)\n  .directive('uiSrefActive', $StateRefActiveDirective)\n  .directive('uiSrefActiveEq', $StateRefActiveDirective);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/stateFilters.js",
    "content": "/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n  var isFilter = function (state) {\n    return $state.is(state);\n  };\n  isFilter.$stateful = true;\n  return isFilter;\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n  var includesFilter = function (state) {\n    return $state.includes(state);\n  };\n  includesFilter.$stateful = true;\n  return  includesFilter;\n}\n\nangular.module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/templateFactory.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.util.$templateFactory\n *\n * @requires $http\n * @requires $templateCache\n * @requires $injector\n *\n * @description\n * Service. Manages loading of templates.\n */\n$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];\nfunction $TemplateFactory(  $http,   $templateCache,   $injector) {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromConfig\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a configuration object. \n   *\n   * @param {object} config Configuration object for which to load a template. \n   * The following properties are search in the specified order, and the first one \n   * that is defined is used to create the template:\n   *\n   * @param {string|object} config.template html string template or function to \n   * load via {@link ui.router.util.$templateFactory#fromString fromString}.\n   * @param {string|object} config.templateUrl url to load or a function returning \n   * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.\n   * @param {Function} config.templateProvider function to invoke via \n   * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.\n   * @param {object} params  Parameters to pass to the template function.\n   * @param {object} locals Locals to pass to `invoke` if the template is loaded \n   * via a `templateProvider`. Defaults to `{ params: params }`.\n   *\n   * @return {string|object}  The template html as a string, or a promise for \n   * that string,or `null` if no template is configured.\n   */\n  this.fromConfig = function (config, params, locals) {\n    return (\n      isDefined(config.template) ? this.fromString(config.template, params) :\n      isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :\n      isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :\n      null\n    );\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromString\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param {string|object} template html template as a string or function that \n   * returns an html template as a string.\n   * @param {object} params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that \n   * string.\n   */\n  this.fromString = function (template, params) {\n    return isFunction(template) ? template(params) : template;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   * \n   * @description\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function \n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromUrl = function (url, params) {\n    if (isFunction(url)) url = url(params);\n    if (url == null) return null;\n    else return $http\n        .get(url, { cache: $templateCache, headers: { Accept: 'text/html' }})\n        .then(function(response) { return response.data; });\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromProvider\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param {Function} provider Function to invoke via `$injector.invoke`\n   * @param {Object} params Parameters for the template.\n   * @param {Object} locals Locals to pass to `invoke`. Defaults to \n   * `{ params: params }`.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromProvider = function (provider, params, locals) {\n    return $injector.invoke(provider, null, locals || { params: params });\n  };\n}\n\nangular.module('ui.router.util').service('$templateFactory', $TemplateFactory);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/urlMatcherFactory.js",
    "content": "var $$UMFP; // reference to $UrlMatcherFactoryProvider\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:UrlMatcher\n *\n * @description\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list\n * of search parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.\n * \n * Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace\n * syntax, which optionally allows a regular expression for the parameter to be specified:\n *\n * * `':'` name - colon placeholder\n * * `'*'` name - catch-all placeholder\n * * `'{' name '}'` - curly placeholder\n * * `'{' name ':' regexp|type '}'` - curly placeholder with regexp or type name. Should the\n *   regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters). For colon \n * placeholders or curly placeholders without an explicit regexp, a path parameter matches any\n * number of characters other than '/'. For catch-all placeholders the path parameter matches\n * any number of characters.\n * \n * Examples:\n * \n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n *   in the built-in  `date` Type matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n * @param {string} pattern  The pattern to compile into a matcher.\n * @param {Object} config  A configuration object hash:\n * @param {Object=} parentMatcher Used to concatenate the pattern/config onto\n *   an existing UrlMatcher\n *\n * * `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * * `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n *\n * @property {string} prefix  A static prefix of this pattern. The matcher guarantees that any\n *   URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns\n *   non-null) will start with this prefix.\n *\n * @property {string} source  The pattern that was passed into the constructor\n *\n * @property {string} sourcePath  The path portion of the source property\n *\n * @property {string} sourceSearch  The search portion of the source property\n *\n * @property {string} regex  The constructed regex that will be used to match against the url when \n *   it is time to determine which url will match.\n *\n * @returns {Object}  New `UrlMatcher` object\n */\nfunction UrlMatcher(pattern, config, parentMatcher) {\n  config = extend({ params: {} }, isObject(config) ? config : {});\n\n  // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n  //   '*' name\n  //   ':' name\n  //   '{' name '}'\n  //   '{' name ':' regexp '}'\n  // The regular expression is somewhat complicated due to the need to allow curly braces\n  // inside the regular expression. The placeholder regexp breaks down as follows:\n  //    ([:*])([\\w\\[\\]]+)              - classic placeholder ($1 / $2) (search version has - for snake-case)\n  //    \\{([\\w\\[\\]]+)(?:\\:( ... ))?\\}  - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n  //    (?: ... | ... | ... )+         - the regexp consists of any number of atoms, an atom being either\n  //    [^{}\\\\]+                       - anything other than curly braces or backslash\n  //    \\\\.                            - a backslash escape\n  //    \\{(?:[^{}\\\\]+|\\\\.)*\\}          - a matched set of curly braces containing other atoms\n  var placeholder       = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      searchPlaceholder = /([:]?)([\\w\\[\\]-]+)|\\{([\\w\\[\\]-]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      compiled = '^', last = 0, m,\n      segments = this.segments = [],\n      parentParams = parentMatcher ? parentMatcher.params : {},\n      params = this.params = parentMatcher ? parentMatcher.params.$$new() : new $$UMFP.ParamSet(),\n      paramNames = [];\n\n  function addParameter(id, type, config, location) {\n    paramNames.push(id);\n    if (parentParams[id]) return parentParams[id];\n    if (!/^\\w+(-+\\w+)*(?:\\[\\])?$/.test(id)) throw new Error(\"Invalid parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    if (params[id]) throw new Error(\"Duplicate parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    params[id] = new $$UMFP.Param(id, type, config, location);\n    return params[id];\n  }\n\n  function quoteRegExp(string, pattern, squash) {\n    var surroundPattern = ['',''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n    if (!pattern) return result;\n    switch(squash) {\n      case false: surroundPattern = ['(', ')'];   break;\n      case true:  surroundPattern = ['?(', ')?']; break;\n      default:    surroundPattern = ['(' + squash + \"|\", ')?'];  break;\n    }\n    return result + surroundPattern[0] + pattern + surroundPattern[1];\n  }\n\n  this.source = pattern;\n\n  // Split into static segments separated by path parameter placeholders.\n  // The number of segments is always 1 more than the number of parameters.\n  function matchDetails(m, isSearch) {\n    var id, regexp, segment, type, cfg, arrayMode;\n    id          = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null\n    cfg         = config.params[id];\n    segment     = pattern.substring(last, m.index);\n    regexp      = isSearch ? m[4] : m[4] || (m[1] == '*' ? '.*' : null);\n    type        = $$UMFP.type(regexp || \"string\") || inherit($$UMFP.type(\"string\"), { pattern: new RegExp(regexp) });\n    return {\n      id: id, regexp: regexp, segment: segment, type: type, cfg: cfg\n    };\n  }\n\n  var p, param, segment;\n  while ((m = placeholder.exec(pattern))) {\n    p = matchDetails(m, false);\n    if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n    param = addParameter(p.id, p.type, p.cfg, \"path\");\n    compiled += quoteRegExp(p.segment, param.type.pattern.source, param.squash);\n    segments.push(p.segment);\n    last = placeholder.lastIndex;\n  }\n  segment = pattern.substring(last);\n\n  // Find any search parameter names and remove them from the last segment\n  var i = segment.indexOf('?');\n\n  if (i >= 0) {\n    var search = this.sourceSearch = segment.substring(i);\n    segment = segment.substring(0, i);\n    this.sourcePath = pattern.substring(0, last + i);\n\n    if (search.length > 0) {\n      last = 0;\n      while ((m = searchPlaceholder.exec(search))) {\n        p = matchDetails(m, true);\n        param = addParameter(p.id, p.type, p.cfg, \"search\");\n        last = placeholder.lastIndex;\n        // check if ?&\n      }\n    }\n  } else {\n    this.sourcePath = pattern;\n    this.sourceSearch = '';\n  }\n\n  compiled += quoteRegExp(segment) + (config.strict === false ? '\\/?' : '') + '$';\n  segments.push(segment);\n\n  this.regexp = new RegExp(compiled, config.caseInsensitive ? 'i' : undefined);\n  this.prefix = segments[0];\n  this.$$paramNames = paramNames;\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#concat\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns a new matcher for a pattern constructed by appending the path part and adding the\n * search parameters of the specified pattern to this pattern. The current pattern is not\n * modified. This can be understood as creating a pattern for URLs that are relative to (or\n * suffixes of) the current pattern.\n *\n * @example\n * The following two matchers are equivalent:\n * <pre>\n * new UrlMatcher('/user/{id}?q').concat('/details?date');\n * new UrlMatcher('/user/{id}/details?q&date');\n * </pre>\n *\n * @param {string} pattern  The pattern to append.\n * @param {Object} config  An object hash of the configuration for the matcher.\n * @returns {UrlMatcher}  A matcher for the concatenated pattern.\n */\nUrlMatcher.prototype.concat = function (pattern, config) {\n  // Because order of search parameters is irrelevant, we can add our own search\n  // parameters to the end of the new pattern. Parse the new pattern by itself\n  // and then join the bits together, but it's much easier to do this on a string level.\n  var defaultConfig = {\n    caseInsensitive: $$UMFP.caseInsensitive(),\n    strict: $$UMFP.strictMode(),\n    squash: $$UMFP.defaultSquashPolicy()\n  };\n  return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch, extend(defaultConfig, config), this);\n};\n\nUrlMatcher.prototype.toString = function () {\n  return this.source;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#exec\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Tests the specified path against this matcher, and returns an object containing the captured\n * parameter values, or null if the path does not match. The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `searchParams`. This means that search parameters are always treated\n * as optional.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n *   x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * </pre>\n *\n * @param {string} path  The URL path to match, e.g. `$location.path()`.\n * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.\n * @returns {Object}  The captured parameter values.\n */\nUrlMatcher.prototype.exec = function (path, searchParams) {\n  var m = this.regexp.exec(path);\n  if (!m) return null;\n  searchParams = searchParams || {};\n\n  var paramNames = this.parameters(), nTotal = paramNames.length,\n    nPath = this.segments.length - 1,\n    values = {}, i, j, cfg, paramName;\n\n  if (nPath !== m.length - 1) throw new Error(\"Unbalanced capture group in route '\" + this.source + \"'\");\n\n  function decodePathArray(string) {\n    function reverseString(str) { return str.split(\"\").reverse().join(\"\"); }\n    function unquoteDashes(str) { return str.replace(/\\\\-/, \"-\"); }\n\n    var split = reverseString(string).split(/-(?!\\\\)/);\n    var allReversed = map(split, reverseString);\n    return map(allReversed, unquoteDashes).reverse();\n  }\n\n  for (i = 0; i < nPath; i++) {\n    paramName = paramNames[i];\n    var param = this.params[paramName];\n    var paramVal = m[i+1];\n    // if the param value matches a pre-replace pair, replace the value before decoding.\n    for (j = 0; j < param.replace; j++) {\n      if (param.replace[j].from === paramVal) paramVal = param.replace[j].to;\n    }\n    if (paramVal && param.array === true) paramVal = decodePathArray(paramVal);\n    values[paramName] = param.value(paramVal);\n  }\n  for (/**/; i < nTotal; i++) {\n    paramName = paramNames[i];\n    values[paramName] = this.params[paramName].value(searchParams[paramName]);\n  }\n\n  return values;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#parameters\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns the names of all path and search parameters of this pattern in an unspecified order.\n * \n * @returns {Array.<string>}  An array of parameter names. Must be treated as read-only. If the\n *    pattern has no parameters, an empty array is returned.\n */\nUrlMatcher.prototype.parameters = function (param) {\n  if (!isDefined(param)) return this.$$paramNames;\n  return this.params[param] || null;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#validate\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param {Object} params The object hash of parameters to validate.\n * @returns {boolean} Returns `true` if `params` validates, otherwise `false`.\n */\nUrlMatcher.prototype.validates = function (params) {\n  return this.params.$$validates(params);\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#format\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters. Null values for path parameters are\n * treated as empty strings.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * </pre>\n *\n * @param {Object} values  the values to substitute for the parameters in this pattern.\n * @returns {string}  the formatted URL (path and optionally search part).\n */\nUrlMatcher.prototype.format = function (values) {\n  values = values || {};\n  var segments = this.segments, params = this.parameters(), paramset = this.params;\n  if (!this.validates(values)) return null;\n\n  var i, search = false, nPath = segments.length - 1, nTotal = params.length, result = segments[0];\n\n  function encodeDashes(str) { // Replace dashes with encoded \"\\-\"\n    return encodeURIComponent(str).replace(/-/g, function(c) { return '%5C%' + c.charCodeAt(0).toString(16).toUpperCase(); });\n  }\n\n  for (i = 0; i < nTotal; i++) {\n    var isPathParam = i < nPath;\n    var name = params[i], param = paramset[name], value = param.value(values[name]);\n    var isDefaultValue = param.isOptional && param.type.equals(param.value(), value);\n    var squash = isDefaultValue ? param.squash : false;\n    var encoded = param.type.encode(value);\n\n    if (isPathParam) {\n      var nextSegment = segments[i + 1];\n      if (squash === false) {\n        if (encoded != null) {\n          if (isArray(encoded)) {\n            result += map(encoded, encodeDashes).join(\"-\");\n          } else {\n            result += encodeURIComponent(encoded);\n          }\n        }\n        result += nextSegment;\n      } else if (squash === true) {\n        var capture = result.match(/\\/$/) ? /\\/?(.*)/ : /(.*)/;\n        result += nextSegment.match(capture)[1];\n      } else if (isString(squash)) {\n        result += squash + nextSegment;\n      }\n    } else {\n      if (encoded == null || (isDefaultValue && squash !== false)) continue;\n      if (!isArray(encoded)) encoded = [ encoded ];\n      encoded = map(encoded, encodeURIComponent).join('&' + name + '=');\n      result += (search ? '&' : '?') + (name + '=' + encoded);\n      search = true;\n    }\n  }\n\n  return result;\n};\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:Type\n *\n * @description\n * Implements an interface to define custom parameter types that can be decoded from and encoded to\n * string parameters matched in a URL. Used by {@link ui.router.util.type:UrlMatcher `UrlMatcher`}\n * objects when matching or formatting URLs, or comparing or validating parameter values.\n *\n * See {@link ui.router.util.$urlMatcherFactory#methods_type `$urlMatcherFactory#type()`} for more\n * information on registering custom types.\n *\n * @param {Object} config  A configuration object which contains the custom type definition.  The object's\n *        properties will override the default methods and/or pattern in `Type`'s public interface.\n * @example\n * <pre>\n * {\n *   decode: function(val) { return parseInt(val, 10); },\n *   encode: function(val) { return val && val.toString(); },\n *   equals: function(a, b) { return this.is(a) && a === b; },\n *   is: function(val) { return angular.isNumber(val) isFinite(val) && val % 1 === 0; },\n *   pattern: /\\d+/\n * }\n * </pre>\n *\n * @property {RegExp} pattern The regular expression pattern used to match values of this type when\n *           coming from a substring of a URL.\n *\n * @returns {Object}  Returns a new `Type` object.\n */\nfunction Type(config) {\n  extend(this, config);\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#is\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Detects whether a value is of a particular type. Accepts a native (decoded) value\n * and determines whether it matches the current `Type` object.\n *\n * @param {*} val  The value to check.\n * @param {string} key  Optional. If the type check is happening in the context of a specific\n *        {@link ui.router.util.type:UrlMatcher `UrlMatcher`} object, this is the name of the\n *        parameter in which `val` is stored. Can be used for meta-programming of `Type` objects.\n * @returns {Boolean}  Returns `true` if the value matches the type, otherwise `false`.\n */\nType.prototype.is = function(val, key) {\n  return true;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#encode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Encodes a custom/native type value to a string that can be embedded in a URL. Note that the\n * return value does *not* need to be URL-safe (i.e. passed through `encodeURIComponent()`), it\n * only needs to be a representation of `val` that has been coerced to a string.\n *\n * @param {*} val  The value to encode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {string}  Returns a string representation of `val` that can be encoded in a URL.\n */\nType.prototype.encode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#decode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Converts a parameter value (from URL string or transition param) to a custom/native value.\n *\n * @param {string} val  The URL parameter value to decode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {*}  Returns a custom representation of the URL parameter value.\n */\nType.prototype.decode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#equals\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Determines whether two decoded values are equivalent.\n *\n * @param {*} a  A value to compare against.\n * @param {*} b  A value to compare against.\n * @returns {Boolean}  Returns `true` if the values are equivalent/equal, otherwise `false`.\n */\nType.prototype.equals = function(a, b) {\n  return a == b;\n};\n\nType.prototype.$subPattern = function() {\n  var sub = this.pattern.toString();\n  return sub.substr(1, sub.length - 2);\n};\n\nType.prototype.pattern = /.*/;\n\nType.prototype.toString = function() { return \"{Type:\" + this.name + \"}\"; };\n\n/*\n * Wraps an existing custom Type as an array of Type, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\nType.prototype.$asArray = function(mode, isSearch) {\n  if (!mode) return this;\n  if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n  return new ArrayType(this, mode);\n\n  function ArrayType(type, mode) {\n    function bindTo(type, callbackName) {\n      return function() {\n        return type[callbackName].apply(type, arguments);\n      };\n    }\n\n    // Wrap non-array value as array\n    function arrayWrap(val) { return isArray(val) ? val : (isDefined(val) ? [ val ] : []); }\n    // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n    function arrayUnwrap(val) {\n      switch(val.length) {\n        case 0: return undefined;\n        case 1: return mode === \"auto\" ? val[0] : val;\n        default: return val;\n      }\n    }\n    function falsey(val) { return !val; }\n\n    // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n    function arrayHandler(callback, allTruthyMode) {\n      return function handleArray(val) {\n        val = arrayWrap(val);\n        var result = map(val, callback);\n        if (allTruthyMode === true)\n          return filter(result, falsey).length === 0;\n        return arrayUnwrap(result);\n      };\n    }\n\n    // Wraps type (.equals) functions to operate on each value of an array\n    function arrayEqualsHandler(callback) {\n      return function handleArray(val1, val2) {\n        var left = arrayWrap(val1), right = arrayWrap(val2);\n        if (left.length !== right.length) return false;\n        for (var i = 0; i < left.length; i++) {\n          if (!callback(left[i], right[i])) return false;\n        }\n        return true;\n      };\n    }\n\n    this.encode = arrayHandler(bindTo(type, 'encode'));\n    this.decode = arrayHandler(bindTo(type, 'decode'));\n    this.is     = arrayHandler(bindTo(type, 'is'), true);\n    this.equals = arrayEqualsHandler(bindTo(type, 'equals'));\n    this.pattern = type.pattern;\n    this.$arrayMode = mode;\n  }\n};\n\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$urlMatcherFactory\n *\n * @description\n * Factory for {@link ui.router.util.type:UrlMatcher `UrlMatcher`} instances. The factory\n * is also available to providers under the name `$urlMatcherFactoryProvider`.\n */\nfunction $UrlMatcherFactory() {\n  $$UMFP = this;\n\n  var isCaseInsensitive = false, isStrictMode = true, defaultSquashPolicy = false;\n\n  function valToString(val) { return val != null ? val.toString().replace(/\\//g, \"%2F\") : val; }\n  function valFromString(val) { return val != null ? val.toString().replace(/%2F/g, \"/\") : val; }\n//  TODO: in 1.0, make string .is() return false if value is undefined by default.\n//  function regexpMatches(val) { /*jshint validthis:true */ return isDefined(val) && this.pattern.test(val); }\n  function regexpMatches(val) { /*jshint validthis:true */ return this.pattern.test(val); }\n\n  var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = {\n    string: {\n      encode: valToString,\n      decode: valFromString,\n      is: regexpMatches,\n      pattern: /[^/]*/\n    },\n    int: {\n      encode: valToString,\n      decode: function(val) { return parseInt(val, 10); },\n      is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; },\n      pattern: /\\d+/\n    },\n    bool: {\n      encode: function(val) { return val ? 1 : 0; },\n      decode: function(val) { return parseInt(val, 10) !== 0; },\n      is: function(val) { return val === true || val === false; },\n      pattern: /0|1/\n    },\n    date: {\n      encode: function (val) {\n        if (!this.is(val))\n          return undefined;\n        return [ val.getFullYear(),\n          ('0' + (val.getMonth() + 1)).slice(-2),\n          ('0' + val.getDate()).slice(-2)\n        ].join(\"-\");\n      },\n      decode: function (val) {\n        if (this.is(val)) return val;\n        var match = this.capture.exec(val);\n        return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n      },\n      is: function(val) { return val instanceof Date && !isNaN(val.valueOf()); },\n      equals: function (a, b) { return this.is(a) && this.is(b) && a.toISOString() === b.toISOString(); },\n      pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n      capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/\n    },\n    json: {\n      encode: angular.toJson,\n      decode: angular.fromJson,\n      is: angular.isObject,\n      equals: angular.equals,\n      pattern: /[^/]*/\n    },\n    any: { // does not encode/decode\n      encode: angular.identity,\n      decode: angular.identity,\n      is: angular.identity,\n      equals: angular.equals,\n      pattern: /.*/\n    }\n  };\n\n  function getDefaultConfig() {\n    return {\n      strict: isStrictMode,\n      caseInsensitive: isCaseInsensitive\n    };\n  }\n\n  function isInjectable(value) {\n    return (isFunction(value) || (isArray(value) && isFunction(value[value.length - 1])));\n  }\n\n  /**\n   * [Internal] Get the default value of a parameter, which may be an injectable function.\n   */\n  $UrlMatcherFactory.$$getDefaultValue = function(config) {\n    if (!isInjectable(config.value)) return config.value;\n    if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n    return injector.invoke(config.value);\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#caseInsensitive\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URL matching should be case sensitive (the default behavior), or not.\n   *\n   * @param {boolean} value `false` to match URL in a case sensitive manner; otherwise `true`;\n   * @returns {boolean} the current value of caseInsensitive\n   */\n  this.caseInsensitive = function(value) {\n    if (isDefined(value))\n      isCaseInsensitive = value;\n    return isCaseInsensitive;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#strictMode\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URLs should match trailing slashes, or not (the default behavior).\n   *\n   * @param {boolean=} value `false` to match trailing slashes in URLs, otherwise `true`.\n   * @returns {boolean} the current value of strictMode\n   */\n  this.strictMode = function(value) {\n    if (isDefined(value))\n      isStrictMode = value;\n    return isStrictMode;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#defaultSquashPolicy\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Sets the default behavior when generating or matching URLs with default parameter values.\n   *\n   * @param {string} value A string that defines the default parameter URL squashing behavior.\n   *    `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL\n   *    `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the\n   *             parameter is surrounded by slashes, squash (remove) one slash from the URL\n   *    any other string, e.g. \"~\": When generating an href with a default parameter value, squash (remove)\n   *             the parameter value from the URL and replace it with this string.\n   */\n  this.defaultSquashPolicy = function(value) {\n    if (!isDefined(value)) return defaultSquashPolicy;\n    if (value !== true && value !== false && !isString(value))\n      throw new Error(\"Invalid squash policy: \" + value + \". Valid policies: false, true, arbitrary-string\");\n    defaultSquashPolicy = value;\n    return value;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#compile\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Creates a {@link ui.router.util.type:UrlMatcher `UrlMatcher`} for the specified pattern.\n   *\n   * @param {string} pattern  The URL pattern.\n   * @param {Object} config  The config object hash.\n   * @returns {UrlMatcher}  The UrlMatcher.\n   */\n  this.compile = function (pattern, config) {\n    return new UrlMatcher(pattern, extend(getDefaultConfig(), config));\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#isMatcher\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Returns true if the specified object is a `UrlMatcher`, or false otherwise.\n   *\n   * @param {Object} object  The object to perform the type check against.\n   * @returns {Boolean}  Returns `true` if the object matches the `UrlMatcher` interface, by\n   *          implementing all the same methods.\n   */\n  this.isMatcher = function (o) {\n    if (!isObject(o)) return false;\n    var result = true;\n\n    forEach(UrlMatcher.prototype, function(val, name) {\n      if (isFunction(val)) {\n        result = result && (isDefined(o[name]) && isFunction(o[name]));\n      }\n    });\n    return result;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#type\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Registers a custom {@link ui.router.util.type:Type `Type`} object that can be used to\n   * generate URLs with typed parameters.\n   *\n   * @param {string} name  The type name.\n   * @param {Object|Function} definition   The type definition. See\n   *        {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   * @param {Object|Function} definitionFn (optional) A function that is injected before the app\n   *        runtime starts.  The result of this function is merged into the existing `definition`.\n   *        See {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   *\n   * @returns {Object}  Returns `$urlMatcherFactoryProvider`.\n   *\n   * @example\n   * This is a simple example of a custom type that encodes and decodes items from an\n   * array, using the array index as the URL-encoded value:\n   *\n   * <pre>\n   * var list = ['John', 'Paul', 'George', 'Ringo'];\n   *\n   * $urlMatcherFactoryProvider.type('listItem', {\n   *   encode: function(item) {\n   *     // Represent the list item in the URL using its corresponding index\n   *     return list.indexOf(item);\n   *   },\n   *   decode: function(item) {\n   *     // Look up the list item by index\n   *     return list[parseInt(item, 10)];\n   *   },\n   *   is: function(item) {\n   *     // Ensure the item is valid by checking to see that it appears\n   *     // in the list\n   *     return list.indexOf(item) > -1;\n   *   }\n   * });\n   *\n   * $stateProvider.state('list', {\n   *   url: \"/list/{item:listItem}\",\n   *   controller: function($scope, $stateParams) {\n   *     console.log($stateParams.item);\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * // Changes URL to '/list/3', logs \"Ringo\" to the console\n   * $state.go('list', { item: \"Ringo\" });\n   * </pre>\n   *\n   * This is a more complex example of a type that relies on dependency injection to\n   * interact with services, and uses the parameter name from the URL to infer how to\n   * handle encoding and decoding parameter values:\n   *\n   * <pre>\n   * // Defines a custom type that gets a value from a service,\n   * // where each service gets different types of values from\n   * // a backend API:\n   * $urlMatcherFactoryProvider.type('dbObject', {}, function(Users, Posts) {\n   *\n   *   // Matches up services to URL parameter names\n   *   var services = {\n   *     user: Users,\n   *     post: Posts\n   *   };\n   *\n   *   return {\n   *     encode: function(object) {\n   *       // Represent the object in the URL using its unique ID\n   *       return object.id;\n   *     },\n   *     decode: function(value, key) {\n   *       // Look up the object by ID, using the parameter\n   *       // name (key) to call the correct service\n   *       return services[key].findById(value);\n   *     },\n   *     is: function(object, key) {\n   *       // Check that object is a valid dbObject\n   *       return angular.isObject(object) && object.id && services[key];\n   *     }\n   *     equals: function(a, b) {\n   *       // Check the equality of decoded objects by comparing\n   *       // their unique IDs\n   *       return a.id === b.id;\n   *     }\n   *   };\n   * });\n   *\n   * // In a config() block, you can then attach URLs with\n   * // type-annotated parameters:\n   * $stateProvider.state('users', {\n   *   url: \"/users\",\n   *   // ...\n   * }).state('users.item', {\n   *   url: \"/{user:dbObject}\",\n   *   controller: function($scope, $stateParams) {\n   *     // $stateParams.user will now be an object returned from\n   *     // the Users service\n   *   },\n   *   // ...\n   * });\n   * </pre>\n   */\n  this.type = function (name, definition, definitionFn) {\n    if (!isDefined(definition)) return $types[name];\n    if ($types.hasOwnProperty(name)) throw new Error(\"A type named '\" + name + \"' has already been defined.\");\n\n    $types[name] = new Type(extend({ name: name }, definition));\n    if (definitionFn) {\n      typeQueue.push({ name: name, def: definitionFn });\n      if (!enqueue) flushTypeQueue();\n    }\n    return this;\n  };\n\n  // `flushTypeQueue()` waits until `$urlMatcherFactory` is injected before invoking the queued `definitionFn`s\n  function flushTypeQueue() {\n    while(typeQueue.length) {\n      var type = typeQueue.shift();\n      if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n      angular.extend($types[type.name], injector.invoke(type.def));\n    }\n  }\n\n  // Register default types. Store them in the prototype of $types.\n  forEach(defaultTypes, function(type, name) { $types[name] = new Type(extend({name: name}, type)); });\n  $types = inherit($types, {});\n\n  /* No need to document $get, since it returns this */\n  this.$get = ['$injector', function ($injector) {\n    injector = $injector;\n    enqueue = false;\n    flushTypeQueue();\n\n    forEach(defaultTypes, function(type, name) {\n      if (!$types[name]) $types[name] = new Type(type);\n    });\n    return this;\n  }];\n\n  this.Param = function Param(id, type, config, location) {\n    var self = this;\n    config = unwrapShorthand(config);\n    type = getType(config, type, location);\n    var arrayMode = getArrayMode();\n    type = arrayMode ? type.$asArray(arrayMode, location === \"search\") : type;\n    if (type.name === \"string\" && !arrayMode && location === \"path\" && config.value === undefined)\n      config.value = \"\"; // for 0.2.x; in 0.3.0+ do not automatically default to \"\"\n    var isOptional = config.value !== undefined;\n    var squash = getSquashPolicy(config, isOptional);\n    var replace = getReplace(config, arrayMode, isOptional, squash);\n\n    function unwrapShorthand(config) {\n      var keys = isObject(config) ? objectKeys(config) : [];\n      var isShorthand = indexOf(keys, \"value\") === -1 && indexOf(keys, \"type\") === -1 &&\n                        indexOf(keys, \"squash\") === -1 && indexOf(keys, \"array\") === -1;\n      if (isShorthand) config = { value: config };\n      config.$$fn = isInjectable(config.value) ? config.value : function () { return config.value; };\n      return config;\n    }\n\n    function getType(config, urlType, location) {\n      if (config.type && urlType) throw new Error(\"Param '\"+id+\"' has two type configurations.\");\n      if (urlType) return urlType;\n      if (!config.type) return (location === \"config\" ? $types.any : $types.string);\n      return config.type instanceof Type ? config.type : new Type(config.type);\n    }\n\n    // array config: param name (param[]) overrides default settings.  explicit config overrides param name.\n    function getArrayMode() {\n      var arrayDefaults = { array: (location === \"search\" ? \"auto\" : false) };\n      var arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n      return extend(arrayDefaults, arrayParamNomenclature, config).array;\n    }\n\n    /**\n     * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n     */\n    function getSquashPolicy(config, isOptional) {\n      var squash = config.squash;\n      if (!isOptional || squash === false) return false;\n      if (!isDefined(squash) || squash == null) return defaultSquashPolicy;\n      if (squash === true || isString(squash)) return squash;\n      throw new Error(\"Invalid squash policy: '\" + squash + \"'. Valid policies: false, true, or arbitrary string\");\n    }\n\n    function getReplace(config, arrayMode, isOptional, squash) {\n      var replace, configuredKeys, defaultPolicy = [\n        { from: \"\",   to: (isOptional || arrayMode ? undefined : \"\") },\n        { from: null, to: (isOptional || arrayMode ? undefined : \"\") }\n      ];\n      replace = isArray(config.replace) ? config.replace : [];\n      if (isString(squash))\n        replace.push({ from: squash, to: undefined });\n      configuredKeys = map(replace, function(item) { return item.from; } );\n      return filter(defaultPolicy, function(item) { return indexOf(configuredKeys, item.from) === -1; }).concat(replace);\n    }\n\n    /**\n     * [Internal] Get the default value of a parameter, which may be an injectable function.\n     */\n    function $$getDefaultValue() {\n      if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n      return injector.invoke(config.$$fn);\n    }\n\n    /**\n     * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n     * default value, which may be the result of an injectable function.\n     */\n    function $value(value) {\n      function hasReplaceVal(val) { return function(obj) { return obj.from === val; }; }\n      function $replace(value) {\n        var replacement = map(filter(self.replace, hasReplaceVal(value)), function(obj) { return obj.to; });\n        return replacement.length ? replacement[0] : value;\n      }\n      value = $replace(value);\n      return isDefined(value) ? self.type.decode(value) : $$getDefaultValue();\n    }\n\n    function toString() { return \"{Param:\" + id + \" \" + type + \" squash: '\" + squash + \"' optional: \" + isOptional + \"}\"; }\n\n    extend(this, {\n      id: id,\n      type: type,\n      location: location,\n      array: arrayMode,\n      squash: squash,\n      replace: replace,\n      isOptional: isOptional,\n      value: $value,\n      dynamic: undefined,\n      config: config,\n      toString: toString\n    });\n  };\n\n  function ParamSet(params) {\n    extend(this, params || {});\n  }\n\n  ParamSet.prototype = {\n    $$new: function() {\n      return inherit(this, extend(new ParamSet(), { $$parent: this}));\n    },\n    $$keys: function () {\n      var keys = [], chain = [], parent = this,\n        ignore = objectKeys(ParamSet.prototype);\n      while (parent) { chain.push(parent); parent = parent.$$parent; }\n      chain.reverse();\n      forEach(chain, function(paramset) {\n        forEach(objectKeys(paramset), function(key) {\n            if (indexOf(keys, key) === -1 && indexOf(ignore, key) === -1) keys.push(key);\n        });\n      });\n      return keys;\n    },\n    $$values: function(paramValues) {\n      var values = {}, self = this;\n      forEach(self.$$keys(), function(key) {\n        values[key] = self[key].value(paramValues && paramValues[key]);\n      });\n      return values;\n    },\n    $$equals: function(paramValues1, paramValues2) {\n      var equal = true, self = this;\n      forEach(self.$$keys(), function(key) {\n        var left = paramValues1 && paramValues1[key], right = paramValues2 && paramValues2[key];\n        if (!self[key].type.equals(left, right)) equal = false;\n      });\n      return equal;\n    },\n    $$validates: function $$validate(paramValues) {\n      var result = true, isOptional, val, param, self = this;\n\n      forEach(this.$$keys(), function(key) {\n        param = self[key];\n        val = paramValues[key];\n        isOptional = !val && param.isOptional;\n        result = result && (isOptional || !!param.type.is(val));\n      });\n      return result;\n    },\n    $$parent: undefined\n  };\n\n  this.ParamSet = ParamSet;\n}\n\n// Register as a provider so it's available to other providers\nangular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);\nangular.module('ui.router.util').run(['$urlMatcherFactory', function($urlMatcherFactory) { }]);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/urlRouter.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.router.$urlRouterProvider\n *\n * @requires ui.router.util.$urlMatcherFactoryProvider\n * @requires $locationProvider\n *\n * @description\n * `$urlRouterProvider` has the responsibility of watching `$location`. \n * When `$location` changes it runs through a list of rules one by one until a \n * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify \n * a url in a state configuration. All urls are compiled into a UrlMatcher object.\n *\n * There are several methods on `$urlRouterProvider` that make it useful to use directly\n * in your module config.\n */\n$UrlRouterProvider.$inject = ['$locationProvider', '$urlMatcherFactoryProvider'];\nfunction $UrlRouterProvider(   $locationProvider,   $urlMatcherFactory) {\n  var rules = [], otherwise = null, interceptDeferred = false, listener;\n\n  // Returns a string that is a prefix of all strings matching the RegExp\n  function regExpPrefix(re) {\n    var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n    return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n  }\n\n  // Interpolates matched values into a String.replace()-style pattern\n  function interpolate(pattern, match) {\n    return pattern.replace(/\\$(\\$|\\d{1,2})/, function (m, what) {\n      return match[what === '$' ? 0 : Number(what)];\n    });\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#rule\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines rules that are used by `$urlRouterProvider` to find matches for\n   * specific URLs.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {object} rule Handler function that takes `$injector` and `$location`\n   * services as arguments. You can use them to return a valid path as a string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.rule = function (rule) {\n    if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    rules.push(rule);\n    return this;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouterProvider#otherwise\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines a path that is used when an invalid route is requested.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     return '/a/valid/url';\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} rule The url path you want to redirect to or a function \n   * rule that returns the url path. The function version is passed two params: \n   * `$injector` and `$location` services, and must return a url string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.otherwise = function (rule) {\n    if (isString(rule)) {\n      var redirect = rule;\n      rule = function () { return redirect; };\n    }\n    else if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    otherwise = rule;\n    return this;\n  };\n\n\n  function handleIfMatch($injector, handler, match) {\n    if (!match) return false;\n    var result = $injector.invoke(handler, handler, { $match: match });\n    return isDefined(result) ? result : true;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#when\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Registers a handler for a given url matching. if handle is a string, it is\n   * treated as a redirect, and is interpolated according to the syntax of match\n   * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n   *\n   * If the handler is a function, it is injectable. It gets invoked if `$location`\n   * matches. You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when = function (what, handler) {\n    var redirect, handlerIsString = isString(handler);\n    if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n    if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n      throw new Error(\"invalid 'handler' in when()\");\n\n    var strategies = {\n      matcher: function (what, handler) {\n        if (handlerIsString) {\n          redirect = $urlMatcherFactory.compile(handler);\n          handler = ['$match', function ($match) { return redirect.format($match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n        }, {\n          prefix: isString(what.prefix) ? what.prefix : ''\n        });\n      },\n      regex: function (what, handler) {\n        if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n        if (handlerIsString) {\n          redirect = handler;\n          handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path()));\n        }, {\n          prefix: regExpPrefix(what)\n        });\n      }\n    };\n\n    var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n    for (var n in check) {\n      if (check[n]) return this.rule(strategies[n](what, handler));\n    }\n\n    throw new Error(\"invalid 'what' in when()\");\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#deferIntercept\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Disables (or enables) deferring location change interception.\n   *\n   * If you wish to customize the behavior of syncing the URL (for example, if you wish to\n   * defer a transition but maintain the current URL), call this method at configuration time.\n   * Then, at run time, call `$urlRouter.listen()` after you have configured your own\n   * `$locationChangeSuccess` event handler.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *\n   *   // Prevent $urlRouter from automatically intercepting URL changes;\n   *   // this allows you to configure custom behavior in between\n   *   // location changes and route synchronization:\n   *   $urlRouterProvider.deferIntercept();\n   *\n   * }).run(function ($rootScope, $urlRouter, UserService) {\n   *\n   *   $rootScope.$on('$locationChangeSuccess', function(e) {\n   *     // UserService is an example service for managing user state\n   *     if (UserService.isLoggedIn()) return;\n   *\n   *     // Prevent $urlRouter's default handler from firing\n   *     e.preventDefault();\n   *\n   *     UserService.handleLogin().then(function() {\n   *       // Once the user has logged in, sync the current URL\n   *       // to the router:\n   *       $urlRouter.sync();\n   *     });\n   *   });\n   *\n   *   // Configures $urlRouter's listener *after* your custom listener\n   *   $urlRouter.listen();\n   * });\n   * </pre>\n   *\n   * @param {boolean} defer Indicates whether to defer location change interception. Passing\n            no parameter is equivalent to `true`.\n   */\n  this.deferIntercept = function (defer) {\n    if (defer === undefined) defer = true;\n    interceptDeferred = defer;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouter\n   *\n   * @requires $location\n   * @requires $rootScope\n   * @requires $injector\n   * @requires $browser\n   *\n   * @description\n   *\n   */\n  this.$get = $get;\n  $get.$inject = ['$location', '$rootScope', '$injector', '$browser'];\n  function $get(   $location,   $rootScope,   $injector,   $browser) {\n\n    var baseHref = $browser.baseHref(), location = $location.url(), lastPushedUrl;\n\n    function appendBasePath(url, isHtml5, absolute) {\n      if (baseHref === '/') return url;\n      if (isHtml5) return baseHref.slice(0, -1) + url;\n      if (absolute) return baseHref.slice(1) + url;\n      return url;\n    }\n\n    // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree\n    function update(evt) {\n      if (evt && evt.defaultPrevented) return;\n      var ignoreUpdate = lastPushedUrl && $location.url() === lastPushedUrl;\n      lastPushedUrl = undefined;\n      if (ignoreUpdate) return true;\n\n      function check(rule) {\n        var handled = rule($injector, $location);\n\n        if (!handled) return false;\n        if (isString(handled)) $location.replace().url(handled);\n        return true;\n      }\n      var n = rules.length, i;\n\n      for (i = 0; i < n; i++) {\n        if (check(rules[i])) return;\n      }\n      // always check otherwise last to allow dynamic updates to the set of rules\n      if (otherwise) check(otherwise);\n    }\n\n    function listen() {\n      listener = listener || $rootScope.$on('$locationChangeSuccess', update);\n      return listener;\n    }\n\n    if (!interceptDeferred) listen();\n\n    return {\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#sync\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.\n       * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event,\n       * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed\n       * with the transition by calling `$urlRouter.sync()`.\n       *\n       * @example\n       * <pre>\n       * angular.module('app', ['ui.router'])\n       *   .run(function($rootScope, $urlRouter) {\n       *     $rootScope.$on('$locationChangeSuccess', function(evt) {\n       *       // Halt state change from even starting\n       *       evt.preventDefault();\n       *       // Perform custom logic\n       *       var meetsRequirement = ...\n       *       // Continue with the update and state transition if logic allows\n       *       if (meetsRequirement) $urlRouter.sync();\n       *     });\n       * });\n       * </pre>\n       */\n      sync: function() {\n        update();\n      },\n\n      listen: function() {\n        return listen();\n      },\n\n      update: function(read) {\n        if (read) {\n          location = $location.url();\n          return;\n        }\n        if ($location.url() === location) return;\n\n        $location.url(location);\n        $location.replace();\n      },\n\n      push: function(urlMatcher, params, options) {\n        $location.url(urlMatcher.format(params || {}));\n        lastPushedUrl = options && options.$$avoidResync ? $location.url() : undefined;\n        if (options && options.replace) $location.replace();\n      },\n\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#href\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * A URL generation method that returns the compiled URL for a given\n       * {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters.\n       *\n       * @example\n       * <pre>\n       * $bob = $urlRouter.href(new UrlMatcher(\"/about/:person\"), {\n       *   person: \"bob\"\n       * });\n       * // $bob == \"/about/bob\";\n       * </pre>\n       *\n       * @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate.\n       * @param {object=} params An object of parameter values to fill the matcher's required parameters.\n       * @param {object=} options Options object. The options are:\n       *\n       * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n       *\n       * @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n       */\n      href: function(urlMatcher, params, options) {\n        if (!urlMatcher.validates(params)) return null;\n\n        var isHtml5 = $locationProvider.html5Mode();\n        if (angular.isObject(isHtml5)) {\n          isHtml5 = isHtml5.enabled;\n        }\n        \n        var url = urlMatcher.format(params);\n        options = options || {};\n\n        if (!isHtml5 && url !== null) {\n          url = \"#\" + $locationProvider.hashPrefix() + url;\n        }\n        url = appendBasePath(url, isHtml5, options.absolute);\n\n        if (!options.absolute || !url) {\n          return url;\n        }\n\n        var slash = (!isHtml5 && url ? '/' : ''), port = $location.port();\n        port = (port === 80 || port === 443 ? '' : ':' + port);\n\n        return [$location.protocol(), '://', $location.host(), port, slash, url].join('');\n      }\n    };\n  }\n}\n\nangular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/view.js",
    "content": "\n$ViewProvider.$inject = [];\nfunction $ViewProvider() {\n\n  this.$get = $get;\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$view\n   *\n   * @requires ui.router.util.$templateFactory\n   * @requires $rootScope\n   *\n   * @description\n   *\n   */\n  $get.$inject = ['$rootScope', '$templateFactory'];\n  function $get(   $rootScope,   $templateFactory) {\n    return {\n      // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })\n      /**\n       * @ngdoc function\n       * @name ui.router.state.$view#load\n       * @methodOf ui.router.state.$view\n       *\n       * @description\n       *\n       * @param {string} name name\n       * @param {object} options option object.\n       */\n      load: function load(name, options) {\n        var result, defaults = {\n          template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}\n        };\n        options = extend(defaults, options);\n\n        if (options.view) {\n          result = $templateFactory.fromConfig(options.view, options.params, options.locals);\n        }\n        if (result && options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$viewContentLoading\n         * @eventOf ui.router.state.$view\n         * @eventType broadcast on root scope\n         * @description\n         *\n         * Fired once the view **begins loading**, *before* the DOM is rendered.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} viewConfig The view config properties (template, controller, etc).\n         *\n         * @example\n         *\n         * <pre>\n         * $scope.$on('$viewContentLoading',\n         * function(event, viewConfig){\n         *     // Access to all the view config properties.\n         *     // and one special property 'targetView'\n         *     // viewConfig.targetView\n         * });\n         * </pre>\n         */\n          $rootScope.$broadcast('$viewContentLoading', options);\n        }\n        return result;\n      }\n    };\n  }\n}\n\nangular.module('ui.router.state').provider('$view', $ViewProvider);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/viewDirective.js",
    "content": "/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-view\n *\n * @requires ui.router.state.$state\n * @requires $compile\n * @requires $controller\n * @requires $injector\n * @requires ui.router.state.$uiViewScroll\n * @requires $document\n *\n * @restrict ECA\n *\n * @description\n * The ui-view directive tells $state where to place your templates.\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states.\n *\n * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window\n * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll\n * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you\n * scroll ui-view elements into view when they are populated during a state activation.\n *\n * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*\n *\n * @param {string=} onload Expression to evaluate whenever the view updates.\n * \n * @example\n * A view can be unnamed or named. \n * <pre>\n * <!-- Unnamed -->\n * <div ui-view></div> \n * \n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n * </pre>\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a \n * single view and it is unnamed then you can populate it like so:\n * <pre>\n * <div ui-view></div> \n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * </pre>\n * \n * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}\n * config property, by name, in this case an empty name:\n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * But typically you'll only use the views property if you name your view or have more than one view \n * in the same template. There's not really a compelling reason to name a view if its the only one, \n * but you could if you wanted, like so:\n * <pre>\n * <div ui-view=\"main\"></div>\n * </pre> \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * Really though, you'll use views to set up multiple views:\n * <pre>\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div> \n * <div ui-view=\"data\"></div> \n * </pre>\n * \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }    \n * })\n * </pre>\n *\n * Examples for `autoscroll`:\n *\n * <pre>\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * </pre>\n */\n$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate'];\nfunction $ViewDirective(   $state,   $injector,   $uiViewScroll,   $interpolate) {\n\n  function getService() {\n    return ($injector.has) ? function(service) {\n      return $injector.has(service) ? $injector.get(service) : null;\n    } : function(service) {\n      try {\n        return $injector.get(service);\n      } catch (e) {\n        return null;\n      }\n    };\n  }\n\n  var service = getService(),\n      $animator = service('$animator'),\n      $animate = service('$animate');\n\n  // Returns a set of DOM manipulation functions based on which Angular version\n  // it should use\n  function getRenderer(attrs, scope) {\n    var statics = function() {\n      return {\n        enter: function (element, target, cb) { target.after(element); cb(); },\n        leave: function (element, cb) { element.remove(); cb(); }\n      };\n    };\n\n    if ($animate) {\n      return {\n        enter: function(element, target, cb) {\n          var promise = $animate.enter(element, null, target, cb);\n          if (promise && promise.then) promise.then(cb);\n        },\n        leave: function(element, cb) {\n          var promise = $animate.leave(element, cb);\n          if (promise && promise.then) promise.then(cb);\n        }\n      };\n    }\n\n    if ($animator) {\n      var animate = $animator && $animator(scope, attrs);\n\n      return {\n        enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },\n        leave: function(element, cb) { animate.leave(element); cb(); }\n      };\n    }\n\n    return statics();\n  }\n\n  var directive = {\n    restrict: 'ECA',\n    terminal: true,\n    priority: 400,\n    transclude: 'element',\n    compile: function (tElement, tAttrs, $transclude) {\n      return function (scope, $element, attrs) {\n        var previousEl, currentEl, currentScope, latestLocals,\n            onloadExp     = attrs.onload || '',\n            autoScrollExp = attrs.autoscroll,\n            renderer      = getRenderer(attrs, scope);\n\n        scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        updateView(true);\n\n        function cleanupLastView() {\n          if (previousEl) {\n            previousEl.remove();\n            previousEl = null;\n          }\n\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n\n          if (currentEl) {\n            renderer.leave(currentEl, function() {\n              previousEl = null;\n            });\n\n            previousEl = currentEl;\n            currentEl = null;\n          }\n        }\n\n        function updateView(firstTime) {\n          var newScope,\n              name            = getUiViewName(scope, attrs, $element, $interpolate),\n              previousLocals  = name && $state.$current && $state.$current.locals[name];\n\n          if (!firstTime && previousLocals === latestLocals) return; // nothing to do\n          newScope = scope.$new();\n          latestLocals = $state.$current.locals[name];\n\n          var clone = $transclude(newScope, function(clone) {\n            renderer.enter(clone, $element, function onUiViewEnter() {\n              if(currentScope) {\n                currentScope.$emit('$viewContentAnimationEnded');\n              }\n\n              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n                $uiViewScroll(clone);\n              }\n            });\n            cleanupLastView();\n          });\n\n          currentEl = clone;\n          currentScope = newScope;\n          /**\n           * @ngdoc event\n           * @name ui.router.state.directive:ui-view#$viewContentLoaded\n           * @eventOf ui.router.state.directive:ui-view\n           * @eventType emits on ui-view directive scope\n           * @description           *\n           * Fired once the view is **loaded**, *after* the DOM is rendered.\n           *\n           * @param {Object} event Event object.\n           */\n          currentScope.$emit('$viewContentLoaded');\n          currentScope.$eval(onloadExp);\n        }\n      };\n    }\n  };\n\n  return directive;\n}\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state', '$interpolate'];\nfunction $ViewDirectiveFill (  $compile,   $controller,   $state,   $interpolate) {\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function (tElement) {\n      var initial = tElement.html();\n      return function (scope, $element, attrs) {\n        var current = $state.$current,\n            name = getUiViewName(scope, attrs, $element, $interpolate),\n            locals  = current && current.locals[name];\n\n        if (! locals) {\n          return;\n        }\n\n        $element.data('$uiView', { name: name, state: locals.$$state });\n        $element.html(locals.$template ? locals.$template : initial);\n\n        var link = $compile($element.contents());\n\n        if (locals.$$controller) {\n          locals.$scope = scope;\n          var controller = $controller(locals.$$controller, locals);\n          if (locals.$$controllerAs) {\n            scope[locals.$$controllerAs] = controller;\n          }\n          $element.data('$ngControllerController', controller);\n          $element.children().data('$ngControllerController', controller);\n        }\n\n        link(scope);\n      };\n    }\n  };\n}\n\n/**\n * Shared ui-view code for both directives:\n * Given scope, element, and its attributes, return the view's name\n */\nfunction getUiViewName(scope, attrs, element, $interpolate) {\n  var name = $interpolate(attrs.uiView || attrs.name || '')(scope);\n  var inherited = element.inheritedData('$uiView');\n  return name.indexOf('@') >= 0 ?  name :  (name + '@' + (inherited ? inherited.state.name : ''));\n}\n\nangular.module('ui.router.state').directive('uiView', $ViewDirective);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/angular-ui-router/src/viewScroll.js",
    "content": "/**\n * @ngdoc object\n * @name ui.router.state.$uiViewScrollProvider\n *\n * @description\n * Provider that returns the {@link ui.router.state.$uiViewScroll} service function.\n */\nfunction $ViewScrollProvider() {\n\n  var useAnchorScroll = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll\n   * @methodOf ui.router.state.$uiViewScrollProvider\n   *\n   * @description\n   * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for\n   * scrolling based on the url anchor.\n   */\n  this.useAnchorScroll = function () {\n    useAnchorScroll = true;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$uiViewScroll\n   *\n   * @requires $anchorScroll\n   * @requires $timeout\n   *\n   * @description\n   * When called with a jqLite element, it scrolls the element into view (after a\n   * `$timeout` so the DOM has time to refresh).\n   *\n   * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n   * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.\n   */\n  this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {\n    if (useAnchorScroll) {\n      return $anchorScroll;\n    }\n\n    return function ($element) {\n      $timeout(function () {\n        $element[0].scrollIntoView();\n      }, 0, false);\n    };\n  }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/babel-polyfill/.bower.json",
    "content": "{\n  \"name\": \"babel-polyfill\",\n  \"version\": \"0.0.1\",\n  \"homepage\": \"https://github.com/nicksrandall/babel-polyfill\",\n  \"authors\": [\n    \"Nick Randall <nick.randall@domo.com>\"\n  ],\n  \"description\": \"A stand alone browser polyfill for babel\",\n  \"main\": \"browser-polyfill.js\",\n  \"keywords\": [\n    \"babel\",\n    \"polyfill\"\n  ],\n  \"license\": \"MIT\",\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"test\",\n    \"tests\"\n  ],\n  \"_release\": \"0.0.1\",\n  \"_resolution\": {\n    \"type\": \"version\",\n    \"tag\": \"v0.0.1\",\n    \"commit\": \"cc7578292b8fac19919c46d8d82982a9418c8c19\"\n  },\n  \"_source\": \"https://github.com/nicksrandall/babel-polyfill.git\",\n  \"_target\": \"~0.0.1\",\n  \"_originalSource\": \"babel-polyfill\",\n  \"_direct\": true\n}"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/babel-polyfill/README.md",
    "content": ""
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/babel-polyfill/bower.json",
    "content": "{\n  \"name\": \"babel-polyfill\",\n  \"version\": \"0.0.1\",\n  \"homepage\": \"https://github.com/nicksrandall/babel-polyfill\",\n  \"authors\": [\n    \"Nick Randall <nick.randall@domo.com>\"\n  ],\n  \"description\": \"A stand alone browser polyfill for babel\",\n  \"main\": \"browser-polyfill.js\",\n  \"keywords\": [\n    \"babel\",\n    \"polyfill\"\n  ],\n  \"license\": \"MIT\",\n  \"ignore\": [\n    \"**/.*\",\n    \"node_modules\",\n    \"bower_components\",\n    \"test\",\n    \"tests\"\n  ]\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/babel-polyfill/browser-polyfill.js",
    "content": "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(global){\"use strict\";if(global._babelPolyfill){throw new Error(\"only one instance of babel/polyfill is allowed\")}global._babelPolyfill=true;require(\"core-js/shim\");require(\"regenerator/runtime\")}).call(this,typeof global!==\"undefined\"?global:typeof self!==\"undefined\"?self:typeof window!==\"undefined\"?window:{})},{\"core-js/shim\":72,\"regenerator/runtime\":73}],2:[function(require,module,exports){\"use strict\";var $=require(\"./$\");module.exports=function(IS_INCLUDES){return function(el){var O=$.toObject(this),length=$.toLength(O.length),index=$.toIndex(arguments[1],length),value;if(IS_INCLUDES&&el!=el)while(length>index){value=O[index++];if(value!=value)return true}else for(;length>index;index++)if(IS_INCLUDES||index in O){if(O[index]===el)return IS_INCLUDES||index}return!IS_INCLUDES&&-1}}},{\"./$\":16}],3:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),ctx=require(\"./$.ctx\");module.exports=function(TYPE){var IS_MAP=TYPE==1,IS_FILTER=TYPE==2,IS_SOME=TYPE==3,IS_EVERY=TYPE==4,IS_FIND_INDEX=TYPE==6,NO_HOLES=TYPE==5||IS_FIND_INDEX;return function(callbackfn){var O=Object($.assertDefined(this)),self=$.ES5Object(O),f=ctx(callbackfn,arguments[1],3),length=$.toLength(self.length),index=0,result=IS_MAP?Array(length):IS_FILTER?[]:undefined,val,res;for(;length>index;index++)if(NO_HOLES||index in self){val=self[index];res=f(val,index,O);if(TYPE){if(IS_MAP)result[index]=res;else if(res)switch(TYPE){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(IS_EVERY)return false}}return IS_FIND_INDEX?-1:IS_SOME||IS_EVERY?IS_EVERY:result}}},{\"./$\":16,\"./$.ctx\":10}],4:[function(require,module,exports){var $=require(\"./$\");function assert(condition,msg1,msg2){if(!condition)throw TypeError(msg2?msg1+msg2:msg1)}assert.def=$.assertDefined;assert.fn=function(it){if(!$.isFunction(it))throw TypeError(it+\" is not a function!\");return it};assert.obj=function(it){if(!$.isObject(it))throw TypeError(it+\" is not an object!\");return it};assert.inst=function(it,Constructor,name){if(!(it instanceof Constructor))throw TypeError(name+\": use the 'new' operator!\");return it};module.exports=assert},{\"./$\":16}],5:[function(require,module,exports){var $=require(\"./$\");module.exports=Object.assign||function assign(target,source){var T=Object($.assertDefined(target)),l=arguments.length,i=1;while(l>i){var S=$.ES5Object(arguments[i++]),keys=$.getKeys(S),length=keys.length,j=0,key;while(length>j)T[key=keys[j++]]=S[key]}return T}},{\"./$\":16}],6:[function(require,module,exports){var $=require(\"./$\"),TAG=require(\"./$.wks\")(\"toStringTag\"),toString={}.toString;function cof(it){return toString.call(it).slice(8,-1)}cof.classof=function(it){var O,T;return it==undefined?it===undefined?\"Undefined\":\"Null\":typeof(T=(O=Object(it))[TAG])==\"string\"?T:cof(O)};cof.set=function(it,tag,stat){if(it&&!$.has(it=stat?it:it.prototype,TAG))$.hide(it,TAG,tag)};module.exports=cof},{\"./$\":16,\"./$.wks\":27}],7:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),ctx=require(\"./$.ctx\"),safe=require(\"./$.uid\").safe,assert=require(\"./$.assert\"),$iter=require(\"./$.iter\"),has=$.has,set=$.set,isObject=$.isObject,hide=$.hide,step=$iter.step,isFrozen=Object.isFrozen||$.core.Object.isFrozen,ID=safe(\"id\"),O1=safe(\"O1\"),LAST=safe(\"last\"),FIRST=safe(\"first\"),ITER=safe(\"iter\"),SIZE=$.DESC?safe(\"size\"):\"size\",id=0;function fastKey(it,create){if(!isObject(it))return(typeof it==\"string\"?\"S\":\"P\")+it;if(isFrozen(it))return\"F\";if(!has(it,ID)){if(!create)return\"E\";hide(it,ID,++id)}return\"O\"+it[ID]}function getEntry(that,key){var index=fastKey(key),entry;if(index!=\"F\")return that[O1][index];for(entry=that[FIRST];entry;entry=entry.n){if(entry.k==key)return entry}}module.exports={getConstructor:function(NAME,IS_MAP,ADDER){function C(iterable){var that=assert.inst(this,C,NAME);set(that,O1,$.create(null));set(that,SIZE,0);set(that,LAST,undefined);set(that,FIRST,undefined);if(iterable!=undefined)$iter.forOf(iterable,IS_MAP,that[ADDER],that)}$.mix(C.prototype,{clear:function clear(){for(var that=this,data=that[O1],entry=that[FIRST];entry;entry=entry.n){entry.r=true;if(entry.p)entry.p=entry.p.n=undefined;delete data[entry.i]}that[FIRST]=that[LAST]=undefined;that[SIZE]=0},\"delete\":function(key){var that=this,entry=getEntry(that,key);if(entry){var next=entry.n,prev=entry.p;delete that[O1][entry.i];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that[FIRST]==entry)that[FIRST]=next;if(that[LAST]==entry)that[LAST]=prev;that[SIZE]--}return!!entry},forEach:function forEach(callbackfn){var f=ctx(callbackfn,arguments[1],3),entry;while(entry=entry?entry.n:this[FIRST]){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function has(key){return!!getEntry(this,key)}});if($.DESC)$.setDesc(C.prototype,\"size\",{get:function(){return assert.def(this[SIZE])}});return C},def:function(that,key,value){var entry=getEntry(that,key),prev,index;if(entry){entry.v=value}else{that[LAST]=entry={i:index=fastKey(key,true),k:key,v:value,p:prev=that[LAST],n:undefined,r:false};if(!that[FIRST])that[FIRST]=entry;if(prev)prev.n=entry;that[SIZE]++;if(index!=\"F\")that[O1][index]=entry}return that},getEntry:getEntry,getIterConstructor:function(){return function(iterated,kind){set(this,ITER,{o:iterated,k:kind})}},next:function(){var iter=this[ITER],kind=iter.k,entry=iter.l;while(entry&&entry.r)entry=entry.p;if(!iter.o||!(iter.l=entry=entry?entry.n:iter.o[FIRST])){iter.o=undefined;return step(1)}if(kind==\"key\")return step(0,entry.k);if(kind==\"value\")return step(0,entry.v);return step(0,[entry.k,entry.v])}}},{\"./$\":16,\"./$.assert\":4,\"./$.ctx\":10,\"./$.iter\":15,\"./$.uid\":25}],8:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),safe=require(\"./$.uid\").safe,assert=require(\"./$.assert\"),forOf=require(\"./$.iter\").forOf,_has=$.has,isObject=$.isObject,hide=$.hide,isFrozen=Object.isFrozen||$.core.Object.isFrozen,id=0,ID=safe(\"id\"),WEAK=safe(\"weak\"),LEAK=safe(\"leak\"),method=require(\"./$.array-methods\"),find=method(5),findIndex=method(6);function findFrozen(store,key){return find.call(store.array,function(it){return it[0]===key})}function leakStore(that){return that[LEAK]||hide(that,LEAK,{array:[],get:function(key){var entry=findFrozen(this,key);if(entry)return entry[1]},has:function(key){return!!findFrozen(this,key)},set:function(key,value){var entry=findFrozen(this,key);if(entry)entry[1]=value;else this.array.push([key,value])},\"delete\":function(key){var index=findIndex.call(this.array,function(it){return it[0]===key});if(~index)this.array.splice(index,1);return!!~index}})[LEAK]}module.exports={getConstructor:function(NAME,IS_MAP,ADDER){function C(iterable){$.set(assert.inst(this,C,NAME),ID,id++);if(iterable!=undefined)forOf(iterable,IS_MAP,this[ADDER],this)}$.mix(C.prototype,{\"delete\":function(key){if(!isObject(key))return false;if(isFrozen(key))return leakStore(this)[\"delete\"](key);return _has(key,WEAK)&&_has(key[WEAK],this[ID])&&delete key[WEAK][this[ID]]},has:function has(key){if(!isObject(key))return false;if(isFrozen(key))return leakStore(this).has(key);return _has(key,WEAK)&&_has(key[WEAK],this[ID])}});return C},def:function(that,key,value){if(isFrozen(assert.obj(key))){leakStore(that).set(key,value)}else{_has(key,WEAK)||hide(key,WEAK,{});key[WEAK][that[ID]]=value}return that},leakStore:leakStore,WEAK:WEAK,ID:ID}},{\"./$\":16,\"./$.array-methods\":3,\"./$.assert\":4,\"./$.iter\":15,\"./$.uid\":25}],9:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),$def=require(\"./$.def\"),$iter=require(\"./$.iter\"),assertInstance=require(\"./$.assert\").inst;module.exports=function(NAME,methods,common,IS_MAP,isWeak){var Base=$.g[NAME],C=Base,ADDER=IS_MAP?\"set\":\"add\",proto=C&&C.prototype,O={};function fixMethod(KEY,CHAIN){var method=proto[KEY];if($.FW)proto[KEY]=function(a,b){var result=method.call(this,a===0?0:a,b);return CHAIN?this:result}}if(!$.isFunction(C)||!(isWeak||!$iter.BUGGY&&proto.forEach&&proto.entries)){C=common.getConstructor(NAME,IS_MAP,ADDER);$.mix(C.prototype,methods)}else{var inst=new C,chain=inst[ADDER](isWeak?{}:-0,1),buggyZero;if(!require(\"./$.iter-detect\")(function(iter){new C(iter)})){C=function(iterable){assertInstance(this,C,NAME);var that=new Base;if(iterable!=undefined)$iter.forOf(iterable,IS_MAP,that[ADDER],that);return that};C.prototype=proto;if($.FW)proto.constructor=C}isWeak||inst.forEach(function(val,key){buggyZero=1/key===-Infinity});if(buggyZero){fixMethod(\"delete\");fixMethod(\"has\");IS_MAP&&fixMethod(\"get\")}if(buggyZero||chain!==inst)fixMethod(ADDER,true)}require(\"./$.cof\").set(C,NAME);require(\"./$.species\")(C);O[NAME]=C;$def($def.G+$def.W+$def.F*(C!=Base),O);if(!isWeak)$iter.std(C,NAME,common.getIterConstructor(),common.next,IS_MAP?\"key+value\":\"value\",!IS_MAP,true);return C}},{\"./$\":16,\"./$.assert\":4,\"./$.cof\":6,\"./$.def\":11,\"./$.iter\":15,\"./$.iter-detect\":14,\"./$.species\":22}],10:[function(require,module,exports){var assertFunction=require(\"./$.assert\").fn;module.exports=function(fn,that,length){assertFunction(fn);if(~length&&that===undefined)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}},{\"./$.assert\":4}],11:[function(require,module,exports){var $=require(\"./$\"),global=$.g,core=$.core,isFunction=$.isFunction;function ctx(fn,that){return function(){return fn.apply(that,arguments)}}global.core=core;$def.F=1;$def.G=2;$def.S=4;$def.P=8;$def.B=16;$def.W=32;function $def(type,name,source){var key,own,out,exp,isGlobal=type&$def.G,target=isGlobal?global:type&$def.S?global[name]:(global[name]||{}).prototype,exports=isGlobal?core:core[name]||(core[name]={});if(isGlobal)source=name;for(key in source){own=!(type&$def.F)&&target&&key in target;out=(own?target:source)[key];if(type&$def.B&&own)exp=ctx(out,global);else exp=type&$def.P&&isFunction(out)?ctx(Function.call,out):out;if(target&&!own){if(isGlobal)target[key]=out;else delete target[key]&&$.hide(target,key,out)}if(exports[key]!=out)$.hide(exports,key,exp)}}module.exports=$def},{\"./$\":16}],12:[function(require,module,exports){module.exports=function($){$.FW=true;$.path=$.g;return $}},{}],13:[function(require,module,exports){module.exports=function(fn,args,that){var un=that===undefined;switch(args.length){case 0:return un?fn():fn.call(that);case 1:return un?fn(args[0]):fn.call(that,args[0]);case 2:return un?fn(args[0],args[1]):fn.call(that,args[0],args[1]);case 3:return un?fn(args[0],args[1],args[2]):fn.call(that,args[0],args[1],args[2]);case 4:return un?fn(args[0],args[1],args[2],args[3]):fn.call(that,args[0],args[1],args[2],args[3]);case 5:return un?fn(args[0],args[1],args[2],args[3],args[4]):fn.call(that,args[0],args[1],args[2],args[3],args[4])}return fn.apply(that,args)}},{}],14:[function(require,module,exports){var SYMBOL_ITERATOR=require(\"./$.wks\")(\"iterator\"),SAFE_CLOSING=false;try{var riter=[7][SYMBOL_ITERATOR]();riter[\"return\"]=function(){SAFE_CLOSING=true};Array.from(riter,function(){throw 2})}catch(e){}module.exports=function(exec){if(!SAFE_CLOSING)return false;var safe=false;try{var arr=[7],iter=arr[SYMBOL_ITERATOR]();iter.next=function(){safe=true};arr[SYMBOL_ITERATOR]=function(){return iter};exec(arr)}catch(e){}return safe}},{\"./$.wks\":27}],15:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),ctx=require(\"./$.ctx\"),cof=require(\"./$.cof\"),$def=require(\"./$.def\"),assertObject=require(\"./$.assert\").obj,SYMBOL_ITERATOR=require(\"./$.wks\")(\"iterator\"),FF_ITERATOR=\"@@iterator\",Iterators={},IteratorPrototype={};var BUGGY=\"keys\"in[]&&!(\"next\"in[].keys());setIterator(IteratorPrototype,$.that);function setIterator(O,value){$.hide(O,SYMBOL_ITERATOR,value);if(FF_ITERATOR in[])$.hide(O,FF_ITERATOR,value)}function defineIterator(Constructor,NAME,value,DEFAULT){var proto=Constructor.prototype,iter=proto[SYMBOL_ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT]||value;if($.FW)setIterator(proto,iter);if(iter!==value){var iterProto=$.getProto(iter.call(new Constructor));cof.set(iterProto,NAME+\" Iterator\",true);if($.FW)$.has(proto,FF_ITERATOR)&&setIterator(iterProto,$.that)}Iterators[NAME]=iter;Iterators[NAME+\" Iterator\"]=$.that;return iter}function getIterator(it){var Symbol=$.g.Symbol,ext=it[Symbol&&Symbol.iterator||FF_ITERATOR],getIter=ext||it[SYMBOL_ITERATOR]||Iterators[cof.classof(it)];return assertObject(getIter.call(it))}function closeIterator(iterator){var ret=iterator[\"return\"];if(ret!==undefined)assertObject(ret.call(iterator))}function stepCall(iterator,fn,value,entries){try{return entries?fn(assertObject(value)[0],value[1]):fn(value)}catch(e){closeIterator(iterator);throw e}}var $iter=module.exports={BUGGY:BUGGY,Iterators:Iterators,prototype:IteratorPrototype,step:function(done,value){return{value:value,done:!!done}},stepCall:stepCall,close:closeIterator,is:function(it){var O=Object(it),Symbol=$.g.Symbol,SYM=Symbol&&Symbol.iterator||FF_ITERATOR;return SYM in O||SYMBOL_ITERATOR in O||$.has(Iterators,cof.classof(O))},get:getIterator,set:setIterator,create:function(Constructor,NAME,next,proto){Constructor.prototype=$.create(proto||$iter.prototype,{next:$.desc(1,next)});cof.set(Constructor,NAME+\" Iterator\")},define:defineIterator,std:function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCE){function createIter(kind){return function(){return new Constructor(this,kind)}}$iter.create(Constructor,NAME,next);var entries=createIter(\"key+value\"),values=createIter(\"value\"),proto=Base.prototype,methods,key;if(DEFAULT==\"value\")values=defineIterator(Base,NAME,values,\"values\");else entries=defineIterator(Base,NAME,entries,\"entries\");if(DEFAULT){methods={entries:entries,keys:IS_SET?values:createIter(\"key\"),values:values};$def($def.P+$def.F*BUGGY,NAME,methods);if(FORCE)for(key in methods){if(!(key in proto))$.hide(proto,key,methods[key])}}},forOf:function(iterable,entries,fn,that){var iterator=getIterator(iterable),f=ctx(fn,that,entries?2:1),step;while(!(step=iterator.next()).done){if(stepCall(iterator,f,step.value,entries)===false){return closeIterator(iterator)}}}}},{\"./$\":16,\"./$.assert\":4,\"./$.cof\":6,\"./$.ctx\":10,\"./$.def\":11,\"./$.wks\":27}],16:[function(require,module,exports){\"use strict\";var global=typeof self!=\"undefined\"?self:Function(\"return this\")(),core={},defineProperty=Object.defineProperty,hasOwnProperty={}.hasOwnProperty,ceil=Math.ceil,floor=Math.floor,max=Math.max,min=Math.min;var DESC=!!function(){try{return defineProperty({},\"a\",{get:function(){return 2}}).a==2}catch(e){}}();var hide=createDefiner(1);function toInteger(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}function desc(bitmap,value){return{enumerable:!(bitmap&1),configurable:!(bitmap&2),writable:!(bitmap&4),value:value}}function simpleSet(object,key,value){object[key]=value;return object}function createDefiner(bitmap){return DESC?function(object,key,value){return $.setDesc(object,key,desc(bitmap,value))}:simpleSet}function isObject(it){return it!==null&&(typeof it==\"object\"||typeof it==\"function\")}function isFunction(it){return typeof it==\"function\"}function assertDefined(it){if(it==undefined)throw TypeError(\"Can't call method on  \"+it);return it}var $=module.exports=require(\"./$.fw\")({g:global,core:core,html:global.document&&document.documentElement,isObject:isObject,isFunction:isFunction,it:function(it){return it},that:function(){return this},toInteger:toInteger,toLength:function(it){return it>0?min(toInteger(it),9007199254740991):0},toIndex:function(index,length){index=toInteger(index);return index<0?max(index+length,0):min(index,length)},has:function(it,key){return hasOwnProperty.call(it,key)},create:Object.create,getProto:Object.getPrototypeOf,DESC:DESC,desc:desc,getDesc:Object.getOwnPropertyDescriptor,setDesc:defineProperty,getKeys:Object.keys,getNames:Object.getOwnPropertyNames,getSymbols:Object.getOwnPropertySymbols,assertDefined:assertDefined,ES5Object:Object,toObject:function(it){return $.ES5Object(assertDefined(it))},hide:hide,def:createDefiner(0),set:global.Symbol?simpleSet:hide,mix:function(target,src){for(var key in src)hide(target,key,src[key]);return target},each:[].forEach});if(typeof __e!=\"undefined\")__e=core;if(typeof __g!=\"undefined\")__g=global},{\"./$.fw\":12}],17:[function(require,module,exports){var $=require(\"./$\");module.exports=function(object,el){var O=$.toObject(object),keys=$.getKeys(O),length=keys.length,index=0,key;while(length>index)if(O[key=keys[index++]]===el)return key}},{\"./$\":16}],18:[function(require,module,exports){var $=require(\"./$\"),assertObject=require(\"./$.assert\").obj;module.exports=function ownKeys(it){assertObject(it);return $.getSymbols?$.getNames(it).concat($.getSymbols(it)):$.getNames(it)}},{\"./$\":16,\"./$.assert\":4}],19:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),invoke=require(\"./$.invoke\"),assertFunction=require(\"./$.assert\").fn;module.exports=function(){var fn=assertFunction(this),length=arguments.length,pargs=Array(length),i=0,_=$.path._,holder=false;while(length>i)if((pargs[i]=arguments[i++])===_)holder=true;return function(){var that=this,_length=arguments.length,j=0,k=0,args;if(!holder&&!_length)return invoke(fn,pargs,that);args=pargs.slice();if(holder)for(;length>j;j++)if(args[j]===_)args[j]=arguments[k++];while(_length>k)args.push(arguments[k++]);return invoke(fn,args,that)}}},{\"./$\":16,\"./$.assert\":4,\"./$.invoke\":13}],20:[function(require,module,exports){\"use strict\";module.exports=function(regExp,replace,isStatic){var replacer=replace===Object(replace)?function(part){return replace[part]}:replace;return function(it){return String(isStatic?it:this).replace(regExp,replacer)}}},{}],21:[function(require,module,exports){var $=require(\"./$\"),assert=require(\"./$.assert\");function check(O,proto){assert.obj(O);assert(proto===null||$.isObject(proto),proto,\": can't set as prototype!\")}module.exports={set:Object.setPrototypeOf||(\"__proto__\"in{}?function(buggy,set){try{set=require(\"./$.ctx\")(Function.call,$.getDesc(Object.prototype,\"__proto__\").set,2);set({},[])}catch(e){buggy=true}return function setPrototypeOf(O,proto){check(O,proto);if(buggy)O.__proto__=proto;else set(O,proto);return O}}():undefined),check:check}},{\"./$\":16,\"./$.assert\":4,\"./$.ctx\":10}],22:[function(require,module,exports){var $=require(\"./$\");module.exports=function(C){if($.DESC&&$.FW)$.setDesc(C,require(\"./$.wks\")(\"species\"),{configurable:true,get:$.that})}},{\"./$\":16,\"./$.wks\":27}],23:[function(require,module,exports){\"use strict\";var $=require(\"./$\");module.exports=function(TO_STRING){return function(pos){var s=String($.assertDefined(this)),i=$.toInteger(pos),l=s.length,a,b;if(i<0||i>=l)return TO_STRING?\"\":undefined;a=s.charCodeAt(i);return a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536}}},{\"./$\":16}],24:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),ctx=require(\"./$.ctx\"),cof=require(\"./$.cof\"),invoke=require(\"./$.invoke\"),global=$.g,isFunction=$.isFunction,html=$.html,document=global.document,process=global.process,setTask=global.setImmediate,clearTask=global.clearImmediate,postMessage=global.postMessage,addEventListener=global.addEventListener,MessageChannel=global.MessageChannel,counter=0,queue={},ONREADYSTATECHANGE=\"onreadystatechange\",defer,channel,port;function run(){var id=+this;if($.has(queue,id)){var fn=queue[id];delete queue[id];fn()}}function listner(event){run.call(event.data)}if(!isFunction(setTask)||!isFunction(clearTask)){setTask=function(fn){var args=[],i=1;while(arguments.length>i)args.push(arguments[i++]);queue[++counter]=function(){invoke(isFunction(fn)?fn:Function(fn),args)};defer(counter);return counter};clearTask=function(id){delete queue[id]};if(cof(process)==\"process\"){defer=function(id){process.nextTick(ctx(run,id,1))}}else if(addEventListener&&isFunction(postMessage)&&!global.importScripts){defer=function(id){postMessage(id,\"*\")};addEventListener(\"message\",listner,false)}else if(isFunction(MessageChannel)){channel=new MessageChannel;port=channel.port2;channel.port1.onmessage=listner;defer=ctx(port.postMessage,port,1)}else if(document&&ONREADYSTATECHANGE in document.createElement(\"script\")){defer=function(id){html.appendChild(document.createElement(\"script\"))[ONREADYSTATECHANGE]=function(){html.removeChild(this);run.call(id)}}}else{defer=function(id){setTimeout(ctx(run,id,1),0)}}}module.exports={set:setTask,clear:clearTask}},{\"./$\":16,\"./$.cof\":6,\"./$.ctx\":10,\"./$.invoke\":13}],25:[function(require,module,exports){var sid=0;function uid(key){return\"Symbol(\"+key+\")_\"+(++sid+Math.random()).toString(36)}uid.safe=require(\"./$\").g.Symbol||uid;module.exports=uid},{\"./$\":16}],26:[function(require,module,exports){var $=require(\"./$\"),UNSCOPABLES=require(\"./$.wks\")(\"unscopables\");if($.FW&&!(UNSCOPABLES in[]))$.hide(Array.prototype,UNSCOPABLES,{});module.exports=function(key){if($.FW)[][UNSCOPABLES][key]=true}},{\"./$\":16,\"./$.wks\":27}],27:[function(require,module,exports){var global=require(\"./$\").g,store={};module.exports=function(name){return store[name]||(store[name]=global.Symbol&&global.Symbol[name]||require(\"./$.uid\").safe(\"Symbol.\"+name))}},{\"./$\":16,\"./$.uid\":25}],28:[function(require,module,exports){var $=require(\"./$\"),cof=require(\"./$.cof\"),$def=require(\"./$.def\"),invoke=require(\"./$.invoke\"),arrayMethod=require(\"./$.array-methods\"),IE_PROTO=require(\"./$.uid\").safe(\"__proto__\"),assert=require(\"./$.assert\"),assertObject=assert.obj,ObjectProto=Object.prototype,A=[],slice=A.slice,indexOf=A.indexOf,classof=cof.classof,defineProperties=Object.defineProperties,has=$.has,defineProperty=$.setDesc,getOwnDescriptor=$.getDesc,isFunction=$.isFunction,toObject=$.toObject,toLength=$.toLength,IE8_DOM_DEFINE=false;if(!$.DESC){try{IE8_DOM_DEFINE=defineProperty(document.createElement(\"div\"),\"x\",{get:function(){return 8}}).x==8}catch(e){}$.setDesc=function(O,P,Attributes){if(IE8_DOM_DEFINE)try{return defineProperty(O,P,Attributes)}catch(e){}if(\"get\"in Attributes||\"set\"in Attributes)throw TypeError(\"Accessors not supported!\");if(\"value\"in Attributes)assertObject(O)[P]=Attributes.value;return O};$.getDesc=function(O,P){if(IE8_DOM_DEFINE)try{return getOwnDescriptor(O,P)}catch(e){}if(has(O,P))return $.desc(!ObjectProto.propertyIsEnumerable.call(O,P),O[P])};defineProperties=function(O,Properties){assertObject(O);var keys=$.getKeys(Properties),length=keys.length,i=0,P;while(length>i)$.setDesc(O,P=keys[i++],Properties[P]);return O}}$def($def.S+$def.F*!$.DESC,\"Object\",{getOwnPropertyDescriptor:$.getDesc,defineProperty:$.setDesc,defineProperties:defineProperties});var keys1=(\"constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,\"+\"toLocaleString,toString,valueOf\").split(\",\"),keys2=keys1.concat(\"length\",\"prototype\"),keysLen1=keys1.length;var createDict=function(){var iframe=document.createElement(\"iframe\"),i=keysLen1,gt=\">\",iframeDocument;iframe.style.display=\"none\";$.html.appendChild(iframe);iframe.src=\"javascript:\";iframeDocument=iframe.contentWindow.document;iframeDocument.open();iframeDocument.write(\"<script>document.F=Object</script\"+gt);iframeDocument.close();createDict=iframeDocument.F;while(i--)delete createDict.prototype[keys1[i]];return createDict()};function createGetKeys(names,length){return function(object){var O=toObject(object),i=0,result=[],key;for(key in O)if(key!=IE_PROTO)has(O,key)&&result.push(key);while(length>i)if(has(O,key=names[i++])){~indexOf.call(result,key)||result.push(key)}return result}}function isPrimitive(it){return!$.isObject(it)}function Empty(){}$def($def.S,\"Object\",{getPrototypeOf:$.getProto=$.getProto||function(O){O=Object(assert.def(O));if(has(O,IE_PROTO))return O[IE_PROTO];if(isFunction(O.constructor)&&O instanceof O.constructor){return O.constructor.prototype}return O instanceof Object?ObjectProto:null},getOwnPropertyNames:$.getNames=$.getNames||createGetKeys(keys2,keys2.length,true),create:$.create=$.create||function(O,Properties){var result;if(O!==null){Empty.prototype=assertObject(O);result=new Empty;Empty.prototype=null;result[IE_PROTO]=O}else result=createDict();return Properties===undefined?result:defineProperties(result,Properties)},keys:$.getKeys=$.getKeys||createGetKeys(keys1,keysLen1,false),seal:$.it,freeze:$.it,preventExtensions:$.it,isSealed:isPrimitive,isFrozen:isPrimitive,isExtensible:$.isObject});$def($def.P,\"Function\",{bind:function(that){var fn=assert.fn(this),partArgs=slice.call(arguments,1);function bound(){var args=partArgs.concat(slice.call(arguments));return invoke(fn,args,this instanceof bound?$.create(fn.prototype):that)}if(fn.prototype)bound.prototype=fn.prototype;return bound}});function arrayMethodFix(fn){return function(){return fn.apply($.ES5Object(this),arguments)}}if(!(0 in Object(\"z\")&&\"z\"[0]==\"z\")){$.ES5Object=function(it){return cof(it)==\"String\"?it.split(\"\"):Object(it)}}$def($def.P+$def.F*($.ES5Object!=Object),\"Array\",{slice:arrayMethodFix(slice),join:arrayMethodFix(A.join)});$def($def.S,\"Array\",{isArray:function(arg){return cof(arg)==\"Array\"}});function createArrayReduce(isRight){return function(callbackfn,memo){assert.fn(callbackfn);var O=toObject(this),length=toLength(O.length),index=isRight?length-1:0,i=isRight?-1:1;if(arguments.length<2)for(;;){if(index in O){memo=O[index];index+=i;break}index+=i;assert(isRight?index>=0:length>index,\"Reduce of empty array with no initial value\")}for(;isRight?index>=0:length>index;index+=i)if(index in O){memo=callbackfn(memo,O[index],index,this)}return memo}}$def($def.P,\"Array\",{forEach:$.each=$.each||arrayMethod(0),map:arrayMethod(1),filter:arrayMethod(2),some:arrayMethod(3),every:arrayMethod(4),reduce:createArrayReduce(false),reduceRight:createArrayReduce(true),indexOf:indexOf=indexOf||require(\"./$.array-includes\")(false),lastIndexOf:function(el,fromIndex){var O=toObject(this),length=toLength(O.length),index=length-1;if(arguments.length>1)index=Math.min(index,$.toInteger(fromIndex));if(index<0)index=toLength(length+index);for(;index>=0;index--)if(index in O)if(O[index]===el)return index;return-1}});$def($def.P,\"String\",{trim:require(\"./$.replacer\")(/^\\s*([\\s\\S]*\\S)?\\s*$/,\"$1\")});$def($def.S,\"Date\",{now:function(){return+new Date}});function lz(num){return num>9?num:\"0\"+num}$def($def.P,\"Date\",{toISOString:function(){if(!isFinite(this))throw RangeError(\"Invalid time value\");var d=this,y=d.getUTCFullYear(),m=d.getUTCMilliseconds(),s=y<0?\"-\":y>9999?\"+\":\"\";return s+(\"00000\"+Math.abs(y)).slice(s?-6:-4)+\"-\"+lz(d.getUTCMonth()+1)+\"-\"+lz(d.getUTCDate())+\"T\"+lz(d.getUTCHours())+\":\"+lz(d.getUTCMinutes())+\":\"+lz(d.getUTCSeconds())+\".\"+(m>99?m:\"0\"+lz(m))+\"Z\"}});if(classof(function(){return arguments}())==\"Object\")cof.classof=function(it){var tag=classof(it);return tag==\"Object\"&&isFunction(it.callee)?\"Arguments\":tag}},{\"./$\":16,\"./$.array-includes\":2,\"./$.array-methods\":3,\"./$.assert\":4,\"./$.cof\":6,\"./$.def\":11,\"./$.invoke\":13,\"./$.replacer\":20,\"./$.uid\":25}],29:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),$def=require(\"./$.def\"),toIndex=$.toIndex;$def($def.P,\"Array\",{copyWithin:function copyWithin(target,start){var O=Object($.assertDefined(this)),len=$.toLength(O.length),to=toIndex(target,len),from=toIndex(start,len),end=arguments[2],fin=end===undefined?len:toIndex(end,len),count=Math.min(fin-from,len-to),inc=1;if(from<to&&to<from+count){inc=-1;from=from+count-1;to=to+count-1}while(count-->0){if(from in O)O[to]=O[from];else delete O[to];to+=inc;from+=inc}return O}});require(\"./$.unscope\")(\"copyWithin\")},{\"./$\":16,\"./$.def\":11,\"./$.unscope\":26}],30:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),$def=require(\"./$.def\"),toIndex=$.toIndex;$def($def.P,\"Array\",{fill:function fill(value){var O=Object($.assertDefined(this)),length=$.toLength(O.length),index=toIndex(arguments[1],length),end=arguments[2],endPos=end===undefined?length:toIndex(end,length);while(endPos>index)O[index++]=value;return O}});require(\"./$.unscope\")(\"fill\")},{\"./$\":16,\"./$.def\":11,\"./$.unscope\":26}],31:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.P,\"Array\",{findIndex:require(\"./$.array-methods\")(6)});require(\"./$.unscope\")(\"findIndex\")},{\"./$.array-methods\":3,\"./$.def\":11,\"./$.unscope\":26}],32:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.P,\"Array\",{find:require(\"./$.array-methods\")(5)});require(\"./$.unscope\")(\"find\")},{\"./$.array-methods\":3,\"./$.def\":11,\"./$.unscope\":26}],33:[function(require,module,exports){var $=require(\"./$\"),ctx=require(\"./$.ctx\"),$def=require(\"./$.def\"),$iter=require(\"./$.iter\"),stepCall=$iter.stepCall;$def($def.S+$def.F*!require(\"./$.iter-detect\")(function(iter){Array.from(iter)}),\"Array\",{from:function from(arrayLike){var O=Object($.assertDefined(arrayLike)),mapfn=arguments[1],mapping=mapfn!==undefined,f=mapping?ctx(mapfn,arguments[2],2):undefined,index=0,length,result,step,iterator;if($iter.is(O)){iterator=$iter.get(O);result=new(typeof this==\"function\"?this:Array);for(;!(step=iterator.next()).done;index++){result[index]=mapping?stepCall(iterator,f,[step.value,index],true):step.value}}else{result=new(typeof this==\"function\"?this:Array)(length=$.toLength(O.length));for(;length>index;index++){result[index]=mapping?f(O[index],index):O[index]}}result.length=index;return result}})},{\"./$\":16,\"./$.ctx\":10,\"./$.def\":11,\"./$.iter\":15,\"./$.iter-detect\":14}],34:[function(require,module,exports){var $=require(\"./$\"),setUnscope=require(\"./$.unscope\"),ITER=require(\"./$.uid\").safe(\"iter\"),$iter=require(\"./$.iter\"),step=$iter.step,Iterators=$iter.Iterators;$iter.std(Array,\"Array\",function(iterated,kind){$.set(this,ITER,{o:$.toObject(iterated),i:0,k:kind})},function(){var iter=this[ITER],O=iter.o,kind=iter.k,index=iter.i++;if(!O||index>=O.length){iter.o=undefined;return step(1)}if(kind==\"key\")return step(0,index);if(kind==\"value\")return step(0,O[index]);return step(0,[index,O[index]])},\"value\");Iterators.Arguments=Iterators.Array;setUnscope(\"keys\");setUnscope(\"values\");setUnscope(\"entries\")},{\"./$\":16,\"./$.iter\":15,\"./$.uid\":25,\"./$.unscope\":26}],35:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.S,\"Array\",{of:function of(){var index=0,length=arguments.length,result=new(typeof this==\"function\"?this:Array)(length);while(length>index)result[index]=arguments[index++];result.length=length;return result}})},{\"./$.def\":11}],36:[function(require,module,exports){require(\"./$.species\")(Array)},{\"./$.species\":22}],37:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),NAME=\"name\",setDesc=$.setDesc,FunctionProto=Function.prototype;NAME in FunctionProto||$.FW&&$.DESC&&setDesc(FunctionProto,NAME,{configurable:true,get:function(){var match=String(this).match(/^\\s*function ([^ (]*)/),name=match?match[1]:\"\";$.has(this,NAME)||setDesc(this,NAME,$.desc(5,name));return name},set:function(value){$.has(this,NAME)||setDesc(this,NAME,$.desc(0,value))}})},{\"./$\":16}],38:[function(require,module,exports){\"use strict\";var strong=require(\"./$.collection-strong\");require(\"./$.collection\")(\"Map\",{get:function get(key){var entry=strong.getEntry(this,key);return entry&&entry.v},set:function set(key,value){return strong.def(this,key===0?0:key,value)}},strong,true)},{\"./$.collection\":9,\"./$.collection-strong\":7}],39:[function(require,module,exports){var Infinity=1/0,$def=require(\"./$.def\"),E=Math.E,pow=Math.pow,abs=Math.abs,exp=Math.exp,log=Math.log,sqrt=Math.sqrt,ceil=Math.ceil,floor=Math.floor,EPSILON=pow(2,-52),EPSILON32=pow(2,-23),MAX32=pow(2,127)*(2-EPSILON32),MIN32=pow(2,-126);function roundTiesToEven(n){return n+1/EPSILON-1/EPSILON}function sign(x){return(x=+x)==0||x!=x?x:x<0?-1:1;\n\n}function asinh(x){return!isFinite(x=+x)||x==0?x:x<0?-asinh(-x):log(x+sqrt(x*x+1))}function expm1(x){return(x=+x)==0?x:x>-1e-6&&x<1e-6?x+x*x/2:exp(x)-1}$def($def.S,\"Math\",{acosh:function acosh(x){return(x=+x)<1?NaN:isFinite(x)?log(x/E+sqrt(x+1)*sqrt(x-1)/E)+1:x},asinh:asinh,atanh:function atanh(x){return(x=+x)==0?x:log((1+x)/(1-x))/2},cbrt:function cbrt(x){return sign(x=+x)*pow(abs(x),1/3)},clz32:function clz32(x){return(x>>>=0)?31-floor(log(x+.5)*Math.LOG2E):32},cosh:function cosh(x){return(exp(x=+x)+exp(-x))/2},expm1:expm1,fround:function fround(x){var $abs=abs(x),$sign=sign(x),a,result;if($abs<MIN32)return $sign*roundTiesToEven($abs/MIN32/EPSILON32)*MIN32*EPSILON32;a=(1+EPSILON32/EPSILON)*$abs;result=a-(a-$abs);if(result>MAX32||result!=result)return $sign*Infinity;return $sign*result},hypot:function hypot(value1,value2){var sum=0,len1=arguments.length,len2=len1,args=Array(len1),larg=-Infinity,arg;while(len1--){arg=args[len1]=+arguments[len1];if(arg==Infinity||arg==-Infinity)return Infinity;if(arg>larg)larg=arg}larg=arg||1;while(len2--)sum+=pow(args[len2]/larg,2);return larg*sqrt(sum)},imul:function imul(x,y){var UInt16=65535,xn=+x,yn=+y,xl=UInt16&xn,yl=UInt16&yn;return 0|xl*yl+((UInt16&xn>>>16)*yl+xl*(UInt16&yn>>>16)<<16>>>0)},log1p:function log1p(x){return(x=+x)>-1e-8&&x<1e-8?x-x*x/2:log(1+x)},log10:function log10(x){return log(x)/Math.LN10},log2:function log2(x){return log(x)/Math.LN2},sign:sign,sinh:function sinh(x){return abs(x=+x)<1?(expm1(x)-expm1(-x))/2:(exp(x-1)-exp(-x-1))*(E/2)},tanh:function tanh(x){var a=expm1(x=+x),b=expm1(-x);return a==Infinity?1:b==Infinity?-1:(a-b)/(exp(x)+exp(-x))},trunc:function trunc(it){return(it>0?floor:ceil)(it)}})},{\"./$.def\":11}],40:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),isObject=$.isObject,isFunction=$.isFunction,NUMBER=\"Number\",Number=$.g[NUMBER],Base=Number,proto=Number.prototype;function toPrimitive(it){var fn,val;if(isFunction(fn=it.valueOf)&&!isObject(val=fn.call(it)))return val;if(isFunction(fn=it.toString)&&!isObject(val=fn.call(it)))return val;throw TypeError(\"Can't convert object to number\")}function toNumber(it){if(isObject(it))it=toPrimitive(it);if(typeof it==\"string\"&&it.length>2&&it.charCodeAt(0)==48){var binary=false;switch(it.charCodeAt(1)){case 66:case 98:binary=true;case 79:case 111:return parseInt(it.slice(2),binary?2:8)}}return+it}if($.FW&&!(Number(\"0o1\")&&Number(\"0b1\"))){Number=function Number(it){return this instanceof Number?new Base(toNumber(it)):toNumber(it)};$.each.call($.DESC?$.getNames(Base):(\"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,\"+\"EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,\"+\"MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger\").split(\",\"),function(key){if($.has(Base,key)&&!$.has(Number,key)){$.setDesc(Number,key,$.getDesc(Base,key))}});Number.prototype=proto;proto.constructor=Number;$.hide($.g,NUMBER,Number)}},{\"./$\":16}],41:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\"),abs=Math.abs,floor=Math.floor,_isFinite=$.g.isFinite,MAX_SAFE_INTEGER=9007199254740991;function isInteger(it){return!$.isObject(it)&&_isFinite(it)&&floor(it)===it}$def($def.S,\"Number\",{EPSILON:Math.pow(2,-52),isFinite:function isFinite(it){return typeof it==\"number\"&&_isFinite(it)},isInteger:isInteger,isNaN:function isNaN(number){return number!=number},isSafeInteger:function isSafeInteger(number){return isInteger(number)&&abs(number)<=MAX_SAFE_INTEGER},MAX_SAFE_INTEGER:MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:-MAX_SAFE_INTEGER,parseFloat:parseFloat,parseInt:parseInt})},{\"./$\":16,\"./$.def\":11}],42:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.S,\"Object\",{assign:require(\"./$.assign\")})},{\"./$.assign\":5,\"./$.def\":11}],43:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.S,\"Object\",{is:function is(x,y){return x===y?x!==0||1/x===1/y:x!=x&&y!=y}})},{\"./$.def\":11}],44:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.S,\"Object\",{setPrototypeOf:require(\"./$.set-proto\").set})},{\"./$.def\":11,\"./$.set-proto\":21}],45:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\"),isObject=$.isObject,toObject=$.toObject;function wrapObjectMethod(METHOD,MODE){var fn=($.core.Object||{})[METHOD]||Object[METHOD],f=0,o={};o[METHOD]=MODE==1?function(it){return isObject(it)?fn(it):it}:MODE==2?function(it){return isObject(it)?fn(it):true}:MODE==3?function(it){return isObject(it)?fn(it):false}:MODE==4?function getOwnPropertyDescriptor(it,key){return fn(toObject(it),key)}:MODE==5?function getPrototypeOf(it){return fn(Object($.assertDefined(it)))}:function(it){return fn(toObject(it))};try{fn(\"z\")}catch(e){f=1}$def($def.S+$def.F*f,\"Object\",o)}wrapObjectMethod(\"freeze\",1);wrapObjectMethod(\"seal\",1);wrapObjectMethod(\"preventExtensions\",1);wrapObjectMethod(\"isFrozen\",2);wrapObjectMethod(\"isSealed\",2);wrapObjectMethod(\"isExtensible\",3);wrapObjectMethod(\"getOwnPropertyDescriptor\",4);wrapObjectMethod(\"getPrototypeOf\",5);wrapObjectMethod(\"keys\");wrapObjectMethod(\"getOwnPropertyNames\")},{\"./$\":16,\"./$.def\":11}],46:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),cof=require(\"./$.cof\"),tmp={};tmp[require(\"./$.wks\")(\"toStringTag\")]=\"z\";if($.FW&&cof(tmp)!=\"z\")$.hide(Object.prototype,\"toString\",function toString(){return\"[object \"+cof.classof(this)+\"]\"})},{\"./$\":16,\"./$.cof\":6,\"./$.wks\":27}],47:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),ctx=require(\"./$.ctx\"),cof=require(\"./$.cof\"),$def=require(\"./$.def\"),assert=require(\"./$.assert\"),$iter=require(\"./$.iter\"),SPECIES=require(\"./$.wks\")(\"species\"),RECORD=require(\"./$.uid\").safe(\"record\"),forOf=$iter.forOf,PROMISE=\"Promise\",global=$.g,process=global.process,asap=process&&process.nextTick||require(\"./$.task\").set,P=global[PROMISE],Base=P,isFunction=$.isFunction,isObject=$.isObject,assertFunction=assert.fn,assertObject=assert.obj,test;function getConstructor(C){var S=assertObject(C)[SPECIES];return S!=undefined?S:C}function isThenable(it){var then;if(isObject(it))then=it.then;return isFunction(then)?then:false}function isUnhandled(promise){var record=promise[RECORD],chain=record.c,i=0,react;if(record.h)return false;while(chain.length>i){react=chain[i++];if(react.fail||!isUnhandled(react.P))return false}return true}function notify(record,isReject){var chain=record.c;if(isReject||chain.length)asap(function(){var promise=record.p,value=record.v,ok=record.s==1,i=0;if(isReject&&isUnhandled(promise)){setTimeout(function(){if(isUnhandled(promise)){if(cof(process)==\"process\"){process.emit(\"unhandledRejection\",value,promise)}else if(global.console&&isFunction(console.error)){console.error(\"Unhandled promise rejection\",value)}}},1e3)}else while(chain.length>i)!function(react){var cb=ok?react.ok:react.fail,ret,then;try{if(cb){if(!ok)record.h=true;ret=cb===true?value:cb(value);if(ret===react.P){react.rej(TypeError(PROMISE+\"-chain cycle\"))}else if(then=isThenable(ret)){then.call(ret,react.res,react.rej)}else react.res(ret)}else react.rej(value)}catch(err){react.rej(err)}}(chain[i++]);chain.length=0})}function $reject(value){var record=this;if(record.d)return;record.d=true;record=record.r||record;record.v=value;record.s=2;notify(record,true)}function $resolve(value){var record=this,then,wrapper;if(record.d)return;record.d=true;record=record.r||record;try{if(then=isThenable(value)){wrapper={r:record,d:false};then.call(value,ctx($resolve,wrapper,1),ctx($reject,wrapper,1))}else{record.v=value;record.s=1;notify(record)}}catch(err){$reject.call(wrapper||{r:record,d:false},err)}}if(!(isFunction(P)&&isFunction(P.resolve)&&P.resolve(test=new P(function(){}))==test)){P=function Promise(executor){assertFunction(executor);var record={p:assert.inst(this,P,PROMISE),c:[],s:0,d:false,v:undefined,h:false};$.hide(this,RECORD,record);try{executor(ctx($resolve,record,1),ctx($reject,record,1))}catch(err){$reject.call(record,err)}};$.mix(P.prototype,{then:function then(onFulfilled,onRejected){var S=assertObject(assertObject(this).constructor)[SPECIES];var react={ok:isFunction(onFulfilled)?onFulfilled:true,fail:isFunction(onRejected)?onRejected:false};var promise=react.P=new(S!=undefined?S:P)(function(res,rej){react.res=assertFunction(res);react.rej=assertFunction(rej)});var record=this[RECORD];record.c.push(react);record.s&&notify(record);return promise},\"catch\":function(onRejected){return this.then(undefined,onRejected)}})}$def($def.G+$def.W+$def.F*(P!=Base),{Promise:P});cof.set(P,PROMISE);require(\"./$.species\")(P);$def($def.S,PROMISE,{reject:function reject(r){return new(getConstructor(this))(function(res,rej){rej(r)})},resolve:function resolve(x){return isObject(x)&&RECORD in x&&$.getProto(x)===this.prototype?x:new(getConstructor(this))(function(res){res(x)})}});$def($def.S+$def.F*!require(\"./$.iter-detect\")(function(iter){P.all(iter)[\"catch\"](function(){})}),PROMISE,{all:function all(iterable){var C=getConstructor(this),values=[];return new C(function(res,rej){forOf(iterable,false,values.push,values);var remaining=values.length,results=Array(remaining);if(remaining)$.each.call(values,function(promise,index){C.resolve(promise).then(function(value){results[index]=value;--remaining||res(results)},rej)});else res(results)})},race:function race(iterable){var C=getConstructor(this);return new C(function(res,rej){forOf(iterable,false,function(promise){C.resolve(promise).then(res,rej)})})}})},{\"./$\":16,\"./$.assert\":4,\"./$.cof\":6,\"./$.ctx\":10,\"./$.def\":11,\"./$.iter\":15,\"./$.iter-detect\":14,\"./$.species\":22,\"./$.task\":24,\"./$.uid\":25,\"./$.wks\":27}],48:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\"),setProto=require(\"./$.set-proto\"),$iter=require(\"./$.iter\"),ITER=require(\"./$.uid\").safe(\"iter\"),step=$iter.step,assert=require(\"./$.assert\"),isObject=$.isObject,getDesc=$.getDesc,setDesc=$.setDesc,getProto=$.getProto,apply=Function.apply,assertObject=assert.obj,_isExtensible=Object.isExtensible||$.it;function Enumerate(iterated){var keys=[],key;for(key in iterated)keys.push(key);$.set(this,ITER,{o:iterated,a:keys,i:0})}$iter.create(Enumerate,\"Object\",function(){var iter=this[ITER],keys=iter.a,key;do{if(iter.i>=keys.length)return step(1)}while(!((key=keys[iter.i++])in iter.o));return step(0,key)});function wrap(fn){return function(it){assertObject(it);try{fn.apply(undefined,arguments);return true}catch(e){return false}}}function get(target,propertyKey){var receiver=arguments.length<3?target:arguments[2],desc=getDesc(assertObject(target),propertyKey),proto;if(desc)return $.has(desc,\"value\")?desc.value:desc.get===undefined?undefined:desc.get.call(receiver);return isObject(proto=getProto(target))?get(proto,propertyKey,receiver):undefined}function set(target,propertyKey,V){var receiver=arguments.length<4?target:arguments[3],ownDesc=getDesc(assertObject(target),propertyKey),existingDescriptor,proto;if(!ownDesc){if(isObject(proto=getProto(target))){return set(proto,propertyKey,V,receiver)}ownDesc=$.desc(0)}if($.has(ownDesc,\"value\")){if(ownDesc.writable===false||!isObject(receiver))return false;existingDescriptor=getDesc(receiver,propertyKey)||$.desc(0);existingDescriptor.value=V;setDesc(receiver,propertyKey,existingDescriptor);return true}return ownDesc.set===undefined?false:(ownDesc.set.call(receiver,V),true)}var reflect={apply:require(\"./$.ctx\")(Function.call,apply,3),construct:function construct(target,argumentsList){var proto=assert.fn(arguments.length<3?target:arguments[2]).prototype,instance=$.create(isObject(proto)?proto:Object.prototype),result=apply.call(target,instance,argumentsList);return isObject(result)?result:instance},defineProperty:wrap(setDesc),deleteProperty:function deleteProperty(target,propertyKey){var desc=getDesc(assertObject(target),propertyKey);return desc&&!desc.configurable?false:delete target[propertyKey]},enumerate:function enumerate(target){return new Enumerate(assertObject(target))},get:get,getOwnPropertyDescriptor:function getOwnPropertyDescriptor(target,propertyKey){return getDesc(assertObject(target),propertyKey)},getPrototypeOf:function getPrototypeOf(target){return getProto(assertObject(target))},has:function has(target,propertyKey){return propertyKey in target},isExtensible:function isExtensible(target){return!!_isExtensible(assertObject(target))},ownKeys:require(\"./$.own-keys\"),preventExtensions:wrap(Object.preventExtensions||$.it),set:set};if(setProto)reflect.setPrototypeOf=function setPrototypeOf(target,proto){setProto.check(target,proto);try{setProto.set(target,proto);return true}catch(e){return false}};$def($def.G,{Reflect:{}});$def($def.S,\"Reflect\",reflect)},{\"./$\":16,\"./$.assert\":4,\"./$.ctx\":10,\"./$.def\":11,\"./$.iter\":15,\"./$.own-keys\":18,\"./$.set-proto\":21,\"./$.uid\":25}],49:[function(require,module,exports){var $=require(\"./$\"),cof=require(\"./$.cof\"),RegExp=$.g.RegExp,Base=RegExp,proto=RegExp.prototype;if($.FW&&$.DESC){if(!function(){try{return RegExp(/a/g,\"i\")==\"/a/i\"}catch(e){}}()){RegExp=function RegExp(pattern,flags){return new Base(cof(pattern)==\"RegExp\"&&flags!==undefined?pattern.source:pattern,flags)};$.each.call($.getNames(Base),function(key){key in RegExp||$.setDesc(RegExp,key,{configurable:true,get:function(){return Base[key]},set:function(it){Base[key]=it}})});proto.constructor=RegExp;RegExp.prototype=proto;$.hide($.g,\"RegExp\",RegExp)}if(/./g.flags!=\"g\")$.setDesc(proto,\"flags\",{configurable:true,get:require(\"./$.replacer\")(/^.*\\/(\\w*)$/,\"$1\")})}require(\"./$.species\")(RegExp)},{\"./$\":16,\"./$.cof\":6,\"./$.replacer\":20,\"./$.species\":22}],50:[function(require,module,exports){\"use strict\";var strong=require(\"./$.collection-strong\");require(\"./$.collection\")(\"Set\",{add:function add(value){return strong.def(this,value=value===0?0:value,value)}},strong)},{\"./$.collection\":9,\"./$.collection-strong\":7}],51:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.P,\"String\",{codePointAt:require(\"./$.string-at\")(false)})},{\"./$.def\":11,\"./$.string-at\":23}],52:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),cof=require(\"./$.cof\"),$def=require(\"./$.def\"),toLength=$.toLength;$def($def.P,\"String\",{endsWith:function endsWith(searchString){if(cof(searchString)==\"RegExp\")throw TypeError();var that=String($.assertDefined(this)),endPosition=arguments[1],len=toLength(that.length),end=endPosition===undefined?len:Math.min(toLength(endPosition),len);searchString+=\"\";return that.slice(end-searchString.length,end)===searchString}})},{\"./$\":16,\"./$.cof\":6,\"./$.def\":11}],53:[function(require,module,exports){var $def=require(\"./$.def\"),toIndex=require(\"./$\").toIndex,fromCharCode=String.fromCharCode;$def($def.S,\"String\",{fromCodePoint:function fromCodePoint(x){var res=[],len=arguments.length,i=0,code;while(len>i){code=+arguments[i++];if(toIndex(code,1114111)!==code)throw RangeError(code+\" is not a valid code point\");res.push(code<65536?fromCharCode(code):fromCharCode(((code-=65536)>>10)+55296,code%1024+56320))}return res.join(\"\")}})},{\"./$\":16,\"./$.def\":11}],54:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),cof=require(\"./$.cof\"),$def=require(\"./$.def\");$def($def.P,\"String\",{includes:function includes(searchString){if(cof(searchString)==\"RegExp\")throw TypeError();return!!~String($.assertDefined(this)).indexOf(searchString,arguments[1])}})},{\"./$\":16,\"./$.cof\":6,\"./$.def\":11}],55:[function(require,module,exports){var set=require(\"./$\").set,at=require(\"./$.string-at\")(true),ITER=require(\"./$.uid\").safe(\"iter\"),$iter=require(\"./$.iter\"),step=$iter.step;$iter.std(String,\"String\",function(iterated){set(this,ITER,{o:String(iterated),i:0})},function(){var iter=this[ITER],O=iter.o,index=iter.i,point;if(index>=O.length)return step(1);point=at.call(O,index);iter.i+=point.length;return step(0,point)})},{\"./$\":16,\"./$.iter\":15,\"./$.string-at\":23,\"./$.uid\":25}],56:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\");$def($def.S,\"String\",{raw:function raw(callSite){var tpl=$.toObject(callSite.raw),len=$.toLength(tpl.length),sln=arguments.length,res=[],i=0;while(len>i){res.push(String(tpl[i++]));if(i<sln)res.push(String(arguments[i]))}return res.join(\"\")}})},{\"./$\":16,\"./$.def\":11}],57:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),$def=require(\"./$.def\");$def($def.P,\"String\",{repeat:function repeat(count){var str=String($.assertDefined(this)),res=\"\",n=$.toInteger(count);if(n<0||n==Infinity)throw RangeError(\"Count can't be negative\");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res}})},{\"./$\":16,\"./$.def\":11}],58:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),cof=require(\"./$.cof\"),$def=require(\"./$.def\");$def($def.P,\"String\",{startsWith:function startsWith(searchString){if(cof(searchString)==\"RegExp\")throw TypeError();var that=String($.assertDefined(this)),index=$.toLength(Math.min(arguments[1],that.length));searchString+=\"\";return that.slice(index,index+searchString.length)===searchString}})},{\"./$\":16,\"./$.cof\":6,\"./$.def\":11}],59:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),setTag=require(\"./$.cof\").set,uid=require(\"./$.uid\"),$def=require(\"./$.def\"),keyOf=require(\"./$.keyof\"),has=$.has,hide=$.hide,getNames=$.getNames,toObject=$.toObject,Symbol=$.g.Symbol,Base=Symbol,setter=false,TAG=uid.safe(\"tag\"),SymbolRegistry={},AllSymbols={};function wrap(tag){var sym=AllSymbols[tag]=$.set($.create(Symbol.prototype),TAG,tag);$.DESC&&setter&&$.setDesc(Object.prototype,tag,{configurable:true,set:function(value){hide(this,tag,value)}});return sym}if(!$.isFunction(Symbol)){Symbol=function Symbol(description){if(this instanceof Symbol)throw TypeError(\"Symbol is not a constructor\");return wrap(uid(description))};hide(Symbol.prototype,\"toString\",function(){return this[TAG]})}$def($def.G+$def.W,{Symbol:Symbol});var symbolStatics={\"for\":function(key){return has(SymbolRegistry,key+=\"\")?SymbolRegistry[key]:SymbolRegistry[key]=Symbol(key)},keyFor:function keyFor(key){return keyOf(SymbolRegistry,key)},pure:uid.safe,set:$.set,useSetter:function(){setter=true},useSimple:function(){setter=false}};$.each.call((\"hasInstance,isConcatSpreadable,iterator,match,replace,search,\"+\"species,split,toPrimitive,toStringTag,unscopables\").split(\",\"),function(it){var sym=require(\"./$.wks\")(it);symbolStatics[it]=Symbol===Base?sym:wrap(sym)});setter=true;$def($def.S,\"Symbol\",symbolStatics);$def($def.S+$def.F*(Symbol!=Base),\"Object\",{getOwnPropertyNames:function getOwnPropertyNames(it){var names=getNames(toObject(it)),result=[],key,i=0;while(names.length>i)has(AllSymbols,key=names[i++])||result.push(key);return result},getOwnPropertySymbols:function getOwnPropertySymbols(it){var names=getNames(toObject(it)),result=[],key,i=0;while(names.length>i)has(AllSymbols,key=names[i++])&&result.push(AllSymbols[key]);return result}});setTag(Symbol,\"Symbol\");setTag(Math,\"Math\",true);setTag($.g.JSON,\"JSON\",true)},{\"./$\":16,\"./$.cof\":6,\"./$.def\":11,\"./$.keyof\":17,\"./$.uid\":25,\"./$.wks\":27}],60:[function(require,module,exports){\"use strict\";var $=require(\"./$\"),weak=require(\"./$.collection-weak\"),leakStore=weak.leakStore,ID=weak.ID,WEAK=weak.WEAK,has=$.has,isObject=$.isObject,isFrozen=Object.isFrozen||$.core.Object.isFrozen,tmp={};var WeakMap=require(\"./$.collection\")(\"WeakMap\",{get:function get(key){if(isObject(key)){if(isFrozen(key))return leakStore(this).get(key);if(has(key,WEAK))return key[WEAK][this[ID]]}},set:function set(key,value){return weak.def(this,key,value)}},weak,true,true);if($.FW&&(new WeakMap).set((Object.freeze||Object)(tmp),7).get(tmp)!=7){$.each.call([\"delete\",\"has\",\"get\",\"set\"],function(key){var method=WeakMap.prototype[key];WeakMap.prototype[key]=function(a,b){if(isObject(a)&&isFrozen(a)){var result=leakStore(this)[key](a,b);return key==\"set\"?this:result}return method.call(this,a,b)}})}},{\"./$\":16,\"./$.collection\":9,\"./$.collection-weak\":8}],61:[function(require,module,exports){\"use strict\";var weak=require(\"./$.collection-weak\");require(\"./$.collection\")(\"WeakSet\",{add:function add(value){return weak.def(this,value,true)}},weak,false,true)},{\"./$.collection\":9,\"./$.collection-weak\":8}],62:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.P,\"Array\",{includes:require(\"./$.array-includes\")(true)});require(\"./$.unscope\")(\"includes\")},{\"./$.array-includes\":2,\"./$.def\":11,\"./$.unscope\":26}],63:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\"),ownKeys=require(\"./$.own-keys\");$def($def.S,\"Object\",{getOwnPropertyDescriptors:function getOwnPropertyDescriptors(object){var O=$.toObject(object),result={};$.each.call(ownKeys(O),function(key){$.setDesc(result,key,$.desc(0,$.getDesc(O,key)))});return result}})},{\"./$\":16,\"./$.def\":11,\"./$.own-keys\":18}],64:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\");function createObjectToArray(isEntries){return function(object){var O=$.toObject(object),keys=$.getKeys(object),length=keys.length,i=0,result=Array(length),key;if(isEntries)while(length>i)result[i]=[key=keys[i++],O[key]];else while(length>i)result[i]=O[keys[i++]];return result}}$def($def.S,\"Object\",{values:createObjectToArray(false),entries:createObjectToArray(true)})},{\"./$\":16,\"./$.def\":11}],65:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.S,\"RegExp\",{escape:require(\"./$.replacer\")(/([\\\\\\-[\\]{}()*+?.,^$|])/g,\"\\\\$1\",true)})},{\"./$.def\":11,\"./$.replacer\":20}],66:[function(require,module,exports){var $def=require(\"./$.def\"),forOf=require(\"./$.iter\").forOf;$def($def.P,\"Set\",{toJSON:function(){var arr=[];forOf(this,false,arr.push,arr);return arr}})},{\"./$.def\":11,\"./$.iter\":15}],67:[function(require,module,exports){var $def=require(\"./$.def\");$def($def.P,\"String\",{at:require(\"./$.string-at\")(true)})},{\"./$.def\":11,\"./$.string-at\":23}],68:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\"),$Array=$.core.Array||Array,statics={};function setStatics(keys,length){$.each.call(keys.split(\",\"),function(key){if(length==undefined&&key in $Array)statics[key]=$Array[key];else if(key in[])statics[key]=require(\"./$.ctx\")(Function.call,[][key],length)})}setStatics(\"pop,reverse,shift,keys,values,entries\",1);setStatics(\"indexOf,every,some,forEach,map,filter,find,findIndex,includes\",3);setStatics(\"join,slice,concat,push,splice,unshift,sort,lastIndexOf,\"+\"reduce,reduceRight,copyWithin,fill,turn\");$def($def.S,\"Array\",statics)},{\"./$\":16,\"./$.ctx\":10,\"./$.def\":11}],69:[function(require,module,exports){require(\"./es6.array.iterator\");var $=require(\"./$\"),Iterators=require(\"./$.iter\").Iterators,ITERATOR=require(\"./$.wks\")(\"iterator\"),NodeList=$.g.NodeList;if($.FW&&NodeList&&!(ITERATOR in NodeList.prototype)){$.hide(NodeList.prototype,ITERATOR,Iterators.Array)}Iterators.NodeList=Iterators.Array},{\"./$\":16,\"./$.iter\":15,\"./$.wks\":27,\"./es6.array.iterator\":34}],70:[function(require,module,exports){var $def=require(\"./$.def\"),$task=require(\"./$.task\");$def($def.G+$def.B,{setImmediate:$task.set,clearImmediate:$task.clear})},{\"./$.def\":11,\"./$.task\":24}],71:[function(require,module,exports){var $=require(\"./$\"),$def=require(\"./$.def\"),invoke=require(\"./$.invoke\"),partial=require(\"./$.partial\"),MSIE=!!$.g.navigator&&/MSIE .\\./.test(navigator.userAgent);function wrap(set){return MSIE?function(fn,time){return set(invoke(partial,[].slice.call(arguments,2),$.isFunction(fn)?fn:Function(fn)),time)}:set}$def($def.G+$def.B+$def.F*MSIE,{setTimeout:wrap($.g.setTimeout),setInterval:wrap($.g.setInterval)})},{\"./$\":16,\"./$.def\":11,\"./$.invoke\":13,\"./$.partial\":19}],72:[function(require,module,exports){require(\"./modules/es5\");require(\"./modules/es6.symbol\");require(\"./modules/es6.object.assign\");require(\"./modules/es6.object.is\");require(\"./modules/es6.object.set-prototype-of\");require(\"./modules/es6.object.to-string\");require(\"./modules/es6.object.statics-accept-primitives\");require(\"./modules/es6.function.name\");require(\"./modules/es6.number.constructor\");require(\"./modules/es6.number.statics\");require(\"./modules/es6.math\");require(\"./modules/es6.string.from-code-point\");require(\"./modules/es6.string.raw\");require(\"./modules/es6.string.iterator\");require(\"./modules/es6.string.code-point-at\");require(\"./modules/es6.string.ends-with\");require(\"./modules/es6.string.includes\");require(\"./modules/es6.string.repeat\");require(\"./modules/es6.string.starts-with\");require(\"./modules/es6.array.from\");require(\"./modules/es6.array.of\");require(\"./modules/es6.array.iterator\");require(\"./modules/es6.array.species\");require(\"./modules/es6.array.copy-within\");require(\"./modules/es6.array.fill\");require(\"./modules/es6.array.find\");require(\"./modules/es6.array.find-index\");require(\"./modules/es6.regexp\");require(\"./modules/es6.promise\");require(\"./modules/es6.map\");require(\"./modules/es6.set\");require(\"./modules/es6.weak-map\");require(\"./modules/es6.weak-set\");require(\"./modules/es6.reflect\");require(\"./modules/es7.array.includes\");require(\"./modules/es7.string.at\");require(\"./modules/es7.regexp.escape\");require(\"./modules/es7.object.get-own-property-descriptors\");require(\"./modules/es7.object.to-array\");require(\"./modules/es7.set.to-json\");require(\"./modules/js.array.statics\");require(\"./modules/web.timers\");require(\"./modules/web.immediate\");require(\"./modules/web.dom.iterable\");module.exports=require(\"./modules/$\").core},{\"./modules/$\":16,\"./modules/es5\":28,\"./modules/es6.array.copy-within\":29,\"./modules/es6.array.fill\":30,\"./modules/es6.array.find\":32,\"./modules/es6.array.find-index\":31,\"./modules/es6.array.from\":33,\"./modules/es6.array.iterator\":34,\"./modules/es6.array.of\":35,\"./modules/es6.array.species\":36,\"./modules/es6.function.name\":37,\"./modules/es6.map\":38,\"./modules/es6.math\":39,\"./modules/es6.number.constructor\":40,\"./modules/es6.number.statics\":41,\"./modules/es6.object.assign\":42,\"./modules/es6.object.is\":43,\"./modules/es6.object.set-prototype-of\":44,\"./modules/es6.object.statics-accept-primitives\":45,\"./modules/es6.object.to-string\":46,\"./modules/es6.promise\":47,\"./modules/es6.reflect\":48,\"./modules/es6.regexp\":49,\"./modules/es6.set\":50,\"./modules/es6.string.code-point-at\":51,\"./modules/es6.string.ends-with\":52,\"./modules/es6.string.from-code-point\":53,\"./modules/es6.string.includes\":54,\"./modules/es6.string.iterator\":55,\"./modules/es6.string.raw\":56,\"./modules/es6.string.repeat\":57,\"./modules/es6.string.starts-with\":58,\"./modules/es6.symbol\":59,\"./modules/es6.weak-map\":60,\"./modules/es6.weak-set\":61,\"./modules/es7.array.includes\":62,\"./modules/es7.object.get-own-property-descriptors\":63,\"./modules/es7.object.to-array\":64,\"./modules/es7.regexp.escape\":65,\"./modules/es7.set.to-json\":66,\"./modules/es7.string.at\":67,\"./modules/js.array.statics\":68,\"./modules/web.dom.iterable\":69,\"./modules/web.immediate\":70,\"./modules/web.timers\":71}],73:[function(require,module,exports){(function(global){!function(global){\"use strict\";var hasOwn=Object.prototype.hasOwnProperty;var undefined;var iteratorSymbol=typeof Symbol===\"function\"&&Symbol.iterator||\"@@iterator\";var inModule=typeof module===\"object\";var runtime=global.regeneratorRuntime;if(runtime){if(inModule){module.exports=runtime}return}runtime=global.regeneratorRuntime=inModule?module.exports:{};function wrap(innerFn,outerFn,self,tryLocsList){var generator=Object.create((outerFn||Generator).prototype);generator._invoke=makeInvokeMethod(innerFn,self||null,new Context(tryLocsList||[]));return generator}runtime.wrap=wrap;function tryCatch(fn,obj,arg){try{return{type:\"normal\",arg:fn.call(obj,arg)}}catch(err){return{type:\"throw\",arg:err}}}var GenStateSuspendedStart=\"suspendedStart\";var GenStateSuspendedYield=\"suspendedYield\";var GenStateExecuting=\"executing\";var GenStateCompleted=\"completed\";var ContinueSentinel={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype;GeneratorFunction.prototype=Gp.constructor=GeneratorFunctionPrototype;GeneratorFunctionPrototype.constructor=GeneratorFunction;GeneratorFunction.displayName=\"GeneratorFunction\";runtime.isGeneratorFunction=function(genFun){var ctor=typeof genFun===\"function\"&&genFun.constructor;return ctor?ctor===GeneratorFunction||(ctor.displayName||ctor.name)===\"GeneratorFunction\":false};runtime.mark=function(genFun){genFun.__proto__=GeneratorFunctionPrototype;genFun.prototype=Object.create(Gp);return genFun};runtime.async=function(innerFn,outerFn,self,tryLocsList){return new Promise(function(resolve,reject){var generator=wrap(innerFn,outerFn,self,tryLocsList);var callNext=step.bind(generator,\"next\");var callThrow=step.bind(generator,\"throw\");function step(method,arg){var record=tryCatch(generator[method],generator,arg);if(record.type===\"throw\"){reject(record.arg);return}var info=record.arg;if(info.done){resolve(info.value)}else{Promise.resolve(info.value).then(callNext,callThrow)}}callNext()})};function makeInvokeMethod(innerFn,self,context){var state=GenStateSuspendedStart;return function invoke(method,arg){if(state===GenStateExecuting){throw new Error(\"Generator is already running\")}if(state===GenStateCompleted){return doneResult()}while(true){var delegate=context.delegate;if(delegate){if(method===\"return\"||method===\"throw\"&&delegate.iterator.throw===undefined){context.delegate=null;var returnMethod=delegate.iterator.return;if(returnMethod){var record=tryCatch(returnMethod,delegate.iterator,arg);if(record.type===\"throw\"){method=\"throw\";arg=record.arg;continue}}if(method===\"return\"){continue}}var record=tryCatch(delegate.iterator[method],delegate.iterator,arg);if(record.type===\"throw\"){context.delegate=null;method=\"throw\";arg=record.arg;continue}method=\"next\";arg=undefined;var info=record.arg;if(info.done){context[delegate.resultName]=info.value;context.next=delegate.nextLoc}else{state=GenStateSuspendedYield;return info}context.delegate=null}if(method===\"next\"){if(state===GenStateSuspendedYield){context.sent=arg}else{delete context.sent}}else if(method===\"throw\"){if(state===GenStateSuspendedStart){state=GenStateCompleted;throw arg}if(context.dispatchException(arg)){method=\"next\";arg=undefined}}else if(method===\"return\"){context.abrupt(\"return\",arg)}state=GenStateExecuting;var record=tryCatch(innerFn,self,context);if(record.type===\"normal\"){state=context.done?GenStateCompleted:GenStateSuspendedYield;var info={value:record.arg,done:context.done};if(record.arg===ContinueSentinel){if(context.delegate&&method===\"next\"){arg=undefined}}else{return info}}else if(record.type===\"throw\"){state=GenStateCompleted;method=\"throw\";arg=record.arg}}}}function defineGeneratorMethod(method){Gp[method]=function(arg){return this._invoke(method,arg)}}defineGeneratorMethod(\"next\");defineGeneratorMethod(\"throw\");defineGeneratorMethod(\"return\");Gp[iteratorSymbol]=function(){return this};Gp.toString=function(){return\"[object Generator]\"};function pushTryEntry(locs){var entry={tryLoc:locs[0]};if(1 in locs){entry.catchLoc=locs[1]}if(2 in locs){entry.finallyLoc=locs[2];entry.afterLoc=locs[3]}this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type=\"normal\";delete record.arg;entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:\"root\"}];tryLocsList.forEach(pushTryEntry,this);this.reset()}runtime.keys=function(object){var keys=[];for(var key in object){keys.push(key)}keys.reverse();return function next(){while(keys.length){var key=keys.pop();if(key in object){next.value=key;next.done=false;return next}}next.done=true;return next}};function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod){return iteratorMethod.call(iterable)}if(typeof iterable.next===\"function\"){return iterable}if(!isNaN(iterable.length)){var i=-1,next=function next(){while(++i<iterable.length){if(hasOwn.call(iterable,i)){next.value=iterable[i];next.done=false;return next}}next.value=undefined;next.done=true;return next};return next.next=next}}return{next:doneResult}}runtime.values=values;function doneResult(){return{value:undefined,done:true}}Context.prototype={constructor:Context,reset:function(){this.prev=0;\n\nthis.next=0;this.sent=undefined;this.done=false;this.delegate=null;this.tryEntries.forEach(resetTryEntry);for(var tempIndex=0,tempName;hasOwn.call(this,tempName=\"t\"+tempIndex)||tempIndex<20;++tempIndex){this[tempName]=null}},stop:function(){this.done=true;var rootEntry=this.tryEntries[0];var rootRecord=rootEntry.completion;if(rootRecord.type===\"throw\"){throw rootRecord.arg}return this.rval},dispatchException:function(exception){if(this.done){throw exception}var context=this;function handle(loc,caught){record.type=\"throw\";record.arg=exception;context.next=loc;return!!caught}for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];var record=entry.completion;if(entry.tryLoc===\"root\"){return handle(\"end\")}if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,\"catchLoc\");var hasFinally=hasOwn.call(entry,\"finallyLoc\");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}else if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else if(hasCatch){if(this.prev<entry.catchLoc){return handle(entry.catchLoc,true)}}else if(hasFinally){if(this.prev<entry.finallyLoc){return handle(entry.finallyLoc)}}else{throw new Error(\"try statement without catch or finally\")}}}},abrupt:function(type,arg){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,\"finallyLoc\")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}}if(finallyEntry&&(type===\"break\"||type===\"continue\")&&finallyEntry.tryLoc<=arg&&arg<finallyEntry.finallyLoc){finallyEntry=null}var record=finallyEntry?finallyEntry.completion:{};record.type=type;record.arg=arg;if(finallyEntry){this.next=finallyEntry.finallyLoc}else{this.complete(record)}return ContinueSentinel},complete:function(record,afterLoc){if(record.type===\"throw\"){throw record.arg}if(record.type===\"break\"||record.type===\"continue\"){this.next=record.arg}else if(record.type===\"return\"){this.rval=record.arg;this.next=\"end\"}else if(record.type===\"normal\"&&afterLoc){this.next=afterLoc}return ContinueSentinel},finish:function(finallyLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc){return this.complete(entry.completion,entry.afterLoc)}}},\"catch\":function(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if(record.type===\"throw\"){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error(\"illegal catch attempt\")},delegateYield:function(iterable,resultName,nextLoc){this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc};return ContinueSentinel}}}(typeof global===\"object\"?global:typeof window===\"object\"?window:typeof self===\"object\"?self:this)}).call(this,typeof global!==\"undefined\"?global:typeof self!==\"undefined\"?self:typeof window!==\"undefined\"?window:{})},{}]},{},[1]);"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/css/ionic.css",
    "content": "@charset \"UTF-8\";\n/*!\n * Copyright 2015 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.3.1\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n/*!\n  Ionicons, v2.0.1\n  Created by Ben Sperry for the Ionic Framework, http://ionicons.com/\n  https://twitter.com/benjsperry  https://twitter.com/ionicframework\n  MIT License: https://github.com/driftyco/ionicons\n\n  Android-style icons originally built by Google’s\n  Material Design Icons: https://github.com/google/material-design-icons\n  used under CC BY http://creativecommons.org/licenses/by/4.0/\n  Modified icons to fit ionicon’s grid from original.\n*/\n@font-face {\n  font-family: \"Ionicons\";\n  src: url(\"../fonts/ionicons.eot?v=2.0.1\");\n  src: url(\"../fonts/ionicons.eot?v=2.0.1#iefix\") format(\"embedded-opentype\"), url(\"../fonts/ionicons.ttf?v=2.0.1\") format(\"truetype\"), url(\"../fonts/ionicons.woff?v=2.0.1\") format(\"woff\"), url(\"../fonts/ionicons.woff\") format(\"woff\"), url(\"../fonts/ionicons.svg?v=2.0.1#Ionicons\") format(\"svg\");\n  font-weight: normal;\n  font-style: normal; }\n\n.ion, .ionicons,\n.ion-alert:before,\n.ion-alert-circled:before,\n.ion-android-add:before,\n.ion-android-add-circle:before,\n.ion-android-alarm-clock:before,\n.ion-android-alert:before,\n.ion-android-apps:before,\n.ion-android-archive:before,\n.ion-android-arrow-back:before,\n.ion-android-arrow-down:before,\n.ion-android-arrow-dropdown:before,\n.ion-android-arrow-dropdown-circle:before,\n.ion-android-arrow-dropleft:before,\n.ion-android-arrow-dropleft-circle:before,\n.ion-android-arrow-dropright:before,\n.ion-android-arrow-dropright-circle:before,\n.ion-android-arrow-dropup:before,\n.ion-android-arrow-dropup-circle:before,\n.ion-android-arrow-forward:before,\n.ion-android-arrow-up:before,\n.ion-android-attach:before,\n.ion-android-bar:before,\n.ion-android-bicycle:before,\n.ion-android-boat:before,\n.ion-android-bookmark:before,\n.ion-android-bulb:before,\n.ion-android-bus:before,\n.ion-android-calendar:before,\n.ion-android-call:before,\n.ion-android-camera:before,\n.ion-android-cancel:before,\n.ion-android-car:before,\n.ion-android-cart:before,\n.ion-android-chat:before,\n.ion-android-checkbox:before,\n.ion-android-checkbox-blank:before,\n.ion-android-checkbox-outline:before,\n.ion-android-checkbox-outline-blank:before,\n.ion-android-checkmark-circle:before,\n.ion-android-clipboard:before,\n.ion-android-close:before,\n.ion-android-cloud:before,\n.ion-android-cloud-circle:before,\n.ion-android-cloud-done:before,\n.ion-android-cloud-outline:before,\n.ion-android-color-palette:before,\n.ion-android-compass:before,\n.ion-android-contact:before,\n.ion-android-contacts:before,\n.ion-android-contract:before,\n.ion-android-create:before,\n.ion-android-delete:before,\n.ion-android-desktop:before,\n.ion-android-document:before,\n.ion-android-done:before,\n.ion-android-done-all:before,\n.ion-android-download:before,\n.ion-android-drafts:before,\n.ion-android-exit:before,\n.ion-android-expand:before,\n.ion-android-favorite:before,\n.ion-android-favorite-outline:before,\n.ion-android-film:before,\n.ion-android-folder:before,\n.ion-android-folder-open:before,\n.ion-android-funnel:before,\n.ion-android-globe:before,\n.ion-android-hand:before,\n.ion-android-hangout:before,\n.ion-android-happy:before,\n.ion-android-home:before,\n.ion-android-image:before,\n.ion-android-laptop:before,\n.ion-android-list:before,\n.ion-android-locate:before,\n.ion-android-lock:before,\n.ion-android-mail:before,\n.ion-android-map:before,\n.ion-android-menu:before,\n.ion-android-microphone:before,\n.ion-android-microphone-off:before,\n.ion-android-more-horizontal:before,\n.ion-android-more-vertical:before,\n.ion-android-navigate:before,\n.ion-android-notifications:before,\n.ion-android-notifications-none:before,\n.ion-android-notifications-off:before,\n.ion-android-open:before,\n.ion-android-options:before,\n.ion-android-people:before,\n.ion-android-person:before,\n.ion-android-person-add:before,\n.ion-android-phone-landscape:before,\n.ion-android-phone-portrait:before,\n.ion-android-pin:before,\n.ion-android-plane:before,\n.ion-android-playstore:before,\n.ion-android-print:before,\n.ion-android-radio-button-off:before,\n.ion-android-radio-button-on:before,\n.ion-android-refresh:before,\n.ion-android-remove:before,\n.ion-android-remove-circle:before,\n.ion-android-restaurant:before,\n.ion-android-sad:before,\n.ion-android-search:before,\n.ion-android-send:before,\n.ion-android-settings:before,\n.ion-android-share:before,\n.ion-android-share-alt:before,\n.ion-android-star:before,\n.ion-android-star-half:before,\n.ion-android-star-outline:before,\n.ion-android-stopwatch:before,\n.ion-android-subway:before,\n.ion-android-sunny:before,\n.ion-android-sync:before,\n.ion-android-textsms:before,\n.ion-android-time:before,\n.ion-android-train:before,\n.ion-android-unlock:before,\n.ion-android-upload:before,\n.ion-android-volume-down:before,\n.ion-android-volume-mute:before,\n.ion-android-volume-off:before,\n.ion-android-volume-up:before,\n.ion-android-walk:before,\n.ion-android-warning:before,\n.ion-android-watch:before,\n.ion-android-wifi:before,\n.ion-aperture:before,\n.ion-archive:before,\n.ion-arrow-down-a:before,\n.ion-arrow-down-b:before,\n.ion-arrow-down-c:before,\n.ion-arrow-expand:before,\n.ion-arrow-graph-down-left:before,\n.ion-arrow-graph-down-right:before,\n.ion-arrow-graph-up-left:before,\n.ion-arrow-graph-up-right:before,\n.ion-arrow-left-a:before,\n.ion-arrow-left-b:before,\n.ion-arrow-left-c:before,\n.ion-arrow-move:before,\n.ion-arrow-resize:before,\n.ion-arrow-return-left:before,\n.ion-arrow-return-right:before,\n.ion-arrow-right-a:before,\n.ion-arrow-right-b:before,\n.ion-arrow-right-c:before,\n.ion-arrow-shrink:before,\n.ion-arrow-swap:before,\n.ion-arrow-up-a:before,\n.ion-arrow-up-b:before,\n.ion-arrow-up-c:before,\n.ion-asterisk:before,\n.ion-at:before,\n.ion-backspace:before,\n.ion-backspace-outline:before,\n.ion-bag:before,\n.ion-battery-charging:before,\n.ion-battery-empty:before,\n.ion-battery-full:before,\n.ion-battery-half:before,\n.ion-battery-low:before,\n.ion-beaker:before,\n.ion-beer:before,\n.ion-bluetooth:before,\n.ion-bonfire:before,\n.ion-bookmark:before,\n.ion-bowtie:before,\n.ion-briefcase:before,\n.ion-bug:before,\n.ion-calculator:before,\n.ion-calendar:before,\n.ion-camera:before,\n.ion-card:before,\n.ion-cash:before,\n.ion-chatbox:before,\n.ion-chatbox-working:before,\n.ion-chatboxes:before,\n.ion-chatbubble:before,\n.ion-chatbubble-working:before,\n.ion-chatbubbles:before,\n.ion-checkmark:before,\n.ion-checkmark-circled:before,\n.ion-checkmark-round:before,\n.ion-chevron-down:before,\n.ion-chevron-left:before,\n.ion-chevron-right:before,\n.ion-chevron-up:before,\n.ion-clipboard:before,\n.ion-clock:before,\n.ion-close:before,\n.ion-close-circled:before,\n.ion-close-round:before,\n.ion-closed-captioning:before,\n.ion-cloud:before,\n.ion-code:before,\n.ion-code-download:before,\n.ion-code-working:before,\n.ion-coffee:before,\n.ion-compass:before,\n.ion-compose:before,\n.ion-connection-bars:before,\n.ion-contrast:before,\n.ion-crop:before,\n.ion-cube:before,\n.ion-disc:before,\n.ion-document:before,\n.ion-document-text:before,\n.ion-drag:before,\n.ion-earth:before,\n.ion-easel:before,\n.ion-edit:before,\n.ion-egg:before,\n.ion-eject:before,\n.ion-email:before,\n.ion-email-unread:before,\n.ion-erlenmeyer-flask:before,\n.ion-erlenmeyer-flask-bubbles:before,\n.ion-eye:before,\n.ion-eye-disabled:before,\n.ion-female:before,\n.ion-filing:before,\n.ion-film-marker:before,\n.ion-fireball:before,\n.ion-flag:before,\n.ion-flame:before,\n.ion-flash:before,\n.ion-flash-off:before,\n.ion-folder:before,\n.ion-fork:before,\n.ion-fork-repo:before,\n.ion-forward:before,\n.ion-funnel:before,\n.ion-gear-a:before,\n.ion-gear-b:before,\n.ion-grid:before,\n.ion-hammer:before,\n.ion-happy:before,\n.ion-happy-outline:before,\n.ion-headphone:before,\n.ion-heart:before,\n.ion-heart-broken:before,\n.ion-help:before,\n.ion-help-buoy:before,\n.ion-help-circled:before,\n.ion-home:before,\n.ion-icecream:before,\n.ion-image:before,\n.ion-images:before,\n.ion-information:before,\n.ion-information-circled:before,\n.ion-ionic:before,\n.ion-ios-alarm:before,\n.ion-ios-alarm-outline:before,\n.ion-ios-albums:before,\n.ion-ios-albums-outline:before,\n.ion-ios-americanfootball:before,\n.ion-ios-americanfootball-outline:before,\n.ion-ios-analytics:before,\n.ion-ios-analytics-outline:before,\n.ion-ios-arrow-back:before,\n.ion-ios-arrow-down:before,\n.ion-ios-arrow-forward:before,\n.ion-ios-arrow-left:before,\n.ion-ios-arrow-right:before,\n.ion-ios-arrow-thin-down:before,\n.ion-ios-arrow-thin-left:before,\n.ion-ios-arrow-thin-right:before,\n.ion-ios-arrow-thin-up:before,\n.ion-ios-arrow-up:before,\n.ion-ios-at:before,\n.ion-ios-at-outline:before,\n.ion-ios-barcode:before,\n.ion-ios-barcode-outline:before,\n.ion-ios-baseball:before,\n.ion-ios-baseball-outline:before,\n.ion-ios-basketball:before,\n.ion-ios-basketball-outline:before,\n.ion-ios-bell:before,\n.ion-ios-bell-outline:before,\n.ion-ios-body:before,\n.ion-ios-body-outline:before,\n.ion-ios-bolt:before,\n.ion-ios-bolt-outline:before,\n.ion-ios-book:before,\n.ion-ios-book-outline:before,\n.ion-ios-bookmarks:before,\n.ion-ios-bookmarks-outline:before,\n.ion-ios-box:before,\n.ion-ios-box-outline:before,\n.ion-ios-briefcase:before,\n.ion-ios-briefcase-outline:before,\n.ion-ios-browsers:before,\n.ion-ios-browsers-outline:before,\n.ion-ios-calculator:before,\n.ion-ios-calculator-outline:before,\n.ion-ios-calendar:before,\n.ion-ios-calendar-outline:before,\n.ion-ios-camera:before,\n.ion-ios-camera-outline:before,\n.ion-ios-cart:before,\n.ion-ios-cart-outline:before,\n.ion-ios-chatboxes:before,\n.ion-ios-chatboxes-outline:before,\n.ion-ios-chatbubble:before,\n.ion-ios-chatbubble-outline:before,\n.ion-ios-checkmark:before,\n.ion-ios-checkmark-empty:before,\n.ion-ios-checkmark-outline:before,\n.ion-ios-circle-filled:before,\n.ion-ios-circle-outline:before,\n.ion-ios-clock:before,\n.ion-ios-clock-outline:before,\n.ion-ios-close:before,\n.ion-ios-close-empty:before,\n.ion-ios-close-outline:before,\n.ion-ios-cloud:before,\n.ion-ios-cloud-download:before,\n.ion-ios-cloud-download-outline:before,\n.ion-ios-cloud-outline:before,\n.ion-ios-cloud-upload:before,\n.ion-ios-cloud-upload-outline:before,\n.ion-ios-cloudy:before,\n.ion-ios-cloudy-night:before,\n.ion-ios-cloudy-night-outline:before,\n.ion-ios-cloudy-outline:before,\n.ion-ios-cog:before,\n.ion-ios-cog-outline:before,\n.ion-ios-color-filter:before,\n.ion-ios-color-filter-outline:before,\n.ion-ios-color-wand:before,\n.ion-ios-color-wand-outline:before,\n.ion-ios-compose:before,\n.ion-ios-compose-outline:before,\n.ion-ios-contact:before,\n.ion-ios-contact-outline:before,\n.ion-ios-copy:before,\n.ion-ios-copy-outline:before,\n.ion-ios-crop:before,\n.ion-ios-crop-strong:before,\n.ion-ios-download:before,\n.ion-ios-download-outline:before,\n.ion-ios-drag:before,\n.ion-ios-email:before,\n.ion-ios-email-outline:before,\n.ion-ios-eye:before,\n.ion-ios-eye-outline:before,\n.ion-ios-fastforward:before,\n.ion-ios-fastforward-outline:before,\n.ion-ios-filing:before,\n.ion-ios-filing-outline:before,\n.ion-ios-film:before,\n.ion-ios-film-outline:before,\n.ion-ios-flag:before,\n.ion-ios-flag-outline:before,\n.ion-ios-flame:before,\n.ion-ios-flame-outline:before,\n.ion-ios-flask:before,\n.ion-ios-flask-outline:before,\n.ion-ios-flower:before,\n.ion-ios-flower-outline:before,\n.ion-ios-folder:before,\n.ion-ios-folder-outline:before,\n.ion-ios-football:before,\n.ion-ios-football-outline:before,\n.ion-ios-game-controller-a:before,\n.ion-ios-game-controller-a-outline:before,\n.ion-ios-game-controller-b:before,\n.ion-ios-game-controller-b-outline:before,\n.ion-ios-gear:before,\n.ion-ios-gear-outline:before,\n.ion-ios-glasses:before,\n.ion-ios-glasses-outline:before,\n.ion-ios-grid-view:before,\n.ion-ios-grid-view-outline:before,\n.ion-ios-heart:before,\n.ion-ios-heart-outline:before,\n.ion-ios-help:before,\n.ion-ios-help-empty:before,\n.ion-ios-help-outline:before,\n.ion-ios-home:before,\n.ion-ios-home-outline:before,\n.ion-ios-infinite:before,\n.ion-ios-infinite-outline:before,\n.ion-ios-information:before,\n.ion-ios-information-empty:before,\n.ion-ios-information-outline:before,\n.ion-ios-ionic-outline:before,\n.ion-ios-keypad:before,\n.ion-ios-keypad-outline:before,\n.ion-ios-lightbulb:before,\n.ion-ios-lightbulb-outline:before,\n.ion-ios-list:before,\n.ion-ios-list-outline:before,\n.ion-ios-location:before,\n.ion-ios-location-outline:before,\n.ion-ios-locked:before,\n.ion-ios-locked-outline:before,\n.ion-ios-loop:before,\n.ion-ios-loop-strong:before,\n.ion-ios-medical:before,\n.ion-ios-medical-outline:before,\n.ion-ios-medkit:before,\n.ion-ios-medkit-outline:before,\n.ion-ios-mic:before,\n.ion-ios-mic-off:before,\n.ion-ios-mic-outline:before,\n.ion-ios-minus:before,\n.ion-ios-minus-empty:before,\n.ion-ios-minus-outline:before,\n.ion-ios-monitor:before,\n.ion-ios-monitor-outline:before,\n.ion-ios-moon:before,\n.ion-ios-moon-outline:before,\n.ion-ios-more:before,\n.ion-ios-more-outline:before,\n.ion-ios-musical-note:before,\n.ion-ios-musical-notes:before,\n.ion-ios-navigate:before,\n.ion-ios-navigate-outline:before,\n.ion-ios-nutrition:before,\n.ion-ios-nutrition-outline:before,\n.ion-ios-paper:before,\n.ion-ios-paper-outline:before,\n.ion-ios-paperplane:before,\n.ion-ios-paperplane-outline:before,\n.ion-ios-partlysunny:before,\n.ion-ios-partlysunny-outline:before,\n.ion-ios-pause:before,\n.ion-ios-pause-outline:before,\n.ion-ios-paw:before,\n.ion-ios-paw-outline:before,\n.ion-ios-people:before,\n.ion-ios-people-outline:before,\n.ion-ios-person:before,\n.ion-ios-person-outline:before,\n.ion-ios-personadd:before,\n.ion-ios-personadd-outline:before,\n.ion-ios-photos:before,\n.ion-ios-photos-outline:before,\n.ion-ios-pie:before,\n.ion-ios-pie-outline:before,\n.ion-ios-pint:before,\n.ion-ios-pint-outline:before,\n.ion-ios-play:before,\n.ion-ios-play-outline:before,\n.ion-ios-plus:before,\n.ion-ios-plus-empty:before,\n.ion-ios-plus-outline:before,\n.ion-ios-pricetag:before,\n.ion-ios-pricetag-outline:before,\n.ion-ios-pricetags:before,\n.ion-ios-pricetags-outline:before,\n.ion-ios-printer:before,\n.ion-ios-printer-outline:before,\n.ion-ios-pulse:before,\n.ion-ios-pulse-strong:before,\n.ion-ios-rainy:before,\n.ion-ios-rainy-outline:before,\n.ion-ios-recording:before,\n.ion-ios-recording-outline:before,\n.ion-ios-redo:before,\n.ion-ios-redo-outline:before,\n.ion-ios-refresh:before,\n.ion-ios-refresh-empty:before,\n.ion-ios-refresh-outline:before,\n.ion-ios-reload:before,\n.ion-ios-reverse-camera:before,\n.ion-ios-reverse-camera-outline:before,\n.ion-ios-rewind:before,\n.ion-ios-rewind-outline:before,\n.ion-ios-rose:before,\n.ion-ios-rose-outline:before,\n.ion-ios-search:before,\n.ion-ios-search-strong:before,\n.ion-ios-settings:before,\n.ion-ios-settings-strong:before,\n.ion-ios-shuffle:before,\n.ion-ios-shuffle-strong:before,\n.ion-ios-skipbackward:before,\n.ion-ios-skipbackward-outline:before,\n.ion-ios-skipforward:before,\n.ion-ios-skipforward-outline:before,\n.ion-ios-snowy:before,\n.ion-ios-speedometer:before,\n.ion-ios-speedometer-outline:before,\n.ion-ios-star:before,\n.ion-ios-star-half:before,\n.ion-ios-star-outline:before,\n.ion-ios-stopwatch:before,\n.ion-ios-stopwatch-outline:before,\n.ion-ios-sunny:before,\n.ion-ios-sunny-outline:before,\n.ion-ios-telephone:before,\n.ion-ios-telephone-outline:before,\n.ion-ios-tennisball:before,\n.ion-ios-tennisball-outline:before,\n.ion-ios-thunderstorm:before,\n.ion-ios-thunderstorm-outline:before,\n.ion-ios-time:before,\n.ion-ios-time-outline:before,\n.ion-ios-timer:before,\n.ion-ios-timer-outline:before,\n.ion-ios-toggle:before,\n.ion-ios-toggle-outline:before,\n.ion-ios-trash:before,\n.ion-ios-trash-outline:before,\n.ion-ios-undo:before,\n.ion-ios-undo-outline:before,\n.ion-ios-unlocked:before,\n.ion-ios-unlocked-outline:before,\n.ion-ios-upload:before,\n.ion-ios-upload-outline:before,\n.ion-ios-videocam:before,\n.ion-ios-videocam-outline:before,\n.ion-ios-volume-high:before,\n.ion-ios-volume-low:before,\n.ion-ios-wineglass:before,\n.ion-ios-wineglass-outline:before,\n.ion-ios-world:before,\n.ion-ios-world-outline:before,\n.ion-ipad:before,\n.ion-iphone:before,\n.ion-ipod:before,\n.ion-jet:before,\n.ion-key:before,\n.ion-knife:before,\n.ion-laptop:before,\n.ion-leaf:before,\n.ion-levels:before,\n.ion-lightbulb:before,\n.ion-link:before,\n.ion-load-a:before,\n.ion-load-b:before,\n.ion-load-c:before,\n.ion-load-d:before,\n.ion-location:before,\n.ion-lock-combination:before,\n.ion-locked:before,\n.ion-log-in:before,\n.ion-log-out:before,\n.ion-loop:before,\n.ion-magnet:before,\n.ion-male:before,\n.ion-man:before,\n.ion-map:before,\n.ion-medkit:before,\n.ion-merge:before,\n.ion-mic-a:before,\n.ion-mic-b:before,\n.ion-mic-c:before,\n.ion-minus:before,\n.ion-minus-circled:before,\n.ion-minus-round:before,\n.ion-model-s:before,\n.ion-monitor:before,\n.ion-more:before,\n.ion-mouse:before,\n.ion-music-note:before,\n.ion-navicon:before,\n.ion-navicon-round:before,\n.ion-navigate:before,\n.ion-network:before,\n.ion-no-smoking:before,\n.ion-nuclear:before,\n.ion-outlet:before,\n.ion-paintbrush:before,\n.ion-paintbucket:before,\n.ion-paper-airplane:before,\n.ion-paperclip:before,\n.ion-pause:before,\n.ion-person:before,\n.ion-person-add:before,\n.ion-person-stalker:before,\n.ion-pie-graph:before,\n.ion-pin:before,\n.ion-pinpoint:before,\n.ion-pizza:before,\n.ion-plane:before,\n.ion-planet:before,\n.ion-play:before,\n.ion-playstation:before,\n.ion-plus:before,\n.ion-plus-circled:before,\n.ion-plus-round:before,\n.ion-podium:before,\n.ion-pound:before,\n.ion-power:before,\n.ion-pricetag:before,\n.ion-pricetags:before,\n.ion-printer:before,\n.ion-pull-request:before,\n.ion-qr-scanner:before,\n.ion-quote:before,\n.ion-radio-waves:before,\n.ion-record:before,\n.ion-refresh:before,\n.ion-reply:before,\n.ion-reply-all:before,\n.ion-ribbon-a:before,\n.ion-ribbon-b:before,\n.ion-sad:before,\n.ion-sad-outline:before,\n.ion-scissors:before,\n.ion-search:before,\n.ion-settings:before,\n.ion-share:before,\n.ion-shuffle:before,\n.ion-skip-backward:before,\n.ion-skip-forward:before,\n.ion-social-android:before,\n.ion-social-android-outline:before,\n.ion-social-angular:before,\n.ion-social-angular-outline:before,\n.ion-social-apple:before,\n.ion-social-apple-outline:before,\n.ion-social-bitcoin:before,\n.ion-social-bitcoin-outline:before,\n.ion-social-buffer:before,\n.ion-social-buffer-outline:before,\n.ion-social-chrome:before,\n.ion-social-chrome-outline:before,\n.ion-social-codepen:before,\n.ion-social-codepen-outline:before,\n.ion-social-css3:before,\n.ion-social-css3-outline:before,\n.ion-social-designernews:before,\n.ion-social-designernews-outline:before,\n.ion-social-dribbble:before,\n.ion-social-dribbble-outline:before,\n.ion-social-dropbox:before,\n.ion-social-dropbox-outline:before,\n.ion-social-euro:before,\n.ion-social-euro-outline:before,\n.ion-social-facebook:before,\n.ion-social-facebook-outline:before,\n.ion-social-foursquare:before,\n.ion-social-foursquare-outline:before,\n.ion-social-freebsd-devil:before,\n.ion-social-github:before,\n.ion-social-github-outline:before,\n.ion-social-google:before,\n.ion-social-google-outline:before,\n.ion-social-googleplus:before,\n.ion-social-googleplus-outline:before,\n.ion-social-hackernews:before,\n.ion-social-hackernews-outline:before,\n.ion-social-html5:before,\n.ion-social-html5-outline:before,\n.ion-social-instagram:before,\n.ion-social-instagram-outline:before,\n.ion-social-javascript:before,\n.ion-social-javascript-outline:before,\n.ion-social-linkedin:before,\n.ion-social-linkedin-outline:before,\n.ion-social-markdown:before,\n.ion-social-nodejs:before,\n.ion-social-octocat:before,\n.ion-social-pinterest:before,\n.ion-social-pinterest-outline:before,\n.ion-social-python:before,\n.ion-social-reddit:before,\n.ion-social-reddit-outline:before,\n.ion-social-rss:before,\n.ion-social-rss-outline:before,\n.ion-social-sass:before,\n.ion-social-skype:before,\n.ion-social-skype-outline:before,\n.ion-social-snapchat:before,\n.ion-social-snapchat-outline:before,\n.ion-social-tumblr:before,\n.ion-social-tumblr-outline:before,\n.ion-social-tux:before,\n.ion-social-twitch:before,\n.ion-social-twitch-outline:before,\n.ion-social-twitter:before,\n.ion-social-twitter-outline:before,\n.ion-social-usd:before,\n.ion-social-usd-outline:before,\n.ion-social-vimeo:before,\n.ion-social-vimeo-outline:before,\n.ion-social-whatsapp:before,\n.ion-social-whatsapp-outline:before,\n.ion-social-windows:before,\n.ion-social-windows-outline:before,\n.ion-social-wordpress:before,\n.ion-social-wordpress-outline:before,\n.ion-social-yahoo:before,\n.ion-social-yahoo-outline:before,\n.ion-social-yen:before,\n.ion-social-yen-outline:before,\n.ion-social-youtube:before,\n.ion-social-youtube-outline:before,\n.ion-soup-can:before,\n.ion-soup-can-outline:before,\n.ion-speakerphone:before,\n.ion-speedometer:before,\n.ion-spoon:before,\n.ion-star:before,\n.ion-stats-bars:before,\n.ion-steam:before,\n.ion-stop:before,\n.ion-thermometer:before,\n.ion-thumbsdown:before,\n.ion-thumbsup:before,\n.ion-toggle:before,\n.ion-toggle-filled:before,\n.ion-transgender:before,\n.ion-trash-a:before,\n.ion-trash-b:before,\n.ion-trophy:before,\n.ion-tshirt:before,\n.ion-tshirt-outline:before,\n.ion-umbrella:before,\n.ion-university:before,\n.ion-unlocked:before,\n.ion-upload:before,\n.ion-usb:before,\n.ion-videocamera:before,\n.ion-volume-high:before,\n.ion-volume-low:before,\n.ion-volume-medium:before,\n.ion-volume-mute:before,\n.ion-wand:before,\n.ion-waterdrop:before,\n.ion-wifi:before,\n.ion-wineglass:before,\n.ion-woman:before,\n.ion-wrench:before,\n.ion-xbox:before {\n  display: inline-block;\n  font-family: \"Ionicons\";\n  speak: none;\n  font-style: normal;\n  font-weight: normal;\n  font-variant: normal;\n  text-transform: none;\n  text-rendering: auto;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale; }\n\n.ion-alert:before {\n  content: \"\"; }\n\n.ion-alert-circled:before {\n  content: \"\"; }\n\n.ion-android-add:before {\n  content: \"\"; }\n\n.ion-android-add-circle:before {\n  content: \"\"; }\n\n.ion-android-alarm-clock:before {\n  content: \"\"; }\n\n.ion-android-alert:before {\n  content: \"\"; }\n\n.ion-android-apps:before {\n  content: \"\"; }\n\n.ion-android-archive:before {\n  content: \"\"; }\n\n.ion-android-arrow-back:before {\n  content: \"\"; }\n\n.ion-android-arrow-down:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropdown:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropdown-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropleft:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropleft-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropright:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropright-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropup:before {\n  content: \"\"; }\n\n.ion-android-arrow-dropup-circle:before {\n  content: \"\"; }\n\n.ion-android-arrow-forward:before {\n  content: \"\"; }\n\n.ion-android-arrow-up:before {\n  content: \"\"; }\n\n.ion-android-attach:before {\n  content: \"\"; }\n\n.ion-android-bar:before {\n  content: \"\"; }\n\n.ion-android-bicycle:before {\n  content: \"\"; }\n\n.ion-android-boat:before {\n  content: \"\"; }\n\n.ion-android-bookmark:before {\n  content: \"\"; }\n\n.ion-android-bulb:before {\n  content: \"\"; }\n\n.ion-android-bus:before {\n  content: \"\"; }\n\n.ion-android-calendar:before {\n  content: \"\"; }\n\n.ion-android-call:before {\n  content: \"\"; }\n\n.ion-android-camera:before {\n  content: \"\"; }\n\n.ion-android-cancel:before {\n  content: \"\"; }\n\n.ion-android-car:before {\n  content: \"\"; }\n\n.ion-android-cart:before {\n  content: \"\"; }\n\n.ion-android-chat:before {\n  content: \"\"; }\n\n.ion-android-checkbox:before {\n  content: \"\"; }\n\n.ion-android-checkbox-blank:before {\n  content: \"\"; }\n\n.ion-android-checkbox-outline:before {\n  content: \"\"; }\n\n.ion-android-checkbox-outline-blank:before {\n  content: \"\"; }\n\n.ion-android-checkmark-circle:before {\n  content: \"\"; }\n\n.ion-android-clipboard:before {\n  content: \"\"; }\n\n.ion-android-close:before {\n  content: \"\"; }\n\n.ion-android-cloud:before {\n  content: \"\"; }\n\n.ion-android-cloud-circle:before {\n  content: \"\"; }\n\n.ion-android-cloud-done:before {\n  content: \"\"; }\n\n.ion-android-cloud-outline:before {\n  content: \"\"; }\n\n.ion-android-color-palette:before {\n  content: \"\"; }\n\n.ion-android-compass:before {\n  content: \"\"; }\n\n.ion-android-contact:before {\n  content: \"\"; }\n\n.ion-android-contacts:before {\n  content: \"\"; }\n\n.ion-android-contract:before {\n  content: \"\"; }\n\n.ion-android-create:before {\n  content: \"\"; }\n\n.ion-android-delete:before {\n  content: \"\"; }\n\n.ion-android-desktop:before {\n  content: \"\"; }\n\n.ion-android-document:before {\n  content: \"\"; }\n\n.ion-android-done:before {\n  content: \"\"; }\n\n.ion-android-done-all:before {\n  content: \"\"; }\n\n.ion-android-download:before {\n  content: \"\"; }\n\n.ion-android-drafts:before {\n  content: \"\"; }\n\n.ion-android-exit:before {\n  content: \"\"; }\n\n.ion-android-expand:before {\n  content: \"\"; }\n\n.ion-android-favorite:before {\n  content: \"\"; }\n\n.ion-android-favorite-outline:before {\n  content: \"\"; }\n\n.ion-android-film:before {\n  content: \"\"; }\n\n.ion-android-folder:before {\n  content: \"\"; }\n\n.ion-android-folder-open:before {\n  content: \"\"; }\n\n.ion-android-funnel:before {\n  content: \"\"; }\n\n.ion-android-globe:before {\n  content: \"\"; }\n\n.ion-android-hand:before {\n  content: \"\"; }\n\n.ion-android-hangout:before {\n  content: \"\"; }\n\n.ion-android-happy:before {\n  content: \"\"; }\n\n.ion-android-home:before {\n  content: \"\"; }\n\n.ion-android-image:before {\n  content: \"\"; }\n\n.ion-android-laptop:before {\n  content: \"\"; }\n\n.ion-android-list:before {\n  content: \"\"; }\n\n.ion-android-locate:before {\n  content: \"\"; }\n\n.ion-android-lock:before {\n  content: \"\"; }\n\n.ion-android-mail:before {\n  content: \"\"; }\n\n.ion-android-map:before {\n  content: \"\"; }\n\n.ion-android-menu:before {\n  content: \"\"; }\n\n.ion-android-microphone:before {\n  content: \"\"; }\n\n.ion-android-microphone-off:before {\n  content: \"\"; }\n\n.ion-android-more-horizontal:before {\n  content: \"\"; }\n\n.ion-android-more-vertical:before {\n  content: \"\"; }\n\n.ion-android-navigate:before {\n  content: \"\"; }\n\n.ion-android-notifications:before {\n  content: \"\"; }\n\n.ion-android-notifications-none:before {\n  content: \"\"; }\n\n.ion-android-notifications-off:before {\n  content: \"\"; }\n\n.ion-android-open:before {\n  content: \"\"; }\n\n.ion-android-options:before {\n  content: \"\"; }\n\n.ion-android-people:before {\n  content: \"\"; }\n\n.ion-android-person:before {\n  content: \"\"; }\n\n.ion-android-person-add:before {\n  content: \"\"; }\n\n.ion-android-phone-landscape:before {\n  content: \"\"; }\n\n.ion-android-phone-portrait:before {\n  content: \"\"; }\n\n.ion-android-pin:before {\n  content: \"\"; }\n\n.ion-android-plane:before {\n  content: \"\"; }\n\n.ion-android-playstore:before {\n  content: \"\"; }\n\n.ion-android-print:before {\n  content: \"\"; }\n\n.ion-android-radio-button-off:before {\n  content: \"\"; }\n\n.ion-android-radio-button-on:before {\n  content: \"\"; }\n\n.ion-android-refresh:before {\n  content: \"\"; }\n\n.ion-android-remove:before {\n  content: \"\"; }\n\n.ion-android-remove-circle:before {\n  content: \"\"; }\n\n.ion-android-restaurant:before {\n  content: \"\"; }\n\n.ion-android-sad:before {\n  content: \"\"; }\n\n.ion-android-search:before {\n  content: \"\"; }\n\n.ion-android-send:before {\n  content: \"\"; }\n\n.ion-android-settings:before {\n  content: \"\"; }\n\n.ion-android-share:before {\n  content: \"\"; }\n\n.ion-android-share-alt:before {\n  content: \"\"; }\n\n.ion-android-star:before {\n  content: \"\"; }\n\n.ion-android-star-half:before {\n  content: \"\"; }\n\n.ion-android-star-outline:before {\n  content: \"\"; }\n\n.ion-android-stopwatch:before {\n  content: \"\"; }\n\n.ion-android-subway:before {\n  content: \"\"; }\n\n.ion-android-sunny:before {\n  content: \"\"; }\n\n.ion-android-sync:before {\n  content: \"\"; }\n\n.ion-android-textsms:before {\n  content: \"\"; }\n\n.ion-android-time:before {\n  content: \"\"; }\n\n.ion-android-train:before {\n  content: \"\"; }\n\n.ion-android-unlock:before {\n  content: \"\"; }\n\n.ion-android-upload:before {\n  content: \"\"; }\n\n.ion-android-volume-down:before {\n  content: \"\"; }\n\n.ion-android-volume-mute:before {\n  content: \"\"; }\n\n.ion-android-volume-off:before {\n  content: \"\"; }\n\n.ion-android-volume-up:before {\n  content: \"\"; }\n\n.ion-android-walk:before {\n  content: \"\"; }\n\n.ion-android-warning:before {\n  content: \"\"; }\n\n.ion-android-watch:before {\n  content: \"\"; }\n\n.ion-android-wifi:before {\n  content: \"\"; }\n\n.ion-aperture:before {\n  content: \"\"; }\n\n.ion-archive:before {\n  content: \"\"; }\n\n.ion-arrow-down-a:before {\n  content: \"\"; }\n\n.ion-arrow-down-b:before {\n  content: \"\"; }\n\n.ion-arrow-down-c:before {\n  content: \"\"; }\n\n.ion-arrow-expand:before {\n  content: \"\"; }\n\n.ion-arrow-graph-down-left:before {\n  content: \"\"; }\n\n.ion-arrow-graph-down-right:before {\n  content: \"\"; }\n\n.ion-arrow-graph-up-left:before {\n  content: \"\"; }\n\n.ion-arrow-graph-up-right:before {\n  content: \"\"; }\n\n.ion-arrow-left-a:before {\n  content: \"\"; }\n\n.ion-arrow-left-b:before {\n  content: \"\"; }\n\n.ion-arrow-left-c:before {\n  content: \"\"; }\n\n.ion-arrow-move:before {\n  content: \"\"; }\n\n.ion-arrow-resize:before {\n  content: \"\"; }\n\n.ion-arrow-return-left:before {\n  content: \"\"; }\n\n.ion-arrow-return-right:before {\n  content: \"\"; }\n\n.ion-arrow-right-a:before {\n  content: \"\"; }\n\n.ion-arrow-right-b:before {\n  content: \"\"; }\n\n.ion-arrow-right-c:before {\n  content: \"\"; }\n\n.ion-arrow-shrink:before {\n  content: \"\"; }\n\n.ion-arrow-swap:before {\n  content: \"\"; }\n\n.ion-arrow-up-a:before {\n  content: \"\"; }\n\n.ion-arrow-up-b:before {\n  content: \"\"; }\n\n.ion-arrow-up-c:before {\n  content: \"\"; }\n\n.ion-asterisk:before {\n  content: \"\"; }\n\n.ion-at:before {\n  content: \"\"; }\n\n.ion-backspace:before {\n  content: \"\"; }\n\n.ion-backspace-outline:before {\n  content: \"\"; }\n\n.ion-bag:before {\n  content: \"\"; }\n\n.ion-battery-charging:before {\n  content: \"\"; }\n\n.ion-battery-empty:before {\n  content: \"\"; }\n\n.ion-battery-full:before {\n  content: \"\"; }\n\n.ion-battery-half:before {\n  content: \"\"; }\n\n.ion-battery-low:before {\n  content: \"\"; }\n\n.ion-beaker:before {\n  content: \"\"; }\n\n.ion-beer:before {\n  content: \"\"; }\n\n.ion-bluetooth:before {\n  content: \"\"; }\n\n.ion-bonfire:before {\n  content: \"\"; }\n\n.ion-bookmark:before {\n  content: \"\"; }\n\n.ion-bowtie:before {\n  content: \"\"; }\n\n.ion-briefcase:before {\n  content: \"\"; }\n\n.ion-bug:before {\n  content: \"\"; }\n\n.ion-calculator:before {\n  content: \"\"; }\n\n.ion-calendar:before {\n  content: \"\"; }\n\n.ion-camera:before {\n  content: \"\"; }\n\n.ion-card:before {\n  content: \"\"; }\n\n.ion-cash:before {\n  content: \"\"; }\n\n.ion-chatbox:before {\n  content: \"\"; }\n\n.ion-chatbox-working:before {\n  content: \"\"; }\n\n.ion-chatboxes:before {\n  content: \"\"; }\n\n.ion-chatbubble:before {\n  content: \"\"; }\n\n.ion-chatbubble-working:before {\n  content: \"\"; }\n\n.ion-chatbubbles:before {\n  content: \"\"; }\n\n.ion-checkmark:before {\n  content: \"\"; }\n\n.ion-checkmark-circled:before {\n  content: \"\"; }\n\n.ion-checkmark-round:before {\n  content: \"\"; }\n\n.ion-chevron-down:before {\n  content: \"\"; }\n\n.ion-chevron-left:before {\n  content: \"\"; }\n\n.ion-chevron-right:before {\n  content: \"\"; }\n\n.ion-chevron-up:before {\n  content: \"\"; }\n\n.ion-clipboard:before {\n  content: \"\"; }\n\n.ion-clock:before {\n  content: \"\"; }\n\n.ion-close:before {\n  content: \"\"; }\n\n.ion-close-circled:before {\n  content: \"\"; }\n\n.ion-close-round:before {\n  content: \"\"; }\n\n.ion-closed-captioning:before {\n  content: \"\"; }\n\n.ion-cloud:before {\n  content: \"\"; }\n\n.ion-code:before {\n  content: \"\"; }\n\n.ion-code-download:before {\n  content: \"\"; }\n\n.ion-code-working:before {\n  content: \"\"; }\n\n.ion-coffee:before {\n  content: \"\"; }\n\n.ion-compass:before {\n  content: \"\"; }\n\n.ion-compose:before {\n  content: \"\"; }\n\n.ion-connection-bars:before {\n  content: \"\"; }\n\n.ion-contrast:before {\n  content: \"\"; }\n\n.ion-crop:before {\n  content: \"\"; }\n\n.ion-cube:before {\n  content: \"\"; }\n\n.ion-disc:before {\n  content: \"\"; }\n\n.ion-document:before {\n  content: \"\"; }\n\n.ion-document-text:before {\n  content: \"\"; }\n\n.ion-drag:before {\n  content: \"\"; }\n\n.ion-earth:before {\n  content: \"\"; }\n\n.ion-easel:before {\n  content: \"\"; }\n\n.ion-edit:before {\n  content: \"\"; }\n\n.ion-egg:before {\n  content: \"\"; }\n\n.ion-eject:before {\n  content: \"\"; }\n\n.ion-email:before {\n  content: \"\"; }\n\n.ion-email-unread:before {\n  content: \"\"; }\n\n.ion-erlenmeyer-flask:before {\n  content: \"\"; }\n\n.ion-erlenmeyer-flask-bubbles:before {\n  content: \"\"; }\n\n.ion-eye:before {\n  content: \"\"; }\n\n.ion-eye-disabled:before {\n  content: \"\"; }\n\n.ion-female:before {\n  content: \"\"; }\n\n.ion-filing:before {\n  content: \"\"; }\n\n.ion-film-marker:before {\n  content: \"\"; }\n\n.ion-fireball:before {\n  content: \"\"; }\n\n.ion-flag:before {\n  content: \"\"; }\n\n.ion-flame:before {\n  content: \"\"; }\n\n.ion-flash:before {\n  content: \"\"; }\n\n.ion-flash-off:before {\n  content: \"\"; }\n\n.ion-folder:before {\n  content: \"\"; }\n\n.ion-fork:before {\n  content: \"\"; }\n\n.ion-fork-repo:before {\n  content: \"\"; }\n\n.ion-forward:before {\n  content: \"\"; }\n\n.ion-funnel:before {\n  content: \"\"; }\n\n.ion-gear-a:before {\n  content: \"\"; }\n\n.ion-gear-b:before {\n  content: \"\"; }\n\n.ion-grid:before {\n  content: \"\"; }\n\n.ion-hammer:before {\n  content: \"\"; }\n\n.ion-happy:before {\n  content: \"\"; }\n\n.ion-happy-outline:before {\n  content: \"\"; }\n\n.ion-headphone:before {\n  content: \"\"; }\n\n.ion-heart:before {\n  content: \"\"; }\n\n.ion-heart-broken:before {\n  content: \"\"; }\n\n.ion-help:before {\n  content: \"\"; }\n\n.ion-help-buoy:before {\n  content: \"\"; }\n\n.ion-help-circled:before {\n  content: \"\"; }\n\n.ion-home:before {\n  content: \"\"; }\n\n.ion-icecream:before {\n  content: \"\"; }\n\n.ion-image:before {\n  content: \"\"; }\n\n.ion-images:before {\n  content: \"\"; }\n\n.ion-information:before {\n  content: \"\"; }\n\n.ion-information-circled:before {\n  content: \"\"; }\n\n.ion-ionic:before {\n  content: \"\"; }\n\n.ion-ios-alarm:before {\n  content: \"\"; }\n\n.ion-ios-alarm-outline:before {\n  content: \"\"; }\n\n.ion-ios-albums:before {\n  content: \"\"; }\n\n.ion-ios-albums-outline:before {\n  content: \"\"; }\n\n.ion-ios-americanfootball:before {\n  content: \"\"; }\n\n.ion-ios-americanfootball-outline:before {\n  content: \"\"; }\n\n.ion-ios-analytics:before {\n  content: \"\"; }\n\n.ion-ios-analytics-outline:before {\n  content: \"\"; }\n\n.ion-ios-arrow-back:before {\n  content: \"\"; }\n\n.ion-ios-arrow-down:before {\n  content: \"\"; }\n\n.ion-ios-arrow-forward:before {\n  content: \"\"; }\n\n.ion-ios-arrow-left:before {\n  content: \"\"; }\n\n.ion-ios-arrow-right:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-down:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-left:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-right:before {\n  content: \"\"; }\n\n.ion-ios-arrow-thin-up:before {\n  content: \"\"; }\n\n.ion-ios-arrow-up:before {\n  content: \"\"; }\n\n.ion-ios-at:before {\n  content: \"\"; }\n\n.ion-ios-at-outline:before {\n  content: \"\"; }\n\n.ion-ios-barcode:before {\n  content: \"\"; }\n\n.ion-ios-barcode-outline:before {\n  content: \"\"; }\n\n.ion-ios-baseball:before {\n  content: \"\"; }\n\n.ion-ios-baseball-outline:before {\n  content: \"\"; }\n\n.ion-ios-basketball:before {\n  content: \"\"; }\n\n.ion-ios-basketball-outline:before {\n  content: \"\"; }\n\n.ion-ios-bell:before {\n  content: \"\"; }\n\n.ion-ios-bell-outline:before {\n  content: \"\"; }\n\n.ion-ios-body:before {\n  content: \"\"; }\n\n.ion-ios-body-outline:before {\n  content: \"\"; }\n\n.ion-ios-bolt:before {\n  content: \"\"; }\n\n.ion-ios-bolt-outline:before {\n  content: \"\"; }\n\n.ion-ios-book:before {\n  content: \"\"; }\n\n.ion-ios-book-outline:before {\n  content: \"\"; }\n\n.ion-ios-bookmarks:before {\n  content: \"\"; }\n\n.ion-ios-bookmarks-outline:before {\n  content: \"\"; }\n\n.ion-ios-box:before {\n  content: \"\"; }\n\n.ion-ios-box-outline:before {\n  content: \"\"; }\n\n.ion-ios-briefcase:before {\n  content: \"\"; }\n\n.ion-ios-briefcase-outline:before {\n  content: \"\"; }\n\n.ion-ios-browsers:before {\n  content: \"\"; }\n\n.ion-ios-browsers-outline:before {\n  content: \"\"; }\n\n.ion-ios-calculator:before {\n  content: \"\"; }\n\n.ion-ios-calculator-outline:before {\n  content: \"\"; }\n\n.ion-ios-calendar:before {\n  content: \"\"; }\n\n.ion-ios-calendar-outline:before {\n  content: \"\"; }\n\n.ion-ios-camera:before {\n  content: \"\"; }\n\n.ion-ios-camera-outline:before {\n  content: \"\"; }\n\n.ion-ios-cart:before {\n  content: \"\"; }\n\n.ion-ios-cart-outline:before {\n  content: \"\"; }\n\n.ion-ios-chatboxes:before {\n  content: \"\"; }\n\n.ion-ios-chatboxes-outline:before {\n  content: \"\"; }\n\n.ion-ios-chatbubble:before {\n  content: \"\"; }\n\n.ion-ios-chatbubble-outline:before {\n  content: \"\"; }\n\n.ion-ios-checkmark:before {\n  content: \"\"; }\n\n.ion-ios-checkmark-empty:before {\n  content: \"\"; }\n\n.ion-ios-checkmark-outline:before {\n  content: \"\"; }\n\n.ion-ios-circle-filled:before {\n  content: \"\"; }\n\n.ion-ios-circle-outline:before {\n  content: \"\"; }\n\n.ion-ios-clock:before {\n  content: \"\"; }\n\n.ion-ios-clock-outline:before {\n  content: \"\"; }\n\n.ion-ios-close:before {\n  content: \"\"; }\n\n.ion-ios-close-empty:before {\n  content: \"\"; }\n\n.ion-ios-close-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloud:before {\n  content: \"\"; }\n\n.ion-ios-cloud-download:before {\n  content: \"\"; }\n\n.ion-ios-cloud-download-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloud-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloud-upload:before {\n  content: \"\"; }\n\n.ion-ios-cloud-upload-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloudy:before {\n  content: \"\"; }\n\n.ion-ios-cloudy-night:before {\n  content: \"\"; }\n\n.ion-ios-cloudy-night-outline:before {\n  content: \"\"; }\n\n.ion-ios-cloudy-outline:before {\n  content: \"\"; }\n\n.ion-ios-cog:before {\n  content: \"\"; }\n\n.ion-ios-cog-outline:before {\n  content: \"\"; }\n\n.ion-ios-color-filter:before {\n  content: \"\"; }\n\n.ion-ios-color-filter-outline:before {\n  content: \"\"; }\n\n.ion-ios-color-wand:before {\n  content: \"\"; }\n\n.ion-ios-color-wand-outline:before {\n  content: \"\"; }\n\n.ion-ios-compose:before {\n  content: \"\"; }\n\n.ion-ios-compose-outline:before {\n  content: \"\"; }\n\n.ion-ios-contact:before {\n  content: \"\"; }\n\n.ion-ios-contact-outline:before {\n  content: \"\"; }\n\n.ion-ios-copy:before {\n  content: \"\"; }\n\n.ion-ios-copy-outline:before {\n  content: \"\"; }\n\n.ion-ios-crop:before {\n  content: \"\"; }\n\n.ion-ios-crop-strong:before {\n  content: \"\"; }\n\n.ion-ios-download:before {\n  content: \"\"; }\n\n.ion-ios-download-outline:before {\n  content: \"\"; }\n\n.ion-ios-drag:before {\n  content: \"\"; }\n\n.ion-ios-email:before {\n  content: \"\"; }\n\n.ion-ios-email-outline:before {\n  content: \"\"; }\n\n.ion-ios-eye:before {\n  content: \"\"; }\n\n.ion-ios-eye-outline:before {\n  content: \"\"; }\n\n.ion-ios-fastforward:before {\n  content: \"\"; }\n\n.ion-ios-fastforward-outline:before {\n  content: \"\"; }\n\n.ion-ios-filing:before {\n  content: \"\"; }\n\n.ion-ios-filing-outline:before {\n  content: \"\"; }\n\n.ion-ios-film:before {\n  content: \"\"; }\n\n.ion-ios-film-outline:before {\n  content: \"\"; }\n\n.ion-ios-flag:before {\n  content: \"\"; }\n\n.ion-ios-flag-outline:before {\n  content: \"\"; }\n\n.ion-ios-flame:before {\n  content: \"\"; }\n\n.ion-ios-flame-outline:before {\n  content: \"\"; }\n\n.ion-ios-flask:before {\n  content: \"\"; }\n\n.ion-ios-flask-outline:before {\n  content: \"\"; }\n\n.ion-ios-flower:before {\n  content: \"\"; }\n\n.ion-ios-flower-outline:before {\n  content: \"\"; }\n\n.ion-ios-folder:before {\n  content: \"\"; }\n\n.ion-ios-folder-outline:before {\n  content: \"\"; }\n\n.ion-ios-football:before {\n  content: \"\"; }\n\n.ion-ios-football-outline:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-a:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-a-outline:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-b:before {\n  content: \"\"; }\n\n.ion-ios-game-controller-b-outline:before {\n  content: \"\"; }\n\n.ion-ios-gear:before {\n  content: \"\"; }\n\n.ion-ios-gear-outline:before {\n  content: \"\"; }\n\n.ion-ios-glasses:before {\n  content: \"\"; }\n\n.ion-ios-glasses-outline:before {\n  content: \"\"; }\n\n.ion-ios-grid-view:before {\n  content: \"\"; }\n\n.ion-ios-grid-view-outline:before {\n  content: \"\"; }\n\n.ion-ios-heart:before {\n  content: \"\"; }\n\n.ion-ios-heart-outline:before {\n  content: \"\"; }\n\n.ion-ios-help:before {\n  content: \"\"; }\n\n.ion-ios-help-empty:before {\n  content: \"\"; }\n\n.ion-ios-help-outline:before {\n  content: \"\"; }\n\n.ion-ios-home:before {\n  content: \"\"; }\n\n.ion-ios-home-outline:before {\n  content: \"\"; }\n\n.ion-ios-infinite:before {\n  content: \"\"; }\n\n.ion-ios-infinite-outline:before {\n  content: \"\"; }\n\n.ion-ios-information:before {\n  content: \"\"; }\n\n.ion-ios-information-empty:before {\n  content: \"\"; }\n\n.ion-ios-information-outline:before {\n  content: \"\"; }\n\n.ion-ios-ionic-outline:before {\n  content: \"\"; }\n\n.ion-ios-keypad:before {\n  content: \"\"; }\n\n.ion-ios-keypad-outline:before {\n  content: \"\"; }\n\n.ion-ios-lightbulb:before {\n  content: \"\"; }\n\n.ion-ios-lightbulb-outline:before {\n  content: \"\"; }\n\n.ion-ios-list:before {\n  content: \"\"; }\n\n.ion-ios-list-outline:before {\n  content: \"\"; }\n\n.ion-ios-location:before {\n  content: \"\"; }\n\n.ion-ios-location-outline:before {\n  content: \"\"; }\n\n.ion-ios-locked:before {\n  content: \"\"; }\n\n.ion-ios-locked-outline:before {\n  content: \"\"; }\n\n.ion-ios-loop:before {\n  content: \"\"; }\n\n.ion-ios-loop-strong:before {\n  content: \"\"; }\n\n.ion-ios-medical:before {\n  content: \"\"; }\n\n.ion-ios-medical-outline:before {\n  content: \"\"; }\n\n.ion-ios-medkit:before {\n  content: \"\"; }\n\n.ion-ios-medkit-outline:before {\n  content: \"\"; }\n\n.ion-ios-mic:before {\n  content: \"\"; }\n\n.ion-ios-mic-off:before {\n  content: \"\"; }\n\n.ion-ios-mic-outline:before {\n  content: \"\"; }\n\n.ion-ios-minus:before {\n  content: \"\"; }\n\n.ion-ios-minus-empty:before {\n  content: \"\"; }\n\n.ion-ios-minus-outline:before {\n  content: \"\"; }\n\n.ion-ios-monitor:before {\n  content: \"\"; }\n\n.ion-ios-monitor-outline:before {\n  content: \"\"; }\n\n.ion-ios-moon:before {\n  content: \"\"; }\n\n.ion-ios-moon-outline:before {\n  content: \"\"; }\n\n.ion-ios-more:before {\n  content: \"\"; }\n\n.ion-ios-more-outline:before {\n  content: \"\"; }\n\n.ion-ios-musical-note:before {\n  content: \"\"; }\n\n.ion-ios-musical-notes:before {\n  content: \"\"; }\n\n.ion-ios-navigate:before {\n  content: \"\"; }\n\n.ion-ios-navigate-outline:before {\n  content: \"\"; }\n\n.ion-ios-nutrition:before {\n  content: \"\"; }\n\n.ion-ios-nutrition-outline:before {\n  content: \"\"; }\n\n.ion-ios-paper:before {\n  content: \"\"; }\n\n.ion-ios-paper-outline:before {\n  content: \"\"; }\n\n.ion-ios-paperplane:before {\n  content: \"\"; }\n\n.ion-ios-paperplane-outline:before {\n  content: \"\"; }\n\n.ion-ios-partlysunny:before {\n  content: \"\"; }\n\n.ion-ios-partlysunny-outline:before {\n  content: \"\"; }\n\n.ion-ios-pause:before {\n  content: \"\"; }\n\n.ion-ios-pause-outline:before {\n  content: \"\"; }\n\n.ion-ios-paw:before {\n  content: \"\"; }\n\n.ion-ios-paw-outline:before {\n  content: \"\"; }\n\n.ion-ios-people:before {\n  content: \"\"; }\n\n.ion-ios-people-outline:before {\n  content: \"\"; }\n\n.ion-ios-person:before {\n  content: \"\"; }\n\n.ion-ios-person-outline:before {\n  content: \"\"; }\n\n.ion-ios-personadd:before {\n  content: \"\"; }\n\n.ion-ios-personadd-outline:before {\n  content: \"\"; }\n\n.ion-ios-photos:before {\n  content: \"\"; }\n\n.ion-ios-photos-outline:before {\n  content: \"\"; }\n\n.ion-ios-pie:before {\n  content: \"\"; }\n\n.ion-ios-pie-outline:before {\n  content: \"\"; }\n\n.ion-ios-pint:before {\n  content: \"\"; }\n\n.ion-ios-pint-outline:before {\n  content: \"\"; }\n\n.ion-ios-play:before {\n  content: \"\"; }\n\n.ion-ios-play-outline:before {\n  content: \"\"; }\n\n.ion-ios-plus:before {\n  content: \"\"; }\n\n.ion-ios-plus-empty:before {\n  content: \"\"; }\n\n.ion-ios-plus-outline:before {\n  content: \"\"; }\n\n.ion-ios-pricetag:before {\n  content: \"\"; }\n\n.ion-ios-pricetag-outline:before {\n  content: \"\"; }\n\n.ion-ios-pricetags:before {\n  content: \"\"; }\n\n.ion-ios-pricetags-outline:before {\n  content: \"\"; }\n\n.ion-ios-printer:before {\n  content: \"\"; }\n\n.ion-ios-printer-outline:before {\n  content: \"\"; }\n\n.ion-ios-pulse:before {\n  content: \"\"; }\n\n.ion-ios-pulse-strong:before {\n  content: \"\"; }\n\n.ion-ios-rainy:before {\n  content: \"\"; }\n\n.ion-ios-rainy-outline:before {\n  content: \"\"; }\n\n.ion-ios-recording:before {\n  content: \"\"; }\n\n.ion-ios-recording-outline:before {\n  content: \"\"; }\n\n.ion-ios-redo:before {\n  content: \"\"; }\n\n.ion-ios-redo-outline:before {\n  content: \"\"; }\n\n.ion-ios-refresh:before {\n  content: \"\"; }\n\n.ion-ios-refresh-empty:before {\n  content: \"\"; }\n\n.ion-ios-refresh-outline:before {\n  content: \"\"; }\n\n.ion-ios-reload:before {\n  content: \"\"; }\n\n.ion-ios-reverse-camera:before {\n  content: \"\"; }\n\n.ion-ios-reverse-camera-outline:before {\n  content: \"\"; }\n\n.ion-ios-rewind:before {\n  content: \"\"; }\n\n.ion-ios-rewind-outline:before {\n  content: \"\"; }\n\n.ion-ios-rose:before {\n  content: \"\"; }\n\n.ion-ios-rose-outline:before {\n  content: \"\"; }\n\n.ion-ios-search:before {\n  content: \"\"; }\n\n.ion-ios-search-strong:before {\n  content: \"\"; }\n\n.ion-ios-settings:before {\n  content: \"\"; }\n\n.ion-ios-settings-strong:before {\n  content: \"\"; }\n\n.ion-ios-shuffle:before {\n  content: \"\"; }\n\n.ion-ios-shuffle-strong:before {\n  content: \"\"; }\n\n.ion-ios-skipbackward:before {\n  content: \"\"; }\n\n.ion-ios-skipbackward-outline:before {\n  content: \"\"; }\n\n.ion-ios-skipforward:before {\n  content: \"\"; }\n\n.ion-ios-skipforward-outline:before {\n  content: \"\"; }\n\n.ion-ios-snowy:before {\n  content: \"\"; }\n\n.ion-ios-speedometer:before {\n  content: \"\"; }\n\n.ion-ios-speedometer-outline:before {\n  content: \"\"; }\n\n.ion-ios-star:before {\n  content: \"\"; }\n\n.ion-ios-star-half:before {\n  content: \"\"; }\n\n.ion-ios-star-outline:before {\n  content: \"\"; }\n\n.ion-ios-stopwatch:before {\n  content: \"\"; }\n\n.ion-ios-stopwatch-outline:before {\n  content: \"\"; }\n\n.ion-ios-sunny:before {\n  content: \"\"; }\n\n.ion-ios-sunny-outline:before {\n  content: \"\"; }\n\n.ion-ios-telephone:before {\n  content: \"\"; }\n\n.ion-ios-telephone-outline:before {\n  content: \"\"; }\n\n.ion-ios-tennisball:before {\n  content: \"\"; }\n\n.ion-ios-tennisball-outline:before {\n  content: \"\"; }\n\n.ion-ios-thunderstorm:before {\n  content: \"\"; }\n\n.ion-ios-thunderstorm-outline:before {\n  content: \"\"; }\n\n.ion-ios-time:before {\n  content: \"\"; }\n\n.ion-ios-time-outline:before {\n  content: \"\"; }\n\n.ion-ios-timer:before {\n  content: \"\"; }\n\n.ion-ios-timer-outline:before {\n  content: \"\"; }\n\n.ion-ios-toggle:before {\n  content: \"\"; }\n\n.ion-ios-toggle-outline:before {\n  content: \"\"; }\n\n.ion-ios-trash:before {\n  content: \"\"; }\n\n.ion-ios-trash-outline:before {\n  content: \"\"; }\n\n.ion-ios-undo:before {\n  content: \"\"; }\n\n.ion-ios-undo-outline:before {\n  content: \"\"; }\n\n.ion-ios-unlocked:before {\n  content: \"\"; }\n\n.ion-ios-unlocked-outline:before {\n  content: \"\"; }\n\n.ion-ios-upload:before {\n  content: \"\"; }\n\n.ion-ios-upload-outline:before {\n  content: \"\"; }\n\n.ion-ios-videocam:before {\n  content: \"\"; }\n\n.ion-ios-videocam-outline:before {\n  content: \"\"; }\n\n.ion-ios-volume-high:before {\n  content: \"\"; }\n\n.ion-ios-volume-low:before {\n  content: \"\"; }\n\n.ion-ios-wineglass:before {\n  content: \"\"; }\n\n.ion-ios-wineglass-outline:before {\n  content: \"\"; }\n\n.ion-ios-world:before {\n  content: \"\"; }\n\n.ion-ios-world-outline:before {\n  content: \"\"; }\n\n.ion-ipad:before {\n  content: \"\"; }\n\n.ion-iphone:before {\n  content: \"\"; }\n\n.ion-ipod:before {\n  content: \"\"; }\n\n.ion-jet:before {\n  content: \"\"; }\n\n.ion-key:before {\n  content: \"\"; }\n\n.ion-knife:before {\n  content: \"\"; }\n\n.ion-laptop:before {\n  content: \"\"; }\n\n.ion-leaf:before {\n  content: \"\"; }\n\n.ion-levels:before {\n  content: \"\"; }\n\n.ion-lightbulb:before {\n  content: \"\"; }\n\n.ion-link:before {\n  content: \"\"; }\n\n.ion-load-a:before {\n  content: \"\"; }\n\n.ion-load-b:before {\n  content: \"\"; }\n\n.ion-load-c:before {\n  content: \"\"; }\n\n.ion-load-d:before {\n  content: \"\"; }\n\n.ion-location:before {\n  content: \"\"; }\n\n.ion-lock-combination:before {\n  content: \"\"; }\n\n.ion-locked:before {\n  content: \"\"; }\n\n.ion-log-in:before {\n  content: \"\"; }\n\n.ion-log-out:before {\n  content: \"\"; }\n\n.ion-loop:before {\n  content: \"\"; }\n\n.ion-magnet:before {\n  content: \"\"; }\n\n.ion-male:before {\n  content: \"\"; }\n\n.ion-man:before {\n  content: \"\"; }\n\n.ion-map:before {\n  content: \"\"; }\n\n.ion-medkit:before {\n  content: \"\"; }\n\n.ion-merge:before {\n  content: \"\"; }\n\n.ion-mic-a:before {\n  content: \"\"; }\n\n.ion-mic-b:before {\n  content: \"\"; }\n\n.ion-mic-c:before {\n  content: \"\"; }\n\n.ion-minus:before {\n  content: \"\"; }\n\n.ion-minus-circled:before {\n  content: \"\"; }\n\n.ion-minus-round:before {\n  content: \"\"; }\n\n.ion-model-s:before {\n  content: \"\"; }\n\n.ion-monitor:before {\n  content: \"\"; }\n\n.ion-more:before {\n  content: \"\"; }\n\n.ion-mouse:before {\n  content: \"\"; }\n\n.ion-music-note:before {\n  content: \"\"; }\n\n.ion-navicon:before {\n  content: \"\"; }\n\n.ion-navicon-round:before {\n  content: \"\"; }\n\n.ion-navigate:before {\n  content: \"\"; }\n\n.ion-network:before {\n  content: \"\"; }\n\n.ion-no-smoking:before {\n  content: \"\"; }\n\n.ion-nuclear:before {\n  content: \"\"; }\n\n.ion-outlet:before {\n  content: \"\"; }\n\n.ion-paintbrush:before {\n  content: \"\"; }\n\n.ion-paintbucket:before {\n  content: \"\"; }\n\n.ion-paper-airplane:before {\n  content: \"\"; }\n\n.ion-paperclip:before {\n  content: \"\"; }\n\n.ion-pause:before {\n  content: \"\"; }\n\n.ion-person:before {\n  content: \"\"; }\n\n.ion-person-add:before {\n  content: \"\"; }\n\n.ion-person-stalker:before {\n  content: \"\"; }\n\n.ion-pie-graph:before {\n  content: \"\"; }\n\n.ion-pin:before {\n  content: \"\"; }\n\n.ion-pinpoint:before {\n  content: \"\"; }\n\n.ion-pizza:before {\n  content: \"\"; }\n\n.ion-plane:before {\n  content: \"\"; }\n\n.ion-planet:before {\n  content: \"\"; }\n\n.ion-play:before {\n  content: \"\"; }\n\n.ion-playstation:before {\n  content: \"\"; }\n\n.ion-plus:before {\n  content: \"\"; }\n\n.ion-plus-circled:before {\n  content: \"\"; }\n\n.ion-plus-round:before {\n  content: \"\"; }\n\n.ion-podium:before {\n  content: \"\"; }\n\n.ion-pound:before {\n  content: \"\"; }\n\n.ion-power:before {\n  content: \"\"; }\n\n.ion-pricetag:before {\n  content: \"\"; }\n\n.ion-pricetags:before {\n  content: \"\"; }\n\n.ion-printer:before {\n  content: \"\"; }\n\n.ion-pull-request:before {\n  content: \"\"; }\n\n.ion-qr-scanner:before {\n  content: \"\"; }\n\n.ion-quote:before {\n  content: \"\"; }\n\n.ion-radio-waves:before {\n  content: \"\"; }\n\n.ion-record:before {\n  content: \"\"; }\n\n.ion-refresh:before {\n  content: \"\"; }\n\n.ion-reply:before {\n  content: \"\"; }\n\n.ion-reply-all:before {\n  content: \"\"; }\n\n.ion-ribbon-a:before {\n  content: \"\"; }\n\n.ion-ribbon-b:before {\n  content: \"\"; }\n\n.ion-sad:before {\n  content: \"\"; }\n\n.ion-sad-outline:before {\n  content: \"\"; }\n\n.ion-scissors:before {\n  content: \"\"; }\n\n.ion-search:before {\n  content: \"\"; }\n\n.ion-settings:before {\n  content: \"\"; }\n\n.ion-share:before {\n  content: \"\"; }\n\n.ion-shuffle:before {\n  content: \"\"; }\n\n.ion-skip-backward:before {\n  content: \"\"; }\n\n.ion-skip-forward:before {\n  content: \"\"; }\n\n.ion-social-android:before {\n  content: \"\"; }\n\n.ion-social-android-outline:before {\n  content: \"\"; }\n\n.ion-social-angular:before {\n  content: \"\"; }\n\n.ion-social-angular-outline:before {\n  content: \"\"; }\n\n.ion-social-apple:before {\n  content: \"\"; }\n\n.ion-social-apple-outline:before {\n  content: \"\"; }\n\n.ion-social-bitcoin:before {\n  content: \"\"; }\n\n.ion-social-bitcoin-outline:before {\n  content: \"\"; }\n\n.ion-social-buffer:before {\n  content: \"\"; }\n\n.ion-social-buffer-outline:before {\n  content: \"\"; }\n\n.ion-social-chrome:before {\n  content: \"\"; }\n\n.ion-social-chrome-outline:before {\n  content: \"\"; }\n\n.ion-social-codepen:before {\n  content: \"\"; }\n\n.ion-social-codepen-outline:before {\n  content: \"\"; }\n\n.ion-social-css3:before {\n  content: \"\"; }\n\n.ion-social-css3-outline:before {\n  content: \"\"; }\n\n.ion-social-designernews:before {\n  content: \"\"; }\n\n.ion-social-designernews-outline:before {\n  content: \"\"; }\n\n.ion-social-dribbble:before {\n  content: \"\"; }\n\n.ion-social-dribbble-outline:before {\n  content: \"\"; }\n\n.ion-social-dropbox:before {\n  content: \"\"; }\n\n.ion-social-dropbox-outline:before {\n  content: \"\"; }\n\n.ion-social-euro:before {\n  content: \"\"; }\n\n.ion-social-euro-outline:before {\n  content: \"\"; }\n\n.ion-social-facebook:before {\n  content: \"\"; }\n\n.ion-social-facebook-outline:before {\n  content: \"\"; }\n\n.ion-social-foursquare:before {\n  content: \"\"; }\n\n.ion-social-foursquare-outline:before {\n  content: \"\"; }\n\n.ion-social-freebsd-devil:before {\n  content: \"\"; }\n\n.ion-social-github:before {\n  content: \"\"; }\n\n.ion-social-github-outline:before {\n  content: \"\"; }\n\n.ion-social-google:before {\n  content: \"\"; }\n\n.ion-social-google-outline:before {\n  content: \"\"; }\n\n.ion-social-googleplus:before {\n  content: \"\"; }\n\n.ion-social-googleplus-outline:before {\n  content: \"\"; }\n\n.ion-social-hackernews:before {\n  content: \"\"; }\n\n.ion-social-hackernews-outline:before {\n  content: \"\"; }\n\n.ion-social-html5:before {\n  content: \"\"; }\n\n.ion-social-html5-outline:before {\n  content: \"\"; }\n\n.ion-social-instagram:before {\n  content: \"\"; }\n\n.ion-social-instagram-outline:before {\n  content: \"\"; }\n\n.ion-social-javascript:before {\n  content: \"\"; }\n\n.ion-social-javascript-outline:before {\n  content: \"\"; }\n\n.ion-social-linkedin:before {\n  content: \"\"; }\n\n.ion-social-linkedin-outline:before {\n  content: \"\"; }\n\n.ion-social-markdown:before {\n  content: \"\"; }\n\n.ion-social-nodejs:before {\n  content: \"\"; }\n\n.ion-social-octocat:before {\n  content: \"\"; }\n\n.ion-social-pinterest:before {\n  content: \"\"; }\n\n.ion-social-pinterest-outline:before {\n  content: \"\"; }\n\n.ion-social-python:before {\n  content: \"\"; }\n\n.ion-social-reddit:before {\n  content: \"\"; }\n\n.ion-social-reddit-outline:before {\n  content: \"\"; }\n\n.ion-social-rss:before {\n  content: \"\"; }\n\n.ion-social-rss-outline:before {\n  content: \"\"; }\n\n.ion-social-sass:before {\n  content: \"\"; }\n\n.ion-social-skype:before {\n  content: \"\"; }\n\n.ion-social-skype-outline:before {\n  content: \"\"; }\n\n.ion-social-snapchat:before {\n  content: \"\"; }\n\n.ion-social-snapchat-outline:before {\n  content: \"\"; }\n\n.ion-social-tumblr:before {\n  content: \"\"; }\n\n.ion-social-tumblr-outline:before {\n  content: \"\"; }\n\n.ion-social-tux:before {\n  content: \"\"; }\n\n.ion-social-twitch:before {\n  content: \"\"; }\n\n.ion-social-twitch-outline:before {\n  content: \"\"; }\n\n.ion-social-twitter:before {\n  content: \"\"; }\n\n.ion-social-twitter-outline:before {\n  content: \"\"; }\n\n.ion-social-usd:before {\n  content: \"\"; }\n\n.ion-social-usd-outline:before {\n  content: \"\"; }\n\n.ion-social-vimeo:before {\n  content: \"\"; }\n\n.ion-social-vimeo-outline:before {\n  content: \"\"; }\n\n.ion-social-whatsapp:before {\n  content: \"\"; }\n\n.ion-social-whatsapp-outline:before {\n  content: \"\"; }\n\n.ion-social-windows:before {\n  content: \"\"; }\n\n.ion-social-windows-outline:before {\n  content: \"\"; }\n\n.ion-social-wordpress:before {\n  content: \"\"; }\n\n.ion-social-wordpress-outline:before {\n  content: \"\"; }\n\n.ion-social-yahoo:before {\n  content: \"\"; }\n\n.ion-social-yahoo-outline:before {\n  content: \"\"; }\n\n.ion-social-yen:before {\n  content: \"\"; }\n\n.ion-social-yen-outline:before {\n  content: \"\"; }\n\n.ion-social-youtube:before {\n  content: \"\"; }\n\n.ion-social-youtube-outline:before {\n  content: \"\"; }\n\n.ion-soup-can:before {\n  content: \"\"; }\n\n.ion-soup-can-outline:before {\n  content: \"\"; }\n\n.ion-speakerphone:before {\n  content: \"\"; }\n\n.ion-speedometer:before {\n  content: \"\"; }\n\n.ion-spoon:before {\n  content: \"\"; }\n\n.ion-star:before {\n  content: \"\"; }\n\n.ion-stats-bars:before {\n  content: \"\"; }\n\n.ion-steam:before {\n  content: \"\"; }\n\n.ion-stop:before {\n  content: \"\"; }\n\n.ion-thermometer:before {\n  content: \"\"; }\n\n.ion-thumbsdown:before {\n  content: \"\"; }\n\n.ion-thumbsup:before {\n  content: \"\"; }\n\n.ion-toggle:before {\n  content: \"\"; }\n\n.ion-toggle-filled:before {\n  content: \"\"; }\n\n.ion-transgender:before {\n  content: \"\"; }\n\n.ion-trash-a:before {\n  content: \"\"; }\n\n.ion-trash-b:before {\n  content: \"\"; }\n\n.ion-trophy:before {\n  content: \"\"; }\n\n.ion-tshirt:before {\n  content: \"\"; }\n\n.ion-tshirt-outline:before {\n  content: \"\"; }\n\n.ion-umbrella:before {\n  content: \"\"; }\n\n.ion-university:before {\n  content: \"\"; }\n\n.ion-unlocked:before {\n  content: \"\"; }\n\n.ion-upload:before {\n  content: \"\"; }\n\n.ion-usb:before {\n  content: \"\"; }\n\n.ion-videocamera:before {\n  content: \"\"; }\n\n.ion-volume-high:before {\n  content: \"\"; }\n\n.ion-volume-low:before {\n  content: \"\"; }\n\n.ion-volume-medium:before {\n  content: \"\"; }\n\n.ion-volume-mute:before {\n  content: \"\"; }\n\n.ion-wand:before {\n  content: \"\"; }\n\n.ion-waterdrop:before {\n  content: \"\"; }\n\n.ion-wifi:before {\n  content: \"\"; }\n\n.ion-wineglass:before {\n  content: \"\"; }\n\n.ion-woman:before {\n  content: \"\"; }\n\n.ion-wrench:before {\n  content: \"\"; }\n\n.ion-xbox:before {\n  content: \"\"; }\n\n/**\n * Resets\n * --------------------------------------------------\n * Adapted from normalize.css and some reset.css. We don't care even one\n * bit about old IE, so we don't need any hacks for that in here.\n *\n * There are probably other things we could remove here, as well.\n *\n * normalize.css v2.1.2 | MIT License | git.io/normalize\n\n * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)\n * http://cssreset.com\n */\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, i, u, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed, fieldset,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  vertical-align: baseline;\n  font: inherit;\n  font-size: 100%; }\n\nol, ul {\n  list-style: none; }\n\nblockquote, q {\n  quotes: none; }\n\nblockquote:before, blockquote:after,\nq:before, q:after {\n  content: '';\n  content: none; }\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\naudio:not([controls]) {\n  display: none;\n  height: 0; }\n\n/**\n * Hide the `template` element in IE, Safari, and Firefox < 22.\n */\n[hidden],\ntemplate {\n  display: none; }\n\nscript {\n  display: none !important; }\n\n/* ==========================================================================\n   Base\n   ========================================================================== */\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n *  user zoom.\n */\nhtml {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  font-family: sans-serif;\n  /* 1 */\n  -webkit-text-size-adjust: 100%;\n  -ms-text-size-adjust: 100%;\n  /* 2 */\n  -webkit-text-size-adjust: 100%;\n  /* 2 */ }\n\n/**\n * Remove default margin.\n */\nbody {\n  margin: 0;\n  line-height: 1; }\n\n/**\n * Remove default outlines.\n */\na,\nbutton,\n:focus,\na:focus,\nbutton:focus,\na:active,\na:hover {\n  outline: 0; }\n\n/* *\n * Remove tap highlight color\n */\na {\n  -webkit-user-drag: none;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-tap-highlight-color: transparent; }\n  a[href]:hover {\n    cursor: pointer; }\n\n/* ==========================================================================\n   Typography\n   ========================================================================== */\n/**\n * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n */\nb,\nstrong {\n  font-weight: bold; }\n\n/**\n * Address styling not present in Safari 5 and Chrome.\n */\ndfn {\n  font-style: italic; }\n\n/**\n * Address differences between Firefox and other browsers.\n */\nhr {\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  height: 0; }\n\n/**\n * Correct font family set oddly in Safari 5 and Chrome.\n */\ncode,\nkbd,\npre,\nsamp {\n  font-size: 1em;\n  font-family: monospace, serif; }\n\n/**\n * Improve readability of pre-formatted text in all browsers.\n */\npre {\n  white-space: pre-wrap; }\n\n/**\n * Set consistent quote types.\n */\nq {\n  quotes: \"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\"; }\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\nsmall {\n  font-size: 80%; }\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\nsub,\nsup {\n  position: relative;\n  vertical-align: baseline;\n  font-size: 75%;\n  line-height: 0; }\n\nsup {\n  top: -0.5em; }\n\nsub {\n  bottom: -0.25em; }\n\n/**\n * Define consistent border, margin, and padding.\n */\nfieldset {\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n  border: 1px solid #c0c0c0; }\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\nlegend {\n  padding: 0;\n  /* 2 */\n  border: 0;\n  /* 1 */ }\n\n/**\n * 1. Correct font family not being inherited in all browsers.\n * 2. Correct font size not being inherited in all browsers.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n * 4. Remove any default :focus styles\n * 5. Make sure webkit font smoothing is being inherited\n * 6. Remove default gradient in Android Firefox / FirefoxOS\n */\nbutton,\ninput,\nselect,\ntextarea {\n  margin: 0;\n  /* 3 */\n  font-size: 100%;\n  /* 2 */\n  font-family: inherit;\n  /* 1 */\n  outline-offset: 0;\n  /* 4 */\n  outline-style: none;\n  /* 4 */\n  outline-width: 0;\n  /* 4 */\n  -webkit-font-smoothing: inherit;\n  /* 5 */\n  background-image: none;\n  /* 6 */ }\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `importnt` in\n * the UA stylesheet.\n */\nbutton,\ninput {\n  line-height: normal; }\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\n */\nbutton,\nselect {\n  text-transform: none; }\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n *  and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n *  `input` and others.\n */\nbutton,\nhtml input[type=\"button\"],\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  cursor: pointer;\n  /* 3 */\n  -webkit-appearance: button;\n  /* 2 */ }\n\n/**\n * Re-set default cursor for disabled elements.\n */\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default; }\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n *  (include `-moz` to future-proof).\n */\ninput[type=\"search\"] {\n  -webkit-box-sizing: content-box;\n  /* 2 */\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  -webkit-appearance: textfield;\n  /* 1 */ }\n\n/**\n * Remove inner padding and search cancel button in Safari 5 and Chrome\n * on OS X.\n */\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none; }\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  padding: 0;\n  border: 0; }\n\n/**\n * 1. Remove default vertical scrollbar in IE 8/9.\n * 2. Improve readability and alignment in all browsers.\n */\ntextarea {\n  overflow: auto;\n  /* 1 */\n  vertical-align: top;\n  /* 2 */ }\n\nimg {\n  -webkit-user-drag: none; }\n\n/* ==========================================================================\n   Tables\n   ========================================================================== */\n/**\n * Remove most spacing between table cells.\n */\ntable {\n  border-spacing: 0;\n  border-collapse: collapse; }\n\n/**\n * Scaffolding\n * --------------------------------------------------\n */\n*,\n*:before,\n*:after {\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box; }\n\nhtml {\n  overflow: hidden;\n  -ms-touch-action: pan-y;\n  touch-action: pan-y; }\n\nbody,\n.ionic-body {\n  -webkit-touch-callout: none;\n  -webkit-font-smoothing: antialiased;\n  font-smoothing: antialiased;\n  -webkit-text-size-adjust: none;\n  -moz-text-size-adjust: none;\n  text-size-adjust: none;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n  margin: 0;\n  padding: 0;\n  color: #000;\n  word-wrap: break-word;\n  font-size: 14px;\n  font-family: -apple-system;\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif;\n  line-height: 20px;\n  text-rendering: optimizeLegibility;\n  -webkit-backface-visibility: hidden;\n  -webkit-user-drag: none;\n  -ms-content-zooming: none; }\n\nbody.grade-b,\nbody.grade-c {\n  text-rendering: auto; }\n\n.content {\n  position: relative; }\n\n.scroll-content {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n  margin-top: -1px;\n  padding-top: 1px;\n  margin-bottom: -1px;\n  width: auto;\n  height: auto; }\n\n.menu .scroll-content.scroll-content-false {\n  z-index: 11; }\n\n.scroll-view {\n  position: relative;\n  display: block;\n  overflow: hidden;\n  margin-top: -1px; }\n  .scroll-view.overflow-scroll {\n    position: relative; }\n  .scroll-view.scroll-x {\n    overflow-x: scroll;\n    overflow-y: hidden; }\n  .scroll-view.scroll-y {\n    overflow-x: hidden;\n    overflow-y: scroll; }\n  .scroll-view.scroll-xy {\n    overflow-x: scroll;\n    overflow-y: scroll; }\n\n/**\n * Scroll is the scroll view component available for complex and custom\n * scroll view functionality.\n */\n.scroll {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  -webkit-touch-callout: none;\n  -webkit-text-size-adjust: none;\n  -moz-text-size-adjust: none;\n  text-size-adjust: none;\n  -webkit-transform-origin: left top;\n  transform-origin: left top; }\n\n/**\n * Set ms-viewport to prevent MS \"page squish\" and allow fluid scrolling\n * https://msdn.microsoft.com/en-us/library/ie/hh869615(v=vs.85).aspx\n */\n@-ms-viewport {\n  width: device-width; }\n\n.scroll-bar {\n  position: absolute;\n  z-index: 9999; }\n\n.ng-animate .scroll-bar {\n  visibility: hidden; }\n\n.scroll-bar-h {\n  right: 2px;\n  bottom: 3px;\n  left: 2px;\n  height: 3px; }\n  .scroll-bar-h .scroll-bar-indicator {\n    height: 100%; }\n\n.scroll-bar-v {\n  top: 2px;\n  right: 3px;\n  bottom: 2px;\n  width: 3px; }\n  .scroll-bar-v .scroll-bar-indicator {\n    width: 100%; }\n\n.scroll-bar-indicator {\n  position: absolute;\n  border-radius: 4px;\n  background: rgba(0, 0, 0, 0.3);\n  opacity: 1;\n  -webkit-transition: opacity 0.3s linear;\n  transition: opacity 0.3s linear; }\n  .scroll-bar-indicator.scroll-bar-fade-out {\n    opacity: 0; }\n\n.platform-android .scroll-bar-indicator {\n  border-radius: 0; }\n\n.grade-b .scroll-bar-indicator,\n.grade-c .scroll-bar-indicator {\n  background: #aaa; }\n  .grade-b .scroll-bar-indicator.scroll-bar-fade-out,\n  .grade-c .scroll-bar-indicator.scroll-bar-fade-out {\n    -webkit-transition: none;\n    transition: none; }\n\nion-infinite-scroll {\n  height: 60px;\n  width: 100%;\n  display: block;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: row;\n  -moz-flex-direction: row;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center; }\n  ion-infinite-scroll .icon {\n    color: #666666;\n    font-size: 30px;\n    color: #666666; }\n  ion-infinite-scroll:not(.active) .spinner,\n  ion-infinite-scroll:not(.active) .icon:before {\n    display: none; }\n\n.overflow-scroll {\n  overflow-x: hidden;\n  overflow-y: scroll;\n  -webkit-overflow-scrolling: touch;\n  -ms-overflow-style: -ms-autohiding-scrollbar;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  position: absolute; }\n  .overflow-scroll.pane {\n    overflow-x: hidden;\n    overflow-y: scroll; }\n  .overflow-scroll .scroll {\n    position: static;\n    height: 100%;\n    -webkit-transform: translate3d(0, 0, 0); }\n\n/* If you change these, change platform.scss as well */\n.has-header {\n  top: 44px; }\n\n.no-header {\n  top: 0; }\n\n.has-subheader {\n  top: 88px; }\n\n.has-tabs-top {\n  top: 93px; }\n\n.has-header.has-subheader.has-tabs-top {\n  top: 137px; }\n\n.has-footer {\n  bottom: 44px; }\n\n.has-subfooter {\n  bottom: 88px; }\n\n.has-tabs,\n.bar-footer.has-tabs {\n  bottom: 49px; }\n  .has-tabs.pane,\n  .bar-footer.has-tabs.pane {\n    bottom: 49px;\n    height: auto; }\n\n.bar-subfooter.has-tabs {\n  bottom: 93px; }\n\n.has-footer.has-tabs {\n  bottom: 93px; }\n\n.pane {\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  -webkit-transition-duration: 0;\n  transition-duration: 0;\n  z-index: 1; }\n\n.view {\n  z-index: 1; }\n\n.pane,\n.view {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background-color: #fff;\n  overflow: hidden; }\n\n.view-container {\n  position: absolute;\n  display: block;\n  width: 100%;\n  height: 100%; }\n\n/**\n * Typography\n * --------------------------------------------------\n */\np {\n  margin: 0 0 10px; }\n\nsmall {\n  font-size: 85%; }\n\ncite {\n  font-style: normal; }\n\n.text-left {\n  text-align: left; }\n\n.text-right {\n  text-align: right; }\n\n.text-center {\n  text-align: center; }\n\nh1, h2, h3, h4, h5, h6,\n.h1, .h2, .h3, .h4, .h5, .h6 {\n  color: #000;\n  font-weight: 500;\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif;\n  line-height: 1.2; }\n  h1 small, h2 small, h3 small, h4 small, h5 small, h6 small,\n  .h1 small, .h2 small, .h3 small, .h4 small, .h5 small, .h6 small {\n    font-weight: normal;\n    line-height: 1; }\n\nh1, .h1,\nh2, .h2,\nh3, .h3 {\n  margin-top: 20px;\n  margin-bottom: 10px; }\n  h1:first-child, .h1:first-child,\n  h2:first-child, .h2:first-child,\n  h3:first-child, .h3:first-child {\n    margin-top: 0; }\n  h1 + h1, h1 + .h1,\n  h1 + h2, h1 + .h2,\n  h1 + h3, h1 + .h3, .h1 + h1, .h1 + .h1,\n  .h1 + h2, .h1 + .h2,\n  .h1 + h3, .h1 + .h3,\n  h2 + h1,\n  h2 + .h1,\n  h2 + h2,\n  h2 + .h2,\n  h2 + h3,\n  h2 + .h3, .h2 + h1, .h2 + .h1,\n  .h2 + h2, .h2 + .h2,\n  .h2 + h3, .h2 + .h3,\n  h3 + h1,\n  h3 + .h1,\n  h3 + h2,\n  h3 + .h2,\n  h3 + h3,\n  h3 + .h3, .h3 + h1, .h3 + .h1,\n  .h3 + h2, .h3 + .h2,\n  .h3 + h3, .h3 + .h3 {\n    margin-top: 10px; }\n\nh4, .h4,\nh5, .h5,\nh6, .h6 {\n  margin-top: 10px;\n  margin-bottom: 10px; }\n\nh1, .h1 {\n  font-size: 36px; }\n\nh2, .h2 {\n  font-size: 30px; }\n\nh3, .h3 {\n  font-size: 24px; }\n\nh4, .h4 {\n  font-size: 18px; }\n\nh5, .h5 {\n  font-size: 14px; }\n\nh6, .h6 {\n  font-size: 12px; }\n\nh1 small, .h1 small {\n  font-size: 24px; }\n\nh2 small, .h2 small {\n  font-size: 18px; }\n\nh3 small, .h3 small,\nh4 small, .h4 small {\n  font-size: 14px; }\n\ndl {\n  margin-bottom: 20px; }\n\ndt,\ndd {\n  line-height: 1.42857; }\n\ndt {\n  font-weight: bold; }\n\nblockquote {\n  margin: 0 0 20px;\n  padding: 10px 20px;\n  border-left: 5px solid gray; }\n  blockquote p {\n    font-weight: 300;\n    font-size: 17.5px;\n    line-height: 1.25; }\n  blockquote p:last-child {\n    margin-bottom: 0; }\n  blockquote small {\n    display: block;\n    line-height: 1.42857; }\n    blockquote small:before {\n      content: '\\2014 \\00A0'; }\n\nq:before,\nq:after,\nblockquote:before,\nblockquote:after {\n  content: \"\"; }\n\naddress {\n  display: block;\n  margin-bottom: 20px;\n  font-style: normal;\n  line-height: 1.42857; }\n\na {\n  color: #387ef5; }\n\na.subdued {\n  padding-right: 10px;\n  color: #888;\n  text-decoration: none; }\n  a.subdued:hover {\n    text-decoration: none; }\n  a.subdued:last-child {\n    padding-right: 0; }\n\n/**\n * Action Sheets\n * --------------------------------------------------\n */\n.action-sheet-backdrop {\n  -webkit-transition: background-color 150ms ease-in-out;\n  transition: background-color 150ms ease-in-out;\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 11;\n  width: 100%;\n  height: 100%;\n  background-color: transparent; }\n  .action-sheet-backdrop.active {\n    background-color: rgba(0, 0, 0, 0.4); }\n\n.action-sheet-wrapper {\n  -webkit-transform: translate3d(0, 100%, 0);\n  transform: translate3d(0, 100%, 0);\n  -webkit-transition: all cubic-bezier(0.36, 0.66, 0.04, 1) 500ms;\n  transition: all cubic-bezier(0.36, 0.66, 0.04, 1) 500ms;\n  position: absolute;\n  bottom: 0;\n  left: 0;\n  right: 0;\n  width: 100%;\n  max-width: 500px;\n  margin: auto; }\n\n.action-sheet-up {\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n\n.action-sheet {\n  margin-left: 8px;\n  margin-right: 8px;\n  width: auto;\n  z-index: 11;\n  overflow: hidden; }\n  .action-sheet .button {\n    display: block;\n    padding: 1px;\n    width: 100%;\n    border-radius: 0;\n    border-color: #d1d3d6;\n    background-color: transparent;\n    color: #007aff;\n    font-size: 21px; }\n    .action-sheet .button:hover {\n      color: #007aff; }\n    .action-sheet .button.destructive {\n      color: #ff3b30; }\n      .action-sheet .button.destructive:hover {\n        color: #ff3b30; }\n  .action-sheet .button.active, .action-sheet .button.activated {\n    box-shadow: none;\n    border-color: #d1d3d6;\n    color: #007aff;\n    background: #e4e5e7; }\n\n.action-sheet-has-icons .icon {\n  position: absolute;\n  left: 16px; }\n\n.action-sheet-title {\n  padding: 16px;\n  color: #8f8f8f;\n  text-align: center;\n  font-size: 13px; }\n\n.action-sheet-group {\n  margin-bottom: 8px;\n  border-radius: 4px;\n  background-color: #fff;\n  overflow: hidden; }\n  .action-sheet-group .button {\n    border-width: 1px 0px 0px 0px; }\n  .action-sheet-group .button:first-child:last-child {\n    border-width: 0; }\n\n.action-sheet-options {\n  background: #f1f2f3; }\n\n.action-sheet-cancel .button {\n  font-weight: 500; }\n\n.action-sheet-open {\n  pointer-events: none; }\n  .action-sheet-open.modal-open .modal {\n    pointer-events: none; }\n  .action-sheet-open .action-sheet-backdrop {\n    pointer-events: auto; }\n\n.platform-android .action-sheet-backdrop.active {\n  background-color: rgba(0, 0, 0, 0.2); }\n\n.platform-android .action-sheet {\n  margin: 0; }\n  .platform-android .action-sheet .action-sheet-title,\n  .platform-android .action-sheet .button {\n    text-align: left;\n    border-color: transparent;\n    font-size: 16px;\n    color: inherit; }\n  .platform-android .action-sheet .action-sheet-title {\n    font-size: 14px;\n    padding: 16px;\n    color: #666; }\n  .platform-android .action-sheet .button.active,\n  .platform-android .action-sheet .button.activated {\n    background: #e8e8e8; }\n\n.platform-android .action-sheet-group {\n  margin: 0;\n  border-radius: 0;\n  background-color: #fafafa; }\n\n.platform-android .action-sheet-cancel {\n  display: none; }\n\n.platform-android .action-sheet-has-icons .button {\n  padding-left: 56px; }\n\n.backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 11;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0, 0, 0, 0.4);\n  visibility: hidden;\n  opacity: 0;\n  -webkit-transition: 0.1s opacity linear;\n  transition: 0.1s opacity linear; }\n  .backdrop.visible {\n    visibility: visible; }\n  .backdrop.active {\n    opacity: 1; }\n\n/**\n * Bar (Headers and Footers)\n * --------------------------------------------------\n */\n.bar {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  position: absolute;\n  right: 0;\n  left: 0;\n  z-index: 9;\n  -webkit-box-sizing: border-box;\n  -moz-box-sizing: border-box;\n  box-sizing: border-box;\n  padding: 5px;\n  width: 100%;\n  height: 44px;\n  border-width: 0;\n  border-style: solid;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid #ddd;\n  background-color: white;\n  /* border-width: 1px will actually create 2 device pixels on retina */\n  /* this nifty trick sets an actual 1px border on hi-res displays */\n  background-size: 0; }\n  @media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx) {\n    .bar {\n      border: none;\n      background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n      background-position: bottom;\n      background-size: 100% 1px;\n      background-repeat: no-repeat; } }\n  .bar.bar-clear {\n    border: none;\n    background: none;\n    color: #fff; }\n    .bar.bar-clear .button {\n      color: #fff; }\n    .bar.bar-clear .title {\n      color: #fff; }\n  .bar.item-input-inset .item-input-wrapper {\n    margin-top: -1px; }\n    .bar.item-input-inset .item-input-wrapper input {\n      padding-left: 8px;\n      width: 94%;\n      height: 28px;\n      background: transparent; }\n  .bar.bar-light {\n    border-color: #ddd;\n    background-color: white;\n    background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n    color: #444; }\n    .bar.bar-light .title {\n      color: #444; }\n    .bar.bar-light.bar-footer {\n      background-image: linear-gradient(180deg, #ddd, #ddd 50%, transparent 50%); }\n  .bar.bar-stable {\n    border-color: #b2b2b2;\n    background-color: #f8f8f8;\n    background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n    color: #444; }\n    .bar.bar-stable .title {\n      color: #444; }\n    .bar.bar-stable.bar-footer {\n      background-image: linear-gradient(180deg, #b2b2b2, #b2b2b2 50%, transparent 50%); }\n  .bar.bar-positive {\n    border-color: #0c60ee;\n    background-color: #387ef5;\n    background-image: linear-gradient(0deg, #0c60ee, #0c60ee 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-positive .title {\n      color: #fff; }\n    .bar.bar-positive.bar-footer {\n      background-image: linear-gradient(180deg, #0c60ee, #0c60ee 50%, transparent 50%); }\n  .bar.bar-calm {\n    border-color: #0a9dc7;\n    background-color: #11c1f3;\n    background-image: linear-gradient(0deg, #0a9dc7, #0a9dc7 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-calm .title {\n      color: #fff; }\n    .bar.bar-calm.bar-footer {\n      background-image: linear-gradient(180deg, #0a9dc7, #0a9dc7 50%, transparent 50%); }\n  .bar.bar-assertive {\n    border-color: #e42112;\n    background-color: #ef473a;\n    background-image: linear-gradient(0deg, #e42112, #e42112 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-assertive .title {\n      color: #fff; }\n    .bar.bar-assertive.bar-footer {\n      background-image: linear-gradient(180deg, #e42112, #e42112 50%, transparent 50%); }\n  .bar.bar-balanced {\n    border-color: #28a54c;\n    background-color: #33cd5f;\n    background-image: linear-gradient(0deg, #28a54c, #28a54c 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-balanced .title {\n      color: #fff; }\n    .bar.bar-balanced.bar-footer {\n      background-image: linear-gradient(180deg, #28a54c, #28a54c 50%, transparent 50%); }\n  .bar.bar-energized {\n    border-color: #e6b500;\n    background-color: #ffc900;\n    background-image: linear-gradient(0deg, #e6b500, #e6b500 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-energized .title {\n      color: #fff; }\n    .bar.bar-energized.bar-footer {\n      background-image: linear-gradient(180deg, #e6b500, #e6b500 50%, transparent 50%); }\n  .bar.bar-royal {\n    border-color: #6b46e5;\n    background-color: #886aea;\n    background-image: linear-gradient(0deg, #6b46e5, #6b46e5 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-royal .title {\n      color: #fff; }\n    .bar.bar-royal.bar-footer {\n      background-image: linear-gradient(180deg, #6b46e5, #6b46e5 50%, transparent 50%); }\n  .bar.bar-dark {\n    border-color: #111;\n    background-color: #444444;\n    background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n    color: #fff; }\n    .bar.bar-dark .title {\n      color: #fff; }\n    .bar.bar-dark.bar-footer {\n      background-image: linear-gradient(180deg, #111, #111 50%, transparent 50%); }\n  .bar .title {\n    display: block;\n    position: absolute;\n    top: 0;\n    right: 0;\n    left: 0;\n    z-index: 0;\n    overflow: hidden;\n    margin: 0 10px;\n    min-width: 30px;\n    height: 43px;\n    text-align: center;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n    font-size: 17px;\n    font-weight: 500;\n    line-height: 44px; }\n    .bar .title.title-left {\n      text-align: left; }\n    .bar .title.title-right {\n      text-align: right; }\n  .bar .title a {\n    color: inherit; }\n  .bar .button, .bar button {\n    z-index: 1;\n    padding: 0 8px;\n    min-width: initial;\n    min-height: 31px;\n    font-weight: 400;\n    font-size: 13px;\n    line-height: 32px; }\n    .bar .button.button-icon:before,\n    .bar .button .icon:before, .bar .button.icon:before, .bar .button.icon-left:before, .bar .button.icon-right:before, .bar button.button-icon:before,\n    .bar button .icon:before, .bar button.icon:before, .bar button.icon-left:before, .bar button.icon-right:before {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-size: 20px;\n      line-height: 32px; }\n    .bar .button.button-icon, .bar button.button-icon {\n      font-size: 17px; }\n      .bar .button.button-icon .icon:before, .bar .button.button-icon:before, .bar .button.button-icon.icon-left:before, .bar .button.button-icon.icon-right:before, .bar button.button-icon .icon:before, .bar button.button-icon:before, .bar button.button-icon.icon-left:before, .bar button.button-icon.icon-right:before {\n        vertical-align: top;\n        font-size: 32px;\n        line-height: 32px; }\n    .bar .button.button-clear, .bar button.button-clear {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-weight: 300;\n      font-size: 17px; }\n      .bar .button.button-clear .icon:before, .bar .button.button-clear.icon:before, .bar .button.button-clear.icon-left:before, .bar .button.button-clear.icon-right:before, .bar button.button-clear .icon:before, .bar button.button-clear.icon:before, .bar button.button-clear.icon-left:before, .bar button.button-clear.icon-right:before {\n        font-size: 32px;\n        line-height: 32px; }\n    .bar .button.back-button, .bar button.back-button {\n      display: block;\n      margin-right: 5px;\n      padding: 0;\n      white-space: nowrap;\n      font-weight: 400; }\n    .bar .button.back-button.active, .bar .button.back-button.activated, .bar button.back-button.active, .bar button.back-button.activated {\n      opacity: 0.2; }\n  .bar .button-bar > .button,\n  .bar .buttons > .button {\n    min-height: 31px;\n    line-height: 32px; }\n  .bar .button-bar + .button,\n  .bar .button + .button-bar {\n    margin-left: 5px; }\n  .bar .buttons,\n  .bar .buttons.primary-buttons,\n  .bar .buttons.secondary-buttons {\n    display: inherit; }\n  .bar .buttons span {\n    display: inline-block; }\n  .bar .buttons-left span {\n    margin-right: 5px;\n    display: inherit; }\n  .bar .buttons-right span {\n    margin-left: 5px;\n    display: inherit; }\n  .bar .title + .button:last-child,\n  .bar > .button + .button:last-child,\n  .bar > .button.pull-right,\n  .bar .buttons.pull-right,\n  .bar .title + .buttons {\n    position: absolute;\n    top: 5px;\n    right: 5px;\n    bottom: 5px; }\n\n.platform-android .nav-bar-has-subheader .bar {\n  background-image: none; }\n\n.platform-android .bar .back-button .icon:before {\n  font-size: 24px; }\n\n.platform-android .bar .title {\n  font-size: 19px;\n  line-height: 44px; }\n\n.bar-light .button {\n  border-color: #ddd;\n  background-color: white;\n  color: #444; }\n  .bar-light .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .bar-light .button.active, .bar-light .button.activated {\n    border-color: #ccc;\n    background-color: #fafafa; }\n  .bar-light .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #444;\n    font-size: 17px; }\n  .bar-light .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-stable .button {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  color: #444; }\n  .bar-stable .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .bar-stable .button.active, .bar-stable .button.activated {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n  .bar-stable .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #444;\n    font-size: 17px; }\n  .bar-stable .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-positive .button {\n  border-color: #0c60ee;\n  background-color: #387ef5;\n  color: #fff; }\n  .bar-positive .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-positive .button.active, .bar-positive .button.activated {\n    border-color: #0c60ee;\n    background-color: #0c60ee; }\n  .bar-positive .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-positive .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-calm .button {\n  border-color: #0a9dc7;\n  background-color: #11c1f3;\n  color: #fff; }\n  .bar-calm .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-calm .button.active, .bar-calm .button.activated {\n    border-color: #0a9dc7;\n    background-color: #0a9dc7; }\n  .bar-calm .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-calm .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-assertive .button {\n  border-color: #e42112;\n  background-color: #ef473a;\n  color: #fff; }\n  .bar-assertive .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-assertive .button.active, .bar-assertive .button.activated {\n    border-color: #e42112;\n    background-color: #e42112; }\n  .bar-assertive .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-assertive .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-balanced .button {\n  border-color: #28a54c;\n  background-color: #33cd5f;\n  color: #fff; }\n  .bar-balanced .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-balanced .button.active, .bar-balanced .button.activated {\n    border-color: #28a54c;\n    background-color: #28a54c; }\n  .bar-balanced .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-balanced .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-energized .button {\n  border-color: #e6b500;\n  background-color: #ffc900;\n  color: #fff; }\n  .bar-energized .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-energized .button.active, .bar-energized .button.activated {\n    border-color: #e6b500;\n    background-color: #e6b500; }\n  .bar-energized .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-energized .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-royal .button {\n  border-color: #6b46e5;\n  background-color: #886aea;\n  color: #fff; }\n  .bar-royal .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-royal .button.active, .bar-royal .button.activated {\n    border-color: #6b46e5;\n    background-color: #6b46e5; }\n  .bar-royal .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-royal .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-dark .button {\n  border-color: #111;\n  background-color: #444444;\n  color: #fff; }\n  .bar-dark .button:hover {\n    color: #fff;\n    text-decoration: none; }\n  .bar-dark .button.active, .bar-dark .button.activated {\n    border-color: #000;\n    background-color: #262626; }\n  .bar-dark .button.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: #fff;\n    font-size: 17px; }\n  .bar-dark .button.button-icon {\n    border-color: transparent;\n    background: none; }\n\n.bar-header {\n  top: 0;\n  border-top-width: 0;\n  border-bottom-width: 1px; }\n  .bar-header.has-tabs-top {\n    border-bottom-width: 0px;\n    background-image: none; }\n\n.tabs-top .bar-header {\n  border-bottom-width: 0px;\n  background-image: none; }\n\n.bar-footer {\n  bottom: 0;\n  border-top-width: 1px;\n  border-bottom-width: 0;\n  background-position: top;\n  height: 44px; }\n  .bar-footer.item-input-inset {\n    position: absolute; }\n  .bar-footer .title {\n    height: 43px;\n    line-height: 44px; }\n\n.bar-tabs {\n  padding: 0; }\n\n.bar-subheader {\n  top: 44px;\n  height: 44px; }\n  .bar-subheader .title {\n    height: 43px;\n    line-height: 44px; }\n\n.bar-subfooter {\n  bottom: 44px;\n  height: 44px; }\n  .bar-subfooter .title {\n    height: 43px;\n    line-height: 44px; }\n\n.nav-bar-block {\n  position: absolute;\n  top: 0;\n  right: 0;\n  left: 0;\n  z-index: 9; }\n\n.bar .back-button.hide,\n.bar .buttons .hide {\n  display: none; }\n\n.nav-bar-tabs-top .bar {\n  background-image: none; }\n\n/**\n * Tabs\n * --------------------------------------------------\n * A navigation bar with any number of tab items supported.\n */\n.tabs {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: horizontal;\n  -moz-flex-direction: horizontal;\n  -ms-flex-direction: horizontal;\n  flex-direction: horizontal;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  color: #444;\n  position: absolute;\n  bottom: 0;\n  z-index: 5;\n  width: 100%;\n  height: 49px;\n  border-style: solid;\n  border-top-width: 1px;\n  background-size: 0;\n  line-height: 49px; }\n  .tabs .tab-item .badge {\n    background-color: #444;\n    color: #f8f8f8; }\n  @media (min--moz-device-pixel-ratio: 1.5), (-webkit-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx) {\n    .tabs {\n      padding-top: 2px;\n      border-top: none !important;\n      border-bottom: none;\n      background-position: top;\n      background-size: 100% 1px;\n      background-repeat: no-repeat; } }\n\n/* Allow parent element of tabs to define color, or just the tab itself */\n.tabs-light > .tabs,\n.tabs.tabs-light {\n  border-color: #ddd;\n  background-color: #fff;\n  background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n  color: #444; }\n  .tabs-light > .tabs .tab-item .badge,\n  .tabs.tabs-light .tab-item .badge {\n    background-color: #444;\n    color: #fff; }\n\n.tabs-stable > .tabs,\n.tabs.tabs-stable {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  color: #444; }\n  .tabs-stable > .tabs .tab-item .badge,\n  .tabs.tabs-stable .tab-item .badge {\n    background-color: #444;\n    color: #f8f8f8; }\n\n.tabs-positive > .tabs,\n.tabs.tabs-positive {\n  border-color: #0c60ee;\n  background-color: #387ef5;\n  background-image: linear-gradient(0deg, #0c60ee, #0c60ee 50%, transparent 50%);\n  color: #fff; }\n  .tabs-positive > .tabs .tab-item .badge,\n  .tabs.tabs-positive .tab-item .badge {\n    background-color: #fff;\n    color: #387ef5; }\n\n.tabs-calm > .tabs,\n.tabs.tabs-calm {\n  border-color: #0a9dc7;\n  background-color: #11c1f3;\n  background-image: linear-gradient(0deg, #0a9dc7, #0a9dc7 50%, transparent 50%);\n  color: #fff; }\n  .tabs-calm > .tabs .tab-item .badge,\n  .tabs.tabs-calm .tab-item .badge {\n    background-color: #fff;\n    color: #11c1f3; }\n\n.tabs-assertive > .tabs,\n.tabs.tabs-assertive {\n  border-color: #e42112;\n  background-color: #ef473a;\n  background-image: linear-gradient(0deg, #e42112, #e42112 50%, transparent 50%);\n  color: #fff; }\n  .tabs-assertive > .tabs .tab-item .badge,\n  .tabs.tabs-assertive .tab-item .badge {\n    background-color: #fff;\n    color: #ef473a; }\n\n.tabs-balanced > .tabs,\n.tabs.tabs-balanced {\n  border-color: #28a54c;\n  background-color: #33cd5f;\n  background-image: linear-gradient(0deg, #28a54c, #28a54c 50%, transparent 50%);\n  color: #fff; }\n  .tabs-balanced > .tabs .tab-item .badge,\n  .tabs.tabs-balanced .tab-item .badge {\n    background-color: #fff;\n    color: #33cd5f; }\n\n.tabs-energized > .tabs,\n.tabs.tabs-energized {\n  border-color: #e6b500;\n  background-color: #ffc900;\n  background-image: linear-gradient(0deg, #e6b500, #e6b500 50%, transparent 50%);\n  color: #fff; }\n  .tabs-energized > .tabs .tab-item .badge,\n  .tabs.tabs-energized .tab-item .badge {\n    background-color: #fff;\n    color: #ffc900; }\n\n.tabs-royal > .tabs,\n.tabs.tabs-royal {\n  border-color: #6b46e5;\n  background-color: #886aea;\n  background-image: linear-gradient(0deg, #6b46e5, #6b46e5 50%, transparent 50%);\n  color: #fff; }\n  .tabs-royal > .tabs .tab-item .badge,\n  .tabs.tabs-royal .tab-item .badge {\n    background-color: #fff;\n    color: #886aea; }\n\n.tabs-dark > .tabs,\n.tabs.tabs-dark {\n  border-color: #111;\n  background-color: #444;\n  background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n  color: #fff; }\n  .tabs-dark > .tabs .tab-item .badge,\n  .tabs.tabs-dark .tab-item .badge {\n    background-color: #fff;\n    color: #444; }\n\n.tabs-striped .tabs {\n  background-color: white;\n  background-image: none;\n  border: none;\n  border-bottom: 1px solid #ddd;\n  padding-top: 2px; }\n\n.tabs-striped .tab-item.tab-item-active, .tabs-striped .tab-item.active, .tabs-striped .tab-item.activated {\n  margin-top: -2px;\n  border-style: solid;\n  border-width: 2px 0 0 0;\n  border-color: #444; }\n  .tabs-striped .tab-item.tab-item-active .badge, .tabs-striped .tab-item.active .badge, .tabs-striped .tab-item.activated .badge {\n    top: 2px;\n    opacity: 1; }\n\n.tabs-striped.tabs-light .tabs {\n  background-color: #fff; }\n\n.tabs-striped.tabs-light .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-light .tab-item.tab-item-active, .tabs-striped.tabs-light .tab-item.active, .tabs-striped.tabs-light .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #444; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-stable .tabs {\n  background-color: #f8f8f8; }\n\n.tabs-striped.tabs-stable .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-stable .tab-item.tab-item-active, .tabs-striped.tabs-stable .tab-item.active, .tabs-striped.tabs-stable .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #444; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-positive .tabs {\n  background-color: #387ef5; }\n\n.tabs-striped.tabs-positive .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-positive .tab-item.tab-item-active, .tabs-striped.tabs-positive .tab-item.active, .tabs-striped.tabs-positive .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-calm .tabs {\n  background-color: #11c1f3; }\n\n.tabs-striped.tabs-calm .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-calm .tab-item.tab-item-active, .tabs-striped.tabs-calm .tab-item.active, .tabs-striped.tabs-calm .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-assertive .tabs {\n  background-color: #ef473a; }\n\n.tabs-striped.tabs-assertive .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-assertive .tab-item.tab-item-active, .tabs-striped.tabs-assertive .tab-item.active, .tabs-striped.tabs-assertive .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-balanced .tabs {\n  background-color: #33cd5f; }\n\n.tabs-striped.tabs-balanced .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-balanced .tab-item.tab-item-active, .tabs-striped.tabs-balanced .tab-item.active, .tabs-striped.tabs-balanced .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-energized .tabs {\n  background-color: #ffc900; }\n\n.tabs-striped.tabs-energized .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-energized .tab-item.tab-item-active, .tabs-striped.tabs-energized .tab-item.active, .tabs-striped.tabs-energized .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-royal .tabs {\n  background-color: #886aea; }\n\n.tabs-striped.tabs-royal .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-royal .tab-item.tab-item-active, .tabs-striped.tabs-royal .tab-item.active, .tabs-striped.tabs-royal .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-dark .tabs {\n  background-color: #444; }\n\n.tabs-striped.tabs-dark .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-dark .tab-item.tab-item-active, .tabs-striped.tabs-dark .tab-item.active, .tabs-striped.tabs-dark .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border-style: solid;\n    border-width: 2px 0 0 0;\n    border-color: #fff; }\n\n.tabs-striped.tabs-top .tab-item.tab-item-active .badge, .tabs-striped.tabs-top .tab-item.active .badge, .tabs-striped.tabs-top .tab-item.activated .badge {\n  top: 4%; }\n\n.tabs-striped.tabs-background-light .tabs {\n  background-color: #fff;\n  background-image: none; }\n\n.tabs-striped.tabs-background-stable .tabs {\n  background-color: #f8f8f8;\n  background-image: none; }\n\n.tabs-striped.tabs-background-positive .tabs {\n  background-color: #387ef5;\n  background-image: none; }\n\n.tabs-striped.tabs-background-calm .tabs {\n  background-color: #11c1f3;\n  background-image: none; }\n\n.tabs-striped.tabs-background-assertive .tabs {\n  background-color: #ef473a;\n  background-image: none; }\n\n.tabs-striped.tabs-background-balanced .tabs {\n  background-color: #33cd5f;\n  background-image: none; }\n\n.tabs-striped.tabs-background-energized .tabs {\n  background-color: #ffc900;\n  background-image: none; }\n\n.tabs-striped.tabs-background-royal .tabs {\n  background-color: #886aea;\n  background-image: none; }\n\n.tabs-striped.tabs-background-dark .tabs {\n  background-color: #444;\n  background-image: none; }\n\n.tabs-striped.tabs-color-light .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-light .tab-item.tab-item-active, .tabs-striped.tabs-color-light .tab-item.active, .tabs-striped.tabs-color-light .tab-item.activated {\n    margin-top: -2px;\n    color: #fff;\n    border: 0 solid #fff;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-light .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-light .tab-item.active .badge, .tabs-striped.tabs-color-light .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-stable .tab-item {\n  color: rgba(248, 248, 248, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-stable .tab-item.tab-item-active, .tabs-striped.tabs-color-stable .tab-item.active, .tabs-striped.tabs-color-stable .tab-item.activated {\n    margin-top: -2px;\n    color: #f8f8f8;\n    border: 0 solid #f8f8f8;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-stable .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-stable .tab-item.active .badge, .tabs-striped.tabs-color-stable .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-positive .tab-item {\n  color: rgba(56, 126, 245, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-positive .tab-item.tab-item-active, .tabs-striped.tabs-color-positive .tab-item.active, .tabs-striped.tabs-color-positive .tab-item.activated {\n    margin-top: -2px;\n    color: #387ef5;\n    border: 0 solid #387ef5;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-positive .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-positive .tab-item.active .badge, .tabs-striped.tabs-color-positive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-calm .tab-item {\n  color: rgba(17, 193, 243, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-calm .tab-item.tab-item-active, .tabs-striped.tabs-color-calm .tab-item.active, .tabs-striped.tabs-color-calm .tab-item.activated {\n    margin-top: -2px;\n    color: #11c1f3;\n    border: 0 solid #11c1f3;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-calm .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-calm .tab-item.active .badge, .tabs-striped.tabs-color-calm .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-assertive .tab-item {\n  color: rgba(239, 71, 58, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-assertive .tab-item.tab-item-active, .tabs-striped.tabs-color-assertive .tab-item.active, .tabs-striped.tabs-color-assertive .tab-item.activated {\n    margin-top: -2px;\n    color: #ef473a;\n    border: 0 solid #ef473a;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-assertive .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-assertive .tab-item.active .badge, .tabs-striped.tabs-color-assertive .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-balanced .tab-item {\n  color: rgba(51, 205, 95, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-balanced .tab-item.tab-item-active, .tabs-striped.tabs-color-balanced .tab-item.active, .tabs-striped.tabs-color-balanced .tab-item.activated {\n    margin-top: -2px;\n    color: #33cd5f;\n    border: 0 solid #33cd5f;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-balanced .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-balanced .tab-item.active .badge, .tabs-striped.tabs-color-balanced .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-energized .tab-item {\n  color: rgba(255, 201, 0, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-energized .tab-item.tab-item-active, .tabs-striped.tabs-color-energized .tab-item.active, .tabs-striped.tabs-color-energized .tab-item.activated {\n    margin-top: -2px;\n    color: #ffc900;\n    border: 0 solid #ffc900;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-energized .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-energized .tab-item.active .badge, .tabs-striped.tabs-color-energized .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-royal .tab-item {\n  color: rgba(136, 106, 234, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-royal .tab-item.tab-item-active, .tabs-striped.tabs-color-royal .tab-item.active, .tabs-striped.tabs-color-royal .tab-item.activated {\n    margin-top: -2px;\n    color: #886aea;\n    border: 0 solid #886aea;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-royal .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-royal .tab-item.active .badge, .tabs-striped.tabs-color-royal .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-striped.tabs-color-dark .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-striped.tabs-color-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-striped.tabs-color-dark .tab-item.tab-item-active, .tabs-striped.tabs-color-dark .tab-item.active, .tabs-striped.tabs-color-dark .tab-item.activated {\n    margin-top: -2px;\n    color: #444;\n    border: 0 solid #444;\n    border-top-width: 2px; }\n    .tabs-striped.tabs-color-dark .tab-item.tab-item-active .badge, .tabs-striped.tabs-color-dark .tab-item.active .badge, .tabs-striped.tabs-color-dark .tab-item.activated .badge {\n      top: 2px;\n      opacity: 1; }\n\n.tabs-background-light .tabs,\n.tabs-background-light > .tabs {\n  background-color: #fff;\n  background-image: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);\n  border-color: #ddd; }\n\n.tabs-background-stable .tabs,\n.tabs-background-stable > .tabs {\n  background-color: #f8f8f8;\n  background-image: linear-gradient(0deg, #b2b2b2, #b2b2b2 50%, transparent 50%);\n  border-color: #b2b2b2; }\n\n.tabs-background-positive .tabs,\n.tabs-background-positive > .tabs {\n  background-color: #387ef5;\n  background-image: linear-gradient(0deg, #0c60ee, #0c60ee 50%, transparent 50%);\n  border-color: #0c60ee; }\n\n.tabs-background-calm .tabs,\n.tabs-background-calm > .tabs {\n  background-color: #11c1f3;\n  background-image: linear-gradient(0deg, #0a9dc7, #0a9dc7 50%, transparent 50%);\n  border-color: #0a9dc7; }\n\n.tabs-background-assertive .tabs,\n.tabs-background-assertive > .tabs {\n  background-color: #ef473a;\n  background-image: linear-gradient(0deg, #e42112, #e42112 50%, transparent 50%);\n  border-color: #e42112; }\n\n.tabs-background-balanced .tabs,\n.tabs-background-balanced > .tabs {\n  background-color: #33cd5f;\n  background-image: linear-gradient(0deg, #28a54c, #28a54c 50%, transparent 50%);\n  border-color: #28a54c; }\n\n.tabs-background-energized .tabs,\n.tabs-background-energized > .tabs {\n  background-color: #ffc900;\n  background-image: linear-gradient(0deg, #e6b500, #e6b500 50%, transparent 50%);\n  border-color: #e6b500; }\n\n.tabs-background-royal .tabs,\n.tabs-background-royal > .tabs {\n  background-color: #886aea;\n  background-image: linear-gradient(0deg, #6b46e5, #6b46e5 50%, transparent 50%);\n  border-color: #6b46e5; }\n\n.tabs-background-dark .tabs,\n.tabs-background-dark > .tabs {\n  background-color: #444;\n  background-image: linear-gradient(0deg, #111, #111 50%, transparent 50%);\n  border-color: #111; }\n\n.tabs-color-light .tab-item {\n  color: rgba(255, 255, 255, 0.4);\n  opacity: 1; }\n  .tabs-color-light .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-light .tab-item.tab-item-active, .tabs-color-light .tab-item.active, .tabs-color-light .tab-item.activated {\n    color: #fff;\n    border: 0 solid #fff; }\n    .tabs-color-light .tab-item.tab-item-active .badge, .tabs-color-light .tab-item.active .badge, .tabs-color-light .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-stable .tab-item {\n  color: rgba(248, 248, 248, 0.4);\n  opacity: 1; }\n  .tabs-color-stable .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-stable .tab-item.tab-item-active, .tabs-color-stable .tab-item.active, .tabs-color-stable .tab-item.activated {\n    color: #f8f8f8;\n    border: 0 solid #f8f8f8; }\n    .tabs-color-stable .tab-item.tab-item-active .badge, .tabs-color-stable .tab-item.active .badge, .tabs-color-stable .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-positive .tab-item {\n  color: rgba(56, 126, 245, 0.4);\n  opacity: 1; }\n  .tabs-color-positive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-positive .tab-item.tab-item-active, .tabs-color-positive .tab-item.active, .tabs-color-positive .tab-item.activated {\n    color: #387ef5;\n    border: 0 solid #387ef5; }\n    .tabs-color-positive .tab-item.tab-item-active .badge, .tabs-color-positive .tab-item.active .badge, .tabs-color-positive .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-calm .tab-item {\n  color: rgba(17, 193, 243, 0.4);\n  opacity: 1; }\n  .tabs-color-calm .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-calm .tab-item.tab-item-active, .tabs-color-calm .tab-item.active, .tabs-color-calm .tab-item.activated {\n    color: #11c1f3;\n    border: 0 solid #11c1f3; }\n    .tabs-color-calm .tab-item.tab-item-active .badge, .tabs-color-calm .tab-item.active .badge, .tabs-color-calm .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-assertive .tab-item {\n  color: rgba(239, 71, 58, 0.4);\n  opacity: 1; }\n  .tabs-color-assertive .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-assertive .tab-item.tab-item-active, .tabs-color-assertive .tab-item.active, .tabs-color-assertive .tab-item.activated {\n    color: #ef473a;\n    border: 0 solid #ef473a; }\n    .tabs-color-assertive .tab-item.tab-item-active .badge, .tabs-color-assertive .tab-item.active .badge, .tabs-color-assertive .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-balanced .tab-item {\n  color: rgba(51, 205, 95, 0.4);\n  opacity: 1; }\n  .tabs-color-balanced .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-balanced .tab-item.tab-item-active, .tabs-color-balanced .tab-item.active, .tabs-color-balanced .tab-item.activated {\n    color: #33cd5f;\n    border: 0 solid #33cd5f; }\n    .tabs-color-balanced .tab-item.tab-item-active .badge, .tabs-color-balanced .tab-item.active .badge, .tabs-color-balanced .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-energized .tab-item {\n  color: rgba(255, 201, 0, 0.4);\n  opacity: 1; }\n  .tabs-color-energized .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-energized .tab-item.tab-item-active, .tabs-color-energized .tab-item.active, .tabs-color-energized .tab-item.activated {\n    color: #ffc900;\n    border: 0 solid #ffc900; }\n    .tabs-color-energized .tab-item.tab-item-active .badge, .tabs-color-energized .tab-item.active .badge, .tabs-color-energized .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-royal .tab-item {\n  color: rgba(136, 106, 234, 0.4);\n  opacity: 1; }\n  .tabs-color-royal .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-royal .tab-item.tab-item-active, .tabs-color-royal .tab-item.active, .tabs-color-royal .tab-item.activated {\n    color: #886aea;\n    border: 0 solid #886aea; }\n    .tabs-color-royal .tab-item.tab-item-active .badge, .tabs-color-royal .tab-item.active .badge, .tabs-color-royal .tab-item.activated .badge {\n      opacity: 1; }\n\n.tabs-color-dark .tab-item {\n  color: rgba(68, 68, 68, 0.4);\n  opacity: 1; }\n  .tabs-color-dark .tab-item .badge {\n    opacity: 0.4; }\n  .tabs-color-dark .tab-item.tab-item-active, .tabs-color-dark .tab-item.active, .tabs-color-dark .tab-item.activated {\n    color: #444;\n    border: 0 solid #444; }\n    .tabs-color-dark .tab-item.tab-item-active .badge, .tabs-color-dark .tab-item.active .badge, .tabs-color-dark .tab-item.activated .badge {\n      opacity: 1; }\n\nion-tabs.tabs-color-active-light .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-light .tab-item.tab-item-active, ion-tabs.tabs-color-active-light .tab-item.active, ion-tabs.tabs-color-active-light .tab-item.activated {\n    color: #fff; }\n\nion-tabs.tabs-striped.tabs-color-active-light .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-light .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-light .tab-item.activated {\n  border-color: #fff;\n  color: #fff; }\n\nion-tabs.tabs-color-active-stable .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-stable .tab-item.tab-item-active, ion-tabs.tabs-color-active-stable .tab-item.active, ion-tabs.tabs-color-active-stable .tab-item.activated {\n    color: #f8f8f8; }\n\nion-tabs.tabs-striped.tabs-color-active-stable .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-stable .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-stable .tab-item.activated {\n  border-color: #f8f8f8;\n  color: #f8f8f8; }\n\nion-tabs.tabs-color-active-positive .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-positive .tab-item.tab-item-active, ion-tabs.tabs-color-active-positive .tab-item.active, ion-tabs.tabs-color-active-positive .tab-item.activated {\n    color: #387ef5; }\n\nion-tabs.tabs-striped.tabs-color-active-positive .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-positive .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-positive .tab-item.activated {\n  border-color: #387ef5;\n  color: #387ef5; }\n\nion-tabs.tabs-color-active-calm .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-calm .tab-item.tab-item-active, ion-tabs.tabs-color-active-calm .tab-item.active, ion-tabs.tabs-color-active-calm .tab-item.activated {\n    color: #11c1f3; }\n\nion-tabs.tabs-striped.tabs-color-active-calm .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-calm .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-calm .tab-item.activated {\n  border-color: #11c1f3;\n  color: #11c1f3; }\n\nion-tabs.tabs-color-active-assertive .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-assertive .tab-item.tab-item-active, ion-tabs.tabs-color-active-assertive .tab-item.active, ion-tabs.tabs-color-active-assertive .tab-item.activated {\n    color: #ef473a; }\n\nion-tabs.tabs-striped.tabs-color-active-assertive .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-assertive .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-assertive .tab-item.activated {\n  border-color: #ef473a;\n  color: #ef473a; }\n\nion-tabs.tabs-color-active-balanced .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-balanced .tab-item.tab-item-active, ion-tabs.tabs-color-active-balanced .tab-item.active, ion-tabs.tabs-color-active-balanced .tab-item.activated {\n    color: #33cd5f; }\n\nion-tabs.tabs-striped.tabs-color-active-balanced .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-balanced .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-balanced .tab-item.activated {\n  border-color: #33cd5f;\n  color: #33cd5f; }\n\nion-tabs.tabs-color-active-energized .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-energized .tab-item.tab-item-active, ion-tabs.tabs-color-active-energized .tab-item.active, ion-tabs.tabs-color-active-energized .tab-item.activated {\n    color: #ffc900; }\n\nion-tabs.tabs-striped.tabs-color-active-energized .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-energized .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-energized .tab-item.activated {\n  border-color: #ffc900;\n  color: #ffc900; }\n\nion-tabs.tabs-color-active-royal .tab-item {\n  color: #444; }\n  ion-tabs.tabs-color-active-royal .tab-item.tab-item-active, ion-tabs.tabs-color-active-royal .tab-item.active, ion-tabs.tabs-color-active-royal .tab-item.activated {\n    color: #886aea; }\n\nion-tabs.tabs-striped.tabs-color-active-royal .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-royal .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-royal .tab-item.activated {\n  border-color: #886aea;\n  color: #886aea; }\n\nion-tabs.tabs-color-active-dark .tab-item {\n  color: #fff; }\n  ion-tabs.tabs-color-active-dark .tab-item.tab-item-active, ion-tabs.tabs-color-active-dark .tab-item.active, ion-tabs.tabs-color-active-dark .tab-item.activated {\n    color: #444; }\n\nion-tabs.tabs-striped.tabs-color-active-dark .tab-item.tab-item-active, ion-tabs.tabs-striped.tabs-color-active-dark .tab-item.active, ion-tabs.tabs-striped.tabs-color-active-dark .tab-item.activated {\n  border-color: #444;\n  color: #444; }\n\n.tabs-top.tabs-striped {\n  padding-bottom: 0; }\n  .tabs-top.tabs-striped .tab-item {\n    background: transparent;\n    -webkit-transition: color .1s ease;\n    -moz-transition: color .1s ease;\n    -ms-transition: color .1s ease;\n    -o-transition: color .1s ease;\n    transition: color .1s ease; }\n    .tabs-top.tabs-striped .tab-item.tab-item-active, .tabs-top.tabs-striped .tab-item.active, .tabs-top.tabs-striped .tab-item.activated {\n      margin-top: 1px;\n      border-width: 0px 0px 2px 0px !important;\n      border-style: solid; }\n      .tabs-top.tabs-striped .tab-item.tab-item-active > .badge, .tabs-top.tabs-striped .tab-item.tab-item-active > i, .tabs-top.tabs-striped .tab-item.active > .badge, .tabs-top.tabs-striped .tab-item.active > i, .tabs-top.tabs-striped .tab-item.activated > .badge, .tabs-top.tabs-striped .tab-item.activated > i {\n        margin-top: -1px; }\n    .tabs-top.tabs-striped .tab-item .badge {\n      -webkit-transition: color .2s ease;\n      -moz-transition: color .2s ease;\n      -ms-transition: color .2s ease;\n      -o-transition: color .2s ease;\n      transition: color .2s ease; }\n  .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.tab-item-active .tab-title, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.tab-item-active i, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.active .tab-title, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.active i, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.activated .tab-title, .tabs-top.tabs-striped:not(.tabs-icon-left):not(.tabs-icon-top) .tab-item.activated i {\n    display: block;\n    margin-top: -1px; }\n  .tabs-top.tabs-striped.tabs-icon-left .tab-item {\n    margin-top: 1px; }\n    .tabs-top.tabs-striped.tabs-icon-left .tab-item.tab-item-active .tab-title, .tabs-top.tabs-striped.tabs-icon-left .tab-item.tab-item-active i, .tabs-top.tabs-striped.tabs-icon-left .tab-item.active .tab-title, .tabs-top.tabs-striped.tabs-icon-left .tab-item.active i, .tabs-top.tabs-striped.tabs-icon-left .tab-item.activated .tab-title, .tabs-top.tabs-striped.tabs-icon-left .tab-item.activated i {\n      margin-top: -0.1em; }\n\n/* Allow parent element to have tabs-top */\n/* If you change this, change platform.scss as well */\n.tabs-top > .tabs,\n.tabs.tabs-top {\n  top: 44px;\n  padding-top: 0;\n  background-position: bottom;\n  border-top-width: 0;\n  border-bottom-width: 1px; }\n  .tabs-top > .tabs .tab-item.tab-item-active .badge, .tabs-top > .tabs .tab-item.active .badge, .tabs-top > .tabs .tab-item.activated .badge,\n  .tabs.tabs-top .tab-item.tab-item-active .badge,\n  .tabs.tabs-top .tab-item.active .badge,\n  .tabs.tabs-top .tab-item.activated .badge {\n    top: 4%; }\n\n.tabs-top ~ .bar-header {\n  border-bottom-width: 0; }\n\n.tab-item {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  overflow: hidden;\n  max-width: 150px;\n  height: 100%;\n  color: inherit;\n  text-align: center;\n  text-decoration: none;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n  font-weight: 400;\n  font-size: 14px;\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif;\n  opacity: 0.7; }\n  .tab-item:hover {\n    cursor: pointer; }\n  .tab-item.tab-hidden {\n    display: none; }\n\n.tabs-item-hide > .tabs,\n.tabs.tabs-item-hide {\n  display: none; }\n\n.tabs-icon-top > .tabs .tab-item,\n.tabs-icon-top.tabs .tab-item,\n.tabs-icon-bottom > .tabs .tab-item,\n.tabs-icon-bottom.tabs .tab-item {\n  font-size: 10px;\n  line-height: 14px; }\n\n.tab-item .icon {\n  display: block;\n  margin: 0 auto;\n  height: 32px;\n  font-size: 32px; }\n\n.tabs-icon-left.tabs .tab-item,\n.tabs-icon-left > .tabs .tab-item,\n.tabs-icon-right.tabs .tab-item,\n.tabs-icon-right > .tabs .tab-item {\n  font-size: 10px; }\n  .tabs-icon-left.tabs .tab-item .icon, .tabs-icon-left.tabs .tab-item .tab-title,\n  .tabs-icon-left > .tabs .tab-item .icon,\n  .tabs-icon-left > .tabs .tab-item .tab-title,\n  .tabs-icon-right.tabs .tab-item .icon,\n  .tabs-icon-right.tabs .tab-item .tab-title,\n  .tabs-icon-right > .tabs .tab-item .icon,\n  .tabs-icon-right > .tabs .tab-item .tab-title {\n    display: inline-block;\n    vertical-align: top;\n    margin-top: -.1em; }\n    .tabs-icon-left.tabs .tab-item .icon:before, .tabs-icon-left.tabs .tab-item .tab-title:before,\n    .tabs-icon-left > .tabs .tab-item .icon:before,\n    .tabs-icon-left > .tabs .tab-item .tab-title:before,\n    .tabs-icon-right.tabs .tab-item .icon:before,\n    .tabs-icon-right.tabs .tab-item .tab-title:before,\n    .tabs-icon-right > .tabs .tab-item .icon:before,\n    .tabs-icon-right > .tabs .tab-item .tab-title:before {\n      font-size: 24px;\n      line-height: 49px; }\n\n.tabs-icon-left > .tabs .tab-item .icon,\n.tabs-icon-left.tabs .tab-item .icon {\n  padding-right: 3px; }\n\n.tabs-icon-right > .tabs .tab-item .icon,\n.tabs-icon-right.tabs .tab-item .icon {\n  padding-left: 3px; }\n\n.tabs-icon-only > .tabs .icon,\n.tabs-icon-only.tabs .icon {\n  line-height: inherit; }\n\n.tab-item.has-badge {\n  position: relative; }\n\n.tab-item .badge {\n  position: absolute;\n  top: 4%;\n  right: 33%;\n  right: calc(50% - 26px);\n  padding: 1px 6px;\n  height: auto;\n  font-size: 12px;\n  line-height: 16px; }\n\n/* Navigational tab */\n/* Active state for tab */\n.tab-item.tab-item-active,\n.tab-item.active,\n.tab-item.activated {\n  opacity: 1; }\n  .tab-item.tab-item-active.tab-item-light,\n  .tab-item.active.tab-item-light,\n  .tab-item.activated.tab-item-light {\n    color: #fff; }\n  .tab-item.tab-item-active.tab-item-stable,\n  .tab-item.active.tab-item-stable,\n  .tab-item.activated.tab-item-stable {\n    color: #f8f8f8; }\n  .tab-item.tab-item-active.tab-item-positive,\n  .tab-item.active.tab-item-positive,\n  .tab-item.activated.tab-item-positive {\n    color: #387ef5; }\n  .tab-item.tab-item-active.tab-item-calm,\n  .tab-item.active.tab-item-calm,\n  .tab-item.activated.tab-item-calm {\n    color: #11c1f3; }\n  .tab-item.tab-item-active.tab-item-assertive,\n  .tab-item.active.tab-item-assertive,\n  .tab-item.activated.tab-item-assertive {\n    color: #ef473a; }\n  .tab-item.tab-item-active.tab-item-balanced,\n  .tab-item.active.tab-item-balanced,\n  .tab-item.activated.tab-item-balanced {\n    color: #33cd5f; }\n  .tab-item.tab-item-active.tab-item-energized,\n  .tab-item.active.tab-item-energized,\n  .tab-item.activated.tab-item-energized {\n    color: #ffc900; }\n  .tab-item.tab-item-active.tab-item-royal,\n  .tab-item.active.tab-item-royal,\n  .tab-item.activated.tab-item-royal {\n    color: #886aea; }\n  .tab-item.tab-item-active.tab-item-dark,\n  .tab-item.active.tab-item-dark,\n  .tab-item.activated.tab-item-dark {\n    color: #444; }\n\n.item.tabs {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  padding: 0; }\n  .item.tabs .icon:before {\n    position: relative; }\n\n.tab-item.disabled,\n.tab-item[disabled] {\n  opacity: .4;\n  cursor: default;\n  pointer-events: none; }\n\n.nav-bar-tabs-top.hide ~ .view-container .tabs-top .tabs {\n  top: 0; }\n\n.pane[hide-nav-bar=\"true\"] .has-tabs-top {\n  top: 49px; }\n\n/**\n * Menus\n * --------------------------------------------------\n * Side panel structure\n */\n.menu {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  z-index: 0;\n  overflow: hidden;\n  min-height: 100%;\n  max-height: 100%;\n  width: 275px;\n  background-color: #fff; }\n  .menu .scroll-content {\n    z-index: 10; }\n  .menu .bar-header {\n    z-index: 11; }\n\n.menu-content {\n  -webkit-transform: none;\n  transform: none;\n  box-shadow: -1px 0px 2px rgba(0, 0, 0, 0.2), 1px 0px 2px rgba(0, 0, 0, 0.2); }\n\n.menu-open .menu-content .pane,\n.menu-open .menu-content .scroll-content {\n  pointer-events: none; }\n\n.menu-open .menu-content .scroll-content .scroll {\n  pointer-events: none; }\n\n.menu-open .menu-content .scroll-content:not(.overflow-scroll) {\n  overflow: hidden; }\n\n.grade-b .menu-content,\n.grade-c .menu-content {\n  -webkit-box-sizing: content-box;\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  right: -1px;\n  left: -1px;\n  border-right: 1px solid #ccc;\n  border-left: 1px solid #ccc;\n  box-shadow: none; }\n\n.menu-left {\n  left: 0; }\n\n.menu-right {\n  right: 0; }\n\n.aside-open.aside-resizing .menu-right {\n  display: none; }\n\n.menu-animated {\n  -webkit-transition: -webkit-transform 200ms ease;\n  transition: transform 200ms ease; }\n\n/**\n * Modals\n * --------------------------------------------------\n * Modals are independent windows that slide in from off-screen.\n */\n.modal-backdrop,\n.modal-backdrop-bg {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 10;\n  width: 100%;\n  height: 100%; }\n\n.modal-backdrop-bg {\n  pointer-events: none; }\n\n.modal {\n  display: block;\n  position: absolute;\n  top: 0;\n  z-index: 10;\n  overflow: hidden;\n  min-height: 100%;\n  width: 100%;\n  background-color: #fff; }\n\n@media (min-width: 680px) {\n  .modal {\n    top: 20%;\n    right: 20%;\n    bottom: 20%;\n    left: 20%;\n    min-height: 240px;\n    width: 60%; }\n  .modal.ng-leave-active {\n    bottom: 0; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .bar-header:not(.bar-subheader) {\n    height: 44px; }\n    .platform-ios.platform-cordova .modal-wrapper .modal .bar-header:not(.bar-subheader) > * {\n      margin-top: 0; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .tabs-top > .tabs,\n  .platform-ios.platform-cordova .modal-wrapper .modal .tabs.tabs-top {\n    top: 44px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header,\n  .platform-ios.platform-cordova .modal-wrapper .modal .bar-subheader {\n    top: 44px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-subheader {\n    top: 88px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header.has-tabs-top {\n    top: 93px; }\n  .platform-ios.platform-cordova .modal-wrapper .modal .has-header.has-subheader.has-tabs-top {\n    top: 137px; }\n  .modal-backdrop-bg {\n    -webkit-transition: opacity 300ms ease-in-out;\n    transition: opacity 300ms ease-in-out;\n    background-color: #000;\n    opacity: 0; }\n  .active .modal-backdrop-bg {\n    opacity: 0.5; } }\n\n.modal-open {\n  pointer-events: none; }\n  .modal-open .modal,\n  .modal-open .modal-backdrop {\n    pointer-events: auto; }\n  .modal-open.loading-active .modal,\n  .modal-open.loading-active .modal-backdrop {\n    pointer-events: none; }\n\n/**\n * Popovers\n * --------------------------------------------------\n * Popovers are independent views which float over content\n */\n.popover-backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: 10;\n  width: 100%;\n  height: 100%;\n  background-color: transparent; }\n  .popover-backdrop.active {\n    background-color: rgba(0, 0, 0, 0.1); }\n\n.popover {\n  position: absolute;\n  top: 25%;\n  left: 50%;\n  z-index: 10;\n  display: block;\n  margin-top: 12px;\n  margin-left: -110px;\n  height: 280px;\n  width: 220px;\n  background-color: #fff;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);\n  opacity: 0; }\n  .popover .item:first-child {\n    border-top: 0; }\n  .popover .item:last-child {\n    border-bottom: 0; }\n  .popover.popover-bottom {\n    margin-top: -12px; }\n\n.popover,\n.popover .bar-header {\n  border-radius: 2px; }\n\n.popover .scroll-content {\n  z-index: 1;\n  margin: 2px 0; }\n\n.popover .bar-header {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0; }\n\n.popover .has-header {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0; }\n\n.popover-arrow {\n  display: none; }\n\n.platform-ios .popover {\n  box-shadow: 0 0 40px rgba(0, 0, 0, 0.08);\n  border-radius: 10px; }\n\n.platform-ios .popover .bar-header {\n  -webkit-border-top-right-radius: 10px;\n  border-top-right-radius: 10px;\n  -webkit-border-top-left-radius: 10px;\n  border-top-left-radius: 10px; }\n\n.platform-ios .popover .scroll-content {\n  margin: 8px 0;\n  border-radius: 10px; }\n\n.platform-ios .popover .scroll-content.has-header {\n  margin-top: 0; }\n\n.platform-ios .popover-arrow {\n  position: absolute;\n  display: block;\n  top: -17px;\n  width: 30px;\n  height: 19px;\n  overflow: hidden; }\n  .platform-ios .popover-arrow:after {\n    position: absolute;\n    top: 12px;\n    left: 5px;\n    width: 20px;\n    height: 20px;\n    background-color: #fff;\n    border-radius: 3px;\n    content: '';\n    -webkit-transform: rotate(-45deg);\n    transform: rotate(-45deg); }\n\n.platform-ios .popover-bottom .popover-arrow {\n  top: auto;\n  bottom: -10px; }\n  .platform-ios .popover-bottom .popover-arrow:after {\n    top: -6px; }\n\n.platform-android .popover {\n  margin-top: -32px;\n  background-color: #fafafa;\n  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }\n  .platform-android .popover .item {\n    border-color: #fafafa;\n    background-color: #fafafa;\n    color: #4d4d4d; }\n  .platform-android .popover.popover-bottom {\n    margin-top: 32px; }\n\n.platform-android .popover-backdrop,\n.platform-android .popover-backdrop.active {\n  background-color: transparent; }\n\n.popover-open {\n  pointer-events: none; }\n  .popover-open .popover,\n  .popover-open .popover-backdrop {\n    pointer-events: auto; }\n  .popover-open.loading-active .popover,\n  .popover-open.loading-active .popover-backdrop {\n    pointer-events: none; }\n\n@media (min-width: 680px) {\n  .popover {\n    width: 360px;\n    margin-left: -180px; } }\n\n/**\n * Popups\n * --------------------------------------------------\n */\n.popup-container {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  right: 0;\n  background: transparent;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  z-index: 12;\n  visibility: hidden; }\n  .popup-container.popup-showing {\n    visibility: visible; }\n  .popup-container.popup-hidden .popup {\n    -webkit-animation-name: scaleOut;\n    animation-name: scaleOut;\n    -webkit-animation-duration: 0.1s;\n    animation-duration: 0.1s;\n    -webkit-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .popup-container.active .popup {\n    -webkit-animation-name: superScaleIn;\n    animation-name: superScaleIn;\n    -webkit-animation-duration: 0.2s;\n    animation-duration: 0.2s;\n    -webkit-animation-timing-function: ease-in-out;\n    animation-timing-function: ease-in-out;\n    -webkit-animation-fill-mode: both;\n    animation-fill-mode: both; }\n  .popup-container .popup {\n    width: 250px;\n    max-width: 100%;\n    max-height: 90%;\n    border-radius: 0px;\n    background-color: rgba(255, 255, 255, 0.9);\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -moz-box;\n    display: -moz-flex;\n    display: -ms-flexbox;\n    display: flex;\n    -webkit-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -moz-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n  .popup-container input,\n  .popup-container textarea {\n    width: 100%; }\n\n.popup-head {\n  padding: 15px 10px;\n  border-bottom: 1px solid #eee;\n  text-align: center; }\n\n.popup-title {\n  margin: 0;\n  padding: 0;\n  font-size: 15px; }\n\n.popup-sub-title {\n  margin: 5px 0 0 0;\n  padding: 0;\n  font-weight: normal;\n  font-size: 11px; }\n\n.popup-body {\n  padding: 10px;\n  overflow: auto; }\n\n.popup-buttons {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-direction: normal;\n  -webkit-box-orient: horizontal;\n  -webkit-flex-direction: row;\n  -moz-flex-direction: row;\n  -ms-flex-direction: row;\n  flex-direction: row;\n  padding: 10px;\n  min-height: 65px; }\n  .popup-buttons .button {\n    -webkit-box-flex: 1;\n    -webkit-flex: 1;\n    -moz-box-flex: 1;\n    -moz-flex: 1;\n    -ms-flex: 1;\n    flex: 1;\n    display: block;\n    min-height: 45px;\n    border-radius: 2px;\n    line-height: 20px;\n    margin-right: 5px; }\n    .popup-buttons .button:last-child {\n      margin-right: 0px; }\n\n.popup-open {\n  pointer-events: none; }\n  .popup-open.modal-open .modal {\n    pointer-events: none; }\n  .popup-open .popup-backdrop, .popup-open .popup {\n    pointer-events: auto; }\n\n/**\n * Loading\n * --------------------------------------------------\n */\n.loading-container {\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  z-index: 13;\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-pack: center;\n  -ms-flex-pack: center;\n  -webkit-justify-content: center;\n  -moz-justify-content: center;\n  justify-content: center;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  -webkit-transition: 0.2s opacity linear;\n  transition: 0.2s opacity linear;\n  visibility: hidden;\n  opacity: 0; }\n  .loading-container:not(.visible) .icon,\n  .loading-container:not(.visible) .spinner {\n    display: none; }\n  .loading-container.visible {\n    visibility: visible; }\n  .loading-container.active {\n    opacity: 1; }\n  .loading-container .loading {\n    padding: 20px;\n    border-radius: 5px;\n    background-color: rgba(0, 0, 0, 0.7);\n    color: #fff;\n    text-align: center;\n    text-overflow: ellipsis;\n    font-size: 15px; }\n    .loading-container .loading h1, .loading-container .loading h2, .loading-container .loading h3, .loading-container .loading h4, .loading-container .loading h5, .loading-container .loading h6 {\n      color: #fff; }\n\n/**\n * Items\n * --------------------------------------------------\n */\n.item {\n  border-color: #ddd;\n  background-color: #fff;\n  color: #444;\n  position: relative;\n  z-index: 2;\n  display: block;\n  margin: -1px;\n  padding: 16px;\n  border-width: 1px;\n  border-style: solid;\n  font-size: 16px; }\n  .item h2 {\n    margin: 0 0 2px 0;\n    font-size: 16px;\n    font-weight: normal; }\n  .item h3 {\n    margin: 0 0 4px 0;\n    font-size: 14px; }\n  .item h4 {\n    margin: 0 0 4px 0;\n    font-size: 12px; }\n  .item h5, .item h6 {\n    margin: 0 0 3px 0;\n    font-size: 10px; }\n  .item p {\n    color: #666;\n    font-size: 14px;\n    margin-bottom: 2px; }\n  .item h1:last-child,\n  .item h2:last-child,\n  .item h3:last-child,\n  .item h4:last-child,\n  .item h5:last-child,\n  .item h6:last-child,\n  .item p:last-child {\n    margin-bottom: 0; }\n  .item .badge {\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -moz-box;\n    display: -moz-flex;\n    display: -ms-flexbox;\n    display: flex;\n    position: absolute;\n    top: 16px;\n    right: 32px; }\n  .item.item-button-right .badge {\n    right: 67px; }\n  .item.item-divider .badge {\n    top: 8px; }\n  .item .badge + .badge {\n    margin-right: 5px; }\n  .item.item-light {\n    border-color: #ddd;\n    background-color: #fff;\n    color: #444; }\n  .item.item-stable {\n    border-color: #b2b2b2;\n    background-color: #f8f8f8;\n    color: #444; }\n  .item.item-positive {\n    border-color: #0c60ee;\n    background-color: #387ef5;\n    color: #fff; }\n  .item.item-calm {\n    border-color: #0a9dc7;\n    background-color: #11c1f3;\n    color: #fff; }\n  .item.item-assertive {\n    border-color: #e42112;\n    background-color: #ef473a;\n    color: #fff; }\n  .item.item-balanced {\n    border-color: #28a54c;\n    background-color: #33cd5f;\n    color: #fff; }\n  .item.item-energized {\n    border-color: #e6b500;\n    background-color: #ffc900;\n    color: #fff; }\n  .item.item-royal {\n    border-color: #6b46e5;\n    background-color: #886aea;\n    color: #fff; }\n  .item.item-dark {\n    border-color: #111;\n    background-color: #444;\n    color: #fff; }\n  .item[ng-click]:hover {\n    cursor: pointer; }\n\n.list-borderless .item,\n.item-borderless {\n  border-width: 0; }\n\n.item.active,\n.item.activated,\n.item-complex.active .item-content,\n.item-complex.activated .item-content,\n.item .item-content.active,\n.item .item-content.activated {\n  border-color: #ccc;\n  background-color: #D9D9D9; }\n  .item.active.item-complex > .item-content,\n  .item.activated.item-complex > .item-content,\n  .item-complex.active .item-content.item-complex > .item-content,\n  .item-complex.activated .item-content.item-complex > .item-content,\n  .item .item-content.active.item-complex > .item-content,\n  .item .item-content.activated.item-complex > .item-content {\n    border-color: #ccc;\n    background-color: #D9D9D9; }\n  .item.active.item-light,\n  .item.activated.item-light,\n  .item-complex.active .item-content.item-light,\n  .item-complex.activated .item-content.item-light,\n  .item .item-content.active.item-light,\n  .item .item-content.activated.item-light {\n    border-color: #ccc;\n    background-color: #fafafa; }\n    .item.active.item-light.item-complex > .item-content,\n    .item.activated.item-light.item-complex > .item-content,\n    .item-complex.active .item-content.item-light.item-complex > .item-content,\n    .item-complex.activated .item-content.item-light.item-complex > .item-content,\n    .item .item-content.active.item-light.item-complex > .item-content,\n    .item .item-content.activated.item-light.item-complex > .item-content {\n      border-color: #ccc;\n      background-color: #fafafa; }\n  .item.active.item-stable,\n  .item.activated.item-stable,\n  .item-complex.active .item-content.item-stable,\n  .item-complex.activated .item-content.item-stable,\n  .item .item-content.active.item-stable,\n  .item .item-content.activated.item-stable {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n    .item.active.item-stable.item-complex > .item-content,\n    .item.activated.item-stable.item-complex > .item-content,\n    .item-complex.active .item-content.item-stable.item-complex > .item-content,\n    .item-complex.activated .item-content.item-stable.item-complex > .item-content,\n    .item .item-content.active.item-stable.item-complex > .item-content,\n    .item .item-content.activated.item-stable.item-complex > .item-content {\n      border-color: #a2a2a2;\n      background-color: #e5e5e5; }\n  .item.active.item-positive,\n  .item.activated.item-positive,\n  .item-complex.active .item-content.item-positive,\n  .item-complex.activated .item-content.item-positive,\n  .item .item-content.active.item-positive,\n  .item .item-content.activated.item-positive {\n    border-color: #0c60ee;\n    background-color: #0c60ee; }\n    .item.active.item-positive.item-complex > .item-content,\n    .item.activated.item-positive.item-complex > .item-content,\n    .item-complex.active .item-content.item-positive.item-complex > .item-content,\n    .item-complex.activated .item-content.item-positive.item-complex > .item-content,\n    .item .item-content.active.item-positive.item-complex > .item-content,\n    .item .item-content.activated.item-positive.item-complex > .item-content {\n      border-color: #0c60ee;\n      background-color: #0c60ee; }\n  .item.active.item-calm,\n  .item.activated.item-calm,\n  .item-complex.active .item-content.item-calm,\n  .item-complex.activated .item-content.item-calm,\n  .item .item-content.active.item-calm,\n  .item .item-content.activated.item-calm {\n    border-color: #0a9dc7;\n    background-color: #0a9dc7; }\n    .item.active.item-calm.item-complex > .item-content,\n    .item.activated.item-calm.item-complex > .item-content,\n    .item-complex.active .item-content.item-calm.item-complex > .item-content,\n    .item-complex.activated .item-content.item-calm.item-complex > .item-content,\n    .item .item-content.active.item-calm.item-complex > .item-content,\n    .item .item-content.activated.item-calm.item-complex > .item-content {\n      border-color: #0a9dc7;\n      background-color: #0a9dc7; }\n  .item.active.item-assertive,\n  .item.activated.item-assertive,\n  .item-complex.active .item-content.item-assertive,\n  .item-complex.activated .item-content.item-assertive,\n  .item .item-content.active.item-assertive,\n  .item .item-content.activated.item-assertive {\n    border-color: #e42112;\n    background-color: #e42112; }\n    .item.active.item-assertive.item-complex > .item-content,\n    .item.activated.item-assertive.item-complex > .item-content,\n    .item-complex.active .item-content.item-assertive.item-complex > .item-content,\n    .item-complex.activated .item-content.item-assertive.item-complex > .item-content,\n    .item .item-content.active.item-assertive.item-complex > .item-content,\n    .item .item-content.activated.item-assertive.item-complex > .item-content {\n      border-color: #e42112;\n      background-color: #e42112; }\n  .item.active.item-balanced,\n  .item.activated.item-balanced,\n  .item-complex.active .item-content.item-balanced,\n  .item-complex.activated .item-content.item-balanced,\n  .item .item-content.active.item-balanced,\n  .item .item-content.activated.item-balanced {\n    border-color: #28a54c;\n    background-color: #28a54c; }\n    .item.active.item-balanced.item-complex > .item-content,\n    .item.activated.item-balanced.item-complex > .item-content,\n    .item-complex.active .item-content.item-balanced.item-complex > .item-content,\n    .item-complex.activated .item-content.item-balanced.item-complex > .item-content,\n    .item .item-content.active.item-balanced.item-complex > .item-content,\n    .item .item-content.activated.item-balanced.item-complex > .item-content {\n      border-color: #28a54c;\n      background-color: #28a54c; }\n  .item.active.item-energized,\n  .item.activated.item-energized,\n  .item-complex.active .item-content.item-energized,\n  .item-complex.activated .item-content.item-energized,\n  .item .item-content.active.item-energized,\n  .item .item-content.activated.item-energized {\n    border-color: #e6b500;\n    background-color: #e6b500; }\n    .item.active.item-energized.item-complex > .item-content,\n    .item.activated.item-energized.item-complex > .item-content,\n    .item-complex.active .item-content.item-energized.item-complex > .item-content,\n    .item-complex.activated .item-content.item-energized.item-complex > .item-content,\n    .item .item-content.active.item-energized.item-complex > .item-content,\n    .item .item-content.activated.item-energized.item-complex > .item-content {\n      border-color: #e6b500;\n      background-color: #e6b500; }\n  .item.active.item-royal,\n  .item.activated.item-royal,\n  .item-complex.active .item-content.item-royal,\n  .item-complex.activated .item-content.item-royal,\n  .item .item-content.active.item-royal,\n  .item .item-content.activated.item-royal {\n    border-color: #6b46e5;\n    background-color: #6b46e5; }\n    .item.active.item-royal.item-complex > .item-content,\n    .item.activated.item-royal.item-complex > .item-content,\n    .item-complex.active .item-content.item-royal.item-complex > .item-content,\n    .item-complex.activated .item-content.item-royal.item-complex > .item-content,\n    .item .item-content.active.item-royal.item-complex > .item-content,\n    .item .item-content.activated.item-royal.item-complex > .item-content {\n      border-color: #6b46e5;\n      background-color: #6b46e5; }\n  .item.active.item-dark,\n  .item.activated.item-dark,\n  .item-complex.active .item-content.item-dark,\n  .item-complex.activated .item-content.item-dark,\n  .item .item-content.active.item-dark,\n  .item .item-content.activated.item-dark {\n    border-color: #000;\n    background-color: #262626; }\n    .item.active.item-dark.item-complex > .item-content,\n    .item.activated.item-dark.item-complex > .item-content,\n    .item-complex.active .item-content.item-dark.item-complex > .item-content,\n    .item-complex.activated .item-content.item-dark.item-complex > .item-content,\n    .item .item-content.active.item-dark.item-complex > .item-content,\n    .item .item-content.activated.item-dark.item-complex > .item-content {\n      border-color: #000;\n      background-color: #262626; }\n\n.item,\n.item h1,\n.item h2,\n.item h3,\n.item h4,\n.item h5,\n.item h6,\n.item p,\n.item-content,\n.item-content h1,\n.item-content h2,\n.item-content h3,\n.item-content h4,\n.item-content h5,\n.item-content h6,\n.item-content p {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap; }\n\na.item {\n  color: inherit;\n  text-decoration: none; }\n  a.item:hover, a.item:focus {\n    text-decoration: none; }\n\n/**\n * Complex Items\n * --------------------------------------------------\n * Adding .item-complex allows the .item to be slidable and\n * have options underneath the button, but also requires an\n * additional .item-content element inside .item.\n * Basically .item-complex removes any default settings which\n * .item added, so that .item-content looks them as just .item.\n */\n.item-complex,\na.item.item-complex,\nbutton.item.item-complex {\n  padding: 0; }\n\n.item-complex .item-content,\n.item-radio .item-content {\n  position: relative;\n  z-index: 2;\n  padding: 16px 49px 16px 16px;\n  border: none;\n  background-color: #fff; }\n\na.item-content {\n  display: block;\n  color: inherit;\n  text-decoration: none; }\n\n.item-text-wrap .item,\n.item-text-wrap .item-content,\n.item-text-wrap,\n.item-text-wrap h1,\n.item-text-wrap h2,\n.item-text-wrap h3,\n.item-text-wrap h4,\n.item-text-wrap h5,\n.item-text-wrap h6,\n.item-text-wrap p,\n.item-complex.item-text-wrap .item-content,\n.item-body h1,\n.item-body h2,\n.item-body h3,\n.item-body h4,\n.item-body h5,\n.item-body h6,\n.item-body p {\n  overflow: visible;\n  white-space: normal; }\n\n.item-complex.item-text-wrap,\n.item-complex.item-text-wrap h1,\n.item-complex.item-text-wrap h2,\n.item-complex.item-text-wrap h3,\n.item-complex.item-text-wrap h4,\n.item-complex.item-text-wrap h5,\n.item-complex.item-text-wrap h6,\n.item-complex.item-text-wrap p {\n  overflow: visible;\n  white-space: normal; }\n\n.item-complex.item-light > .item-content {\n  border-color: #ddd;\n  background-color: #fff;\n  color: #444; }\n  .item-complex.item-light > .item-content.active, .item-complex.item-light > .item-content:active {\n    border-color: #ccc;\n    background-color: #fafafa; }\n    .item-complex.item-light > .item-content.active.item-complex > .item-content, .item-complex.item-light > .item-content:active.item-complex > .item-content {\n      border-color: #ccc;\n      background-color: #fafafa; }\n\n.item-complex.item-stable > .item-content {\n  border-color: #b2b2b2;\n  background-color: #f8f8f8;\n  color: #444; }\n  .item-complex.item-stable > .item-content.active, .item-complex.item-stable > .item-content:active {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n    .item-complex.item-stable > .item-content.active.item-complex > .item-content, .item-complex.item-stable > .item-content:active.item-complex > .item-content {\n      border-color: #a2a2a2;\n      background-color: #e5e5e5; }\n\n.item-complex.item-positive > .item-content {\n  border-color: #0c60ee;\n  background-color: #387ef5;\n  color: #fff; }\n  .item-complex.item-positive > .item-content.active, .item-complex.item-positive > .item-content:active {\n    border-color: #0c60ee;\n    background-color: #0c60ee; }\n    .item-complex.item-positive > .item-content.active.item-complex > .item-content, .item-complex.item-positive > .item-content:active.item-complex > .item-content {\n      border-color: #0c60ee;\n      background-color: #0c60ee; }\n\n.item-complex.item-calm > .item-content {\n  border-color: #0a9dc7;\n  background-color: #11c1f3;\n  color: #fff; }\n  .item-complex.item-calm > .item-content.active, .item-complex.item-calm > .item-content:active {\n    border-color: #0a9dc7;\n    background-color: #0a9dc7; }\n    .item-complex.item-calm > .item-content.active.item-complex > .item-content, .item-complex.item-calm > .item-content:active.item-complex > .item-content {\n      border-color: #0a9dc7;\n      background-color: #0a9dc7; }\n\n.item-complex.item-assertive > .item-content {\n  border-color: #e42112;\n  background-color: #ef473a;\n  color: #fff; }\n  .item-complex.item-assertive > .item-content.active, .item-complex.item-assertive > .item-content:active {\n    border-color: #e42112;\n    background-color: #e42112; }\n    .item-complex.item-assertive > .item-content.active.item-complex > .item-content, .item-complex.item-assertive > .item-content:active.item-complex > .item-content {\n      border-color: #e42112;\n      background-color: #e42112; }\n\n.item-complex.item-balanced > .item-content {\n  border-color: #28a54c;\n  background-color: #33cd5f;\n  color: #fff; }\n  .item-complex.item-balanced > .item-content.active, .item-complex.item-balanced > .item-content:active {\n    border-color: #28a54c;\n    background-color: #28a54c; }\n    .item-complex.item-balanced > .item-content.active.item-complex > .item-content, .item-complex.item-balanced > .item-content:active.item-complex > .item-content {\n      border-color: #28a54c;\n      background-color: #28a54c; }\n\n.item-complex.item-energized > .item-content {\n  border-color: #e6b500;\n  background-color: #ffc900;\n  color: #fff; }\n  .item-complex.item-energized > .item-content.active, .item-complex.item-energized > .item-content:active {\n    border-color: #e6b500;\n    background-color: #e6b500; }\n    .item-complex.item-energized > .item-content.active.item-complex > .item-content, .item-complex.item-energized > .item-content:active.item-complex > .item-content {\n      border-color: #e6b500;\n      background-color: #e6b500; }\n\n.item-complex.item-royal > .item-content {\n  border-color: #6b46e5;\n  background-color: #886aea;\n  color: #fff; }\n  .item-complex.item-royal > .item-content.active, .item-complex.item-royal > .item-content:active {\n    border-color: #6b46e5;\n    background-color: #6b46e5; }\n    .item-complex.item-royal > .item-content.active.item-complex > .item-content, .item-complex.item-royal > .item-content:active.item-complex > .item-content {\n      border-color: #6b46e5;\n      background-color: #6b46e5; }\n\n.item-complex.item-dark > .item-content {\n  border-color: #111;\n  background-color: #444;\n  color: #fff; }\n  .item-complex.item-dark > .item-content.active, .item-complex.item-dark > .item-content:active {\n    border-color: #000;\n    background-color: #262626; }\n    .item-complex.item-dark > .item-content.active.item-complex > .item-content, .item-complex.item-dark > .item-content:active.item-complex > .item-content {\n      border-color: #000;\n      background-color: #262626; }\n\n/**\n * Item Icons\n * --------------------------------------------------\n */\n.item-icon-left .icon,\n.item-icon-right .icon {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 0;\n  height: 100%;\n  font-size: 32px; }\n  .item-icon-left .icon:before,\n  .item-icon-right .icon:before {\n    display: block;\n    width: 32px;\n    text-align: center; }\n\n.item .fill-icon {\n  min-width: 30px;\n  min-height: 30px;\n  font-size: 28px; }\n\n.item-icon-left {\n  padding-left: 54px; }\n  .item-icon-left .icon {\n    left: 11px; }\n\n.item-complex.item-icon-left {\n  padding-left: 0; }\n  .item-complex.item-icon-left .item-content {\n    padding-left: 54px; }\n\n.item-icon-right {\n  padding-right: 54px; }\n  .item-icon-right .icon {\n    right: 11px; }\n\n.item-complex.item-icon-right {\n  padding-right: 0; }\n  .item-complex.item-icon-right .item-content {\n    padding-right: 54px; }\n\n.item-icon-left.item-icon-right .icon:first-child {\n  right: auto; }\n\n.item-icon-left.item-icon-right .icon:last-child,\n.item-icon-left .item-delete .icon {\n  left: auto; }\n\n.item-icon-left .icon-accessory,\n.item-icon-right .icon-accessory {\n  color: #ccc;\n  font-size: 16px; }\n\n.item-icon-left .icon-accessory {\n  left: 3px; }\n\n.item-icon-right .icon-accessory {\n  right: 3px; }\n\n/**\n * Item Button\n * --------------------------------------------------\n * An item button is a child button inside an .item (not the entire .item)\n */\n.item-button-left {\n  padding-left: 72px; }\n\n.item-button-left > .button,\n.item-button-left .item-content > .button {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 8px;\n  left: 11px;\n  min-width: 34px;\n  min-height: 34px;\n  font-size: 18px;\n  line-height: 32px; }\n  .item-button-left > .button .icon:before,\n  .item-button-left .item-content > .button .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: 31px; }\n  .item-button-left > .button > .button,\n  .item-button-left .item-content > .button > .button {\n    margin: 0px 2px;\n    min-height: 34px;\n    font-size: 18px;\n    line-height: 32px; }\n\n.item-button-right,\na.item.item-button-right,\nbutton.item.item-button-right {\n  padding-right: 80px; }\n\n.item-button-right > .button,\n.item-button-right .item-content > .button,\n.item-button-right > .buttons,\n.item-button-right .item-content > .buttons {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: absolute;\n  top: 8px;\n  right: 16px;\n  min-width: 34px;\n  min-height: 34px;\n  font-size: 18px;\n  line-height: 32px; }\n  .item-button-right > .button .icon:before,\n  .item-button-right .item-content > .button .icon:before,\n  .item-button-right > .buttons .icon:before,\n  .item-button-right .item-content > .buttons .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: 31px; }\n  .item-button-right > .button > .button,\n  .item-button-right .item-content > .button > .button,\n  .item-button-right > .buttons > .button,\n  .item-button-right .item-content > .buttons > .button {\n    margin: 0px 2px;\n    min-width: 34px;\n    min-height: 34px;\n    font-size: 18px;\n    line-height: 32px; }\n\n.item-button-left.item-button-right .button:first-child {\n  right: auto; }\n\n.item-button-left.item-button-right .button:last-child {\n  left: auto; }\n\n.item-avatar,\n.item-avatar .item-content,\n.item-avatar-left,\n.item-avatar-left .item-content {\n  padding-left: 72px;\n  min-height: 72px; }\n  .item-avatar > img:first-child,\n  .item-avatar .item-image,\n  .item-avatar .item-content > img:first-child,\n  .item-avatar .item-content .item-image,\n  .item-avatar-left > img:first-child,\n  .item-avatar-left .item-image,\n  .item-avatar-left .item-content > img:first-child,\n  .item-avatar-left .item-content .item-image {\n    position: absolute;\n    top: 16px;\n    left: 16px;\n    max-width: 40px;\n    max-height: 40px;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%; }\n\n.item-avatar-right,\n.item-avatar-right .item-content {\n  padding-right: 72px;\n  min-height: 72px; }\n  .item-avatar-right > img:first-child,\n  .item-avatar-right .item-image,\n  .item-avatar-right .item-content > img:first-child,\n  .item-avatar-right .item-content .item-image {\n    position: absolute;\n    top: 16px;\n    right: 16px;\n    max-width: 40px;\n    max-height: 40px;\n    width: 100%;\n    height: 100%;\n    border-radius: 50%; }\n\n.item-thumbnail-left,\n.item-thumbnail-left .item-content {\n  padding-top: 8px;\n  padding-left: 106px;\n  min-height: 100px; }\n  .item-thumbnail-left > img:first-child,\n  .item-thumbnail-left .item-image,\n  .item-thumbnail-left .item-content > img:first-child,\n  .item-thumbnail-left .item-content .item-image {\n    position: absolute;\n    top: 10px;\n    left: 10px;\n    max-width: 80px;\n    max-height: 80px;\n    width: 100%;\n    height: 100%; }\n\n.item-avatar.item-complex,\n.item-avatar-left.item-complex,\n.item-thumbnail-left.item-complex {\n  padding-top: 0;\n  padding-left: 0; }\n\n.item-thumbnail-right,\n.item-thumbnail-right .item-content {\n  padding-top: 8px;\n  padding-right: 106px;\n  min-height: 100px; }\n  .item-thumbnail-right > img:first-child,\n  .item-thumbnail-right .item-image,\n  .item-thumbnail-right .item-content > img:first-child,\n  .item-thumbnail-right .item-content .item-image {\n    position: absolute;\n    top: 10px;\n    right: 10px;\n    max-width: 80px;\n    max-height: 80px;\n    width: 100%;\n    height: 100%; }\n\n.item-avatar-right.item-complex,\n.item-thumbnail-right.item-complex {\n  padding-top: 0;\n  padding-right: 0; }\n\n.item-image {\n  padding: 0;\n  text-align: center; }\n  .item-image img:first-child, .item-image .list-img {\n    width: 100%;\n    vertical-align: middle; }\n\n.item-body {\n  overflow: auto;\n  padding: 16px;\n  text-overflow: inherit;\n  white-space: normal; }\n  .item-body h1, .item-body h2, .item-body h3, .item-body h4, .item-body h5, .item-body h6, .item-body p {\n    margin-top: 16px;\n    margin-bottom: 16px; }\n\n.item-divider {\n  padding-top: 8px;\n  padding-bottom: 8px;\n  min-height: 30px;\n  background-color: #f5f5f5;\n  color: #222;\n  font-weight: 500; }\n\n.platform-ios .item-divider-platform,\n.item-divider-ios {\n  padding-top: 26px;\n  text-transform: uppercase;\n  font-weight: 300;\n  font-size: 13px;\n  background-color: #efeff4;\n  color: #555; }\n\n.platform-android .item-divider-platform,\n.item-divider-android {\n  font-weight: 300;\n  font-size: 13px; }\n\n.item-note {\n  float: right;\n  color: #aaa;\n  font-size: 14px; }\n\n.item-left-editable .item-content,\n.item-right-editable .item-content {\n  -webkit-transition-duration: 250ms;\n  transition-duration: 250ms;\n  -webkit-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  -webkit-transition-property: -webkit-transform;\n  -moz-transition-property: -moz-transform;\n  transition-property: transform; }\n\n.list-left-editing .item-left-editable .item-content,\n.item-left-editing.item-left-editable .item-content {\n  -webkit-transform: translate3d(50px, 0, 0);\n  transform: translate3d(50px, 0, 0); }\n\n.item-remove-animate.ng-leave {\n  -webkit-transition-duration: 300ms;\n  transition-duration: 300ms; }\n\n.item-remove-animate.ng-leave .item-content, .item-remove-animate.ng-leave:last-of-type {\n  -webkit-transition-duration: 300ms;\n  transition-duration: 300ms;\n  -webkit-transition-timing-function: ease-in;\n  transition-timing-function: ease-in;\n  -webkit-transition-property: all;\n  transition-property: all; }\n\n.item-remove-animate.ng-leave.ng-leave-active .item-content {\n  opacity: 0;\n  -webkit-transform: translate3d(-100%, 0, 0) !important;\n  transform: translate3d(-100%, 0, 0) !important; }\n\n.item-remove-animate.ng-leave.ng-leave-active:last-of-type {\n  opacity: 0; }\n\n.item-remove-animate.ng-leave.ng-leave-active ~ ion-item:not(.ng-leave) {\n  -webkit-transform: translate3d(0, -webkit-calc(-100% + 1px), 0);\n  transform: translate3d(0, calc(-100% + 1px), 0);\n  -webkit-transition-duration: 300ms;\n  transition-duration: 300ms;\n  -webkit-transition-timing-function: cubic-bezier(0.25, 0.81, 0.24, 1);\n  transition-timing-function: cubic-bezier(0.25, 0.81, 0.24, 1);\n  -webkit-transition-property: all;\n  transition-property: all; }\n\n.item-left-edit {\n  -webkit-transition: all ease-in-out 125ms;\n  transition: all ease-in-out 125ms;\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 0;\n  width: 50px;\n  height: 100%;\n  line-height: 100%;\n  display: none;\n  opacity: 0;\n  -webkit-transform: translate3d(-21px, 0, 0);\n  transform: translate3d(-21px, 0, 0); }\n  .item-left-edit .button {\n    height: 100%; }\n    .item-left-edit .button.icon {\n      display: -webkit-box;\n      display: -webkit-flex;\n      display: -moz-box;\n      display: -moz-flex;\n      display: -ms-flexbox;\n      display: flex;\n      -webkit-box-align: center;\n      -ms-flex-align: center;\n      -webkit-align-items: center;\n      -moz-align-items: center;\n      align-items: center;\n      position: absolute;\n      top: 0;\n      height: 100%; }\n  .item-left-edit.visible {\n    display: block; }\n    .item-left-edit.visible.active {\n      opacity: 1;\n      -webkit-transform: translate3d(8px, 0, 0);\n      transform: translate3d(8px, 0, 0); }\n\n.list-left-editing .item-left-edit {\n  -webkit-transition-delay: 125ms;\n  transition-delay: 125ms; }\n\n.item-delete .button.icon {\n  color: #ef473a;\n  font-size: 24px; }\n  .item-delete .button.icon:hover {\n    opacity: .7; }\n\n.item-right-edit {\n  -webkit-transition: all ease-in-out 250ms;\n  transition: all ease-in-out 250ms;\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 3;\n  width: 75px;\n  height: 100%;\n  background: inherit;\n  padding-left: 20px;\n  display: block;\n  opacity: 0;\n  -webkit-transform: translate3d(75px, 0, 0);\n  transform: translate3d(75px, 0, 0); }\n  .item-right-edit .button {\n    min-width: 50px;\n    height: 100%; }\n    .item-right-edit .button.icon {\n      display: -webkit-box;\n      display: -webkit-flex;\n      display: -moz-box;\n      display: -moz-flex;\n      display: -ms-flexbox;\n      display: flex;\n      -webkit-box-align: center;\n      -ms-flex-align: center;\n      -webkit-align-items: center;\n      -moz-align-items: center;\n      align-items: center;\n      position: absolute;\n      top: 0;\n      height: 100%;\n      font-size: 32px; }\n  .item-right-edit.visible {\n    display: block; }\n    .item-right-edit.visible.active {\n      opacity: 1;\n      -webkit-transform: translate3d(0, 0, 0);\n      transform: translate3d(0, 0, 0); }\n\n.item-reorder .button.icon {\n  color: #444;\n  font-size: 32px; }\n\n.item-reordering {\n  position: absolute;\n  left: 0;\n  top: 0;\n  z-index: 9;\n  width: 100%;\n  box-shadow: 0px 0px 10px 0px #aaa; }\n  .item-reordering .item-reorder {\n    z-index: 9; }\n\n.item-placeholder {\n  opacity: 0.7; }\n\n/**\n * The hidden right-side buttons that can be exposed under a list item\n * with dragging.\n */\n.item-options {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 1;\n  height: 100%; }\n  .item-options .button {\n    height: 100%;\n    border: none;\n    border-radius: 0;\n    display: -webkit-inline-box;\n    display: -webkit-inline-flex;\n    display: -moz-inline-flex;\n    display: -ms-inline-flexbox;\n    display: inline-flex;\n    -webkit-box-align: center;\n    -ms-flex-align: center;\n    -webkit-align-items: center;\n    -moz-align-items: center;\n    align-items: center; }\n    .item-options .button:before {\n      margin: 0 auto; }\n\n/**\n * Lists\n * --------------------------------------------------\n */\n.list {\n  position: relative;\n  padding-top: 1px;\n  padding-bottom: 1px;\n  padding-left: 0;\n  margin-bottom: 20px; }\n\n.list:last-child {\n  margin-bottom: 0px; }\n  .list:last-child.card {\n    margin-bottom: 40px; }\n\n/**\n * List Header\n * --------------------------------------------------\n */\n.list-header {\n  margin-top: 20px;\n  padding: 5px 15px;\n  background-color: transparent;\n  color: #222;\n  font-weight: bold; }\n\n.card.list .list-item {\n  padding-right: 1px;\n  padding-left: 1px; }\n\n/**\n * Cards and Inset Lists\n * --------------------------------------------------\n * A card and list-inset are close to the same thing, except a card as a box shadow.\n */\n.card,\n.list-inset {\n  overflow: hidden;\n  margin: 20px 10px;\n  border-radius: 2px;\n  background-color: #fff; }\n\n.card {\n  padding-top: 1px;\n  padding-bottom: 1px;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }\n  .card .item {\n    border-left: 0;\n    border-right: 0; }\n  .card .item:first-child {\n    border-top: 0; }\n  .card .item:last-child {\n    border-bottom: 0; }\n\n.padding .card, .padding .list-inset {\n  margin-left: 0;\n  margin-right: 0; }\n\n.card .item:first-child,\n.list-inset .item:first-child,\n.padding > .list .item:first-child {\n  border-top-left-radius: 2px;\n  border-top-right-radius: 2px; }\n  .card .item:first-child .item-content,\n  .list-inset .item:first-child .item-content,\n  .padding > .list .item:first-child .item-content {\n    border-top-left-radius: 2px;\n    border-top-right-radius: 2px; }\n\n.card .item:last-child,\n.list-inset .item:last-child,\n.padding > .list .item:last-child {\n  border-bottom-right-radius: 2px;\n  border-bottom-left-radius: 2px; }\n  .card .item:last-child .item-content,\n  .list-inset .item:last-child .item-content,\n  .padding > .list .item:last-child .item-content {\n    border-bottom-right-radius: 2px;\n    border-bottom-left-radius: 2px; }\n\n.card .item:last-child,\n.list-inset .item:last-child {\n  margin-bottom: -1px; }\n\n.card .item,\n.list-inset .item,\n.padding > .list .item,\n.padding-horizontal > .list .item {\n  margin-right: 0;\n  margin-left: 0; }\n  .card .item.item-input input,\n  .list-inset .item.item-input input,\n  .padding > .list .item.item-input input,\n  .padding-horizontal > .list .item.item-input input {\n    padding-right: 44px; }\n\n.padding-left > .list .item {\n  margin-left: 0; }\n\n.padding-right > .list .item {\n  margin-right: 0; }\n\n/**\n * Badges\n * --------------------------------------------------\n */\n.badge {\n  background-color: transparent;\n  color: #AAAAAA;\n  z-index: 1;\n  display: inline-block;\n  padding: 3px 8px;\n  min-width: 10px;\n  border-radius: 10px;\n  vertical-align: baseline;\n  text-align: center;\n  white-space: nowrap;\n  font-weight: bold;\n  font-size: 14px;\n  line-height: 16px; }\n  .badge:empty {\n    display: none; }\n\n.tabs .tab-item .badge.badge-light,\n.badge.badge-light {\n  background-color: #fff;\n  color: #444; }\n\n.tabs .tab-item .badge.badge-stable,\n.badge.badge-stable {\n  background-color: #f8f8f8;\n  color: #444; }\n\n.tabs .tab-item .badge.badge-positive,\n.badge.badge-positive {\n  background-color: #387ef5;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-calm,\n.badge.badge-calm {\n  background-color: #11c1f3;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-assertive,\n.badge.badge-assertive {\n  background-color: #ef473a;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-balanced,\n.badge.badge-balanced {\n  background-color: #33cd5f;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-energized,\n.badge.badge-energized {\n  background-color: #ffc900;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-royal,\n.badge.badge-royal {\n  background-color: #886aea;\n  color: #fff; }\n\n.tabs .tab-item .badge.badge-dark,\n.badge.badge-dark {\n  background-color: #444;\n  color: #fff; }\n\n.button .badge {\n  position: relative;\n  top: -1px; }\n\n/**\n * Slide Box\n * --------------------------------------------------\n */\n.slider {\n  position: relative;\n  visibility: hidden;\n  overflow: hidden; }\n\n.slider-slides {\n  position: relative;\n  height: 100%; }\n\n.slider-slide {\n  position: relative;\n  display: block;\n  float: left;\n  width: 100%;\n  height: 100%;\n  vertical-align: top; }\n\n.slider-slide-image > img {\n  width: 100%; }\n\n.slider-pager {\n  position: absolute;\n  bottom: 20px;\n  z-index: 1;\n  width: 100%;\n  height: 15px;\n  text-align: center; }\n  .slider-pager .slider-pager-page {\n    display: inline-block;\n    margin: 0px 3px;\n    width: 15px;\n    color: #000;\n    text-decoration: none;\n    opacity: 0.3; }\n    .slider-pager .slider-pager-page.active {\n      -webkit-transition: opacity 0.4s ease-in;\n      transition: opacity 0.4s ease-in;\n      opacity: 1; }\n\n.slider-slide.ng-enter, .slider-slide.ng-leave, .slider-slide.ng-animate,\n.slider-pager-page.ng-enter,\n.slider-pager-page.ng-leave,\n.slider-pager-page.ng-animate {\n  -webkit-transition: none !important;\n  transition: none !important; }\n\n.slider-slide.ng-animate,\n.slider-pager-page.ng-animate {\n  -webkit-animation: none 0s;\n  animation: none 0s; }\n\n/**\n * Swiper 3.2.7\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n *\n * http://www.idangero.us/swiper/\n *\n * Copyright 2015, Vladimir Kharlampidi\n * The iDangero.us\n * http://www.idangero.us/\n *\n * Licensed under MIT\n *\n * Released on: December 7, 2015\n */\n.swiper-container {\n  margin: 0 auto;\n  position: relative;\n  overflow: hidden;\n  /* Fix of Webkit flickering */\n  z-index: 1; }\n\n.swiper-container-no-flexbox .swiper-slide {\n  float: left; }\n\n.swiper-container-vertical > .swiper-wrapper {\n  -webkit-box-orient: vertical;\n  -moz-box-orient: vertical;\n  -ms-flex-direction: column;\n  -webkit-flex-direction: column;\n  flex-direction: column; }\n\n.swiper-wrapper {\n  position: relative;\n  width: 100%;\n  height: 100%;\n  z-index: 1;\n  display: -webkit-box;\n  display: -moz-box;\n  display: -ms-flexbox;\n  display: -webkit-flex;\n  display: flex;\n  -webkit-transition-property: -webkit-transform;\n  -moz-transition-property: -moz-transform;\n  -o-transition-property: -o-transform;\n  -ms-transition-property: -ms-transform;\n  transition-property: transform;\n  -webkit-box-sizing: content-box;\n  -moz-box-sizing: content-box;\n  box-sizing: content-box; }\n\n.swiper-container-android .swiper-slide,\n.swiper-wrapper {\n  -webkit-transform: translate3d(0px, 0, 0);\n  -moz-transform: translate3d(0px, 0, 0);\n  -o-transform: translate(0px, 0px);\n  -ms-transform: translate3d(0px, 0, 0);\n  transform: translate3d(0px, 0, 0); }\n\n.swiper-container-multirow > .swiper-wrapper {\n  -webkit-box-lines: multiple;\n  -moz-box-lines: multiple;\n  -ms-flex-wrap: wrap;\n  -webkit-flex-wrap: wrap;\n  flex-wrap: wrap; }\n\n.swiper-container-free-mode > .swiper-wrapper {\n  -webkit-transition-timing-function: ease-out;\n  -moz-transition-timing-function: ease-out;\n  -ms-transition-timing-function: ease-out;\n  -o-transition-timing-function: ease-out;\n  transition-timing-function: ease-out;\n  margin: 0 auto; }\n\n.swiper-slide {\n  display: block;\n  -webkit-flex-shrink: 0;\n  -ms-flex: 0 0 auto;\n  flex-shrink: 0;\n  width: 100%;\n  height: 100%;\n  position: relative; }\n\n/* Auto Height */\n.swiper-container-autoheight,\n.swiper-container-autoheight .swiper-slide {\n  height: auto; }\n\n.swiper-container-autoheight .swiper-wrapper {\n  -webkit-box-align: start;\n  -ms-flex-align: start;\n  -webkit-align-items: flex-start;\n  align-items: flex-start;\n  -webkit-transition-property: -webkit-transform, height;\n  -moz-transition-property: -moz-transform;\n  -o-transition-property: -o-transform;\n  -ms-transition-property: -ms-transform;\n  transition-property: transform, height; }\n\n/* a11y */\n.swiper-container .swiper-notification {\n  position: absolute;\n  left: 0;\n  top: 0;\n  pointer-events: none;\n  opacity: 0;\n  z-index: -1000; }\n\n/* IE10 Windows Phone 8 Fixes */\n.swiper-wp8-horizontal {\n  -ms-touch-action: pan-y;\n  touch-action: pan-y; }\n\n.swiper-wp8-vertical {\n  -ms-touch-action: pan-x;\n  touch-action: pan-x; }\n\n/* Arrows */\n.swiper-button-prev,\n.swiper-button-next {\n  position: absolute;\n  top: 50%;\n  width: 27px;\n  height: 44px;\n  margin-top: -22px;\n  z-index: 10;\n  cursor: pointer;\n  -moz-background-size: 27px 44px;\n  -webkit-background-size: 27px 44px;\n  background-size: 27px 44px;\n  background-position: center;\n  background-repeat: no-repeat; }\n\n.swiper-button-prev.swiper-button-disabled,\n.swiper-button-next.swiper-button-disabled {\n  opacity: 0.35;\n  cursor: auto;\n  pointer-events: none; }\n\n.swiper-button-prev,\n.swiper-container-rtl .swiper-button-next {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E\");\n  left: 10px;\n  right: auto; }\n\n.swiper-button-prev.swiper-button-black,\n.swiper-container-rtl .swiper-button-next.swiper-button-black {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E\"); }\n\n.swiper-button-prev.swiper-button-white,\n.swiper-container-rtl .swiper-button-next.swiper-button-white {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E\"); }\n\n.swiper-button-next,\n.swiper-container-rtl .swiper-button-prev {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E\");\n  right: 10px;\n  left: auto; }\n\n.swiper-button-next.swiper-button-black,\n.swiper-container-rtl .swiper-button-prev.swiper-button-black {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E\"); }\n\n.swiper-button-next.swiper-button-white,\n.swiper-container-rtl .swiper-button-prev.swiper-button-white {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E\"); }\n\n/* Pagination Styles */\n.swiper-pagination {\n  position: absolute;\n  text-align: center;\n  -webkit-transition: 300ms;\n  -moz-transition: 300ms;\n  -o-transition: 300ms;\n  transition: 300ms;\n  -webkit-transform: translate3d(0, 0, 0);\n  -ms-transform: translate3d(0, 0, 0);\n  -o-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  z-index: 10; }\n\n.swiper-pagination.swiper-pagination-hidden {\n  opacity: 0; }\n\n.swiper-pagination-bullet {\n  width: 8px;\n  height: 8px;\n  display: inline-block;\n  border-radius: 100%;\n  background: #000;\n  opacity: 0.2; }\n\nbutton.swiper-pagination-bullet {\n  border: none;\n  margin: 0;\n  padding: 0;\n  box-shadow: none;\n  -moz-appearance: none;\n  -ms-appearance: none;\n  -webkit-appearance: none;\n  appearance: none; }\n\n.swiper-pagination-clickable .swiper-pagination-bullet {\n  cursor: pointer; }\n\n.swiper-pagination-white .swiper-pagination-bullet {\n  background: #fff; }\n\n.swiper-pagination-bullet-active {\n  opacity: 1; }\n\n.swiper-pagination-white .swiper-pagination-bullet-active {\n  background: #fff; }\n\n.swiper-pagination-black .swiper-pagination-bullet-active {\n  background: #000; }\n\n.swiper-container-vertical > .swiper-pagination {\n  right: 10px;\n  top: 50%;\n  -webkit-transform: translate3d(0px, -50%, 0);\n  -moz-transform: translate3d(0px, -50%, 0);\n  -o-transform: translate(0px, -50%);\n  -ms-transform: translate3d(0px, -50%, 0);\n  transform: translate3d(0px, -50%, 0); }\n\n.swiper-container-vertical > .swiper-pagination .swiper-pagination-bullet {\n  margin: 5px 0;\n  display: block; }\n\n.swiper-container-horizontal > .swiper-pagination {\n  bottom: 10px;\n  left: 0;\n  width: 100%; }\n\n.swiper-container-horizontal > .swiper-pagination .swiper-pagination-bullet {\n  margin: 0 5px; }\n\n/* 3D Container */\n.swiper-container-3d {\n  -webkit-perspective: 1200px;\n  -moz-perspective: 1200px;\n  -o-perspective: 1200px;\n  perspective: 1200px; }\n\n.swiper-container-3d .swiper-wrapper,\n.swiper-container-3d .swiper-slide,\n.swiper-container-3d .swiper-slide-shadow-left,\n.swiper-container-3d .swiper-slide-shadow-right,\n.swiper-container-3d .swiper-slide-shadow-top,\n.swiper-container-3d .swiper-slide-shadow-bottom,\n.swiper-container-3d .swiper-cube-shadow {\n  -webkit-transform-style: preserve-3d;\n  -moz-transform-style: preserve-3d;\n  -ms-transform-style: preserve-3d;\n  transform-style: preserve-3d; }\n\n.swiper-container-3d .swiper-slide-shadow-left,\n.swiper-container-3d .swiper-slide-shadow-right,\n.swiper-container-3d .swiper-slide-shadow-top,\n.swiper-container-3d .swiper-slide-shadow-bottom {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n  z-index: 10; }\n\n.swiper-container-3d .swiper-slide-shadow-left {\n  background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(right, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n.swiper-container-3d .swiper-slide-shadow-right {\n  background-image: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n.swiper-container-3d .swiper-slide-shadow-top {\n  background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n.swiper-container-3d .swiper-slide-shadow-bottom {\n  background-image: -webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.5)), to(transparent));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.5), transparent);\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.5), transparent);\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);\n  /* Firefox 16+, IE10, Opera 12.50+ */ }\n\n/* Coverflow */\n.swiper-container-coverflow .swiper-wrapper {\n  /* Windows 8 IE 10 fix */\n  -ms-perspective: 1200px; }\n\n/* Fade */\n.swiper-container-fade.swiper-container-free-mode .swiper-slide {\n  -webkit-transition-timing-function: ease-out;\n  -moz-transition-timing-function: ease-out;\n  -ms-transition-timing-function: ease-out;\n  -o-transition-timing-function: ease-out;\n  transition-timing-function: ease-out; }\n\n.swiper-container-fade .swiper-slide {\n  pointer-events: none; }\n\n.swiper-container-fade .swiper-slide .swiper-slide {\n  pointer-events: none; }\n\n.swiper-container-fade .swiper-slide-active,\n.swiper-container-fade .swiper-slide-active .swiper-slide-active {\n  pointer-events: auto; }\n\n/* Cube */\n.swiper-container-cube {\n  overflow: visible; }\n\n.swiper-container-cube .swiper-slide {\n  pointer-events: none;\n  visibility: hidden;\n  -webkit-transform-origin: 0 0;\n  -moz-transform-origin: 0 0;\n  -ms-transform-origin: 0 0;\n  transform-origin: 0 0;\n  -webkit-backface-visibility: hidden;\n  -moz-backface-visibility: hidden;\n  -ms-backface-visibility: hidden;\n  backface-visibility: hidden;\n  width: 100%;\n  height: 100%;\n  z-index: 1; }\n\n.swiper-container-cube.swiper-container-rtl .swiper-slide {\n  -webkit-transform-origin: 100% 0;\n  -moz-transform-origin: 100% 0;\n  -ms-transform-origin: 100% 0;\n  transform-origin: 100% 0; }\n\n.swiper-container-cube .swiper-slide-active,\n.swiper-container-cube .swiper-slide-next,\n.swiper-container-cube .swiper-slide-prev,\n.swiper-container-cube .swiper-slide-next + .swiper-slide {\n  pointer-events: auto;\n  visibility: visible; }\n\n.swiper-container-cube .swiper-slide-shadow-top,\n.swiper-container-cube .swiper-slide-shadow-bottom,\n.swiper-container-cube .swiper-slide-shadow-left,\n.swiper-container-cube .swiper-slide-shadow-right {\n  z-index: 0;\n  -webkit-backface-visibility: hidden;\n  -moz-backface-visibility: hidden;\n  -ms-backface-visibility: hidden;\n  backface-visibility: hidden; }\n\n.swiper-container-cube .swiper-cube-shadow {\n  position: absolute;\n  left: 0;\n  bottom: 0px;\n  width: 100%;\n  height: 100%;\n  background: #000;\n  opacity: 0.6;\n  -webkit-filter: blur(50px);\n  filter: blur(50px);\n  z-index: 0; }\n\n/* Scrollbar */\n.swiper-scrollbar {\n  border-radius: 10px;\n  position: relative;\n  -ms-touch-action: none;\n  background: rgba(0, 0, 0, 0.1); }\n\n.swiper-container-horizontal > .swiper-scrollbar {\n  position: absolute;\n  left: 1%;\n  bottom: 3px;\n  z-index: 50;\n  height: 5px;\n  width: 98%; }\n\n.swiper-container-vertical > .swiper-scrollbar {\n  position: absolute;\n  right: 3px;\n  top: 1%;\n  z-index: 50;\n  width: 5px;\n  height: 98%; }\n\n.swiper-scrollbar-drag {\n  height: 100%;\n  width: 100%;\n  position: relative;\n  background: rgba(0, 0, 0, 0.5);\n  border-radius: 10px;\n  left: 0;\n  top: 0; }\n\n.swiper-scrollbar-cursor-drag {\n  cursor: move; }\n\n/* Preloader */\n.swiper-lazy-preloader {\n  width: 42px;\n  height: 42px;\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  margin-left: -21px;\n  margin-top: -21px;\n  z-index: 10;\n  -webkit-transform-origin: 50%;\n  -moz-transform-origin: 50%;\n  transform-origin: 50%;\n  -webkit-animation: swiper-preloader-spin 1s steps(12, end) infinite;\n  -moz-animation: swiper-preloader-spin 1s steps(12, end) infinite;\n  animation: swiper-preloader-spin 1s steps(12, end) infinite; }\n\n.swiper-lazy-preloader:after {\n  display: block;\n  content: \"\";\n  width: 100%;\n  height: 100%;\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E\");\n  background-position: 50%;\n  -webkit-background-size: 100%;\n  background-size: 100%;\n  background-repeat: no-repeat; }\n\n.swiper-lazy-preloader-white:after {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%23fff'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E\"); }\n\n@-webkit-keyframes swiper-preloader-spin {\n  100% {\n    -webkit-transform: rotate(360deg); } }\n\n@keyframes swiper-preloader-spin {\n  100% {\n    transform: rotate(360deg); } }\n\nion-slides {\n  width: 100%;\n  height: 100%;\n  display: block; }\n\n.slide-zoom {\n  display: block;\n  width: 100%;\n  text-align: center; }\n\n.swiper-container {\n  width: 100%;\n  height: 100%;\n  padding: 0;\n  overflow: hidden; }\n\n.swiper-wrapper {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n  padding: 0; }\n\n.swiper-slide {\n  width: 100%;\n  height: 100%;\n  box-sizing: border-box;\n  /* Center slide text vertically */ }\n  .swiper-slide img {\n    width: auto;\n    height: auto;\n    max-width: 100%;\n    max-height: 100%; }\n\n.scroll-refresher {\n  position: absolute;\n  top: -60px;\n  right: 0;\n  left: 0;\n  overflow: hidden;\n  margin: auto;\n  height: 60px; }\n  .scroll-refresher .ionic-refresher-content {\n    position: absolute;\n    bottom: 15px;\n    left: 0;\n    width: 100%;\n    color: #666666;\n    text-align: center;\n    font-size: 30px; }\n    .scroll-refresher .ionic-refresher-content .text-refreshing,\n    .scroll-refresher .ionic-refresher-content .text-pulling {\n      font-size: 16px;\n      line-height: 16px; }\n    .scroll-refresher .ionic-refresher-content.ionic-refresher-with-text {\n      bottom: 10px; }\n  .scroll-refresher .icon-refreshing,\n  .scroll-refresher .icon-pulling {\n    width: 100%;\n    -webkit-backface-visibility: hidden;\n    backface-visibility: hidden;\n    -webkit-transform-style: preserve-3d;\n    transform-style: preserve-3d; }\n  .scroll-refresher .icon-pulling {\n    -webkit-animation-name: refresh-spin-back;\n    animation-name: refresh-spin-back;\n    -webkit-animation-duration: 200ms;\n    animation-duration: 200ms;\n    -webkit-animation-timing-function: linear;\n    animation-timing-function: linear;\n    -webkit-animation-fill-mode: none;\n    animation-fill-mode: none;\n    -webkit-transform: translate3d(0, 0, 0) rotate(0deg);\n    transform: translate3d(0, 0, 0) rotate(0deg); }\n  .scroll-refresher .icon-refreshing,\n  .scroll-refresher .text-refreshing {\n    display: none; }\n  .scroll-refresher .icon-refreshing {\n    -webkit-animation-duration: 1.5s;\n    animation-duration: 1.5s; }\n  .scroll-refresher.active .icon-pulling:not(.pulling-rotation-disabled) {\n    -webkit-animation-name: refresh-spin;\n    animation-name: refresh-spin;\n    -webkit-transform: translate3d(0, 0, 0) rotate(-180deg);\n    transform: translate3d(0, 0, 0) rotate(-180deg); }\n  .scroll-refresher.active.refreshing {\n    -webkit-transition: -webkit-transform 0.2s;\n    transition: -webkit-transform 0.2s;\n    -webkit-transition: transform 0.2s;\n    transition: transform 0.2s;\n    -webkit-transform: scale(1, 1);\n    transform: scale(1, 1); }\n    .scroll-refresher.active.refreshing .icon-pulling,\n    .scroll-refresher.active.refreshing .text-pulling {\n      display: none; }\n    .scroll-refresher.active.refreshing .icon-refreshing,\n    .scroll-refresher.active.refreshing .text-refreshing {\n      display: block; }\n    .scroll-refresher.active.refreshing.refreshing-tail {\n      -webkit-transform: scale(0, 0);\n      transform: scale(0, 0); }\n\n.overflow-scroll > .scroll {\n  -webkit-overflow-scrolling: touch;\n  width: 100%; }\n  .overflow-scroll > .scroll.overscroll {\n    position: fixed;\n    right: 0;\n    left: 0; }\n\n.overflow-scroll.padding > .scroll.overscroll {\n  padding: 10px; }\n\n@-webkit-keyframes refresh-spin {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(0); }\n  100% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(180deg); } }\n\n@keyframes refresh-spin {\n  0% {\n    transform: translate3d(0, 0, 0) rotate(0); }\n  100% {\n    transform: translate3d(0, 0, 0) rotate(180deg); } }\n\n@-webkit-keyframes refresh-spin-back {\n  0% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(180deg); }\n  100% {\n    -webkit-transform: translate3d(0, 0, 0) rotate(0); } }\n\n@keyframes refresh-spin-back {\n  0% {\n    transform: translate3d(0, 0, 0) rotate(180deg); }\n  100% {\n    transform: translate3d(0, 0, 0) rotate(0); } }\n\n/**\n * Spinners\n * --------------------------------------------------\n */\n.spinner {\n  stroke: #444;\n  fill: #444; }\n  .spinner svg {\n    width: 28px;\n    height: 28px; }\n  .spinner.spinner-light {\n    stroke: #fff;\n    fill: #fff; }\n  .spinner.spinner-stable {\n    stroke: #f8f8f8;\n    fill: #f8f8f8; }\n  .spinner.spinner-positive {\n    stroke: #387ef5;\n    fill: #387ef5; }\n  .spinner.spinner-calm {\n    stroke: #11c1f3;\n    fill: #11c1f3; }\n  .spinner.spinner-balanced {\n    stroke: #33cd5f;\n    fill: #33cd5f; }\n  .spinner.spinner-assertive {\n    stroke: #ef473a;\n    fill: #ef473a; }\n  .spinner.spinner-energized {\n    stroke: #ffc900;\n    fill: #ffc900; }\n  .spinner.spinner-royal {\n    stroke: #886aea;\n    fill: #886aea; }\n  .spinner.spinner-dark {\n    stroke: #444;\n    fill: #444; }\n\n.spinner-android {\n  stroke: #4b8bf4; }\n\n.spinner-ios,\n.spinner-ios-small {\n  stroke: #69717d; }\n\n.spinner-spiral .stop1 {\n  stop-color: #fff;\n  stop-opacity: 0; }\n\n.spinner-spiral.spinner-light .stop1 {\n  stop-color: #444; }\n\n.spinner-spiral.spinner-light .stop2 {\n  stop-color: #fff; }\n\n.spinner-spiral.spinner-stable .stop2 {\n  stop-color: #f8f8f8; }\n\n.spinner-spiral.spinner-positive .stop2 {\n  stop-color: #387ef5; }\n\n.spinner-spiral.spinner-calm .stop2 {\n  stop-color: #11c1f3; }\n\n.spinner-spiral.spinner-balanced .stop2 {\n  stop-color: #33cd5f; }\n\n.spinner-spiral.spinner-assertive .stop2 {\n  stop-color: #ef473a; }\n\n.spinner-spiral.spinner-energized .stop2 {\n  stop-color: #ffc900; }\n\n.spinner-spiral.spinner-royal .stop2 {\n  stop-color: #886aea; }\n\n.spinner-spiral.spinner-dark .stop2 {\n  stop-color: #444; }\n\n/**\n * Forms\n * --------------------------------------------------\n */\nform {\n  margin: 0 0 1.42857; }\n\nlegend {\n  display: block;\n  margin-bottom: 1.42857;\n  padding: 0;\n  width: 100%;\n  border: 1px solid #ddd;\n  color: #444;\n  font-size: 21px;\n  line-height: 2.85714; }\n  legend small {\n    color: #f8f8f8;\n    font-size: 1.07143; }\n\nlabel,\ninput,\nbutton,\nselect,\ntextarea {\n  font-weight: normal;\n  font-size: 14px;\n  line-height: 1.42857; }\n\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: \"-apple-system\", \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif; }\n\n.item-input {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: relative;\n  overflow: hidden;\n  padding: 6px 0 5px 16px; }\n  .item-input input {\n    -webkit-border-radius: 0;\n    border-radius: 0;\n    -webkit-box-flex: 1;\n    -webkit-flex: 1 220px;\n    -moz-box-flex: 1;\n    -moz-flex: 1 220px;\n    -ms-flex: 1 220px;\n    flex: 1 220px;\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    margin: 0;\n    padding-right: 24px;\n    background-color: transparent; }\n  .item-input .button .icon {\n    -webkit-box-flex: 0;\n    -webkit-flex: 0 0 24px;\n    -moz-box-flex: 0;\n    -moz-flex: 0 0 24px;\n    -ms-flex: 0 0 24px;\n    flex: 0 0 24px;\n    position: static;\n    display: inline-block;\n    height: auto;\n    text-align: center;\n    font-size: 16px; }\n  .item-input .button-bar {\n    -webkit-border-radius: 0;\n    border-radius: 0;\n    -webkit-box-flex: 1;\n    -webkit-flex: 1 0 220px;\n    -moz-box-flex: 1;\n    -moz-flex: 1 0 220px;\n    -ms-flex: 1 0 220px;\n    flex: 1 0 220px;\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none; }\n  .item-input .icon {\n    min-width: 14px; }\n\n.platform-windowsphone .item-input input {\n  flex-shrink: 1; }\n\n.item-input-inset {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  position: relative;\n  overflow: hidden;\n  padding: 10.66667px; }\n\n.item-input-wrapper {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-flex: 1;\n  -webkit-flex: 1 0;\n  -moz-box-flex: 1;\n  -moz-flex: 1 0;\n  -ms-flex: 1 0;\n  flex: 1 0;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  -webkit-border-radius: 4px;\n  border-radius: 4px;\n  padding-right: 8px;\n  padding-left: 8px;\n  background: #eee; }\n\n.item-input-inset .item-input-wrapper input {\n  padding-left: 4px;\n  height: 29px;\n  background: transparent;\n  line-height: 18px; }\n\n.item-input-wrapper ~ .button {\n  margin-left: 10.66667px; }\n\n.input-label {\n  display: table;\n  padding: 7px 10px 7px 0px;\n  max-width: 200px;\n  width: 35%;\n  color: #444;\n  font-size: 16px; }\n\n.placeholder-icon {\n  color: #aaa; }\n  .placeholder-icon:first-child {\n    padding-right: 6px; }\n  .placeholder-icon:last-child {\n    padding-left: 6px; }\n\n.item-stacked-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none; }\n  .item-stacked-label .input-label, .item-stacked-label .icon {\n    display: inline-block;\n    padding: 4px 0 0 0px;\n    vertical-align: middle; }\n\n.item-stacked-label input,\n.item-stacked-label textarea {\n  -webkit-border-radius: 2px;\n  border-radius: 2px;\n  padding: 4px 8px 3px 0;\n  border: none;\n  background-color: #fff; }\n\n.item-stacked-label input {\n  overflow: hidden;\n  height: 46px; }\n\n.item-select.item-stacked-label select {\n  position: relative;\n  padding: 0px;\n  max-width: 90%;\n  direction: ltr;\n  white-space: pre-wrap;\n  margin: -3px; }\n\n.item-floating-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none; }\n  .item-floating-label .input-label {\n    position: relative;\n    padding: 5px 0 0 0;\n    opacity: 0;\n    top: 10px;\n    -webkit-transition: opacity 0.15s ease-in, top 0.2s linear;\n    transition: opacity 0.15s ease-in, top 0.2s linear; }\n    .item-floating-label .input-label.has-input {\n      opacity: 1;\n      top: 0;\n      -webkit-transition: opacity 0.15s ease-in, top 0.2s linear;\n      transition: opacity 0.15s ease-in, top 0.2s linear; }\n\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  display: block;\n  padding-top: 2px;\n  padding-left: 0;\n  height: 34px;\n  color: #111;\n  vertical-align: middle;\n  font-size: 14px;\n  line-height: 16px; }\n\n.platform-ios input[type=\"datetime-local\"],\n.platform-ios input[type=\"date\"],\n.platform-ios input[type=\"month\"],\n.platform-ios input[type=\"time\"],\n.platform-ios input[type=\"week\"],\n.platform-android input[type=\"datetime-local\"],\n.platform-android input[type=\"date\"],\n.platform-android input[type=\"month\"],\n.platform-android input[type=\"time\"],\n.platform-android input[type=\"week\"] {\n  padding-top: 8px; }\n\n.item-input input,\n.item-input textarea {\n  width: 100%; }\n\ntextarea {\n  padding-left: 0; }\n  textarea::-moz-placeholder {\n    color: #aaaaaa; }\n  textarea:-ms-input-placeholder {\n    color: #aaaaaa; }\n  textarea::-webkit-input-placeholder {\n    color: #aaaaaa;\n    text-indent: -3px; }\n\ntextarea {\n  height: auto; }\n\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  border: 0; }\n\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 0;\n  line-height: normal; }\n\n.item-input input[type=\"file\"],\n.item-input input[type=\"image\"],\n.item-input input[type=\"submit\"],\n.item-input input[type=\"reset\"],\n.item-input input[type=\"button\"],\n.item-input input[type=\"radio\"],\n.item-input input[type=\"checkbox\"] {\n  width: auto; }\n\ninput[type=\"file\"] {\n  line-height: 34px; }\n\n.previous-input-focus,\n.cloned-text-input + input,\n.cloned-text-input + textarea {\n  position: absolute !important;\n  left: -9999px;\n  width: 200px; }\n\ninput::-moz-placeholder,\ntextarea::-moz-placeholder {\n  color: #aaaaaa; }\n\ninput:-ms-input-placeholder,\ntextarea:-ms-input-placeholder {\n  color: #aaaaaa; }\n\ninput::-webkit-input-placeholder,\ntextarea::-webkit-input-placeholder {\n  color: #aaaaaa;\n  text-indent: 0; }\n\ninput[disabled],\nselect[disabled],\ntextarea[disabled],\ninput[readonly]:not(.cloned-text-input),\ntextarea[readonly]:not(.cloned-text-input),\nselect[readonly] {\n  background-color: #f8f8f8;\n  cursor: not-allowed; }\n\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\ninput[type=\"radio\"][readonly],\ninput[type=\"checkbox\"][readonly] {\n  background-color: transparent; }\n\n/**\n * Checkbox\n * --------------------------------------------------\n */\n.checkbox {\n  position: relative;\n  display: inline-block;\n  padding: 7px 7px;\n  cursor: pointer; }\n  .checkbox input:before,\n  .checkbox .checkbox-icon:before {\n    border-color: #ddd; }\n  .checkbox input:checked:before,\n  .checkbox input:checked + .checkbox-icon:before {\n    background: #387ef5;\n    border-color: #387ef5; }\n\n.checkbox-light input:before,\n.checkbox-light .checkbox-icon:before {\n  border-color: #ddd; }\n\n.checkbox-light input:checked:before,\n.checkbox-light input:checked + .checkbox-icon:before {\n  background: #ddd;\n  border-color: #ddd; }\n\n.checkbox-stable input:before,\n.checkbox-stable .checkbox-icon:before {\n  border-color: #b2b2b2; }\n\n.checkbox-stable input:checked:before,\n.checkbox-stable input:checked + .checkbox-icon:before {\n  background: #b2b2b2;\n  border-color: #b2b2b2; }\n\n.checkbox-positive input:before,\n.checkbox-positive .checkbox-icon:before {\n  border-color: #387ef5; }\n\n.checkbox-positive input:checked:before,\n.checkbox-positive input:checked + .checkbox-icon:before {\n  background: #387ef5;\n  border-color: #387ef5; }\n\n.checkbox-calm input:before,\n.checkbox-calm .checkbox-icon:before {\n  border-color: #11c1f3; }\n\n.checkbox-calm input:checked:before,\n.checkbox-calm input:checked + .checkbox-icon:before {\n  background: #11c1f3;\n  border-color: #11c1f3; }\n\n.checkbox-assertive input:before,\n.checkbox-assertive .checkbox-icon:before {\n  border-color: #ef473a; }\n\n.checkbox-assertive input:checked:before,\n.checkbox-assertive input:checked + .checkbox-icon:before {\n  background: #ef473a;\n  border-color: #ef473a; }\n\n.checkbox-balanced input:before,\n.checkbox-balanced .checkbox-icon:before {\n  border-color: #33cd5f; }\n\n.checkbox-balanced input:checked:before,\n.checkbox-balanced input:checked + .checkbox-icon:before {\n  background: #33cd5f;\n  border-color: #33cd5f; }\n\n.checkbox-energized input:before,\n.checkbox-energized .checkbox-icon:before {\n  border-color: #ffc900; }\n\n.checkbox-energized input:checked:before,\n.checkbox-energized input:checked + .checkbox-icon:before {\n  background: #ffc900;\n  border-color: #ffc900; }\n\n.checkbox-royal input:before,\n.checkbox-royal .checkbox-icon:before {\n  border-color: #886aea; }\n\n.checkbox-royal input:checked:before,\n.checkbox-royal input:checked + .checkbox-icon:before {\n  background: #886aea;\n  border-color: #886aea; }\n\n.checkbox-dark input:before,\n.checkbox-dark .checkbox-icon:before {\n  border-color: #444; }\n\n.checkbox-dark input:checked:before,\n.checkbox-dark input:checked + .checkbox-icon:before {\n  background: #444;\n  border-color: #444; }\n\n.checkbox input:disabled:before,\n.checkbox input:disabled + .checkbox-icon:before {\n  border-color: #ddd; }\n\n.checkbox input:disabled:checked:before,\n.checkbox input:disabled:checked + .checkbox-icon:before {\n  background: #ddd; }\n\n.checkbox.checkbox-input-hidden input {\n  display: none !important; }\n\n.checkbox input,\n.checkbox-icon {\n  position: relative;\n  width: 28px;\n  height: 28px;\n  display: block;\n  border: 0;\n  background: transparent;\n  cursor: pointer;\n  -webkit-appearance: none; }\n  .checkbox input:before,\n  .checkbox-icon:before {\n    display: table;\n    width: 100%;\n    height: 100%;\n    border-width: 1px;\n    border-style: solid;\n    border-radius: 28px;\n    background: #fff;\n    content: ' ';\n    -webkit-transition: background-color 20ms ease-in-out;\n    transition: background-color 20ms ease-in-out; }\n\n.checkbox input:checked:before,\ninput:checked + .checkbox-icon:before {\n  border-width: 2px; }\n\n.checkbox input:after,\n.checkbox-icon:after {\n  -webkit-transition: opacity 0.05s ease-in-out;\n  transition: opacity 0.05s ease-in-out;\n  -webkit-transform: rotate(-45deg);\n  transform: rotate(-45deg);\n  position: absolute;\n  top: 33%;\n  left: 25%;\n  display: table;\n  width: 14px;\n  height: 6px;\n  border: 1px solid #fff;\n  border-top: 0;\n  border-right: 0;\n  content: ' ';\n  opacity: 0; }\n\n.platform-android .checkbox-platform input:before,\n.platform-android .checkbox-platform .checkbox-icon:before,\n.checkbox-square input:before,\n.checkbox-square .checkbox-icon:before {\n  border-radius: 2px;\n  width: 72%;\n  height: 72%;\n  margin-top: 14%;\n  margin-left: 14%;\n  border-width: 2px; }\n\n.platform-android .checkbox-platform input:after,\n.platform-android .checkbox-platform .checkbox-icon:after,\n.checkbox-square input:after,\n.checkbox-square .checkbox-icon:after {\n  border-width: 2px;\n  top: 19%;\n  left: 25%;\n  width: 13px;\n  height: 7px; }\n\n.platform-android .item-checkbox-right .checkbox-square .checkbox-icon::after {\n  top: 31%; }\n\n.grade-c .checkbox input:after,\n.grade-c .checkbox-icon:after {\n  -webkit-transform: rotate(0);\n  transform: rotate(0);\n  top: 3px;\n  left: 4px;\n  border: none;\n  color: #fff;\n  content: '\\2713';\n  font-weight: bold;\n  font-size: 20px; }\n\n.checkbox input:checked:after,\ninput:checked + .checkbox-icon:after {\n  opacity: 1; }\n\n.item-checkbox {\n  padding-left: 60px; }\n  .item-checkbox.active {\n    box-shadow: none; }\n\n.item-checkbox .checkbox {\n  position: absolute;\n  top: 50%;\n  right: 8px;\n  left: 8px;\n  z-index: 3;\n  margin-top: -21px; }\n\n.item-checkbox.item-checkbox-right {\n  padding-right: 60px;\n  padding-left: 16px; }\n\n.item-checkbox-right .checkbox input,\n.item-checkbox-right .checkbox-icon {\n  float: right; }\n\n/**\n * Toggle\n * --------------------------------------------------\n */\n.item-toggle {\n  pointer-events: none; }\n\n.toggle {\n  position: relative;\n  display: inline-block;\n  pointer-events: auto;\n  margin: -5px;\n  padding: 5px; }\n  .toggle input:checked + .track {\n    border-color: #4cd964;\n    background-color: #4cd964; }\n  .toggle.dragging .handle {\n    background-color: #f2f2f2 !important; }\n\n.toggle.toggle-light input:checked + .track {\n  border-color: #ddd;\n  background-color: #ddd; }\n\n.toggle.toggle-stable input:checked + .track {\n  border-color: #b2b2b2;\n  background-color: #b2b2b2; }\n\n.toggle.toggle-positive input:checked + .track {\n  border-color: #387ef5;\n  background-color: #387ef5; }\n\n.toggle.toggle-calm input:checked + .track {\n  border-color: #11c1f3;\n  background-color: #11c1f3; }\n\n.toggle.toggle-assertive input:checked + .track {\n  border-color: #ef473a;\n  background-color: #ef473a; }\n\n.toggle.toggle-balanced input:checked + .track {\n  border-color: #33cd5f;\n  background-color: #33cd5f; }\n\n.toggle.toggle-energized input:checked + .track {\n  border-color: #ffc900;\n  background-color: #ffc900; }\n\n.toggle.toggle-royal input:checked + .track {\n  border-color: #886aea;\n  background-color: #886aea; }\n\n.toggle.toggle-dark input:checked + .track {\n  border-color: #444;\n  background-color: #444; }\n\n.toggle input {\n  display: none; }\n\n/* the track appearance when the toggle is \"off\" */\n.toggle .track {\n  -webkit-transition-timing-function: ease-in-out;\n  transition-timing-function: ease-in-out;\n  -webkit-transition-duration: 0.3s;\n  transition-duration: 0.3s;\n  -webkit-transition-property: background-color, border;\n  transition-property: background-color, border;\n  display: inline-block;\n  box-sizing: border-box;\n  width: 51px;\n  height: 31px;\n  border: solid 2px #e6e6e6;\n  border-radius: 20px;\n  background-color: #fff;\n  content: ' ';\n  cursor: pointer;\n  pointer-events: none; }\n\n/* Fix to avoid background color bleeding */\n/* (occurred on (at least) Android 4.2, Asus MeMO Pad HD7 ME173X) */\n.platform-android4_2 .toggle .track {\n  -webkit-background-clip: padding-box; }\n\n/* the handle (circle) thats inside the toggle's track area */\n/* also the handle's appearance when it is \"off\" */\n.toggle .handle {\n  -webkit-transition: 0.3s cubic-bezier(0, 1.1, 1, 1.1);\n  transition: 0.3s cubic-bezier(0, 1.1, 1, 1.1);\n  -webkit-transition-property: background-color, transform;\n  transition-property: background-color, transform;\n  position: absolute;\n  display: block;\n  width: 27px;\n  height: 27px;\n  border-radius: 27px;\n  background-color: #fff;\n  top: 7px;\n  left: 7px;\n  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.35), 0 1px 1px rgba(0, 0, 0, 0.15); }\n  .toggle .handle:before {\n    position: absolute;\n    top: -4px;\n    left: -21.5px;\n    padding: 18.5px 34px;\n    content: \" \"; }\n\n.toggle input:checked + .track .handle {\n  -webkit-transform: translate3d(20px, 0, 0);\n  transform: translate3d(20px, 0, 0);\n  background-color: #fff; }\n\n.item-toggle.active {\n  box-shadow: none; }\n\n.item-toggle,\n.item-toggle.item-complex .item-content {\n  padding-right: 99px; }\n\n.item-toggle.item-complex {\n  padding-right: 0; }\n\n.item-toggle .toggle {\n  position: absolute;\n  top: 10px;\n  right: 16px;\n  z-index: 3; }\n\n.toggle input:disabled + .track {\n  opacity: .6; }\n\n.toggle-small .track {\n  border: 0;\n  width: 34px;\n  height: 15px;\n  background: #9e9e9e; }\n\n.toggle-small input:checked + .track {\n  background: rgba(0, 150, 137, 0.5); }\n\n.toggle-small .handle {\n  top: 2px;\n  left: 4px;\n  width: 21px;\n  height: 21px;\n  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25); }\n\n.toggle-small input:checked + .track .handle {\n  -webkit-transform: translate3d(16px, 0, 0);\n  transform: translate3d(16px, 0, 0);\n  background: #009689; }\n\n.toggle-small.item-toggle .toggle {\n  top: 19px; }\n\n.toggle-small .toggle-light input:checked + .track {\n  background-color: rgba(221, 221, 221, 0.5); }\n\n.toggle-small .toggle-light input:checked + .track .handle {\n  background-color: #ddd; }\n\n.toggle-small .toggle-stable input:checked + .track {\n  background-color: rgba(178, 178, 178, 0.5); }\n\n.toggle-small .toggle-stable input:checked + .track .handle {\n  background-color: #b2b2b2; }\n\n.toggle-small .toggle-positive input:checked + .track {\n  background-color: rgba(56, 126, 245, 0.5); }\n\n.toggle-small .toggle-positive input:checked + .track .handle {\n  background-color: #387ef5; }\n\n.toggle-small .toggle-calm input:checked + .track {\n  background-color: rgba(17, 193, 243, 0.5); }\n\n.toggle-small .toggle-calm input:checked + .track .handle {\n  background-color: #11c1f3; }\n\n.toggle-small .toggle-assertive input:checked + .track {\n  background-color: rgba(239, 71, 58, 0.5); }\n\n.toggle-small .toggle-assertive input:checked + .track .handle {\n  background-color: #ef473a; }\n\n.toggle-small .toggle-balanced input:checked + .track {\n  background-color: rgba(51, 205, 95, 0.5); }\n\n.toggle-small .toggle-balanced input:checked + .track .handle {\n  background-color: #33cd5f; }\n\n.toggle-small .toggle-energized input:checked + .track {\n  background-color: rgba(255, 201, 0, 0.5); }\n\n.toggle-small .toggle-energized input:checked + .track .handle {\n  background-color: #ffc900; }\n\n.toggle-small .toggle-royal input:checked + .track {\n  background-color: rgba(136, 106, 234, 0.5); }\n\n.toggle-small .toggle-royal input:checked + .track .handle {\n  background-color: #886aea; }\n\n.toggle-small .toggle-dark input:checked + .track {\n  background-color: rgba(68, 68, 68, 0.5); }\n\n.toggle-small .toggle-dark input:checked + .track .handle {\n  background-color: #444; }\n\n/**\n * Radio Button Inputs\n * --------------------------------------------------\n */\n.item-radio {\n  padding: 0; }\n  .item-radio:hover {\n    cursor: pointer; }\n\n.item-radio .item-content {\n  /* give some room to the right for the checkmark icon */\n  padding-right: 64px; }\n\n.item-radio .radio-icon {\n  /* checkmark icon will be hidden by default */\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: 3;\n  visibility: hidden;\n  padding: 14px;\n  height: 100%;\n  font-size: 24px; }\n\n.item-radio input {\n  /* hide any radio button inputs elements (the ugly circles) */\n  position: absolute;\n  left: -9999px; }\n  .item-radio input:checked + .radio-content .item-content {\n    /* style the item content when its checked */\n    background: #f7f7f7; }\n  .item-radio input:checked + .radio-content .radio-icon {\n    /* show the checkmark icon when its checked */\n    visibility: visible; }\n\n/**\n * Range\n * --------------------------------------------------\n */\n.range input {\n  display: inline-block;\n  overflow: hidden;\n  margin-top: 5px;\n  margin-bottom: 5px;\n  padding-right: 2px;\n  padding-left: 1px;\n  width: auto;\n  height: 43px;\n  outline: none;\n  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ccc), color-stop(100%, #ccc));\n  background: linear-gradient(to right, #ccc 0%, #ccc 100%);\n  background-position: center;\n  background-size: 99% 2px;\n  background-repeat: no-repeat;\n  -webkit-appearance: none;\n  /*\n   &::-ms-track{\n     background: transparent;\n     border-color: transparent;\n     border-width: 11px 0 16px;\n     color:transparent;\n     margin-top:20px;\n   }\n   &::-ms-thumb {\n     width: $range-slider-width;\n     height: $range-slider-height;\n     border-radius: $range-slider-border-radius;\n     background-color: $toggle-handle-off-bg-color;\n     border-color:$toggle-handle-off-bg-color;\n     box-shadow: $range-slider-box-shadow;\n     margin-left:1px;\n     margin-right:1px;\n     outline:none;\n   }\n   &::-ms-fill-upper {\n     height: $range-track-height;\n     background:$range-default-track-bg;\n   }\n   */ }\n  .range input::-moz-focus-outer {\n    /* hide the focus outline in Firefox */\n    border: 0; }\n  .range input::-webkit-slider-thumb {\n    position: relative;\n    width: 28px;\n    height: 28px;\n    border-radius: 50%;\n    background-color: #fff;\n    box-shadow: 0 0 2px rgba(0, 0, 0, 0.3), 0 3px 5px rgba(0, 0, 0, 0.2);\n    cursor: pointer;\n    -webkit-appearance: none;\n    border: 0; }\n  .range input::-webkit-slider-thumb:before {\n    /* what creates the colorful line on the left side of the slider */\n    position: absolute;\n    top: 13px;\n    left: -2001px;\n    width: 2000px;\n    height: 2px;\n    background: #444;\n    content: ' '; }\n  .range input::-webkit-slider-thumb:after {\n    /* create a larger (but hidden) hit area */\n    position: absolute;\n    top: -15px;\n    left: -15px;\n    padding: 30px;\n    content: ' '; }\n  .range input::-ms-fill-lower {\n    height: 2px;\n    background: #444; }\n\n.range {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center;\n  padding: 2px 11px; }\n  .range.range-light input::-webkit-slider-thumb:before {\n    background: #ddd; }\n  .range.range-light input::-ms-fill-lower {\n    background: #ddd; }\n  .range.range-stable input::-webkit-slider-thumb:before {\n    background: #b2b2b2; }\n  .range.range-stable input::-ms-fill-lower {\n    background: #b2b2b2; }\n  .range.range-positive input::-webkit-slider-thumb:before {\n    background: #387ef5; }\n  .range.range-positive input::-ms-fill-lower {\n    background: #387ef5; }\n  .range.range-calm input::-webkit-slider-thumb:before {\n    background: #11c1f3; }\n  .range.range-calm input::-ms-fill-lower {\n    background: #11c1f3; }\n  .range.range-balanced input::-webkit-slider-thumb:before {\n    background: #33cd5f; }\n  .range.range-balanced input::-ms-fill-lower {\n    background: #33cd5f; }\n  .range.range-assertive input::-webkit-slider-thumb:before {\n    background: #ef473a; }\n  .range.range-assertive input::-ms-fill-lower {\n    background: #ef473a; }\n  .range.range-energized input::-webkit-slider-thumb:before {\n    background: #ffc900; }\n  .range.range-energized input::-ms-fill-lower {\n    background: #ffc900; }\n  .range.range-royal input::-webkit-slider-thumb:before {\n    background: #886aea; }\n  .range.range-royal input::-ms-fill-lower {\n    background: #886aea; }\n  .range.range-dark input::-webkit-slider-thumb:before {\n    background: #444; }\n  .range.range-dark input::-ms-fill-lower {\n    background: #444; }\n\n.range .icon {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0;\n  -moz-box-flex: 0;\n  -moz-flex: 0;\n  -ms-flex: 0;\n  flex: 0;\n  display: block;\n  min-width: 24px;\n  text-align: center;\n  font-size: 24px; }\n\n.range input {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  margin-right: 10px;\n  margin-left: 10px; }\n\n.range-label {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 auto;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 auto;\n  -ms-flex: 0 0 auto;\n  flex: 0 0 auto;\n  display: block;\n  white-space: nowrap; }\n\n.range-label:first-child {\n  padding-left: 5px; }\n\n.range input + .range-label {\n  padding-right: 5px;\n  padding-left: 0; }\n\n.platform-windowsphone .range input {\n  height: auto; }\n\n/**\n * Select\n * --------------------------------------------------\n */\n.item-select {\n  position: relative; }\n  .item-select select {\n    -webkit-appearance: none;\n    -moz-appearance: none;\n    appearance: none;\n    position: absolute;\n    top: 0;\n    bottom: 0;\n    right: 0;\n    padding: 0 48px 0 16px;\n    max-width: 65%;\n    border: none;\n    background: #fff;\n    color: #333;\n    text-indent: .01px;\n    text-overflow: '';\n    white-space: nowrap;\n    font-size: 14px;\n    cursor: pointer;\n    direction: rtl; }\n  .item-select select::-ms-expand {\n    display: none; }\n  .item-select option {\n    direction: ltr; }\n  .item-select:after {\n    position: absolute;\n    top: 50%;\n    right: 16px;\n    margin-top: -3px;\n    width: 0;\n    height: 0;\n    border-top: 5px solid;\n    border-right: 5px solid transparent;\n    border-left: 5px solid transparent;\n    color: #999;\n    content: \"\";\n    pointer-events: none; }\n  .item-select.item-light select {\n    background: #fff;\n    color: #444; }\n  .item-select.item-stable select {\n    background: #f8f8f8;\n    color: #444; }\n  .item-select.item-stable:after, .item-select.item-stable .input-label {\n    color: #666666; }\n  .item-select.item-positive select {\n    background: #387ef5;\n    color: #fff; }\n  .item-select.item-positive:after, .item-select.item-positive .input-label {\n    color: #fff; }\n  .item-select.item-calm select {\n    background: #11c1f3;\n    color: #fff; }\n  .item-select.item-calm:after, .item-select.item-calm .input-label {\n    color: #fff; }\n  .item-select.item-assertive select {\n    background: #ef473a;\n    color: #fff; }\n  .item-select.item-assertive:after, .item-select.item-assertive .input-label {\n    color: #fff; }\n  .item-select.item-balanced select {\n    background: #33cd5f;\n    color: #fff; }\n  .item-select.item-balanced:after, .item-select.item-balanced .input-label {\n    color: #fff; }\n  .item-select.item-energized select {\n    background: #ffc900;\n    color: #fff; }\n  .item-select.item-energized:after, .item-select.item-energized .input-label {\n    color: #fff; }\n  .item-select.item-royal select {\n    background: #886aea;\n    color: #fff; }\n  .item-select.item-royal:after, .item-select.item-royal .input-label {\n    color: #fff; }\n  .item-select.item-dark select {\n    background: #444;\n    color: #fff; }\n  .item-select.item-dark:after, .item-select.item-dark .input-label {\n    color: #fff; }\n\nselect[multiple], select[size] {\n  height: auto; }\n\n/**\n * Progress\n * --------------------------------------------------\n */\nprogress {\n  display: block;\n  margin: 15px auto;\n  width: 100%; }\n\n/**\n * Buttons\n * --------------------------------------------------\n */\n.button {\n  border-color: transparent;\n  background-color: #f8f8f8;\n  color: #444;\n  position: relative;\n  display: inline-block;\n  margin: 0;\n  padding: 0 12px;\n  min-width: 52px;\n  min-height: 47px;\n  border-width: 1px;\n  border-style: solid;\n  border-radius: 4px;\n  vertical-align: top;\n  text-align: center;\n  text-overflow: ellipsis;\n  font-size: 16px;\n  line-height: 42px;\n  cursor: pointer; }\n  .button:hover {\n    color: #444;\n    text-decoration: none; }\n  .button.active, .button.activated {\n    border-color: #a2a2a2;\n    background-color: #e5e5e5; }\n  .button:after {\n    position: absolute;\n    top: -6px;\n    right: -6px;\n    bottom: -6px;\n    left: -6px;\n    content: ' '; }\n  .button .icon {\n    vertical-align: top;\n    pointer-events: none; }\n  .button .icon:before, .button.icon:before, .button.icon-left:before, .button.icon-right:before {\n    display: inline-block;\n    padding: 0 0 1px 0;\n    vertical-align: inherit;\n    font-size: 24px;\n    line-height: 41px;\n    pointer-events: none; }\n  .button.icon-left:before {\n    float: left;\n    padding-right: .2em;\n    padding-left: 0; }\n  .button.icon-right:before {\n    float: right;\n    padding-right: 0;\n    padding-left: .2em; }\n  .button.button-block, .button.button-full {\n    margin-top: 10px;\n    margin-bottom: 10px; }\n  .button.button-light {\n    border-color: transparent;\n    background-color: #fff;\n    color: #444; }\n    .button.button-light:hover {\n      color: #444;\n      text-decoration: none; }\n    .button.button-light.active, .button.button-light.activated {\n      border-color: #a2a2a2;\n      background-color: #fafafa; }\n    .button.button-light.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ddd; }\n    .button.button-light.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-light.button-outline {\n      border-color: #ddd;\n      background: transparent;\n      color: #ddd; }\n      .button.button-light.button-outline.active, .button.button-light.button-outline.activated {\n        background-color: #ddd;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-stable {\n    border-color: transparent;\n    background-color: #f8f8f8;\n    color: #444; }\n    .button.button-stable:hover {\n      color: #444;\n      text-decoration: none; }\n    .button.button-stable.active, .button.button-stable.activated {\n      border-color: #a2a2a2;\n      background-color: #e5e5e5; }\n    .button.button-stable.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #b2b2b2; }\n    .button.button-stable.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-stable.button-outline {\n      border-color: #b2b2b2;\n      background: transparent;\n      color: #b2b2b2; }\n      .button.button-stable.button-outline.active, .button.button-stable.button-outline.activated {\n        background-color: #b2b2b2;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-positive {\n    border-color: transparent;\n    background-color: #387ef5;\n    color: #fff; }\n    .button.button-positive:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-positive.active, .button.button-positive.activated {\n      border-color: #a2a2a2;\n      background-color: #0c60ee; }\n    .button.button-positive.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #387ef5; }\n    .button.button-positive.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-positive.button-outline {\n      border-color: #387ef5;\n      background: transparent;\n      color: #387ef5; }\n      .button.button-positive.button-outline.active, .button.button-positive.button-outline.activated {\n        background-color: #387ef5;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-calm {\n    border-color: transparent;\n    background-color: #11c1f3;\n    color: #fff; }\n    .button.button-calm:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-calm.active, .button.button-calm.activated {\n      border-color: #a2a2a2;\n      background-color: #0a9dc7; }\n    .button.button-calm.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #11c1f3; }\n    .button.button-calm.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-calm.button-outline {\n      border-color: #11c1f3;\n      background: transparent;\n      color: #11c1f3; }\n      .button.button-calm.button-outline.active, .button.button-calm.button-outline.activated {\n        background-color: #11c1f3;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-assertive {\n    border-color: transparent;\n    background-color: #ef473a;\n    color: #fff; }\n    .button.button-assertive:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-assertive.active, .button.button-assertive.activated {\n      border-color: #a2a2a2;\n      background-color: #e42112; }\n    .button.button-assertive.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ef473a; }\n    .button.button-assertive.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-assertive.button-outline {\n      border-color: #ef473a;\n      background: transparent;\n      color: #ef473a; }\n      .button.button-assertive.button-outline.active, .button.button-assertive.button-outline.activated {\n        background-color: #ef473a;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-balanced {\n    border-color: transparent;\n    background-color: #33cd5f;\n    color: #fff; }\n    .button.button-balanced:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-balanced.active, .button.button-balanced.activated {\n      border-color: #a2a2a2;\n      background-color: #28a54c; }\n    .button.button-balanced.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #33cd5f; }\n    .button.button-balanced.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-balanced.button-outline {\n      border-color: #33cd5f;\n      background: transparent;\n      color: #33cd5f; }\n      .button.button-balanced.button-outline.active, .button.button-balanced.button-outline.activated {\n        background-color: #33cd5f;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-energized {\n    border-color: transparent;\n    background-color: #ffc900;\n    color: #fff; }\n    .button.button-energized:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-energized.active, .button.button-energized.activated {\n      border-color: #a2a2a2;\n      background-color: #e6b500; }\n    .button.button-energized.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #ffc900; }\n    .button.button-energized.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-energized.button-outline {\n      border-color: #ffc900;\n      background: transparent;\n      color: #ffc900; }\n      .button.button-energized.button-outline.active, .button.button-energized.button-outline.activated {\n        background-color: #ffc900;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-royal {\n    border-color: transparent;\n    background-color: #886aea;\n    color: #fff; }\n    .button.button-royal:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-royal.active, .button.button-royal.activated {\n      border-color: #a2a2a2;\n      background-color: #6b46e5; }\n    .button.button-royal.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #886aea; }\n    .button.button-royal.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-royal.button-outline {\n      border-color: #886aea;\n      background: transparent;\n      color: #886aea; }\n      .button.button-royal.button-outline.active, .button.button-royal.button-outline.activated {\n        background-color: #886aea;\n        box-shadow: none;\n        color: #fff; }\n  .button.button-dark {\n    border-color: transparent;\n    background-color: #444;\n    color: #fff; }\n    .button.button-dark:hover {\n      color: #fff;\n      text-decoration: none; }\n    .button.button-dark.active, .button.button-dark.activated {\n      border-color: #a2a2a2;\n      background-color: #262626; }\n    .button.button-dark.button-clear {\n      border-color: transparent;\n      background: none;\n      box-shadow: none;\n      color: #444; }\n    .button.button-dark.button-icon {\n      border-color: transparent;\n      background: none; }\n    .button.button-dark.button-outline {\n      border-color: #444;\n      background: transparent;\n      color: #444; }\n      .button.button-dark.button-outline.active, .button.button-dark.button-outline.activated {\n        background-color: #444;\n        box-shadow: none;\n        color: #fff; }\n\n.button-small {\n  padding: 2px 4px 1px;\n  min-width: 28px;\n  min-height: 30px;\n  font-size: 12px;\n  line-height: 26px; }\n  .button-small .icon:before, .button-small.icon:before, .button-small.icon-left:before, .button-small.icon-right:before {\n    font-size: 16px;\n    line-height: 19px;\n    margin-top: 3px; }\n\n.button-large {\n  padding: 0 16px;\n  min-width: 68px;\n  min-height: 59px;\n  font-size: 20px;\n  line-height: 53px; }\n  .button-large .icon:before, .button-large.icon:before, .button-large.icon-left:before, .button-large.icon-right:before {\n    padding-bottom: 2px;\n    font-size: 32px;\n    line-height: 51px; }\n\n.button-icon {\n  -webkit-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  padding: 0 6px;\n  min-width: initial;\n  border-color: transparent;\n  background: none; }\n  .button-icon.button.active, .button-icon.button.activated {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    opacity: 0.3; }\n  .button-icon .icon:before, .button-icon.icon:before {\n    font-size: 32px; }\n\n.button-clear {\n  -webkit-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  padding: 0 6px;\n  max-height: 42px;\n  border-color: transparent;\n  background: none;\n  box-shadow: none; }\n  .button-clear.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: transparent; }\n  .button-clear.button-icon {\n    border-color: transparent;\n    background: none; }\n  .button-clear.active, .button-clear.activated {\n    opacity: 0.3; }\n\n.button-outline {\n  -webkit-transition: opacity 0.1s;\n  transition: opacity 0.1s;\n  background: none;\n  box-shadow: none; }\n  .button-outline.button-outline {\n    border-color: transparent;\n    background: transparent;\n    color: transparent; }\n    .button-outline.button-outline.active, .button-outline.button-outline.activated {\n      background-color: transparent;\n      box-shadow: none;\n      color: #fff; }\n\n.padding > .button.button-block:first-child {\n  margin-top: 0; }\n\n.button-block {\n  display: block;\n  clear: both; }\n  .button-block:after {\n    clear: both; }\n\n.button-full,\n.button-full > .button {\n  display: block;\n  margin-right: 0;\n  margin-left: 0;\n  border-right-width: 0;\n  border-left-width: 0;\n  border-radius: 0; }\n\nbutton.button-block,\nbutton.button-full,\n.button-full > button.button,\ninput.button.button-block {\n  width: 100%; }\n\na.button {\n  text-decoration: none; }\n  a.button .icon:before, a.button.icon:before, a.button.icon-left:before, a.button.icon-right:before {\n    margin-top: 2px; }\n\n.button.disabled,\n.button[disabled] {\n  opacity: .4;\n  cursor: default !important;\n  pointer-events: none; }\n\n/**\n * Button Bar\n * --------------------------------------------------\n */\n.button-bar {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  width: 100%; }\n  .button-bar.button-bar-inline {\n    display: block;\n    width: auto;\n    *zoom: 1; }\n    .button-bar.button-bar-inline:before, .button-bar.button-bar-inline:after {\n      display: table;\n      content: \"\";\n      line-height: 0; }\n    .button-bar.button-bar-inline:after {\n      clear: both; }\n    .button-bar.button-bar-inline > .button {\n      width: auto;\n      display: inline-block;\n      float: left; }\n  .button-bar.bar-light > .button {\n    border-color: #ddd; }\n  .button-bar.bar-stable > .button {\n    border-color: #b2b2b2; }\n  .button-bar.bar-positive > .button {\n    border-color: #0c60ee; }\n  .button-bar.bar-calm > .button {\n    border-color: #0a9dc7; }\n  .button-bar.bar-assertive > .button {\n    border-color: #e42112; }\n  .button-bar.bar-balanced > .button {\n    border-color: #28a54c; }\n  .button-bar.bar-energized > .button {\n    border-color: #e6b500; }\n  .button-bar.bar-royal > .button {\n    border-color: #6b46e5; }\n  .button-bar.bar-dark > .button {\n    border-color: #111; }\n\n.button-bar > .button {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  overflow: hidden;\n  padding: 0 16px;\n  width: 0;\n  border-width: 1px 0px 1px 1px;\n  border-radius: 0;\n  text-align: center;\n  text-overflow: ellipsis;\n  white-space: nowrap; }\n  .button-bar > .button:before,\n  .button-bar > .button .icon:before {\n    line-height: 44px; }\n  .button-bar > .button:first-child {\n    border-radius: 4px 0px 0px 4px; }\n  .button-bar > .button:last-child {\n    border-right-width: 1px;\n    border-radius: 0px 4px 4px 0px; }\n  .button-bar > .button:only-child {\n    border-radius: 4px; }\n\n.button-bar > .button-small:before,\n.button-bar > .button-small .icon:before {\n  line-height: 28px; }\n\n/**\n * Grid\n * --------------------------------------------------\n * Using flexbox for the grid, inspired by Philip Walton:\n * http://philipwalton.github.io/solved-by-flexbox/demos/grids/\n * By default each .col within a .row will evenly take up\n * available width, and the height of each .col with take\n * up the height of the tallest .col in the same .row.\n */\n.row {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n  padding: 5px;\n  width: 100%; }\n\n.row-wrap {\n  -webkit-flex-wrap: wrap;\n  -moz-flex-wrap: wrap;\n  -ms-flex-wrap: wrap;\n  flex-wrap: wrap; }\n\n.row-no-padding {\n  padding: 0; }\n  .row-no-padding > .col {\n    padding: 0; }\n\n.row + .row {\n  margin-top: -5px;\n  padding-top: 0; }\n\n.col {\n  -webkit-box-flex: 1;\n  -webkit-flex: 1;\n  -moz-box-flex: 1;\n  -moz-flex: 1;\n  -ms-flex: 1;\n  flex: 1;\n  display: block;\n  padding: 5px;\n  width: 100%; }\n\n/* Vertically Align Columns */\n/* .row-* vertically aligns every .col in the .row */\n.row-top {\n  -webkit-box-align: start;\n  -ms-flex-align: start;\n  -webkit-align-items: flex-start;\n  -moz-align-items: flex-start;\n  align-items: flex-start; }\n\n.row-bottom {\n  -webkit-box-align: end;\n  -ms-flex-align: end;\n  -webkit-align-items: flex-end;\n  -moz-align-items: flex-end;\n  align-items: flex-end; }\n\n.row-center {\n  -webkit-box-align: center;\n  -ms-flex-align: center;\n  -webkit-align-items: center;\n  -moz-align-items: center;\n  align-items: center; }\n\n.row-stretch {\n  -webkit-box-align: stretch;\n  -ms-flex-align: stretch;\n  -webkit-align-items: stretch;\n  -moz-align-items: stretch;\n  align-items: stretch; }\n\n.row-baseline {\n  -webkit-box-align: baseline;\n  -ms-flex-align: baseline;\n  -webkit-align-items: baseline;\n  -moz-align-items: baseline;\n  align-items: baseline; }\n\n/* .col-* vertically aligns an individual .col */\n.col-top {\n  -webkit-align-self: flex-start;\n  -moz-align-self: flex-start;\n  -ms-flex-item-align: start;\n  align-self: flex-start; }\n\n.col-bottom {\n  -webkit-align-self: flex-end;\n  -moz-align-self: flex-end;\n  -ms-flex-item-align: end;\n  align-self: flex-end; }\n\n.col-center {\n  -webkit-align-self: center;\n  -moz-align-self: center;\n  -ms-flex-item-align: center;\n  align-self: center; }\n\n/* Column Offsets */\n.col-offset-10 {\n  margin-left: 10%; }\n\n.col-offset-20 {\n  margin-left: 20%; }\n\n.col-offset-25 {\n  margin-left: 25%; }\n\n.col-offset-33, .col-offset-34 {\n  margin-left: 33.3333%; }\n\n.col-offset-50 {\n  margin-left: 50%; }\n\n.col-offset-66, .col-offset-67 {\n  margin-left: 66.6666%; }\n\n.col-offset-75 {\n  margin-left: 75%; }\n\n.col-offset-80 {\n  margin-left: 80%; }\n\n.col-offset-90 {\n  margin-left: 90%; }\n\n/* Explicit Column Percent Sizes */\n/* By default each grid column will evenly distribute */\n/* across the grid. However, you can specify individual */\n/* columns to take up a certain size of the available area */\n.col-10 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 10%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 10%;\n  -ms-flex: 0 0 10%;\n  flex: 0 0 10%;\n  max-width: 10%; }\n\n.col-20 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 20%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 20%;\n  -ms-flex: 0 0 20%;\n  flex: 0 0 20%;\n  max-width: 20%; }\n\n.col-25 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 25%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 25%;\n  -ms-flex: 0 0 25%;\n  flex: 0 0 25%;\n  max-width: 25%; }\n\n.col-33, .col-34 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 33.3333%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 33.3333%;\n  -ms-flex: 0 0 33.3333%;\n  flex: 0 0 33.3333%;\n  max-width: 33.3333%; }\n\n.col-40 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 40%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 40%;\n  -ms-flex: 0 0 40%;\n  flex: 0 0 40%;\n  max-width: 40%; }\n\n.col-50 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 50%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 50%;\n  -ms-flex: 0 0 50%;\n  flex: 0 0 50%;\n  max-width: 50%; }\n\n.col-60 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 60%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 60%;\n  -ms-flex: 0 0 60%;\n  flex: 0 0 60%;\n  max-width: 60%; }\n\n.col-66, .col-67 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 66.6666%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 66.6666%;\n  -ms-flex: 0 0 66.6666%;\n  flex: 0 0 66.6666%;\n  max-width: 66.6666%; }\n\n.col-75 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 75%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 75%;\n  -ms-flex: 0 0 75%;\n  flex: 0 0 75%;\n  max-width: 75%; }\n\n.col-80 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 80%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 80%;\n  -ms-flex: 0 0 80%;\n  flex: 0 0 80%;\n  max-width: 80%; }\n\n.col-90 {\n  -webkit-box-flex: 0;\n  -webkit-flex: 0 0 90%;\n  -moz-box-flex: 0;\n  -moz-flex: 0 0 90%;\n  -ms-flex: 0 0 90%;\n  flex: 0 0 90%;\n  max-width: 90%; }\n\n/* Responsive Grid Classes */\n/* Adding a class of responsive-X to a row */\n/* will trigger the flex-direction to */\n/* change to column and add some margin */\n/* to any columns in the row for clearity */\n@media (max-width: 567px) {\n  .responsive-sm {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-sm .col, .responsive-sm .col-10, .responsive-sm .col-20, .responsive-sm .col-25, .responsive-sm .col-33, .responsive-sm .col-34, .responsive-sm .col-50, .responsive-sm .col-66, .responsive-sm .col-67, .responsive-sm .col-75, .responsive-sm .col-80, .responsive-sm .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n@media (max-width: 767px) {\n  .responsive-md {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-md .col, .responsive-md .col-10, .responsive-md .col-20, .responsive-md .col-25, .responsive-md .col-33, .responsive-md .col-34, .responsive-md .col-50, .responsive-md .col-66, .responsive-md .col-67, .responsive-md .col-75, .responsive-md .col-80, .responsive-md .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n@media (max-width: 1023px) {\n  .responsive-lg {\n    -webkit-box-direction: normal;\n    -moz-box-direction: normal;\n    -webkit-box-orient: vertical;\n    -moz-box-orient: vertical;\n    -webkit-flex-direction: column;\n    -ms-flex-direction: column;\n    flex-direction: column; }\n    .responsive-lg .col, .responsive-lg .col-10, .responsive-lg .col-20, .responsive-lg .col-25, .responsive-lg .col-33, .responsive-lg .col-34, .responsive-lg .col-50, .responsive-lg .col-66, .responsive-lg .col-67, .responsive-lg .col-75, .responsive-lg .col-80, .responsive-lg .col-90 {\n      -webkit-box-flex: 1;\n      -webkit-flex: 1;\n      -moz-box-flex: 1;\n      -moz-flex: 1;\n      -ms-flex: 1;\n      flex: 1;\n      margin-bottom: 15px;\n      margin-left: 0;\n      max-width: 100%;\n      width: 100%; } }\n\n/**\n * Utility Classes\n * --------------------------------------------------\n */\n.hide {\n  display: none; }\n\n.opacity-hide {\n  opacity: 0; }\n\n.grade-b .opacity-hide,\n.grade-c .opacity-hide {\n  opacity: 1;\n  display: none; }\n\n.show {\n  display: block; }\n\n.opacity-show {\n  opacity: 1; }\n\n.invisible {\n  visibility: hidden; }\n\n.keyboard-open .hide-on-keyboard-open {\n  display: none; }\n\n.keyboard-open .tabs.hide-on-keyboard-open + .pane .has-tabs,\n.keyboard-open .bar-footer.hide-on-keyboard-open + .pane .has-footer {\n  bottom: 0; }\n\n.inline {\n  display: inline-block; }\n\n.disable-pointer-events {\n  pointer-events: none; }\n\n.enable-pointer-events {\n  pointer-events: auto; }\n\n.disable-user-behavior {\n  -webkit-user-select: none;\n  -moz-user-select: none;\n  -ms-user-select: none;\n  user-select: none;\n  -webkit-touch-callout: none;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-tap-highlight-color: transparent;\n  -webkit-user-drag: none;\n  -ms-touch-action: none;\n  -ms-content-zooming: none; }\n\n.click-block {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  opacity: 0;\n  z-index: 99999;\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  overflow: hidden; }\n\n.click-block-hide {\n  -webkit-transform: translate3d(-9999px, 0, 0);\n  transform: translate3d(-9999px, 0, 0); }\n\n.no-resize {\n  resize: none; }\n\n.block {\n  display: block;\n  clear: both; }\n  .block:after {\n    display: block;\n    visibility: hidden;\n    clear: both;\n    height: 0;\n    content: \".\"; }\n\n.full-image {\n  width: 100%; }\n\n.clearfix {\n  *zoom: 1; }\n  .clearfix:before, .clearfix:after {\n    display: table;\n    content: \"\";\n    line-height: 0; }\n  .clearfix:after {\n    clear: both; }\n\n/**\n * Content Padding\n * --------------------------------------------------\n */\n.padding {\n  padding: 10px; }\n\n.padding-top,\n.padding-vertical {\n  padding-top: 10px; }\n\n.padding-right,\n.padding-horizontal {\n  padding-right: 10px; }\n\n.padding-bottom,\n.padding-vertical {\n  padding-bottom: 10px; }\n\n.padding-left,\n.padding-horizontal {\n  padding-left: 10px; }\n\n/**\n * Scrollable iFrames\n * --------------------------------------------------\n */\n.iframe-wrapper {\n  position: fixed;\n  -webkit-overflow-scrolling: touch;\n  overflow: scroll; }\n  .iframe-wrapper iframe {\n    height: 100%;\n    width: 100%; }\n\n/**\n * Rounded\n * --------------------------------------------------\n */\n.rounded {\n  border-radius: 4px; }\n\n/**\n * Utility Colors\n * --------------------------------------------------\n * Utility colors are added to help set a naming convention. You'll\n * notice we purposely do not use words like \"red\" or \"blue\", but\n * instead have colors which represent an emotion or generic theme.\n */\n.light, a.light {\n  color: #fff; }\n\n.light-bg {\n  background-color: #fff; }\n\n.light-border {\n  border-color: #ddd; }\n\n.stable, a.stable {\n  color: #f8f8f8; }\n\n.stable-bg {\n  background-color: #f8f8f8; }\n\n.stable-border {\n  border-color: #b2b2b2; }\n\n.positive, a.positive {\n  color: #387ef5; }\n\n.positive-bg {\n  background-color: #387ef5; }\n\n.positive-border {\n  border-color: #0c60ee; }\n\n.calm, a.calm {\n  color: #11c1f3; }\n\n.calm-bg {\n  background-color: #11c1f3; }\n\n.calm-border {\n  border-color: #0a9dc7; }\n\n.assertive, a.assertive {\n  color: #ef473a; }\n\n.assertive-bg {\n  background-color: #ef473a; }\n\n.assertive-border {\n  border-color: #e42112; }\n\n.balanced, a.balanced {\n  color: #33cd5f; }\n\n.balanced-bg {\n  background-color: #33cd5f; }\n\n.balanced-border {\n  border-color: #28a54c; }\n\n.energized, a.energized {\n  color: #ffc900; }\n\n.energized-bg {\n  background-color: #ffc900; }\n\n.energized-border {\n  border-color: #e6b500; }\n\n.royal, a.royal {\n  color: #886aea; }\n\n.royal-bg {\n  background-color: #886aea; }\n\n.royal-border {\n  border-color: #6b46e5; }\n\n.dark, a.dark {\n  color: #444; }\n\n.dark-bg {\n  background-color: #444; }\n\n.dark-border {\n  border-color: #111; }\n\n[collection-repeat] {\n  /* Position is set by transforms */\n  left: 0 !important;\n  top: 0 !important;\n  position: absolute !important;\n  z-index: 1; }\n\n.collection-repeat-container {\n  position: relative;\n  z-index: 1; }\n\n.collection-repeat-after-container {\n  z-index: 0;\n  display: block;\n  /* when scrolling horizontally, make sure the after container doesn't take up 100% width */ }\n  .collection-repeat-after-container.horizontal {\n    display: inline-block; }\n\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak,\n.x-ng-cloak, .ng-hide:not(.ng-hide-animate) {\n  display: none !important; }\n\n/**\n * Platform\n * --------------------------------------------------\n * Platform specific tweaks\n */\n.platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader) {\n  height: 64px; }\n  .platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader).item-input-inset .item-input-wrapper {\n    margin-top: 19px !important; }\n  .platform-ios.platform-cordova:not(.fullscreen) .bar-header:not(.bar-subheader) > * {\n    margin-top: 20px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .tabs-top > .tabs,\n.platform-ios.platform-cordova:not(.fullscreen) .tabs.tabs-top {\n  top: 64px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-header,\n.platform-ios.platform-cordova:not(.fullscreen) .bar-subheader {\n  top: 64px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-subheader {\n  top: 108px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-header.has-tabs-top {\n  top: 113px; }\n\n.platform-ios.platform-cordova:not(.fullscreen) .has-header.has-subheader.has-tabs-top {\n  top: 157px; }\n\n.platform-ios.platform-cordova .popover .bar-header:not(.bar-subheader) {\n  height: 44px; }\n  .platform-ios.platform-cordova .popover .bar-header:not(.bar-subheader).item-input-inset .item-input-wrapper {\n    margin-top: -1px; }\n  .platform-ios.platform-cordova .popover .bar-header:not(.bar-subheader) > * {\n    margin-top: 0; }\n\n.platform-ios.platform-cordova .popover .has-header,\n.platform-ios.platform-cordova .popover .bar-subheader {\n  top: 44px; }\n\n.platform-ios.platform-cordova .popover .has-subheader {\n  top: 88px; }\n\n.platform-ios.platform-cordova.status-bar-hide {\n  margin-bottom: 20px; }\n\n@media (orientation: landscape) {\n  .platform-ios.platform-browser.platform-ipad {\n    position: fixed; } }\n\n.platform-c:not(.enable-transitions) * {\n  -webkit-transition: none !important;\n  transition: none !important; }\n\n.slide-in-up {\n  -webkit-transform: translate3d(0, 100%, 0);\n  transform: translate3d(0, 100%, 0); }\n\n.slide-in-up.ng-enter,\n.slide-in-up > .ng-enter {\n  -webkit-transition: all cubic-bezier(0.1, 0.7, 0.1, 1) 400ms;\n  transition: all cubic-bezier(0.1, 0.7, 0.1, 1) 400ms; }\n\n.slide-in-up.ng-enter-active,\n.slide-in-up > .ng-enter-active {\n  -webkit-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0); }\n\n.slide-in-up.ng-leave,\n.slide-in-up > .ng-leave {\n  -webkit-transition: all ease-in-out 250ms;\n  transition: all ease-in-out 250ms; }\n\n@-webkit-keyframes scaleOut {\n  from {\n    -webkit-transform: scale(1);\n    opacity: 1; }\n  to {\n    -webkit-transform: scale(0.8);\n    opacity: 0; } }\n\n@keyframes scaleOut {\n  from {\n    transform: scale(1);\n    opacity: 1; }\n  to {\n    transform: scale(0.8);\n    opacity: 0; } }\n\n@-webkit-keyframes superScaleIn {\n  from {\n    -webkit-transform: scale(1.2);\n    opacity: 0; }\n  to {\n    -webkit-transform: scale(1);\n    opacity: 1; } }\n\n@keyframes superScaleIn {\n  from {\n    transform: scale(1.2);\n    opacity: 0; }\n  to {\n    transform: scale(1);\n    opacity: 1; } }\n\n[nav-view-transition=\"ios\"] [nav-view=\"entering\"],\n[nav-view-transition=\"ios\"] [nav-view=\"leaving\"] {\n  -webkit-transition-duration: 500ms;\n  transition-duration: 500ms;\n  -webkit-transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  -webkit-transition-property: opacity, -webkit-transform, box-shadow;\n  transition-property: opacity, transform, box-shadow; }\n\n[nav-view-transition=\"ios\"][nav-view-direction=\"forward\"], [nav-view-transition=\"ios\"][nav-view-direction=\"back\"] {\n  background-color: #000; }\n\n[nav-view-transition=\"ios\"] [nav-view=\"active\"],\n[nav-view-transition=\"ios\"][nav-view-direction=\"forward\"] [nav-view=\"entering\"],\n[nav-view-transition=\"ios\"][nav-view-direction=\"back\"] [nav-view=\"leaving\"] {\n  z-index: 3; }\n\n[nav-view-transition=\"ios\"][nav-view-direction=\"back\"] [nav-view=\"entering\"],\n[nav-view-transition=\"ios\"][nav-view-direction=\"forward\"] [nav-view=\"leaving\"] {\n  z-index: 2; }\n\n[nav-bar-transition=\"ios\"] .title,\n[nav-bar-transition=\"ios\"] .buttons,\n[nav-bar-transition=\"ios\"] .back-text {\n  -webkit-transition-duration: 500ms;\n  transition-duration: 500ms;\n  -webkit-transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  transition-timing-function: cubic-bezier(0.36, 0.66, 0.04, 1);\n  -webkit-transition-property: opacity, -webkit-transform;\n  transition-property: opacity, transform; }\n\n[nav-bar-transition=\"ios\"] [nav-bar=\"active\"],\n[nav-bar-transition=\"ios\"] [nav-bar=\"entering\"] {\n  z-index: 10; }\n  [nav-bar-transition=\"ios\"] [nav-bar=\"active\"] .bar,\n  [nav-bar-transition=\"ios\"] [nav-bar=\"entering\"] .bar {\n    background: transparent; }\n\n[nav-bar-transition=\"ios\"] [nav-bar=\"cached\"] {\n  display: block; }\n  [nav-bar-transition=\"ios\"] [nav-bar=\"cached\"] .header-item {\n    display: none; }\n\n[nav-view-transition=\"android\"] [nav-view=\"entering\"],\n[nav-view-transition=\"android\"] [nav-view=\"leaving\"] {\n  -webkit-transition-duration: 200ms;\n  transition-duration: 200ms;\n  -webkit-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -webkit-transition-property: -webkit-transform;\n  transition-property: transform; }\n\n[nav-view-transition=\"android\"] [nav-view=\"active\"],\n[nav-view-transition=\"android\"][nav-view-direction=\"forward\"] [nav-view=\"entering\"],\n[nav-view-transition=\"android\"][nav-view-direction=\"back\"] [nav-view=\"leaving\"] {\n  z-index: 3; }\n\n[nav-view-transition=\"android\"][nav-view-direction=\"back\"] [nav-view=\"entering\"],\n[nav-view-transition=\"android\"][nav-view-direction=\"forward\"] [nav-view=\"leaving\"] {\n  z-index: 2; }\n\n[nav-bar-transition=\"android\"] .title,\n[nav-bar-transition=\"android\"] .buttons {\n  -webkit-transition-duration: 200ms;\n  transition-duration: 200ms;\n  -webkit-transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  transition-timing-function: cubic-bezier(0.4, 0.6, 0.2, 1);\n  -webkit-transition-property: opacity;\n  transition-property: opacity; }\n\n[nav-bar-transition=\"android\"] [nav-bar=\"active\"],\n[nav-bar-transition=\"android\"] [nav-bar=\"entering\"] {\n  z-index: 10; }\n  [nav-bar-transition=\"android\"] [nav-bar=\"active\"] .bar,\n  [nav-bar-transition=\"android\"] [nav-bar=\"entering\"] .bar {\n    background: transparent; }\n\n[nav-bar-transition=\"android\"] [nav-bar=\"cached\"] {\n  display: block; }\n  [nav-bar-transition=\"android\"] [nav-bar=\"cached\"] .header-item {\n    display: none; }\n\n[nav-swipe=\"fast\"] [nav-view],\n[nav-swipe=\"fast\"] .title,\n[nav-swipe=\"fast\"] .buttons,\n[nav-swipe=\"fast\"] .back-text {\n  -webkit-transition-duration: 50ms;\n  transition-duration: 50ms;\n  -webkit-transition-timing-function: linear;\n  transition-timing-function: linear; }\n\n[nav-swipe=\"slow\"] [nav-view],\n[nav-swipe=\"slow\"] .title,\n[nav-swipe=\"slow\"] .buttons,\n[nav-swipe=\"slow\"] .back-text {\n  -webkit-transition-duration: 160ms;\n  transition-duration: 160ms;\n  -webkit-transition-timing-function: linear;\n  transition-timing-function: linear; }\n\n[nav-view=\"cached\"],\n[nav-bar=\"cached\"] {\n  display: none; }\n\n[nav-view=\"stage\"] {\n  opacity: 0;\n  -webkit-transition-duration: 0;\n  transition-duration: 0; }\n\n[nav-bar=\"stage\"] .title,\n[nav-bar=\"stage\"] .buttons,\n[nav-bar=\"stage\"] .back-text {\n  position: absolute;\n  opacity: 0;\n  -webkit-transition-duration: 0s;\n  transition-duration: 0s; }\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/angular/angular-animate.js",
    "content": "/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* jshint ignore:start */\nvar noop        = angular.noop;\nvar copy        = angular.copy;\nvar extend      = angular.extend;\nvar jqLite      = angular.element;\nvar forEach     = angular.forEach;\nvar isArray     = angular.isArray;\nvar isString    = angular.isString;\nvar isObject    = angular.isObject;\nvar isUndefined = angular.isUndefined;\nvar isDefined   = angular.isDefined;\nvar isFunction  = angular.isFunction;\nvar isElement   = angular.isElement;\n\nvar ELEMENT_NODE = 1;\nvar COMMENT_NODE = 8;\n\nvar ADD_CLASS_SUFFIX = '-add';\nvar REMOVE_CLASS_SUFFIX = '-remove';\nvar EVENT_CLASS_PREFIX = 'ng-';\nvar ACTIVE_CLASS_SUFFIX = '-active';\nvar PREPARE_CLASS_SUFFIX = '-prepare';\n\nvar NG_ANIMATE_CLASSNAME = 'ng-animate';\nvar NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren';\n\n// Detect proper transitionend/animationend event names.\nvar CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;\n\n// If unprefixed events are not supported but webkit-prefixed are, use the latter.\n// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.\n// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`\n// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.\n// Register both events in case `window.onanimationend` is not supported because of that,\n// do the same for `transitionend` as Safari is likely to exhibit similar behavior.\n// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit\n// therefore there is no reason to test anymore for other vendor prefixes:\n// http://caniuse.com/#search=transition\nif (isUndefined(window.ontransitionend) && isDefined(window.onwebkittransitionend)) {\n  CSS_PREFIX = '-webkit-';\n  TRANSITION_PROP = 'WebkitTransition';\n  TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';\n} else {\n  TRANSITION_PROP = 'transition';\n  TRANSITIONEND_EVENT = 'transitionend';\n}\n\nif (isUndefined(window.onanimationend) && isDefined(window.onwebkitanimationend)) {\n  CSS_PREFIX = '-webkit-';\n  ANIMATION_PROP = 'WebkitAnimation';\n  ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';\n} else {\n  ANIMATION_PROP = 'animation';\n  ANIMATIONEND_EVENT = 'animationend';\n}\n\nvar DURATION_KEY = 'Duration';\nvar PROPERTY_KEY = 'Property';\nvar DELAY_KEY = 'Delay';\nvar TIMING_KEY = 'TimingFunction';\nvar ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';\nvar ANIMATION_PLAYSTATE_KEY = 'PlayState';\nvar SAFE_FAST_FORWARD_DURATION_VALUE = 9999;\n\nvar ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;\nvar ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;\nvar TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;\nvar TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;\n\nvar isPromiseLike = function(p) {\n  return p && p.then ? true : false;\n};\n\nvar ngMinErr = angular.$$minErr('ng');\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction mergeClasses(a,b) {\n  if (!a && !b) return '';\n  if (!a) return b;\n  if (!b) return a;\n  if (isArray(a)) a = a.join(' ');\n  if (isArray(b)) b = b.join(' ');\n  return a + ' ' + b;\n}\n\nfunction packageStyles(options) {\n  var styles = {};\n  if (options && (options.to || options.from)) {\n    styles.to = options.to;\n    styles.from = options.from;\n  }\n  return styles;\n}\n\nfunction pendClasses(classes, fix, isPrefix) {\n  var className = '';\n  classes = isArray(classes)\n      ? classes\n      : classes && isString(classes) && classes.length\n          ? classes.split(/\\s+/)\n          : [];\n  forEach(classes, function(klass, i) {\n    if (klass && klass.length > 0) {\n      className += (i > 0) ? ' ' : '';\n      className += isPrefix ? fix + klass\n                            : klass + fix;\n    }\n  });\n  return className;\n}\n\nfunction removeFromArray(arr, val) {\n  var index = arr.indexOf(val);\n  if (val >= 0) {\n    arr.splice(index, 1);\n  }\n}\n\nfunction stripCommentsFromElement(element) {\n  if (element instanceof jqLite) {\n    switch (element.length) {\n      case 0:\n        return [];\n        break;\n\n      case 1:\n        // there is no point of stripping anything if the element\n        // is the only element within the jqLite wrapper.\n        // (it's important that we retain the element instance.)\n        if (element[0].nodeType === ELEMENT_NODE) {\n          return element;\n        }\n        break;\n\n      default:\n        return jqLite(extractElementNode(element));\n        break;\n    }\n  }\n\n  if (element.nodeType === ELEMENT_NODE) {\n    return jqLite(element);\n  }\n}\n\nfunction extractElementNode(element) {\n  if (!element[0]) return element;\n  for (var i = 0; i < element.length; i++) {\n    var elm = element[i];\n    if (elm.nodeType == ELEMENT_NODE) {\n      return elm;\n    }\n  }\n}\n\nfunction $$addClass($$jqLite, element, className) {\n  forEach(element, function(elm) {\n    $$jqLite.addClass(elm, className);\n  });\n}\n\nfunction $$removeClass($$jqLite, element, className) {\n  forEach(element, function(elm) {\n    $$jqLite.removeClass(elm, className);\n  });\n}\n\nfunction applyAnimationClassesFactory($$jqLite) {\n  return function(element, options) {\n    if (options.addClass) {\n      $$addClass($$jqLite, element, options.addClass);\n      options.addClass = null;\n    }\n    if (options.removeClass) {\n      $$removeClass($$jqLite, element, options.removeClass);\n      options.removeClass = null;\n    }\n  }\n}\n\nfunction prepareAnimationOptions(options) {\n  options = options || {};\n  if (!options.$$prepared) {\n    var domOperation = options.domOperation || noop;\n    options.domOperation = function() {\n      options.$$domOperationFired = true;\n      domOperation();\n      domOperation = noop;\n    };\n    options.$$prepared = true;\n  }\n  return options;\n}\n\nfunction applyAnimationStyles(element, options) {\n  applyAnimationFromStyles(element, options);\n  applyAnimationToStyles(element, options);\n}\n\nfunction applyAnimationFromStyles(element, options) {\n  if (options.from) {\n    element.css(options.from);\n    options.from = null;\n  }\n}\n\nfunction applyAnimationToStyles(element, options) {\n  if (options.to) {\n    element.css(options.to);\n    options.to = null;\n  }\n}\n\nfunction mergeAnimationDetails(element, oldAnimation, newAnimation) {\n  var target = oldAnimation.options || {};\n  var newOptions = newAnimation.options || {};\n\n  var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || '');\n  var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || '');\n  var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove);\n\n  if (newOptions.preparationClasses) {\n    target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses);\n    delete newOptions.preparationClasses;\n  }\n\n  // noop is basically when there is no callback; otherwise something has been set\n  var realDomOperation = target.domOperation !== noop ? target.domOperation : null;\n\n  extend(target, newOptions);\n\n  // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this.\n  if (realDomOperation) {\n    target.domOperation = realDomOperation;\n  }\n\n  if (classes.addClass) {\n    target.addClass = classes.addClass;\n  } else {\n    target.addClass = null;\n  }\n\n  if (classes.removeClass) {\n    target.removeClass = classes.removeClass;\n  } else {\n    target.removeClass = null;\n  }\n\n  oldAnimation.addClass = target.addClass;\n  oldAnimation.removeClass = target.removeClass;\n\n  return target;\n}\n\nfunction resolveElementClasses(existing, toAdd, toRemove) {\n  var ADD_CLASS = 1;\n  var REMOVE_CLASS = -1;\n\n  var flags = {};\n  existing = splitClassesToLookup(existing);\n\n  toAdd = splitClassesToLookup(toAdd);\n  forEach(toAdd, function(value, key) {\n    flags[key] = ADD_CLASS;\n  });\n\n  toRemove = splitClassesToLookup(toRemove);\n  forEach(toRemove, function(value, key) {\n    flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;\n  });\n\n  var classes = {\n    addClass: '',\n    removeClass: ''\n  };\n\n  forEach(flags, function(val, klass) {\n    var prop, allow;\n    if (val === ADD_CLASS) {\n      prop = 'addClass';\n      allow = !existing[klass];\n    } else if (val === REMOVE_CLASS) {\n      prop = 'removeClass';\n      allow = existing[klass];\n    }\n    if (allow) {\n      if (classes[prop].length) {\n        classes[prop] += ' ';\n      }\n      classes[prop] += klass;\n    }\n  });\n\n  function splitClassesToLookup(classes) {\n    if (isString(classes)) {\n      classes = classes.split(' ');\n    }\n\n    var obj = {};\n    forEach(classes, function(klass) {\n      // sometimes the split leaves empty string values\n      // incase extra spaces were applied to the options\n      if (klass.length) {\n        obj[klass] = true;\n      }\n    });\n    return obj;\n  }\n\n  return classes;\n}\n\nfunction getDomNode(element) {\n  return (element instanceof angular.element) ? element[0] : element;\n}\n\nfunction applyGeneratedPreparationClasses(element, event, options) {\n  var classes = '';\n  if (event) {\n    classes = pendClasses(event, EVENT_CLASS_PREFIX, true);\n  }\n  if (options.addClass) {\n    classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX));\n  }\n  if (options.removeClass) {\n    classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX));\n  }\n  if (classes.length) {\n    options.preparationClasses = classes;\n    element.addClass(classes);\n  }\n}\n\nfunction clearGeneratedClasses(element, options) {\n  if (options.preparationClasses) {\n    element.removeClass(options.preparationClasses);\n    options.preparationClasses = null;\n  }\n  if (options.activeClasses) {\n    element.removeClass(options.activeClasses);\n    options.activeClasses = null;\n  }\n}\n\nfunction blockTransitions(node, duration) {\n  // we use a negative delay value since it performs blocking\n  // yet it doesn't kill any existing transitions running on the\n  // same element which makes this safe for class-based animations\n  var value = duration ? '-' + duration + 's' : '';\n  applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]);\n  return [TRANSITION_DELAY_PROP, value];\n}\n\nfunction blockKeyframeAnimations(node, applyBlock) {\n  var value = applyBlock ? 'paused' : '';\n  var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;\n  applyInlineStyle(node, [key, value]);\n  return [key, value];\n}\n\nfunction applyInlineStyle(node, styleTuple) {\n  var prop = styleTuple[0];\n  var value = styleTuple[1];\n  node.style[prop] = value;\n}\n\nfunction concatWithSpace(a,b) {\n  if (!a) return b;\n  if (!b) return a;\n  return a + ' ' + b;\n}\n\nvar $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {\n  var queue, cancelFn;\n\n  function scheduler(tasks) {\n    // we make a copy since RAFScheduler mutates the state\n    // of the passed in array variable and this would be difficult\n    // to track down on the outside code\n    queue = queue.concat(tasks);\n    nextTick();\n  }\n\n  queue = scheduler.queue = [];\n\n  /* waitUntilQuiet does two things:\n   * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through\n   * 2. It will delay the next wave of tasks from running until the quiet `fn` has run.\n   *\n   * The motivation here is that animation code can request more time from the scheduler\n   * before the next wave runs. This allows for certain DOM properties such as classes to\n   * be resolved in time for the next animation to run.\n   */\n  scheduler.waitUntilQuiet = function(fn) {\n    if (cancelFn) cancelFn();\n\n    cancelFn = $$rAF(function() {\n      cancelFn = null;\n      fn();\n      nextTick();\n    });\n  };\n\n  return scheduler;\n\n  function nextTick() {\n    if (!queue.length) return;\n\n    var items = queue.shift();\n    for (var i = 0; i < items.length; i++) {\n      items[i]();\n    }\n\n    if (!cancelFn) {\n      $$rAF(function() {\n        if (!cancelFn) nextTick();\n      });\n    }\n  }\n}];\n\n/**\n * @ngdoc directive\n * @name ngAnimateChildren\n * @restrict AE\n * @element ANY\n *\n * @description\n *\n * ngAnimateChildren allows you to specify that children of this element should animate even if any\n * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move`\n * (structural) animation, child elements that also have an active structural animation are not animated.\n *\n * Note that even if `ngAnimteChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation).\n *\n *\n * @param {string} ngAnimateChildren If the value is empty, `true` or `on`,\n *     then child animations are allowed. If the value is `false`, child animations are not allowed.\n *\n * @example\n * <example module=\"ngAnimateChildren\" name=\"ngAnimateChildren\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n       <div ng-controller=\"mainController as main\">\n         <label>Show container? <input type=\"checkbox\" ng-model=\"main.enterElement\" /></label>\n         <label>Animate children? <input type=\"checkbox\" ng-model=\"main.animateChildren\" /></label>\n         <hr>\n         <div ng-animate-children=\"{{main.animateChildren}}\">\n           <div ng-if=\"main.enterElement\" class=\"container\">\n             List of items:\n             <div ng-repeat=\"item in [0, 1, 2, 3]\" class=\"item\">Item {{item}}</div>\n           </div>\n         </div>\n       </div>\n     </file>\n     <file name=\"animations.css\">\n\n      .container.ng-enter,\n      .container.ng-leave {\n        transition: all ease 1.5s;\n      }\n\n      .container.ng-enter,\n      .container.ng-leave-active {\n        opacity: 0;\n      }\n\n      .container.ng-leave,\n      .container.ng-enter-active {\n        opacity: 1;\n      }\n\n      .item {\n        background: firebrick;\n        color: #FFF;\n        margin-bottom: 10px;\n      }\n\n      .item.ng-enter,\n      .item.ng-leave {\n        transition: transform 1.5s ease;\n      }\n\n      .item.ng-enter {\n        transform: translateX(50px);\n      }\n\n      .item.ng-enter-active {\n        transform: translateX(0);\n      }\n    </file>\n    <file name=\"script.js\">\n      angular.module('ngAnimateChildren', ['ngAnimate'])\n        .controller('mainController', function() {\n          this.animateChildren = false;\n          this.enterElement = false;\n        });\n    </file>\n  </example>\n */\nvar $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {\n  return {\n    link: function(scope, element, attrs) {\n      var val = attrs.ngAnimateChildren;\n      if (angular.isString(val) && val.length === 0) { //empty attribute\n        element.data(NG_ANIMATE_CHILDREN_DATA, true);\n      } else {\n        // Interpolate and set the value, so that it is available to\n        // animations that run right after compilation\n        setData($interpolate(val)(scope));\n        attrs.$observe('ngAnimateChildren', setData);\n      }\n\n      function setData(value) {\n        value = value === 'on' || value === 'true';\n        element.data(NG_ANIMATE_CHILDREN_DATA, value);\n      }\n    }\n  };\n}];\n\nvar ANIMATE_TIMER_KEY = '$$animateCss';\n\n/**\n * @ngdoc service\n * @name $animateCss\n * @kind object\n *\n * @description\n * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes\n * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT\n * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or\n * directives to create more complex animations that can be purely driven using CSS code.\n *\n * Note that only browsers that support CSS transitions and/or keyframe animations are capable of\n * rendering animations triggered via `$animateCss` (bad news for IE9 and lower).\n *\n * ## Usage\n * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that\n * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however,\n * any automatic control over cancelling animations and/or preventing animations from being run on\n * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to\n * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger\n * the CSS animation.\n *\n * The example below shows how we can create a folding animation on an element using `ng-if`:\n *\n * ```html\n * <!-- notice the `fold-animation` CSS class -->\n * <div ng-if=\"onOff\" class=\"fold-animation\">\n *   This element will go BOOM\n * </div>\n * <button ng-click=\"onOff=true\">Fold In</button>\n * ```\n *\n * Now we create the **JavaScript animation** that will trigger the CSS transition:\n *\n * ```js\n * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element, doneFn) {\n *       var height = element[0].offsetHeight;\n *       return $animateCss(element, {\n *         from: { height:'0px' },\n *         to: { height:height + 'px' },\n *         duration: 1 // one second\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * ## More Advanced Uses\n *\n * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks\n * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code.\n *\n * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation,\n * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with\n * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order\n * to provide a working animation that will run in CSS.\n *\n * The example below showcases a more advanced version of the `.fold-animation` from the example above:\n *\n * ```js\n * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element, doneFn) {\n *       var height = element[0].offsetHeight;\n *       return $animateCss(element, {\n *         addClass: 'red large-text pulse-twice',\n *         easing: 'ease-out',\n *         from: { height:'0px' },\n *         to: { height:height + 'px' },\n *         duration: 1 // one second\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * Since we're adding/removing CSS classes then the CSS transition will also pick those up:\n *\n * ```css\n * /&#42; since a hardcoded duration value of 1 was provided in the JavaScript animation code,\n * the CSS classes below will be transitioned despite them being defined as regular CSS classes &#42;/\n * .red { background:red; }\n * .large-text { font-size:20px; }\n *\n * /&#42; we can also use a keyframe animation and $animateCss will make it work alongside the transition &#42;/\n * .pulse-twice {\n *   animation: 0.5s pulse linear 2;\n *   -webkit-animation: 0.5s pulse linear 2;\n * }\n *\n * @keyframes pulse {\n *   from { transform: scale(0.5); }\n *   to { transform: scale(1.5); }\n * }\n *\n * @-webkit-keyframes pulse {\n *   from { -webkit-transform: scale(0.5); }\n *   to { -webkit-transform: scale(1.5); }\n * }\n * ```\n *\n * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen.\n *\n * ## How the Options are handled\n *\n * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation\n * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline\n * styles using the `from` and `to` properties.\n *\n * ```js\n * var animator = $animateCss(element, {\n *   from: { background:'red' },\n *   to: { background:'blue' }\n * });\n * animator.start();\n * ```\n *\n * ```css\n * .rotating-animation {\n *   animation:0.5s rotate linear;\n *   -webkit-animation:0.5s rotate linear;\n * }\n *\n * @keyframes rotate {\n *   from { transform: rotate(0deg); }\n *   to { transform: rotate(360deg); }\n * }\n *\n * @-webkit-keyframes rotate {\n *   from { -webkit-transform: rotate(0deg); }\n *   to { -webkit-transform: rotate(360deg); }\n * }\n * ```\n *\n * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is\n * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition\n * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition\n * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied\n * and spread across the transition and keyframe animation.\n *\n * ## What is returned\n *\n * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually\n * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are\n * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties:\n *\n * ```js\n * var animator = $animateCss(element, { ... });\n * ```\n *\n * Now what do the contents of our `animator` variable look like:\n *\n * ```js\n * {\n *   // starts the animation\n *   start: Function,\n *\n *   // ends (aborts) the animation\n *   end: Function\n * }\n * ```\n *\n * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends.\n * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been\n * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties\n * and that changing them will not reconfigure the parameters of the animation.\n *\n * ### runner.done() vs runner.then()\n * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the\n * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**.\n * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()`\n * unless you really need a digest to kick off afterwards.\n *\n * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss\n * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code).\n * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works.\n *\n * @param {DOMElement} element the element that will be animated\n * @param {object} options the animation-related options that will be applied during the animation\n *\n * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied\n * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.)\n * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and\n * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted.\n * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both).\n * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`).\n * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`).\n * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation.\n * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.\n * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation.\n * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation.\n * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0`\n * is provided then the animation will be skipped entirely.\n * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is\n * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value\n * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same\n * CSS delay value.\n * * `stagger` - A numeric time value representing the delay between successively animated elements\n * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.})\n * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a\n *   `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)\n * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.)\n * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once\n *    the animation is closed. This is useful for when the styles are used purely for the sake of\n *    the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation).\n *    By default this value is set to `false`.\n *\n * @return {object} an object with start and end methods and details about the animation.\n *\n * * `start` - The method to start the animation. This will return a `Promise` when called.\n * * `end` - This method will cancel the animation and remove all applied CSS classes and styles.\n */\nvar ONE_SECOND = 1000;\nvar BASE_TEN = 10;\n\nvar ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;\nvar CLOSING_TIME_BUFFER = 1.5;\n\nvar DETECT_CSS_PROPERTIES = {\n  transitionDuration:      TRANSITION_DURATION_PROP,\n  transitionDelay:         TRANSITION_DELAY_PROP,\n  transitionProperty:      TRANSITION_PROP + PROPERTY_KEY,\n  animationDuration:       ANIMATION_DURATION_PROP,\n  animationDelay:          ANIMATION_DELAY_PROP,\n  animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY\n};\n\nvar DETECT_STAGGER_CSS_PROPERTIES = {\n  transitionDuration:      TRANSITION_DURATION_PROP,\n  transitionDelay:         TRANSITION_DELAY_PROP,\n  animationDuration:       ANIMATION_DURATION_PROP,\n  animationDelay:          ANIMATION_DELAY_PROP\n};\n\nfunction getCssKeyframeDurationStyle(duration) {\n  return [ANIMATION_DURATION_PROP, duration + 's'];\n}\n\nfunction getCssDelayStyle(delay, isKeyframeAnimation) {\n  var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP;\n  return [prop, delay + 's'];\n}\n\nfunction computeCssStyles($window, element, properties) {\n  var styles = Object.create(null);\n  var detectedStyles = $window.getComputedStyle(element) || {};\n  forEach(properties, function(formalStyleName, actualStyleName) {\n    var val = detectedStyles[formalStyleName];\n    if (val) {\n      var c = val.charAt(0);\n\n      // only numerical-based values have a negative sign or digit as the first value\n      if (c === '-' || c === '+' || c >= 0) {\n        val = parseMaxTime(val);\n      }\n\n      // by setting this to null in the event that the delay is not set or is set directly as 0\n      // then we can still allow for negative values to be used later on and not mistake this\n      // value for being greater than any other negative value.\n      if (val === 0) {\n        val = null;\n      }\n      styles[actualStyleName] = val;\n    }\n  });\n\n  return styles;\n}\n\nfunction parseMaxTime(str) {\n  var maxValue = 0;\n  var values = str.split(/\\s*,\\s*/);\n  forEach(values, function(value) {\n    // it's always safe to consider only second values and omit `ms` values since\n    // getComputedStyle will always handle the conversion for us\n    if (value.charAt(value.length - 1) == 's') {\n      value = value.substring(0, value.length - 1);\n    }\n    value = parseFloat(value) || 0;\n    maxValue = maxValue ? Math.max(value, maxValue) : value;\n  });\n  return maxValue;\n}\n\nfunction truthyTimingValue(val) {\n  return val === 0 || val != null;\n}\n\nfunction getCssTransitionDurationStyle(duration, applyOnlyDuration) {\n  var style = TRANSITION_PROP;\n  var value = duration + 's';\n  if (applyOnlyDuration) {\n    style += DURATION_KEY;\n  } else {\n    value += ' linear all';\n  }\n  return [style, value];\n}\n\nfunction createLocalCacheLookup() {\n  var cache = Object.create(null);\n  return {\n    flush: function() {\n      cache = Object.create(null);\n    },\n\n    count: function(key) {\n      var entry = cache[key];\n      return entry ? entry.total : 0;\n    },\n\n    get: function(key) {\n      var entry = cache[key];\n      return entry && entry.value;\n    },\n\n    put: function(key, value) {\n      if (!cache[key]) {\n        cache[key] = { total: 1, value: value };\n      } else {\n        cache[key].total++;\n      }\n    }\n  };\n}\n\n// we do not reassign an already present style value since\n// if we detect the style property value again we may be\n// detecting styles that were added via the `from` styles.\n// We make use of `isDefined` here since an empty string\n// or null value (which is what getPropertyValue will return\n// for a non-existing style) will still be marked as a valid\n// value for the style (a falsy value implies that the style\n// is to be removed at the end of the animation). If we had a simple\n// \"OR\" statement then it would not be enough to catch that.\nfunction registerRestorableStyles(backup, node, properties) {\n  forEach(properties, function(prop) {\n    backup[prop] = isDefined(backup[prop])\n        ? backup[prop]\n        : node.style.getPropertyValue(prop);\n  });\n}\n\nvar $AnimateCssProvider = ['$animateProvider', function($animateProvider) {\n  var gcsLookup = createLocalCacheLookup();\n  var gcsStaggerLookup = createLocalCacheLookup();\n\n  this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',\n               '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue',\n       function($window,   $$jqLite,   $$AnimateRunner,   $timeout,\n                $$forceReflow,   $sniffer,   $$rAFScheduler, $$animateQueue) {\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    var parentCounter = 0;\n    function gcsHashFn(node, extraClasses) {\n      var KEY = \"$$ngAnimateParentKey\";\n      var parentNode = node.parentNode;\n      var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter);\n      return parentID + '-' + node.getAttribute('class') + '-' + extraClasses;\n    }\n\n    function computeCachedCssStyles(node, className, cacheKey, properties) {\n      var timings = gcsLookup.get(cacheKey);\n\n      if (!timings) {\n        timings = computeCssStyles($window, node, properties);\n        if (timings.animationIterationCount === 'infinite') {\n          timings.animationIterationCount = 1;\n        }\n      }\n\n      // we keep putting this in multiple times even though the value and the cacheKey are the same\n      // because we're keeping an internal tally of how many duplicate animations are detected.\n      gcsLookup.put(cacheKey, timings);\n      return timings;\n    }\n\n    function computeCachedCssStaggerStyles(node, className, cacheKey, properties) {\n      var stagger;\n\n      // if we have one or more existing matches of matching elements\n      // containing the same parent + CSS styles (which is how cacheKey works)\n      // then staggering is possible\n      if (gcsLookup.count(cacheKey) > 0) {\n        stagger = gcsStaggerLookup.get(cacheKey);\n\n        if (!stagger) {\n          var staggerClassName = pendClasses(className, '-stagger');\n\n          $$jqLite.addClass(node, staggerClassName);\n\n          stagger = computeCssStyles($window, node, properties);\n\n          // force the conversion of a null value to zero incase not set\n          stagger.animationDuration = Math.max(stagger.animationDuration, 0);\n          stagger.transitionDuration = Math.max(stagger.transitionDuration, 0);\n\n          $$jqLite.removeClass(node, staggerClassName);\n\n          gcsStaggerLookup.put(cacheKey, stagger);\n        }\n      }\n\n      return stagger || {};\n    }\n\n    var cancelLastRAFRequest;\n    var rafWaitQueue = [];\n    function waitUntilQuiet(callback) {\n      rafWaitQueue.push(callback);\n      $$rAFScheduler.waitUntilQuiet(function() {\n        gcsLookup.flush();\n        gcsStaggerLookup.flush();\n\n        // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable.\n        // PLEASE EXAMINE THE `$$forceReflow` service to understand why.\n        var pageWidth = $$forceReflow();\n\n        // we use a for loop to ensure that if the queue is changed\n        // during this looping then it will consider new requests\n        for (var i = 0; i < rafWaitQueue.length; i++) {\n          rafWaitQueue[i](pageWidth);\n        }\n        rafWaitQueue.length = 0;\n      });\n    }\n\n    function computeTimings(node, className, cacheKey) {\n      var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES);\n      var aD = timings.animationDelay;\n      var tD = timings.transitionDelay;\n      timings.maxDelay = aD && tD\n          ? Math.max(aD, tD)\n          : (aD || tD);\n      timings.maxDuration = Math.max(\n          timings.animationDuration * timings.animationIterationCount,\n          timings.transitionDuration);\n\n      return timings;\n    }\n\n    return function init(element, initialOptions) {\n      // all of the animation functions should create\n      // a copy of the options data, however, if a\n      // parent service has already created a copy then\n      // we should stick to using that\n      var options = initialOptions || {};\n      if (!options.$$prepared) {\n        options = prepareAnimationOptions(copy(options));\n      }\n\n      var restoreStyles = {};\n      var node = getDomNode(element);\n      if (!node\n          || !node.parentNode\n          || !$$animateQueue.enabled()) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var temporaryStyles = [];\n      var classes = element.attr('class');\n      var styles = packageStyles(options);\n      var animationClosed;\n      var animationPaused;\n      var animationCompleted;\n      var runner;\n      var runnerHost;\n      var maxDelay;\n      var maxDelayTime;\n      var maxDuration;\n      var maxDurationTime;\n      var startTime;\n      var events = [];\n\n      if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var method = options.event && isArray(options.event)\n            ? options.event.join(' ')\n            : options.event;\n\n      var isStructural = method && options.structural;\n      var structuralClassName = '';\n      var addRemoveClassName = '';\n\n      if (isStructural) {\n        structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true);\n      } else if (method) {\n        structuralClassName = method;\n      }\n\n      if (options.addClass) {\n        addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX);\n      }\n\n      if (options.removeClass) {\n        if (addRemoveClassName.length) {\n          addRemoveClassName += ' ';\n        }\n        addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX);\n      }\n\n      // there may be a situation where a structural animation is combined together\n      // with CSS classes that need to resolve before the animation is computed.\n      // However this means that there is no explicit CSS code to block the animation\n      // from happening (by setting 0s none in the class name). If this is the case\n      // we need to apply the classes before the first rAF so we know to continue if\n      // there actually is a detected transition or keyframe animation\n      if (options.applyClassesEarly && addRemoveClassName.length) {\n        applyAnimationClasses(element, options);\n      }\n\n      var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim();\n      var fullClassName = classes + ' ' + preparationClasses;\n      var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);\n      var hasToStyles = styles.to && Object.keys(styles.to).length > 0;\n      var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0;\n\n      // there is no way we can trigger an animation if no styles and\n      // no classes are being applied which would then trigger a transition,\n      // unless there a is raw keyframe value that is applied to the element.\n      if (!containsKeyframeAnimation\n           && !hasToStyles\n           && !preparationClasses) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var cacheKey, stagger;\n      if (options.stagger > 0) {\n        var staggerVal = parseFloat(options.stagger);\n        stagger = {\n          transitionDelay: staggerVal,\n          animationDelay: staggerVal,\n          transitionDuration: 0,\n          animationDuration: 0\n        };\n      } else {\n        cacheKey = gcsHashFn(node, fullClassName);\n        stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES);\n      }\n\n      if (!options.$$skipPreparationClasses) {\n        $$jqLite.addClass(element, preparationClasses);\n      }\n\n      var applyOnlyDuration;\n\n      if (options.transitionStyle) {\n        var transitionStyle = [TRANSITION_PROP, options.transitionStyle];\n        applyInlineStyle(node, transitionStyle);\n        temporaryStyles.push(transitionStyle);\n      }\n\n      if (options.duration >= 0) {\n        applyOnlyDuration = node.style[TRANSITION_PROP].length > 0;\n        var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration);\n\n        // we set the duration so that it will be picked up by getComputedStyle later\n        applyInlineStyle(node, durationStyle);\n        temporaryStyles.push(durationStyle);\n      }\n\n      if (options.keyframeStyle) {\n        var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle];\n        applyInlineStyle(node, keyframeStyle);\n        temporaryStyles.push(keyframeStyle);\n      }\n\n      var itemIndex = stagger\n          ? options.staggerIndex >= 0\n              ? options.staggerIndex\n              : gcsLookup.count(cacheKey)\n          : 0;\n\n      var isFirst = itemIndex === 0;\n\n      // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY\n      // without causing any combination of transitions to kick in. By adding a negative delay value\n      // it forces the setup class' transition to end immediately. We later then remove the negative\n      // transition delay to allow for the transition to naturally do it's thing. The beauty here is\n      // that if there is no transition defined then nothing will happen and this will also allow\n      // other transitions to be stacked on top of each other without any chopping them out.\n      if (isFirst && !options.skipBlocking) {\n        blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);\n      }\n\n      var timings = computeTimings(node, fullClassName, cacheKey);\n      var relativeDelay = timings.maxDelay;\n      maxDelay = Math.max(relativeDelay, 0);\n      maxDuration = timings.maxDuration;\n\n      var flags = {};\n      flags.hasTransitions          = timings.transitionDuration > 0;\n      flags.hasAnimations           = timings.animationDuration > 0;\n      flags.hasTransitionAll        = flags.hasTransitions && timings.transitionProperty == 'all';\n      flags.applyTransitionDuration = hasToStyles && (\n                                        (flags.hasTransitions && !flags.hasTransitionAll)\n                                         || (flags.hasAnimations && !flags.hasTransitions));\n      flags.applyAnimationDuration  = options.duration && flags.hasAnimations;\n      flags.applyTransitionDelay    = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions);\n      flags.applyAnimationDelay     = truthyTimingValue(options.delay) && flags.hasAnimations;\n      flags.recalculateTimingStyles = addRemoveClassName.length > 0;\n\n      if (flags.applyTransitionDuration || flags.applyAnimationDuration) {\n        maxDuration = options.duration ? parseFloat(options.duration) : maxDuration;\n\n        if (flags.applyTransitionDuration) {\n          flags.hasTransitions = true;\n          timings.transitionDuration = maxDuration;\n          applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0;\n          temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration));\n        }\n\n        if (flags.applyAnimationDuration) {\n          flags.hasAnimations = true;\n          timings.animationDuration = maxDuration;\n          temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration));\n        }\n      }\n\n      if (maxDuration === 0 && !flags.recalculateTimingStyles) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      if (options.delay != null) {\n        var delayStyle;\n        if (typeof options.delay !== \"boolean\") {\n          delayStyle = parseFloat(options.delay);\n          // number in options.delay means we have to recalculate the delay for the closing timeout\n          maxDelay = Math.max(delayStyle, 0);\n        }\n\n        if (flags.applyTransitionDelay) {\n          temporaryStyles.push(getCssDelayStyle(delayStyle));\n        }\n\n        if (flags.applyAnimationDelay) {\n          temporaryStyles.push(getCssDelayStyle(delayStyle, true));\n        }\n      }\n\n      // we need to recalculate the delay value since we used a pre-emptive negative\n      // delay value and the delay value is required for the final event checking. This\n      // property will ensure that this will happen after the RAF phase has passed.\n      if (options.duration == null && timings.transitionDuration > 0) {\n        flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst;\n      }\n\n      maxDelayTime = maxDelay * ONE_SECOND;\n      maxDurationTime = maxDuration * ONE_SECOND;\n      if (!options.skipBlocking) {\n        flags.blockTransition = timings.transitionDuration > 0;\n        flags.blockKeyframeAnimation = timings.animationDuration > 0 &&\n                                       stagger.animationDelay > 0 &&\n                                       stagger.animationDuration === 0;\n      }\n\n      if (options.from) {\n        if (options.cleanupStyles) {\n          registerRestorableStyles(restoreStyles, node, Object.keys(options.from));\n        }\n        applyAnimationFromStyles(element, options);\n      }\n\n      if (flags.blockTransition || flags.blockKeyframeAnimation) {\n        applyBlocking(maxDuration);\n      } else if (!options.skipBlocking) {\n        blockTransitions(node, false);\n      }\n\n      // TODO(matsko): for 1.5 change this code to have an animator object for better debugging\n      return {\n        $$willAnimate: true,\n        end: endFn,\n        start: function() {\n          if (animationClosed) return;\n\n          runnerHost = {\n            end: endFn,\n            cancel: cancelFn,\n            resume: null, //this will be set during the start() phase\n            pause: null\n          };\n\n          runner = new $$AnimateRunner(runnerHost);\n\n          waitUntilQuiet(start);\n\n          // we don't have access to pause/resume the animation\n          // since it hasn't run yet. AnimateRunner will therefore\n          // set noop functions for resume and pause and they will\n          // later be overridden once the animation is triggered\n          return runner;\n        }\n      };\n\n      function endFn() {\n        close();\n      }\n\n      function cancelFn() {\n        close(true);\n      }\n\n      function close(rejected) { // jshint ignore:line\n        // if the promise has been called already then we shouldn't close\n        // the animation again\n        if (animationClosed || (animationCompleted && animationPaused)) return;\n        animationClosed = true;\n        animationPaused = false;\n\n        if (!options.$$skipPreparationClasses) {\n          $$jqLite.removeClass(element, preparationClasses);\n        }\n        $$jqLite.removeClass(element, activeClasses);\n\n        blockKeyframeAnimations(node, false);\n        blockTransitions(node, false);\n\n        forEach(temporaryStyles, function(entry) {\n          // There is only one way to remove inline style properties entirely from elements.\n          // By using `removeProperty` this works, but we need to convert camel-cased CSS\n          // styles down to hyphenated values.\n          node.style[entry[0]] = '';\n        });\n\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n\n        if (Object.keys(restoreStyles).length) {\n          forEach(restoreStyles, function(value, prop) {\n            value ? node.style.setProperty(prop, value)\n                  : node.style.removeProperty(prop);\n          });\n        }\n\n        // the reason why we have this option is to allow a synchronous closing callback\n        // that is fired as SOON as the animation ends (when the CSS is removed) or if\n        // the animation never takes off at all. A good example is a leave animation since\n        // the element must be removed just after the animation is over or else the element\n        // will appear on screen for one animation frame causing an overbearing flicker.\n        if (options.onDone) {\n          options.onDone();\n        }\n\n        if (events && events.length) {\n          // Remove the transitionend / animationend listener(s)\n          element.off(events.join(' '), onAnimationProgress);\n        }\n\n        //Cancel the fallback closing timeout and remove the timer data\n        var animationTimerData = element.data(ANIMATE_TIMER_KEY);\n        if (animationTimerData) {\n          $timeout.cancel(animationTimerData[0].timer);\n          element.removeData(ANIMATE_TIMER_KEY);\n        }\n\n        // if the preparation function fails then the promise is not setup\n        if (runner) {\n          runner.complete(!rejected);\n        }\n      }\n\n      function applyBlocking(duration) {\n        if (flags.blockTransition) {\n          blockTransitions(node, duration);\n        }\n\n        if (flags.blockKeyframeAnimation) {\n          blockKeyframeAnimations(node, !!duration);\n        }\n      }\n\n      function closeAndReturnNoopAnimator() {\n        runner = new $$AnimateRunner({\n          end: endFn,\n          cancel: cancelFn\n        });\n\n        // should flush the cache animation\n        waitUntilQuiet(noop);\n        close();\n\n        return {\n          $$willAnimate: false,\n          start: function() {\n            return runner;\n          },\n          end: endFn\n        };\n      }\n\n      function onAnimationProgress(event) {\n        event.stopPropagation();\n        var ev = event.originalEvent || event;\n\n        // we now always use `Date.now()` due to the recent changes with\n        // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info)\n        var timeStamp = ev.$manualTimeStamp || Date.now();\n\n        /* Firefox (or possibly just Gecko) likes to not round values up\n         * when a ms measurement is used for the animation */\n        var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));\n\n        /* $manualTimeStamp is a mocked timeStamp value which is set\n         * within browserTrigger(). This is only here so that tests can\n         * mock animations properly. Real events fallback to event.timeStamp,\n         * or, if they don't, then a timeStamp is automatically created for them.\n         * We're checking to see if the timeStamp surpasses the expected delay,\n         * but we're using elapsedTime instead of the timeStamp on the 2nd\n         * pre-condition since animationPauseds sometimes close off early */\n        if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {\n          // we set this flag to ensure that if the transition is paused then, when resumed,\n          // the animation will automatically close itself since transitions cannot be paused.\n          animationCompleted = true;\n          close();\n        }\n      }\n\n      function start() {\n        if (animationClosed) return;\n        if (!node.parentNode) {\n          close();\n          return;\n        }\n\n        // even though we only pause keyframe animations here the pause flag\n        // will still happen when transitions are used. Only the transition will\n        // not be paused since that is not possible. If the animation ends when\n        // paused then it will not complete until unpaused or cancelled.\n        var playPause = function(playAnimation) {\n          if (!animationCompleted) {\n            animationPaused = !playAnimation;\n            if (timings.animationDuration) {\n              var value = blockKeyframeAnimations(node, animationPaused);\n              animationPaused\n                  ? temporaryStyles.push(value)\n                  : removeFromArray(temporaryStyles, value);\n            }\n          } else if (animationPaused && playAnimation) {\n            animationPaused = false;\n            close();\n          }\n        };\n\n        // checking the stagger duration prevents an accidentally cascade of the CSS delay style\n        // being inherited from the parent. If the transition duration is zero then we can safely\n        // rely that the delay value is an intentional stagger delay style.\n        var maxStagger = itemIndex > 0\n                         && ((timings.transitionDuration && stagger.transitionDuration === 0) ||\n                            (timings.animationDuration && stagger.animationDuration === 0))\n                         && Math.max(stagger.animationDelay, stagger.transitionDelay);\n        if (maxStagger) {\n          $timeout(triggerAnimationStart,\n                   Math.floor(maxStagger * itemIndex * ONE_SECOND),\n                   false);\n        } else {\n          triggerAnimationStart();\n        }\n\n        // this will decorate the existing promise runner with pause/resume methods\n        runnerHost.resume = function() {\n          playPause(true);\n        };\n\n        runnerHost.pause = function() {\n          playPause(false);\n        };\n\n        function triggerAnimationStart() {\n          // just incase a stagger animation kicks in when the animation\n          // itself was cancelled entirely\n          if (animationClosed) return;\n\n          applyBlocking(false);\n\n          forEach(temporaryStyles, function(entry) {\n            var key = entry[0];\n            var value = entry[1];\n            node.style[key] = value;\n          });\n\n          applyAnimationClasses(element, options);\n          $$jqLite.addClass(element, activeClasses);\n\n          if (flags.recalculateTimingStyles) {\n            fullClassName = node.className + ' ' + preparationClasses;\n            cacheKey = gcsHashFn(node, fullClassName);\n\n            timings = computeTimings(node, fullClassName, cacheKey);\n            relativeDelay = timings.maxDelay;\n            maxDelay = Math.max(relativeDelay, 0);\n            maxDuration = timings.maxDuration;\n\n            if (maxDuration === 0) {\n              close();\n              return;\n            }\n\n            flags.hasTransitions = timings.transitionDuration > 0;\n            flags.hasAnimations = timings.animationDuration > 0;\n          }\n\n          if (flags.applyAnimationDelay) {\n            relativeDelay = typeof options.delay !== \"boolean\" && truthyTimingValue(options.delay)\n                  ? parseFloat(options.delay)\n                  : relativeDelay;\n\n            maxDelay = Math.max(relativeDelay, 0);\n            timings.animationDelay = relativeDelay;\n            delayStyle = getCssDelayStyle(relativeDelay, true);\n            temporaryStyles.push(delayStyle);\n            node.style[delayStyle[0]] = delayStyle[1];\n          }\n\n          maxDelayTime = maxDelay * ONE_SECOND;\n          maxDurationTime = maxDuration * ONE_SECOND;\n\n          if (options.easing) {\n            var easeProp, easeVal = options.easing;\n            if (flags.hasTransitions) {\n              easeProp = TRANSITION_PROP + TIMING_KEY;\n              temporaryStyles.push([easeProp, easeVal]);\n              node.style[easeProp] = easeVal;\n            }\n            if (flags.hasAnimations) {\n              easeProp = ANIMATION_PROP + TIMING_KEY;\n              temporaryStyles.push([easeProp, easeVal]);\n              node.style[easeProp] = easeVal;\n            }\n          }\n\n          if (timings.transitionDuration) {\n            events.push(TRANSITIONEND_EVENT);\n          }\n\n          if (timings.animationDuration) {\n            events.push(ANIMATIONEND_EVENT);\n          }\n\n          startTime = Date.now();\n          var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime;\n          var endTime = startTime + timerTime;\n\n          var animationsData = element.data(ANIMATE_TIMER_KEY) || [];\n          var setupFallbackTimer = true;\n          if (animationsData.length) {\n            var currentTimerData = animationsData[0];\n            setupFallbackTimer = endTime > currentTimerData.expectedEndTime;\n            if (setupFallbackTimer) {\n              $timeout.cancel(currentTimerData.timer);\n            } else {\n              animationsData.push(close);\n            }\n          }\n\n          if (setupFallbackTimer) {\n            var timer = $timeout(onAnimationExpired, timerTime, false);\n            animationsData[0] = {\n              timer: timer,\n              expectedEndTime: endTime\n            };\n            animationsData.push(close);\n            element.data(ANIMATE_TIMER_KEY, animationsData);\n          }\n\n          if (events.length) {\n            element.on(events.join(' '), onAnimationProgress);\n          }\n\n          if (options.to) {\n            if (options.cleanupStyles) {\n              registerRestorableStyles(restoreStyles, node, Object.keys(options.to));\n            }\n            applyAnimationToStyles(element, options);\n          }\n        }\n\n        function onAnimationExpired() {\n          var animationsData = element.data(ANIMATE_TIMER_KEY);\n\n          // this will be false in the event that the element was\n          // removed from the DOM (via a leave animation or something\n          // similar)\n          if (animationsData) {\n            for (var i = 1; i < animationsData.length; i++) {\n              animationsData[i]();\n            }\n            element.removeData(ANIMATE_TIMER_KEY);\n          }\n        }\n      }\n    };\n  }];\n}];\n\nvar $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) {\n  $$animationProvider.drivers.push('$$animateCssDriver');\n\n  var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim';\n  var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor';\n\n  var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out';\n  var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in';\n\n  function isDocumentFragment(node) {\n    return node.parentNode && node.parentNode.nodeType === 11;\n  }\n\n  this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document',\n       function($animateCss,   $rootScope,   $$AnimateRunner,   $rootElement,   $sniffer,   $$jqLite,   $document) {\n\n    // only browsers that support these properties can render animations\n    if (!$sniffer.animations && !$sniffer.transitions) return noop;\n\n    var bodyNode = $document[0].body;\n    var rootNode = getDomNode($rootElement);\n\n    var rootBodyElement = jqLite(\n      // this is to avoid using something that exists outside of the body\n      // we also special case the doc fragment case because our unit test code\n      // appends the $rootElement to the body after the app has been bootstrapped\n      isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode\n    );\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    return function initDriverFn(animationDetails) {\n      return animationDetails.from && animationDetails.to\n          ? prepareFromToAnchorAnimation(animationDetails.from,\n                                         animationDetails.to,\n                                         animationDetails.classes,\n                                         animationDetails.anchors)\n          : prepareRegularAnimation(animationDetails);\n    };\n\n    function filterCssClasses(classes) {\n      //remove all the `ng-` stuff\n      return classes.replace(/\\bng-\\S+\\b/g, '');\n    }\n\n    function getUniqueValues(a, b) {\n      if (isString(a)) a = a.split(' ');\n      if (isString(b)) b = b.split(' ');\n      return a.filter(function(val) {\n        return b.indexOf(val) === -1;\n      }).join(' ');\n    }\n\n    function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {\n      var clone = jqLite(getDomNode(outAnchor).cloneNode(true));\n      var startingClasses = filterCssClasses(getClassVal(clone));\n\n      outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);\n      inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);\n\n      clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);\n\n      rootBodyElement.append(clone);\n\n      var animatorIn, animatorOut = prepareOutAnimation();\n\n      // the user may not end up using the `out` animation and\n      // only making use of the `in` animation or vice-versa.\n      // In either case we should allow this and not assume the\n      // animation is over unless both animations are not used.\n      if (!animatorOut) {\n        animatorIn = prepareInAnimation();\n        if (!animatorIn) {\n          return end();\n        }\n      }\n\n      var startingAnimator = animatorOut || animatorIn;\n\n      return {\n        start: function() {\n          var runner;\n\n          var currentAnimation = startingAnimator.start();\n          currentAnimation.done(function() {\n            currentAnimation = null;\n            if (!animatorIn) {\n              animatorIn = prepareInAnimation();\n              if (animatorIn) {\n                currentAnimation = animatorIn.start();\n                currentAnimation.done(function() {\n                  currentAnimation = null;\n                  end();\n                  runner.complete();\n                });\n                return currentAnimation;\n              }\n            }\n            // in the event that there is no `in` animation\n            end();\n            runner.complete();\n          });\n\n          runner = new $$AnimateRunner({\n            end: endFn,\n            cancel: endFn\n          });\n\n          return runner;\n\n          function endFn() {\n            if (currentAnimation) {\n              currentAnimation.end();\n            }\n          }\n        }\n      };\n\n      function calculateAnchorStyles(anchor) {\n        var styles = {};\n\n        var coords = getDomNode(anchor).getBoundingClientRect();\n\n        // we iterate directly since safari messes up and doesn't return\n        // all the keys for the coords object when iterated\n        forEach(['width','height','top','left'], function(key) {\n          var value = coords[key];\n          switch (key) {\n            case 'top':\n              value += bodyNode.scrollTop;\n              break;\n            case 'left':\n              value += bodyNode.scrollLeft;\n              break;\n          }\n          styles[key] = Math.floor(value) + 'px';\n        });\n        return styles;\n      }\n\n      function prepareOutAnimation() {\n        var animator = $animateCss(clone, {\n          addClass: NG_OUT_ANCHOR_CLASS_NAME,\n          delay: true,\n          from: calculateAnchorStyles(outAnchor)\n        });\n\n        // read the comment within `prepareRegularAnimation` to understand\n        // why this check is necessary\n        return animator.$$willAnimate ? animator : null;\n      }\n\n      function getClassVal(element) {\n        return element.attr('class') || '';\n      }\n\n      function prepareInAnimation() {\n        var endingClasses = filterCssClasses(getClassVal(inAnchor));\n        var toAdd = getUniqueValues(endingClasses, startingClasses);\n        var toRemove = getUniqueValues(startingClasses, endingClasses);\n\n        var animator = $animateCss(clone, {\n          to: calculateAnchorStyles(inAnchor),\n          addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd,\n          removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove,\n          delay: true\n        });\n\n        // read the comment within `prepareRegularAnimation` to understand\n        // why this check is necessary\n        return animator.$$willAnimate ? animator : null;\n      }\n\n      function end() {\n        clone.remove();\n        outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);\n        inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);\n      }\n    }\n\n    function prepareFromToAnchorAnimation(from, to, classes, anchors) {\n      var fromAnimation = prepareRegularAnimation(from, noop);\n      var toAnimation = prepareRegularAnimation(to, noop);\n\n      var anchorAnimations = [];\n      forEach(anchors, function(anchor) {\n        var outElement = anchor['out'];\n        var inElement = anchor['in'];\n        var animator = prepareAnchoredAnimation(classes, outElement, inElement);\n        if (animator) {\n          anchorAnimations.push(animator);\n        }\n      });\n\n      // no point in doing anything when there are no elements to animate\n      if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return;\n\n      return {\n        start: function() {\n          var animationRunners = [];\n\n          if (fromAnimation) {\n            animationRunners.push(fromAnimation.start());\n          }\n\n          if (toAnimation) {\n            animationRunners.push(toAnimation.start());\n          }\n\n          forEach(anchorAnimations, function(animation) {\n            animationRunners.push(animation.start());\n          });\n\n          var runner = new $$AnimateRunner({\n            end: endFn,\n            cancel: endFn // CSS-driven animations cannot be cancelled, only ended\n          });\n\n          $$AnimateRunner.all(animationRunners, function(status) {\n            runner.complete(status);\n          });\n\n          return runner;\n\n          function endFn() {\n            forEach(animationRunners, function(runner) {\n              runner.end();\n            });\n          }\n        }\n      };\n    }\n\n    function prepareRegularAnimation(animationDetails) {\n      var element = animationDetails.element;\n      var options = animationDetails.options || {};\n\n      if (animationDetails.structural) {\n        options.event = animationDetails.event;\n        options.structural = true;\n        options.applyClassesEarly = true;\n\n        // we special case the leave animation since we want to ensure that\n        // the element is removed as soon as the animation is over. Otherwise\n        // a flicker might appear or the element may not be removed at all\n        if (animationDetails.event === 'leave') {\n          options.onDone = options.domOperation;\n        }\n      }\n\n      // We assign the preparationClasses as the actual animation event since\n      // the internals of $animateCss will just suffix the event token values\n      // with `-active` to trigger the animation.\n      if (options.preparationClasses) {\n        options.event = concatWithSpace(options.event, options.preparationClasses);\n      }\n\n      var animator = $animateCss(element, options);\n\n      // the driver lookup code inside of $$animation attempts to spawn a\n      // driver one by one until a driver returns a.$$willAnimate animator object.\n      // $animateCss will always return an object, however, it will pass in\n      // a flag as a hint as to whether an animation was detected or not\n      return animator.$$willAnimate ? animator : null;\n    }\n  }];\n}];\n\n// TODO(matsko): use caching here to speed things up for detection\n// TODO(matsko): add documentation\n//  by the time...\n\nvar $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {\n  this.$get = ['$injector', '$$AnimateRunner', '$$jqLite',\n       function($injector,   $$AnimateRunner,   $$jqLite) {\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n         // $animateJs(element, 'enter');\n    return function(element, event, classes, options) {\n      var animationClosed = false;\n\n      // the `classes` argument is optional and if it is not used\n      // then the classes will be resolved from the element's className\n      // property as well as options.addClass/options.removeClass.\n      if (arguments.length === 3 && isObject(classes)) {\n        options = classes;\n        classes = null;\n      }\n\n      options = prepareAnimationOptions(options);\n      if (!classes) {\n        classes = element.attr('class') || '';\n        if (options.addClass) {\n          classes += ' ' + options.addClass;\n        }\n        if (options.removeClass) {\n          classes += ' ' + options.removeClass;\n        }\n      }\n\n      var classesToAdd = options.addClass;\n      var classesToRemove = options.removeClass;\n\n      // the lookupAnimations function returns a series of animation objects that are\n      // matched up with one or more of the CSS classes. These animation objects are\n      // defined via the module.animation factory function. If nothing is detected then\n      // we don't return anything which then makes $animation query the next driver.\n      var animations = lookupAnimations(classes);\n      var before, after;\n      if (animations.length) {\n        var afterFn, beforeFn;\n        if (event == 'leave') {\n          beforeFn = 'leave';\n          afterFn = 'afterLeave'; // TODO(matsko): get rid of this\n        } else {\n          beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1);\n          afterFn = event;\n        }\n\n        if (event !== 'enter' && event !== 'move') {\n          before = packageAnimations(element, event, options, animations, beforeFn);\n        }\n        after  = packageAnimations(element, event, options, animations, afterFn);\n      }\n\n      // no matching animations\n      if (!before && !after) return;\n\n      function applyOptions() {\n        options.domOperation();\n        applyAnimationClasses(element, options);\n      }\n\n      function close() {\n        animationClosed = true;\n        applyOptions();\n        applyAnimationStyles(element, options);\n      }\n\n      var runner;\n\n      return {\n        $$willAnimate: true,\n        end: function() {\n          if (runner) {\n            runner.end();\n          } else {\n            close();\n            runner = new $$AnimateRunner();\n            runner.complete(true);\n          }\n          return runner;\n        },\n        start: function() {\n          if (runner) {\n            return runner;\n          }\n\n          runner = new $$AnimateRunner();\n          var closeActiveAnimations;\n          var chain = [];\n\n          if (before) {\n            chain.push(function(fn) {\n              closeActiveAnimations = before(fn);\n            });\n          }\n\n          if (chain.length) {\n            chain.push(function(fn) {\n              applyOptions();\n              fn(true);\n            });\n          } else {\n            applyOptions();\n          }\n\n          if (after) {\n            chain.push(function(fn) {\n              closeActiveAnimations = after(fn);\n            });\n          }\n\n          runner.setHost({\n            end: function() {\n              endAnimations();\n            },\n            cancel: function() {\n              endAnimations(true);\n            }\n          });\n\n          $$AnimateRunner.chain(chain, onComplete);\n          return runner;\n\n          function onComplete(success) {\n            close(success);\n            runner.complete(success);\n          }\n\n          function endAnimations(cancelled) {\n            if (!animationClosed) {\n              (closeActiveAnimations || noop)(cancelled);\n              onComplete(cancelled);\n            }\n          }\n        }\n      };\n\n      function executeAnimationFn(fn, element, event, options, onDone) {\n        var args;\n        switch (event) {\n          case 'animate':\n            args = [element, options.from, options.to, onDone];\n            break;\n\n          case 'setClass':\n            args = [element, classesToAdd, classesToRemove, onDone];\n            break;\n\n          case 'addClass':\n            args = [element, classesToAdd, onDone];\n            break;\n\n          case 'removeClass':\n            args = [element, classesToRemove, onDone];\n            break;\n\n          default:\n            args = [element, onDone];\n            break;\n        }\n\n        args.push(options);\n\n        var value = fn.apply(fn, args);\n        if (value) {\n          if (isFunction(value.start)) {\n            value = value.start();\n          }\n\n          if (value instanceof $$AnimateRunner) {\n            value.done(onDone);\n          } else if (isFunction(value)) {\n            // optional onEnd / onCancel callback\n            return value;\n          }\n        }\n\n        return noop;\n      }\n\n      function groupEventedAnimations(element, event, options, animations, fnName) {\n        var operations = [];\n        forEach(animations, function(ani) {\n          var animation = ani[fnName];\n          if (!animation) return;\n\n          // note that all of these animations will run in parallel\n          operations.push(function() {\n            var runner;\n            var endProgressCb;\n\n            var resolved = false;\n            var onAnimationComplete = function(rejected) {\n              if (!resolved) {\n                resolved = true;\n                (endProgressCb || noop)(rejected);\n                runner.complete(!rejected);\n              }\n            };\n\n            runner = new $$AnimateRunner({\n              end: function() {\n                onAnimationComplete();\n              },\n              cancel: function() {\n                onAnimationComplete(true);\n              }\n            });\n\n            endProgressCb = executeAnimationFn(animation, element, event, options, function(result) {\n              var cancelled = result === false;\n              onAnimationComplete(cancelled);\n            });\n\n            return runner;\n          });\n        });\n\n        return operations;\n      }\n\n      function packageAnimations(element, event, options, animations, fnName) {\n        var operations = groupEventedAnimations(element, event, options, animations, fnName);\n        if (operations.length === 0) {\n          var a,b;\n          if (fnName === 'beforeSetClass') {\n            a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass');\n            b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass');\n          } else if (fnName === 'setClass') {\n            a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass');\n            b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass');\n          }\n\n          if (a) {\n            operations = operations.concat(a);\n          }\n          if (b) {\n            operations = operations.concat(b);\n          }\n        }\n\n        if (operations.length === 0) return;\n\n        // TODO(matsko): add documentation\n        return function startAnimation(callback) {\n          var runners = [];\n          if (operations.length) {\n            forEach(operations, function(animateFn) {\n              runners.push(animateFn());\n            });\n          }\n\n          runners.length ? $$AnimateRunner.all(runners, callback) : callback();\n\n          return function endFn(reject) {\n            forEach(runners, function(runner) {\n              reject ? runner.cancel() : runner.end();\n            });\n          };\n        };\n      }\n    };\n\n    function lookupAnimations(classes) {\n      classes = isArray(classes) ? classes : classes.split(' ');\n      var matches = [], flagMap = {};\n      for (var i=0; i < classes.length; i++) {\n        var klass = classes[i],\n            animationFactory = $animateProvider.$$registeredAnimations[klass];\n        if (animationFactory && !flagMap[klass]) {\n          matches.push($injector.get(animationFactory));\n          flagMap[klass] = true;\n        }\n      }\n      return matches;\n    }\n  }];\n}];\n\nvar $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) {\n  $$animationProvider.drivers.push('$$animateJsDriver');\n  this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {\n    return function initDriverFn(animationDetails) {\n      if (animationDetails.from && animationDetails.to) {\n        var fromAnimation = prepareAnimation(animationDetails.from);\n        var toAnimation = prepareAnimation(animationDetails.to);\n        if (!fromAnimation && !toAnimation) return;\n\n        return {\n          start: function() {\n            var animationRunners = [];\n\n            if (fromAnimation) {\n              animationRunners.push(fromAnimation.start());\n            }\n\n            if (toAnimation) {\n              animationRunners.push(toAnimation.start());\n            }\n\n            $$AnimateRunner.all(animationRunners, done);\n\n            var runner = new $$AnimateRunner({\n              end: endFnFactory(),\n              cancel: endFnFactory()\n            });\n\n            return runner;\n\n            function endFnFactory() {\n              return function() {\n                forEach(animationRunners, function(runner) {\n                  // at this point we cannot cancel animations for groups just yet. 1.5+\n                  runner.end();\n                });\n              };\n            }\n\n            function done(status) {\n              runner.complete(status);\n            }\n          }\n        };\n      } else {\n        return prepareAnimation(animationDetails);\n      }\n    };\n\n    function prepareAnimation(animationDetails) {\n      // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations\n      var element = animationDetails.element;\n      var event = animationDetails.event;\n      var options = animationDetails.options;\n      var classes = animationDetails.classes;\n      return $$animateJs(element, event, classes, options);\n    }\n  }];\n}];\n\nvar NG_ANIMATE_ATTR_NAME = 'data-ng-animate';\nvar NG_ANIMATE_PIN_DATA = '$ngAnimatePin';\nvar $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {\n  var PRE_DIGEST_STATE = 1;\n  var RUNNING_STATE = 2;\n  var ONE_SPACE = ' ';\n\n  var rules = this.rules = {\n    skip: [],\n    cancel: [],\n    join: []\n  };\n\n  function makeTruthyCssClassMap(classString) {\n    if (!classString) {\n      return null;\n    }\n\n    var keys = classString.split(ONE_SPACE);\n    var map = Object.create(null);\n\n    forEach(keys, function(key) {\n      map[key] = true;\n    });\n    return map;\n  }\n\n  function hasMatchingClasses(newClassString, currentClassString) {\n    if (newClassString && currentClassString) {\n      var currentClassMap = makeTruthyCssClassMap(currentClassString);\n      return newClassString.split(ONE_SPACE).some(function(className) {\n        return currentClassMap[className];\n      });\n    }\n  }\n\n  function isAllowed(ruleType, element, currentAnimation, previousAnimation) {\n    return rules[ruleType].some(function(fn) {\n      return fn(element, currentAnimation, previousAnimation);\n    });\n  }\n\n  function hasAnimationClasses(animation, and) {\n    var a = (animation.addClass || '').length > 0;\n    var b = (animation.removeClass || '').length > 0;\n    return and ? a && b : a || b;\n  }\n\n  rules.join.push(function(element, newAnimation, currentAnimation) {\n    // if the new animation is class-based then we can just tack that on\n    return !newAnimation.structural && hasAnimationClasses(newAnimation);\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // there is no need to animate anything if no classes are being added and\n    // there is no structural animation that will be triggered\n    return !newAnimation.structural && !hasAnimationClasses(newAnimation);\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // why should we trigger a new structural animation if the element will\n    // be removed from the DOM anyway?\n    return currentAnimation.event == 'leave' && newAnimation.structural;\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // if there is an ongoing current animation then don't even bother running the class-based animation\n    return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // there can never be two structural animations running at the same time\n    return currentAnimation.structural && newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // if the previous animation is already running, but the new animation will\n    // be triggered, but the new animation is structural\n    return currentAnimation.state === RUNNING_STATE && newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // cancel the animation if classes added / removed in both animation cancel each other out,\n    // but only if the current animation isn't structural\n\n    if (currentAnimation.structural) return false;\n\n    var nA = newAnimation.addClass;\n    var nR = newAnimation.removeClass;\n    var cA = currentAnimation.addClass;\n    var cR = currentAnimation.removeClass;\n\n    // early detection to save the global CPU shortage :)\n    if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) {\n      return false;\n    }\n\n    return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA);\n  });\n\n  this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',\n               '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow',\n       function($$rAF,   $rootScope,   $rootElement,   $document,   $$HashMap,\n                $$animation,   $$AnimateRunner,   $templateRequest,   $$jqLite,   $$forceReflow) {\n\n    var activeAnimationsLookup = new $$HashMap();\n    var disabledElementsLookup = new $$HashMap();\n    var animationsEnabled = null;\n\n    function postDigestTaskFactory() {\n      var postDigestCalled = false;\n      return function(fn) {\n        // we only issue a call to postDigest before\n        // it has first passed. This prevents any callbacks\n        // from not firing once the animation has completed\n        // since it will be out of the digest cycle.\n        if (postDigestCalled) {\n          fn();\n        } else {\n          $rootScope.$$postDigest(function() {\n            postDigestCalled = true;\n            fn();\n          });\n        }\n      };\n    }\n\n    // Wait until all directive and route-related templates are downloaded and\n    // compiled. The $templateRequest.totalPendingRequests variable keeps track of\n    // all of the remote templates being currently downloaded. If there are no\n    // templates currently downloading then the watcher will still fire anyway.\n    var deregisterWatch = $rootScope.$watch(\n      function() { return $templateRequest.totalPendingRequests === 0; },\n      function(isEmpty) {\n        if (!isEmpty) return;\n        deregisterWatch();\n\n        // Now that all templates have been downloaded, $animate will wait until\n        // the post digest queue is empty before enabling animations. By having two\n        // calls to $postDigest calls we can ensure that the flag is enabled at the\n        // very end of the post digest queue. Since all of the animations in $animate\n        // use $postDigest, it's important that the code below executes at the end.\n        // This basically means that the page is fully downloaded and compiled before\n        // any animations are triggered.\n        $rootScope.$$postDigest(function() {\n          $rootScope.$$postDigest(function() {\n            // we check for null directly in the event that the application already called\n            // .enabled() with whatever arguments that it provided it with\n            if (animationsEnabled === null) {\n              animationsEnabled = true;\n            }\n          });\n        });\n      }\n    );\n\n    var callbackRegistry = {};\n\n    // remember that the classNameFilter is set during the provider/config\n    // stage therefore we can optimize here and setup a helper function\n    var classNameFilter = $animateProvider.classNameFilter();\n    var isAnimatableClassName = !classNameFilter\n              ? function() { return true; }\n              : function(className) {\n                return classNameFilter.test(className);\n              };\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    function normalizeAnimationDetails(element, animation) {\n      return mergeAnimationDetails(element, animation, {});\n    }\n\n    // IE9-11 has no method \"contains\" in SVG element and in Node.prototype. Bug #10259.\n    var contains = Node.prototype.contains || function(arg) {\n      // jshint bitwise: false\n      return this === arg || !!(this.compareDocumentPosition(arg) & 16);\n      // jshint bitwise: true\n    };\n\n    function findCallbacks(parent, element, event) {\n      var targetNode = getDomNode(element);\n      var targetParentNode = getDomNode(parent);\n\n      var matches = [];\n      var entries = callbackRegistry[event];\n      if (entries) {\n        forEach(entries, function(entry) {\n          if (contains.call(entry.node, targetNode)) {\n            matches.push(entry.callback);\n          } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) {\n            matches.push(entry.callback);\n          }\n        });\n      }\n\n      return matches;\n    }\n\n    var $animate = {\n      on: function(event, container, callback) {\n        var node = extractElementNode(container);\n        callbackRegistry[event] = callbackRegistry[event] || [];\n        callbackRegistry[event].push({\n          node: node,\n          callback: callback\n        });\n\n        // Remove the callback when the element is removed from the DOM\n        jqLite(container).on('$destroy', function() {\n          $animate.off(event, container, callback);\n        });\n      },\n\n      off: function(event, container, callback) {\n        var entries = callbackRegistry[event];\n        if (!entries) return;\n\n        callbackRegistry[event] = arguments.length === 1\n            ? null\n            : filterFromRegistry(entries, container, callback);\n\n        function filterFromRegistry(list, matchContainer, matchCallback) {\n          var containerNode = extractElementNode(matchContainer);\n          return list.filter(function(entry) {\n            var isMatch = entry.node === containerNode &&\n                            (!matchCallback || entry.callback === matchCallback);\n            return !isMatch;\n          });\n        }\n      },\n\n      pin: function(element, parentElement) {\n        assertArg(isElement(element), 'element', 'not an element');\n        assertArg(isElement(parentElement), 'parentElement', 'not an element');\n        element.data(NG_ANIMATE_PIN_DATA, parentElement);\n      },\n\n      push: function(element, event, options, domOperation) {\n        options = options || {};\n        options.domOperation = domOperation;\n        return queueAnimation(element, event, options);\n      },\n\n      // this method has four signatures:\n      //  () - global getter\n      //  (bool) - global setter\n      //  (element) - element getter\n      //  (element, bool) - element setter<F37>\n      enabled: function(element, bool) {\n        var argCount = arguments.length;\n\n        if (argCount === 0) {\n          // () - Global getter\n          bool = !!animationsEnabled;\n        } else {\n          var hasElement = isElement(element);\n\n          if (!hasElement) {\n            // (bool) - Global setter\n            bool = animationsEnabled = !!element;\n          } else {\n            var node = getDomNode(element);\n            var recordExists = disabledElementsLookup.get(node);\n\n            if (argCount === 1) {\n              // (element) - Element getter\n              bool = !recordExists;\n            } else {\n              // (element, bool) - Element setter\n              disabledElementsLookup.put(node, !bool);\n            }\n          }\n        }\n\n        return bool;\n      }\n    };\n\n    return $animate;\n\n    function queueAnimation(element, event, initialOptions) {\n      // we always make a copy of the options since\n      // there should never be any side effects on\n      // the input data when running `$animateCss`.\n      var options = copy(initialOptions);\n\n      var node, parent;\n      element = stripCommentsFromElement(element);\n      if (element) {\n        node = getDomNode(element);\n        parent = element.parent();\n      }\n\n      options = prepareAnimationOptions(options);\n\n      // we create a fake runner with a working promise.\n      // These methods will become available after the digest has passed\n      var runner = new $$AnimateRunner();\n\n      // this is used to trigger callbacks in postDigest mode\n      var runInNextPostDigestOrNow = postDigestTaskFactory();\n\n      if (isArray(options.addClass)) {\n        options.addClass = options.addClass.join(' ');\n      }\n\n      if (options.addClass && !isString(options.addClass)) {\n        options.addClass = null;\n      }\n\n      if (isArray(options.removeClass)) {\n        options.removeClass = options.removeClass.join(' ');\n      }\n\n      if (options.removeClass && !isString(options.removeClass)) {\n        options.removeClass = null;\n      }\n\n      if (options.from && !isObject(options.from)) {\n        options.from = null;\n      }\n\n      if (options.to && !isObject(options.to)) {\n        options.to = null;\n      }\n\n      // there are situations where a directive issues an animation for\n      // a jqLite wrapper that contains only comment nodes... If this\n      // happens then there is no way we can perform an animation\n      if (!node) {\n        close();\n        return runner;\n      }\n\n      var className = [node.className, options.addClass, options.removeClass].join(' ');\n      if (!isAnimatableClassName(className)) {\n        close();\n        return runner;\n      }\n\n      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;\n\n      // this is a hard disable of all animations for the application or on\n      // the element itself, therefore  there is no need to continue further\n      // past this point if not enabled\n      // Animations are also disabled if the document is currently hidden (page is not visible\n      // to the user), because browsers slow down or do not flush calls to requestAnimationFrame\n      var skipAnimations = !animationsEnabled || $document[0].hidden || disabledElementsLookup.get(node);\n      var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {};\n      var hasExistingAnimation = !!existingAnimation.state;\n\n      // there is no point in traversing the same collection of parent ancestors if a followup\n      // animation will be run on the same element that already did all that checking work\n      if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) {\n        skipAnimations = !areAnimationsAllowed(element, parent, event);\n      }\n\n      if (skipAnimations) {\n        close();\n        return runner;\n      }\n\n      if (isStructural) {\n        closeChildAnimations(element);\n      }\n\n      var newAnimation = {\n        structural: isStructural,\n        element: element,\n        event: event,\n        addClass: options.addClass,\n        removeClass: options.removeClass,\n        close: close,\n        options: options,\n        runner: runner\n      };\n\n      if (hasExistingAnimation) {\n        var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation);\n        if (skipAnimationFlag) {\n          if (existingAnimation.state === RUNNING_STATE) {\n            close();\n            return runner;\n          } else {\n            mergeAnimationDetails(element, existingAnimation, newAnimation);\n            return existingAnimation.runner;\n          }\n        }\n        var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation);\n        if (cancelAnimationFlag) {\n          if (existingAnimation.state === RUNNING_STATE) {\n            // this will end the animation right away and it is safe\n            // to do so since the animation is already running and the\n            // runner callback code will run in async\n            existingAnimation.runner.end();\n          } else if (existingAnimation.structural) {\n            // this means that the animation is queued into a digest, but\n            // hasn't started yet. Therefore it is safe to run the close\n            // method which will call the runner methods in async.\n            existingAnimation.close();\n          } else {\n            // this will merge the new animation options into existing animation options\n            mergeAnimationDetails(element, existingAnimation, newAnimation);\n\n            return existingAnimation.runner;\n          }\n        } else {\n          // a joined animation means that this animation will take over the existing one\n          // so an example would involve a leave animation taking over an enter. Then when\n          // the postDigest kicks in the enter will be ignored.\n          var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation);\n          if (joinAnimationFlag) {\n            if (existingAnimation.state === RUNNING_STATE) {\n              normalizeAnimationDetails(element, newAnimation);\n            } else {\n              applyGeneratedPreparationClasses(element, isStructural ? event : null, options);\n\n              event = newAnimation.event = existingAnimation.event;\n              options = mergeAnimationDetails(element, existingAnimation, newAnimation);\n\n              //we return the same runner since only the option values of this animation will\n              //be fed into the `existingAnimation`.\n              return existingAnimation.runner;\n            }\n          }\n        }\n      } else {\n        // normalization in this case means that it removes redundant CSS classes that\n        // already exist (addClass) or do not exist (removeClass) on the element\n        normalizeAnimationDetails(element, newAnimation);\n      }\n\n      // when the options are merged and cleaned up we may end up not having to do\n      // an animation at all, therefore we should check this before issuing a post\n      // digest callback. Structural animations will always run no matter what.\n      var isValidAnimation = newAnimation.structural;\n      if (!isValidAnimation) {\n        // animate (from/to) can be quickly checked first, otherwise we check if any classes are present\n        isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0)\n                            || hasAnimationClasses(newAnimation);\n      }\n\n      if (!isValidAnimation) {\n        close();\n        clearElementAnimationState(element);\n        return runner;\n      }\n\n      // the counter keeps track of cancelled animations\n      var counter = (existingAnimation.counter || 0) + 1;\n      newAnimation.counter = counter;\n\n      markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation);\n\n      $rootScope.$$postDigest(function() {\n        var animationDetails = activeAnimationsLookup.get(node);\n        var animationCancelled = !animationDetails;\n        animationDetails = animationDetails || {};\n\n        // if addClass/removeClass is called before something like enter then the\n        // registered parent element may not be present. The code below will ensure\n        // that a final value for parent element is obtained\n        var parentElement = element.parent() || [];\n\n        // animate/structural/class-based animations all have requirements. Otherwise there\n        // is no point in performing an animation. The parent node must also be set.\n        var isValidAnimation = parentElement.length > 0\n                                && (animationDetails.event === 'animate'\n                                    || animationDetails.structural\n                                    || hasAnimationClasses(animationDetails));\n\n        // this means that the previous animation was cancelled\n        // even if the follow-up animation is the same event\n        if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) {\n          // if another animation did not take over then we need\n          // to make sure that the domOperation and options are\n          // handled accordingly\n          if (animationCancelled) {\n            applyAnimationClasses(element, options);\n            applyAnimationStyles(element, options);\n          }\n\n          // if the event changed from something like enter to leave then we do\n          // it, otherwise if it's the same then the end result will be the same too\n          if (animationCancelled || (isStructural && animationDetails.event !== event)) {\n            options.domOperation();\n            runner.end();\n          }\n\n          // in the event that the element animation was not cancelled or a follow-up animation\n          // isn't allowed to animate from here then we need to clear the state of the element\n          // so that any future animations won't read the expired animation data.\n          if (!isValidAnimation) {\n            clearElementAnimationState(element);\n          }\n\n          return;\n        }\n\n        // this combined multiple class to addClass / removeClass into a setClass event\n        // so long as a structural event did not take over the animation\n        event = !animationDetails.structural && hasAnimationClasses(animationDetails, true)\n            ? 'setClass'\n            : animationDetails.event;\n\n        markElementAnimationState(element, RUNNING_STATE);\n        var realRunner = $$animation(element, event, animationDetails.options);\n\n        realRunner.done(function(status) {\n          close(!status);\n          var animationDetails = activeAnimationsLookup.get(node);\n          if (animationDetails && animationDetails.counter === counter) {\n            clearElementAnimationState(getDomNode(element));\n          }\n          notifyProgress(runner, event, 'close', {});\n        });\n\n        // this will update the runner's flow-control events based on\n        // the `realRunner` object.\n        runner.setHost(realRunner);\n        notifyProgress(runner, event, 'start', {});\n      });\n\n      return runner;\n\n      function notifyProgress(runner, event, phase, data) {\n        runInNextPostDigestOrNow(function() {\n          var callbacks = findCallbacks(parent, element, event);\n          if (callbacks.length) {\n            // do not optimize this call here to RAF because\n            // we don't know how heavy the callback code here will\n            // be and if this code is buffered then this can\n            // lead to a performance regression.\n            $$rAF(function() {\n              forEach(callbacks, function(callback) {\n                callback(element, phase, data);\n              });\n            });\n          }\n        });\n        runner.progress(event, phase, data);\n      }\n\n      function close(reject) { // jshint ignore:line\n        clearGeneratedClasses(element, options);\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n        options.domOperation();\n        runner.complete(!reject);\n      }\n    }\n\n    function closeChildAnimations(element) {\n      var node = getDomNode(element);\n      var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']');\n      forEach(children, function(child) {\n        var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));\n        var animationDetails = activeAnimationsLookup.get(child);\n        if (animationDetails) {\n          switch (state) {\n            case RUNNING_STATE:\n              animationDetails.runner.end();\n              /* falls through */\n            case PRE_DIGEST_STATE:\n              activeAnimationsLookup.remove(child);\n              break;\n          }\n        }\n      });\n    }\n\n    function clearElementAnimationState(element) {\n      var node = getDomNode(element);\n      node.removeAttribute(NG_ANIMATE_ATTR_NAME);\n      activeAnimationsLookup.remove(node);\n    }\n\n    function isMatchingElement(nodeOrElmA, nodeOrElmB) {\n      return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB);\n    }\n\n    /**\n     * This fn returns false if any of the following is true:\n     * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed\n     * b) a parent element has an ongoing structural animation, and animateChildren is false\n     * c) the element is not a child of the body\n     * d) the element is not a child of the $rootElement\n     */\n    function areAnimationsAllowed(element, parentElement, event) {\n      var bodyElement = jqLite($document[0].body);\n      var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML';\n      var rootElementDetected = isMatchingElement(element, $rootElement);\n      var parentAnimationDetected = false;\n      var animateChildren;\n      var elementDisabled = disabledElementsLookup.get(getDomNode(element));\n\n      var parentHost = jqLite.data(element[0], NG_ANIMATE_PIN_DATA);\n      if (parentHost) {\n        parentElement = parentHost;\n      }\n\n      parentElement = getDomNode(parentElement);\n\n      while (parentElement) {\n        if (!rootElementDetected) {\n          // angular doesn't want to attempt to animate elements outside of the application\n          // therefore we need to ensure that the rootElement is an ancestor of the current element\n          rootElementDetected = isMatchingElement(parentElement, $rootElement);\n        }\n\n        if (parentElement.nodeType !== ELEMENT_NODE) {\n          // no point in inspecting the #document element\n          break;\n        }\n\n        var details = activeAnimationsLookup.get(parentElement) || {};\n        // either an enter, leave or move animation will commence\n        // therefore we can't allow any animations to take place\n        // but if a parent animation is class-based then that's ok\n        if (!parentAnimationDetected) {\n          var parentElementDisabled = disabledElementsLookup.get(parentElement);\n\n          if (parentElementDisabled === true && elementDisabled !== false) {\n            // disable animations if the user hasn't explicitly enabled animations on the\n            // current element\n            elementDisabled = true;\n            // element is disabled via parent element, no need to check anything else\n            break;\n          } else if (parentElementDisabled === false) {\n            elementDisabled = false;\n          }\n          parentAnimationDetected = details.structural;\n        }\n\n        if (isUndefined(animateChildren) || animateChildren === true) {\n          var value = jqLite.data(parentElement, NG_ANIMATE_CHILDREN_DATA);\n          if (isDefined(value)) {\n            animateChildren = value;\n          }\n        }\n\n        // there is no need to continue traversing at this point\n        if (parentAnimationDetected && animateChildren === false) break;\n\n        if (!bodyElementDetected) {\n          // we also need to ensure that the element is or will be a part of the body element\n          // otherwise it is pointless to even issue an animation to be rendered\n          bodyElementDetected = isMatchingElement(parentElement, bodyElement);\n        }\n\n        if (bodyElementDetected && rootElementDetected) {\n          // If both body and root have been found, any other checks are pointless,\n          // as no animation data should live outside the application\n          break;\n        }\n\n        if (!rootElementDetected) {\n          // If no rootElement is detected, check if the parentElement is pinned to another element\n          parentHost = jqLite.data(parentElement, NG_ANIMATE_PIN_DATA);\n          if (parentHost) {\n            // The pin target element becomes the next parent element\n            parentElement = getDomNode(parentHost);\n            continue;\n          }\n        }\n\n        parentElement = parentElement.parentNode;\n      }\n\n      var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true;\n      return allowAnimation && rootElementDetected && bodyElementDetected;\n    }\n\n    function markElementAnimationState(element, state, details) {\n      details = details || {};\n      details.state = state;\n\n      var node = getDomNode(element);\n      node.setAttribute(NG_ANIMATE_ATTR_NAME, state);\n\n      var oldValue = activeAnimationsLookup.get(node);\n      var newValue = oldValue\n          ? extend(oldValue, details)\n          : details;\n      activeAnimationsLookup.put(node, newValue);\n    }\n  }];\n}];\n\nvar $$AnimationProvider = ['$animateProvider', function($animateProvider) {\n  var NG_ANIMATE_REF_ATTR = 'ng-animate-ref';\n\n  var drivers = this.drivers = [];\n\n  var RUNNER_STORAGE_KEY = '$$animationRunner';\n\n  function setRunner(element, runner) {\n    element.data(RUNNER_STORAGE_KEY, runner);\n  }\n\n  function removeRunner(element) {\n    element.removeData(RUNNER_STORAGE_KEY);\n  }\n\n  function getRunner(element) {\n    return element.data(RUNNER_STORAGE_KEY);\n  }\n\n  this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$HashMap', '$$rAFScheduler',\n       function($$jqLite,   $rootScope,   $injector,   $$AnimateRunner,   $$HashMap,   $$rAFScheduler) {\n\n    var animationQueue = [];\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    function sortAnimations(animations) {\n      var tree = { children: [] };\n      var i, lookup = new $$HashMap();\n\n      // this is done first beforehand so that the hashmap\n      // is filled with a list of the elements that will be animated\n      for (i = 0; i < animations.length; i++) {\n        var animation = animations[i];\n        lookup.put(animation.domNode, animations[i] = {\n          domNode: animation.domNode,\n          fn: animation.fn,\n          children: []\n        });\n      }\n\n      for (i = 0; i < animations.length; i++) {\n        processNode(animations[i]);\n      }\n\n      return flatten(tree);\n\n      function processNode(entry) {\n        if (entry.processed) return entry;\n        entry.processed = true;\n\n        var elementNode = entry.domNode;\n        var parentNode = elementNode.parentNode;\n        lookup.put(elementNode, entry);\n\n        var parentEntry;\n        while (parentNode) {\n          parentEntry = lookup.get(parentNode);\n          if (parentEntry) {\n            if (!parentEntry.processed) {\n              parentEntry = processNode(parentEntry);\n            }\n            break;\n          }\n          parentNode = parentNode.parentNode;\n        }\n\n        (parentEntry || tree).children.push(entry);\n        return entry;\n      }\n\n      function flatten(tree) {\n        var result = [];\n        var queue = [];\n        var i;\n\n        for (i = 0; i < tree.children.length; i++) {\n          queue.push(tree.children[i]);\n        }\n\n        var remainingLevelEntries = queue.length;\n        var nextLevelEntries = 0;\n        var row = [];\n\n        for (i = 0; i < queue.length; i++) {\n          var entry = queue[i];\n          if (remainingLevelEntries <= 0) {\n            remainingLevelEntries = nextLevelEntries;\n            nextLevelEntries = 0;\n            result.push(row);\n            row = [];\n          }\n          row.push(entry.fn);\n          entry.children.forEach(function(childEntry) {\n            nextLevelEntries++;\n            queue.push(childEntry);\n          });\n          remainingLevelEntries--;\n        }\n\n        if (row.length) {\n          result.push(row);\n        }\n\n        return result;\n      }\n    }\n\n    // TODO(matsko): document the signature in a better way\n    return function(element, event, options) {\n      options = prepareAnimationOptions(options);\n      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;\n\n      // there is no animation at the current moment, however\n      // these runner methods will get later updated with the\n      // methods leading into the driver's end/cancel methods\n      // for now they just stop the animation from starting\n      var runner = new $$AnimateRunner({\n        end: function() { close(); },\n        cancel: function() { close(true); }\n      });\n\n      if (!drivers.length) {\n        close();\n        return runner;\n      }\n\n      setRunner(element, runner);\n\n      var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass));\n      var tempClasses = options.tempClasses;\n      if (tempClasses) {\n        classes += ' ' + tempClasses;\n        options.tempClasses = null;\n      }\n\n      var prepareClassName;\n      if (isStructural) {\n        prepareClassName = 'ng-' + event + PREPARE_CLASS_SUFFIX;\n        $$jqLite.addClass(element, prepareClassName);\n      }\n\n      animationQueue.push({\n        // this data is used by the postDigest code and passed into\n        // the driver step function\n        element: element,\n        classes: classes,\n        event: event,\n        structural: isStructural,\n        options: options,\n        beforeStart: beforeStart,\n        close: close\n      });\n\n      element.on('$destroy', handleDestroyedElement);\n\n      // we only want there to be one function called within the post digest\n      // block. This way we can group animations for all the animations that\n      // were apart of the same postDigest flush call.\n      if (animationQueue.length > 1) return runner;\n\n      $rootScope.$$postDigest(function() {\n        var animations = [];\n        forEach(animationQueue, function(entry) {\n          // the element was destroyed early on which removed the runner\n          // form its storage. This means we can't animate this element\n          // at all and it already has been closed due to destruction.\n          if (getRunner(entry.element)) {\n            animations.push(entry);\n          } else {\n            entry.close();\n          }\n        });\n\n        // now any future animations will be in another postDigest\n        animationQueue.length = 0;\n\n        var groupedAnimations = groupAnimations(animations);\n        var toBeSortedAnimations = [];\n\n        forEach(groupedAnimations, function(animationEntry) {\n          toBeSortedAnimations.push({\n            domNode: getDomNode(animationEntry.from ? animationEntry.from.element : animationEntry.element),\n            fn: function triggerAnimationStart() {\n              // it's important that we apply the `ng-animate` CSS class and the\n              // temporary classes before we do any driver invoking since these\n              // CSS classes may be required for proper CSS detection.\n              animationEntry.beforeStart();\n\n              var startAnimationFn, closeFn = animationEntry.close;\n\n              // in the event that the element was removed before the digest runs or\n              // during the RAF sequencing then we should not trigger the animation.\n              var targetElement = animationEntry.anchors\n                  ? (animationEntry.from.element || animationEntry.to.element)\n                  : animationEntry.element;\n\n              if (getRunner(targetElement)) {\n                var operation = invokeFirstDriver(animationEntry);\n                if (operation) {\n                  startAnimationFn = operation.start;\n                }\n              }\n\n              if (!startAnimationFn) {\n                closeFn();\n              } else {\n                var animationRunner = startAnimationFn();\n                animationRunner.done(function(status) {\n                  closeFn(!status);\n                });\n                updateAnimationRunners(animationEntry, animationRunner);\n              }\n            }\n          });\n        });\n\n        // we need to sort each of the animations in order of parent to child\n        // relationships. This ensures that the child classes are applied at the\n        // right time.\n        $$rAFScheduler(sortAnimations(toBeSortedAnimations));\n      });\n\n      return runner;\n\n      // TODO(matsko): change to reference nodes\n      function getAnchorNodes(node) {\n        var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']';\n        var items = node.hasAttribute(NG_ANIMATE_REF_ATTR)\n              ? [node]\n              : node.querySelectorAll(SELECTOR);\n        var anchors = [];\n        forEach(items, function(node) {\n          var attr = node.getAttribute(NG_ANIMATE_REF_ATTR);\n          if (attr && attr.length) {\n            anchors.push(node);\n          }\n        });\n        return anchors;\n      }\n\n      function groupAnimations(animations) {\n        var preparedAnimations = [];\n        var refLookup = {};\n        forEach(animations, function(animation, index) {\n          var element = animation.element;\n          var node = getDomNode(element);\n          var event = animation.event;\n          var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;\n          var anchorNodes = animation.structural ? getAnchorNodes(node) : [];\n\n          if (anchorNodes.length) {\n            var direction = enterOrMove ? 'to' : 'from';\n\n            forEach(anchorNodes, function(anchor) {\n              var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);\n              refLookup[key] = refLookup[key] || {};\n              refLookup[key][direction] = {\n                animationID: index,\n                element: jqLite(anchor)\n              };\n            });\n          } else {\n            preparedAnimations.push(animation);\n          }\n        });\n\n        var usedIndicesLookup = {};\n        var anchorGroups = {};\n        forEach(refLookup, function(operations, key) {\n          var from = operations.from;\n          var to = operations.to;\n\n          if (!from || !to) {\n            // only one of these is set therefore we can't have an\n            // anchor animation since all three pieces are required\n            var index = from ? from.animationID : to.animationID;\n            var indexKey = index.toString();\n            if (!usedIndicesLookup[indexKey]) {\n              usedIndicesLookup[indexKey] = true;\n              preparedAnimations.push(animations[index]);\n            }\n            return;\n          }\n\n          var fromAnimation = animations[from.animationID];\n          var toAnimation = animations[to.animationID];\n          var lookupKey = from.animationID.toString();\n          if (!anchorGroups[lookupKey]) {\n            var group = anchorGroups[lookupKey] = {\n              structural: true,\n              beforeStart: function() {\n                fromAnimation.beforeStart();\n                toAnimation.beforeStart();\n              },\n              close: function() {\n                fromAnimation.close();\n                toAnimation.close();\n              },\n              classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes),\n              from: fromAnimation,\n              to: toAnimation,\n              anchors: [] // TODO(matsko): change to reference nodes\n            };\n\n            // the anchor animations require that the from and to elements both have at least\n            // one shared CSS class which effectively marries the two elements together to use\n            // the same animation driver and to properly sequence the anchor animation.\n            if (group.classes.length) {\n              preparedAnimations.push(group);\n            } else {\n              preparedAnimations.push(fromAnimation);\n              preparedAnimations.push(toAnimation);\n            }\n          }\n\n          anchorGroups[lookupKey].anchors.push({\n            'out': from.element, 'in': to.element\n          });\n        });\n\n        return preparedAnimations;\n      }\n\n      function cssClassesIntersection(a,b) {\n        a = a.split(' ');\n        b = b.split(' ');\n        var matches = [];\n\n        for (var i = 0; i < a.length; i++) {\n          var aa = a[i];\n          if (aa.substring(0,3) === 'ng-') continue;\n\n          for (var j = 0; j < b.length; j++) {\n            if (aa === b[j]) {\n              matches.push(aa);\n              break;\n            }\n          }\n        }\n\n        return matches.join(' ');\n      }\n\n      function invokeFirstDriver(animationDetails) {\n        // we loop in reverse order since the more general drivers (like CSS and JS)\n        // may attempt more elements, but custom drivers are more particular\n        for (var i = drivers.length - 1; i >= 0; i--) {\n          var driverName = drivers[i];\n          if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check\n\n          var factory = $injector.get(driverName);\n          var driver = factory(animationDetails);\n          if (driver) {\n            return driver;\n          }\n        }\n      }\n\n      function beforeStart() {\n        element.addClass(NG_ANIMATE_CLASSNAME);\n        if (tempClasses) {\n          $$jqLite.addClass(element, tempClasses);\n        }\n        if (prepareClassName) {\n          $$jqLite.removeClass(element, prepareClassName);\n          prepareClassName = null;\n        }\n      }\n\n      function updateAnimationRunners(animation, newRunner) {\n        if (animation.from && animation.to) {\n          update(animation.from.element);\n          update(animation.to.element);\n        } else {\n          update(animation.element);\n        }\n\n        function update(element) {\n          getRunner(element).setHost(newRunner);\n        }\n      }\n\n      function handleDestroyedElement() {\n        var runner = getRunner(element);\n        if (runner && (event !== 'leave' || !options.$$domOperationFired)) {\n          runner.end();\n        }\n      }\n\n      function close(rejected) { // jshint ignore:line\n        element.off('$destroy', handleDestroyedElement);\n        removeRunner(element);\n\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n        options.domOperation();\n\n        if (tempClasses) {\n          $$jqLite.removeClass(element, tempClasses);\n        }\n\n        element.removeClass(NG_ANIMATE_CLASSNAME);\n        runner.complete(!rejected);\n      }\n    };\n  }];\n}];\n\n/**\n * @ngdoc directive\n * @name ngAnimateSwap\n * @restrict A\n * @scope\n *\n * @description\n *\n * ngAnimateSwap is a animation-oriented directive that allows for the container to\n * be removed and entered in whenever the associated expression changes. A\n * common usecase for this directive is a rotating banner or slider component which\n * contains one image being present at a time. When the active image changes\n * then the old image will perform a `leave` animation and the new element\n * will be inserted via an `enter` animation.\n *\n * @animations\n * | Animation                        | Occurs                               |\n * |----------------------------------|--------------------------------------|\n * | {@link ng.$animate#enter enter}  | when the new element is inserted to the DOM  |\n * | {@link ng.$animate#leave leave}  | when the old element is removed from the DOM |\n *\n * @example\n * <example name=\"ngAnimateSwap-directive\" module=\"ngAnimateSwapExample\"\n *          deps=\"angular-animate.js\"\n *          animations=\"true\" fixBase=\"true\">\n *   <file name=\"index.html\">\n *     <div class=\"container\" ng-controller=\"AppCtrl\">\n *       <div ng-animate-swap=\"number\" class=\"cell swap-animation\" ng-class=\"colorClass(number)\">\n *         {{ number }}\n *       </div>\n *     </div>\n *   </file>\n *   <file name=\"script.js\">\n *     angular.module('ngAnimateSwapExample', ['ngAnimate'])\n *       .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {\n *         $scope.number = 0;\n *         $interval(function() {\n *           $scope.number++;\n *         }, 1000);\n *\n *         var colors = ['red','blue','green','yellow','orange'];\n *         $scope.colorClass = function(number) {\n *           return colors[number % colors.length];\n *         };\n *       }]);\n *   </file>\n *  <file name=\"animations.css\">\n *  .container {\n *    height:250px;\n *    width:250px;\n *    position:relative;\n *    overflow:hidden;\n *    border:2px solid black;\n *  }\n *  .container .cell {\n *    font-size:150px;\n *    text-align:center;\n *    line-height:250px;\n *    position:absolute;\n *    top:0;\n *    left:0;\n *    right:0;\n *    border-bottom:2px solid black;\n *  }\n *  .swap-animation.ng-enter, .swap-animation.ng-leave {\n *    transition:0.5s linear all;\n *  }\n *  .swap-animation.ng-enter {\n *    top:-250px;\n *  }\n *  .swap-animation.ng-enter-active {\n *    top:0px;\n *  }\n *  .swap-animation.ng-leave {\n *    top:0px;\n *  }\n *  .swap-animation.ng-leave-active {\n *    top:250px;\n *  }\n *  .red { background:red; }\n *  .green { background:green; }\n *  .blue { background:blue; }\n *  .yellow { background:yellow; }\n *  .orange { background:orange; }\n *  </file>\n * </example>\n */\nvar ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $rootScope) {\n  return {\n    restrict: 'A',\n    transclude: 'element',\n    terminal: true,\n    priority: 600, // we use 600 here to ensure that the directive is caught before others\n    link: function(scope, $element, attrs, ctrl, $transclude) {\n      var previousElement, previousScope;\n      scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) {\n        if (previousElement) {\n          $animate.leave(previousElement);\n        }\n        if (previousScope) {\n          previousScope.$destroy();\n          previousScope = null;\n        }\n        if (value || value === 0) {\n          previousScope = scope.$new();\n          $transclude(previousScope, function(element) {\n            previousElement = element;\n            $animate.enter(element, null, $element);\n          });\n        }\n      });\n    }\n  };\n}];\n\n/* global angularAnimateModule: true,\n\n   ngAnimateSwapDirective,\n   $$AnimateAsyncRunFactory,\n   $$rAFSchedulerFactory,\n   $$AnimateChildrenDirective,\n   $$AnimateQueueProvider,\n   $$AnimationProvider,\n   $AnimateCssProvider,\n   $$AnimateCssDriverProvider,\n   $$AnimateJsProvider,\n   $$AnimateJsDriverProvider,\n*/\n\n/**\n * @ngdoc module\n * @name ngAnimate\n * @description\n *\n * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via\n * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an Angular app.\n *\n * <div doc-module-components=\"ngAnimate\"></div>\n *\n * # Usage\n * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based\n * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For\n * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within\n * the HTML element that the animation will be triggered on.\n *\n * ## Directive Support\n * The following directives are \"animation aware\":\n *\n * | Directive                                                                                                | Supported Animations                                                     |\n * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n * | {@link ng.directive:ngRepeat#animations ngRepeat}                                                        | enter, leave and move                                                    |\n * | {@link ngRoute.directive:ngView#animations ngView}                                                       | enter and leave                                                          |\n * | {@link ng.directive:ngInclude#animations ngInclude}                                                      | enter and leave                                                          |\n * | {@link ng.directive:ngSwitch#animations ngSwitch}                                                        | enter and leave                                                          |\n * | {@link ng.directive:ngIf#animations ngIf}                                                                | enter and leave                                                          |\n * | {@link ng.directive:ngClass#animations ngClass}                                                          | add and remove (the CSS class(es) present)                               |\n * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide}            | add and remove (the ng-hide class value)                                 |\n * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel}    | add and remove (dirty, pristine, valid, invalid & all other validations) |\n * | {@link module:ngMessages#animations ngMessages}                                                          | add and remove (ng-active & ng-inactive)                                 |\n * | {@link module:ngMessages#animations ngMessage}                                                           | enter and leave                                                          |\n *\n * (More information can be found by visiting each the documentation associated with each directive.)\n *\n * ## CSS-based Animations\n *\n * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML\n * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation.\n *\n * The example below shows how an `enter` animation can be made possible on an element using `ng-if`:\n *\n * ```html\n * <div ng-if=\"bool\" class=\"fade\">\n *    Fade me in out\n * </div>\n * <button ng-click=\"bool=true\">Fade In!</button>\n * <button ng-click=\"bool=false\">Fade Out!</button>\n * ```\n *\n * Notice the CSS class **fade**? We can now create the CSS transition code that references this class:\n *\n * ```css\n * /&#42; The starting CSS styles for the enter animation &#42;/\n * .fade.ng-enter {\n *   transition:0.5s linear all;\n *   opacity:0;\n * }\n *\n * /&#42; The finishing CSS styles for the enter animation &#42;/\n * .fade.ng-enter.ng-enter-active {\n *   opacity:1;\n * }\n * ```\n *\n * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two\n * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition\n * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards.\n *\n * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions:\n *\n * ```css\n * /&#42; now the element will fade out before it is removed from the DOM &#42;/\n * .fade.ng-leave {\n *   transition:0.5s linear all;\n *   opacity:1;\n * }\n * .fade.ng-leave.ng-leave-active {\n *   opacity:0;\n * }\n * ```\n *\n * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class:\n *\n * ```css\n * /&#42; there is no need to define anything inside of the destination\n * CSS class since the keyframe will take charge of the animation &#42;/\n * .fade.ng-leave {\n *   animation: my_fade_animation 0.5s linear;\n *   -webkit-animation: my_fade_animation 0.5s linear;\n * }\n *\n * @keyframes my_fade_animation {\n *   from { opacity:1; }\n *   to { opacity:0; }\n * }\n *\n * @-webkit-keyframes my_fade_animation {\n *   from { opacity:1; }\n *   to { opacity:0; }\n * }\n * ```\n *\n * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element.\n *\n * ### CSS Class-based Animations\n *\n * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different\n * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added\n * and removed.\n *\n * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class:\n *\n * ```html\n * <div ng-show=\"bool\" class=\"fade\">\n *   Show and hide me\n * </div>\n * <button ng-click=\"bool=true\">Toggle</button>\n *\n * <style>\n * .fade.ng-hide {\n *   transition:0.5s linear all;\n *   opacity:0;\n * }\n * </style>\n * ```\n *\n * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since\n * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest.\n *\n * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation\n * with CSS styles.\n *\n * ```html\n * <div ng-class=\"{on:onOff}\" class=\"highlight\">\n *   Highlight this box\n * </div>\n * <button ng-click=\"onOff=!onOff\">Toggle</button>\n *\n * <style>\n * .highlight {\n *   transition:0.5s linear all;\n * }\n * .highlight.on-add {\n *   background:white;\n * }\n * .highlight.on {\n *   background:yellow;\n * }\n * .highlight.on-remove {\n *   background:black;\n * }\n * </style>\n * ```\n *\n * We can also make use of CSS keyframes by placing them within the CSS classes.\n *\n *\n * ### CSS Staggering Animations\n * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a\n * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be\n * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for\n * the animation. The style property expected within the stagger class can either be a **transition-delay** or an\n * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).\n *\n * ```css\n * .my-animation.ng-enter {\n *   /&#42; standard transition code &#42;/\n *   transition: 1s linear all;\n *   opacity:0;\n * }\n * .my-animation.ng-enter-stagger {\n *   /&#42; this will have a 100ms delay between each successive leave animation &#42;/\n *   transition-delay: 0.1s;\n *\n *   /&#42; As of 1.4.4, this must always be set: it signals ngAnimate\n *     to not accidentally inherit a delay property from another CSS class &#42;/\n *   transition-duration: 0s;\n * }\n * .my-animation.ng-enter.ng-enter-active {\n *   /&#42; standard transition styles &#42;/\n *   opacity:1;\n * }\n * ```\n *\n * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations\n * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this\n * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation\n * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired.\n *\n * The following code will issue the **ng-leave-stagger** event on the element provided:\n *\n * ```js\n * var kids = parent.children();\n *\n * $animate.leave(kids[0]); //stagger index=0\n * $animate.leave(kids[1]); //stagger index=1\n * $animate.leave(kids[2]); //stagger index=2\n * $animate.leave(kids[3]); //stagger index=3\n * $animate.leave(kids[4]); //stagger index=4\n *\n * window.requestAnimationFrame(function() {\n *   //stagger has reset itself\n *   $animate.leave(kids[5]); //stagger index=0\n *   $animate.leave(kids[6]); //stagger index=1\n *\n *   $scope.$digest();\n * });\n * ```\n *\n * Stagger animations are currently only supported within CSS-defined animations.\n *\n * ### The `ng-animate` CSS class\n *\n * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation.\n * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations).\n *\n * Therefore, animations can be applied to an element using this temporary class directly via CSS.\n *\n * ```css\n * .zipper.ng-animate {\n *   transition:0.5s linear all;\n * }\n * .zipper.ng-enter {\n *   opacity:0;\n * }\n * .zipper.ng-enter.ng-enter-active {\n *   opacity:1;\n * }\n * .zipper.ng-leave {\n *   opacity:1;\n * }\n * .zipper.ng-leave.ng-leave-active {\n *   opacity:0;\n * }\n * ```\n *\n * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove\n * the CSS class once an animation has completed.)\n *\n *\n * ### The `ng-[event]-prepare` class\n *\n * This is a special class that can be used to prevent unwanted flickering / flash of content before\n * the actual animation starts. The class is added as soon as an animation is initialized, but removed\n * before the actual animation starts (after waiting for a $digest).\n * It is also only added for *structural* animations (`enter`, `move`, and `leave`).\n *\n * In practice, flickering can appear when nesting elements with structural animations such as `ngIf`\n * into elements that have class-based animations such as `ngClass`.\n *\n * ```html\n * <div ng-class=\"{red: myProp}\">\n *   <div ng-class=\"{blue: myProp}\">\n *     <div class=\"message\" ng-if=\"myProp\"></div>\n *   </div>\n * </div>\n * ```\n *\n * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating.\n * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:\n *\n * ```css\n * .message.ng-enter-prepare {\n *   opacity: 0;\n * }\n *\n * ```\n *\n * ## JavaScript-based Animations\n *\n * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared\n * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the\n * `module.animation()` module function we can register the animation.\n *\n * Let's see an example of a enter/leave animation using `ngRepeat`:\n *\n * ```html\n * <div ng-repeat=\"item in items\" class=\"slide\">\n *   {{ item }}\n * </div>\n * ```\n *\n * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`:\n *\n * ```js\n * myModule.animation('.slide', [function() {\n *   return {\n *     // make note that other events (like addClass/removeClass)\n *     // have different function input parameters\n *     enter: function(element, doneFn) {\n *       jQuery(element).fadeIn(1000, doneFn);\n *\n *       // remember to call doneFn so that angular\n *       // knows that the animation has concluded\n *     },\n *\n *     move: function(element, doneFn) {\n *       jQuery(element).fadeIn(1000, doneFn);\n *     },\n *\n *     leave: function(element, doneFn) {\n *       jQuery(element).fadeOut(1000, doneFn);\n *     }\n *   }\n * }]);\n * ```\n *\n * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as\n * greensock.js and velocity.js.\n *\n * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define\n * our animations inside of the same registered animation, however, the function input arguments are a bit different:\n *\n * ```html\n * <div ng-class=\"color\" class=\"colorful\">\n *   this box is moody\n * </div>\n * <button ng-click=\"color='red'\">Change to red</button>\n * <button ng-click=\"color='blue'\">Change to blue</button>\n * <button ng-click=\"color='green'\">Change to green</button>\n * ```\n *\n * ```js\n * myModule.animation('.colorful', [function() {\n *   return {\n *     addClass: function(element, className, doneFn) {\n *       // do some cool animation and call the doneFn\n *     },\n *     removeClass: function(element, className, doneFn) {\n *       // do some cool animation and call the doneFn\n *     },\n *     setClass: function(element, addedClass, removedClass, doneFn) {\n *       // do some cool animation and call the doneFn\n *     }\n *   }\n * }]);\n * ```\n *\n * ## CSS + JS Animations Together\n *\n * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular,\n * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking\n * charge of the animation**:\n *\n * ```html\n * <div ng-if=\"bool\" class=\"slide\">\n *   Slide in and out\n * </div>\n * ```\n *\n * ```js\n * myModule.animation('.slide', [function() {\n *   return {\n *     enter: function(element, doneFn) {\n *       jQuery(element).slideIn(1000, doneFn);\n *     }\n *   }\n * }]);\n * ```\n *\n * ```css\n * .slide.ng-enter {\n *   transition:0.5s linear all;\n *   transform:translateY(-100px);\n * }\n * .slide.ng-enter.ng-enter-active {\n *   transform:translateY(0);\n * }\n * ```\n *\n * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the\n * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from\n * our own JS-based animation code:\n *\n * ```js\n * myModule.animation('.slide', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element) {\n*        // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`.\n *       return $animateCss(element, {\n *         event: 'enter',\n *         structural: true\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework.\n *\n * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or\n * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that\n * data into `$animateCss` directly:\n *\n * ```js\n * myModule.animation('.slide', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element) {\n *       return $animateCss(element, {\n *         event: 'enter',\n *         structural: true,\n *         addClass: 'maroon-setting',\n *         from: { height:0 },\n *         to: { height: 200 }\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * Now we can fill in the rest via our transition CSS code:\n *\n * ```css\n * /&#42; the transition tells ngAnimate to make the animation happen &#42;/\n * .slide.ng-enter { transition:0.5s linear all; }\n *\n * /&#42; this extra CSS class will be absorbed into the transition\n * since the $animateCss code is adding the class &#42;/\n * .maroon-setting { background:red; }\n * ```\n *\n * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over.\n *\n * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}.\n *\n * ## Animation Anchoring (via `ng-animate-ref`)\n *\n * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between\n * structural areas of an application (like views) by pairing up elements using an attribute\n * called `ng-animate-ref`.\n *\n * Let's say for example we have two views that are managed by `ng-view` and we want to show\n * that there is a relationship between two components situated in within these views. By using the\n * `ng-animate-ref` attribute we can identify that the two components are paired together and we\n * can then attach an animation, which is triggered when the view changes.\n *\n * Say for example we have the following template code:\n *\n * ```html\n * <!-- index.html -->\n * <div ng-view class=\"view-animation\">\n * </div>\n *\n * <!-- home.html -->\n * <a href=\"#/banner-page\">\n *   <img src=\"./banner.jpg\" class=\"banner\" ng-animate-ref=\"banner\">\n * </a>\n *\n * <!-- banner-page.html -->\n * <img src=\"./banner.jpg\" class=\"banner\" ng-animate-ref=\"banner\">\n * ```\n *\n * Now, when the view changes (once the link is clicked), ngAnimate will examine the\n * HTML contents to see if there is a match reference between any components in the view\n * that is leaving and the view that is entering. It will scan both the view which is being\n * removed (leave) and inserted (enter) to see if there are any paired DOM elements that\n * contain a matching ref value.\n *\n * The two images match since they share the same ref value. ngAnimate will now create a\n * transport element (which is a clone of the first image element) and it will then attempt\n * to animate to the position of the second image element in the next view. For the animation to\n * work a special CSS class called `ng-anchor` will be added to the transported element.\n *\n * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then\n * ngAnimate will handle the entire transition for us as well as the addition and removal of\n * any changes of CSS classes between the elements:\n *\n * ```css\n * .banner.ng-anchor {\n *   /&#42; this animation will last for 1 second since there are\n *          two phases to the animation (an `in` and an `out` phase) &#42;/\n *   transition:0.5s linear all;\n * }\n * ```\n *\n * We also **must** include animations for the views that are being entered and removed\n * (otherwise anchoring wouldn't be possible since the new view would be inserted right away).\n *\n * ```css\n * .view-animation.ng-enter, .view-animation.ng-leave {\n *   transition:0.5s linear all;\n *   position:fixed;\n *   left:0;\n *   top:0;\n *   width:100%;\n * }\n * .view-animation.ng-enter {\n *   transform:translateX(100%);\n * }\n * .view-animation.ng-leave,\n * .view-animation.ng-enter.ng-enter-active {\n *   transform:translateX(0%);\n * }\n * .view-animation.ng-leave.ng-leave-active {\n *   transform:translateX(-100%);\n * }\n * ```\n *\n * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur:\n * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away\n * from its origin. Once that animation is over then the `in` stage occurs which animates the\n * element to its destination. The reason why there are two animations is to give enough time\n * for the enter animation on the new element to be ready.\n *\n * The example above sets up a transition for both the in and out phases, but we can also target the out or\n * in phases directly via `ng-anchor-out` and `ng-anchor-in`.\n *\n * ```css\n * .banner.ng-anchor-out {\n *   transition: 0.5s linear all;\n *\n *   /&#42; the scale will be applied during the out animation,\n *          but will be animated away when the in animation runs &#42;/\n *   transform: scale(1.2);\n * }\n *\n * .banner.ng-anchor-in {\n *   transition: 1s linear all;\n * }\n * ```\n *\n *\n *\n *\n * ### Anchoring Demo\n *\n  <example module=\"anchoringExample\"\n           name=\"anchoringExample\"\n           id=\"anchoringExample\"\n           deps=\"angular-animate.js;angular-route.js\"\n           animations=\"true\">\n    <file name=\"index.html\">\n      <a href=\"#/\">Home</a>\n      <hr />\n      <div class=\"view-container\">\n        <div ng-view class=\"view\"></div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('anchoringExample', ['ngAnimate', 'ngRoute'])\n        .config(['$routeProvider', function($routeProvider) {\n          $routeProvider.when('/', {\n            templateUrl: 'home.html',\n            controller: 'HomeController as home'\n          });\n          $routeProvider.when('/profile/:id', {\n            templateUrl: 'profile.html',\n            controller: 'ProfileController as profile'\n          });\n        }])\n        .run(['$rootScope', function($rootScope) {\n          $rootScope.records = [\n            { id:1, title: \"Miss Beulah Roob\" },\n            { id:2, title: \"Trent Morissette\" },\n            { id:3, title: \"Miss Ava Pouros\" },\n            { id:4, title: \"Rod Pouros\" },\n            { id:5, title: \"Abdul Rice\" },\n            { id:6, title: \"Laurie Rutherford Sr.\" },\n            { id:7, title: \"Nakia McLaughlin\" },\n            { id:8, title: \"Jordon Blanda DVM\" },\n            { id:9, title: \"Rhoda Hand\" },\n            { id:10, title: \"Alexandrea Sauer\" }\n          ];\n        }])\n        .controller('HomeController', [function() {\n          //empty\n        }])\n        .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) {\n          var index = parseInt($routeParams.id, 10);\n          var record = $rootScope.records[index - 1];\n\n          this.title = record.title;\n          this.id = record.id;\n        }]);\n    </file>\n    <file name=\"home.html\">\n      <h2>Welcome to the home page</h1>\n      <p>Please click on an element</p>\n      <a class=\"record\"\n         ng-href=\"#/profile/{{ record.id }}\"\n         ng-animate-ref=\"{{ record.id }}\"\n         ng-repeat=\"record in records\">\n        {{ record.title }}\n      </a>\n    </file>\n    <file name=\"profile.html\">\n      <div class=\"profile record\" ng-animate-ref=\"{{ profile.id }}\">\n        {{ profile.title }}\n      </div>\n    </file>\n    <file name=\"animations.css\">\n      .record {\n        display:block;\n        font-size:20px;\n      }\n      .profile {\n        background:black;\n        color:white;\n        font-size:100px;\n      }\n      .view-container {\n        position:relative;\n      }\n      .view-container > .view.ng-animate {\n        position:absolute;\n        top:0;\n        left:0;\n        width:100%;\n        min-height:500px;\n      }\n      .view.ng-enter, .view.ng-leave,\n      .record.ng-anchor {\n        transition:0.5s linear all;\n      }\n      .view.ng-enter {\n        transform:translateX(100%);\n      }\n      .view.ng-enter.ng-enter-active, .view.ng-leave {\n        transform:translateX(0%);\n      }\n      .view.ng-leave.ng-leave-active {\n        transform:translateX(-100%);\n      }\n      .record.ng-anchor-out {\n        background:red;\n      }\n    </file>\n  </example>\n *\n * ### How is the element transported?\n *\n * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting\n * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element\n * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The\n * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match\n * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied\n * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class\n * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element\n * will become visible since the shim class will be removed.\n *\n * ### How is the morphing handled?\n *\n * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out\n * what CSS classes differ between the starting element and the destination element. These different CSS classes\n * will be added/removed on the anchor element and a transition will be applied (the transition that is provided\n * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will\n * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that\n * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since\n * the cloned element is placed inside of root element which is likely close to the body element).\n *\n * Note that if the root element is on the `<html>` element then the cloned node will be placed inside of body.\n *\n *\n * ## Using $animate in your directive code\n *\n * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application?\n * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's\n * imagine we have a greeting box that shows and hides itself when the data changes\n *\n * ```html\n * <greeting-box active=\"onOrOff\">Hi there</greeting-box>\n * ```\n *\n * ```js\n * ngModule.directive('greetingBox', ['$animate', function($animate) {\n *   return function(scope, element, attrs) {\n *     attrs.$observe('active', function(value) {\n *       value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');\n *     });\n *   });\n * }]);\n * ```\n *\n * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element\n * in our HTML code then we can trigger a CSS or JS animation to happen.\n *\n * ```css\n * /&#42; normally we would create a CSS class to reference on the element &#42;/\n * greeting-box.on { transition:0.5s linear all; background:green; color:white; }\n * ```\n *\n * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's\n * possible be sure to visit the {@link ng.$animate $animate service API page}.\n *\n *\n * ## Callbacks and Promises\n *\n * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger\n * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has\n * ended by chaining onto the returned promise that animation method returns.\n *\n * ```js\n * // somewhere within the depths of the directive\n * $animate.enter(element, parent).then(function() {\n *   //the animation has completed\n * });\n * ```\n *\n * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case\n * anymore.)\n *\n * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering\n * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view\n * routing controller to hook into that:\n *\n * ```js\n * ngModule.controller('HomePageController', ['$animate', function($animate) {\n *   $animate.on('enter', ngViewElement, function(element) {\n *     // the animation for this route has completed\n *   }]);\n * }])\n * ```\n *\n * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.)\n */\n\n/**\n * @ngdoc service\n * @name $animate\n * @kind object\n *\n * @description\n * The ngAnimate `$animate` service documentation is the same for the core `$animate` service.\n *\n * Click here {@link ng.$animate to learn more about animations with `$animate`}.\n */\nangular.module('ngAnimate', [])\n  .directive('ngAnimateSwap', ngAnimateSwapDirective)\n\n  .directive('ngAnimateChildren', $$AnimateChildrenDirective)\n  .factory('$$rAFScheduler', $$rAFSchedulerFactory)\n\n  .provider('$$animateQueue', $$AnimateQueueProvider)\n  .provider('$$animation', $$AnimationProvider)\n\n  .provider('$animateCss', $AnimateCssProvider)\n  .provider('$$animateCssDriver', $$AnimateCssDriverProvider)\n\n  .provider('$$animateJs', $$AnimateJsProvider)\n  .provider('$$animateJsDriver', $$AnimateJsDriverProvider);\n\n\n})(window, window.angular);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/angular/angular-resource.js",
    "content": "/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\nvar $resourceMinErr = angular.$$minErr('$resource');\n\n// Helper functions and regex to lookup a dotted path on an object\n// stopping at undefined/null.  The path must be composed of ASCII\n// identifiers (just like $parse)\nvar MEMBER_NAME_REGEX = /^(\\.[a-zA-Z_$@][0-9a-zA-Z_$@]*)+$/;\n\nfunction isValidDottedPath(path) {\n  return (path != null && path !== '' && path !== 'hasOwnProperty' &&\n      MEMBER_NAME_REGEX.test('.' + path));\n}\n\nfunction lookupDottedPath(obj, path) {\n  if (!isValidDottedPath(path)) {\n    throw $resourceMinErr('badmember', 'Dotted member path \"@{0}\" is invalid.', path);\n  }\n  var keys = path.split('.');\n  for (var i = 0, ii = keys.length; i < ii && angular.isDefined(obj); i++) {\n    var key = keys[i];\n    obj = (obj !== null) ? obj[key] : undefined;\n  }\n  return obj;\n}\n\n/**\n * Create a shallow copy of an object and clear other fields from the destination\n */\nfunction shallowClearAndCopy(src, dst) {\n  dst = dst || {};\n\n  angular.forEach(dst, function(value, key) {\n    delete dst[key];\n  });\n\n  for (var key in src) {\n    if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {\n      dst[key] = src[key];\n    }\n  }\n\n  return dst;\n}\n\n/**\n * @ngdoc module\n * @name ngResource\n * @description\n *\n * # ngResource\n *\n * The `ngResource` module provides interaction support with RESTful services\n * via the $resource service.\n *\n *\n * <div doc-module-components=\"ngResource\"></div>\n *\n * See {@link ngResource.$resource `$resource`} for usage.\n */\n\n/**\n * @ngdoc service\n * @name $resource\n * @requires $http\n * @requires ng.$log\n * @requires $q\n * @requires ng.$timeout\n *\n * @description\n * A factory which creates a resource object that lets you interact with\n * [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.\n *\n * The returned resource object has action methods which provide high-level behaviors without\n * the need to interact with the low level {@link ng.$http $http} service.\n *\n * Requires the {@link ngResource `ngResource`} module to be installed.\n *\n * By default, trailing slashes will be stripped from the calculated URLs,\n * which can pose problems with server backends that do not expect that\n * behavior.  This can be disabled by configuring the `$resourceProvider` like\n * this:\n *\n * ```js\n     app.config(['$resourceProvider', function($resourceProvider) {\n       // Don't strip trailing slashes from calculated URLs\n       $resourceProvider.defaults.stripTrailingSlashes = false;\n     }]);\n * ```\n *\n * @param {string} url A parameterized URL template with parameters prefixed by `:` as in\n *   `/user/:username`. If you are using a URL with a port number (e.g.\n *   `http://example.com:8080/api`), it will be respected.\n *\n *   If you are using a url with a suffix, just add the suffix, like this:\n *   `$resource('http://example.com/resource.json')` or `$resource('http://example.com/:id.json')`\n *   or even `$resource('http://example.com/resource/:resource_id.:format')`\n *   If the parameter before the suffix is empty, :resource_id in this case, then the `/.` will be\n *   collapsed down to a single `.`.  If you need this sequence to appear and not collapse then you\n *   can escape it with `/\\.`.\n *\n * @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in\n *   `actions` methods. If a parameter value is a function, it will be executed every time\n *   when a param value needs to be obtained for a request (unless the param was overridden).\n *\n *   Each key value in the parameter object is first bound to url template if present and then any\n *   excess keys are appended to the url search query after the `?`.\n *\n *   Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in\n *   URL `/path/greet?salutation=Hello`.\n *\n *   If the parameter value is prefixed with `@` then the value for that parameter will be extracted\n *   from the corresponding property on the `data` object (provided when calling an action method).\n *   For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of\n *   `someParam` will be `data.someProp`.\n *\n * @param {Object.<Object>=} actions Hash with declaration of custom actions that should extend\n *   the default set of resource actions. The declaration should be created in the format of {@link\n *   ng.$http#usage $http.config}:\n *\n *       {action1: {method:?, params:?, isArray:?, headers:?, ...},\n *        action2: {method:?, params:?, isArray:?, headers:?, ...},\n *        ...}\n *\n *   Where:\n *\n *   - **`action`** – {string} – The name of action. This name becomes the name of the method on\n *     your resource object.\n *   - **`method`** – {string} – Case insensitive HTTP method (e.g. `GET`, `POST`, `PUT`,\n *     `DELETE`, `JSONP`, etc).\n *   - **`params`** – {Object=} – Optional set of pre-bound parameters for this action. If any of\n *     the parameter value is a function, it will be executed every time when a param value needs to\n *     be obtained for a request (unless the param was overridden).\n *   - **`url`** – {string} – action specific `url` override. The url templating is supported just\n *     like for the resource-level urls.\n *   - **`isArray`** – {boolean=} – If true then the returned object for this action is an array,\n *     see `returns` section.\n *   - **`transformRequest`** –\n *     `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n *     transform function or an array of such functions. The transform function takes the http\n *     request body and headers and returns its transformed (typically serialized) version.\n *     By default, transformRequest will contain one function that checks if the request data is\n *     an object and serializes to using `angular.toJson`. To prevent this behavior, set\n *     `transformRequest` to an empty array: `transformRequest: []`\n *   - **`transformResponse`** –\n *     `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n *     transform function or an array of such functions. The transform function takes the http\n *     response body and headers and returns its transformed (typically deserialized) version.\n *     By default, transformResponse will contain one function that checks if the response looks\n *     like a JSON string and deserializes it using `angular.fromJson`. To prevent this behavior,\n *     set `transformResponse` to an empty array: `transformResponse: []`\n *   - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the\n *     GET request, otherwise if a cache instance built with\n *     {@link ng.$cacheFactory $cacheFactory}, this cache will be used for\n *     caching.\n *   - **`timeout`** – `{number}` – timeout in milliseconds.<br />\n *     **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are\n *     **not** supported in $resource, because the same value would be used for multiple requests.\n *     If you are looking for a way to cancel requests, you should use the `cancellable` option.\n *   - **`cancellable`** – `{boolean}` – if set to true, the request made by a \"non-instance\" call\n *     will be cancelled (if not already completed) by calling `$cancelRequest()` on the call's\n *     return value. Calling `$cancelRequest()` for a non-cancellable or an already\n *     completed/cancelled request will have no effect.<br />\n *   - **`withCredentials`** - `{boolean}` - whether to set the `withCredentials` flag on the\n *     XHR object. See\n *     [requests with credentials](https://developer.mozilla.org/en/http_access_control#section_5)\n *     for more information.\n *   - **`responseType`** - `{string}` - see\n *     [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).\n *   - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -\n *     `response` and `responseError`. Both `response` and `responseError` interceptors get called\n *     with `http response` object. See {@link ng.$http $http interceptors}.\n *\n * @param {Object} options Hash with custom settings that should extend the\n *   default `$resourceProvider` behavior.  The supported options are:\n *\n *   - **`stripTrailingSlashes`** – {boolean} – If true then the trailing\n *   slashes from any calculated URL will be stripped. (Defaults to true.)\n *   - **`cancellable`** – {boolean} – If true, the request made by a \"non-instance\" call will be\n *   cancelled (if not already completed) by calling `$cancelRequest()` on the call's return value.\n *   This can be overwritten per action. (Defaults to false.)\n *\n * @returns {Object} A resource \"class\" object with methods for the default set of resource actions\n *   optionally extended with custom `actions`. The default set contains these actions:\n *   ```js\n *   { 'get':    {method:'GET'},\n *     'save':   {method:'POST'},\n *     'query':  {method:'GET', isArray:true},\n *     'remove': {method:'DELETE'},\n *     'delete': {method:'DELETE'} };\n *   ```\n *\n *   Calling these methods invoke an {@link ng.$http} with the specified http method,\n *   destination and parameters. When the data is returned from the server then the object is an\n *   instance of the resource class. The actions `save`, `remove` and `delete` are available on it\n *   as  methods with the `$` prefix. This allows you to easily perform CRUD operations (create,\n *   read, update, delete) on server-side data like this:\n *   ```js\n *   var User = $resource('/user/:userId', {userId:'@id'});\n *   var user = User.get({userId:123}, function() {\n *     user.abc = true;\n *     user.$save();\n *   });\n *   ```\n *\n *   It is important to realize that invoking a $resource object method immediately returns an\n *   empty reference (object or array depending on `isArray`). Once the data is returned from the\n *   server the existing reference is populated with the actual data. This is a useful trick since\n *   usually the resource is assigned to a model which is then rendered by the view. Having an empty\n *   object results in no rendering, once the data arrives from the server then the object is\n *   populated with the data and the view automatically re-renders itself showing the new data. This\n *   means that in most cases one never has to write a callback function for the action methods.\n *\n *   The action methods on the class object or instance object can be invoked with the following\n *   parameters:\n *\n *   - HTTP GET \"class\" actions: `Resource.action([parameters], [success], [error])`\n *   - non-GET \"class\" actions: `Resource.action([parameters], postData, [success], [error])`\n *   - non-GET instance actions:  `instance.$action([parameters], [success], [error])`\n *\n *\n *   Success callback is called with (value, responseHeaders) arguments, where the value is\n *   the populated resource instance or collection object. The error callback is called\n *   with (httpResponse) argument.\n *\n *   Class actions return empty instance (with additional properties below).\n *   Instance actions return promise of the action.\n *\n *   The Resource instances and collections have these additional properties:\n *\n *   - `$promise`: the {@link ng.$q promise} of the original server interaction that created this\n *     instance or collection.\n *\n *     On success, the promise is resolved with the same resource instance or collection object,\n *     updated with data from server. This makes it easy to use in\n *     {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view\n *     rendering until the resource(s) are loaded.\n *\n *     On failure, the promise is rejected with the {@link ng.$http http response} object, without\n *     the `resource` property.\n *\n *     If an interceptor object was provided, the promise will instead be resolved with the value\n *     returned by the interceptor.\n *\n *   - `$resolved`: `true` after first server interaction is completed (either with success or\n *      rejection), `false` before that. Knowing if the Resource has been resolved is useful in\n *      data-binding.\n *\n *   The Resource instances and collections have these additional methods:\n *\n *   - `$cancelRequest`: If there is a cancellable, pending request related to the instance or\n *      collection, calling this method will abort the request.\n *\n * @example\n *\n * # Credit card resource\n *\n * ```js\n     // Define CreditCard class\n     var CreditCard = $resource('/user/:userId/card/:cardId',\n      {userId:123, cardId:'@id'}, {\n       charge: {method:'POST', params:{charge:true}}\n      });\n\n     // We can retrieve a collection from the server\n     var cards = CreditCard.query(function() {\n       // GET: /user/123/card\n       // server returns: [ {id:456, number:'1234', name:'Smith'} ];\n\n       var card = cards[0];\n       // each item is an instance of CreditCard\n       expect(card instanceof CreditCard).toEqual(true);\n       card.name = \"J. Smith\";\n       // non GET methods are mapped onto the instances\n       card.$save();\n       // POST: /user/123/card/456 {id:456, number:'1234', name:'J. Smith'}\n       // server returns: {id:456, number:'1234', name: 'J. Smith'};\n\n       // our custom method is mapped as well.\n       card.$charge({amount:9.99});\n       // POST: /user/123/card/456?amount=9.99&charge=true {id:456, number:'1234', name:'J. Smith'}\n     });\n\n     // we can create an instance as well\n     var newCard = new CreditCard({number:'0123'});\n     newCard.name = \"Mike Smith\";\n     newCard.$save();\n     // POST: /user/123/card {number:'0123', name:'Mike Smith'}\n     // server returns: {id:789, number:'0123', name: 'Mike Smith'};\n     expect(newCard.id).toEqual(789);\n * ```\n *\n * The object returned from this function execution is a resource \"class\" which has \"static\" method\n * for each action in the definition.\n *\n * Calling these methods invoke `$http` on the `url` template with the given `method`, `params` and\n * `headers`.\n *\n * @example\n *\n * # User resource\n *\n * When the data is returned from the server then the object is an instance of the resource type and\n * all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD\n * operations (create, read, update, delete) on server-side data.\n\n   ```js\n     var User = $resource('/user/:userId', {userId:'@id'});\n     User.get({userId:123}, function(user) {\n       user.abc = true;\n       user.$save();\n     });\n   ```\n *\n * It's worth noting that the success callback for `get`, `query` and other methods gets passed\n * in the response that came from the server as well as $http header getter function, so one\n * could rewrite the above example and get access to http headers as:\n *\n   ```js\n     var User = $resource('/user/:userId', {userId:'@id'});\n     User.get({userId:123}, function(user, getResponseHeaders){\n       user.abc = true;\n       user.$save(function(user, putResponseHeaders) {\n         //user => saved user object\n         //putResponseHeaders => $http header getter\n       });\n     });\n   ```\n *\n * You can also access the raw `$http` promise via the `$promise` property on the object returned\n *\n   ```\n     var User = $resource('/user/:userId', {userId:'@id'});\n     User.get({userId:123})\n         .$promise.then(function(user) {\n           $scope.user = user;\n         });\n   ```\n *\n * @example\n *\n * # Creating a custom 'PUT' request\n *\n * In this example we create a custom method on our resource to make a PUT request\n * ```js\n *    var app = angular.module('app', ['ngResource', 'ngRoute']);\n *\n *    // Some APIs expect a PUT request in the format URL/object/ID\n *    // Here we are creating an 'update' method\n *    app.factory('Notes', ['$resource', function($resource) {\n *    return $resource('/notes/:id', null,\n *        {\n *            'update': { method:'PUT' }\n *        });\n *    }]);\n *\n *    // In our controller we get the ID from the URL using ngRoute and $routeParams\n *    // We pass in $routeParams and our Notes factory along with $scope\n *    app.controller('NotesCtrl', ['$scope', '$routeParams', 'Notes',\n                                      function($scope, $routeParams, Notes) {\n *    // First get a note object from the factory\n *    var note = Notes.get({ id:$routeParams.id });\n *    $id = note.id;\n *\n *    // Now call update passing in the ID first then the object you are updating\n *    Notes.update({ id:$id }, note);\n *\n *    // This will PUT /notes/ID with the note object in the request payload\n *    }]);\n * ```\n *\n * @example\n *\n * # Cancelling requests\n *\n * If an action's configuration specifies that it is cancellable, you can cancel the request related\n * to an instance or collection (as long as it is a result of a \"non-instance\" call):\n *\n   ```js\n     // ...defining the `Hotel` resource...\n     var Hotel = $resource('/api/hotel/:id', {id: '@id'}, {\n       // Let's make the `query()` method cancellable\n       query: {method: 'get', isArray: true, cancellable: true}\n     });\n\n     // ...somewhere in the PlanVacationController...\n     ...\n     this.onDestinationChanged = function onDestinationChanged(destination) {\n       // We don't care about any pending request for hotels\n       // in a different destination any more\n       this.availableHotels.$cancelRequest();\n\n       // Let's query for hotels in '<destination>'\n       // (calls: /api/hotel?location=<destination>)\n       this.availableHotels = Hotel.query({location: destination});\n     };\n   ```\n *\n */\nangular.module('ngResource', ['ng']).\n  provider('$resource', function() {\n    var PROTOCOL_AND_DOMAIN_REGEX = /^https?:\\/\\/[^\\/]*/;\n    var provider = this;\n\n    this.defaults = {\n      // Strip slashes by default\n      stripTrailingSlashes: true,\n\n      // Default actions configuration\n      actions: {\n        'get': {method: 'GET'},\n        'save': {method: 'POST'},\n        'query': {method: 'GET', isArray: true},\n        'remove': {method: 'DELETE'},\n        'delete': {method: 'DELETE'}\n      }\n    };\n\n    this.$get = ['$http', '$log', '$q', '$timeout', function($http, $log, $q, $timeout) {\n\n      var noop = angular.noop,\n        forEach = angular.forEach,\n        extend = angular.extend,\n        copy = angular.copy,\n        isFunction = angular.isFunction;\n\n      /**\n       * We need our custom method because encodeURIComponent is too aggressive and doesn't follow\n       * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set\n       * (pchar) allowed in path segments:\n       *    segment       = *pchar\n       *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n       *    pct-encoded   = \"%\" HEXDIG HEXDIG\n       *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n       *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n       *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n       */\n      function encodeUriSegment(val) {\n        return encodeUriQuery(val, true).\n          replace(/%26/gi, '&').\n          replace(/%3D/gi, '=').\n          replace(/%2B/gi, '+');\n      }\n\n\n      /**\n       * This method is intended for encoding *key* or *value* parts of query component. We need a\n       * custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't\n       * have to be encoded per http://tools.ietf.org/html/rfc3986:\n       *    query       = *( pchar / \"/\" / \"?\" )\n       *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n       *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n       *    pct-encoded   = \"%\" HEXDIG HEXDIG\n       *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n       *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n       */\n      function encodeUriQuery(val, pctEncodeSpaces) {\n        return encodeURIComponent(val).\n          replace(/%40/gi, '@').\n          replace(/%3A/gi, ':').\n          replace(/%24/g, '$').\n          replace(/%2C/gi, ',').\n          replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));\n      }\n\n      function Route(template, defaults) {\n        this.template = template;\n        this.defaults = extend({}, provider.defaults, defaults);\n        this.urlParams = {};\n      }\n\n      Route.prototype = {\n        setUrlParams: function(config, params, actionUrl) {\n          var self = this,\n            url = actionUrl || self.template,\n            val,\n            encodedVal,\n            protocolAndDomain = '';\n\n          var urlParams = self.urlParams = {};\n          forEach(url.split(/\\W/), function(param) {\n            if (param === 'hasOwnProperty') {\n              throw $resourceMinErr('badname', \"hasOwnProperty is not a valid parameter name.\");\n            }\n            if (!(new RegExp(\"^\\\\d+$\").test(param)) && param &&\n              (new RegExp(\"(^|[^\\\\\\\\]):\" + param + \"(\\\\W|$)\").test(url))) {\n              urlParams[param] = {\n                isQueryParamValue: (new RegExp(\"\\\\?.*=:\" + param + \"(?:\\\\W|$)\")).test(url)\n              };\n            }\n          });\n          url = url.replace(/\\\\:/g, ':');\n          url = url.replace(PROTOCOL_AND_DOMAIN_REGEX, function(match) {\n            protocolAndDomain = match;\n            return '';\n          });\n\n          params = params || {};\n          forEach(self.urlParams, function(paramInfo, urlParam) {\n            val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];\n            if (angular.isDefined(val) && val !== null) {\n              if (paramInfo.isQueryParamValue) {\n                encodedVal = encodeUriQuery(val, true);\n              } else {\n                encodedVal = encodeUriSegment(val);\n              }\n              url = url.replace(new RegExp(\":\" + urlParam + \"(\\\\W|$)\", \"g\"), function(match, p1) {\n                return encodedVal + p1;\n              });\n            } else {\n              url = url.replace(new RegExp(\"(\\/?):\" + urlParam + \"(\\\\W|$)\", \"g\"), function(match,\n                  leadingSlashes, tail) {\n                if (tail.charAt(0) == '/') {\n                  return tail;\n                } else {\n                  return leadingSlashes + tail;\n                }\n              });\n            }\n          });\n\n          // strip trailing slashes and set the url (unless this behavior is specifically disabled)\n          if (self.defaults.stripTrailingSlashes) {\n            url = url.replace(/\\/+$/, '') || '/';\n          }\n\n          // then replace collapse `/.` if found in the last URL path segment before the query\n          // E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`\n          url = url.replace(/\\/\\.(?=\\w+($|\\?))/, '.');\n          // replace escaped `/\\.` with `/.`\n          config.url = protocolAndDomain + url.replace(/\\/\\\\\\./, '/.');\n\n\n          // set params - delegate param encoding to $http\n          forEach(params, function(value, key) {\n            if (!self.urlParams[key]) {\n              config.params = config.params || {};\n              config.params[key] = value;\n            }\n          });\n        }\n      };\n\n\n      function resourceFactory(url, paramDefaults, actions, options) {\n        var route = new Route(url, options);\n\n        actions = extend({}, provider.defaults.actions, actions);\n\n        function extractParams(data, actionParams) {\n          var ids = {};\n          actionParams = extend({}, paramDefaults, actionParams);\n          forEach(actionParams, function(value, key) {\n            if (isFunction(value)) { value = value(); }\n            ids[key] = value && value.charAt && value.charAt(0) == '@' ?\n              lookupDottedPath(data, value.substr(1)) : value;\n          });\n          return ids;\n        }\n\n        function defaultResponseInterceptor(response) {\n          return response.resource;\n        }\n\n        function Resource(value) {\n          shallowClearAndCopy(value || {}, this);\n        }\n\n        Resource.prototype.toJSON = function() {\n          var data = extend({}, this);\n          delete data.$promise;\n          delete data.$resolved;\n          return data;\n        };\n\n        forEach(actions, function(action, name) {\n          var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);\n          var numericTimeout = action.timeout;\n          var cancellable = angular.isDefined(action.cancellable) ? action.cancellable :\n              (options && angular.isDefined(options.cancellable)) ? options.cancellable :\n              provider.defaults.cancellable;\n\n          if (numericTimeout && !angular.isNumber(numericTimeout)) {\n            $log.debug('ngResource:\\n' +\n                       '  Only numeric values are allowed as `timeout`.\\n' +\n                       '  Promises are not supported in $resource, because the same value would ' +\n                       'be used for multiple requests. If you are looking for a way to cancel ' +\n                       'requests, you should use the `cancellable` option.');\n            delete action.timeout;\n            numericTimeout = null;\n          }\n\n          Resource[name] = function(a1, a2, a3, a4) {\n            var params = {}, data, success, error;\n\n            /* jshint -W086 */ /* (purposefully fall through case statements) */\n            switch (arguments.length) {\n              case 4:\n                error = a4;\n                success = a3;\n              //fallthrough\n              case 3:\n              case 2:\n                if (isFunction(a2)) {\n                  if (isFunction(a1)) {\n                    success = a1;\n                    error = a2;\n                    break;\n                  }\n\n                  success = a2;\n                  error = a3;\n                  //fallthrough\n                } else {\n                  params = a1;\n                  data = a2;\n                  success = a3;\n                  break;\n                }\n              case 1:\n                if (isFunction(a1)) success = a1;\n                else if (hasBody) data = a1;\n                else params = a1;\n                break;\n              case 0: break;\n              default:\n                throw $resourceMinErr('badargs',\n                  \"Expected up to 4 arguments [params, data, success, error], got {0} arguments\",\n                  arguments.length);\n            }\n            /* jshint +W086 */ /* (purposefully fall through case statements) */\n\n            var isInstanceCall = this instanceof Resource;\n            var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));\n            var httpConfig = {};\n            var responseInterceptor = action.interceptor && action.interceptor.response ||\n              defaultResponseInterceptor;\n            var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||\n              undefined;\n            var timeoutDeferred;\n            var numericTimeoutPromise;\n\n            forEach(action, function(value, key) {\n              switch (key) {\n                default:\n                  httpConfig[key] = copy(value);\n                  break;\n                case 'params':\n                case 'isArray':\n                case 'interceptor':\n                case 'cancellable':\n                  break;\n              }\n            });\n\n            if (!isInstanceCall && cancellable) {\n              timeoutDeferred = $q.defer();\n              httpConfig.timeout = timeoutDeferred.promise;\n\n              if (numericTimeout) {\n                numericTimeoutPromise = $timeout(timeoutDeferred.resolve, numericTimeout);\n              }\n            }\n\n            if (hasBody) httpConfig.data = data;\n            route.setUrlParams(httpConfig,\n              extend({}, extractParams(data, action.params || {}), params),\n              action.url);\n\n            var promise = $http(httpConfig).then(function(response) {\n              var data = response.data;\n\n              if (data) {\n                // Need to convert action.isArray to boolean in case it is undefined\n                // jshint -W018\n                if (angular.isArray(data) !== (!!action.isArray)) {\n                  throw $resourceMinErr('badcfg',\n                      'Error in resource configuration for action `{0}`. Expected response to ' +\n                      'contain an {1} but got an {2} (Request: {3} {4})', name, action.isArray ? 'array' : 'object',\n                    angular.isArray(data) ? 'array' : 'object', httpConfig.method, httpConfig.url);\n                }\n                // jshint +W018\n                if (action.isArray) {\n                  value.length = 0;\n                  forEach(data, function(item) {\n                    if (typeof item === \"object\") {\n                      value.push(new Resource(item));\n                    } else {\n                      // Valid JSON values may be string literals, and these should not be converted\n                      // into objects. These items will not have access to the Resource prototype\n                      // methods, but unfortunately there\n                      value.push(item);\n                    }\n                  });\n                } else {\n                  var promise = value.$promise;     // Save the promise\n                  shallowClearAndCopy(data, value);\n                  value.$promise = promise;         // Restore the promise\n                }\n              }\n              response.resource = value;\n\n              return response;\n            }, function(response) {\n              (error || noop)(response);\n              return $q.reject(response);\n            });\n\n            promise['finally'](function() {\n              value.$resolved = true;\n              if (!isInstanceCall && cancellable) {\n                value.$cancelRequest = angular.noop;\n                $timeout.cancel(numericTimeoutPromise);\n                timeoutDeferred = numericTimeoutPromise = httpConfig.timeout = null;\n              }\n            });\n\n            promise = promise.then(\n              function(response) {\n                var value = responseInterceptor(response);\n                (success || noop)(value, response.headers);\n                return value;\n              },\n              responseErrorInterceptor);\n\n            if (!isInstanceCall) {\n              // we are creating instance / collection\n              // - set the initial promise\n              // - return the instance / collection\n              value.$promise = promise;\n              value.$resolved = false;\n              if (cancellable) value.$cancelRequest = timeoutDeferred.resolve;\n\n              return value;\n            }\n\n            // instance call\n            return promise;\n          };\n\n\n          Resource.prototype['$' + name] = function(params, success, error) {\n            if (isFunction(params)) {\n              error = success; success = params; params = {};\n            }\n            var result = Resource[name].call(this, params, this, success, error);\n            return result.$promise || result;\n          };\n        });\n\n        Resource.bind = function(additionalParamDefaults) {\n          return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);\n        };\n\n        return Resource;\n      }\n\n      return resourceFactory;\n    }];\n  });\n\n\n})(window, window.angular);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/angular/angular-sanitize.js",
    "content": "/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sanitizeMinErr = angular.$$minErr('$sanitize');\n\n/**\n * @ngdoc module\n * @name ngSanitize\n * @description\n *\n * # ngSanitize\n *\n * The `ngSanitize` module provides functionality to sanitize HTML.\n *\n *\n * <div doc-module-components=\"ngSanitize\"></div>\n *\n * See {@link ngSanitize.$sanitize `$sanitize`} for usage.\n */\n\n/**\n * @ngdoc service\n * @name $sanitize\n * @kind function\n *\n * @description\n *   Sanitizes an html string by stripping all potentially dangerous tokens.\n *\n *   The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are\n *   then serialized back to properly escaped html string. This means that no unsafe input can make\n *   it into the returned string.\n *\n *   The whitelist for URL sanitization of attribute values is configured using the functions\n *   `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider\n *   `$compileProvider`}.\n *\n *   The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.\n *\n * @param {string} html HTML input.\n * @returns {string} Sanitized HTML.\n *\n * @example\n   <example module=\"sanitizeExample\" deps=\"angular-sanitize.js\">\n   <file name=\"index.html\">\n     <script>\n         angular.module('sanitizeExample', ['ngSanitize'])\n           .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {\n             $scope.snippet =\n               '<p style=\"color:blue\">an html\\n' +\n               '<em onmouseover=\"this.textContent=\\'PWN3D!\\'\">click here</em>\\n' +\n               'snippet</p>';\n             $scope.deliberatelyTrustDangerousSnippet = function() {\n               return $sce.trustAsHtml($scope.snippet);\n             };\n           }]);\n     </script>\n     <div ng-controller=\"ExampleController\">\n        Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <td>Directive</td>\n           <td>How</td>\n           <td>Source</td>\n           <td>Rendered</td>\n         </tr>\n         <tr id=\"bind-html-with-sanitize\">\n           <td>ng-bind-html</td>\n           <td>Automatically uses $sanitize</td>\n           <td><pre>&lt;div ng-bind-html=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind-html=\"snippet\"></div></td>\n         </tr>\n         <tr id=\"bind-html-with-trust\">\n           <td>ng-bind-html</td>\n           <td>Bypass $sanitize by explicitly trusting the dangerous value</td>\n           <td>\n           <pre>&lt;div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"&gt;\n&lt;/div&gt;</pre>\n           </td>\n           <td><div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"></div></td>\n         </tr>\n         <tr id=\"bind-default\">\n           <td>ng-bind</td>\n           <td>Automatically escapes</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n       </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should sanitize the html snippet by default', function() {\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('<p>an html\\n<em>click here</em>\\nsnippet</p>');\n     });\n\n     it('should inline raw snippet if bound to a trusted value', function() {\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).\n         toBe(\"<p style=\\\"color:blue\\\">an html\\n\" +\n              \"<em onmouseover=\\\"this.textContent='PWN3D!'\\\">click here</em>\\n\" +\n              \"snippet</p>\");\n     });\n\n     it('should escape snippet without any filter', function() {\n       expect(element(by.css('#bind-default div')).getInnerHtml()).\n         toBe(\"&lt;p style=\\\"color:blue\\\"&gt;an html\\n\" +\n              \"&lt;em onmouseover=\\\"this.textContent='PWN3D!'\\\"&gt;click here&lt;/em&gt;\\n\" +\n              \"snippet&lt;/p&gt;\");\n     });\n\n     it('should update', function() {\n       element(by.model('snippet')).clear();\n       element(by.model('snippet')).sendKeys('new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('new <b>text</b>');\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(\n         'new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(\n         \"new &lt;b onclick=\\\"alert(1)\\\"&gt;text&lt;/b&gt;\");\n     });\n   </file>\n   </example>\n */\n\n\n/**\n * @ngdoc provider\n * @name $sanitizeProvider\n *\n * @description\n * Creates and configures {@link $sanitize} instance.\n */\nfunction $SanitizeProvider() {\n  var svgEnabled = false;\n\n  this.$get = ['$$sanitizeUri', function($$sanitizeUri) {\n    if (svgEnabled) {\n      angular.extend(validElements, svgElements);\n    }\n    return function(html) {\n      var buf = [];\n      htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {\n        return !/^unsafe:/.test($$sanitizeUri(uri, isImage));\n      }));\n      return buf.join('');\n    };\n  }];\n\n\n  /**\n   * @ngdoc method\n   * @name $sanitizeProvider#enableSvg\n   * @kind function\n   *\n   * @description\n   * Enables a subset of svg to be supported by the sanitizer.\n   *\n   * <div class=\"alert alert-warning\">\n   *   <p>By enabling this setting without taking other precautions, you might expose your\n   *   application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned\n   *   outside of the containing element and be rendered over other elements on the page (e.g. a login\n   *   link). Such behavior can then result in phishing incidents.</p>\n   *\n   *   <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg\n   *   tags within the sanitized content:</p>\n   *\n   *   <br>\n   *\n   *   <pre><code>\n   *   .rootOfTheIncludedContent svg {\n   *     overflow: hidden !important;\n   *   }\n   *   </code></pre>\n   * </div>\n   *\n   * @param {boolean=} regexp New regexp to whitelist urls with.\n   * @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called\n   *    without an argument or self for chaining otherwise.\n   */\n  this.enableSvg = function(enableSvg) {\n    if (angular.isDefined(enableSvg)) {\n      svgEnabled = enableSvg;\n      return this;\n    } else {\n      return svgEnabled;\n    }\n  };\n}\n\nfunction sanitizeText(chars) {\n  var buf = [];\n  var writer = htmlSanitizeWriter(buf, angular.noop);\n  writer.chars(chars);\n  return buf.join('');\n}\n\n\n// Regular Expressions for parsing tags and attributes\nvar SURROGATE_PAIR_REGEXP = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n  // Match everything outside of normal chars and \" (quote character)\n  NON_ALPHANUMERIC_REGEXP = /([^\\#-~ |!])/g;\n\n\n// Good source of info about elements and attributes\n// http://dev.w3.org/html5/spec/Overview.html#semantics\n// http://simon.html5.org/html-elements\n\n// Safe Void Elements - HTML5\n// http://dev.w3.org/html5/spec/Overview.html#void-elements\nvar voidElements = toMap(\"area,br,col,hr,img,wbr\");\n\n// Elements that you can, intentionally, leave open (and which close themselves)\n// http://dev.w3.org/html5/spec/Overview.html#optional-tags\nvar optionalEndTagBlockElements = toMap(\"colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr\"),\n    optionalEndTagInlineElements = toMap(\"rp,rt\"),\n    optionalEndTagElements = angular.extend({},\n                                            optionalEndTagInlineElements,\n                                            optionalEndTagBlockElements);\n\n// Safe Block Elements - HTML5\nvar blockElements = angular.extend({}, optionalEndTagBlockElements, toMap(\"address,article,\" +\n        \"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,\" +\n        \"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul\"));\n\n// Inline Elements - HTML5\nvar inlineElements = angular.extend({}, optionalEndTagInlineElements, toMap(\"a,abbr,acronym,b,\" +\n        \"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,\" +\n        \"samp,small,span,strike,strong,sub,sup,time,tt,u,var\"));\n\n// SVG Elements\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements\n// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.\n// They can potentially allow for arbitrary javascript to be executed. See #11290\nvar svgElements = toMap(\"circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,\" +\n        \"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,\" +\n        \"radialGradient,rect,stop,svg,switch,text,title,tspan\");\n\n// Blocked Elements (will be stripped)\nvar blockedElements = toMap(\"script,style\");\n\nvar validElements = angular.extend({},\n                                   voidElements,\n                                   blockElements,\n                                   inlineElements,\n                                   optionalEndTagElements);\n\n//Attributes that have href and hence need to be sanitized\nvar uriAttrs = toMap(\"background,cite,href,longdesc,src,xlink:href\");\n\nvar htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +\n    'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +\n    'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +\n    'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +\n    'valign,value,vspace,width');\n\n// SVG attributes (without \"id\" and \"name\" attributes)\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes\nvar svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +\n    'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +\n    'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +\n    'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +\n    'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +\n    'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +\n    'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +\n    'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +\n    'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +\n    'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +\n    'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +\n    'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +\n    'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +\n    'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +\n    'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);\n\nvar validAttrs = angular.extend({},\n                                uriAttrs,\n                                svgAttrs,\n                                htmlAttrs);\n\nfunction toMap(str, lowercaseKeys) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) {\n    obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;\n  }\n  return obj;\n}\n\nvar inertBodyElement;\n(function(window) {\n  var doc;\n  if (window.document && window.document.implementation) {\n    doc = window.document.implementation.createHTMLDocument(\"inert\");\n  } else {\n    throw $sanitizeMinErr('noinert', \"Can't create an inert html document\");\n  }\n  var docElement = doc.documentElement || doc.getDocumentElement();\n  var bodyElements = docElement.getElementsByTagName('body');\n\n  // usually there should be only one body element in the document, but IE doesn't have any, so we need to create one\n  if (bodyElements.length === 1) {\n    inertBodyElement = bodyElements[0];\n  } else {\n    var html = doc.createElement('html');\n    inertBodyElement = doc.createElement('body');\n    html.appendChild(inertBodyElement);\n    doc.appendChild(html);\n  }\n})(window);\n\n/**\n * @example\n * htmlParser(htmlString, {\n *     start: function(tag, attrs) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * });\n *\n * @param {string} html string\n * @param {object} handler\n */\nfunction htmlParser(html, handler) {\n  if (html === null || html === undefined) {\n    html = '';\n  } else if (typeof html !== 'string') {\n    html = '' + html;\n  }\n  inertBodyElement.innerHTML = html;\n\n  //mXSS protection\n  var mXSSAttempts = 5;\n  do {\n    if (mXSSAttempts === 0) {\n      throw $sanitizeMinErr('uinput', \"Failed to sanitize html because the input is unstable\");\n    }\n    mXSSAttempts--;\n\n    // strip custom-namespaced attributes on IE<=11\n    if (document.documentMode <= 11) {\n      stripCustomNsAttrs(inertBodyElement);\n    }\n    html = inertBodyElement.innerHTML; //trigger mXSS\n    inertBodyElement.innerHTML = html;\n  } while (html !== inertBodyElement.innerHTML);\n\n  var node = inertBodyElement.firstChild;\n  while (node) {\n    switch (node.nodeType) {\n      case 1: // ELEMENT_NODE\n        handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));\n        break;\n      case 3: // TEXT NODE\n        handler.chars(node.textContent);\n        break;\n    }\n\n    var nextNode;\n    if (!(nextNode = node.firstChild)) {\n      if (node.nodeType == 1) {\n        handler.end(node.nodeName.toLowerCase());\n      }\n      nextNode = node.nextSibling;\n      if (!nextNode) {\n        while (nextNode == null) {\n          node = node.parentNode;\n          if (node === inertBodyElement) break;\n          nextNode = node.nextSibling;\n          if (node.nodeType == 1) {\n            handler.end(node.nodeName.toLowerCase());\n          }\n        }\n      }\n    }\n    node = nextNode;\n  }\n\n  while (node = inertBodyElement.firstChild) {\n    inertBodyElement.removeChild(node);\n  }\n}\n\nfunction attrToMap(attrs) {\n  var map = {};\n  for (var i = 0, ii = attrs.length; i < ii; i++) {\n    var attr = attrs[i];\n    map[attr.name] = attr.value;\n  }\n  return map;\n}\n\n\n/**\n * Escapes all potentially dangerous characters, so that the\n * resulting string can be safely inserted into attribute or\n * element text.\n * @param value\n * @returns {string} escaped text\n */\nfunction encodeEntities(value) {\n  return value.\n    replace(/&/g, '&amp;').\n    replace(SURROGATE_PAIR_REGEXP, function(value) {\n      var hi = value.charCodeAt(0);\n      var low = value.charCodeAt(1);\n      return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';\n    }).\n    replace(NON_ALPHANUMERIC_REGEXP, function(value) {\n      return '&#' + value.charCodeAt(0) + ';';\n    }).\n    replace(/</g, '&lt;').\n    replace(/>/g, '&gt;');\n}\n\n/**\n * create an HTML/XML writer which writes to buffer\n * @param {Array} buf use buf.join('') to get out sanitized html string\n * @returns {object} in the form of {\n *     start: function(tag, attrs) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * }\n */\nfunction htmlSanitizeWriter(buf, uriValidator) {\n  var ignoreCurrentElement = false;\n  var out = angular.bind(buf, buf.push);\n  return {\n    start: function(tag, attrs) {\n      tag = angular.lowercase(tag);\n      if (!ignoreCurrentElement && blockedElements[tag]) {\n        ignoreCurrentElement = tag;\n      }\n      if (!ignoreCurrentElement && validElements[tag] === true) {\n        out('<');\n        out(tag);\n        angular.forEach(attrs, function(value, key) {\n          var lkey=angular.lowercase(key);\n          var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');\n          if (validAttrs[lkey] === true &&\n            (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {\n            out(' ');\n            out(key);\n            out('=\"');\n            out(encodeEntities(value));\n            out('\"');\n          }\n        });\n        out('>');\n      }\n    },\n    end: function(tag) {\n      tag = angular.lowercase(tag);\n      if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {\n        out('</');\n        out(tag);\n        out('>');\n      }\n      if (tag == ignoreCurrentElement) {\n        ignoreCurrentElement = false;\n      }\n    },\n    chars: function(chars) {\n      if (!ignoreCurrentElement) {\n        out(encodeEntities(chars));\n      }\n    }\n  };\n}\n\n\n/**\n * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare\n * ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want\n * to allow any of these custom attributes. This method strips them all.\n *\n * @param node Root element to process\n */\nfunction stripCustomNsAttrs(node) {\n  if (node.nodeType === Node.ELEMENT_NODE) {\n    var attrs = node.attributes;\n    for (var i = 0, l = attrs.length; i < l; i++) {\n      var attrNode = attrs[i];\n      var attrName = attrNode.name.toLowerCase();\n      if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {\n        node.removeAttributeNode(attrNode);\n        i--;\n        l--;\n      }\n    }\n  }\n\n  var nextNode = node.firstChild;\n  if (nextNode) {\n    stripCustomNsAttrs(nextNode);\n  }\n\n  nextNode = node.nextSibling;\n  if (nextNode) {\n    stripCustomNsAttrs(nextNode);\n  }\n}\n\n\n\n// define ngSanitize module and register $sanitize service\nangular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);\n\n/* global sanitizeText: false */\n\n/**\n * @ngdoc filter\n * @name linky\n * @kind function\n *\n * @description\n * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and\n * plain email address links.\n *\n * Requires the {@link ngSanitize `ngSanitize`} module to be installed.\n *\n * @param {string} text Input text.\n * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.\n * @param {object|function(url)} [attributes] Add custom attributes to the link element.\n *\n *    Can be one of:\n *\n *    - `object`: A map of attributes\n *    - `function`: Takes the url as a parameter and returns a map of attributes\n *\n *    If the map of attributes contains a value for `target`, it overrides the value of\n *    the target parameter.\n *\n *\n * @returns {string} Html-linkified and {@link $sanitize sanitized} text.\n *\n * @usage\n   <span ng-bind-html=\"linky_expression | linky\"></span>\n *\n * @example\n   <example module=\"linkyExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n       Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <th>Filter</th>\n           <th>Source</th>\n           <th>Rendered</th>\n         </tr>\n         <tr id=\"linky-filter\">\n           <td>linky filter</td>\n           <td>\n             <pre>&lt;div ng-bind-html=\"snippet | linky\"&gt;<br>&lt;/div&gt;</pre>\n           </td>\n           <td>\n             <div ng-bind-html=\"snippet | linky\"></div>\n           </td>\n         </tr>\n         <tr id=\"linky-target\">\n          <td>linky target</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithSingleURL | linky:'_blank'\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithSingleURL | linky:'_blank'\"></div>\n          </td>\n         </tr>\n         <tr id=\"linky-custom-attributes\">\n          <td>linky custom attributes</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\"></div>\n          </td>\n         </tr>\n         <tr id=\"escaped-html\">\n           <td>no filter</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"script.js\">\n       angular.module('linkyExample', ['ngSanitize'])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.snippet =\n             'Pretty text with some links:\\n'+\n             'http://angularjs.org/,\\n'+\n             'mailto:us@somewhere.org,\\n'+\n             'another@somewhere.org,\\n'+\n             'and one more: ftp://127.0.0.1/.';\n           $scope.snippetWithSingleURL = 'http://angularjs.org/';\n         }]);\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should linkify the snippet with urls', function() {\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);\n       });\n\n       it('should not linkify snippet without the linky filter', function() {\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);\n       });\n\n       it('should update', function() {\n         element(by.model('snippet')).clear();\n         element(by.model('snippet')).sendKeys('new http://link.');\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('new http://link.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())\n             .toBe('new http://link.');\n       });\n\n       it('should work with the target property', function() {\n        expect(element(by.id('linky-target')).\n            element(by.binding(\"snippetWithSingleURL | linky:'_blank'\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');\n       });\n\n       it('should optionally add custom attributes', function() {\n        expect(element(by.id('linky-custom-attributes')).\n            element(by.binding(\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');\n       });\n     </file>\n   </example>\n */\nangular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {\n  var LINKY_URL_REGEXP =\n        /((ftp|https?):\\/\\/|(www\\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\\S*[^\\s.;,(){}<>\"\\u201d\\u2019]/i,\n      MAILTO_REGEXP = /^mailto:/i;\n\n  var linkyMinErr = angular.$$minErr('linky');\n  var isString = angular.isString;\n\n  return function(text, target, attributes) {\n    if (text == null || text === '') return text;\n    if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);\n\n    var match;\n    var raw = text;\n    var html = [];\n    var url;\n    var i;\n    while ((match = raw.match(LINKY_URL_REGEXP))) {\n      // We can not end in these as they are sometimes found at the end of the sentence\n      url = match[0];\n      // if we did not match ftp/http/www/mailto then assume mailto\n      if (!match[2] && !match[4]) {\n        url = (match[3] ? 'http://' : 'mailto:') + url;\n      }\n      i = match.index;\n      addText(raw.substr(0, i));\n      addLink(url, match[0].replace(MAILTO_REGEXP, ''));\n      raw = raw.substring(i + match[0].length);\n    }\n    addText(raw);\n    return $sanitize(html.join(''));\n\n    function addText(text) {\n      if (!text) {\n        return;\n      }\n      html.push(sanitizeText(text));\n    }\n\n    function addLink(url, text) {\n      var key;\n      html.push('<a ');\n      if (angular.isFunction(attributes)) {\n        attributes = attributes(url);\n      }\n      if (angular.isObject(attributes)) {\n        for (key in attributes) {\n          html.push(key + '=\"' + attributes[key] + '\" ');\n        }\n      } else {\n        attributes = {};\n      }\n      if (angular.isDefined(target) && !('target' in attributes)) {\n        html.push('target=\"',\n                  target,\n                  '\" ');\n      }\n      html.push('href=\"',\n                url.replace(/\"/g, '&quot;'),\n                '\">');\n      addText(text);\n      html.push('</a>');\n    }\n  };\n}]);\n\n\n})(window, window.angular);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/angular/angular.js",
    "content": "/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, document, undefined) {'use strict';\n\n/**\n * @description\n *\n * This object provides a utility for producing rich Error messages within\n * Angular. It can be called as follows:\n *\n * var exampleMinErr = minErr('example');\n * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);\n *\n * The above creates an instance of minErr in the example namespace. The\n * resulting error will have a namespaced error code of example.one.  The\n * resulting error will replace {0} with the value of foo, and {1} with the\n * value of bar. The object is not restricted in the number of arguments it can\n * take.\n *\n * If fewer arguments are specified than necessary for interpolation, the extra\n * interpolation markers will be preserved in the final string.\n *\n * Since data will be parsed statically during a build step, some restrictions\n * are applied with respect to how minErr instances are created and called.\n * Instances should have names of the form namespaceMinErr for a minErr created\n * using minErr('namespace') . Error codes, namespaces and template strings\n * should all be static strings, not variables or general expressions.\n *\n * @param {string} module The namespace to use for the new minErr instance.\n * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning\n *   error from returned function, for cases when a particular type of error is useful.\n * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance\n */\n\nfunction minErr(module, ErrorConstructor) {\n  ErrorConstructor = ErrorConstructor || Error;\n  return function() {\n    var SKIP_INDEXES = 2;\n\n    var templateArgs = arguments,\n      code = templateArgs[0],\n      message = '[' + (module ? module + ':' : '') + code + '] ',\n      template = templateArgs[1],\n      paramPrefix, i;\n\n    message += template.replace(/\\{\\d+\\}/g, function(match) {\n      var index = +match.slice(1, -1),\n        shiftedIndex = index + SKIP_INDEXES;\n\n      if (shiftedIndex < templateArgs.length) {\n        return toDebugString(templateArgs[shiftedIndex]);\n      }\n\n      return match;\n    });\n\n    message += '\\nhttp://errors.angularjs.org/1.5.3/' +\n      (module ? module + '/' : '') + code;\n\n    for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {\n      message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +\n        encodeURIComponent(toDebugString(templateArgs[i]));\n    }\n\n    return new ErrorConstructor(message);\n  };\n}\n\n/* We need to tell jshint what variables are being exported */\n/* global angular: true,\n  msie: true,\n  jqLite: true,\n  jQuery: true,\n  slice: true,\n  splice: true,\n  push: true,\n  toString: true,\n  ngMinErr: true,\n  angularModule: true,\n  uid: true,\n  REGEX_STRING_REGEXP: true,\n  VALIDITY_STATE_PROPERTY: true,\n\n  lowercase: true,\n  uppercase: true,\n  manualLowercase: true,\n  manualUppercase: true,\n  nodeName_: true,\n  isArrayLike: true,\n  forEach: true,\n  forEachSorted: true,\n  reverseParams: true,\n  nextUid: true,\n  setHashKey: true,\n  extend: true,\n  toInt: true,\n  inherit: true,\n  merge: true,\n  noop: true,\n  identity: true,\n  valueFn: true,\n  isUndefined: true,\n  isDefined: true,\n  isObject: true,\n  isBlankObject: true,\n  isString: true,\n  isNumber: true,\n  isDate: true,\n  isArray: true,\n  isFunction: true,\n  isRegExp: true,\n  isWindow: true,\n  isScope: true,\n  isFile: true,\n  isFormData: true,\n  isBlob: true,\n  isBoolean: true,\n  isPromiseLike: true,\n  trim: true,\n  escapeForRegexp: true,\n  isElement: true,\n  makeMap: true,\n  includes: true,\n  arrayRemove: true,\n  copy: true,\n  shallowCopy: true,\n  equals: true,\n  csp: true,\n  jq: true,\n  concat: true,\n  sliceArgs: true,\n  bind: true,\n  toJsonReplacer: true,\n  toJson: true,\n  fromJson: true,\n  convertTimezoneToLocal: true,\n  timezoneToOffset: true,\n  startingTag: true,\n  tryDecodeURIComponent: true,\n  parseKeyValue: true,\n  toKeyValue: true,\n  encodeUriSegment: true,\n  encodeUriQuery: true,\n  angularInit: true,\n  bootstrap: true,\n  getTestability: true,\n  snake_case: true,\n  bindJQuery: true,\n  assertArg: true,\n  assertArgFn: true,\n  assertNotHasOwnProperty: true,\n  getter: true,\n  getBlockNodes: true,\n  hasOwnProperty: true,\n  createMap: true,\n\n  NODE_TYPE_ELEMENT: true,\n  NODE_TYPE_ATTRIBUTE: true,\n  NODE_TYPE_TEXT: true,\n  NODE_TYPE_COMMENT: true,\n  NODE_TYPE_DOCUMENT: true,\n  NODE_TYPE_DOCUMENT_FRAGMENT: true,\n*/\n\n////////////////////////////////////\n\n/**\n * @ngdoc module\n * @name ng\n * @module ng\n * @description\n *\n * # ng (core module)\n * The ng module is loaded by default when an AngularJS application is started. The module itself\n * contains the essential components for an AngularJS application to function. The table below\n * lists a high level breakdown of each of the services/factories, filters, directives and testing\n * components available within this core module.\n *\n * <div doc-module-components=\"ng\"></div>\n */\n\nvar REGEX_STRING_REGEXP = /^\\/(.+)\\/([a-z]*)$/;\n\n// The name of a form control's ValidityState property.\n// This is used so that it's possible for internal tests to create mock ValidityStates.\nvar VALIDITY_STATE_PROPERTY = 'validity';\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};\nvar uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};\n\n\nvar manualLowercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})\n      : s;\n};\nvar manualUppercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})\n      : s;\n};\n\n\n// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish\n// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods\n// with correct but slower alternatives. See https://github.com/angular/angular.js/issues/11387\nif ('i' !== 'I'.toLowerCase()) {\n  lowercase = manualLowercase;\n  uppercase = manualUppercase;\n}\n\n\nvar\n    msie,             // holds major version number for IE, or NaN if UA is not IE.\n    jqLite,           // delay binding since jQuery could be loaded after us.\n    jQuery,           // delay binding\n    slice             = [].slice,\n    splice            = [].splice,\n    push              = [].push,\n    toString          = Object.prototype.toString,\n    getPrototypeOf    = Object.getPrototypeOf,\n    ngMinErr          = minErr('ng'),\n\n    /** @name angular */\n    angular           = window.angular || (window.angular = {}),\n    angularModule,\n    uid               = 0;\n\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nmsie = document.documentMode;\n\n\n/**\n * @private\n * @param {*} obj\n * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,\n *                   String ...)\n */\nfunction isArrayLike(obj) {\n\n  // `null`, `undefined` and `window` are not array-like\n  if (obj == null || isWindow(obj)) return false;\n\n  // arrays, strings and jQuery/jqLite objects are array like\n  // * jqLite is either the jQuery or jqLite constructor function\n  // * we have to check the existence of jqLite first as this method is called\n  //   via the forEach method when constructing the jqLite object in the first place\n  if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;\n\n  // Support: iOS 8.2 (not reproducible in simulator)\n  // \"length\" in obj used to prevent JIT error (gh-11508)\n  var length = \"length\" in Object(obj) && obj.length;\n\n  // NodeList objects (with `item` method) and\n  // other objects with suitable length characteristics are array-like\n  return isNumber(length) &&\n    (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');\n\n}\n\n/**\n * @ngdoc function\n * @name angular.forEach\n * @module ng\n * @kind function\n *\n * @description\n * Invokes the `iterator` function once for each item in `obj` collection, which can be either an\n * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`\n * is the value of an object property or an array element, `key` is the object property key or\n * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.\n *\n * It is worth noting that `.forEach` does not iterate over inherited properties because it filters\n * using the `hasOwnProperty` method.\n *\n * Unlike ES262's\n * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),\n * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just\n * return the value provided.\n *\n   ```js\n     var values = {name: 'misko', gender: 'male'};\n     var log = [];\n     angular.forEach(values, function(value, key) {\n       this.push(key + ': ' + value);\n     }, log);\n     expect(log).toEqual(['name: misko', 'gender: male']);\n   ```\n *\n * @param {Object|Array} obj Object to iterate over.\n * @param {Function} iterator Iterator function.\n * @param {Object=} context Object to become context (`this`) for the iterator function.\n * @returns {Object|Array} Reference to `obj`.\n */\n\nfunction forEach(obj, iterator, context) {\n  var key, length;\n  if (obj) {\n    if (isFunction(obj)) {\n      for (key in obj) {\n        // Need to check if hasOwnProperty exists,\n        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else if (isArray(obj) || isArrayLike(obj)) {\n      var isPrimitive = typeof obj !== 'object';\n      for (key = 0, length = obj.length; key < length; key++) {\n        if (isPrimitive || key in obj) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else if (obj.forEach && obj.forEach !== forEach) {\n        obj.forEach(iterator, context, obj);\n    } else if (isBlankObject(obj)) {\n      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n      for (key in obj) {\n        iterator.call(context, obj[key], key, obj);\n      }\n    } else if (typeof obj.hasOwnProperty === 'function') {\n      // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed\n      for (key in obj) {\n        if (obj.hasOwnProperty(key)) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else {\n      // Slow path for objects which do not have a method `hasOwnProperty`\n      for (key in obj) {\n        if (hasOwnProperty.call(obj, key)) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    }\n  }\n  return obj;\n}\n\nfunction forEachSorted(obj, iterator, context) {\n  var keys = Object.keys(obj).sort();\n  for (var i = 0; i < keys.length; i++) {\n    iterator.call(context, obj[keys[i]], keys[i]);\n  }\n  return keys;\n}\n\n\n/**\n * when using forEach the params are value, key, but it is often useful to have key, value.\n * @param {function(string, *)} iteratorFn\n * @returns {function(*, string)}\n */\nfunction reverseParams(iteratorFn) {\n  return function(value, key) {iteratorFn(key, value);};\n}\n\n/**\n * A consistent way of creating unique IDs in angular.\n *\n * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before\n * we hit number precision issues in JavaScript.\n *\n * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M\n *\n * @returns {number} an unique alpha-numeric string\n */\nfunction nextUid() {\n  return ++uid;\n}\n\n\n/**\n * Set or clear the hashkey for an object.\n * @param obj object\n * @param h the hashkey (!truthy to delete the hashkey)\n */\nfunction setHashKey(obj, h) {\n  if (h) {\n    obj.$$hashKey = h;\n  } else {\n    delete obj.$$hashKey;\n  }\n}\n\n\nfunction baseExtend(dst, objs, deep) {\n  var h = dst.$$hashKey;\n\n  for (var i = 0, ii = objs.length; i < ii; ++i) {\n    var obj = objs[i];\n    if (!isObject(obj) && !isFunction(obj)) continue;\n    var keys = Object.keys(obj);\n    for (var j = 0, jj = keys.length; j < jj; j++) {\n      var key = keys[j];\n      var src = obj[key];\n\n      if (deep && isObject(src)) {\n        if (isDate(src)) {\n          dst[key] = new Date(src.valueOf());\n        } else if (isRegExp(src)) {\n          dst[key] = new RegExp(src);\n        } else if (src.nodeName) {\n          dst[key] = src.cloneNode(true);\n        } else if (isElement(src)) {\n          dst[key] = src.clone();\n        } else {\n          if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};\n          baseExtend(dst[key], [src], true);\n        }\n      } else {\n        dst[key] = src;\n      }\n    }\n  }\n\n  setHashKey(dst, h);\n  return dst;\n}\n\n/**\n * @ngdoc function\n * @name angular.extend\n * @module ng\n * @kind function\n *\n * @description\n * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.\n *\n * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use\n * {@link angular.merge} for this.\n *\n * @param {Object} dst Destination object.\n * @param {...Object} src Source object(s).\n * @returns {Object} Reference to `dst`.\n */\nfunction extend(dst) {\n  return baseExtend(dst, slice.call(arguments, 1), false);\n}\n\n\n/**\n* @ngdoc function\n* @name angular.merge\n* @module ng\n* @kind function\n*\n* @description\n* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.\n*\n* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source\n* objects, performing a deep copy.\n*\n* @param {Object} dst Destination object.\n* @param {...Object} src Source object(s).\n* @returns {Object} Reference to `dst`.\n*/\nfunction merge(dst) {\n  return baseExtend(dst, slice.call(arguments, 1), true);\n}\n\n\n\nfunction toInt(str) {\n  return parseInt(str, 10);\n}\n\n\nfunction inherit(parent, extra) {\n  return extend(Object.create(parent), extra);\n}\n\n/**\n * @ngdoc function\n * @name angular.noop\n * @module ng\n * @kind function\n *\n * @description\n * A function that performs no operations. This function can be useful when writing code in the\n * functional style.\n   ```js\n     function foo(callback) {\n       var result = calculateResult();\n       (callback || angular.noop)(result);\n     }\n   ```\n */\nfunction noop() {}\nnoop.$inject = [];\n\n\n/**\n * @ngdoc function\n * @name angular.identity\n * @module ng\n * @kind function\n *\n * @description\n * A function that returns its first argument. This function is useful when writing code in the\n * functional style.\n *\n   ```js\n     function transformer(transformationFn, value) {\n       return (transformationFn || angular.identity)(value);\n     };\n   ```\n  * @param {*} value to be returned.\n  * @returns {*} the value passed in.\n */\nfunction identity($) {return $;}\nidentity.$inject = [];\n\n\nfunction valueFn(value) {return function valueRef() {return value;};}\n\nfunction hasCustomToString(obj) {\n  return isFunction(obj.toString) && obj.toString !== toString;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isUndefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is undefined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is undefined.\n */\nfunction isUndefined(value) {return typeof value === 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is defined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is defined.\n */\nfunction isDefined(value) {return typeof value !== 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isObject\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not\n * considered to be objects. Note that JavaScript arrays are objects.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Object` but not `null`.\n */\nfunction isObject(value) {\n  // http://jsperf.com/isobject4\n  return value !== null && typeof value === 'object';\n}\n\n\n/**\n * Determine if a value is an object with a null prototype\n *\n * @returns {boolean} True if `value` is an `Object` with a null prototype\n */\nfunction isBlankObject(value) {\n  return value !== null && typeof value === 'object' && !getPrototypeOf(value);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isString\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `String`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `String`.\n */\nfunction isString(value) {return typeof value === 'string';}\n\n\n/**\n * @ngdoc function\n * @name angular.isNumber\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Number`.\n *\n * This includes the \"special\" numbers `NaN`, `+Infinity` and `-Infinity`.\n *\n * If you wish to exclude these then you can use the native\n * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)\n * method.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Number`.\n */\nfunction isNumber(value) {return typeof value === 'number';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDate\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a value is a date.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Date`.\n */\nfunction isDate(value) {\n  return toString.call(value) === '[object Date]';\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isArray\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Array`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Array`.\n */\nvar isArray = Array.isArray;\n\n/**\n * @ngdoc function\n * @name angular.isFunction\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Function`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Function`.\n */\nfunction isFunction(value) {return typeof value === 'function';}\n\n\n/**\n * Determines if a value is a regular expression object.\n *\n * @private\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `RegExp`.\n */\nfunction isRegExp(value) {\n  return toString.call(value) === '[object RegExp]';\n}\n\n\n/**\n * Checks if `obj` is a window object.\n *\n * @private\n * @param {*} obj Object to check\n * @returns {boolean} True if `obj` is a window obj.\n */\nfunction isWindow(obj) {\n  return obj && obj.window === obj;\n}\n\n\nfunction isScope(obj) {\n  return obj && obj.$evalAsync && obj.$watch;\n}\n\n\nfunction isFile(obj) {\n  return toString.call(obj) === '[object File]';\n}\n\n\nfunction isFormData(obj) {\n  return toString.call(obj) === '[object FormData]';\n}\n\n\nfunction isBlob(obj) {\n  return toString.call(obj) === '[object Blob]';\n}\n\n\nfunction isBoolean(value) {\n  return typeof value === 'boolean';\n}\n\n\nfunction isPromiseLike(obj) {\n  return obj && isFunction(obj.then);\n}\n\n\nvar TYPED_ARRAY_REGEXP = /^\\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\\]$/;\nfunction isTypedArray(value) {\n  return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));\n}\n\nfunction isArrayBuffer(obj) {\n  return toString.call(obj) === '[object ArrayBuffer]';\n}\n\n\nvar trim = function(value) {\n  return isString(value) ? value.trim() : value;\n};\n\n// Copied from:\n// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021\n// Prereq: s is a string.\nvar escapeForRegexp = function(s) {\n  return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1').\n           replace(/\\x08/g, '\\\\x08');\n};\n\n\n/**\n * @ngdoc function\n * @name angular.isElement\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a DOM element (or wrapped jQuery element).\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).\n */\nfunction isElement(node) {\n  return !!(node &&\n    (node.nodeName  // we are a direct element\n    || (node.prop && node.attr && node.find)));  // we have an on and find method part of jQuery API\n}\n\n/**\n * @param str 'key1,key2,...'\n * @returns {object} in the form of {key1:true, key2:true, ...}\n */\nfunction makeMap(str) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) {\n    obj[items[i]] = true;\n  }\n  return obj;\n}\n\n\nfunction nodeName_(element) {\n  return lowercase(element.nodeName || (element[0] && element[0].nodeName));\n}\n\nfunction includes(array, obj) {\n  return Array.prototype.indexOf.call(array, obj) != -1;\n}\n\nfunction arrayRemove(array, value) {\n  var index = array.indexOf(value);\n  if (index >= 0) {\n    array.splice(index, 1);\n  }\n  return index;\n}\n\n/**\n * @ngdoc function\n * @name angular.copy\n * @module ng\n * @kind function\n *\n * @description\n * Creates a deep copy of `source`, which should be an object or an array.\n *\n * * If no destination is supplied, a copy of the object or array is created.\n * * If a destination is provided, all of its elements (for arrays) or properties (for objects)\n *   are deleted and then all elements/properties from the source are copied to it.\n * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.\n * * If `source` is identical to 'destination' an exception will be thrown.\n *\n * @param {*} source The source that will be used to make a copy.\n *                   Can be any type, including primitives, `null`, and `undefined`.\n * @param {(Object|Array)=} destination Destination into which the source is copied. If\n *     provided, must be of the same type as `source`.\n * @returns {*} The copy or updated `destination`, if `destination` was specified.\n *\n * @example\n <example module=\"copyExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form novalidate class=\"simple-form\">\n Name: <input type=\"text\" ng-model=\"user.name\" /><br />\n E-mail: <input type=\"email\" ng-model=\"user.email\" /><br />\n Gender: <input type=\"radio\" ng-model=\"user.gender\" value=\"male\" />male\n <input type=\"radio\" ng-model=\"user.gender\" value=\"female\" />female<br />\n <button ng-click=\"reset()\">RESET</button>\n <button ng-click=\"update(user)\">SAVE</button>\n </form>\n <pre>form = {{user | json}}</pre>\n <pre>master = {{master | json}}</pre>\n </div>\n\n <script>\n  angular.module('copyExample', [])\n    .controller('ExampleController', ['$scope', function($scope) {\n      $scope.master= {};\n\n      $scope.update = function(user) {\n        // Example with 1 argument\n        $scope.master= angular.copy(user);\n      };\n\n      $scope.reset = function() {\n        // Example with 2 arguments\n        angular.copy($scope.master, $scope.user);\n      };\n\n      $scope.reset();\n    }]);\n </script>\n </file>\n </example>\n */\nfunction copy(source, destination) {\n  var stackSource = [];\n  var stackDest = [];\n\n  if (destination) {\n    if (isTypedArray(destination) || isArrayBuffer(destination)) {\n      throw ngMinErr('cpta', \"Can't copy! TypedArray destination cannot be mutated.\");\n    }\n    if (source === destination) {\n      throw ngMinErr('cpi', \"Can't copy! Source and destination are identical.\");\n    }\n\n    // Empty the destination object\n    if (isArray(destination)) {\n      destination.length = 0;\n    } else {\n      forEach(destination, function(value, key) {\n        if (key !== '$$hashKey') {\n          delete destination[key];\n        }\n      });\n    }\n\n    stackSource.push(source);\n    stackDest.push(destination);\n    return copyRecurse(source, destination);\n  }\n\n  return copyElement(source);\n\n  function copyRecurse(source, destination) {\n    var h = destination.$$hashKey;\n    var key;\n    if (isArray(source)) {\n      for (var i = 0, ii = source.length; i < ii; i++) {\n        destination.push(copyElement(source[i]));\n      }\n    } else if (isBlankObject(source)) {\n      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n      for (key in source) {\n        destination[key] = copyElement(source[key]);\n      }\n    } else if (source && typeof source.hasOwnProperty === 'function') {\n      // Slow path, which must rely on hasOwnProperty\n      for (key in source) {\n        if (source.hasOwnProperty(key)) {\n          destination[key] = copyElement(source[key]);\n        }\n      }\n    } else {\n      // Slowest path --- hasOwnProperty can't be called as a method\n      for (key in source) {\n        if (hasOwnProperty.call(source, key)) {\n          destination[key] = copyElement(source[key]);\n        }\n      }\n    }\n    setHashKey(destination, h);\n    return destination;\n  }\n\n  function copyElement(source) {\n    // Simple values\n    if (!isObject(source)) {\n      return source;\n    }\n\n    // Already copied values\n    var index = stackSource.indexOf(source);\n    if (index !== -1) {\n      return stackDest[index];\n    }\n\n    if (isWindow(source) || isScope(source)) {\n      throw ngMinErr('cpws',\n        \"Can't copy! Making copies of Window or Scope instances is not supported.\");\n    }\n\n    var needsRecurse = false;\n    var destination = copyType(source);\n\n    if (destination === undefined) {\n      destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));\n      needsRecurse = true;\n    }\n\n    stackSource.push(source);\n    stackDest.push(destination);\n\n    return needsRecurse\n      ? copyRecurse(source, destination)\n      : destination;\n  }\n\n  function copyType(source) {\n    switch (toString.call(source)) {\n      case '[object Int8Array]':\n      case '[object Int16Array]':\n      case '[object Int32Array]':\n      case '[object Float32Array]':\n      case '[object Float64Array]':\n      case '[object Uint8Array]':\n      case '[object Uint8ClampedArray]':\n      case '[object Uint16Array]':\n      case '[object Uint32Array]':\n        return new source.constructor(copyElement(source.buffer));\n\n      case '[object ArrayBuffer]':\n        //Support: IE10\n        if (!source.slice) {\n          var copied = new ArrayBuffer(source.byteLength);\n          new Uint8Array(copied).set(new Uint8Array(source));\n          return copied;\n        }\n        return source.slice(0);\n\n      case '[object Boolean]':\n      case '[object Number]':\n      case '[object String]':\n      case '[object Date]':\n        return new source.constructor(source.valueOf());\n\n      case '[object RegExp]':\n        var re = new RegExp(source.source, source.toString().match(/[^\\/]*$/)[0]);\n        re.lastIndex = source.lastIndex;\n        return re;\n\n      case '[object Blob]':\n        return new source.constructor([source], {type: source.type});\n    }\n\n    if (isFunction(source.cloneNode)) {\n      return source.cloneNode(true);\n    }\n  }\n}\n\n/**\n * Creates a shallow copy of an object, an array or a primitive.\n *\n * Assumes that there are no proto properties for objects.\n */\nfunction shallowCopy(src, dst) {\n  if (isArray(src)) {\n    dst = dst || [];\n\n    for (var i = 0, ii = src.length; i < ii; i++) {\n      dst[i] = src[i];\n    }\n  } else if (isObject(src)) {\n    dst = dst || {};\n\n    for (var key in src) {\n      if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {\n        dst[key] = src[key];\n      }\n    }\n  }\n\n  return dst || src;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.equals\n * @module ng\n * @kind function\n *\n * @description\n * Determines if two objects or two values are equivalent. Supports value types, regular\n * expressions, arrays and objects.\n *\n * Two objects or values are considered equivalent if at least one of the following is true:\n *\n * * Both objects or values pass `===` comparison.\n * * Both objects or values are of the same type and all of their properties are equal by\n *   comparing them with `angular.equals`.\n * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)\n * * Both values represent the same regular expression (In JavaScript,\n *   /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual\n *   representation matches).\n *\n * During a property comparison, properties of `function` type and properties with names\n * that begin with `$` are ignored.\n *\n * Scope and DOMWindow objects are being compared only by identify (`===`).\n *\n * @param {*} o1 Object or value to compare.\n * @param {*} o2 Object or value to compare.\n * @returns {boolean} True if arguments are equal.\n */\nfunction equals(o1, o2) {\n  if (o1 === o2) return true;\n  if (o1 === null || o2 === null) return false;\n  if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n  var t1 = typeof o1, t2 = typeof o2, length, key, keySet;\n  if (t1 == t2 && t1 == 'object') {\n    if (isArray(o1)) {\n      if (!isArray(o2)) return false;\n      if ((length = o1.length) == o2.length) {\n        for (key = 0; key < length; key++) {\n          if (!equals(o1[key], o2[key])) return false;\n        }\n        return true;\n      }\n    } else if (isDate(o1)) {\n      if (!isDate(o2)) return false;\n      return equals(o1.getTime(), o2.getTime());\n    } else if (isRegExp(o1)) {\n      if (!isRegExp(o2)) return false;\n      return o1.toString() == o2.toString();\n    } else {\n      if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||\n        isArray(o2) || isDate(o2) || isRegExp(o2)) return false;\n      keySet = createMap();\n      for (key in o1) {\n        if (key.charAt(0) === '$' || isFunction(o1[key])) continue;\n        if (!equals(o1[key], o2[key])) return false;\n        keySet[key] = true;\n      }\n      for (key in o2) {\n        if (!(key in keySet) &&\n            key.charAt(0) !== '$' &&\n            isDefined(o2[key]) &&\n            !isFunction(o2[key])) return false;\n      }\n      return true;\n    }\n  }\n  return false;\n}\n\nvar csp = function() {\n  if (!isDefined(csp.rules)) {\n\n\n    var ngCspElement = (document.querySelector('[ng-csp]') ||\n                    document.querySelector('[data-ng-csp]'));\n\n    if (ngCspElement) {\n      var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||\n                    ngCspElement.getAttribute('data-ng-csp');\n      csp.rules = {\n        noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),\n        noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)\n      };\n    } else {\n      csp.rules = {\n        noUnsafeEval: noUnsafeEval(),\n        noInlineStyle: false\n      };\n    }\n  }\n\n  return csp.rules;\n\n  function noUnsafeEval() {\n    try {\n      /* jshint -W031, -W054 */\n      new Function('');\n      /* jshint +W031, +W054 */\n      return false;\n    } catch (e) {\n      return true;\n    }\n  }\n};\n\n/**\n * @ngdoc directive\n * @module ng\n * @name ngJq\n *\n * @element ANY\n * @param {string=} ngJq the name of the library available under `window`\n * to be used for angular.element\n * @description\n * Use this directive to force the angular.element library.  This should be\n * used to force either jqLite by leaving ng-jq blank or setting the name of\n * the jquery variable under window (eg. jQuery).\n *\n * Since angular looks for this directive when it is loaded (doesn't wait for the\n * DOMContentLoaded event), it must be placed on an element that comes before the script\n * which loads angular. Also, only the first instance of `ng-jq` will be used and all\n * others ignored.\n *\n * @example\n * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.\n ```html\n <!doctype html>\n <html ng-app ng-jq>\n ...\n ...\n </html>\n ```\n * @example\n * This example shows how to use a jQuery based library of a different name.\n * The library name must be available at the top most 'window'.\n ```html\n <!doctype html>\n <html ng-app ng-jq=\"jQueryLib\">\n ...\n ...\n </html>\n ```\n */\nvar jq = function() {\n  if (isDefined(jq.name_)) return jq.name_;\n  var el;\n  var i, ii = ngAttrPrefixes.length, prefix, name;\n  for (i = 0; i < ii; ++i) {\n    prefix = ngAttrPrefixes[i];\n    if (el = document.querySelector('[' + prefix.replace(':', '\\\\:') + 'jq]')) {\n      name = el.getAttribute(prefix + 'jq');\n      break;\n    }\n  }\n\n  return (jq.name_ = name);\n};\n\nfunction concat(array1, array2, index) {\n  return array1.concat(slice.call(array2, index));\n}\n\nfunction sliceArgs(args, startIndex) {\n  return slice.call(args, startIndex || 0);\n}\n\n\n/* jshint -W101 */\n/**\n * @ngdoc function\n * @name angular.bind\n * @module ng\n * @kind function\n *\n * @description\n * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for\n * `fn`). You can supply optional `args` that are prebound to the function. This feature is also\n * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as\n * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).\n *\n * @param {Object} self Context which `fn` should be evaluated in.\n * @param {function()} fn Function to be bound.\n * @param {...*} args Optional arguments to be prebound to the `fn` function call.\n * @returns {function()} Function that wraps the `fn` with all the specified bindings.\n */\n/* jshint +W101 */\nfunction bind(self, fn) {\n  var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];\n  if (isFunction(fn) && !(fn instanceof RegExp)) {\n    return curryArgs.length\n      ? function() {\n          return arguments.length\n            ? fn.apply(self, concat(curryArgs, arguments, 0))\n            : fn.apply(self, curryArgs);\n        }\n      : function() {\n          return arguments.length\n            ? fn.apply(self, arguments)\n            : fn.call(self);\n        };\n  } else {\n    // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)\n    return fn;\n  }\n}\n\n\nfunction toJsonReplacer(key, value) {\n  var val = value;\n\n  if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {\n    val = undefined;\n  } else if (isWindow(value)) {\n    val = '$WINDOW';\n  } else if (value &&  document === value) {\n    val = '$DOCUMENT';\n  } else if (isScope(value)) {\n    val = '$SCOPE';\n  }\n\n  return val;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.toJson\n * @module ng\n * @kind function\n *\n * @description\n * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be\n * stripped since angular uses this notation internally.\n *\n * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.\n * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.\n *    If set to an integer, the JSON output will contain that many spaces per indentation.\n * @returns {string|undefined} JSON-ified string representing `obj`.\n */\nfunction toJson(obj, pretty) {\n  if (isUndefined(obj)) return undefined;\n  if (!isNumber(pretty)) {\n    pretty = pretty ? 2 : null;\n  }\n  return JSON.stringify(obj, toJsonReplacer, pretty);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.fromJson\n * @module ng\n * @kind function\n *\n * @description\n * Deserializes a JSON string.\n *\n * @param {string} json JSON string to deserialize.\n * @returns {Object|Array|string|number} Deserialized JSON string.\n */\nfunction fromJson(json) {\n  return isString(json)\n      ? JSON.parse(json)\n      : json;\n}\n\n\nvar ALL_COLONS = /:/g;\nfunction timezoneToOffset(timezone, fallback) {\n  // IE/Edge do not \"understand\" colon (`:`) in timezone\n  timezone = timezone.replace(ALL_COLONS, '');\n  var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;\n  return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;\n}\n\n\nfunction addDateMinutes(date, minutes) {\n  date = new Date(date.getTime());\n  date.setMinutes(date.getMinutes() + minutes);\n  return date;\n}\n\n\nfunction convertTimezoneToLocal(date, timezone, reverse) {\n  reverse = reverse ? -1 : 1;\n  var dateTimezoneOffset = date.getTimezoneOffset();\n  var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n  return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));\n}\n\n\n/**\n * @returns {string} Returns the string representation of the element.\n */\nfunction startingTag(element) {\n  element = jqLite(element).clone();\n  try {\n    // turns out IE does not let you set .html() on elements which\n    // are not allowed to have children. So we just ignore it.\n    element.empty();\n  } catch (e) {}\n  var elemHtml = jqLite('<div>').append(element).html();\n  try {\n    return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :\n        elemHtml.\n          match(/^(<[^>]+>)/)[1].\n          replace(/^<([\\w\\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});\n  } catch (e) {\n    return lowercase(elemHtml);\n  }\n\n}\n\n\n/////////////////////////////////////////////////\n\n/**\n * Tries to decode the URI component without throwing an exception.\n *\n * @private\n * @param str value potential URI component to check.\n * @returns {boolean} True if `value` can be decoded\n * with the decodeURIComponent function.\n */\nfunction tryDecodeURIComponent(value) {\n  try {\n    return decodeURIComponent(value);\n  } catch (e) {\n    // Ignore any invalid uri component\n  }\n}\n\n\n/**\n * Parses an escaped url query string into key-value pairs.\n * @returns {Object.<string,boolean|Array>}\n */\nfunction parseKeyValue(/**string*/keyValue) {\n  var obj = {};\n  forEach((keyValue || \"\").split('&'), function(keyValue) {\n    var splitPoint, key, val;\n    if (keyValue) {\n      key = keyValue = keyValue.replace(/\\+/g,'%20');\n      splitPoint = keyValue.indexOf('=');\n      if (splitPoint !== -1) {\n        key = keyValue.substring(0, splitPoint);\n        val = keyValue.substring(splitPoint + 1);\n      }\n      key = tryDecodeURIComponent(key);\n      if (isDefined(key)) {\n        val = isDefined(val) ? tryDecodeURIComponent(val) : true;\n        if (!hasOwnProperty.call(obj, key)) {\n          obj[key] = val;\n        } else if (isArray(obj[key])) {\n          obj[key].push(val);\n        } else {\n          obj[key] = [obj[key],val];\n        }\n      }\n    }\n  });\n  return obj;\n}\n\nfunction toKeyValue(obj) {\n  var parts = [];\n  forEach(obj, function(value, key) {\n    if (isArray(value)) {\n      forEach(value, function(arrayValue) {\n        parts.push(encodeUriQuery(key, true) +\n                   (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));\n      });\n    } else {\n    parts.push(encodeUriQuery(key, true) +\n               (value === true ? '' : '=' + encodeUriQuery(value, true)));\n    }\n  });\n  return parts.length ? parts.join('&') : '';\n}\n\n\n/**\n * We need our custom method because encodeURIComponent is too aggressive and doesn't follow\n * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path\n * segments:\n *    segment       = *pchar\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriSegment(val) {\n  return encodeUriQuery(val, true).\n             replace(/%26/gi, '&').\n             replace(/%3D/gi, '=').\n             replace(/%2B/gi, '+');\n}\n\n\n/**\n * This method is intended for encoding *key* or *value* parts of query component. We need a custom\n * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be\n * encoded per http://tools.ietf.org/html/rfc3986:\n *    query       = *( pchar / \"/\" / \"?\" )\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriQuery(val, pctEncodeSpaces) {\n  return encodeURIComponent(val).\n             replace(/%40/gi, '@').\n             replace(/%3A/gi, ':').\n             replace(/%24/g, '$').\n             replace(/%2C/gi, ',').\n             replace(/%3B/gi, ';').\n             replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));\n}\n\nvar ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];\n\nfunction getNgAttribute(element, ngAttr) {\n  var attr, i, ii = ngAttrPrefixes.length;\n  for (i = 0; i < ii; ++i) {\n    attr = ngAttrPrefixes[i] + ngAttr;\n    if (isString(attr = element.getAttribute(attr))) {\n      return attr;\n    }\n  }\n  return null;\n}\n\n/**\n * @ngdoc directive\n * @name ngApp\n * @module ng\n *\n * @element ANY\n * @param {angular.Module} ngApp an optional application\n *   {@link angular.module module} name to load.\n * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be\n *   created in \"strict-di\" mode. This means that the application will fail to invoke functions which\n *   do not use explicit function annotation (and are thus unsuitable for minification), as described\n *   in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in\n *   tracking down the root of these bugs.\n *\n * @description\n *\n * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive\n * designates the **root element** of the application and is typically placed near the root element\n * of the page - e.g. on the `<body>` or `<html>` tags.\n *\n * There are a few things to keep in mind when using `ngApp`:\n * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`\n *   found in the document will be used to define the root element to auto-bootstrap as an\n *   application. To run multiple applications in an HTML document you must manually bootstrap them using\n *   {@link angular.bootstrap} instead.\n * - AngularJS applications cannot be nested within each other.\n * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.\n *   This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and\n *   {@link ngRoute.ngView `ngView`}.\n *   Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},\n *   causing animations to stop working and making the injector inaccessible from outside the app.\n *\n * You can specify an **AngularJS module** to be used as the root module for the application.  This\n * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It\n * should contain the application code needed or have dependencies on other modules that will\n * contain the code. See {@link angular.module} for more information.\n *\n * In the example below if the `ngApp` directive were not placed on the `html` element then the\n * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`\n * would not be resolved to `3`.\n *\n * `ngApp` is the easiest, and most common way to bootstrap an application.\n *\n <example module=\"ngAppDemo\">\n   <file name=\"index.html\">\n   <div ng-controller=\"ngAppDemoController\">\n     I can add: {{a}} + {{b}} =  {{ a+b }}\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {\n     $scope.a = 1;\n     $scope.b = 2;\n   });\n   </file>\n </example>\n *\n * Using `ngStrictDi`, you would see something like this:\n *\n <example ng-app-included=\"true\">\n   <file name=\"index.html\">\n   <div ng-app=\"ngAppStrictDemo\" ng-strict-di>\n       <div ng-controller=\"GoodController1\">\n           I can add: {{a}} + {{b}} =  {{ a+b }}\n\n           <p>This renders because the controller does not fail to\n              instantiate, by using explicit annotation style (see\n              script.js for details)\n           </p>\n       </div>\n\n       <div ng-controller=\"GoodController2\">\n           Name: <input ng-model=\"name\"><br />\n           Hello, {{name}}!\n\n           <p>This renders because the controller does not fail to\n              instantiate, by using explicit annotation style\n              (see script.js for details)\n           </p>\n       </div>\n\n       <div ng-controller=\"BadController\">\n           I can add: {{a}} + {{b}} =  {{ a+b }}\n\n           <p>The controller could not be instantiated, due to relying\n              on automatic function annotations (which are disabled in\n              strict mode). As such, the content of this section is not\n              interpolated, and there should be an error in your web console.\n           </p>\n       </div>\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppStrictDemo', [])\n     // BadController will fail to instantiate, due to relying on automatic function annotation,\n     // rather than an explicit annotation\n     .controller('BadController', function($scope) {\n       $scope.a = 1;\n       $scope.b = 2;\n     })\n     // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,\n     // due to using explicit annotations using the array style and $inject property, respectively.\n     .controller('GoodController1', ['$scope', function($scope) {\n       $scope.a = 1;\n       $scope.b = 2;\n     }])\n     .controller('GoodController2', GoodController2);\n     function GoodController2($scope) {\n       $scope.name = \"World\";\n     }\n     GoodController2.$inject = ['$scope'];\n   </file>\n   <file name=\"style.css\">\n   div[ng-controller] {\n       margin-bottom: 1em;\n       -webkit-border-radius: 4px;\n       border-radius: 4px;\n       border: 1px solid;\n       padding: .5em;\n   }\n   div[ng-controller^=Good] {\n       border-color: #d6e9c6;\n       background-color: #dff0d8;\n       color: #3c763d;\n   }\n   div[ng-controller^=Bad] {\n       border-color: #ebccd1;\n       background-color: #f2dede;\n       color: #a94442;\n       margin-bottom: 0;\n   }\n   </file>\n </example>\n */\nfunction angularInit(element, bootstrap) {\n  var appElement,\n      module,\n      config = {};\n\n  // The element `element` has priority over any other element\n  forEach(ngAttrPrefixes, function(prefix) {\n    var name = prefix + 'app';\n\n    if (!appElement && element.hasAttribute && element.hasAttribute(name)) {\n      appElement = element;\n      module = element.getAttribute(name);\n    }\n  });\n  forEach(ngAttrPrefixes, function(prefix) {\n    var name = prefix + 'app';\n    var candidate;\n\n    if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\\\:') + ']'))) {\n      appElement = candidate;\n      module = candidate.getAttribute(name);\n    }\n  });\n  if (appElement) {\n    config.strictDi = getNgAttribute(appElement, \"strict-di\") !== null;\n    bootstrap(appElement, module ? [module] : [], config);\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.bootstrap\n * @module ng\n * @description\n * Use this function to manually start up angular application.\n *\n * For more information, see the {@link guide/bootstrap Bootstrap guide}.\n *\n * Angular will detect if it has been loaded into the browser more than once and only allow the\n * first loaded script to be bootstrapped and will report a warning to the browser console for\n * each of the subsequent scripts. This prevents strange results in applications, where otherwise\n * multiple instances of Angular try to work on the DOM.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.\n * They must use {@link ng.directive:ngApp ngApp}.\n * </div>\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},\n * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.\n * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},\n * causing animations to stop working and making the injector inaccessible from outside the app.\n * </div>\n *\n * ```html\n * <!doctype html>\n * <html>\n * <body>\n * <div ng-controller=\"WelcomeController\">\n *   {{greeting}}\n * </div>\n *\n * <script src=\"angular.js\"></script>\n * <script>\n *   var app = angular.module('demo', [])\n *   .controller('WelcomeController', function($scope) {\n *       $scope.greeting = 'Welcome!';\n *   });\n *   angular.bootstrap(document, ['demo']);\n * </script>\n * </body>\n * </html>\n * ```\n *\n * @param {DOMElement} element DOM element which is the root of angular application.\n * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.\n *     Each item in the array should be the name of a predefined module or a (DI annotated)\n *     function that will be invoked by the injector as a `config` block.\n *     See: {@link angular.module modules}\n * @param {Object=} config an object for defining configuration options for the application. The\n *     following keys are supported:\n *\n * * `strictDi` - disable automatic function annotation for the application. This is meant to\n *   assist in finding bugs which break minified code. Defaults to `false`.\n *\n * @returns {auto.$injector} Returns the newly created injector for this app.\n */\nfunction bootstrap(element, modules, config) {\n  if (!isObject(config)) config = {};\n  var defaultConfig = {\n    strictDi: false\n  };\n  config = extend(defaultConfig, config);\n  var doBootstrap = function() {\n    element = jqLite(element);\n\n    if (element.injector()) {\n      var tag = (element[0] === document) ? 'document' : startingTag(element);\n      //Encode angle brackets to prevent input from being sanitized to empty string #8683\n      throw ngMinErr(\n          'btstrpd',\n          \"App Already Bootstrapped with this Element '{0}'\",\n          tag.replace(/</,'&lt;').replace(/>/,'&gt;'));\n    }\n\n    modules = modules || [];\n    modules.unshift(['$provide', function($provide) {\n      $provide.value('$rootElement', element);\n    }]);\n\n    if (config.debugInfoEnabled) {\n      // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.\n      modules.push(['$compileProvider', function($compileProvider) {\n        $compileProvider.debugInfoEnabled(true);\n      }]);\n    }\n\n    modules.unshift('ng');\n    var injector = createInjector(modules, config.strictDi);\n    injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',\n       function bootstrapApply(scope, element, compile, injector) {\n        scope.$apply(function() {\n          element.data('$injector', injector);\n          compile(element)(scope);\n        });\n      }]\n    );\n    return injector;\n  };\n\n  var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;\n  var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;\n\n  if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {\n    config.debugInfoEnabled = true;\n    window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');\n  }\n\n  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {\n    return doBootstrap();\n  }\n\n  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');\n  angular.resumeBootstrap = function(extraModules) {\n    forEach(extraModules, function(module) {\n      modules.push(module);\n    });\n    return doBootstrap();\n  };\n\n  if (isFunction(angular.resumeDeferredBootstrap)) {\n    angular.resumeDeferredBootstrap();\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.reloadWithDebugInfo\n * @module ng\n * @description\n * Use this function to reload the current application with debug information turned on.\n * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.\n *\n * See {@link ng.$compileProvider#debugInfoEnabled} for more.\n */\nfunction reloadWithDebugInfo() {\n  window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;\n  window.location.reload();\n}\n\n/**\n * @name angular.getTestability\n * @module ng\n * @description\n * Get the testability service for the instance of Angular on the given\n * element.\n * @param {DOMElement} element DOM element which is the root of angular application.\n */\nfunction getTestability(rootElement) {\n  var injector = angular.element(rootElement).injector();\n  if (!injector) {\n    throw ngMinErr('test',\n      'no injector found for element argument to getTestability');\n  }\n  return injector.get('$$testability');\n}\n\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nfunction snake_case(name, separator) {\n  separator = separator || '_';\n  return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n    return (pos ? separator : '') + letter.toLowerCase();\n  });\n}\n\nvar bindJQueryFired = false;\nfunction bindJQuery() {\n  var originalCleanData;\n\n  if (bindJQueryFired) {\n    return;\n  }\n\n  // bind to jQuery if present;\n  var jqName = jq();\n  jQuery = isUndefined(jqName) ? window.jQuery :   // use jQuery (if present)\n           !jqName             ? undefined     :   // use jqLite\n                                 window[jqName];   // use jQuery specified by `ngJq`\n\n  // Use jQuery if it exists with proper functionality, otherwise default to us.\n  // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.\n  // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older\n  // versions. It will not work for sure with jQuery <1.7, though.\n  if (jQuery && jQuery.fn.on) {\n    jqLite = jQuery;\n    extend(jQuery.fn, {\n      scope: JQLitePrototype.scope,\n      isolateScope: JQLitePrototype.isolateScope,\n      controller: JQLitePrototype.controller,\n      injector: JQLitePrototype.injector,\n      inheritedData: JQLitePrototype.inheritedData\n    });\n\n    // All nodes removed from the DOM via various jQuery APIs like .remove()\n    // are passed through jQuery.cleanData. Monkey-patch this method to fire\n    // the $destroy event on all removed nodes.\n    originalCleanData = jQuery.cleanData;\n    jQuery.cleanData = function(elems) {\n      var events;\n      for (var i = 0, elem; (elem = elems[i]) != null; i++) {\n        events = jQuery._data(elem, \"events\");\n        if (events && events.$destroy) {\n          jQuery(elem).triggerHandler('$destroy');\n        }\n      }\n      originalCleanData(elems);\n    };\n  } else {\n    jqLite = JQLite;\n  }\n\n  angular.element = jqLite;\n\n  // Prevent double-proxying.\n  bindJQueryFired = true;\n}\n\n/**\n * throw error if the argument is falsy.\n */\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction assertArgFn(arg, name, acceptArrayAnnotation) {\n  if (acceptArrayAnnotation && isArray(arg)) {\n      arg = arg[arg.length - 1];\n  }\n\n  assertArg(isFunction(arg), name, 'not a function, got ' +\n      (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));\n  return arg;\n}\n\n/**\n * throw error if the name given is hasOwnProperty\n * @param  {String} name    the name to test\n * @param  {String} context the context in which the name is used, such as module or directive\n */\nfunction assertNotHasOwnProperty(name, context) {\n  if (name === 'hasOwnProperty') {\n    throw ngMinErr('badname', \"hasOwnProperty is not a valid {0} name\", context);\n  }\n}\n\n/**\n * Return the value accessible from the object by path. Any undefined traversals are ignored\n * @param {Object} obj starting object\n * @param {String} path path to traverse\n * @param {boolean} [bindFnToScope=true]\n * @returns {Object} value as accessible by path\n */\n//TODO(misko): this function needs to be removed\nfunction getter(obj, path, bindFnToScope) {\n  if (!path) return obj;\n  var keys = path.split('.');\n  var key;\n  var lastInstance = obj;\n  var len = keys.length;\n\n  for (var i = 0; i < len; i++) {\n    key = keys[i];\n    if (obj) {\n      obj = (lastInstance = obj)[key];\n    }\n  }\n  if (!bindFnToScope && isFunction(obj)) {\n    return bind(lastInstance, obj);\n  }\n  return obj;\n}\n\n/**\n * Return the DOM siblings between the first and last node in the given array.\n * @param {Array} array like object\n * @returns {Array} the inputted object or a jqLite collection containing the nodes\n */\nfunction getBlockNodes(nodes) {\n  // TODO(perf): update `nodes` instead of creating a new object?\n  var node = nodes[0];\n  var endNode = nodes[nodes.length - 1];\n  var blockNodes;\n\n  for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {\n    if (blockNodes || nodes[i] !== node) {\n      if (!blockNodes) {\n        blockNodes = jqLite(slice.call(nodes, 0, i));\n      }\n      blockNodes.push(node);\n    }\n  }\n\n  return blockNodes || nodes;\n}\n\n\n/**\n * Creates a new object without a prototype. This object is useful for lookup without having to\n * guard against prototypically inherited properties via hasOwnProperty.\n *\n * Related micro-benchmarks:\n * - http://jsperf.com/object-create2\n * - http://jsperf.com/proto-map-lookup/2\n * - http://jsperf.com/for-in-vs-object-keys2\n *\n * @returns {Object}\n */\nfunction createMap() {\n  return Object.create(null);\n}\n\nvar NODE_TYPE_ELEMENT = 1;\nvar NODE_TYPE_ATTRIBUTE = 2;\nvar NODE_TYPE_TEXT = 3;\nvar NODE_TYPE_COMMENT = 8;\nvar NODE_TYPE_DOCUMENT = 9;\nvar NODE_TYPE_DOCUMENT_FRAGMENT = 11;\n\n/**\n * @ngdoc type\n * @name angular.Module\n * @module ng\n * @description\n *\n * Interface for configuring angular {@link angular.module modules}.\n */\n\nfunction setupModuleLoader(window) {\n\n  var $injectorMinErr = minErr('$injector');\n  var ngMinErr = minErr('ng');\n\n  function ensure(obj, name, factory) {\n    return obj[name] || (obj[name] = factory());\n  }\n\n  var angular = ensure(window, 'angular', Object);\n\n  // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap\n  angular.$$minErr = angular.$$minErr || minErr;\n\n  return ensure(angular, 'module', function() {\n    /** @type {Object.<string, angular.Module>} */\n    var modules = {};\n\n    /**\n     * @ngdoc function\n     * @name angular.module\n     * @module ng\n     * @description\n     *\n     * The `angular.module` is a global place for creating, registering and retrieving Angular\n     * modules.\n     * All modules (angular core or 3rd party) that should be available to an application must be\n     * registered using this mechanism.\n     *\n     * Passing one argument retrieves an existing {@link angular.Module},\n     * whereas passing more than one argument creates a new {@link angular.Module}\n     *\n     *\n     * # Module\n     *\n     * A module is a collection of services, directives, controllers, filters, and configuration information.\n     * `angular.module` is used to configure the {@link auto.$injector $injector}.\n     *\n     * ```js\n     * // Create a new module\n     * var myModule = angular.module('myModule', []);\n     *\n     * // register a new service\n     * myModule.value('appName', 'MyCoolApp');\n     *\n     * // configure existing services inside initialization blocks.\n     * myModule.config(['$locationProvider', function($locationProvider) {\n     *   // Configure existing providers\n     *   $locationProvider.hashPrefix('!');\n     * }]);\n     * ```\n     *\n     * Then you can create an injector and load your modules like this:\n     *\n     * ```js\n     * var injector = angular.injector(['ng', 'myModule'])\n     * ```\n     *\n     * However it's more likely that you'll just use\n     * {@link ng.directive:ngApp ngApp} or\n     * {@link angular.bootstrap} to simplify this process for you.\n     *\n     * @param {!string} name The name of the module to create or retrieve.\n     * @param {!Array.<string>=} requires If specified then new module is being created. If\n     *        unspecified then the module is being retrieved for further configuration.\n     * @param {Function=} configFn Optional configuration function for the module. Same as\n     *        {@link angular.Module#config Module#config()}.\n     * @returns {angular.Module} new module with the {@link angular.Module} api.\n     */\n    return function module(name, requires, configFn) {\n      var assertNotHasOwnProperty = function(name, context) {\n        if (name === 'hasOwnProperty') {\n          throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);\n        }\n      };\n\n      assertNotHasOwnProperty(name, 'module');\n      if (requires && modules.hasOwnProperty(name)) {\n        modules[name] = null;\n      }\n      return ensure(modules, name, function() {\n        if (!requires) {\n          throw $injectorMinErr('nomod', \"Module '{0}' is not available! You either misspelled \" +\n             \"the module name or forgot to load it. If registering a module ensure that you \" +\n             \"specify the dependencies as the second argument.\", name);\n        }\n\n        /** @type {!Array.<Array.<*>>} */\n        var invokeQueue = [];\n\n        /** @type {!Array.<Function>} */\n        var configBlocks = [];\n\n        /** @type {!Array.<Function>} */\n        var runBlocks = [];\n\n        var config = invokeLater('$injector', 'invoke', 'push', configBlocks);\n\n        /** @type {angular.Module} */\n        var moduleInstance = {\n          // Private state\n          _invokeQueue: invokeQueue,\n          _configBlocks: configBlocks,\n          _runBlocks: runBlocks,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#requires\n           * @module ng\n           *\n           * @description\n           * Holds the list of modules which the injector will load before the current module is\n           * loaded.\n           */\n          requires: requires,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#name\n           * @module ng\n           *\n           * @description\n           * Name of the module.\n           */\n          name: name,\n\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#provider\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerType Construction function for creating new instance of the\n           *                                service.\n           * @description\n           * See {@link auto.$provide#provider $provide.provider()}.\n           */\n          provider: invokeLaterAndSetModuleName('$provide', 'provider'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#factory\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerFunction Function for creating new instance of the service.\n           * @description\n           * See {@link auto.$provide#factory $provide.factory()}.\n           */\n          factory: invokeLaterAndSetModuleName('$provide', 'factory'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#service\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} constructor A constructor function that will be instantiated.\n           * @description\n           * See {@link auto.$provide#service $provide.service()}.\n           */\n          service: invokeLaterAndSetModuleName('$provide', 'service'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#value\n           * @module ng\n           * @param {string} name service name\n           * @param {*} object Service instance object.\n           * @description\n           * See {@link auto.$provide#value $provide.value()}.\n           */\n          value: invokeLater('$provide', 'value'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#constant\n           * @module ng\n           * @param {string} name constant name\n           * @param {*} object Constant value.\n           * @description\n           * Because the constants are fixed, they get applied before other provide methods.\n           * See {@link auto.$provide#constant $provide.constant()}.\n           */\n          constant: invokeLater('$provide', 'constant', 'unshift'),\n\n           /**\n           * @ngdoc method\n           * @name angular.Module#decorator\n           * @module ng\n           * @param {string} The name of the service to decorate.\n           * @param {Function} This function will be invoked when the service needs to be\n           *                                    instantiated and should return the decorated service instance.\n           * @description\n           * See {@link auto.$provide#decorator $provide.decorator()}.\n           */\n          decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#animation\n           * @module ng\n           * @param {string} name animation name\n           * @param {Function} animationFactory Factory function for creating new instance of an\n           *                                    animation.\n           * @description\n           *\n           * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.\n           *\n           *\n           * Defines an animation hook that can be later used with\n           * {@link $animate $animate} service and directives that use this service.\n           *\n           * ```js\n           * module.animation('.animation-name', function($inject1, $inject2) {\n           *   return {\n           *     eventName : function(element, done) {\n           *       //code to run the animation\n           *       //once complete, then run done()\n           *       return function cancellationFunction(element) {\n           *         //code to cancel the animation\n           *       }\n           *     }\n           *   }\n           * })\n           * ```\n           *\n           * See {@link ng.$animateProvider#register $animateProvider.register()} and\n           * {@link ngAnimate ngAnimate module} for more information.\n           */\n          animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#filter\n           * @module ng\n           * @param {string} name Filter name - this must be a valid angular expression identifier\n           * @param {Function} filterFactory Factory function for creating new instance of filter.\n           * @description\n           * See {@link ng.$filterProvider#register $filterProvider.register()}.\n           *\n           * <div class=\"alert alert-warning\">\n           * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n           * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n           * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n           * (`myapp_subsection_filterx`).\n           * </div>\n           */\n          filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#controller\n           * @module ng\n           * @param {string|Object} name Controller name, or an object map of controllers where the\n           *    keys are the names and the values are the constructors.\n           * @param {Function} constructor Controller constructor function.\n           * @description\n           * See {@link ng.$controllerProvider#register $controllerProvider.register()}.\n           */\n          controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#directive\n           * @module ng\n           * @param {string|Object} name Directive name, or an object map of directives where the\n           *    keys are the names and the values are the factories.\n           * @param {Function} directiveFactory Factory function for creating new instance of\n           * directives.\n           * @description\n           * See {@link ng.$compileProvider#directive $compileProvider.directive()}.\n           */\n          directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#component\n           * @module ng\n           * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)\n           * @param {Object} options Component definition object (a simplified\n           *    {@link ng.$compile#directive-definition-object directive definition object})\n           *\n           * @description\n           * See {@link ng.$compileProvider#component $compileProvider.component()}.\n           */\n          component: invokeLaterAndSetModuleName('$compileProvider', 'component'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#config\n           * @module ng\n           * @param {Function} configFn Execute this function on module load. Useful for service\n           *    configuration.\n           * @description\n           * Use this method to register work which needs to be performed on module loading.\n           * For more about how to configure services, see\n           * {@link providers#provider-recipe Provider Recipe}.\n           */\n          config: config,\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#run\n           * @module ng\n           * @param {Function} initializationFn Execute this function after injector creation.\n           *    Useful for application initialization.\n           * @description\n           * Use this method to register work which should be performed when the injector is done\n           * loading all modules.\n           */\n          run: function(block) {\n            runBlocks.push(block);\n            return this;\n          }\n        };\n\n        if (configFn) {\n          config(configFn);\n        }\n\n        return moduleInstance;\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @param {String=} insertMethod\n         * @returns {angular.Module}\n         */\n        function invokeLater(provider, method, insertMethod, queue) {\n          if (!queue) queue = invokeQueue;\n          return function() {\n            queue[insertMethod || 'push']([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @returns {angular.Module}\n         */\n        function invokeLaterAndSetModuleName(provider, method) {\n          return function(recipeName, factoryFunction) {\n            if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;\n            invokeQueue.push([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n      });\n    };\n  });\n\n}\n\n/* global: toDebugString: true */\n\nfunction serializeObject(obj) {\n  var seen = [];\n\n  return JSON.stringify(obj, function(key, val) {\n    val = toJsonReplacer(key, val);\n    if (isObject(val)) {\n\n      if (seen.indexOf(val) >= 0) return '...';\n\n      seen.push(val);\n    }\n    return val;\n  });\n}\n\nfunction toDebugString(obj) {\n  if (typeof obj === 'function') {\n    return obj.toString().replace(/ \\{[\\s\\S]*$/, '');\n  } else if (isUndefined(obj)) {\n    return 'undefined';\n  } else if (typeof obj !== 'string') {\n    return serializeObject(obj);\n  }\n  return obj;\n}\n\n/* global angularModule: true,\n  version: true,\n\n  $CompileProvider,\n\n  htmlAnchorDirective,\n  inputDirective,\n  inputDirective,\n  formDirective,\n  scriptDirective,\n  selectDirective,\n  styleDirective,\n  optionDirective,\n  ngBindDirective,\n  ngBindHtmlDirective,\n  ngBindTemplateDirective,\n  ngClassDirective,\n  ngClassEvenDirective,\n  ngClassOddDirective,\n  ngCloakDirective,\n  ngControllerDirective,\n  ngFormDirective,\n  ngHideDirective,\n  ngIfDirective,\n  ngIncludeDirective,\n  ngIncludeFillContentDirective,\n  ngInitDirective,\n  ngNonBindableDirective,\n  ngPluralizeDirective,\n  ngRepeatDirective,\n  ngShowDirective,\n  ngStyleDirective,\n  ngSwitchDirective,\n  ngSwitchWhenDirective,\n  ngSwitchDefaultDirective,\n  ngOptionsDirective,\n  ngTranscludeDirective,\n  ngModelDirective,\n  ngListDirective,\n  ngChangeDirective,\n  patternDirective,\n  patternDirective,\n  requiredDirective,\n  requiredDirective,\n  minlengthDirective,\n  minlengthDirective,\n  maxlengthDirective,\n  maxlengthDirective,\n  ngValueDirective,\n  ngModelOptionsDirective,\n  ngAttributeAliasDirectives,\n  ngEventDirectives,\n\n  $AnchorScrollProvider,\n  $AnimateProvider,\n  $CoreAnimateCssProvider,\n  $$CoreAnimateJsProvider,\n  $$CoreAnimateQueueProvider,\n  $$AnimateRunnerFactoryProvider,\n  $$AnimateAsyncRunFactoryProvider,\n  $BrowserProvider,\n  $CacheFactoryProvider,\n  $ControllerProvider,\n  $DateProvider,\n  $DocumentProvider,\n  $ExceptionHandlerProvider,\n  $FilterProvider,\n  $$ForceReflowProvider,\n  $InterpolateProvider,\n  $IntervalProvider,\n  $$HashMapProvider,\n  $HttpProvider,\n  $HttpParamSerializerProvider,\n  $HttpParamSerializerJQLikeProvider,\n  $HttpBackendProvider,\n  $xhrFactoryProvider,\n  $LocationProvider,\n  $LogProvider,\n  $ParseProvider,\n  $RootScopeProvider,\n  $QProvider,\n  $$QProvider,\n  $$SanitizeUriProvider,\n  $SceProvider,\n  $SceDelegateProvider,\n  $SnifferProvider,\n  $TemplateCacheProvider,\n  $TemplateRequestProvider,\n  $$TestabilityProvider,\n  $TimeoutProvider,\n  $$RAFProvider,\n  $WindowProvider,\n  $$jqLiteProvider,\n  $$CookieReaderProvider\n*/\n\n\n/**\n * @ngdoc object\n * @name angular.version\n * @module ng\n * @description\n * An object that contains information about the current AngularJS version.\n *\n * This object has the following properties:\n *\n * - `full` – `{string}` – Full version string, such as \"0.9.18\".\n * - `major` – `{number}` – Major version number, such as \"0\".\n * - `minor` – `{number}` – Minor version number, such as \"9\".\n * - `dot` – `{number}` – Dot version number, such as \"18\".\n * - `codeName` – `{string}` – Code name of the release, such as \"jiggling-armfat\".\n */\nvar version = {\n  full: '1.5.3',    // all of these placeholder strings will be replaced by grunt's\n  major: 1,    // package task\n  minor: 5,\n  dot: 3,\n  codeName: 'diplohaplontic-meiosis'\n};\n\n\nfunction publishExternalAPI(angular) {\n  extend(angular, {\n    'bootstrap': bootstrap,\n    'copy': copy,\n    'extend': extend,\n    'merge': merge,\n    'equals': equals,\n    'element': jqLite,\n    'forEach': forEach,\n    'injector': createInjector,\n    'noop': noop,\n    'bind': bind,\n    'toJson': toJson,\n    'fromJson': fromJson,\n    'identity': identity,\n    'isUndefined': isUndefined,\n    'isDefined': isDefined,\n    'isString': isString,\n    'isFunction': isFunction,\n    'isObject': isObject,\n    'isNumber': isNumber,\n    'isElement': isElement,\n    'isArray': isArray,\n    'version': version,\n    'isDate': isDate,\n    'lowercase': lowercase,\n    'uppercase': uppercase,\n    'callbacks': {counter: 0},\n    'getTestability': getTestability,\n    '$$minErr': minErr,\n    '$$csp': csp,\n    'reloadWithDebugInfo': reloadWithDebugInfo\n  });\n\n  angularModule = setupModuleLoader(window);\n\n  angularModule('ng', ['ngLocale'], ['$provide',\n    function ngModule($provide) {\n      // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.\n      $provide.provider({\n        $$sanitizeUri: $$SanitizeUriProvider\n      });\n      $provide.provider('$compile', $CompileProvider).\n        directive({\n            a: htmlAnchorDirective,\n            input: inputDirective,\n            textarea: inputDirective,\n            form: formDirective,\n            script: scriptDirective,\n            select: selectDirective,\n            style: styleDirective,\n            option: optionDirective,\n            ngBind: ngBindDirective,\n            ngBindHtml: ngBindHtmlDirective,\n            ngBindTemplate: ngBindTemplateDirective,\n            ngClass: ngClassDirective,\n            ngClassEven: ngClassEvenDirective,\n            ngClassOdd: ngClassOddDirective,\n            ngCloak: ngCloakDirective,\n            ngController: ngControllerDirective,\n            ngForm: ngFormDirective,\n            ngHide: ngHideDirective,\n            ngIf: ngIfDirective,\n            ngInclude: ngIncludeDirective,\n            ngInit: ngInitDirective,\n            ngNonBindable: ngNonBindableDirective,\n            ngPluralize: ngPluralizeDirective,\n            ngRepeat: ngRepeatDirective,\n            ngShow: ngShowDirective,\n            ngStyle: ngStyleDirective,\n            ngSwitch: ngSwitchDirective,\n            ngSwitchWhen: ngSwitchWhenDirective,\n            ngSwitchDefault: ngSwitchDefaultDirective,\n            ngOptions: ngOptionsDirective,\n            ngTransclude: ngTranscludeDirective,\n            ngModel: ngModelDirective,\n            ngList: ngListDirective,\n            ngChange: ngChangeDirective,\n            pattern: patternDirective,\n            ngPattern: patternDirective,\n            required: requiredDirective,\n            ngRequired: requiredDirective,\n            minlength: minlengthDirective,\n            ngMinlength: minlengthDirective,\n            maxlength: maxlengthDirective,\n            ngMaxlength: maxlengthDirective,\n            ngValue: ngValueDirective,\n            ngModelOptions: ngModelOptionsDirective\n        }).\n        directive({\n          ngInclude: ngIncludeFillContentDirective\n        }).\n        directive(ngAttributeAliasDirectives).\n        directive(ngEventDirectives);\n      $provide.provider({\n        $anchorScroll: $AnchorScrollProvider,\n        $animate: $AnimateProvider,\n        $animateCss: $CoreAnimateCssProvider,\n        $$animateJs: $$CoreAnimateJsProvider,\n        $$animateQueue: $$CoreAnimateQueueProvider,\n        $$AnimateRunner: $$AnimateRunnerFactoryProvider,\n        $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,\n        $browser: $BrowserProvider,\n        $cacheFactory: $CacheFactoryProvider,\n        $controller: $ControllerProvider,\n        $document: $DocumentProvider,\n        $exceptionHandler: $ExceptionHandlerProvider,\n        $filter: $FilterProvider,\n        $$forceReflow: $$ForceReflowProvider,\n        $interpolate: $InterpolateProvider,\n        $interval: $IntervalProvider,\n        $http: $HttpProvider,\n        $httpParamSerializer: $HttpParamSerializerProvider,\n        $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,\n        $httpBackend: $HttpBackendProvider,\n        $xhrFactory: $xhrFactoryProvider,\n        $location: $LocationProvider,\n        $log: $LogProvider,\n        $parse: $ParseProvider,\n        $rootScope: $RootScopeProvider,\n        $q: $QProvider,\n        $$q: $$QProvider,\n        $sce: $SceProvider,\n        $sceDelegate: $SceDelegateProvider,\n        $sniffer: $SnifferProvider,\n        $templateCache: $TemplateCacheProvider,\n        $templateRequest: $TemplateRequestProvider,\n        $$testability: $$TestabilityProvider,\n        $timeout: $TimeoutProvider,\n        $window: $WindowProvider,\n        $$rAF: $$RAFProvider,\n        $$jqLite: $$jqLiteProvider,\n        $$HashMap: $$HashMapProvider,\n        $$cookieReader: $$CookieReaderProvider\n      });\n    }\n  ]);\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* global JQLitePrototype: true,\n  addEventListenerFn: true,\n  removeEventListenerFn: true,\n  BOOLEAN_ATTR: true,\n  ALIASED_ATTR: true,\n*/\n\n//////////////////////////////////\n//JQLite\n//////////////////////////////////\n\n/**\n * @ngdoc function\n * @name angular.element\n * @module ng\n * @kind function\n *\n * @description\n * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.\n *\n * If jQuery is available, `angular.element` is an alias for the\n * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`\n * delegates to Angular's built-in subset of jQuery, called \"jQuery lite\" or **jqLite**.\n *\n * jqLite is a tiny, API-compatible subset of jQuery that allows\n * Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most\n * commonly needed functionality with the goal of having a very small footprint.\n *\n * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the\n * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a\n * specific version of jQuery if multiple versions exist on the page.\n *\n * <div class=\"alert alert-info\">**Note:** All element references in Angular are always wrapped with jQuery or\n * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>\n *\n * <div class=\"alert alert-warning\">**Note:** Keep in mind that this function will not find elements\n * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`\n * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>\n *\n * ## Angular's jqLite\n * jqLite provides only the following jQuery methods:\n *\n * - [`addClass()`](http://api.jquery.com/addClass/)\n * - [`after()`](http://api.jquery.com/after/)\n * - [`append()`](http://api.jquery.com/append/)\n * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters\n * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData\n * - [`children()`](http://api.jquery.com/children/) - Does not support selectors\n * - [`clone()`](http://api.jquery.com/clone/)\n * - [`contents()`](http://api.jquery.com/contents/)\n * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`.\n *   As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.\n * - [`data()`](http://api.jquery.com/data/)\n * - [`detach()`](http://api.jquery.com/detach/)\n * - [`empty()`](http://api.jquery.com/empty/)\n * - [`eq()`](http://api.jquery.com/eq/)\n * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name\n * - [`hasClass()`](http://api.jquery.com/hasClass/)\n * - [`html()`](http://api.jquery.com/html/)\n * - [`next()`](http://api.jquery.com/next/) - Does not support selectors\n * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData\n * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter\n * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors\n * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors\n * - [`prepend()`](http://api.jquery.com/prepend/)\n * - [`prop()`](http://api.jquery.com/prop/)\n * - [`ready()`](http://api.jquery.com/ready/)\n * - [`remove()`](http://api.jquery.com/remove/)\n * - [`removeAttr()`](http://api.jquery.com/removeAttr/)\n * - [`removeClass()`](http://api.jquery.com/removeClass/)\n * - [`removeData()`](http://api.jquery.com/removeData/)\n * - [`replaceWith()`](http://api.jquery.com/replaceWith/)\n * - [`text()`](http://api.jquery.com/text/)\n * - [`toggleClass()`](http://api.jquery.com/toggleClass/)\n * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.\n * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter\n * - [`val()`](http://api.jquery.com/val/)\n * - [`wrap()`](http://api.jquery.com/wrap/)\n *\n * ## jQuery/jqLite Extras\n * Angular also provides the following additional methods and events to both jQuery and jqLite:\n *\n * ### Events\n * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event\n *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM\n *    element before it is removed.\n *\n * ### Methods\n * - `controller(name)` - retrieves the controller of the current element or its parent. By default\n *   retrieves controller associated with the `ngController` directive. If `name` is provided as\n *   camelCase directive name, then the controller for this directive will be retrieved (e.g.\n *   `'ngModel'`).\n * - `injector()` - retrieves the injector of the current element or its parent.\n * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current\n *   element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to\n *   be enabled.\n * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the\n *   current element. This getter should be used only on elements that contain a directive which starts a new isolate\n *   scope. Calling `scope()` on this element always returns the original non-isolate scope.\n *   Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.\n * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top\n *   parent element is reached.\n *\n * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.\n * @returns {Object} jQuery object.\n */\n\nJQLite.expando = 'ng339';\n\nvar jqCache = JQLite.cache = {},\n    jqId = 1,\n    addEventListenerFn = function(element, type, fn) {\n      element.addEventListener(type, fn, false);\n    },\n    removeEventListenerFn = function(element, type, fn) {\n      element.removeEventListener(type, fn, false);\n    };\n\n/*\n * !!! This is an undocumented \"private\" function !!!\n */\nJQLite._data = function(node) {\n  //jQuery always returns an object on cache miss\n  return this.cache[node[this.expando]] || {};\n};\n\nfunction jqNextId() { return ++jqId; }\n\n\nvar SPECIAL_CHARS_REGEXP = /([\\:\\-\\_]+(.))/g;\nvar MOZ_HACK_REGEXP = /^moz([A-Z])/;\nvar MOUSE_EVENT_MAP= { mouseleave: \"mouseout\", mouseenter: \"mouseover\"};\nvar jqLiteMinErr = minErr('jqLite');\n\n/**\n * Converts snake_case to camelCase.\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction camelCase(name) {\n  return name.\n    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {\n      return offset ? letter.toUpperCase() : letter;\n    }).\n    replace(MOZ_HACK_REGEXP, 'Moz$1');\n}\n\nvar SINGLE_TAG_REGEXP = /^<([\\w-]+)\\s*\\/?>(?:<\\/\\1>|)$/;\nvar HTML_REGEXP = /<|&#?\\w+;/;\nvar TAG_NAME_REGEXP = /<([\\w:-]+)/;\nvar XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^>]*)\\/>/gi;\n\nvar wrapMap = {\n  'option': [1, '<select multiple=\"multiple\">', '</select>'],\n\n  'thead': [1, '<table>', '</table>'],\n  'col': [2, '<table><colgroup>', '</colgroup></table>'],\n  'tr': [2, '<table><tbody>', '</tbody></table>'],\n  'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n  '_default': [0, \"\", \"\"]\n};\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n\nfunction jqLiteIsTextNode(html) {\n  return !HTML_REGEXP.test(html);\n}\n\nfunction jqLiteAcceptsData(node) {\n  // The window object can accept data but has no nodeType\n  // Otherwise we are only interested in elements (1) and documents (9)\n  var nodeType = node.nodeType;\n  return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;\n}\n\nfunction jqLiteHasData(node) {\n  for (var key in jqCache[node.ng339]) {\n    return true;\n  }\n  return false;\n}\n\nfunction jqLiteCleanData(nodes) {\n  for (var i = 0, ii = nodes.length; i < ii; i++) {\n    jqLiteRemoveData(nodes[i]);\n  }\n}\n\nfunction jqLiteBuildFragment(html, context) {\n  var tmp, tag, wrap,\n      fragment = context.createDocumentFragment(),\n      nodes = [], i;\n\n  if (jqLiteIsTextNode(html)) {\n    // Convert non-html into a text node\n    nodes.push(context.createTextNode(html));\n  } else {\n    // Convert html into DOM nodes\n    tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n    tag = (TAG_NAME_REGEXP.exec(html) || [\"\", \"\"])[1].toLowerCase();\n    wrap = wrapMap[tag] || wrapMap._default;\n    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, \"<$1></$2>\") + wrap[2];\n\n    // Descend through wrappers to the right content\n    i = wrap[0];\n    while (i--) {\n      tmp = tmp.lastChild;\n    }\n\n    nodes = concat(nodes, tmp.childNodes);\n\n    tmp = fragment.firstChild;\n    tmp.textContent = \"\";\n  }\n\n  // Remove wrapper from fragment\n  fragment.textContent = \"\";\n  fragment.innerHTML = \"\"; // Clear inner HTML\n  forEach(nodes, function(node) {\n    fragment.appendChild(node);\n  });\n\n  return fragment;\n}\n\nfunction jqLiteParseHTML(html, context) {\n  context = context || document;\n  var parsed;\n\n  if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {\n    return [context.createElement(parsed[1])];\n  }\n\n  if ((parsed = jqLiteBuildFragment(html, context))) {\n    return parsed.childNodes;\n  }\n\n  return [];\n}\n\nfunction jqLiteWrapNode(node, wrapper) {\n  var parent = node.parentNode;\n\n  if (parent) {\n    parent.replaceChild(wrapper, node);\n  }\n\n  wrapper.appendChild(node);\n}\n\n\n// IE9-11 has no method \"contains\" in SVG element and in Node.prototype. Bug #10259.\nvar jqLiteContains = Node.prototype.contains || function(arg) {\n  // jshint bitwise: false\n  return !!(this.compareDocumentPosition(arg) & 16);\n  // jshint bitwise: true\n};\n\n/////////////////////////////////////////////\nfunction JQLite(element) {\n  if (element instanceof JQLite) {\n    return element;\n  }\n\n  var argIsString;\n\n  if (isString(element)) {\n    element = trim(element);\n    argIsString = true;\n  }\n  if (!(this instanceof JQLite)) {\n    if (argIsString && element.charAt(0) != '<') {\n      throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');\n    }\n    return new JQLite(element);\n  }\n\n  if (argIsString) {\n    jqLiteAddNodes(this, jqLiteParseHTML(element));\n  } else {\n    jqLiteAddNodes(this, element);\n  }\n}\n\nfunction jqLiteClone(element) {\n  return element.cloneNode(true);\n}\n\nfunction jqLiteDealoc(element, onlyDescendants) {\n  if (!onlyDescendants) jqLiteRemoveData(element);\n\n  if (element.querySelectorAll) {\n    var descendants = element.querySelectorAll('*');\n    for (var i = 0, l = descendants.length; i < l; i++) {\n      jqLiteRemoveData(descendants[i]);\n    }\n  }\n}\n\nfunction jqLiteOff(element, type, fn, unsupported) {\n  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');\n\n  var expandoStore = jqLiteExpandoStore(element);\n  var events = expandoStore && expandoStore.events;\n  var handle = expandoStore && expandoStore.handle;\n\n  if (!handle) return; //no listeners registered\n\n  if (!type) {\n    for (type in events) {\n      if (type !== '$destroy') {\n        removeEventListenerFn(element, type, handle);\n      }\n      delete events[type];\n    }\n  } else {\n\n    var removeHandler = function(type) {\n      var listenerFns = events[type];\n      if (isDefined(fn)) {\n        arrayRemove(listenerFns || [], fn);\n      }\n      if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {\n        removeEventListenerFn(element, type, handle);\n        delete events[type];\n      }\n    };\n\n    forEach(type.split(' '), function(type) {\n      removeHandler(type);\n      if (MOUSE_EVENT_MAP[type]) {\n        removeHandler(MOUSE_EVENT_MAP[type]);\n      }\n    });\n  }\n}\n\nfunction jqLiteRemoveData(element, name) {\n  var expandoId = element.ng339;\n  var expandoStore = expandoId && jqCache[expandoId];\n\n  if (expandoStore) {\n    if (name) {\n      delete expandoStore.data[name];\n      return;\n    }\n\n    if (expandoStore.handle) {\n      if (expandoStore.events.$destroy) {\n        expandoStore.handle({}, '$destroy');\n      }\n      jqLiteOff(element);\n    }\n    delete jqCache[expandoId];\n    element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it\n  }\n}\n\n\nfunction jqLiteExpandoStore(element, createIfNecessary) {\n  var expandoId = element.ng339,\n      expandoStore = expandoId && jqCache[expandoId];\n\n  if (createIfNecessary && !expandoStore) {\n    element.ng339 = expandoId = jqNextId();\n    expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};\n  }\n\n  return expandoStore;\n}\n\n\nfunction jqLiteData(element, key, value) {\n  if (jqLiteAcceptsData(element)) {\n\n    var isSimpleSetter = isDefined(value);\n    var isSimpleGetter = !isSimpleSetter && key && !isObject(key);\n    var massGetter = !key;\n    var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);\n    var data = expandoStore && expandoStore.data;\n\n    if (isSimpleSetter) { // data('key', value)\n      data[key] = value;\n    } else {\n      if (massGetter) {  // data()\n        return data;\n      } else {\n        if (isSimpleGetter) { // data('key')\n          // don't force creation of expandoStore if it doesn't exist yet\n          return data && data[key];\n        } else { // mass-setter: data({key1: val1, key2: val2})\n          extend(data, key);\n        }\n      }\n    }\n  }\n}\n\nfunction jqLiteHasClass(element, selector) {\n  if (!element.getAttribute) return false;\n  return ((\" \" + (element.getAttribute('class') || '') + \" \").replace(/[\\n\\t]/g, \" \").\n      indexOf(\" \" + selector + \" \") > -1);\n}\n\nfunction jqLiteRemoveClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    forEach(cssClasses.split(' '), function(cssClass) {\n      element.setAttribute('class', trim(\n          (\" \" + (element.getAttribute('class') || '') + \" \")\n          .replace(/[\\n\\t]/g, \" \")\n          .replace(\" \" + trim(cssClass) + \" \", \" \"))\n      );\n    });\n  }\n}\n\nfunction jqLiteAddClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')\n                            .replace(/[\\n\\t]/g, \" \");\n\n    forEach(cssClasses.split(' '), function(cssClass) {\n      cssClass = trim(cssClass);\n      if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n        existingClasses += cssClass + ' ';\n      }\n    });\n\n    element.setAttribute('class', trim(existingClasses));\n  }\n}\n\n\nfunction jqLiteAddNodes(root, elements) {\n  // THIS CODE IS VERY HOT. Don't make changes without benchmarking.\n\n  if (elements) {\n\n    // if a Node (the most common case)\n    if (elements.nodeType) {\n      root[root.length++] = elements;\n    } else {\n      var length = elements.length;\n\n      // if an Array or NodeList and not a Window\n      if (typeof length === 'number' && elements.window !== elements) {\n        if (length) {\n          for (var i = 0; i < length; i++) {\n            root[root.length++] = elements[i];\n          }\n        }\n      } else {\n        root[root.length++] = elements;\n      }\n    }\n  }\n}\n\n\nfunction jqLiteController(element, name) {\n  return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');\n}\n\nfunction jqLiteInheritedData(element, name, value) {\n  // if element is the document object work with the html element instead\n  // this makes $(document).scope() possible\n  if (element.nodeType == NODE_TYPE_DOCUMENT) {\n    element = element.documentElement;\n  }\n  var names = isArray(name) ? name : [name];\n\n  while (element) {\n    for (var i = 0, ii = names.length; i < ii; i++) {\n      if (isDefined(value = jqLite.data(element, names[i]))) return value;\n    }\n\n    // If dealing with a document fragment node with a host element, and no parent, use the host\n    // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM\n    // to lookup parent controllers.\n    element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);\n  }\n}\n\nfunction jqLiteEmpty(element) {\n  jqLiteDealoc(element, true);\n  while (element.firstChild) {\n    element.removeChild(element.firstChild);\n  }\n}\n\nfunction jqLiteRemove(element, keepData) {\n  if (!keepData) jqLiteDealoc(element);\n  var parent = element.parentNode;\n  if (parent) parent.removeChild(element);\n}\n\n\nfunction jqLiteDocumentLoaded(action, win) {\n  win = win || window;\n  if (win.document.readyState === 'complete') {\n    // Force the action to be run async for consistent behavior\n    // from the action's point of view\n    // i.e. it will definitely not be in a $apply\n    win.setTimeout(action);\n  } else {\n    // No need to unbind this handler as load is only ever called once\n    jqLite(win).on('load', action);\n  }\n}\n\n//////////////////////////////////////////\n// Functions which are declared directly.\n//////////////////////////////////////////\nvar JQLitePrototype = JQLite.prototype = {\n  ready: function(fn) {\n    var fired = false;\n\n    function trigger() {\n      if (fired) return;\n      fired = true;\n      fn();\n    }\n\n    // check if document is already loaded\n    if (document.readyState === 'complete') {\n      setTimeout(trigger);\n    } else {\n      this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9\n      // we can not use jqLite since we are not done loading and jQuery could be loaded later.\n      // jshint -W064\n      JQLite(window).on('load', trigger); // fallback to window.onload for others\n      // jshint +W064\n    }\n  },\n  toString: function() {\n    var value = [];\n    forEach(this, function(e) { value.push('' + e);});\n    return '[' + value.join(', ') + ']';\n  },\n\n  eq: function(index) {\n      return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);\n  },\n\n  length: 0,\n  push: push,\n  sort: [].sort,\n  splice: [].splice\n};\n\n//////////////////////////////////////////\n// Functions iterating getter/setters.\n// these functions return self on setter and\n// value on get.\n//////////////////////////////////////////\nvar BOOLEAN_ATTR = {};\nforEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {\n  BOOLEAN_ATTR[lowercase(value)] = value;\n});\nvar BOOLEAN_ELEMENTS = {};\nforEach('input,select,option,textarea,button,form,details'.split(','), function(value) {\n  BOOLEAN_ELEMENTS[value] = true;\n});\nvar ALIASED_ATTR = {\n  'ngMinlength': 'minlength',\n  'ngMaxlength': 'maxlength',\n  'ngMin': 'min',\n  'ngMax': 'max',\n  'ngPattern': 'pattern'\n};\n\nfunction getBooleanAttrName(element, name) {\n  // check dom last since we will most likely fail on name\n  var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];\n\n  // booleanAttr is here twice to minimize DOM access\n  return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;\n}\n\nfunction getAliasedAttrName(name) {\n  return ALIASED_ATTR[name];\n}\n\nforEach({\n  data: jqLiteData,\n  removeData: jqLiteRemoveData,\n  hasData: jqLiteHasData,\n  cleanData: jqLiteCleanData\n}, function(fn, name) {\n  JQLite[name] = fn;\n});\n\nforEach({\n  data: jqLiteData,\n  inheritedData: jqLiteInheritedData,\n\n  scope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);\n  },\n\n  isolateScope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');\n  },\n\n  controller: jqLiteController,\n\n  injector: function(element) {\n    return jqLiteInheritedData(element, '$injector');\n  },\n\n  removeAttr: function(element, name) {\n    element.removeAttribute(name);\n  },\n\n  hasClass: jqLiteHasClass,\n\n  css: function(element, name, value) {\n    name = camelCase(name);\n\n    if (isDefined(value)) {\n      element.style[name] = value;\n    } else {\n      return element.style[name];\n    }\n  },\n\n  attr: function(element, name, value) {\n    var nodeType = element.nodeType;\n    if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {\n      return;\n    }\n    var lowercasedName = lowercase(name);\n    if (BOOLEAN_ATTR[lowercasedName]) {\n      if (isDefined(value)) {\n        if (!!value) {\n          element[name] = true;\n          element.setAttribute(name, lowercasedName);\n        } else {\n          element[name] = false;\n          element.removeAttribute(lowercasedName);\n        }\n      } else {\n        return (element[name] ||\n                 (element.attributes.getNamedItem(name) || noop).specified)\n               ? lowercasedName\n               : undefined;\n      }\n    } else if (isDefined(value)) {\n      element.setAttribute(name, value);\n    } else if (element.getAttribute) {\n      // the extra argument \"2\" is to get the right thing for a.href in IE, see jQuery code\n      // some elements (e.g. Document) don't have get attribute, so return undefined\n      var ret = element.getAttribute(name, 2);\n      // normalize non-existing attributes to undefined (as jQuery)\n      return ret === null ? undefined : ret;\n    }\n  },\n\n  prop: function(element, name, value) {\n    if (isDefined(value)) {\n      element[name] = value;\n    } else {\n      return element[name];\n    }\n  },\n\n  text: (function() {\n    getText.$dv = '';\n    return getText;\n\n    function getText(element, value) {\n      if (isUndefined(value)) {\n        var nodeType = element.nodeType;\n        return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';\n      }\n      element.textContent = value;\n    }\n  })(),\n\n  val: function(element, value) {\n    if (isUndefined(value)) {\n      if (element.multiple && nodeName_(element) === 'select') {\n        var result = [];\n        forEach(element.options, function(option) {\n          if (option.selected) {\n            result.push(option.value || option.text);\n          }\n        });\n        return result.length === 0 ? null : result;\n      }\n      return element.value;\n    }\n    element.value = value;\n  },\n\n  html: function(element, value) {\n    if (isUndefined(value)) {\n      return element.innerHTML;\n    }\n    jqLiteDealoc(element, true);\n    element.innerHTML = value;\n  },\n\n  empty: jqLiteEmpty\n}, function(fn, name) {\n  /**\n   * Properties: writes return selection, reads return first value\n   */\n  JQLite.prototype[name] = function(arg1, arg2) {\n    var i, key;\n    var nodeCount = this.length;\n\n    // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it\n    // in a way that survives minification.\n    // jqLiteEmpty takes no arguments but is a setter.\n    if (fn !== jqLiteEmpty &&\n        (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {\n      if (isObject(arg1)) {\n\n        // we are a write, but the object properties are the key/values\n        for (i = 0; i < nodeCount; i++) {\n          if (fn === jqLiteData) {\n            // data() takes the whole object in jQuery\n            fn(this[i], arg1);\n          } else {\n            for (key in arg1) {\n              fn(this[i], key, arg1[key]);\n            }\n          }\n        }\n        // return self for chaining\n        return this;\n      } else {\n        // we are a read, so read the first child.\n        // TODO: do we still need this?\n        var value = fn.$dv;\n        // Only if we have $dv do we iterate over all, otherwise it is just the first element.\n        var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;\n        for (var j = 0; j < jj; j++) {\n          var nodeValue = fn(this[j], arg1, arg2);\n          value = value ? value + nodeValue : nodeValue;\n        }\n        return value;\n      }\n    } else {\n      // we are a write, so apply to all children\n      for (i = 0; i < nodeCount; i++) {\n        fn(this[i], arg1, arg2);\n      }\n      // return self for chaining\n      return this;\n    }\n  };\n});\n\nfunction createEventHandler(element, events) {\n  var eventHandler = function(event, type) {\n    // jQuery specific api\n    event.isDefaultPrevented = function() {\n      return event.defaultPrevented;\n    };\n\n    var eventFns = events[type || event.type];\n    var eventFnsLength = eventFns ? eventFns.length : 0;\n\n    if (!eventFnsLength) return;\n\n    if (isUndefined(event.immediatePropagationStopped)) {\n      var originalStopImmediatePropagation = event.stopImmediatePropagation;\n      event.stopImmediatePropagation = function() {\n        event.immediatePropagationStopped = true;\n\n        if (event.stopPropagation) {\n          event.stopPropagation();\n        }\n\n        if (originalStopImmediatePropagation) {\n          originalStopImmediatePropagation.call(event);\n        }\n      };\n    }\n\n    event.isImmediatePropagationStopped = function() {\n      return event.immediatePropagationStopped === true;\n    };\n\n    // Some events have special handlers that wrap the real handler\n    var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;\n\n    // Copy event handlers in case event handlers array is modified during execution.\n    if ((eventFnsLength > 1)) {\n      eventFns = shallowCopy(eventFns);\n    }\n\n    for (var i = 0; i < eventFnsLength; i++) {\n      if (!event.isImmediatePropagationStopped()) {\n        handlerWrapper(element, event, eventFns[i]);\n      }\n    }\n  };\n\n  // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all\n  //       events on `element`\n  eventHandler.elem = element;\n  return eventHandler;\n}\n\nfunction defaultHandlerWrapper(element, event, handler) {\n  handler.call(element, event);\n}\n\nfunction specialMouseHandlerWrapper(target, event, handler) {\n  // Refer to jQuery's implementation of mouseenter & mouseleave\n  // Read about mouseenter and mouseleave:\n  // http://www.quirksmode.org/js/events_mouse.html#link8\n  var related = event.relatedTarget;\n  // For mousenter/leave call the handler if related is outside the target.\n  // NB: No relatedTarget if the mouse left/entered the browser window\n  if (!related || (related !== target && !jqLiteContains.call(target, related))) {\n    handler.call(target, event);\n  }\n}\n\n//////////////////////////////////////////\n// Functions iterating traversal.\n// These functions chain results into a single\n// selector.\n//////////////////////////////////////////\nforEach({\n  removeData: jqLiteRemoveData,\n\n  on: function jqLiteOn(element, type, fn, unsupported) {\n    if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');\n\n    // Do not add event handlers to non-elements because they will not be cleaned up.\n    if (!jqLiteAcceptsData(element)) {\n      return;\n    }\n\n    var expandoStore = jqLiteExpandoStore(element, true);\n    var events = expandoStore.events;\n    var handle = expandoStore.handle;\n\n    if (!handle) {\n      handle = expandoStore.handle = createEventHandler(element, events);\n    }\n\n    // http://jsperf.com/string-indexof-vs-split\n    var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];\n    var i = types.length;\n\n    var addHandler = function(type, specialHandlerWrapper, noEventListener) {\n      var eventFns = events[type];\n\n      if (!eventFns) {\n        eventFns = events[type] = [];\n        eventFns.specialHandlerWrapper = specialHandlerWrapper;\n        if (type !== '$destroy' && !noEventListener) {\n          addEventListenerFn(element, type, handle);\n        }\n      }\n\n      eventFns.push(fn);\n    };\n\n    while (i--) {\n      type = types[i];\n      if (MOUSE_EVENT_MAP[type]) {\n        addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);\n        addHandler(type, undefined, true);\n      } else {\n        addHandler(type);\n      }\n    }\n  },\n\n  off: jqLiteOff,\n\n  one: function(element, type, fn) {\n    element = jqLite(element);\n\n    //add the listener twice so that when it is called\n    //you can remove the original function and still be\n    //able to call element.off(ev, fn) normally\n    element.on(type, function onFn() {\n      element.off(type, fn);\n      element.off(type, onFn);\n    });\n    element.on(type, fn);\n  },\n\n  replaceWith: function(element, replaceNode) {\n    var index, parent = element.parentNode;\n    jqLiteDealoc(element);\n    forEach(new JQLite(replaceNode), function(node) {\n      if (index) {\n        parent.insertBefore(node, index.nextSibling);\n      } else {\n        parent.replaceChild(node, element);\n      }\n      index = node;\n    });\n  },\n\n  children: function(element) {\n    var children = [];\n    forEach(element.childNodes, function(element) {\n      if (element.nodeType === NODE_TYPE_ELEMENT) {\n        children.push(element);\n      }\n    });\n    return children;\n  },\n\n  contents: function(element) {\n    return element.contentDocument || element.childNodes || [];\n  },\n\n  append: function(element, node) {\n    var nodeType = element.nodeType;\n    if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;\n\n    node = new JQLite(node);\n\n    for (var i = 0, ii = node.length; i < ii; i++) {\n      var child = node[i];\n      element.appendChild(child);\n    }\n  },\n\n  prepend: function(element, node) {\n    if (element.nodeType === NODE_TYPE_ELEMENT) {\n      var index = element.firstChild;\n      forEach(new JQLite(node), function(child) {\n        element.insertBefore(child, index);\n      });\n    }\n  },\n\n  wrap: function(element, wrapNode) {\n    jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);\n  },\n\n  remove: jqLiteRemove,\n\n  detach: function(element) {\n    jqLiteRemove(element, true);\n  },\n\n  after: function(element, newElement) {\n    var index = element, parent = element.parentNode;\n    newElement = new JQLite(newElement);\n\n    for (var i = 0, ii = newElement.length; i < ii; i++) {\n      var node = newElement[i];\n      parent.insertBefore(node, index.nextSibling);\n      index = node;\n    }\n  },\n\n  addClass: jqLiteAddClass,\n  removeClass: jqLiteRemoveClass,\n\n  toggleClass: function(element, selector, condition) {\n    if (selector) {\n      forEach(selector.split(' '), function(className) {\n        var classCondition = condition;\n        if (isUndefined(classCondition)) {\n          classCondition = !jqLiteHasClass(element, className);\n        }\n        (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);\n      });\n    }\n  },\n\n  parent: function(element) {\n    var parent = element.parentNode;\n    return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;\n  },\n\n  next: function(element) {\n    return element.nextElementSibling;\n  },\n\n  find: function(element, selector) {\n    if (element.getElementsByTagName) {\n      return element.getElementsByTagName(selector);\n    } else {\n      return [];\n    }\n  },\n\n  clone: jqLiteClone,\n\n  triggerHandler: function(element, event, extraParameters) {\n\n    var dummyEvent, eventFnsCopy, handlerArgs;\n    var eventName = event.type || event;\n    var expandoStore = jqLiteExpandoStore(element);\n    var events = expandoStore && expandoStore.events;\n    var eventFns = events && events[eventName];\n\n    if (eventFns) {\n      // Create a dummy event to pass to the handlers\n      dummyEvent = {\n        preventDefault: function() { this.defaultPrevented = true; },\n        isDefaultPrevented: function() { return this.defaultPrevented === true; },\n        stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },\n        isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },\n        stopPropagation: noop,\n        type: eventName,\n        target: element\n      };\n\n      // If a custom event was provided then extend our dummy event with it\n      if (event.type) {\n        dummyEvent = extend(dummyEvent, event);\n      }\n\n      // Copy event handlers in case event handlers array is modified during execution.\n      eventFnsCopy = shallowCopy(eventFns);\n      handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];\n\n      forEach(eventFnsCopy, function(fn) {\n        if (!dummyEvent.isImmediatePropagationStopped()) {\n          fn.apply(element, handlerArgs);\n        }\n      });\n    }\n  }\n}, function(fn, name) {\n  /**\n   * chaining functions\n   */\n  JQLite.prototype[name] = function(arg1, arg2, arg3) {\n    var value;\n\n    for (var i = 0, ii = this.length; i < ii; i++) {\n      if (isUndefined(value)) {\n        value = fn(this[i], arg1, arg2, arg3);\n        if (isDefined(value)) {\n          // any function which returns a value needs to be wrapped\n          value = jqLite(value);\n        }\n      } else {\n        jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));\n      }\n    }\n    return isDefined(value) ? value : this;\n  };\n\n  // bind legacy bind/unbind to on/off\n  JQLite.prototype.bind = JQLite.prototype.on;\n  JQLite.prototype.unbind = JQLite.prototype.off;\n});\n\n\n// Provider for private $$jqLite service\nfunction $$jqLiteProvider() {\n  this.$get = function $$jqLite() {\n    return extend(JQLite, {\n      hasClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteHasClass(node, classes);\n      },\n      addClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteAddClass(node, classes);\n      },\n      removeClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteRemoveClass(node, classes);\n      }\n    });\n  };\n}\n\n/**\n * Computes a hash of an 'obj'.\n * Hash of a:\n *  string is string\n *  number is number as string\n *  object is either result of calling $$hashKey function on the object or uniquely generated id,\n *         that is also assigned to the $$hashKey property of the object.\n *\n * @param obj\n * @returns {string} hash string such that the same input will have the same hash string.\n *         The resulting string key is in 'type:hashKey' format.\n */\nfunction hashKey(obj, nextUidFn) {\n  var key = obj && obj.$$hashKey;\n\n  if (key) {\n    if (typeof key === 'function') {\n      key = obj.$$hashKey();\n    }\n    return key;\n  }\n\n  var objType = typeof obj;\n  if (objType == 'function' || (objType == 'object' && obj !== null)) {\n    key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();\n  } else {\n    key = objType + ':' + obj;\n  }\n\n  return key;\n}\n\n/**\n * HashMap which can use objects as keys\n */\nfunction HashMap(array, isolatedUid) {\n  if (isolatedUid) {\n    var uid = 0;\n    this.nextUid = function() {\n      return ++uid;\n    };\n  }\n  forEach(array, this.put, this);\n}\nHashMap.prototype = {\n  /**\n   * Store key value pair\n   * @param key key to store can be any type\n   * @param value value to store can be any type\n   */\n  put: function(key, value) {\n    this[hashKey(key, this.nextUid)] = value;\n  },\n\n  /**\n   * @param key\n   * @returns {Object} the value for the key\n   */\n  get: function(key) {\n    return this[hashKey(key, this.nextUid)];\n  },\n\n  /**\n   * Remove the key/value pair\n   * @param key\n   */\n  remove: function(key) {\n    var value = this[key = hashKey(key, this.nextUid)];\n    delete this[key];\n    return value;\n  }\n};\n\nvar $$HashMapProvider = [function() {\n  this.$get = [function() {\n    return HashMap;\n  }];\n}];\n\n/**\n * @ngdoc function\n * @module ng\n * @name angular.injector\n * @kind function\n *\n * @description\n * Creates an injector object that can be used for retrieving services as well as for\n * dependency injection (see {@link guide/di dependency injection}).\n *\n * @param {Array.<string|Function>} modules A list of module functions or their aliases. See\n *     {@link angular.module}. The `ng` module must be explicitly added.\n * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which\n *     disallows argument name annotation inference.\n * @returns {injector} Injector object. See {@link auto.$injector $injector}.\n *\n * @example\n * Typical usage\n * ```js\n *   // create an injector\n *   var $injector = angular.injector(['ng']);\n *\n *   // use the injector to kick off your application\n *   // use the type inference to auto inject arguments, or use implicit injection\n *   $injector.invoke(function($rootScope, $compile, $document) {\n *     $compile($document)($rootScope);\n *     $rootScope.$digest();\n *   });\n * ```\n *\n * Sometimes you want to get access to the injector of a currently running Angular app\n * from outside Angular. Perhaps, you want to inject and compile some markup after the\n * application has been bootstrapped. You can do this using the extra `injector()` added\n * to JQuery/jqLite elements. See {@link angular.element}.\n *\n * *This is fairly rare but could be the case if a third party library is injecting the\n * markup.*\n *\n * In the following example a new block of HTML containing a `ng-controller`\n * directive is added to the end of the document body by JQuery. We then compile and link\n * it into the current AngularJS scope.\n *\n * ```js\n * var $div = $('<div ng-controller=\"MyCtrl\">{{content.label}}</div>');\n * $(document.body).append($div);\n *\n * angular.element(document).injector().invoke(function($compile) {\n *   var scope = angular.element($div).scope();\n *   $compile($div)(scope);\n * });\n * ```\n */\n\n\n/**\n * @ngdoc module\n * @name auto\n * @description\n *\n * Implicit module which gets automatically added to each {@link auto.$injector $injector}.\n */\n\nvar ARROW_ARG = /^([^\\(]+?)=>/;\nvar FN_ARGS = /^[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar FN_ARG_SPLIT = /,/;\nvar FN_ARG = /^\\s*(_?)(\\S+?)\\1\\s*$/;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nvar $injectorMinErr = minErr('$injector');\n\nfunction extractArgs(fn) {\n  var fnText = fn.toString().replace(STRIP_COMMENTS, ''),\n      args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);\n  return args;\n}\n\nfunction anonFn(fn) {\n  // For anonymous functions, showing at the very least the function signature can help in\n  // debugging.\n  var args = extractArgs(fn);\n  if (args) {\n    return 'function(' + (args[1] || '').replace(/[\\s\\r\\n]+/, ' ') + ')';\n  }\n  return 'fn';\n}\n\nfunction annotate(fn, strictDi, name) {\n  var $inject,\n      argDecl,\n      last;\n\n  if (typeof fn === 'function') {\n    if (!($inject = fn.$inject)) {\n      $inject = [];\n      if (fn.length) {\n        if (strictDi) {\n          if (!isString(name) || !name) {\n            name = fn.name || anonFn(fn);\n          }\n          throw $injectorMinErr('strictdi',\n            '{0} is not using explicit annotation and cannot be invoked in strict mode', name);\n        }\n        argDecl = extractArgs(fn);\n        forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {\n          arg.replace(FN_ARG, function(all, underscore, name) {\n            $inject.push(name);\n          });\n        });\n      }\n      fn.$inject = $inject;\n    }\n  } else if (isArray(fn)) {\n    last = fn.length - 1;\n    assertArgFn(fn[last], 'fn');\n    $inject = fn.slice(0, last);\n  } else {\n    assertArgFn(fn, 'fn', true);\n  }\n  return $inject;\n}\n\n///////////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $injector\n *\n * @description\n *\n * `$injector` is used to retrieve object instances as defined by\n * {@link auto.$provide provider}, instantiate types, invoke methods,\n * and load modules.\n *\n * The following always holds true:\n *\n * ```js\n *   var $injector = angular.injector();\n *   expect($injector.get('$injector')).toBe($injector);\n *   expect($injector.invoke(function($injector) {\n *     return $injector;\n *   })).toBe($injector);\n * ```\n *\n * # Injection Function Annotation\n *\n * JavaScript does not have annotations, and annotations are needed for dependency injection. The\n * following are all valid ways of annotating function with injection arguments and are equivalent.\n *\n * ```js\n *   // inferred (only works if code not minified/obfuscated)\n *   $injector.invoke(function(serviceA){});\n *\n *   // annotated\n *   function explicit(serviceA) {};\n *   explicit.$inject = ['serviceA'];\n *   $injector.invoke(explicit);\n *\n *   // inline\n *   $injector.invoke(['serviceA', function(serviceA){}]);\n * ```\n *\n * ## Inference\n *\n * In JavaScript calling `toString()` on a function returns the function definition. The definition\n * can then be parsed and the function arguments can be extracted. This method of discovering\n * annotations is disallowed when the injector is in strict mode.\n * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the\n * argument names.\n *\n * ## `$inject` Annotation\n * By adding an `$inject` property onto a function the injection parameters can be specified.\n *\n * ## Inline\n * As an array of injection names, where the last item in the array is the function to call.\n */\n\n/**\n * @ngdoc method\n * @name $injector#get\n *\n * @description\n * Return an instance of the service.\n *\n * @param {string} name The name of the instance to retrieve.\n * @param {string=} caller An optional string to provide the origin of the function call for error messages.\n * @return {*} The instance.\n */\n\n/**\n * @ngdoc method\n * @name $injector#invoke\n *\n * @description\n * Invoke the method and supply the method arguments from the `$injector`.\n *\n * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are\n *   injected according to the {@link guide/di $inject Annotation} rules.\n * @param {Object=} self The `this` for the invoked method.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n *                         object first, before the `$injector` is consulted.\n * @returns {*} the value returned by the invoked `fn` function.\n */\n\n/**\n * @ngdoc method\n * @name $injector#has\n *\n * @description\n * Allows the user to query if the particular service exists.\n *\n * @param {string} name Name of the service to query.\n * @returns {boolean} `true` if injector has given service.\n */\n\n/**\n * @ngdoc method\n * @name $injector#instantiate\n * @description\n * Create a new instance of JS type. The method takes a constructor function, invokes the new\n * operator, and supplies all of the arguments to the constructor function as specified by the\n * constructor annotation.\n *\n * @param {Function} Type Annotated constructor function.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n * object first, before the `$injector` is consulted.\n * @returns {Object} new instance of `Type`.\n */\n\n/**\n * @ngdoc method\n * @name $injector#annotate\n *\n * @description\n * Returns an array of service names which the function is requesting for injection. This API is\n * used by the injector to determine which services need to be injected into the function when the\n * function is invoked. There are three ways in which the function can be annotated with the needed\n * dependencies.\n *\n * # Argument names\n *\n * The simplest form is to extract the dependencies from the arguments of the function. This is done\n * by converting the function into a string using `toString()` method and extracting the argument\n * names.\n * ```js\n *   // Given\n *   function MyController($scope, $route) {\n *     // ...\n *   }\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * You can disallow this method by using strict injection mode.\n *\n * This method does not work with code minification / obfuscation. For this reason the following\n * annotation strategies are supported.\n *\n * # The `$inject` property\n *\n * If a function has an `$inject` property and its value is an array of strings, then the strings\n * represent names of services to be injected into the function.\n * ```js\n *   // Given\n *   var MyController = function(obfuscatedScope, obfuscatedRoute) {\n *     // ...\n *   }\n *   // Define function dependencies\n *   MyController['$inject'] = ['$scope', '$route'];\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * # The array notation\n *\n * It is often desirable to inline Injected functions and that's when setting the `$inject` property\n * is very inconvenient. In these situations using the array notation to specify the dependencies in\n * a way that survives minification is a better choice:\n *\n * ```js\n *   // We wish to write this (not minification / obfuscation safe)\n *   injector.invoke(function($compile, $rootScope) {\n *     // ...\n *   });\n *\n *   // We are forced to write break inlining\n *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {\n *     // ...\n *   };\n *   tmpFn.$inject = ['$compile', '$rootScope'];\n *   injector.invoke(tmpFn);\n *\n *   // To better support inline function the inline annotation is supported\n *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {\n *     // ...\n *   }]);\n *\n *   // Therefore\n *   expect(injector.annotate(\n *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])\n *    ).toEqual(['$compile', '$rootScope']);\n * ```\n *\n * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to\n * be retrieved as described above.\n *\n * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.\n *\n * @returns {Array.<string>} The names of the services which the function requires.\n */\n\n\n\n\n/**\n * @ngdoc service\n * @name $provide\n *\n * @description\n *\n * The {@link auto.$provide $provide} service has a number of methods for registering components\n * with the {@link auto.$injector $injector}. Many of these functions are also exposed on\n * {@link angular.Module}.\n *\n * An Angular **service** is a singleton object created by a **service factory**.  These **service\n * factories** are functions which, in turn, are created by a **service provider**.\n * The **service providers** are constructor functions. When instantiated they must contain a\n * property called `$get`, which holds the **service factory** function.\n *\n * When you request a service, the {@link auto.$injector $injector} is responsible for finding the\n * correct **service provider**, instantiating it and then calling its `$get` **service factory**\n * function to get the instance of the **service**.\n *\n * Often services have no configuration options and there is no need to add methods to the service\n * provider.  The provider will be no more than a constructor function with a `$get` property. For\n * these cases the {@link auto.$provide $provide} service has additional helper methods to register\n * services without specifying a provider.\n *\n * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the\n *     {@link auto.$injector $injector}\n * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by\n *     providers and services.\n * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by\n *     services, not providers.\n * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,\n *     that will be wrapped in a **service provider** object, whose `$get` property will contain the\n *     given factory function.\n * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`\n *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate\n *      a new object using the given constructor function.\n *\n * See the individual methods for more information and examples.\n */\n\n/**\n * @ngdoc method\n * @name $provide#provider\n * @description\n *\n * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions\n * are constructor functions, whose instances are responsible for \"providing\" a factory for a\n * service.\n *\n * Service provider names start with the name of the service they provide followed by `Provider`.\n * For example, the {@link ng.$log $log} service has a provider called\n * {@link ng.$logProvider $logProvider}.\n *\n * Service provider objects can have additional methods which allow configuration of the provider\n * and its service. Importantly, you can configure what kind of service is created by the `$get`\n * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a\n * method {@link ng.$logProvider#debugEnabled debugEnabled}\n * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the\n * console or not.\n *\n * @param {string} name The name of the instance. NOTE: the provider will be available under `name +\n                        'Provider'` key.\n * @param {(Object|function())} provider If the provider is:\n *\n *   - `Object`: then it should have a `$get` method. The `$get` method will be invoked using\n *     {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.\n *   - `Constructor`: a new instance of the provider will be created using\n *     {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.\n *\n * @returns {Object} registered provider instance\n\n * @example\n *\n * The following example shows how to create a simple event tracking service and register it using\n * {@link auto.$provide#provider $provide.provider()}.\n *\n * ```js\n *  // Define the eventTracker provider\n *  function EventTrackerProvider() {\n *    var trackingUrl = '/track';\n *\n *    // A provider method for configuring where the tracked events should been saved\n *    this.setTrackingUrl = function(url) {\n *      trackingUrl = url;\n *    };\n *\n *    // The service factory function\n *    this.$get = ['$http', function($http) {\n *      var trackedEvents = {};\n *      return {\n *        // Call this to track an event\n *        event: function(event) {\n *          var count = trackedEvents[event] || 0;\n *          count += 1;\n *          trackedEvents[event] = count;\n *          return count;\n *        },\n *        // Call this to save the tracked events to the trackingUrl\n *        save: function() {\n *          $http.post(trackingUrl, trackedEvents);\n *        }\n *      };\n *    }];\n *  }\n *\n *  describe('eventTracker', function() {\n *    var postSpy;\n *\n *    beforeEach(module(function($provide) {\n *      // Register the eventTracker provider\n *      $provide.provider('eventTracker', EventTrackerProvider);\n *    }));\n *\n *    beforeEach(module(function(eventTrackerProvider) {\n *      // Configure eventTracker provider\n *      eventTrackerProvider.setTrackingUrl('/custom-track');\n *    }));\n *\n *    it('tracks events', inject(function(eventTracker) {\n *      expect(eventTracker.event('login')).toEqual(1);\n *      expect(eventTracker.event('login')).toEqual(2);\n *    }));\n *\n *    it('saves to the tracking url', inject(function(eventTracker, $http) {\n *      postSpy = spyOn($http, 'post');\n *      eventTracker.event('login');\n *      eventTracker.save();\n *      expect(postSpy).toHaveBeenCalled();\n *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');\n *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');\n *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });\n *    }));\n *  });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $provide#factory\n * @description\n *\n * Register a **service factory**, which will be called to return the service instance.\n * This is short for registering a service where its provider consists of only a `$get` property,\n * which is the given service factory function.\n * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to\n * configure your service in a provider.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.\n *                      Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service\n * ```js\n *   $provide.factory('ping', ['$http', function($http) {\n *     return function ping() {\n *       return $http.send('/ping');\n *     };\n *   }]);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#service\n * @description\n *\n * Register a **service constructor**, which will be invoked with `new` to create the service\n * instance.\n * This is short for registering a service where its provider's `$get` property is a factory\n * function that returns an instance instantiated by the injector from the service constructor\n * function.\n *\n * Internally it looks a bit like this:\n *\n * ```\n * {\n *   $get: function() {\n *     return $injector.instantiate(constructor);\n *   }\n * }\n * ```\n *\n *\n * You should use {@link auto.$provide#service $provide.service(class)} if you define your service\n * as a type/class.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)\n *     that will be instantiated.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service using\n * {@link auto.$provide#service $provide.service(class)}.\n * ```js\n *   var Ping = function($http) {\n *     this.$http = $http;\n *   };\n *\n *   Ping.$inject = ['$http'];\n *\n *   Ping.prototype.send = function() {\n *     return this.$http.get('/ping');\n *   };\n *   $provide.service('ping', Ping);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping.send();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#value\n * @description\n *\n * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a\n * number, an array, an object or a function. This is short for registering a service where its\n * provider's `$get` property is a factory function that takes no arguments and returns the **value\n * service**. That also means it is not possible to inject other services into a value service.\n *\n * Value services are similar to constant services, except that they cannot be injected into a\n * module configuration function (see {@link angular.Module#config}) but they can be overridden by\n * an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the instance.\n * @param {*} value The value.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here are some examples of creating value services.\n * ```js\n *   $provide.value('ADMIN_USER', 'admin');\n *\n *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });\n *\n *   $provide.value('halfOf', function(value) {\n *     return value / 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#constant\n * @description\n *\n * Register a **constant service** with the {@link auto.$injector $injector}, such as a string,\n * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not\n * possible to inject other services into a constant.\n *\n * But unlike {@link auto.$provide#value value}, a constant can be\n * injected into a module configuration function (see {@link angular.Module#config}) and it cannot\n * be overridden by an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the constant.\n * @param {*} value The constant value.\n * @returns {Object} registered instance\n *\n * @example\n * Here a some examples of creating constants:\n * ```js\n *   $provide.constant('SHARD_HEIGHT', 306);\n *\n *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);\n *\n *   $provide.constant('double', function(value) {\n *     return value * 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#decorator\n * @description\n *\n * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator\n * intercepts the creation of a service, allowing it to override or modify the behavior of the\n * service. The object returned by the decorator may be the original service, or a new service\n * object which replaces or wraps and delegates to the original service.\n *\n * @param {string} name The name of the service to decorate.\n * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be\n *    instantiated and should return the decorated service instance. The function is called using\n *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.\n *    Local injection arguments:\n *\n *    * `$delegate` - The original service instance, which can be monkey patched, configured,\n *      decorated or delegated to.\n *\n * @example\n * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting\n * calls to {@link ng.$log#error $log.warn()}.\n * ```js\n *   $provide.decorator('$log', ['$delegate', function($delegate) {\n *     $delegate.warn = $delegate.error;\n *     return $delegate;\n *   }]);\n * ```\n */\n\n\nfunction createInjector(modulesToLoad, strictDi) {\n  strictDi = (strictDi === true);\n  var INSTANTIATING = {},\n      providerSuffix = 'Provider',\n      path = [],\n      loadedModules = new HashMap([], true),\n      providerCache = {\n        $provide: {\n            provider: supportObject(provider),\n            factory: supportObject(factory),\n            service: supportObject(service),\n            value: supportObject(value),\n            constant: supportObject(constant),\n            decorator: decorator\n          }\n      },\n      providerInjector = (providerCache.$injector =\n          createInternalInjector(providerCache, function(serviceName, caller) {\n            if (angular.isString(caller)) {\n              path.push(caller);\n            }\n            throw $injectorMinErr('unpr', \"Unknown provider: {0}\", path.join(' <- '));\n          })),\n      instanceCache = {},\n      protoInstanceInjector =\n          createInternalInjector(instanceCache, function(serviceName, caller) {\n            var provider = providerInjector.get(serviceName + providerSuffix, caller);\n            return instanceInjector.invoke(\n                provider.$get, provider, undefined, serviceName);\n          }),\n      instanceInjector = protoInstanceInjector;\n\n  providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };\n  var runBlocks = loadModules(modulesToLoad);\n  instanceInjector = protoInstanceInjector.get('$injector');\n  instanceInjector.strictDi = strictDi;\n  forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });\n\n  return instanceInjector;\n\n  ////////////////////////////////////\n  // $provider\n  ////////////////////////////////////\n\n  function supportObject(delegate) {\n    return function(key, value) {\n      if (isObject(key)) {\n        forEach(key, reverseParams(delegate));\n      } else {\n        return delegate(key, value);\n      }\n    };\n  }\n\n  function provider(name, provider_) {\n    assertNotHasOwnProperty(name, 'service');\n    if (isFunction(provider_) || isArray(provider_)) {\n      provider_ = providerInjector.instantiate(provider_);\n    }\n    if (!provider_.$get) {\n      throw $injectorMinErr('pget', \"Provider '{0}' must define $get factory method.\", name);\n    }\n    return providerCache[name + providerSuffix] = provider_;\n  }\n\n  function enforceReturnValue(name, factory) {\n    return function enforcedReturnValue() {\n      var result = instanceInjector.invoke(factory, this);\n      if (isUndefined(result)) {\n        throw $injectorMinErr('undef', \"Provider '{0}' must return a value from $get factory method.\", name);\n      }\n      return result;\n    };\n  }\n\n  function factory(name, factoryFn, enforce) {\n    return provider(name, {\n      $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn\n    });\n  }\n\n  function service(name, constructor) {\n    return factory(name, ['$injector', function($injector) {\n      return $injector.instantiate(constructor);\n    }]);\n  }\n\n  function value(name, val) { return factory(name, valueFn(val), false); }\n\n  function constant(name, value) {\n    assertNotHasOwnProperty(name, 'constant');\n    providerCache[name] = value;\n    instanceCache[name] = value;\n  }\n\n  function decorator(serviceName, decorFn) {\n    var origProvider = providerInjector.get(serviceName + providerSuffix),\n        orig$get = origProvider.$get;\n\n    origProvider.$get = function() {\n      var origInstance = instanceInjector.invoke(orig$get, origProvider);\n      return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});\n    };\n  }\n\n  ////////////////////////////////////\n  // Module Loading\n  ////////////////////////////////////\n  function loadModules(modulesToLoad) {\n    assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');\n    var runBlocks = [], moduleFn;\n    forEach(modulesToLoad, function(module) {\n      if (loadedModules.get(module)) return;\n      loadedModules.put(module, true);\n\n      function runInvokeQueue(queue) {\n        var i, ii;\n        for (i = 0, ii = queue.length; i < ii; i++) {\n          var invokeArgs = queue[i],\n              provider = providerInjector.get(invokeArgs[0]);\n\n          provider[invokeArgs[1]].apply(provider, invokeArgs[2]);\n        }\n      }\n\n      try {\n        if (isString(module)) {\n          moduleFn = angularModule(module);\n          runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);\n          runInvokeQueue(moduleFn._invokeQueue);\n          runInvokeQueue(moduleFn._configBlocks);\n        } else if (isFunction(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else if (isArray(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else {\n          assertArgFn(module, 'module');\n        }\n      } catch (e) {\n        if (isArray(module)) {\n          module = module[module.length - 1];\n        }\n        if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {\n          // Safari & FF's stack traces don't contain error.message content\n          // unlike those of Chrome and IE\n          // So if stack doesn't contain message, we create a new string that contains both.\n          // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.\n          /* jshint -W022 */\n          e = e.message + '\\n' + e.stack;\n        }\n        throw $injectorMinErr('modulerr', \"Failed to instantiate module {0} due to:\\n{1}\",\n                  module, e.stack || e.message || e);\n      }\n    });\n    return runBlocks;\n  }\n\n  ////////////////////////////////////\n  // internal Injector\n  ////////////////////////////////////\n\n  function createInternalInjector(cache, factory) {\n\n    function getService(serviceName, caller) {\n      if (cache.hasOwnProperty(serviceName)) {\n        if (cache[serviceName] === INSTANTIATING) {\n          throw $injectorMinErr('cdep', 'Circular dependency found: {0}',\n                    serviceName + ' <- ' + path.join(' <- '));\n        }\n        return cache[serviceName];\n      } else {\n        try {\n          path.unshift(serviceName);\n          cache[serviceName] = INSTANTIATING;\n          return cache[serviceName] = factory(serviceName, caller);\n        } catch (err) {\n          if (cache[serviceName] === INSTANTIATING) {\n            delete cache[serviceName];\n          }\n          throw err;\n        } finally {\n          path.shift();\n        }\n      }\n    }\n\n\n    function injectionArgs(fn, locals, serviceName) {\n      var args = [],\n          $inject = createInjector.$$annotate(fn, strictDi, serviceName);\n\n      for (var i = 0, length = $inject.length; i < length; i++) {\n        var key = $inject[i];\n        if (typeof key !== 'string') {\n          throw $injectorMinErr('itkn',\n                  'Incorrect injection token! Expected service name as string, got {0}', key);\n        }\n        args.push(locals && locals.hasOwnProperty(key) ? locals[key] :\n                                                         getService(key, serviceName));\n      }\n      return args;\n    }\n\n    function isClass(func) {\n      // IE 9-11 do not support classes and IE9 leaks with the code below.\n      if (msie <= 11) {\n        return false;\n      }\n      // Workaround for MS Edge.\n      // Check https://connect.microsoft.com/IE/Feedback/Details/2211653\n      return typeof func === 'function'\n        && /^(?:class\\s|constructor\\()/.test(Function.prototype.toString.call(func));\n    }\n\n    function invoke(fn, self, locals, serviceName) {\n      if (typeof locals === 'string') {\n        serviceName = locals;\n        locals = null;\n      }\n\n      var args = injectionArgs(fn, locals, serviceName);\n      if (isArray(fn)) {\n        fn = fn[fn.length - 1];\n      }\n\n      if (!isClass(fn)) {\n        // http://jsperf.com/angularjs-invoke-apply-vs-switch\n        // #5388\n        return fn.apply(self, args);\n      } else {\n        args.unshift(null);\n        return new (Function.prototype.bind.apply(fn, args))();\n      }\n    }\n\n\n    function instantiate(Type, locals, serviceName) {\n      // Check if Type is annotated and use just the given function at n-1 as parameter\n      // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);\n      var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);\n      var args = injectionArgs(Type, locals, serviceName);\n      // Empty object at position 0 is ignored for invocation with `new`, but required.\n      args.unshift(null);\n      return new (Function.prototype.bind.apply(ctor, args))();\n    }\n\n\n    return {\n      invoke: invoke,\n      instantiate: instantiate,\n      get: getService,\n      annotate: createInjector.$$annotate,\n      has: function(name) {\n        return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);\n      }\n    };\n  }\n}\n\ncreateInjector.$$annotate = annotate;\n\n/**\n * @ngdoc provider\n * @name $anchorScrollProvider\n *\n * @description\n * Use `$anchorScrollProvider` to disable automatic scrolling whenever\n * {@link ng.$location#hash $location.hash()} changes.\n */\nfunction $AnchorScrollProvider() {\n\n  var autoScrollingEnabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $anchorScrollProvider#disableAutoScrolling\n   *\n   * @description\n   * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to\n   * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />\n   * Use this method to disable automatic scrolling.\n   *\n   * If automatic scrolling is disabled, one must explicitly call\n   * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the\n   * current hash.\n   */\n  this.disableAutoScrolling = function() {\n    autoScrollingEnabled = false;\n  };\n\n  /**\n   * @ngdoc service\n   * @name $anchorScroll\n   * @kind function\n   * @requires $window\n   * @requires $location\n   * @requires $rootScope\n   *\n   * @description\n   * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the\n   * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified\n   * in the\n   * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-indicated-part-of-the-document).\n   *\n   * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to\n   * match any anchor whenever it changes. This can be disabled by calling\n   * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.\n   *\n   * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a\n   * vertical scroll-offset (either fixed or dynamic).\n   *\n   * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of\n   *                       {@link ng.$location#hash $location.hash()} will be used.\n   *\n   * @property {(number|function|jqLite)} yOffset\n   * If set, specifies a vertical scroll-offset. This is often useful when there are fixed\n   * positioned elements at the top of the page, such as navbars, headers etc.\n   *\n   * `yOffset` can be specified in various ways:\n   * - **number**: A fixed number of pixels to be used as offset.<br /><br />\n   * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return\n   *   a number representing the offset (in pixels).<br /><br />\n   * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from\n   *   the top of the page to the element's bottom will be used as offset.<br />\n   *   **Note**: The element will be taken into account only as long as its `position` is set to\n   *   `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust\n   *   their height and/or positioning according to the viewport's size.\n   *\n   * <br />\n   * <div class=\"alert alert-warning\">\n   * In order for `yOffset` to work properly, scrolling should take place on the document's root and\n   * not some child element.\n   * </div>\n   *\n   * @example\n     <example module=\"anchorScrollExample\">\n       <file name=\"index.html\">\n         <div id=\"scrollArea\" ng-controller=\"ScrollController\">\n           <a ng-click=\"gotoBottom()\">Go to bottom</a>\n           <a id=\"bottom\"></a> You're at the bottom!\n         </div>\n       </file>\n       <file name=\"script.js\">\n         angular.module('anchorScrollExample', [])\n           .controller('ScrollController', ['$scope', '$location', '$anchorScroll',\n             function ($scope, $location, $anchorScroll) {\n               $scope.gotoBottom = function() {\n                 // set the location.hash to the id of\n                 // the element you wish to scroll to.\n                 $location.hash('bottom');\n\n                 // call $anchorScroll()\n                 $anchorScroll();\n               };\n             }]);\n       </file>\n       <file name=\"style.css\">\n         #scrollArea {\n           height: 280px;\n           overflow: auto;\n         }\n\n         #bottom {\n           display: block;\n           margin-top: 2000px;\n         }\n       </file>\n     </example>\n   *\n   * <hr />\n   * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).\n   * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.\n   *\n   * @example\n     <example module=\"anchorScrollOffsetExample\">\n       <file name=\"index.html\">\n         <div class=\"fixed-header\" ng-controller=\"headerCtrl\">\n           <a href=\"\" ng-click=\"gotoAnchor(x)\" ng-repeat=\"x in [1,2,3,4,5]\">\n             Go to anchor {{x}}\n           </a>\n         </div>\n         <div id=\"anchor{{x}}\" class=\"anchor\" ng-repeat=\"x in [1,2,3,4,5]\">\n           Anchor {{x}} of 5\n         </div>\n       </file>\n       <file name=\"script.js\">\n         angular.module('anchorScrollOffsetExample', [])\n           .run(['$anchorScroll', function($anchorScroll) {\n             $anchorScroll.yOffset = 50;   // always scroll by 50 extra pixels\n           }])\n           .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',\n             function ($anchorScroll, $location, $scope) {\n               $scope.gotoAnchor = function(x) {\n                 var newHash = 'anchor' + x;\n                 if ($location.hash() !== newHash) {\n                   // set the $location.hash to `newHash` and\n                   // $anchorScroll will automatically scroll to it\n                   $location.hash('anchor' + x);\n                 } else {\n                   // call $anchorScroll() explicitly,\n                   // since $location.hash hasn't changed\n                   $anchorScroll();\n                 }\n               };\n             }\n           ]);\n       </file>\n       <file name=\"style.css\">\n         body {\n           padding-top: 50px;\n         }\n\n         .anchor {\n           border: 2px dashed DarkOrchid;\n           padding: 10px 10px 200px 10px;\n         }\n\n         .fixed-header {\n           background-color: rgba(0, 0, 0, 0.2);\n           height: 50px;\n           position: fixed;\n           top: 0; left: 0; right: 0;\n         }\n\n         .fixed-header > a {\n           display: inline-block;\n           margin: 5px 15px;\n         }\n       </file>\n     </example>\n   */\n  this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {\n    var document = $window.document;\n\n    // Helper function to get first anchor from a NodeList\n    // (using `Array#some()` instead of `angular#forEach()` since it's more performant\n    //  and working in all supported browsers.)\n    function getFirstAnchor(list) {\n      var result = null;\n      Array.prototype.some.call(list, function(element) {\n        if (nodeName_(element) === 'a') {\n          result = element;\n          return true;\n        }\n      });\n      return result;\n    }\n\n    function getYOffset() {\n\n      var offset = scroll.yOffset;\n\n      if (isFunction(offset)) {\n        offset = offset();\n      } else if (isElement(offset)) {\n        var elem = offset[0];\n        var style = $window.getComputedStyle(elem);\n        if (style.position !== 'fixed') {\n          offset = 0;\n        } else {\n          offset = elem.getBoundingClientRect().bottom;\n        }\n      } else if (!isNumber(offset)) {\n        offset = 0;\n      }\n\n      return offset;\n    }\n\n    function scrollTo(elem) {\n      if (elem) {\n        elem.scrollIntoView();\n\n        var offset = getYOffset();\n\n        if (offset) {\n          // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.\n          // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the\n          // top of the viewport.\n          //\n          // IF the number of pixels from the top of `elem` to the end of the page's content is less\n          // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some\n          // way down the page.\n          //\n          // This is often the case for elements near the bottom of the page.\n          //\n          // In such cases we do not need to scroll the whole `offset` up, just the difference between\n          // the top of the element and the offset, which is enough to align the top of `elem` at the\n          // desired position.\n          var elemTop = elem.getBoundingClientRect().top;\n          $window.scrollBy(0, elemTop - offset);\n        }\n      } else {\n        $window.scrollTo(0, 0);\n      }\n    }\n\n    function scroll(hash) {\n      hash = isString(hash) ? hash : $location.hash();\n      var elm;\n\n      // empty hash, scroll to the top of the page\n      if (!hash) scrollTo(null);\n\n      // element with given id\n      else if ((elm = document.getElementById(hash))) scrollTo(elm);\n\n      // first anchor with given name :-D\n      else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);\n\n      // no element and hash == 'top', scroll to the top of the page\n      else if (hash === 'top') scrollTo(null);\n    }\n\n    // does not scroll when user clicks on anchor link that is currently on\n    // (no url change, no $location.hash() change), browser native does scroll\n    if (autoScrollingEnabled) {\n      $rootScope.$watch(function autoScrollWatch() {return $location.hash();},\n        function autoScrollWatchAction(newVal, oldVal) {\n          // skip the initial scroll if $location.hash is empty\n          if (newVal === oldVal && newVal === '') return;\n\n          jqLiteDocumentLoaded(function() {\n            $rootScope.$evalAsync(scroll);\n          });\n        });\n    }\n\n    return scroll;\n  }];\n}\n\nvar $animateMinErr = minErr('$animate');\nvar ELEMENT_NODE = 1;\nvar NG_ANIMATE_CLASSNAME = 'ng-animate';\n\nfunction mergeClasses(a,b) {\n  if (!a && !b) return '';\n  if (!a) return b;\n  if (!b) return a;\n  if (isArray(a)) a = a.join(' ');\n  if (isArray(b)) b = b.join(' ');\n  return a + ' ' + b;\n}\n\nfunction extractElementNode(element) {\n  for (var i = 0; i < element.length; i++) {\n    var elm = element[i];\n    if (elm.nodeType === ELEMENT_NODE) {\n      return elm;\n    }\n  }\n}\n\nfunction splitClasses(classes) {\n  if (isString(classes)) {\n    classes = classes.split(' ');\n  }\n\n  // Use createMap() to prevent class assumptions involving property names in\n  // Object.prototype\n  var obj = createMap();\n  forEach(classes, function(klass) {\n    // sometimes the split leaves empty string values\n    // incase extra spaces were applied to the options\n    if (klass.length) {\n      obj[klass] = true;\n    }\n  });\n  return obj;\n}\n\n// if any other type of options value besides an Object value is\n// passed into the $animate.method() animation then this helper code\n// will be run which will ignore it. While this patch is not the\n// greatest solution to this, a lot of existing plugins depend on\n// $animate to either call the callback (< 1.2) or return a promise\n// that can be changed. This helper function ensures that the options\n// are wiped clean incase a callback function is provided.\nfunction prepareAnimateOptions(options) {\n  return isObject(options)\n      ? options\n      : {};\n}\n\nvar $$CoreAnimateJsProvider = function() {\n  this.$get = noop;\n};\n\n// this is prefixed with Core since it conflicts with\n// the animateQueueProvider defined in ngAnimate/animateQueue.js\nvar $$CoreAnimateQueueProvider = function() {\n  var postDigestQueue = new HashMap();\n  var postDigestElements = [];\n\n  this.$get = ['$$AnimateRunner', '$rootScope',\n       function($$AnimateRunner,   $rootScope) {\n    return {\n      enabled: noop,\n      on: noop,\n      off: noop,\n      pin: noop,\n\n      push: function(element, event, options, domOperation) {\n        domOperation        && domOperation();\n\n        options = options || {};\n        options.from        && element.css(options.from);\n        options.to          && element.css(options.to);\n\n        if (options.addClass || options.removeClass) {\n          addRemoveClassesPostDigest(element, options.addClass, options.removeClass);\n        }\n\n        var runner = new $$AnimateRunner(); // jshint ignore:line\n\n        // since there are no animations to run the runner needs to be\n        // notified that the animation call is complete.\n        runner.complete();\n        return runner;\n      }\n    };\n\n\n    function updateData(data, classes, value) {\n      var changed = false;\n      if (classes) {\n        classes = isString(classes) ? classes.split(' ') :\n                  isArray(classes) ? classes : [];\n        forEach(classes, function(className) {\n          if (className) {\n            changed = true;\n            data[className] = value;\n          }\n        });\n      }\n      return changed;\n    }\n\n    function handleCSSClassChanges() {\n      forEach(postDigestElements, function(element) {\n        var data = postDigestQueue.get(element);\n        if (data) {\n          var existing = splitClasses(element.attr('class'));\n          var toAdd = '';\n          var toRemove = '';\n          forEach(data, function(status, className) {\n            var hasClass = !!existing[className];\n            if (status !== hasClass) {\n              if (status) {\n                toAdd += (toAdd.length ? ' ' : '') + className;\n              } else {\n                toRemove += (toRemove.length ? ' ' : '') + className;\n              }\n            }\n          });\n\n          forEach(element, function(elm) {\n            toAdd    && jqLiteAddClass(elm, toAdd);\n            toRemove && jqLiteRemoveClass(elm, toRemove);\n          });\n          postDigestQueue.remove(element);\n        }\n      });\n      postDigestElements.length = 0;\n    }\n\n\n    function addRemoveClassesPostDigest(element, add, remove) {\n      var data = postDigestQueue.get(element) || {};\n\n      var classesAdded = updateData(data, add, true);\n      var classesRemoved = updateData(data, remove, false);\n\n      if (classesAdded || classesRemoved) {\n\n        postDigestQueue.put(element, data);\n        postDigestElements.push(element);\n\n        if (postDigestElements.length === 1) {\n          $rootScope.$$postDigest(handleCSSClassChanges);\n        }\n      }\n    }\n  }];\n};\n\n/**\n * @ngdoc provider\n * @name $animateProvider\n *\n * @description\n * Default implementation of $animate that doesn't perform any animations, instead just\n * synchronously performs DOM updates and resolves the returned runner promise.\n *\n * In order to enable animations the `ngAnimate` module has to be loaded.\n *\n * To see the functional implementation check out `src/ngAnimate/animate.js`.\n */\nvar $AnimateProvider = ['$provide', function($provide) {\n  var provider = this;\n\n  this.$$registeredAnimations = Object.create(null);\n\n   /**\n   * @ngdoc method\n   * @name $animateProvider#register\n   *\n   * @description\n   * Registers a new injectable animation factory function. The factory function produces the\n   * animation object which contains callback functions for each event that is expected to be\n   * animated.\n   *\n   *   * `eventFn`: `function(element, ... , doneFunction, options)`\n   *   The element to animate, the `doneFunction` and the options fed into the animation. Depending\n   *   on the type of animation additional arguments will be injected into the animation function. The\n   *   list below explains the function signatures for the different animation methods:\n   *\n   *   - setClass: function(element, addedClasses, removedClasses, doneFunction, options)\n   *   - addClass: function(element, addedClasses, doneFunction, options)\n   *   - removeClass: function(element, removedClasses, doneFunction, options)\n   *   - enter, leave, move: function(element, doneFunction, options)\n   *   - animate: function(element, fromStyles, toStyles, doneFunction, options)\n   *\n   *   Make sure to trigger the `doneFunction` once the animation is fully complete.\n   *\n   * ```js\n   *   return {\n   *     //enter, leave, move signature\n   *     eventFn : function(element, done, options) {\n   *       //code to run the animation\n   *       //once complete, then run done()\n   *       return function endFunction(wasCancelled) {\n   *         //code to cancel the animation\n   *       }\n   *     }\n   *   }\n   * ```\n   *\n   * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).\n   * @param {Function} factory The factory function that will be executed to return the animation\n   *                           object.\n   */\n  this.register = function(name, factory) {\n    if (name && name.charAt(0) !== '.') {\n      throw $animateMinErr('notcsel', \"Expecting class selector starting with '.' got '{0}'.\", name);\n    }\n\n    var key = name + '-animation';\n    provider.$$registeredAnimations[name.substr(1)] = key;\n    $provide.factory(key, factory);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $animateProvider#classNameFilter\n   *\n   * @description\n   * Sets and/or returns the CSS class regular expression that is checked when performing\n   * an animation. Upon bootstrap the classNameFilter value is not set at all and will\n   * therefore enable $animate to attempt to perform an animation on any element that is triggered.\n   * When setting the `classNameFilter` value, animations will only be performed on elements\n   * that successfully match the filter expression. This in turn can boost performance\n   * for low-powered devices as well as applications containing a lot of structural operations.\n   * @param {RegExp=} expression The className expression which will be checked against all animations\n   * @return {RegExp} The current CSS className expression value. If null then there is no expression value\n   */\n  this.classNameFilter = function(expression) {\n    if (arguments.length === 1) {\n      this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;\n      if (this.$$classNameFilter) {\n        var reservedRegex = new RegExp(\"(\\\\s+|\\\\/)\" + NG_ANIMATE_CLASSNAME + \"(\\\\s+|\\\\/)\");\n        if (reservedRegex.test(this.$$classNameFilter.toString())) {\n          throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the \"{0}\" CSS class.', NG_ANIMATE_CLASSNAME);\n\n        }\n      }\n    }\n    return this.$$classNameFilter;\n  };\n\n  this.$get = ['$$animateQueue', function($$animateQueue) {\n    function domInsert(element, parentElement, afterElement) {\n      // if for some reason the previous element was removed\n      // from the dom sometime before this code runs then let's\n      // just stick to using the parent element as the anchor\n      if (afterElement) {\n        var afterNode = extractElementNode(afterElement);\n        if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {\n          afterElement = null;\n        }\n      }\n      afterElement ? afterElement.after(element) : parentElement.prepend(element);\n    }\n\n    /**\n     * @ngdoc service\n     * @name $animate\n     * @description The $animate service exposes a series of DOM utility methods that provide support\n     * for animation hooks. The default behavior is the application of DOM operations, however,\n     * when an animation is detected (and animations are enabled), $animate will do the heavy lifting\n     * to ensure that animation runs with the triggered DOM operation.\n     *\n     * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't\n     * included and only when it is active then the animation hooks that `$animate` triggers will be\n     * functional. Once active then all structural `ng-` directives will trigger animations as they perform\n     * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,\n     * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.\n     *\n     * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.\n     *\n     * To learn more about enabling animation support, click here to visit the\n     * {@link ngAnimate ngAnimate module page}.\n     */\n    return {\n      // we don't call it directly since non-existant arguments may\n      // be interpreted as null within the sub enabled function\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#on\n       * @kind function\n       * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)\n       *    has fired on the given element or among any of its children. Once the listener is fired, the provided callback\n       *    is fired with the following params:\n       *\n       * ```js\n       * $animate.on('enter', container,\n       *    function callback(element, phase) {\n       *      // cool we detected an enter animation within the container\n       *    }\n       * );\n       * ```\n       *\n       * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)\n       * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself\n       *     as well as among its children\n       * @param {Function} callback the callback function that will be fired when the listener is triggered\n       *\n       * The arguments present in the callback function are:\n       * * `element` - The captured DOM element that the animation was fired on.\n       * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).\n       */\n      on: $$animateQueue.on,\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#off\n       * @kind function\n       * @description Deregisters an event listener based on the event which has been associated with the provided element. This method\n       * can be used in three different ways depending on the arguments:\n       *\n       * ```js\n       * // remove all the animation event listeners listening for `enter`\n       * $animate.off('enter');\n       *\n       * // remove all the animation event listeners listening for `enter` on the given element and its children\n       * $animate.off('enter', container);\n       *\n       * // remove the event listener function provided by `callback` that is set\n       * // to listen for `enter` on the given `container` as well as its children\n       * $animate.off('enter', container, callback);\n       * ```\n       *\n       * @param {string} event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)\n       * @param {DOMElement=} container the container element the event listener was placed on\n       * @param {Function=} callback the callback function that was registered as the listener\n       */\n      off: $$animateQueue.off,\n\n      /**\n       * @ngdoc method\n       * @name $animate#pin\n       * @kind function\n       * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists\n       *    outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the\n       *    element despite being outside the realm of the application or within another application. Say for example if the application\n       *    was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated\n       *    as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind\n       *    that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.\n       *\n       *    Note that this feature is only active when the `ngAnimate` module is used.\n       *\n       * @param {DOMElement} element the external element that will be pinned\n       * @param {DOMElement} parentElement the host parent element that will be associated with the external element\n       */\n      pin: $$animateQueue.pin,\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enabled\n       * @kind function\n       * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This\n       * function can be called in four ways:\n       *\n       * ```js\n       * // returns true or false\n       * $animate.enabled();\n       *\n       * // changes the enabled state for all animations\n       * $animate.enabled(false);\n       * $animate.enabled(true);\n       *\n       * // returns true or false if animations are enabled for an element\n       * $animate.enabled(element);\n       *\n       * // changes the enabled state for an element and its children\n       * $animate.enabled(element, true);\n       * $animate.enabled(element, false);\n       * ```\n       *\n       * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state\n       * @param {boolean=} enabled whether or not the animations will be enabled for the element\n       *\n       * @return {boolean} whether or not animations are enabled\n       */\n      enabled: $$animateQueue.enabled,\n\n      /**\n       * @ngdoc method\n       * @name $animate#cancel\n       * @kind function\n       * @description Cancels the provided animation.\n       *\n       * @param {Promise} animationPromise The animation promise that is returned when an animation is started.\n       */\n      cancel: function(runner) {\n        runner.end && runner.end();\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enter\n       * @kind function\n       * @description Inserts the element into the DOM either after the `after` element (if provided) or\n       *   as the first child within the `parent` element and then triggers an animation.\n       *   A promise is returned that will be resolved during the next digest once the animation\n       *   has completed.\n       *\n       * @param {DOMElement} element the element which will be inserted into the DOM\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (so long as the after element is not present)\n       * @param {DOMElement=} after the sibling element after which the element will be appended\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      enter: function(element, parent, after, options) {\n        parent = parent && jqLite(parent);\n        after = after && jqLite(after);\n        parent = parent || after.parent();\n        domInsert(element, parent, after);\n        return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#move\n       * @kind function\n       * @description Inserts (moves) the element into its new position in the DOM either after\n       *   the `after` element (if provided) or as the first child within the `parent` element\n       *   and then triggers an animation. A promise is returned that will be resolved\n       *   during the next digest once the animation has completed.\n       *\n       * @param {DOMElement} element the element which will be moved into the new DOM position\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (so long as the after element is not present)\n       * @param {DOMElement=} after the sibling element after which the element will be appended\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      move: function(element, parent, after, options) {\n        parent = parent && jqLite(parent);\n        after = after && jqLite(after);\n        parent = parent || after.parent();\n        domInsert(element, parent, after);\n        return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#leave\n       * @kind function\n       * @description Triggers an animation and then removes the element from the DOM.\n       * When the function is called a promise is returned that will be resolved during the next\n       * digest once the animation has completed.\n       *\n       * @param {DOMElement} element the element which will be removed from the DOM\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      leave: function(element, options) {\n        return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {\n          element.remove();\n        });\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#addClass\n       * @kind function\n       *\n       * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon\n       *   execution, the addClass operation will only be handled after the next digest and it will not trigger an\n       *   animation if element already contains the CSS class or if the class is removed at a later step.\n       *   Note that class-based animations are treated differently compared to structural animations\n       *   (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *   depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      addClass: function(element, className, options) {\n        options = prepareAnimateOptions(options);\n        options.addClass = mergeClasses(options.addclass, className);\n        return $$animateQueue.push(element, 'addClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#removeClass\n       * @kind function\n       *\n       * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon\n       *   execution, the removeClass operation will only be handled after the next digest and it will not trigger an\n       *   animation if element does not contain the CSS class or if the class is added at a later step.\n       *   Note that class-based animations are treated differently compared to structural animations\n       *   (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *   depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      removeClass: function(element, className, options) {\n        options = prepareAnimateOptions(options);\n        options.removeClass = mergeClasses(options.removeClass, className);\n        return $$animateQueue.push(element, 'removeClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#setClass\n       * @kind function\n       *\n       * @description Performs both the addition and removal of a CSS classes on an element and (during the process)\n       *    triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and\n       *    `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has\n       *    passed. Note that class-based animations are treated differently compared to structural animations\n       *    (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *    depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)\n       * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      setClass: function(element, add, remove, options) {\n        options = prepareAnimateOptions(options);\n        options.addClass = mergeClasses(options.addClass, add);\n        options.removeClass = mergeClasses(options.removeClass, remove);\n        return $$animateQueue.push(element, 'setClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#animate\n       * @kind function\n       *\n       * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.\n       * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take\n       * on the provided styles. For example, if a transition animation is set for the given classNamem, then the provided `from` and\n       * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding\n       * style in `to`, the style in `from` is applied immediately, and no animation is run.\n       * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`\n       * method (or as part of the `options` parameter):\n       *\n       * ```js\n       * ngModule.animation('.my-inline-animation', function() {\n       *   return {\n       *     animate : function(element, from, to, done, options) {\n       *       //animation\n       *       done();\n       *     }\n       *   }\n       * });\n       * ```\n       *\n       * @param {DOMElement} element the element which the CSS styles will be applied to\n       * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.\n       * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.\n       * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If\n       *    this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.\n       *    (Note that if no animation is detected then this value will not be applied to the element.)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      animate: function(element, from, to, className, options) {\n        options = prepareAnimateOptions(options);\n        options.from = options.from ? extend(options.from, from) : from;\n        options.to   = options.to   ? extend(options.to, to)     : to;\n\n        className = className || 'ng-inline-animate';\n        options.tempClasses = mergeClasses(options.tempClasses, className);\n        return $$animateQueue.push(element, 'animate', options);\n      }\n    };\n  }];\n}];\n\nvar $$AnimateAsyncRunFactoryProvider = function() {\n  this.$get = ['$$rAF', function($$rAF) {\n    var waitQueue = [];\n\n    function waitForTick(fn) {\n      waitQueue.push(fn);\n      if (waitQueue.length > 1) return;\n      $$rAF(function() {\n        for (var i = 0; i < waitQueue.length; i++) {\n          waitQueue[i]();\n        }\n        waitQueue = [];\n      });\n    }\n\n    return function() {\n      var passed = false;\n      waitForTick(function() {\n        passed = true;\n      });\n      return function(callback) {\n        passed ? callback() : waitForTick(callback);\n      };\n    };\n  }];\n};\n\nvar $$AnimateRunnerFactoryProvider = function() {\n  this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',\n       function($q,   $sniffer,   $$animateAsyncRun,   $document,   $timeout) {\n\n    var INITIAL_STATE = 0;\n    var DONE_PENDING_STATE = 1;\n    var DONE_COMPLETE_STATE = 2;\n\n    AnimateRunner.chain = function(chain, callback) {\n      var index = 0;\n\n      next();\n      function next() {\n        if (index === chain.length) {\n          callback(true);\n          return;\n        }\n\n        chain[index](function(response) {\n          if (response === false) {\n            callback(false);\n            return;\n          }\n          index++;\n          next();\n        });\n      }\n    };\n\n    AnimateRunner.all = function(runners, callback) {\n      var count = 0;\n      var status = true;\n      forEach(runners, function(runner) {\n        runner.done(onProgress);\n      });\n\n      function onProgress(response) {\n        status = status && response;\n        if (++count === runners.length) {\n          callback(status);\n        }\n      }\n    };\n\n    function AnimateRunner(host) {\n      this.setHost(host);\n\n      var rafTick = $$animateAsyncRun();\n      var timeoutTick = function(fn) {\n        $timeout(fn, 0, false);\n      };\n\n      this._doneCallbacks = [];\n      this._tick = function(fn) {\n        var doc = $document[0];\n\n        // the document may not be ready or attached\n        // to the module for some internal tests\n        if (doc && doc.hidden) {\n          timeoutTick(fn);\n        } else {\n          rafTick(fn);\n        }\n      };\n      this._state = 0;\n    }\n\n    AnimateRunner.prototype = {\n      setHost: function(host) {\n        this.host = host || {};\n      },\n\n      done: function(fn) {\n        if (this._state === DONE_COMPLETE_STATE) {\n          fn();\n        } else {\n          this._doneCallbacks.push(fn);\n        }\n      },\n\n      progress: noop,\n\n      getPromise: function() {\n        if (!this.promise) {\n          var self = this;\n          this.promise = $q(function(resolve, reject) {\n            self.done(function(status) {\n              status === false ? reject() : resolve();\n            });\n          });\n        }\n        return this.promise;\n      },\n\n      then: function(resolveHandler, rejectHandler) {\n        return this.getPromise().then(resolveHandler, rejectHandler);\n      },\n\n      'catch': function(handler) {\n        return this.getPromise()['catch'](handler);\n      },\n\n      'finally': function(handler) {\n        return this.getPromise()['finally'](handler);\n      },\n\n      pause: function() {\n        if (this.host.pause) {\n          this.host.pause();\n        }\n      },\n\n      resume: function() {\n        if (this.host.resume) {\n          this.host.resume();\n        }\n      },\n\n      end: function() {\n        if (this.host.end) {\n          this.host.end();\n        }\n        this._resolve(true);\n      },\n\n      cancel: function() {\n        if (this.host.cancel) {\n          this.host.cancel();\n        }\n        this._resolve(false);\n      },\n\n      complete: function(response) {\n        var self = this;\n        if (self._state === INITIAL_STATE) {\n          self._state = DONE_PENDING_STATE;\n          self._tick(function() {\n            self._resolve(response);\n          });\n        }\n      },\n\n      _resolve: function(response) {\n        if (this._state !== DONE_COMPLETE_STATE) {\n          forEach(this._doneCallbacks, function(fn) {\n            fn(response);\n          });\n          this._doneCallbacks.length = 0;\n          this._state = DONE_COMPLETE_STATE;\n        }\n      }\n    };\n\n    return AnimateRunner;\n  }];\n};\n\n/**\n * @ngdoc service\n * @name $animateCss\n * @kind object\n *\n * @description\n * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,\n * then the `$animateCss` service will actually perform animations.\n *\n * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.\n */\nvar $CoreAnimateCssProvider = function() {\n  this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {\n\n    return function(element, initialOptions) {\n      // all of the animation functions should create\n      // a copy of the options data, however, if a\n      // parent service has already created a copy then\n      // we should stick to using that\n      var options = initialOptions || {};\n      if (!options.$$prepared) {\n        options = copy(options);\n      }\n\n      // there is no point in applying the styles since\n      // there is no animation that goes on at all in\n      // this version of $animateCss.\n      if (options.cleanupStyles) {\n        options.from = options.to = null;\n      }\n\n      if (options.from) {\n        element.css(options.from);\n        options.from = null;\n      }\n\n      /* jshint newcap: false */\n      var closed, runner = new $$AnimateRunner();\n      return {\n        start: run,\n        end: run\n      };\n\n      function run() {\n        $$rAF(function() {\n          applyAnimationContents();\n          if (!closed) {\n            runner.complete();\n          }\n          closed = true;\n        });\n        return runner;\n      }\n\n      function applyAnimationContents() {\n        if (options.addClass) {\n          element.addClass(options.addClass);\n          options.addClass = null;\n        }\n        if (options.removeClass) {\n          element.removeClass(options.removeClass);\n          options.removeClass = null;\n        }\n        if (options.to) {\n          element.css(options.to);\n          options.to = null;\n        }\n      }\n    };\n  }];\n};\n\n/* global stripHash: true */\n\n/**\n * ! This is a private undocumented service !\n *\n * @name $browser\n * @requires $log\n * @description\n * This object has two goals:\n *\n * - hide all the global state in the browser caused by the window object\n * - abstract away all the browser specific features and inconsistencies\n *\n * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`\n * service, which can be used for convenient testing of the application without the interaction with\n * the real browser apis.\n */\n/**\n * @param {object} window The global window object.\n * @param {object} document jQuery wrapped document.\n * @param {object} $log window.console or an object with the same interface.\n * @param {object} $sniffer $sniffer service\n */\nfunction Browser(window, document, $log, $sniffer) {\n  var self = this,\n      location = window.location,\n      history = window.history,\n      setTimeout = window.setTimeout,\n      clearTimeout = window.clearTimeout,\n      pendingDeferIds = {};\n\n  self.isMock = false;\n\n  var outstandingRequestCount = 0;\n  var outstandingRequestCallbacks = [];\n\n  // TODO(vojta): remove this temporary api\n  self.$$completeOutstandingRequest = completeOutstandingRequest;\n  self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };\n\n  /**\n   * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`\n   * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.\n   */\n  function completeOutstandingRequest(fn) {\n    try {\n      fn.apply(null, sliceArgs(arguments, 1));\n    } finally {\n      outstandingRequestCount--;\n      if (outstandingRequestCount === 0) {\n        while (outstandingRequestCallbacks.length) {\n          try {\n            outstandingRequestCallbacks.pop()();\n          } catch (e) {\n            $log.error(e);\n          }\n        }\n      }\n    }\n  }\n\n  function getHash(url) {\n    var index = url.indexOf('#');\n    return index === -1 ? '' : url.substr(index);\n  }\n\n  /**\n   * @private\n   * Note: this method is used only by scenario runner\n   * TODO(vojta): prefix this method with $$ ?\n   * @param {function()} callback Function that will be called when no outstanding request\n   */\n  self.notifyWhenNoOutstandingRequests = function(callback) {\n    if (outstandingRequestCount === 0) {\n      callback();\n    } else {\n      outstandingRequestCallbacks.push(callback);\n    }\n  };\n\n  //////////////////////////////////////////////////////////////\n  // URL API\n  //////////////////////////////////////////////////////////////\n\n  var cachedState, lastHistoryState,\n      lastBrowserUrl = location.href,\n      baseElement = document.find('base'),\n      pendingLocation = null,\n      getCurrentState = !$sniffer.history ? noop : function getCurrentState() {\n        try {\n          return history.state;\n        } catch (e) {\n          // MSIE can reportedly throw when there is no state (UNCONFIRMED).\n        }\n      };\n\n  cacheState();\n  lastHistoryState = cachedState;\n\n  /**\n   * @name $browser#url\n   *\n   * @description\n   * GETTER:\n   * Without any argument, this method just returns current value of location.href.\n   *\n   * SETTER:\n   * With at least one argument, this method sets url to new value.\n   * If html5 history api supported, pushState/replaceState is used, otherwise\n   * location.href/location.replace is used.\n   * Returns its own instance to allow chaining\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to change url.\n   *\n   * @param {string} url New url (when used as setter)\n   * @param {boolean=} replace Should new url replace current history record?\n   * @param {object=} state object to use with pushState/replaceState\n   */\n  self.url = function(url, replace, state) {\n    // In modern browsers `history.state` is `null` by default; treating it separately\n    // from `undefined` would cause `$browser.url('/foo')` to change `history.state`\n    // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.\n    if (isUndefined(state)) {\n      state = null;\n    }\n\n    // Android Browser BFCache causes location, history reference to become stale.\n    if (location !== window.location) location = window.location;\n    if (history !== window.history) history = window.history;\n\n    // setter\n    if (url) {\n      var sameState = lastHistoryState === state;\n\n      // Don't change anything if previous and current URLs and states match. This also prevents\n      // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.\n      // See https://github.com/angular/angular.js/commit/ffb2701\n      if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {\n        return self;\n      }\n      var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);\n      lastBrowserUrl = url;\n      lastHistoryState = state;\n      // Don't use history API if only the hash changed\n      // due to a bug in IE10/IE11 which leads\n      // to not firing a `hashchange` nor `popstate` event\n      // in some cases (see #9143).\n      if ($sniffer.history && (!sameBase || !sameState)) {\n        history[replace ? 'replaceState' : 'pushState'](state, '', url);\n        cacheState();\n        // Do the assignment again so that those two variables are referentially identical.\n        lastHistoryState = cachedState;\n      } else {\n        if (!sameBase || pendingLocation) {\n          pendingLocation = url;\n        }\n        if (replace) {\n          location.replace(url);\n        } else if (!sameBase) {\n          location.href = url;\n        } else {\n          location.hash = getHash(url);\n        }\n        if (location.href !== url) {\n          pendingLocation = url;\n        }\n      }\n      return self;\n    // getter\n    } else {\n      // - pendingLocation is needed as browsers don't allow to read out\n      //   the new location.href if a reload happened or if there is a bug like in iOS 9 (see\n      //   https://openradar.appspot.com/22186109).\n      // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172\n      return pendingLocation || location.href.replace(/%27/g,\"'\");\n    }\n  };\n\n  /**\n   * @name $browser#state\n   *\n   * @description\n   * This method is a getter.\n   *\n   * Return history.state or null if history.state is undefined.\n   *\n   * @returns {object} state\n   */\n  self.state = function() {\n    return cachedState;\n  };\n\n  var urlChangeListeners = [],\n      urlChangeInit = false;\n\n  function cacheStateAndFireUrlChange() {\n    pendingLocation = null;\n    cacheState();\n    fireUrlChange();\n  }\n\n  // This variable should be used *only* inside the cacheState function.\n  var lastCachedState = null;\n  function cacheState() {\n    // This should be the only place in $browser where `history.state` is read.\n    cachedState = getCurrentState();\n    cachedState = isUndefined(cachedState) ? null : cachedState;\n\n    // Prevent callbacks fo fire twice if both hashchange & popstate were fired.\n    if (equals(cachedState, lastCachedState)) {\n      cachedState = lastCachedState;\n    }\n    lastCachedState = cachedState;\n  }\n\n  function fireUrlChange() {\n    if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {\n      return;\n    }\n\n    lastBrowserUrl = self.url();\n    lastHistoryState = cachedState;\n    forEach(urlChangeListeners, function(listener) {\n      listener(self.url(), cachedState);\n    });\n  }\n\n  /**\n   * @name $browser#onUrlChange\n   *\n   * @description\n   * Register callback function that will be called, when url changes.\n   *\n   * It's only called when the url is changed from outside of angular:\n   * - user types different url into address bar\n   * - user clicks on history (forward/back) button\n   * - user clicks on a link\n   *\n   * It's not called when url is changed by $browser.url() method\n   *\n   * The listener gets called with new url as parameter.\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to monitor url changes in angular apps.\n   *\n   * @param {function(string)} listener Listener function to be called when url changes.\n   * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.\n   */\n  self.onUrlChange = function(callback) {\n    // TODO(vojta): refactor to use node's syntax for events\n    if (!urlChangeInit) {\n      // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)\n      // don't fire popstate when user change the address bar and don't fire hashchange when url\n      // changed by push/replaceState\n\n      // html5 history api - popstate event\n      if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);\n      // hashchange event\n      jqLite(window).on('hashchange', cacheStateAndFireUrlChange);\n\n      urlChangeInit = true;\n    }\n\n    urlChangeListeners.push(callback);\n    return callback;\n  };\n\n  /**\n   * @private\n   * Remove popstate and hashchange handler from window.\n   *\n   * NOTE: this api is intended for use only by $rootScope.\n   */\n  self.$$applicationDestroyed = function() {\n    jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);\n  };\n\n  /**\n   * Checks whether the url has changed outside of Angular.\n   * Needs to be exported to be able to check for changes that have been done in sync,\n   * as hashchange/popstate events fire in async.\n   */\n  self.$$checkUrlChange = fireUrlChange;\n\n  //////////////////////////////////////////////////////////////\n  // Misc API\n  //////////////////////////////////////////////////////////////\n\n  /**\n   * @name $browser#baseHref\n   *\n   * @description\n   * Returns current <base href>\n   * (always relative - without domain)\n   *\n   * @returns {string} The current base href\n   */\n  self.baseHref = function() {\n    var href = baseElement.attr('href');\n    return href ? href.replace(/^(https?\\:)?\\/\\/[^\\/]*/, '') : '';\n  };\n\n  /**\n   * @name $browser#defer\n   * @param {function()} fn A function, who's execution should be deferred.\n   * @param {number=} [delay=0] of milliseconds to defer the function execution.\n   * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.\n   *\n   * @description\n   * Executes a fn asynchronously via `setTimeout(fn, delay)`.\n   *\n   * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using\n   * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed\n   * via `$browser.defer.flush()`.\n   *\n   */\n  self.defer = function(fn, delay) {\n    var timeoutId;\n    outstandingRequestCount++;\n    timeoutId = setTimeout(function() {\n      delete pendingDeferIds[timeoutId];\n      completeOutstandingRequest(fn);\n    }, delay || 0);\n    pendingDeferIds[timeoutId] = true;\n    return timeoutId;\n  };\n\n\n  /**\n   * @name $browser#defer.cancel\n   *\n   * @description\n   * Cancels a deferred task identified with `deferId`.\n   *\n   * @param {*} deferId Token returned by the `$browser.defer` function.\n   * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n   *                    canceled.\n   */\n  self.defer.cancel = function(deferId) {\n    if (pendingDeferIds[deferId]) {\n      delete pendingDeferIds[deferId];\n      clearTimeout(deferId);\n      completeOutstandingRequest(noop);\n      return true;\n    }\n    return false;\n  };\n\n}\n\nfunction $BrowserProvider() {\n  this.$get = ['$window', '$log', '$sniffer', '$document',\n      function($window, $log, $sniffer, $document) {\n        return new Browser($window, $document, $log, $sniffer);\n      }];\n}\n\n/**\n * @ngdoc service\n * @name $cacheFactory\n *\n * @description\n * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to\n * them.\n *\n * ```js\n *\n *  var cache = $cacheFactory('cacheId');\n *  expect($cacheFactory.get('cacheId')).toBe(cache);\n *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();\n *\n *  cache.put(\"key\", \"value\");\n *  cache.put(\"another key\", \"another value\");\n *\n *  // We've specified no options on creation\n *  expect(cache.info()).toEqual({id: 'cacheId', size: 2});\n *\n * ```\n *\n *\n * @param {string} cacheId Name or id of the newly created cache.\n * @param {object=} options Options object that specifies the cache behavior. Properties:\n *\n *   - `{number=}` `capacity` — turns the cache into LRU cache.\n *\n * @returns {object} Newly created cache object with the following set of methods:\n *\n * - `{object}` `info()` — Returns id, size, and options of cache.\n * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns\n *   it.\n * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.\n * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.\n * - `{void}` `removeAll()` — Removes all cached values.\n * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.\n *\n * @example\n   <example module=\"cacheExampleApp\">\n     <file name=\"index.html\">\n       <div ng-controller=\"CacheController\">\n         <input ng-model=\"newCacheKey\" placeholder=\"Key\">\n         <input ng-model=\"newCacheValue\" placeholder=\"Value\">\n         <button ng-click=\"put(newCacheKey, newCacheValue)\">Cache</button>\n\n         <p ng-if=\"keys.length\">Cached Values</p>\n         <div ng-repeat=\"key in keys\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"cache.get(key)\"></b>\n         </div>\n\n         <p>Cache Info</p>\n         <div ng-repeat=\"(key, value) in cache.info()\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"value\"></b>\n         </div>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('cacheExampleApp', []).\n         controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {\n           $scope.keys = [];\n           $scope.cache = $cacheFactory('cacheId');\n           $scope.put = function(key, value) {\n             if (angular.isUndefined($scope.cache.get(key))) {\n               $scope.keys.push(key);\n             }\n             $scope.cache.put(key, angular.isUndefined(value) ? null : value);\n           };\n         }]);\n     </file>\n     <file name=\"style.css\">\n       p {\n         margin: 10px 0 3px;\n       }\n     </file>\n   </example>\n */\nfunction $CacheFactoryProvider() {\n\n  this.$get = function() {\n    var caches = {};\n\n    function cacheFactory(cacheId, options) {\n      if (cacheId in caches) {\n        throw minErr('$cacheFactory')('iid', \"CacheId '{0}' is already taken!\", cacheId);\n      }\n\n      var size = 0,\n          stats = extend({}, options, {id: cacheId}),\n          data = createMap(),\n          capacity = (options && options.capacity) || Number.MAX_VALUE,\n          lruHash = createMap(),\n          freshEnd = null,\n          staleEnd = null;\n\n      /**\n       * @ngdoc type\n       * @name $cacheFactory.Cache\n       *\n       * @description\n       * A cache object used to store and retrieve data, primarily used by\n       * {@link $http $http} and the {@link ng.directive:script script} directive to cache\n       * templates and other data.\n       *\n       * ```js\n       *  angular.module('superCache')\n       *    .factory('superCache', ['$cacheFactory', function($cacheFactory) {\n       *      return $cacheFactory('super-cache');\n       *    }]);\n       * ```\n       *\n       * Example test:\n       *\n       * ```js\n       *  it('should behave like a cache', inject(function(superCache) {\n       *    superCache.put('key', 'value');\n       *    superCache.put('another key', 'another value');\n       *\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 2\n       *    });\n       *\n       *    superCache.remove('another key');\n       *    expect(superCache.get('another key')).toBeUndefined();\n       *\n       *    superCache.removeAll();\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 0\n       *    });\n       *  }));\n       * ```\n       */\n      return caches[cacheId] = {\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#put\n         * @kind function\n         *\n         * @description\n         * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be\n         * retrieved later, and incrementing the size of the cache if the key was not already\n         * present in the cache. If behaving like an LRU cache, it will also remove stale\n         * entries from the set.\n         *\n         * It will not insert undefined values into the cache.\n         *\n         * @param {string} key the key under which the cached data is stored.\n         * @param {*} value the value to store alongside the key. If it is undefined, the key\n         *    will not be stored.\n         * @returns {*} the value stored.\n         */\n        put: function(key, value) {\n          if (isUndefined(value)) return;\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key] || (lruHash[key] = {key: key});\n\n            refresh(lruEntry);\n          }\n\n          if (!(key in data)) size++;\n          data[key] = value;\n\n          if (size > capacity) {\n            this.remove(staleEnd.key);\n          }\n\n          return value;\n        },\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#get\n         * @kind function\n         *\n         * @description\n         * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the data to be retrieved\n         * @returns {*} the value stored.\n         */\n        get: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            refresh(lruEntry);\n          }\n\n          return data[key];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#remove\n         * @kind function\n         *\n         * @description\n         * Removes an entry from the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the entry to be removed\n         */\n        remove: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            if (lruEntry == freshEnd) freshEnd = lruEntry.p;\n            if (lruEntry == staleEnd) staleEnd = lruEntry.n;\n            link(lruEntry.n,lruEntry.p);\n\n            delete lruHash[key];\n          }\n\n          if (!(key in data)) return;\n\n          delete data[key];\n          size--;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#removeAll\n         * @kind function\n         *\n         * @description\n         * Clears the cache object of any entries.\n         */\n        removeAll: function() {\n          data = createMap();\n          size = 0;\n          lruHash = createMap();\n          freshEnd = staleEnd = null;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#destroy\n         * @kind function\n         *\n         * @description\n         * Destroys the {@link $cacheFactory.Cache Cache} object entirely,\n         * removing it from the {@link $cacheFactory $cacheFactory} set.\n         */\n        destroy: function() {\n          data = null;\n          stats = null;\n          lruHash = null;\n          delete caches[cacheId];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#info\n         * @kind function\n         *\n         * @description\n         * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.\n         *\n         * @returns {object} an object with the following properties:\n         *   <ul>\n         *     <li>**id**: the id of the cache instance</li>\n         *     <li>**size**: the number of entries kept in the cache instance</li>\n         *     <li>**...**: any additional properties from the options object when creating the\n         *       cache.</li>\n         *   </ul>\n         */\n        info: function() {\n          return extend({}, stats, {size: size});\n        }\n      };\n\n\n      /**\n       * makes the `entry` the freshEnd of the LRU linked list\n       */\n      function refresh(entry) {\n        if (entry != freshEnd) {\n          if (!staleEnd) {\n            staleEnd = entry;\n          } else if (staleEnd == entry) {\n            staleEnd = entry.n;\n          }\n\n          link(entry.n, entry.p);\n          link(entry, freshEnd);\n          freshEnd = entry;\n          freshEnd.n = null;\n        }\n      }\n\n\n      /**\n       * bidirectionally links two entries of the LRU linked list\n       */\n      function link(nextEntry, prevEntry) {\n        if (nextEntry != prevEntry) {\n          if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify\n          if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify\n        }\n      }\n    }\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#info\n   *\n   * @description\n   * Get information about all the caches that have been created\n   *\n   * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`\n   */\n    cacheFactory.info = function() {\n      var info = {};\n      forEach(caches, function(cache, cacheId) {\n        info[cacheId] = cache.info();\n      });\n      return info;\n    };\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#get\n   *\n   * @description\n   * Get access to a cache object by the `cacheId` used when it was created.\n   *\n   * @param {string} cacheId Name or id of a cache to access.\n   * @returns {object} Cache object identified by the cacheId or undefined if no such cache.\n   */\n    cacheFactory.get = function(cacheId) {\n      return caches[cacheId];\n    };\n\n\n    return cacheFactory;\n  };\n}\n\n/**\n * @ngdoc service\n * @name $templateCache\n *\n * @description\n * The first time a template is used, it is loaded in the template cache for quick retrieval. You\n * can load templates directly into the cache in a `script` tag, or by consuming the\n * `$templateCache` service directly.\n *\n * Adding via the `script` tag:\n *\n * ```html\n *   <script type=\"text/ng-template\" id=\"templateId.html\">\n *     <p>This is the content of the template</p>\n *   </script>\n * ```\n *\n * **Note:** the `script` tag containing the template does not need to be included in the `head` of\n * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,\n * element with ng-app attribute), otherwise the template will be ignored.\n *\n * Adding via the `$templateCache` service:\n *\n * ```js\n * var myApp = angular.module('myApp', []);\n * myApp.run(function($templateCache) {\n *   $templateCache.put('templateId.html', 'This is the content of the template');\n * });\n * ```\n *\n * To retrieve the template later, simply use it in your HTML:\n * ```html\n * <div ng-include=\" 'templateId.html' \"></div>\n * ```\n *\n * or get it via Javascript:\n * ```js\n * $templateCache.get('templateId.html')\n * ```\n *\n * See {@link ng.$cacheFactory $cacheFactory}.\n *\n */\nfunction $TemplateCacheProvider() {\n  this.$get = ['$cacheFactory', function($cacheFactory) {\n    return $cacheFactory('templates');\n  }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!\n *\n * DOM-related variables:\n *\n * - \"node\" - DOM Node\n * - \"element\" - DOM Element or Node\n * - \"$node\" or \"$element\" - jqLite-wrapped node or element\n *\n *\n * Compiler related stuff:\n *\n * - \"linkFn\" - linking fn of a single directive\n * - \"nodeLinkFn\" - function that aggregates all linking fns for a particular node\n * - \"childLinkFn\" -  function that aggregates all linking fns for child nodes of a particular node\n * - \"compositeLinkFn\" - function that aggregates all linking fns for a compilation root (nodeList)\n */\n\n\n/**\n * @ngdoc service\n * @name $compile\n * @kind function\n *\n * @description\n * Compiles an HTML string or DOM into a template and produces a template function, which\n * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.\n *\n * The compilation is a process of walking the DOM tree and matching DOM elements to\n * {@link ng.$compileProvider#directive directives}.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** This document is an in-depth reference of all directive options.\n * For a gentle introduction to directives with examples of common use cases,\n * see the {@link guide/directive directive guide}.\n * </div>\n *\n * ## Comprehensive Directive API\n *\n * There are many different options for a directive.\n *\n * The difference resides in the return value of the factory function.\n * You can either return a \"Directive Definition Object\" (see below) that defines the directive properties,\n * or just the `postLink` function (all other properties will have the default values).\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's recommended to use the \"directive definition object\" form.\n * </div>\n *\n * Here's an example directive declared with a Directive Definition Object:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       priority: 0,\n *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },\n *       // or\n *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },\n *       transclude: false,\n *       restrict: 'A',\n *       templateNamespace: 'html',\n *       scope: false,\n *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },\n *       controllerAs: 'stringIdentifier',\n *       bindToController: false,\n *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],\n *       compile: function compile(tElement, tAttrs, transclude) {\n *         return {\n *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *           post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *         }\n *         // or\n *         // return function postLink( ... ) { ... }\n *       },\n *       // or\n *       // link: {\n *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *       // }\n *       // or\n *       // link: function postLink( ... ) { ... }\n *     };\n *     return directiveDefinitionObject;\n *   });\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Any unspecified options will use the default value. You can see the default values below.\n * </div>\n *\n * Therefore the above can be simplified as:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       link: function postLink(scope, iElement, iAttrs) { ... }\n *     };\n *     return directiveDefinitionObject;\n *     // or\n *     // return function postLink(scope, iElement, iAttrs) { ... }\n *   });\n * ```\n *\n *\n *\n * ### Directive Definition Object\n *\n * The directive definition object provides instructions to the {@link ng.$compile\n * compiler}. The attributes are:\n *\n * #### `multiElement`\n * When this property is set to true, the HTML compiler will collect DOM nodes between\n * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them\n * together as the directive elements. It is recommended that this feature be used on directives\n * which are not strictly behavioral (such as {@link ngClick}), and which\n * do not manipulate or replace child nodes (such as {@link ngInclude}).\n *\n * #### `priority`\n * When there are multiple directives defined on a single DOM element, sometimes it\n * is necessary to specify the order in which the directives are applied. The `priority` is used\n * to sort the directives before their `compile` functions get called. Priority is defined as a\n * number. Directives with greater numerical `priority` are compiled first. Pre-link functions\n * are also run in priority order, but post-link functions are run in reverse order. The order\n * of directives with the same priority is undefined. The default priority is `0`.\n *\n * #### `terminal`\n * If set to true then the current `priority` will be the last set of directives\n * which will execute (any directives at the current priority will still execute\n * as the order of execution on same `priority` is undefined). Note that expressions\n * and other directives used in the directive's template will also be excluded from execution.\n *\n * #### `scope`\n * The scope property can be `true`, an object or a falsy value:\n *\n * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.\n *\n * * **`true`:** A new child scope that prototypically inherits from its parent will be created for\n * the directive's element. If multiple directives on the same element request a new scope,\n * only one new scope is created. The new scope rule does not apply for the root of the template\n * since the root of the template always gets a new scope.\n *\n * * **`{...}` (an object hash):** A new \"isolate\" scope is created for the directive's element. The\n * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent\n * scope. This is useful when creating reusable components, which should not accidentally read or modify\n * data in the parent scope.\n *\n * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the\n * directive's element. These local properties are useful for aliasing values for templates. The keys in\n * the object hash map to the name of the property on the isolate scope; the values define how the property\n * is bound to the parent scope, via matching attributes on the directive's element:\n *\n * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is\n *   always a string since DOM attributes are strings. If no `attr` name is specified then the\n *   attribute name is assumed to be the same as the local name. Given `<my-component\n *   my-attr=\"hello {{name}}\">` and the isolate scope definition `scope: { localName:'@myAttr' }`,\n *   the directive's scope property `localName` will reflect the interpolated value of `hello\n *   {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's\n *   scope. The `name` is read from the parent scope (not the directive's scope).\n *\n * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression\n *   passed via the attribute `attr`. The expression is evaluated in the context of the parent scope.\n *   If no `attr` name is specified then the attribute name is assumed to be the same as the local\n *   name. Given `<my-component my-attr=\"parentModel\">` and the isolate scope definition `scope: {\n *   localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the\n *   value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in\n *   `localModel` and vice versa. Optional attributes should be marked as such with a question mark:\n *   `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't\n *   optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`})\n *   will be thrown upon discovering changes to the local value, since it will be impossible to sync\n *   them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`}\n *   method is used for tracking changes, and the equality check is based on object identity.\n *   However, if an object literal or an array literal is passed as the binding expression, the\n *   equality check is done by value (using the {@link angular.equals} function). It's also possible\n *   to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection\n *   `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional).\n *\n  * * `<` or `<attr` - set up a one-way (one-directional) binding between a local scope property and an\n *   expression passed via the attribute `attr`. The expression is evaluated in the context of the\n *   parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the\n *   local name. You can also make the binding optional by adding `?`: `<?` or `<?attr`.\n *\n *   For example, given `<my-component my-attr=\"parentModel\">` and directive definition of\n *   `scope: { localModel:'<myAttr' }`, then the isolated scope property `localModel` will reflect the\n *   value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected\n *   in `localModel`, but changes in `localModel` will not reflect in `parentModel`. There are however\n *   two caveats:\n *     1. one-way binding does not copy the value from the parent to the isolate scope, it simply\n *     sets the same value. That means if your bound value is an object, changes to its properties\n *     in the isolated scope will be reflected in the parent scope (because both reference the same object).\n *     2. one-way binding watches changes to the **identity** of the parent value. That means the\n *     {@link ng.$rootScope.Scope#$watch `$watch`} on the parent value only fires if the reference\n *     to the value has changed. In most cases, this should not be of concern, but can be important\n *     to know if you one-way bind to an object, and then replace that object in the isolated scope.\n *     If you now change a property of the object in your parent scope, the change will not be\n *     propagated to the isolated scope, because the identity of the object on the parent scope\n *     has not changed. Instead you must assign a new object.\n *\n *   One-way binding is useful if you do not plan to propagate changes to your isolated scope bindings\n *   back to the parent. However, it does not make this completely impossible.\n *\n * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If\n *   no `attr` name is specified then the attribute name is assumed to be the same as the local name.\n *   Given `<my-component my-attr=\"count = count + value\">` and the isolate scope definition `scope: {\n *   localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for\n *   the `count = count + value` expression. Often it's desirable to pass data from the isolated scope\n *   via an expression to the parent scope. This can be done by passing a map of local variable names\n *   and values into the expression wrapper fn. For example, if the expression is `increment(amount)`\n *   then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.\n *\n * In general it's possible to apply more than one directive to one element, but there might be limitations\n * depending on the type of scope required by the directives. The following points will help explain these limitations.\n * For simplicity only two directives are taken into account, but it is also applicable for several directives:\n *\n * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope\n * * **child scope** + **no scope** =>  Both directives will share one single child scope\n * * **child scope** + **child scope** =>  Both directives will share one single child scope\n * * **isolated scope** + **no scope** =>  The isolated directive will use it's own created isolated scope. The other directive will use\n * its parent's scope\n * * **isolated scope** + **child scope** =>  **Won't work!** Only one scope can be related to one element. Therefore these directives cannot\n * be applied to the same element.\n * * **isolated scope** + **isolated scope**  =>  **Won't work!** Only one scope can be related to one element. Therefore these directives\n * cannot be applied to the same element.\n *\n *\n * #### `bindToController`\n * This property is used to bind scope properties directly to the controller. It can be either\n * `true` or an object hash with the same format as the `scope` property. Additionally, a controller\n * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller\n * definition: `controller: 'myCtrl as myAlias'`.\n *\n * When an isolate scope is used for a directive (see above), `bindToController: true` will\n * allow a component to have its properties bound to the controller, rather than to scope.\n *\n * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller\n * properties. You can access these bindings once they have been initialized by providing a controller method called\n * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings\n * initialized.\n *\n * <div class=\"alert alert-warning\">\n * **Deprecation warning:** although bindings for non-ES6 class controllers are currently\n * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization\n * code that relies upon bindings inside a `$onInit` method on the controller, instead.\n * </div>\n *\n * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.\n * This will set up the scope bindings to the controller directly. Note that `scope` can still be used\n * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate\n * scope (useful for component directives).\n *\n * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.\n *\n *\n * #### `controller`\n * Controller constructor function. The controller is instantiated before the\n * pre-linking phase and can be accessed by other directives (see\n * `require` attribute). This allows the directives to communicate with each other and augment\n * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:\n *\n * * `$scope` - Current scope associated with the element\n * * `$element` - Current element\n * * `$attrs` - Current attributes object for the element\n * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:\n *   `function([scope], cloneLinkingFn, futureParentElement, slotName)`:\n *    * `scope`: (optional) override the scope.\n *    * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content.\n *    * `futureParentElement` (optional):\n *        * defines the parent to which the `cloneLinkingFn` will add the cloned elements.\n *        * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.\n *        * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)\n *          and when the `cloneLinkinFn` is passed,\n *          as those elements need to created and cloned in a special way when they are defined outside their\n *          usual containers (e.g. like `<svg>`).\n *        * See also the `directive.templateNamespace` property.\n *    * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`)\n *      then the default translusion is provided.\n *    The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns\n *    `true` if the specified slot contains content (i.e. one or more DOM nodes).\n *\n * The controller can provide the following methods that act as life-cycle hooks:\n * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and\n *   had their bindings initialized (and before the pre &amp; post linking functions for the directives on\n *   this element). This is a good place to put initialization code for your controller.\n * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The\n *   `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an\n *   object of the form `{ currentValue: ..., previousValue: ... }`. Use this hook to trigger updates within a component\n *   such as cloning the bound value to prevent accidental mutation of the outer value.\n * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing\n *   external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in\n *   the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent\n *   components will have their `$onDestroy()` hook called before child components.\n * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link\n *   function this hook can be used to set up DOM event handlers and do direct DOM manipulation.\n *   Note that child elements that contain `templateUrl` directives will not have been compiled and linked since\n *   they are waiting for their template to load asynchronously and their own compilation and linking has been\n *   suspended until that occurs.\n *\n *\n * #### `require`\n * Require another directive and inject its controller as the fourth argument to the linking function. The\n * `require` property can be a string, an array or an object:\n * * a **string** containing the name of the directive to pass to the linking function\n * * an **array** containing the names of directives to pass to the linking function. The argument passed to the\n * linking function will be an array of controllers in the same order as the names in the `require` property\n * * an **object** whose property values are the names of the directives to pass to the linking function. The argument\n * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding\n * controllers.\n *\n * If the `require` property is an object and `bindToController` is truthy, then the required controllers are\n * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers\n * have been constructed but before `$onInit` is called.\n * See the {@link $compileProvider#component} helper for an example of how this can be used.\n *\n * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is\n * raised (unless no link function is specified and the required controllers are not being bound to the directive\n * controller, in which case error checking is skipped). The name can be prefixed with:\n *\n * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.\n * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.\n * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.\n * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.\n * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass\n *   `null` to the `link` fn if not found.\n * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass\n *   `null` to the `link` fn if not found.\n *\n *\n * #### `controllerAs`\n * Identifier name for a reference to the controller in the directive's scope.\n * This allows the controller to be referenced from the directive template. This is especially\n * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible\n * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the\n * `controllerAs` reference might overwrite a property that already exists on the parent scope.\n *\n *\n * #### `restrict`\n * String of subset of `EACM` which restricts the directive to a specific directive\n * declaration style. If omitted, the defaults (elements and attributes) are used.\n *\n * * `E` - Element name (default): `<my-directive></my-directive>`\n * * `A` - Attribute (default): `<div my-directive=\"exp\"></div>`\n * * `C` - Class: `<div class=\"my-directive: exp;\"></div>`\n * * `M` - Comment: `<!-- directive: my-directive exp -->`\n *\n *\n * #### `templateNamespace`\n * String representing the document type used by the markup in the template.\n * AngularJS needs this information as those elements need to be created and cloned\n * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.\n *\n * * `html` - All root nodes in the template are HTML. Root nodes may also be\n *   top-level elements such as `<svg>` or `<math>`.\n * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).\n * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).\n *\n * If no `templateNamespace` is specified, then the namespace is considered to be `html`.\n *\n * #### `template`\n * HTML markup that may:\n * * Replace the contents of the directive's element (default).\n * * Replace the directive's element itself (if `replace` is true - DEPRECATED).\n * * Wrap the contents of the directive's element (if `transclude` is true).\n *\n * Value may be:\n *\n * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.\n * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`\n *   function api below) and returns a string value.\n *\n *\n * #### `templateUrl`\n * This is similar to `template` but the template is loaded from the specified URL, asynchronously.\n *\n * Because template loading is asynchronous the compiler will suspend compilation of directives on that element\n * for later when the template has been resolved.  In the meantime it will continue to compile and link\n * sibling and parent elements as though this element had not contained any directives.\n *\n * The compiler does not suspend the entire compilation to wait for templates to be loaded because this\n * would result in the whole app \"stalling\" until all templates are loaded asynchronously - even in the\n * case when only one deeply nested directive has `templateUrl`.\n *\n * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}\n *\n * You can specify `templateUrl` as a string representing the URL or as a function which takes two\n * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns\n * a string value representing the url.  In either case, the template URL is passed through {@link\n * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.\n *\n *\n * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)\n * specify what the template should replace. Defaults to `false`.\n *\n * * `true` - the template will replace the directive's element.\n * * `false` - the template will replace the contents of the directive's element.\n *\n * The replacement process migrates all of the attributes / classes from the old element to the new\n * one. See the {@link guide/directive#template-expanding-directive\n * Directives Guide} for an example.\n *\n * There are very few scenarios where element replacement is required for the application function,\n * the main one being reusable custom components that are used within SVG contexts\n * (because SVG doesn't work with custom elements in the DOM tree).\n *\n * #### `transclude`\n * Extract the contents of the element where the directive appears and make it available to the directive.\n * The contents are compiled and provided to the directive as a **transclusion function**. See the\n * {@link $compile#transclusion Transclusion} section below.\n *\n *\n * #### `compile`\n *\n * ```js\n *   function compile(tElement, tAttrs, transclude) { ... }\n * ```\n *\n * The compile function deals with transforming the template DOM. Since most directives do not do\n * template transformation, it is not used often. The compile function takes the following arguments:\n *\n *   * `tElement` - template element - The element where the directive has been declared. It is\n *     safe to do template transformation on the element and child elements only.\n *\n *   * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared\n *     between all directive compile functions.\n *\n *   * `transclude` -  [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`\n *\n * <div class=\"alert alert-warning\">\n * **Note:** The template instance and the link instance may be different objects if the template has\n * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that\n * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration\n * should be done in a linking function rather than in a compile function.\n * </div>\n\n * <div class=\"alert alert-warning\">\n * **Note:** The compile function cannot handle directives that recursively use themselves in their\n * own templates or compile functions. Compiling these directives results in an infinite loop and\n * stack overflow errors.\n *\n * This can be avoided by manually using $compile in the postLink function to imperatively compile\n * a directive's template instead of relying on automatic template compilation via `template` or\n * `templateUrl` declaration or manual compilation inside the compile function.\n * </div>\n *\n * <div class=\"alert alert-danger\">\n * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it\n *   e.g. does not know about the right outer scope. Please use the transclude function that is passed\n *   to the link function instead.\n * </div>\n\n * A compile function can have a return value which can be either a function or an object.\n *\n * * returning a (post-link) function - is equivalent to registering the linking function via the\n *   `link` property of the config object when the compile function is empty.\n *\n * * returning an object with function(s) registered via `pre` and `post` properties - allows you to\n *   control when a linking function should be called during the linking phase. See info about\n *   pre-linking and post-linking functions below.\n *\n *\n * #### `link`\n * This property is used only if the `compile` property is not defined.\n *\n * ```js\n *   function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }\n * ```\n *\n * The link function is responsible for registering DOM listeners as well as updating the DOM. It is\n * executed after the template has been cloned. This is where most of the directive logic will be\n * put.\n *\n *   * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the\n *     directive for registering {@link ng.$rootScope.Scope#$watch watches}.\n *\n *   * `iElement` - instance element - The element where the directive is to be used. It is safe to\n *     manipulate the children of the element only in `postLink` function since the children have\n *     already been linked.\n *\n *   * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared\n *     between all directive linking functions.\n *\n *   * `controller` - the directive's required controller instance(s) - Instances are shared\n *     among all directives, which allows the directives to use the controllers as a communication\n *     channel. The exact value depends on the directive's `require` property:\n *       * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one\n *       * `string`: the controller instance\n *       * `array`: array of controller instances\n *\n *     If a required controller cannot be found, and it is optional, the instance is `null`,\n *     otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.\n *\n *     Note that you can also require the directive's own controller - it will be made available like\n *     any other controller.\n *\n *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.\n *     This is the same as the `$transclude`\n *     parameter of directive controllers, see there for details.\n *     `function([scope], cloneLinkingFn, futureParentElement)`.\n *\n * #### Pre-linking function\n *\n * Executed before the child elements are linked. Not safe to do DOM transformation since the\n * compiler linking function will fail to locate the correct elements for linking.\n *\n * #### Post-linking function\n *\n * Executed after the child elements are linked.\n *\n * Note that child elements that contain `templateUrl` directives will not have been compiled\n * and linked since they are waiting for their template to load asynchronously and their own\n * compilation and linking has been suspended until that occurs.\n *\n * It is safe to do DOM transformation in the post-linking function on elements that are not waiting\n * for their async templates to be resolved.\n *\n *\n * ### Transclusion\n *\n * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and\n * copying them to another part of the DOM, while maintaining their connection to the original AngularJS\n * scope from where they were taken.\n *\n * Transclusion is used (often with {@link ngTransclude}) to insert the\n * original contents of a directive's element into a specified place in the template of the directive.\n * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded\n * content has access to the properties on the scope from which it was taken, even if the directive\n * has isolated scope.\n * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.\n *\n * This makes it possible for the widget to have private state for its template, while the transcluded\n * content has access to its originating scope.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** When testing an element transclude directive you must not place the directive at the root of the\n * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives\n * Testing Transclusion Directives}.\n * </div>\n *\n * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the\n * directive's element, the entire element or multiple parts of the element contents:\n *\n * * `true` - transclude the content (i.e. the child nodes) of the directive's element.\n * * `'element'` - transclude the whole of the directive's element including any directives on this\n *   element that defined at a lower priority than this directive. When used, the `template`\n *   property is ignored.\n * * **`{...}` (an object hash):** - map elements of the content onto transclusion \"slots\" in the template.\n *\n * **Mult-slot transclusion** is declared by providing an object for the `transclude` property.\n *\n * This object is a map where the keys are the name of the slot to fill and the value is an element selector\n * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)\n * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).\n *\n * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}\n *\n * If the element selector is prefixed with a `?` then that slot is optional.\n *\n * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `<my-custom-element>` elements to\n * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive.\n *\n * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements\n * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call\n * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and\n * injectable into the directive's controller.\n *\n *\n * #### Transclusion Functions\n *\n * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion\n * function** to the directive's `link` function and `controller`. This transclusion function is a special\n * **linking function** that will return the compiled contents linked to a new transclusion scope.\n *\n * <div class=\"alert alert-info\">\n * If you are just using {@link ngTransclude} then you don't need to worry about this function, since\n * ngTransclude will deal with it for us.\n * </div>\n *\n * If you want to manually control the insertion and removal of the transcluded content in your directive\n * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery\n * object that contains the compiled DOM, which is linked to the correct transclusion scope.\n *\n * When you call a transclusion function you can pass in a **clone attach function**. This function accepts\n * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded\n * content and the `scope` is the newly created transclusion scope, to which the clone is bound.\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function\n * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.\n * </div>\n *\n * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone\n * attach function**:\n *\n * ```js\n * var transcludedContent, transclusionScope;\n *\n * $transclude(function(clone, scope) {\n *   element.append(clone);\n *   transcludedContent = clone;\n *   transclusionScope = scope;\n * });\n * ```\n *\n * Later, if you want to remove the transcluded content from your DOM then you should also destroy the\n * associated transclusion scope:\n *\n * ```js\n * transcludedContent.remove();\n * transclusionScope.$destroy();\n * ```\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: if you intend to add and remove transcluded content manually in your directive\n * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),\n * then you are also responsible for calling `$destroy` on the transclusion scope.\n * </div>\n *\n * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}\n * automatically destroy their transcluded clones as necessary so you do not need to worry about this if\n * you are simply using {@link ngTransclude} to inject the transclusion into your directive.\n *\n *\n * #### Transclusion Scopes\n *\n * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion\n * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed\n * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it\n * was taken.\n *\n * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look\n * like this:\n *\n * ```html\n * <div ng-app>\n *   <div isolate>\n *     <div transclusion>\n *     </div>\n *   </div>\n * </div>\n * ```\n *\n * The `$parent` scope hierarchy will look like this:\n *\n   ```\n   - $rootScope\n     - isolate\n       - transclusion\n   ```\n *\n * but the scopes will inherit prototypically from different scopes to their `$parent`.\n *\n   ```\n   - $rootScope\n     - transclusion\n   - isolate\n   ```\n *\n *\n * ### Attributes\n *\n * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the\n * `link()` or `compile()` functions. It has a variety of uses.\n *\n * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:\n *   'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access\n *   to the attributes.\n *\n * * *Directive inter-communication:* All directives share the same instance of the attributes\n *   object which allows the directives to use the attributes object as inter directive\n *   communication.\n *\n * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object\n *   allowing other directives to read the interpolated value.\n *\n * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes\n *   that contain interpolation (e.g. `src=\"{{bar}}\"`). Not only is this very efficient but it's also\n *   the only way to easily get the actual value because during the linking phase the interpolation\n *   hasn't been evaluated yet and so the value is at this time set to `undefined`.\n *\n * ```js\n * function linkingFn(scope, elm, attrs, ctrl) {\n *   // get the attribute value\n *   console.log(attrs.ngModel);\n *\n *   // change the attribute\n *   attrs.$set('ngModel', 'new value');\n *\n *   // observe changes to interpolated attribute\n *   attrs.$observe('ngModel', function(value) {\n *     console.log('ngModel has changed value to ' + value);\n *   });\n * }\n * ```\n *\n * ## Example\n *\n * <div class=\"alert alert-warning\">\n * **Note**: Typically directives are registered with `module.directive`. The example below is\n * to illustrate how `$compile` works.\n * </div>\n *\n <example module=\"compileExample\">\n   <file name=\"index.html\">\n    <script>\n      angular.module('compileExample', [], function($compileProvider) {\n        // configure new 'compile' directive by passing a directive\n        // factory function. The factory function injects the '$compile'\n        $compileProvider.directive('compile', function($compile) {\n          // directive factory creates a link function\n          return function(scope, element, attrs) {\n            scope.$watch(\n              function(scope) {\n                 // watch the 'compile' expression for changes\n                return scope.$eval(attrs.compile);\n              },\n              function(value) {\n                // when the 'compile' expression changes\n                // assign it into the current DOM\n                element.html(value);\n\n                // compile the new DOM and link it to the current\n                // scope.\n                // NOTE: we only compile .childNodes so that\n                // we don't get into infinite loop compiling ourselves\n                $compile(element.contents())(scope);\n              }\n            );\n          };\n        });\n      })\n      .controller('GreeterController', ['$scope', function($scope) {\n        $scope.name = 'Angular';\n        $scope.html = 'Hello {{name}}';\n      }]);\n    </script>\n    <div ng-controller=\"GreeterController\">\n      <input ng-model=\"name\"> <br/>\n      <textarea ng-model=\"html\"></textarea> <br/>\n      <div compile=\"html\"></div>\n    </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should auto compile', function() {\n       var textarea = $('textarea');\n       var output = $('div[compile]');\n       // The initial state reads 'Hello Angular'.\n       expect(output.getText()).toBe('Hello Angular');\n       textarea.clear();\n       textarea.sendKeys('{{name}}!');\n       expect(output.getText()).toBe('Angular!');\n     });\n   </file>\n </example>\n\n *\n *\n * @param {string|DOMElement} element Element or HTML string to compile into a template function.\n * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.\n *\n * <div class=\"alert alert-danger\">\n * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it\n *   e.g. will not use the right outer scope. Please pass the transclude function as a\n *   `parentBoundTranscludeFn` to the link function instead.\n * </div>\n *\n * @param {number} maxPriority only apply directives lower than given priority (Only effects the\n *                 root element(s), not their children)\n * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template\n * (a DOM element/tree) to a scope. Where:\n *\n *  * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.\n *  * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the\n *  `template` and call the `cloneAttachFn` function allowing the caller to attach the\n *  cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is\n *  called as: <br/> `cloneAttachFn(clonedElement, scope)` where:\n *\n *      * `clonedElement` - is a clone of the original `element` passed into the compiler.\n *      * `scope` - is the current scope with which the linking function is working with.\n *\n *  * `options` - An optional object hash with linking options. If `options` is provided, then the following\n *  keys may be used to control linking behavior:\n *\n *      * `parentBoundTranscludeFn` - the transclude function made available to\n *        directives; if given, it will be passed through to the link functions of\n *        directives found in `element` during compilation.\n *      * `transcludeControllers` - an object hash with keys that map controller names\n *        to a hash with the key `instance`, which maps to the controller instance;\n *        if given, it will make the controllers available to directives on the compileNode:\n *        ```\n *        {\n *          parent: {\n *            instance: parentControllerInstance\n *          }\n *        }\n *        ```\n *      * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add\n *        the cloned elements; only needed for transcludes that are allowed to contain non html\n *        elements (e.g. SVG elements). See also the directive.controller property.\n *\n * Calling the linking function returns the element of the template. It is either the original\n * element passed in, or the clone of the element if the `cloneAttachFn` is provided.\n *\n * After linking the view is not updated until after a call to $digest which typically is done by\n * Angular automatically.\n *\n * If you need access to the bound view, there are two ways to do it:\n *\n * - If you are not asking the linking function to clone the template, create the DOM element(s)\n *   before you send them to the compiler and keep this reference around.\n *   ```js\n *     var element = $compile('<p>{{total}}</p>')(scope);\n *   ```\n *\n * - if on the other hand, you need the element to be cloned, the view reference from the original\n *   example would not point to the clone, but rather to the original template that was cloned. In\n *   this case, you can access the clone via the cloneAttachFn:\n *   ```js\n *     var templateElement = angular.element('<p>{{total}}</p>'),\n *         scope = ....;\n *\n *     var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {\n *       //attach the clone to DOM document at the right place\n *     });\n *\n *     //now we have reference to the cloned DOM via `clonedElement`\n *   ```\n *\n *\n * For information on how the compiler works, see the\n * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.\n */\n\nvar $compileMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $compileProvider\n *\n * @description\n */\n$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];\nfunction $CompileProvider($provide, $$sanitizeUriProvider) {\n  var hasDirectives = {},\n      Suffix = 'Directive',\n      COMMENT_DIRECTIVE_REGEXP = /^\\s*directive\\:\\s*([\\w\\-]+)\\s+(.*)$/,\n      CLASS_DIRECTIVE_REGEXP = /(([\\w\\-]+)(?:\\:([^;]+))?;?)/,\n      ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),\n      REQUIRE_PREFIX_REGEXP = /^(?:(\\^\\^?)?(\\?)?(\\^\\^?)?)?/;\n\n  // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes\n  // The assumption is that future DOM event attribute names will begin with\n  // 'on' and be composed of only English letters.\n  var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;\n  var bindingCache = createMap();\n\n  function parseIsolateBindings(scope, directiveName, isController) {\n    var LOCAL_REGEXP = /^\\s*([@&<]|=(\\*?))(\\??)\\s*(\\w*)\\s*$/;\n\n    var bindings = {};\n\n    forEach(scope, function(definition, scopeName) {\n      if (definition in bindingCache) {\n        bindings[scopeName] = bindingCache[definition];\n        return;\n      }\n      var match = definition.match(LOCAL_REGEXP);\n\n      if (!match) {\n        throw $compileMinErr('iscp',\n            \"Invalid {3} for directive '{0}'.\" +\n            \" Definition: {... {1}: '{2}' ...}\",\n            directiveName, scopeName, definition,\n            (isController ? \"controller bindings definition\" :\n            \"isolate scope definition\"));\n      }\n\n      bindings[scopeName] = {\n        mode: match[1][0],\n        collection: match[2] === '*',\n        optional: match[3] === '?',\n        attrName: match[4] || scopeName\n      };\n      if (match[4]) {\n        bindingCache[definition] = bindings[scopeName];\n      }\n    });\n\n    return bindings;\n  }\n\n  function parseDirectiveBindings(directive, directiveName) {\n    var bindings = {\n      isolateScope: null,\n      bindToController: null\n    };\n    if (isObject(directive.scope)) {\n      if (directive.bindToController === true) {\n        bindings.bindToController = parseIsolateBindings(directive.scope,\n                                                         directiveName, true);\n        bindings.isolateScope = {};\n      } else {\n        bindings.isolateScope = parseIsolateBindings(directive.scope,\n                                                     directiveName, false);\n      }\n    }\n    if (isObject(directive.bindToController)) {\n      bindings.bindToController =\n          parseIsolateBindings(directive.bindToController, directiveName, true);\n    }\n    if (isObject(bindings.bindToController)) {\n      var controller = directive.controller;\n      var controllerAs = directive.controllerAs;\n      if (!controller) {\n        // There is no controller, there may or may not be a controllerAs property\n        throw $compileMinErr('noctrl',\n              \"Cannot bind to controller without directive '{0}'s controller.\",\n              directiveName);\n      } else if (!identifierForController(controller, controllerAs)) {\n        // There is a controller, but no identifier or controllerAs property\n        throw $compileMinErr('noident',\n              \"Cannot bind to controller without identifier for directive '{0}'.\",\n              directiveName);\n      }\n    }\n    return bindings;\n  }\n\n  function assertValidDirectiveName(name) {\n    var letter = name.charAt(0);\n    if (!letter || letter !== lowercase(letter)) {\n      throw $compileMinErr('baddir', \"Directive/Component name '{0}' is invalid. The first character must be a lowercase letter\", name);\n    }\n    if (name !== name.trim()) {\n      throw $compileMinErr('baddir',\n            \"Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces\",\n            name);\n    }\n  }\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#directive\n   * @kind function\n   *\n   * @description\n   * Register a new directive with the compiler.\n   *\n   * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which\n   *    will match as <code>ng-bind</code>), or an object map of directives where the keys are the\n   *    names and the values are the factories.\n   * @param {Function|Array} directiveFactory An injectable directive factory function. See the\n   *    {@link guide/directive directive guide} and the {@link $compile compile API} for more info.\n   * @returns {ng.$compileProvider} Self for chaining.\n   */\n  this.directive = function registerDirective(name, directiveFactory) {\n    assertNotHasOwnProperty(name, 'directive');\n    if (isString(name)) {\n      assertValidDirectiveName(name);\n      assertArg(directiveFactory, 'directiveFactory');\n      if (!hasDirectives.hasOwnProperty(name)) {\n        hasDirectives[name] = [];\n        $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',\n          function($injector, $exceptionHandler) {\n            var directives = [];\n            forEach(hasDirectives[name], function(directiveFactory, index) {\n              try {\n                var directive = $injector.invoke(directiveFactory);\n                if (isFunction(directive)) {\n                  directive = { compile: valueFn(directive) };\n                } else if (!directive.compile && directive.link) {\n                  directive.compile = valueFn(directive.link);\n                }\n                directive.priority = directive.priority || 0;\n                directive.index = index;\n                directive.name = directive.name || name;\n                directive.require = directive.require || (directive.controller && directive.name);\n                directive.restrict = directive.restrict || 'EA';\n                directive.$$moduleName = directiveFactory.$$moduleName;\n                directives.push(directive);\n              } catch (e) {\n                $exceptionHandler(e);\n              }\n            });\n            return directives;\n          }]);\n      }\n      hasDirectives[name].push(directiveFactory);\n    } else {\n      forEach(name, reverseParams(registerDirective));\n    }\n    return this;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#component\n   * @module ng\n   * @param {string} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`)\n   * @param {Object} options Component definition object (a simplified\n   *    {@link ng.$compile#directive-definition-object directive definition object}),\n   *    with the following properties (all optional):\n   *\n   *    - `controller` – `{(string|function()=}` – controller constructor function that should be\n   *      associated with newly created scope or the name of a {@link ng.$compile#-controller-\n   *      registered controller} if passed as a string. An empty `noop` function by default.\n   *    - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope.\n   *      If present, the controller will be published to scope under the `controllerAs` name.\n   *      If not present, this will default to be `$ctrl`.\n   *    - `template` – `{string=|function()=}` – html template as a string or a function that\n   *      returns an html template as a string which should be used as the contents of this component.\n   *      Empty string by default.\n   *\n   *      If `template` is a function, then it is {@link auto.$injector#invoke injected} with\n   *      the following locals:\n   *\n   *      - `$element` - Current element\n   *      - `$attrs` - Current attributes object for the element\n   *\n   *    - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html\n   *      template that should be used  as the contents of this component.\n   *\n   *      If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with\n   *      the following locals:\n   *\n   *      - `$element` - Current element\n   *      - `$attrs` - Current attributes object for the element\n   *\n   *    - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties.\n   *      Component properties are always bound to the component controller and not to the scope.\n   *      See {@link ng.$compile#-bindtocontroller- `bindToController`}.\n   *    - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.\n   *      Disabled by default.\n   *    - `$...` – additional properties to attach to the directive factory function and the controller\n   *      constructor function. (This is used by the component router to annotate)\n   *\n   * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls.\n   * @description\n   * Register a **component definition** with the compiler. This is a shorthand for registering a special\n   * type of directive, which represents a self-contained UI component in your application. Such components\n   * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).\n   *\n   * Component definitions are very simple and do not require as much configuration as defining general\n   * directives. Component definitions usually consist only of a template and a controller backing it.\n   *\n   * In order to make the definition easier, components enforce best practices like use of `controllerAs`,\n   * `bindToController`. They always have **isolate scope** and are restricted to elements.\n   *\n   * Here are a few examples of how you would usually define components:\n   *\n   * ```js\n   *   var myMod = angular.module(...);\n   *   myMod.component('myComp', {\n   *     template: '<div>My name is {{$ctrl.name}}</div>',\n   *     controller: function() {\n   *       this.name = 'shahar';\n   *     }\n   *   });\n   *\n   *   myMod.component('myComp', {\n   *     template: '<div>My name is {{$ctrl.name}}</div>',\n   *     bindings: {name: '@'}\n   *   });\n   *\n   *   myMod.component('myComp', {\n   *     templateUrl: 'views/my-comp.html',\n   *     controller: 'MyCtrl',\n   *     controllerAs: 'ctrl',\n   *     bindings: {name: '@'}\n   *   });\n   *\n   * ```\n   * For more examples, and an in-depth guide, see the {@link guide/component component guide}.\n   *\n   * <br />\n   * See also {@link ng.$compileProvider#directive $compileProvider.directive()}.\n   */\n  this.component = function registerComponent(name, options) {\n    var controller = options.controller || noop;\n\n    function factory($injector) {\n      function makeInjectable(fn) {\n        if (isFunction(fn) || isArray(fn)) {\n          return function(tElement, tAttrs) {\n            return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});\n          };\n        } else {\n          return fn;\n        }\n      }\n\n      var template = (!options.template && !options.templateUrl ? '' : options.template);\n      return {\n        controller: controller,\n        controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',\n        template: makeInjectable(template),\n        templateUrl: makeInjectable(options.templateUrl),\n        transclude: options.transclude,\n        scope: {},\n        bindToController: options.bindings || {},\n        restrict: 'E',\n        require: options.require\n      };\n    }\n\n    // Copy any annotation properties (starting with $) over to the factory function\n    // These could be used by libraries such as the new component router\n    forEach(options, function(val, key) {\n      if (key.charAt(0) === '$') {\n        factory[key] = val;\n        controller[key] = val;\n      }\n    });\n\n    factory.$inject = ['$injector'];\n\n    return this.directive(name, factory);\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#aHrefSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at preventing XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.aHrefSanitizationWhitelist();\n    }\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#imgSrcSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name  $compileProvider#debugInfoEnabled\n   *\n   * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the\n   * current debugInfoEnabled state\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   *\n   * @kind function\n   *\n   * @description\n   * Call this method to enable/disable various debug runtime information in the compiler such as adding\n   * binding information and a reference to the current scope on to DOM elements.\n   * If enabled, the compiler will add the following to DOM elements that have been bound to the scope\n   * * `ng-binding` CSS class\n   * * `$binding` data property containing an array of the binding expressions\n   *\n   * You may want to disable this in production for a significant performance boost. See\n   * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.\n   *\n   * The default value is true.\n   */\n  var debugInfoEnabled = true;\n  this.debugInfoEnabled = function(enabled) {\n    if (isDefined(enabled)) {\n      debugInfoEnabled = enabled;\n      return this;\n    }\n    return debugInfoEnabled;\n  };\n\n\n  var TTL = 10;\n  /**\n   * @ngdoc method\n   * @name $compileProvider#onChangesTtl\n   * @description\n   *\n   * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and\n   * assuming that the model is unstable.\n   *\n   * The current default is 10 iterations.\n   *\n   * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result\n   * in several iterations of calls to these hooks. However if an application needs more than the default 10\n   * iterations to stabilize then you should investigate what is causing the model to continuously change during\n   * the `$onChanges` hook execution.\n   *\n   * Increasing the TTL could have performance implications, so you should not change it without proper justification.\n   *\n   * @param {number} limit The number of `$onChanges` hook iterations.\n   * @returns {number|object} the current limit (or `this` if called as a setter for chaining)\n   */\n  this.onChangesTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n      return this;\n    }\n    return TTL;\n  };\n\n  this.$get = [\n            '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',\n            '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',\n    function($injector,   $interpolate,   $exceptionHandler,   $templateRequest,   $parse,\n             $controller,   $rootScope,   $sce,   $animate,   $$sanitizeUri) {\n\n    var SIMPLE_ATTR_NAME = /^\\w/;\n    var specialAttrHolder = document.createElement('div');\n\n\n\n    var onChangesTtl = TTL;\n    // The onChanges hooks should all be run together in a single digest\n    // When changes occur, the call to trigger their hooks will be added to this queue\n    var onChangesQueue;\n\n    // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest\n    function flushOnChangesQueue() {\n      try {\n        if (!(--onChangesTtl)) {\n          // We have hit the TTL limit so reset everything\n          onChangesQueue = undefined;\n          throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\\n', TTL);\n        }\n        // We must run this hook in an apply since the $$postDigest runs outside apply\n        $rootScope.$apply(function() {\n          for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) {\n            onChangesQueue[i]();\n          }\n          // Reset the queue to trigger a new schedule next time there is a change\n          onChangesQueue = undefined;\n        });\n      } finally {\n        onChangesTtl++;\n      }\n    }\n\n\n    function Attributes(element, attributesToCopy) {\n      if (attributesToCopy) {\n        var keys = Object.keys(attributesToCopy);\n        var i, l, key;\n\n        for (i = 0, l = keys.length; i < l; i++) {\n          key = keys[i];\n          this[key] = attributesToCopy[key];\n        }\n      } else {\n        this.$attr = {};\n      }\n\n      this.$$element = element;\n    }\n\n    Attributes.prototype = {\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$normalize\n       * @kind function\n       *\n       * @description\n       * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or\n       * `data-`) to its normalized, camelCase form.\n       *\n       * Also there is special case for Moz prefix starting with upper case letter.\n       *\n       * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}\n       *\n       * @param {string} name Name to normalize\n       */\n      $normalize: directiveNormalize,\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$addClass\n       * @kind function\n       *\n       * @description\n       * Adds the CSS class value specified by the classVal parameter to the element. If animations\n       * are enabled then an animation will be triggered for the class addition.\n       *\n       * @param {string} classVal The className value that will be added to the element\n       */\n      $addClass: function(classVal) {\n        if (classVal && classVal.length > 0) {\n          $animate.addClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$removeClass\n       * @kind function\n       *\n       * @description\n       * Removes the CSS class value specified by the classVal parameter from the element. If\n       * animations are enabled then an animation will be triggered for the class removal.\n       *\n       * @param {string} classVal The className value that will be removed from the element\n       */\n      $removeClass: function(classVal) {\n        if (classVal && classVal.length > 0) {\n          $animate.removeClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$updateClass\n       * @kind function\n       *\n       * @description\n       * Adds and removes the appropriate CSS class values to the element based on the difference\n       * between the new and old CSS class values (specified as newClasses and oldClasses).\n       *\n       * @param {string} newClasses The current CSS className value\n       * @param {string} oldClasses The former CSS className value\n       */\n      $updateClass: function(newClasses, oldClasses) {\n        var toAdd = tokenDifference(newClasses, oldClasses);\n        if (toAdd && toAdd.length) {\n          $animate.addClass(this.$$element, toAdd);\n        }\n\n        var toRemove = tokenDifference(oldClasses, newClasses);\n        if (toRemove && toRemove.length) {\n          $animate.removeClass(this.$$element, toRemove);\n        }\n      },\n\n      /**\n       * Set a normalized attribute on the element in a way such that all directives\n       * can share the attribute. This function properly handles boolean attributes.\n       * @param {string} key Normalized key. (ie ngAttribute)\n       * @param {string|boolean} value The value to set. If `null` attribute will be deleted.\n       * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.\n       *     Defaults to true.\n       * @param {string=} attrName Optional none normalized name. Defaults to key.\n       */\n      $set: function(key, value, writeAttr, attrName) {\n        // TODO: decide whether or not to throw an error if \"class\"\n        //is set through this function since it may cause $updateClass to\n        //become unstable.\n\n        var node = this.$$element[0],\n            booleanKey = getBooleanAttrName(node, key),\n            aliasedKey = getAliasedAttrName(key),\n            observer = key,\n            nodeName;\n\n        if (booleanKey) {\n          this.$$element.prop(key, value);\n          attrName = booleanKey;\n        } else if (aliasedKey) {\n          this[aliasedKey] = value;\n          observer = aliasedKey;\n        }\n\n        this[key] = value;\n\n        // translate normalized key to actual key\n        if (attrName) {\n          this.$attr[key] = attrName;\n        } else {\n          attrName = this.$attr[key];\n          if (!attrName) {\n            this.$attr[key] = attrName = snake_case(key, '-');\n          }\n        }\n\n        nodeName = nodeName_(this.$$element);\n\n        if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||\n            (nodeName === 'img' && key === 'src')) {\n          // sanitize a[href] and img[src] values\n          this[key] = value = $$sanitizeUri(value, key === 'src');\n        } else if (nodeName === 'img' && key === 'srcset') {\n          // sanitize img[srcset] values\n          var result = \"\";\n\n          // first check if there are spaces because it's not the same pattern\n          var trimmedSrcset = trim(value);\n          //                (   999x   ,|   999w   ,|   ,|,   )\n          var srcPattern = /(\\s+\\d+x\\s*,|\\s+\\d+w\\s*,|\\s+,|,\\s+)/;\n          var pattern = /\\s/.test(trimmedSrcset) ? srcPattern : /(,)/;\n\n          // split srcset into tuple of uri and descriptor except for the last item\n          var rawUris = trimmedSrcset.split(pattern);\n\n          // for each tuples\n          var nbrUrisWith2parts = Math.floor(rawUris.length / 2);\n          for (var i = 0; i < nbrUrisWith2parts; i++) {\n            var innerIdx = i * 2;\n            // sanitize the uri\n            result += $$sanitizeUri(trim(rawUris[innerIdx]), true);\n            // add the descriptor\n            result += (\" \" + trim(rawUris[innerIdx + 1]));\n          }\n\n          // split the last item into uri and descriptor\n          var lastTuple = trim(rawUris[i * 2]).split(/\\s/);\n\n          // sanitize the last uri\n          result += $$sanitizeUri(trim(lastTuple[0]), true);\n\n          // and add the last descriptor if any\n          if (lastTuple.length === 2) {\n            result += (\" \" + trim(lastTuple[1]));\n          }\n          this[key] = value = result;\n        }\n\n        if (writeAttr !== false) {\n          if (value === null || isUndefined(value)) {\n            this.$$element.removeAttr(attrName);\n          } else {\n            if (SIMPLE_ATTR_NAME.test(attrName)) {\n              this.$$element.attr(attrName, value);\n            } else {\n              setSpecialAttr(this.$$element[0], attrName, value);\n            }\n          }\n        }\n\n        // fire observers\n        var $$observers = this.$$observers;\n        $$observers && forEach($$observers[observer], function(fn) {\n          try {\n            fn(value);\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        });\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$observe\n       * @kind function\n       *\n       * @description\n       * Observes an interpolated attribute.\n       *\n       * The observer function will be invoked once during the next `$digest` following\n       * compilation. The observer is then invoked whenever the interpolated value\n       * changes.\n       *\n       * @param {string} key Normalized key. (ie ngAttribute) .\n       * @param {function(interpolatedValue)} fn Function that will be called whenever\n                the interpolated value of the attribute changes.\n       *        See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation\n       *        guide} for more info.\n       * @returns {function()} Returns a deregistration function for this observer.\n       */\n      $observe: function(key, fn) {\n        var attrs = this,\n            $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),\n            listeners = ($$observers[key] || ($$observers[key] = []));\n\n        listeners.push(fn);\n        $rootScope.$evalAsync(function() {\n          if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {\n            // no one registered attribute interpolation function, so lets call it manually\n            fn(attrs[key]);\n          }\n        });\n\n        return function() {\n          arrayRemove(listeners, fn);\n        };\n      }\n    };\n\n    function setSpecialAttr(element, attrName, value) {\n      // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`\n      // so we have to jump through some hoops to get such an attribute\n      // https://github.com/angular/angular.js/pull/13318\n      specialAttrHolder.innerHTML = \"<span \" + attrName + \">\";\n      var attributes = specialAttrHolder.firstChild.attributes;\n      var attribute = attributes[0];\n      // We have to remove the attribute from its container element before we can add it to the destination element\n      attributes.removeNamedItem(attribute.name);\n      attribute.value = value;\n      element.attributes.setNamedItem(attribute);\n    }\n\n    function safeAddClass($element, className) {\n      try {\n        $element.addClass(className);\n      } catch (e) {\n        // ignore, since it means that we are trying to set class on\n        // SVG element, where class name is read-only.\n      }\n    }\n\n\n    var startSymbol = $interpolate.startSymbol(),\n        endSymbol = $interpolate.endSymbol(),\n        denormalizeTemplate = (startSymbol == '{{' && endSymbol  == '}}')\n            ? identity\n            : function denormalizeTemplate(template) {\n              return template.replace(/\\{\\{/g, startSymbol).replace(/}}/g, endSymbol);\n        },\n        NG_ATTR_BINDING = /^ngAttr[A-Z]/;\n    var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;\n\n    compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {\n      var bindings = $element.data('$binding') || [];\n\n      if (isArray(binding)) {\n        bindings = bindings.concat(binding);\n      } else {\n        bindings.push(binding);\n      }\n\n      $element.data('$binding', bindings);\n    } : noop;\n\n    compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {\n      safeAddClass($element, 'ng-binding');\n    } : noop;\n\n    compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {\n      var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';\n      $element.data(dataName, scope);\n    } : noop;\n\n    compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {\n      safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');\n    } : noop;\n\n    compile.$$createComment = function(directiveName, comment) {\n      var content = '';\n      if (debugInfoEnabled) {\n        content = ' ' + (directiveName || '') + ': ' + (comment || '') + ' ';\n      }\n      return document.createComment(content);\n    };\n\n    return compile;\n\n    //================================\n\n    function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,\n                        previousCompileContext) {\n      if (!($compileNodes instanceof jqLite)) {\n        // jquery always rewraps, whereas we need to preserve the original selector so that we can\n        // modify it.\n        $compileNodes = jqLite($compileNodes);\n      }\n\n      var NOT_EMPTY = /\\S+/;\n\n      // We can not compile top level text elements since text nodes can be merged and we will\n      // not be able to attach scope data to them, so we will wrap them in <span>\n      for (var i = 0, len = $compileNodes.length; i < len; i++) {\n        var domNode = $compileNodes[i];\n\n        if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {\n          jqLiteWrapNode(domNode, $compileNodes[i] = document.createElement('span'));\n        }\n      }\n\n      var compositeLinkFn =\n              compileNodes($compileNodes, transcludeFn, $compileNodes,\n                           maxPriority, ignoreDirective, previousCompileContext);\n      compile.$$addScopeClass($compileNodes);\n      var namespace = null;\n      return function publicLinkFn(scope, cloneConnectFn, options) {\n        assertArg(scope, 'scope');\n\n        if (previousCompileContext && previousCompileContext.needsNewScope) {\n          // A parent directive did a replace and a directive on this element asked\n          // for transclusion, which caused us to lose a layer of element on which\n          // we could hold the new transclusion scope, so we will create it manually\n          // here.\n          scope = scope.$parent.$new();\n        }\n\n        options = options || {};\n        var parentBoundTranscludeFn = options.parentBoundTranscludeFn,\n          transcludeControllers = options.transcludeControllers,\n          futureParentElement = options.futureParentElement;\n\n        // When `parentBoundTranscludeFn` is passed, it is a\n        // `controllersBoundTransclude` function (it was previously passed\n        // as `transclude` to directive.link) so we must unwrap it to get\n        // its `boundTranscludeFn`\n        if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {\n          parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;\n        }\n\n        if (!namespace) {\n          namespace = detectNamespaceForChildElements(futureParentElement);\n        }\n        var $linkNode;\n        if (namespace !== 'html') {\n          // When using a directive with replace:true and templateUrl the $compileNodes\n          // (or a child element inside of them)\n          // might change, so we need to recreate the namespace adapted compileNodes\n          // for call to the link function.\n          // Note: This will already clone the nodes...\n          $linkNode = jqLite(\n            wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())\n          );\n        } else if (cloneConnectFn) {\n          // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart\n          // and sometimes changes the structure of the DOM.\n          $linkNode = JQLitePrototype.clone.call($compileNodes);\n        } else {\n          $linkNode = $compileNodes;\n        }\n\n        if (transcludeControllers) {\n          for (var controllerName in transcludeControllers) {\n            $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);\n          }\n        }\n\n        compile.$$addScopeInfo($linkNode, scope);\n\n        if (cloneConnectFn) cloneConnectFn($linkNode, scope);\n        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);\n        return $linkNode;\n      };\n    }\n\n    function detectNamespaceForChildElements(parentElement) {\n      // TODO: Make this detect MathML as well...\n      var node = parentElement && parentElement[0];\n      if (!node) {\n        return 'html';\n      } else {\n        return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html';\n      }\n    }\n\n    /**\n     * Compile function matches each node in nodeList against the directives. Once all directives\n     * for a particular node are collected their compile functions are executed. The compile\n     * functions return values - the linking functions - are combined into a composite linking\n     * function, which is the a linking function for the node.\n     *\n     * @param {NodeList} nodeList an array of nodes or NodeList to compile\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *        scope argument is auto-generated to the new child of the transcluded parent scope.\n     * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then\n     *        the rootElement must be set the jqLite collection of the compile root. This is\n     *        needed so that the jqLite collection items can be replaced with widgets.\n     * @param {number=} maxPriority Max directive priority.\n     * @returns {Function} A composite linking function of all of the matched directives or null.\n     */\n    function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,\n                            previousCompileContext) {\n      var linkFns = [],\n          attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;\n\n      for (var i = 0; i < nodeList.length; i++) {\n        attrs = new Attributes();\n\n        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.\n        directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,\n                                        ignoreDirective);\n\n        nodeLinkFn = (directives.length)\n            ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,\n                                      null, [], [], previousCompileContext)\n            : null;\n\n        if (nodeLinkFn && nodeLinkFn.scope) {\n          compile.$$addScopeClass(attrs.$$element);\n        }\n\n        childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||\n                      !(childNodes = nodeList[i].childNodes) ||\n                      !childNodes.length)\n            ? null\n            : compileNodes(childNodes,\n                 nodeLinkFn ? (\n                  (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)\n                     && nodeLinkFn.transclude) : transcludeFn);\n\n        if (nodeLinkFn || childLinkFn) {\n          linkFns.push(i, nodeLinkFn, childLinkFn);\n          linkFnFound = true;\n          nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;\n        }\n\n        //use the previous context only for the first element in the virtual group\n        previousCompileContext = null;\n      }\n\n      // return a linking function if we have found anything, null otherwise\n      return linkFnFound ? compositeLinkFn : null;\n\n      function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {\n        var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;\n        var stableNodeList;\n\n\n        if (nodeLinkFnFound) {\n          // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our\n          // offsets don't get screwed up\n          var nodeListLength = nodeList.length;\n          stableNodeList = new Array(nodeListLength);\n\n          // create a sparse array by only copying the elements which have a linkFn\n          for (i = 0; i < linkFns.length; i+=3) {\n            idx = linkFns[i];\n            stableNodeList[idx] = nodeList[idx];\n          }\n        } else {\n          stableNodeList = nodeList;\n        }\n\n        for (i = 0, ii = linkFns.length; i < ii;) {\n          node = stableNodeList[linkFns[i++]];\n          nodeLinkFn = linkFns[i++];\n          childLinkFn = linkFns[i++];\n\n          if (nodeLinkFn) {\n            if (nodeLinkFn.scope) {\n              childScope = scope.$new();\n              compile.$$addScopeInfo(jqLite(node), childScope);\n            } else {\n              childScope = scope;\n            }\n\n            if (nodeLinkFn.transcludeOnThisElement) {\n              childBoundTranscludeFn = createBoundTranscludeFn(\n                  scope, nodeLinkFn.transclude, parentBoundTranscludeFn);\n\n            } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {\n              childBoundTranscludeFn = parentBoundTranscludeFn;\n\n            } else if (!parentBoundTranscludeFn && transcludeFn) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);\n\n            } else {\n              childBoundTranscludeFn = null;\n            }\n\n            nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);\n\n          } else if (childLinkFn) {\n            childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);\n          }\n        }\n      }\n    }\n\n    function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {\n      function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {\n\n        if (!transcludedScope) {\n          transcludedScope = scope.$new(false, containingScope);\n          transcludedScope.$$transcluded = true;\n        }\n\n        return transcludeFn(transcludedScope, cloneFn, {\n          parentBoundTranscludeFn: previousBoundTranscludeFn,\n          transcludeControllers: controllers,\n          futureParentElement: futureParentElement\n        });\n      }\n\n      // We need  to attach the transclusion slots onto the `boundTranscludeFn`\n      // so that they are available inside the `controllersBoundTransclude` function\n      var boundSlots = boundTranscludeFn.$$slots = createMap();\n      for (var slotName in transcludeFn.$$slots) {\n        if (transcludeFn.$$slots[slotName]) {\n          boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);\n        } else {\n          boundSlots[slotName] = null;\n        }\n      }\n\n      return boundTranscludeFn;\n    }\n\n    /**\n     * Looks for directives on the given node and adds them to the directive collection which is\n     * sorted.\n     *\n     * @param node Node to search.\n     * @param directives An array to which the directives are added to. This array is sorted before\n     *        the function returns.\n     * @param attrs The shared attrs object which is used to populate the normalized attributes.\n     * @param {number=} maxPriority Max directive priority.\n     */\n    function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {\n      var nodeType = node.nodeType,\n          attrsMap = attrs.$attr,\n          match,\n          className;\n\n      switch (nodeType) {\n        case NODE_TYPE_ELEMENT: /* Element */\n          // use the node name: <directive>\n          addDirective(directives,\n              directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);\n\n          // iterate over the attributes\n          for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,\n                   j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {\n            var attrStartName = false;\n            var attrEndName = false;\n\n            attr = nAttrs[j];\n            name = attr.name;\n            value = trim(attr.value);\n\n            // support ngAttr attribute binding\n            ngAttrName = directiveNormalize(name);\n            if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {\n              name = name.replace(PREFIX_REGEXP, '')\n                .substr(8).replace(/_(.)/g, function(match, letter) {\n                  return letter.toUpperCase();\n                });\n            }\n\n            var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);\n            if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {\n              attrStartName = name;\n              attrEndName = name.substr(0, name.length - 5) + 'end';\n              name = name.substr(0, name.length - 6);\n            }\n\n            nName = directiveNormalize(name.toLowerCase());\n            attrsMap[nName] = name;\n            if (isNgAttr || !attrs.hasOwnProperty(nName)) {\n                attrs[nName] = value;\n                if (getBooleanAttrName(node, nName)) {\n                  attrs[nName] = true; // presence means true\n                }\n            }\n            addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);\n            addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,\n                          attrEndName);\n          }\n\n          // use class as directive\n          className = node.className;\n          if (isObject(className)) {\n              // Maybe SVGAnimatedString\n              className = className.animVal;\n          }\n          if (isString(className) && className !== '') {\n            while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {\n              nName = directiveNormalize(match[2]);\n              if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[3]);\n              }\n              className = className.substr(match.index + match[0].length);\n            }\n          }\n          break;\n        case NODE_TYPE_TEXT: /* Text Node */\n          if (msie === 11) {\n            // Workaround for #11781\n            while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {\n              node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;\n              node.parentNode.removeChild(node.nextSibling);\n            }\n          }\n          addTextInterpolateDirective(directives, node.nodeValue);\n          break;\n        case NODE_TYPE_COMMENT: /* Comment */\n          try {\n            match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);\n            if (match) {\n              nName = directiveNormalize(match[1]);\n              if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[2]);\n              }\n            }\n          } catch (e) {\n            // turns out that under some circumstances IE9 throws errors when one attempts to read\n            // comment's node value.\n            // Just ignore it and continue. (Can't seem to reproduce in test case.)\n          }\n          break;\n      }\n\n      directives.sort(byPriority);\n      return directives;\n    }\n\n    /**\n     * Given a node with an directive-start it collects all of the siblings until it finds\n     * directive-end.\n     * @param node\n     * @param attrStart\n     * @param attrEnd\n     * @returns {*}\n     */\n    function groupScan(node, attrStart, attrEnd) {\n      var nodes = [];\n      var depth = 0;\n      if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {\n        do {\n          if (!node) {\n            throw $compileMinErr('uterdir',\n                      \"Unterminated attribute, found '{0}' but no matching '{1}' found.\",\n                      attrStart, attrEnd);\n          }\n          if (node.nodeType == NODE_TYPE_ELEMENT) {\n            if (node.hasAttribute(attrStart)) depth++;\n            if (node.hasAttribute(attrEnd)) depth--;\n          }\n          nodes.push(node);\n          node = node.nextSibling;\n        } while (depth > 0);\n      } else {\n        nodes.push(node);\n      }\n\n      return jqLite(nodes);\n    }\n\n    /**\n     * Wrapper for linking function which converts normal linking function into a grouped\n     * linking function.\n     * @param linkFn\n     * @param attrStart\n     * @param attrEnd\n     * @returns {Function}\n     */\n    function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {\n      return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) {\n        element = groupScan(element[0], attrStart, attrEnd);\n        return linkFn(scope, element, attrs, controllers, transcludeFn);\n      };\n    }\n\n    /**\n     * A function generator that is used to support both eager and lazy compilation\n     * linking function.\n     * @param eager\n     * @param $compileNodes\n     * @param transcludeFn\n     * @param maxPriority\n     * @param ignoreDirective\n     * @param previousCompileContext\n     * @returns {Function}\n     */\n    function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {\n      var compiled;\n\n      if (eager) {\n        return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);\n      }\n      return function lazyCompilation() {\n        if (!compiled) {\n          compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);\n\n          // Null out all of these references in order to make them eligible for garbage collection\n          // since this is a potentially long lived closure\n          $compileNodes = transcludeFn = previousCompileContext = null;\n        }\n        return compiled.apply(this, arguments);\n      };\n    }\n\n    /**\n     * Once the directives have been collected, their compile functions are executed. This method\n     * is responsible for inlining directive templates as well as terminating the application\n     * of the directives if the terminal directive has been reached.\n     *\n     * @param {Array} directives Array of collected directives to execute their compile function.\n     *        this needs to be pre-sorted by priority order.\n     * @param {Node} compileNode The raw DOM node to apply the compile functions to\n     * @param {Object} templateAttrs The shared attribute function\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *                                                  scope argument is auto-generated to the new\n     *                                                  child of the transcluded parent scope.\n     * @param {JQLite} jqCollection If we are working on the root of the compile tree then this\n     *                              argument has the root jqLite array so that we can replace nodes\n     *                              on it.\n     * @param {Object=} originalReplaceDirective An optional directive that will be ignored when\n     *                                           compiling the transclusion.\n     * @param {Array.<Function>} preLinkFns\n     * @param {Array.<Function>} postLinkFns\n     * @param {Object} previousCompileContext Context used for previous compilation of the current\n     *                                        node\n     * @returns {Function} linkFn\n     */\n    function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,\n                                   jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,\n                                   previousCompileContext) {\n      previousCompileContext = previousCompileContext || {};\n\n      var terminalPriority = -Number.MAX_VALUE,\n          newScopeDirective = previousCompileContext.newScopeDirective,\n          controllerDirectives = previousCompileContext.controllerDirectives,\n          newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,\n          templateDirective = previousCompileContext.templateDirective,\n          nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,\n          hasTranscludeDirective = false,\n          hasTemplate = false,\n          hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,\n          $compileNode = templateAttrs.$$element = jqLite(compileNode),\n          directive,\n          directiveName,\n          $template,\n          replaceDirective = originalReplaceDirective,\n          childTranscludeFn = transcludeFn,\n          linkFn,\n          didScanForMultipleTransclusion = false,\n          mightHaveMultipleTransclusionError = false,\n          directiveValue;\n\n      // executes all directives on the current element\n      for (var i = 0, ii = directives.length; i < ii; i++) {\n        directive = directives[i];\n        var attrStart = directive.$$start;\n        var attrEnd = directive.$$end;\n\n        // collect multiblock sections\n        if (attrStart) {\n          $compileNode = groupScan(compileNode, attrStart, attrEnd);\n        }\n        $template = undefined;\n\n        if (terminalPriority > directive.priority) {\n          break; // prevent further processing of directives\n        }\n\n        if (directiveValue = directive.scope) {\n\n          // skip the check for directives with async templates, we'll check the derived sync\n          // directive when the template arrives\n          if (!directive.templateUrl) {\n            if (isObject(directiveValue)) {\n              // This directive is trying to add an isolated scope.\n              // Check that there is no scope of any kind already\n              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,\n                                directive, $compileNode);\n              newIsolateScopeDirective = directive;\n            } else {\n              // This directive is trying to add a child scope.\n              // Check that there is no isolated scope already\n              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,\n                                $compileNode);\n            }\n          }\n\n          newScopeDirective = newScopeDirective || directive;\n        }\n\n        directiveName = directive.name;\n\n        // If we encounter a condition that can result in transclusion on the directive,\n        // then scan ahead in the remaining directives for others that may cause a multiple\n        // transclusion error to be thrown during the compilation process.  If a matching directive\n        // is found, then we know that when we encounter a transcluded directive, we need to eagerly\n        // compile the `transclude` function rather than doing it lazily in order to throw\n        // exceptions at the correct time\n        if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))\n            || (directive.transclude && !directive.$$tlb))) {\n                var candidateDirective;\n\n                for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {\n                    if ((candidateDirective.transclude && !candidateDirective.$$tlb)\n                        || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {\n                        mightHaveMultipleTransclusionError = true;\n                        break;\n                    }\n                }\n\n                didScanForMultipleTransclusion = true;\n        }\n\n        if (!directive.templateUrl && directive.controller) {\n          directiveValue = directive.controller;\n          controllerDirectives = controllerDirectives || createMap();\n          assertNoDuplicate(\"'\" + directiveName + \"' controller\",\n              controllerDirectives[directiveName], directive, $compileNode);\n          controllerDirectives[directiveName] = directive;\n        }\n\n        if (directiveValue = directive.transclude) {\n          hasTranscludeDirective = true;\n\n          // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.\n          // This option should only be used by directives that know how to safely handle element transclusion,\n          // where the transcluded nodes are added or replaced after linking.\n          if (!directive.$$tlb) {\n            assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);\n            nonTlbTranscludeDirective = directive;\n          }\n\n          if (directiveValue == 'element') {\n            hasElementTranscludeDirective = true;\n            terminalPriority = directive.priority;\n            $template = $compileNode;\n            $compileNode = templateAttrs.$$element =\n                jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName]));\n            compileNode = $compileNode[0];\n            replaceWith(jqCollection, sliceArgs($template), compileNode);\n\n            // Support: Chrome < 50\n            // https://github.com/angular/angular.js/issues/14041\n\n            // In the versions of V8 prior to Chrome 50, the document fragment that is created\n            // in the `replaceWith` function is improperly garbage collected despite still\n            // being referenced by the `parentNode` property of all of the child nodes.  By adding\n            // a reference to the fragment via a different property, we can avoid that incorrect\n            // behavior.\n            // TODO: remove this line after Chrome 50 has been released\n            $template[0].$$parentNode = $template[0].parentNode;\n\n            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,\n                                        replaceDirective && replaceDirective.name, {\n                                          // Don't pass in:\n                                          // - controllerDirectives - otherwise we'll create duplicates controllers\n                                          // - newIsolateScopeDirective or templateDirective - combining templates with\n                                          //   element transclusion doesn't make sense.\n                                          //\n                                          // We need only nonTlbTranscludeDirective so that we prevent putting transclusion\n                                          // on the same element more than once.\n                                          nonTlbTranscludeDirective: nonTlbTranscludeDirective\n                                        });\n          } else {\n\n            var slots = createMap();\n\n            $template = jqLite(jqLiteClone(compileNode)).contents();\n\n            if (isObject(directiveValue)) {\n\n              // We have transclusion slots,\n              // collect them up, compile them and store their transclusion functions\n              $template = [];\n\n              var slotMap = createMap();\n              var filledSlots = createMap();\n\n              // Parse the element selectors\n              forEach(directiveValue, function(elementSelector, slotName) {\n                // If an element selector starts with a ? then it is optional\n                var optional = (elementSelector.charAt(0) === '?');\n                elementSelector = optional ? elementSelector.substring(1) : elementSelector;\n\n                slotMap[elementSelector] = slotName;\n\n                // We explicitly assign `null` since this implies that a slot was defined but not filled.\n                // Later when calling boundTransclusion functions with a slot name we only error if the\n                // slot is `undefined`\n                slots[slotName] = null;\n\n                // filledSlots contains `true` for all slots that are either optional or have been\n                // filled. This is used to check that we have not missed any required slots\n                filledSlots[slotName] = optional;\n              });\n\n              // Add the matching elements into their slot\n              forEach($compileNode.contents(), function(node) {\n                var slotName = slotMap[directiveNormalize(nodeName_(node))];\n                if (slotName) {\n                  filledSlots[slotName] = true;\n                  slots[slotName] = slots[slotName] || [];\n                  slots[slotName].push(node);\n                } else {\n                  $template.push(node);\n                }\n              });\n\n              // Check for required slots that were not filled\n              forEach(filledSlots, function(filled, slotName) {\n                if (!filled) {\n                  throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);\n                }\n              });\n\n              for (var slotName in slots) {\n                if (slots[slotName]) {\n                  // Only define a transclusion function if the slot was filled\n                  slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);\n                }\n              }\n            }\n\n            $compileNode.empty(); // clear contents\n            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,\n                undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});\n            childTranscludeFn.$$slots = slots;\n          }\n        }\n\n        if (directive.template) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          directiveValue = (isFunction(directive.template))\n              ? directive.template($compileNode, templateAttrs)\n              : directive.template;\n\n          directiveValue = denormalizeTemplate(directiveValue);\n\n          if (directive.replace) {\n            replaceDirective = directive;\n            if (jqLiteIsTextNode(directiveValue)) {\n              $template = [];\n            } else {\n              $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  directiveName, '');\n            }\n\n            replaceWith(jqCollection, $compileNode, compileNode);\n\n            var newTemplateAttrs = {$attr: {}};\n\n            // combine directives from the original node and from the template:\n            // - take the array of directives for this element\n            // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)\n            // - collect directives from the template and sort them by priority\n            // - combine directives as: processed + template + unprocessed\n            var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);\n            var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));\n\n            if (newIsolateScopeDirective || newScopeDirective) {\n              // The original directive caused the current element to be replaced but this element\n              // also needs to have a new scope, so we need to tell the template directives\n              // that they would need to get their scope from further up, if they require transclusion\n              markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);\n            }\n            directives = directives.concat(templateDirectives).concat(unprocessedDirectives);\n            mergeTemplateAttributes(templateAttrs, newTemplateAttrs);\n\n            ii = directives.length;\n          } else {\n            $compileNode.html(directiveValue);\n          }\n        }\n\n        if (directive.templateUrl) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          if (directive.replace) {\n            replaceDirective = directive;\n          }\n\n          nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,\n              templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {\n                controllerDirectives: controllerDirectives,\n                newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,\n                newIsolateScopeDirective: newIsolateScopeDirective,\n                templateDirective: templateDirective,\n                nonTlbTranscludeDirective: nonTlbTranscludeDirective\n              });\n          ii = directives.length;\n        } else if (directive.compile) {\n          try {\n            linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);\n            if (isFunction(linkFn)) {\n              addLinkFns(null, linkFn, attrStart, attrEnd);\n            } else if (linkFn) {\n              addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);\n            }\n          } catch (e) {\n            $exceptionHandler(e, startingTag($compileNode));\n          }\n        }\n\n        if (directive.terminal) {\n          nodeLinkFn.terminal = true;\n          terminalPriority = Math.max(terminalPriority, directive.priority);\n        }\n\n      }\n\n      nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;\n      nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;\n      nodeLinkFn.templateOnThisElement = hasTemplate;\n      nodeLinkFn.transclude = childTranscludeFn;\n\n      previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;\n\n      // might be normal or delayed nodeLinkFn depending on if templateUrl is present\n      return nodeLinkFn;\n\n      ////////////////////\n\n      function addLinkFns(pre, post, attrStart, attrEnd) {\n        if (pre) {\n          if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);\n          pre.require = directive.require;\n          pre.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            pre = cloneAndAnnotateFn(pre, {isolateScope: true});\n          }\n          preLinkFns.push(pre);\n        }\n        if (post) {\n          if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);\n          post.require = directive.require;\n          post.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            post = cloneAndAnnotateFn(post, {isolateScope: true});\n          }\n          postLinkFns.push(post);\n        }\n      }\n\n      function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {\n        var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,\n            attrs, removeScopeBindingWatches, removeControllerBindingWatches;\n\n        if (compileNode === linkNode) {\n          attrs = templateAttrs;\n          $element = templateAttrs.$$element;\n        } else {\n          $element = jqLite(linkNode);\n          attrs = new Attributes($element, templateAttrs);\n        }\n\n        controllerScope = scope;\n        if (newIsolateScopeDirective) {\n          isolateScope = scope.$new(true);\n        } else if (newScopeDirective) {\n          controllerScope = scope.$parent;\n        }\n\n        if (boundTranscludeFn) {\n          // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`\n          // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`\n          transcludeFn = controllersBoundTransclude;\n          transcludeFn.$$boundTransclude = boundTranscludeFn;\n          // expose the slots on the `$transclude` function\n          transcludeFn.isSlotFilled = function(slotName) {\n            return !!boundTranscludeFn.$$slots[slotName];\n          };\n        }\n\n        if (controllerDirectives) {\n          elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective);\n        }\n\n        if (newIsolateScopeDirective) {\n          // Initialize isolate scope bindings for new isolate scope directive.\n          compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||\n              templateDirective === newIsolateScopeDirective.$$originalDirective)));\n          compile.$$addScopeClass($element, true);\n          isolateScope.$$isolateBindings =\n              newIsolateScopeDirective.$$isolateBindings;\n          removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope,\n                                        isolateScope.$$isolateBindings,\n                                        newIsolateScopeDirective);\n          if (removeScopeBindingWatches) {\n            isolateScope.$on('$destroy', removeScopeBindingWatches);\n          }\n        }\n\n        // Initialize bindToController bindings\n        for (var name in elementControllers) {\n          var controllerDirective = controllerDirectives[name];\n          var controller = elementControllers[name];\n          var bindings = controllerDirective.$$bindings.bindToController;\n\n          if (controller.identifier && bindings) {\n            removeControllerBindingWatches =\n              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n          }\n\n          var controllerResult = controller();\n          if (controllerResult !== controller.instance) {\n            // If the controller constructor has a return value, overwrite the instance\n            // from setupControllers\n            controller.instance = controllerResult;\n            $element.data('$' + controllerDirective.name + 'Controller', controllerResult);\n            removeControllerBindingWatches && removeControllerBindingWatches();\n            removeControllerBindingWatches =\n              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n          }\n        }\n\n        // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy\n        forEach(controllerDirectives, function(controllerDirective, name) {\n          var require = controllerDirective.require;\n          if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {\n            extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));\n          }\n        });\n\n        // Handle the init and destroy lifecycle hooks on all controllers that have them\n        forEach(elementControllers, function(controller) {\n          var controllerInstance = controller.instance;\n          if (isFunction(controllerInstance.$onInit)) {\n            controllerInstance.$onInit();\n          }\n          if (isFunction(controllerInstance.$onDestroy)) {\n            controllerScope.$on('$destroy', function callOnDestroyHook() {\n              controllerInstance.$onDestroy();\n            });\n          }\n        });\n\n        // PRELINKING\n        for (i = 0, ii = preLinkFns.length; i < ii; i++) {\n          linkFn = preLinkFns[i];\n          invokeLinkFn(linkFn,\n              linkFn.isolateScope ? isolateScope : scope,\n              $element,\n              attrs,\n              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n              transcludeFn\n          );\n        }\n\n        // RECURSION\n        // We only pass the isolate scope, if the isolate directive has a template,\n        // otherwise the child elements do not belong to the isolate directive.\n        var scopeToChild = scope;\n        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {\n          scopeToChild = isolateScope;\n        }\n        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);\n\n        // POSTLINKING\n        for (i = postLinkFns.length - 1; i >= 0; i--) {\n          linkFn = postLinkFns[i];\n          invokeLinkFn(linkFn,\n              linkFn.isolateScope ? isolateScope : scope,\n              $element,\n              attrs,\n              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n              transcludeFn\n          );\n        }\n\n        // Trigger $postLink lifecycle hooks\n        forEach(elementControllers, function(controller) {\n          var controllerInstance = controller.instance;\n          if (isFunction(controllerInstance.$postLink)) {\n            controllerInstance.$postLink();\n          }\n        });\n\n        // This is the function that is injected as `$transclude`.\n        // Note: all arguments are optional!\n        function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {\n          var transcludeControllers;\n          // No scope passed in:\n          if (!isScope(scope)) {\n            slotName = futureParentElement;\n            futureParentElement = cloneAttachFn;\n            cloneAttachFn = scope;\n            scope = undefined;\n          }\n\n          if (hasElementTranscludeDirective) {\n            transcludeControllers = elementControllers;\n          }\n          if (!futureParentElement) {\n            futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;\n          }\n          if (slotName) {\n            // slotTranscludeFn can be one of three things:\n            //  * a transclude function - a filled slot\n            //  * `null` - an optional slot that was not filled\n            //  * `undefined` - a slot that was not declared (i.e. invalid)\n            var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];\n            if (slotTranscludeFn) {\n              return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);\n            } else if (isUndefined(slotTranscludeFn)) {\n              throw $compileMinErr('noslot',\n               'No parent directive that requires a transclusion with slot name \"{0}\". ' +\n               'Element: {1}',\n               slotName, startingTag($element));\n            }\n          } else {\n            return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);\n          }\n        }\n      }\n    }\n\n    function getControllers(directiveName, require, $element, elementControllers) {\n      var value;\n\n      if (isString(require)) {\n        var match = require.match(REQUIRE_PREFIX_REGEXP);\n        var name = require.substring(match[0].length);\n        var inheritType = match[1] || match[3];\n        var optional = match[2] === '?';\n\n        //If only parents then start at the parent element\n        if (inheritType === '^^') {\n          $element = $element.parent();\n        //Otherwise attempt getting the controller from elementControllers in case\n        //the element is transcluded (and has no data) and to avoid .data if possible\n        } else {\n          value = elementControllers && elementControllers[name];\n          value = value && value.instance;\n        }\n\n        if (!value) {\n          var dataName = '$' + name + 'Controller';\n          value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);\n        }\n\n        if (!value && !optional) {\n          throw $compileMinErr('ctreq',\n              \"Controller '{0}', required by directive '{1}', can't be found!\",\n              name, directiveName);\n        }\n      } else if (isArray(require)) {\n        value = [];\n        for (var i = 0, ii = require.length; i < ii; i++) {\n          value[i] = getControllers(directiveName, require[i], $element, elementControllers);\n        }\n      } else if (isObject(require)) {\n        value = {};\n        forEach(require, function(controller, property) {\n          value[property] = getControllers(directiveName, controller, $element, elementControllers);\n        });\n      }\n\n      return value || null;\n    }\n\n    function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {\n      var elementControllers = createMap();\n      for (var controllerKey in controllerDirectives) {\n        var directive = controllerDirectives[controllerKey];\n        var locals = {\n          $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,\n          $element: $element,\n          $attrs: attrs,\n          $transclude: transcludeFn\n        };\n\n        var controller = directive.controller;\n        if (controller == '@') {\n          controller = attrs[directive.name];\n        }\n\n        var controllerInstance = $controller(controller, locals, true, directive.controllerAs);\n\n        // For directives with element transclusion the element is a comment.\n        // In this case .data will not attach any data.\n        // Instead, we save the controllers for the element in a local hash and attach to .data\n        // later, once we have the actual element.\n        elementControllers[directive.name] = controllerInstance;\n        $element.data('$' + directive.name + 'Controller', controllerInstance.instance);\n      }\n      return elementControllers;\n    }\n\n    // Depending upon the context in which a directive finds itself it might need to have a new isolated\n    // or child scope created. For instance:\n    // * if the directive has been pulled into a template because another directive with a higher priority\n    // asked for element transclusion\n    // * if the directive itself asks for transclusion but it is at the root of a template and the original\n    // element was replaced. See https://github.com/angular/angular.js/issues/12936\n    function markDirectiveScope(directives, isolateScope, newScope) {\n      for (var j = 0, jj = directives.length; j < jj; j++) {\n        directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});\n      }\n    }\n\n    /**\n     * looks up the directive and decorates it with exception handling and proper parameters. We\n     * call this the boundDirective.\n     *\n     * @param {string} name name of the directive to look up.\n     * @param {string} location The directive must be found in specific format.\n     *   String containing any of theses characters:\n     *\n     *   * `E`: element name\n     *   * `A': attribute\n     *   * `C`: class\n     *   * `M`: comment\n     * @returns {boolean} true if directive was added.\n     */\n    function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,\n                          endAttrName) {\n      if (name === ignoreDirective) return null;\n      var match = null;\n      if (hasDirectives.hasOwnProperty(name)) {\n        for (var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i < ii; i++) {\n          try {\n            directive = directives[i];\n            if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&\n                 directive.restrict.indexOf(location) != -1) {\n              if (startAttrName) {\n                directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});\n              }\n              if (!directive.$$bindings) {\n                var bindings = directive.$$bindings =\n                    parseDirectiveBindings(directive, directive.name);\n                if (isObject(bindings.isolateScope)) {\n                  directive.$$isolateBindings = bindings.isolateScope;\n                }\n              }\n              tDirectives.push(directive);\n              match = directive;\n            }\n          } catch (e) { $exceptionHandler(e); }\n        }\n      }\n      return match;\n    }\n\n\n    /**\n     * looks up the directive and returns true if it is a multi-element directive,\n     * and therefore requires DOM nodes between -start and -end markers to be grouped\n     * together.\n     *\n     * @param {string} name name of the directive to look up.\n     * @returns true if directive was registered as multi-element.\n     */\n    function directiveIsMultiElement(name) {\n      if (hasDirectives.hasOwnProperty(name)) {\n        for (var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i < ii; i++) {\n          directive = directives[i];\n          if (directive.multiElement) {\n            return true;\n          }\n        }\n      }\n      return false;\n    }\n\n    /**\n     * When the element is replaced with HTML template then the new attributes\n     * on the template need to be merged with the existing attributes in the DOM.\n     * The desired effect is to have both of the attributes present.\n     *\n     * @param {object} dst destination attributes (original DOM)\n     * @param {object} src source attributes (from the directive template)\n     */\n    function mergeTemplateAttributes(dst, src) {\n      var srcAttr = src.$attr,\n          dstAttr = dst.$attr,\n          $element = dst.$$element;\n\n      // reapply the old attributes to the new element\n      forEach(dst, function(value, key) {\n        if (key.charAt(0) != '$') {\n          if (src[key] && src[key] !== value) {\n            value += (key === 'style' ? ';' : ' ') + src[key];\n          }\n          dst.$set(key, value, true, srcAttr[key]);\n        }\n      });\n\n      // copy the new attributes on the old attrs object\n      forEach(src, function(value, key) {\n        if (key == 'class') {\n          safeAddClass($element, value);\n          dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;\n        } else if (key == 'style') {\n          $element.attr('style', $element.attr('style') + ';' + value);\n          dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;\n          // `dst` will never contain hasOwnProperty as DOM parser won't let it.\n          // You will get an \"InvalidCharacterError: DOM Exception 5\" error if you\n          // have an attribute like \"has-own-property\" or \"data-has-own-property\", etc.\n        } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {\n          dst[key] = value;\n          dstAttr[key] = srcAttr[key];\n        }\n      });\n    }\n\n\n    function compileTemplateUrl(directives, $compileNode, tAttrs,\n        $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {\n      var linkQueue = [],\n          afterTemplateNodeLinkFn,\n          afterTemplateChildLinkFn,\n          beforeTemplateCompileNode = $compileNode[0],\n          origAsyncDirective = directives.shift(),\n          derivedSyncDirective = inherit(origAsyncDirective, {\n            templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective\n          }),\n          templateUrl = (isFunction(origAsyncDirective.templateUrl))\n              ? origAsyncDirective.templateUrl($compileNode, tAttrs)\n              : origAsyncDirective.templateUrl,\n          templateNamespace = origAsyncDirective.templateNamespace;\n\n      $compileNode.empty();\n\n      $templateRequest(templateUrl)\n        .then(function(content) {\n          var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;\n\n          content = denormalizeTemplate(content);\n\n          if (origAsyncDirective.replace) {\n            if (jqLiteIsTextNode(content)) {\n              $template = [];\n            } else {\n              $template = removeComments(wrapTemplate(templateNamespace, trim(content)));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  origAsyncDirective.name, templateUrl);\n            }\n\n            tempTemplateAttrs = {$attr: {}};\n            replaceWith($rootElement, $compileNode, compileNode);\n            var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);\n\n            if (isObject(origAsyncDirective.scope)) {\n              // the original directive that caused the template to be loaded async required\n              // an isolate scope\n              markDirectiveScope(templateDirectives, true);\n            }\n            directives = templateDirectives.concat(directives);\n            mergeTemplateAttributes(tAttrs, tempTemplateAttrs);\n          } else {\n            compileNode = beforeTemplateCompileNode;\n            $compileNode.html(content);\n          }\n\n          directives.unshift(derivedSyncDirective);\n\n          afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,\n              childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,\n              previousCompileContext);\n          forEach($rootElement, function(node, i) {\n            if (node == compileNode) {\n              $rootElement[i] = $compileNode[0];\n            }\n          });\n          afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);\n\n          while (linkQueue.length) {\n            var scope = linkQueue.shift(),\n                beforeTemplateLinkNode = linkQueue.shift(),\n                linkRootElement = linkQueue.shift(),\n                boundTranscludeFn = linkQueue.shift(),\n                linkNode = $compileNode[0];\n\n            if (scope.$$destroyed) continue;\n\n            if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {\n              var oldClasses = beforeTemplateLinkNode.className;\n\n              if (!(previousCompileContext.hasElementTranscludeDirective &&\n                  origAsyncDirective.replace)) {\n                // it was cloned therefore we have to clone as well.\n                linkNode = jqLiteClone(compileNode);\n              }\n              replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);\n\n              // Copy in CSS classes from original node\n              safeAddClass(jqLite(linkNode), oldClasses);\n            }\n            if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n            } else {\n              childBoundTranscludeFn = boundTranscludeFn;\n            }\n            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,\n              childBoundTranscludeFn);\n          }\n          linkQueue = null;\n        });\n\n      return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {\n        var childBoundTranscludeFn = boundTranscludeFn;\n        if (scope.$$destroyed) return;\n        if (linkQueue) {\n          linkQueue.push(scope,\n                         node,\n                         rootElement,\n                         childBoundTranscludeFn);\n        } else {\n          if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n            childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n          }\n          afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);\n        }\n      };\n    }\n\n\n    /**\n     * Sorting function for bound directives.\n     */\n    function byPriority(a, b) {\n      var diff = b.priority - a.priority;\n      if (diff !== 0) return diff;\n      if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;\n      return a.index - b.index;\n    }\n\n    function assertNoDuplicate(what, previousDirective, directive, element) {\n\n      function wrapModuleNameIfDefined(moduleName) {\n        return moduleName ?\n          (' (module: ' + moduleName + ')') :\n          '';\n      }\n\n      if (previousDirective) {\n        throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',\n            previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),\n            directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));\n      }\n    }\n\n\n    function addTextInterpolateDirective(directives, text) {\n      var interpolateFn = $interpolate(text, true);\n      if (interpolateFn) {\n        directives.push({\n          priority: 0,\n          compile: function textInterpolateCompileFn(templateNode) {\n            var templateNodeParent = templateNode.parent(),\n                hasCompileParent = !!templateNodeParent.length;\n\n            // When transcluding a template that has bindings in the root\n            // we don't have a parent and thus need to add the class during linking fn.\n            if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);\n\n            return function textInterpolateLinkFn(scope, node) {\n              var parent = node.parent();\n              if (!hasCompileParent) compile.$$addBindingClass(parent);\n              compile.$$addBindingInfo(parent, interpolateFn.expressions);\n              scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {\n                node[0].nodeValue = value;\n              });\n            };\n          }\n        });\n      }\n    }\n\n\n    function wrapTemplate(type, template) {\n      type = lowercase(type || 'html');\n      switch (type) {\n      case 'svg':\n      case 'math':\n        var wrapper = document.createElement('div');\n        wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';\n        return wrapper.childNodes[0].childNodes;\n      default:\n        return template;\n      }\n    }\n\n\n    function getTrustedContext(node, attrNormalizedName) {\n      if (attrNormalizedName == \"srcdoc\") {\n        return $sce.HTML;\n      }\n      var tag = nodeName_(node);\n      // maction[xlink:href] can source SVG.  It's not limited to <maction>.\n      if (attrNormalizedName == \"xlinkHref\" ||\n          (tag == \"form\" && attrNormalizedName == \"action\") ||\n          (tag != \"img\" && (attrNormalizedName == \"src\" ||\n                            attrNormalizedName == \"ngSrc\"))) {\n        return $sce.RESOURCE_URL;\n      }\n    }\n\n\n    function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {\n      var trustedContext = getTrustedContext(node, name);\n      allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;\n\n      var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);\n\n      // no interpolation found -> ignore\n      if (!interpolateFn) return;\n\n\n      if (name === \"multiple\" && nodeName_(node) === \"select\") {\n        throw $compileMinErr(\"selmulti\",\n            \"Binding to the 'multiple' attribute is not supported. Element: {0}\",\n            startingTag(node));\n      }\n\n      directives.push({\n        priority: 100,\n        compile: function() {\n            return {\n              pre: function attrInterpolatePreLinkFn(scope, element, attr) {\n                var $$observers = (attr.$$observers || (attr.$$observers = createMap()));\n\n                if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {\n                  throw $compileMinErr('nodomevents',\n                      \"Interpolations for HTML DOM event attributes are disallowed.  Please use the \" +\n                          \"ng- versions (such as ng-click instead of onclick) instead.\");\n                }\n\n                // If the attribute has changed since last $interpolate()ed\n                var newValue = attr[name];\n                if (newValue !== value) {\n                  // we need to interpolate again since the attribute value has been updated\n                  // (e.g. by another directive's compile function)\n                  // ensure unset/empty values make interpolateFn falsy\n                  interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);\n                  value = newValue;\n                }\n\n                // if attribute was updated so that there is no interpolation going on we don't want to\n                // register any observers\n                if (!interpolateFn) return;\n\n                // initialize attr object so that it's ready in case we need the value for isolate\n                // scope initialization, otherwise the value would not be available from isolate\n                // directive's linking fn during linking phase\n                attr[name] = interpolateFn(scope);\n\n                ($$observers[name] || ($$observers[name] = [])).$$inter = true;\n                (attr.$$observers && attr.$$observers[name].$$scope || scope).\n                  $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {\n                    //special case for class attribute addition + removal\n                    //so that class changes can tap into the animation\n                    //hooks provided by the $animate service. Be sure to\n                    //skip animations when the first digest occurs (when\n                    //both the new and the old values are the same) since\n                    //the CSS classes are the non-interpolated values\n                    if (name === 'class' && newValue != oldValue) {\n                      attr.$updateClass(newValue, oldValue);\n                    } else {\n                      attr.$set(name, newValue);\n                    }\n                  });\n              }\n            };\n          }\n      });\n    }\n\n\n    /**\n     * This is a special jqLite.replaceWith, which can replace items which\n     * have no parents, provided that the containing jqLite collection is provided.\n     *\n     * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes\n     *                               in the root of the tree.\n     * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep\n     *                                  the shell, but replace its DOM node reference.\n     * @param {Node} newNode The new DOM node.\n     */\n    function replaceWith($rootElement, elementsToRemove, newNode) {\n      var firstElementToRemove = elementsToRemove[0],\n          removeCount = elementsToRemove.length,\n          parent = firstElementToRemove.parentNode,\n          i, ii;\n\n      if ($rootElement) {\n        for (i = 0, ii = $rootElement.length; i < ii; i++) {\n          if ($rootElement[i] == firstElementToRemove) {\n            $rootElement[i++] = newNode;\n            for (var j = i, j2 = j + removeCount - 1,\n                     jj = $rootElement.length;\n                 j < jj; j++, j2++) {\n              if (j2 < jj) {\n                $rootElement[j] = $rootElement[j2];\n              } else {\n                delete $rootElement[j];\n              }\n            }\n            $rootElement.length -= removeCount - 1;\n\n            // If the replaced element is also the jQuery .context then replace it\n            // .context is a deprecated jQuery api, so we should set it only when jQuery set it\n            // http://api.jquery.com/context/\n            if ($rootElement.context === firstElementToRemove) {\n              $rootElement.context = newNode;\n            }\n            break;\n          }\n        }\n      }\n\n      if (parent) {\n        parent.replaceChild(newNode, firstElementToRemove);\n      }\n\n      // Append all the `elementsToRemove` to a fragment. This will...\n      // - remove them from the DOM\n      // - allow them to still be traversed with .nextSibling\n      // - allow a single fragment.qSA to fetch all elements being removed\n      var fragment = document.createDocumentFragment();\n      for (i = 0; i < removeCount; i++) {\n        fragment.appendChild(elementsToRemove[i]);\n      }\n\n      if (jqLite.hasData(firstElementToRemove)) {\n        // Copy over user data (that includes Angular's $scope etc.). Don't copy private\n        // data here because there's no public interface in jQuery to do that and copying over\n        // event listeners (which is the main use of private data) wouldn't work anyway.\n        jqLite.data(newNode, jqLite.data(firstElementToRemove));\n\n        // Remove $destroy event listeners from `firstElementToRemove`\n        jqLite(firstElementToRemove).off('$destroy');\n      }\n\n      // Cleanup any data/listeners on the elements and children.\n      // This includes invoking the $destroy event on any elements with listeners.\n      jqLite.cleanData(fragment.querySelectorAll('*'));\n\n      // Update the jqLite collection to only contain the `newNode`\n      for (i = 1; i < removeCount; i++) {\n        delete elementsToRemove[i];\n      }\n      elementsToRemove[0] = newNode;\n      elementsToRemove.length = 1;\n    }\n\n\n    function cloneAndAnnotateFn(fn, annotation) {\n      return extend(function() { return fn.apply(null, arguments); }, fn, annotation);\n    }\n\n\n    function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {\n      try {\n        linkFn(scope, $element, attrs, controllers, transcludeFn);\n      } catch (e) {\n        $exceptionHandler(e, startingTag($element));\n      }\n    }\n\n\n    // Set up $watches for isolate scope and controller bindings. This process\n    // only occurs for isolate scopes and new scopes with controllerAs.\n    function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {\n      var removeWatchCollection = [];\n      var changes;\n      forEach(bindings, function initializeBinding(definition, scopeName) {\n        var attrName = definition.attrName,\n        optional = definition.optional,\n        mode = definition.mode, // @, =, or &\n        lastValue,\n        parentGet, parentSet, compare, removeWatch;\n\n        switch (mode) {\n\n          case '@':\n            if (!optional && !hasOwnProperty.call(attrs, attrName)) {\n              destination[scopeName] = attrs[attrName] = void 0;\n            }\n            attrs.$observe(attrName, function(value) {\n              if (isString(value)) {\n                var oldValue = destination[scopeName];\n                recordChanges(scopeName, value, oldValue);\n                destination[scopeName] = value;\n              }\n            });\n            attrs.$$observers[attrName].$$scope = scope;\n            lastValue = attrs[attrName];\n            if (isString(lastValue)) {\n              // If the attribute has been provided then we trigger an interpolation to ensure\n              // the value is there for use in the link fn\n              destination[scopeName] = $interpolate(lastValue)(scope);\n            } else if (isBoolean(lastValue)) {\n              // If the attributes is one of the BOOLEAN_ATTR then Angular will have converted\n              // the value to boolean rather than a string, so we special case this situation\n              destination[scopeName] = lastValue;\n            }\n            break;\n\n          case '=':\n            if (!hasOwnProperty.call(attrs, attrName)) {\n              if (optional) break;\n              attrs[attrName] = void 0;\n            }\n            if (optional && !attrs[attrName]) break;\n\n            parentGet = $parse(attrs[attrName]);\n            if (parentGet.literal) {\n              compare = equals;\n            } else {\n              compare = function simpleCompare(a, b) { return a === b || (a !== a && b !== b); };\n            }\n            parentSet = parentGet.assign || function() {\n              // reset the change, or we will throw this exception on every $digest\n              lastValue = destination[scopeName] = parentGet(scope);\n              throw $compileMinErr('nonassign',\n                  \"Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!\",\n                  attrs[attrName], attrName, directive.name);\n            };\n            lastValue = destination[scopeName] = parentGet(scope);\n            var parentValueWatch = function parentValueWatch(parentValue) {\n              if (!compare(parentValue, destination[scopeName])) {\n                // we are out of sync and need to copy\n                if (!compare(parentValue, lastValue)) {\n                  // parent changed and it has precedence\n                  destination[scopeName] = parentValue;\n                } else {\n                  // if the parent can be assigned then do so\n                  parentSet(scope, parentValue = destination[scopeName]);\n                }\n              }\n              return lastValue = parentValue;\n            };\n            parentValueWatch.$stateful = true;\n            if (definition.collection) {\n              removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);\n            } else {\n              removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);\n            }\n            removeWatchCollection.push(removeWatch);\n            break;\n\n          case '<':\n            if (!hasOwnProperty.call(attrs, attrName)) {\n              if (optional) break;\n              attrs[attrName] = void 0;\n            }\n            if (optional && !attrs[attrName]) break;\n\n            parentGet = $parse(attrs[attrName]);\n\n            destination[scopeName] = parentGet(scope);\n\n            removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newParentValue) {\n              var oldValue = destination[scopeName];\n              recordChanges(scopeName, newParentValue, oldValue);\n              destination[scopeName] = newParentValue;\n            }, parentGet.literal);\n\n            removeWatchCollection.push(removeWatch);\n            break;\n\n          case '&':\n            // Don't assign Object.prototype method to scope\n            parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;\n\n            // Don't assign noop to destination if expression is not valid\n            if (parentGet === noop && optional) break;\n\n            destination[scopeName] = function(locals) {\n              return parentGet(scope, locals);\n            };\n            break;\n        }\n      });\n\n      function recordChanges(key, currentValue, previousValue) {\n        if (isFunction(destination.$onChanges) && currentValue !== previousValue) {\n          // If we have not already scheduled the top level onChangesQueue handler then do so now\n          if (!onChangesQueue) {\n            scope.$$postDigest(flushOnChangesQueue);\n            onChangesQueue = [];\n          }\n          // If we have not already queued a trigger of onChanges for this controller then do so now\n          if (!changes) {\n            changes = {};\n            onChangesQueue.push(triggerOnChangesHook);\n          }\n          // If the has been a change on this property already then we need to reuse the previous value\n          if (changes[key]) {\n            previousValue = changes[key].previousValue;\n          }\n          // Store this change\n          changes[key] = {previousValue: previousValue, currentValue: currentValue};\n        }\n      }\n\n      function triggerOnChangesHook() {\n        destination.$onChanges(changes);\n        // Now clear the changes so that we schedule onChanges when more changes arrive\n        changes = undefined;\n      }\n\n      return removeWatchCollection.length && function removeWatches() {\n        for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {\n          removeWatchCollection[i]();\n        }\n      };\n    }\n  }];\n}\n\nvar PREFIX_REGEXP = /^((?:x|data)[\\:\\-_])/i;\n/**\n * Converts all accepted directives format into proper directive name.\n * @param name Name to normalize\n */\nfunction directiveNormalize(name) {\n  return camelCase(name.replace(PREFIX_REGEXP, ''));\n}\n\n/**\n * @ngdoc type\n * @name $compile.directive.Attributes\n *\n * @description\n * A shared object between directive compile / linking functions which contains normalized DOM\n * element attributes. The values reflect current binding state `{{ }}`. The normalization is\n * needed since all of these are treated as equivalent in Angular:\n *\n * ```\n *    <span ng:bind=\"a\" ng-bind=\"a\" data-ng-bind=\"a\" x-ng-bind=\"a\">\n * ```\n */\n\n/**\n * @ngdoc property\n * @name $compile.directive.Attributes#$attr\n *\n * @description\n * A map of DOM element attribute names to the normalized name. This is\n * needed to do reverse lookup from normalized name back to actual name.\n */\n\n\n/**\n * @ngdoc method\n * @name $compile.directive.Attributes#$set\n * @kind function\n *\n * @description\n * Set DOM element attribute value.\n *\n *\n * @param {string} name Normalized element attribute name of the property to modify. The name is\n *          reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}\n *          property to the original name.\n * @param {string} value Value to set the attribute to. The value can be an interpolated string.\n */\n\n\n\n/**\n * Closure compiler type information\n */\n\nfunction nodesetLinkingFn(\n  /* angular.Scope */ scope,\n  /* NodeList */ nodeList,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction directiveLinkingFn(\n  /* nodesetLinkingFn */ nodesetLinkingFn,\n  /* angular.Scope */ scope,\n  /* Node */ node,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction tokenDifference(str1, str2) {\n  var values = '',\n      tokens1 = str1.split(/\\s+/),\n      tokens2 = str2.split(/\\s+/);\n\n  outer:\n  for (var i = 0; i < tokens1.length; i++) {\n    var token = tokens1[i];\n    for (var j = 0; j < tokens2.length; j++) {\n      if (token == tokens2[j]) continue outer;\n    }\n    values += (values.length > 0 ? ' ' : '') + token;\n  }\n  return values;\n}\n\nfunction removeComments(jqNodes) {\n  jqNodes = jqLite(jqNodes);\n  var i = jqNodes.length;\n\n  if (i <= 1) {\n    return jqNodes;\n  }\n\n  while (i--) {\n    var node = jqNodes[i];\n    if (node.nodeType === NODE_TYPE_COMMENT) {\n      splice.call(jqNodes, i, 1);\n    }\n  }\n  return jqNodes;\n}\n\nvar $controllerMinErr = minErr('$controller');\n\n\nvar CNTRL_REG = /^(\\S+)(\\s+as\\s+([\\w$]+))?$/;\nfunction identifierForController(controller, ident) {\n  if (ident && isString(ident)) return ident;\n  if (isString(controller)) {\n    var match = CNTRL_REG.exec(controller);\n    if (match) return match[3];\n  }\n}\n\n\n/**\n * @ngdoc provider\n * @name $controllerProvider\n * @description\n * The {@link ng.$controller $controller service} is used by Angular to create new\n * controllers.\n *\n * This provider allows controller registration via the\n * {@link ng.$controllerProvider#register register} method.\n */\nfunction $ControllerProvider() {\n  var controllers = {},\n      globals = false;\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#has\n   * @param {string} name Controller name to check.\n   */\n  this.has = function(name) {\n    return controllers.hasOwnProperty(name);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#register\n   * @param {string|Object} name Controller name, or an object map of controllers where the keys are\n   *    the names and the values are the constructors.\n   * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI\n   *    annotations in the array notation).\n   */\n  this.register = function(name, constructor) {\n    assertNotHasOwnProperty(name, 'controller');\n    if (isObject(name)) {\n      extend(controllers, name);\n    } else {\n      controllers[name] = constructor;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#allowGlobals\n   * @description If called, allows `$controller` to find controller constructors on `window`\n   */\n  this.allowGlobals = function() {\n    globals = true;\n  };\n\n\n  this.$get = ['$injector', '$window', function($injector, $window) {\n\n    /**\n     * @ngdoc service\n     * @name $controller\n     * @requires $injector\n     *\n     * @param {Function|string} constructor If called with a function then it's considered to be the\n     *    controller constructor function. Otherwise it's considered to be a string which is used\n     *    to retrieve the controller constructor using the following steps:\n     *\n     *    * check if a controller with given name is registered via `$controllerProvider`\n     *    * check if evaluating the string on the current scope returns a constructor\n     *    * if $controllerProvider#allowGlobals, check `window[constructor]` on the global\n     *      `window` object (not recommended)\n     *\n     *    The string can use the `controller as property` syntax, where the controller instance is published\n     *    as the specified property on the `scope`; the `scope` must be injected into `locals` param for this\n     *    to work correctly.\n     *\n     * @param {Object} locals Injection locals for Controller.\n     * @return {Object} Instance of given controller.\n     *\n     * @description\n     * `$controller` service is responsible for instantiating controllers.\n     *\n     * It's just a simple call to {@link auto.$injector $injector}, but extracted into\n     * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).\n     */\n    return function $controller(expression, locals, later, ident) {\n      // PRIVATE API:\n      //   param `later` --- indicates that the controller's constructor is invoked at a later time.\n      //                     If true, $controller will allocate the object with the correct\n      //                     prototype chain, but will not invoke the controller until a returned\n      //                     callback is invoked.\n      //   param `ident` --- An optional label which overrides the label parsed from the controller\n      //                     expression, if any.\n      var instance, match, constructor, identifier;\n      later = later === true;\n      if (ident && isString(ident)) {\n        identifier = ident;\n      }\n\n      if (isString(expression)) {\n        match = expression.match(CNTRL_REG);\n        if (!match) {\n          throw $controllerMinErr('ctrlfmt',\n            \"Badly formed controller string '{0}'. \" +\n            \"Must match `__name__ as __id__` or `__name__`.\", expression);\n        }\n        constructor = match[1],\n        identifier = identifier || match[3];\n        expression = controllers.hasOwnProperty(constructor)\n            ? controllers[constructor]\n            : getter(locals.$scope, constructor, true) ||\n                (globals ? getter($window, constructor, true) : undefined);\n\n        assertArgFn(expression, constructor, true);\n      }\n\n      if (later) {\n        // Instantiate controller later:\n        // This machinery is used to create an instance of the object before calling the\n        // controller's constructor itself.\n        //\n        // This allows properties to be added to the controller before the constructor is\n        // invoked. Primarily, this is used for isolate scope bindings in $compile.\n        //\n        // This feature is not intended for use by applications, and is thus not documented\n        // publicly.\n        // Object creation: http://jsperf.com/create-constructor/2\n        var controllerPrototype = (isArray(expression) ?\n          expression[expression.length - 1] : expression).prototype;\n        instance = Object.create(controllerPrototype || null);\n\n        if (identifier) {\n          addIdentifier(locals, identifier, instance, constructor || expression.name);\n        }\n\n        var instantiate;\n        return instantiate = extend(function $controllerInit() {\n          var result = $injector.invoke(expression, instance, locals, constructor);\n          if (result !== instance && (isObject(result) || isFunction(result))) {\n            instance = result;\n            if (identifier) {\n              // If result changed, re-assign controllerAs value to scope.\n              addIdentifier(locals, identifier, instance, constructor || expression.name);\n            }\n          }\n          return instance;\n        }, {\n          instance: instance,\n          identifier: identifier\n        });\n      }\n\n      instance = $injector.instantiate(expression, locals, constructor);\n\n      if (identifier) {\n        addIdentifier(locals, identifier, instance, constructor || expression.name);\n      }\n\n      return instance;\n    };\n\n    function addIdentifier(locals, identifier, instance, name) {\n      if (!(locals && isObject(locals.$scope))) {\n        throw minErr('$controller')('noscp',\n          \"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.\",\n          name, identifier);\n      }\n\n      locals.$scope[identifier] = instance;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $document\n * @requires $window\n *\n * @description\n * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.\n *\n * @example\n   <example module=\"documentExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <p>$document title: <b ng-bind=\"title\"></b></p>\n         <p>window.document title: <b ng-bind=\"windowTitle\"></b></p>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('documentExample', [])\n         .controller('ExampleController', ['$scope', '$document', function($scope, $document) {\n           $scope.title = $document[0].title;\n           $scope.windowTitle = angular.element(window.document)[0].title;\n         }]);\n     </file>\n   </example>\n */\nfunction $DocumentProvider() {\n  this.$get = ['$window', function(window) {\n    return jqLite(window.document);\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $exceptionHandler\n * @requires ng.$log\n *\n * @description\n * Any uncaught exception in angular expressions is delegated to this service.\n * The default implementation simply delegates to `$log.error` which logs it into\n * the browser console.\n *\n * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by\n * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.\n *\n * ## Example:\n *\n * ```js\n *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {\n *     return function(exception, cause) {\n *       exception.message += ' (caused by \"' + cause + '\")';\n *       throw exception;\n *     };\n *   });\n * ```\n *\n * This example will override the normal action of `$exceptionHandler`, to make angular\n * exceptions fail hard when they happen, instead of just logging to the console.\n *\n * <hr />\n * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`\n * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}\n * (unless executed during a digest).\n *\n * If you wish, you can manually delegate exceptions, e.g.\n * `try { ... } catch(e) { $exceptionHandler(e); }`\n *\n * @param {Error} exception Exception associated with the error.\n * @param {string=} cause optional information about the context in which\n *       the error was thrown.\n *\n */\nfunction $ExceptionHandlerProvider() {\n  this.$get = ['$log', function($log) {\n    return function(exception, cause) {\n      $log.error.apply($log, arguments);\n    };\n  }];\n}\n\nvar $$ForceReflowProvider = function() {\n  this.$get = ['$document', function($document) {\n    return function(domNode) {\n      //the line below will force the browser to perform a repaint so\n      //that all the animated elements within the animation frame will\n      //be properly updated and drawn on screen. This is required to\n      //ensure that the preparation animation is properly flushed so that\n      //the active state picks up from there. DO NOT REMOVE THIS LINE.\n      //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH\n      //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND\n      //WILL TAKE YEARS AWAY FROM YOUR LIFE.\n      if (domNode) {\n        if (!domNode.nodeType && domNode instanceof jqLite) {\n          domNode = domNode[0];\n        }\n      } else {\n        domNode = $document[0].body;\n      }\n      return domNode.offsetWidth + 1;\n    };\n  }];\n};\n\nvar APPLICATION_JSON = 'application/json';\nvar CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};\nvar JSON_START = /^\\[|^\\{(?!\\{)/;\nvar JSON_ENDS = {\n  '[': /]$/,\n  '{': /}$/\n};\nvar JSON_PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar $httpMinErr = minErr('$http');\nvar $httpMinErrLegacyFn = function(method) {\n  return function() {\n    throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);\n  };\n};\n\nfunction serializeValue(v) {\n  if (isObject(v)) {\n    return isDate(v) ? v.toISOString() : toJson(v);\n  }\n  return v;\n}\n\n\nfunction $HttpParamSerializerProvider() {\n  /**\n   * @ngdoc service\n   * @name $httpParamSerializer\n   * @description\n   *\n   * Default {@link $http `$http`} params serializer that converts objects to strings\n   * according to the following rules:\n   *\n   * * `{'foo': 'bar'}` results in `foo=bar`\n   * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)\n   * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)\n   * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D\"` (stringified and encoded representation of an object)\n   *\n   * Note that serializer will sort the request parameters alphabetically.\n   * */\n\n  this.$get = function() {\n    return function ngParamSerializer(params) {\n      if (!params) return '';\n      var parts = [];\n      forEachSorted(params, function(value, key) {\n        if (value === null || isUndefined(value)) return;\n        if (isArray(value)) {\n          forEach(value, function(v) {\n            parts.push(encodeUriQuery(key)  + '=' + encodeUriQuery(serializeValue(v)));\n          });\n        } else {\n          parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));\n        }\n      });\n\n      return parts.join('&');\n    };\n  };\n}\n\nfunction $HttpParamSerializerJQLikeProvider() {\n  /**\n   * @ngdoc service\n   * @name $httpParamSerializerJQLike\n   * @description\n   *\n   * Alternative {@link $http `$http`} params serializer that follows\n   * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.\n   * The serializer will also sort the params alphabetically.\n   *\n   * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:\n   *\n   * ```js\n   * $http({\n   *   url: myUrl,\n   *   method: 'GET',\n   *   params: myParams,\n   *   paramSerializer: '$httpParamSerializerJQLike'\n   * });\n   * ```\n   *\n   * It is also possible to set it as the default `paramSerializer` in the\n   * {@link $httpProvider#defaults `$httpProvider`}.\n   *\n   * Additionally, you can inject the serializer and use it explicitly, for example to serialize\n   * form data for submission:\n   *\n   * ```js\n   * .controller(function($http, $httpParamSerializerJQLike) {\n   *   //...\n   *\n   *   $http({\n   *     url: myUrl,\n   *     method: 'POST',\n   *     data: $httpParamSerializerJQLike(myData),\n   *     headers: {\n   *       'Content-Type': 'application/x-www-form-urlencoded'\n   *     }\n   *   });\n   *\n   * });\n   * ```\n   *\n   * */\n  this.$get = function() {\n    return function jQueryLikeParamSerializer(params) {\n      if (!params) return '';\n      var parts = [];\n      serialize(params, '', true);\n      return parts.join('&');\n\n      function serialize(toSerialize, prefix, topLevel) {\n        if (toSerialize === null || isUndefined(toSerialize)) return;\n        if (isArray(toSerialize)) {\n          forEach(toSerialize, function(value, index) {\n            serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');\n          });\n        } else if (isObject(toSerialize) && !isDate(toSerialize)) {\n          forEachSorted(toSerialize, function(value, key) {\n            serialize(value, prefix +\n                (topLevel ? '' : '[') +\n                key +\n                (topLevel ? '' : ']'));\n          });\n        } else {\n          parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));\n        }\n      }\n    };\n  };\n}\n\nfunction defaultHttpResponseTransform(data, headers) {\n  if (isString(data)) {\n    // Strip json vulnerability protection prefix and trim whitespace\n    var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();\n\n    if (tempData) {\n      var contentType = headers('Content-Type');\n      if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {\n        data = fromJson(tempData);\n      }\n    }\n  }\n\n  return data;\n}\n\nfunction isJsonLike(str) {\n    var jsonStart = str.match(JSON_START);\n    return jsonStart && JSON_ENDS[jsonStart[0]].test(str);\n}\n\n/**\n * Parse headers into key value object\n *\n * @param {string} headers Raw headers as a string\n * @returns {Object} Parsed headers as key value object\n */\nfunction parseHeaders(headers) {\n  var parsed = createMap(), i;\n\n  function fillInParsed(key, val) {\n    if (key) {\n      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n    }\n  }\n\n  if (isString(headers)) {\n    forEach(headers.split('\\n'), function(line) {\n      i = line.indexOf(':');\n      fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));\n    });\n  } else if (isObject(headers)) {\n    forEach(headers, function(headerVal, headerKey) {\n      fillInParsed(lowercase(headerKey), trim(headerVal));\n    });\n  }\n\n  return parsed;\n}\n\n\n/**\n * Returns a function that provides access to parsed headers.\n *\n * Headers are lazy parsed when first requested.\n * @see parseHeaders\n *\n * @param {(string|Object)} headers Headers to provide access to.\n * @returns {function(string=)} Returns a getter function which if called with:\n *\n *   - if called with single an argument returns a single header value or null\n *   - if called with no arguments returns an object containing all headers.\n */\nfunction headersGetter(headers) {\n  var headersObj;\n\n  return function(name) {\n    if (!headersObj) headersObj =  parseHeaders(headers);\n\n    if (name) {\n      var value = headersObj[lowercase(name)];\n      if (value === void 0) {\n        value = null;\n      }\n      return value;\n    }\n\n    return headersObj;\n  };\n}\n\n\n/**\n * Chain all given functions\n *\n * This function is used for both request and response transforming\n *\n * @param {*} data Data to transform.\n * @param {function(string=)} headers HTTP headers getter fn.\n * @param {number} status HTTP status code of the response.\n * @param {(Function|Array.<Function>)} fns Function or an array of functions.\n * @returns {*} Transformed data.\n */\nfunction transformData(data, headers, status, fns) {\n  if (isFunction(fns)) {\n    return fns(data, headers, status);\n  }\n\n  forEach(fns, function(fn) {\n    data = fn(data, headers, status);\n  });\n\n  return data;\n}\n\n\nfunction isSuccess(status) {\n  return 200 <= status && status < 300;\n}\n\n\n/**\n * @ngdoc provider\n * @name $httpProvider\n * @description\n * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.\n * */\nfunction $HttpProvider() {\n  /**\n   * @ngdoc property\n   * @name $httpProvider#defaults\n   * @description\n   *\n   * Object containing default values for all {@link ng.$http $http} requests.\n   *\n   * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with\n   * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses\n   * by default. See {@link $http#caching $http Caching} for more information.\n   *\n   * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.\n   * Defaults value is `'XSRF-TOKEN'`.\n   *\n   * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the\n   * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.\n   *\n   * - **`defaults.headers`** - {Object} - Default headers for all $http requests.\n   * Refer to {@link ng.$http#setting-http-headers $http} for documentation on\n   * setting default headers.\n   *     - **`defaults.headers.common`**\n   *     - **`defaults.headers.post`**\n   *     - **`defaults.headers.put`**\n   *     - **`defaults.headers.patch`**\n   *\n   *\n   * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function\n   *  used to the prepare string representation of request parameters (specified as an object).\n   *  If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.\n   *  Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.\n   *\n   **/\n  var defaults = this.defaults = {\n    // transform incoming response data\n    transformResponse: [defaultHttpResponseTransform],\n\n    // transform outgoing request data\n    transformRequest: [function(d) {\n      return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;\n    }],\n\n    // default headers\n    headers: {\n      common: {\n        'Accept': 'application/json, text/plain, */*'\n      },\n      post:   shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      put:    shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      patch:  shallowCopy(CONTENT_TYPE_APPLICATION_JSON)\n    },\n\n    xsrfCookieName: 'XSRF-TOKEN',\n    xsrfHeaderName: 'X-XSRF-TOKEN',\n\n    paramSerializer: '$httpParamSerializer'\n  };\n\n  var useApplyAsync = false;\n  /**\n   * @ngdoc method\n   * @name $httpProvider#useApplyAsync\n   * @description\n   *\n   * Configure $http service to combine processing of multiple http responses received at around\n   * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in\n   * significant performance improvement for bigger applications that make many HTTP requests\n   * concurrently (common during application bootstrap).\n   *\n   * Defaults to false. If no value is specified, returns the current configured value.\n   *\n   * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred\n   *    \"apply\" on the next tick, giving time for subsequent requests in a roughly ~10ms window\n   *    to load and share the same digest cycle.\n   *\n   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n   *    otherwise, returns the current configured value.\n   **/\n  this.useApplyAsync = function(value) {\n    if (isDefined(value)) {\n      useApplyAsync = !!value;\n      return this;\n    }\n    return useApplyAsync;\n  };\n\n  var useLegacyPromise = true;\n  /**\n   * @ngdoc method\n   * @name $httpProvider#useLegacyPromiseExtensions\n   * @description\n   *\n   * Configure `$http` service to return promises without the shorthand methods `success` and `error`.\n   * This should be used to make sure that applications work without these methods.\n   *\n   * Defaults to true. If no value is specified, returns the current configured value.\n   *\n   * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.\n   *\n   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n   *    otherwise, returns the current configured value.\n   **/\n  this.useLegacyPromiseExtensions = function(value) {\n    if (isDefined(value)) {\n      useLegacyPromise = !!value;\n      return this;\n    }\n    return useLegacyPromise;\n  };\n\n  /**\n   * @ngdoc property\n   * @name $httpProvider#interceptors\n   * @description\n   *\n   * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}\n   * pre-processing of request or postprocessing of responses.\n   *\n   * These service factories are ordered by request, i.e. they are applied in the same order as the\n   * array, on request, but reverse order, on response.\n   *\n   * {@link ng.$http#interceptors Interceptors detailed info}\n   **/\n  var interceptorFactories = this.interceptors = [];\n\n  this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',\n      function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {\n\n    var defaultCache = $cacheFactory('$http');\n\n    /**\n     * Make sure that default param serializer is exposed as a function\n     */\n    defaults.paramSerializer = isString(defaults.paramSerializer) ?\n      $injector.get(defaults.paramSerializer) : defaults.paramSerializer;\n\n    /**\n     * Interceptors stored in reverse order. Inner interceptors before outer interceptors.\n     * The reversal is needed so that we can build up the interception chain around the\n     * server request.\n     */\n    var reversedInterceptors = [];\n\n    forEach(interceptorFactories, function(interceptorFactory) {\n      reversedInterceptors.unshift(isString(interceptorFactory)\n          ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));\n    });\n\n    /**\n     * @ngdoc service\n     * @kind function\n     * @name $http\n     * @requires ng.$httpBackend\n     * @requires $cacheFactory\n     * @requires $rootScope\n     * @requires $q\n     * @requires $injector\n     *\n     * @description\n     * The `$http` service is a core Angular service that facilitates communication with the remote\n     * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)\n     * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).\n     *\n     * For unit testing applications that use `$http` service, see\n     * {@link ngMock.$httpBackend $httpBackend mock}.\n     *\n     * For a higher level of abstraction, please check out the {@link ngResource.$resource\n     * $resource} service.\n     *\n     * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by\n     * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage\n     * it is important to familiarize yourself with these APIs and the guarantees they provide.\n     *\n     *\n     * ## General usage\n     * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —\n     * that is used to generate an HTTP request and returns  a {@link ng.$q promise}.\n     *\n     * ```js\n     *   // Simple GET request example:\n     *   $http({\n     *     method: 'GET',\n     *     url: '/someUrl'\n     *   }).then(function successCallback(response) {\n     *       // this callback will be called asynchronously\n     *       // when the response is available\n     *     }, function errorCallback(response) {\n     *       // called asynchronously if an error occurs\n     *       // or server returns response with an error status.\n     *     });\n     * ```\n     *\n     * The response object has these properties:\n     *\n     *   - **data** – `{string|Object}` – The response body transformed with the transform\n     *     functions.\n     *   - **status** – `{number}` – HTTP status code of the response.\n     *   - **headers** – `{function([headerName])}` – Header getter function.\n     *   - **config** – `{Object}` – The configuration object that was used to generate the request.\n     *   - **statusText** – `{string}` – HTTP status text of the response.\n     *\n     * A response status code between 200 and 299 is considered a success status and\n     * will result in the success callback being called. Note that if the response is a redirect,\n     * XMLHttpRequest will transparently follow it, meaning that the error callback will not be\n     * called for such responses.\n     *\n     *\n     * ## Shortcut methods\n     *\n     * Shortcut methods are also available. All shortcut methods require passing in the URL, and\n     * request data must be passed in for POST/PUT requests. An optional config can be passed as the\n     * last argument.\n     *\n     * ```js\n     *   $http.get('/someUrl', config).then(successCallback, errorCallback);\n     *   $http.post('/someUrl', data, config).then(successCallback, errorCallback);\n     * ```\n     *\n     * Complete list of shortcut methods:\n     *\n     * - {@link ng.$http#get $http.get}\n     * - {@link ng.$http#head $http.head}\n     * - {@link ng.$http#post $http.post}\n     * - {@link ng.$http#put $http.put}\n     * - {@link ng.$http#delete $http.delete}\n     * - {@link ng.$http#jsonp $http.jsonp}\n     * - {@link ng.$http#patch $http.patch}\n     *\n     *\n     * ## Writing Unit Tests that use $http\n     * When unit testing (using {@link ngMock ngMock}), it is necessary to call\n     * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending\n     * request using trained responses.\n     *\n     * ```\n     * $httpBackend.expectGET(...);\n     * $http.get(...);\n     * $httpBackend.flush();\n     * ```\n     *\n     * ## Deprecation Notice\n     * <div class=\"alert alert-danger\">\n     *   The `$http` legacy promise methods `success` and `error` have been deprecated.\n     *   Use the standard `then` method instead.\n     *   If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to\n     *   `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.\n     * </div>\n     *\n     * ## Setting HTTP Headers\n     *\n     * The $http service will automatically add certain HTTP headers to all requests. These defaults\n     * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration\n     * object, which currently contains this default configuration:\n     *\n     * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):\n     *   - `Accept: application/json, text/plain, * / *`\n     * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)\n     *   - `Content-Type: application/json`\n     * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)\n     *   - `Content-Type: application/json`\n     *\n     * To add or overwrite these defaults, simply add or remove a property from these configuration\n     * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object\n     * with the lowercased HTTP method name as the key, e.g.\n     * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.\n     *\n     * The defaults can also be set at runtime via the `$http.defaults` object in the same\n     * fashion. For example:\n     *\n     * ```\n     * module.run(function($http) {\n     *   $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';\n     * });\n     * ```\n     *\n     * In addition, you can supply a `headers` property in the config object passed when\n     * calling `$http(config)`, which overrides the defaults without changing them globally.\n     *\n     * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,\n     * Use the `headers` property, setting the desired header to `undefined`. For example:\n     *\n     * ```js\n     * var req = {\n     *  method: 'POST',\n     *  url: 'http://example.com',\n     *  headers: {\n     *    'Content-Type': undefined\n     *  },\n     *  data: { test: 'test' }\n     * }\n     *\n     * $http(req).then(function(){...}, function(){...});\n     * ```\n     *\n     * ## Transforming Requests and Responses\n     *\n     * Both requests and responses can be transformed using transformation functions: `transformRequest`\n     * and `transformResponse`. These properties can be a single function that returns\n     * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,\n     * which allows you to `push` or `unshift` a new transformation function into the transformation chain.\n     *\n     * <div class=\"alert alert-warning\">\n     * **Note:** Angular does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline.\n     * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference).\n     * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest\n     * function will be reflected on the scope and in any templates where the object is data-bound.\n     * To prevent his, transform functions should have no side-effects.\n     * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return.\n     * </div>\n     *\n     * ### Default Transformations\n     *\n     * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and\n     * `defaults.transformResponse` properties. If a request does not provide its own transformations\n     * then these will be applied.\n     *\n     * You can augment or replace the default transformations by modifying these properties by adding to or\n     * replacing the array.\n     *\n     * Angular provides the following default transformations:\n     *\n     * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):\n     *\n     * - If the `data` property of the request configuration object contains an object, serialize it\n     *   into JSON format.\n     *\n     * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):\n     *\n     *  - If XSRF prefix is detected, strip it (see Security Considerations section below).\n     *  - If JSON response is detected, deserialize it using a JSON parser.\n     *\n     *\n     * ### Overriding the Default Transformations Per Request\n     *\n     * If you wish override the request/response transformations only for a single request then provide\n     * `transformRequest` and/or `transformResponse` properties on the configuration object passed\n     * into `$http`.\n     *\n     * Note that if you provide these properties on the config object the default transformations will be\n     * overwritten. If you wish to augment the default transformations then you must include them in your\n     * local transformation array.\n     *\n     * The following code demonstrates adding a new response transformation to be run after the default response\n     * transformations have been run.\n     *\n     * ```js\n     * function appendTransform(defaults, transform) {\n     *\n     *   // We can't guarantee that the default transformation is an array\n     *   defaults = angular.isArray(defaults) ? defaults : [defaults];\n     *\n     *   // Append the new transformation to the defaults\n     *   return defaults.concat(transform);\n     * }\n     *\n     * $http({\n     *   url: '...',\n     *   method: 'GET',\n     *   transformResponse: appendTransform($http.defaults.transformResponse, function(value) {\n     *     return doTransform(value);\n     *   })\n     * });\n     * ```\n     *\n     *\n     * ## Caching\n     *\n     * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must\n     * set the config.cache value or the default cache value to TRUE or to a cache object (created\n     * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes\n     * precedence over the default cache value.\n     *\n     * In order to:\n     *   * cache all responses - set the default cache value to TRUE or to a cache object\n     *   * cache a specific response - set config.cache value to TRUE or to a cache object\n     *\n     * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,\n     * then the default `$cacheFactory($http)` object is used.\n     *\n     * The default cache value can be set by updating the\n     * {@link ng.$http#defaults `$http.defaults.cache`} property or the\n     * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property.\n     *\n     * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using\n     * the relevant cache object. The next time the same request is made, the response is returned\n     * from the cache without sending a request to the server.\n     *\n     * Take note that:\n     *\n     *   * Only GET and JSONP requests are cached.\n     *   * The cache key is the request URL including search parameters; headers are not considered.\n     *   * Cached responses are returned asynchronously, in the same way as responses from the server.\n     *   * If multiple identical requests are made using the same cache, which is not yet populated,\n     *     one request will be made to the server and remaining requests will return the same response.\n     *   * A cache-control header on the response does not affect if or how responses are cached.\n     *\n     *\n     * ## Interceptors\n     *\n     * Before you start creating interceptors, be sure to understand the\n     * {@link ng.$q $q and deferred/promise APIs}.\n     *\n     * For purposes of global error handling, authentication, or any kind of synchronous or\n     * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be\n     * able to intercept requests before they are handed to the server and\n     * responses before they are handed over to the application code that\n     * initiated these requests. The interceptors leverage the {@link ng.$q\n     * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.\n     *\n     * The interceptors are service factories that are registered with the `$httpProvider` by\n     * adding them to the `$httpProvider.interceptors` array. The factory is called and\n     * injected with dependencies (if specified) and returns the interceptor.\n     *\n     * There are two kinds of interceptors (and two kinds of rejection interceptors):\n     *\n     *   * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to\n     *     modify the `config` object or create a new one. The function needs to return the `config`\n     *     object directly, or a promise containing the `config` or a new `config` object.\n     *   * `requestError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *   * `response`: interceptors get called with http `response` object. The function is free to\n     *     modify the `response` object or create a new one. The function needs to return the `response`\n     *     object directly, or as a promise containing the `response` or a new `response` object.\n     *   * `responseError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *\n     *\n     * ```js\n     *   // register the interceptor as a service\n     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n     *     return {\n     *       // optional method\n     *       'request': function(config) {\n     *         // do something on success\n     *         return config;\n     *       },\n     *\n     *       // optional method\n     *      'requestError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       },\n     *\n     *\n     *\n     *       // optional method\n     *       'response': function(response) {\n     *         // do something on success\n     *         return response;\n     *       },\n     *\n     *       // optional method\n     *      'responseError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       }\n     *     };\n     *   });\n     *\n     *   $httpProvider.interceptors.push('myHttpInterceptor');\n     *\n     *\n     *   // alternatively, register the interceptor via an anonymous factory\n     *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {\n     *     return {\n     *      'request': function(config) {\n     *          // same as above\n     *       },\n     *\n     *       'response': function(response) {\n     *          // same as above\n     *       }\n     *     };\n     *   });\n     * ```\n     *\n     * ## Security Considerations\n     *\n     * When designing web applications, consider security threats from:\n     *\n     * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)\n     *\n     * Both server and the client must cooperate in order to eliminate these threats. Angular comes\n     * pre-configured with strategies that address these issues, but for this to work backend server\n     * cooperation is required.\n     *\n     * ### JSON Vulnerability Protection\n     *\n     * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * allows third party website to turn your JSON resource URL into\n     * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To\n     * counter this your server can prefix all JSON requests with following string `\")]}',\\n\"`.\n     * Angular will automatically strip the prefix before processing it as JSON.\n     *\n     * For example if your server needs to return:\n     * ```js\n     * ['one','two']\n     * ```\n     *\n     * which is vulnerable to attack, your server can return:\n     * ```js\n     * )]}',\n     * ['one','two']\n     * ```\n     *\n     * Angular will strip the prefix, before processing the JSON.\n     *\n     *\n     * ### Cross Site Request Forgery (XSRF) Protection\n     *\n     * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by\n     * which the attacker can trick an authenticated user into unknowingly executing actions on your\n     * website. Angular provides a mechanism to counter XSRF. When performing XHR requests, the\n     * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP\n     * header (`X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the\n     * cookie, your server can be assured that the XHR came from JavaScript running on your domain.\n     * The header will not be set for cross-domain requests.\n     *\n     * To take advantage of this, your server needs to set a token in a JavaScript readable session\n     * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the\n     * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure\n     * that only JavaScript running on your domain could have sent the request. The token must be\n     * unique for each user and must be verifiable by the server (to prevent the JavaScript from\n     * making up its own tokens). We recommend that the token is a digest of your site's\n     * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)\n     * for added security.\n     *\n     * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName\n     * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,\n     * or the per-request config object.\n     *\n     * In order to prevent collisions in environments where multiple Angular apps share the\n     * same domain or subdomain, we recommend that each application uses unique cookie name.\n     *\n     * @param {object} config Object describing the request to be made and how it should be\n     *    processed. The object has following properties:\n     *\n     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)\n     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.\n     *    - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized\n     *      with the `paramSerializer` and appended as GET parameters.\n     *    - **data** – `{string|Object}` – Data to be sent as the request message data.\n     *    - **headers** – `{Object}` – Map of strings or functions which return strings representing\n     *      HTTP headers to send to the server. If the return value of a function is null, the\n     *      header will not be sent. Functions accept a config object as an argument.\n     *    - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.\n     *    - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.\n     *    - **transformRequest** –\n     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      request body and headers and returns its transformed (typically serialized) version.\n     *      See {@link ng.$http#overriding-the-default-transformations-per-request\n     *      Overriding the Default Transformations}\n     *    - **transformResponse** –\n     *      `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      response body, headers and status and returns its transformed (typically deserialized) version.\n     *      See {@link ng.$http#overriding-the-default-transformations-per-request\n     *      Overriding the Default Transformations}\n     *    - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to\n     *      prepare the string representation of request parameters (specified as an object).\n     *      If specified as string, it is interpreted as function registered with the\n     *      {@link $injector $injector}, which means you can create your own serializer\n     *      by registering it as a {@link auto.$provide#service service}.\n     *      The default serializer is the {@link $httpParamSerializer $httpParamSerializer};\n     *      alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}\n     *    - **cache** – `{boolean|Object}` – A boolean value or object created with\n     *      {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.\n     *      See {@link $http#caching $http Caching} for more information.\n     *    - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}\n     *      that should abort the request when resolved.\n     *    - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the\n     *      XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)\n     *      for more information.\n     *    - **responseType** - `{string}` - see\n     *      [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).\n     *\n     * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object\n     *                        when the request succeeds or fails.\n     *\n     *\n     * @property {Array.<Object>} pendingRequests Array of config objects for currently pending\n     *   requests. This is primarily meant to be used for debugging purposes.\n     *\n     *\n     * @example\n<example module=\"httpExample\">\n<file name=\"index.html\">\n  <div ng-controller=\"FetchController\">\n    <select ng-model=\"method\" aria-label=\"Request method\">\n      <option>GET</option>\n      <option>JSONP</option>\n    </select>\n    <input type=\"text\" ng-model=\"url\" size=\"80\" aria-label=\"URL\" />\n    <button id=\"fetchbtn\" ng-click=\"fetch()\">fetch</button><br>\n    <button id=\"samplegetbtn\" ng-click=\"updateModel('GET', 'http-hello.html')\">Sample GET</button>\n    <button id=\"samplejsonpbtn\"\n      ng-click=\"updateModel('JSONP',\n                    'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')\">\n      Sample JSONP\n    </button>\n    <button id=\"invalidjsonpbtn\"\n      ng-click=\"updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')\">\n        Invalid JSONP\n      </button>\n    <pre>http status code: {{status}}</pre>\n    <pre>http response data: {{data}}</pre>\n  </div>\n</file>\n<file name=\"script.js\">\n  angular.module('httpExample', [])\n    .controller('FetchController', ['$scope', '$http', '$templateCache',\n      function($scope, $http, $templateCache) {\n        $scope.method = 'GET';\n        $scope.url = 'http-hello.html';\n\n        $scope.fetch = function() {\n          $scope.code = null;\n          $scope.response = null;\n\n          $http({method: $scope.method, url: $scope.url, cache: $templateCache}).\n            then(function(response) {\n              $scope.status = response.status;\n              $scope.data = response.data;\n            }, function(response) {\n              $scope.data = response.data || \"Request failed\";\n              $scope.status = response.status;\n          });\n        };\n\n        $scope.updateModel = function(method, url) {\n          $scope.method = method;\n          $scope.url = url;\n        };\n      }]);\n</file>\n<file name=\"http-hello.html\">\n  Hello, $http!\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  var status = element(by.binding('status'));\n  var data = element(by.binding('data'));\n  var fetchBtn = element(by.id('fetchbtn'));\n  var sampleGetBtn = element(by.id('samplegetbtn'));\n  var sampleJsonpBtn = element(by.id('samplejsonpbtn'));\n  var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));\n\n  it('should make an xhr GET request', function() {\n    sampleGetBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('200');\n    expect(data.getText()).toMatch(/Hello, \\$http!/);\n  });\n\n// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185\n// it('should make a JSONP request to angularjs.org', function() {\n//   sampleJsonpBtn.click();\n//   fetchBtn.click();\n//   expect(status.getText()).toMatch('200');\n//   expect(data.getText()).toMatch(/Super Hero!/);\n// });\n\n  it('should make JSONP request to invalid URL and invoke the error handler',\n      function() {\n    invalidJsonpBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('0');\n    expect(data.getText()).toMatch('Request failed');\n  });\n</file>\n</example>\n     */\n    function $http(requestConfig) {\n\n      if (!isObject(requestConfig)) {\n        throw minErr('$http')('badreq', 'Http request configuration must be an object.  Received: {0}', requestConfig);\n      }\n\n      if (!isString(requestConfig.url)) {\n        throw minErr('$http')('badreq', 'Http request configuration url must be a string.  Received: {0}', requestConfig.url);\n      }\n\n      var config = extend({\n        method: 'get',\n        transformRequest: defaults.transformRequest,\n        transformResponse: defaults.transformResponse,\n        paramSerializer: defaults.paramSerializer\n      }, requestConfig);\n\n      config.headers = mergeHeaders(requestConfig);\n      config.method = uppercase(config.method);\n      config.paramSerializer = isString(config.paramSerializer) ?\n        $injector.get(config.paramSerializer) : config.paramSerializer;\n\n      var serverRequest = function(config) {\n        var headers = config.headers;\n        var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);\n\n        // strip content-type if data is undefined\n        if (isUndefined(reqData)) {\n          forEach(headers, function(value, header) {\n            if (lowercase(header) === 'content-type') {\n                delete headers[header];\n            }\n          });\n        }\n\n        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {\n          config.withCredentials = defaults.withCredentials;\n        }\n\n        // send request\n        return sendReq(config, reqData).then(transformResponse, transformResponse);\n      };\n\n      var chain = [serverRequest, undefined];\n      var promise = $q.when(config);\n\n      // apply interceptors\n      forEach(reversedInterceptors, function(interceptor) {\n        if (interceptor.request || interceptor.requestError) {\n          chain.unshift(interceptor.request, interceptor.requestError);\n        }\n        if (interceptor.response || interceptor.responseError) {\n          chain.push(interceptor.response, interceptor.responseError);\n        }\n      });\n\n      while (chain.length) {\n        var thenFn = chain.shift();\n        var rejectFn = chain.shift();\n\n        promise = promise.then(thenFn, rejectFn);\n      }\n\n      if (useLegacyPromise) {\n        promise.success = function(fn) {\n          assertArgFn(fn, 'fn');\n\n          promise.then(function(response) {\n            fn(response.data, response.status, response.headers, config);\n          });\n          return promise;\n        };\n\n        promise.error = function(fn) {\n          assertArgFn(fn, 'fn');\n\n          promise.then(null, function(response) {\n            fn(response.data, response.status, response.headers, config);\n          });\n          return promise;\n        };\n      } else {\n        promise.success = $httpMinErrLegacyFn('success');\n        promise.error = $httpMinErrLegacyFn('error');\n      }\n\n      return promise;\n\n      function transformResponse(response) {\n        // make a copy since the response must be cacheable\n        var resp = extend({}, response);\n        resp.data = transformData(response.data, response.headers, response.status,\n                                  config.transformResponse);\n        return (isSuccess(response.status))\n          ? resp\n          : $q.reject(resp);\n      }\n\n      function executeHeaderFns(headers, config) {\n        var headerContent, processedHeaders = {};\n\n        forEach(headers, function(headerFn, header) {\n          if (isFunction(headerFn)) {\n            headerContent = headerFn(config);\n            if (headerContent != null) {\n              processedHeaders[header] = headerContent;\n            }\n          } else {\n            processedHeaders[header] = headerFn;\n          }\n        });\n\n        return processedHeaders;\n      }\n\n      function mergeHeaders(config) {\n        var defHeaders = defaults.headers,\n            reqHeaders = extend({}, config.headers),\n            defHeaderName, lowercaseDefHeaderName, reqHeaderName;\n\n        defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);\n\n        // using for-in instead of forEach to avoid unnecessary iteration after header has been found\n        defaultHeadersIteration:\n        for (defHeaderName in defHeaders) {\n          lowercaseDefHeaderName = lowercase(defHeaderName);\n\n          for (reqHeaderName in reqHeaders) {\n            if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {\n              continue defaultHeadersIteration;\n            }\n          }\n\n          reqHeaders[defHeaderName] = defHeaders[defHeaderName];\n        }\n\n        // execute if header value is a function for merged headers\n        return executeHeaderFns(reqHeaders, shallowCopy(config));\n      }\n    }\n\n    $http.pendingRequests = [];\n\n    /**\n     * @ngdoc method\n     * @name $http#get\n     *\n     * @description\n     * Shortcut method to perform `GET` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#delete\n     *\n     * @description\n     * Shortcut method to perform `DELETE` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#head\n     *\n     * @description\n     * Shortcut method to perform `HEAD` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#jsonp\n     *\n     * @description\n     * Shortcut method to perform `JSONP` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request.\n     *                     The name of the callback should be the string `JSON_CALLBACK`.\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n    createShortMethods('get', 'delete', 'head', 'jsonp');\n\n    /**\n     * @ngdoc method\n     * @name $http#post\n     *\n     * @description\n     * Shortcut method to perform `POST` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#put\n     *\n     * @description\n     * Shortcut method to perform `PUT` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n     /**\n      * @ngdoc method\n      * @name $http#patch\n      *\n      * @description\n      * Shortcut method to perform `PATCH` request.\n      *\n      * @param {string} url Relative or absolute URL specifying the destination of the request\n      * @param {*} data Request content\n      * @param {Object=} config Optional configuration object\n      * @returns {HttpPromise} Future object\n      */\n    createShortMethodsWithData('post', 'put', 'patch');\n\n        /**\n         * @ngdoc property\n         * @name $http#defaults\n         *\n         * @description\n         * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of\n         * default headers, withCredentials as well as request and response transformations.\n         *\n         * See \"Setting HTTP Headers\" and \"Transforming Requests and Responses\" sections above.\n         */\n    $http.defaults = defaults;\n\n\n    return $http;\n\n\n    function createShortMethods(names) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, config) {\n          return $http(extend({}, config || {}, {\n            method: name,\n            url: url\n          }));\n        };\n      });\n    }\n\n\n    function createShortMethodsWithData(name) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, data, config) {\n          return $http(extend({}, config || {}, {\n            method: name,\n            url: url,\n            data: data\n          }));\n        };\n      });\n    }\n\n\n    /**\n     * Makes the request.\n     *\n     * !!! ACCESSES CLOSURE VARS:\n     * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests\n     */\n    function sendReq(config, reqData) {\n      var deferred = $q.defer(),\n          promise = deferred.promise,\n          cache,\n          cachedResp,\n          reqHeaders = config.headers,\n          url = buildUrl(config.url, config.paramSerializer(config.params));\n\n      $http.pendingRequests.push(config);\n      promise.then(removePendingReq, removePendingReq);\n\n\n      if ((config.cache || defaults.cache) && config.cache !== false &&\n          (config.method === 'GET' || config.method === 'JSONP')) {\n        cache = isObject(config.cache) ? config.cache\n              : isObject(defaults.cache) ? defaults.cache\n              : defaultCache;\n      }\n\n      if (cache) {\n        cachedResp = cache.get(url);\n        if (isDefined(cachedResp)) {\n          if (isPromiseLike(cachedResp)) {\n            // cached request has already been sent, but there is no response yet\n            cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);\n          } else {\n            // serving from cache\n            if (isArray(cachedResp)) {\n              resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);\n            } else {\n              resolvePromise(cachedResp, 200, {}, 'OK');\n            }\n          }\n        } else {\n          // put the promise for the non-transformed response into cache as a placeholder\n          cache.put(url, promise);\n        }\n      }\n\n\n      // if we won't have the response in cache, set the xsrf headers and\n      // send the request to the backend\n      if (isUndefined(cachedResp)) {\n        var xsrfValue = urlIsSameOrigin(config.url)\n            ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]\n            : undefined;\n        if (xsrfValue) {\n          reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;\n        }\n\n        $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,\n            config.withCredentials, config.responseType);\n      }\n\n      return promise;\n\n\n      /**\n       * Callback registered to $httpBackend():\n       *  - caches the response if desired\n       *  - resolves the raw $http promise\n       *  - calls $apply\n       */\n      function done(status, response, headersString, statusText) {\n        if (cache) {\n          if (isSuccess(status)) {\n            cache.put(url, [status, response, parseHeaders(headersString), statusText]);\n          } else {\n            // remove promise from the cache\n            cache.remove(url);\n          }\n        }\n\n        function resolveHttpPromise() {\n          resolvePromise(response, status, headersString, statusText);\n        }\n\n        if (useApplyAsync) {\n          $rootScope.$applyAsync(resolveHttpPromise);\n        } else {\n          resolveHttpPromise();\n          if (!$rootScope.$$phase) $rootScope.$apply();\n        }\n      }\n\n\n      /**\n       * Resolves the raw $http promise.\n       */\n      function resolvePromise(response, status, headers, statusText) {\n        //status: HTTP response status code, 0, -1 (aborted by timeout / promise)\n        status = status >= -1 ? status : 0;\n\n        (isSuccess(status) ? deferred.resolve : deferred.reject)({\n          data: response,\n          status: status,\n          headers: headersGetter(headers),\n          config: config,\n          statusText: statusText\n        });\n      }\n\n      function resolvePromiseWithResult(result) {\n        resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);\n      }\n\n      function removePendingReq() {\n        var idx = $http.pendingRequests.indexOf(config);\n        if (idx !== -1) $http.pendingRequests.splice(idx, 1);\n      }\n    }\n\n\n    function buildUrl(url, serializedParams) {\n      if (serializedParams.length > 0) {\n        url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;\n      }\n      return url;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $xhrFactory\n *\n * @description\n * Factory function used to create XMLHttpRequest objects.\n *\n * Replace or decorate this service to create your own custom XMLHttpRequest objects.\n *\n * ```\n * angular.module('myApp', [])\n * .factory('$xhrFactory', function() {\n *   return function createXhr(method, url) {\n *     return new window.XMLHttpRequest({mozSystem: true});\n *   };\n * });\n * ```\n *\n * @param {string} method HTTP method of the request (GET, POST, PUT, ..)\n * @param {string} url URL of the request.\n */\nfunction $xhrFactoryProvider() {\n  this.$get = function() {\n    return function createXhr() {\n      return new window.XMLHttpRequest();\n    };\n  };\n}\n\n/**\n * @ngdoc service\n * @name $httpBackend\n * @requires $window\n * @requires $document\n * @requires $xhrFactory\n *\n * @description\n * HTTP backend used by the {@link ng.$http service} that delegates to\n * XMLHttpRequest object or JSONP and deals with browser incompatibilities.\n *\n * You should never need to use this service directly, instead use the higher-level abstractions:\n * {@link ng.$http $http} or {@link ngResource.$resource $resource}.\n *\n * During testing this implementation is swapped with {@link ngMock.$httpBackend mock\n * $httpBackend} which can be trained with responses.\n */\nfunction $HttpBackendProvider() {\n  this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {\n    return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);\n  }];\n}\n\nfunction createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {\n  // TODO(vojta): fix the signature\n  return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {\n    $browser.$$incOutstandingRequestCount();\n    url = url || $browser.url();\n\n    if (lowercase(method) == 'jsonp') {\n      var callbackId = '_' + (callbacks.counter++).toString(36);\n      callbacks[callbackId] = function(data) {\n        callbacks[callbackId].data = data;\n        callbacks[callbackId].called = true;\n      };\n\n      var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),\n          callbackId, function(status, text) {\n        completeRequest(callback, status, callbacks[callbackId].data, \"\", text);\n        callbacks[callbackId] = noop;\n      });\n    } else {\n\n      var xhr = createXhr(method, url);\n\n      xhr.open(method, url, true);\n      forEach(headers, function(value, key) {\n        if (isDefined(value)) {\n            xhr.setRequestHeader(key, value);\n        }\n      });\n\n      xhr.onload = function requestLoaded() {\n        var statusText = xhr.statusText || '';\n\n        // responseText is the old-school way of retrieving response (supported by IE9)\n        // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n        var response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n        // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n        var status = xhr.status === 1223 ? 204 : xhr.status;\n\n        // fix status code when it is 0 (0 status is undocumented).\n        // Occurs when accessing file resources or on Android 4.1 stock browser\n        // while retrieving files from application cache.\n        if (status === 0) {\n          status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;\n        }\n\n        completeRequest(callback,\n            status,\n            response,\n            xhr.getAllResponseHeaders(),\n            statusText);\n      };\n\n      var requestError = function() {\n        // The response is always empty\n        // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error\n        completeRequest(callback, -1, null, null, '');\n      };\n\n      xhr.onerror = requestError;\n      xhr.onabort = requestError;\n\n      if (withCredentials) {\n        xhr.withCredentials = true;\n      }\n\n      if (responseType) {\n        try {\n          xhr.responseType = responseType;\n        } catch (e) {\n          // WebKit added support for the json responseType value on 09/03/2013\n          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n          // known to throw when setting the value \"json\" as the response type. Other older\n          // browsers implementing the responseType\n          //\n          // The json response type can be ignored if not supported, because JSON payloads are\n          // parsed on the client-side regardless.\n          if (responseType !== 'json') {\n            throw e;\n          }\n        }\n      }\n\n      xhr.send(isUndefined(post) ? null : post);\n    }\n\n    if (timeout > 0) {\n      var timeoutId = $browserDefer(timeoutRequest, timeout);\n    } else if (isPromiseLike(timeout)) {\n      timeout.then(timeoutRequest);\n    }\n\n\n    function timeoutRequest() {\n      jsonpDone && jsonpDone();\n      xhr && xhr.abort();\n    }\n\n    function completeRequest(callback, status, response, headersString, statusText) {\n      // cancel timeout and subsequent timeout promise resolution\n      if (isDefined(timeoutId)) {\n        $browserDefer.cancel(timeoutId);\n      }\n      jsonpDone = xhr = null;\n\n      callback(status, response, headersString, statusText);\n      $browser.$$completeOutstandingRequest(noop);\n    }\n  };\n\n  function jsonpReq(url, callbackId, done) {\n    // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:\n    // - fetches local scripts via XHR and evals them\n    // - adds and immediately removes script elements from the document\n    var script = rawDocument.createElement('script'), callback = null;\n    script.type = \"text/javascript\";\n    script.src = url;\n    script.async = true;\n\n    callback = function(event) {\n      removeEventListenerFn(script, \"load\", callback);\n      removeEventListenerFn(script, \"error\", callback);\n      rawDocument.body.removeChild(script);\n      script = null;\n      var status = -1;\n      var text = \"unknown\";\n\n      if (event) {\n        if (event.type === \"load\" && !callbacks[callbackId].called) {\n          event = { type: \"error\" };\n        }\n        text = event.type;\n        status = event.type === \"error\" ? 404 : 200;\n      }\n\n      if (done) {\n        done(status, text);\n      }\n    };\n\n    addEventListenerFn(script, \"load\", callback);\n    addEventListenerFn(script, \"error\", callback);\n    rawDocument.body.appendChild(script);\n    return callback;\n  }\n}\n\nvar $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');\n$interpolateMinErr.throwNoconcat = function(text) {\n  throw $interpolateMinErr('noconcat',\n      \"Error while interpolating: {0}\\nStrict Contextual Escaping disallows \" +\n      \"interpolations that concatenate multiple expressions when a trusted value is \" +\n      \"required.  See http://docs.angularjs.org/api/ng.$sce\", text);\n};\n\n$interpolateMinErr.interr = function(text, err) {\n  return $interpolateMinErr('interr', \"Can't interpolate: {0}\\n{1}\", text, err.toString());\n};\n\n/**\n * @ngdoc provider\n * @name $interpolateProvider\n *\n * @description\n *\n * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.\n *\n * <div class=\"alert alert-danger\">\n * This feature is sometimes used to mix different markup languages, e.g. to wrap an Angular\n * template within a Python Jinja template (or any other template language). Mixing templating\n * languages is **very dangerous**. The embedding template language will not safely escape Angular\n * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS)\n * security bugs!\n * </div>\n *\n * @example\n<example name=\"custom-interpolation-markup\" module=\"customInterpolationApp\">\n<file name=\"index.html\">\n<script>\n  var customInterpolationApp = angular.module('customInterpolationApp', []);\n\n  customInterpolationApp.config(function($interpolateProvider) {\n    $interpolateProvider.startSymbol('//');\n    $interpolateProvider.endSymbol('//');\n  });\n\n\n  customInterpolationApp.controller('DemoController', function() {\n      this.label = \"This binding is brought you by // interpolation symbols.\";\n  });\n</script>\n<div ng-controller=\"DemoController as demo\">\n    //demo.label//\n</div>\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  it('should interpolate binding with custom symbols', function() {\n    expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');\n  });\n</file>\n</example>\n */\nfunction $InterpolateProvider() {\n  var startSymbol = '{{';\n  var endSymbol = '}}';\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#startSymbol\n   * @description\n   * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.\n   *\n   * @param {string=} value new value to set the starting symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.startSymbol = function(value) {\n    if (value) {\n      startSymbol = value;\n      return this;\n    } else {\n      return startSymbol;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#endSymbol\n   * @description\n   * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n   *\n   * @param {string=} value new value to set the ending symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.endSymbol = function(value) {\n    if (value) {\n      endSymbol = value;\n      return this;\n    } else {\n      return endSymbol;\n    }\n  };\n\n\n  this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {\n    var startSymbolLength = startSymbol.length,\n        endSymbolLength = endSymbol.length,\n        escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),\n        escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');\n\n    function escape(ch) {\n      return '\\\\\\\\\\\\' + ch;\n    }\n\n    function unescapeText(text) {\n      return text.replace(escapedStartRegexp, startSymbol).\n        replace(escapedEndRegexp, endSymbol);\n    }\n\n    function stringify(value) {\n      if (value == null) { // null || undefined\n        return '';\n      }\n      switch (typeof value) {\n        case 'string':\n          break;\n        case 'number':\n          value = '' + value;\n          break;\n        default:\n          value = toJson(value);\n      }\n\n      return value;\n    }\n\n    //TODO: this is the same as the constantWatchDelegate in parse.js\n    function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {\n      var unwatch;\n      return unwatch = scope.$watch(function constantInterpolateWatch(scope) {\n        unwatch();\n        return constantInterp(scope);\n      }, listener, objectEquality);\n    }\n\n    /**\n     * @ngdoc service\n     * @name $interpolate\n     * @kind function\n     *\n     * @requires $parse\n     * @requires $sce\n     *\n     * @description\n     *\n     * Compiles a string with markup into an interpolation function. This service is used by the\n     * HTML {@link ng.$compile $compile} service for data binding. See\n     * {@link ng.$interpolateProvider $interpolateProvider} for configuring the\n     * interpolation markup.\n     *\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var exp = $interpolate('Hello {{name | uppercase}}!');\n     *   expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');\n     * ```\n     *\n     * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is\n     * `true`, the interpolation function will return `undefined` unless all embedded expressions\n     * evaluate to a value other than `undefined`.\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var context = {greeting: 'Hello', name: undefined };\n     *\n     *   // default \"forgiving\" mode\n     *   var exp = $interpolate('{{greeting}} {{name}}!');\n     *   expect(exp(context)).toEqual('Hello !');\n     *\n     *   // \"allOrNothing\" mode\n     *   exp = $interpolate('{{greeting}} {{name}}!', false, null, true);\n     *   expect(exp(context)).toBeUndefined();\n     *   context.name = 'Angular';\n     *   expect(exp(context)).toEqual('Hello Angular!');\n     * ```\n     *\n     * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.\n     *\n     * ####Escaped Interpolation\n     * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers\n     * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).\n     * It will be rendered as a regular start/end marker, and will not be interpreted as an expression\n     * or binding.\n     *\n     * This enables web-servers to prevent script injection attacks and defacing attacks, to some\n     * degree, while also enabling code examples to work without relying on the\n     * {@link ng.directive:ngNonBindable ngNonBindable} directive.\n     *\n     * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,\n     * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all\n     * interpolation start/end markers with their escaped counterparts.**\n     *\n     * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered\n     * output when the $interpolate service processes the text. So, for HTML elements interpolated\n     * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter\n     * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,\n     * this is typically useful only when user-data is used in rendering a template from the server, or\n     * when otherwise untrusted data is used by a directive.\n     *\n     * <example>\n     *  <file name=\"index.html\">\n     *    <div ng-init=\"username='A user'\">\n     *      <p ng-init=\"apptitle='Escaping demo'\">{{apptitle}}: \\{\\{ username = \"defaced value\"; \\}\\}\n     *        </p>\n     *      <p><strong>{{username}}</strong> attempts to inject code which will deface the\n     *        application, but fails to accomplish their task, because the server has correctly\n     *        escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)\n     *        characters.</p>\n     *      <p>Instead, the result of the attempted script injection is visible, and can be removed\n     *        from the database by an administrator.</p>\n     *    </div>\n     *  </file>\n     * </example>\n     *\n     * @param {string} text The text with markup to interpolate.\n     * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have\n     *    embedded expression in order to return an interpolation function. Strings with no\n     *    embedded expression will return null for the interpolation function.\n     * @param {string=} trustedContext when provided, the returned function passes the interpolated\n     *    result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,\n     *    trustedContext)} before returning it.  Refer to the {@link ng.$sce $sce} service that\n     *    provides Strict Contextual Escaping for details.\n     * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined\n     *    unless all embedded expressions evaluate to a value other than `undefined`.\n     * @returns {function(context)} an interpolation function which is used to compute the\n     *    interpolated string. The function has these parameters:\n     *\n     * - `context`: evaluation context for all expressions embedded in the interpolated text\n     */\n    function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {\n      // Provide a quick exit and simplified result function for text with no interpolation\n      if (!text.length || text.indexOf(startSymbol) === -1) {\n        var constantInterp;\n        if (!mustHaveExpression) {\n          var unescapedText = unescapeText(text);\n          constantInterp = valueFn(unescapedText);\n          constantInterp.exp = text;\n          constantInterp.expressions = [];\n          constantInterp.$$watchDelegate = constantWatchDelegate;\n        }\n        return constantInterp;\n      }\n\n      allOrNothing = !!allOrNothing;\n      var startIndex,\n          endIndex,\n          index = 0,\n          expressions = [],\n          parseFns = [],\n          textLength = text.length,\n          exp,\n          concat = [],\n          expressionPositions = [];\n\n      while (index < textLength) {\n        if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&\n             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {\n          if (index !== startIndex) {\n            concat.push(unescapeText(text.substring(index, startIndex)));\n          }\n          exp = text.substring(startIndex + startSymbolLength, endIndex);\n          expressions.push(exp);\n          parseFns.push($parse(exp, parseStringifyInterceptor));\n          index = endIndex + endSymbolLength;\n          expressionPositions.push(concat.length);\n          concat.push('');\n        } else {\n          // we did not find an interpolation, so we have to add the remainder to the separators array\n          if (index !== textLength) {\n            concat.push(unescapeText(text.substring(index)));\n          }\n          break;\n        }\n      }\n\n      // Concatenating expressions makes it hard to reason about whether some combination of\n      // concatenated values are unsafe to use and could easily lead to XSS.  By requiring that a\n      // single expression be used for iframe[src], object[src], etc., we ensure that the value\n      // that's used is assigned or constructed by some JS code somewhere that is more testable or\n      // make it obvious that you bound the value to some user controlled value.  This helps reduce\n      // the load when auditing for XSS issues.\n      if (trustedContext && concat.length > 1) {\n          $interpolateMinErr.throwNoconcat(text);\n      }\n\n      if (!mustHaveExpression || expressions.length) {\n        var compute = function(values) {\n          for (var i = 0, ii = expressions.length; i < ii; i++) {\n            if (allOrNothing && isUndefined(values[i])) return;\n            concat[expressionPositions[i]] = values[i];\n          }\n          return concat.join('');\n        };\n\n        var getValue = function(value) {\n          return trustedContext ?\n            $sce.getTrusted(trustedContext, value) :\n            $sce.valueOf(value);\n        };\n\n        return extend(function interpolationFn(context) {\n            var i = 0;\n            var ii = expressions.length;\n            var values = new Array(ii);\n\n            try {\n              for (; i < ii; i++) {\n                values[i] = parseFns[i](context);\n              }\n\n              return compute(values);\n            } catch (err) {\n              $exceptionHandler($interpolateMinErr.interr(text, err));\n            }\n\n          }, {\n          // all of these properties are undocumented for now\n          exp: text, //just for compatibility with regular watchers created via $watch\n          expressions: expressions,\n          $$watchDelegate: function(scope, listener) {\n            var lastValue;\n            return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {\n              var currValue = compute(values);\n              if (isFunction(listener)) {\n                listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);\n              }\n              lastValue = currValue;\n            });\n          }\n        });\n      }\n\n      function parseStringifyInterceptor(value) {\n        try {\n          value = getValue(value);\n          return allOrNothing && !isDefined(value) ? value : stringify(value);\n        } catch (err) {\n          $exceptionHandler($interpolateMinErr.interr(text, err));\n        }\n      }\n    }\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#startSymbol\n     * @description\n     * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.\n     *\n     * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} start symbol.\n     */\n    $interpolate.startSymbol = function() {\n      return startSymbol;\n    };\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#endSymbol\n     * @description\n     * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n     *\n     * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} end symbol.\n     */\n    $interpolate.endSymbol = function() {\n      return endSymbol;\n    };\n\n    return $interpolate;\n  }];\n}\n\nfunction $IntervalProvider() {\n  this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',\n       function($rootScope,   $window,   $q,   $$q,   $browser) {\n    var intervals = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $interval\n      *\n      * @description\n      * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`\n      * milliseconds.\n      *\n      * The return value of registering an interval function is a promise. This promise will be\n      * notified upon each tick of the interval, and will be resolved after `count` iterations, or\n      * run indefinitely if `count` is not defined. The value of the notification will be the\n      * number of iterations that have run.\n      * To cancel an interval, call `$interval.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to\n      * move forward by `millis` milliseconds and trigger any functions scheduled to run in that\n      * time.\n      *\n      * <div class=\"alert alert-warning\">\n      * **Note**: Intervals created by this service must be explicitly destroyed when you are finished\n      * with them.  In particular they are not automatically destroyed when a controller's scope or a\n      * directive's element are destroyed.\n      * You should take this into consideration and make sure to always cancel the interval at the\n      * appropriate moment.  See the example below for more details on how and when to do this.\n      * </div>\n      *\n      * @param {function()} fn A function that should be called repeatedly.\n      * @param {number} delay Number of milliseconds between each function call.\n      * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat\n      *   indefinitely.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @param {...*=} Pass additional parameters to the executed function.\n      * @returns {promise} A promise which will be notified on each iteration.\n      *\n      * @example\n      * <example module=\"intervalExample\">\n      * <file name=\"index.html\">\n      *   <script>\n      *     angular.module('intervalExample', [])\n      *       .controller('ExampleController', ['$scope', '$interval',\n      *         function($scope, $interval) {\n      *           $scope.format = 'M/d/yy h:mm:ss a';\n      *           $scope.blood_1 = 100;\n      *           $scope.blood_2 = 120;\n      *\n      *           var stop;\n      *           $scope.fight = function() {\n      *             // Don't start a new fight if we are already fighting\n      *             if ( angular.isDefined(stop) ) return;\n      *\n      *             stop = $interval(function() {\n      *               if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {\n      *                 $scope.blood_1 = $scope.blood_1 - 3;\n      *                 $scope.blood_2 = $scope.blood_2 - 4;\n      *               } else {\n      *                 $scope.stopFight();\n      *               }\n      *             }, 100);\n      *           };\n      *\n      *           $scope.stopFight = function() {\n      *             if (angular.isDefined(stop)) {\n      *               $interval.cancel(stop);\n      *               stop = undefined;\n      *             }\n      *           };\n      *\n      *           $scope.resetFight = function() {\n      *             $scope.blood_1 = 100;\n      *             $scope.blood_2 = 120;\n      *           };\n      *\n      *           $scope.$on('$destroy', function() {\n      *             // Make sure that the interval is destroyed too\n      *             $scope.stopFight();\n      *           });\n      *         }])\n      *       // Register the 'myCurrentTime' directive factory method.\n      *       // We inject $interval and dateFilter service since the factory method is DI.\n      *       .directive('myCurrentTime', ['$interval', 'dateFilter',\n      *         function($interval, dateFilter) {\n      *           // return the directive link function. (compile function not needed)\n      *           return function(scope, element, attrs) {\n      *             var format,  // date format\n      *                 stopTime; // so that we can cancel the time updates\n      *\n      *             // used to update the UI\n      *             function updateTime() {\n      *               element.text(dateFilter(new Date(), format));\n      *             }\n      *\n      *             // watch the expression, and update the UI on change.\n      *             scope.$watch(attrs.myCurrentTime, function(value) {\n      *               format = value;\n      *               updateTime();\n      *             });\n      *\n      *             stopTime = $interval(updateTime, 1000);\n      *\n      *             // listen on DOM destroy (removal) event, and cancel the next UI update\n      *             // to prevent updating time after the DOM element was removed.\n      *             element.on('$destroy', function() {\n      *               $interval.cancel(stopTime);\n      *             });\n      *           }\n      *         }]);\n      *   </script>\n      *\n      *   <div>\n      *     <div ng-controller=\"ExampleController\">\n      *       <label>Date format: <input ng-model=\"format\"></label> <hr/>\n      *       Current time is: <span my-current-time=\"format\"></span>\n      *       <hr/>\n      *       Blood 1 : <font color='red'>{{blood_1}}</font>\n      *       Blood 2 : <font color='red'>{{blood_2}}</font>\n      *       <button type=\"button\" data-ng-click=\"fight()\">Fight</button>\n      *       <button type=\"button\" data-ng-click=\"stopFight()\">StopFight</button>\n      *       <button type=\"button\" data-ng-click=\"resetFight()\">resetFight</button>\n      *     </div>\n      *   </div>\n      *\n      * </file>\n      * </example>\n      */\n    function interval(fn, delay, count, invokeApply) {\n      var hasParams = arguments.length > 4,\n          args = hasParams ? sliceArgs(arguments, 4) : [],\n          setInterval = $window.setInterval,\n          clearInterval = $window.clearInterval,\n          iteration = 0,\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          deferred = (skipApply ? $$q : $q).defer(),\n          promise = deferred.promise;\n\n      count = isDefined(count) ? count : 0;\n\n      promise.$$intervalId = setInterval(function tick() {\n        if (skipApply) {\n          $browser.defer(callback);\n        } else {\n          $rootScope.$evalAsync(callback);\n        }\n        deferred.notify(iteration++);\n\n        if (count > 0 && iteration >= count) {\n          deferred.resolve(iteration);\n          clearInterval(promise.$$intervalId);\n          delete intervals[promise.$$intervalId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n\n      }, delay);\n\n      intervals[promise.$$intervalId] = deferred;\n\n      return promise;\n\n      function callback() {\n        if (!hasParams) {\n          fn(iteration);\n        } else {\n          fn.apply(null, args);\n        }\n      }\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $interval#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`.\n      *\n      * @param {Promise=} promise returned by the `$interval` function.\n      * @returns {boolean} Returns `true` if the task was successfully canceled.\n      */\n    interval.cancel = function(promise) {\n      if (promise && promise.$$intervalId in intervals) {\n        intervals[promise.$$intervalId].reject('canceled');\n        $window.clearInterval(promise.$$intervalId);\n        delete intervals[promise.$$intervalId];\n        return true;\n      }\n      return false;\n    };\n\n    return interval;\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $locale\n *\n * @description\n * $locale service provides localization rules for various Angular components. As of right now the\n * only public api is:\n *\n * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)\n */\n\nvar PATH_MATCH = /^([^\\?#]*)(\\?([^#]*))?(#(.*))?$/,\n    DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};\nvar $locationMinErr = minErr('$location');\n\n\n/**\n * Encode path using encodeUriSegment, ignoring forward slashes\n *\n * @param {string} path Path to encode\n * @returns {string}\n */\nfunction encodePath(path) {\n  var segments = path.split('/'),\n      i = segments.length;\n\n  while (i--) {\n    segments[i] = encodeUriSegment(segments[i]);\n  }\n\n  return segments.join('/');\n}\n\nfunction parseAbsoluteUrl(absoluteUrl, locationObj) {\n  var parsedUrl = urlResolve(absoluteUrl);\n\n  locationObj.$$protocol = parsedUrl.protocol;\n  locationObj.$$host = parsedUrl.hostname;\n  locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;\n}\n\n\nfunction parseAppUrl(relativeUrl, locationObj) {\n  var prefixed = (relativeUrl.charAt(0) !== '/');\n  if (prefixed) {\n    relativeUrl = '/' + relativeUrl;\n  }\n  var match = urlResolve(relativeUrl);\n  locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?\n      match.pathname.substring(1) : match.pathname);\n  locationObj.$$search = parseKeyValue(match.search);\n  locationObj.$$hash = decodeURIComponent(match.hash);\n\n  // make sure path starts with '/';\n  if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {\n    locationObj.$$path = '/' + locationObj.$$path;\n  }\n}\n\n\n/**\n *\n * @param {string} begin\n * @param {string} whole\n * @returns {string} returns text from whole after begin or undefined if it does not begin with\n *                   expected string.\n */\nfunction beginsWith(begin, whole) {\n  if (whole.indexOf(begin) === 0) {\n    return whole.substr(begin.length);\n  }\n}\n\n\nfunction stripHash(url) {\n  var index = url.indexOf('#');\n  return index == -1 ? url : url.substr(0, index);\n}\n\nfunction trimEmptyHash(url) {\n  return url.replace(/(#.+)|#$/, '$1');\n}\n\n\nfunction stripFile(url) {\n  return url.substr(0, stripHash(url).lastIndexOf('/') + 1);\n}\n\n/* return the server only (scheme://host:port) */\nfunction serverBase(url) {\n  return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));\n}\n\n\n/**\n * LocationHtml5Url represents an url\n * This object is exposed as $location service when HTML5 mode is enabled and supported\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} basePrefix url path prefix\n */\nfunction LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {\n  this.$$html5 = true;\n  basePrefix = basePrefix || '';\n  parseAbsoluteUrl(appBase, this);\n\n\n  /**\n   * Parse given html5 (regular) url string into properties\n   * @param {string} url HTML5 url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var pathUrl = beginsWith(appBaseNoFile, url);\n    if (!isString(pathUrl)) {\n      throw $locationMinErr('ipthprfx', 'Invalid url \"{0}\", missing path prefix \"{1}\".', url,\n          appBaseNoFile);\n    }\n\n    parseAppUrl(pathUrl, this);\n\n    if (!this.$$path) {\n      this.$$path = '/';\n    }\n\n    this.$$compose();\n  };\n\n  /**\n   * Compose url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'\n  };\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (relHref && relHref[0] === '#') {\n      // special case for links to hash fragments:\n      // keep the old url and only replace the hash fragment\n      this.hash(relHref.slice(1));\n      return true;\n    }\n    var appUrl, prevAppUrl;\n    var rewrittenUrl;\n\n    if (isDefined(appUrl = beginsWith(appBase, url))) {\n      prevAppUrl = appUrl;\n      if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {\n        rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);\n      } else {\n        rewrittenUrl = appBase + prevAppUrl;\n      }\n    } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {\n      rewrittenUrl = appBaseNoFile + appUrl;\n    } else if (appBaseNoFile == url + '/') {\n      rewrittenUrl = appBaseNoFile;\n    }\n    if (rewrittenUrl) {\n      this.$$parse(rewrittenUrl);\n    }\n    return !!rewrittenUrl;\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when developer doesn't opt into html5 mode.\n * It also serves as the base class for html5 mode fallback on legacy browsers.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {\n\n  parseAbsoluteUrl(appBase, this);\n\n\n  /**\n   * Parse given hashbang url into properties\n   * @param {string} url Hashbang url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);\n    var withoutHashUrl;\n\n    if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {\n\n      // The rest of the url starts with a hash so we have\n      // got either a hashbang path or a plain hash fragment\n      withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);\n      if (isUndefined(withoutHashUrl)) {\n        // There was no hashbang prefix so we just have a hash fragment\n        withoutHashUrl = withoutBaseUrl;\n      }\n\n    } else {\n      // There was no hashbang path nor hash fragment:\n      // If we are in HTML5 mode we use what is left as the path;\n      // Otherwise we ignore what is left\n      if (this.$$html5) {\n        withoutHashUrl = withoutBaseUrl;\n      } else {\n        withoutHashUrl = '';\n        if (isUndefined(withoutBaseUrl)) {\n          appBase = url;\n          this.replace();\n        }\n      }\n    }\n\n    parseAppUrl(withoutHashUrl, this);\n\n    this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);\n\n    this.$$compose();\n\n    /*\n     * In Windows, on an anchor node on documents loaded from\n     * the filesystem, the browser will return a pathname\n     * prefixed with the drive name ('/C:/path') when a\n     * pathname without a drive is set:\n     *  * a.setAttribute('href', '/foo')\n     *   * a.pathname === '/C:/foo' //true\n     *\n     * Inside of Angular, we're always using pathnames that\n     * do not include drive names for routing.\n     */\n    function removeWindowsDriveName(path, url, base) {\n      /*\n      Matches paths for file protocol on windows,\n      such as /C:/foo/bar, and captures only /foo/bar.\n      */\n      var windowsFilePathExp = /^\\/[A-Z]:(\\/.*)/;\n\n      var firstPathSegmentMatch;\n\n      //Get the relative path from the input URL.\n      if (url.indexOf(base) === 0) {\n        url = url.replace(base, '');\n      }\n\n      // The input URL intentionally contains a first path segment that ends with a colon.\n      if (windowsFilePathExp.exec(url)) {\n        return path;\n      }\n\n      firstPathSegmentMatch = windowsFilePathExp.exec(path);\n      return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;\n    }\n  };\n\n  /**\n   * Compose hashbang url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');\n  };\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (stripHash(appBase) == stripHash(url)) {\n      this.$$parse(url);\n      return true;\n    }\n    return false;\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when html5 history api is enabled but the browser\n * does not support it.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {\n  this.$$html5 = true;\n  LocationHashbangUrl.apply(this, arguments);\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (relHref && relHref[0] === '#') {\n      // special case for links to hash fragments:\n      // keep the old url and only replace the hash fragment\n      this.hash(relHref.slice(1));\n      return true;\n    }\n\n    var rewrittenUrl;\n    var appUrl;\n\n    if (appBase == stripHash(url)) {\n      rewrittenUrl = url;\n    } else if ((appUrl = beginsWith(appBaseNoFile, url))) {\n      rewrittenUrl = appBase + hashPrefix + appUrl;\n    } else if (appBaseNoFile === url + '/') {\n      rewrittenUrl = appBaseNoFile;\n    }\n    if (rewrittenUrl) {\n      this.$$parse(rewrittenUrl);\n    }\n    return !!rewrittenUrl;\n  };\n\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'\n    this.$$absUrl = appBase + hashPrefix + this.$$url;\n  };\n\n}\n\n\nvar locationPrototype = {\n\n  /**\n   * Are we in html5 mode?\n   * @private\n   */\n  $$html5: false,\n\n  /**\n   * Has any change been replacing?\n   * @private\n   */\n  $$replace: false,\n\n  /**\n   * @ngdoc method\n   * @name $location#absUrl\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return full url representation with all segments encoded according to rules specified in\n   * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var absUrl = $location.absUrl();\n   * // => \"http://example.com/#/some/path?foo=bar&baz=xoxo\"\n   * ```\n   *\n   * @return {string} full url\n   */\n  absUrl: locationGetter('$$absUrl'),\n\n  /**\n   * @ngdoc method\n   * @name $location#url\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return url (e.g. `/path?a=b#hash`) when called without any parameter.\n   *\n   * Change path, search and hash, when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var url = $location.url();\n   * // => \"/some/path?foo=bar&baz=xoxo\"\n   * ```\n   *\n   * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)\n   * @return {string} url\n   */\n  url: function(url) {\n    if (isUndefined(url)) {\n      return this.$$url;\n    }\n\n    var match = PATH_MATCH.exec(url);\n    if (match[1] || url === '') this.path(decodeURIComponent(match[1]));\n    if (match[2] || match[1] || url === '') this.search(match[3] || '');\n    this.hash(match[5] || '');\n\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#protocol\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return protocol of current url.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var protocol = $location.protocol();\n   * // => \"http\"\n   * ```\n   *\n   * @return {string} protocol of current url\n   */\n  protocol: locationGetter('$$protocol'),\n\n  /**\n   * @ngdoc method\n   * @name $location#host\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return host of current url.\n   *\n   * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var host = $location.host();\n   * // => \"example.com\"\n   *\n   * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo\n   * host = $location.host();\n   * // => \"example.com\"\n   * host = location.host;\n   * // => \"example.com:8080\"\n   * ```\n   *\n   * @return {string} host of current url.\n   */\n  host: locationGetter('$$host'),\n\n  /**\n   * @ngdoc method\n   * @name $location#port\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return port of current url.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var port = $location.port();\n   * // => 80\n   * ```\n   *\n   * @return {Number} port\n   */\n  port: locationGetter('$$port'),\n\n  /**\n   * @ngdoc method\n   * @name $location#path\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return path of current url when called without any parameter.\n   *\n   * Change path when called with parameter and return `$location`.\n   *\n   * Note: Path should always begin with forward slash (/), this method will add the forward slash\n   * if it is missing.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var path = $location.path();\n   * // => \"/some/path\"\n   * ```\n   *\n   * @param {(string|number)=} path New path\n   * @return {string} path\n   */\n  path: locationGetterSetter('$$path', function(path) {\n    path = path !== null ? path.toString() : '';\n    return path.charAt(0) == '/' ? path : '/' + path;\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#search\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return search part (as object) of current url when called without any parameter.\n   *\n   * Change search part when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var searchObject = $location.search();\n   * // => {foo: 'bar', baz: 'xoxo'}\n   *\n   * // set foo to 'yipee'\n   * $location.search('foo', 'yipee');\n   * // $location.search() => {foo: 'yipee', baz: 'xoxo'}\n   * ```\n   *\n   * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or\n   * hash object.\n   *\n   * When called with a single argument the method acts as a setter, setting the `search` component\n   * of `$location` to the specified value.\n   *\n   * If the argument is a hash object containing an array of values, these values will be encoded\n   * as duplicate search parameters in the url.\n   *\n   * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`\n   * will override only a single search property.\n   *\n   * If `paramValue` is an array, it will override the property of the `search` component of\n   * `$location` specified via the first argument.\n   *\n   * If `paramValue` is `null`, the property specified via the first argument will be deleted.\n   *\n   * If `paramValue` is `true`, the property specified via the first argument will be added with no\n   * value nor trailing equal sign.\n   *\n   * @return {Object} If called with no arguments returns the parsed `search` object. If called with\n   * one or more arguments returns `$location` object itself.\n   */\n  search: function(search, paramValue) {\n    switch (arguments.length) {\n      case 0:\n        return this.$$search;\n      case 1:\n        if (isString(search) || isNumber(search)) {\n          search = search.toString();\n          this.$$search = parseKeyValue(search);\n        } else if (isObject(search)) {\n          search = copy(search, {});\n          // remove object undefined or null properties\n          forEach(search, function(value, key) {\n            if (value == null) delete search[key];\n          });\n\n          this.$$search = search;\n        } else {\n          throw $locationMinErr('isrcharg',\n              'The first argument of the `$location#search()` call must be a string or an object.');\n        }\n        break;\n      default:\n        if (isUndefined(paramValue) || paramValue === null) {\n          delete this.$$search[search];\n        } else {\n          this.$$search[search] = paramValue;\n        }\n    }\n\n    this.$$compose();\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#hash\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Returns the hash fragment when called without any parameters.\n   *\n   * Changes the hash fragment when called with a parameter and returns `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue\n   * var hash = $location.hash();\n   * // => \"hashValue\"\n   * ```\n   *\n   * @param {(string|number)=} hash New hash fragment\n   * @return {string} hash\n   */\n  hash: locationGetterSetter('$$hash', function(hash) {\n    return hash !== null ? hash.toString() : '';\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#replace\n   *\n   * @description\n   * If called, all changes to $location during the current `$digest` will replace the current history\n   * record, instead of adding a new one.\n   */\n  replace: function() {\n    this.$$replace = true;\n    return this;\n  }\n};\n\nforEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {\n  Location.prototype = Object.create(locationPrototype);\n\n  /**\n   * @ngdoc method\n   * @name $location#state\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return the history state object when called without any parameter.\n   *\n   * Change the history state object when called with one parameter and return `$location`.\n   * The state object is later passed to `pushState` or `replaceState`.\n   *\n   * NOTE: This method is supported only in HTML5 mode and only in browsers supporting\n   * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support\n   * older browsers (like IE9 or Android < 4.0), don't use this method.\n   *\n   * @param {object=} state State object for pushState or replaceState\n   * @return {object} state\n   */\n  Location.prototype.state = function(state) {\n    if (!arguments.length) {\n      return this.$$state;\n    }\n\n    if (Location !== LocationHtml5Url || !this.$$html5) {\n      throw $locationMinErr('nostate', 'History API state support is available only ' +\n        'in HTML5 mode and only in browsers supporting HTML5 History API');\n    }\n    // The user might modify `stateObject` after invoking `$location.state(stateObject)`\n    // but we're changing the $$state reference to $browser.state() during the $digest\n    // so the modification window is narrow.\n    this.$$state = isUndefined(state) ? null : state;\n\n    return this;\n  };\n});\n\n\nfunction locationGetter(property) {\n  return function() {\n    return this[property];\n  };\n}\n\n\nfunction locationGetterSetter(property, preprocess) {\n  return function(value) {\n    if (isUndefined(value)) {\n      return this[property];\n    }\n\n    this[property] = preprocess(value);\n    this.$$compose();\n\n    return this;\n  };\n}\n\n\n/**\n * @ngdoc service\n * @name $location\n *\n * @requires $rootElement\n *\n * @description\n * The $location service parses the URL in the browser address bar (based on the\n * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL\n * available to your application. Changes to the URL in the address bar are reflected into\n * $location service and changes to $location are reflected into the browser address bar.\n *\n * **The $location service:**\n *\n * - Exposes the current URL in the browser address bar, so you can\n *   - Watch and observe the URL.\n *   - Change the URL.\n * - Synchronizes the URL with the browser when the user\n *   - Changes the address bar.\n *   - Clicks the back or forward button (or clicks a History link).\n *   - Clicks on a link.\n * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).\n *\n * For more information see {@link guide/$location Developer Guide: Using $location}\n */\n\n/**\n * @ngdoc provider\n * @name $locationProvider\n * @description\n * Use the `$locationProvider` to configure how the application deep linking paths are stored.\n */\nfunction $LocationProvider() {\n  var hashPrefix = '',\n      html5Mode = {\n        enabled: false,\n        requireBase: true,\n        rewriteLinks: true\n      };\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#hashPrefix\n   * @description\n   * @param {string=} prefix Prefix for hash part (containing path and search)\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.hashPrefix = function(prefix) {\n    if (isDefined(prefix)) {\n      hashPrefix = prefix;\n      return this;\n    } else {\n      return hashPrefix;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#html5Mode\n   * @description\n   * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.\n   *   If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported\n   *   properties:\n   *   - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to\n   *     change urls where supported. Will fall back to hash-prefixed paths in browsers that do not\n   *     support `pushState`.\n   *   - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies\n   *     whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are\n   *     true, and a base tag is not present, an error will be thrown when `$location` is injected.\n   *     See the {@link guide/$location $location guide for more information}\n   *   - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,\n   *     enables/disables url rewriting for relative links.\n   *\n   * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter\n   */\n  this.html5Mode = function(mode) {\n    if (isBoolean(mode)) {\n      html5Mode.enabled = mode;\n      return this;\n    } else if (isObject(mode)) {\n\n      if (isBoolean(mode.enabled)) {\n        html5Mode.enabled = mode.enabled;\n      }\n\n      if (isBoolean(mode.requireBase)) {\n        html5Mode.requireBase = mode.requireBase;\n      }\n\n      if (isBoolean(mode.rewriteLinks)) {\n        html5Mode.rewriteLinks = mode.rewriteLinks;\n      }\n\n      return this;\n    } else {\n      return html5Mode;\n    }\n  };\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeStart\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted before a URL will change.\n   *\n   * This change can be prevented by calling\n   * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more\n   * details about event object. Upon successful change\n   * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.\n   *\n   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n   * the browser supports the HTML5 History API.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   * @param {string=} newState New history state object\n   * @param {string=} oldState History state object that was before it was changed.\n   */\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeSuccess\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted after a URL was changed.\n   *\n   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n   * the browser supports the HTML5 History API.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   * @param {string=} newState New history state object\n   * @param {string=} oldState History state object that was before it was changed.\n   */\n\n  this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',\n      function($rootScope, $browser, $sniffer, $rootElement, $window) {\n    var $location,\n        LocationMode,\n        baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''\n        initialUrl = $browser.url(),\n        appBase;\n\n    if (html5Mode.enabled) {\n      if (!baseHref && html5Mode.requireBase) {\n        throw $locationMinErr('nobase',\n          \"$location in HTML5 mode requires a <base> tag to be present!\");\n      }\n      appBase = serverBase(initialUrl) + (baseHref || '/');\n      LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;\n    } else {\n      appBase = stripHash(initialUrl);\n      LocationMode = LocationHashbangUrl;\n    }\n    var appBaseNoFile = stripFile(appBase);\n\n    $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);\n    $location.$$parseLinkUrl(initialUrl, initialUrl);\n\n    $location.$$state = $browser.state();\n\n    var IGNORE_URI_REGEXP = /^\\s*(javascript|mailto):/i;\n\n    function setBrowserUrlWithFallback(url, replace, state) {\n      var oldUrl = $location.url();\n      var oldState = $location.$$state;\n      try {\n        $browser.url(url, replace, state);\n\n        // Make sure $location.state() returns referentially identical (not just deeply equal)\n        // state object; this makes possible quick checking if the state changed in the digest\n        // loop. Checking deep equality would be too expensive.\n        $location.$$state = $browser.state();\n      } catch (e) {\n        // Restore old values if pushState fails\n        $location.url(oldUrl);\n        $location.$$state = oldState;\n\n        throw e;\n      }\n    }\n\n    $rootElement.on('click', function(event) {\n      // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)\n      // currently we open nice url link and redirect then\n\n      if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;\n\n      var elm = jqLite(event.target);\n\n      // traverse the DOM up to find first A tag\n      while (nodeName_(elm[0]) !== 'a') {\n        // ignore rewriting if no A tag (reached root element, or no parent - removed from document)\n        if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;\n      }\n\n      var absHref = elm.prop('href');\n      // get the actual href attribute - see\n      // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx\n      var relHref = elm.attr('href') || elm.attr('xlink:href');\n\n      if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {\n        // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during\n        // an animation.\n        absHref = urlResolve(absHref.animVal).href;\n      }\n\n      // Ignore when url is started with javascript: or mailto:\n      if (IGNORE_URI_REGEXP.test(absHref)) return;\n\n      if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {\n        if ($location.$$parseLinkUrl(absHref, relHref)) {\n          // We do a preventDefault for all urls that are part of the angular application,\n          // in html5mode and also without, so that we are able to abort navigation without\n          // getting double entries in the location history.\n          event.preventDefault();\n          // update location manually\n          if ($location.absUrl() != $browser.url()) {\n            $rootScope.$apply();\n            // hack to work around FF6 bug 684208 when scenario runner clicks on links\n            $window.angular['ff-684208-preventDefault'] = true;\n          }\n        }\n      }\n    });\n\n\n    // rewrite hashbang url <> html5 url\n    if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {\n      $browser.url($location.absUrl(), true);\n    }\n\n    var initializing = true;\n\n    // update $location when $browser url changes\n    $browser.onUrlChange(function(newUrl, newState) {\n\n      if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {\n        // If we are navigating outside of the app then force a reload\n        $window.location.href = newUrl;\n        return;\n      }\n\n      $rootScope.$evalAsync(function() {\n        var oldUrl = $location.absUrl();\n        var oldState = $location.$$state;\n        var defaultPrevented;\n        newUrl = trimEmptyHash(newUrl);\n        $location.$$parse(newUrl);\n        $location.$$state = newState;\n\n        defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n            newState, oldState).defaultPrevented;\n\n        // if the location was changed by a `$locationChangeStart` handler then stop\n        // processing this location change\n        if ($location.absUrl() !== newUrl) return;\n\n        if (defaultPrevented) {\n          $location.$$parse(oldUrl);\n          $location.$$state = oldState;\n          setBrowserUrlWithFallback(oldUrl, false, oldState);\n        } else {\n          initializing = false;\n          afterLocationChange(oldUrl, oldState);\n        }\n      });\n      if (!$rootScope.$$phase) $rootScope.$digest();\n    });\n\n    // update browser\n    $rootScope.$watch(function $locationWatch() {\n      var oldUrl = trimEmptyHash($browser.url());\n      var newUrl = trimEmptyHash($location.absUrl());\n      var oldState = $browser.state();\n      var currentReplace = $location.$$replace;\n      var urlOrStateChanged = oldUrl !== newUrl ||\n        ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);\n\n      if (initializing || urlOrStateChanged) {\n        initializing = false;\n\n        $rootScope.$evalAsync(function() {\n          var newUrl = $location.absUrl();\n          var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n              $location.$$state, oldState).defaultPrevented;\n\n          // if the location was changed by a `$locationChangeStart` handler then stop\n          // processing this location change\n          if ($location.absUrl() !== newUrl) return;\n\n          if (defaultPrevented) {\n            $location.$$parse(oldUrl);\n            $location.$$state = oldState;\n          } else {\n            if (urlOrStateChanged) {\n              setBrowserUrlWithFallback(newUrl, currentReplace,\n                                        oldState === $location.$$state ? null : $location.$$state);\n            }\n            afterLocationChange(oldUrl, oldState);\n          }\n        });\n      }\n\n      $location.$$replace = false;\n\n      // we don't need to return anything because $evalAsync will make the digest loop dirty when\n      // there is a change\n    });\n\n    return $location;\n\n    function afterLocationChange(oldUrl, oldState) {\n      $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,\n        $location.$$state, oldState);\n    }\n}];\n}\n\n/**\n * @ngdoc service\n * @name $log\n * @requires $window\n *\n * @description\n * Simple service for logging. Default implementation safely writes the message\n * into the browser's console (if present).\n *\n * The main purpose of this service is to simplify debugging and troubleshooting.\n *\n * The default is to log `debug` messages. You can use\n * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.\n *\n * @example\n   <example module=\"logExample\">\n     <file name=\"script.js\">\n       angular.module('logExample', [])\n         .controller('LogController', ['$scope', '$log', function($scope, $log) {\n           $scope.$log = $log;\n           $scope.message = 'Hello World!';\n         }]);\n     </file>\n     <file name=\"index.html\">\n       <div ng-controller=\"LogController\">\n         <p>Reload this page with open console, enter text and hit the log button...</p>\n         <label>Message:\n         <input type=\"text\" ng-model=\"message\" /></label>\n         <button ng-click=\"$log.log(message)\">log</button>\n         <button ng-click=\"$log.warn(message)\">warn</button>\n         <button ng-click=\"$log.info(message)\">info</button>\n         <button ng-click=\"$log.error(message)\">error</button>\n         <button ng-click=\"$log.debug(message)\">debug</button>\n       </div>\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc provider\n * @name $logProvider\n * @description\n * Use the `$logProvider` to configure how the application logs messages\n */\nfunction $LogProvider() {\n  var debug = true,\n      self = this;\n\n  /**\n   * @ngdoc method\n   * @name $logProvider#debugEnabled\n   * @description\n   * @param {boolean=} flag enable or disable debug level messages\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.debugEnabled = function(flag) {\n    if (isDefined(flag)) {\n      debug = flag;\n    return this;\n    } else {\n      return debug;\n    }\n  };\n\n  this.$get = ['$window', function($window) {\n    return {\n      /**\n       * @ngdoc method\n       * @name $log#log\n       *\n       * @description\n       * Write a log message\n       */\n      log: consoleLog('log'),\n\n      /**\n       * @ngdoc method\n       * @name $log#info\n       *\n       * @description\n       * Write an information message\n       */\n      info: consoleLog('info'),\n\n      /**\n       * @ngdoc method\n       * @name $log#warn\n       *\n       * @description\n       * Write a warning message\n       */\n      warn: consoleLog('warn'),\n\n      /**\n       * @ngdoc method\n       * @name $log#error\n       *\n       * @description\n       * Write an error message\n       */\n      error: consoleLog('error'),\n\n      /**\n       * @ngdoc method\n       * @name $log#debug\n       *\n       * @description\n       * Write a debug message\n       */\n      debug: (function() {\n        var fn = consoleLog('debug');\n\n        return function() {\n          if (debug) {\n            fn.apply(self, arguments);\n          }\n        };\n      }())\n    };\n\n    function formatError(arg) {\n      if (arg instanceof Error) {\n        if (arg.stack) {\n          arg = (arg.message && arg.stack.indexOf(arg.message) === -1)\n              ? 'Error: ' + arg.message + '\\n' + arg.stack\n              : arg.stack;\n        } else if (arg.sourceURL) {\n          arg = arg.message + '\\n' + arg.sourceURL + ':' + arg.line;\n        }\n      }\n      return arg;\n    }\n\n    function consoleLog(type) {\n      var console = $window.console || {},\n          logFn = console[type] || console.log || noop,\n          hasApply = false;\n\n      // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.\n      // The reason behind this is that console.log has type \"object\" in IE8...\n      try {\n        hasApply = !!logFn.apply;\n      } catch (e) {}\n\n      if (hasApply) {\n        return function() {\n          var args = [];\n          forEach(arguments, function(arg) {\n            args.push(formatError(arg));\n          });\n          return logFn.apply(console, args);\n        };\n      }\n\n      // we are IE which either doesn't have window.console => this is noop and we do nothing,\n      // or we are IE where console.log doesn't have apply so we log at least first 2 args\n      return function(arg1, arg2) {\n        logFn(arg1, arg2 == null ? '' : arg2);\n      };\n    }\n  }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $parseMinErr = minErr('$parse');\n\n// Sandboxing Angular Expressions\n// ------------------------------\n// Angular expressions are generally considered safe because these expressions only have direct\n// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by\n// obtaining a reference to native JS functions such as the Function constructor.\n//\n// As an example, consider the following Angular expression:\n//\n//   {}.toString.constructor('alert(\"evil JS code\")')\n//\n// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits\n// against the expression language, but not to prevent exploits that were enabled by exposing\n// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good\n// practice and therefore we are not even trying to protect against interaction with an object\n// explicitly exposed in this way.\n//\n// In general, it is not possible to access a Window object from an angular expression unless a\n// window or some DOM object that has a reference to window is published onto a Scope.\n// Similarly we prevent invocations of function known to be dangerous, as well as assignments to\n// native objects.\n//\n// See https://docs.angularjs.org/guide/security\n\n\nfunction ensureSafeMemberName(name, fullExpression) {\n  if (name === \"__defineGetter__\" || name === \"__defineSetter__\"\n      || name === \"__lookupGetter__\" || name === \"__lookupSetter__\"\n      || name === \"__proto__\") {\n    throw $parseMinErr('isecfld',\n        'Attempting to access a disallowed field in Angular expressions! '\n        + 'Expression: {0}', fullExpression);\n  }\n  return name;\n}\n\nfunction getStringValue(name) {\n  // Property names must be strings. This means that non-string objects cannot be used\n  // as keys in an object. Any non-string object, including a number, is typecasted\n  // into a string via the toString method.\n  // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names\n  //\n  // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it\n  // to a string. It's not always possible. If `name` is an object and its `toString` method is\n  // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown:\n  //\n  // TypeError: Cannot convert object to primitive value\n  //\n  // For performance reasons, we don't catch this error here and allow it to propagate up the call\n  // stack. Note that you'll get the same error in JavaScript if you try to access a property using\n  // such a 'broken' object as a key.\n  return name + '';\n}\n\nfunction ensureSafeObject(obj, fullExpression) {\n  // nifty check if obj is Function that is fast and works across iframes and other contexts\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n          'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isWindow(obj)\n        obj.window === obj) {\n      throw $parseMinErr('isecwindow',\n          'Referencing the Window in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isElement(obj)\n        obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {\n      throw $parseMinErr('isecdom',\n          'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// block Object so that we can't get hold of dangerous Object.* methods\n        obj === Object) {\n      throw $parseMinErr('isecobj',\n          'Referencing Object in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    }\n  }\n  return obj;\n}\n\nvar CALL = Function.prototype.call;\nvar APPLY = Function.prototype.apply;\nvar BIND = Function.prototype.bind;\n\nfunction ensureSafeFunction(obj, fullExpression) {\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n        'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    } else if (obj === CALL || obj === APPLY || obj === BIND) {\n      throw $parseMinErr('isecff',\n        'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    }\n  }\n}\n\nfunction ensureSafeAssignContext(obj, fullExpression) {\n  if (obj) {\n    if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||\n        obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {\n      throw $parseMinErr('isecaf',\n        'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);\n    }\n  }\n}\n\nvar OPERATORS = createMap();\nforEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });\nvar ESCAPE = {\"n\":\"\\n\", \"f\":\"\\f\", \"r\":\"\\r\", \"t\":\"\\t\", \"v\":\"\\v\", \"'\":\"'\", '\"':'\"'};\n\n\n/////////////////////////////////////////\n\n\n/**\n * @constructor\n */\nvar Lexer = function(options) {\n  this.options = options;\n};\n\nLexer.prototype = {\n  constructor: Lexer,\n\n  lex: function(text) {\n    this.text = text;\n    this.index = 0;\n    this.tokens = [];\n\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      if (ch === '\"' || ch === \"'\") {\n        this.readString(ch);\n      } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {\n        this.readNumber();\n      } else if (this.isIdent(ch)) {\n        this.readIdent();\n      } else if (this.is(ch, '(){}[].,;:?')) {\n        this.tokens.push({index: this.index, text: ch});\n        this.index++;\n      } else if (this.isWhitespace(ch)) {\n        this.index++;\n      } else {\n        var ch2 = ch + this.peek();\n        var ch3 = ch2 + this.peek(2);\n        var op1 = OPERATORS[ch];\n        var op2 = OPERATORS[ch2];\n        var op3 = OPERATORS[ch3];\n        if (op1 || op2 || op3) {\n          var token = op3 ? ch3 : (op2 ? ch2 : ch);\n          this.tokens.push({index: this.index, text: token, operator: true});\n          this.index += token.length;\n        } else {\n          this.throwError('Unexpected next character ', this.index, this.index + 1);\n        }\n      }\n    }\n    return this.tokens;\n  },\n\n  is: function(ch, chars) {\n    return chars.indexOf(ch) !== -1;\n  },\n\n  peek: function(i) {\n    var num = i || 1;\n    return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;\n  },\n\n  isNumber: function(ch) {\n    return ('0' <= ch && ch <= '9') && typeof ch === \"string\";\n  },\n\n  isWhitespace: function(ch) {\n    // IE treats non-breaking space as \\u00A0\n    return (ch === ' ' || ch === '\\r' || ch === '\\t' ||\n            ch === '\\n' || ch === '\\v' || ch === '\\u00A0');\n  },\n\n  isIdent: function(ch) {\n    return ('a' <= ch && ch <= 'z' ||\n            'A' <= ch && ch <= 'Z' ||\n            '_' === ch || ch === '$');\n  },\n\n  isExpOperator: function(ch) {\n    return (ch === '-' || ch === '+' || this.isNumber(ch));\n  },\n\n  throwError: function(error, start, end) {\n    end = end || this.index;\n    var colStr = (isDefined(start)\n            ? 's ' + start +  '-' + this.index + ' [' + this.text.substring(start, end) + ']'\n            : ' ' + end);\n    throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',\n        error, colStr, this.text);\n  },\n\n  readNumber: function() {\n    var number = '';\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = lowercase(this.text.charAt(this.index));\n      if (ch == '.' || this.isNumber(ch)) {\n        number += ch;\n      } else {\n        var peekCh = this.peek();\n        if (ch == 'e' && this.isExpOperator(peekCh)) {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            peekCh && this.isNumber(peekCh) &&\n            number.charAt(number.length - 1) == 'e') {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            (!peekCh || !this.isNumber(peekCh)) &&\n            number.charAt(number.length - 1) == 'e') {\n          this.throwError('Invalid exponent');\n        } else {\n          break;\n        }\n      }\n      this.index++;\n    }\n    this.tokens.push({\n      index: start,\n      text: number,\n      constant: true,\n      value: Number(number)\n    });\n  },\n\n  readIdent: function() {\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      if (!(this.isIdent(ch) || this.isNumber(ch))) {\n        break;\n      }\n      this.index++;\n    }\n    this.tokens.push({\n      index: start,\n      text: this.text.slice(start, this.index),\n      identifier: true\n    });\n  },\n\n  readString: function(quote) {\n    var start = this.index;\n    this.index++;\n    var string = '';\n    var rawString = quote;\n    var escape = false;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      rawString += ch;\n      if (escape) {\n        if (ch === 'u') {\n          var hex = this.text.substring(this.index + 1, this.index + 5);\n          if (!hex.match(/[\\da-f]{4}/i)) {\n            this.throwError('Invalid unicode escape [\\\\u' + hex + ']');\n          }\n          this.index += 4;\n          string += String.fromCharCode(parseInt(hex, 16));\n        } else {\n          var rep = ESCAPE[ch];\n          string = string + (rep || ch);\n        }\n        escape = false;\n      } else if (ch === '\\\\') {\n        escape = true;\n      } else if (ch === quote) {\n        this.index++;\n        this.tokens.push({\n          index: start,\n          text: rawString,\n          constant: true,\n          value: string\n        });\n        return;\n      } else {\n        string += ch;\n      }\n      this.index++;\n    }\n    this.throwError('Unterminated quote', start);\n  }\n};\n\nvar AST = function(lexer, options) {\n  this.lexer = lexer;\n  this.options = options;\n};\n\nAST.Program = 'Program';\nAST.ExpressionStatement = 'ExpressionStatement';\nAST.AssignmentExpression = 'AssignmentExpression';\nAST.ConditionalExpression = 'ConditionalExpression';\nAST.LogicalExpression = 'LogicalExpression';\nAST.BinaryExpression = 'BinaryExpression';\nAST.UnaryExpression = 'UnaryExpression';\nAST.CallExpression = 'CallExpression';\nAST.MemberExpression = 'MemberExpression';\nAST.Identifier = 'Identifier';\nAST.Literal = 'Literal';\nAST.ArrayExpression = 'ArrayExpression';\nAST.Property = 'Property';\nAST.ObjectExpression = 'ObjectExpression';\nAST.ThisExpression = 'ThisExpression';\nAST.LocalsExpression = 'LocalsExpression';\n\n// Internal use only\nAST.NGValueParameter = 'NGValueParameter';\n\nAST.prototype = {\n  ast: function(text) {\n    this.text = text;\n    this.tokens = this.lexer.lex(text);\n\n    var value = this.program();\n\n    if (this.tokens.length !== 0) {\n      this.throwError('is an unexpected token', this.tokens[0]);\n    }\n\n    return value;\n  },\n\n  program: function() {\n    var body = [];\n    while (true) {\n      if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))\n        body.push(this.expressionStatement());\n      if (!this.expect(';')) {\n        return { type: AST.Program, body: body};\n      }\n    }\n  },\n\n  expressionStatement: function() {\n    return { type: AST.ExpressionStatement, expression: this.filterChain() };\n  },\n\n  filterChain: function() {\n    var left = this.expression();\n    var token;\n    while ((token = this.expect('|'))) {\n      left = this.filter(left);\n    }\n    return left;\n  },\n\n  expression: function() {\n    return this.assignment();\n  },\n\n  assignment: function() {\n    var result = this.ternary();\n    if (this.expect('=')) {\n      result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};\n    }\n    return result;\n  },\n\n  ternary: function() {\n    var test = this.logicalOR();\n    var alternate;\n    var consequent;\n    if (this.expect('?')) {\n      alternate = this.expression();\n      if (this.consume(':')) {\n        consequent = this.expression();\n        return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};\n      }\n    }\n    return test;\n  },\n\n  logicalOR: function() {\n    var left = this.logicalAND();\n    while (this.expect('||')) {\n      left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };\n    }\n    return left;\n  },\n\n  logicalAND: function() {\n    var left = this.equality();\n    while (this.expect('&&')) {\n      left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};\n    }\n    return left;\n  },\n\n  equality: function() {\n    var left = this.relational();\n    var token;\n    while ((token = this.expect('==','!=','===','!=='))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };\n    }\n    return left;\n  },\n\n  relational: function() {\n    var left = this.additive();\n    var token;\n    while ((token = this.expect('<', '>', '<=', '>='))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };\n    }\n    return left;\n  },\n\n  additive: function() {\n    var left = this.multiplicative();\n    var token;\n    while ((token = this.expect('+','-'))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };\n    }\n    return left;\n  },\n\n  multiplicative: function() {\n    var left = this.unary();\n    var token;\n    while ((token = this.expect('*','/','%'))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };\n    }\n    return left;\n  },\n\n  unary: function() {\n    var token;\n    if ((token = this.expect('+', '-', '!'))) {\n      return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };\n    } else {\n      return this.primary();\n    }\n  },\n\n  primary: function() {\n    var primary;\n    if (this.expect('(')) {\n      primary = this.filterChain();\n      this.consume(')');\n    } else if (this.expect('[')) {\n      primary = this.arrayDeclaration();\n    } else if (this.expect('{')) {\n      primary = this.object();\n    } else if (this.selfReferential.hasOwnProperty(this.peek().text)) {\n      primary = copy(this.selfReferential[this.consume().text]);\n    } else if (this.options.literals.hasOwnProperty(this.peek().text)) {\n      primary = { type: AST.Literal, value: this.options.literals[this.consume().text]};\n    } else if (this.peek().identifier) {\n      primary = this.identifier();\n    } else if (this.peek().constant) {\n      primary = this.constant();\n    } else {\n      this.throwError('not a primary expression', this.peek());\n    }\n\n    var next;\n    while ((next = this.expect('(', '[', '.'))) {\n      if (next.text === '(') {\n        primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };\n        this.consume(')');\n      } else if (next.text === '[') {\n        primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };\n        this.consume(']');\n      } else if (next.text === '.') {\n        primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };\n      } else {\n        this.throwError('IMPOSSIBLE');\n      }\n    }\n    return primary;\n  },\n\n  filter: function(baseExpression) {\n    var args = [baseExpression];\n    var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};\n\n    while (this.expect(':')) {\n      args.push(this.expression());\n    }\n\n    return result;\n  },\n\n  parseArguments: function() {\n    var args = [];\n    if (this.peekToken().text !== ')') {\n      do {\n        args.push(this.expression());\n      } while (this.expect(','));\n    }\n    return args;\n  },\n\n  identifier: function() {\n    var token = this.consume();\n    if (!token.identifier) {\n      this.throwError('is not a valid identifier', token);\n    }\n    return { type: AST.Identifier, name: token.text };\n  },\n\n  constant: function() {\n    // TODO check that it is a constant\n    return { type: AST.Literal, value: this.consume().value };\n  },\n\n  arrayDeclaration: function() {\n    var elements = [];\n    if (this.peekToken().text !== ']') {\n      do {\n        if (this.peek(']')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        elements.push(this.expression());\n      } while (this.expect(','));\n    }\n    this.consume(']');\n\n    return { type: AST.ArrayExpression, elements: elements };\n  },\n\n  object: function() {\n    var properties = [], property;\n    if (this.peekToken().text !== '}') {\n      do {\n        if (this.peek('}')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        property = {type: AST.Property, kind: 'init'};\n        if (this.peek().constant) {\n          property.key = this.constant();\n        } else if (this.peek().identifier) {\n          property.key = this.identifier();\n        } else {\n          this.throwError(\"invalid key\", this.peek());\n        }\n        this.consume(':');\n        property.value = this.expression();\n        properties.push(property);\n      } while (this.expect(','));\n    }\n    this.consume('}');\n\n    return {type: AST.ObjectExpression, properties: properties };\n  },\n\n  throwError: function(msg, token) {\n    throw $parseMinErr('syntax',\n        'Syntax Error: Token \\'{0}\\' {1} at column {2} of the expression [{3}] starting at [{4}].',\n          token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));\n  },\n\n  consume: function(e1) {\n    if (this.tokens.length === 0) {\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    }\n\n    var token = this.expect(e1);\n    if (!token) {\n      this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());\n    }\n    return token;\n  },\n\n  peekToken: function() {\n    if (this.tokens.length === 0) {\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    }\n    return this.tokens[0];\n  },\n\n  peek: function(e1, e2, e3, e4) {\n    return this.peekAhead(0, e1, e2, e3, e4);\n  },\n\n  peekAhead: function(i, e1, e2, e3, e4) {\n    if (this.tokens.length > i) {\n      var token = this.tokens[i];\n      var t = token.text;\n      if (t === e1 || t === e2 || t === e3 || t === e4 ||\n          (!e1 && !e2 && !e3 && !e4)) {\n        return token;\n      }\n    }\n    return false;\n  },\n\n  expect: function(e1, e2, e3, e4) {\n    var token = this.peek(e1, e2, e3, e4);\n    if (token) {\n      this.tokens.shift();\n      return token;\n    }\n    return false;\n  },\n\n  selfReferential: {\n    'this': {type: AST.ThisExpression },\n    '$locals': {type: AST.LocalsExpression }\n  }\n};\n\nfunction ifDefined(v, d) {\n  return typeof v !== 'undefined' ? v : d;\n}\n\nfunction plusFn(l, r) {\n  if (typeof l === 'undefined') return r;\n  if (typeof r === 'undefined') return l;\n  return l + r;\n}\n\nfunction isStateless($filter, filterName) {\n  var fn = $filter(filterName);\n  return !fn.$stateful;\n}\n\nfunction findConstantAndWatchExpressions(ast, $filter) {\n  var allConstants;\n  var argsToWatch;\n  switch (ast.type) {\n  case AST.Program:\n    allConstants = true;\n    forEach(ast.body, function(expr) {\n      findConstantAndWatchExpressions(expr.expression, $filter);\n      allConstants = allConstants && expr.expression.constant;\n    });\n    ast.constant = allConstants;\n    break;\n  case AST.Literal:\n    ast.constant = true;\n    ast.toWatch = [];\n    break;\n  case AST.UnaryExpression:\n    findConstantAndWatchExpressions(ast.argument, $filter);\n    ast.constant = ast.argument.constant;\n    ast.toWatch = ast.argument.toWatch;\n    break;\n  case AST.BinaryExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);\n    break;\n  case AST.LogicalExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = ast.constant ? [] : [ast];\n    break;\n  case AST.ConditionalExpression:\n    findConstantAndWatchExpressions(ast.test, $filter);\n    findConstantAndWatchExpressions(ast.alternate, $filter);\n    findConstantAndWatchExpressions(ast.consequent, $filter);\n    ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;\n    ast.toWatch = ast.constant ? [] : [ast];\n    break;\n  case AST.Identifier:\n    ast.constant = false;\n    ast.toWatch = [ast];\n    break;\n  case AST.MemberExpression:\n    findConstantAndWatchExpressions(ast.object, $filter);\n    if (ast.computed) {\n      findConstantAndWatchExpressions(ast.property, $filter);\n    }\n    ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);\n    ast.toWatch = [ast];\n    break;\n  case AST.CallExpression:\n    allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;\n    argsToWatch = [];\n    forEach(ast.arguments, function(expr) {\n      findConstantAndWatchExpressions(expr, $filter);\n      allConstants = allConstants && expr.constant;\n      if (!expr.constant) {\n        argsToWatch.push.apply(argsToWatch, expr.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];\n    break;\n  case AST.AssignmentExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = [ast];\n    break;\n  case AST.ArrayExpression:\n    allConstants = true;\n    argsToWatch = [];\n    forEach(ast.elements, function(expr) {\n      findConstantAndWatchExpressions(expr, $filter);\n      allConstants = allConstants && expr.constant;\n      if (!expr.constant) {\n        argsToWatch.push.apply(argsToWatch, expr.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = argsToWatch;\n    break;\n  case AST.ObjectExpression:\n    allConstants = true;\n    argsToWatch = [];\n    forEach(ast.properties, function(property) {\n      findConstantAndWatchExpressions(property.value, $filter);\n      allConstants = allConstants && property.value.constant;\n      if (!property.value.constant) {\n        argsToWatch.push.apply(argsToWatch, property.value.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = argsToWatch;\n    break;\n  case AST.ThisExpression:\n    ast.constant = false;\n    ast.toWatch = [];\n    break;\n  case AST.LocalsExpression:\n    ast.constant = false;\n    ast.toWatch = [];\n    break;\n  }\n}\n\nfunction getInputs(body) {\n  if (body.length != 1) return;\n  var lastExpression = body[0].expression;\n  var candidate = lastExpression.toWatch;\n  if (candidate.length !== 1) return candidate;\n  return candidate[0] !== lastExpression ? candidate : undefined;\n}\n\nfunction isAssignable(ast) {\n  return ast.type === AST.Identifier || ast.type === AST.MemberExpression;\n}\n\nfunction assignableAST(ast) {\n  if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {\n    return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};\n  }\n}\n\nfunction isLiteral(ast) {\n  return ast.body.length === 0 ||\n      ast.body.length === 1 && (\n      ast.body[0].expression.type === AST.Literal ||\n      ast.body[0].expression.type === AST.ArrayExpression ||\n      ast.body[0].expression.type === AST.ObjectExpression);\n}\n\nfunction isConstant(ast) {\n  return ast.constant;\n}\n\nfunction ASTCompiler(astBuilder, $filter) {\n  this.astBuilder = astBuilder;\n  this.$filter = $filter;\n}\n\nASTCompiler.prototype = {\n  compile: function(expression, expensiveChecks) {\n    var self = this;\n    var ast = this.astBuilder.ast(expression);\n    this.state = {\n      nextId: 0,\n      filters: {},\n      expensiveChecks: expensiveChecks,\n      fn: {vars: [], body: [], own: {}},\n      assign: {vars: [], body: [], own: {}},\n      inputs: []\n    };\n    findConstantAndWatchExpressions(ast, self.$filter);\n    var extra = '';\n    var assignable;\n    this.stage = 'assign';\n    if ((assignable = assignableAST(ast))) {\n      this.state.computing = 'assign';\n      var result = this.nextId();\n      this.recurse(assignable, result);\n      this.return_(result);\n      extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');\n    }\n    var toWatch = getInputs(ast.body);\n    self.stage = 'inputs';\n    forEach(toWatch, function(watch, key) {\n      var fnKey = 'fn' + key;\n      self.state[fnKey] = {vars: [], body: [], own: {}};\n      self.state.computing = fnKey;\n      var intoId = self.nextId();\n      self.recurse(watch, intoId);\n      self.return_(intoId);\n      self.state.inputs.push(fnKey);\n      watch.watchId = key;\n    });\n    this.state.computing = 'fn';\n    this.stage = 'main';\n    this.recurse(ast);\n    var fnString =\n      // The build and minification steps remove the string \"use strict\" from the code, but this is done using a regex.\n      // This is a workaround for this until we do a better job at only removing the prefix only when we should.\n      '\"' + this.USE + ' ' + this.STRICT + '\";\\n' +\n      this.filterPrefix() +\n      'var fn=' + this.generateFunction('fn', 's,l,a,i') +\n      extra +\n      this.watchFns() +\n      'return fn;';\n\n    /* jshint -W054 */\n    var fn = (new Function('$filter',\n        'ensureSafeMemberName',\n        'ensureSafeObject',\n        'ensureSafeFunction',\n        'getStringValue',\n        'ensureSafeAssignContext',\n        'ifDefined',\n        'plus',\n        'text',\n        fnString))(\n          this.$filter,\n          ensureSafeMemberName,\n          ensureSafeObject,\n          ensureSafeFunction,\n          getStringValue,\n          ensureSafeAssignContext,\n          ifDefined,\n          plusFn,\n          expression);\n    /* jshint +W054 */\n    this.state = this.stage = undefined;\n    fn.literal = isLiteral(ast);\n    fn.constant = isConstant(ast);\n    return fn;\n  },\n\n  USE: 'use',\n\n  STRICT: 'strict',\n\n  watchFns: function() {\n    var result = [];\n    var fns = this.state.inputs;\n    var self = this;\n    forEach(fns, function(name) {\n      result.push('var ' + name + '=' + self.generateFunction(name, 's'));\n    });\n    if (fns.length) {\n      result.push('fn.inputs=[' + fns.join(',') + '];');\n    }\n    return result.join('');\n  },\n\n  generateFunction: function(name, params) {\n    return 'function(' + params + '){' +\n        this.varsPrefix(name) +\n        this.body(name) +\n        '};';\n  },\n\n  filterPrefix: function() {\n    var parts = [];\n    var self = this;\n    forEach(this.state.filters, function(id, filter) {\n      parts.push(id + '=$filter(' + self.escape(filter) + ')');\n    });\n    if (parts.length) return 'var ' + parts.join(',') + ';';\n    return '';\n  },\n\n  varsPrefix: function(section) {\n    return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';\n  },\n\n  body: function(section) {\n    return this.state[section].body.join('');\n  },\n\n  recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n    var left, right, self = this, args, expression;\n    recursionFn = recursionFn || noop;\n    if (!skipWatchIdCheck && isDefined(ast.watchId)) {\n      intoId = intoId || this.nextId();\n      this.if_('i',\n        this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),\n        this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)\n      );\n      return;\n    }\n    switch (ast.type) {\n    case AST.Program:\n      forEach(ast.body, function(expression, pos) {\n        self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });\n        if (pos !== ast.body.length - 1) {\n          self.current().body.push(right, ';');\n        } else {\n          self.return_(right);\n        }\n      });\n      break;\n    case AST.Literal:\n      expression = this.escape(ast.value);\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.UnaryExpression:\n      this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });\n      expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.BinaryExpression:\n      this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });\n      this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });\n      if (ast.operator === '+') {\n        expression = this.plus(left, right);\n      } else if (ast.operator === '-') {\n        expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);\n      } else {\n        expression = '(' + left + ')' + ast.operator + '(' + right + ')';\n      }\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.LogicalExpression:\n      intoId = intoId || this.nextId();\n      self.recurse(ast.left, intoId);\n      self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));\n      recursionFn(intoId);\n      break;\n    case AST.ConditionalExpression:\n      intoId = intoId || this.nextId();\n      self.recurse(ast.test, intoId);\n      self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));\n      recursionFn(intoId);\n      break;\n    case AST.Identifier:\n      intoId = intoId || this.nextId();\n      if (nameId) {\n        nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');\n        nameId.computed = false;\n        nameId.name = ast.name;\n      }\n      ensureSafeMemberName(ast.name);\n      self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),\n        function() {\n          self.if_(self.stage === 'inputs' || 's', function() {\n            if (create && create !== 1) {\n              self.if_(\n                self.not(self.nonComputedMember('s', ast.name)),\n                self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));\n            }\n            self.assign(intoId, self.nonComputedMember('s', ast.name));\n          });\n        }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))\n        );\n      if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {\n        self.addEnsureSafeObject(intoId);\n      }\n      recursionFn(intoId);\n      break;\n    case AST.MemberExpression:\n      left = nameId && (nameId.context = this.nextId()) || this.nextId();\n      intoId = intoId || this.nextId();\n      self.recurse(ast.object, left, undefined, function() {\n        self.if_(self.notNull(left), function() {\n          if (create && create !== 1) {\n            self.addEnsureSafeAssignContext(left);\n          }\n          if (ast.computed) {\n            right = self.nextId();\n            self.recurse(ast.property, right);\n            self.getStringValue(right);\n            self.addEnsureSafeMemberName(right);\n            if (create && create !== 1) {\n              self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));\n            }\n            expression = self.ensureSafeObject(self.computedMember(left, right));\n            self.assign(intoId, expression);\n            if (nameId) {\n              nameId.computed = true;\n              nameId.name = right;\n            }\n          } else {\n            ensureSafeMemberName(ast.property.name);\n            if (create && create !== 1) {\n              self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));\n            }\n            expression = self.nonComputedMember(left, ast.property.name);\n            if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {\n              expression = self.ensureSafeObject(expression);\n            }\n            self.assign(intoId, expression);\n            if (nameId) {\n              nameId.computed = false;\n              nameId.name = ast.property.name;\n            }\n          }\n        }, function() {\n          self.assign(intoId, 'undefined');\n        });\n        recursionFn(intoId);\n      }, !!create);\n      break;\n    case AST.CallExpression:\n      intoId = intoId || this.nextId();\n      if (ast.filter) {\n        right = self.filter(ast.callee.name);\n        args = [];\n        forEach(ast.arguments, function(expr) {\n          var argument = self.nextId();\n          self.recurse(expr, argument);\n          args.push(argument);\n        });\n        expression = right + '(' + args.join(',') + ')';\n        self.assign(intoId, expression);\n        recursionFn(intoId);\n      } else {\n        right = self.nextId();\n        left = {};\n        args = [];\n        self.recurse(ast.callee, right, left, function() {\n          self.if_(self.notNull(right), function() {\n            self.addEnsureSafeFunction(right);\n            forEach(ast.arguments, function(expr) {\n              self.recurse(expr, self.nextId(), undefined, function(argument) {\n                args.push(self.ensureSafeObject(argument));\n              });\n            });\n            if (left.name) {\n              if (!self.state.expensiveChecks) {\n                self.addEnsureSafeObject(left.context);\n              }\n              expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';\n            } else {\n              expression = right + '(' + args.join(',') + ')';\n            }\n            expression = self.ensureSafeObject(expression);\n            self.assign(intoId, expression);\n          }, function() {\n            self.assign(intoId, 'undefined');\n          });\n          recursionFn(intoId);\n        });\n      }\n      break;\n    case AST.AssignmentExpression:\n      right = this.nextId();\n      left = {};\n      if (!isAssignable(ast.left)) {\n        throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');\n      }\n      this.recurse(ast.left, undefined, left, function() {\n        self.if_(self.notNull(left.context), function() {\n          self.recurse(ast.right, right);\n          self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));\n          self.addEnsureSafeAssignContext(left.context);\n          expression = self.member(left.context, left.name, left.computed) + ast.operator + right;\n          self.assign(intoId, expression);\n          recursionFn(intoId || expression);\n        });\n      }, 1);\n      break;\n    case AST.ArrayExpression:\n      args = [];\n      forEach(ast.elements, function(expr) {\n        self.recurse(expr, self.nextId(), undefined, function(argument) {\n          args.push(argument);\n        });\n      });\n      expression = '[' + args.join(',') + ']';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.ObjectExpression:\n      args = [];\n      forEach(ast.properties, function(property) {\n        self.recurse(property.value, self.nextId(), undefined, function(expr) {\n          args.push(self.escape(\n              property.key.type === AST.Identifier ? property.key.name :\n                ('' + property.key.value)) +\n              ':' + expr);\n        });\n      });\n      expression = '{' + args.join(',') + '}';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.ThisExpression:\n      this.assign(intoId, 's');\n      recursionFn('s');\n      break;\n    case AST.LocalsExpression:\n      this.assign(intoId, 'l');\n      recursionFn('l');\n      break;\n    case AST.NGValueParameter:\n      this.assign(intoId, 'v');\n      recursionFn('v');\n      break;\n    }\n  },\n\n  getHasOwnProperty: function(element, property) {\n    var key = element + '.' + property;\n    var own = this.current().own;\n    if (!own.hasOwnProperty(key)) {\n      own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');\n    }\n    return own[key];\n  },\n\n  assign: function(id, value) {\n    if (!id) return;\n    this.current().body.push(id, '=', value, ';');\n    return id;\n  },\n\n  filter: function(filterName) {\n    if (!this.state.filters.hasOwnProperty(filterName)) {\n      this.state.filters[filterName] = this.nextId(true);\n    }\n    return this.state.filters[filterName];\n  },\n\n  ifDefined: function(id, defaultValue) {\n    return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';\n  },\n\n  plus: function(left, right) {\n    return 'plus(' + left + ',' + right + ')';\n  },\n\n  return_: function(id) {\n    this.current().body.push('return ', id, ';');\n  },\n\n  if_: function(test, alternate, consequent) {\n    if (test === true) {\n      alternate();\n    } else {\n      var body = this.current().body;\n      body.push('if(', test, '){');\n      alternate();\n      body.push('}');\n      if (consequent) {\n        body.push('else{');\n        consequent();\n        body.push('}');\n      }\n    }\n  },\n\n  not: function(expression) {\n    return '!(' + expression + ')';\n  },\n\n  notNull: function(expression) {\n    return expression + '!=null';\n  },\n\n  nonComputedMember: function(left, right) {\n    return left + '.' + right;\n  },\n\n  computedMember: function(left, right) {\n    return left + '[' + right + ']';\n  },\n\n  member: function(left, right, computed) {\n    if (computed) return this.computedMember(left, right);\n    return this.nonComputedMember(left, right);\n  },\n\n  addEnsureSafeObject: function(item) {\n    this.current().body.push(this.ensureSafeObject(item), ';');\n  },\n\n  addEnsureSafeMemberName: function(item) {\n    this.current().body.push(this.ensureSafeMemberName(item), ';');\n  },\n\n  addEnsureSafeFunction: function(item) {\n    this.current().body.push(this.ensureSafeFunction(item), ';');\n  },\n\n  addEnsureSafeAssignContext: function(item) {\n    this.current().body.push(this.ensureSafeAssignContext(item), ';');\n  },\n\n  ensureSafeObject: function(item) {\n    return 'ensureSafeObject(' + item + ',text)';\n  },\n\n  ensureSafeMemberName: function(item) {\n    return 'ensureSafeMemberName(' + item + ',text)';\n  },\n\n  ensureSafeFunction: function(item) {\n    return 'ensureSafeFunction(' + item + ',text)';\n  },\n\n  getStringValue: function(item) {\n    this.assign(item, 'getStringValue(' + item + ')');\n  },\n\n  ensureSafeAssignContext: function(item) {\n    return 'ensureSafeAssignContext(' + item + ',text)';\n  },\n\n  lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n    var self = this;\n    return function() {\n      self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);\n    };\n  },\n\n  lazyAssign: function(id, value) {\n    var self = this;\n    return function() {\n      self.assign(id, value);\n    };\n  },\n\n  stringEscapeRegex: /[^ a-zA-Z0-9]/g,\n\n  stringEscapeFn: function(c) {\n    return '\\\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);\n  },\n\n  escape: function(value) {\n    if (isString(value)) return \"'\" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + \"'\";\n    if (isNumber(value)) return value.toString();\n    if (value === true) return 'true';\n    if (value === false) return 'false';\n    if (value === null) return 'null';\n    if (typeof value === 'undefined') return 'undefined';\n\n    throw $parseMinErr('esc', 'IMPOSSIBLE');\n  },\n\n  nextId: function(skip, init) {\n    var id = 'v' + (this.state.nextId++);\n    if (!skip) {\n      this.current().vars.push(id + (init ? '=' + init : ''));\n    }\n    return id;\n  },\n\n  current: function() {\n    return this.state[this.state.computing];\n  }\n};\n\n\nfunction ASTInterpreter(astBuilder, $filter) {\n  this.astBuilder = astBuilder;\n  this.$filter = $filter;\n}\n\nASTInterpreter.prototype = {\n  compile: function(expression, expensiveChecks) {\n    var self = this;\n    var ast = this.astBuilder.ast(expression);\n    this.expression = expression;\n    this.expensiveChecks = expensiveChecks;\n    findConstantAndWatchExpressions(ast, self.$filter);\n    var assignable;\n    var assign;\n    if ((assignable = assignableAST(ast))) {\n      assign = this.recurse(assignable);\n    }\n    var toWatch = getInputs(ast.body);\n    var inputs;\n    if (toWatch) {\n      inputs = [];\n      forEach(toWatch, function(watch, key) {\n        var input = self.recurse(watch);\n        watch.input = input;\n        inputs.push(input);\n        watch.watchId = key;\n      });\n    }\n    var expressions = [];\n    forEach(ast.body, function(expression) {\n      expressions.push(self.recurse(expression.expression));\n    });\n    var fn = ast.body.length === 0 ? noop :\n             ast.body.length === 1 ? expressions[0] :\n             function(scope, locals) {\n               var lastValue;\n               forEach(expressions, function(exp) {\n                 lastValue = exp(scope, locals);\n               });\n               return lastValue;\n             };\n    if (assign) {\n      fn.assign = function(scope, value, locals) {\n        return assign(scope, locals, value);\n      };\n    }\n    if (inputs) {\n      fn.inputs = inputs;\n    }\n    fn.literal = isLiteral(ast);\n    fn.constant = isConstant(ast);\n    return fn;\n  },\n\n  recurse: function(ast, context, create) {\n    var left, right, self = this, args, expression;\n    if (ast.input) {\n      return this.inputs(ast.input, ast.watchId);\n    }\n    switch (ast.type) {\n    case AST.Literal:\n      return this.value(ast.value, context);\n    case AST.UnaryExpression:\n      right = this.recurse(ast.argument);\n      return this['unary' + ast.operator](right, context);\n    case AST.BinaryExpression:\n      left = this.recurse(ast.left);\n      right = this.recurse(ast.right);\n      return this['binary' + ast.operator](left, right, context);\n    case AST.LogicalExpression:\n      left = this.recurse(ast.left);\n      right = this.recurse(ast.right);\n      return this['binary' + ast.operator](left, right, context);\n    case AST.ConditionalExpression:\n      return this['ternary?:'](\n        this.recurse(ast.test),\n        this.recurse(ast.alternate),\n        this.recurse(ast.consequent),\n        context\n      );\n    case AST.Identifier:\n      ensureSafeMemberName(ast.name, self.expression);\n      return self.identifier(ast.name,\n                             self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),\n                             context, create, self.expression);\n    case AST.MemberExpression:\n      left = this.recurse(ast.object, false, !!create);\n      if (!ast.computed) {\n        ensureSafeMemberName(ast.property.name, self.expression);\n        right = ast.property.name;\n      }\n      if (ast.computed) right = this.recurse(ast.property);\n      return ast.computed ?\n        this.computedMember(left, right, context, create, self.expression) :\n        this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);\n    case AST.CallExpression:\n      args = [];\n      forEach(ast.arguments, function(expr) {\n        args.push(self.recurse(expr));\n      });\n      if (ast.filter) right = this.$filter(ast.callee.name);\n      if (!ast.filter) right = this.recurse(ast.callee, true);\n      return ast.filter ?\n        function(scope, locals, assign, inputs) {\n          var values = [];\n          for (var i = 0; i < args.length; ++i) {\n            values.push(args[i](scope, locals, assign, inputs));\n          }\n          var value = right.apply(undefined, values, inputs);\n          return context ? {context: undefined, name: undefined, value: value} : value;\n        } :\n        function(scope, locals, assign, inputs) {\n          var rhs = right(scope, locals, assign, inputs);\n          var value;\n          if (rhs.value != null) {\n            ensureSafeObject(rhs.context, self.expression);\n            ensureSafeFunction(rhs.value, self.expression);\n            var values = [];\n            for (var i = 0; i < args.length; ++i) {\n              values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));\n            }\n            value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);\n          }\n          return context ? {value: value} : value;\n        };\n    case AST.AssignmentExpression:\n      left = this.recurse(ast.left, true, 1);\n      right = this.recurse(ast.right);\n      return function(scope, locals, assign, inputs) {\n        var lhs = left(scope, locals, assign, inputs);\n        var rhs = right(scope, locals, assign, inputs);\n        ensureSafeObject(lhs.value, self.expression);\n        ensureSafeAssignContext(lhs.context);\n        lhs.context[lhs.name] = rhs;\n        return context ? {value: rhs} : rhs;\n      };\n    case AST.ArrayExpression:\n      args = [];\n      forEach(ast.elements, function(expr) {\n        args.push(self.recurse(expr));\n      });\n      return function(scope, locals, assign, inputs) {\n        var value = [];\n        for (var i = 0; i < args.length; ++i) {\n          value.push(args[i](scope, locals, assign, inputs));\n        }\n        return context ? {value: value} : value;\n      };\n    case AST.ObjectExpression:\n      args = [];\n      forEach(ast.properties, function(property) {\n        args.push({key: property.key.type === AST.Identifier ?\n                        property.key.name :\n                        ('' + property.key.value),\n                   value: self.recurse(property.value)\n        });\n      });\n      return function(scope, locals, assign, inputs) {\n        var value = {};\n        for (var i = 0; i < args.length; ++i) {\n          value[args[i].key] = args[i].value(scope, locals, assign, inputs);\n        }\n        return context ? {value: value} : value;\n      };\n    case AST.ThisExpression:\n      return function(scope) {\n        return context ? {value: scope} : scope;\n      };\n    case AST.LocalsExpression:\n      return function(scope, locals) {\n        return context ? {value: locals} : locals;\n      };\n    case AST.NGValueParameter:\n      return function(scope, locals, assign) {\n        return context ? {value: assign} : assign;\n      };\n    }\n  },\n\n  'unary+': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = argument(scope, locals, assign, inputs);\n      if (isDefined(arg)) {\n        arg = +arg;\n      } else {\n        arg = 0;\n      }\n      return context ? {value: arg} : arg;\n    };\n  },\n  'unary-': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = argument(scope, locals, assign, inputs);\n      if (isDefined(arg)) {\n        arg = -arg;\n      } else {\n        arg = 0;\n      }\n      return context ? {value: arg} : arg;\n    };\n  },\n  'unary!': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = !argument(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary+': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs = right(scope, locals, assign, inputs);\n      var arg = plusFn(lhs, rhs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary-': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs = right(scope, locals, assign, inputs);\n      var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary*': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary/': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary%': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary===': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary!==': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary==': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary!=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary<': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary>': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary<=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary>=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary&&': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary||': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'ternary?:': function(test, alternate, consequent, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  value: function(value, context) {\n    return function() { return context ? {context: undefined, name: undefined, value: value} : value; };\n  },\n  identifier: function(name, expensiveChecks, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var base = locals && (name in locals) ? locals : scope;\n      if (create && create !== 1 && base && !(base[name])) {\n        base[name] = {};\n      }\n      var value = base ? base[name] : undefined;\n      if (expensiveChecks) {\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: base, name: name, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  computedMember: function(left, right, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs;\n      var value;\n      if (lhs != null) {\n        rhs = right(scope, locals, assign, inputs);\n        rhs = getStringValue(rhs);\n        ensureSafeMemberName(rhs, expression);\n        if (create && create !== 1) {\n          ensureSafeAssignContext(lhs);\n          if (lhs && !(lhs[rhs])) {\n            lhs[rhs] = {};\n          }\n        }\n        value = lhs[rhs];\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: lhs, name: rhs, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      if (create && create !== 1) {\n        ensureSafeAssignContext(lhs);\n        if (lhs && !(lhs[right])) {\n          lhs[right] = {};\n        }\n      }\n      var value = lhs != null ? lhs[right] : undefined;\n      if (expensiveChecks || isPossiblyDangerousMemberName(right)) {\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: lhs, name: right, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  inputs: function(input, watchId) {\n    return function(scope, value, locals, inputs) {\n      if (inputs) return inputs[watchId];\n      return input(scope, value, locals);\n    };\n  }\n};\n\n/**\n * @constructor\n */\nvar Parser = function(lexer, $filter, options) {\n  this.lexer = lexer;\n  this.$filter = $filter;\n  this.options = options;\n  this.ast = new AST(lexer, options);\n  this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :\n                                   new ASTCompiler(this.ast, $filter);\n};\n\nParser.prototype = {\n  constructor: Parser,\n\n  parse: function(text) {\n    return this.astCompiler.compile(text, this.options.expensiveChecks);\n  }\n};\n\nfunction isPossiblyDangerousMemberName(name) {\n  return name == 'constructor';\n}\n\nvar objectValueOf = Object.prototype.valueOf;\n\nfunction getValueOf(value) {\n  return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);\n}\n\n///////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $parse\n * @kind function\n *\n * @description\n *\n * Converts Angular {@link guide/expression expression} into a function.\n *\n * ```js\n *   var getter = $parse('user.name');\n *   var setter = getter.assign;\n *   var context = {user:{name:'angular'}};\n *   var locals = {user:{name:'local'}};\n *\n *   expect(getter(context)).toEqual('angular');\n *   setter(context, 'newValue');\n *   expect(context.user.name).toEqual('newValue');\n *   expect(getter(context, locals)).toEqual('local');\n * ```\n *\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n *      are evaluated against (typically a scope object).\n *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n *      `context`.\n *\n *    The returned function also has the following properties:\n *      * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript\n *        literal.\n *      * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript\n *        constant literals.\n *      * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be\n *        set to a function to change its value on the given context.\n *\n */\n\n\n/**\n * @ngdoc provider\n * @name $parseProvider\n *\n * @description\n * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}\n *  service.\n */\nfunction $ParseProvider() {\n  var cacheDefault = createMap();\n  var cacheExpensive = createMap();\n  var literals = {\n    'true': true,\n    'false': false,\n    'null': null,\n    'undefined': undefined\n  };\n\n  /**\n   * @ngdoc method\n   * @name $parseProvider#addLiteral\n   * @description\n   *\n   * Configure $parse service to add literal values that will be present as literal at expressions.\n   *\n   * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.\n   * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.\n   *\n   **/\n  this.addLiteral = function(literalName, literalValue) {\n    literals[literalName] = literalValue;\n  };\n\n  this.$get = ['$filter', function($filter) {\n    var noUnsafeEval = csp().noUnsafeEval;\n    var $parseOptions = {\n          csp: noUnsafeEval,\n          expensiveChecks: false,\n          literals: copy(literals)\n        },\n        $parseOptionsExpensive = {\n          csp: noUnsafeEval,\n          expensiveChecks: true,\n          literals: copy(literals)\n        };\n    var runningChecksEnabled = false;\n\n    $parse.$$runningExpensiveChecks = function() {\n      return runningChecksEnabled;\n    };\n\n    return $parse;\n\n    function $parse(exp, interceptorFn, expensiveChecks) {\n      var parsedExpression, oneTime, cacheKey;\n\n      expensiveChecks = expensiveChecks || runningChecksEnabled;\n\n      switch (typeof exp) {\n        case 'string':\n          exp = exp.trim();\n          cacheKey = exp;\n\n          var cache = (expensiveChecks ? cacheExpensive : cacheDefault);\n          parsedExpression = cache[cacheKey];\n\n          if (!parsedExpression) {\n            if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {\n              oneTime = true;\n              exp = exp.substring(2);\n            }\n            var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;\n            var lexer = new Lexer(parseOptions);\n            var parser = new Parser(lexer, $filter, parseOptions);\n            parsedExpression = parser.parse(exp);\n            if (parsedExpression.constant) {\n              parsedExpression.$$watchDelegate = constantWatchDelegate;\n            } else if (oneTime) {\n              parsedExpression.$$watchDelegate = parsedExpression.literal ?\n                  oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;\n            } else if (parsedExpression.inputs) {\n              parsedExpression.$$watchDelegate = inputsWatchDelegate;\n            }\n            if (expensiveChecks) {\n              parsedExpression = expensiveChecksInterceptor(parsedExpression);\n            }\n            cache[cacheKey] = parsedExpression;\n          }\n          return addInterceptor(parsedExpression, interceptorFn);\n\n        case 'function':\n          return addInterceptor(exp, interceptorFn);\n\n        default:\n          return addInterceptor(noop, interceptorFn);\n      }\n    }\n\n    function expensiveChecksInterceptor(fn) {\n      if (!fn) return fn;\n      expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;\n      expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);\n      expensiveCheckFn.constant = fn.constant;\n      expensiveCheckFn.literal = fn.literal;\n      for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {\n        fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);\n      }\n      expensiveCheckFn.inputs = fn.inputs;\n\n      return expensiveCheckFn;\n\n      function expensiveCheckFn(scope, locals, assign, inputs) {\n        var expensiveCheckOldValue = runningChecksEnabled;\n        runningChecksEnabled = true;\n        try {\n          return fn(scope, locals, assign, inputs);\n        } finally {\n          runningChecksEnabled = expensiveCheckOldValue;\n        }\n      }\n    }\n\n    function expressionInputDirtyCheck(newValue, oldValueOfValue) {\n\n      if (newValue == null || oldValueOfValue == null) { // null/undefined\n        return newValue === oldValueOfValue;\n      }\n\n      if (typeof newValue === 'object') {\n\n        // attempt to convert the value to a primitive type\n        // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can\n        //             be cheaply dirty-checked\n        newValue = getValueOf(newValue);\n\n        if (typeof newValue === 'object') {\n          // objects/arrays are not supported - deep-watching them would be too expensive\n          return false;\n        }\n\n        // fall-through to the primitive equality check\n      }\n\n      //Primitive or NaN\n      return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);\n    }\n\n    function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {\n      var inputExpressions = parsedExpression.inputs;\n      var lastResult;\n\n      if (inputExpressions.length === 1) {\n        var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails\n        inputExpressions = inputExpressions[0];\n        return scope.$watch(function expressionInputWatch(scope) {\n          var newInputValue = inputExpressions(scope);\n          if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {\n            lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);\n            oldInputValueOf = newInputValue && getValueOf(newInputValue);\n          }\n          return lastResult;\n        }, listener, objectEquality, prettyPrintExpression);\n      }\n\n      var oldInputValueOfValues = [];\n      var oldInputValues = [];\n      for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n        oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails\n        oldInputValues[i] = null;\n      }\n\n      return scope.$watch(function expressionInputsWatch(scope) {\n        var changed = false;\n\n        for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n          var newInputValue = inputExpressions[i](scope);\n          if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {\n            oldInputValues[i] = newInputValue;\n            oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);\n          }\n        }\n\n        if (changed) {\n          lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);\n        }\n\n        return lastResult;\n      }, listener, objectEquality, prettyPrintExpression);\n    }\n\n    function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch, lastValue;\n      return unwatch = scope.$watch(function oneTimeWatch(scope) {\n        return parsedExpression(scope);\n      }, function oneTimeListener(value, old, scope) {\n        lastValue = value;\n        if (isFunction(listener)) {\n          listener.apply(this, arguments);\n        }\n        if (isDefined(value)) {\n          scope.$$postDigest(function() {\n            if (isDefined(lastValue)) {\n              unwatch();\n            }\n          });\n        }\n      }, objectEquality);\n    }\n\n    function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch, lastValue;\n      return unwatch = scope.$watch(function oneTimeWatch(scope) {\n        return parsedExpression(scope);\n      }, function oneTimeListener(value, old, scope) {\n        lastValue = value;\n        if (isFunction(listener)) {\n          listener.call(this, value, old, scope);\n        }\n        if (isAllDefined(value)) {\n          scope.$$postDigest(function() {\n            if (isAllDefined(lastValue)) unwatch();\n          });\n        }\n      }, objectEquality);\n\n      function isAllDefined(value) {\n        var allDefined = true;\n        forEach(value, function(val) {\n          if (!isDefined(val)) allDefined = false;\n        });\n        return allDefined;\n      }\n    }\n\n    function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch;\n      return unwatch = scope.$watch(function constantWatch(scope) {\n        unwatch();\n        return parsedExpression(scope);\n      }, listener, objectEquality);\n    }\n\n    function addInterceptor(parsedExpression, interceptorFn) {\n      if (!interceptorFn) return parsedExpression;\n      var watchDelegate = parsedExpression.$$watchDelegate;\n      var useInputs = false;\n\n      var regularWatch =\n          watchDelegate !== oneTimeLiteralWatchDelegate &&\n          watchDelegate !== oneTimeWatchDelegate;\n\n      var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {\n        var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);\n        return interceptorFn(value, scope, locals);\n      } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {\n        var value = parsedExpression(scope, locals, assign, inputs);\n        var result = interceptorFn(value, scope, locals);\n        // we only return the interceptor's result if the\n        // initial value is defined (for bind-once)\n        return isDefined(value) ? result : value;\n      };\n\n      // Propagate $$watchDelegates other then inputsWatchDelegate\n      if (parsedExpression.$$watchDelegate &&\n          parsedExpression.$$watchDelegate !== inputsWatchDelegate) {\n        fn.$$watchDelegate = parsedExpression.$$watchDelegate;\n      } else if (!interceptorFn.$stateful) {\n        // If there is an interceptor, but no watchDelegate then treat the interceptor like\n        // we treat filters - it is assumed to be a pure function unless flagged with $stateful\n        fn.$$watchDelegate = inputsWatchDelegate;\n        useInputs = !parsedExpression.inputs;\n        fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];\n      }\n\n      return fn;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $q\n * @requires $rootScope\n *\n * @description\n * A service that helps you run functions asynchronously, and use their return values (or exceptions)\n * when they are done processing.\n *\n * This is an implementation of promises/deferred objects inspired by\n * [Kris Kowal's Q](https://github.com/kriskowal/q).\n *\n * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred\n * implementations, and the other which resembles ES6 (ES2015) promises to some degree.\n *\n * # $q constructor\n *\n * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`\n * function as the first argument. This is similar to the native Promise implementation from ES6,\n * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n *\n * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are\n * available yet.\n *\n * It can be used like so:\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     // perform some asynchronous operation, resolve or reject the promise when appropriate.\n *     return $q(function(resolve, reject) {\n *       setTimeout(function() {\n *         if (okToGreet(name)) {\n *           resolve('Hello, ' + name + '!');\n *         } else {\n *           reject('Greeting ' + name + ' is not allowed.');\n *         }\n *       }, 1000);\n *     });\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   });\n * ```\n *\n * Note: progress/notify callbacks are not currently supported via the ES6-style interface.\n *\n * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.\n *\n * However, the more traditional CommonJS-style usage is still available, and documented below.\n *\n * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an\n * interface for interacting with an object that represents the result of an action that is\n * performed asynchronously, and may or may not be finished at any given point in time.\n *\n * From the perspective of dealing with error handling, deferred and promise APIs are to\n * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     var deferred = $q.defer();\n *\n *     setTimeout(function() {\n *       deferred.notify('About to greet ' + name + '.');\n *\n *       if (okToGreet(name)) {\n *         deferred.resolve('Hello, ' + name + '!');\n *       } else {\n *         deferred.reject('Greeting ' + name + ' is not allowed.');\n *       }\n *     }, 1000);\n *\n *     return deferred.promise;\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   }, function(update) {\n *     alert('Got notification: ' + update);\n *   });\n * ```\n *\n * At first it might not be obvious why this extra complexity is worth the trouble. The payoff\n * comes in the way of guarantees that promise and deferred APIs make, see\n * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.\n *\n * Additionally the promise api allows for composition that is very hard to do with the\n * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.\n * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the\n * section on serial or parallel joining of promises.\n *\n * # The Deferred API\n *\n * A new instance of deferred is constructed by calling `$q.defer()`.\n *\n * The purpose of the deferred object is to expose the associated Promise instance as well as APIs\n * that can be used for signaling the successful or unsuccessful completion, as well as the status\n * of the task.\n *\n * **Methods**\n *\n * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection\n *   constructed via `$q.reject`, the promise will be rejected instead.\n * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to\n *   resolving it with a rejection constructed via `$q.reject`.\n * - `notify(value)` - provides updates on the status of the promise's execution. This may be called\n *   multiple times before the promise is either resolved or rejected.\n *\n * **Properties**\n *\n * - promise – `{Promise}` – promise object associated with this deferred.\n *\n *\n * # The Promise API\n *\n * A new promise instance is created when a deferred instance is created and can be retrieved by\n * calling `deferred.promise`.\n *\n * The purpose of the promise object is to allow for interested parties to get access to the result\n * of the deferred task when it completes.\n *\n * **Methods**\n *\n * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or\n *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously\n *   as soon as the result is available. The callbacks are called with a single argument: the result\n *   or rejection reason. Additionally, the notify callback may be called zero or more times to\n *   provide a progress indication, before the promise is resolved or rejected.\n *\n *   This method *returns a new promise* which is resolved or rejected via the return value of the\n *   `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved\n *   with the value which is resolved in that promise using\n *   [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).\n *   It also notifies via the return value of the `notifyCallback` method. The promise cannot be\n *   resolved or rejected from the notifyCallback method.\n *\n * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`\n *\n * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,\n *   but to do so without modifying the final value. This is useful to release resources or do some\n *   clean-up that needs to be done whether the promise was rejected or resolved. See the [full\n *   specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for\n *   more information.\n *\n * # Chaining promises\n *\n * Because calling the `then` method of a promise returns a new derived promise, it is easily\n * possible to create a chain of promises:\n *\n * ```js\n *   promiseB = promiseA.then(function(result) {\n *     return result + 1;\n *   });\n *\n *   // promiseB will be resolved immediately after promiseA is resolved and its value\n *   // will be the result of promiseA incremented by 1\n * ```\n *\n * It is possible to create chains of any length and since a promise can be resolved with another\n * promise (which will defer its resolution further), it is possible to pause/defer resolution of\n * the promises at any point in the chain. This makes it possible to implement powerful APIs like\n * $http's response interceptors.\n *\n *\n * # Differences between Kris Kowal's Q and $q\n *\n *  There are two main differences:\n *\n * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation\n *   mechanism in angular, which means faster propagation of resolution or rejection into your\n *   models and avoiding unnecessary browser repaints, which would result in flickering UI.\n * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains\n *   all the important functionality needed for common async tasks.\n *\n * # Testing\n *\n *  ```js\n *    it('should simulate promise', inject(function($q, $rootScope) {\n *      var deferred = $q.defer();\n *      var promise = deferred.promise;\n *      var resolvedValue;\n *\n *      promise.then(function(value) { resolvedValue = value; });\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Simulate resolving of promise\n *      deferred.resolve(123);\n *      // Note that the 'then' function does not get called synchronously.\n *      // This is because we want the promise API to always be async, whether or not\n *      // it got called synchronously or asynchronously.\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Propagate promise resolution to 'then' functions using $apply().\n *      $rootScope.$apply();\n *      expect(resolvedValue).toEqual(123);\n *    }));\n *  ```\n *\n * @param {function(function, function)} resolver Function which is responsible for resolving or\n *   rejecting the newly created promise. The first parameter is a function which resolves the\n *   promise, the second parameter is a function which rejects the promise.\n *\n * @returns {Promise} The newly created promise.\n */\nfunction $QProvider() {\n\n  this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $rootScope.$evalAsync(callback);\n    }, $exceptionHandler);\n  }];\n}\n\nfunction $$QProvider() {\n  this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $browser.defer(callback);\n    }, $exceptionHandler);\n  }];\n}\n\n/**\n * Constructs a promise manager.\n *\n * @param {function(function)} nextTick Function for executing functions in the next turn.\n * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for\n *     debugging purposes.\n * @returns {object} Promise manager.\n */\nfunction qFactory(nextTick, exceptionHandler) {\n  var $qMinErr = minErr('$q', TypeError);\n\n  /**\n   * @ngdoc method\n   * @name ng.$q#defer\n   * @kind function\n   *\n   * @description\n   * Creates a `Deferred` object which represents a task which will finish in the future.\n   *\n   * @returns {Deferred} Returns a new instance of deferred.\n   */\n  var defer = function() {\n    var d = new Deferred();\n    //Necessary to support unbound execution :/\n    d.resolve = simpleBind(d, d.resolve);\n    d.reject = simpleBind(d, d.reject);\n    d.notify = simpleBind(d, d.notify);\n    return d;\n  };\n\n  function Promise() {\n    this.$$state = { status: 0 };\n  }\n\n  extend(Promise.prototype, {\n    then: function(onFulfilled, onRejected, progressBack) {\n      if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {\n        return this;\n      }\n      var result = new Deferred();\n\n      this.$$state.pending = this.$$state.pending || [];\n      this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);\n      if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);\n\n      return result.promise;\n    },\n\n    \"catch\": function(callback) {\n      return this.then(null, callback);\n    },\n\n    \"finally\": function(callback, progressBack) {\n      return this.then(function(value) {\n        return handleCallback(value, true, callback);\n      }, function(error) {\n        return handleCallback(error, false, callback);\n      }, progressBack);\n    }\n  });\n\n  //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native\n  function simpleBind(context, fn) {\n    return function(value) {\n      fn.call(context, value);\n    };\n  }\n\n  function processQueue(state) {\n    var fn, deferred, pending;\n\n    pending = state.pending;\n    state.processScheduled = false;\n    state.pending = undefined;\n    for (var i = 0, ii = pending.length; i < ii; ++i) {\n      deferred = pending[i][0];\n      fn = pending[i][state.status];\n      try {\n        if (isFunction(fn)) {\n          deferred.resolve(fn(state.value));\n        } else if (state.status === 1) {\n          deferred.resolve(state.value);\n        } else {\n          deferred.reject(state.value);\n        }\n      } catch (e) {\n        deferred.reject(e);\n        exceptionHandler(e);\n      }\n    }\n  }\n\n  function scheduleProcessQueue(state) {\n    if (state.processScheduled || !state.pending) return;\n    state.processScheduled = true;\n    nextTick(function() { processQueue(state); });\n  }\n\n  function Deferred() {\n    this.promise = new Promise();\n  }\n\n  extend(Deferred.prototype, {\n    resolve: function(val) {\n      if (this.promise.$$state.status) return;\n      if (val === this.promise) {\n        this.$$reject($qMinErr(\n          'qcycle',\n          \"Expected promise to be resolved with value other than itself '{0}'\",\n          val));\n      } else {\n        this.$$resolve(val);\n      }\n\n    },\n\n    $$resolve: function(val) {\n      var then;\n      var that = this;\n      var done = false;\n      try {\n        if ((isObject(val) || isFunction(val))) then = val && val.then;\n        if (isFunction(then)) {\n          this.promise.$$state.status = -1;\n          then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));\n        } else {\n          this.promise.$$state.value = val;\n          this.promise.$$state.status = 1;\n          scheduleProcessQueue(this.promise.$$state);\n        }\n      } catch (e) {\n        rejectPromise(e);\n        exceptionHandler(e);\n      }\n\n      function resolvePromise(val) {\n        if (done) return;\n        done = true;\n        that.$$resolve(val);\n      }\n      function rejectPromise(val) {\n        if (done) return;\n        done = true;\n        that.$$reject(val);\n      }\n    },\n\n    reject: function(reason) {\n      if (this.promise.$$state.status) return;\n      this.$$reject(reason);\n    },\n\n    $$reject: function(reason) {\n      this.promise.$$state.value = reason;\n      this.promise.$$state.status = 2;\n      scheduleProcessQueue(this.promise.$$state);\n    },\n\n    notify: function(progress) {\n      var callbacks = this.promise.$$state.pending;\n\n      if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {\n        nextTick(function() {\n          var callback, result;\n          for (var i = 0, ii = callbacks.length; i < ii; i++) {\n            result = callbacks[i][0];\n            callback = callbacks[i][3];\n            try {\n              result.notify(isFunction(callback) ? callback(progress) : progress);\n            } catch (e) {\n              exceptionHandler(e);\n            }\n          }\n        });\n      }\n    }\n  });\n\n  /**\n   * @ngdoc method\n   * @name $q#reject\n   * @kind function\n   *\n   * @description\n   * Creates a promise that is resolved as rejected with the specified `reason`. This api should be\n   * used to forward rejection in a chain of promises. If you are dealing with the last promise in\n   * a promise chain, you don't need to worry about it.\n   *\n   * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of\n   * `reject` as the `throw` keyword in JavaScript. This also means that if you \"catch\" an error via\n   * a promise error callback and you want to forward the error to the promise derived from the\n   * current promise, you have to \"rethrow\" the error by returning a rejection constructed via\n   * `reject`.\n   *\n   * ```js\n   *   promiseB = promiseA.then(function(result) {\n   *     // success: do something and resolve promiseB\n   *     //          with the old or a new result\n   *     return result;\n   *   }, function(reason) {\n   *     // error: handle the error if possible and\n   *     //        resolve promiseB with newPromiseOrValue,\n   *     //        otherwise forward the rejection to promiseB\n   *     if (canHandle(reason)) {\n   *      // handle the error and recover\n   *      return newPromiseOrValue;\n   *     }\n   *     return $q.reject(reason);\n   *   });\n   * ```\n   *\n   * @param {*} reason Constant, message, exception or an object representing the rejection reason.\n   * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.\n   */\n  var reject = function(reason) {\n    var result = new Deferred();\n    result.reject(reason);\n    return result.promise;\n  };\n\n  var makePromise = function makePromise(value, resolved) {\n    var result = new Deferred();\n    if (resolved) {\n      result.resolve(value);\n    } else {\n      result.reject(value);\n    }\n    return result.promise;\n  };\n\n  var handleCallback = function handleCallback(value, isResolved, callback) {\n    var callbackOutput = null;\n    try {\n      if (isFunction(callback)) callbackOutput = callback();\n    } catch (e) {\n      return makePromise(e, false);\n    }\n    if (isPromiseLike(callbackOutput)) {\n      return callbackOutput.then(function() {\n        return makePromise(value, isResolved);\n      }, function(error) {\n        return makePromise(error, false);\n      });\n    } else {\n      return makePromise(value, isResolved);\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $q#when\n   * @kind function\n   *\n   * @description\n   * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.\n   * This is useful when you are dealing with an object that might or might not be a promise, or if\n   * the promise comes from a source that can't be trusted.\n   *\n   * @param {*} value Value or a promise\n   * @param {Function=} successCallback\n   * @param {Function=} errorCallback\n   * @param {Function=} progressCallback\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n\n\n  var when = function(value, callback, errback, progressBack) {\n    var result = new Deferred();\n    result.resolve(value);\n    return result.promise.then(callback, errback, progressBack);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $q#resolve\n   * @kind function\n   *\n   * @description\n   * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.\n   *\n   * @param {*} value Value or a promise\n   * @param {Function=} successCallback\n   * @param {Function=} errorCallback\n   * @param {Function=} progressCallback\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n  var resolve = when;\n\n  /**\n   * @ngdoc method\n   * @name $q#all\n   * @kind function\n   *\n   * @description\n   * Combines multiple promises into a single promise that is resolved when all of the input\n   * promises are resolved.\n   *\n   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.\n   * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,\n   *   each value corresponding to the promise at the same index/key in the `promises` array/hash.\n   *   If any of the promises is resolved with a rejection, this resulting promise will be rejected\n   *   with the same rejection value.\n   */\n\n  function all(promises) {\n    var deferred = new Deferred(),\n        counter = 0,\n        results = isArray(promises) ? [] : {};\n\n    forEach(promises, function(promise, key) {\n      counter++;\n      when(promise).then(function(value) {\n        if (results.hasOwnProperty(key)) return;\n        results[key] = value;\n        if (!(--counter)) deferred.resolve(results);\n      }, function(reason) {\n        if (results.hasOwnProperty(key)) return;\n        deferred.reject(reason);\n      });\n    });\n\n    if (counter === 0) {\n      deferred.resolve(results);\n    }\n\n    return deferred.promise;\n  }\n\n  var $Q = function Q(resolver) {\n    if (!isFunction(resolver)) {\n      throw $qMinErr('norslvr', \"Expected resolverFn, got '{0}'\", resolver);\n    }\n\n    var deferred = new Deferred();\n\n    function resolveFn(value) {\n      deferred.resolve(value);\n    }\n\n    function rejectFn(reason) {\n      deferred.reject(reason);\n    }\n\n    resolver(resolveFn, rejectFn);\n\n    return deferred.promise;\n  };\n\n  // Let's make the instanceof operator work for promises, so that\n  // `new $q(fn) instanceof $q` would evaluate to true.\n  $Q.prototype = Promise.prototype;\n\n  $Q.defer = defer;\n  $Q.reject = reject;\n  $Q.when = when;\n  $Q.resolve = resolve;\n  $Q.all = all;\n\n  return $Q;\n}\n\nfunction $$RAFProvider() { //rAF\n  this.$get = ['$window', '$timeout', function($window, $timeout) {\n    var requestAnimationFrame = $window.requestAnimationFrame ||\n                                $window.webkitRequestAnimationFrame;\n\n    var cancelAnimationFrame = $window.cancelAnimationFrame ||\n                               $window.webkitCancelAnimationFrame ||\n                               $window.webkitCancelRequestAnimationFrame;\n\n    var rafSupported = !!requestAnimationFrame;\n    var raf = rafSupported\n      ? function(fn) {\n          var id = requestAnimationFrame(fn);\n          return function() {\n            cancelAnimationFrame(id);\n          };\n        }\n      : function(fn) {\n          var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666\n          return function() {\n            $timeout.cancel(timer);\n          };\n        };\n\n    raf.supported = rafSupported;\n\n    return raf;\n  }];\n}\n\n/**\n * DESIGN NOTES\n *\n * The design decisions behind the scope are heavily favored for speed and memory consumption.\n *\n * The typical use of scope is to watch the expressions, which most of the time return the same\n * value as last time so we optimize the operation.\n *\n * Closures construction is expensive in terms of speed as well as memory:\n *   - No closures, instead use prototypical inheritance for API\n *   - Internal state needs to be stored on scope directly, which means that private state is\n *     exposed as $$____ properties\n *\n * Loop operations are optimized by using while(count--) { ... }\n *   - This means that in order to keep the same order of execution as addition we have to add\n *     items to the array at the beginning (unshift) instead of at the end (push)\n *\n * Child scopes are created and removed often\n *   - Using an array would be slow since inserts in the middle are expensive; so we use linked lists\n *\n * There are fewer watches than observers. This is why you don't want the observer to be implemented\n * in the same way as watch. Watch requires return of the initialization function which is expensive\n * to construct.\n */\n\n\n/**\n * @ngdoc provider\n * @name $rootScopeProvider\n * @description\n *\n * Provider for the $rootScope service.\n */\n\n/**\n * @ngdoc method\n * @name $rootScopeProvider#digestTtl\n * @description\n *\n * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and\n * assuming that the model is unstable.\n *\n * The current default is 10 iterations.\n *\n * In complex applications it's possible that the dependencies between `$watch`s will result in\n * several digest iterations. However if an application needs more than the default 10 digest\n * iterations for its model to stabilize then you should investigate what is causing the model to\n * continuously change during the digest.\n *\n * Increasing the TTL could have performance implications, so you should not change it without\n * proper justification.\n *\n * @param {number} limit The number of digest iterations.\n */\n\n\n/**\n * @ngdoc service\n * @name $rootScope\n * @description\n *\n * Every application has a single root {@link ng.$rootScope.Scope scope}.\n * All other scopes are descendant scopes of the root scope. Scopes provide separation\n * between the model and the view, via a mechanism for watching the model for changes.\n * They also provide event emission/broadcast and subscription facility. See the\n * {@link guide/scope developer guide on scopes}.\n */\nfunction $RootScopeProvider() {\n  var TTL = 10;\n  var $rootScopeMinErr = minErr('$rootScope');\n  var lastDirtyWatch = null;\n  var applyAsyncId = null;\n\n  this.digestTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n    }\n    return TTL;\n  };\n\n  function createChildScopeClass(parent) {\n    function ChildScope() {\n      this.$$watchers = this.$$nextSibling =\n          this.$$childHead = this.$$childTail = null;\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$watchersCount = 0;\n      this.$id = nextUid();\n      this.$$ChildScope = null;\n    }\n    ChildScope.prototype = parent;\n    return ChildScope;\n  }\n\n  this.$get = ['$exceptionHandler', '$parse', '$browser',\n      function($exceptionHandler, $parse, $browser) {\n\n    function destroyChildScope($event) {\n        $event.currentScope.$$destroyed = true;\n    }\n\n    function cleanUpScope($scope) {\n\n      if (msie === 9) {\n        // There is a memory leak in IE9 if all child scopes are not disconnected\n        // completely when a scope is destroyed. So this code will recurse up through\n        // all this scopes children\n        //\n        // See issue https://github.com/angular/angular.js/issues/10706\n        $scope.$$childHead && cleanUpScope($scope.$$childHead);\n        $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);\n      }\n\n      // The code below works around IE9 and V8's memory leaks\n      //\n      // See:\n      // - https://code.google.com/p/v8/issues/detail?id=2073#c26\n      // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909\n      // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451\n\n      $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =\n          $scope.$$childTail = $scope.$root = $scope.$$watchers = null;\n    }\n\n    /**\n     * @ngdoc type\n     * @name $rootScope.Scope\n     *\n     * @description\n     * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the\n     * {@link auto.$injector $injector}. Child scopes are created using the\n     * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when\n     * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for\n     * an in-depth introduction and usage examples.\n     *\n     *\n     * # Inheritance\n     * A scope can inherit from a parent scope, as in this example:\n     * ```js\n         var parent = $rootScope;\n         var child = parent.$new();\n\n         parent.salutation = \"Hello\";\n         expect(child.salutation).toEqual('Hello');\n\n         child.salutation = \"Welcome\";\n         expect(child.salutation).toEqual('Welcome');\n         expect(parent.salutation).toEqual('Hello');\n     * ```\n     *\n     * When interacting with `Scope` in tests, additional helper methods are available on the\n     * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional\n     * details.\n     *\n     *\n     * @param {Object.<string, function()>=} providers Map of service factory which need to be\n     *                                       provided for the current scope. Defaults to {@link ng}.\n     * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should\n     *                              append/override services provided by `providers`. This is handy\n     *                              when unit-testing and having the need to override a default\n     *                              service.\n     * @returns {Object} Newly created scope.\n     *\n     */\n    function Scope() {\n      this.$id = nextUid();\n      this.$$phase = this.$parent = this.$$watchers =\n                     this.$$nextSibling = this.$$prevSibling =\n                     this.$$childHead = this.$$childTail = null;\n      this.$root = this;\n      this.$$destroyed = false;\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$watchersCount = 0;\n      this.$$isolateBindings = null;\n    }\n\n    /**\n     * @ngdoc property\n     * @name $rootScope.Scope#$id\n     *\n     * @description\n     * Unique scope ID (monotonically increasing) useful for debugging.\n     */\n\n     /**\n      * @ngdoc property\n      * @name $rootScope.Scope#$parent\n      *\n      * @description\n      * Reference to the parent scope.\n      */\n\n      /**\n       * @ngdoc property\n       * @name $rootScope.Scope#$root\n       *\n       * @description\n       * Reference to the root scope.\n       */\n\n    Scope.prototype = {\n      constructor: Scope,\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$new\n       * @kind function\n       *\n       * @description\n       * Creates a new child {@link ng.$rootScope.Scope scope}.\n       *\n       * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.\n       * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.\n       *\n       * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is\n       * desired for the scope and its child scopes to be permanently detached from the parent and\n       * thus stop participating in model change detection and listener notification by invoking.\n       *\n       * @param {boolean} isolate If true, then the scope does not prototypically inherit from the\n       *         parent scope. The scope is isolated, as it can not see parent scope properties.\n       *         When creating widgets, it is useful for the widget to not accidentally read parent\n       *         state.\n       *\n       * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`\n       *                              of the newly created scope. Defaults to `this` scope if not provided.\n       *                              This is used when creating a transclude scope to correctly place it\n       *                              in the scope hierarchy while maintaining the correct prototypical\n       *                              inheritance.\n       *\n       * @returns {Object} The newly created child scope.\n       *\n       */\n      $new: function(isolate, parent) {\n        var child;\n\n        parent = parent || this;\n\n        if (isolate) {\n          child = new Scope();\n          child.$root = this.$root;\n        } else {\n          // Only create a child scope class if somebody asks for one,\n          // but cache it to allow the VM to optimize lookups.\n          if (!this.$$ChildScope) {\n            this.$$ChildScope = createChildScopeClass(this);\n          }\n          child = new this.$$ChildScope();\n        }\n        child.$parent = parent;\n        child.$$prevSibling = parent.$$childTail;\n        if (parent.$$childHead) {\n          parent.$$childTail.$$nextSibling = child;\n          parent.$$childTail = child;\n        } else {\n          parent.$$childHead = parent.$$childTail = child;\n        }\n\n        // When the new scope is not isolated or we inherit from `this`, and\n        // the parent scope is destroyed, the property `$$destroyed` is inherited\n        // prototypically. In all other cases, this property needs to be set\n        // when the parent scope is destroyed.\n        // The listener needs to be added after the parent is set\n        if (isolate || parent != this) child.$on('$destroy', destroyChildScope);\n\n        return child;\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watch\n       * @kind function\n       *\n       * @description\n       * Registers a `listener` callback to be executed whenever the `watchExpression` changes.\n       *\n       * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest\n       *   $digest()} and should return the value that will be watched. (`watchExpression` should not change\n       *   its value when executed multiple times with the same input because it may be executed multiple\n       *   times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be\n       *   [idempotent](http://en.wikipedia.org/wiki/Idempotence).\n       * - The `listener` is called only when the value from the current `watchExpression` and the\n       *   previous call to `watchExpression` are not equal (with the exception of the initial run,\n       *   see below). Inequality is determined according to reference inequality,\n       *   [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)\n       *    via the `!==` Javascript operator, unless `objectEquality == true`\n       *   (see next point)\n       * - When `objectEquality == true`, inequality of the `watchExpression` is determined\n       *   according to the {@link angular.equals} function. To save the value of the object for\n       *   later comparison, the {@link angular.copy} function is used. This therefore means that\n       *   watching complex objects will have adverse memory and performance implications.\n       * - The watch `listener` may change the model, which may trigger other `listener`s to fire.\n       *   This is achieved by rerunning the watchers until no changes are detected. The rerun\n       *   iteration limit is 10 to prevent an infinite loop deadlock.\n       *\n       *\n       * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,\n       * you can register a `watchExpression` function with no `listener`. (Be prepared for\n       * multiple calls to your `watchExpression` because it will execute multiple times in a\n       * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)\n       *\n       * After a watcher is registered with the scope, the `listener` fn is called asynchronously\n       * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the\n       * watcher. In rare cases, this is undesirable because the listener is called when the result\n       * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you\n       * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the\n       * listener was called due to initialization.\n       *\n       *\n       *\n       * # Example\n       * ```js\n           // let's assume that scope was dependency injected as the $rootScope\n           var scope = $rootScope;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n\n\n\n           // Using a function as a watchExpression\n           var food;\n           scope.foodCounter = 0;\n           expect(scope.foodCounter).toEqual(0);\n           scope.$watch(\n             // This function returns the value being watched. It is called for each turn of the $digest loop\n             function() { return food; },\n             // This is the change listener, called when the value returned from the above function changes\n             function(newValue, oldValue) {\n               if ( newValue !== oldValue ) {\n                 // Only increment the counter if the value changed\n                 scope.foodCounter = scope.foodCounter + 1;\n               }\n             }\n           );\n           // No digest has been run so the counter will be zero\n           expect(scope.foodCounter).toEqual(0);\n\n           // Run the digest but since food has not changed count will still be zero\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(0);\n\n           // Update food and run digest.  Now the counter will increment\n           food = 'cheeseburger';\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(1);\n\n       * ```\n       *\n       *\n       *\n       * @param {(function()|string)} watchExpression Expression that is evaluated on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers\n       *    a call to the `listener`.\n       *\n       *    - `string`: Evaluated as {@link guide/expression expression}\n       *    - `function(scope)`: called with current `scope` as a parameter.\n       * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value\n       *    of `watchExpression` changes.\n       *\n       *    - `newVal` contains the current value of the `watchExpression`\n       *    - `oldVal` contains the previous value of the `watchExpression`\n       *    - `scope` refers to the current scope\n       * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of\n       *     comparing for reference equality.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {\n        var get = $parse(watchExp);\n\n        if (get.$$watchDelegate) {\n          return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);\n        }\n        var scope = this,\n            array = scope.$$watchers,\n            watcher = {\n              fn: listener,\n              last: initWatchVal,\n              get: get,\n              exp: prettyPrintExpression || watchExp,\n              eq: !!objectEquality\n            };\n\n        lastDirtyWatch = null;\n\n        if (!isFunction(listener)) {\n          watcher.fn = noop;\n        }\n\n        if (!array) {\n          array = scope.$$watchers = [];\n        }\n        // we use unshift since we use a while loop in $digest for speed.\n        // the while loop reads in reverse order.\n        array.unshift(watcher);\n        incrementWatchersCount(this, 1);\n\n        return function deregisterWatch() {\n          if (arrayRemove(array, watcher) >= 0) {\n            incrementWatchersCount(scope, -1);\n          }\n          lastDirtyWatch = null;\n        };\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchGroup\n       * @kind function\n       *\n       * @description\n       * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.\n       * If any one expression in the collection changes the `listener` is executed.\n       *\n       * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every\n       *   call to $digest() to see if any items changes.\n       * - The `listener` is called whenever any expression in the `watchExpressions` array changes.\n       *\n       * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually\n       * watched using {@link ng.$rootScope.Scope#$watch $watch()}\n       *\n       * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any\n       *    expression in `watchExpressions` changes\n       *    The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching\n       *    those of `watchExpression`\n       *    and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching\n       *    those of `watchExpression`\n       *    The `scope` refers to the current scope.\n       * @returns {function()} Returns a de-registration function for all listeners.\n       */\n      $watchGroup: function(watchExpressions, listener) {\n        var oldValues = new Array(watchExpressions.length);\n        var newValues = new Array(watchExpressions.length);\n        var deregisterFns = [];\n        var self = this;\n        var changeReactionScheduled = false;\n        var firstRun = true;\n\n        if (!watchExpressions.length) {\n          // No expressions means we call the listener ASAP\n          var shouldCall = true;\n          self.$evalAsync(function() {\n            if (shouldCall) listener(newValues, newValues, self);\n          });\n          return function deregisterWatchGroup() {\n            shouldCall = false;\n          };\n        }\n\n        if (watchExpressions.length === 1) {\n          // Special case size of one\n          return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {\n            newValues[0] = value;\n            oldValues[0] = oldValue;\n            listener(newValues, (value === oldValue) ? newValues : oldValues, scope);\n          });\n        }\n\n        forEach(watchExpressions, function(expr, i) {\n          var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {\n            newValues[i] = value;\n            oldValues[i] = oldValue;\n            if (!changeReactionScheduled) {\n              changeReactionScheduled = true;\n              self.$evalAsync(watchGroupAction);\n            }\n          });\n          deregisterFns.push(unwatchFn);\n        });\n\n        function watchGroupAction() {\n          changeReactionScheduled = false;\n\n          if (firstRun) {\n            firstRun = false;\n            listener(newValues, newValues, self);\n          } else {\n            listener(newValues, oldValues, self);\n          }\n        }\n\n        return function deregisterWatchGroup() {\n          while (deregisterFns.length) {\n            deregisterFns.shift()();\n          }\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchCollection\n       * @kind function\n       *\n       * @description\n       * Shallow watches the properties of an object and fires whenever any of the properties change\n       * (for arrays, this implies watching the array items; for object maps, this implies watching\n       * the properties). If a change is detected, the `listener` callback is fired.\n       *\n       * - The `obj` collection is observed via standard $watch operation and is examined on every\n       *   call to $digest() to see if any items have been added, removed, or moved.\n       * - The `listener` is called whenever anything within the `obj` has changed. Examples include\n       *   adding, removing, and moving items belonging to an object or array.\n       *\n       *\n       * # Example\n       * ```js\n          $scope.names = ['igor', 'matias', 'misko', 'james'];\n          $scope.dataCount = 4;\n\n          $scope.$watchCollection('names', function(newNames, oldNames) {\n            $scope.dataCount = newNames.length;\n          });\n\n          expect($scope.dataCount).toEqual(4);\n          $scope.$digest();\n\n          //still at 4 ... no changes\n          expect($scope.dataCount).toEqual(4);\n\n          $scope.names.pop();\n          $scope.$digest();\n\n          //now there's been a change\n          expect($scope.dataCount).toEqual(3);\n       * ```\n       *\n       *\n       * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The\n       *    expression value should evaluate to an object or an array which is observed on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the\n       *    collection will trigger a call to the `listener`.\n       *\n       * @param {function(newCollection, oldCollection, scope)} listener a callback function called\n       *    when a change is detected.\n       *    - The `newCollection` object is the newly modified data obtained from the `obj` expression\n       *    - The `oldCollection` object is a copy of the former collection data.\n       *      Due to performance considerations, the`oldCollection` value is computed only if the\n       *      `listener` function declares two or more arguments.\n       *    - The `scope` argument refers to the current scope.\n       *\n       * @returns {function()} Returns a de-registration function for this listener. When the\n       *    de-registration function is executed, the internal watch operation is terminated.\n       */\n      $watchCollection: function(obj, listener) {\n        $watchCollectionInterceptor.$stateful = true;\n\n        var self = this;\n        // the current value, updated on each dirty-check run\n        var newValue;\n        // a shallow copy of the newValue from the last dirty-check run,\n        // updated to match newValue during dirty-check run\n        var oldValue;\n        // a shallow copy of the newValue from when the last change happened\n        var veryOldValue;\n        // only track veryOldValue if the listener is asking for it\n        var trackVeryOldValue = (listener.length > 1);\n        var changeDetected = 0;\n        var changeDetector = $parse(obj, $watchCollectionInterceptor);\n        var internalArray = [];\n        var internalObject = {};\n        var initRun = true;\n        var oldLength = 0;\n\n        function $watchCollectionInterceptor(_value) {\n          newValue = _value;\n          var newLength, key, bothNaN, newItem, oldItem;\n\n          // If the new value is undefined, then return undefined as the watch may be a one-time watch\n          if (isUndefined(newValue)) return;\n\n          if (!isObject(newValue)) { // if primitive\n            if (oldValue !== newValue) {\n              oldValue = newValue;\n              changeDetected++;\n            }\n          } else if (isArrayLike(newValue)) {\n            if (oldValue !== internalArray) {\n              // we are transitioning from something which was not an array into array.\n              oldValue = internalArray;\n              oldLength = oldValue.length = 0;\n              changeDetected++;\n            }\n\n            newLength = newValue.length;\n\n            if (oldLength !== newLength) {\n              // if lengths do not match we need to trigger change notification\n              changeDetected++;\n              oldValue.length = oldLength = newLength;\n            }\n            // copy the items to oldValue and look for changes.\n            for (var i = 0; i < newLength; i++) {\n              oldItem = oldValue[i];\n              newItem = newValue[i];\n\n              bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n              if (!bothNaN && (oldItem !== newItem)) {\n                changeDetected++;\n                oldValue[i] = newItem;\n              }\n            }\n          } else {\n            if (oldValue !== internalObject) {\n              // we are transitioning from something which was not an object into object.\n              oldValue = internalObject = {};\n              oldLength = 0;\n              changeDetected++;\n            }\n            // copy the items to oldValue and look for changes.\n            newLength = 0;\n            for (key in newValue) {\n              if (hasOwnProperty.call(newValue, key)) {\n                newLength++;\n                newItem = newValue[key];\n                oldItem = oldValue[key];\n\n                if (key in oldValue) {\n                  bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n                  if (!bothNaN && (oldItem !== newItem)) {\n                    changeDetected++;\n                    oldValue[key] = newItem;\n                  }\n                } else {\n                  oldLength++;\n                  oldValue[key] = newItem;\n                  changeDetected++;\n                }\n              }\n            }\n            if (oldLength > newLength) {\n              // we used to have more keys, need to find them and destroy them.\n              changeDetected++;\n              for (key in oldValue) {\n                if (!hasOwnProperty.call(newValue, key)) {\n                  oldLength--;\n                  delete oldValue[key];\n                }\n              }\n            }\n          }\n          return changeDetected;\n        }\n\n        function $watchCollectionAction() {\n          if (initRun) {\n            initRun = false;\n            listener(newValue, newValue, self);\n          } else {\n            listener(newValue, veryOldValue, self);\n          }\n\n          // make a copy for the next time a collection is changed\n          if (trackVeryOldValue) {\n            if (!isObject(newValue)) {\n              //primitive\n              veryOldValue = newValue;\n            } else if (isArrayLike(newValue)) {\n              veryOldValue = new Array(newValue.length);\n              for (var i = 0; i < newValue.length; i++) {\n                veryOldValue[i] = newValue[i];\n              }\n            } else { // if object\n              veryOldValue = {};\n              for (var key in newValue) {\n                if (hasOwnProperty.call(newValue, key)) {\n                  veryOldValue[key] = newValue[key];\n                }\n              }\n            }\n          }\n        }\n\n        return this.$watch(changeDetector, $watchCollectionAction);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$digest\n       * @kind function\n       *\n       * @description\n       * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and\n       * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change\n       * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}\n       * until no more listeners are firing. This means that it is possible to get into an infinite\n       * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of\n       * iterations exceeds 10.\n       *\n       * Usually, you don't call `$digest()` directly in\n       * {@link ng.directive:ngController controllers} or in\n       * {@link ng.$compileProvider#directive directives}.\n       * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within\n       * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.\n       *\n       * If you want to be notified whenever `$digest()` is called,\n       * you can register a `watchExpression` function with\n       * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.\n       *\n       * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.\n       *\n       * # Example\n       * ```js\n           var scope = ...;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n       * ```\n       *\n       */\n      $digest: function() {\n        var watch, value, last, fn, get,\n            watchers,\n            length,\n            dirty, ttl = TTL,\n            next, current, target = this,\n            watchLog = [],\n            logIdx, asyncTask;\n\n        beginPhase('$digest');\n        // Check for changes to browser url that happened in sync before the call to $digest\n        $browser.$$checkUrlChange();\n\n        if (this === $rootScope && applyAsyncId !== null) {\n          // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then\n          // cancel the scheduled $apply and flush the queue of expressions to be evaluated.\n          $browser.defer.cancel(applyAsyncId);\n          flushApplyAsync();\n        }\n\n        lastDirtyWatch = null;\n\n        do { // \"while dirty\" loop\n          dirty = false;\n          current = target;\n\n          while (asyncQueue.length) {\n            try {\n              asyncTask = asyncQueue.shift();\n              asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n            lastDirtyWatch = null;\n          }\n\n          traverseScopesLoop:\n          do { // \"traverse the scopes\" loop\n            if ((watchers = current.$$watchers)) {\n              // process our watches\n              length = watchers.length;\n              while (length--) {\n                try {\n                  watch = watchers[length];\n                  // Most common watches are on primitives, in which case we can short\n                  // circuit it with === operator, only when === fails do we use .equals\n                  if (watch) {\n                    get = watch.get;\n                    if ((value = get(current)) !== (last = watch.last) &&\n                        !(watch.eq\n                            ? equals(value, last)\n                            : (typeof value === 'number' && typeof last === 'number'\n                               && isNaN(value) && isNaN(last)))) {\n                      dirty = true;\n                      lastDirtyWatch = watch;\n                      watch.last = watch.eq ? copy(value, null) : value;\n                      fn = watch.fn;\n                      fn(value, ((last === initWatchVal) ? value : last), current);\n                      if (ttl < 5) {\n                        logIdx = 4 - ttl;\n                        if (!watchLog[logIdx]) watchLog[logIdx] = [];\n                        watchLog[logIdx].push({\n                          msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,\n                          newVal: value,\n                          oldVal: last\n                        });\n                      }\n                    } else if (watch === lastDirtyWatch) {\n                      // If the most recently dirty watcher is now clean, short circuit since the remaining watchers\n                      // have already been tested.\n                      dirty = false;\n                      break traverseScopesLoop;\n                    }\n                  }\n                } catch (e) {\n                  $exceptionHandler(e);\n                }\n              }\n            }\n\n            // Insanity Warning: scope depth-first traversal\n            // yes, this code is a bit crazy, but it works and we have tests to prove it!\n            // this piece should be kept in sync with the traversal in $broadcast\n            if (!(next = ((current.$$watchersCount && current.$$childHead) ||\n                (current !== target && current.$$nextSibling)))) {\n              while (current !== target && !(next = current.$$nextSibling)) {\n                current = current.$parent;\n              }\n            }\n          } while ((current = next));\n\n          // `break traverseScopesLoop;` takes us to here\n\n          if ((dirty || asyncQueue.length) && !(ttl--)) {\n            clearPhase();\n            throw $rootScopeMinErr('infdig',\n                '{0} $digest() iterations reached. Aborting!\\n' +\n                'Watchers fired in the last 5 iterations: {1}',\n                TTL, watchLog);\n          }\n\n        } while (dirty || asyncQueue.length);\n\n        clearPhase();\n\n        while (postDigestQueue.length) {\n          try {\n            postDigestQueue.shift()();\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        }\n      },\n\n\n      /**\n       * @ngdoc event\n       * @name $rootScope.Scope#$destroy\n       * @eventType broadcast on scope being destroyed\n       *\n       * @description\n       * Broadcasted when a scope and its children are being destroyed.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$destroy\n       * @kind function\n       *\n       * @description\n       * Removes the current scope (and all of its children) from the parent scope. Removal implies\n       * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer\n       * propagate to the current scope and its children. Removal also implies that the current\n       * scope is eligible for garbage collection.\n       *\n       * The `$destroy()` is usually used by directives such as\n       * {@link ng.directive:ngRepeat ngRepeat} for managing the\n       * unrolling of the loop.\n       *\n       * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.\n       * Application code can register a `$destroy` event handler that will give it a chance to\n       * perform any necessary cleanup.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n      $destroy: function() {\n        // We can't destroy a scope that has been already destroyed.\n        if (this.$$destroyed) return;\n        var parent = this.$parent;\n\n        this.$broadcast('$destroy');\n        this.$$destroyed = true;\n\n        if (this === $rootScope) {\n          //Remove handlers attached to window when $rootScope is removed\n          $browser.$$applicationDestroyed();\n        }\n\n        incrementWatchersCount(this, -this.$$watchersCount);\n        for (var eventName in this.$$listenerCount) {\n          decrementListenerCount(this, this.$$listenerCount[eventName], eventName);\n        }\n\n        // sever all the references to parent scopes (after this cleanup, the current scope should\n        // not be retained by any of our references and should be eligible for garbage collection)\n        if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;\n        if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;\n        if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;\n        if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;\n\n        // Disable listeners, watchers and apply/digest methods\n        this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;\n        this.$on = this.$watch = this.$watchGroup = function() { return noop; };\n        this.$$listeners = {};\n\n        // Disconnect the next sibling to prevent `cleanUpScope` destroying those too\n        this.$$nextSibling = null;\n        cleanUpScope(this);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$eval\n       * @kind function\n       *\n       * @description\n       * Executes the `expression` on the current scope and returns the result. Any exceptions in\n       * the expression are propagated (uncaught). This is useful when evaluating Angular\n       * expressions.\n       *\n       * # Example\n       * ```js\n           var scope = ng.$rootScope.Scope();\n           scope.a = 1;\n           scope.b = 2;\n\n           expect(scope.$eval('a+b')).toEqual(3);\n           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);\n       * ```\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in  {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       * @returns {*} The result of evaluating the expression.\n       */\n      $eval: function(expr, locals) {\n        return $parse(expr)(this, locals);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$evalAsync\n       * @kind function\n       *\n       * @description\n       * Executes the expression on the current scope at a later point in time.\n       *\n       * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only\n       * that:\n       *\n       *   - it will execute after the function that scheduled the evaluation (preferably before DOM\n       *     rendering).\n       *   - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after\n       *     `expression` execution.\n       *\n       * Any exceptions from the execution of the expression are forwarded to the\n       * {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle\n       * will be scheduled. However, it is encouraged to always call code that changes the model\n       * from within an `$apply` call. That includes code evaluated via `$evalAsync`.\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       */\n      $evalAsync: function(expr, locals) {\n        // if we are outside of an $digest loop and this is the first time we are scheduling async\n        // task also schedule async auto-flush\n        if (!$rootScope.$$phase && !asyncQueue.length) {\n          $browser.defer(function() {\n            if (asyncQueue.length) {\n              $rootScope.$digest();\n            }\n          });\n        }\n\n        asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});\n      },\n\n      $$postDigest: function(fn) {\n        postDigestQueue.push(fn);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$apply\n       * @kind function\n       *\n       * @description\n       * `$apply()` is used to execute an expression in angular from outside of the angular\n       * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).\n       * Because we are calling into the angular framework we need to perform proper scope life\n       * cycle of {@link ng.$exceptionHandler exception handling},\n       * {@link ng.$rootScope.Scope#$digest executing watches}.\n       *\n       * ## Life cycle\n       *\n       * # Pseudo-Code of `$apply()`\n       * ```js\n           function $apply(expr) {\n             try {\n               return $eval(expr);\n             } catch (e) {\n               $exceptionHandler(e);\n             } finally {\n               $root.$digest();\n             }\n           }\n       * ```\n       *\n       *\n       * Scope's `$apply()` method transitions through the following stages:\n       *\n       * 1. The {@link guide/expression expression} is executed using the\n       *    {@link ng.$rootScope.Scope#$eval $eval()} method.\n       * 2. Any exceptions from the execution of the expression are forwarded to the\n       *    {@link ng.$exceptionHandler $exceptionHandler} service.\n       * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the\n       *    expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.\n       *\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       *\n       * @returns {*} The result of evaluating the expression.\n       */\n      $apply: function(expr) {\n        try {\n          beginPhase('$apply');\n          try {\n            return this.$eval(expr);\n          } finally {\n            clearPhase();\n          }\n        } catch (e) {\n          $exceptionHandler(e);\n        } finally {\n          try {\n            $rootScope.$digest();\n          } catch (e) {\n            $exceptionHandler(e);\n            throw e;\n          }\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$applyAsync\n       * @kind function\n       *\n       * @description\n       * Schedule the invocation of $apply to occur at a later time. The actual time difference\n       * varies across browsers, but is typically around ~10 milliseconds.\n       *\n       * This can be used to queue up multiple expressions which need to be evaluated in the same\n       * digest.\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       */\n      $applyAsync: function(expr) {\n        var scope = this;\n        expr && applyAsyncQueue.push($applyAsyncExpression);\n        expr = $parse(expr);\n        scheduleApplyAsync();\n\n        function $applyAsyncExpression() {\n          scope.$eval(expr);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$on\n       * @kind function\n       *\n       * @description\n       * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for\n       * discussion of event life cycle.\n       *\n       * The event listener function format is: `function(event, args...)`. The `event` object\n       * passed into the listener has the following attributes:\n       *\n       *   - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or\n       *     `$broadcast`-ed.\n       *   - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the\n       *     event propagates through the scope hierarchy, this property is set to null.\n       *   - `name` - `{string}`: name of the event.\n       *   - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel\n       *     further event propagation (available only for events that were `$emit`-ed).\n       *   - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag\n       *     to true.\n       *   - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.\n       *\n       * @param {string} name Event name to listen on.\n       * @param {function(event, ...args)} listener Function to call when the event is emitted.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $on: function(name, listener) {\n        var namedListeners = this.$$listeners[name];\n        if (!namedListeners) {\n          this.$$listeners[name] = namedListeners = [];\n        }\n        namedListeners.push(listener);\n\n        var current = this;\n        do {\n          if (!current.$$listenerCount[name]) {\n            current.$$listenerCount[name] = 0;\n          }\n          current.$$listenerCount[name]++;\n        } while ((current = current.$parent));\n\n        var self = this;\n        return function() {\n          var indexOfListener = namedListeners.indexOf(listener);\n          if (indexOfListener !== -1) {\n            namedListeners[indexOfListener] = null;\n            decrementListenerCount(self, 1, name);\n          }\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$emit\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` upwards through the scope hierarchy notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$emit` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event traverses upwards toward the root scope and calls all\n       * registered listeners along the way. The event will stop propagating if one of the listeners\n       * cancels it.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to emit.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).\n       */\n      $emit: function(name, args) {\n        var empty = [],\n            namedListeners,\n            scope = this,\n            stopPropagation = false,\n            event = {\n              name: name,\n              targetScope: scope,\n              stopPropagation: function() {stopPropagation = true;},\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            },\n            listenerArgs = concat([event], arguments, 1),\n            i, length;\n\n        do {\n          namedListeners = scope.$$listeners[name] || empty;\n          event.currentScope = scope;\n          for (i = 0, length = namedListeners.length; i < length; i++) {\n\n            // if listeners were deregistered, defragment the array\n            if (!namedListeners[i]) {\n              namedListeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n            try {\n              //allow all listeners attached to the current scope to run\n              namedListeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n          //if any listener on the current scope stops propagation, prevent bubbling\n          if (stopPropagation) {\n            event.currentScope = null;\n            return event;\n          }\n          //traverse upwards\n          scope = scope.$parent;\n        } while (scope);\n\n        event.currentScope = null;\n\n        return event;\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$broadcast\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` downwards to all child scopes (and their children) notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$broadcast` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event propagates to all direct and indirect scopes of the current\n       * scope and calls all registered listeners along the way. The event cannot be canceled.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to broadcast.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}\n       */\n      $broadcast: function(name, args) {\n        var target = this,\n            current = target,\n            next = target,\n            event = {\n              name: name,\n              targetScope: target,\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            };\n\n        if (!target.$$listenerCount[name]) return event;\n\n        var listenerArgs = concat([event], arguments, 1),\n            listeners, i, length;\n\n        //down while you can, then up and next sibling or up and next sibling until back at root\n        while ((current = next)) {\n          event.currentScope = current;\n          listeners = current.$$listeners[name] || [];\n          for (i = 0, length = listeners.length; i < length; i++) {\n            // if listeners were deregistered, defragment the array\n            if (!listeners[i]) {\n              listeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n\n            try {\n              listeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n\n          // Insanity Warning: scope depth-first traversal\n          // yes, this code is a bit crazy, but it works and we have tests to prove it!\n          // this piece should be kept in sync with the traversal in $digest\n          // (though it differs due to having the extra check for $$listenerCount)\n          if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||\n              (current !== target && current.$$nextSibling)))) {\n            while (current !== target && !(next = current.$$nextSibling)) {\n              current = current.$parent;\n            }\n          }\n        }\n\n        event.currentScope = null;\n        return event;\n      }\n    };\n\n    var $rootScope = new Scope();\n\n    //The internal queues. Expose them on the $rootScope for debugging/testing purposes.\n    var asyncQueue = $rootScope.$$asyncQueue = [];\n    var postDigestQueue = $rootScope.$$postDigestQueue = [];\n    var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];\n\n    return $rootScope;\n\n\n    function beginPhase(phase) {\n      if ($rootScope.$$phase) {\n        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);\n      }\n\n      $rootScope.$$phase = phase;\n    }\n\n    function clearPhase() {\n      $rootScope.$$phase = null;\n    }\n\n    function incrementWatchersCount(current, count) {\n      do {\n        current.$$watchersCount += count;\n      } while ((current = current.$parent));\n    }\n\n    function decrementListenerCount(current, count, name) {\n      do {\n        current.$$listenerCount[name] -= count;\n\n        if (current.$$listenerCount[name] === 0) {\n          delete current.$$listenerCount[name];\n        }\n      } while ((current = current.$parent));\n    }\n\n    /**\n     * function used as an initial value for watchers.\n     * because it's unique we can easily tell it apart from other values\n     */\n    function initWatchVal() {}\n\n    function flushApplyAsync() {\n      while (applyAsyncQueue.length) {\n        try {\n          applyAsyncQueue.shift()();\n        } catch (e) {\n          $exceptionHandler(e);\n        }\n      }\n      applyAsyncId = null;\n    }\n\n    function scheduleApplyAsync() {\n      if (applyAsyncId === null) {\n        applyAsyncId = $browser.defer(function() {\n          $rootScope.$apply(flushApplyAsync);\n        });\n      }\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $rootElement\n *\n * @description\n * The root element of Angular application. This is either the element where {@link\n * ng.directive:ngApp ngApp} was declared or the element passed into\n * {@link angular.bootstrap}. The element represents the root element of application. It is also the\n * location where the application's {@link auto.$injector $injector} service gets\n * published, and can be retrieved using `$rootElement.injector()`.\n */\n\n\n// the implementation is in angular.bootstrap\n\n/**\n * @description\n * Private service to sanitize uris for links and images. Used by $compile and $sanitize.\n */\nfunction $$SanitizeUriProvider() {\n  var aHrefSanitizationWhitelist = /^\\s*(https?|ftp|mailto|tel|file):/,\n    imgSrcSanitizationWhitelist = /^\\s*((https?|ftp|file|blob):|data:image\\/)/;\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      aHrefSanitizationWhitelist = regexp;\n      return this;\n    }\n    return aHrefSanitizationWhitelist;\n  };\n\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      imgSrcSanitizationWhitelist = regexp;\n      return this;\n    }\n    return imgSrcSanitizationWhitelist;\n  };\n\n  this.$get = function() {\n    return function sanitizeUri(uri, isImage) {\n      var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;\n      var normalizedVal;\n      normalizedVal = urlResolve(uri).href;\n      if (normalizedVal !== '' && !normalizedVal.match(regex)) {\n        return 'unsafe:' + normalizedVal;\n      }\n      return uri;\n    };\n  };\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sceMinErr = minErr('$sce');\n\nvar SCE_CONTEXTS = {\n  HTML: 'html',\n  CSS: 'css',\n  URL: 'url',\n  // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a\n  // url.  (e.g. ng-include, script src, templateUrl)\n  RESOURCE_URL: 'resourceUrl',\n  JS: 'js'\n};\n\n// Helper functions follow.\n\nfunction adjustMatcher(matcher) {\n  if (matcher === 'self') {\n    return matcher;\n  } else if (isString(matcher)) {\n    // Strings match exactly except for 2 wildcards - '*' and '**'.\n    // '*' matches any character except those from the set ':/.?&'.\n    // '**' matches any character (like .* in a RegExp).\n    // More than 2 *'s raises an error as it's ill defined.\n    if (matcher.indexOf('***') > -1) {\n      throw $sceMinErr('iwcard',\n          'Illegal sequence *** in string matcher.  String: {0}', matcher);\n    }\n    matcher = escapeForRegexp(matcher).\n                  replace('\\\\*\\\\*', '.*').\n                  replace('\\\\*', '[^:/.?&;]*');\n    return new RegExp('^' + matcher + '$');\n  } else if (isRegExp(matcher)) {\n    // The only other type of matcher allowed is a Regexp.\n    // Match entire URL / disallow partial matches.\n    // Flags are reset (i.e. no global, ignoreCase or multiline)\n    return new RegExp('^' + matcher.source + '$');\n  } else {\n    throw $sceMinErr('imatcher',\n        'Matchers may only be \"self\", string patterns or RegExp objects');\n  }\n}\n\n\nfunction adjustMatchers(matchers) {\n  var adjustedMatchers = [];\n  if (isDefined(matchers)) {\n    forEach(matchers, function(matcher) {\n      adjustedMatchers.push(adjustMatcher(matcher));\n    });\n  }\n  return adjustedMatchers;\n}\n\n\n/**\n * @ngdoc service\n * @name $sceDelegate\n * @kind function\n *\n * @description\n *\n * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict\n * Contextual Escaping (SCE)} services to AngularJS.\n *\n * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of\n * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is\n * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to\n * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things\n * work because `$sce` delegates to `$sceDelegate` for these operations.\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.\n *\n * The default instance of `$sceDelegate` should work out of the box with little pain.  While you\n * can override it completely to change the behavior of `$sce`, the common case would\n * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting\n * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as\n * templates.  Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist\n * $sceDelegateProvider.resourceUrlWhitelist} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n */\n\n/**\n * @ngdoc provider\n * @name $sceDelegateProvider\n * @description\n *\n * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate\n * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure\n * that the URLs used for sourcing Angular templates are safe.  Refer {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and\n * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n *\n * For the general details about this service in Angular, read the main page for {@link ng.$sce\n * Strict Contextual Escaping (SCE)}.\n *\n * **Example**:  Consider the following case. <a name=\"example\"></a>\n *\n * - your app is hosted at url `http://myapp.example.com/`\n * - but some of your templates are hosted on other domains you control such as\n *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.\n * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.\n *\n * Here is what a secure configuration for this scenario might look like:\n *\n * ```\n *  angular.module('myApp', []).config(function($sceDelegateProvider) {\n *    $sceDelegateProvider.resourceUrlWhitelist([\n *      // Allow same origin resource loads.\n *      'self',\n *      // Allow loading from our assets domain.  Notice the difference between * and **.\n *      'http://srv*.assets.example.com/**'\n *    ]);\n *\n *    // The blacklist overrides the whitelist so the open redirect here is blocked.\n *    $sceDelegateProvider.resourceUrlBlacklist([\n *      'http://myapp.example.com/clickThru**'\n *    ]);\n *  });\n * ```\n */\n\nfunction $SceDelegateProvider() {\n  this.SCE_CONTEXTS = SCE_CONTEXTS;\n\n  // Resource URLs can also be trusted by policy.\n  var resourceUrlWhitelist = ['self'],\n      resourceUrlBlacklist = [];\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlWhitelist\n   * @kind function\n   *\n   * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value\n   *    provided.  This must be an array or null.  A snapshot of this array is used so further\n   *    changes to the array are ignored.\n   *\n   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *    allowed in this array.\n   *\n   *    <div class=\"alert alert-warning\">\n   *    **Note:** an empty whitelist array will block all URLs!\n   *    </div>\n   *\n   * @return {Array} the currently set whitelist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is `['self']` allowing only\n   * same origin resource requests.\n   *\n   * @description\n   * Sets/Gets the whitelist of trusted resource URLs.\n   */\n  this.resourceUrlWhitelist = function(value) {\n    if (arguments.length) {\n      resourceUrlWhitelist = adjustMatchers(value);\n    }\n    return resourceUrlWhitelist;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlBlacklist\n   * @kind function\n   *\n   * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value\n   *    provided.  This must be an array or null.  A snapshot of this array is used so further\n   *    changes to the array are ignored.\n   *\n   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *    allowed in this array.\n   *\n   *    The typical usage for the blacklist is to **block\n   *    [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as\n   *    these would otherwise be trusted but actually return content from the redirected domain.\n   *\n   *    Finally, **the blacklist overrides the whitelist** and has the final say.\n   *\n   * @return {Array} the currently set blacklist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there\n   * is no blacklist.)\n   *\n   * @description\n   * Sets/Gets the blacklist of trusted resource URLs.\n   */\n\n  this.resourceUrlBlacklist = function(value) {\n    if (arguments.length) {\n      resourceUrlBlacklist = adjustMatchers(value);\n    }\n    return resourceUrlBlacklist;\n  };\n\n  this.$get = ['$injector', function($injector) {\n\n    var htmlSanitizer = function htmlSanitizer(html) {\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    };\n\n    if ($injector.has('$sanitize')) {\n      htmlSanitizer = $injector.get('$sanitize');\n    }\n\n\n    function matchUrl(matcher, parsedUrl) {\n      if (matcher === 'self') {\n        return urlIsSameOrigin(parsedUrl);\n      } else {\n        // definitely a regex.  See adjustMatchers()\n        return !!matcher.exec(parsedUrl.href);\n      }\n    }\n\n    function isResourceUrlAllowedByPolicy(url) {\n      var parsedUrl = urlResolve(url.toString());\n      var i, n, allowed = false;\n      // Ensure that at least one item from the whitelist allows this url.\n      for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {\n        if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {\n          allowed = true;\n          break;\n        }\n      }\n      if (allowed) {\n        // Ensure that no item from the blacklist blocked this url.\n        for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {\n          if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {\n            allowed = false;\n            break;\n          }\n        }\n      }\n      return allowed;\n    }\n\n    function generateHolderType(Base) {\n      var holderType = function TrustedValueHolderType(trustedValue) {\n        this.$$unwrapTrustedValue = function() {\n          return trustedValue;\n        };\n      };\n      if (Base) {\n        holderType.prototype = new Base();\n      }\n      holderType.prototype.valueOf = function sceValueOf() {\n        return this.$$unwrapTrustedValue();\n      };\n      holderType.prototype.toString = function sceToString() {\n        return this.$$unwrapTrustedValue().toString();\n      };\n      return holderType;\n    }\n\n    var trustedValueHolderBase = generateHolderType(),\n        byType = {};\n\n    byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#trustAs\n     *\n     * @description\n     * Returns an object that is trusted by angular for use in specified strict\n     * contextual escaping contexts (such as ng-bind-html, ng-include, any src\n     * attribute interpolation, any dom event binding attribute interpolation\n     * such as for onclick,  etc.) that uses the provided value.\n     * See {@link ng.$sce $sce} for enabling strict contextual escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n    function trustAs(type, trustedValue) {\n      var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (!Constructor) {\n        throw $sceMinErr('icontext',\n            'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',\n            type, trustedValue);\n      }\n      if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {\n        return trustedValue;\n      }\n      // All the current contexts in SCE_CONTEXTS happen to be strings.  In order to avoid trusting\n      // mutable objects, we ensure here that the value passed in is actually a string.\n      if (typeof trustedValue !== 'string') {\n        throw $sceMinErr('itype',\n            'Attempted to trust a non-string value in a content requiring a string: Context: {0}',\n            type);\n      }\n      return new Constructor(trustedValue);\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#valueOf\n     *\n     * @description\n     * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs\n     * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.\n     *\n     * If the passed parameter is not a value that had been returned by {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.\n     *\n     * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}\n     *      call or anything else.\n     * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns\n     *     `value` unchanged.\n     */\n    function valueOf(maybeTrusted) {\n      if (maybeTrusted instanceof trustedValueHolderBase) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      } else {\n        return maybeTrusted;\n      }\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#getTrusted\n     *\n     * @description\n     * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and\n     * returns the originally supplied value if the queried context type is a supertype of the\n     * created type.  If this condition isn't satisfied, throws an exception.\n     *\n     * <div class=\"alert alert-danger\">\n     * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting\n     * (XSS) vulnerability in your application.\n     * </div>\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} call.\n     * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.\n     */\n    function getTrusted(type, maybeTrusted) {\n      if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {\n        return maybeTrusted;\n      }\n      var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (constructor && maybeTrusted instanceof constructor) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      }\n      // If we get here, then we may only take one of two actions.\n      // 1. sanitize the value for the requested type, or\n      // 2. throw an exception.\n      if (type === SCE_CONTEXTS.RESOURCE_URL) {\n        if (isResourceUrlAllowedByPolicy(maybeTrusted)) {\n          return maybeTrusted;\n        } else {\n          throw $sceMinErr('insecurl',\n              'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}',\n              maybeTrusted.toString());\n        }\n      } else if (type === SCE_CONTEXTS.HTML) {\n        return htmlSanitizer(maybeTrusted);\n      }\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    }\n\n    return { trustAs: trustAs,\n             getTrusted: getTrusted,\n             valueOf: valueOf };\n  }];\n}\n\n\n/**\n * @ngdoc provider\n * @name $sceProvider\n * @description\n *\n * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.\n * -   enable/disable Strict Contextual Escaping (SCE) in a module\n * -   override the default implementation with a custom delegate\n *\n * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.\n */\n\n/* jshint maxlen: false*/\n\n/**\n * @ngdoc service\n * @name $sce\n * @kind function\n *\n * @description\n *\n * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.\n *\n * # Strict Contextual Escaping\n *\n * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain\n * contexts to result in a value that is marked as safe to use for that context.  One example of\n * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer\n * to these contexts as privileged or SCE contexts.\n *\n * As of version 1.2, Angular ships with SCE enabled by default.\n *\n * Note:  When enabled (the default), IE<11 in quirks mode is not supported.  In this mode, IE<11 allow\n * one to execute arbitrary javascript by the use of the expression() syntax.  Refer\n * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.\n * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`\n * to the top of your HTML document.\n *\n * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for\n * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.\n *\n * Here's an example of a binding in a privileged context:\n *\n * ```\n * <input ng-model=\"userHtml\" aria-label=\"User input\">\n * <div ng-bind-html=\"userHtml\"></div>\n * ```\n *\n * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE\n * disabled, this application allows the user to render arbitrary HTML into the DIV.\n * In a more realistic example, one may be rendering user comments, blog articles, etc. via\n * bindings.  (HTML is just one example of a context where rendering user controlled input creates\n * security vulnerabilities.)\n *\n * For the case of HTML, you might use a library, either on the client side, or on the server side,\n * to sanitize unsafe HTML before binding to the value and rendering it in the document.\n *\n * How would you ensure that every place that used these types of bindings was bound to a value that\n * was sanitized by your library (or returned as safe for rendering by your server?)  How can you\n * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some\n * properties/fields and forgot to update the binding to the sanitized value?\n *\n * To be secure by default, you want to ensure that any such bindings are disallowed unless you can\n * determine that something explicitly says it's safe to use a value for binding in that\n * context.  You can then audit your code (a simple grep would do) to ensure that this is only done\n * for those values that you can easily tell are safe - because they were received from your server,\n * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps\n * allowing only the files in a specific directory to do this.  Ensuring that the internal API\n * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.\n *\n * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}\n * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to\n * obtain values that will be accepted by SCE / privileged contexts.\n *\n *\n * ## How does it work?\n *\n * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted\n * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link\n * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the\n * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.\n *\n * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link\n * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly\n * simplified):\n *\n * ```\n * var ngBindHtmlDirective = ['$sce', function($sce) {\n *   return function(scope, element, attr) {\n *     scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {\n *       element.html(value || '');\n *     });\n *   };\n * }];\n * ```\n *\n * ## Impact on loading templates\n *\n * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as\n * `templateUrl`'s specified by {@link guide/directive directives}.\n *\n * By default, Angular only loads templates from the same domain and protocol as the application\n * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or\n * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist\n * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.\n *\n * *Please note*:\n * The browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy apply in addition to this and may further restrict whether the template is successfully\n * loaded.  This means that without the right CORS policy, loading templates from a different domain\n * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some\n * browsers.\n *\n * ## This feels like too much overhead\n *\n * It's important to remember that SCE only applies to interpolation expressions.\n *\n * If your expressions are constant literals, they're automatically trusted and you don't need to\n * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.\n * `<div ng-bind-html=\"'<b>implicitly trusted</b>'\"></div>`) just works.\n *\n * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them\n * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.\n *\n * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load\n * templates in `ng-include` from your application's domain without having to even know about SCE.\n * It blocks loading templates from other domains or loading templates over http from an https\n * served document.  You can change these by setting your own custom {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.\n *\n * This significantly reduces the overhead.  It is far easier to pay the small overhead and have an\n * application that's secure and can be audited to verify that with much more ease than bolting\n * security onto an application later.\n *\n * <a name=\"contexts\"></a>\n * ## What trusted context types are supported?\n *\n * | Context             | Notes          |\n * |---------------------|----------------|\n * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |\n * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |\n * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |\n * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |\n * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |\n *\n * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name=\"resourceUrlPatternItem\"></a>\n *\n *  Each element in these arrays must be one of the following:\n *\n *  - **'self'**\n *    - The special **string**, `'self'`, can be used to match against all URLs of the **same\n *      domain** as the application document using the **same protocol**.\n *  - **String** (except the special value `'self'`)\n *    - The string is matched against the full *normalized / absolute URL* of the resource\n *      being tested (substring matches are not good enough.)\n *    - There are exactly **two wildcard sequences** - `*` and `**`.  All other characters\n *      match themselves.\n *    - `*`: matches zero or more occurrences of any character other than one of the following 6\n *      characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'.  It's a useful wildcard for use\n *      in a whitelist.\n *    - `**`: matches zero or more occurrences of *any* character.  As such, it's not\n *      appropriate for use in a scheme, domain, etc. as it would match too much.  (e.g.\n *      http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might\n *      not have been the intention.)  Its usage at the very end of the path is ok.  (e.g.\n *      http://foo.example.com/templates/**).\n *  - **RegExp** (*see caveat below*)\n *    - *Caveat*:  While regular expressions are powerful and offer great flexibility,  their syntax\n *      (and all the inevitable escaping) makes them *harder to maintain*.  It's easy to\n *      accidentally introduce a bug when one updates a complex expression (imho, all regexes should\n *      have good test coverage).  For instance, the use of `.` in the regex is correct only in a\n *      small number of cases.  A `.` character in the regex used when matching the scheme or a\n *      subdomain could be matched against a `:` or literal `.` that was likely not intended.   It\n *      is highly recommended to use the string patterns and only fall back to regular expressions\n *      as a last resort.\n *    - The regular expression must be an instance of RegExp (i.e. not a string.)  It is\n *      matched against the **entire** *normalized / absolute URL* of the resource being tested\n *      (even when the RegExp did not have the `^` and `$` codes.)  In addition, any flags\n *      present on the RegExp (such as multiline, global, ignoreCase) are ignored.\n *    - If you are generating your JavaScript from some other templating engine (not\n *      recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),\n *      remember to escape your regular expression (and be aware that you might need more than\n *      one level of escaping depending on your templating engine and the way you interpolated\n *      the value.)  Do make use of your platform's escaping mechanism as it might be good\n *      enough before coding your own.  E.g. Ruby has\n *      [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)\n *      and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).\n *      Javascript lacks a similar built in function for escaping.  Take a look at Google\n *      Closure library's [goog.string.regExpEscape(s)](\n *      http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.\n *\n * ## Show me an example using SCE.\n *\n * <example module=\"mySceApp\" deps=\"angular-sanitize.js\">\n * <file name=\"index.html\">\n *   <div ng-controller=\"AppController as myCtrl\">\n *     <i ng-bind-html=\"myCtrl.explicitlyTrustedHtml\" id=\"explicitlyTrustedHtml\"></i><br><br>\n *     <b>User comments</b><br>\n *     By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when\n *     $sanitize is available.  If $sanitize isn't available, this results in an error instead of an\n *     exploit.\n *     <div class=\"well\">\n *       <div ng-repeat=\"userComment in myCtrl.userComments\">\n *         <b>{{userComment.name}}</b>:\n *         <span ng-bind-html=\"userComment.htmlComment\" class=\"htmlComment\"></span>\n *         <br>\n *       </div>\n *     </div>\n *   </div>\n * </file>\n *\n * <file name=\"script.js\">\n *   angular.module('mySceApp', ['ngSanitize'])\n *     .controller('AppController', ['$http', '$templateCache', '$sce',\n *       function($http, $templateCache, $sce) {\n *         var self = this;\n *         $http.get(\"test_data.json\", {cache: $templateCache}).success(function(userComments) {\n *           self.userComments = userComments;\n *         });\n *         self.explicitlyTrustedHtml = $sce.trustAsHtml(\n *             '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *             'sanitization.&quot;\">Hover over this text.</span>');\n *       }]);\n * </file>\n *\n * <file name=\"test_data.json\">\n * [\n *   { \"name\": \"Alice\",\n *     \"htmlComment\":\n *         \"<span onmouseover='this.textContent=\\\"PWN3D!\\\"'>Is <i>anyone</i> reading this?</span>\"\n *   },\n *   { \"name\": \"Bob\",\n *     \"htmlComment\": \"<i>Yes!</i>  Am I the only other one?\"\n *   }\n * ]\n * </file>\n *\n * <file name=\"protractor.js\" type=\"protractor\">\n *   describe('SCE doc demo', function() {\n *     it('should sanitize untrusted values', function() {\n *       expect(element.all(by.css('.htmlComment')).first().getInnerHtml())\n *           .toBe('<span>Is <i>anyone</i> reading this?</span>');\n *     });\n *\n *     it('should NOT sanitize explicitly trusted values', function() {\n *       expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(\n *           '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *           'sanitization.&quot;\">Hover over this text.</span>');\n *     });\n *   });\n * </file>\n * </example>\n *\n *\n *\n * ## Can I disable SCE completely?\n *\n * Yes, you can.  However, this is strongly discouraged.  SCE gives you a lot of security benefits\n * for little coding overhead.  It will be much harder to take an SCE disabled application and\n * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE\n * for cases where you have a lot of existing code that was written before SCE was introduced and\n * you're migrating them a module at a time.\n *\n * That said, here's how you can completely disable SCE:\n *\n * ```\n * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {\n *   // Completely disable SCE.  For demonstration purposes only!\n *   // Do not use in new projects.\n *   $sceProvider.enabled(false);\n * });\n * ```\n *\n */\n/* jshint maxlen: 100 */\n\nfunction $SceProvider() {\n  var enabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $sceProvider#enabled\n   * @kind function\n   *\n   * @param {boolean=} value If provided, then enables/disables SCE.\n   * @return {boolean} true if SCE is enabled, false otherwise.\n   *\n   * @description\n   * Enables/disables SCE and returns the current value.\n   */\n  this.enabled = function(value) {\n    if (arguments.length) {\n      enabled = !!value;\n    }\n    return enabled;\n  };\n\n\n  /* Design notes on the default implementation for SCE.\n   *\n   * The API contract for the SCE delegate\n   * -------------------------------------\n   * The SCE delegate object must provide the following 3 methods:\n   *\n   * - trustAs(contextEnum, value)\n   *     This method is used to tell the SCE service that the provided value is OK to use in the\n   *     contexts specified by contextEnum.  It must return an object that will be accepted by\n   *     getTrusted() for a compatible contextEnum and return this value.\n   *\n   * - valueOf(value)\n   *     For values that were not produced by trustAs(), return them as is.  For values that were\n   *     produced by trustAs(), return the corresponding input value to trustAs.  Basically, if\n   *     trustAs is wrapping the given values into some type, this operation unwraps it when given\n   *     such a value.\n   *\n   * - getTrusted(contextEnum, value)\n   *     This function should return the a value that is safe to use in the context specified by\n   *     contextEnum or throw and exception otherwise.\n   *\n   * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be\n   * opaque or wrapped in some holder object.  That happens to be an implementation detail.  For\n   * instance, an implementation could maintain a registry of all trusted objects by context.  In\n   * such a case, trustAs() would return the same object that was passed in.  getTrusted() would\n   * return the same object passed in if it was found in the registry under a compatible context or\n   * throw an exception otherwise.  An implementation might only wrap values some of the time based\n   * on some criteria.  getTrusted() might return a value and not throw an exception for special\n   * constants or objects even if not wrapped.  All such implementations fulfill this contract.\n   *\n   *\n   * A note on the inheritance model for SCE contexts\n   * ------------------------------------------------\n   * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types.  This\n   * is purely an implementation details.\n   *\n   * The contract is simply this:\n   *\n   *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)\n   *     will also succeed.\n   *\n   * Inheritance happens to capture this in a natural way.  In some future, we\n   * may not use inheritance anymore.  That is OK because no code outside of\n   * sce.js and sceSpecs.js would need to be aware of this detail.\n   */\n\n  this.$get = ['$parse', '$sceDelegate', function(\n                $parse,   $sceDelegate) {\n    // Prereq: Ensure that we're not running in IE<11 quirks mode.  In that mode, IE < 11 allow\n    // the \"expression(javascript expression)\" syntax which is insecure.\n    if (enabled && msie < 8) {\n      throw $sceMinErr('iequirks',\n        'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +\n        'mode.  You can fix this by adding the text <!doctype html> to the top of your HTML ' +\n        'document.  See http://docs.angularjs.org/api/ng.$sce for more information.');\n    }\n\n    var sce = shallowCopy(SCE_CONTEXTS);\n\n    /**\n     * @ngdoc method\n     * @name $sce#isEnabled\n     * @kind function\n     *\n     * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you\n     * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.\n     *\n     * @description\n     * Returns a boolean indicating if SCE is enabled.\n     */\n    sce.isEnabled = function() {\n      return enabled;\n    };\n    sce.trustAs = $sceDelegate.trustAs;\n    sce.getTrusted = $sceDelegate.getTrusted;\n    sce.valueOf = $sceDelegate.valueOf;\n\n    if (!enabled) {\n      sce.trustAs = sce.getTrusted = function(type, value) { return value; };\n      sce.valueOf = identity;\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAs\n     *\n     * @description\n     * Converts Angular {@link guide/expression expression} into a function.  This is like {@link\n     * ng.$parse $parse} and is identical when the expression is a literal constant.  Otherwise, it\n     * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,\n     * *result*)}\n     *\n     * @param {string} type The kind of SCE context in which this result will be used.\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n    sce.parseAs = function sceParseAs(type, expr) {\n      var parsed = $parse(expr);\n      if (parsed.literal && parsed.constant) {\n        return parsed;\n      } else {\n        return $parse(expr, function(value) {\n          return sce.getTrusted(type, value);\n        });\n      }\n    };\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAs\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,\n     * returns an object that is trusted by angular for use in specified strict contextual\n     * escaping contexts (such as ng-bind-html, ng-include, any src attribute\n     * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)\n     * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual\n     * escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsHtml(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml\n     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl\n     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl\n     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the return\n     *     value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsJs(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs\n     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrusted\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,\n     * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the\n     * originally supplied value if the queried context type is a supertype of the created type.\n     * If this condition isn't satisfied, throws an exception.\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}\n     *                         call.\n     * @returns {*} The value the was originally provided to\n     *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.\n     *              Otherwise, throws an exception.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedHtml(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedCss\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedCss(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sceDelegate.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedJs\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedJs(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsHtml(expression string)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsCss\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsCss(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsUrl(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsResourceUrl(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsJs(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    // Shorthand delegations.\n    var parse = sce.parseAs,\n        getTrusted = sce.getTrusted,\n        trustAs = sce.trustAs;\n\n    forEach(SCE_CONTEXTS, function(enumValue, name) {\n      var lName = lowercase(name);\n      sce[camelCase(\"parse_as_\" + lName)] = function(expr) {\n        return parse(enumValue, expr);\n      };\n      sce[camelCase(\"get_trusted_\" + lName)] = function(value) {\n        return getTrusted(enumValue, value);\n      };\n      sce[camelCase(\"trust_as_\" + lName)] = function(value) {\n        return trustAs(enumValue, value);\n      };\n    });\n\n    return sce;\n  }];\n}\n\n/**\n * !!! This is an undocumented \"private\" service !!!\n *\n * @name $sniffer\n * @requires $window\n * @requires $document\n *\n * @property {boolean} history Does the browser support html5 history api ?\n * @property {boolean} transitions Does the browser support CSS transition events ?\n * @property {boolean} animations Does the browser support CSS animation events ?\n *\n * @description\n * This is very simple implementation of testing browser's features.\n */\nfunction $SnifferProvider() {\n  this.$get = ['$window', '$document', function($window, $document) {\n    var eventSupport = {},\n        // Chrome Packaged Apps are not allowed to access `history.pushState`. They can be detected by\n        // the presence of `chrome.app.runtime` (see https://developer.chrome.com/apps/api_index)\n        isChromePackagedApp = $window.chrome && $window.chrome.app && $window.chrome.app.runtime,\n        hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState,\n        android =\n          toInt((/android (\\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),\n        boxee = /Boxee/i.test(($window.navigator || {}).userAgent),\n        document = $document[0] || {},\n        vendorPrefix,\n        vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,\n        bodyStyle = document.body && document.body.style,\n        transitions = false,\n        animations = false,\n        match;\n\n    if (bodyStyle) {\n      for (var prop in bodyStyle) {\n        if (match = vendorRegex.exec(prop)) {\n          vendorPrefix = match[0];\n          vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);\n          break;\n        }\n      }\n\n      if (!vendorPrefix) {\n        vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';\n      }\n\n      transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));\n      animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));\n\n      if (android && (!transitions ||  !animations)) {\n        transitions = isString(bodyStyle.webkitTransition);\n        animations = isString(bodyStyle.webkitAnimation);\n      }\n    }\n\n\n    return {\n      // Android has history.pushState, but it does not update location correctly\n      // so let's not use the history API at all.\n      // http://code.google.com/p/android/issues/detail?id=17471\n      // https://github.com/angular/angular.js/issues/904\n\n      // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has\n      // so let's not use the history API also\n      // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined\n      // jshint -W018\n      history: !!(hasHistoryPushState && !(android < 4) && !boxee),\n      // jshint +W018\n      hasEvent: function(event) {\n        // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have\n        // it. In particular the event is not fired when backspace or delete key are pressed or\n        // when cut operation is performed.\n        // IE10+ implements 'input' event but it erroneously fires under various situations,\n        // e.g. when placeholder changes, or a form is focused.\n        if (event === 'input' && msie <= 11) return false;\n\n        if (isUndefined(eventSupport[event])) {\n          var divElm = document.createElement('div');\n          eventSupport[event] = 'on' + event in divElm;\n        }\n\n        return eventSupport[event];\n      },\n      csp: csp(),\n      vendorPrefix: vendorPrefix,\n      transitions: transitions,\n      animations: animations,\n      android: android\n    };\n  }];\n}\n\nvar $templateRequestMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $templateRequestProvider\n * @description\n * Used to configure the options passed to the {@link $http} service when making a template request.\n *\n * For example, it can be used for specifying the \"Accept\" header that is sent to the server, when\n * requesting a template.\n */\nfunction $TemplateRequestProvider() {\n\n  var httpOptions;\n\n  /**\n   * @ngdoc method\n   * @name $templateRequestProvider#httpOptions\n   * @description\n   * The options to be passed to the {@link $http} service when making the request.\n   * You can use this to override options such as the \"Accept\" header for template requests.\n   *\n   * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the\n   * options if not overridden here.\n   *\n   * @param {string=} value new value for the {@link $http} options.\n   * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.\n   */\n  this.httpOptions = function(val) {\n    if (val) {\n      httpOptions = val;\n      return this;\n    }\n    return httpOptions;\n  };\n\n  /**\n   * @ngdoc service\n   * @name $templateRequest\n   *\n   * @description\n   * The `$templateRequest` service runs security checks then downloads the provided template using\n   * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request\n   * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the\n   * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the\n   * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted\n   * when `tpl` is of type string and `$templateCache` has the matching entry.\n   *\n   * If you want to pass custom options to the `$http` service, such as setting the Accept header you\n   * can configure this via {@link $templateRequestProvider#httpOptions}.\n   *\n   * @param {string|TrustedResourceUrl} tpl The HTTP request template URL\n   * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty\n   *\n   * @return {Promise} a promise for the HTTP response data of the given URL.\n   *\n   * @property {number} totalPendingRequests total amount of pending template requests being downloaded.\n   */\n  this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {\n\n    function handleRequestFn(tpl, ignoreRequestError) {\n      handleRequestFn.totalPendingRequests++;\n\n      // We consider the template cache holds only trusted templates, so\n      // there's no need to go through whitelisting again for keys that already\n      // are included in there. This also makes Angular accept any script\n      // directive, no matter its name. However, we still need to unwrap trusted\n      // types.\n      if (!isString(tpl) || !$templateCache.get(tpl)) {\n        tpl = $sce.getTrustedResourceUrl(tpl);\n      }\n\n      var transformResponse = $http.defaults && $http.defaults.transformResponse;\n\n      if (isArray(transformResponse)) {\n        transformResponse = transformResponse.filter(function(transformer) {\n          return transformer !== defaultHttpResponseTransform;\n        });\n      } else if (transformResponse === defaultHttpResponseTransform) {\n        transformResponse = null;\n      }\n\n      return $http.get(tpl, extend({\n          cache: $templateCache,\n          transformResponse: transformResponse\n        }, httpOptions))\n        ['finally'](function() {\n          handleRequestFn.totalPendingRequests--;\n        })\n        .then(function(response) {\n          $templateCache.put(tpl, response.data);\n          return response.data;\n        }, handleError);\n\n      function handleError(resp) {\n        if (!ignoreRequestError) {\n          throw $templateRequestMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',\n            tpl, resp.status, resp.statusText);\n        }\n        return $q.reject(resp);\n      }\n    }\n\n    handleRequestFn.totalPendingRequests = 0;\n\n    return handleRequestFn;\n  }];\n}\n\nfunction $$TestabilityProvider() {\n  this.$get = ['$rootScope', '$browser', '$location',\n       function($rootScope,   $browser,   $location) {\n\n    /**\n     * @name $testability\n     *\n     * @description\n     * The private $$testability service provides a collection of methods for use when debugging\n     * or by automated test and debugging tools.\n     */\n    var testability = {};\n\n    /**\n     * @name $$testability#findBindings\n     *\n     * @description\n     * Returns an array of elements that are bound (via ng-bind or {{}})\n     * to expressions matching the input.\n     *\n     * @param {Element} element The element root to search from.\n     * @param {string} expression The binding expression to match.\n     * @param {boolean} opt_exactMatch If true, only returns exact matches\n     *     for the expression. Filters and whitespace are ignored.\n     */\n    testability.findBindings = function(element, expression, opt_exactMatch) {\n      var bindings = element.getElementsByClassName('ng-binding');\n      var matches = [];\n      forEach(bindings, function(binding) {\n        var dataBinding = angular.element(binding).data('$binding');\n        if (dataBinding) {\n          forEach(dataBinding, function(bindingName) {\n            if (opt_exactMatch) {\n              var matcher = new RegExp('(^|\\\\s)' + escapeForRegexp(expression) + '(\\\\s|\\\\||$)');\n              if (matcher.test(bindingName)) {\n                matches.push(binding);\n              }\n            } else {\n              if (bindingName.indexOf(expression) != -1) {\n                matches.push(binding);\n              }\n            }\n          });\n        }\n      });\n      return matches;\n    };\n\n    /**\n     * @name $$testability#findModels\n     *\n     * @description\n     * Returns an array of elements that are two-way found via ng-model to\n     * expressions matching the input.\n     *\n     * @param {Element} element The element root to search from.\n     * @param {string} expression The model expression to match.\n     * @param {boolean} opt_exactMatch If true, only returns exact matches\n     *     for the expression.\n     */\n    testability.findModels = function(element, expression, opt_exactMatch) {\n      var prefixes = ['ng-', 'data-ng-', 'ng\\\\:'];\n      for (var p = 0; p < prefixes.length; ++p) {\n        var attributeEquals = opt_exactMatch ? '=' : '*=';\n        var selector = '[' + prefixes[p] + 'model' + attributeEquals + '\"' + expression + '\"]';\n        var elements = element.querySelectorAll(selector);\n        if (elements.length) {\n          return elements;\n        }\n      }\n    };\n\n    /**\n     * @name $$testability#getLocation\n     *\n     * @description\n     * Shortcut for getting the location in a browser agnostic way. Returns\n     *     the path, search, and hash. (e.g. /path?a=b#hash)\n     */\n    testability.getLocation = function() {\n      return $location.url();\n    };\n\n    /**\n     * @name $$testability#setLocation\n     *\n     * @description\n     * Shortcut for navigating to a location without doing a full page reload.\n     *\n     * @param {string} url The location url (path, search and hash,\n     *     e.g. /path?a=b#hash) to go to.\n     */\n    testability.setLocation = function(url) {\n      if (url !== $location.url()) {\n        $location.url(url);\n        $rootScope.$digest();\n      }\n    };\n\n    /**\n     * @name $$testability#whenStable\n     *\n     * @description\n     * Calls the callback when $timeout and $http requests are completed.\n     *\n     * @param {function} callback\n     */\n    testability.whenStable = function(callback) {\n      $browser.notifyWhenNoOutstandingRequests(callback);\n    };\n\n    return testability;\n  }];\n}\n\nfunction $TimeoutProvider() {\n  this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',\n       function($rootScope,   $browser,   $q,   $$q,   $exceptionHandler) {\n\n    var deferreds = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $timeout\n      *\n      * @description\n      * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch\n      * block and delegates any exceptions to\n      * {@link ng.$exceptionHandler $exceptionHandler} service.\n      *\n      * The return value of calling `$timeout` is a promise, which will be resolved when\n      * the delay has passed and the timeout function, if provided, is executed.\n      *\n      * To cancel a timeout request, call `$timeout.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to\n      * synchronously flush the queue of deferred functions.\n      *\n      * If you only want a promise that will be resolved after some specified delay\n      * then you can call `$timeout` without the `fn` function.\n      *\n      * @param {function()=} fn A function, whose execution should be delayed.\n      * @param {number=} [delay=0] Delay in milliseconds.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @param {...*=} Pass additional parameters to the executed function.\n      * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise\n      *   will be resolved with the return value of the `fn` function.\n      *\n      */\n    function timeout(fn, delay, invokeApply) {\n      if (!isFunction(fn)) {\n        invokeApply = delay;\n        delay = fn;\n        fn = noop;\n      }\n\n      var args = sliceArgs(arguments, 3),\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          deferred = (skipApply ? $$q : $q).defer(),\n          promise = deferred.promise,\n          timeoutId;\n\n      timeoutId = $browser.defer(function() {\n        try {\n          deferred.resolve(fn.apply(null, args));\n        } catch (e) {\n          deferred.reject(e);\n          $exceptionHandler(e);\n        }\n        finally {\n          delete deferreds[promise.$$timeoutId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n      }, delay);\n\n      promise.$$timeoutId = timeoutId;\n      deferreds[timeoutId] = deferred;\n\n      return promise;\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $timeout#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`. As a result of this, the promise will be\n      * resolved with a rejection.\n      *\n      * @param {Promise=} promise Promise returned by the `$timeout` function.\n      * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n      *   canceled.\n      */\n    timeout.cancel = function(promise) {\n      if (promise && promise.$$timeoutId in deferreds) {\n        deferreds[promise.$$timeoutId].reject('canceled');\n        delete deferreds[promise.$$timeoutId];\n        return $browser.defer.cancel(promise.$$timeoutId);\n      }\n      return false;\n    };\n\n    return timeout;\n  }];\n}\n\n// NOTE:  The usage of window and document instead of $window and $document here is\n// deliberate.  This service depends on the specific behavior of anchor nodes created by the\n// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and\n// cause us to break tests.  In addition, when the browser resolves a URL for XHR, it\n// doesn't know about mocked locations and resolves URLs to the real document - which is\n// exactly the behavior needed here.  There is little value is mocking these out for this\n// service.\nvar urlParsingNode = document.createElement(\"a\");\nvar originUrl = urlResolve(window.location.href);\n\n\n/**\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL.  Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL.  This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers.  However, the parsed components will not be set if the URL assigned did not specify\n * them.  (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.)  We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again.  This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * References:\n *   http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n *   http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *   http://url.spec.whatwg.org/#urlutils\n *   https://github.com/angular/angular.js/pull/2902\n *   http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n *   | member name   | Description    |\n *   |---------------|----------------|\n *   | href          | A normalized version of the provided URL if it was not an absolute URL |\n *   | protocol      | The protocol including the trailing colon                              |\n *   | host          | The host and port (if the port is non-default) of the normalizedUrl    |\n *   | search        | The search params, minus the question mark                             |\n *   | hash          | The hash string, minus the hash symbol\n *   | hostname      | The hostname\n *   | port          | The port, without \":\"\n *   | pathname      | The pathname, beginning with \"/\"\n *\n */\nfunction urlResolve(url) {\n  var href = url;\n\n  if (msie) {\n    // Normalize before parse.  Refer Implementation Notes on why this is\n    // done in two steps on IE.\n    urlParsingNode.setAttribute(\"href\", href);\n    href = urlParsingNode.href;\n  }\n\n  urlParsingNode.setAttribute('href', href);\n\n  // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n  return {\n    href: urlParsingNode.href,\n    protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n    host: urlParsingNode.host,\n    search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n    hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n    hostname: urlParsingNode.hostname,\n    port: urlParsingNode.port,\n    pathname: (urlParsingNode.pathname.charAt(0) === '/')\n      ? urlParsingNode.pathname\n      : '/' + urlParsingNode.pathname\n  };\n}\n\n/**\n * Parse a request URL and determine whether this is a same-origin request as the application document.\n *\n * @param {string|object} requestUrl The url of the request as a string that will be resolved\n * or a parsed URL object.\n * @returns {boolean} Whether the request is for the same origin as the application document.\n */\nfunction urlIsSameOrigin(requestUrl) {\n  var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;\n  return (parsed.protocol === originUrl.protocol &&\n          parsed.host === originUrl.host);\n}\n\n/**\n * @ngdoc service\n * @name $window\n *\n * @description\n * A reference to the browser's `window` object. While `window`\n * is globally available in JavaScript, it causes testability problems, because\n * it is a global variable. In angular we always refer to it through the\n * `$window` service, so it may be overridden, removed or mocked for testing.\n *\n * Expressions, like the one defined for the `ngClick` directive in the example\n * below, are evaluated with respect to the current scope.  Therefore, there is\n * no risk of inadvertently coding in a dependency on a global value in such an\n * expression.\n *\n * @example\n   <example module=\"windowExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('windowExample', [])\n           .controller('ExampleController', ['$scope', '$window', function($scope, $window) {\n             $scope.greeting = 'Hello, World!';\n             $scope.doGreeting = function(greeting) {\n               $window.alert(greeting);\n             };\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"text\" ng-model=\"greeting\" aria-label=\"greeting\" />\n         <button ng-click=\"doGreeting(greeting)\">ALERT</button>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n      it('should display the greeting in the input box', function() {\n       element(by.model('greeting')).sendKeys('Hello, E2E Tests');\n       // If we click the button it will block the test runner\n       // element(':button').click();\n      });\n     </file>\n   </example>\n */\nfunction $WindowProvider() {\n  this.$get = valueFn(window);\n}\n\n/**\n * @name $$cookieReader\n * @requires $document\n *\n * @description\n * This is a private service for reading cookies used by $http and ngCookies\n *\n * @return {Object} a key/value map of the current cookies\n */\nfunction $$CookieReader($document) {\n  var rawDocument = $document[0] || {};\n  var lastCookies = {};\n  var lastCookieString = '';\n\n  function safeDecodeURIComponent(str) {\n    try {\n      return decodeURIComponent(str);\n    } catch (e) {\n      return str;\n    }\n  }\n\n  return function() {\n    var cookieArray, cookie, i, index, name;\n    var currentCookieString = rawDocument.cookie || '';\n\n    if (currentCookieString !== lastCookieString) {\n      lastCookieString = currentCookieString;\n      cookieArray = lastCookieString.split('; ');\n      lastCookies = {};\n\n      for (i = 0; i < cookieArray.length; i++) {\n        cookie = cookieArray[i];\n        index = cookie.indexOf('=');\n        if (index > 0) { //ignore nameless cookies\n          name = safeDecodeURIComponent(cookie.substring(0, index));\n          // the first value that is seen for a cookie is the most\n          // specific one.  values for the same cookie name that\n          // follow are for less specific paths.\n          if (isUndefined(lastCookies[name])) {\n            lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));\n          }\n        }\n      }\n    }\n    return lastCookies;\n  };\n}\n\n$$CookieReader.$inject = ['$document'];\n\nfunction $$CookieReaderProvider() {\n  this.$get = $$CookieReader;\n}\n\n/* global currencyFilter: true,\n dateFilter: true,\n filterFilter: true,\n jsonFilter: true,\n limitToFilter: true,\n lowercaseFilter: true,\n numberFilter: true,\n orderByFilter: true,\n uppercaseFilter: true,\n */\n\n/**\n * @ngdoc provider\n * @name $filterProvider\n * @description\n *\n * Filters are just functions which transform input to an output. However filters need to be\n * Dependency Injected. To achieve this a filter definition consists of a factory function which is\n * annotated with dependencies and is responsible for creating a filter function.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n * (`myapp_subsection_filterx`).\n * </div>\n *\n * ```js\n *   // Filter registration\n *   function MyModule($provide, $filterProvider) {\n *     // create a service to demonstrate injection (not always needed)\n *     $provide.value('greet', function(name){\n *       return 'Hello ' + name + '!';\n *     });\n *\n *     // register a filter factory which uses the\n *     // greet service to demonstrate DI.\n *     $filterProvider.register('greet', function(greet){\n *       // return the filter function which uses the greet service\n *       // to generate salutation\n *       return function(text) {\n *         // filters need to be forgiving so check input validity\n *         return text && greet(text) || text;\n *       };\n *     });\n *   }\n * ```\n *\n * The filter function is registered with the `$injector` under the filter name suffix with\n * `Filter`.\n *\n * ```js\n *   it('should be the same instance', inject(\n *     function($filterProvider) {\n *       $filterProvider.register('reverse', function(){\n *         return ...;\n *       });\n *     },\n *     function($filter, reverseFilter) {\n *       expect($filter('reverse')).toBe(reverseFilter);\n *     });\n * ```\n *\n *\n * For more information about how angular filters work, and how to create your own filters, see\n * {@link guide/filter Filters} in the Angular Developer Guide.\n */\n\n/**\n * @ngdoc service\n * @name $filter\n * @kind function\n * @description\n * Filters are used for formatting data displayed to the user.\n *\n * The general syntax in templates is as follows:\n *\n *         {{ expression [| filter_name[:parameter_value] ... ] }}\n *\n * @param {String} name Name of the filter function to retrieve\n * @return {Function} the filter function\n * @example\n   <example name=\"$filter\" module=\"filterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"MainCtrl\">\n        <h3>{{ originalText }}</h3>\n        <h3>{{ filteredText }}</h3>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n      angular.module('filterExample', [])\n      .controller('MainCtrl', function($scope, $filter) {\n        $scope.originalText = 'hello';\n        $scope.filteredText = $filter('uppercase')($scope.originalText);\n      });\n     </file>\n   </example>\n  */\n$FilterProvider.$inject = ['$provide'];\nfunction $FilterProvider($provide) {\n  var suffix = 'Filter';\n\n  /**\n   * @ngdoc method\n   * @name $filterProvider#register\n   * @param {string|Object} name Name of the filter function, or an object map of filters where\n   *    the keys are the filter names and the values are the filter factories.\n   *\n   *    <div class=\"alert alert-warning\">\n   *    **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n   *    Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n   *    your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n   *    (`myapp_subsection_filterx`).\n   *    </div>\n    * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.\n   * @returns {Object} Registered filter instance, or if a map of filters was provided then a map\n   *    of the registered filter instances.\n   */\n  function register(name, factory) {\n    if (isObject(name)) {\n      var filters = {};\n      forEach(name, function(filter, key) {\n        filters[key] = register(key, filter);\n      });\n      return filters;\n    } else {\n      return $provide.factory(name + suffix, factory);\n    }\n  }\n  this.register = register;\n\n  this.$get = ['$injector', function($injector) {\n    return function(name) {\n      return $injector.get(name + suffix);\n    };\n  }];\n\n  ////////////////////////////////////////\n\n  /* global\n    currencyFilter: false,\n    dateFilter: false,\n    filterFilter: false,\n    jsonFilter: false,\n    limitToFilter: false,\n    lowercaseFilter: false,\n    numberFilter: false,\n    orderByFilter: false,\n    uppercaseFilter: false,\n  */\n\n  register('currency', currencyFilter);\n  register('date', dateFilter);\n  register('filter', filterFilter);\n  register('json', jsonFilter);\n  register('limitTo', limitToFilter);\n  register('lowercase', lowercaseFilter);\n  register('number', numberFilter);\n  register('orderBy', orderByFilter);\n  register('uppercase', uppercaseFilter);\n}\n\n/**\n * @ngdoc filter\n * @name filter\n * @kind function\n *\n * @description\n * Selects a subset of items from `array` and returns it as a new array.\n *\n * @param {Array} array The source array.\n * @param {string|Object|function()} expression The predicate to be used for selecting items from\n *   `array`.\n *\n *   Can be one of:\n *\n *   - `string`: The string is used for matching against the contents of the `array`. All strings or\n *     objects with string properties in `array` that match this string will be returned. This also\n *     applies to nested object properties.\n *     The predicate can be negated by prefixing the string with `!`.\n *\n *   - `Object`: A pattern object can be used to filter specific properties on objects contained\n *     by `array`. For example `{name:\"M\", phone:\"1\"}` predicate will return an array of items\n *     which have property `name` containing \"M\" and property `phone` containing \"1\". A special\n *     property name `$` can be used (as in `{$:\"text\"}`) to accept a match against any\n *     property of the object or its nested object properties. That's equivalent to the simple\n *     substring match with a `string` as described above. The predicate can be negated by prefixing\n *     the string with `!`.\n *     For example `{name: \"!M\"}` predicate will return an array of items which have property `name`\n *     not containing \"M\".\n *\n *     Note that a named property will match properties on the same level only, while the special\n *     `$` property will match properties on the same level or deeper. E.g. an array item like\n *     `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but\n *     **will** be matched by `{$: 'John'}`.\n *\n *   - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.\n *     The function is called for each element of the array, with the element, its index, and\n *     the entire array itself as arguments.\n *\n *     The final result is an array of those elements that the predicate returned true for.\n *\n * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in\n *     determining if the expected value (from the filter expression) and actual value (from\n *     the object in the array) should be considered a match.\n *\n *   Can be one of:\n *\n *   - `function(actual, expected)`:\n *     The function will be given the object value and the predicate value to compare and\n *     should return true if both values should be considered equal.\n *\n *   - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.\n *     This is essentially strict comparison of expected and actual.\n *\n *   - `false|undefined`: A short hand for a function which will look for a substring match in case\n *     insensitive way.\n *\n *     Primitive values are converted to strings. Objects are not compared against primitives,\n *     unless they have a custom `toString` method (e.g. `Date` objects).\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div ng-init=\"friends = [{name:'John', phone:'555-1276'},\n                                {name:'Mary', phone:'800-BIG-MARY'},\n                                {name:'Mike', phone:'555-4321'},\n                                {name:'Adam', phone:'555-5678'},\n                                {name:'Julie', phone:'555-8765'},\n                                {name:'Juliette', phone:'555-5678'}]\"></div>\n\n       <label>Search: <input ng-model=\"searchText\"></label>\n       <table id=\"searchTextResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friend in friends | filter:searchText\">\n           <td>{{friend.name}}</td>\n           <td>{{friend.phone}}</td>\n         </tr>\n       </table>\n       <hr>\n       <label>Any: <input ng-model=\"search.$\"></label> <br>\n       <label>Name only <input ng-model=\"search.name\"></label><br>\n       <label>Phone only <input ng-model=\"search.phone\"></label><br>\n       <label>Equality <input type=\"checkbox\" ng-model=\"strict\"></label><br>\n       <table id=\"searchObjResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friendObj in friends | filter:search:strict\">\n           <td>{{friendObj.name}}</td>\n           <td>{{friendObj.phone}}</td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var expectFriendNames = function(expectedNames, key) {\n         element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {\n           arr.forEach(function(wd, i) {\n             expect(wd.getText()).toMatch(expectedNames[i]);\n           });\n         });\n       };\n\n       it('should search across all fields when filtering with a string', function() {\n         var searchText = element(by.model('searchText'));\n         searchText.clear();\n         searchText.sendKeys('m');\n         expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');\n\n         searchText.clear();\n         searchText.sendKeys('76');\n         expectFriendNames(['John', 'Julie'], 'friend');\n       });\n\n       it('should search in specific fields when filtering with a predicate object', function() {\n         var searchAny = element(by.model('search.$'));\n         searchAny.clear();\n         searchAny.sendKeys('i');\n         expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');\n       });\n       it('should use a equal comparison when comparator is true', function() {\n         var searchName = element(by.model('search.name'));\n         var strict = element(by.model('strict'));\n         searchName.clear();\n         searchName.sendKeys('Julie');\n         strict.click();\n         expectFriendNames(['Julie'], 'friendObj');\n       });\n     </file>\n   </example>\n */\nfunction filterFilter() {\n  return function(array, expression, comparator) {\n    if (!isArrayLike(array)) {\n      if (array == null) {\n        return array;\n      } else {\n        throw minErr('filter')('notarray', 'Expected array but received: {0}', array);\n      }\n    }\n\n    var expressionType = getTypeForFilter(expression);\n    var predicateFn;\n    var matchAgainstAnyProp;\n\n    switch (expressionType) {\n      case 'function':\n        predicateFn = expression;\n        break;\n      case 'boolean':\n      case 'null':\n      case 'number':\n      case 'string':\n        matchAgainstAnyProp = true;\n        //jshint -W086\n      case 'object':\n        //jshint +W086\n        predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);\n        break;\n      default:\n        return array;\n    }\n\n    return Array.prototype.filter.call(array, predicateFn);\n  };\n}\n\n// Helper functions for `filterFilter`\nfunction createPredicateFn(expression, comparator, matchAgainstAnyProp) {\n  var shouldMatchPrimitives = isObject(expression) && ('$' in expression);\n  var predicateFn;\n\n  if (comparator === true) {\n    comparator = equals;\n  } else if (!isFunction(comparator)) {\n    comparator = function(actual, expected) {\n      if (isUndefined(actual)) {\n        // No substring matching against `undefined`\n        return false;\n      }\n      if ((actual === null) || (expected === null)) {\n        // No substring matching against `null`; only match against `null`\n        return actual === expected;\n      }\n      if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {\n        // Should not compare primitives against objects, unless they have custom `toString` method\n        return false;\n      }\n\n      actual = lowercase('' + actual);\n      expected = lowercase('' + expected);\n      return actual.indexOf(expected) !== -1;\n    };\n  }\n\n  predicateFn = function(item) {\n    if (shouldMatchPrimitives && !isObject(item)) {\n      return deepCompare(item, expression.$, comparator, false);\n    }\n    return deepCompare(item, expression, comparator, matchAgainstAnyProp);\n  };\n\n  return predicateFn;\n}\n\nfunction deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {\n  var actualType = getTypeForFilter(actual);\n  var expectedType = getTypeForFilter(expected);\n\n  if ((expectedType === 'string') && (expected.charAt(0) === '!')) {\n    return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);\n  } else if (isArray(actual)) {\n    // In case `actual` is an array, consider it a match\n    // if ANY of it's items matches `expected`\n    return actual.some(function(item) {\n      return deepCompare(item, expected, comparator, matchAgainstAnyProp);\n    });\n  }\n\n  switch (actualType) {\n    case 'object':\n      var key;\n      if (matchAgainstAnyProp) {\n        for (key in actual) {\n          if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {\n            return true;\n          }\n        }\n        return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);\n      } else if (expectedType === 'object') {\n        for (key in expected) {\n          var expectedVal = expected[key];\n          if (isFunction(expectedVal) || isUndefined(expectedVal)) {\n            continue;\n          }\n\n          var matchAnyProperty = key === '$';\n          var actualVal = matchAnyProperty ? actual : actual[key];\n          if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {\n            return false;\n          }\n        }\n        return true;\n      } else {\n        return comparator(actual, expected);\n      }\n      break;\n    case 'function':\n      return false;\n    default:\n      return comparator(actual, expected);\n  }\n}\n\n// Used for easily differentiating between `null` and actual `object`\nfunction getTypeForFilter(val) {\n  return (val === null) ? 'null' : typeof val;\n}\n\nvar MAX_DIGITS = 22;\nvar DECIMAL_SEP = '.';\nvar ZERO_CHAR = '0';\n\n/**\n * @ngdoc filter\n * @name currency\n * @kind function\n *\n * @description\n * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default\n * symbol for current locale is used.\n *\n * @param {number} amount Input to filter.\n * @param {string=} symbol Currency symbol or identifier to be displayed.\n * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale\n * @returns {string} Formatted number.\n *\n *\n * @example\n   <example module=\"currencyExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('currencyExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.amount = 1234.56;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"number\" ng-model=\"amount\" aria-label=\"amount\"> <br>\n         default currency symbol ($): <span id=\"currency-default\">{{amount | currency}}</span><br>\n         custom currency identifier (USD$): <span id=\"currency-custom\">{{amount | currency:\"USD$\"}}</span>\n         no fractions (0): <span id=\"currency-no-fractions\">{{amount | currency:\"USD$\":0}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should init with 1234.56', function() {\n         expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');\n         expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');\n         expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');\n       });\n       it('should update', function() {\n         if (browser.params.browser == 'safari') {\n           // Safari does not understand the minus key. See\n           // https://github.com/angular/protractor/issues/481\n           return;\n         }\n         element(by.model('amount')).clear();\n         element(by.model('amount')).sendKeys('-1234');\n         expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');\n         expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');\n         expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');\n       });\n     </file>\n   </example>\n */\ncurrencyFilter.$inject = ['$locale'];\nfunction currencyFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(amount, currencySymbol, fractionSize) {\n    if (isUndefined(currencySymbol)) {\n      currencySymbol = formats.CURRENCY_SYM;\n    }\n\n    if (isUndefined(fractionSize)) {\n      fractionSize = formats.PATTERNS[1].maxFrac;\n    }\n\n    // if null or undefined pass it through\n    return (amount == null)\n        ? amount\n        : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).\n            replace(/\\u00A4/g, currencySymbol);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name number\n * @kind function\n *\n * @description\n * Formats a number as text.\n *\n * If the input is null or undefined, it will just be returned.\n * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively.\n * If the input is not a number an empty string is returned.\n *\n *\n * @param {number|string} number Number to format.\n * @param {(number|string)=} fractionSize Number of decimal places to round the number to.\n * If this is not provided then the fraction size is computed from the current locale's number\n * formatting pattern. In the case of the default locale, it will be 3.\n * @returns {string} Number rounded to fractionSize and places a “,” after each third digit.\n *\n * @example\n   <example module=\"numberFilterExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('numberFilterExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.val = 1234.56789;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>Enter number: <input ng-model='val'></label><br>\n         Default formatting: <span id='number-default'>{{val | number}}</span><br>\n         No fractions: <span>{{val | number:0}}</span><br>\n         Negative number: <span>{{-val | number:4}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format numbers', function() {\n         expect(element(by.id('number-default')).getText()).toBe('1,234.568');\n         expect(element(by.binding('val | number:0')).getText()).toBe('1,235');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');\n       });\n\n       it('should update', function() {\n         element(by.model('val')).clear();\n         element(by.model('val')).sendKeys('3374.333');\n         expect(element(by.id('number-default')).getText()).toBe('3,374.333');\n         expect(element(by.binding('val | number:0')).getText()).toBe('3,374');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');\n      });\n     </file>\n   </example>\n */\nnumberFilter.$inject = ['$locale'];\nfunction numberFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(number, fractionSize) {\n\n    // if null or undefined pass it through\n    return (number == null)\n        ? number\n        : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,\n                       fractionSize);\n  };\n}\n\n/**\n * Parse a number (as a string) into three components that can be used\n * for formatting the number.\n *\n * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)\n *\n * @param  {string} numStr The number to parse\n * @return {object} An object describing this number, containing the following keys:\n *  - d : an array of digits containing leading zeros as necessary\n *  - i : the number of the digits in `d` that are to the left of the decimal point\n *  - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d`\n *\n */\nfunction parse(numStr) {\n  var exponent = 0, digits, numberOfIntegerDigits;\n  var i, j, zeros;\n\n  // Decimal point?\n  if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {\n    numStr = numStr.replace(DECIMAL_SEP, '');\n  }\n\n  // Exponential form?\n  if ((i = numStr.search(/e/i)) > 0) {\n    // Work out the exponent.\n    if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;\n    numberOfIntegerDigits += +numStr.slice(i + 1);\n    numStr = numStr.substring(0, i);\n  } else if (numberOfIntegerDigits < 0) {\n    // There was no decimal point or exponent so it is an integer.\n    numberOfIntegerDigits = numStr.length;\n  }\n\n  // Count the number of leading zeros.\n  for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++) {/* jshint noempty: false */}\n\n  if (i == (zeros = numStr.length)) {\n    // The digits are all zero.\n    digits = [0];\n    numberOfIntegerDigits = 1;\n  } else {\n    // Count the number of trailing zeros\n    zeros--;\n    while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;\n\n    // Trailing zeros are insignificant so ignore them\n    numberOfIntegerDigits -= i;\n    digits = [];\n    // Convert string to array of digits without leading/trailing zeros.\n    for (j = 0; i <= zeros; i++, j++) {\n      digits[j] = +numStr.charAt(i);\n    }\n  }\n\n  // If the number overflows the maximum allowed digits then use an exponent.\n  if (numberOfIntegerDigits > MAX_DIGITS) {\n    digits = digits.splice(0, MAX_DIGITS - 1);\n    exponent = numberOfIntegerDigits - 1;\n    numberOfIntegerDigits = 1;\n  }\n\n  return { d: digits, e: exponent, i: numberOfIntegerDigits };\n}\n\n/**\n * Round the parsed number to the specified number of decimal places\n * This function changed the parsedNumber in-place\n */\nfunction roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {\n    var digits = parsedNumber.d;\n    var fractionLen = digits.length - parsedNumber.i;\n\n    // determine fractionSize if it is not specified; `+fractionSize` converts it to a number\n    fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;\n\n    // The index of the digit to where rounding is to occur\n    var roundAt = fractionSize + parsedNumber.i;\n    var digit = digits[roundAt];\n\n    if (roundAt > 0) {\n      // Drop fractional digits beyond `roundAt`\n      digits.splice(Math.max(parsedNumber.i, roundAt));\n\n      // Set non-fractional digits beyond `roundAt` to 0\n      for (var j = roundAt; j < digits.length; j++) {\n        digits[j] = 0;\n      }\n    } else {\n      // We rounded to zero so reset the parsedNumber\n      fractionLen = Math.max(0, fractionLen);\n      parsedNumber.i = 1;\n      digits.length = Math.max(1, roundAt = fractionSize + 1);\n      digits[0] = 0;\n      for (var i = 1; i < roundAt; i++) digits[i] = 0;\n    }\n\n    if (digit >= 5) {\n      if (roundAt - 1 < 0) {\n        for (var k = 0; k > roundAt; k--) {\n          digits.unshift(0);\n          parsedNumber.i++;\n        }\n        digits.unshift(1);\n        parsedNumber.i++;\n      } else {\n        digits[roundAt - 1]++;\n      }\n    }\n\n    // Pad out with zeros to get the required fraction length\n    for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);\n\n\n    // Do any carrying, e.g. a digit was rounded up to 10\n    var carry = digits.reduceRight(function(carry, d, i, digits) {\n      d = d + carry;\n      digits[i] = d % 10;\n      return Math.floor(d / 10);\n    }, 0);\n    if (carry) {\n      digits.unshift(carry);\n      parsedNumber.i++;\n    }\n}\n\n/**\n * Format a number into a string\n * @param  {number} number       The number to format\n * @param  {{\n *           minFrac, // the minimum number of digits required in the fraction part of the number\n *           maxFrac, // the maximum number of digits required in the fraction part of the number\n *           gSize,   // number of digits in each group of separated digits\n *           lgSize,  // number of digits in the last group of digits before the decimal separator\n *           negPre,  // the string to go in front of a negative number (e.g. `-` or `(`))\n *           posPre,  // the string to go in front of a positive number\n *           negSuf,  // the string to go after a negative number (e.g. `)`)\n *           posSuf   // the string to go after a positive number\n *         }} pattern\n * @param  {string} groupSep     The string to separate groups of number (e.g. `,`)\n * @param  {string} decimalSep   The string to act as the decimal separator (e.g. `.`)\n * @param  {[type]} fractionSize The size of the fractional part of the number\n * @return {string}              The number formatted as a string\n */\nfunction formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {\n\n  if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';\n\n  var isInfinity = !isFinite(number);\n  var isZero = false;\n  var numStr = Math.abs(number) + '',\n      formattedText = '',\n      parsedNumber;\n\n  if (isInfinity) {\n    formattedText = '\\u221e';\n  } else {\n    parsedNumber = parse(numStr);\n\n    roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);\n\n    var digits = parsedNumber.d;\n    var integerLen = parsedNumber.i;\n    var exponent = parsedNumber.e;\n    var decimals = [];\n    isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);\n\n    // pad zeros for small numbers\n    while (integerLen < 0) {\n      digits.unshift(0);\n      integerLen++;\n    }\n\n    // extract decimals digits\n    if (integerLen > 0) {\n      decimals = digits.splice(integerLen);\n    } else {\n      decimals = digits;\n      digits = [0];\n    }\n\n    // format the integer digits with grouping separators\n    var groups = [];\n    if (digits.length >= pattern.lgSize) {\n      groups.unshift(digits.splice(-pattern.lgSize).join(''));\n    }\n    while (digits.length > pattern.gSize) {\n      groups.unshift(digits.splice(-pattern.gSize).join(''));\n    }\n    if (digits.length) {\n      groups.unshift(digits.join(''));\n    }\n    formattedText = groups.join(groupSep);\n\n    // append the decimal digits\n    if (decimals.length) {\n      formattedText += decimalSep + decimals.join('');\n    }\n\n    if (exponent) {\n      formattedText += 'e+' + exponent;\n    }\n  }\n  if (number < 0 && !isZero) {\n    return pattern.negPre + formattedText + pattern.negSuf;\n  } else {\n    return pattern.posPre + formattedText + pattern.posSuf;\n  }\n}\n\nfunction padNumber(num, digits, trim, negWrap) {\n  var neg = '';\n  if (num < 0 || (negWrap && num <= 0)) {\n    if (negWrap) {\n      num = -num + 1;\n    } else {\n      num = -num;\n      neg = '-';\n    }\n  }\n  num = '' + num;\n  while (num.length < digits) num = ZERO_CHAR + num;\n  if (trim) {\n    num = num.substr(num.length - digits);\n  }\n  return neg + num;\n}\n\n\nfunction dateGetter(name, size, offset, trim, negWrap) {\n  offset = offset || 0;\n  return function(date) {\n    var value = date['get' + name]();\n    if (offset > 0 || value > -offset) {\n      value += offset;\n    }\n    if (value === 0 && offset == -12) value = 12;\n    return padNumber(value, size, trim, negWrap);\n  };\n}\n\nfunction dateStrGetter(name, shortForm, standAlone) {\n  return function(date, formats) {\n    var value = date['get' + name]();\n    var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : '');\n    var get = uppercase(propPrefix + name);\n\n    return formats[get][value];\n  };\n}\n\nfunction timeZoneGetter(date, formats, offset) {\n  var zone = -1 * offset;\n  var paddedZone = (zone >= 0) ? \"+\" : \"\";\n\n  paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +\n                padNumber(Math.abs(zone % 60), 2);\n\n  return paddedZone;\n}\n\nfunction getFirstThursdayOfYear(year) {\n    // 0 = index of January\n    var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();\n    // 4 = index of Thursday (+1 to account for 1st = 5)\n    // 11 = index of *next* Thursday (+1 account for 1st = 12)\n    return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);\n}\n\nfunction getThursdayThisWeek(datetime) {\n    return new Date(datetime.getFullYear(), datetime.getMonth(),\n      // 4 = index of Thursday\n      datetime.getDate() + (4 - datetime.getDay()));\n}\n\nfunction weekGetter(size) {\n   return function(date) {\n      var firstThurs = getFirstThursdayOfYear(date.getFullYear()),\n         thisThurs = getThursdayThisWeek(date);\n\n      var diff = +thisThurs - +firstThurs,\n         result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week\n\n      return padNumber(result, size);\n   };\n}\n\nfunction ampmGetter(date, formats) {\n  return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];\n}\n\nfunction eraGetter(date, formats) {\n  return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];\n}\n\nfunction longEraGetter(date, formats) {\n  return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];\n}\n\nvar DATE_FORMATS = {\n  yyyy: dateGetter('FullYear', 4, 0, false, true),\n    yy: dateGetter('FullYear', 2, 0, true, true),\n     y: dateGetter('FullYear', 1, 0, false, true),\n  MMMM: dateStrGetter('Month'),\n   MMM: dateStrGetter('Month', true),\n    MM: dateGetter('Month', 2, 1),\n     M: dateGetter('Month', 1, 1),\n  LLLL: dateStrGetter('Month', false, true),\n    dd: dateGetter('Date', 2),\n     d: dateGetter('Date', 1),\n    HH: dateGetter('Hours', 2),\n     H: dateGetter('Hours', 1),\n    hh: dateGetter('Hours', 2, -12),\n     h: dateGetter('Hours', 1, -12),\n    mm: dateGetter('Minutes', 2),\n     m: dateGetter('Minutes', 1),\n    ss: dateGetter('Seconds', 2),\n     s: dateGetter('Seconds', 1),\n     // while ISO 8601 requires fractions to be prefixed with `.` or `,`\n     // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions\n   sss: dateGetter('Milliseconds', 3),\n  EEEE: dateStrGetter('Day'),\n   EEE: dateStrGetter('Day', true),\n     a: ampmGetter,\n     Z: timeZoneGetter,\n    ww: weekGetter(2),\n     w: weekGetter(1),\n     G: eraGetter,\n     GG: eraGetter,\n     GGG: eraGetter,\n     GGGG: longEraGetter\n};\n\nvar DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,\n    NUMBER_STRING = /^\\-?\\d+$/;\n\n/**\n * @ngdoc filter\n * @name date\n * @kind function\n *\n * @description\n *   Formats `date` to a string based on the requested `format`.\n *\n *   `format` string can be composed of the following elements:\n *\n *   * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)\n *   * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)\n *   * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)\n *   * `'MMMM'`: Month in year (January-December)\n *   * `'MMM'`: Month in year (Jan-Dec)\n *   * `'MM'`: Month in year, padded (01-12)\n *   * `'M'`: Month in year (1-12)\n *   * `'LLLL'`: Stand-alone month in year (January-December)\n *   * `'dd'`: Day in month, padded (01-31)\n *   * `'d'`: Day in month (1-31)\n *   * `'EEEE'`: Day in Week,(Sunday-Saturday)\n *   * `'EEE'`: Day in Week, (Sun-Sat)\n *   * `'HH'`: Hour in day, padded (00-23)\n *   * `'H'`: Hour in day (0-23)\n *   * `'hh'`: Hour in AM/PM, padded (01-12)\n *   * `'h'`: Hour in AM/PM, (1-12)\n *   * `'mm'`: Minute in hour, padded (00-59)\n *   * `'m'`: Minute in hour (0-59)\n *   * `'ss'`: Second in minute, padded (00-59)\n *   * `'s'`: Second in minute (0-59)\n *   * `'sss'`: Millisecond in second, padded (000-999)\n *   * `'a'`: AM/PM marker\n *   * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)\n *   * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year\n *   * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year\n *   * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')\n *   * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')\n *\n *   `format` string can also be one of the following predefined\n *   {@link guide/i18n localizable formats}:\n *\n *   * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale\n *     (e.g. Sep 3, 2010 12:05:08 PM)\n *   * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US  locale (e.g. 9/3/10 12:05 PM)\n *   * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US  locale\n *     (e.g. Friday, September 3, 2010)\n *   * `'longDate'`: equivalent to `'MMMM d, y'` for en_US  locale (e.g. September 3, 2010)\n *   * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US  locale (e.g. Sep 3, 2010)\n *   * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)\n *   * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)\n *   * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)\n *\n *   `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.\n *   `\"h 'in the morning'\"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence\n *   (e.g. `\"h 'o''clock'\"`).\n *\n * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or\n *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its\n *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is\n *    specified in the string input, the time is considered to be in the local timezone.\n * @param {string=} format Formatting rules (see Description). If not specified,\n *    `mediumDate` is used.\n * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the\n *    continental US time zone abbreviations, but for general use, use a time zone offset, for\n *    example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n *    If not specified, the timezone of the browser will be used.\n * @returns {string} Formatted string or the input if input is not recognized as date/millis.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:\n           <span>{{1288323623006 | date:'medium'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:\n          <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:\n          <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:\"MM/dd/yyyy 'at' h:mma\"}}</span>:\n          <span>{{'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"}}</span><br>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format date', function() {\n         expect(element(by.binding(\"1288323623006 | date:'medium'\")).getText()).\n            toMatch(/Oct 2\\d, 2010 \\d{1,2}:\\d{2}:\\d{2} (AM|PM)/);\n         expect(element(by.binding(\"1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'\")).getText()).\n            toMatch(/2010\\-10\\-2\\d \\d{2}:\\d{2}:\\d{2} (\\-|\\+)?\\d{4}/);\n         expect(element(by.binding(\"'1288323623006' | date:'MM/dd/yyyy @ h:mma'\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 @ \\d{1,2}:\\d{2}(AM|PM)/);\n         expect(element(by.binding(\"'1288323623006' | date:\\\"MM/dd/yyyy 'at' h:mma\\\"\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 at \\d{1,2}:\\d{2}(AM|PM)/);\n       });\n     </file>\n   </example>\n */\ndateFilter.$inject = ['$locale'];\nfunction dateFilter($locale) {\n\n\n  var R_ISO8601_STR = /^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;\n                     // 1        2       3         4          5          6          7          8  9     10      11\n  function jsonStringToDate(string) {\n    var match;\n    if (match = string.match(R_ISO8601_STR)) {\n      var date = new Date(0),\n          tzHour = 0,\n          tzMin  = 0,\n          dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,\n          timeSetter = match[8] ? date.setUTCHours : date.setHours;\n\n      if (match[9]) {\n        tzHour = toInt(match[9] + match[10]);\n        tzMin = toInt(match[9] + match[11]);\n      }\n      dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));\n      var h = toInt(match[4] || 0) - tzHour;\n      var m = toInt(match[5] || 0) - tzMin;\n      var s = toInt(match[6] || 0);\n      var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n      timeSetter.call(date, h, m, s, ms);\n      return date;\n    }\n    return string;\n  }\n\n\n  return function(date, format, timezone) {\n    var text = '',\n        parts = [],\n        fn, match;\n\n    format = format || 'mediumDate';\n    format = $locale.DATETIME_FORMATS[format] || format;\n    if (isString(date)) {\n      date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);\n    }\n\n    if (isNumber(date)) {\n      date = new Date(date);\n    }\n\n    if (!isDate(date) || !isFinite(date.getTime())) {\n      return date;\n    }\n\n    while (format) {\n      match = DATE_FORMATS_SPLIT.exec(format);\n      if (match) {\n        parts = concat(parts, match, 1);\n        format = parts.pop();\n      } else {\n        parts.push(format);\n        format = null;\n      }\n    }\n\n    var dateTimezoneOffset = date.getTimezoneOffset();\n    if (timezone) {\n      dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n      date = convertTimezoneToLocal(date, timezone, true);\n    }\n    forEach(parts, function(value) {\n      fn = DATE_FORMATS[value];\n      text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)\n                 : value === \"''\" ? \"'\" : value.replace(/(^'|'$)/g, '').replace(/''/g, \"'\");\n    });\n\n    return text;\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name json\n * @kind function\n *\n * @description\n *   Allows you to convert a JavaScript object into JSON string.\n *\n *   This filter is mostly useful for debugging. When using the double curly {{value}} notation\n *   the binding is automatically converted to JSON.\n *\n * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.\n * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.\n * @returns {string} JSON string.\n *\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <pre id=\"default-spacing\">{{ {'name':'value'} | json }}</pre>\n       <pre id=\"custom-spacing\">{{ {'name':'value'} | json:4 }}</pre>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should jsonify filtered objects', function() {\n         expect(element(by.id('default-spacing')).getText()).toMatch(/\\{\\n  \"name\": ?\"value\"\\n}/);\n         expect(element(by.id('custom-spacing')).getText()).toMatch(/\\{\\n    \"name\": ?\"value\"\\n}/);\n       });\n     </file>\n   </example>\n *\n */\nfunction jsonFilter() {\n  return function(object, spacing) {\n    if (isUndefined(spacing)) {\n        spacing = 2;\n    }\n    return toJson(object, spacing);\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name lowercase\n * @kind function\n * @description\n * Converts string to lowercase.\n * @see angular.lowercase\n */\nvar lowercaseFilter = valueFn(lowercase);\n\n\n/**\n * @ngdoc filter\n * @name uppercase\n * @kind function\n * @description\n * Converts string to uppercase.\n * @see angular.uppercase\n */\nvar uppercaseFilter = valueFn(uppercase);\n\n/**\n * @ngdoc filter\n * @name limitTo\n * @kind function\n *\n * @description\n * Creates a new array or string containing only a specified number of elements. The elements\n * are taken from either the beginning or the end of the source array, string or number, as specified by\n * the value and sign (positive or negative) of `limit`. If a number is used as input, it is\n * converted to a string.\n *\n * @param {Array|string|number} input Source array, string or number to be limited.\n * @param {string|number} limit The length of the returned array or string. If the `limit` number\n *     is positive, `limit` number of items from the beginning of the source array/string are copied.\n *     If the number is negative, `limit` number  of items from the end of the source array/string\n *     are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,\n *     the input will be returned unchanged.\n * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`\n *     indicates an offset from the end of `input`. Defaults to `0`.\n * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array\n *     had less than `limit` elements.\n *\n * @example\n   <example module=\"limitToExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('limitToExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.numbers = [1,2,3,4,5,6,7,8,9];\n             $scope.letters = \"abcdefghi\";\n             $scope.longNumber = 2345432342;\n             $scope.numLimit = 3;\n             $scope.letterLimit = 3;\n             $scope.longNumberLimit = 3;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>\n            Limit {{numbers}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"numLimit\">\n         </label>\n         <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>\n         <label>\n            Limit {{letters}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"letterLimit\">\n         </label>\n         <p>Output letters: {{ letters | limitTo:letterLimit }}</p>\n         <label>\n            Limit {{longNumber}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"longNumberLimit\">\n         </label>\n         <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var numLimitInput = element(by.model('numLimit'));\n       var letterLimitInput = element(by.model('letterLimit'));\n       var longNumberLimitInput = element(by.model('longNumberLimit'));\n       var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));\n       var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));\n       var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));\n\n       it('should limit the number array to first three items', function() {\n         expect(numLimitInput.getAttribute('value')).toBe('3');\n         expect(letterLimitInput.getAttribute('value')).toBe('3');\n         expect(longNumberLimitInput.getAttribute('value')).toBe('3');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abc');\n         expect(limitedLongNumber.getText()).toEqual('Output long number: 234');\n       });\n\n       // There is a bug in safari and protractor that doesn't like the minus key\n       // it('should update the output when -3 is entered', function() {\n       //   numLimitInput.clear();\n       //   numLimitInput.sendKeys('-3');\n       //   letterLimitInput.clear();\n       //   letterLimitInput.sendKeys('-3');\n       //   longNumberLimitInput.clear();\n       //   longNumberLimitInput.sendKeys('-3');\n       //   expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');\n       //   expect(limitedLetters.getText()).toEqual('Output letters: ghi');\n       //   expect(limitedLongNumber.getText()).toEqual('Output long number: 342');\n       // });\n\n       it('should not exceed the maximum size of input array', function() {\n         numLimitInput.clear();\n         numLimitInput.sendKeys('100');\n         letterLimitInput.clear();\n         letterLimitInput.sendKeys('100');\n         longNumberLimitInput.clear();\n         longNumberLimitInput.sendKeys('100');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');\n         expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');\n       });\n     </file>\n   </example>\n*/\nfunction limitToFilter() {\n  return function(input, limit, begin) {\n    if (Math.abs(Number(limit)) === Infinity) {\n      limit = Number(limit);\n    } else {\n      limit = toInt(limit);\n    }\n    if (isNaN(limit)) return input;\n\n    if (isNumber(input)) input = input.toString();\n    if (!isArray(input) && !isString(input)) return input;\n\n    begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);\n    begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;\n\n    if (limit >= 0) {\n      return input.slice(begin, begin + limit);\n    } else {\n      if (begin === 0) {\n        return input.slice(limit, input.length);\n      } else {\n        return input.slice(Math.max(0, begin + limit), begin);\n      }\n    }\n  };\n}\n\n/**\n * @ngdoc filter\n * @name orderBy\n * @kind function\n *\n * @description\n * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically\n * for strings and numerically for numbers. Note: if you notice numbers are not being sorted\n * as expected, make sure they are actually being saved as numbers and not strings.\n * Array-like values (e.g. NodeLists, jQuery objects, TypedArrays, Strings, etc) are also supported.\n *\n * @param {Array} array The array (or array-like object) to sort.\n * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be\n *    used by the comparator to determine the order of elements.\n *\n *    Can be one of:\n *\n *    - `function`: Getter function. The result of this function will be sorted using the\n *      `<`, `===`, `>` operator.\n *    - `string`: An Angular expression. The result of this expression is used to compare elements\n *      (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by\n *      3 first characters of a property called `name`). The result of a constant expression\n *      is interpreted as a property name to be used in comparisons (for example `\"special name\"`\n *      to sort object by the value of their `special name` property). An expression can be\n *      optionally prefixed with `+` or `-` to control ascending or descending sort order\n *      (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array\n *      element itself is used to compare where sorting.\n *    - `Array`: An array of function or string predicates. The first predicate in the array\n *      is used for sorting, but when two items are equivalent, the next predicate is used.\n *\n *    If the predicate is missing or empty then it defaults to `'+'`.\n *\n * @param {boolean=} reverse Reverse the order of the array.\n * @returns {Array} Sorted copy of the source array.\n *\n *\n * @example\n * The example below demonstrates a simple ngRepeat, where the data is sorted\n * by age in descending order (predicate is set to `'-age'`).\n * `reverse` is not set, which means it defaults to `false`.\n   <example module=\"orderByExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <table class=\"friend\">\n           <tr>\n             <th>Name</th>\n             <th>Phone Number</th>\n             <th>Age</th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:'-age'\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('orderByExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.friends =\n               [{name:'John', phone:'555-1212', age:10},\n                {name:'Mary', phone:'555-9876', age:19},\n                {name:'Mike', phone:'555-4321', age:21},\n                {name:'Adam', phone:'555-5678', age:35},\n                {name:'Julie', phone:'555-8765', age:29}];\n         }]);\n     </file>\n   </example>\n *\n * The predicate and reverse parameters can be controlled dynamically through scope properties,\n * as shown in the next example.\n * @example\n   <example module=\"orderByExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n         <hr/>\n         <button ng-click=\"predicate=''\">Set to unsorted</button>\n         <table class=\"friend\">\n           <tr>\n            <th>\n                <button ng-click=\"order('name')\">Name</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n            <th>\n                <button ng-click=\"order('phone')\">Phone Number</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n            <th>\n                <button ng-click=\"order('age')\">Age</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:predicate:reverse\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('orderByExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.friends =\n               [{name:'John', phone:'555-1212', age:10},\n                {name:'Mary', phone:'555-9876', age:19},\n                {name:'Mike', phone:'555-4321', age:21},\n                {name:'Adam', phone:'555-5678', age:35},\n                {name:'Julie', phone:'555-8765', age:29}];\n           $scope.predicate = 'age';\n           $scope.reverse = true;\n           $scope.order = function(predicate) {\n             $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n             $scope.predicate = predicate;\n           };\n         }]);\n      </file>\n     <file name=\"style.css\">\n       .sortorder:after {\n         content: '\\25b2';\n       }\n       .sortorder.reverse:after {\n         content: '\\25bc';\n       }\n     </file>\n   </example>\n *\n * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the\n * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the\n * desired parameters.\n *\n * Example:\n *\n * @example\n  <example module=\"orderByExample\">\n    <file name=\"index.html\">\n    <div ng-controller=\"ExampleController\">\n      <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n      <table class=\"friend\">\n        <tr>\n          <th>\n              <button ng-click=\"order('name')\">Name</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n          <th>\n              <button ng-click=\"order('phone')\">Phone Number</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n          <th>\n              <button ng-click=\"order('age')\">Age</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n        </tr>\n        <tr ng-repeat=\"friend in friends\">\n          <td>{{friend.name}}</td>\n          <td>{{friend.phone}}</td>\n          <td>{{friend.age}}</td>\n        </tr>\n      </table>\n    </div>\n    </file>\n\n    <file name=\"script.js\">\n      angular.module('orderByExample', [])\n        .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {\n          var orderBy = $filter('orderBy');\n          $scope.friends = [\n            { name: 'John',    phone: '555-1212',    age: 10 },\n            { name: 'Mary',    phone: '555-9876',    age: 19 },\n            { name: 'Mike',    phone: '555-4321',    age: 21 },\n            { name: 'Adam',    phone: '555-5678',    age: 35 },\n            { name: 'Julie',   phone: '555-8765',    age: 29 }\n          ];\n          $scope.order = function(predicate) {\n            $scope.predicate = predicate;\n            $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n            $scope.friends = orderBy($scope.friends, predicate, $scope.reverse);\n          };\n          $scope.order('age', true);\n        }]);\n    </file>\n\n    <file name=\"style.css\">\n       .sortorder:after {\n         content: '\\25b2';\n       }\n       .sortorder.reverse:after {\n         content: '\\25bc';\n       }\n    </file>\n</example>\n */\norderByFilter.$inject = ['$parse'];\nfunction orderByFilter($parse) {\n  return function(array, sortPredicate, reverseOrder) {\n\n    if (array == null) return array;\n    if (!isArrayLike(array)) {\n      throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);\n    }\n\n    if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }\n    if (sortPredicate.length === 0) { sortPredicate = ['+']; }\n\n    var predicates = processPredicates(sortPredicate, reverseOrder);\n    // Add a predicate at the end that evaluates to the element index. This makes the\n    // sort stable as it works as a tie-breaker when all the input predicates cannot\n    // distinguish between two elements.\n    predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});\n\n    // The next three lines are a version of a Swartzian Transform idiom from Perl\n    // (sometimes called the Decorate-Sort-Undecorate idiom)\n    // See https://en.wikipedia.org/wiki/Schwartzian_transform\n    var compareValues = Array.prototype.map.call(array, getComparisonObject);\n    compareValues.sort(doComparison);\n    array = compareValues.map(function(item) { return item.value; });\n\n    return array;\n\n    function getComparisonObject(value, index) {\n      return {\n        value: value,\n        predicateValues: predicates.map(function(predicate) {\n          return getPredicateValue(predicate.get(value), index);\n        })\n      };\n    }\n\n    function doComparison(v1, v2) {\n      var result = 0;\n      for (var index=0, length = predicates.length; index < length; ++index) {\n        result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;\n        if (result) break;\n      }\n      return result;\n    }\n  };\n\n  function processPredicates(sortPredicate, reverseOrder) {\n    reverseOrder = reverseOrder ? -1 : 1;\n    return sortPredicate.map(function(predicate) {\n      var descending = 1, get = identity;\n\n      if (isFunction(predicate)) {\n        get = predicate;\n      } else if (isString(predicate)) {\n        if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {\n          descending = predicate.charAt(0) == '-' ? -1 : 1;\n          predicate = predicate.substring(1);\n        }\n        if (predicate !== '') {\n          get = $parse(predicate);\n          if (get.constant) {\n            var key = get();\n            get = function(value) { return value[key]; };\n          }\n        }\n      }\n      return { get: get, descending: descending * reverseOrder };\n    });\n  }\n\n  function isPrimitive(value) {\n    switch (typeof value) {\n      case 'number': /* falls through */\n      case 'boolean': /* falls through */\n      case 'string':\n        return true;\n      default:\n        return false;\n    }\n  }\n\n  function objectValue(value, index) {\n    // If `valueOf` is a valid function use that\n    if (typeof value.valueOf === 'function') {\n      value = value.valueOf();\n      if (isPrimitive(value)) return value;\n    }\n    // If `toString` is a valid function and not the one from `Object.prototype` use that\n    if (hasCustomToString(value)) {\n      value = value.toString();\n      if (isPrimitive(value)) return value;\n    }\n    // We have a basic object so we use the position of the object in the collection\n    return index;\n  }\n\n  function getPredicateValue(value, index) {\n    var type = typeof value;\n    if (value === null) {\n      type = 'string';\n      value = 'null';\n    } else if (type === 'string') {\n      value = value.toLowerCase();\n    } else if (type === 'object') {\n      value = objectValue(value, index);\n    }\n    return { value: value, type: type };\n  }\n\n  function compare(v1, v2) {\n    var result = 0;\n    if (v1.type === v2.type) {\n      if (v1.value !== v2.value) {\n        result = v1.value < v2.value ? -1 : 1;\n      }\n    } else {\n      result = v1.type < v2.type ? -1 : 1;\n    }\n    return result;\n  }\n}\n\nfunction ngDirective(directive) {\n  if (isFunction(directive)) {\n    directive = {\n      link: directive\n    };\n  }\n  directive.restrict = directive.restrict || 'AC';\n  return valueFn(directive);\n}\n\n/**\n * @ngdoc directive\n * @name a\n * @restrict E\n *\n * @description\n * Modifies the default behavior of the html A tag so that the default action is prevented when\n * the href attribute is empty.\n *\n * This change permits the easy creation of action links with the `ngClick` directive\n * without changing the location or causing page reloads, e.g.:\n * `<a href=\"\" ng-click=\"list.addItem()\">Add Item</a>`\n */\nvar htmlAnchorDirective = valueFn({\n  restrict: 'E',\n  compile: function(element, attr) {\n    if (!attr.href && !attr.xlinkHref) {\n      return function(scope, element) {\n        // If the linked element is not an anchor tag anymore, do nothing\n        if (element[0].nodeName.toLowerCase() !== 'a') return;\n\n        // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n        var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?\n                   'xlink:href' : 'href';\n        element.on('click', function(event) {\n          // if we have no href url, then don't navigate anywhere.\n          if (!element.attr(href)) {\n            event.preventDefault();\n          }\n        });\n      };\n    }\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngHref\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in an href attribute will\n * make the link go to the wrong URL if the user clicks it before\n * Angular has a chance to replace the `{{hash}}` markup with its\n * value. Until Angular replaces the markup the link will be broken\n * and will most likely return a 404 error. The `ngHref` directive\n * solves this problem.\n *\n * The wrong way to write it:\n * ```html\n * <a href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <a ng-href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * @element A\n * @param {template} ngHref any string which can contain `{{}}` markup.\n *\n * @example\n * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes\n * in links and their different behaviors:\n    <example>\n      <file name=\"index.html\">\n        <input ng-model=\"value\" /><br />\n        <a id=\"link-1\" href ng-click=\"value = 1\">link 1</a> (link, don't reload)<br />\n        <a id=\"link-2\" href=\"\" ng-click=\"value = 2\">link 2</a> (link, don't reload)<br />\n        <a id=\"link-3\" ng-href=\"/{{'123'}}\">link 3</a> (link, reload!)<br />\n        <a id=\"link-4\" href=\"\" name=\"xx\" ng-click=\"value = 4\">anchor</a> (link, don't reload)<br />\n        <a id=\"link-5\" name=\"xxx\" ng-click=\"value = 5\">anchor</a> (no link)<br />\n        <a id=\"link-6\" ng-href=\"{{value}}\">link</a> (link, change location)\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should execute ng-click but not reload when href without value', function() {\n          element(by.id('link-1')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('1');\n          expect(element(by.id('link-1')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when href empty string', function() {\n          element(by.id('link-2')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('2');\n          expect(element(by.id('link-2')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click and change url when ng-href specified', function() {\n          expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\\/123$/);\n\n          element(by.id('link-3')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/123$/);\n            });\n          }, 5000, 'page should navigate to /123');\n        });\n\n        it('should execute ng-click but not reload when href empty string and name specified', function() {\n          element(by.id('link-4')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('4');\n          expect(element(by.id('link-4')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when no href but name specified', function() {\n          element(by.id('link-5')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('5');\n          expect(element(by.id('link-5')).getAttribute('href')).toBe(null);\n        });\n\n        it('should only change url when only ng-href', function() {\n          element(by.model('value')).clear();\n          element(by.model('value')).sendKeys('6');\n          expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\\/6$/);\n\n          element(by.id('link-6')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/6$/);\n            });\n          }, 5000, 'page should navigate to /6');\n        });\n      </file>\n    </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngSrc\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `src` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrc` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrc any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngSrcset\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrcset` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrcset any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngDisabled\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * This directive sets the `disabled` attribute on the element if the\n * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `disabled`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Click me to toggle: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n        <button ng-model=\"button\" ng-disabled=\"checked\">Button</button>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle button', function() {\n          expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,\n *     then the `disabled` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngChecked\n * @restrict A\n * @priority 100\n *\n * @description\n * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.\n *\n * Note that this directive should not be used together with {@link ngModel `ngModel`},\n * as this can lead to unexpected behavior.\n *\n * A special directive is necessary because we cannot use interpolation inside the `checked`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to check both: <input type=\"checkbox\" ng-model=\"master\"></label><br/>\n        <input id=\"checkSlave\" type=\"checkbox\" ng-checked=\"master\" aria-label=\"Slave input\">\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should check both checkBoxes', function() {\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();\n          element(by.model('master')).click();\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,\n *     then the `checked` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngReadonly\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `readOnly` attribute on the element, if the expression inside `ngReadonly` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `readOnly`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to make text readonly: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n        <input type=\"text\" ng-readonly=\"checked\" value=\"I'm Angular\" aria-label=\"Readonly field\" />\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle readonly attr', function() {\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,\n *     then special attribute \"readonly\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSelected\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `selected`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to select: <input type=\"checkbox\" ng-model=\"selected\"></label><br/>\n        <select aria-label=\"ngSelected demo\">\n          <option>Hello!</option>\n          <option id=\"greet\" ng-selected=\"selected\">Greetings!</option>\n        </select>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should select Greetings!', function() {\n          expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();\n          element(by.model('selected')).click();\n          expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element OPTION\n * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,\n *     then special attribute \"selected\" will be set on the element\n */\n\n/**\n * @ngdoc directive\n * @name ngOpen\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `open`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n     <example>\n       <file name=\"index.html\">\n         <label>Check me check multiple: <input type=\"checkbox\" ng-model=\"open\"></label><br/>\n         <details id=\"details\" ng-open=\"open\">\n            <summary>Show/Hide me</summary>\n         </details>\n       </file>\n       <file name=\"protractor.js\" type=\"protractor\">\n         it('should toggle open', function() {\n           expect(element(by.id('details')).getAttribute('open')).toBeFalsy();\n           element(by.model('open')).click();\n           expect(element(by.id('details')).getAttribute('open')).toBeTruthy();\n         });\n       </file>\n     </example>\n *\n * @element DETAILS\n * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,\n *     then special attribute \"open\" will be set on the element\n */\n\nvar ngAttributeAliasDirectives = {};\n\n// boolean attrs are evaluated\nforEach(BOOLEAN_ATTR, function(propName, attrName) {\n  // binding to multiple is not supported\n  if (propName == \"multiple\") return;\n\n  function defaultLinkFn(scope, element, attr) {\n    scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {\n      attr.$set(attrName, !!value);\n    });\n  }\n\n  var normalized = directiveNormalize('ng-' + attrName);\n  var linkFn = defaultLinkFn;\n\n  if (propName === 'checked') {\n    linkFn = function(scope, element, attr) {\n      // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input\n      if (attr.ngModel !== attr[normalized]) {\n        defaultLinkFn(scope, element, attr);\n      }\n    };\n  }\n\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      restrict: 'A',\n      priority: 100,\n      link: linkFn\n    };\n  };\n});\n\n// aliased input attrs are evaluated\nforEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {\n  ngAttributeAliasDirectives[ngAttr] = function() {\n    return {\n      priority: 100,\n      link: function(scope, element, attr) {\n        //special case ngPattern when a literal regular expression value\n        //is used as the expression (this way we don't have to watch anything).\n        if (ngAttr === \"ngPattern\" && attr.ngPattern.charAt(0) == \"/\") {\n          var match = attr.ngPattern.match(REGEX_STRING_REGEXP);\n          if (match) {\n            attr.$set(\"ngPattern\", new RegExp(match[1], match[2]));\n            return;\n          }\n        }\n\n        scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {\n          attr.$set(ngAttr, value);\n        });\n      }\n    };\n  };\n});\n\n// ng-src, ng-srcset, ng-href are interpolated\nforEach(['src', 'srcset', 'href'], function(attrName) {\n  var normalized = directiveNormalize('ng-' + attrName);\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      priority: 99, // it needs to run after the attributes are interpolated\n      link: function(scope, element, attr) {\n        var propName = attrName,\n            name = attrName;\n\n        if (attrName === 'href' &&\n            toString.call(element.prop('href')) === '[object SVGAnimatedString]') {\n          name = 'xlinkHref';\n          attr.$attr[name] = 'xlink:href';\n          propName = null;\n        }\n\n        attr.$observe(normalized, function(value) {\n          if (!value) {\n            if (attrName === 'href') {\n              attr.$set(name, null);\n            }\n            return;\n          }\n\n          attr.$set(name, value);\n\n          // on IE, if \"ng:src\" directive declaration is used and \"src\" attribute doesn't exist\n          // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need\n          // to set the property as well to achieve the desired effect.\n          // we use attr[attrName] value since $set can sanitize the url.\n          if (msie && propName) element.prop(propName, attr[name]);\n        });\n      }\n    };\n  };\n});\n\n/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true\n */\nvar nullFormCtrl = {\n  $addControl: noop,\n  $$renameControl: nullFormRenameControl,\n  $removeControl: noop,\n  $setValidity: noop,\n  $setDirty: noop,\n  $setPristine: noop,\n  $setSubmitted: noop\n},\nSUBMITTED_CLASS = 'ng-submitted';\n\nfunction nullFormRenameControl(control, name) {\n  control.$name = name;\n}\n\n/**\n * @ngdoc type\n * @name form.FormController\n *\n * @property {boolean} $pristine True if user has not interacted with the form yet.\n * @property {boolean} $dirty True if user has already interacted with the form.\n * @property {boolean} $valid True if all of the containing forms and controls are valid.\n * @property {boolean} $invalid True if at least one containing control or form is invalid.\n * @property {boolean} $pending True if at least one containing control or form is pending.\n * @property {boolean} $submitted True if user has submitted the form even if its invalid.\n *\n * @property {Object} $error Is an object hash, containing references to controls or\n *  forms with failing validators, where:\n *\n *  - keys are validation tokens (error names),\n *  - values are arrays of controls or forms that have a failing validator for given error name.\n *\n *  Built-in validation tokens:\n *\n *  - `email`\n *  - `max`\n *  - `maxlength`\n *  - `min`\n *  - `minlength`\n *  - `number`\n *  - `pattern`\n *  - `required`\n *  - `url`\n *  - `date`\n *  - `datetimelocal`\n *  - `time`\n *  - `week`\n *  - `month`\n *\n * @description\n * `FormController` keeps track of all its controls and nested forms as well as the state of them,\n * such as being valid/invalid or dirty/pristine.\n *\n * Each {@link ng.directive:form form} directive creates an instance\n * of `FormController`.\n *\n */\n//asks for $scope to fool the BC controller module\nFormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];\nfunction FormController(element, attrs, $scope, $animate, $interpolate) {\n  var form = this,\n      controls = [];\n\n  // init state\n  form.$error = {};\n  form.$$success = {};\n  form.$pending = undefined;\n  form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);\n  form.$dirty = false;\n  form.$pristine = true;\n  form.$valid = true;\n  form.$invalid = false;\n  form.$submitted = false;\n  form.$$parentForm = nullFormCtrl;\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$rollbackViewValue\n   *\n   * @description\n   * Rollback all form controls pending updates to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. This method is typically needed by the reset button of\n   * a form that uses `ng-model-options` to pend updates.\n   */\n  form.$rollbackViewValue = function() {\n    forEach(controls, function(control) {\n      control.$rollbackViewValue();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$commitViewValue\n   *\n   * @description\n   * Commit all form controls pending updates to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`\n   * usually handles calling this in response to input events.\n   */\n  form.$commitViewValue = function() {\n    forEach(controls, function(control) {\n      control.$commitViewValue();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$addControl\n   * @param {object} control control object, either a {@link form.FormController} or an\n   * {@link ngModel.NgModelController}\n   *\n   * @description\n   * Register a control with the form. Input elements using ngModelController do this automatically\n   * when they are linked.\n   *\n   * Note that the current state of the control will not be reflected on the new parent form. This\n   * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`\n   * state.\n   *\n   * However, if the method is used programmatically, for example by adding dynamically created controls,\n   * or controls that have been previously removed without destroying their corresponding DOM element,\n   * it's the developers responsibility to make sure the current state propagates to the parent form.\n   *\n   * For example, if an input control is added that is already `$dirty` and has `$error` properties,\n   * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.\n   */\n  form.$addControl = function(control) {\n    // Breaking change - before, inputs whose name was \"hasOwnProperty\" were quietly ignored\n    // and not added to the scope.  Now we throw an error.\n    assertNotHasOwnProperty(control.$name, 'input');\n    controls.push(control);\n\n    if (control.$name) {\n      form[control.$name] = control;\n    }\n\n    control.$$parentForm = form;\n  };\n\n  // Private API: rename a form control\n  form.$$renameControl = function(control, newName) {\n    var oldName = control.$name;\n\n    if (form[oldName] === control) {\n      delete form[oldName];\n    }\n    form[newName] = control;\n    control.$name = newName;\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$removeControl\n   * @param {object} control control object, either a {@link form.FormController} or an\n   * {@link ngModel.NgModelController}\n   *\n   * @description\n   * Deregister a control from the form.\n   *\n   * Input elements using ngModelController do this automatically when they are destroyed.\n   *\n   * Note that only the removed control's validation state (`$errors`etc.) will be removed from the\n   * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be\n   * different from case to case. For example, removing the only `$dirty` control from a form may or\n   * may not mean that the form is still `$dirty`.\n   */\n  form.$removeControl = function(control) {\n    if (control.$name && form[control.$name] === control) {\n      delete form[control.$name];\n    }\n    forEach(form.$pending, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n    forEach(form.$error, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n    forEach(form.$$success, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n\n    arrayRemove(controls, control);\n    control.$$parentForm = nullFormCtrl;\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setValidity\n   *\n   * @description\n   * Sets the validity of a form control.\n   *\n   * This method will also propagate to parent forms.\n   */\n  addSetValidityMethod({\n    ctrl: this,\n    $element: element,\n    set: function(object, property, controller) {\n      var list = object[property];\n      if (!list) {\n        object[property] = [controller];\n      } else {\n        var index = list.indexOf(controller);\n        if (index === -1) {\n          list.push(controller);\n        }\n      }\n    },\n    unset: function(object, property, controller) {\n      var list = object[property];\n      if (!list) {\n        return;\n      }\n      arrayRemove(list, controller);\n      if (list.length === 0) {\n        delete object[property];\n      }\n    },\n    $animate: $animate\n  });\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setDirty\n   *\n   * @description\n   * Sets the form to a dirty state.\n   *\n   * This method can be called to add the 'ng-dirty' class and set the form to a dirty\n   * state (ng-dirty class). This method will also propagate to parent forms.\n   */\n  form.$setDirty = function() {\n    $animate.removeClass(element, PRISTINE_CLASS);\n    $animate.addClass(element, DIRTY_CLASS);\n    form.$dirty = true;\n    form.$pristine = false;\n    form.$$parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setPristine\n   *\n   * @description\n   * Sets the form to its pristine state.\n   *\n   * This method can be called to remove the 'ng-dirty' class and set the form to its pristine\n   * state (ng-pristine class). This method will also propagate to all the controls contained\n   * in this form.\n   *\n   * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after\n   * saving or resetting it.\n   */\n  form.$setPristine = function() {\n    $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);\n    form.$dirty = false;\n    form.$pristine = true;\n    form.$submitted = false;\n    forEach(controls, function(control) {\n      control.$setPristine();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setUntouched\n   *\n   * @description\n   * Sets the form to its untouched state.\n   *\n   * This method can be called to remove the 'ng-touched' class and set the form controls to their\n   * untouched state (ng-untouched class).\n   *\n   * Setting a form controls back to their untouched state is often useful when setting the form\n   * back to its pristine state.\n   */\n  form.$setUntouched = function() {\n    forEach(controls, function(control) {\n      control.$setUntouched();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setSubmitted\n   *\n   * @description\n   * Sets the form to its submitted state.\n   */\n  form.$setSubmitted = function() {\n    $animate.addClass(element, SUBMITTED_CLASS);\n    form.$submitted = true;\n    form.$$parentForm.$setSubmitted();\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ngForm\n * @restrict EAC\n *\n * @description\n * Nestable alias of {@link ng.directive:form `form`} directive. HTML\n * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a\n * sub-group of controls needs to be determined.\n *\n * Note: the purpose of `ngForm` is to group controls,\n * but not to be a replacement for the `<form>` tag with all of its capabilities\n * (e.g. posting to the server, ...).\n *\n * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n *\n */\n\n /**\n * @ngdoc directive\n * @name form\n * @restrict E\n *\n * @description\n * Directive that instantiates\n * {@link form.FormController FormController}.\n *\n * If the `name` attribute is specified, the form controller is published onto the current scope under\n * this name.\n *\n * # Alias: {@link ng.directive:ngForm `ngForm`}\n *\n * In Angular, forms can be nested. This means that the outer form is valid when all of the child\n * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so\n * Angular provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to\n * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group\n * of controls needs to be determined.\n *\n * # CSS classes\n *  - `ng-valid` is set if the form is valid.\n *  - `ng-invalid` is set if the form is invalid.\n *  - `ng-pending` is set if the form is pending.\n *  - `ng-pristine` is set if the form is pristine.\n *  - `ng-dirty` is set if the form is dirty.\n *  - `ng-submitted` is set if the form was submitted.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n *\n * # Submitting a form and preventing the default action\n *\n * Since the role of forms in client-side Angular applications is different than in classical\n * roundtrip apps, it is desirable for the browser not to translate the form submission into a full\n * page reload that sends the data to the server. Instead some javascript logic should be triggered\n * to handle the form submission in an application-specific way.\n *\n * For this reason, Angular prevents the default action (form submission to the server) unless the\n * `<form>` element has an `action` attribute specified.\n *\n * You can use one of the following two ways to specify what javascript method should be called when\n * a form is submitted:\n *\n * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element\n * - {@link ng.directive:ngClick ngClick} directive on the first\n  *  button or input field of type submit (input[type=submit])\n *\n * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}\n * or {@link ng.directive:ngClick ngClick} directives.\n * This is because of the following form submission rules in the HTML specification:\n *\n * - If a form has only one input field then hitting enter in this field triggers form submit\n * (`ngSubmit`)\n * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter\n * doesn't trigger submit\n * - if a form has one or more input fields and one or more buttons or input[type=submit] then\n * hitting enter in any of the input fields will trigger the click handler on the *first* button or\n * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)\n *\n * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is\n * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * ## Animation Hooks\n *\n * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.\n * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any\n * other validations that are performed within the form. Animations in ngForm are similar to how\n * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well\n * as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style a form element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-form {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-form.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n    <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"formExample\">\n      <file name=\"index.html\">\n       <script>\n         angular.module('formExample', [])\n           .controller('FormController', ['$scope', function($scope) {\n             $scope.userType = 'guest';\n           }]);\n       </script>\n       <style>\n        .my-form {\n          transition:all linear 0.5s;\n          background: transparent;\n        }\n        .my-form.ng-invalid {\n          background: red;\n        }\n       </style>\n       <form name=\"myForm\" ng-controller=\"FormController\" class=\"my-form\">\n         userType: <input name=\"input\" ng-model=\"userType\" required>\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">Required!</span><br>\n         <code>userType = {{userType}}</code><br>\n         <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>\n         <code>myForm.input.$error = {{myForm.input.$error}}</code><br>\n         <code>myForm.$valid = {{myForm.$valid}}</code><br>\n         <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should initialize to model', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n\n          expect(userType.getText()).toContain('guest');\n          expect(valid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var userInput = element(by.model('userType'));\n\n          userInput.clear();\n          userInput.sendKeys('');\n\n          expect(userType.getText()).toEqual('userType =');\n          expect(valid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n *\n * @param {string=} name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n */\nvar formDirectiveFactory = function(isNgForm) {\n  return ['$timeout', '$parse', function($timeout, $parse) {\n    var formDirective = {\n      name: 'form',\n      restrict: isNgForm ? 'EAC' : 'E',\n      require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form\n      controller: FormController,\n      compile: function ngFormCompile(formElement, attr) {\n        // Setup initial state of the control\n        formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);\n\n        var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);\n\n        return {\n          pre: function ngFormPreLink(scope, formElement, attr, ctrls) {\n            var controller = ctrls[0];\n\n            // if `action` attr is not present on the form, prevent the default action (submission)\n            if (!('action' in attr)) {\n              // we can't use jq events because if a form is destroyed during submission the default\n              // action is not prevented. see #1238\n              //\n              // IE 9 is not affected because it doesn't fire a submit event and try to do a full\n              // page reload if the form was destroyed by submission of the form via a click handler\n              // on a button in the form. Looks like an IE9 specific bug.\n              var handleFormSubmission = function(event) {\n                scope.$apply(function() {\n                  controller.$commitViewValue();\n                  controller.$setSubmitted();\n                });\n\n                event.preventDefault();\n              };\n\n              addEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n\n              // unregister the preventDefault listener so that we don't not leak memory but in a\n              // way that will achieve the prevention of the default action.\n              formElement.on('$destroy', function() {\n                $timeout(function() {\n                  removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n                }, 0, false);\n              });\n            }\n\n            var parentFormCtrl = ctrls[1] || controller.$$parentForm;\n            parentFormCtrl.$addControl(controller);\n\n            var setter = nameAttr ? getSetter(controller.$name) : noop;\n\n            if (nameAttr) {\n              setter(scope, controller);\n              attr.$observe(nameAttr, function(newValue) {\n                if (controller.$name === newValue) return;\n                setter(scope, undefined);\n                controller.$$parentForm.$$renameControl(controller, newValue);\n                setter = getSetter(controller.$name);\n                setter(scope, controller);\n              });\n            }\n            formElement.on('$destroy', function() {\n              controller.$$parentForm.$removeControl(controller);\n              setter(scope, undefined);\n              extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards\n            });\n          }\n        };\n      }\n    };\n\n    return formDirective;\n\n    function getSetter(expression) {\n      if (expression === '') {\n        //create an assignable expression, so forms with an empty name can be renamed later\n        return $parse('this[\"\"]').assign;\n      }\n      return $parse(expression).assign || noop;\n    }\n  }];\n};\n\nvar formDirective = formDirectiveFactory();\nvar ngFormDirective = formDirectiveFactory(true);\n\n/* global VALID_CLASS: false,\n  INVALID_CLASS: false,\n  PRISTINE_CLASS: false,\n  DIRTY_CLASS: false,\n  UNTOUCHED_CLASS: false,\n  TOUCHED_CLASS: false,\n  ngModelMinErr: false,\n*/\n\n// Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231\nvar ISO_DATE_REGEXP = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/;\n// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)\n// Note: We are being more lenient, because browsers are too.\n//   1. Scheme\n//   2. Slashes\n//   3. Username\n//   4. Password\n//   5. Hostname\n//   6. Port\n//   7. Path\n//   8. Query\n//   9. Fragment\n//                 1111111111111111 222   333333    44444        555555555555555555555555    666     77777777     8888888     999\nvar URL_REGEXP = /^[a-z][a-z\\d.+-]*:\\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\\s:/?#]+|\\[[a-f\\d:]+\\])(?::\\d+)?(?:\\/[^?#]*)?(?:\\?[^#]*)?(?:#.*)?$/i;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;\nvar NUMBER_REGEXP = /^\\s*(\\-|\\+)?(\\d+|(\\d*(\\.\\d*)))([eE][+-]?\\d+)?\\s*$/;\nvar DATE_REGEXP = /^(\\d{4,})-(\\d{2})-(\\d{2})$/;\nvar DATETIMELOCAL_REGEXP = /^(\\d{4,})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\nvar WEEK_REGEXP = /^(\\d{4,})-W(\\d\\d)$/;\nvar MONTH_REGEXP = /^(\\d{4,})-(\\d\\d)$/;\nvar TIME_REGEXP = /^(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\n\nvar PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown';\nvar PARTIAL_VALIDATION_TYPES = createMap();\nforEach('date,datetime-local,month,time,week'.split(','), function(type) {\n  PARTIAL_VALIDATION_TYPES[type] = true;\n});\n\nvar inputType = {\n\n  /**\n   * @ngdoc input\n   * @name input[text]\n   *\n   * @description\n   * Standard HTML text input with angular data binding, inherited by most of the `input` elements.\n   *\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Adds `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n   *    This parameter is ignored for input[type=password] controls, which will never trim the\n   *    input.\n   *\n   * @example\n      <example name=\"text-input-directive\" module=\"textInputExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('textInputExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.example = {\n                 text: 'guest',\n                 word: /^\\s*\\w*\\s*$/\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Single word:\n             <input type=\"text\" name=\"input\" ng-model=\"example.text\"\n                    ng-pattern=\"example.word\" required ng-trim=\"false\">\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.pattern\">\n               Single word only!</span>\n           </div>\n           <tt>text = {{example.text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('example.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('example.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('guest');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if multi word', function() {\n            input.clear();\n            input.sendKeys('hello world');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'text': textInputType,\n\n    /**\n     * @ngdoc input\n     * @name input[date]\n     *\n     * @description\n     * Input with date validation and transformation. In browsers that do not yet support\n     * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601\n     * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many\n     * modern browsers do not yet support this input type, it is important to provide cues to users on the\n     * expected input format via a placeholder or label.\n     *\n     * The model must always be a Date object, otherwise Angular will throw an error.\n     * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n     *\n     * The timezone to be used to read/write the `Date` instance in the model can be defined using\n     * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n     *\n     * @param {string} ngModel Assignable angular expression to data-bind to.\n     * @param {string=} name Property name of the form under which the control is published.\n     * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a\n     *   valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n     *   (e.g. `min=\"{{minDate | date:'yyyy-MM-dd'}}\"`). Note that `min` will also add native HTML5\n     *   constraint validation.\n     * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be\n     *   a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n     *   (e.g. `max=\"{{maxDate | date:'yyyy-MM-dd'}}\"`). Note that `max` will also add native HTML5\n     *   constraint validation.\n     * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string\n     *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n     * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string\n     *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n     * @param {string=} required Sets `required` validation error key if the value is not entered.\n     * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n     *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n     *    `required` when you want to data-bind to the `required` attribute.\n     * @param {string=} ngChange Angular expression to be executed when input changes due to user\n     *    interaction with the input element.\n     *\n     * @example\n     <example name=\"date-input-directive\" module=\"dateInputExample\">\n     <file name=\"index.html\">\n       <script>\n          angular.module('dateInputExample', [])\n            .controller('DateController', ['$scope', function($scope) {\n              $scope.example = {\n                value: new Date(2013, 9, 22)\n              };\n            }]);\n       </script>\n       <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n          <label for=\"exampleInput\">Pick a date in 2013:</label>\n          <input type=\"date\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n              placeholder=\"yyyy-MM-dd\" min=\"2013-01-01\" max=\"2013-12-31\" required />\n          <div role=\"alert\">\n            <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n                Required!</span>\n            <span class=\"error\" ng-show=\"myForm.input.$error.date\">\n                Not a valid date!</span>\n           </div>\n           <tt>value = {{example.value | date: \"yyyy-MM-dd\"}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n       </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n        var value = element(by.binding('example.value | date: \"yyyy-MM-dd\"'));\n        var valid = element(by.binding('myForm.input.$valid'));\n        var input = element(by.model('example.value'));\n\n        // currently protractor/webdriver does not support\n        // sending keys to all known HTML5 input controls\n        // for various browsers (see https://github.com/angular/protractor/issues/562).\n        function setInput(val) {\n          // set the value of the element and force validation.\n          var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n          \"ipt.value = '\" + val + \"';\" +\n          \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n          browser.executeScript(scr);\n        }\n\n        it('should initialize to model', function() {\n          expect(value.getText()).toContain('2013-10-22');\n          expect(valid.getText()).toContain('myForm.input.$valid = true');\n        });\n\n        it('should be invalid if empty', function() {\n          setInput('');\n          expect(value.getText()).toEqual('value =');\n          expect(valid.getText()).toContain('myForm.input.$valid = false');\n        });\n\n        it('should be invalid if over max', function() {\n          setInput('2015-01-01');\n          expect(value.getText()).toContain('');\n          expect(valid.getText()).toContain('myForm.input.$valid = false');\n        });\n     </file>\n     </example>\n     */\n  'date': createDateInputType('date', DATE_REGEXP,\n         createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),\n         'yyyy-MM-dd'),\n\n   /**\n    * @ngdoc input\n    * @name input[datetime-local]\n    *\n    * @description\n    * Input with datetime validation and transformation. In browsers that do not yet support\n    * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n    * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.\n    *\n    * The model must always be a Date object, otherwise Angular will throw an error.\n    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n    *\n    * The timezone to be used to read/write the `Date` instance in the model can be defined using\n    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n    *\n    * @param {string} ngModel Assignable angular expression to data-bind to.\n    * @param {string=} name Property name of the form under which the control is published.\n    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n    *   inside this attribute (e.g. `min=\"{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n    *   Note that `min` will also add native HTML5 constraint validation.\n    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n    *   inside this attribute (e.g. `max=\"{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n    *   Note that `max` will also add native HTML5 constraint validation.\n    * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string\n    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n    * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string\n    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n    * @param {string=} required Sets `required` validation error key if the value is not entered.\n    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n    *    `required` when you want to data-bind to the `required` attribute.\n    * @param {string=} ngChange Angular expression to be executed when input changes due to user\n    *    interaction with the input element.\n    *\n    * @example\n    <example name=\"datetimelocal-input-directive\" module=\"dateExample\">\n    <file name=\"index.html\">\n      <script>\n        angular.module('dateExample', [])\n          .controller('DateController', ['$scope', function($scope) {\n            $scope.example = {\n              value: new Date(2010, 11, 28, 14, 57)\n            };\n          }]);\n      </script>\n      <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label for=\"exampleInput\">Pick a date between in 2013:</label>\n        <input type=\"datetime-local\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n            placeholder=\"yyyy-MM-ddTHH:mm:ss\" min=\"2001-01-01T00:00:00\" max=\"2013-12-31T00:00:00\" required />\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.datetimelocal\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"yyyy-MM-ddTHH:mm:ss\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-MM-ddTHH:mm:ss\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2010-12-28T14:57:00');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-01-01T23:59:00');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n    </file>\n    </example>\n    */\n  'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,\n      createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),\n      'yyyy-MM-ddTHH:mm:ss.sss'),\n\n  /**\n   * @ngdoc input\n   * @name input[time]\n   *\n   * @description\n   * Input with time validation and transformation. In browsers that do not yet support\n   * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n   * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a\n   * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.\n   *\n   * The model must always be a Date object, otherwise Angular will throw an error.\n   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n   *\n   * The timezone to be used to read/write the `Date` instance in the model can be defined using\n   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n   *   attribute (e.g. `min=\"{{minTime | date:'HH:mm:ss'}}\"`). Note that `min` will also add\n   *   native HTML5 constraint validation.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n   *   attribute (e.g. `max=\"{{maxTime | date:'HH:mm:ss'}}\"`). Note that `max` will also add\n   *   native HTML5 constraint validation.\n   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the\n   *   `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the\n   *   `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n   <example name=\"time-input-directive\" module=\"timeExample\">\n   <file name=\"index.html\">\n     <script>\n      angular.module('timeExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(1970, 0, 1, 14, 57, 0)\n          };\n        }]);\n     </script>\n     <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label for=\"exampleInput\">Pick a time between 8am and 5pm:</label>\n        <input type=\"time\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n            placeholder=\"HH:mm:ss\" min=\"08:00:00\" max=\"17:00:00\" required />\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.time\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"HH:mm:ss\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n     </form>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"HH:mm:ss\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('14:57:00');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('23:59:00');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n   </file>\n   </example>\n   */\n  'time': createDateInputType('time', TIME_REGEXP,\n      createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),\n     'HH:mm:ss.sss'),\n\n   /**\n    * @ngdoc input\n    * @name input[week]\n    *\n    * @description\n    * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support\n    * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n    * week format (yyyy-W##), for example: `2013-W02`.\n    *\n    * The model must always be a Date object, otherwise Angular will throw an error.\n    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n    *\n    * The timezone to be used to read/write the `Date` instance in the model can be defined using\n    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n    *\n    * @param {string} ngModel Assignable angular expression to data-bind to.\n    * @param {string=} name Property name of the form under which the control is published.\n    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n    *   attribute (e.g. `min=\"{{minWeek | date:'yyyy-Www'}}\"`). Note that `min` will also add\n    *   native HTML5 constraint validation.\n    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n    *   attribute (e.g. `max=\"{{maxWeek | date:'yyyy-Www'}}\"`). Note that `max` will also add\n    *   native HTML5 constraint validation.\n    * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n    * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n    * @param {string=} required Sets `required` validation error key if the value is not entered.\n    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n    *    `required` when you want to data-bind to the `required` attribute.\n    * @param {string=} ngChange Angular expression to be executed when input changes due to user\n    *    interaction with the input element.\n    *\n    * @example\n    <example name=\"week-input-directive\" module=\"weekExample\">\n    <file name=\"index.html\">\n      <script>\n      angular.module('weekExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(2013, 0, 3)\n          };\n        }]);\n      </script>\n      <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label>Pick a date between in 2013:\n          <input id=\"exampleInput\" type=\"week\" name=\"input\" ng-model=\"example.value\"\n                 placeholder=\"YYYY-W##\" min=\"2012-W32\"\n                 max=\"2013-W52\" required />\n        </label>\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.week\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"yyyy-Www\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-Www\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2013-W01');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-W01');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n    </file>\n    </example>\n    */\n  'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),\n\n  /**\n   * @ngdoc input\n   * @name input[month]\n   *\n   * @description\n   * Input with month validation and transformation. In browsers that do not yet support\n   * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n   * month format (yyyy-MM), for example: `2009-01`.\n   *\n   * The model must always be a Date object, otherwise Angular will throw an error.\n   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n   * If the model is not set to the first of the month, the next view to model update will set it\n   * to the first of the month.\n   *\n   * The timezone to be used to read/write the `Date` instance in the model can be defined using\n   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n   *   attribute (e.g. `min=\"{{minMonth | date:'yyyy-MM'}}\"`). Note that `min` will also add\n   *   native HTML5 constraint validation.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n   *   attribute (e.g. `max=\"{{maxMonth | date:'yyyy-MM'}}\"`). Note that `max` will also add\n   *   native HTML5 constraint validation.\n   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n   *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n   *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n   <example name=\"month-input-directive\" module=\"monthExample\">\n   <file name=\"index.html\">\n     <script>\n      angular.module('monthExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(2013, 9, 1)\n          };\n        }]);\n     </script>\n     <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n       <label for=\"exampleInput\">Pick a month in 2013:</label>\n       <input id=\"exampleInput\" type=\"month\" name=\"input\" ng-model=\"example.value\"\n          placeholder=\"yyyy-MM\" min=\"2013-01\" max=\"2013-12\" required />\n       <div role=\"alert\">\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n            Required!</span>\n         <span class=\"error\" ng-show=\"myForm.input.$error.month\">\n            Not a valid month!</span>\n       </div>\n       <tt>value = {{example.value | date: \"yyyy-MM\"}}</tt><br/>\n       <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n       <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n       <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n       <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n     </form>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-MM\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2013-10');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-01');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n   </file>\n   </example>\n   */\n  'month': createDateInputType('month', MONTH_REGEXP,\n     createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),\n     'yyyy-MM'),\n\n  /**\n   * @ngdoc input\n   * @name input[number]\n   *\n   * @description\n   * Text input with number validation and transformation. Sets the `number` validation\n   * error if not a valid number.\n   *\n   * <div class=\"alert alert-warning\">\n   * The model must always be of type `number` otherwise Angular will throw an error.\n   * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}\n   * error docs for more information and an example of how to convert your model if necessary.\n   * </div>\n   *\n   * ## Issues with HTML5 constraint validation\n   *\n   * In browsers that follow the\n   * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),\n   * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.\n   * If a non-number is entered in the input, the browser will report the value as an empty string,\n   * which means the view / model values in `ngModel` and subsequently the scope value\n   * will also be an empty string.\n   *\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"number-input-directive\" module=\"numberExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('numberExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.example = {\n                 value: 12\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Number:\n             <input type=\"number\" name=\"input\" ng-model=\"example.value\"\n                    min=\"0\" max=\"99\" required>\n          </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.number\">\n               Not valid number!</span>\n           </div>\n           <tt>value = {{example.value}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var value = element(by.binding('example.value'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('example.value'));\n\n          it('should initialize to model', function() {\n            expect(value.getText()).toContain('12');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if over max', function() {\n            input.clear();\n            input.sendKeys('123');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'number': numberInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[url]\n   *\n   * @description\n   * Text input with URL validation. Sets the `url` validation error key if the content is not a\n   * valid URL.\n   *\n   * <div class=\"alert alert-warning\">\n   * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex\n   * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify\n   * the built-in validators (see the {@link guide/forms Forms guide})\n   * </div>\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"url-input-directive\" module=\"urlExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('urlExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.url = {\n                 text: 'http://google.com'\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>URL:\n             <input type=\"url\" name=\"input\" ng-model=\"url.text\" required>\n           <label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.url\">\n               Not valid url!</span>\n           </div>\n           <tt>text = {{url.text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n           <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('url.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('url.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('http://google.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not url', function() {\n            input.clear();\n            input.sendKeys('box');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'url': urlInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[email]\n   *\n   * @description\n   * Text input with email validation. Sets the `email` validation error key if not a valid email\n   * address.\n   *\n   * <div class=\"alert alert-warning\">\n   * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex\n   * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can\n   * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})\n   * </div>\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"email-input-directive\" module=\"emailExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('emailExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.email = {\n                 text: 'me@example.com'\n               };\n             }]);\n         </script>\n           <form name=\"myForm\" ng-controller=\"ExampleController\">\n             <label>Email:\n               <input type=\"email\" name=\"input\" ng-model=\"email.text\" required>\n             </label>\n             <div role=\"alert\">\n               <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n                 Required!</span>\n               <span class=\"error\" ng-show=\"myForm.input.$error.email\">\n                 Not valid email!</span>\n             </div>\n             <tt>text = {{email.text}}</tt><br/>\n             <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n             <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n             <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n             <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n             <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>\n           </form>\n         </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('email.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('email.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('me@example.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not email', function() {\n            input.clear();\n            input.sendKeys('xxx');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'email': emailInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[radio]\n   *\n   * @description\n   * HTML radio button.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string} value The value to which the `ngModel` expression should be set when selected.\n   *    Note that `value` only supports `string` values, i.e. the scope model needs to be a string,\n   *    too. Use `ngValue` if you need complex models (`number`, `object`, ...).\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio\n   *    is selected. Should be used instead of the `value` attribute if you need\n   *    a non-string `ngModel` (`boolean`, `array`, ...).\n   *\n   * @example\n      <example name=\"radio-input-directive\" module=\"radioExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('radioExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.color = {\n                 name: 'blue'\n               };\n               $scope.specialValue = {\n                 \"id\": \"12345\",\n                 \"value\": \"green\"\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" value=\"red\">\n             Red\n           </label><br/>\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" ng-value=\"specialValue\">\n             Green\n           </label><br/>\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" value=\"blue\">\n             Blue\n           </label><br/>\n           <tt>color = {{color.name | json}}</tt><br/>\n          </form>\n          Note that `ng-value=\"specialValue\"` sets radio item's value to be the value of `$scope.specialValue`.\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var color = element(by.binding('color.name'));\n\n            expect(color.getText()).toContain('blue');\n\n            element.all(by.model('color.name')).get(0).click();\n\n            expect(color.getText()).toContain('red');\n          });\n        </file>\n      </example>\n   */\n  'radio': radioInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[checkbox]\n   *\n   * @description\n   * HTML checkbox.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {expression=} ngTrueValue The value to which the expression should be set when selected.\n   * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"checkbox-input-directive\" module=\"checkboxExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('checkboxExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.checkboxModel = {\n                value1 : true,\n                value2 : 'YES'\n              };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Value1:\n             <input type=\"checkbox\" ng-model=\"checkboxModel.value1\">\n           </label><br/>\n           <label>Value2:\n             <input type=\"checkbox\" ng-model=\"checkboxModel.value2\"\n                    ng-true-value=\"'YES'\" ng-false-value=\"'NO'\">\n            </label><br/>\n           <tt>value1 = {{checkboxModel.value1}}</tt><br/>\n           <tt>value2 = {{checkboxModel.value2}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var value1 = element(by.binding('checkboxModel.value1'));\n            var value2 = element(by.binding('checkboxModel.value2'));\n\n            expect(value1.getText()).toContain('true');\n            expect(value2.getText()).toContain('YES');\n\n            element(by.model('checkboxModel.value1')).click();\n            element(by.model('checkboxModel.value2')).click();\n\n            expect(value1.getText()).toContain('false');\n            expect(value2.getText()).toContain('NO');\n          });\n        </file>\n      </example>\n   */\n  'checkbox': checkboxInputType,\n\n  'hidden': noop,\n  'button': noop,\n  'submit': noop,\n  'reset': noop,\n  'file': noop\n};\n\nfunction stringBasedInputType(ctrl) {\n  ctrl.$formatters.push(function(value) {\n    return ctrl.$isEmpty(value) ? value : value.toString();\n  });\n}\n\nfunction textInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n}\n\nfunction baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  var type = lowercase(element[0].type);\n\n  // In composition mode, users are still inputing intermediate text buffer,\n  // hold the listener until composition is done.\n  // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent\n  if (!$sniffer.android) {\n    var composing = false;\n\n    element.on('compositionstart', function() {\n      composing = true;\n    });\n\n    element.on('compositionend', function() {\n      composing = false;\n      listener();\n    });\n  }\n\n  var timeout;\n\n  var listener = function(ev) {\n    if (timeout) {\n      $browser.defer.cancel(timeout);\n      timeout = null;\n    }\n    if (composing) return;\n    var value = element.val(),\n        event = ev && ev.type;\n\n    // By default we will trim the value\n    // If the attribute ng-trim exists we will avoid trimming\n    // If input type is 'password', the value is never trimmed\n    if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {\n      value = trim(value);\n    }\n\n    // If a control is suffering from bad input (due to native validators), browsers discard its\n    // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the\n    // control's value is the same empty value twice in a row.\n    if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {\n      ctrl.$setViewValue(value, event);\n    }\n  };\n\n  // if the browser does support \"input\" event, we are fine - except on IE9 which doesn't fire the\n  // input event on backspace, delete or cut\n  if ($sniffer.hasEvent('input')) {\n    element.on('input', listener);\n  } else {\n    var deferListener = function(ev, input, origValue) {\n      if (!timeout) {\n        timeout = $browser.defer(function() {\n          timeout = null;\n          if (!input || input.value !== origValue) {\n            listener(ev);\n          }\n        });\n      }\n    };\n\n    element.on('keydown', function(event) {\n      var key = event.keyCode;\n\n      // ignore\n      //    command            modifiers                   arrows\n      if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;\n\n      deferListener(event, this, this.value);\n    });\n\n    // if user modifies input value using context menu in IE, we need \"paste\" and \"cut\" events to catch it\n    if ($sniffer.hasEvent('paste')) {\n      element.on('paste cut', deferListener);\n    }\n  }\n\n  // if user paste into input using mouse on older browser\n  // or form autocomplete on newer browser, we need \"change\" event to catch it\n  element.on('change', listener);\n\n  // Some native input types (date-family) have the ability to change validity without\n  // firing any input/change events.\n  // For these event types, when native validators are present and the browser supports the type,\n  // check for validity changes on various DOM events.\n  if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) {\n    element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {\n      if (!timeout) {\n        var validity = this[VALIDITY_STATE_PROPERTY];\n        var origBadInput = validity.badInput;\n        var origTypeMismatch = validity.typeMismatch;\n        timeout = $browser.defer(function() {\n          timeout = null;\n          if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) {\n            listener(ev);\n          }\n        });\n      }\n    });\n  }\n\n  ctrl.$render = function() {\n    // Workaround for Firefox validation #12102.\n    var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;\n    if (element.val() !== value) {\n      element.val(value);\n    }\n  };\n}\n\nfunction weekParser(isoWeek, existingDate) {\n  if (isDate(isoWeek)) {\n    return isoWeek;\n  }\n\n  if (isString(isoWeek)) {\n    WEEK_REGEXP.lastIndex = 0;\n    var parts = WEEK_REGEXP.exec(isoWeek);\n    if (parts) {\n      var year = +parts[1],\n          week = +parts[2],\n          hours = 0,\n          minutes = 0,\n          seconds = 0,\n          milliseconds = 0,\n          firstThurs = getFirstThursdayOfYear(year),\n          addDays = (week - 1) * 7;\n\n      if (existingDate) {\n        hours = existingDate.getHours();\n        minutes = existingDate.getMinutes();\n        seconds = existingDate.getSeconds();\n        milliseconds = existingDate.getMilliseconds();\n      }\n\n      return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);\n    }\n  }\n\n  return NaN;\n}\n\nfunction createDateParser(regexp, mapping) {\n  return function(iso, date) {\n    var parts, map;\n\n    if (isDate(iso)) {\n      return iso;\n    }\n\n    if (isString(iso)) {\n      // When a date is JSON'ified to wraps itself inside of an extra\n      // set of double quotes. This makes the date parsing code unable\n      // to match the date string and parse it as a date.\n      if (iso.charAt(0) == '\"' && iso.charAt(iso.length - 1) == '\"') {\n        iso = iso.substring(1, iso.length - 1);\n      }\n      if (ISO_DATE_REGEXP.test(iso)) {\n        return new Date(iso);\n      }\n      regexp.lastIndex = 0;\n      parts = regexp.exec(iso);\n\n      if (parts) {\n        parts.shift();\n        if (date) {\n          map = {\n            yyyy: date.getFullYear(),\n            MM: date.getMonth() + 1,\n            dd: date.getDate(),\n            HH: date.getHours(),\n            mm: date.getMinutes(),\n            ss: date.getSeconds(),\n            sss: date.getMilliseconds() / 1000\n          };\n        } else {\n          map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };\n        }\n\n        forEach(parts, function(part, index) {\n          if (index < mapping.length) {\n            map[mapping[index]] = +part;\n          }\n        });\n        return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);\n      }\n    }\n\n    return NaN;\n  };\n}\n\nfunction createDateInputType(type, regexp, parseDate, format) {\n  return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {\n    badInputChecker(scope, element, attr, ctrl);\n    baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n    var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;\n    var previousDate;\n\n    ctrl.$$parserName = type;\n    ctrl.$parsers.push(function(value) {\n      if (ctrl.$isEmpty(value)) return null;\n      if (regexp.test(value)) {\n        // Note: We cannot read ctrl.$modelValue, as there might be a different\n        // parser/formatter in the processing chain so that the model\n        // contains some different data format!\n        var parsedDate = parseDate(value, previousDate);\n        if (timezone) {\n          parsedDate = convertTimezoneToLocal(parsedDate, timezone);\n        }\n        return parsedDate;\n      }\n      return undefined;\n    });\n\n    ctrl.$formatters.push(function(value) {\n      if (value && !isDate(value)) {\n        throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);\n      }\n      if (isValidDate(value)) {\n        previousDate = value;\n        if (previousDate && timezone) {\n          previousDate = convertTimezoneToLocal(previousDate, timezone, true);\n        }\n        return $filter('date')(value, format, timezone);\n      } else {\n        previousDate = null;\n        return '';\n      }\n    });\n\n    if (isDefined(attr.min) || attr.ngMin) {\n      var minVal;\n      ctrl.$validators.min = function(value) {\n        return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;\n      };\n      attr.$observe('min', function(val) {\n        minVal = parseObservedDateValue(val);\n        ctrl.$validate();\n      });\n    }\n\n    if (isDefined(attr.max) || attr.ngMax) {\n      var maxVal;\n      ctrl.$validators.max = function(value) {\n        return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;\n      };\n      attr.$observe('max', function(val) {\n        maxVal = parseObservedDateValue(val);\n        ctrl.$validate();\n      });\n    }\n\n    function isValidDate(value) {\n      // Invalid Date: getTime() returns NaN\n      return value && !(value.getTime && value.getTime() !== value.getTime());\n    }\n\n    function parseObservedDateValue(val) {\n      return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;\n    }\n  };\n}\n\nfunction badInputChecker(scope, element, attr, ctrl) {\n  var node = element[0];\n  var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);\n  if (nativeValidation) {\n    ctrl.$parsers.push(function(value) {\n      var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};\n      return validity.badInput || validity.typeMismatch ? undefined : value;\n    });\n  }\n}\n\nfunction numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  badInputChecker(scope, element, attr, ctrl);\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  ctrl.$$parserName = 'number';\n  ctrl.$parsers.push(function(value) {\n    if (ctrl.$isEmpty(value))      return null;\n    if (NUMBER_REGEXP.test(value)) return parseFloat(value);\n    return undefined;\n  });\n\n  ctrl.$formatters.push(function(value) {\n    if (!ctrl.$isEmpty(value)) {\n      if (!isNumber(value)) {\n        throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);\n      }\n      value = value.toString();\n    }\n    return value;\n  });\n\n  if (isDefined(attr.min) || attr.ngMin) {\n    var minVal;\n    ctrl.$validators.min = function(value) {\n      return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;\n    };\n\n    attr.$observe('min', function(val) {\n      if (isDefined(val) && !isNumber(val)) {\n        val = parseFloat(val, 10);\n      }\n      minVal = isNumber(val) && !isNaN(val) ? val : undefined;\n      // TODO(matsko): implement validateLater to reduce number of validations\n      ctrl.$validate();\n    });\n  }\n\n  if (isDefined(attr.max) || attr.ngMax) {\n    var maxVal;\n    ctrl.$validators.max = function(value) {\n      return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;\n    };\n\n    attr.$observe('max', function(val) {\n      if (isDefined(val) && !isNumber(val)) {\n        val = parseFloat(val, 10);\n      }\n      maxVal = isNumber(val) && !isNaN(val) ? val : undefined;\n      // TODO(matsko): implement validateLater to reduce number of validations\n      ctrl.$validate();\n    });\n  }\n}\n\nfunction urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  // Note: no badInputChecker here by purpose as `url` is only a validation\n  // in browsers, i.e. we can always read out input.value even if it is not valid!\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n\n  ctrl.$$parserName = 'url';\n  ctrl.$validators.url = function(modelValue, viewValue) {\n    var value = modelValue || viewValue;\n    return ctrl.$isEmpty(value) || URL_REGEXP.test(value);\n  };\n}\n\nfunction emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  // Note: no badInputChecker here by purpose as `url` is only a validation\n  // in browsers, i.e. we can always read out input.value even if it is not valid!\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n\n  ctrl.$$parserName = 'email';\n  ctrl.$validators.email = function(modelValue, viewValue) {\n    var value = modelValue || viewValue;\n    return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);\n  };\n}\n\nfunction radioInputType(scope, element, attr, ctrl) {\n  // make the name unique, if not defined\n  if (isUndefined(attr.name)) {\n    element.attr('name', nextUid());\n  }\n\n  var listener = function(ev) {\n    if (element[0].checked) {\n      ctrl.$setViewValue(attr.value, ev && ev.type);\n    }\n  };\n\n  element.on('click', listener);\n\n  ctrl.$render = function() {\n    var value = attr.value;\n    element[0].checked = (value == ctrl.$viewValue);\n  };\n\n  attr.$observe('value', ctrl.$render);\n}\n\nfunction parseConstantExpr($parse, context, name, expression, fallback) {\n  var parseFn;\n  if (isDefined(expression)) {\n    parseFn = $parse(expression);\n    if (!parseFn.constant) {\n      throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +\n                                   '`{1}`.', name, expression);\n    }\n    return parseFn(context);\n  }\n  return fallback;\n}\n\nfunction checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {\n  var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);\n  var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);\n\n  var listener = function(ev) {\n    ctrl.$setViewValue(element[0].checked, ev && ev.type);\n  };\n\n  element.on('click', listener);\n\n  ctrl.$render = function() {\n    element[0].checked = ctrl.$viewValue;\n  };\n\n  // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`\n  // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert\n  // it to a boolean.\n  ctrl.$isEmpty = function(value) {\n    return value === false;\n  };\n\n  ctrl.$formatters.push(function(value) {\n    return equals(value, trueValue);\n  });\n\n  ctrl.$parsers.push(function(value) {\n    return value ? trueValue : falseValue;\n  });\n}\n\n\n/**\n * @ngdoc directive\n * @name textarea\n * @restrict E\n *\n * @description\n * HTML textarea element control with angular data-binding. The data-binding and validation\n * properties of this element are exactly the same as those of the\n * {@link ng.directive:input input element}.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n *    length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n *    If the expression evaluates to a RegExp object, then this is used directly.\n *    If the expression evaluates to a string, then it will be converted to a RegExp\n *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n *    `new RegExp('^abc$')`.<br />\n *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n *    start at the index of the last search's match, thus not taking the whole input value into\n *    account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n */\n\n\n/**\n * @ngdoc directive\n * @name input\n * @restrict E\n *\n * @description\n * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,\n * input state control, and validation.\n * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Not every feature offered is available for all input types.\n * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {boolean=} ngRequired Sets `required` attribute if set to true\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n *    length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n *    value does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n *    If the expression evaluates to a RegExp object, then this is used directly.\n *    If the expression evaluates to a string, then it will be converted to a RegExp\n *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n *    `new RegExp('^abc$')`.<br />\n *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n *    start at the index of the last search's match, thus not taking the whole input value into\n *    account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n *    This parameter is ignored for input[type=password] controls, which will never trim the\n *    input.\n *\n * @example\n    <example name=\"input-directive\" module=\"inputExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('inputExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.user = {name: 'guest', last: 'visitor'};\n            }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <form name=\"myForm\">\n           <label>\n              User name:\n              <input type=\"text\" name=\"userName\" ng-model=\"user.name\" required>\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.userName.$error.required\">\n              Required!</span>\n           </div>\n           <label>\n              Last name:\n              <input type=\"text\" name=\"lastName\" ng-model=\"user.last\"\n              ng-minlength=\"3\" ng-maxlength=\"10\">\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.lastName.$error.minlength\">\n               Too short!</span>\n             <span class=\"error\" ng-show=\"myForm.lastName.$error.maxlength\">\n               Too long!</span>\n           </div>\n         </form>\n         <hr>\n         <tt>user = {{user}}</tt><br/>\n         <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>\n         <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>\n         <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>\n         <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n         <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>\n         <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>\n       </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var user = element(by.exactBinding('user'));\n        var userNameValid = element(by.binding('myForm.userName.$valid'));\n        var lastNameValid = element(by.binding('myForm.lastName.$valid'));\n        var lastNameError = element(by.binding('myForm.lastName.$error'));\n        var formValid = element(by.binding('myForm.$valid'));\n        var userNameInput = element(by.model('user.name'));\n        var userLastInput = element(by.model('user.last'));\n\n        it('should initialize to model', function() {\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty when required', function() {\n          userNameInput.clear();\n          userNameInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('false');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be valid if empty when min length is set', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"\"}');\n          expect(lastNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if less than required min length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('xx');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('minlength');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be invalid if longer than max length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('some ridiculously long name');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('maxlength');\n          expect(formValid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n */\nvar inputDirective = ['$browser', '$sniffer', '$filter', '$parse',\n    function($browser, $sniffer, $filter, $parse) {\n  return {\n    restrict: 'E',\n    require: ['?ngModel'],\n    link: {\n      pre: function(scope, element, attr, ctrls) {\n        if (ctrls[0]) {\n          (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,\n                                                              $browser, $filter, $parse);\n        }\n      }\n    }\n  };\n}];\n\n\n\nvar CONSTANT_VALUE_REGEXP = /^(true|false|\\d+)$/;\n/**\n * @ngdoc directive\n * @name ngValue\n *\n * @description\n * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},\n * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to\n * the bound value.\n *\n * `ngValue` is useful when dynamically generating lists of radio buttons using\n * {@link ngRepeat `ngRepeat`}, as shown below.\n *\n * Likewise, `ngValue` can be used to generate `<option>` elements for\n * the {@link select `select`} element. In that case however, only strings are supported\n * for the `value `attribute, so the resulting `ngModel` will always be a string.\n * Support for `select` models with non-string values is available via `ngOptions`.\n *\n * @element input\n * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute\n *   of the `input` element\n *\n * @example\n    <example name=\"ngValue-directive\" module=\"valueExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('valueExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.names = ['pizza', 'unicorns', 'robots'];\n              $scope.my = { favorite: 'unicorns' };\n            }]);\n       </script>\n        <form ng-controller=\"ExampleController\">\n          <h2>Which is your favorite?</h2>\n            <label ng-repeat=\"name in names\" for=\"{{name}}\">\n              {{name}}\n              <input type=\"radio\"\n                     ng-model=\"my.favorite\"\n                     ng-value=\"name\"\n                     id=\"{{name}}\"\n                     name=\"favorite\">\n            </label>\n          <div>You chose {{my.favorite}}</div>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var favorite = element(by.binding('my.favorite'));\n\n        it('should initialize to model', function() {\n          expect(favorite.getText()).toContain('unicorns');\n        });\n        it('should bind the values to the inputs', function() {\n          element.all(by.model('my.favorite')).get(0).click();\n          expect(favorite.getText()).toContain('pizza');\n        });\n      </file>\n    </example>\n */\nvar ngValueDirective = function() {\n  return {\n    restrict: 'A',\n    priority: 100,\n    compile: function(tpl, tplAttr) {\n      if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {\n        return function ngValueConstantLink(scope, elm, attr) {\n          attr.$set('value', scope.$eval(attr.ngValue));\n        };\n      } else {\n        return function ngValueLink(scope, elm, attr) {\n          scope.$watch(attr.ngValue, function valueWatchAction(value) {\n            attr.$set('value', value);\n          });\n        };\n      }\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngBind\n * @restrict AC\n *\n * @description\n * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element\n * with the value of a given expression, and to update the text content when the value of that\n * expression changes.\n *\n * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like\n * `{{ expression }}` which is similar but less verbose.\n *\n * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily\n * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an\n * element attribute, it makes the bindings invisible to the user while the page is loading.\n *\n * An alternative solution to this problem would be using the\n * {@link ng.directive:ngCloak ngCloak} directive.\n *\n *\n * @element ANY\n * @param {expression} ngBind {@link guide/expression Expression} to evaluate.\n *\n * @example\n * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.name = 'Whirled';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>Enter name: <input type=\"text\" ng-model=\"name\"></label><br>\n         Hello <span ng-bind=\"name\"></span>!\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var nameInput = element(by.model('name'));\n\n         expect(element(by.binding('name')).getText()).toBe('Whirled');\n         nameInput.clear();\n         nameInput.sendKeys('world');\n         expect(element(by.binding('name')).getText()).toBe('world');\n       });\n     </file>\n   </example>\n */\nvar ngBindDirective = ['$compile', function($compile) {\n  return {\n    restrict: 'AC',\n    compile: function ngBindCompile(templateElement) {\n      $compile.$$addBindingClass(templateElement);\n      return function ngBindLink(scope, element, attr) {\n        $compile.$$addBindingInfo(element, attr.ngBind);\n        element = element[0];\n        scope.$watch(attr.ngBind, function ngBindWatchAction(value) {\n          element.textContent = isUndefined(value) ? '' : value;\n        });\n      };\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindTemplate\n *\n * @description\n * The `ngBindTemplate` directive specifies that the element\n * text content should be replaced with the interpolation of the template\n * in the `ngBindTemplate` attribute.\n * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`\n * expressions. This directive is needed since some HTML elements\n * (such as TITLE and OPTION) cannot contain SPAN elements.\n *\n * @element ANY\n * @param {string} ngBindTemplate template of form\n *   <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.\n *\n * @example\n * Try it here: enter text in text box and watch the greeting change.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.salutation = 'Hello';\n             $scope.name = 'World';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n        <label>Salutation: <input type=\"text\" ng-model=\"salutation\"></label><br>\n        <label>Name: <input type=\"text\" ng-model=\"name\"></label><br>\n        <pre ng-bind-template=\"{{salutation}} {{name}}!\"></pre>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var salutationElem = element(by.binding('salutation'));\n         var salutationInput = element(by.model('salutation'));\n         var nameInput = element(by.model('name'));\n\n         expect(salutationElem.getText()).toBe('Hello World!');\n\n         salutationInput.clear();\n         salutationInput.sendKeys('Greetings');\n         nameInput.clear();\n         nameInput.sendKeys('user');\n\n         expect(salutationElem.getText()).toBe('Greetings user!');\n       });\n     </file>\n   </example>\n */\nvar ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {\n  return {\n    compile: function ngBindTemplateCompile(templateElement) {\n      $compile.$$addBindingClass(templateElement);\n      return function ngBindTemplateLink(scope, element, attr) {\n        var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));\n        $compile.$$addBindingInfo(element, interpolateFn.expressions);\n        element = element[0];\n        attr.$observe('ngBindTemplate', function(value) {\n          element.textContent = isUndefined(value) ? '' : value;\n        });\n      };\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindHtml\n *\n * @description\n * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,\n * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.\n * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link\n * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}\n * in your module's dependencies, you need to include \"angular-sanitize.js\" in your application.\n *\n * You may also bypass sanitization for values you know are safe. To do so, bind to\n * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}.  See the example\n * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.\n *\n * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you\n * will have an exception (instead of an exploit.)\n *\n * @element ANY\n * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.\n *\n * @example\n\n   <example module=\"bindHtmlExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n        <p ng-bind-html=\"myHTML\"></p>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n       angular.module('bindHtmlExample', ['ngSanitize'])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.myHTML =\n              'I am an <code>HTML</code>string with ' +\n              '<a href=\"#\">links!</a> and other <em>stuff</em>';\n         }]);\n     </file>\n\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind-html', function() {\n         expect(element(by.binding('myHTML')).getText()).toBe(\n             'I am an HTMLstring with links! and other stuff');\n       });\n     </file>\n   </example>\n */\nvar ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {\n  return {\n    restrict: 'A',\n    compile: function ngBindHtmlCompile(tElement, tAttrs) {\n      var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);\n      var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) {\n        return (value || '').toString();\n      });\n      $compile.$$addBindingClass(tElement);\n\n      return function ngBindHtmlLink(scope, element, attr) {\n        $compile.$$addBindingInfo(element, attr.ngBindHtml);\n\n        scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {\n          // we re-evaluate the expr because we want a TrustedValueHolderType\n          // for $sce, not a string\n          element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');\n        });\n      };\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngChange\n *\n * @description\n * Evaluate the given expression when the user changes the input.\n * The expression is evaluated immediately, unlike the JavaScript onchange event\n * which only triggers at the end of a change (usually, when the user leaves the\n * form element or presses the return key).\n *\n * The `ngChange` expression is only evaluated when a change in the input value causes\n * a new value to be committed to the model.\n *\n * It will not be evaluated:\n * * if the value returned from the `$parsers` transformation pipeline has not changed\n * * if the input has continued to be invalid since the model will stay `null`\n * * if the model is changed programmatically and not by a change to the input value\n *\n *\n * Note, this directive requires `ngModel` to be present.\n *\n * @element input\n * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change\n * in input value.\n *\n * @example\n * <example name=\"ngChange-directive\" module=\"changeExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('changeExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.counter = 0;\n *           $scope.change = function() {\n *             $scope.counter++;\n *           };\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <input type=\"checkbox\" ng-model=\"confirmed\" ng-change=\"change()\" id=\"ng-change-example1\" />\n *       <input type=\"checkbox\" ng-model=\"confirmed\" id=\"ng-change-example2\" />\n *       <label for=\"ng-change-example2\">Confirmed</label><br />\n *       <tt>debug = {{confirmed}}</tt><br/>\n *       <tt>counter = {{counter}}</tt><br/>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var counter = element(by.binding('counter'));\n *     var debug = element(by.binding('confirmed'));\n *\n *     it('should evaluate the expression if changing from view', function() {\n *       expect(counter.getText()).toContain('0');\n *\n *       element(by.id('ng-change-example1')).click();\n *\n *       expect(counter.getText()).toContain('1');\n *       expect(debug.getText()).toContain('true');\n *     });\n *\n *     it('should not evaluate the expression if changing from model', function() {\n *       element(by.id('ng-change-example2')).click();\n\n *       expect(counter.getText()).toContain('0');\n *       expect(debug.getText()).toContain('true');\n *     });\n *   </file>\n * </example>\n */\nvar ngChangeDirective = valueFn({\n  restrict: 'A',\n  require: 'ngModel',\n  link: function(scope, element, attr, ctrl) {\n    ctrl.$viewChangeListeners.push(function() {\n      scope.$eval(attr.ngChange);\n    });\n  }\n});\n\nfunction classDirective(name, selector) {\n  name = 'ngClass' + name;\n  return ['$animate', function($animate) {\n    return {\n      restrict: 'AC',\n      link: function(scope, element, attr) {\n        var oldVal;\n\n        scope.$watch(attr[name], ngClassWatchAction, true);\n\n        attr.$observe('class', function(value) {\n          ngClassWatchAction(scope.$eval(attr[name]));\n        });\n\n\n        if (name !== 'ngClass') {\n          scope.$watch('$index', function($index, old$index) {\n            // jshint bitwise: false\n            var mod = $index & 1;\n            if (mod !== (old$index & 1)) {\n              var classes = arrayClasses(scope.$eval(attr[name]));\n              mod === selector ?\n                addClasses(classes) :\n                removeClasses(classes);\n            }\n          });\n        }\n\n        function addClasses(classes) {\n          var newClasses = digestClassCounts(classes, 1);\n          attr.$addClass(newClasses);\n        }\n\n        function removeClasses(classes) {\n          var newClasses = digestClassCounts(classes, -1);\n          attr.$removeClass(newClasses);\n        }\n\n        function digestClassCounts(classes, count) {\n          // Use createMap() to prevent class assumptions involving property\n          // names in Object.prototype\n          var classCounts = element.data('$classCounts') || createMap();\n          var classesToUpdate = [];\n          forEach(classes, function(className) {\n            if (count > 0 || classCounts[className]) {\n              classCounts[className] = (classCounts[className] || 0) + count;\n              if (classCounts[className] === +(count > 0)) {\n                classesToUpdate.push(className);\n              }\n            }\n          });\n          element.data('$classCounts', classCounts);\n          return classesToUpdate.join(' ');\n        }\n\n        function updateClasses(oldClasses, newClasses) {\n          var toAdd = arrayDifference(newClasses, oldClasses);\n          var toRemove = arrayDifference(oldClasses, newClasses);\n          toAdd = digestClassCounts(toAdd, 1);\n          toRemove = digestClassCounts(toRemove, -1);\n          if (toAdd && toAdd.length) {\n            $animate.addClass(element, toAdd);\n          }\n          if (toRemove && toRemove.length) {\n            $animate.removeClass(element, toRemove);\n          }\n        }\n\n        function ngClassWatchAction(newVal) {\n          if (selector === true || scope.$index % 2 === selector) {\n            var newClasses = arrayClasses(newVal || []);\n            if (!oldVal) {\n              addClasses(newClasses);\n            } else if (!equals(newVal,oldVal)) {\n              var oldClasses = arrayClasses(oldVal);\n              updateClasses(oldClasses, newClasses);\n            }\n          }\n          oldVal = shallowCopy(newVal);\n        }\n      }\n    };\n\n    function arrayDifference(tokens1, tokens2) {\n      var values = [];\n\n      outer:\n      for (var i = 0; i < tokens1.length; i++) {\n        var token = tokens1[i];\n        for (var j = 0; j < tokens2.length; j++) {\n          if (token == tokens2[j]) continue outer;\n        }\n        values.push(token);\n      }\n      return values;\n    }\n\n    function arrayClasses(classVal) {\n      var classes = [];\n      if (isArray(classVal)) {\n        forEach(classVal, function(v) {\n          classes = classes.concat(arrayClasses(v));\n        });\n        return classes;\n      } else if (isString(classVal)) {\n        return classVal.split(' ');\n      } else if (isObject(classVal)) {\n        forEach(classVal, function(v, k) {\n          if (v) {\n            classes = classes.concat(k.split(' '));\n          }\n        });\n        return classes;\n      }\n      return classVal;\n    }\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ngClass\n * @restrict AC\n *\n * @description\n * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding\n * an expression that represents all classes to be added.\n *\n * The directive operates in three different ways, depending on which of three types the expression\n * evaluates to:\n *\n * 1. If the expression evaluates to a string, the string should be one or more space-delimited class\n * names.\n *\n * 2. If the expression evaluates to an object, then for each key-value pair of the\n * object with a truthy value the corresponding key is used as a class name.\n *\n * 3. If the expression evaluates to an array, each element of the array should either be a string as in\n * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array\n * to give you more control over what CSS classes appear. See the code below for an example of this.\n *\n *\n * The directive won't add duplicate classes if a particular class was already set.\n *\n * When the expression changes, the previously added classes are removed and only then are the\n * new classes added.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#addClass addClass}       | just before the class is applied to the element   |\n * | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |\n *\n * @element ANY\n * @param {expression} ngClass {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class\n *   names, an array, or a map of class names to boolean values. In the case of a map, the\n *   names of the properties whose values are truthy will be added as css classes to the\n *   element.\n *\n * @example Example that demonstrates basic bindings via ngClass directive.\n   <example>\n     <file name=\"index.html\">\n       <p ng-class=\"{strike: deleted, bold: important, 'has-error': error}\">Map Syntax Example</p>\n       <label>\n          <input type=\"checkbox\" ng-model=\"deleted\">\n          deleted (apply \"strike\" class)\n       </label><br>\n       <label>\n          <input type=\"checkbox\" ng-model=\"important\">\n          important (apply \"bold\" class)\n       </label><br>\n       <label>\n          <input type=\"checkbox\" ng-model=\"error\">\n          error (apply \"has-error\" class)\n       </label>\n       <hr>\n       <p ng-class=\"style\">Using String Syntax</p>\n       <input type=\"text\" ng-model=\"style\"\n              placeholder=\"Type: bold strike red\" aria-label=\"Type: bold strike red\">\n       <hr>\n       <p ng-class=\"[style1, style2, style3]\">Using Array Syntax</p>\n       <input ng-model=\"style1\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red\"><br>\n       <input ng-model=\"style2\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 2\"><br>\n       <input ng-model=\"style3\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 3\"><br>\n       <hr>\n       <p ng-class=\"[style4, {orange: warning}]\">Using Array and Map Syntax</p>\n       <input ng-model=\"style4\" placeholder=\"Type: bold, strike\" aria-label=\"Type: bold, strike\"><br>\n       <label><input type=\"checkbox\" ng-model=\"warning\"> warning (apply \"orange\" class)</label>\n     </file>\n     <file name=\"style.css\">\n       .strike {\n           text-decoration: line-through;\n       }\n       .bold {\n           font-weight: bold;\n       }\n       .red {\n           color: red;\n       }\n       .has-error {\n           color: red;\n           background-color: yellow;\n       }\n       .orange {\n           color: orange;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var ps = element.all(by.css('p'));\n\n       it('should let you toggle the class', function() {\n\n         expect(ps.first().getAttribute('class')).not.toMatch(/bold/);\n         expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);\n\n         element(by.model('important')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/bold/);\n\n         element(by.model('error')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/has-error/);\n       });\n\n       it('should let you toggle string example', function() {\n         expect(ps.get(1).getAttribute('class')).toBe('');\n         element(by.model('style')).clear();\n         element(by.model('style')).sendKeys('red');\n         expect(ps.get(1).getAttribute('class')).toBe('red');\n       });\n\n       it('array example should have 3 classes', function() {\n         expect(ps.get(2).getAttribute('class')).toBe('');\n         element(by.model('style1')).sendKeys('bold');\n         element(by.model('style2')).sendKeys('strike');\n         element(by.model('style3')).sendKeys('red');\n         expect(ps.get(2).getAttribute('class')).toBe('bold strike red');\n       });\n\n       it('array with map example should have 2 classes', function() {\n         expect(ps.last().getAttribute('class')).toBe('');\n         element(by.model('style4')).sendKeys('bold');\n         element(by.model('warning')).click();\n         expect(ps.last().getAttribute('class')).toBe('bold orange');\n       });\n     </file>\n   </example>\n\n   ## Animations\n\n   The example below demonstrates how to perform animations using ngClass.\n\n   <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n      <input id=\"setbtn\" type=\"button\" value=\"set\" ng-click=\"myVar='my-class'\">\n      <input id=\"clearbtn\" type=\"button\" value=\"clear\" ng-click=\"myVar=''\">\n      <br>\n      <span class=\"base-class\" ng-class=\"myVar\">Sample Text</span>\n     </file>\n     <file name=\"style.css\">\n       .base-class {\n         transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n       }\n\n       .base-class.my-class {\n         color: red;\n         font-size:3em;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class', function() {\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n\n         element(by.id('setbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).\n           toMatch(/my-class/);\n\n         element(by.id('clearbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n       });\n     </file>\n   </example>\n\n\n   ## ngClass and pre-existing CSS3 Transitions/Animations\n   The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.\n   Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder\n   any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure\n   to view the step by step details of {@link $animate#addClass $animate.addClass} and\n   {@link $animate#removeClass $animate.removeClass}.\n */\nvar ngClassDirective = classDirective('', true);\n\n/**\n * @ngdoc directive\n * @name ngClassOdd\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}}\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassOddDirective = classDirective('Odd', 0);\n\n/**\n * @ngdoc directive\n * @name ngClassEven\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The\n *   result of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}} &nbsp; &nbsp; &nbsp;\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassEvenDirective = classDirective('Even', 1);\n\n/**\n * @ngdoc directive\n * @name ngCloak\n * @restrict AC\n *\n * @description\n * The `ngCloak` directive is used to prevent the Angular html template from being briefly\n * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this\n * directive to avoid the undesirable flicker effect caused by the html template display.\n *\n * The directive can be applied to the `<body>` element, but the preferred usage is to apply\n * multiple `ngCloak` directives to small portions of the page to permit progressive rendering\n * of the browser view.\n *\n * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and\n * `angular.min.js`.\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```css\n * [ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {\n *   display: none !important;\n * }\n * ```\n *\n * When this css rule is loaded by the browser, all html elements (including their children) that\n * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive\n * during the compilation of the template it deletes the `ngCloak` element attribute, making\n * the compiled element visible.\n *\n * For the best result, the `angular.js` script must be loaded in the head section of the html\n * document; alternatively, the css rule above must be included in the external stylesheet of the\n * application.\n *\n * @element ANY\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <div id=\"template1\" ng-cloak>{{ 'hello' }}</div>\n        <div id=\"template2\" class=\"ng-cloak\">{{ 'world' }}</div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should remove the template directive and css class', function() {\n         expect($('#template1').getAttribute('ng-cloak')).\n           toBeNull();\n         expect($('#template2').getAttribute('ng-cloak')).\n           toBeNull();\n       });\n     </file>\n   </example>\n *\n */\nvar ngCloakDirective = ngDirective({\n  compile: function(element, attr) {\n    attr.$set('ngCloak', undefined);\n    element.removeClass('ng-cloak');\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngController\n *\n * @description\n * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular\n * supports the principles behind the Model-View-Controller design pattern.\n *\n * MVC components in angular:\n *\n * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties\n *   are accessed through bindings.\n * * View — The template (HTML with data bindings) that is rendered into the View.\n * * Controller — The `ngController` directive specifies a Controller class; the class contains business\n *   logic behind the application to decorate the scope with functions and values\n *\n * Note that you can also attach controllers to the DOM by declaring it in a route definition\n * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller\n * again using `ng-controller` in the template itself.  This will cause the controller to be attached\n * and executed twice.\n *\n * @element ANY\n * @scope\n * @priority 500\n * @param {expression} ngController Name of a constructor function registered with the current\n * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}\n * that on the current scope evaluates to a constructor function.\n *\n * The controller instance can be published into a scope property by specifying\n * `ng-controller=\"as propertyName\"`.\n *\n * If the current `$controllerProvider` is configured to use globals (via\n * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may\n * also be the name of a globally accessible constructor function (not recommended).\n *\n * @example\n * Here is a simple form for editing user contact information. Adding, removing, clearing, and\n * greeting are methods declared on the controller (see source tab). These methods can\n * easily be called from the angular markup. Any changes to the data are automatically reflected\n * in the View without the need for a manual update.\n *\n * Two different declaration styles are included below:\n *\n * * one binds methods and properties directly onto the controller using `this`:\n * `ng-controller=\"SettingsController1 as settings\"`\n * * one injects `$scope` into the controller:\n * `ng-controller=\"SettingsController2\"`\n *\n * The second option is more common in the Angular community, and is generally used in boilerplates\n * and in this guide. However, there are advantages to binding properties directly to the controller\n * and avoiding scope.\n *\n * * Using `controller as` makes it obvious which controller you are accessing in the template when\n * multiple controllers apply to an element.\n * * If you are writing your controllers as classes you have easier access to the properties and\n * methods, which will appear on the scope, from inside the controller code.\n * * Since there is always a `.` in the bindings, you don't have to worry about prototypal\n * inheritance masking primitives.\n *\n * This example demonstrates the `controller as` syntax.\n *\n * <example name=\"ngControllerAs\" module=\"controllerAsExample\">\n *   <file name=\"index.html\">\n *    <div id=\"ctrl-as-exmpl\" ng-controller=\"SettingsController1 as settings\">\n *      <label>Name: <input type=\"text\" ng-model=\"settings.name\"/></label>\n *      <button ng-click=\"settings.greet()\">greet</button><br/>\n *      Contact:\n *      <ul>\n *        <li ng-repeat=\"contact in settings.contacts\">\n *          <select ng-model=\"contact.type\" aria-label=\"Contact method\" id=\"select_{{$index}}\">\n *             <option>phone</option>\n *             <option>email</option>\n *          </select>\n *          <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n *          <button ng-click=\"settings.clearContact(contact)\">clear</button>\n *          <button ng-click=\"settings.removeContact(contact)\" aria-label=\"Remove\">X</button>\n *        </li>\n *        <li><button ng-click=\"settings.addContact()\">add</button></li>\n *     </ul>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    angular.module('controllerAsExample', [])\n *      .controller('SettingsController1', SettingsController1);\n *\n *    function SettingsController1() {\n *      this.name = \"John Smith\";\n *      this.contacts = [\n *        {type: 'phone', value: '408 555 1212'},\n *        {type: 'email', value: 'john.smith@example.org'} ];\n *    }\n *\n *    SettingsController1.prototype.greet = function() {\n *      alert(this.name);\n *    };\n *\n *    SettingsController1.prototype.addContact = function() {\n *      this.contacts.push({type: 'email', value: 'yourname@example.org'});\n *    };\n *\n *    SettingsController1.prototype.removeContact = function(contactToRemove) {\n *     var index = this.contacts.indexOf(contactToRemove);\n *      this.contacts.splice(index, 1);\n *    };\n *\n *    SettingsController1.prototype.clearContact = function(contact) {\n *      contact.type = 'phone';\n *      contact.value = '';\n *    };\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should check controller as', function() {\n *       var container = element(by.id('ctrl-as-exmpl'));\n *         expect(container.element(by.model('settings.name'))\n *           .getAttribute('value')).toBe('John Smith');\n *\n *       var firstRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(0));\n *       var secondRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(1));\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('408 555 1212');\n *\n *       expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('john.smith@example.org');\n *\n *       firstRepeat.element(by.buttonText('clear')).click();\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('');\n *\n *       container.element(by.buttonText('add')).click();\n *\n *       expect(container.element(by.repeater('contact in settings.contacts').row(2))\n *           .element(by.model('contact.value'))\n *           .getAttribute('value'))\n *           .toBe('yourname@example.org');\n *     });\n *   </file>\n * </example>\n *\n * This example demonstrates the \"attach to `$scope`\" style of controller.\n *\n * <example name=\"ngController\" module=\"controllerExample\">\n *  <file name=\"index.html\">\n *   <div id=\"ctrl-exmpl\" ng-controller=\"SettingsController2\">\n *     <label>Name: <input type=\"text\" ng-model=\"name\"/></label>\n *     <button ng-click=\"greet()\">greet</button><br/>\n *     Contact:\n *     <ul>\n *       <li ng-repeat=\"contact in contacts\">\n *         <select ng-model=\"contact.type\" id=\"select_{{$index}}\">\n *            <option>phone</option>\n *            <option>email</option>\n *         </select>\n *         <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n *         <button ng-click=\"clearContact(contact)\">clear</button>\n *         <button ng-click=\"removeContact(contact)\">X</button>\n *       </li>\n *       <li>[ <button ng-click=\"addContact()\">add</button> ]</li>\n *    </ul>\n *   </div>\n *  </file>\n *  <file name=\"app.js\">\n *   angular.module('controllerExample', [])\n *     .controller('SettingsController2', ['$scope', SettingsController2]);\n *\n *   function SettingsController2($scope) {\n *     $scope.name = \"John Smith\";\n *     $scope.contacts = [\n *       {type:'phone', value:'408 555 1212'},\n *       {type:'email', value:'john.smith@example.org'} ];\n *\n *     $scope.greet = function() {\n *       alert($scope.name);\n *     };\n *\n *     $scope.addContact = function() {\n *       $scope.contacts.push({type:'email', value:'yourname@example.org'});\n *     };\n *\n *     $scope.removeContact = function(contactToRemove) {\n *       var index = $scope.contacts.indexOf(contactToRemove);\n *       $scope.contacts.splice(index, 1);\n *     };\n *\n *     $scope.clearContact = function(contact) {\n *       contact.type = 'phone';\n *       contact.value = '';\n *     };\n *   }\n *  </file>\n *  <file name=\"protractor.js\" type=\"protractor\">\n *    it('should check controller', function() {\n *      var container = element(by.id('ctrl-exmpl'));\n *\n *      expect(container.element(by.model('name'))\n *          .getAttribute('value')).toBe('John Smith');\n *\n *      var firstRepeat =\n *          container.element(by.repeater('contact in contacts').row(0));\n *      var secondRepeat =\n *          container.element(by.repeater('contact in contacts').row(1));\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('408 555 1212');\n *      expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('john.smith@example.org');\n *\n *      firstRepeat.element(by.buttonText('clear')).click();\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('');\n *\n *      container.element(by.buttonText('add')).click();\n *\n *      expect(container.element(by.repeater('contact in contacts').row(2))\n *          .element(by.model('contact.value'))\n *          .getAttribute('value'))\n *          .toBe('yourname@example.org');\n *    });\n *  </file>\n *</example>\n\n */\nvar ngControllerDirective = [function() {\n  return {\n    restrict: 'A',\n    scope: true,\n    controller: '@',\n    priority: 500\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngCsp\n *\n * @element html\n * @description\n *\n * Angular has some features that can break certain\n * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.\n *\n * If you intend to implement these rules then you must tell Angular not to use these features.\n *\n * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.\n *\n *\n * The following rules affect Angular:\n *\n * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions\n * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%\n * increase in the speed of evaluating Angular expressions.\n *\n * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular\n * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).\n * To make these directives work when a CSP rule is blocking inline styles, you must link to the\n * `angular-csp.css` in your HTML manually.\n *\n * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval\n * and automatically deactivates this feature in the {@link $parse} service. This autodetection,\n * however, triggers a CSP error to be logged in the console:\n *\n * ```\n * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of\n * script in the following Content Security Policy directive: \"default-src 'self'\". Note that\n * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.\n * ```\n *\n * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`\n * directive on an element of the HTML document that appears before the `<script>` tag that loads\n * the `angular.js` file.\n *\n * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*\n *\n * You can specify which of the CSP related Angular features should be deactivated by providing\n * a value for the `ng-csp` attribute. The options are as follows:\n *\n * * no-inline-style: this stops Angular from injecting CSS styles into the DOM\n *\n * * no-unsafe-eval: this stops Angular from optimizing $parse with unsafe eval of strings\n *\n * You can use these values in the following combinations:\n *\n *\n * * No declaration means that Angular will assume that you can do inline styles, but it will do\n * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline\n * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject\n * inline styles. E.g. `<body ng-csp=\"no-unsafe-eval\">`.\n *\n * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can\n * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp=\"no-inline-style\">`\n *\n * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject\n * styles nor use eval, which is the same as an empty: ng-csp.\n * E.g.`<body ng-csp=\"no-inline-style;no-unsafe-eval\">`\n *\n * @example\n * This example shows how to apply the `ngCsp` directive to the `html` tag.\n   ```html\n     <!doctype html>\n     <html ng-app ng-csp>\n     ...\n     ...\n     </html>\n   ```\n  * @example\n      // Note: the suffix `.csp` in the example name triggers\n      // csp mode in our http server!\n      <example name=\"example.csp\" module=\"cspExample\" ng-csp=\"true\">\n        <file name=\"index.html\">\n          <div ng-controller=\"MainController as ctrl\">\n            <div>\n              <button ng-click=\"ctrl.inc()\" id=\"inc\">Increment</button>\n              <span id=\"counter\">\n                {{ctrl.counter}}\n              </span>\n            </div>\n\n            <div>\n              <button ng-click=\"ctrl.evil()\" id=\"evil\">Evil</button>\n              <span id=\"evilError\">\n                {{ctrl.evilError}}\n              </span>\n            </div>\n          </div>\n        </file>\n        <file name=\"script.js\">\n           angular.module('cspExample', [])\n             .controller('MainController', function() {\n                this.counter = 0;\n                this.inc = function() {\n                  this.counter++;\n                };\n                this.evil = function() {\n                  // jshint evil:true\n                  try {\n                    eval('1+2');\n                  } catch (e) {\n                    this.evilError = e.message;\n                  }\n                };\n              });\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var util, webdriver;\n\n          var incBtn = element(by.id('inc'));\n          var counter = element(by.id('counter'));\n          var evilBtn = element(by.id('evil'));\n          var evilError = element(by.id('evilError'));\n\n          function getAndClearSevereErrors() {\n            return browser.manage().logs().get('browser').then(function(browserLog) {\n              return browserLog.filter(function(logEntry) {\n                return logEntry.level.value > webdriver.logging.Level.WARNING.value;\n              });\n            });\n          }\n\n          function clearErrors() {\n            getAndClearSevereErrors();\n          }\n\n          function expectNoErrors() {\n            getAndClearSevereErrors().then(function(filteredLog) {\n              expect(filteredLog.length).toEqual(0);\n              if (filteredLog.length) {\n                console.log('browser console errors: ' + util.inspect(filteredLog));\n              }\n            });\n          }\n\n          function expectError(regex) {\n            getAndClearSevereErrors().then(function(filteredLog) {\n              var found = false;\n              filteredLog.forEach(function(log) {\n                if (log.message.match(regex)) {\n                  found = true;\n                }\n              });\n              if (!found) {\n                throw new Error('expected an error that matches ' + regex);\n              }\n            });\n          }\n\n          beforeEach(function() {\n            util = require('util');\n            webdriver = require('protractor/node_modules/selenium-webdriver');\n          });\n\n          // For now, we only test on Chrome,\n          // as Safari does not load the page with Protractor's injected scripts,\n          // and Firefox webdriver always disables content security policy (#6358)\n          if (browser.params.browser !== 'chrome') {\n            return;\n          }\n\n          it('should not report errors when the page is loaded', function() {\n            // clear errors so we are not dependent on previous tests\n            clearErrors();\n            // Need to reload the page as the page is already loaded when\n            // we come here\n            browser.driver.getCurrentUrl().then(function(url) {\n              browser.get(url);\n            });\n            expectNoErrors();\n          });\n\n          it('should evaluate expressions', function() {\n            expect(counter.getText()).toEqual('0');\n            incBtn.click();\n            expect(counter.getText()).toEqual('1');\n            expectNoErrors();\n          });\n\n          it('should throw and report an error when using \"eval\"', function() {\n            evilBtn.click();\n            expect(evilError.getText()).toMatch(/Content Security Policy/);\n            expectError(/Content Security Policy/);\n          });\n        </file>\n      </example>\n  */\n\n// ngCsp is not implemented as a proper directive any more, because we need it be processed while we\n// bootstrap the system (before $parse is instantiated), for this reason we just have\n// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc\n\n/**\n * @ngdoc directive\n * @name ngClick\n *\n * @description\n * The ngClick directive allows you to specify custom behavior when\n * an element is clicked.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon\n * click. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-click=\"count = count + 1\" ng-init=\"count=0\">\n        Increment\n      </button>\n      <span>\n        count: {{count}}\n      </span>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-click', function() {\n         expect(element(by.binding('count')).getText()).toMatch('0');\n         element(by.css('button')).click();\n         expect(element(by.binding('count')).getText()).toMatch('1');\n       });\n     </file>\n   </example>\n */\n/*\n * A collection of directives that allows creation of custom event handlers that are defined as\n * angular expressions and are compiled and executed within the current scope.\n */\nvar ngEventDirectives = {};\n\n// For events that might fire synchronously during DOM manipulation\n// we need to execute their event handlers asynchronously using $evalAsync,\n// so that they are not executed in an inconsistent state.\nvar forceAsyncEvents = {\n  'blur': true,\n  'focus': true\n};\nforEach(\n  'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),\n  function(eventName) {\n    var directiveName = directiveNormalize('ng-' + eventName);\n    ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {\n      return {\n        restrict: 'A',\n        compile: function($element, attr) {\n          // We expose the powerful $event object on the scope that provides access to the Window,\n          // etc. that isn't protected by the fast paths in $parse.  We explicitly request better\n          // checks at the cost of speed since event handler expressions are not executed as\n          // frequently as regular change detection.\n          var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);\n          return function ngEventHandler(scope, element) {\n            element.on(eventName, function(event) {\n              var callback = function() {\n                fn(scope, {$event:event});\n              };\n              if (forceAsyncEvents[eventName] && $rootScope.$$phase) {\n                scope.$evalAsync(callback);\n              } else {\n                scope.$apply(callback);\n              }\n            });\n          };\n        }\n      };\n    }];\n  }\n);\n\n/**\n * @ngdoc directive\n * @name ngDblclick\n *\n * @description\n * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon\n * a dblclick. (The Event object is available as `$event`)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-dblclick=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on double click)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousedown\n *\n * @description\n * The ngMousedown directive allows you to specify custom behavior on mousedown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon\n * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousedown=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse down)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseup\n *\n * @description\n * Specify custom behavior on mouseup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon\n * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseup=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse up)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngMouseover\n *\n * @description\n * Specify custom behavior on mouseover event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon\n * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseover=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse is over)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseenter\n *\n * @description\n * Specify custom behavior on mouseenter event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon\n * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseenter=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse enters)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseleave\n *\n * @description\n * Specify custom behavior on mouseleave event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon\n * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseleave=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse leaves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousemove\n *\n * @description\n * Specify custom behavior on mousemove event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon\n * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousemove=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse moves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeydown\n *\n * @description\n * Specify custom behavior on keydown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon\n * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keydown=\"count = count + 1\" ng-init=\"count=0\">\n      key down count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeyup\n *\n * @description\n * Specify custom behavior on keyup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon\n * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <p>Typing in the input box below updates the key count</p>\n       <input ng-keyup=\"count = count + 1\" ng-init=\"count=0\"> key up count: {{count}}\n\n       <p>Typing in the input box below updates the keycode</p>\n       <input ng-keyup=\"event=$event\">\n       <p>event keyCode: {{ event.keyCode }}</p>\n       <p>event altKey: {{ event.altKey }}</p>\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeypress\n *\n * @description\n * Specify custom behavior on keypress event.\n *\n * @element ANY\n * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon\n * keypress. ({@link guide/expression#-event- Event object is available as `$event`}\n * and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keypress=\"count = count + 1\" ng-init=\"count=0\">\n      key press count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSubmit\n *\n * @description\n * Enables binding angular expressions to onsubmit events.\n *\n * Additionally it prevents the default action (which for form means sending the request to the\n * server and reloading the current page), but only if the form does not contain `action`,\n * `data-action`, or `x-action` attributes.\n *\n * <div class=\"alert alert-warning\">\n * **Warning:** Be careful not to cause \"double-submission\" by using both the `ngClick` and\n * `ngSubmit` handlers together. See the\n * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}\n * for a detailed discussion of when `ngSubmit` may be triggered.\n * </div>\n *\n * @element form\n * @priority 0\n * @param {expression} ngSubmit {@link guide/expression Expression} to eval.\n * ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example module=\"submitExample\">\n     <file name=\"index.html\">\n      <script>\n        angular.module('submitExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.list = [];\n            $scope.text = 'hello';\n            $scope.submit = function() {\n              if ($scope.text) {\n                $scope.list.push(this.text);\n                $scope.text = '';\n              }\n            };\n          }]);\n      </script>\n      <form ng-submit=\"submit()\" ng-controller=\"ExampleController\">\n        Enter text and hit enter:\n        <input type=\"text\" ng-model=\"text\" name=\"text\" />\n        <input type=\"submit\" id=\"submit\" value=\"Submit\" />\n        <pre>list={{list}}</pre>\n      </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-submit', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n         expect(element(by.model('text')).getAttribute('value')).toBe('');\n       });\n       it('should ignore empty strings', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n        });\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngFocus\n *\n * @description\n * Specify custom behavior on focus event.\n *\n * Note: As the `focus` event is executed synchronously when calling `input.focus()`\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon\n * focus. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngBlur\n *\n * @description\n * Specify custom behavior on blur event.\n *\n * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when\n * an element has lost focus.\n *\n * Note: As the `blur` event is executed synchronously also during DOM manipulations\n * (e.g. removing a focussed input),\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon\n * blur. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngCopy\n *\n * @description\n * Specify custom behavior on copy event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon\n * copy. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-copy=\"copied=true\" ng-init=\"copied=false; value='copy me'\" ng-model=\"value\">\n      copied: {{copied}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngCut\n *\n * @description\n * Specify custom behavior on cut event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon\n * cut. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-cut=\"cut=true\" ng-init=\"cut=false; value='cut me'\" ng-model=\"value\">\n      cut: {{cut}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngPaste\n *\n * @description\n * Specify custom behavior on paste event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon\n * paste. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-paste=\"paste=true\" ng-init=\"paste=false\" placeholder='paste here'>\n      pasted: {{paste}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngIf\n * @restrict A\n * @multiElement\n *\n * @description\n * The `ngIf` directive removes or recreates a portion of the DOM tree based on an\n * {expression}. If the expression assigned to `ngIf` evaluates to a false\n * value then the element is removed from the DOM, otherwise a clone of the\n * element is reinserted into the DOM.\n *\n * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the\n * element in the DOM rather than changing its visibility via the `display` css property.  A common\n * case when this difference is significant is when using css selectors that rely on an element's\n * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.\n *\n * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope\n * is created when the element is restored.  The scope created within `ngIf` inherits from\n * its parent scope using\n * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).\n * An important implication of this is if `ngModel` is used within `ngIf` to bind to\n * a javascript primitive defined in the parent scope. In this case any modifications made to the\n * variable within the child scope will override (hide) the value in the parent scope.\n *\n * Also, `ngIf` recreates elements using their compiled state. An example of this behavior\n * is if an element's class attribute is directly modified after it's compiled, using something like\n * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element\n * the added class will be lost because the original compiled state is used to regenerate the element.\n *\n * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`\n * and `leave` effects.\n *\n * @animations\n * | Animation                        | Occurs                               |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container |\n * | {@link ng.$animate#leave leave}  | just before the `ngIf` contents are removed from the DOM |\n *\n * @element ANY\n * @scope\n * @priority 600\n * @param {expression} ngIf If the {@link guide/expression expression} is falsy then\n *     the element is removed from the DOM tree. If it is truthy a copy of the compiled\n *     element is added to the DOM tree.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <label>Click me: <input type=\"checkbox\" ng-model=\"checked\" ng-init=\"checked=true\" /></label><br/>\n      Show when checked:\n      <span ng-if=\"checked\" class=\"animate-if\">\n        This is removed when the checkbox is unchecked.\n      </span>\n    </file>\n    <file name=\"animations.css\">\n      .animate-if {\n        background:white;\n        border:1px solid black;\n        padding:10px;\n      }\n\n      .animate-if.ng-enter, .animate-if.ng-leave {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n      }\n\n      .animate-if.ng-enter,\n      .animate-if.ng-leave.ng-leave-active {\n        opacity:0;\n      }\n\n      .animate-if.ng-leave,\n      .animate-if.ng-enter.ng-enter-active {\n        opacity:1;\n      }\n    </file>\n  </example>\n */\nvar ngIfDirective = ['$animate', '$compile', function($animate, $compile) {\n  return {\n    multiElement: true,\n    transclude: 'element',\n    priority: 600,\n    terminal: true,\n    restrict: 'A',\n    $$tlb: true,\n    link: function($scope, $element, $attr, ctrl, $transclude) {\n        var block, childScope, previousElements;\n        $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {\n\n          if (value) {\n            if (!childScope) {\n              $transclude(function(clone, newScope) {\n                childScope = newScope;\n                clone[clone.length++] = $compile.$$createComment('end ngIf', $attr.ngIf);\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block = {\n                  clone: clone\n                };\n                $animate.enter(clone, $element.parent(), $element);\n              });\n            }\n          } else {\n            if (previousElements) {\n              previousElements.remove();\n              previousElements = null;\n            }\n            if (childScope) {\n              childScope.$destroy();\n              childScope = null;\n            }\n            if (block) {\n              previousElements = getBlockNodes(block.clone);\n              $animate.leave(previousElements).then(function() {\n                previousElements = null;\n              });\n              block = null;\n            }\n          }\n        });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngInclude\n * @restrict ECA\n *\n * @description\n * Fetches, compiles and includes an external HTML fragment.\n *\n * By default, the template URL is restricted to the same domain and protocol as the\n * application document. This is done by calling {@link $sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols\n * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or\n * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link\n * ng.$sce Strict Contextual Escaping}.\n *\n * In addition, the browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy may further restrict whether the template is successfully loaded.\n * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`\n * access on some browsers.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | when the expression changes, on the new include |\n * | {@link ng.$animate#leave leave}  | when the expression changes, on the old include |\n *\n * The enter and leave animation occur concurrently.\n *\n * @scope\n * @priority 400\n *\n * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,\n *                 make sure you wrap it in **single** quotes, e.g. `src=\"'myPartialTemplate.html'\"`.\n * @param {string=} onload Expression to evaluate when a new partial is loaded.\n *                  <div class=\"alert alert-warning\">\n *                  **Note:** When using onload on SVG elements in IE11, the browser will try to call\n *                  a function with the name on the window element, which will usually throw a\n *                  \"function is undefined\" error. To fix this, you can instead use `data-onload` or a\n *                  different form that {@link guide/directive#normalization matches} `onload`.\n *                  </div>\n   *\n * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll\n *                  $anchorScroll} to scroll the viewport after the content is loaded.\n *\n *                  - If the attribute is not set, disable scrolling.\n *                  - If the attribute is set without value, enable scrolling.\n *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.\n *\n * @example\n  <example module=\"includeExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n     <div ng-controller=\"ExampleController\">\n       <select ng-model=\"template\" ng-options=\"t.name for t in templates\">\n        <option value=\"\">(blank)</option>\n       </select>\n       url of the template: <code>{{template.url}}</code>\n       <hr/>\n       <div class=\"slide-animate-container\">\n         <div class=\"slide-animate\" ng-include=\"template.url\"></div>\n       </div>\n     </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('includeExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.templates =\n            [ { name: 'template1.html', url: 'template1.html'},\n              { name: 'template2.html', url: 'template2.html'} ];\n          $scope.template = $scope.templates[0];\n        }]);\n     </file>\n    <file name=\"template1.html\">\n      Content of template1.html\n    </file>\n    <file name=\"template2.html\">\n      Content of template2.html\n    </file>\n    <file name=\"animations.css\">\n      .slide-animate-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .slide-animate {\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter, .slide-animate.ng-leave {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n        display:block;\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter {\n        top:-50px;\n      }\n      .slide-animate.ng-enter.ng-enter-active {\n        top:0;\n      }\n\n      .slide-animate.ng-leave {\n        top:0;\n      }\n      .slide-animate.ng-leave.ng-leave-active {\n        top:50px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var templateSelect = element(by.model('template'));\n      var includeElem = element(by.css('[ng-include]'));\n\n      it('should load template1.html', function() {\n        expect(includeElem.getText()).toMatch(/Content of template1.html/);\n      });\n\n      it('should load template2.html', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          // See https://github.com/angular/protractor/issues/480\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(2).click();\n        expect(includeElem.getText()).toMatch(/Content of template2.html/);\n      });\n\n      it('should change to blank', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(0).click();\n        expect(includeElem.isPresent()).toBe(false);\n      });\n    </file>\n  </example>\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentRequested\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted every time the ngInclude content is requested.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentLoaded\n * @eventType emit on the current ngInclude scope\n * @description\n * Emitted every time the ngInclude content is reloaded.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentError\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\nvar ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',\n                  function($templateRequest,   $anchorScroll,   $animate) {\n  return {\n    restrict: 'ECA',\n    priority: 400,\n    terminal: true,\n    transclude: 'element',\n    controller: angular.noop,\n    compile: function(element, attr) {\n      var srcExp = attr.ngInclude || attr.src,\n          onloadExp = attr.onload || '',\n          autoScrollExp = attr.autoscroll;\n\n      return function(scope, $element, $attr, ctrl, $transclude) {\n        var changeCounter = 0,\n            currentScope,\n            previousElement,\n            currentElement;\n\n        var cleanupLastIncludeContent = function() {\n          if (previousElement) {\n            previousElement.remove();\n            previousElement = null;\n          }\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n          if (currentElement) {\n            $animate.leave(currentElement).then(function() {\n              previousElement = null;\n            });\n            previousElement = currentElement;\n            currentElement = null;\n          }\n        };\n\n        scope.$watch(srcExp, function ngIncludeWatchAction(src) {\n          var afterAnimation = function() {\n            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {\n              $anchorScroll();\n            }\n          };\n          var thisChangeId = ++changeCounter;\n\n          if (src) {\n            //set the 2nd param to true to ignore the template request error so that the inner\n            //contents and scope can be cleaned up.\n            $templateRequest(src, true).then(function(response) {\n              if (scope.$$destroyed) return;\n\n              if (thisChangeId !== changeCounter) return;\n              var newScope = scope.$new();\n              ctrl.template = response;\n\n              // Note: This will also link all children of ng-include that were contained in the original\n              // html. If that content contains controllers, ... they could pollute/change the scope.\n              // However, using ng-include on an element with additional content does not make sense...\n              // Note: We can't remove them in the cloneAttchFn of $transclude as that\n              // function is called before linking the content, which would apply child\n              // directives to non existing elements.\n              var clone = $transclude(newScope, function(clone) {\n                cleanupLastIncludeContent();\n                $animate.enter(clone, null, $element).then(afterAnimation);\n              });\n\n              currentScope = newScope;\n              currentElement = clone;\n\n              currentScope.$emit('$includeContentLoaded', src);\n              scope.$eval(onloadExp);\n            }, function() {\n              if (scope.$$destroyed) return;\n\n              if (thisChangeId === changeCounter) {\n                cleanupLastIncludeContent();\n                scope.$emit('$includeContentError', src);\n              }\n            });\n            scope.$emit('$includeContentRequested', src);\n          } else {\n            cleanupLastIncludeContent();\n            ctrl.template = null;\n          }\n        });\n      };\n    }\n  };\n}];\n\n// This directive is called during the $transclude call of the first `ngInclude` directive.\n// It will replace and compile the content of the element with the loaded template.\n// We need this directive so that the element content is already filled when\n// the link function of another directive on the same element as ngInclude\n// is called.\nvar ngIncludeFillContentDirective = ['$compile',\n  function($compile) {\n    return {\n      restrict: 'ECA',\n      priority: -400,\n      require: 'ngInclude',\n      link: function(scope, $element, $attr, ctrl) {\n        if (toString.call($element[0]).match(/SVG/)) {\n          // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not\n          // support innerHTML, so detect this here and try to generate the contents\n          // specially.\n          $element.empty();\n          $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope,\n              function namespaceAdaptedClone(clone) {\n            $element.append(clone);\n          }, {futureParentElement: $element});\n          return;\n        }\n\n        $element.html(ctrl.template);\n        $compile($element.contents())(scope);\n      }\n    };\n  }];\n\n/**\n * @ngdoc directive\n * @name ngInit\n * @restrict AC\n *\n * @description\n * The `ngInit` directive allows you to evaluate an expression in the\n * current scope.\n *\n * <div class=\"alert alert-danger\">\n * This directive can be abused to add unnecessary amounts of logic into your templates.\n * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of\n * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via\n * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}\n * rather than `ngInit` to initialize values on a scope.\n * </div>\n *\n * <div class=\"alert alert-warning\">\n * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make\n * sure you have parentheses to ensure correct operator precedence:\n * <pre class=\"prettyprint\">\n * `<div ng-init=\"test1 = ($index | toString)\"></div>`\n * </pre>\n * </div>\n *\n * @priority 450\n *\n * @element ANY\n * @param {expression} ngInit {@link guide/expression Expression} to eval.\n *\n * @example\n   <example module=\"initExample\">\n     <file name=\"index.html\">\n   <script>\n     angular.module('initExample', [])\n       .controller('ExampleController', ['$scope', function($scope) {\n         $scope.list = [['a', 'b'], ['c', 'd']];\n       }]);\n   </script>\n   <div ng-controller=\"ExampleController\">\n     <div ng-repeat=\"innerList in list\" ng-init=\"outerIndex = $index\">\n       <div ng-repeat=\"value in innerList\" ng-init=\"innerIndex = $index\">\n          <span class=\"example-init\">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>\n       </div>\n     </div>\n   </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should alias index positions', function() {\n         var elements = element.all(by.css('.example-init'));\n         expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');\n         expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');\n         expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');\n         expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');\n       });\n     </file>\n   </example>\n */\nvar ngInitDirective = ngDirective({\n  priority: 450,\n  compile: function() {\n    return {\n      pre: function(scope, element, attrs) {\n        scope.$eval(attrs.ngInit);\n      }\n    };\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngList\n *\n * @description\n * Text input that converts between a delimited string and an array of strings. The default\n * delimiter is a comma followed by a space - equivalent to `ng-list=\", \"`. You can specify a custom\n * delimiter as the value of the `ngList` attribute - for example, `ng-list=\" | \"`.\n *\n * The behaviour of the directive is affected by the use of the `ngTrim` attribute.\n * * If `ngTrim` is set to `\"false\"` then whitespace around both the separator and each\n *   list item is respected. This implies that the user of the directive is responsible for\n *   dealing with whitespace but also allows you to use whitespace as a delimiter, such as a\n *   tab or newline character.\n * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected\n *   when joining the list items back together) and whitespace around each list item is stripped\n *   before it is added to the model.\n *\n * ### Example with Validation\n *\n * <example name=\"ngList-directive\" module=\"listExample\">\n *   <file name=\"app.js\">\n *      angular.module('listExample', [])\n *        .controller('ExampleController', ['$scope', function($scope) {\n *          $scope.names = ['morpheus', 'neo', 'trinity'];\n *        }]);\n *   </file>\n *   <file name=\"index.html\">\n *    <form name=\"myForm\" ng-controller=\"ExampleController\">\n *      <label>List: <input name=\"namesInput\" ng-model=\"names\" ng-list required></label>\n *      <span role=\"alert\">\n *        <span class=\"error\" ng-show=\"myForm.namesInput.$error.required\">\n *        Required!</span>\n *      </span>\n *      <br>\n *      <tt>names = {{names}}</tt><br/>\n *      <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>\n *      <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>\n *      <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n *      <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n *     </form>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var listInput = element(by.model('names'));\n *     var names = element(by.exactBinding('names'));\n *     var valid = element(by.binding('myForm.namesInput.$valid'));\n *     var error = element(by.css('span.error'));\n *\n *     it('should initialize to model', function() {\n *       expect(names.getText()).toContain('[\"morpheus\",\"neo\",\"trinity\"]');\n *       expect(valid.getText()).toContain('true');\n *       expect(error.getCssValue('display')).toBe('none');\n *     });\n *\n *     it('should be invalid if empty', function() {\n *       listInput.clear();\n *       listInput.sendKeys('');\n *\n *       expect(names.getText()).toContain('');\n *       expect(valid.getText()).toContain('false');\n *       expect(error.getCssValue('display')).not.toBe('none');\n *     });\n *   </file>\n * </example>\n *\n * ### Example - splitting on newline\n * <example name=\"ngList-directive-newlines\">\n *   <file name=\"index.html\">\n *    <textarea ng-model=\"list\" ng-list=\"&#10;\" ng-trim=\"false\"></textarea>\n *    <pre>{{ list | json }}</pre>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it(\"should split the text by newlines\", function() {\n *       var listInput = element(by.model('list'));\n *       var output = element(by.binding('list | json'));\n *       listInput.sendKeys('abc\\ndef\\nghi');\n *       expect(output.getText()).toContain('[\\n  \"abc\",\\n  \"def\",\\n  \"ghi\"\\n]');\n *     });\n *   </file>\n * </example>\n *\n * @element input\n * @param {string=} ngList optional delimiter that should be used to split the value.\n */\nvar ngListDirective = function() {\n  return {\n    restrict: 'A',\n    priority: 100,\n    require: 'ngModel',\n    link: function(scope, element, attr, ctrl) {\n      // We want to control whitespace trimming so we use this convoluted approach\n      // to access the ngList attribute, which doesn't pre-trim the attribute\n      var ngList = element.attr(attr.$attr.ngList) || ', ';\n      var trimValues = attr.ngTrim !== 'false';\n      var separator = trimValues ? trim(ngList) : ngList;\n\n      var parse = function(viewValue) {\n        // If the viewValue is invalid (say required but empty) it will be `undefined`\n        if (isUndefined(viewValue)) return;\n\n        var list = [];\n\n        if (viewValue) {\n          forEach(viewValue.split(separator), function(value) {\n            if (value) list.push(trimValues ? trim(value) : value);\n          });\n        }\n\n        return list;\n      };\n\n      ctrl.$parsers.push(parse);\n      ctrl.$formatters.push(function(value) {\n        if (isArray(value)) {\n          return value.join(ngList);\n        }\n\n        return undefined;\n      });\n\n      // Override the standard $isEmpty because an empty array means the input is empty.\n      ctrl.$isEmpty = function(value) {\n        return !value || !value.length;\n      };\n    }\n  };\n};\n\n/* global VALID_CLASS: true,\n  INVALID_CLASS: true,\n  PRISTINE_CLASS: true,\n  DIRTY_CLASS: true,\n  UNTOUCHED_CLASS: true,\n  TOUCHED_CLASS: true,\n*/\n\nvar VALID_CLASS = 'ng-valid',\n    INVALID_CLASS = 'ng-invalid',\n    PRISTINE_CLASS = 'ng-pristine',\n    DIRTY_CLASS = 'ng-dirty',\n    UNTOUCHED_CLASS = 'ng-untouched',\n    TOUCHED_CLASS = 'ng-touched',\n    PENDING_CLASS = 'ng-pending',\n    EMPTY_CLASS = 'ng-empty',\n    NOT_EMPTY_CLASS = 'ng-not-empty';\n\nvar ngModelMinErr = minErr('ngModel');\n\n/**\n * @ngdoc type\n * @name ngModel.NgModelController\n *\n * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a\n * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue\n * is set.\n * @property {*} $modelValue The value in the model that the control is bound to.\n * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever\n       the control reads value from the DOM. The functions are called in array order, each passing\n       its return value through to the next. The last return value is forwarded to the\n       {@link ngModel.NgModelController#$validators `$validators`} collection.\n\nParsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue\n`$viewValue`}.\n\nReturning `undefined` from a parser means a parse error occurred. In that case,\nno {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`\nwill be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}\nis set to `true`. The parse error is stored in `ngModel.$error.parse`.\n\n *\n * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever\n       the model value changes. The functions are called in reverse array order, each passing the value through to the\n       next. The last return value is used as the actual DOM value.\n       Used to format / convert values for display in the control.\n * ```js\n * function formatter(value) {\n *   if (value) {\n *     return value.toUpperCase();\n *   }\n * }\n * ngModel.$formatters.push(formatter);\n * ```\n *\n * @property {Object.<string, function>} $validators A collection of validators that are applied\n *      whenever the model value changes. The key value within the object refers to the name of the\n *      validator while the function refers to the validation operation. The validation operation is\n *      provided with the model value as an argument and must return a true or false value depending\n *      on the response of that validation.\n *\n * ```js\n * ngModel.$validators.validCharacters = function(modelValue, viewValue) {\n *   var value = modelValue || viewValue;\n *   return /[0-9]+/.test(value) &&\n *          /[a-z]+/.test(value) &&\n *          /[A-Z]+/.test(value) &&\n *          /\\W+/.test(value);\n * };\n * ```\n *\n * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to\n *      perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided\n *      is expected to return a promise when it is run during the model validation process. Once the promise\n *      is delivered then the validation status will be set to true when fulfilled and false when rejected.\n *      When the asynchronous validators are triggered, each of the validators will run in parallel and the model\n *      value will only be updated once all validators have been fulfilled. As long as an asynchronous validator\n *      is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators\n *      will only run once all synchronous validators have passed.\n *\n * Please note that if $http is used then it is important that the server returns a success HTTP response code\n * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.\n *\n * ```js\n * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {\n *   var value = modelValue || viewValue;\n *\n *   // Lookup user by username\n *   return $http.get('/api/users/' + value).\n *      then(function resolved() {\n *        //username exists, this means validation fails\n *        return $q.reject('exists');\n *      }, function rejected() {\n *        //username does not exist, therefore this validation passes\n *        return true;\n *      });\n * };\n * ```\n *\n * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the\n *     view value has changed. It is called with no arguments, and its return value is ignored.\n *     This can be used in place of additional $watches against the model value.\n *\n * @property {Object} $error An object hash with all failing validator ids as keys.\n * @property {Object} $pending An object hash with all pending validator ids as keys.\n *\n * @property {boolean} $untouched True if control has not lost focus yet.\n * @property {boolean} $touched True if control has lost focus.\n * @property {boolean} $pristine True if user has not interacted with the control yet.\n * @property {boolean} $dirty True if user has already interacted with the control.\n * @property {boolean} $valid True if there is no error.\n * @property {boolean} $invalid True if at least one error on the control.\n * @property {string} $name The name attribute of the control.\n *\n * @description\n *\n * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.\n * The controller contains services for data-binding, validation, CSS updates, and value formatting\n * and parsing. It purposefully does not contain any logic which deals with DOM rendering or\n * listening to DOM events.\n * Such DOM related logic should be provided by other directives which make use of\n * `NgModelController` for data-binding to control elements.\n * Angular provides this DOM logic for most {@link input `input`} elements.\n * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example\n * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.\n *\n * @example\n * ### Custom Control Example\n * This example shows how to use `NgModelController` with a custom control to achieve\n * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)\n * collaborate together to achieve the desired result.\n *\n * `contenteditable` is an HTML5 attribute, which tells the browser to let the element\n * contents be edited in place by the user.\n *\n * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}\n * module to automatically remove \"bad\" content like inline event listener (e.g. `<span onclick=\"...\">`).\n * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks\n * that content using the `$sce` service.\n *\n * <example name=\"NgModelController\" module=\"customControl\" deps=\"angular-sanitize.js\">\n    <file name=\"style.css\">\n      [contenteditable] {\n        border: 1px solid black;\n        background-color: white;\n        min-height: 20px;\n      }\n\n      .ng-invalid {\n        border: 1px solid red;\n      }\n\n    </file>\n    <file name=\"script.js\">\n      angular.module('customControl', ['ngSanitize']).\n        directive('contenteditable', ['$sce', function($sce) {\n          return {\n            restrict: 'A', // only activate on element attribute\n            require: '?ngModel', // get a hold of NgModelController\n            link: function(scope, element, attrs, ngModel) {\n              if (!ngModel) return; // do nothing if no ng-model\n\n              // Specify how UI should be updated\n              ngModel.$render = function() {\n                element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));\n              };\n\n              // Listen for change events to enable binding\n              element.on('blur keyup change', function() {\n                scope.$evalAsync(read);\n              });\n              read(); // initialize\n\n              // Write data to the model\n              function read() {\n                var html = element.html();\n                // When we clear the content editable the browser leaves a <br> behind\n                // If strip-br attribute is provided then we strip this out\n                if ( attrs.stripBr && html == '<br>' ) {\n                  html = '';\n                }\n                ngModel.$setViewValue(html);\n              }\n            }\n          };\n        }]);\n    </file>\n    <file name=\"index.html\">\n      <form name=\"myForm\">\n       <div contenteditable\n            name=\"myWidget\" ng-model=\"userContent\"\n            strip-br=\"true\"\n            required>Change me!</div>\n        <span ng-show=\"myForm.myWidget.$error.required\">Required!</span>\n       <hr>\n       <textarea ng-model=\"userContent\" aria-label=\"Dynamic textarea\"></textarea>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n    it('should data-bind and become invalid', function() {\n      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {\n        // SafariDriver can't handle contenteditable\n        // and Firefox driver can't clear contenteditables very well\n        return;\n      }\n      var contentEditable = element(by.css('[contenteditable]'));\n      var content = 'Change me!';\n\n      expect(contentEditable.getText()).toEqual(content);\n\n      contentEditable.clear();\n      contentEditable.sendKeys(protractor.Key.BACK_SPACE);\n      expect(contentEditable.getText()).toEqual('');\n      expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);\n    });\n    </file>\n * </example>\n *\n *\n */\nvar NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',\n    function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {\n  this.$viewValue = Number.NaN;\n  this.$modelValue = Number.NaN;\n  this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.\n  this.$validators = {};\n  this.$asyncValidators = {};\n  this.$parsers = [];\n  this.$formatters = [];\n  this.$viewChangeListeners = [];\n  this.$untouched = true;\n  this.$touched = false;\n  this.$pristine = true;\n  this.$dirty = false;\n  this.$valid = true;\n  this.$invalid = false;\n  this.$error = {}; // keep invalid keys here\n  this.$$success = {}; // keep valid keys here\n  this.$pending = undefined; // keep pending keys here\n  this.$name = $interpolate($attr.name || '', false)($scope);\n  this.$$parentForm = nullFormCtrl;\n\n  var parsedNgModel = $parse($attr.ngModel),\n      parsedNgModelAssign = parsedNgModel.assign,\n      ngModelGet = parsedNgModel,\n      ngModelSet = parsedNgModelAssign,\n      pendingDebounce = null,\n      parserValid,\n      ctrl = this;\n\n  this.$$setOptions = function(options) {\n    ctrl.$options = options;\n    if (options && options.getterSetter) {\n      var invokeModelGetter = $parse($attr.ngModel + '()'),\n          invokeModelSetter = $parse($attr.ngModel + '($$$p)');\n\n      ngModelGet = function($scope) {\n        var modelValue = parsedNgModel($scope);\n        if (isFunction(modelValue)) {\n          modelValue = invokeModelGetter($scope);\n        }\n        return modelValue;\n      };\n      ngModelSet = function($scope, newValue) {\n        if (isFunction(parsedNgModel($scope))) {\n          invokeModelSetter($scope, {$$$p: newValue});\n        } else {\n          parsedNgModelAssign($scope, newValue);\n        }\n      };\n    } else if (!parsedNgModel.assign) {\n      throw ngModelMinErr('nonassign', \"Expression '{0}' is non-assignable. Element: {1}\",\n          $attr.ngModel, startingTag($element));\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$render\n   *\n   * @description\n   * Called when the view needs to be updated. It is expected that the user of the ng-model\n   * directive will implement this method.\n   *\n   * The `$render()` method is invoked in the following situations:\n   *\n   * * `$rollbackViewValue()` is called.  If we are rolling back the view value to the last\n   *   committed value then `$render()` is called to update the input control.\n   * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and\n   *   the `$viewValue` are different from last time.\n   *\n   * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of\n   * `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue`\n   * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be\n   * invoked if you only change a property on the objects.\n   */\n  this.$render = noop;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$isEmpty\n   *\n   * @description\n   * This is called when we need to determine if the value of an input is empty.\n   *\n   * For instance, the required directive does this to work out if the input has data or not.\n   *\n   * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.\n   *\n   * You can override this for input directives whose concept of being empty is different from the\n   * default. The `checkboxInputType` directive does this because in its case a value of `false`\n   * implies empty.\n   *\n   * @param {*} value The value of the input to check for emptiness.\n   * @returns {boolean} True if `value` is \"empty\".\n   */\n  this.$isEmpty = function(value) {\n    return isUndefined(value) || value === '' || value === null || value !== value;\n  };\n\n  this.$$updateEmptyClasses = function(value) {\n    if (ctrl.$isEmpty(value)) {\n      $animate.removeClass($element, NOT_EMPTY_CLASS);\n      $animate.addClass($element, EMPTY_CLASS);\n    } else {\n      $animate.removeClass($element, EMPTY_CLASS);\n      $animate.addClass($element, NOT_EMPTY_CLASS);\n    }\n  };\n\n\n  var currentValidationRunId = 0;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setValidity\n   *\n   * @description\n   * Change the validity state, and notify the form.\n   *\n   * This method can be called within $parsers/$formatters or a custom validation implementation.\n   * However, in most cases it should be sufficient to use the `ngModel.$validators` and\n   * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.\n   *\n   * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned\n   *        to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`\n   *        (for unfulfilled `$asyncValidators`), so that it is available for data-binding.\n   *        The `validationErrorKey` should be in camelCase and will get converted into dash-case\n   *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`\n   *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .\n   * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),\n   *                          or skipped (null). Pending is used for unfulfilled `$asyncValidators`.\n   *                          Skipped is used by Angular when validators do not run because of parse errors and\n   *                          when `$asyncValidators` do not run because any of the `$validators` failed.\n   */\n  addSetValidityMethod({\n    ctrl: this,\n    $element: $element,\n    set: function(object, property) {\n      object[property] = true;\n    },\n    unset: function(object, property) {\n      delete object[property];\n    },\n    $animate: $animate\n  });\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setPristine\n   *\n   * @description\n   * Sets the control to its pristine state.\n   *\n   * This method can be called to remove the `ng-dirty` class and set the control to its pristine\n   * state (`ng-pristine` class). A model is considered to be pristine when the control\n   * has not been changed from when first compiled.\n   */\n  this.$setPristine = function() {\n    ctrl.$dirty = false;\n    ctrl.$pristine = true;\n    $animate.removeClass($element, DIRTY_CLASS);\n    $animate.addClass($element, PRISTINE_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setDirty\n   *\n   * @description\n   * Sets the control to its dirty state.\n   *\n   * This method can be called to remove the `ng-pristine` class and set the control to its dirty\n   * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed\n   * from when first compiled.\n   */\n  this.$setDirty = function() {\n    ctrl.$dirty = true;\n    ctrl.$pristine = false;\n    $animate.removeClass($element, PRISTINE_CLASS);\n    $animate.addClass($element, DIRTY_CLASS);\n    ctrl.$$parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setUntouched\n   *\n   * @description\n   * Sets the control to its untouched state.\n   *\n   * This method can be called to remove the `ng-touched` class and set the control to its\n   * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched\n   * by default, however this function can be used to restore that state if the model has\n   * already been touched by the user.\n   */\n  this.$setUntouched = function() {\n    ctrl.$touched = false;\n    ctrl.$untouched = true;\n    $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setTouched\n   *\n   * @description\n   * Sets the control to its touched state.\n   *\n   * This method can be called to remove the `ng-untouched` class and set the control to its\n   * touched state (`ng-touched` class). A model is considered to be touched when the user has\n   * first focused the control element and then shifted focus away from the control (blur event).\n   */\n  this.$setTouched = function() {\n    ctrl.$touched = true;\n    ctrl.$untouched = false;\n    $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$rollbackViewValue\n   *\n   * @description\n   * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,\n   * which may be caused by a pending debounced event or because the input is waiting for a some\n   * future event.\n   *\n   * If you have an input that uses `ng-model-options` to set up debounced updates or updates that\n   * depend on special events such as blur, you can have a situation where there is a period when\n   * the `$viewValue` is out of sync with the ngModel's `$modelValue`.\n   *\n   * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update\n   * and reset the input to the last committed view value.\n   *\n   * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`\n   * programmatically before these debounced/future events have resolved/occurred, because Angular's\n   * dirty checking mechanism is not able to tell whether the model has actually changed or not.\n   *\n   * The `$rollbackViewValue()` method should be called before programmatically changing the model of an\n   * input which may have such events pending. This is important in order to make sure that the\n   * input field will be updated with the new model value and any pending operations are cancelled.\n   *\n   * <example name=\"ng-model-cancel-update\" module=\"cancel-update-example\">\n   *   <file name=\"app.js\">\n   *     angular.module('cancel-update-example', [])\n   *\n   *     .controller('CancelUpdateController', ['$scope', function($scope) {\n   *       $scope.model = {};\n   *\n   *       $scope.setEmpty = function(e, value, rollback) {\n   *         if (e.keyCode == 27) {\n   *           e.preventDefault();\n   *           if (rollback) {\n   *             $scope.myForm[value].$rollbackViewValue();\n   *           }\n   *           $scope.model[value] = '';\n   *         }\n   *       };\n   *     }]);\n   *   </file>\n   *   <file name=\"index.html\">\n   *     <div ng-controller=\"CancelUpdateController\">\n   *        <p>Both of these inputs are only updated if they are blurred. Hitting escape should\n   *        empty them. Follow these steps and observe the difference:</p>\n   *       <ol>\n   *         <li>Type something in the input. You will see that the model is not yet updated</li>\n   *         <li>Press the Escape key.\n   *           <ol>\n   *             <li> In the first example, nothing happens, because the model is already '', and no\n   *             update is detected. If you blur the input, the model will be set to the current view.\n   *             </li>\n   *             <li> In the second example, the pending update is cancelled, and the input is set back\n   *             to the last committed view value (''). Blurring the input does nothing.\n   *             </li>\n   *           </ol>\n   *         </li>\n   *       </ol>\n   *\n   *       <form name=\"myForm\" ng-model-options=\"{ updateOn: 'blur' }\">\n   *         <div>\n   *        <p id=\"inputDescription1\">Without $rollbackViewValue():</p>\n   *         <input name=\"value1\" aria-describedby=\"inputDescription1\" ng-model=\"model.value1\"\n   *                ng-keydown=\"setEmpty($event, 'value1')\">\n   *         value1: \"{{ model.value1 }}\"\n   *         </div>\n   *\n   *         <div>\n   *        <p id=\"inputDescription2\">With $rollbackViewValue():</p>\n   *         <input name=\"value2\" aria-describedby=\"inputDescription2\" ng-model=\"model.value2\"\n   *                ng-keydown=\"setEmpty($event, 'value2', true)\">\n   *         value2: \"{{ model.value2 }}\"\n   *         </div>\n   *       </form>\n   *     </div>\n   *   </file>\n       <file name=\"style.css\">\n          div {\n            display: table-cell;\n          }\n          div:nth-child(1) {\n            padding-right: 30px;\n          }\n\n        </file>\n   * </example>\n   */\n  this.$rollbackViewValue = function() {\n    $timeout.cancel(pendingDebounce);\n    ctrl.$viewValue = ctrl.$$lastCommittedViewValue;\n    ctrl.$render();\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$validate\n   *\n   * @description\n   * Runs each of the registered validators (first synchronous validators and then\n   * asynchronous validators).\n   * If the validity changes to invalid, the model will be set to `undefined`,\n   * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.\n   * If the validity changes to valid, it will set the model to the last available valid\n   * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.\n   */\n  this.$validate = function() {\n    // ignore $validate before model is initialized\n    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n      return;\n    }\n\n    var viewValue = ctrl.$$lastCommittedViewValue;\n    // Note: we use the $$rawModelValue as $modelValue might have been\n    // set to undefined during a view -> model update that found validation\n    // errors. We can't parse the view here, since that could change\n    // the model although neither viewValue nor the model on the scope changed\n    var modelValue = ctrl.$$rawModelValue;\n\n    var prevValid = ctrl.$valid;\n    var prevModelValue = ctrl.$modelValue;\n\n    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n\n    ctrl.$$runValidators(modelValue, viewValue, function(allValid) {\n      // If there was no change in validity, don't update the model\n      // This prevents changing an invalid modelValue to undefined\n      if (!allowInvalid && prevValid !== allValid) {\n        // Note: Don't check ctrl.$valid here, as we could have\n        // external validators (e.g. calculated on the server),\n        // that just call $setValidity and need the model value\n        // to calculate their validity.\n        ctrl.$modelValue = allValid ? modelValue : undefined;\n\n        if (ctrl.$modelValue !== prevModelValue) {\n          ctrl.$$writeModelToScope();\n        }\n      }\n    });\n\n  };\n\n  this.$$runValidators = function(modelValue, viewValue, doneCallback) {\n    currentValidationRunId++;\n    var localValidationRunId = currentValidationRunId;\n\n    // check parser error\n    if (!processParseErrors()) {\n      validationDone(false);\n      return;\n    }\n    if (!processSyncValidators()) {\n      validationDone(false);\n      return;\n    }\n    processAsyncValidators();\n\n    function processParseErrors() {\n      var errorKey = ctrl.$$parserName || 'parse';\n      if (isUndefined(parserValid)) {\n        setValidity(errorKey, null);\n      } else {\n        if (!parserValid) {\n          forEach(ctrl.$validators, function(v, name) {\n            setValidity(name, null);\n          });\n          forEach(ctrl.$asyncValidators, function(v, name) {\n            setValidity(name, null);\n          });\n        }\n        // Set the parse error last, to prevent unsetting it, should a $validators key == parserName\n        setValidity(errorKey, parserValid);\n        return parserValid;\n      }\n      return true;\n    }\n\n    function processSyncValidators() {\n      var syncValidatorsValid = true;\n      forEach(ctrl.$validators, function(validator, name) {\n        var result = validator(modelValue, viewValue);\n        syncValidatorsValid = syncValidatorsValid && result;\n        setValidity(name, result);\n      });\n      if (!syncValidatorsValid) {\n        forEach(ctrl.$asyncValidators, function(v, name) {\n          setValidity(name, null);\n        });\n        return false;\n      }\n      return true;\n    }\n\n    function processAsyncValidators() {\n      var validatorPromises = [];\n      var allValid = true;\n      forEach(ctrl.$asyncValidators, function(validator, name) {\n        var promise = validator(modelValue, viewValue);\n        if (!isPromiseLike(promise)) {\n          throw ngModelMinErr('nopromise',\n            \"Expected asynchronous validator to return a promise but got '{0}' instead.\", promise);\n        }\n        setValidity(name, undefined);\n        validatorPromises.push(promise.then(function() {\n          setValidity(name, true);\n        }, function() {\n          allValid = false;\n          setValidity(name, false);\n        }));\n      });\n      if (!validatorPromises.length) {\n        validationDone(true);\n      } else {\n        $q.all(validatorPromises).then(function() {\n          validationDone(allValid);\n        }, noop);\n      }\n    }\n\n    function setValidity(name, isValid) {\n      if (localValidationRunId === currentValidationRunId) {\n        ctrl.$setValidity(name, isValid);\n      }\n    }\n\n    function validationDone(allValid) {\n      if (localValidationRunId === currentValidationRunId) {\n\n        doneCallback(allValid);\n      }\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$commitViewValue\n   *\n   * @description\n   * Commit a pending update to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`\n   * usually handles calling this in response to input events.\n   */\n  this.$commitViewValue = function() {\n    var viewValue = ctrl.$viewValue;\n\n    $timeout.cancel(pendingDebounce);\n\n    // If the view value has not changed then we should just exit, except in the case where there is\n    // a native validator on the element. In this case the validation state may have changed even though\n    // the viewValue has stayed empty.\n    if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {\n      return;\n    }\n    ctrl.$$updateEmptyClasses(viewValue);\n    ctrl.$$lastCommittedViewValue = viewValue;\n\n    // change to dirty\n    if (ctrl.$pristine) {\n      this.$setDirty();\n    }\n    this.$$parseAndValidate();\n  };\n\n  this.$$parseAndValidate = function() {\n    var viewValue = ctrl.$$lastCommittedViewValue;\n    var modelValue = viewValue;\n    parserValid = isUndefined(modelValue) ? undefined : true;\n\n    if (parserValid) {\n      for (var i = 0; i < ctrl.$parsers.length; i++) {\n        modelValue = ctrl.$parsers[i](modelValue);\n        if (isUndefined(modelValue)) {\n          parserValid = false;\n          break;\n        }\n      }\n    }\n    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n      // ctrl.$modelValue has not been touched yet...\n      ctrl.$modelValue = ngModelGet($scope);\n    }\n    var prevModelValue = ctrl.$modelValue;\n    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n    ctrl.$$rawModelValue = modelValue;\n\n    if (allowInvalid) {\n      ctrl.$modelValue = modelValue;\n      writeToModelIfNeeded();\n    }\n\n    // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.\n    // This can happen if e.g. $setViewValue is called from inside a parser\n    ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {\n      if (!allowInvalid) {\n        // Note: Don't check ctrl.$valid here, as we could have\n        // external validators (e.g. calculated on the server),\n        // that just call $setValidity and need the model value\n        // to calculate their validity.\n        ctrl.$modelValue = allValid ? modelValue : undefined;\n        writeToModelIfNeeded();\n      }\n    });\n\n    function writeToModelIfNeeded() {\n      if (ctrl.$modelValue !== prevModelValue) {\n        ctrl.$$writeModelToScope();\n      }\n    }\n  };\n\n  this.$$writeModelToScope = function() {\n    ngModelSet($scope, ctrl.$modelValue);\n    forEach(ctrl.$viewChangeListeners, function(listener) {\n      try {\n        listener();\n      } catch (e) {\n        $exceptionHandler(e);\n      }\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setViewValue\n   *\n   * @description\n   * Update the view value.\n   *\n   * This method should be called when a control wants to change the view value; typically,\n   * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}\n   * directive calls it when the value of the input changes and {@link ng.directive:select select}\n   * calls it when an option is selected.\n   *\n   * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`\n   * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged\n   * value sent directly for processing, finally to be applied to `$modelValue` and then the\n   * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,\n   * in the `$viewChangeListeners` list, are called.\n   *\n   * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`\n   * and the `default` trigger is not listed, all those actions will remain pending until one of the\n   * `updateOn` events is triggered on the DOM element.\n   * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}\n   * directive is used with a custom debounce for this particular event.\n   * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`\n   * is specified, once the timer runs out.\n   *\n   * When used with standard inputs, the view value will always be a string (which is in some cases\n   * parsed into another type, such as a `Date` object for `input[date]`.)\n   * However, custom controls might also pass objects to this method. In this case, we should make\n   * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not\n   * perform a deep watch of objects, it only looks for a change of identity. If you only change\n   * the property of the object then ngModel will not realize that the object has changed and\n   * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should\n   * not change properties of the copy once it has been passed to `$setViewValue`.\n   * Otherwise you may cause the model value on the scope to change incorrectly.\n   *\n   * <div class=\"alert alert-info\">\n   * In any case, the value passed to the method should always reflect the current value\n   * of the control. For example, if you are calling `$setViewValue` for an input element,\n   * you should pass the input DOM value. Otherwise, the control and the scope model become\n   * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change\n   * the control's DOM value in any way. If we want to change the control's DOM value\n   * programmatically, we should update the `ngModel` scope expression. Its new value will be\n   * picked up by the model controller, which will run it through the `$formatters`, `$render` it\n   * to update the DOM, and finally call `$validate` on it.\n   * </div>\n   *\n   * @param {*} value value from the view.\n   * @param {string} trigger Event that triggered the update.\n   */\n  this.$setViewValue = function(value, trigger) {\n    ctrl.$viewValue = value;\n    if (!ctrl.$options || ctrl.$options.updateOnDefault) {\n      ctrl.$$debounceViewValueCommit(trigger);\n    }\n  };\n\n  this.$$debounceViewValueCommit = function(trigger) {\n    var debounceDelay = 0,\n        options = ctrl.$options,\n        debounce;\n\n    if (options && isDefined(options.debounce)) {\n      debounce = options.debounce;\n      if (isNumber(debounce)) {\n        debounceDelay = debounce;\n      } else if (isNumber(debounce[trigger])) {\n        debounceDelay = debounce[trigger];\n      } else if (isNumber(debounce['default'])) {\n        debounceDelay = debounce['default'];\n      }\n    }\n\n    $timeout.cancel(pendingDebounce);\n    if (debounceDelay) {\n      pendingDebounce = $timeout(function() {\n        ctrl.$commitViewValue();\n      }, debounceDelay);\n    } else if ($rootScope.$$phase) {\n      ctrl.$commitViewValue();\n    } else {\n      $scope.$apply(function() {\n        ctrl.$commitViewValue();\n      });\n    }\n  };\n\n  // model -> value\n  // Note: we cannot use a normal scope.$watch as we want to detect the following:\n  // 1. scope value is 'a'\n  // 2. user enters 'b'\n  // 3. ng-change kicks in and reverts scope value to 'a'\n  //    -> scope value did not change since the last digest as\n  //       ng-change executes in apply phase\n  // 4. view should be changed back to 'a'\n  $scope.$watch(function ngModelWatch() {\n    var modelValue = ngModelGet($scope);\n\n    // if scope model value and ngModel value are out of sync\n    // TODO(perf): why not move this to the action fn?\n    if (modelValue !== ctrl.$modelValue &&\n       // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator\n       (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)\n    ) {\n      ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;\n      parserValid = undefined;\n\n      var formatters = ctrl.$formatters,\n          idx = formatters.length;\n\n      var viewValue = modelValue;\n      while (idx--) {\n        viewValue = formatters[idx](viewValue);\n      }\n      if (ctrl.$viewValue !== viewValue) {\n        ctrl.$$updateEmptyClasses(viewValue);\n        ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;\n        ctrl.$render();\n\n        ctrl.$$runValidators(modelValue, viewValue, noop);\n      }\n    }\n\n    return modelValue;\n  });\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngModel\n *\n * @element input\n * @priority 1\n *\n * @description\n * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a\n * property on the scope using {@link ngModel.NgModelController NgModelController},\n * which is created and exposed by this directive.\n *\n * `ngModel` is responsible for:\n *\n * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`\n *   require.\n * - Providing validation behavior (i.e. required, number, email, url).\n * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).\n * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,\n *   `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.\n * - Registering the control with its parent {@link ng.directive:form form}.\n *\n * Note: `ngModel` will try to bind to the property given by evaluating the expression on the\n * current scope. If the property doesn't already exist on this scope, it will be created\n * implicitly and added to the scope.\n *\n * For best practices on using `ngModel`, see:\n *\n *  - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)\n *\n * For basic examples, how to use `ngModel`, see:\n *\n *  - {@link ng.directive:input input}\n *    - {@link input[text] text}\n *    - {@link input[checkbox] checkbox}\n *    - {@link input[radio] radio}\n *    - {@link input[number] number}\n *    - {@link input[email] email}\n *    - {@link input[url] url}\n *    - {@link input[date] date}\n *    - {@link input[datetime-local] datetime-local}\n *    - {@link input[time] time}\n *    - {@link input[month] month}\n *    - {@link input[week] week}\n *  - {@link ng.directive:select select}\n *  - {@link ng.directive:textarea textarea}\n *\n * # Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the\n * object or collection change, `ngModel` will not be notified and so the input will not be  re-rendered.\n *\n * The model must be assigned an entirely new object or collection before a re-rendering will occur.\n *\n * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression\n * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or\n * if the select is given the `multiple` attribute.\n *\n * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the\n * first level of the object (or only changing the properties of an item in the collection if it's an array) will still\n * not trigger a re-rendering of the model.\n *\n * # CSS classes\n * The following CSS classes are added and removed on the associated input/select/textarea element\n * depending on the validity of the model.\n *\n *  - `ng-valid`: the model is valid\n *  - `ng-invalid`: the model is invalid\n *  - `ng-valid-[key]`: for each valid key added by `$setValidity`\n *  - `ng-invalid-[key]`: for each invalid key added by `$setValidity`\n *  - `ng-pristine`: the control hasn't been interacted with yet\n *  - `ng-dirty`: the control has been interacted with\n *  - `ng-touched`: the control has been blurred\n *  - `ng-untouched`: the control hasn't been blurred\n *  - `ng-pending`: any `$asyncValidators` are unfulfilled\n *  - `ng-empty`: the view does not contain a value or the value is deemed \"empty\", as defined\n *     by the {@link ngModel.NgModelController#$isEmpty} method\n *  - `ng-not-empty`: the view contains a non-empty value\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n * ## Animation Hooks\n *\n * Animations within models are triggered when any of the associated CSS classes are added and removed\n * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,\n * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.\n * The animations that are triggered within ngModel are similar to how they work in ngClass and\n * animations can be hooked into using CSS transitions, keyframes as well as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style an input element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-input {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-input.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n * <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"inputExample\">\n     <file name=\"index.html\">\n       <script>\n        angular.module('inputExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.val = '1';\n          }]);\n       </script>\n       <style>\n         .my-input {\n           transition:all linear 0.5s;\n           background: transparent;\n         }\n         .my-input.ng-invalid {\n           color:white;\n           background: red;\n         }\n       </style>\n       <p id=\"inputDescription\">\n        Update input to see transitions when valid/invalid.\n        Integer is a valid value.\n       </p>\n       <form name=\"testForm\" ng-controller=\"ExampleController\">\n         <input ng-model=\"val\" ng-pattern=\"/^\\d+$/\" name=\"anim\" class=\"my-input\"\n                aria-describedby=\"inputDescription\" />\n       </form>\n     </file>\n * </example>\n *\n * ## Binding to a getter/setter\n *\n * Sometimes it's helpful to bind `ngModel` to a getter/setter function.  A getter/setter is a\n * function that returns a representation of the model when called with zero arguments, and sets\n * the internal state of a model when called with an argument. It's sometimes useful to use this\n * for models that have an internal representation that's different from what the model exposes\n * to the view.\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more\n * frequently than other parts of your code.\n * </div>\n *\n * You use this behavior by adding `ng-model-options=\"{ getterSetter: true }\"` to an element that\n * has `ng-model` attached to it. You can also add `ng-model-options=\"{ getterSetter: true }\"` to\n * a `<form>`, which will enable this behavior for all `<input>`s within it. See\n * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.\n *\n * The following example shows how to use `ngModel` with a getter/setter:\n *\n * @example\n * <example name=\"ngModel-getter-setter\" module=\"getterSetterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <form name=\"userForm\">\n           <label>Name:\n             <input type=\"text\" name=\"userName\"\n                    ng-model=\"user.name\"\n                    ng-model-options=\"{ getterSetter: true }\" />\n           </label>\n         </form>\n         <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n       </div>\n     </file>\n     <file name=\"app.js\">\n       angular.module('getterSetterExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           var _name = 'Brian';\n           $scope.user = {\n             name: function(newName) {\n              // Note that newName can be undefined for two reasons:\n              // 1. Because it is called as a getter and thus called with no arguments\n              // 2. Because the property should actually be set to undefined. This happens e.g. if the\n              //    input is invalid\n              return arguments.length ? (_name = newName) : _name;\n             }\n           };\n         }]);\n     </file>\n * </example>\n */\nvar ngModelDirective = ['$rootScope', function($rootScope) {\n  return {\n    restrict: 'A',\n    require: ['ngModel', '^?form', '^?ngModelOptions'],\n    controller: NgModelController,\n    // Prelink needs to run before any input directive\n    // so that we can set the NgModelOptions in NgModelController\n    // before anyone else uses it.\n    priority: 1,\n    compile: function ngModelCompile(element) {\n      // Setup initial state of the control\n      element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);\n\n      return {\n        pre: function ngModelPreLink(scope, element, attr, ctrls) {\n          var modelCtrl = ctrls[0],\n              formCtrl = ctrls[1] || modelCtrl.$$parentForm;\n\n          modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);\n\n          // notify others, especially parent forms\n          formCtrl.$addControl(modelCtrl);\n\n          attr.$observe('name', function(newValue) {\n            if (modelCtrl.$name !== newValue) {\n              modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);\n            }\n          });\n\n          scope.$on('$destroy', function() {\n            modelCtrl.$$parentForm.$removeControl(modelCtrl);\n          });\n        },\n        post: function ngModelPostLink(scope, element, attr, ctrls) {\n          var modelCtrl = ctrls[0];\n          if (modelCtrl.$options && modelCtrl.$options.updateOn) {\n            element.on(modelCtrl.$options.updateOn, function(ev) {\n              modelCtrl.$$debounceViewValueCommit(ev && ev.type);\n            });\n          }\n\n          element.on('blur', function() {\n            if (modelCtrl.$touched) return;\n\n            if ($rootScope.$$phase) {\n              scope.$evalAsync(modelCtrl.$setTouched);\n            } else {\n              scope.$apply(modelCtrl.$setTouched);\n            }\n          });\n        }\n      };\n    }\n  };\n}];\n\nvar DEFAULT_REGEXP = /(\\s+|^)default(\\s+|$)/;\n\n/**\n * @ngdoc directive\n * @name ngModelOptions\n *\n * @description\n * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of\n * events that will trigger a model update and/or a debouncing delay so that the actual update only\n * takes place when a timer expires; this timer will be reset after another change takes place.\n *\n * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might\n * be different from the value in the actual model. This means that if you update the model you\n * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in\n * order to make sure it is synchronized with the model and that any debounced action is canceled.\n *\n * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}\n * method is by making sure the input is placed inside a form that has a `name` attribute. This is\n * important because `form` controllers are published to the related scope under the name in their\n * `name` attribute.\n *\n * Any pending changes will take place immediately when an enclosing form is submitted via the\n * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * `ngModelOptions` has an effect on the element it's declared on and its descendants.\n *\n * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:\n *   - `updateOn`: string specifying which event should the input be bound to. You can set several\n *     events using an space delimited list. There is a special event called `default` that\n *     matches the default events belonging of the control.\n *   - `debounce`: integer value which contains the debounce model update value in milliseconds. A\n *     value of 0 triggers an immediate update. If an object is supplied instead, you can specify a\n *     custom value for each event. For example:\n *     `ng-model-options=\"{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }\"`\n *   - `allowInvalid`: boolean value which indicates that the model can be set with values that did\n *     not validate correctly instead of the default behavior of setting the model to undefined.\n *   - `getterSetter`: boolean value which determines whether or not to treat functions bound to\n       `ngModel` as getters/setters.\n *   - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for\n *     `<input type=\"date\">`, `<input type=\"time\">`, ... . It understands UTC/GMT and the\n *     continental US time zone abbreviations, but for general use, use a time zone offset, for\n *     example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n *     If not specified, the timezone of the browser will be used.\n *\n * @example\n\n  The following example shows how to override immediate updates. Changes on the inputs within the\n  form will update the model only when the control loses focus (blur event). If `escape` key is\n  pressed while the input field is focused, the value is reset to the value in the current model.\n\n  <example name=\"ngModelOptions-directive-blur\" module=\"optionsExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ updateOn: 'blur' }\"\n                   ng-keyup=\"cancel($event)\" />\n          </label><br />\n          <label>Other data:\n            <input type=\"text\" ng-model=\"user.data\" />\n          </label><br />\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n        <pre>user.data = <span ng-bind=\"user.data\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('optionsExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.user = { name: 'John', data: '' };\n\n          $scope.cancel = function(e) {\n            if (e.keyCode == 27) {\n              $scope.userForm.userName.$rollbackViewValue();\n            }\n          };\n        }]);\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var model = element(by.binding('user.name'));\n      var input = element(by.model('user.name'));\n      var other = element(by.model('user.data'));\n\n      it('should allow custom events', function() {\n        input.sendKeys(' Doe');\n        input.click();\n        expect(model.getText()).toEqual('John');\n        other.click();\n        expect(model.getText()).toEqual('John Doe');\n      });\n\n      it('should $rollbackViewValue when model changes', function() {\n        input.sendKeys(' Doe');\n        expect(input.getAttribute('value')).toEqual('John Doe');\n        input.sendKeys(protractor.Key.ESCAPE);\n        expect(input.getAttribute('value')).toEqual('John');\n        other.click();\n        expect(model.getText()).toEqual('John');\n      });\n    </file>\n  </example>\n\n  This one shows how to debounce model changes. Model will be updated only 1 sec after last change.\n  If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.\n\n  <example name=\"ngModelOptions-directive-debounce\" module=\"optionsExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ debounce: 1000 }\" />\n          </label>\n          <button ng-click=\"userForm.userName.$rollbackViewValue(); user.name=''\">Clear</button>\n          <br />\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('optionsExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.user = { name: 'Igor' };\n        }]);\n    </file>\n  </example>\n\n  This one shows how to bind to getter/setters:\n\n  <example name=\"ngModelOptions-directive-getter-setter\" module=\"getterSetterExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ getterSetter: true }\" />\n          </label>\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('getterSetterExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          var _name = 'Brian';\n          $scope.user = {\n            name: function(newName) {\n              // Note that newName can be undefined for two reasons:\n              // 1. Because it is called as a getter and thus called with no arguments\n              // 2. Because the property should actually be set to undefined. This happens e.g. if the\n              //    input is invalid\n              return arguments.length ? (_name = newName) : _name;\n            }\n          };\n        }]);\n    </file>\n  </example>\n */\nvar ngModelOptionsDirective = function() {\n  return {\n    restrict: 'A',\n    controller: ['$scope', '$attrs', function($scope, $attrs) {\n      var that = this;\n      this.$options = copy($scope.$eval($attrs.ngModelOptions));\n      // Allow adding/overriding bound events\n      if (isDefined(this.$options.updateOn)) {\n        this.$options.updateOnDefault = false;\n        // extract \"default\" pseudo-event from list of events that can trigger a model update\n        this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {\n          that.$options.updateOnDefault = true;\n          return ' ';\n        }));\n      } else {\n        this.$options.updateOnDefault = true;\n      }\n    }]\n  };\n};\n\n\n\n// helper methods\nfunction addSetValidityMethod(context) {\n  var ctrl = context.ctrl,\n      $element = context.$element,\n      classCache = {},\n      set = context.set,\n      unset = context.unset,\n      $animate = context.$animate;\n\n  classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));\n\n  ctrl.$setValidity = setValidity;\n\n  function setValidity(validationErrorKey, state, controller) {\n    if (isUndefined(state)) {\n      createAndSet('$pending', validationErrorKey, controller);\n    } else {\n      unsetAndCleanup('$pending', validationErrorKey, controller);\n    }\n    if (!isBoolean(state)) {\n      unset(ctrl.$error, validationErrorKey, controller);\n      unset(ctrl.$$success, validationErrorKey, controller);\n    } else {\n      if (state) {\n        unset(ctrl.$error, validationErrorKey, controller);\n        set(ctrl.$$success, validationErrorKey, controller);\n      } else {\n        set(ctrl.$error, validationErrorKey, controller);\n        unset(ctrl.$$success, validationErrorKey, controller);\n      }\n    }\n    if (ctrl.$pending) {\n      cachedToggleClass(PENDING_CLASS, true);\n      ctrl.$valid = ctrl.$invalid = undefined;\n      toggleValidationCss('', null);\n    } else {\n      cachedToggleClass(PENDING_CLASS, false);\n      ctrl.$valid = isObjectEmpty(ctrl.$error);\n      ctrl.$invalid = !ctrl.$valid;\n      toggleValidationCss('', ctrl.$valid);\n    }\n\n    // re-read the state as the set/unset methods could have\n    // combined state in ctrl.$error[validationError] (used for forms),\n    // where setting/unsetting only increments/decrements the value,\n    // and does not replace it.\n    var combinedState;\n    if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {\n      combinedState = undefined;\n    } else if (ctrl.$error[validationErrorKey]) {\n      combinedState = false;\n    } else if (ctrl.$$success[validationErrorKey]) {\n      combinedState = true;\n    } else {\n      combinedState = null;\n    }\n\n    toggleValidationCss(validationErrorKey, combinedState);\n    ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);\n  }\n\n  function createAndSet(name, value, controller) {\n    if (!ctrl[name]) {\n      ctrl[name] = {};\n    }\n    set(ctrl[name], value, controller);\n  }\n\n  function unsetAndCleanup(name, value, controller) {\n    if (ctrl[name]) {\n      unset(ctrl[name], value, controller);\n    }\n    if (isObjectEmpty(ctrl[name])) {\n      ctrl[name] = undefined;\n    }\n  }\n\n  function cachedToggleClass(className, switchValue) {\n    if (switchValue && !classCache[className]) {\n      $animate.addClass($element, className);\n      classCache[className] = true;\n    } else if (!switchValue && classCache[className]) {\n      $animate.removeClass($element, className);\n      classCache[className] = false;\n    }\n  }\n\n  function toggleValidationCss(validationErrorKey, isValid) {\n    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n\n    cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);\n    cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);\n  }\n}\n\nfunction isObjectEmpty(obj) {\n  if (obj) {\n    for (var prop in obj) {\n      if (obj.hasOwnProperty(prop)) {\n        return false;\n      }\n    }\n  }\n  return true;\n}\n\n/**\n * @ngdoc directive\n * @name ngNonBindable\n * @restrict AC\n * @priority 1000\n *\n * @description\n * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current\n * DOM element. This is useful if the element contains what appears to be Angular directives and\n * bindings but which should be ignored by Angular. This could be the case if you have a site that\n * displays snippets of code, for instance.\n *\n * @element ANY\n *\n * @example\n * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,\n * but the one wrapped in `ngNonBindable` is left alone.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <div>Normal: {{1 + 2}}</div>\n        <div ng-non-bindable>Ignored: {{1 + 2}}</div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-non-bindable', function() {\n         expect(element(by.binding('1 + 2')).getText()).toContain('3');\n         expect(element.all(by.css('div')).last().getText()).toMatch(/1 \\+ 2/);\n       });\n      </file>\n    </example>\n */\nvar ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });\n\n/* global jqLiteRemove */\n\nvar ngOptionsMinErr = minErr('ngOptions');\n\n/**\n * @ngdoc directive\n * @name ngOptions\n * @restrict A\n *\n * @description\n *\n * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`\n * elements for the `<select>` element using the array or object obtained by evaluating the\n * `ngOptions` comprehension expression.\n *\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a\n * similar result. However, `ngOptions` provides some benefits such as reducing memory and\n * increasing speed by not creating a new scope for each repeated instance, as well as providing\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound\n *  to a non-string value. This is because an option element can only be bound to string values at\n * present.\n *\n * When an item in the `<select>` menu is selected, the array element or object property\n * represented by the selected option will be bound to the model identified by the `ngModel`\n * directive.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * ## Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding the select to a model that is an object or a collection.\n *\n * One issue occurs if you want to preselect an option. For example, if you set\n * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,\n * because the objects are not identical. So by default, you should always reference the item in your collection\n * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.\n *\n * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity\n * of the item not by reference, but by the result of the `track by` expression. For example, if your\n * collection items have an id property, you would `track by item.id`.\n *\n * A different issue with objects or collections is that ngModel won't detect if an object property or\n * a collection item changes. For that reason, `ngOptions` additionally watches the model using\n * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.\n * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection\n * has not changed identity, but only a property on the object or an item in the collection changes.\n *\n * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection\n * if the model is an array). This means that changing a property deeper than the first level inside the\n * object/collection will not trigger a re-rendering.\n *\n * ## `select` **`as`**\n *\n * Using `select` **`as`** will bind the result of the `select` expression to the model, but\n * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)\n * or property name (for object data sources) of the value within the collection. If a **`track by`** expression\n * is used, the result of that expression will be set as the value of the `option` and `select` elements.\n *\n *\n * ### `select` **`as`** and **`track by`**\n *\n * <div class=\"alert alert-warning\">\n * Be careful when using `select` **`as`** and **`track by`** in the same expression.\n * </div>\n *\n * Given this array of items on the $scope:\n *\n * ```js\n * $scope.items = [{\n *   id: 1,\n *   label: 'aLabel',\n *   subItem: { name: 'aSubItem' }\n * }, {\n *   id: 2,\n *   label: 'bLabel',\n *   subItem: { name: 'bSubItem' }\n * }];\n * ```\n *\n * This will work:\n *\n * ```html\n * <select ng-options=\"item as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0];\n * ```\n *\n * but this will not work:\n *\n * ```html\n * <select ng-options=\"item.subItem as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0].subItem;\n * ```\n *\n * In both examples, the **`track by`** expression is applied successfully to each `item` in the\n * `items` array. Because the selected option has been set programmatically in the controller, the\n * **`track by`** expression is also applied to the `ngModel` value. In the first example, the\n * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with\n * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**\n * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value\n * is not matched against any `<option>` and the `<select>` appears as having no selected value.\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required The control is considered valid only if value is entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {comprehension_expression=} ngOptions in one of the following forms:\n *\n *   * for array data sources:\n *     * `label` **`for`** `value` **`in`** `array`\n *     * `select` **`as`** `label` **`for`** `value` **`in`** `array`\n *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array`\n *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`\n *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *     * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`\n *        (for including a filter with `track by`)\n *   * for object data sources:\n *     * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`group by`** `group`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`disable when`** `disable`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *\n * Where:\n *\n *   * `array` / `object`: an expression which evaluates to an array / object to iterate over.\n *   * `value`: local variable which will refer to each item in the `array` or each property value\n *      of `object` during iteration.\n *   * `key`: local variable which will refer to a property name in `object` during iteration.\n *   * `label`: The result of this expression will be the label for `<option>` element. The\n *     `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).\n *   * `select`: The result of this expression will be bound to the model of the parent `<select>`\n *      element. If not specified, `select` expression will default to `value`.\n *   * `group`: The result of this expression will be used to group options using the `<optgroup>`\n *      DOM element.\n *   * `disable`: The result of this expression will be used to disable the rendered `<option>`\n *      element. Return `true` to disable.\n *   * `trackexpr`: Used when working with an array of objects. The result of this expression will be\n *      used to identify the objects in the array. The `trackexpr` will most likely refer to the\n *     `value` variable (e.g. `value.propertyName`). With this the selection is preserved\n *      even when the options are recreated (e.g. reloaded from the server).\n *\n * @example\n    <example module=\"selectExample\">\n      <file name=\"index.html\">\n        <script>\n        angular.module('selectExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.colors = [\n              {name:'black', shade:'dark'},\n              {name:'white', shade:'light', notAnOption: true},\n              {name:'red', shade:'dark'},\n              {name:'blue', shade:'dark', notAnOption: true},\n              {name:'yellow', shade:'light', notAnOption: false}\n            ];\n            $scope.myColor = $scope.colors[2]; // red\n          }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          <ul>\n            <li ng-repeat=\"color in colors\">\n              <label>Name: <input ng-model=\"color.name\"></label>\n              <label><input type=\"checkbox\" ng-model=\"color.notAnOption\"> Disabled?</label>\n              <button ng-click=\"colors.splice($index, 1)\" aria-label=\"Remove\">X</button>\n            </li>\n            <li>\n              <button ng-click=\"colors.push({})\">add</button>\n            </li>\n          </ul>\n          <hr/>\n          <label>Color (null not allowed):\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\"></select>\n          </label><br/>\n          <label>Color (null allowed):\n          <span  class=\"nullable\">\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\">\n              <option value=\"\">-- choose color --</option>\n            </select>\n          </span></label><br/>\n\n          <label>Color grouped by shade:\n            <select ng-model=\"myColor\" ng-options=\"color.name group by color.shade for color in colors\">\n            </select>\n          </label><br/>\n\n          <label>Color grouped by shade, with some disabled:\n            <select ng-model=\"myColor\"\n                  ng-options=\"color.name group by color.shade disable when color.notAnOption for color in colors\">\n            </select>\n          </label><br/>\n\n\n\n          Select <button ng-click=\"myColor = { name:'not in list', shade: 'other' }\">bogus</button>.\n          <br/>\n          <hr/>\n          Currently selected: {{ {selected_color:myColor} }}\n          <div style=\"border:solid 1px black; height:20px\"\n               ng-style=\"{'background-color':myColor.name}\">\n          </div>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n         it('should check ng-options', function() {\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');\n           element.all(by.model('myColor')).first().click();\n           element.all(by.css('select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');\n           element(by.css('.nullable select[ng-model=\"myColor\"]')).click();\n           element.all(by.css('.nullable select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');\n         });\n      </file>\n    </example>\n */\n\n// jshint maxlen: false\n//                     //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999\nvar NG_OPTIONS_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+group\\s+by\\s+([\\s\\S]+?))?(?:\\s+disable\\s+when\\s+([\\s\\S]+?))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?$/;\n                        // 1: value expression (valueFn)\n                        // 2: label expression (displayFn)\n                        // 3: group by expression (groupByFn)\n                        // 4: disable when expression (disableWhenFn)\n                        // 5: array item variable name\n                        // 6: object item key variable name\n                        // 7: object item value variable name\n                        // 8: collection expression\n                        // 9: track by expression\n// jshint maxlen: 100\n\n\nvar ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {\n\n  function parseOptionsExpression(optionsExp, selectElement, scope) {\n\n    var match = optionsExp.match(NG_OPTIONS_REGEXP);\n    if (!(match)) {\n      throw ngOptionsMinErr('iexp',\n        \"Expected expression in form of \" +\n        \"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'\" +\n        \" but got '{0}'. Element: {1}\",\n        optionsExp, startingTag(selectElement));\n    }\n\n    // Extract the parts from the ngOptions expression\n\n    // The variable name for the value of the item in the collection\n    var valueName = match[5] || match[7];\n    // The variable name for the key of the item in the collection\n    var keyName = match[6];\n\n    // An expression that generates the viewValue for an option if there is a label expression\n    var selectAs = / as /.test(match[0]) && match[1];\n    // An expression that is used to track the id of each object in the options collection\n    var trackBy = match[9];\n    // An expression that generates the viewValue for an option if there is no label expression\n    var valueFn = $parse(match[2] ? match[1] : valueName);\n    var selectAsFn = selectAs && $parse(selectAs);\n    var viewValueFn = selectAsFn || valueFn;\n    var trackByFn = trackBy && $parse(trackBy);\n\n    // Get the value by which we are going to track the option\n    // if we have a trackFn then use that (passing scope and locals)\n    // otherwise just hash the given viewValue\n    var getTrackByValueFn = trackBy ?\n                              function(value, locals) { return trackByFn(scope, locals); } :\n                              function getHashOfValue(value) { return hashKey(value); };\n    var getTrackByValue = function(value, key) {\n      return getTrackByValueFn(value, getLocals(value, key));\n    };\n\n    var displayFn = $parse(match[2] || match[1]);\n    var groupByFn = $parse(match[3] || '');\n    var disableWhenFn = $parse(match[4] || '');\n    var valuesFn = $parse(match[8]);\n\n    var locals = {};\n    var getLocals = keyName ? function(value, key) {\n      locals[keyName] = key;\n      locals[valueName] = value;\n      return locals;\n    } : function(value) {\n      locals[valueName] = value;\n      return locals;\n    };\n\n\n    function Option(selectValue, viewValue, label, group, disabled) {\n      this.selectValue = selectValue;\n      this.viewValue = viewValue;\n      this.label = label;\n      this.group = group;\n      this.disabled = disabled;\n    }\n\n    function getOptionValuesKeys(optionValues) {\n      var optionValuesKeys;\n\n      if (!keyName && isArrayLike(optionValues)) {\n        optionValuesKeys = optionValues;\n      } else {\n        // if object, extract keys, in enumeration order, unsorted\n        optionValuesKeys = [];\n        for (var itemKey in optionValues) {\n          if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {\n            optionValuesKeys.push(itemKey);\n          }\n        }\n      }\n      return optionValuesKeys;\n    }\n\n    return {\n      trackBy: trackBy,\n      getTrackByValue: getTrackByValue,\n      getWatchables: $parse(valuesFn, function(optionValues) {\n        // Create a collection of things that we would like to watch (watchedArray)\n        // so that they can all be watched using a single $watchCollection\n        // that only runs the handler once if anything changes\n        var watchedArray = [];\n        optionValues = optionValues || [];\n\n        var optionValuesKeys = getOptionValuesKeys(optionValues);\n        var optionValuesLength = optionValuesKeys.length;\n        for (var index = 0; index < optionValuesLength; index++) {\n          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n          var value = optionValues[key];\n\n          var locals = getLocals(value, key);\n          var selectValue = getTrackByValueFn(value, locals);\n          watchedArray.push(selectValue);\n\n          // Only need to watch the displayFn if there is a specific label expression\n          if (match[2] || match[1]) {\n            var label = displayFn(scope, locals);\n            watchedArray.push(label);\n          }\n\n          // Only need to watch the disableWhenFn if there is a specific disable expression\n          if (match[4]) {\n            var disableWhen = disableWhenFn(scope, locals);\n            watchedArray.push(disableWhen);\n          }\n        }\n        return watchedArray;\n      }),\n\n      getOptions: function() {\n\n        var optionItems = [];\n        var selectValueMap = {};\n\n        // The option values were already computed in the `getWatchables` fn,\n        // which must have been called to trigger `getOptions`\n        var optionValues = valuesFn(scope) || [];\n        var optionValuesKeys = getOptionValuesKeys(optionValues);\n        var optionValuesLength = optionValuesKeys.length;\n\n        for (var index = 0; index < optionValuesLength; index++) {\n          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n          var value = optionValues[key];\n          var locals = getLocals(value, key);\n          var viewValue = viewValueFn(scope, locals);\n          var selectValue = getTrackByValueFn(viewValue, locals);\n          var label = displayFn(scope, locals);\n          var group = groupByFn(scope, locals);\n          var disabled = disableWhenFn(scope, locals);\n          var optionItem = new Option(selectValue, viewValue, label, group, disabled);\n\n          optionItems.push(optionItem);\n          selectValueMap[selectValue] = optionItem;\n        }\n\n        return {\n          items: optionItems,\n          selectValueMap: selectValueMap,\n          getOptionFromViewValue: function(value) {\n            return selectValueMap[getTrackByValue(value)];\n          },\n          getViewValueFromOption: function(option) {\n            // If the viewValue could be an object that may be mutated by the application,\n            // we need to make a copy and not return the reference to the value on the option.\n            return trackBy ? angular.copy(option.viewValue) : option.viewValue;\n          }\n        };\n      }\n    };\n  }\n\n\n  // we can't just jqLite('<option>') since jqLite is not smart enough\n  // to create it in <select> and IE barfs otherwise.\n  var optionTemplate = document.createElement('option'),\n      optGroupTemplate = document.createElement('optgroup');\n\n    function ngOptionsPostLink(scope, selectElement, attr, ctrls) {\n\n      var selectCtrl = ctrls[0];\n      var ngModelCtrl = ctrls[1];\n      var multiple = attr.multiple;\n\n      // The emptyOption allows the application developer to provide their own custom \"empty\"\n      // option when the viewValue does not match any of the option values.\n      var emptyOption;\n      for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {\n        if (children[i].value === '') {\n          emptyOption = children.eq(i);\n          break;\n        }\n      }\n\n      var providedEmptyOption = !!emptyOption;\n\n      var unknownOption = jqLite(optionTemplate.cloneNode(false));\n      unknownOption.val('?');\n\n      var options;\n      var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);\n\n\n      var renderEmptyOption = function() {\n        if (!providedEmptyOption) {\n          selectElement.prepend(emptyOption);\n        }\n        selectElement.val('');\n        emptyOption.prop('selected', true); // needed for IE\n        emptyOption.attr('selected', true);\n      };\n\n      var removeEmptyOption = function() {\n        if (!providedEmptyOption) {\n          emptyOption.remove();\n        }\n      };\n\n\n      var renderUnknownOption = function() {\n        selectElement.prepend(unknownOption);\n        selectElement.val('?');\n        unknownOption.prop('selected', true); // needed for IE\n        unknownOption.attr('selected', true);\n      };\n\n      var removeUnknownOption = function() {\n        unknownOption.remove();\n      };\n\n      // Update the controller methods for multiple selectable options\n      if (!multiple) {\n\n        selectCtrl.writeValue = function writeNgOptionsValue(value) {\n          var option = options.getOptionFromViewValue(value);\n\n          if (option && !option.disabled) {\n            // Don't update the option when it is already selected.\n            // For example, the browser will select the first option by default. In that case,\n            // most properties are set automatically - except the `selected` attribute, which we\n            // set always\n\n            if (selectElement[0].value !== option.selectValue) {\n              removeUnknownOption();\n              removeEmptyOption();\n\n              selectElement[0].value = option.selectValue;\n              option.element.selected = true;\n            }\n\n            option.element.setAttribute('selected', 'selected');\n          } else {\n            if (value === null || providedEmptyOption) {\n              removeUnknownOption();\n              renderEmptyOption();\n            } else {\n              removeEmptyOption();\n              renderUnknownOption();\n            }\n          }\n        };\n\n        selectCtrl.readValue = function readNgOptionsValue() {\n\n          var selectedOption = options.selectValueMap[selectElement.val()];\n\n          if (selectedOption && !selectedOption.disabled) {\n            removeEmptyOption();\n            removeUnknownOption();\n            return options.getViewValueFromOption(selectedOption);\n          }\n          return null;\n        };\n\n        // If we are using `track by` then we must watch the tracked value on the model\n        // since ngModel only watches for object identity change\n        if (ngOptions.trackBy) {\n          scope.$watch(\n            function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },\n            function() { ngModelCtrl.$render(); }\n          );\n        }\n\n      } else {\n\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n\n\n        selectCtrl.writeValue = function writeNgOptionsMultiple(value) {\n          options.items.forEach(function(option) {\n            option.element.selected = false;\n          });\n\n          if (value) {\n            value.forEach(function(item) {\n              var option = options.getOptionFromViewValue(item);\n              if (option && !option.disabled) option.element.selected = true;\n            });\n          }\n        };\n\n\n        selectCtrl.readValue = function readNgOptionsMultiple() {\n          var selectedValues = selectElement.val() || [],\n              selections = [];\n\n          forEach(selectedValues, function(value) {\n            var option = options.selectValueMap[value];\n            if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));\n          });\n\n          return selections;\n        };\n\n        // If we are using `track by` then we must watch these tracked values on the model\n        // since ngModel only watches for object identity change\n        if (ngOptions.trackBy) {\n\n          scope.$watchCollection(function() {\n            if (isArray(ngModelCtrl.$viewValue)) {\n              return ngModelCtrl.$viewValue.map(function(value) {\n                return ngOptions.getTrackByValue(value);\n              });\n            }\n          }, function() {\n            ngModelCtrl.$render();\n          });\n\n        }\n      }\n\n\n      if (providedEmptyOption) {\n\n        // we need to remove it before calling selectElement.empty() because otherwise IE will\n        // remove the label from the element. wtf?\n        emptyOption.remove();\n\n        // compile the element since there might be bindings in it\n        $compile(emptyOption)(scope);\n\n        // remove the class, which is added automatically because we recompile the element and it\n        // becomes the compilation root\n        emptyOption.removeClass('ng-scope');\n      } else {\n        emptyOption = jqLite(optionTemplate.cloneNode(false));\n      }\n\n      // We need to do this here to ensure that the options object is defined\n      // when we first hit it in writeNgOptionsValue\n      updateOptions();\n\n      // We will re-render the option elements if the option values or labels change\n      scope.$watchCollection(ngOptions.getWatchables, updateOptions);\n\n      // ------------------------------------------------------------------ //\n\n\n      function updateOptionElement(option, element) {\n        option.element = element;\n        element.disabled = option.disabled;\n        // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive\n        // selects in certain circumstances when multiple selects are next to each other and display\n        // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].\n        // See https://github.com/angular/angular.js/issues/11314 for more info.\n        // This is unfortunately untestable with unit / e2e tests\n        if (option.label !== element.label) {\n          element.label = option.label;\n          element.textContent = option.label;\n        }\n        if (option.value !== element.value) element.value = option.selectValue;\n      }\n\n      function addOrReuseElement(parent, current, type, templateElement) {\n        var element;\n        // Check whether we can reuse the next element\n        if (current && lowercase(current.nodeName) === type) {\n          // The next element is the right type so reuse it\n          element = current;\n        } else {\n          // The next element is not the right type so create a new one\n          element = templateElement.cloneNode(false);\n          if (!current) {\n            // There are no more elements so just append it to the select\n            parent.appendChild(element);\n          } else {\n            // The next element is not a group so insert the new one\n            parent.insertBefore(element, current);\n          }\n        }\n        return element;\n      }\n\n\n      function removeExcessElements(current) {\n        var next;\n        while (current) {\n          next = current.nextSibling;\n          jqLiteRemove(current);\n          current = next;\n        }\n      }\n\n\n      function skipEmptyAndUnknownOptions(current) {\n        var emptyOption_ = emptyOption && emptyOption[0];\n        var unknownOption_ = unknownOption && unknownOption[0];\n\n        // We cannot rely on the extracted empty option being the same as the compiled empty option,\n        // because the compiled empty option might have been replaced by a comment because\n        // it had an \"element\" transclusion directive on it (such as ngIf)\n        if (emptyOption_ || unknownOption_) {\n          while (current &&\n                (current === emptyOption_ ||\n                current === unknownOption_ ||\n                current.nodeType === NODE_TYPE_COMMENT ||\n                (nodeName_(current) === 'option' && current.value === ''))) {\n            current = current.nextSibling;\n          }\n        }\n        return current;\n      }\n\n\n      function updateOptions() {\n\n        var previousValue = options && selectCtrl.readValue();\n\n        options = ngOptions.getOptions();\n\n        var groupMap = {};\n        var currentElement = selectElement[0].firstChild;\n\n        // Ensure that the empty option is always there if it was explicitly provided\n        if (providedEmptyOption) {\n          selectElement.prepend(emptyOption);\n        }\n\n        currentElement = skipEmptyAndUnknownOptions(currentElement);\n\n        options.items.forEach(function updateOption(option) {\n          var group;\n          var groupElement;\n          var optionElement;\n\n          if (isDefined(option.group)) {\n\n            // This option is to live in a group\n            // See if we have already created this group\n            group = groupMap[option.group];\n\n            if (!group) {\n\n              // We have not already created this group\n              groupElement = addOrReuseElement(selectElement[0],\n                                               currentElement,\n                                               'optgroup',\n                                               optGroupTemplate);\n              // Move to the next element\n              currentElement = groupElement.nextSibling;\n\n              // Update the label on the group element\n              groupElement.label = option.group;\n\n              // Store it for use later\n              group = groupMap[option.group] = {\n                groupElement: groupElement,\n                currentOptionElement: groupElement.firstChild\n              };\n\n            }\n\n            // So now we have a group for this option we add the option to the group\n            optionElement = addOrReuseElement(group.groupElement,\n                                              group.currentOptionElement,\n                                              'option',\n                                              optionTemplate);\n            updateOptionElement(option, optionElement);\n            // Move to the next element\n            group.currentOptionElement = optionElement.nextSibling;\n\n          } else {\n\n            // This option is not in a group\n            optionElement = addOrReuseElement(selectElement[0],\n                                              currentElement,\n                                              'option',\n                                              optionTemplate);\n            updateOptionElement(option, optionElement);\n            // Move to the next element\n            currentElement = optionElement.nextSibling;\n          }\n        });\n\n\n        // Now remove all excess options and group\n        Object.keys(groupMap).forEach(function(key) {\n          removeExcessElements(groupMap[key].currentOptionElement);\n        });\n        removeExcessElements(currentElement);\n\n        ngModelCtrl.$render();\n\n        // Check to see if the value has changed due to the update to the options\n        if (!ngModelCtrl.$isEmpty(previousValue)) {\n          var nextValue = selectCtrl.readValue();\n          var isNotPrimitive = ngOptions.trackBy || multiple;\n          if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {\n            ngModelCtrl.$setViewValue(nextValue);\n            ngModelCtrl.$render();\n          }\n        }\n\n      }\n  }\n\n  return {\n    restrict: 'A',\n    terminal: true,\n    require: ['select', 'ngModel'],\n    link: {\n      pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {\n        // Deactivate the SelectController.register method to prevent\n        // option directives from accidentally registering themselves\n        // (and unwanted $destroy handlers etc.)\n        ctrls[0].registerOption = noop;\n      },\n      post: ngOptionsPostLink\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngPluralize\n * @restrict EA\n *\n * @description\n * `ngPluralize` is a directive that displays messages according to en-US localization rules.\n * These rules are bundled with angular.js, but can be overridden\n * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive\n * by specifying the mappings between\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * and the strings to be displayed.\n *\n * # Plural categories and explicit number rules\n * There are two\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * in Angular's default en-US locale: \"one\" and \"other\".\n *\n * While a plural category may match many numbers (for example, in en-US locale, \"other\" can match\n * any number that is not 1), an explicit number rule can only match one number. For example, the\n * explicit number rule for \"3\" matches the number 3. There are examples of plural categories\n * and explicit number rules throughout the rest of this documentation.\n *\n * # Configuring ngPluralize\n * You configure ngPluralize by providing 2 attributes: `count` and `when`.\n * You can also provide an optional attribute, `offset`.\n *\n * The value of the `count` attribute can be either a string or an {@link guide/expression\n * Angular expression}; these are evaluated on the current scope for its bound value.\n *\n * The `when` attribute specifies the mappings between plural categories and the actual\n * string to be displayed. The value of the attribute should be a JSON object.\n *\n * The following example shows how to configure ngPluralize:\n *\n * ```html\n * <ng-pluralize count=\"personCount\"\n                 when=\"{'0': 'Nobody is viewing.',\n *                      'one': '1 person is viewing.',\n *                      'other': '{} people are viewing.'}\">\n * </ng-pluralize>\n *```\n *\n * In the example, `\"0: Nobody is viewing.\"` is an explicit number rule. If you did not\n * specify this rule, 0 would be matched to the \"other\" category and \"0 people are viewing\"\n * would be shown instead of \"Nobody is viewing\". You can specify an explicit number rule for\n * other numbers, for example 12, so that instead of showing \"12 people are viewing\", you can\n * show \"a dozen people are viewing\".\n *\n * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted\n * into pluralized strings. In the previous example, Angular will replace `{}` with\n * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder\n * for <span ng-non-bindable>{{numberExpression}}</span>.\n *\n * If no rule is defined for a category, then an empty string is displayed and a warning is generated.\n * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.\n *\n * # Configuring ngPluralize with offset\n * The `offset` attribute allows further customization of pluralized text, which can result in\n * a better user experience. For example, instead of the message \"4 people are viewing this document\",\n * you might display \"John, Kate and 2 others are viewing this document\".\n * The offset attribute allows you to offset a number by any desired value.\n * Let's take a look at an example:\n *\n * ```html\n * <ng-pluralize count=\"personCount\" offset=2\n *               when=\"{'0': 'Nobody is viewing.',\n *                      '1': '{{person1}} is viewing.',\n *                      '2': '{{person1}} and {{person2}} are viewing.',\n *                      'one': '{{person1}}, {{person2}} and one other person are viewing.',\n *                      'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n * </ng-pluralize>\n * ```\n *\n * Notice that we are still using two plural categories(one, other), but we added\n * three explicit number rules 0, 1 and 2.\n * When one person, perhaps John, views the document, \"John is viewing\" will be shown.\n * When three people view the document, no explicit number rule is found, so\n * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.\n * In this case, plural category 'one' is matched and \"John, Mary and one other person are viewing\"\n * is shown.\n *\n * Note that when you specify offsets, you must provide explicit number rules for\n * numbers from 0 up to and including the offset. If you use an offset of 3, for example,\n * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for\n * plural categories \"one\" and \"other\".\n *\n * @param {string|expression} count The variable to be bound to.\n * @param {string} when The mapping between plural category to its corresponding strings.\n * @param {number=} offset Offset to deduct from the total number.\n *\n * @example\n    <example module=\"pluralizeExample\">\n      <file name=\"index.html\">\n        <script>\n          angular.module('pluralizeExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.person1 = 'Igor';\n              $scope.person2 = 'Misko';\n              $scope.personCount = 1;\n            }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          <label>Person 1:<input type=\"text\" ng-model=\"person1\" value=\"Igor\" /></label><br/>\n          <label>Person 2:<input type=\"text\" ng-model=\"person2\" value=\"Misko\" /></label><br/>\n          <label>Number of People:<input type=\"text\" ng-model=\"personCount\" value=\"1\" /></label><br/>\n\n          <!--- Example with simple pluralization rules for en locale --->\n          Without Offset:\n          <ng-pluralize count=\"personCount\"\n                        when=\"{'0': 'Nobody is viewing.',\n                               'one': '1 person is viewing.',\n                               'other': '{} people are viewing.'}\">\n          </ng-pluralize><br>\n\n          <!--- Example with offset --->\n          With Offset(2):\n          <ng-pluralize count=\"personCount\" offset=2\n                        when=\"{'0': 'Nobody is viewing.',\n                               '1': '{{person1}} is viewing.',\n                               '2': '{{person1}} and {{person2}} are viewing.',\n                               'one': '{{person1}}, {{person2}} and one other person are viewing.',\n                               'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n          </ng-pluralize>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should show correct pluralized string', function() {\n          var withoutOffset = element.all(by.css('ng-pluralize')).get(0);\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var countInput = element(by.model('personCount'));\n\n          expect(withoutOffset.getText()).toEqual('1 person is viewing.');\n          expect(withOffset.getText()).toEqual('Igor is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('0');\n\n          expect(withoutOffset.getText()).toEqual('Nobody is viewing.');\n          expect(withOffset.getText()).toEqual('Nobody is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('2');\n\n          expect(withoutOffset.getText()).toEqual('2 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('3');\n\n          expect(withoutOffset.getText()).toEqual('3 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('4');\n\n          expect(withoutOffset.getText()).toEqual('4 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');\n        });\n        it('should show data-bound names', function() {\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var personCount = element(by.model('personCount'));\n          var person1 = element(by.model('person1'));\n          var person2 = element(by.model('person2'));\n          personCount.clear();\n          personCount.sendKeys('4');\n          person1.clear();\n          person1.sendKeys('Di');\n          person2.clear();\n          person2.sendKeys('Vojta');\n          expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');\n        });\n      </file>\n    </example>\n */\nvar ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {\n  var BRACE = /{}/g,\n      IS_WHEN = /^when(Minus)?(.+)$/;\n\n  return {\n    link: function(scope, element, attr) {\n      var numberExp = attr.count,\n          whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs\n          offset = attr.offset || 0,\n          whens = scope.$eval(whenExp) || {},\n          whensExpFns = {},\n          startSymbol = $interpolate.startSymbol(),\n          endSymbol = $interpolate.endSymbol(),\n          braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,\n          watchRemover = angular.noop,\n          lastCount;\n\n      forEach(attr, function(expression, attributeName) {\n        var tmpMatch = IS_WHEN.exec(attributeName);\n        if (tmpMatch) {\n          var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);\n          whens[whenKey] = element.attr(attr.$attr[attributeName]);\n        }\n      });\n      forEach(whens, function(expression, key) {\n        whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));\n\n      });\n\n      scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {\n        var count = parseFloat(newVal);\n        var countIsNaN = isNaN(count);\n\n        if (!countIsNaN && !(count in whens)) {\n          // If an explicit number rule such as 1, 2, 3... is defined, just use it.\n          // Otherwise, check it against pluralization rules in $locale service.\n          count = $locale.pluralCat(count - offset);\n        }\n\n        // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.\n        // In JS `NaN !== NaN`, so we have to explicitly check.\n        if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {\n          watchRemover();\n          var whenExpFn = whensExpFns[count];\n          if (isUndefined(whenExpFn)) {\n            if (newVal != null) {\n              $log.debug(\"ngPluralize: no rule defined for '\" + count + \"' in \" + whenExp);\n            }\n            watchRemover = noop;\n            updateElementText();\n          } else {\n            watchRemover = scope.$watch(whenExpFn, updateElementText);\n          }\n          lastCount = count;\n        }\n      });\n\n      function updateElementText(newText) {\n        element.text(newText || '');\n      }\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngRepeat\n * @multiElement\n *\n * @description\n * The `ngRepeat` directive instantiates a template once per item from a collection. Each template\n * instance gets its own scope, where the given loop variable is set to the current collection item,\n * and `$index` is set to the item index or key.\n *\n * Special properties are exposed on the local scope of each template instance, including:\n *\n * | Variable  | Type            | Details                                                                     |\n * |-----------|-----------------|-----------------------------------------------------------------------------|\n * | `$index`  | {@type number}  | iterator offset of the repeated element (0..length-1)                       |\n * | `$first`  | {@type boolean} | true if the repeated element is first in the iterator.                      |\n * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |\n * | `$last`   | {@type boolean} | true if the repeated element is last in the iterator.                       |\n * | `$even`   | {@type boolean} | true if the iterator position `$index` is even (otherwise false).           |\n * | `$odd`    | {@type boolean} | true if the iterator position `$index` is odd (otherwise false).            |\n *\n * <div class=\"alert alert-info\">\n *   Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.\n *   This may be useful when, for instance, nesting ngRepeats.\n * </div>\n *\n *\n * # Iterating over object properties\n *\n * It is possible to get `ngRepeat` to iterate over the properties of an object using the following\n * syntax:\n *\n * ```js\n * <div ng-repeat=\"(key, value) in myObj\"> ... </div>\n * ```\n *\n * However, there are a limitations compared to array iteration:\n *\n * - The JavaScript specification does not define the order of keys\n *   returned for an object, so Angular relies on the order returned by the browser\n *   when running `for key in myObj`. Browsers generally follow the strategy of providing\n *   keys in the order in which they were defined, although there are exceptions when keys are deleted\n *   and reinstated. See the\n *   [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).\n *\n * - `ngRepeat` will silently *ignore* object keys starting with `$`, because\n *   it's a prefix used by Angular for public (`$`) and private (`$$`) properties.\n *\n * - The built-in filters {@link ng.orderBy orderBy} and {@link ng.filter filter} do not work with\n *   objects, and will throw if used with one.\n *\n * If you are hitting any of these limitations, the recommended workaround is to convert your object into an array\n * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could\n * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)\n * or implement a `$watch` on the object yourself.\n *\n *\n * # Tracking and Duplicates\n *\n * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in\n * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:\n *\n * * When an item is added, a new instance of the template is added to the DOM.\n * * When an item is removed, its template instance is removed from the DOM.\n * * When items are reordered, their respective templates are reordered in the DOM.\n *\n * To minimize creation of DOM elements, `ngRepeat` uses a function\n * to \"keep track\" of all items in the collection and their corresponding DOM elements.\n * For example, if an item is added to the collection, ngRepeat will know that all other items\n * already have DOM elements, and will not re-render them.\n *\n * The default tracking function (which tracks items by their identity) does not allow\n * duplicate items in arrays. This is because when there are duplicates, it is not possible\n * to maintain a one-to-one mapping between collection items and DOM elements.\n *\n * If you do need to repeat duplicate items, you can substitute the default tracking behavior\n * with your own using the `track by` expression.\n *\n * For example, you may track items by the index of each item in the collection, using the\n * special scope property `$index`:\n * ```html\n *    <div ng-repeat=\"n in [42, 42, 43, 43] track by $index\">\n *      {{n}}\n *    </div>\n * ```\n *\n * You may also use arbitrary expressions in `track by`, including references to custom functions\n * on the scope:\n * ```html\n *    <div ng-repeat=\"n in [42, 42, 43, 43] track by myTrackingFunction(n)\">\n *      {{n}}\n *    </div>\n * ```\n *\n * <div class=\"alert alert-success\">\n * If you are working with objects that have an identifier property, you should track\n * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`\n * will not have to rebuild the DOM elements for items it has already rendered, even if the\n * JavaScript objects in the collection have been substituted for new ones. For large collections,\n * this significantly improves rendering performance. If you don't have a unique identifier,\n * `track by $index` can also provide a performance boost.\n * </div>\n * ```html\n *    <div ng-repeat=\"model in collection track by model.id\">\n *      {{model.name}}\n *    </div>\n * ```\n *\n * When no `track by` expression is provided, it is equivalent to tracking by the built-in\n * `$id` function, which tracks items by their identity:\n * ```html\n *    <div ng-repeat=\"obj in collection track by $id(obj)\">\n *      {{obj.prop}}\n *    </div>\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `track by` must always be the last expression:\n * </div>\n * ```\n * <div ng-repeat=\"model in collection | orderBy: 'id' as filtered_result track by model.id\">\n *     {{model.name}}\n * </div>\n * ```\n *\n * # Special repeat start and end points\n * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending\n * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.\n * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)\n * up to and including the ending HTML tag where **ng-repeat-end** is placed.\n *\n * The example below makes use of this feature:\n * ```html\n *   <header ng-repeat-start=\"item in items\">\n *     Header {{ item }}\n *   </header>\n *   <div class=\"body\">\n *     Body {{ item }}\n *   </div>\n *   <footer ng-repeat-end>\n *     Footer {{ item }}\n *   </footer>\n * ```\n *\n * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:\n * ```html\n *   <header>\n *     Header A\n *   </header>\n *   <div class=\"body\">\n *     Body A\n *   </div>\n *   <footer>\n *     Footer A\n *   </footer>\n *   <header>\n *     Header B\n *   </header>\n *   <div class=\"body\">\n *     Body B\n *   </div>\n *   <footer>\n *     Footer B\n *   </footer>\n * ```\n *\n * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such\n * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter} | when a new item is added to the list or when an item is revealed after a filter |\n * | {@link ng.$animate#leave leave} | when an item is removed from the list or when an item is filtered out |\n * | {@link ng.$animate#move move } | when an adjacent item is filtered out causing a reorder or when the item contents are reordered |\n *\n * See the example below for defining CSS animations with ngRepeat.\n *\n * @element ANY\n * @scope\n * @priority 1000\n * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These\n *   formats are currently supported:\n *\n *   * `variable in expression` – where variable is the user defined loop variable and `expression`\n *     is a scope expression giving the collection to enumerate.\n *\n *     For example: `album in artist.albums`.\n *\n *   * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,\n *     and `expression` is the scope expression giving the collection to enumerate.\n *\n *     For example: `(name, age) in {'adam':10, 'amalie':12}`.\n *\n *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking expression\n *     which can be used to associate the objects in the collection with the DOM elements. If no tracking expression\n *     is specified, ng-repeat associates elements by identity. It is an error to have\n *     more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are\n *     mapped to the same DOM element, which is not possible.)\n *\n *     Note that the tracking expression must come last, after any filters, and the alias expression.\n *\n *     For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements\n *     will be associated by item identity in the array.\n *\n *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n *     element in the same way in the DOM.\n *\n *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n *     property is same.\n *\n *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n *     to items in conjunction with a tracking expression.\n *\n *   * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the\n *     intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message\n *     when a filter is active on the repeater, but the filtered result set is empty.\n *\n *     For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after\n *     the items have been processed through the filter.\n *\n *     Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end\n *     (and not as operator, inside an expression).\n *\n *     For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .\n *\n * @example\n * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed\n * results by name. New (entering) and removed (leaving) items are animated.\n  <example module=\"ngRepeat\" name=\"ngRepeat\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"repeatController\">\n        I have {{friends.length}} friends. They are:\n        <input type=\"search\" ng-model=\"q\" placeholder=\"filter friends...\" aria-label=\"filter friends\" />\n        <ul class=\"example-animate-container\">\n          <li class=\"animate-repeat\" ng-repeat=\"friend in friends | filter:q as results\">\n            [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.\n          </li>\n          <li class=\"animate-repeat\" ng-if=\"results.length == 0\">\n            <strong>No results found...</strong>\n          </li>\n        </ul>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('ngRepeat', ['ngAnimate']).controller('repeatController', function($scope) {\n        $scope.friends = [\n          {name:'John', age:25, gender:'boy'},\n          {name:'Jessie', age:30, gender:'girl'},\n          {name:'Johanna', age:28, gender:'girl'},\n          {name:'Joy', age:15, gender:'girl'},\n          {name:'Mary', age:28, gender:'girl'},\n          {name:'Peter', age:95, gender:'boy'},\n          {name:'Sebastian', age:50, gender:'boy'},\n          {name:'Erika', age:27, gender:'girl'},\n          {name:'Patrick', age:40, gender:'boy'},\n          {name:'Samantha', age:60, gender:'girl'}\n        ];\n      });\n    </file>\n    <file name=\"animations.css\">\n      .example-animate-container {\n        background:white;\n        border:1px solid black;\n        list-style:none;\n        margin:0;\n        padding:0 10px;\n      }\n\n      .animate-repeat {\n        line-height:30px;\n        list-style:none;\n        box-sizing:border-box;\n      }\n\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter,\n      .animate-repeat.ng-leave {\n        transition:all linear 0.5s;\n      }\n\n      .animate-repeat.ng-leave.ng-leave-active,\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter {\n        opacity:0;\n        max-height:0;\n      }\n\n      .animate-repeat.ng-leave,\n      .animate-repeat.ng-move.ng-move-active,\n      .animate-repeat.ng-enter.ng-enter-active {\n        opacity:1;\n        max-height:30px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var friends = element.all(by.repeater('friend in friends'));\n\n      it('should render initial data set', function() {\n        expect(friends.count()).toBe(10);\n        expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');\n        expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');\n        expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');\n        expect(element(by.binding('friends.length')).getText())\n            .toMatch(\"I have 10 friends. They are:\");\n      });\n\n       it('should update repeater when filter predicate changes', function() {\n         expect(friends.count()).toBe(10);\n\n         element(by.model('q')).sendKeys('ma');\n\n         expect(friends.count()).toBe(2);\n         expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');\n         expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');\n       });\n      </file>\n    </example>\n */\nvar ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $animate, $compile) {\n  var NG_REMOVED = '$$NG_REMOVED';\n  var ngRepeatMinErr = minErr('ngRepeat');\n\n  var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {\n    // TODO(perf): generate setters to shave off ~40ms or 1-1.5%\n    scope[valueIdentifier] = value;\n    if (keyIdentifier) scope[keyIdentifier] = key;\n    scope.$index = index;\n    scope.$first = (index === 0);\n    scope.$last = (index === (arrayLength - 1));\n    scope.$middle = !(scope.$first || scope.$last);\n    // jshint bitwise: false\n    scope.$odd = !(scope.$even = (index&1) === 0);\n    // jshint bitwise: true\n  };\n\n  var getBlockStart = function(block) {\n    return block.clone[0];\n  };\n\n  var getBlockEnd = function(block) {\n    return block.clone[block.clone.length - 1];\n  };\n\n\n  return {\n    restrict: 'A',\n    multiElement: true,\n    transclude: 'element',\n    priority: 1000,\n    terminal: true,\n    $$tlb: true,\n    compile: function ngRepeatCompile($element, $attr) {\n      var expression = $attr.ngRepeat;\n      var ngRepeatEndComment = $compile.$$createComment('end ngRepeat', expression);\n\n      var match = expression.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n\n      if (!match) {\n        throw ngRepeatMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n            expression);\n      }\n\n      var lhs = match[1];\n      var rhs = match[2];\n      var aliasAs = match[3];\n      var trackByExp = match[4];\n\n      match = lhs.match(/^(?:(\\s*[\\$\\w]+)|\\(\\s*([\\$\\w]+)\\s*,\\s*([\\$\\w]+)\\s*\\))$/);\n\n      if (!match) {\n        throw ngRepeatMinErr('iidexp', \"'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.\",\n            lhs);\n      }\n      var valueIdentifier = match[3] || match[1];\n      var keyIdentifier = match[2];\n\n      if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||\n          /^(null|undefined|this|\\$index|\\$first|\\$middle|\\$last|\\$even|\\$odd|\\$parent|\\$root|\\$id)$/.test(aliasAs))) {\n        throw ngRepeatMinErr('badident', \"alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.\",\n          aliasAs);\n      }\n\n      var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;\n      var hashFnLocals = {$id: hashKey};\n\n      if (trackByExp) {\n        trackByExpGetter = $parse(trackByExp);\n      } else {\n        trackByIdArrayFn = function(key, value) {\n          return hashKey(value);\n        };\n        trackByIdObjFn = function(key) {\n          return key;\n        };\n      }\n\n      return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {\n\n        if (trackByExpGetter) {\n          trackByIdExpFn = function(key, value, index) {\n            // assign key, value, and $index to the locals so that they can be used in hash functions\n            if (keyIdentifier) hashFnLocals[keyIdentifier] = key;\n            hashFnLocals[valueIdentifier] = value;\n            hashFnLocals.$index = index;\n            return trackByExpGetter($scope, hashFnLocals);\n          };\n        }\n\n        // Store a list of elements from previous run. This is a hash where key is the item from the\n        // iterator, and the value is objects with following properties.\n        //   - scope: bound scope\n        //   - element: previous element.\n        //   - index: position\n        //\n        // We are using no-proto object so that we don't need to guard against inherited props via\n        // hasOwnProperty.\n        var lastBlockMap = createMap();\n\n        //watch props\n        $scope.$watchCollection(rhs, function ngRepeatAction(collection) {\n          var index, length,\n              previousNode = $element[0],     // node that cloned nodes should be inserted after\n                                              // initialized to the comment node anchor\n              nextNode,\n              // Same as lastBlockMap but it has the current state. It will become the\n              // lastBlockMap on the next iteration.\n              nextBlockMap = createMap(),\n              collectionLength,\n              key, value, // key/value of iteration\n              trackById,\n              trackByIdFn,\n              collectionKeys,\n              block,       // last object information {scope, element, id}\n              nextBlockOrder,\n              elementsToRemove;\n\n          if (aliasAs) {\n            $scope[aliasAs] = collection;\n          }\n\n          if (isArrayLike(collection)) {\n            collectionKeys = collection;\n            trackByIdFn = trackByIdExpFn || trackByIdArrayFn;\n          } else {\n            trackByIdFn = trackByIdExpFn || trackByIdObjFn;\n            // if object, extract keys, in enumeration order, unsorted\n            collectionKeys = [];\n            for (var itemKey in collection) {\n              if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {\n                collectionKeys.push(itemKey);\n              }\n            }\n          }\n\n          collectionLength = collectionKeys.length;\n          nextBlockOrder = new Array(collectionLength);\n\n          // locate existing items\n          for (index = 0; index < collectionLength; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            trackById = trackByIdFn(key, value, index);\n            if (lastBlockMap[trackById]) {\n              // found previously seen block\n              block = lastBlockMap[trackById];\n              delete lastBlockMap[trackById];\n              nextBlockMap[trackById] = block;\n              nextBlockOrder[index] = block;\n            } else if (nextBlockMap[trackById]) {\n              // if collision detected. restore lastBlockMap and throw an error\n              forEach(nextBlockOrder, function(block) {\n                if (block && block.scope) lastBlockMap[block.id] = block;\n              });\n              throw ngRepeatMinErr('dupes',\n                  \"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}\",\n                  expression, trackById, value);\n            } else {\n              // new never before seen block\n              nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};\n              nextBlockMap[trackById] = true;\n            }\n          }\n\n          // remove leftover items\n          for (var blockKey in lastBlockMap) {\n            block = lastBlockMap[blockKey];\n            elementsToRemove = getBlockNodes(block.clone);\n            $animate.leave(elementsToRemove);\n            if (elementsToRemove[0].parentNode) {\n              // if the element was not removed yet because of pending animation, mark it as deleted\n              // so that we can ignore it later\n              for (index = 0, length = elementsToRemove.length; index < length; index++) {\n                elementsToRemove[index][NG_REMOVED] = true;\n              }\n            }\n            block.scope.$destroy();\n          }\n\n          // we are not using forEach for perf reasons (trying to avoid #call)\n          for (index = 0; index < collectionLength; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            block = nextBlockOrder[index];\n\n            if (block.scope) {\n              // if we have already seen this object, then we need to reuse the\n              // associated scope/element\n\n              nextNode = previousNode;\n\n              // skip nodes that are already pending removal via leave animation\n              do {\n                nextNode = nextNode.nextSibling;\n              } while (nextNode && nextNode[NG_REMOVED]);\n\n              if (getBlockStart(block) != nextNode) {\n                // existing item which got moved\n                $animate.move(getBlockNodes(block.clone), null, previousNode);\n              }\n              previousNode = getBlockEnd(block);\n              updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n            } else {\n              // new item which we don't know about\n              $transclude(function ngRepeatTransclude(clone, scope) {\n                block.scope = scope;\n                // http://jsperf.com/clone-vs-createcomment\n                var endNode = ngRepeatEndComment.cloneNode(false);\n                clone[clone.length++] = endNode;\n\n                $animate.enter(clone, null, previousNode);\n                previousNode = endNode;\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block.clone = clone;\n                nextBlockMap[block.id] = block;\n                updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n              });\n            }\n          }\n          lastBlockMap = nextBlockMap;\n        });\n      };\n    }\n  };\n}];\n\nvar NG_HIDE_CLASS = 'ng-hide';\nvar NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';\n/**\n * @ngdoc directive\n * @name ngShow\n * @multiElement\n *\n * @description\n * The `ngShow` directive shows or hides the given HTML element based on the expression\n * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding\n * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is visible) -->\n * <div ng-show=\"myValue\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is hidden) -->\n * <div ng-show=\"myValue\" class=\"ng-hide\"></div>\n * ```\n *\n * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope\n * with extra animation classes that can be added.\n *\n * ```css\n * .ng-hide:not(.ng-hide-animate) {\n *   /&#42; this is just another form of hiding an element &#42;/\n *   display: block!important;\n *   position: absolute;\n *   top: -9999px;\n *   left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngShow`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass except that\n * you must also include the !important flag to override the display property\n * so that you can perform an animation when the element is hidden during the time of the animation.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   /&#42; this is required as of 1.3x to properly\n *      apply all styling in a show/hide animation &#42;/\n *   transition: 0s linear all;\n * }\n *\n * .my-element.ng-hide-add-active,\n * .my-element.ng-hide-remove-active {\n *   /&#42; the transition is defined in the active class &#42;/\n *   transition: 1s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden |\n * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngShow` expression evaluates to a truthy value and just before contents are set to visible |\n *\n * @element ANY\n * @param {expression} ngShow If the {@link guide/expression expression} is truthy\n *     then the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngHide\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-show\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-show\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-show {\n        line-height: 20px;\n        opacity: 1;\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n\n      .animate-show.ng-hide-add, .animate-show.ng-hide-remove {\n        transition: all linear 0.5s;\n      }\n\n      .animate-show.ng-hide {\n        line-height: 0;\n        opacity: 0;\n        padding: 0 10px;\n      }\n\n      .check-element {\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngShowDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'A',\n    multiElement: true,\n    link: function(scope, element, attr) {\n      scope.$watch(attr.ngShow, function ngShowWatchAction(value) {\n        // we're adding a temporary, animation-specific class for ng-hide since this way\n        // we can control when the element is actually displayed on screen without having\n        // to have a global/greedy CSS selector that breaks when other animations are run.\n        // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845\n        $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {\n          tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n        });\n      });\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngHide\n * @multiElement\n *\n * @description\n * The `ngHide` directive shows or hides the given HTML element based on the expression\n * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is hidden) -->\n * <div ng-hide=\"myValue\" class=\"ng-hide\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is visible) -->\n * <div ng-hide=\"myValue\"></div>\n * ```\n *\n * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n *   /&#42; this is just another form of hiding an element &#42;/\n *   display: block!important;\n *   position: absolute;\n *   top: -9999px;\n *   left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngHide`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`\n * CSS class is added and removed for you instead of your own CSS class.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   transition: 0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden |\n * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible |\n *\n *\n * @element ANY\n * @param {expression} ngHide If the {@link guide/expression expression} is truthy then\n *     the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngShow\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-hide\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-hide\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-hide {\n        transition: all linear 0.5s;\n        line-height: 20px;\n        opacity: 1;\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n\n      .animate-hide.ng-hide {\n        line-height: 0;\n        opacity: 0;\n        padding: 0 10px;\n      }\n\n      .check-element {\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngHideDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'A',\n    multiElement: true,\n    link: function(scope, element, attr) {\n      scope.$watch(attr.ngHide, function ngHideWatchAction(value) {\n        // The comment inside of the ngShowDirective explains why we add and\n        // remove a temporary class for the show/hide animation\n        $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {\n          tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n        });\n      });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngStyle\n * @restrict AC\n *\n * @description\n * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.\n *\n * @element ANY\n * @param {expression} ngStyle\n *\n * {@link guide/expression Expression} which evals to an\n * object whose keys are CSS style names and values are corresponding values for those CSS\n * keys.\n *\n * Since some CSS style names are not valid keys for an object, they must be quoted.\n * See the 'background-color' style in the example below.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <input type=\"button\" value=\"set color\" ng-click=\"myStyle={color:'red'}\">\n        <input type=\"button\" value=\"set background\" ng-click=\"myStyle={'background-color':'blue'}\">\n        <input type=\"button\" value=\"clear\" ng-click=\"myStyle={}\">\n        <br/>\n        <span ng-style=\"myStyle\">Sample Text</span>\n        <pre>myStyle={{myStyle}}</pre>\n     </file>\n     <file name=\"style.css\">\n       span {\n         color: black;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var colorSpan = element(by.css('span'));\n\n       it('should check ng-style', function() {\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n         element(by.css('input[value=\\'set color\\']')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');\n         element(by.css('input[value=clear]')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n       });\n     </file>\n   </example>\n */\nvar ngStyleDirective = ngDirective(function(scope, element, attr) {\n  scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {\n    if (oldStyles && (newStyles !== oldStyles)) {\n      forEach(oldStyles, function(val, style) { element.css(style, '');});\n    }\n    if (newStyles) element.css(newStyles);\n  }, true);\n});\n\n/**\n * @ngdoc directive\n * @name ngSwitch\n * @restrict EA\n *\n * @description\n * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.\n * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location\n * as specified in the template.\n *\n * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it\n * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element\n * matches the value obtained from the evaluated expression. In other words, you define a container element\n * (where you place the directive), place an expression on the **`on=\"...\"` attribute**\n * (or the **`ng-switch=\"...\"` attribute**), define any inner elements inside of the directive and place\n * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on\n * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default\n * attribute is displayed.\n *\n * <div class=\"alert alert-info\">\n * Be aware that the attribute values to match against cannot be expressions. They are interpreted\n * as literal string values to match against.\n * For example, **`ng-switch-when=\"someVal\"`** will match against the string `\"someVal\"` not against the\n * value of the expression `$scope.someVal`.\n * </div>\n\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | after the ngSwitch contents change and the matched child element is placed inside the container |\n * | {@link ng.$animate#leave leave}  | after the ngSwitch contents change and just before the former contents are removed from the DOM |\n *\n * @usage\n *\n * ```\n * <ANY ng-switch=\"expression\">\n *   <ANY ng-switch-when=\"matchValue1\">...</ANY>\n *   <ANY ng-switch-when=\"matchValue2\">...</ANY>\n *   <ANY ng-switch-default>...</ANY>\n * </ANY>\n * ```\n *\n *\n * @scope\n * @priority 1200\n * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.\n * On child elements add:\n *\n * * `ngSwitchWhen`: the case statement to match against. If match then this\n *   case will be displayed. If the same match appears multiple times, all the\n *   elements will be displayed.\n * * `ngSwitchDefault`: the default case when no other case match. If there\n *   are multiple default cases, all of them will be displayed when no other\n *   case match.\n *\n *\n * @example\n  <example module=\"switchExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <select ng-model=\"selection\" ng-options=\"item for item in items\">\n        </select>\n        <code>selection={{selection}}</code>\n        <hr/>\n        <div class=\"animate-switch-container\"\n          ng-switch on=\"selection\">\n            <div class=\"animate-switch\" ng-switch-when=\"settings\">Settings Div</div>\n            <div class=\"animate-switch\" ng-switch-when=\"home\">Home Span</div>\n            <div class=\"animate-switch\" ng-switch-default>default</div>\n        </div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('switchExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.items = ['settings', 'home', 'other'];\n          $scope.selection = $scope.items[0];\n        }]);\n    </file>\n    <file name=\"animations.css\">\n      .animate-switch-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .animate-switch {\n        padding:10px;\n      }\n\n      .animate-switch.ng-animate {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n      }\n\n      .animate-switch.ng-leave.ng-leave-active,\n      .animate-switch.ng-enter {\n        top:-50px;\n      }\n      .animate-switch.ng-leave,\n      .animate-switch.ng-enter.ng-enter-active {\n        top:0;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var switchElem = element(by.css('[ng-switch]'));\n      var select = element(by.model('selection'));\n\n      it('should start in settings', function() {\n        expect(switchElem.getText()).toMatch(/Settings Div/);\n      });\n      it('should change to home', function() {\n        select.all(by.css('option')).get(1).click();\n        expect(switchElem.getText()).toMatch(/Home Span/);\n      });\n      it('should select default', function() {\n        select.all(by.css('option')).get(2).click();\n        expect(switchElem.getText()).toMatch(/default/);\n      });\n    </file>\n  </example>\n */\nvar ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {\n  return {\n    require: 'ngSwitch',\n\n    // asks for $scope to fool the BC controller module\n    controller: ['$scope', function ngSwitchController() {\n     this.cases = {};\n    }],\n    link: function(scope, element, attr, ngSwitchController) {\n      var watchExpr = attr.ngSwitch || attr.on,\n          selectedTranscludes = [],\n          selectedElements = [],\n          previousLeaveAnimations = [],\n          selectedScopes = [];\n\n      var spliceFactory = function(array, index) {\n          return function() { array.splice(index, 1); };\n      };\n\n      scope.$watch(watchExpr, function ngSwitchWatchAction(value) {\n        var i, ii;\n        for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {\n          $animate.cancel(previousLeaveAnimations[i]);\n        }\n        previousLeaveAnimations.length = 0;\n\n        for (i = 0, ii = selectedScopes.length; i < ii; ++i) {\n          var selected = getBlockNodes(selectedElements[i].clone);\n          selectedScopes[i].$destroy();\n          var promise = previousLeaveAnimations[i] = $animate.leave(selected);\n          promise.then(spliceFactory(previousLeaveAnimations, i));\n        }\n\n        selectedElements.length = 0;\n        selectedScopes.length = 0;\n\n        if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {\n          forEach(selectedTranscludes, function(selectedTransclude) {\n            selectedTransclude.transclude(function(caseElement, selectedScope) {\n              selectedScopes.push(selectedScope);\n              var anchor = selectedTransclude.element;\n              caseElement[caseElement.length++] = $compile.$$createComment('end ngSwitchWhen');\n              var block = { clone: caseElement };\n\n              selectedElements.push(block);\n              $animate.enter(caseElement, anchor.parent(), anchor);\n            });\n          });\n        }\n      });\n    }\n  };\n}];\n\nvar ngSwitchWhenDirective = ngDirective({\n  transclude: 'element',\n  priority: 1200,\n  require: '^ngSwitch',\n  multiElement: true,\n  link: function(scope, element, attrs, ctrl, $transclude) {\n    ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);\n    ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });\n  }\n});\n\nvar ngSwitchDefaultDirective = ngDirective({\n  transclude: 'element',\n  priority: 1200,\n  require: '^ngSwitch',\n  multiElement: true,\n  link: function(scope, element, attr, ctrl, $transclude) {\n    ctrl.cases['?'] = (ctrl.cases['?'] || []);\n    ctrl.cases['?'].push({ transclude: $transclude, element: element });\n   }\n});\n\n/**\n * @ngdoc directive\n * @name ngTransclude\n * @restrict EAC\n *\n * @description\n * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.\n *\n * You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name\n * as the value of the `ng-transclude` or `ng-transclude-slot` attribute.\n *\n * If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing\n * content of this element will be removed before the transcluded content is inserted.\n * If the transcluded content is empty, the existing content is left intact. This lets you provide fallback content in the case\n * that no transcluded content is provided.\n *\n * @element ANY\n *\n * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided, is empty\n *                                               or its value is the same as the name of the attribute then the default slot is used.\n *\n * @example\n * ### Basic transclusion\n * This example demonstrates basic transclusion of content into a component directive.\n * <example name=\"simpleTranscludeExample\" module=\"transcludeExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('transcludeExample', [])\n *        .directive('pane', function(){\n *           return {\n *             restrict: 'E',\n *             transclude: true,\n *             scope: { title:'@' },\n *             template: '<div style=\"border: 1px solid black;\">' +\n *                         '<div style=\"background-color: gray\">{{title}}</div>' +\n *                         '<ng-transclude></ng-transclude>' +\n *                       '</div>'\n *           };\n *       })\n *       .controller('ExampleController', ['$scope', function($scope) {\n *         $scope.title = 'Lorem Ipsum';\n *         $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n *       }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <input ng-model=\"title\" aria-label=\"title\"> <br/>\n *       <textarea ng-model=\"text\" aria-label=\"text\"></textarea> <br/>\n *       <pane title=\"{{title}}\">{{text}}</pane>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *      it('should have transcluded', function() {\n *        var titleElement = element(by.model('title'));\n *        titleElement.clear();\n *        titleElement.sendKeys('TITLE');\n *        var textElement = element(by.model('text'));\n *        textElement.clear();\n *        textElement.sendKeys('TEXT');\n *        expect(element(by.binding('title')).getText()).toEqual('TITLE');\n *        expect(element(by.binding('text')).getText()).toEqual('TEXT');\n *      });\n *   </file>\n * </example>\n *\n * @example\n * ### Transclude fallback content\n * This example shows how to use `NgTransclude` with fallback content, that\n * is displayed if no transcluded content is provided.\n *\n * <example module=\"transcludeFallbackContentExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('transcludeFallbackContentExample', [])\n * .directive('myButton', function(){\n *             return {\n *               restrict: 'E',\n *               transclude: true,\n *               scope: true,\n *               template: '<button style=\"cursor: pointer;\">' +\n *                           '<ng-transclude>' +\n *                             '<b style=\"color: red;\">Button1</b>' +\n *                           '</ng-transclude>' +\n *                         '</button>'\n *             };\n *         });\n * </script>\n * <!-- fallback button content -->\n * <my-button id=\"fallback\"></my-button>\n * <!-- modified button content -->\n * <my-button id=\"modified\">\n *   <i style=\"color: green;\">Button2</i>\n * </my-button>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should have different transclude element content', function() {\n *          expect(element(by.id('fallback')).getText()).toBe('Button1');\n *          expect(element(by.id('modified')).getText()).toBe('Button2');\n *        });\n * </file>\n * </example>\n *\n * @example\n * ### Multi-slot transclusion\n * This example demonstrates using multi-slot transclusion in a component directive.\n * <example name=\"multiSlotTranscludeExample\" module=\"multiSlotTranscludeExample\">\n *   <file name=\"index.html\">\n *    <style>\n *      .title, .footer {\n *        background-color: gray\n *      }\n *    </style>\n *    <div ng-controller=\"ExampleController\">\n *      <input ng-model=\"title\" aria-label=\"title\"> <br/>\n *      <textarea ng-model=\"text\" aria-label=\"text\"></textarea> <br/>\n *      <pane>\n *        <pane-title><a ng-href=\"{{link}}\">{{title}}</a></pane-title>\n *        <pane-body><p>{{text}}</p></pane-body>\n *      </pane>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    angular.module('multiSlotTranscludeExample', [])\n *     .directive('pane', function(){\n *        return {\n *          restrict: 'E',\n *          transclude: {\n *            'title': '?paneTitle',\n *            'body': 'paneBody',\n *            'footer': '?paneFooter'\n *          },\n *          template: '<div style=\"border: 1px solid black;\">' +\n *                      '<div class=\"title\" ng-transclude=\"title\">Fallback Title</div>' +\n *                      '<div ng-transclude=\"body\"></div>' +\n *                      '<div class=\"footer\" ng-transclude=\"footer\">Fallback Footer</div>' +\n *                    '</div>'\n *        };\n *    })\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.title = 'Lorem Ipsum';\n *      $scope.link = \"https://google.com\";\n *      $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n *    }]);\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *      it('should have transcluded the title and the body', function() {\n *        var titleElement = element(by.model('title'));\n *        titleElement.clear();\n *        titleElement.sendKeys('TITLE');\n *        var textElement = element(by.model('text'));\n *        textElement.clear();\n *        textElement.sendKeys('TEXT');\n *        expect(element(by.css('.title')).getText()).toEqual('TITLE');\n *        expect(element(by.binding('text')).getText()).toEqual('TEXT');\n *        expect(element(by.css('.footer')).getText()).toEqual('Fallback Footer');\n *      });\n *   </file>\n * </example>\n */\nvar ngTranscludeMinErr = minErr('ngTransclude');\nvar ngTranscludeDirective = ngDirective({\n  restrict: 'EAC',\n  link: function($scope, $element, $attrs, controller, $transclude) {\n\n    if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {\n      // If the attribute is of the form: `ng-transclude=\"ng-transclude\"`\n      // then treat it like the default\n      $attrs.ngTransclude = '';\n    }\n\n    function ngTranscludeCloneAttachFn(clone) {\n      if (clone.length) {\n        $element.empty();\n        $element.append(clone);\n      }\n    }\n\n    if (!$transclude) {\n      throw ngTranscludeMinErr('orphan',\n       'Illegal use of ngTransclude directive in the template! ' +\n       'No parent directive that requires a transclusion found. ' +\n       'Element: {0}',\n       startingTag($element));\n    }\n\n    // If there is no slot name defined or the slot name is not optional\n    // then transclude the slot\n    var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;\n    $transclude(ngTranscludeCloneAttachFn, null, slotName);\n  }\n});\n\n/**\n * @ngdoc directive\n * @name script\n * @restrict E\n *\n * @description\n * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the\n * template can be used by {@link ng.directive:ngInclude `ngInclude`},\n * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the\n * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be\n * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.\n *\n * @param {string} type Must be set to `'text/ng-template'`.\n * @param {string} id Cache name of the template.\n *\n * @example\n  <example>\n    <file name=\"index.html\">\n      <script type=\"text/ng-template\" id=\"/tpl.html\">\n        Content of the template.\n      </script>\n\n      <a ng-click=\"currentTpl='/tpl.html'\" id=\"tpl-link\">Load inlined template</a>\n      <div id=\"tpl-content\" ng-include src=\"currentTpl\"></div>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      it('should load template defined inside script tag', function() {\n        element(by.css('#tpl-link')).click();\n        expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);\n      });\n    </file>\n  </example>\n */\nvar scriptDirective = ['$templateCache', function($templateCache) {\n  return {\n    restrict: 'E',\n    terminal: true,\n    compile: function(element, attr) {\n      if (attr.type == 'text/ng-template') {\n        var templateUrl = attr.id,\n            text = element[0].text;\n\n        $templateCache.put(templateUrl, text);\n      }\n    }\n  };\n}];\n\nvar noopNgModelController = { $setViewValue: noop, $render: noop };\n\nfunction chromeHack(optionElement) {\n  // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459\n  // Adding an <option selected=\"selected\"> element to a <select required=\"required\"> should\n  // automatically select the new element\n  if (optionElement[0].hasAttribute('selected')) {\n    optionElement[0].selected = true;\n  }\n}\n\n/**\n * @ngdoc type\n * @name  select.SelectController\n * @description\n * The controller for the `<select>` directive. This provides support for reading\n * and writing the selected value(s) of the control and also coordinates dynamically\n * added `<option>` elements, perhaps by an `ngRepeat` directive.\n */\nvar SelectController =\n        ['$element', '$scope', function($element, $scope) {\n\n  var self = this,\n      optionsMap = new HashMap();\n\n  // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors\n  self.ngModelCtrl = noopNgModelController;\n\n  // The \"unknown\" option is one that is prepended to the list if the viewValue\n  // does not match any of the options. When it is rendered the value of the unknown\n  // option is '? XXX ?' where XXX is the hashKey of the value that is not known.\n  //\n  // We can't just jqLite('<option>') since jqLite is not smart enough\n  // to create it in <select> and IE barfs otherwise.\n  self.unknownOption = jqLite(document.createElement('option'));\n  self.renderUnknownOption = function(val) {\n    var unknownVal = '? ' + hashKey(val) + ' ?';\n    self.unknownOption.val(unknownVal);\n    $element.prepend(self.unknownOption);\n    $element.val(unknownVal);\n  };\n\n  $scope.$on('$destroy', function() {\n    // disable unknown option so that we don't do work when the whole select is being destroyed\n    self.renderUnknownOption = noop;\n  });\n\n  self.removeUnknownOption = function() {\n    if (self.unknownOption.parent()) self.unknownOption.remove();\n  };\n\n\n  // Read the value of the select control, the implementation of this changes depending\n  // upon whether the select can have multiple values and whether ngOptions is at work.\n  self.readValue = function readSingleValue() {\n    self.removeUnknownOption();\n    return $element.val();\n  };\n\n\n  // Write the value to the select control, the implementation of this changes depending\n  // upon whether the select can have multiple values and whether ngOptions is at work.\n  self.writeValue = function writeSingleValue(value) {\n    if (self.hasOption(value)) {\n      self.removeUnknownOption();\n      $element.val(value);\n      if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy\n    } else {\n      if (value == null && self.emptyOption) {\n        self.removeUnknownOption();\n        $element.val('');\n      } else {\n        self.renderUnknownOption(value);\n      }\n    }\n  };\n\n\n  // Tell the select control that an option, with the given value, has been added\n  self.addOption = function(value, element) {\n    // Skip comment nodes, as they only pollute the `optionsMap`\n    if (element[0].nodeType === NODE_TYPE_COMMENT) return;\n\n    assertNotHasOwnProperty(value, '\"option value\"');\n    if (value === '') {\n      self.emptyOption = element;\n    }\n    var count = optionsMap.get(value) || 0;\n    optionsMap.put(value, count + 1);\n    self.ngModelCtrl.$render();\n    chromeHack(element);\n  };\n\n  // Tell the select control that an option, with the given value, has been removed\n  self.removeOption = function(value) {\n    var count = optionsMap.get(value);\n    if (count) {\n      if (count === 1) {\n        optionsMap.remove(value);\n        if (value === '') {\n          self.emptyOption = undefined;\n        }\n      } else {\n        optionsMap.put(value, count - 1);\n      }\n    }\n  };\n\n  // Check whether the select control has an option matching the given value\n  self.hasOption = function(value) {\n    return !!optionsMap.get(value);\n  };\n\n\n  self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {\n\n    if (interpolateValueFn) {\n      // The value attribute is interpolated\n      var oldVal;\n      optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {\n        if (isDefined(oldVal)) {\n          self.removeOption(oldVal);\n        }\n        oldVal = newVal;\n        self.addOption(newVal, optionElement);\n      });\n    } else if (interpolateTextFn) {\n      // The text content is interpolated\n      optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {\n        optionAttrs.$set('value', newVal);\n        if (oldVal !== newVal) {\n          self.removeOption(oldVal);\n        }\n        self.addOption(newVal, optionElement);\n      });\n    } else {\n      // The value attribute is static\n      self.addOption(optionAttrs.value, optionElement);\n    }\n\n    optionElement.on('$destroy', function() {\n      self.removeOption(optionAttrs.value);\n      self.ngModelCtrl.$render();\n    });\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name select\n * @restrict E\n *\n * @description\n * HTML `SELECT` element with angular data-binding.\n *\n * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding\n * between the scope and the `<select>` control (including setting default values).\n * It also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or\n * {@link ngOptions `ngOptions`} directives.\n *\n * When an item in the `<select>` menu is selected, the value of the selected option will be bound\n * to the model identified by the `ngModel` directive. With static or repeated options, this is\n * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.\n * If you want dynamic value attributes, you can use interpolation inside the value attribute.\n *\n * <div class=\"alert alert-warning\">\n * Note that the value of a `select` directive used without `ngOptions` is always a string.\n * When the model needs to be bound to a non-string value, you must either explicitly convert it\n * using a directive (see example below) or use `ngOptions` to specify the set of options.\n * This is because an option element can only be bound to string values at present.\n * </div>\n *\n * If the viewValue of `ngModel` does not match any of the options, then the control\n * will automatically add an \"unknown\" option, which it then removes when the mismatch is resolved.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * <div class=\"alert alert-info\">\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions\n * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression, and additionally in reducing memory and increasing speed by not creating\n * a new scope for each repeated instance.\n * </div>\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} multiple Allows multiple options to be selected. The selected values will be\n *     bound to the model as an array.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds required attribute and required validation constraint to\n * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required\n * when you want to data-bind to the required attribute.\n * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user\n *    interaction with the select element.\n * @param {string=} ngOptions sets the options that the select is populated with and defines what is\n * set on the model on selection. See {@link ngOptions `ngOptions`}.\n *\n * @example\n * ### Simple `select` elements with static options\n *\n * <example name=\"static-select\" module=\"staticSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"singleSelect\"> Single select: </label><br>\n *     <select name=\"singleSelect\" ng-model=\"data.singleSelect\">\n *       <option value=\"option-1\">Option 1</option>\n *       <option value=\"option-2\">Option 2</option>\n *     </select><br>\n *\n *     <label for=\"singleSelect\"> Single select with \"not selected\" option and dynamic option values: </label><br>\n *     <select name=\"singleSelect\" id=\"singleSelect\" ng-model=\"data.singleSelect\">\n *       <option value=\"\">---Please select---</option> <!-- not selected / blank option -->\n *       <option value=\"{{data.option1}}\">Option 1</option> <!-- interpolation -->\n *       <option value=\"option-2\">Option 2</option>\n *     </select><br>\n *     <button ng-click=\"forceUnknownOption()\">Force unknown option</button><br>\n *     <tt>singleSelect = {{data.singleSelect}}</tt>\n *\n *     <hr>\n *     <label for=\"multipleSelect\"> Multiple select: </label><br>\n *     <select name=\"multipleSelect\" id=\"multipleSelect\" ng-model=\"data.multipleSelect\" multiple>\n *       <option value=\"option-1\">Option 1</option>\n *       <option value=\"option-2\">Option 2</option>\n *       <option value=\"option-3\">Option 3</option>\n *     </select><br>\n *     <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>\n *   </form>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('staticSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       singleSelect: null,\n *       multipleSelect: [],\n *       option1: 'option-1',\n *      };\n *\n *      $scope.forceUnknownOption = function() {\n *        $scope.data.singleSelect = 'nonsense';\n *      };\n *   }]);\n * </file>\n *</example>\n *\n * ### Using `ngRepeat` to generate `select` options\n * <example name=\"ngrepeat-select\" module=\"ngrepeatSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"repeatSelect\"> Repeat select: </label>\n *     <select name=\"repeatSelect\" id=\"repeatSelect\" ng-model=\"data.repeatSelect\">\n *       <option ng-repeat=\"option in data.availableOptions\" value=\"{{option.id}}\">{{option.name}}</option>\n *     </select>\n *   </form>\n *   <hr>\n *   <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('ngrepeatSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       repeatSelect: null,\n *       availableOptions: [\n *         {id: '1', name: 'Option A'},\n *         {id: '2', name: 'Option B'},\n *         {id: '3', name: 'Option C'}\n *       ],\n *      };\n *   }]);\n * </file>\n *</example>\n *\n *\n * ### Using `select` with `ngOptions` and setting a default value\n * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.\n *\n * <example name=\"select-with-default-values\" module=\"defaultValueSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"mySelect\">Make a choice:</label>\n *     <select name=\"mySelect\" id=\"mySelect\"\n *       ng-options=\"option.name for option in data.availableOptions track by option.id\"\n *       ng-model=\"data.selectedOption\"></select>\n *   </form>\n *   <hr>\n *   <tt>option = {{data.selectedOption}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('defaultValueSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       availableOptions: [\n *         {id: '1', name: 'Option A'},\n *         {id: '2', name: 'Option B'},\n *         {id: '3', name: 'Option C'}\n *       ],\n *       selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui\n *       };\n *   }]);\n * </file>\n *</example>\n *\n *\n * ### Binding `select` to a non-string value via `ngModel` parsing / formatting\n *\n * <example name=\"select-with-non-string-options\" module=\"nonStringSelect\">\n *   <file name=\"index.html\">\n *     <select ng-model=\"model.id\" convert-to-number>\n *       <option value=\"0\">Zero</option>\n *       <option value=\"1\">One</option>\n *       <option value=\"2\">Two</option>\n *     </select>\n *     {{ model }}\n *   </file>\n *   <file name=\"app.js\">\n *     angular.module('nonStringSelect', [])\n *       .run(function($rootScope) {\n *         $rootScope.model = { id: 2 };\n *       })\n *       .directive('convertToNumber', function() {\n *         return {\n *           require: 'ngModel',\n *           link: function(scope, element, attrs, ngModel) {\n *             ngModel.$parsers.push(function(val) {\n *               return parseInt(val, 10);\n *             });\n *             ngModel.$formatters.push(function(val) {\n *               return '' + val;\n *             });\n *           }\n *         };\n *       });\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should initialize to model', function() {\n *       var select = element(by.css('select'));\n *       expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');\n *     });\n *   </file>\n * </example>\n *\n */\nvar selectDirective = function() {\n\n  return {\n    restrict: 'E',\n    require: ['select', '?ngModel'],\n    controller: SelectController,\n    priority: 1,\n    link: {\n      pre: selectPreLink,\n      post: selectPostLink\n    }\n  };\n\n  function selectPreLink(scope, element, attr, ctrls) {\n\n      // if ngModel is not defined, we don't need to do anything\n      var ngModelCtrl = ctrls[1];\n      if (!ngModelCtrl) return;\n\n      var selectCtrl = ctrls[0];\n\n      selectCtrl.ngModelCtrl = ngModelCtrl;\n\n      // When the selected item(s) changes we delegate getting the value of the select control\n      // to the `readValue` method, which can be changed if the select can have multiple\n      // selected values or if the options are being generated by `ngOptions`\n      element.on('change', function() {\n        scope.$apply(function() {\n          ngModelCtrl.$setViewValue(selectCtrl.readValue());\n        });\n      });\n\n      // If the select allows multiple values then we need to modify how we read and write\n      // values from and to the control; also what it means for the value to be empty and\n      // we have to add an extra watch since ngModel doesn't work well with arrays - it\n      // doesn't trigger rendering if only an item in the array changes.\n      if (attr.multiple) {\n\n        // Read value now needs to check each option to see if it is selected\n        selectCtrl.readValue = function readMultipleValue() {\n          var array = [];\n          forEach(element.find('option'), function(option) {\n            if (option.selected) {\n              array.push(option.value);\n            }\n          });\n          return array;\n        };\n\n        // Write value now needs to set the selected property of each matching option\n        selectCtrl.writeValue = function writeMultipleValue(value) {\n          var items = new HashMap(value);\n          forEach(element.find('option'), function(option) {\n            option.selected = isDefined(items.get(option.value));\n          });\n        };\n\n        // we have to do it on each watch since ngModel watches reference, but\n        // we need to work of an array, so we need to see if anything was inserted/removed\n        var lastView, lastViewRef = NaN;\n        scope.$watch(function selectMultipleWatch() {\n          if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {\n            lastView = shallowCopy(ngModelCtrl.$viewValue);\n            ngModelCtrl.$render();\n          }\n          lastViewRef = ngModelCtrl.$viewValue;\n        });\n\n        // If we are a multiple select then value is now a collection\n        // so the meaning of $isEmpty changes\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n\n      }\n    }\n\n    function selectPostLink(scope, element, attrs, ctrls) {\n      // if ngModel is not defined, we don't need to do anything\n      var ngModelCtrl = ctrls[1];\n      if (!ngModelCtrl) return;\n\n      var selectCtrl = ctrls[0];\n\n      // We delegate rendering to the `writeValue` method, which can be changed\n      // if the select can have multiple selected values or if the options are being\n      // generated by `ngOptions`.\n      // This must be done in the postLink fn to prevent $render to be called before\n      // all nodes have been linked correctly.\n      ngModelCtrl.$render = function() {\n        selectCtrl.writeValue(ngModelCtrl.$viewValue);\n      };\n    }\n};\n\n\n// The option directive is purely designed to communicate the existence (or lack of)\n// of dynamically created (and destroyed) option elements to their containing select\n// directive via its controller.\nvar optionDirective = ['$interpolate', function($interpolate) {\n  return {\n    restrict: 'E',\n    priority: 100,\n    compile: function(element, attr) {\n      if (isDefined(attr.value)) {\n        // If the value attribute is defined, check if it contains an interpolation\n        var interpolateValueFn = $interpolate(attr.value, true);\n      } else {\n        // If the value attribute is not defined then we fall back to the\n        // text content of the option element, which may be interpolated\n        var interpolateTextFn = $interpolate(element.text(), true);\n        if (!interpolateTextFn) {\n          attr.$set('value', element.text());\n        }\n      }\n\n      return function(scope, element, attr) {\n        // This is an optimization over using ^^ since we don't want to have to search\n        // all the way to the root of the DOM for every single option element\n        var selectCtrlName = '$selectController',\n            parent = element.parent(),\n            selectCtrl = parent.data(selectCtrlName) ||\n              parent.parent().data(selectCtrlName); // in case we are in optgroup\n\n        if (selectCtrl) {\n          selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);\n        }\n      };\n    }\n  };\n}];\n\nvar styleDirective = valueFn({\n  restrict: 'E',\n  terminal: false\n});\n\n/**\n * @ngdoc directive\n * @name ngRequired\n *\n * @description\n *\n * ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for {@link input `input`} and {@link select `select`} controls, but can also be\n * applied to custom controls.\n *\n * The directive sets the `required` attribute on the element if the Angular expression inside\n * `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we\n * cannot use interpolation inside `required`. See the {@link guide/interpolation interpolation guide}\n * for more info.\n *\n * The validator will set the `required` error key to true if the `required` attribute is set and\n * calling {@link ngModel.NgModelController#$isEmpty `NgModelController.$isEmpty`} with the\n * {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`} returns `true`. For example, the\n * `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing\n * custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.\n *\n * @example\n * <example name=\"ngRequiredDirective\" module=\"ngRequiredExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngRequiredExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.required = true;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"required\">Toggle required: </label>\n *         <input type=\"checkbox\" ng-model=\"required\" id=\"required\" />\n *         <br>\n *         <label for=\"input\">This input must be filled if `required` is true: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-required=\"required\" /><br>\n *         <hr>\n *         required error set? = <code>{{form.input.$error.required}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var required = element(by.binding('form.input.$error.required'));\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should set the required error', function() {\n         expect(required.getText()).toContain('true');\n\n         input.sendKeys('123');\n         expect(required.getText()).not.toContain('true');\n         expect(model.getText()).toContain('123');\n       });\n *   </file>\n * </example>\n */\nvar requiredDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n      attr.required = true; // force truthy in case we are on non input element\n\n      ctrl.$validators.required = function(modelValue, viewValue) {\n        return !attr.required || !ctrl.$isEmpty(viewValue);\n      };\n\n      attr.$observe('required', function() {\n        ctrl.$validate();\n      });\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngPattern\n *\n * @description\n *\n * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * does not match a RegExp which is obtained by evaluating the Angular expression given in the\n * `ngPattern` attribute value:\n * * If the expression evaluates to a RegExp object, then this is used directly.\n * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it\n * in `^` and `$` characters. For instance, `\"abc\"` will be converted to `new RegExp('^abc$')`.\n *\n * <div class=\"alert alert-info\">\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * </div>\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `pattern` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is\n *     not available.\n *   </li>\n *   <li>\n *     The `ngPattern` attribute must be an expression, while the `pattern` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngPatternDirective\" module=\"ngPatternExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngPatternExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.regex = '\\\\d+';\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"regex\">Set a pattern (regex string): </label>\n *         <input type=\"text\" ng-model=\"regex\" id=\"regex\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current pattern: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-pattern=\"regex\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default pattern', function() {\n         input.sendKeys('aaa');\n         expect(model.getText()).not.toContain('aaa');\n\n         input.clear().then(function() {\n           input.sendKeys('123');\n           expect(model.getText()).toContain('123');\n         });\n       });\n *   </file>\n * </example>\n */\nvar patternDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var regexp, patternExp = attr.ngPattern || attr.pattern;\n      attr.$observe('pattern', function(regex) {\n        if (isString(regex) && regex.length > 0) {\n          regex = new RegExp('^' + regex + '$');\n        }\n\n        if (regex && !regex.test) {\n          throw minErr('ngPattern')('noregexp',\n            'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,\n            regex, startingTag(elm));\n        }\n\n        regexp = regex || undefined;\n        ctrl.$validate();\n      });\n\n      ctrl.$validators.pattern = function(modelValue, viewValue) {\n        // HTML5 pattern constraint validates the input value, so we validate the viewValue\n        return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);\n      };\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngMaxlength\n *\n * @description\n *\n * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is longer than the integer obtained by evaluating the Angular expression given in the\n * `ngMaxlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `maxlength` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint\n *     validation is not available.\n *   </li>\n *   <li>\n *     The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMaxlengthDirective\" module=\"ngMaxlengthExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngMaxlengthExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.maxlength = 5;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"maxlength\">Set a maxlength: </label>\n *         <input type=\"number\" ng-model=\"maxlength\" id=\"maxlength\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current maxlength: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-maxlength=\"maxlength\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default maxlength', function() {\n         input.sendKeys('abcdef');\n         expect(model.getText()).not.toContain('abcdef');\n\n         input.clear().then(function() {\n           input.sendKeys('abcde');\n           expect(model.getText()).toContain('abcde');\n         });\n       });\n *   </file>\n * </example>\n */\nvar maxlengthDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var maxlength = -1;\n      attr.$observe('maxlength', function(value) {\n        var intVal = toInt(value);\n        maxlength = isNaN(intVal) ? -1 : intVal;\n        ctrl.$validate();\n      });\n      ctrl.$validators.maxlength = function(modelValue, viewValue) {\n        return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);\n      };\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngMinlength\n *\n * @description\n *\n * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is shorter than the integer obtained by evaluating the Angular expression given in the\n * `ngMinlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `minlength` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint\n *     validation is not available.\n *   </li>\n *   <li>\n *     The `ngMinlength` value must be an expression, while the `minlength` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMinlengthDirective\" module=\"ngMinlengthExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngMinlengthExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.minlength = 3;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"minlength\">Set a minlength: </label>\n *         <input type=\"number\" ng-model=\"minlength\" id=\"minlength\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current minlength: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-minlength=\"minlength\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default minlength', function() {\n         input.sendKeys('ab');\n         expect(model.getText()).not.toContain('ab');\n\n         input.sendKeys('abc');\n         expect(model.getText()).toContain('abc');\n       });\n *   </file>\n * </example>\n */\nvar minlengthDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var minlength = 0;\n      attr.$observe('minlength', function(value) {\n        minlength = toInt(value) || 0;\n        ctrl.$validate();\n      });\n      ctrl.$validators.minlength = function(modelValue, viewValue) {\n        return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;\n      };\n    }\n  };\n};\n\nif (window.angular.bootstrap) {\n  //AngularJS is already loaded, so we can return here...\n  if (window.console) {\n    console.log('WARNING: Tried to load angular more than once.');\n  }\n  return;\n}\n\n//try to bind to jquery now so that one can write jqLite(document).ready()\n//but we will rebind on bootstrap again.\nbindJQuery();\n\npublishExternalAPI(angular);\n\nangular.module(\"ngLocale\", [], [\"$provide\", function($provide) {\nvar PLURAL_CATEGORY = {ZERO: \"zero\", ONE: \"one\", TWO: \"two\", FEW: \"few\", MANY: \"many\", OTHER: \"other\"};\nfunction getDecimals(n) {\n  n = n + '';\n  var i = n.indexOf('.');\n  return (i == -1) ? 0 : n.length - i - 1;\n}\n\nfunction getVF(n, opt_precision) {\n  var v = opt_precision;\n\n  if (undefined === v) {\n    v = Math.min(getDecimals(n), 3);\n  }\n\n  var base = Math.pow(10, v);\n  var f = ((n * base) | 0) % base;\n  return {v: v, f: f};\n}\n\n$provide.value(\"$locale\", {\n  \"DATETIME_FORMATS\": {\n    \"AMPMS\": [\n      \"AM\",\n      \"PM\"\n    ],\n    \"DAY\": [\n      \"Sunday\",\n      \"Monday\",\n      \"Tuesday\",\n      \"Wednesday\",\n      \"Thursday\",\n      \"Friday\",\n      \"Saturday\"\n    ],\n    \"ERANAMES\": [\n      \"Before Christ\",\n      \"Anno Domini\"\n    ],\n    \"ERAS\": [\n      \"BC\",\n      \"AD\"\n    ],\n    \"FIRSTDAYOFWEEK\": 6,\n    \"MONTH\": [\n      \"January\",\n      \"February\",\n      \"March\",\n      \"April\",\n      \"May\",\n      \"June\",\n      \"July\",\n      \"August\",\n      \"September\",\n      \"October\",\n      \"November\",\n      \"December\"\n    ],\n    \"SHORTDAY\": [\n      \"Sun\",\n      \"Mon\",\n      \"Tue\",\n      \"Wed\",\n      \"Thu\",\n      \"Fri\",\n      \"Sat\"\n    ],\n    \"SHORTMONTH\": [\n      \"Jan\",\n      \"Feb\",\n      \"Mar\",\n      \"Apr\",\n      \"May\",\n      \"Jun\",\n      \"Jul\",\n      \"Aug\",\n      \"Sep\",\n      \"Oct\",\n      \"Nov\",\n      \"Dec\"\n    ],\n    \"STANDALONEMONTH\": [\n      \"January\",\n      \"February\",\n      \"March\",\n      \"April\",\n      \"May\",\n      \"June\",\n      \"July\",\n      \"August\",\n      \"September\",\n      \"October\",\n      \"November\",\n      \"December\"\n    ],\n    \"WEEKENDRANGE\": [\n      5,\n      6\n    ],\n    \"fullDate\": \"EEEE, MMMM d, y\",\n    \"longDate\": \"MMMM d, y\",\n    \"medium\": \"MMM d, y h:mm:ss a\",\n    \"mediumDate\": \"MMM d, y\",\n    \"mediumTime\": \"h:mm:ss a\",\n    \"short\": \"M/d/yy h:mm a\",\n    \"shortDate\": \"M/d/yy\",\n    \"shortTime\": \"h:mm a\"\n  },\n  \"NUMBER_FORMATS\": {\n    \"CURRENCY_SYM\": \"$\",\n    \"DECIMAL_SEP\": \".\",\n    \"GROUP_SEP\": \",\",\n    \"PATTERNS\": [\n      {\n        \"gSize\": 3,\n        \"lgSize\": 3,\n        \"maxFrac\": 3,\n        \"minFrac\": 0,\n        \"minInt\": 1,\n        \"negPre\": \"-\",\n        \"negSuf\": \"\",\n        \"posPre\": \"\",\n        \"posSuf\": \"\"\n      },\n      {\n        \"gSize\": 3,\n        \"lgSize\": 3,\n        \"maxFrac\": 2,\n        \"minFrac\": 2,\n        \"minInt\": 1,\n        \"negPre\": \"-\\u00a4\",\n        \"negSuf\": \"\",\n        \"posPre\": \"\\u00a4\",\n        \"posSuf\": \"\"\n      }\n    ]\n  },\n  \"id\": \"en-us\",\n  \"localeID\": \"en_US\",\n  \"pluralCat\": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (i == 1 && vf.v == 0) {    return PLURAL_CATEGORY.ONE;  }  return PLURAL_CATEGORY.OTHER;}\n});\n}]);\n\n  jqLite(document).ready(function() {\n    angularInit(document, bootstrap);\n  });\n\n})(window, document);\n\n!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type=\"text/css\">@charset \"UTF-8\";[ng\\\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/angular-ui/angular-ui-router.js",
    "content": "/**\n * State-based routing for AngularJS\n * @version v0.2.13\n * @link http://angular-ui.github.com/\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n\n/* commonjs package manager support (eg componentjs) */\nif (typeof module !== \"undefined\" && typeof exports !== \"undefined\" && module.exports === exports){\n  module.exports = 'ui.router';\n}\n\n(function (window, angular, undefined) {\n/*jshint globalstrict:true*/\n/*global angular:false*/\n'use strict';\n\nvar isDefined = angular.isDefined,\n    isFunction = angular.isFunction,\n    isString = angular.isString,\n    isObject = angular.isObject,\n    isArray = angular.isArray,\n    forEach = angular.forEach,\n    extend = angular.extend,\n    copy = angular.copy;\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, { prototype: parent }))(), extra);\n}\n\nfunction merge(dst) {\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        if (!dst.hasOwnProperty(key)) dst[key] = value;\n      });\n    }\n  });\n  return dst;\n}\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nfunction ancestors(first, second) {\n  var path = [];\n\n  for (var n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * IE8-safe wrapper for `Object.keys()`.\n *\n * @param {Object} object A JavaScript object.\n * @return {Array} Returns the keys of the object as an array.\n */\nfunction objectKeys(object) {\n  if (Object.keys) {\n    return Object.keys(object);\n  }\n  var result = [];\n\n  angular.forEach(object, function(val, key) {\n    result.push(key);\n  });\n  return result;\n}\n\n/**\n * IE8-safe wrapper for `Array.prototype.indexOf()`.\n *\n * @param {Array} array A JavaScript array.\n * @param {*} value A value to search the array for.\n * @return {Number} Returns the array index value of `value`, or `-1` if not present.\n */\nfunction indexOf(array, value) {\n  if (Array.prototype.indexOf) {\n    return array.indexOf(value, Number(arguments[2]) || 0);\n  }\n  var len = array.length >>> 0, from = Number(arguments[2]) || 0;\n  from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n\n  if (from < 0) from += len;\n\n  for (; from < len; from++) {\n    if (from in array && array[from] === value) return from;\n  }\n  return -1;\n}\n\n/**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} currentParams The value of the current state parameters ($stateParams).\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\nfunction inheritParams(currentParams, newParams, $current, $to) {\n  var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];\n\n  for (var i in parents) {\n    if (!parents[i].params) continue;\n    parentParams = objectKeys(parents[i].params);\n    if (!parentParams.length) continue;\n\n    for (var j in parentParams) {\n      if (indexOf(inheritList, parentParams[j]) >= 0) continue;\n      inheritList.push(parentParams[j]);\n      inherited[parentParams[j]] = currentParams[parentParams[j]];\n    }\n  }\n  return extend({}, inherited, newParams);\n}\n\n/**\n * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.\n *\n * @param {Object} a The first object.\n * @param {Object} b The second object.\n * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,\n *                     it defaults to the list of keys in `a`.\n * @return {Boolean} Returns `true` if the keys match, otherwise `false`.\n */\nfunction equalForKeys(a, b, keys) {\n  if (!keys) {\n    keys = [];\n    for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility\n  }\n\n  for (var i=0; i<keys.length; i++) {\n    var k = keys[i];\n    if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized\n  }\n  return true;\n}\n\n/**\n * Returns the subset of an object, based on a list of keys.\n *\n * @param {Array} keys\n * @param {Object} values\n * @return {Boolean} Returns a subset of `values`.\n */\nfunction filterByKeys(keys, values) {\n  var filtered = {};\n\n  forEach(keys, function (name) {\n    filtered[name] = values[name];\n  });\n  return filtered;\n}\n\n// like _.indexBy\n// when you know that your index values will be unique, or you want last-one-in to win\nfunction indexBy(array, propName) {\n  var result = {};\n  forEach(array, function(item) {\n    result[item[propName]] = item;\n  });\n  return result;\n}\n\n// extracted from underscore.js\n// Return a copy of the object only containing the whitelisted properties.\nfunction pick(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  forEach(keys, function(key) {\n    if (key in obj) copy[key] = obj[key];\n  });\n  return copy;\n}\n\n// extracted from underscore.js\n// Return a copy of the object omitting the blacklisted properties.\nfunction omit(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  for (var key in obj) {\n    if (indexOf(keys, key) == -1) copy[key] = obj[key];\n  }\n  return copy;\n}\n\nfunction pluck(collection, key) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = isFunction(key) ? key(val) : val[key];\n  });\n  return result;\n}\n\nfunction filter(collection, callback) {\n  var array = isArray(collection);\n  var result = array ? [] : {};\n  forEach(collection, function(val, i) {\n    if (callback(val, i)) {\n      result[array ? result.length : i] = val;\n    }\n  });\n  return result;\n}\n\nfunction map(collection, callback) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = callback(val, i);\n  });\n  return result;\n}\n\n/**\n * @ngdoc overview\n * @name ui.router.util\n *\n * @description\n * # ui.router.util sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n *\n */\nangular.module('ui.router.util', ['ng']);\n\n/**\n * @ngdoc overview\n * @name ui.router.router\n * \n * @requires ui.router.util\n *\n * @description\n * # ui.router.router sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n */\nangular.module('ui.router.router', ['ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router.state\n * \n * @requires ui.router.router\n * @requires ui.router.util\n *\n * @description\n * # ui.router.state sub-module\n *\n * This module is a dependency of the main ui.router module. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n * \n */\nangular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router\n *\n * @requires ui.router.state\n *\n * @description\n * # ui.router\n * \n * ## The main module for ui.router \n * There are several sub-modules included with the ui.router module, however only this module is needed\n * as a dependency within your angular app. The other modules are for organization purposes. \n *\n * The modules are:\n * * ui.router - the main \"umbrella\" module\n * * ui.router.router - \n * \n * *You'll need to include **only** this module as the dependency within your angular app.*\n * \n * <pre>\n * <!doctype html>\n * <html ng-app=\"myApp\">\n * <head>\n *   <script src=\"js/angular.js\"></script>\n *   <!-- Include the ui-router script -->\n *   <script src=\"js/angular-ui-router.min.js\"></script>\n *   <script>\n *     // ...and add 'ui.router' as a dependency\n *     var myApp = angular.module('myApp', ['ui.router']);\n *   </script>\n * </head>\n * <body>\n * </body>\n * </html>\n * </pre>\n */\nangular.module('ui.router', ['ui.router.state']);\n\nangular.module('ui.router.compat', ['ui.router']);\n\n/**\n * @ngdoc object\n * @name ui.router.util.$resolve\n *\n * @requires $q\n * @requires $injector\n *\n * @description\n * Manages resolution of (acyclic) graphs of promises.\n */\n$Resolve.$inject = ['$q', '$injector'];\nfunction $Resolve(  $q,    $injector) {\n  \n  var VISIT_IN_PROGRESS = 1,\n      VISIT_DONE = 2,\n      NOTHING = {},\n      NO_DEPENDENCIES = [],\n      NO_LOCALS = NOTHING,\n      NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });\n  \n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#study\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Studies a set of invocables that are likely to be used multiple times.\n   * <pre>\n   * $resolve.study(invocables)(locals, parent, self)\n   * </pre>\n   * is equivalent to\n   * <pre>\n   * $resolve.resolve(invocables, locals, parent, self)\n   * </pre>\n   * but the former is more efficient (in fact `resolve` just calls `study` \n   * internally).\n   *\n   * @param {object} invocables Invocable objects\n   * @return {function} a function to pass in locals, parent and self\n   */\n  this.study = function (invocables) {\n    if (!isObject(invocables)) throw new Error(\"'invocables' must be an object\");\n    var invocableKeys = objectKeys(invocables || {});\n    \n    // Perform a topological sort of invocables to build an ordered plan\n    var plan = [], cycle = [], visited = {};\n    function visit(value, key) {\n      if (visited[key] === VISIT_DONE) return;\n      \n      cycle.push(key);\n      if (visited[key] === VISIT_IN_PROGRESS) {\n        cycle.splice(0, indexOf(cycle, key));\n        throw new Error(\"Cyclic dependency: \" + cycle.join(\" -> \"));\n      }\n      visited[key] = VISIT_IN_PROGRESS;\n      \n      if (isString(value)) {\n        plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);\n      } else {\n        var params = $injector.annotate(value);\n        forEach(params, function (param) {\n          if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);\n        });\n        plan.push(key, value, params);\n      }\n      \n      cycle.pop();\n      visited[key] = VISIT_DONE;\n    }\n    forEach(invocables, visit);\n    invocables = cycle = visited = null; // plan is all that's required\n    \n    function isResolve(value) {\n      return isObject(value) && value.then && value.$$promises;\n    }\n    \n    return function (locals, parent, self) {\n      if (isResolve(locals) && self === undefined) {\n        self = parent; parent = locals; locals = null;\n      }\n      if (!locals) locals = NO_LOCALS;\n      else if (!isObject(locals)) {\n        throw new Error(\"'locals' must be an object\");\n      }       \n      if (!parent) parent = NO_PARENT;\n      else if (!isResolve(parent)) {\n        throw new Error(\"'parent' must be a promise returned by $resolve.resolve()\");\n      }\n      \n      // To complete the overall resolution, we have to wait for the parent\n      // promise and for the promise for each invokable in our plan.\n      var resolution = $q.defer(),\n          result = resolution.promise,\n          promises = result.$$promises = {},\n          values = extend({}, locals),\n          wait = 1 + plan.length/3,\n          merged = false;\n          \n      function done() {\n        // Merge parent values we haven't got yet and publish our own $$values\n        if (!--wait) {\n          if (!merged) merge(values, parent.$$values); \n          result.$$values = values;\n          result.$$promises = result.$$promises || true; // keep for isResolve()\n          delete result.$$inheritedValues;\n          resolution.resolve(values);\n        }\n      }\n      \n      function fail(reason) {\n        result.$$failure = reason;\n        resolution.reject(reason);\n      }\n\n      // Short-circuit if parent has already failed\n      if (isDefined(parent.$$failure)) {\n        fail(parent.$$failure);\n        return result;\n      }\n      \n      if (parent.$$inheritedValues) {\n        merge(values, omit(parent.$$inheritedValues, invocableKeys));\n      }\n\n      // Merge parent values if the parent has already resolved, or merge\n      // parent promises and wait if the parent resolve is still in progress.\n      extend(promises, parent.$$promises);\n      if (parent.$$values) {\n        merged = merge(values, omit(parent.$$values, invocableKeys));\n        result.$$inheritedValues = omit(parent.$$values, invocableKeys);\n        done();\n      } else {\n        if (parent.$$inheritedValues) {\n          result.$$inheritedValues = omit(parent.$$inheritedValues, invocableKeys);\n        }        \n        parent.then(done, fail);\n      }\n      \n      // Process each invocable in the plan, but ignore any where a local of the same name exists.\n      for (var i=0, ii=plan.length; i<ii; i+=3) {\n        if (locals.hasOwnProperty(plan[i])) done();\n        else invoke(plan[i], plan[i+1], plan[i+2]);\n      }\n      \n      function invoke(key, invocable, params) {\n        // Create a deferred for this invocation. Failures will propagate to the resolution as well.\n        var invocation = $q.defer(), waitParams = 0;\n        function onfailure(reason) {\n          invocation.reject(reason);\n          fail(reason);\n        }\n        // Wait for any parameter that we have a promise for (either from parent or from this\n        // resolve; in that case study() will have made sure it's ordered before us in the plan).\n        forEach(params, function (dep) {\n          if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {\n            waitParams++;\n            promises[dep].then(function (result) {\n              values[dep] = result;\n              if (!(--waitParams)) proceed();\n            }, onfailure);\n          }\n        });\n        if (!waitParams) proceed();\n        function proceed() {\n          if (isDefined(result.$$failure)) return;\n          try {\n            invocation.resolve($injector.invoke(invocable, self, values));\n            invocation.promise.then(function (result) {\n              values[key] = result;\n              done();\n            }, onfailure);\n          } catch (e) {\n            onfailure(e);\n          }\n        }\n        // Publish promise synchronously; invocations further down in the plan may depend on it.\n        promises[key] = invocation.promise;\n      }\n      \n      return result;\n    };\n  };\n  \n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#resolve\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Resolves a set of invocables. An invocable is a function to be invoked via \n   * `$injector.invoke()`, and can have an arbitrary number of dependencies. \n   * An invocable can either return a value directly,\n   * or a `$q` promise. If a promise is returned it will be resolved and the \n   * resulting value will be used instead. Dependencies of invocables are resolved \n   * (in this order of precedence)\n   *\n   * - from the specified `locals`\n   * - from another invocable that is part of this `$resolve` call\n   * - from an invocable that is inherited from a `parent` call to `$resolve` \n   *   (or recursively\n   * - from any ancestor `$resolve` of that parent).\n   *\n   * The return value of `$resolve` is a promise for an object that contains \n   * (in this order of precedence)\n   *\n   * - any `locals` (if specified)\n   * - the resolved return values of all injectables\n   * - any values inherited from a `parent` call to `$resolve` (if specified)\n   *\n   * The promise will resolve after the `parent` promise (if any) and all promises \n   * returned by injectables have been resolved. If any invocable \n   * (or `$injector.invoke`) throws an exception, or if a promise returned by an \n   * invocable is rejected, the `$resolve` promise is immediately rejected with the \n   * same error. A rejection of a `parent` promise (if specified) will likewise be \n   * propagated immediately. Once the `$resolve` promise has been rejected, no \n   * further invocables will be called.\n   * \n   * Cyclic dependencies between invocables are not permitted and will caues `$resolve`\n   * to throw an error. As a special case, an injectable can depend on a parameter \n   * with the same name as the injectable, which will be fulfilled from the `parent` \n   * injectable of the same name. This allows inherited values to be decorated. \n   * Note that in this case any other injectable in the same `$resolve` with the same\n   * dependency would see the decorated value, not the inherited value.\n   *\n   * Note that missing dependencies -- unlike cyclic dependencies -- will cause an \n   * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) \n   * exception.\n   *\n   * Invocables are invoked eagerly as soon as all dependencies are available. \n   * This is true even for dependencies inherited from a `parent` call to `$resolve`.\n   *\n   * As a special case, an invocable can be a string, in which case it is taken to \n   * be a service name to be passed to `$injector.get()`. This is supported primarily \n   * for backwards-compatibility with the `resolve` property of `$routeProvider` \n   * routes.\n   *\n   * @param {object} invocables functions to invoke or \n   * `$injector` services to fetch.\n   * @param {object} locals  values to make available to the injectables\n   * @param {object} parent  a promise returned by another call to `$resolve`.\n   * @param {object} self  the `this` for the invoked methods\n   * @return {object} Promise for an object that contains the resolved return value\n   * of all invocables, as well as any inherited and local values.\n   */\n  this.resolve = function (invocables, locals, parent, self) {\n    return this.study(invocables)(locals, parent, self);\n  };\n}\n\nangular.module('ui.router.util').service('$resolve', $Resolve);\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$templateFactory\n *\n * @requires $http\n * @requires $templateCache\n * @requires $injector\n *\n * @description\n * Service. Manages loading of templates.\n */\n$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];\nfunction $TemplateFactory(  $http,   $templateCache,   $injector) {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromConfig\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a configuration object. \n   *\n   * @param {object} config Configuration object for which to load a template. \n   * The following properties are search in the specified order, and the first one \n   * that is defined is used to create the template:\n   *\n   * @param {string|object} config.template html string template or function to \n   * load via {@link ui.router.util.$templateFactory#fromString fromString}.\n   * @param {string|object} config.templateUrl url to load or a function returning \n   * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.\n   * @param {Function} config.templateProvider function to invoke via \n   * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.\n   * @param {object} params  Parameters to pass to the template function.\n   * @param {object} locals Locals to pass to `invoke` if the template is loaded \n   * via a `templateProvider`. Defaults to `{ params: params }`.\n   *\n   * @return {string|object}  The template html as a string, or a promise for \n   * that string,or `null` if no template is configured.\n   */\n  this.fromConfig = function (config, params, locals) {\n    return (\n      isDefined(config.template) ? this.fromString(config.template, params) :\n      isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :\n      isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :\n      null\n    );\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromString\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param {string|object} template html template as a string or function that \n   * returns an html template as a string.\n   * @param {object} params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that \n   * string.\n   */\n  this.fromString = function (template, params) {\n    return isFunction(template) ? template(params) : template;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   * \n   * @description\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function \n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromUrl = function (url, params) {\n    if (isFunction(url)) url = url(params);\n    if (url == null) return null;\n    else return $http\n        .get(url, { cache: $templateCache, headers: { Accept: 'text/html' }})\n        .then(function(response) { return response.data; });\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromProvider\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param {Function} provider Function to invoke via `$injector.invoke`\n   * @param {Object} params Parameters for the template.\n   * @param {Object} locals Locals to pass to `invoke`. Defaults to \n   * `{ params: params }`.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromProvider = function (provider, params, locals) {\n    return $injector.invoke(provider, null, locals || { params: params });\n  };\n}\n\nangular.module('ui.router.util').service('$templateFactory', $TemplateFactory);\n\nvar $$UMFP; // reference to $UrlMatcherFactoryProvider\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:UrlMatcher\n *\n * @description\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list\n * of search parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.\n * \n * Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace\n * syntax, which optionally allows a regular expression for the parameter to be specified:\n *\n * * `':'` name - colon placeholder\n * * `'*'` name - catch-all placeholder\n * * `'{' name '}'` - curly placeholder\n * * `'{' name ':' regexp|type '}'` - curly placeholder with regexp or type name. Should the\n *   regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters). For colon \n * placeholders or curly placeholders without an explicit regexp, a path parameter matches any\n * number of characters other than '/'. For catch-all placeholders the path parameter matches\n * any number of characters.\n * \n * Examples:\n * \n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n *   in the built-in  `date` Type matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n * @param {string} pattern  The pattern to compile into a matcher.\n * @param {Object} config  A configuration object hash:\n * @param {Object=} parentMatcher Used to concatenate the pattern/config onto\n *   an existing UrlMatcher\n *\n * * `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * * `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n *\n * @property {string} prefix  A static prefix of this pattern. The matcher guarantees that any\n *   URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns\n *   non-null) will start with this prefix.\n *\n * @property {string} source  The pattern that was passed into the constructor\n *\n * @property {string} sourcePath  The path portion of the source property\n *\n * @property {string} sourceSearch  The search portion of the source property\n *\n * @property {string} regex  The constructed regex that will be used to match against the url when \n *   it is time to determine which url will match.\n *\n * @returns {Object}  New `UrlMatcher` object\n */\nfunction UrlMatcher(pattern, config, parentMatcher) {\n  config = extend({ params: {} }, isObject(config) ? config : {});\n\n  // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n  //   '*' name\n  //   ':' name\n  //   '{' name '}'\n  //   '{' name ':' regexp '}'\n  // The regular expression is somewhat complicated due to the need to allow curly braces\n  // inside the regular expression. The placeholder regexp breaks down as follows:\n  //    ([:*])([\\w\\[\\]]+)              - classic placeholder ($1 / $2) (search version has - for snake-case)\n  //    \\{([\\w\\[\\]]+)(?:\\:( ... ))?\\}  - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n  //    (?: ... | ... | ... )+         - the regexp consists of any number of atoms, an atom being either\n  //    [^{}\\\\]+                       - anything other than curly braces or backslash\n  //    \\\\.                            - a backslash escape\n  //    \\{(?:[^{}\\\\]+|\\\\.)*\\}          - a matched set of curly braces containing other atoms\n  var placeholder       = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      searchPlaceholder = /([:]?)([\\w\\[\\]-]+)|\\{([\\w\\[\\]-]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      compiled = '^', last = 0, m,\n      segments = this.segments = [],\n      parentParams = parentMatcher ? parentMatcher.params : {},\n      params = this.params = parentMatcher ? parentMatcher.params.$$new() : new $$UMFP.ParamSet(),\n      paramNames = [];\n\n  function addParameter(id, type, config, location) {\n    paramNames.push(id);\n    if (parentParams[id]) return parentParams[id];\n    if (!/^\\w+(-+\\w+)*(?:\\[\\])?$/.test(id)) throw new Error(\"Invalid parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    if (params[id]) throw new Error(\"Duplicate parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    params[id] = new $$UMFP.Param(id, type, config, location);\n    return params[id];\n  }\n\n  function quoteRegExp(string, pattern, squash) {\n    var surroundPattern = ['',''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n    if (!pattern) return result;\n    switch(squash) {\n      case false: surroundPattern = ['(', ')'];   break;\n      case true:  surroundPattern = ['?(', ')?']; break;\n      default:    surroundPattern = ['(' + squash + \"|\", ')?'];  break;\n    }\n    return result + surroundPattern[0] + pattern + surroundPattern[1];\n  }\n\n  this.source = pattern;\n\n  // Split into static segments separated by path parameter placeholders.\n  // The number of segments is always 1 more than the number of parameters.\n  function matchDetails(m, isSearch) {\n    var id, regexp, segment, type, cfg, arrayMode;\n    id          = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null\n    cfg         = config.params[id];\n    segment     = pattern.substring(last, m.index);\n    regexp      = isSearch ? m[4] : m[4] || (m[1] == '*' ? '.*' : null);\n    type        = $$UMFP.type(regexp || \"string\") || inherit($$UMFP.type(\"string\"), { pattern: new RegExp(regexp) });\n    return {\n      id: id, regexp: regexp, segment: segment, type: type, cfg: cfg\n    };\n  }\n\n  var p, param, segment;\n  while ((m = placeholder.exec(pattern))) {\n    p = matchDetails(m, false);\n    if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n    param = addParameter(p.id, p.type, p.cfg, \"path\");\n    compiled += quoteRegExp(p.segment, param.type.pattern.source, param.squash);\n    segments.push(p.segment);\n    last = placeholder.lastIndex;\n  }\n  segment = pattern.substring(last);\n\n  // Find any search parameter names and remove them from the last segment\n  var i = segment.indexOf('?');\n\n  if (i >= 0) {\n    var search = this.sourceSearch = segment.substring(i);\n    segment = segment.substring(0, i);\n    this.sourcePath = pattern.substring(0, last + i);\n\n    if (search.length > 0) {\n      last = 0;\n      while ((m = searchPlaceholder.exec(search))) {\n        p = matchDetails(m, true);\n        param = addParameter(p.id, p.type, p.cfg, \"search\");\n        last = placeholder.lastIndex;\n        // check if ?&\n      }\n    }\n  } else {\n    this.sourcePath = pattern;\n    this.sourceSearch = '';\n  }\n\n  compiled += quoteRegExp(segment) + (config.strict === false ? '\\/?' : '') + '$';\n  segments.push(segment);\n\n  this.regexp = new RegExp(compiled, config.caseInsensitive ? 'i' : undefined);\n  this.prefix = segments[0];\n  this.$$paramNames = paramNames;\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#concat\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns a new matcher for a pattern constructed by appending the path part and adding the\n * search parameters of the specified pattern to this pattern. The current pattern is not\n * modified. This can be understood as creating a pattern for URLs that are relative to (or\n * suffixes of) the current pattern.\n *\n * @example\n * The following two matchers are equivalent:\n * <pre>\n * new UrlMatcher('/user/{id}?q').concat('/details?date');\n * new UrlMatcher('/user/{id}/details?q&date');\n * </pre>\n *\n * @param {string} pattern  The pattern to append.\n * @param {Object} config  An object hash of the configuration for the matcher.\n * @returns {UrlMatcher}  A matcher for the concatenated pattern.\n */\nUrlMatcher.prototype.concat = function (pattern, config) {\n  // Because order of search parameters is irrelevant, we can add our own search\n  // parameters to the end of the new pattern. Parse the new pattern by itself\n  // and then join the bits together, but it's much easier to do this on a string level.\n  var defaultConfig = {\n    caseInsensitive: $$UMFP.caseInsensitive(),\n    strict: $$UMFP.strictMode(),\n    squash: $$UMFP.defaultSquashPolicy()\n  };\n  return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch, extend(defaultConfig, config), this);\n};\n\nUrlMatcher.prototype.toString = function () {\n  return this.source;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#exec\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Tests the specified path against this matcher, and returns an object containing the captured\n * parameter values, or null if the path does not match. The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `searchParams`. This means that search parameters are always treated\n * as optional.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n *   x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * </pre>\n *\n * @param {string} path  The URL path to match, e.g. `$location.path()`.\n * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.\n * @returns {Object}  The captured parameter values.\n */\nUrlMatcher.prototype.exec = function (path, searchParams) {\n  var m = this.regexp.exec(path);\n  if (!m) return null;\n  searchParams = searchParams || {};\n\n  var paramNames = this.parameters(), nTotal = paramNames.length,\n    nPath = this.segments.length - 1,\n    values = {}, i, j, cfg, paramName;\n\n  if (nPath !== m.length - 1) throw new Error(\"Unbalanced capture group in route '\" + this.source + \"'\");\n\n  function decodePathArray(string) {\n    function reverseString(str) { return str.split(\"\").reverse().join(\"\"); }\n    function unquoteDashes(str) { return str.replace(/\\\\-/, \"-\"); }\n\n    var split = reverseString(string).split(/-(?!\\\\)/);\n    var allReversed = map(split, reverseString);\n    return map(allReversed, unquoteDashes).reverse();\n  }\n\n  for (i = 0; i < nPath; i++) {\n    paramName = paramNames[i];\n    var param = this.params[paramName];\n    var paramVal = m[i+1];\n    // if the param value matches a pre-replace pair, replace the value before decoding.\n    for (j = 0; j < param.replace; j++) {\n      if (param.replace[j].from === paramVal) paramVal = param.replace[j].to;\n    }\n    if (paramVal && param.array === true) paramVal = decodePathArray(paramVal);\n    values[paramName] = param.value(paramVal);\n  }\n  for (/**/; i < nTotal; i++) {\n    paramName = paramNames[i];\n    values[paramName] = this.params[paramName].value(searchParams[paramName]);\n  }\n\n  return values;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#parameters\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns the names of all path and search parameters of this pattern in an unspecified order.\n * \n * @returns {Array.<string>}  An array of parameter names. Must be treated as read-only. If the\n *    pattern has no parameters, an empty array is returned.\n */\nUrlMatcher.prototype.parameters = function (param) {\n  if (!isDefined(param)) return this.$$paramNames;\n  return this.params[param] || null;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#validate\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param {Object} params The object hash of parameters to validate.\n * @returns {boolean} Returns `true` if `params` validates, otherwise `false`.\n */\nUrlMatcher.prototype.validates = function (params) {\n  return this.params.$$validates(params);\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#format\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters. Null values for path parameters are\n * treated as empty strings.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * </pre>\n *\n * @param {Object} values  the values to substitute for the parameters in this pattern.\n * @returns {string}  the formatted URL (path and optionally search part).\n */\nUrlMatcher.prototype.format = function (values) {\n  values = values || {};\n  var segments = this.segments, params = this.parameters(), paramset = this.params;\n  if (!this.validates(values)) return null;\n\n  var i, search = false, nPath = segments.length - 1, nTotal = params.length, result = segments[0];\n\n  function encodeDashes(str) { // Replace dashes with encoded \"\\-\"\n    return encodeURIComponent(str).replace(/-/g, function(c) { return '%5C%' + c.charCodeAt(0).toString(16).toUpperCase(); });\n  }\n\n  for (i = 0; i < nTotal; i++) {\n    var isPathParam = i < nPath;\n    var name = params[i], param = paramset[name], value = param.value(values[name]);\n    var isDefaultValue = param.isOptional && param.type.equals(param.value(), value);\n    var squash = isDefaultValue ? param.squash : false;\n    var encoded = param.type.encode(value);\n\n    if (isPathParam) {\n      var nextSegment = segments[i + 1];\n      if (squash === false) {\n        if (encoded != null) {\n          if (isArray(encoded)) {\n            result += map(encoded, encodeDashes).join(\"-\");\n          } else {\n            result += encodeURIComponent(encoded);\n          }\n        }\n        result += nextSegment;\n      } else if (squash === true) {\n        var capture = result.match(/\\/$/) ? /\\/?(.*)/ : /(.*)/;\n        result += nextSegment.match(capture)[1];\n      } else if (isString(squash)) {\n        result += squash + nextSegment;\n      }\n    } else {\n      if (encoded == null || (isDefaultValue && squash !== false)) continue;\n      if (!isArray(encoded)) encoded = [ encoded ];\n      encoded = map(encoded, encodeURIComponent).join('&' + name + '=');\n      result += (search ? '&' : '?') + (name + '=' + encoded);\n      search = true;\n    }\n  }\n\n  return result;\n};\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:Type\n *\n * @description\n * Implements an interface to define custom parameter types that can be decoded from and encoded to\n * string parameters matched in a URL. Used by {@link ui.router.util.type:UrlMatcher `UrlMatcher`}\n * objects when matching or formatting URLs, or comparing or validating parameter values.\n *\n * See {@link ui.router.util.$urlMatcherFactory#methods_type `$urlMatcherFactory#type()`} for more\n * information on registering custom types.\n *\n * @param {Object} config  A configuration object which contains the custom type definition.  The object's\n *        properties will override the default methods and/or pattern in `Type`'s public interface.\n * @example\n * <pre>\n * {\n *   decode: function(val) { return parseInt(val, 10); },\n *   encode: function(val) { return val && val.toString(); },\n *   equals: function(a, b) { return this.is(a) && a === b; },\n *   is: function(val) { return angular.isNumber(val) isFinite(val) && val % 1 === 0; },\n *   pattern: /\\d+/\n * }\n * </pre>\n *\n * @property {RegExp} pattern The regular expression pattern used to match values of this type when\n *           coming from a substring of a URL.\n *\n * @returns {Object}  Returns a new `Type` object.\n */\nfunction Type(config) {\n  extend(this, config);\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#is\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Detects whether a value is of a particular type. Accepts a native (decoded) value\n * and determines whether it matches the current `Type` object.\n *\n * @param {*} val  The value to check.\n * @param {string} key  Optional. If the type check is happening in the context of a specific\n *        {@link ui.router.util.type:UrlMatcher `UrlMatcher`} object, this is the name of the\n *        parameter in which `val` is stored. Can be used for meta-programming of `Type` objects.\n * @returns {Boolean}  Returns `true` if the value matches the type, otherwise `false`.\n */\nType.prototype.is = function(val, key) {\n  return true;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#encode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Encodes a custom/native type value to a string that can be embedded in a URL. Note that the\n * return value does *not* need to be URL-safe (i.e. passed through `encodeURIComponent()`), it\n * only needs to be a representation of `val` that has been coerced to a string.\n *\n * @param {*} val  The value to encode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {string}  Returns a string representation of `val` that can be encoded in a URL.\n */\nType.prototype.encode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#decode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Converts a parameter value (from URL string or transition param) to a custom/native value.\n *\n * @param {string} val  The URL parameter value to decode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {*}  Returns a custom representation of the URL parameter value.\n */\nType.prototype.decode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#equals\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Determines whether two decoded values are equivalent.\n *\n * @param {*} a  A value to compare against.\n * @param {*} b  A value to compare against.\n * @returns {Boolean}  Returns `true` if the values are equivalent/equal, otherwise `false`.\n */\nType.prototype.equals = function(a, b) {\n  return a == b;\n};\n\nType.prototype.$subPattern = function() {\n  var sub = this.pattern.toString();\n  return sub.substr(1, sub.length - 2);\n};\n\nType.prototype.pattern = /.*/;\n\nType.prototype.toString = function() { return \"{Type:\" + this.name + \"}\"; };\n\n/*\n * Wraps an existing custom Type as an array of Type, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\nType.prototype.$asArray = function(mode, isSearch) {\n  if (!mode) return this;\n  if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n  return new ArrayType(this, mode);\n\n  function ArrayType(type, mode) {\n    function bindTo(type, callbackName) {\n      return function() {\n        return type[callbackName].apply(type, arguments);\n      };\n    }\n\n    // Wrap non-array value as array\n    function arrayWrap(val) { return isArray(val) ? val : (isDefined(val) ? [ val ] : []); }\n    // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n    function arrayUnwrap(val) {\n      switch(val.length) {\n        case 0: return undefined;\n        case 1: return mode === \"auto\" ? val[0] : val;\n        default: return val;\n      }\n    }\n    function falsey(val) { return !val; }\n\n    // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n    function arrayHandler(callback, allTruthyMode) {\n      return function handleArray(val) {\n        val = arrayWrap(val);\n        var result = map(val, callback);\n        if (allTruthyMode === true)\n          return filter(result, falsey).length === 0;\n        return arrayUnwrap(result);\n      };\n    }\n\n    // Wraps type (.equals) functions to operate on each value of an array\n    function arrayEqualsHandler(callback) {\n      return function handleArray(val1, val2) {\n        var left = arrayWrap(val1), right = arrayWrap(val2);\n        if (left.length !== right.length) return false;\n        for (var i = 0; i < left.length; i++) {\n          if (!callback(left[i], right[i])) return false;\n        }\n        return true;\n      };\n    }\n\n    this.encode = arrayHandler(bindTo(type, 'encode'));\n    this.decode = arrayHandler(bindTo(type, 'decode'));\n    this.is     = arrayHandler(bindTo(type, 'is'), true);\n    this.equals = arrayEqualsHandler(bindTo(type, 'equals'));\n    this.pattern = type.pattern;\n    this.$arrayMode = mode;\n  }\n};\n\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$urlMatcherFactory\n *\n * @description\n * Factory for {@link ui.router.util.type:UrlMatcher `UrlMatcher`} instances. The factory\n * is also available to providers under the name `$urlMatcherFactoryProvider`.\n */\nfunction $UrlMatcherFactory() {\n  $$UMFP = this;\n\n  var isCaseInsensitive = false, isStrictMode = true, defaultSquashPolicy = false;\n\n  function valToString(val) { return val != null ? val.toString().replace(/\\//g, \"%2F\") : val; }\n  function valFromString(val) { return val != null ? val.toString().replace(/%2F/g, \"/\") : val; }\n//  TODO: in 1.0, make string .is() return false if value is undefined by default.\n//  function regexpMatches(val) { /*jshint validthis:true */ return isDefined(val) && this.pattern.test(val); }\n  function regexpMatches(val) { /*jshint validthis:true */ return this.pattern.test(val); }\n\n  var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = {\n    string: {\n      encode: valToString,\n      decode: valFromString,\n      is: regexpMatches,\n      pattern: /[^/]*/\n    },\n    int: {\n      encode: valToString,\n      decode: function(val) { return parseInt(val, 10); },\n      is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; },\n      pattern: /\\d+/\n    },\n    bool: {\n      encode: function(val) { return val ? 1 : 0; },\n      decode: function(val) { return parseInt(val, 10) !== 0; },\n      is: function(val) { return val === true || val === false; },\n      pattern: /0|1/\n    },\n    date: {\n      encode: function (val) {\n        if (!this.is(val))\n          return undefined;\n        return [ val.getFullYear(),\n          ('0' + (val.getMonth() + 1)).slice(-2),\n          ('0' + val.getDate()).slice(-2)\n        ].join(\"-\");\n      },\n      decode: function (val) {\n        if (this.is(val)) return val;\n        var match = this.capture.exec(val);\n        return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n      },\n      is: function(val) { return val instanceof Date && !isNaN(val.valueOf()); },\n      equals: function (a, b) { return this.is(a) && this.is(b) && a.toISOString() === b.toISOString(); },\n      pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n      capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/\n    },\n    json: {\n      encode: angular.toJson,\n      decode: angular.fromJson,\n      is: angular.isObject,\n      equals: angular.equals,\n      pattern: /[^/]*/\n    },\n    any: { // does not encode/decode\n      encode: angular.identity,\n      decode: angular.identity,\n      is: angular.identity,\n      equals: angular.equals,\n      pattern: /.*/\n    }\n  };\n\n  function getDefaultConfig() {\n    return {\n      strict: isStrictMode,\n      caseInsensitive: isCaseInsensitive\n    };\n  }\n\n  function isInjectable(value) {\n    return (isFunction(value) || (isArray(value) && isFunction(value[value.length - 1])));\n  }\n\n  /**\n   * [Internal] Get the default value of a parameter, which may be an injectable function.\n   */\n  $UrlMatcherFactory.$$getDefaultValue = function(config) {\n    if (!isInjectable(config.value)) return config.value;\n    if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n    return injector.invoke(config.value);\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#caseInsensitive\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URL matching should be case sensitive (the default behavior), or not.\n   *\n   * @param {boolean} value `false` to match URL in a case sensitive manner; otherwise `true`;\n   * @returns {boolean} the current value of caseInsensitive\n   */\n  this.caseInsensitive = function(value) {\n    if (isDefined(value))\n      isCaseInsensitive = value;\n    return isCaseInsensitive;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#strictMode\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URLs should match trailing slashes, or not (the default behavior).\n   *\n   * @param {boolean=} value `false` to match trailing slashes in URLs, otherwise `true`.\n   * @returns {boolean} the current value of strictMode\n   */\n  this.strictMode = function(value) {\n    if (isDefined(value))\n      isStrictMode = value;\n    return isStrictMode;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#defaultSquashPolicy\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Sets the default behavior when generating or matching URLs with default parameter values.\n   *\n   * @param {string} value A string that defines the default parameter URL squashing behavior.\n   *    `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL\n   *    `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the\n   *             parameter is surrounded by slashes, squash (remove) one slash from the URL\n   *    any other string, e.g. \"~\": When generating an href with a default parameter value, squash (remove)\n   *             the parameter value from the URL and replace it with this string.\n   */\n  this.defaultSquashPolicy = function(value) {\n    if (!isDefined(value)) return defaultSquashPolicy;\n    if (value !== true && value !== false && !isString(value))\n      throw new Error(\"Invalid squash policy: \" + value + \". Valid policies: false, true, arbitrary-string\");\n    defaultSquashPolicy = value;\n    return value;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#compile\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Creates a {@link ui.router.util.type:UrlMatcher `UrlMatcher`} for the specified pattern.\n   *\n   * @param {string} pattern  The URL pattern.\n   * @param {Object} config  The config object hash.\n   * @returns {UrlMatcher}  The UrlMatcher.\n   */\n  this.compile = function (pattern, config) {\n    return new UrlMatcher(pattern, extend(getDefaultConfig(), config));\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#isMatcher\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Returns true if the specified object is a `UrlMatcher`, or false otherwise.\n   *\n   * @param {Object} object  The object to perform the type check against.\n   * @returns {Boolean}  Returns `true` if the object matches the `UrlMatcher` interface, by\n   *          implementing all the same methods.\n   */\n  this.isMatcher = function (o) {\n    if (!isObject(o)) return false;\n    var result = true;\n\n    forEach(UrlMatcher.prototype, function(val, name) {\n      if (isFunction(val)) {\n        result = result && (isDefined(o[name]) && isFunction(o[name]));\n      }\n    });\n    return result;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#type\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Registers a custom {@link ui.router.util.type:Type `Type`} object that can be used to\n   * generate URLs with typed parameters.\n   *\n   * @param {string} name  The type name.\n   * @param {Object|Function} definition   The type definition. See\n   *        {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   * @param {Object|Function} definitionFn (optional) A function that is injected before the app\n   *        runtime starts.  The result of this function is merged into the existing `definition`.\n   *        See {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   *\n   * @returns {Object}  Returns `$urlMatcherFactoryProvider`.\n   *\n   * @example\n   * This is a simple example of a custom type that encodes and decodes items from an\n   * array, using the array index as the URL-encoded value:\n   *\n   * <pre>\n   * var list = ['John', 'Paul', 'George', 'Ringo'];\n   *\n   * $urlMatcherFactoryProvider.type('listItem', {\n   *   encode: function(item) {\n   *     // Represent the list item in the URL using its corresponding index\n   *     return list.indexOf(item);\n   *   },\n   *   decode: function(item) {\n   *     // Look up the list item by index\n   *     return list[parseInt(item, 10)];\n   *   },\n   *   is: function(item) {\n   *     // Ensure the item is valid by checking to see that it appears\n   *     // in the list\n   *     return list.indexOf(item) > -1;\n   *   }\n   * });\n   *\n   * $stateProvider.state('list', {\n   *   url: \"/list/{item:listItem}\",\n   *   controller: function($scope, $stateParams) {\n   *     console.log($stateParams.item);\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * // Changes URL to '/list/3', logs \"Ringo\" to the console\n   * $state.go('list', { item: \"Ringo\" });\n   * </pre>\n   *\n   * This is a more complex example of a type that relies on dependency injection to\n   * interact with services, and uses the parameter name from the URL to infer how to\n   * handle encoding and decoding parameter values:\n   *\n   * <pre>\n   * // Defines a custom type that gets a value from a service,\n   * // where each service gets different types of values from\n   * // a backend API:\n   * $urlMatcherFactoryProvider.type('dbObject', {}, function(Users, Posts) {\n   *\n   *   // Matches up services to URL parameter names\n   *   var services = {\n   *     user: Users,\n   *     post: Posts\n   *   };\n   *\n   *   return {\n   *     encode: function(object) {\n   *       // Represent the object in the URL using its unique ID\n   *       return object.id;\n   *     },\n   *     decode: function(value, key) {\n   *       // Look up the object by ID, using the parameter\n   *       // name (key) to call the correct service\n   *       return services[key].findById(value);\n   *     },\n   *     is: function(object, key) {\n   *       // Check that object is a valid dbObject\n   *       return angular.isObject(object) && object.id && services[key];\n   *     }\n   *     equals: function(a, b) {\n   *       // Check the equality of decoded objects by comparing\n   *       // their unique IDs\n   *       return a.id === b.id;\n   *     }\n   *   };\n   * });\n   *\n   * // In a config() block, you can then attach URLs with\n   * // type-annotated parameters:\n   * $stateProvider.state('users', {\n   *   url: \"/users\",\n   *   // ...\n   * }).state('users.item', {\n   *   url: \"/{user:dbObject}\",\n   *   controller: function($scope, $stateParams) {\n   *     // $stateParams.user will now be an object returned from\n   *     // the Users service\n   *   },\n   *   // ...\n   * });\n   * </pre>\n   */\n  this.type = function (name, definition, definitionFn) {\n    if (!isDefined(definition)) return $types[name];\n    if ($types.hasOwnProperty(name)) throw new Error(\"A type named '\" + name + \"' has already been defined.\");\n\n    $types[name] = new Type(extend({ name: name }, definition));\n    if (definitionFn) {\n      typeQueue.push({ name: name, def: definitionFn });\n      if (!enqueue) flushTypeQueue();\n    }\n    return this;\n  };\n\n  // `flushTypeQueue()` waits until `$urlMatcherFactory` is injected before invoking the queued `definitionFn`s\n  function flushTypeQueue() {\n    while(typeQueue.length) {\n      var type = typeQueue.shift();\n      if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n      angular.extend($types[type.name], injector.invoke(type.def));\n    }\n  }\n\n  // Register default types. Store them in the prototype of $types.\n  forEach(defaultTypes, function(type, name) { $types[name] = new Type(extend({name: name}, type)); });\n  $types = inherit($types, {});\n\n  /* No need to document $get, since it returns this */\n  this.$get = ['$injector', function ($injector) {\n    injector = $injector;\n    enqueue = false;\n    flushTypeQueue();\n\n    forEach(defaultTypes, function(type, name) {\n      if (!$types[name]) $types[name] = new Type(type);\n    });\n    return this;\n  }];\n\n  this.Param = function Param(id, type, config, location) {\n    var self = this;\n    config = unwrapShorthand(config);\n    type = getType(config, type, location);\n    var arrayMode = getArrayMode();\n    type = arrayMode ? type.$asArray(arrayMode, location === \"search\") : type;\n    if (type.name === \"string\" && !arrayMode && location === \"path\" && config.value === undefined)\n      config.value = \"\"; // for 0.2.x; in 0.3.0+ do not automatically default to \"\"\n    var isOptional = config.value !== undefined;\n    var squash = getSquashPolicy(config, isOptional);\n    var replace = getReplace(config, arrayMode, isOptional, squash);\n\n    function unwrapShorthand(config) {\n      var keys = isObject(config) ? objectKeys(config) : [];\n      var isShorthand = indexOf(keys, \"value\") === -1 && indexOf(keys, \"type\") === -1 &&\n                        indexOf(keys, \"squash\") === -1 && indexOf(keys, \"array\") === -1;\n      if (isShorthand) config = { value: config };\n      config.$$fn = isInjectable(config.value) ? config.value : function () { return config.value; };\n      return config;\n    }\n\n    function getType(config, urlType, location) {\n      if (config.type && urlType) throw new Error(\"Param '\"+id+\"' has two type configurations.\");\n      if (urlType) return urlType;\n      if (!config.type) return (location === \"config\" ? $types.any : $types.string);\n      return config.type instanceof Type ? config.type : new Type(config.type);\n    }\n\n    // array config: param name (param[]) overrides default settings.  explicit config overrides param name.\n    function getArrayMode() {\n      var arrayDefaults = { array: (location === \"search\" ? \"auto\" : false) };\n      var arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n      return extend(arrayDefaults, arrayParamNomenclature, config).array;\n    }\n\n    /**\n     * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n     */\n    function getSquashPolicy(config, isOptional) {\n      var squash = config.squash;\n      if (!isOptional || squash === false) return false;\n      if (!isDefined(squash) || squash == null) return defaultSquashPolicy;\n      if (squash === true || isString(squash)) return squash;\n      throw new Error(\"Invalid squash policy: '\" + squash + \"'. Valid policies: false, true, or arbitrary string\");\n    }\n\n    function getReplace(config, arrayMode, isOptional, squash) {\n      var replace, configuredKeys, defaultPolicy = [\n        { from: \"\",   to: (isOptional || arrayMode ? undefined : \"\") },\n        { from: null, to: (isOptional || arrayMode ? undefined : \"\") }\n      ];\n      replace = isArray(config.replace) ? config.replace : [];\n      if (isString(squash))\n        replace.push({ from: squash, to: undefined });\n      configuredKeys = map(replace, function(item) { return item.from; } );\n      return filter(defaultPolicy, function(item) { return indexOf(configuredKeys, item.from) === -1; }).concat(replace);\n    }\n\n    /**\n     * [Internal] Get the default value of a parameter, which may be an injectable function.\n     */\n    function $$getDefaultValue() {\n      if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n      return injector.invoke(config.$$fn);\n    }\n\n    /**\n     * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n     * default value, which may be the result of an injectable function.\n     */\n    function $value(value) {\n      function hasReplaceVal(val) { return function(obj) { return obj.from === val; }; }\n      function $replace(value) {\n        var replacement = map(filter(self.replace, hasReplaceVal(value)), function(obj) { return obj.to; });\n        return replacement.length ? replacement[0] : value;\n      }\n      value = $replace(value);\n      return isDefined(value) ? self.type.decode(value) : $$getDefaultValue();\n    }\n\n    function toString() { return \"{Param:\" + id + \" \" + type + \" squash: '\" + squash + \"' optional: \" + isOptional + \"}\"; }\n\n    extend(this, {\n      id: id,\n      type: type,\n      location: location,\n      array: arrayMode,\n      squash: squash,\n      replace: replace,\n      isOptional: isOptional,\n      value: $value,\n      dynamic: undefined,\n      config: config,\n      toString: toString\n    });\n  };\n\n  function ParamSet(params) {\n    extend(this, params || {});\n  }\n\n  ParamSet.prototype = {\n    $$new: function() {\n      return inherit(this, extend(new ParamSet(), { $$parent: this}));\n    },\n    $$keys: function () {\n      var keys = [], chain = [], parent = this,\n        ignore = objectKeys(ParamSet.prototype);\n      while (parent) { chain.push(parent); parent = parent.$$parent; }\n      chain.reverse();\n      forEach(chain, function(paramset) {\n        forEach(objectKeys(paramset), function(key) {\n            if (indexOf(keys, key) === -1 && indexOf(ignore, key) === -1) keys.push(key);\n        });\n      });\n      return keys;\n    },\n    $$values: function(paramValues) {\n      var values = {}, self = this;\n      forEach(self.$$keys(), function(key) {\n        values[key] = self[key].value(paramValues && paramValues[key]);\n      });\n      return values;\n    },\n    $$equals: function(paramValues1, paramValues2) {\n      var equal = true, self = this;\n      forEach(self.$$keys(), function(key) {\n        var left = paramValues1 && paramValues1[key], right = paramValues2 && paramValues2[key];\n        if (!self[key].type.equals(left, right)) equal = false;\n      });\n      return equal;\n    },\n    $$validates: function $$validate(paramValues) {\n      var result = true, isOptional, val, param, self = this;\n\n      forEach(this.$$keys(), function(key) {\n        param = self[key];\n        val = paramValues[key];\n        isOptional = !val && param.isOptional;\n        result = result && (isOptional || !!param.type.is(val));\n      });\n      return result;\n    },\n    $$parent: undefined\n  };\n\n  this.ParamSet = ParamSet;\n}\n\n// Register as a provider so it's available to other providers\nangular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);\nangular.module('ui.router.util').run(['$urlMatcherFactory', function($urlMatcherFactory) { }]);\n\n/**\n * @ngdoc object\n * @name ui.router.router.$urlRouterProvider\n *\n * @requires ui.router.util.$urlMatcherFactoryProvider\n * @requires $locationProvider\n *\n * @description\n * `$urlRouterProvider` has the responsibility of watching `$location`. \n * When `$location` changes it runs through a list of rules one by one until a \n * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify \n * a url in a state configuration. All urls are compiled into a UrlMatcher object.\n *\n * There are several methods on `$urlRouterProvider` that make it useful to use directly\n * in your module config.\n */\n$UrlRouterProvider.$inject = ['$locationProvider', '$urlMatcherFactoryProvider'];\nfunction $UrlRouterProvider(   $locationProvider,   $urlMatcherFactory) {\n  var rules = [], otherwise = null, interceptDeferred = false, listener;\n\n  // Returns a string that is a prefix of all strings matching the RegExp\n  function regExpPrefix(re) {\n    var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n    return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n  }\n\n  // Interpolates matched values into a String.replace()-style pattern\n  function interpolate(pattern, match) {\n    return pattern.replace(/\\$(\\$|\\d{1,2})/, function (m, what) {\n      return match[what === '$' ? 0 : Number(what)];\n    });\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#rule\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines rules that are used by `$urlRouterProvider` to find matches for\n   * specific URLs.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {object} rule Handler function that takes `$injector` and `$location`\n   * services as arguments. You can use them to return a valid path as a string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.rule = function (rule) {\n    if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    rules.push(rule);\n    return this;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouterProvider#otherwise\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines a path that is used when an invalid route is requested.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     return '/a/valid/url';\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} rule The url path you want to redirect to or a function \n   * rule that returns the url path. The function version is passed two params: \n   * `$injector` and `$location` services, and must return a url string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.otherwise = function (rule) {\n    if (isString(rule)) {\n      var redirect = rule;\n      rule = function () { return redirect; };\n    }\n    else if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    otherwise = rule;\n    return this;\n  };\n\n\n  function handleIfMatch($injector, handler, match) {\n    if (!match) return false;\n    var result = $injector.invoke(handler, handler, { $match: match });\n    return isDefined(result) ? result : true;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#when\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Registers a handler for a given url matching. if handle is a string, it is\n   * treated as a redirect, and is interpolated according to the syntax of match\n   * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n   *\n   * If the handler is a function, it is injectable. It gets invoked if `$location`\n   * matches. You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when = function (what, handler) {\n    var redirect, handlerIsString = isString(handler);\n    if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n    if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n      throw new Error(\"invalid 'handler' in when()\");\n\n    var strategies = {\n      matcher: function (what, handler) {\n        if (handlerIsString) {\n          redirect = $urlMatcherFactory.compile(handler);\n          handler = ['$match', function ($match) { return redirect.format($match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n        }, {\n          prefix: isString(what.prefix) ? what.prefix : ''\n        });\n      },\n      regex: function (what, handler) {\n        if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n        if (handlerIsString) {\n          redirect = handler;\n          handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path()));\n        }, {\n          prefix: regExpPrefix(what)\n        });\n      }\n    };\n\n    var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n    for (var n in check) {\n      if (check[n]) return this.rule(strategies[n](what, handler));\n    }\n\n    throw new Error(\"invalid 'what' in when()\");\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#deferIntercept\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Disables (or enables) deferring location change interception.\n   *\n   * If you wish to customize the behavior of syncing the URL (for example, if you wish to\n   * defer a transition but maintain the current URL), call this method at configuration time.\n   * Then, at run time, call `$urlRouter.listen()` after you have configured your own\n   * `$locationChangeSuccess` event handler.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *\n   *   // Prevent $urlRouter from automatically intercepting URL changes;\n   *   // this allows you to configure custom behavior in between\n   *   // location changes and route synchronization:\n   *   $urlRouterProvider.deferIntercept();\n   *\n   * }).run(function ($rootScope, $urlRouter, UserService) {\n   *\n   *   $rootScope.$on('$locationChangeSuccess', function(e) {\n   *     // UserService is an example service for managing user state\n   *     if (UserService.isLoggedIn()) return;\n   *\n   *     // Prevent $urlRouter's default handler from firing\n   *     e.preventDefault();\n   *\n   *     UserService.handleLogin().then(function() {\n   *       // Once the user has logged in, sync the current URL\n   *       // to the router:\n   *       $urlRouter.sync();\n   *     });\n   *   });\n   *\n   *   // Configures $urlRouter's listener *after* your custom listener\n   *   $urlRouter.listen();\n   * });\n   * </pre>\n   *\n   * @param {boolean} defer Indicates whether to defer location change interception. Passing\n            no parameter is equivalent to `true`.\n   */\n  this.deferIntercept = function (defer) {\n    if (defer === undefined) defer = true;\n    interceptDeferred = defer;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouter\n   *\n   * @requires $location\n   * @requires $rootScope\n   * @requires $injector\n   * @requires $browser\n   *\n   * @description\n   *\n   */\n  this.$get = $get;\n  $get.$inject = ['$location', '$rootScope', '$injector', '$browser'];\n  function $get(   $location,   $rootScope,   $injector,   $browser) {\n\n    var baseHref = $browser.baseHref(), location = $location.url(), lastPushedUrl;\n\n    function appendBasePath(url, isHtml5, absolute) {\n      if (baseHref === '/') return url;\n      if (isHtml5) return baseHref.slice(0, -1) + url;\n      if (absolute) return baseHref.slice(1) + url;\n      return url;\n    }\n\n    // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree\n    function update(evt) {\n      if (evt && evt.defaultPrevented) return;\n      var ignoreUpdate = lastPushedUrl && $location.url() === lastPushedUrl;\n      lastPushedUrl = undefined;\n      if (ignoreUpdate) return true;\n\n      function check(rule) {\n        var handled = rule($injector, $location);\n\n        if (!handled) return false;\n        if (isString(handled)) $location.replace().url(handled);\n        return true;\n      }\n      var n = rules.length, i;\n\n      for (i = 0; i < n; i++) {\n        if (check(rules[i])) return;\n      }\n      // always check otherwise last to allow dynamic updates to the set of rules\n      if (otherwise) check(otherwise);\n    }\n\n    function listen() {\n      listener = listener || $rootScope.$on('$locationChangeSuccess', update);\n      return listener;\n    }\n\n    if (!interceptDeferred) listen();\n\n    return {\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#sync\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.\n       * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event,\n       * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed\n       * with the transition by calling `$urlRouter.sync()`.\n       *\n       * @example\n       * <pre>\n       * angular.module('app', ['ui.router'])\n       *   .run(function($rootScope, $urlRouter) {\n       *     $rootScope.$on('$locationChangeSuccess', function(evt) {\n       *       // Halt state change from even starting\n       *       evt.preventDefault();\n       *       // Perform custom logic\n       *       var meetsRequirement = ...\n       *       // Continue with the update and state transition if logic allows\n       *       if (meetsRequirement) $urlRouter.sync();\n       *     });\n       * });\n       * </pre>\n       */\n      sync: function() {\n        update();\n      },\n\n      listen: function() {\n        return listen();\n      },\n\n      update: function(read) {\n        if (read) {\n          location = $location.url();\n          return;\n        }\n        if ($location.url() === location) return;\n\n        $location.url(location);\n        $location.replace();\n      },\n\n      push: function(urlMatcher, params, options) {\n        $location.url(urlMatcher.format(params || {}));\n        lastPushedUrl = options && options.$$avoidResync ? $location.url() : undefined;\n        if (options && options.replace) $location.replace();\n      },\n\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#href\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * A URL generation method that returns the compiled URL for a given\n       * {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters.\n       *\n       * @example\n       * <pre>\n       * $bob = $urlRouter.href(new UrlMatcher(\"/about/:person\"), {\n       *   person: \"bob\"\n       * });\n       * // $bob == \"/about/bob\";\n       * </pre>\n       *\n       * @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate.\n       * @param {object=} params An object of parameter values to fill the matcher's required parameters.\n       * @param {object=} options Options object. The options are:\n       *\n       * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n       *\n       * @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n       */\n      href: function(urlMatcher, params, options) {\n        if (!urlMatcher.validates(params)) return null;\n\n        var isHtml5 = $locationProvider.html5Mode();\n        if (angular.isObject(isHtml5)) {\n          isHtml5 = isHtml5.enabled;\n        }\n        \n        var url = urlMatcher.format(params);\n        options = options || {};\n\n        if (!isHtml5 && url !== null) {\n          url = \"#\" + $locationProvider.hashPrefix() + url;\n        }\n        url = appendBasePath(url, isHtml5, options.absolute);\n\n        if (!options.absolute || !url) {\n          return url;\n        }\n\n        var slash = (!isHtml5 && url ? '/' : ''), port = $location.port();\n        port = (port === 80 || port === 443 ? '' : ':' + port);\n\n        return [$location.protocol(), '://', $location.host(), port, slash, url].join('');\n      }\n    };\n  }\n}\n\nangular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$stateProvider\n *\n * @requires ui.router.router.$urlRouterProvider\n * @requires ui.router.util.$urlMatcherFactoryProvider\n *\n * @description\n * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\n$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider'];\nfunction $StateProvider(   $urlRouterProvider,   $urlMatcherFactory) {\n\n  var root, states = {}, $state, queue = {}, abstractKey = 'abstract';\n\n  // Builds state properties from definition passed to registerState()\n  var stateBuilder = {\n\n    // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.\n    // state.children = [];\n    // if (parent) parent.children.push(state);\n    parent: function(state) {\n      if (isDefined(state.parent) && state.parent) return findState(state.parent);\n      // regex matches any valid composite state name\n      // would match \"contact.list\" but not \"contacts\"\n      var compositeName = /^(.+)\\.[^.]+$/.exec(state.name);\n      return compositeName ? findState(compositeName[1]) : root;\n    },\n\n    // inherit 'data' from parent and override by own values (if any)\n    data: function(state) {\n      if (state.parent && state.parent.data) {\n        state.data = state.self.data = extend({}, state.parent.data, state.data);\n      }\n      return state.data;\n    },\n\n    // Build a URLMatcher if necessary, either via a relative or absolute URL\n    url: function(state) {\n      var url = state.url, config = { params: state.params || {} };\n\n      if (isString(url)) {\n        if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);\n        return (state.parent.navigable || root).url.concat(url, config);\n      }\n\n      if (!url || $urlMatcherFactory.isMatcher(url)) return url;\n      throw new Error(\"Invalid url '\" + url + \"' in state '\" + state + \"'\");\n    },\n\n    // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n    navigable: function(state) {\n      return state.url ? state : (state.parent ? state.parent.navigable : null);\n    },\n\n    // Own parameters for this state. state.url.params is already built at this point. Create and add non-url params\n    ownParams: function(state) {\n      var params = state.url && state.url.params || new $$UMFP.ParamSet();\n      forEach(state.params || {}, function(config, id) {\n        if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, \"config\");\n      });\n      return params;\n    },\n\n    // Derive parameters for this state and ensure they're a super-set of parent's parameters\n    params: function(state) {\n      return state.parent && state.parent.params ? extend(state.parent.params.$$new(), state.ownParams) : new $$UMFP.ParamSet();\n    },\n\n    // If there is no explicit multi-view configuration, make one up so we don't have\n    // to handle both cases in the view directive later. Note that having an explicit\n    // 'views' property will mean the default unnamed view properties are ignored. This\n    // is also a good time to resolve view names to absolute names, so everything is a\n    // straight lookup at link time.\n    views: function(state) {\n      var views = {};\n\n      forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {\n        if (name.indexOf('@') < 0) name += '@' + state.parent.name;\n        views[name] = view;\n      });\n      return views;\n    },\n\n    // Keep a full path from the root down to this state as this is needed for state activation.\n    path: function(state) {\n      return state.parent ? state.parent.path.concat(state) : []; // exclude root from path\n    },\n\n    // Speed up $state.contains() as it's used a lot\n    includes: function(state) {\n      var includes = state.parent ? extend({}, state.parent.includes) : {};\n      includes[state.name] = true;\n      return includes;\n    },\n\n    $delegates: {}\n  };\n\n  function isRelative(stateName) {\n    return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n  }\n\n  function findState(stateOrName, base) {\n    if (!stateOrName) return undefined;\n\n    var isStr = isString(stateOrName),\n        name  = isStr ? stateOrName : stateOrName.name,\n        path  = isRelative(name);\n\n    if (path) {\n      if (!base) throw new Error(\"No reference point given for path '\"  + name + \"'\");\n      base = findState(base);\n      \n      var rel = name.split(\".\"), i = 0, pathLength = rel.length, current = base;\n\n      for (; i < pathLength; i++) {\n        if (rel[i] === \"\" && i === 0) {\n          current = base;\n          continue;\n        }\n        if (rel[i] === \"^\") {\n          if (!current.parent) throw new Error(\"Path '\" + name + \"' not valid for state '\" + base.name + \"'\");\n          current = current.parent;\n          continue;\n        }\n        break;\n      }\n      rel = rel.slice(i).join(\".\");\n      name = current.name + (current.name && rel ? \".\" : \"\") + rel;\n    }\n    var state = states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    }\n    return undefined;\n  }\n\n  function queueState(parentName, state) {\n    if (!queue[parentName]) {\n      queue[parentName] = [];\n    }\n    queue[parentName].push(state);\n  }\n\n  function flushQueuedChildren(parentName) {\n    var queued = queue[parentName] || [];\n    while(queued.length) {\n      registerState(queued.shift());\n    }\n  }\n\n  function registerState(state) {\n    // Wrap a new object around the state so we can store our private details easily.\n    state = inherit(state, {\n      self: state,\n      resolve: state.resolve || {},\n      toString: function() { return this.name; }\n    });\n\n    var name = state.name;\n    if (!isString(name) || name.indexOf('@') >= 0) throw new Error(\"State must have a valid name\");\n    if (states.hasOwnProperty(name)) throw new Error(\"State '\" + name + \"'' is already defined\");\n\n    // Get parent name\n    var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))\n        : (isString(state.parent)) ? state.parent\n        : (isObject(state.parent) && isString(state.parent.name)) ? state.parent.name\n        : '';\n\n    // If parent is not registered yet, add state to queue and register later\n    if (parentName && !states[parentName]) {\n      return queueState(parentName, state.self);\n    }\n\n    for (var key in stateBuilder) {\n      if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);\n    }\n    states[name] = state;\n\n    // Register the state in the global state list and with $urlRouter if necessary.\n    if (!state[abstractKey] && state.url) {\n      $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {\n        if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {\n          $state.transitionTo(state, $match, { inherit: true, location: false });\n        }\n      }]);\n    }\n\n    // Register any queued children\n    flushQueuedChildren(name);\n\n    return state;\n  }\n\n  // Checks text to see if it looks like a glob.\n  function isGlob (text) {\n    return text.indexOf('*') > -1;\n  }\n\n  // Returns true if glob matches current $state name.\n  function doesStateMatchGlob (glob) {\n    var globSegments = glob.split('.'),\n        segments = $state.$current.name.split('.');\n\n    //match greedy starts\n    if (globSegments[0] === '**') {\n       segments = segments.slice(indexOf(segments, globSegments[1]));\n       segments.unshift('**');\n    }\n    //match greedy ends\n    if (globSegments[globSegments.length - 1] === '**') {\n       segments.splice(indexOf(segments, globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);\n       segments.push('**');\n    }\n\n    if (globSegments.length != segments.length) {\n      return false;\n    }\n\n    //match single stars\n    for (var i = 0, l = globSegments.length; i < l; i++) {\n      if (globSegments[i] === '*') {\n        segments[i] = '*';\n      }\n    }\n\n    return segments.join('') === globSegments.join('');\n  }\n\n\n  // Implicit root state that is always active\n  root = registerState({\n    name: '',\n    url: '^',\n    views: null,\n    'abstract': true\n  });\n  root.navigable = null;\n\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#decorator\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Allows you to extend (carefully) or override (at your own peril) the \n   * `stateBuilder` object used internally by `$stateProvider`. This can be used \n   * to add custom functionality to ui-router, for example inferring templateUrl \n   * based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new \n   * properties within the state's internal definition. There is currently no clear \n   * use-case for this beyond accessing internal states (i.e. $state.$current), \n   * however, expect this to become increasingly relevant as we introduce additional \n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of \n   * execution of the builder functions in non-deterministic. Builder functions \n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n   *   or `null`.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is \n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to \n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view \n   *   name (i.e. \"viewName@stateName\") and each value is the config object \n   *   (template, controller) for the view. Even when you don't use the views object \n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template \n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state, \n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state. \n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that \n   *   would pass a `$state.includes()` test.\n   *\n   * @example\n   * <pre>\n   * // Override the internal 'views' builder with a function that takes the state\n   * // definition, and a reference to the internal function being overridden:\n   * $stateProvider.decorator('views', function (state, parent) {\n   *   var result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(views, function (config, name) {\n   *     var autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * $state.go('home');\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * </pre>\n   *\n   * @param {string} name The name of the builder function to decorate. \n   * @param {object} func A function that is responsible for decorating the original \n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  this.decorator = decorator;\n  function decorator(name, func) {\n    /*jshint validthis: true */\n    if (isString(name) && !isDefined(func)) {\n      return stateBuilder[name];\n    }\n    if (!isFunction(func) || !isString(name)) {\n      return this;\n    }\n    if (stateBuilder[name] && !stateBuilder.$delegates[name]) {\n      stateBuilder.$delegates[name] = stateBuilder[name];\n    }\n    stateBuilder[name] = func;\n    return this;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#state\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Registers a state configuration under a given state name. The stateConfig object\n   * has the following acceptable properties.\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} stateConfig State configuration object.\n   * @param {string|function=} stateConfig.template\n   * <a id='template'></a>\n   *   html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property \n   *   takes precedence over templateUrl.\n   *   \n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <pre>template:\n   *   \"<h1>inline template definition</h1>\" +\n   *   \"<div ui-view></div>\"</pre>\n   * <pre>template: function(params) {\n   *       return \"<h1>generated template</h1>\"; }</pre>\n   * </div>\n   *\n   * @param {string|function=} stateConfig.templateUrl\n   * <a id='templateUrl'></a>\n   *\n   *   path or function that returns a path to an html\n   *   template that should be used by uiView.\n   *   \n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by \n   *     applying the current state\n   *\n   * <pre>templateUrl: \"home.html\"</pre>\n   * <pre>templateUrl: function(params) {\n   *     return myTemplates[params.pageId]; }</pre>\n   *\n   * @param {function=} stateConfig.templateProvider\n   * <a id='templateProvider'></a>\n   *    Provider function that returns HTML content string.\n   * <pre> templateProvider:\n   *       function(MyTemplateService, params) {\n   *         return MyTemplateService.getTemplate(params.pageId);\n   *       }</pre>\n   *\n   * @param {string|function=} stateConfig.controller\n   * <a id='controller'></a>\n   *\n   *  Controller fn that should be associated with newly\n   *   related scope or the name of a registered controller if passed as a string.\n   *   Optionally, the ControllerAs may be declared here.\n   * <pre>controller: \"MyRegisteredController\"</pre>\n   * <pre>controller:\n   *     \"MyRegisteredController as fooCtrl\"}</pre>\n   * <pre>controller: function($scope, MyService) {\n   *     $scope.data = MyService.getData(); }</pre>\n   *\n   * @param {function=} stateConfig.controllerProvider\n   * <a id='controllerProvider'></a>\n   *\n   * Injectable provider function that returns the actual controller or string.\n   * <pre>controllerProvider:\n   *   function(MyResolveData) {\n   *     if (MyResolveData.foo)\n   *       return \"FooCtrl\"\n   *     else if (MyResolveData.bar)\n   *       return \"BarCtrl\";\n   *     else return function($scope) {\n   *       $scope.baz = \"Qux\";\n   *     }\n   *   }</pre>\n   *\n   * @param {string=} stateConfig.controllerAs\n   * <a id='controllerAs'></a>\n   * \n   * A controller alias name. If present the controller will be\n   *   published to scope under the controllerAs name.\n   * <pre>controllerAs: \"myCtrl\"</pre>\n   *\n   * @param {object=} stateConfig.resolve\n   * <a id='resolve'></a>\n   *\n   * An optional map&lt;string, function&gt; of dependencies which\n   *   should be injected into the controller. If any of these dependencies are promises, \n   *   the router will wait for them all to be resolved before the controller is instantiated.\n   *   If all the promises are resolved successfully, the $stateChangeSuccess event is fired\n   *   and the values of the resolved promises are injected into any controllers that reference them.\n   *   If any  of the promises are rejected the $stateChangeError event is fired.\n   *\n   *   The map object is:\n   *   \n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function, \n   *     it is injected and return value it treated as dependency. If result is a promise, it is \n   *     resolved before its value is injected into controller.\n   *\n   * <pre>resolve: {\n   *     myResolve1:\n   *       function($http, $stateParams) {\n   *         return $http.get(\"/api/foos/\"+stateParams.fooID);\n   *       }\n   *     }</pre>\n   *\n   * @param {string=} stateConfig.url\n   * <a id='url'></a>\n   *\n   *   A url fragment with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any \n   *   parameters that were passed.\n   *\n   * examples:\n   * <pre>url: \"/home\"\n   * url: \"/users/:userid\"\n   * url: \"/books/{bookid:[a-zA-Z_-]}\"\n   * url: \"/books/{categoryid:int}\"\n   * url: \"/books/{publishername:string}/{categoryid:int}\"\n   * url: \"/messages?before&after\"\n   * url: \"/messages?{before:date}&{after:date}\"</pre>\n   * url: \"/messages/:mailboxid?{before:date}&{after:date}\"\n   *\n   * @param {object=} stateConfig.views\n   * <a id='views'></a>\n   * an optional map&lt;string, object&gt; which defined multiple views, or targets views\n   * manually/explicitly.\n   *\n   * Examples:\n   *\n   * Targets three named `ui-view`s in the parent state's template\n   * <pre>views: {\n   *     header: {\n   *       controller: \"headerCtrl\",\n   *       templateUrl: \"header.html\"\n   *     }, body: {\n   *       controller: \"bodyCtrl\",\n   *       templateUrl: \"body.html\"\n   *     }, footer: {\n   *       controller: \"footCtrl\",\n   *       templateUrl: \"footer.html\"\n   *     }\n   *   }</pre>\n   *\n   * Targets named `ui-view=\"header\"` from grandparent state 'top''s template, and named `ui-view=\"body\" from parent state's template.\n   * <pre>views: {\n   *     'header@top': {\n   *       controller: \"msgHeaderCtrl\",\n   *       templateUrl: \"msgHeader.html\"\n   *     }, 'body': {\n   *       controller: \"messagesCtrl\",\n   *       templateUrl: \"messages.html\"\n   *     }\n   *   }</pre>\n   *\n   * @param {boolean=} [stateConfig.abstract=false]\n   * <a id='abstract'></a>\n   * An abstract state will never be directly activated,\n   *   but can provide inherited properties to its common children states.\n   * <pre>abstract: true</pre>\n   *\n   * @param {function=} stateConfig.onEnter\n   * <a id='onEnter'></a>\n   *\n   * Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onEnter: function(MyService, $stateParams) {\n   *     MyService.foo($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {function=} stateConfig.onExit\n   * <a id='onExit'></a>\n   *\n   * Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onExit: function(MyService, $stateParams) {\n   *     MyService.cleanup($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {boolean=} [stateConfig.reloadOnSearch=true]\n   * <a id='reloadOnSearch'></a>\n   *\n   * If `false`, will not retrigger the same state\n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()). \n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   * <pre>reloadOnSearch: false</pre>\n   *\n   * @param {object=} stateConfig.data\n   * <a id='data'></a>\n   *\n   * Arbitrary data object, useful for custom configuration.  The parent state's `data` is\n   *   prototypally inherited.  In other words, adding a data property to a state adds it to\n   *   the entire subtree via prototypal inheritance.\n   *\n   * <pre>data: {\n   *     requiredRole: 'foo'\n   * } </pre>\n   *\n   * @param {object=} stateConfig.params\n   * <a id='params'></a>\n   *\n   * A map which optionally configures parameters declared in the `url`, or\n   *   defines additional non-url parameters.  For each parameter being\n   *   configured, add a configuration object keyed to the name of the parameter.\n   *\n   *   Each parameter configuration object may contain the following properties:\n   *\n   *   - ** value ** - {object|function=}: specifies the default value for this\n   *     parameter.  This implicitly sets this parameter as optional.\n   *\n   *     When UI-Router routes to a state and no value is\n   *     specified for this parameter in the URL or transition, the\n   *     default value will be used instead.  If `value` is a function,\n   *     it will be injected and invoked, and the return value used.\n   *\n   *     *Note*: `undefined` is treated as \"no default value\" while `null`\n   *     is treated as \"the default value is `null`\".\n   *\n   *     *Shorthand*: If you only need to configure the default value of the\n   *     parameter, you may use a shorthand syntax.   In the **`params`**\n   *     map, instead mapping the param name to a full parameter configuration\n   *     object, simply set map it to the default parameter value, e.g.:\n   *\n   * <pre>// define a parameter's default value\n   * params: {\n   *     param1: { value: \"defaultValue\" }\n   * }\n   * // shorthand default values\n   * params: {\n   *     param1: \"defaultValue\",\n   *     param2: \"param2Default\"\n   * }</pre>\n   *\n   *   - ** array ** - {boolean=}: *(default: false)* If true, the param value will be\n   *     treated as an array of values.  If you specified a Type, the value will be\n   *     treated as an array of the specified Type.  Note: query parameter values\n   *     default to a special `\"auto\"` mode.\n   *\n   *     For query parameters in `\"auto\"` mode, if multiple  values for a single parameter\n   *     are present in the URL (e.g.: `/foo?bar=1&bar=2&bar=3`) then the values\n   *     are mapped to an array (e.g.: `{ foo: [ '1', '2', '3' ] }`).  However, if\n   *     only one value is present (e.g.: `/foo?bar=1`) then the value is treated as single\n   *     value (e.g.: `{ foo: '1' }`).\n   *\n   * <pre>params: {\n   *     param1: { array: true }\n   * }</pre>\n   *\n   *   - ** squash ** - {bool|string=}: `squash` configures how a default parameter value is represented in the URL when\n   *     the current parameter value is the same as the default value. If `squash` is not set, it uses the\n   *     configured default squash policy.\n   *     (See {@link ui.router.util.$urlMatcherFactory#methods_defaultSquashPolicy `defaultSquashPolicy()`})\n   *\n   *   There are three squash settings:\n   *\n   *     - false: The parameter's default value is not squashed.  It is encoded and included in the URL\n   *     - true: The parameter's default value is omitted from the URL.  If the parameter is preceeded and followed\n   *       by slashes in the state's `url` declaration, then one of those slashes are omitted.\n   *       This can allow for cleaner looking URLs.\n   *     - `\"<arbitrary string>\"`: The parameter's default value is replaced with an arbitrary placeholder of  your choice.\n   *\n   * <pre>params: {\n   *     param1: {\n   *       value: \"defaultId\",\n   *       squash: true\n   * } }\n   * // squash \"defaultValue\" to \"~\"\n   * params: {\n   *     param1: {\n   *       value: \"defaultValue\",\n   *       squash: \"~\"\n   * } }\n   * </pre>\n   *\n   *\n   * @example\n   * <pre>\n   * // Some state name examples\n   *\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the\n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * </pre>\n   *\n   */\n  this.state = state;\n  function state(name, definition) {\n    /*jshint validthis: true */\n    if (isObject(name)) definition = name;\n    else definition.name = name;\n    registerState(definition);\n    return this;\n  }\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$state\n   *\n   * @requires $rootScope\n   * @requires $q\n   * @requires ui.router.state.$view\n   * @requires $injector\n   * @requires ui.router.util.$resolve\n   * @requires ui.router.state.$stateParams\n   * @requires ui.router.router.$urlRouter\n   *\n   * @property {object} params A param object, e.g. {sectionId: section.id)}, that \n   * you'd like to test against the current active state.\n   * @property {object} current A reference to the state's config object. However \n   * you passed it in. Useful for accessing custom data.\n   * @property {object} transition Currently pending transition. A promise that'll \n   * resolve or reject.\n   *\n   * @description\n   * `$state` service is responsible for representing states as well as transitioning\n   * between them. It also provides interfaces to ask for current state or even states\n   * you're coming from.\n   */\n  this.$get = $get;\n  $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$urlRouter', '$location', '$urlMatcherFactory'];\n  function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $urlRouter,   $location,   $urlMatcherFactory) {\n\n    var TransitionSuperseded = $q.reject(new Error('transition superseded'));\n    var TransitionPrevented = $q.reject(new Error('transition prevented'));\n    var TransitionAborted = $q.reject(new Error('transition aborted'));\n    var TransitionFailed = $q.reject(new Error('transition failed'));\n\n    // Handles the case where a state which is the target of a transition is not found, and the user\n    // can optionally retry or defer the transition\n    function handleRedirect(redirect, state, params, options) {\n      /**\n       * @ngdoc event\n       * @name ui.router.state.$state#$stateNotFound\n       * @eventOf ui.router.state.$state\n       * @eventType broadcast on root scope\n       * @description\n       * Fired when a requested state **cannot be found** using the provided state name during transition.\n       * The event is broadcast allowing any handlers a single chance to deal with the error (usually by\n       * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,\n       * you can see its three properties in the example. You can use `event.preventDefault()` to abort the\n       * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.\n       *\n       * @param {Object} event Event object.\n       * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.\n       * @param {State} fromState Current state object.\n       * @param {Object} fromParams Current state params.\n       *\n       * @example\n       *\n       * <pre>\n       * // somewhere, assume lazy.state has not been defined\n       * $state.go(\"lazy.state\", {a:1, b:2}, {inherit:false});\n       *\n       * // somewhere else\n       * $scope.$on('$stateNotFound',\n       * function(event, unfoundState, fromState, fromParams){\n       *     console.log(unfoundState.to); // \"lazy.state\"\n       *     console.log(unfoundState.toParams); // {a:1, b:2}\n       *     console.log(unfoundState.options); // {inherit:false} + default options\n       * })\n       * </pre>\n       */\n      var evt = $rootScope.$broadcast('$stateNotFound', redirect, state, params);\n\n      if (evt.defaultPrevented) {\n        $urlRouter.update();\n        return TransitionAborted;\n      }\n\n      if (!evt.retry) {\n        return null;\n      }\n\n      // Allow the handler to return a promise to defer state lookup retry\n      if (options.$retry) {\n        $urlRouter.update();\n        return TransitionFailed;\n      }\n      var retryTransition = $state.transition = $q.when(evt.retry);\n\n      retryTransition.then(function() {\n        if (retryTransition !== $state.transition) return TransitionSuperseded;\n        redirect.options.$retry = true;\n        return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);\n      }, function() {\n        return TransitionAborted;\n      });\n      $urlRouter.update();\n\n      return retryTransition;\n    }\n\n    root.locals = { resolve: null, globals: { $stateParams: {} } };\n\n    $state = {\n      params: {},\n      current: root.self,\n      $current: root,\n      transition: null\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#reload\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, \n     * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).\n     *\n     * @example\n     * <pre>\n     * var app angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.reload = function(){\n     *     $state.reload();\n     *   }\n     * });\n     * </pre>\n     *\n     * `reload()` is just an alias for:\n     * <pre>\n     * $state.transitionTo($state.current, $stateParams, { \n     *   reload: true, inherit: false, notify: true\n     * });\n     * </pre>\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.reload = function reload() {\n      return $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: true });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#go\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Convenience method for transitioning to a new state. `$state.go` calls \n     * `$state.transitionTo` internally but automatically sets options to \n     * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. \n     * This allows you to easily use an absolute or relative to path and specify \n     * only the parameters you'd like to update (while letting unspecified parameters \n     * inherit from the currently active ancestor states).\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.go('contact.detail');\n     *   };\n     * });\n     * </pre>\n     * <img src='../ngdoc_assets/StateGoExamples.png'/>\n     *\n     * @param {string} to Absolute state name or relative state path. Some examples:\n     *\n     * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n     * - `$state.go('^')` - will go to a parent state\n     * - `$state.go('^.sibling')` - will go to a sibling state\n     * - `$state.go('.child.grandchild')` - will go to grandchild state\n     *\n     * @param {object=} params A map of the parameters that will be sent to the state, \n     * will populate $stateParams. Any parameters that are not specified will be inherited from currently \n     * defined parameters. This allows, for example, going to a sibling state that shares parameters\n     * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.\n     * transitioning to a sibling will get you the parameters for all parents, transitioning to a child\n     * will get you all current parameters, etc.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition.\n     *\n     * Possible success values:\n     *\n     * - $state.current\n     *\n     * <br/>Possible rejection values:\n     *\n     * - 'transition superseded' - when a newer transition has been started after this one\n     * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener\n     * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or\n     *   when a `$stateNotFound` `event.retry` promise errors.\n     * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.\n     * - *resolve error* - when an error has occurred with a `resolve`\n     *\n     */\n    $state.go = function go(to, params, options) {\n      return $state.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#transitionTo\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}\n     * uses `transitionTo` internally. `$state.go` is recommended in most situations.\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.transitionTo('contact.detail');\n     *   };\n     * });\n     * </pre>\n     *\n     * @param {string} to State name.\n     * @param {object=} toParams A map of the parameters that will be sent to the state,\n     * will populate $stateParams.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.transitionTo = function transitionTo(to, toParams, options) {\n      toParams = toParams || {};\n      options = extend({\n        location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false\n      }, options || {});\n\n      var from = $state.$current, fromParams = $state.params, fromPath = from.path;\n      var evt, toState = findState(to, options.relative);\n\n      if (!isDefined(toState)) {\n        var redirect = { to: to, toParams: toParams, options: options };\n        var redirectResult = handleRedirect(redirect, from.self, fromParams, options);\n\n        if (redirectResult) {\n          return redirectResult;\n        }\n\n        // Always retry once if the $stateNotFound was not prevented\n        // (handles either redirect changed or state lazy-definition)\n        to = redirect.to;\n        toParams = redirect.toParams;\n        options = redirect.options;\n        toState = findState(to, options.relative);\n\n        if (!isDefined(toState)) {\n          if (!options.relative) throw new Error(\"No such state '\" + to + \"'\");\n          throw new Error(\"Could not resolve '\" + to + \"' from state '\" + options.relative + \"'\");\n        }\n      }\n      if (toState[abstractKey]) throw new Error(\"Cannot transition to abstract state '\" + to + \"'\");\n      if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);\n      if (!toState.params.$$validates(toParams)) return TransitionFailed;\n\n      toParams = toState.params.$$values(toParams);\n      to = toState;\n\n      var toPath = to.path;\n\n      // Starting from the root of the path, keep all levels that haven't changed\n      var keep = 0, state = toPath[keep], locals = root.locals, toLocals = [];\n\n      if (!options.reload) {\n        while (state && state === fromPath[keep] && state.ownParams.$$equals(toParams, fromParams)) {\n          locals = toLocals[keep] = state.locals;\n          keep++;\n          state = toPath[keep];\n        }\n      }\n\n      // If we're going to the same state and all locals are kept, we've got nothing to do.\n      // But clear 'transition', as we still want to cancel any other pending transitions.\n      // TODO: We may not want to bump 'transition' if we're called from a location change\n      // that we've initiated ourselves, because we might accidentally abort a legitimate\n      // transition initiated from code?\n      if (shouldTriggerReload(to, from, locals, options)) {\n        if (to.self.reloadOnSearch !== false) $urlRouter.update();\n        $state.transition = null;\n        return $q.when($state.current);\n      }\n\n      // Filter parameters before we pass them to event handlers etc.\n      toParams = filterByKeys(to.params.$$keys(), toParams || {});\n\n      // Broadcast start event and cancel the transition if requested\n      if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeStart\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when the state transition **begins**. You can use `event.preventDefault()`\n         * to prevent the transition from happening and then the transition promise will be\n         * rejected with a `'transition prevented'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         *\n         * @example\n         *\n         * <pre>\n         * $rootScope.$on('$stateChangeStart',\n         * function(event, toState, toParams, fromState, fromParams){\n         *     event.preventDefault();\n         *     // transitionTo() promise will be rejected with\n         *     // a 'transition prevented' error\n         * })\n         * </pre>\n         */\n        if ($rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams).defaultPrevented) {\n          $urlRouter.update();\n          return TransitionPrevented;\n        }\n      }\n\n      // Resolve locals for the remaining states, but don't update any global state just\n      // yet -- if anything fails to resolve the current state needs to remain untouched.\n      // We also set up an inheritance chain for the locals here. This allows the view directive\n      // to quickly look up the correct definition for each view in the current state. Even\n      // though we create the locals object itself outside resolveState(), it is initially\n      // empty and gets filled asynchronously. We need to keep track of the promise for the\n      // (fully resolved) current locals, and pass this down the chain.\n      var resolved = $q.when(locals);\n\n      for (var l = keep; l < toPath.length; l++, state = toPath[l]) {\n        locals = toLocals[l] = inherit(locals);\n        resolved = resolveState(state, toParams, state === to, resolved, locals, options);\n      }\n\n      // Once everything is resolved, we are ready to perform the actual transition\n      // and return a promise for the new state. We also keep track of what the\n      // current promise is, so that we can detect overlapping transitions and\n      // keep only the outcome of the last transition.\n      var transition = $state.transition = resolved.then(function () {\n        var l, entering, exiting;\n\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Exit 'from' states not kept\n        for (l = fromPath.length - 1; l >= keep; l--) {\n          exiting = fromPath[l];\n          if (exiting.self.onExit) {\n            $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);\n          }\n          exiting.locals = null;\n        }\n\n        // Enter 'to' states not kept\n        for (l = keep; l < toPath.length; l++) {\n          entering = toPath[l];\n          entering.locals = toLocals[l];\n          if (entering.self.onEnter) {\n            $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);\n          }\n        }\n\n        // Run it again, to catch any transitions in callbacks\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Update globals in $state\n        $state.$current = to;\n        $state.current = to.self;\n        $state.params = toParams;\n        copy($state.params, $stateParams);\n        $state.transition = null;\n\n        if (options.location && to.navigable) {\n          $urlRouter.push(to.navigable.url, to.navigable.locals.globals.$stateParams, {\n            $$avoidResync: true, replace: options.location === 'replace'\n          });\n        }\n\n        if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeSuccess\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired once the state transition is **complete**.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         */\n          $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);\n        }\n        $urlRouter.update(true);\n\n        return $state.current;\n      }, function (error) {\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        $state.transition = null;\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeError\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when an **error occurs** during transition. It's important to note that if you\n         * have any errors in your resolve functions (javascript errors, non-existent services, etc)\n         * they will not throw traditionally. You must listen for this $stateChangeError event to\n         * catch **ALL** errors.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         * @param {Error} error The resolve error object.\n         */\n        evt = $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);\n\n        if (!evt.defaultPrevented) {\n            $urlRouter.update();\n        }\n\n        return $q.reject(error);\n      });\n\n      return transition;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#is\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Similar to {@link ui.router.state.$state#methods_includes $state.includes},\n     * but only checks for the full state name. If params is supplied then it will be\n     * tested for strict equality against the current active params object, so all params\n     * must match with none missing and no extras.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // absolute name\n     * $state.is('contact.details.item'); // returns true\n     * $state.is(contactDetailItemStateObject); // returns true\n     *\n     * // relative name (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.is('.item')}\">Item</div>\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name (absolute or relative) or state object you'd like to check.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like\n     * to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object} -  If `stateOrName` is a relative state name and `options.relative` is set, .is will\n     * test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it is the state.\n     */\n    $state.is = function is(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) { return undefined; }\n      if ($state.$current !== state) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams) : true;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#includes\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method to determine if the current active state is equal to or is the child of the\n     * state stateName. If any params are passed then they will be tested for a match as well.\n     * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n     *\n     * @example\n     * Partial and relative names\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // Using partial names\n     * $state.includes(\"contacts\"); // returns true\n     * $state.includes(\"contacts.details\"); // returns true\n     * $state.includes(\"contacts.details.item\"); // returns true\n     * $state.includes(\"contacts.list\"); // returns false\n     * $state.includes(\"about\"); // returns false\n     *\n     * // Using relative names (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.includes('.item')}\">Item</div>\n     * </pre>\n     *\n     * Basic globbing patterns\n     * <pre>\n     * $state.$current.name = 'contacts.details.item.url';\n     *\n     * $state.includes(\"*.details.*.*\"); // returns true\n     * $state.includes(\"*.details.**\"); // returns true\n     * $state.includes(\"**.item.**\"); // returns true\n     * $state.includes(\"*.details.item.url\"); // returns true\n     * $state.includes(\"*.details.*.url\"); // returns true\n     * $state.includes(\"*.details.*\"); // returns false\n     * $state.includes(\"item.**\"); // returns false\n     * </pre>\n     *\n     * @param {string} stateOrName A partial name, relative name, or glob pattern\n     * to be searched for within the current state name.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`,\n     * that you'd like to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object=} -  If `stateOrName` is a relative state reference and `options.relative` is set,\n     * .includes will test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it does include the state\n     */\n    $state.includes = function includes(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      if (isString(stateOrName) && isGlob(stateOrName)) {\n        if (!doesStateMatchGlob(stateOrName)) {\n          return false;\n        }\n        stateOrName = $state.$current.name;\n      }\n\n      var state = findState(stateOrName, options.relative);\n      if (!isDefined(state)) { return undefined; }\n      if (!isDefined($state.$current.includes[state.name])) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams, objectKeys(params)) : true;\n    };\n\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#href\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A url generation method that returns the compiled url for the given state populated with the given params.\n     *\n     * @example\n     * <pre>\n     * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.\n     * @param {object=} params An object of parameter values to fill the state's required parameters.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`lossy`** - {boolean=true} -  If true, and if there is no url associated with the state provided in the\n     *    first parameter, then the constructed href url will be built from the first navigable ancestor (aka\n     *    ancestor with a valid url).\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n     * \n     * @returns {string} compiled state url\n     */\n    $state.href = function href(stateOrName, params, options) {\n      options = extend({\n        lossy:    true,\n        inherit:  true,\n        absolute: false,\n        relative: $state.$current\n      }, options || {});\n\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) return null;\n      if (options.inherit) params = inheritParams($stateParams, params || {}, $state.$current, state);\n      \n      var nav = (state && options.lossy) ? state.navigable : state;\n\n      if (!nav || nav.url === undefined || nav.url === null) {\n        return null;\n      }\n      return $urlRouter.href(nav.url, filterByKeys(state.params.$$keys(), params || {}), {\n        absolute: options.absolute\n      });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#get\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Returns the state configuration object for any specific state or all states.\n     *\n     * @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for\n     * the requested state. If not provided, returns an array of ALL state configs.\n     * @param {string|object=} context When stateOrName is a relative state reference, the state will be retrieved relative to context.\n     * @returns {Object|Array} State configuration object or array of all objects.\n     */\n    $state.get = function (stateOrName, context) {\n      if (arguments.length === 0) return map(objectKeys(states), function(name) { return states[name].self; });\n      var state = findState(stateOrName, context || $state.$current);\n      return (state && state.self) ? state.self : null;\n    };\n\n    function resolveState(state, params, paramsAreFiltered, inherited, dst, options) {\n      // Make a restricted $stateParams with only the parameters that apply to this state if\n      // necessary. In addition to being available to the controller and onEnter/onExit callbacks,\n      // we also need $stateParams to be available for any $injector calls we make during the\n      // dependency resolution process.\n      var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params.$$keys(), params);\n      var locals = { $stateParams: $stateParams };\n\n      // Resolve 'global' dependencies for the state, i.e. those not specific to a view.\n      // We're also including $stateParams in this; that way the parameters are restricted\n      // to the set that should be visible to the state, and are independent of when we update\n      // the global $state and $stateParams values.\n      dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);\n      var promises = [dst.resolve.then(function (globals) {\n        dst.globals = globals;\n      })];\n      if (inherited) promises.push(inherited);\n\n      // Resolve template and dependencies for all views.\n      forEach(state.views, function (view, name) {\n        var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});\n        injectables.$template = [ function () {\n          return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: options.notify }) || '';\n        }];\n\n        promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {\n          // References to the controller (only instantiated at link time)\n          if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {\n            var injectLocals = angular.extend({}, injectables, locals);\n            result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);\n          } else {\n            result.$$controller = view.controller;\n          }\n          // Provide access to the state itself for internal use\n          result.$$state = state;\n          result.$$controllerAs = view.controllerAs;\n          dst[name] = result;\n        }));\n      });\n\n      // Wait for all the promises and then return the activation object\n      return $q.all(promises).then(function (values) {\n        return dst;\n      });\n    }\n\n    return $state;\n  }\n\n  function shouldTriggerReload(to, from, locals, options) {\n    if (to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false))) {\n      return true;\n    }\n  }\n}\n\nangular.module('ui.router.state')\n  .value('$stateParams', {})\n  .provider('$state', $StateProvider);\n\n\n$ViewProvider.$inject = [];\nfunction $ViewProvider() {\n\n  this.$get = $get;\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$view\n   *\n   * @requires ui.router.util.$templateFactory\n   * @requires $rootScope\n   *\n   * @description\n   *\n   */\n  $get.$inject = ['$rootScope', '$templateFactory'];\n  function $get(   $rootScope,   $templateFactory) {\n    return {\n      // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })\n      /**\n       * @ngdoc function\n       * @name ui.router.state.$view#load\n       * @methodOf ui.router.state.$view\n       *\n       * @description\n       *\n       * @param {string} name name\n       * @param {object} options option object.\n       */\n      load: function load(name, options) {\n        var result, defaults = {\n          template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}\n        };\n        options = extend(defaults, options);\n\n        if (options.view) {\n          result = $templateFactory.fromConfig(options.view, options.params, options.locals);\n        }\n        if (result && options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$viewContentLoading\n         * @eventOf ui.router.state.$view\n         * @eventType broadcast on root scope\n         * @description\n         *\n         * Fired once the view **begins loading**, *before* the DOM is rendered.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} viewConfig The view config properties (template, controller, etc).\n         *\n         * @example\n         *\n         * <pre>\n         * $scope.$on('$viewContentLoading',\n         * function(event, viewConfig){\n         *     // Access to all the view config properties.\n         *     // and one special property 'targetView'\n         *     // viewConfig.targetView\n         * });\n         * </pre>\n         */\n          $rootScope.$broadcast('$viewContentLoading', options);\n        }\n        return result;\n      }\n    };\n  }\n}\n\nangular.module('ui.router.state').provider('$view', $ViewProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$uiViewScrollProvider\n *\n * @description\n * Provider that returns the {@link ui.router.state.$uiViewScroll} service function.\n */\nfunction $ViewScrollProvider() {\n\n  var useAnchorScroll = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll\n   * @methodOf ui.router.state.$uiViewScrollProvider\n   *\n   * @description\n   * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for\n   * scrolling based on the url anchor.\n   */\n  this.useAnchorScroll = function () {\n    useAnchorScroll = true;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$uiViewScroll\n   *\n   * @requires $anchorScroll\n   * @requires $timeout\n   *\n   * @description\n   * When called with a jqLite element, it scrolls the element into view (after a\n   * `$timeout` so the DOM has time to refresh).\n   *\n   * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n   * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.\n   */\n  this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {\n    if (useAnchorScroll) {\n      return $anchorScroll;\n    }\n\n    return function ($element) {\n      $timeout(function () {\n        $element[0].scrollIntoView();\n      }, 0, false);\n    };\n  }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-view\n *\n * @requires ui.router.state.$state\n * @requires $compile\n * @requires $controller\n * @requires $injector\n * @requires ui.router.state.$uiViewScroll\n * @requires $document\n *\n * @restrict ECA\n *\n * @description\n * The ui-view directive tells $state where to place your templates.\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states.\n *\n * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window\n * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll\n * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you\n * scroll ui-view elements into view when they are populated during a state activation.\n *\n * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*\n *\n * @param {string=} onload Expression to evaluate whenever the view updates.\n * \n * @example\n * A view can be unnamed or named. \n * <pre>\n * <!-- Unnamed -->\n * <div ui-view></div> \n * \n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n * </pre>\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a \n * single view and it is unnamed then you can populate it like so:\n * <pre>\n * <div ui-view></div> \n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * </pre>\n * \n * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}\n * config property, by name, in this case an empty name:\n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * But typically you'll only use the views property if you name your view or have more than one view \n * in the same template. There's not really a compelling reason to name a view if its the only one, \n * but you could if you wanted, like so:\n * <pre>\n * <div ui-view=\"main\"></div>\n * </pre> \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * Really though, you'll use views to set up multiple views:\n * <pre>\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div> \n * <div ui-view=\"data\"></div> \n * </pre>\n * \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }    \n * })\n * </pre>\n *\n * Examples for `autoscroll`:\n *\n * <pre>\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * </pre>\n */\n$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate'];\nfunction $ViewDirective(   $state,   $injector,   $uiViewScroll,   $interpolate) {\n\n  function getService() {\n    return ($injector.has) ? function(service) {\n      return $injector.has(service) ? $injector.get(service) : null;\n    } : function(service) {\n      try {\n        return $injector.get(service);\n      } catch (e) {\n        return null;\n      }\n    };\n  }\n\n  var service = getService(),\n      $animator = service('$animator'),\n      $animate = service('$animate');\n\n  // Returns a set of DOM manipulation functions based on which Angular version\n  // it should use\n  function getRenderer(attrs, scope) {\n    var statics = function() {\n      return {\n        enter: function (element, target, cb) { target.after(element); cb(); },\n        leave: function (element, cb) { element.remove(); cb(); }\n      };\n    };\n\n    if ($animate) {\n      return {\n        enter: function(element, target, cb) {\n          var promise = $animate.enter(element, null, target, cb);\n          if (promise && promise.then) promise.then(cb);\n        },\n        leave: function(element, cb) {\n          var promise = $animate.leave(element, cb);\n          if (promise && promise.then) promise.then(cb);\n        }\n      };\n    }\n\n    if ($animator) {\n      var animate = $animator && $animator(scope, attrs);\n\n      return {\n        enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },\n        leave: function(element, cb) { animate.leave(element); cb(); }\n      };\n    }\n\n    return statics();\n  }\n\n  var directive = {\n    restrict: 'ECA',\n    terminal: true,\n    priority: 400,\n    transclude: 'element',\n    compile: function (tElement, tAttrs, $transclude) {\n      return function (scope, $element, attrs) {\n        var previousEl, currentEl, currentScope, latestLocals,\n            onloadExp     = attrs.onload || '',\n            autoScrollExp = attrs.autoscroll,\n            renderer      = getRenderer(attrs, scope);\n\n        scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        updateView(true);\n\n        function cleanupLastView() {\n          if (previousEl) {\n            previousEl.remove();\n            previousEl = null;\n          }\n\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n\n          if (currentEl) {\n            renderer.leave(currentEl, function() {\n              previousEl = null;\n            });\n\n            previousEl = currentEl;\n            currentEl = null;\n          }\n        }\n\n        function updateView(firstTime) {\n          var newScope,\n              name            = getUiViewName(scope, attrs, $element, $interpolate),\n              previousLocals  = name && $state.$current && $state.$current.locals[name];\n\n          if (!firstTime && previousLocals === latestLocals) return; // nothing to do\n          newScope = scope.$new();\n          latestLocals = $state.$current.locals[name];\n\n          var clone = $transclude(newScope, function(clone) {\n            renderer.enter(clone, $element, function onUiViewEnter() {\n              if(currentScope) {\n                currentScope.$emit('$viewContentAnimationEnded');\n              }\n\n              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n                $uiViewScroll(clone);\n              }\n            });\n            cleanupLastView();\n          });\n\n          currentEl = clone;\n          currentScope = newScope;\n          /**\n           * @ngdoc event\n           * @name ui.router.state.directive:ui-view#$viewContentLoaded\n           * @eventOf ui.router.state.directive:ui-view\n           * @eventType emits on ui-view directive scope\n           * @description           *\n           * Fired once the view is **loaded**, *after* the DOM is rendered.\n           *\n           * @param {Object} event Event object.\n           */\n          currentScope.$emit('$viewContentLoaded');\n          currentScope.$eval(onloadExp);\n        }\n      };\n    }\n  };\n\n  return directive;\n}\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state', '$interpolate'];\nfunction $ViewDirectiveFill (  $compile,   $controller,   $state,   $interpolate) {\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function (tElement) {\n      var initial = tElement.html();\n      return function (scope, $element, attrs) {\n        var current = $state.$current,\n            name = getUiViewName(scope, attrs, $element, $interpolate),\n            locals  = current && current.locals[name];\n\n        if (! locals) {\n          return;\n        }\n\n        $element.data('$uiView', { name: name, state: locals.$$state });\n        $element.html(locals.$template ? locals.$template : initial);\n\n        var link = $compile($element.contents());\n\n        if (locals.$$controller) {\n          locals.$scope = scope;\n          var controller = $controller(locals.$$controller, locals);\n          if (locals.$$controllerAs) {\n            scope[locals.$$controllerAs] = controller;\n          }\n          $element.data('$ngControllerController', controller);\n          $element.children().data('$ngControllerController', controller);\n        }\n\n        link(scope);\n      };\n    }\n  };\n}\n\n/**\n * Shared ui-view code for both directives:\n * Given scope, element, and its attributes, return the view's name\n */\nfunction getUiViewName(scope, attrs, element, $interpolate) {\n  var name = $interpolate(attrs.uiView || attrs.name || '')(scope);\n  var inherited = element.inheritedData('$uiView');\n  return name.indexOf('@') >= 0 ?  name :  (name + '@' + (inherited ? inherited.state.name : ''));\n}\n\nangular.module('ui.router.state').directive('uiView', $ViewDirective);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n\nfunction parseStateRef(ref, current) {\n  var preparsed = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n  if (preparsed) ref = current + '(' + preparsed[1] + ')';\n  parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1], paramExpr: parsed[3] || null };\n}\n\nfunction stateContext(el) {\n  var stateData = el.parent().inheritedData('$uiView');\n\n  if (stateData && stateData.state && stateData.state.name) {\n    return stateData.state;\n  }\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref\n *\n * @requires ui.router.state.$state\n * @requires $timeout\n *\n * @restrict A\n *\n * @description\n * A directive that binds a link (`<a>` tag) to a state. If the state has an associated \n * URL, the directive will automatically generate & update the `href` attribute via \n * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking \n * the link will trigger a state transition with optional parameters. \n *\n * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be \n * handled natively by the browser.\n *\n * You can also use relative state paths within ui-sref, just like the relative \n * paths passed to `$state.go()`. You just need to be aware that the path is relative\n * to the state that the link lives in, in other words the state that loaded the \n * template containing the link.\n *\n * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}\n * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,\n * and `reload`.\n *\n * @example\n * Here's an example of how you'd use ui-sref and how it would compile. If you have the \n * following template:\n * <pre>\n * <a ui-sref=\"home\">Home</a> | <a ui-sref=\"about\">About</a> | <a ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * </pre>\n * \n * Then the compiled html would be (assuming Html5Mode is off and current state is contacts):\n * <pre>\n * <a href=\"#/home\" ui-sref=\"home\">Home</a> | <a href=\"#/about\" ui-sref=\"about\">About</a> | <a href=\"#/contacts?page=2\" ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * </pre>\n *\n * @param {string} ui-sref 'stateName' can be any valid absolute or relative state\n * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}\n */\n$StateRefDirective.$inject = ['$state', '$timeout'];\nfunction $StateRefDirective($state, $timeout) {\n  var allowedOptions = ['location', 'inherit', 'reload'];\n\n  return {\n    restrict: 'A',\n    require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n    link: function(scope, element, attrs, uiSrefActive) {\n      var ref = parseStateRef(attrs.uiSref, $state.current.name);\n      var params = null, url = null, base = stateContext(element) || $state.$current;\n      var newHref = null, isAnchor = element.prop(\"tagName\") === \"A\";\n      var isForm = element[0].nodeName === \"FORM\";\n      var attr = isForm ? \"action\" : \"href\", nav = true;\n\n      var options = { relative: base, inherit: true };\n      var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};\n\n      angular.forEach(allowedOptions, function(option) {\n        if (option in optionsOverride) {\n          options[option] = optionsOverride[option];\n        }\n      });\n\n      var update = function(newVal) {\n        if (newVal) params = angular.copy(newVal);\n        if (!nav) return;\n\n        newHref = $state.href(ref.state, params, options);\n\n        var activeDirective = uiSrefActive[1] || uiSrefActive[0];\n        if (activeDirective) {\n          activeDirective.$$setStateInfo(ref.state, params);\n        }\n        if (newHref === null) {\n          nav = false;\n          return false;\n        }\n        attrs.$set(attr, newHref);\n      };\n\n      if (ref.paramExpr) {\n        scope.$watch(ref.paramExpr, function(newVal, oldVal) {\n          if (newVal !== params) update(newVal);\n        }, true);\n        params = angular.copy(scope.$eval(ref.paramExpr));\n      }\n      update();\n\n      if (isForm) return;\n\n      element.bind(\"click\", function(e) {\n        var button = e.which || e.button;\n        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {\n          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n          var transition = $timeout(function() {\n            $state.go(ref.state, params, options);\n          });\n          e.preventDefault();\n\n          // if the state has no URL, ignore one preventDefault from the <a> directive.\n          var ignorePreventDefaultCount = isAnchor && !newHref ? 1: 0;\n          e.preventDefault = function() {\n            if (ignorePreventDefaultCount-- <= 0)\n              $timeout.cancel(transition);\n          };\n        }\n      });\n    }\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * A directive working alongside ui-sref to add classes to an element when the\n * related ui-sref directive's state is active, and removing them when it is inactive.\n * The primary use-case is to simplify the special appearance of navigation menus\n * relying on `ui-sref`, by having the \"active\" state's menu button appear different,\n * distinguishing it from the inactive menu items.\n *\n * ui-sref-active can live on the same element as ui-sref or on a parent element. The first\n * ui-sref-active found at the same level or above the ui-sref will be used.\n *\n * Will activate when the ui-sref's target state or any child state is active. If you\n * need to activate only when the ui-sref target state is active and *not* any of\n * it's children, then you will use\n * {@link ui.router.state.directive:ui-sref-active-eq ui-sref-active-eq}\n *\n * @example\n * Given the following template:\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n *\n * When the app state is \"app.user\" (or any children states), and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n * The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * Multiple classes may be specified in a space-separated format:\n * <pre>\n * <ul>\n *   <li ui-sref-active='class1 class2 class3'>\n *     <a ui-sref=\"app.user\">link</a>\n *   </li>\n * </ul>\n * </pre>\n */\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active-eq\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * The same as {@link ui.router.state.directive:ui-sref-active ui-sref-active} but will only activate\n * when the exact target state used in the `ui-sref` is active; no child states.\n *\n */\n$StateRefActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateRefActiveDirective($state, $stateParams, $interpolate) {\n  return  {\n    restrict: \"A\",\n    controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {\n      var state, params, activeClass;\n\n      // There probably isn't much point in $observing this\n      // uiSrefActive and uiSrefActiveEq share the same directive object with some\n      // slight difference in logic routing\n      activeClass = $interpolate($attrs.uiSrefActiveEq || $attrs.uiSrefActive || '', false)($scope);\n\n      // Allow uiSref to communicate with uiSrefActive[Equals]\n      this.$$setStateInfo = function (newState, newParams) {\n        state = $state.get(newState, stateContext($element));\n        params = newParams;\n        update();\n      };\n\n      $scope.$on('$stateChangeSuccess', update);\n\n      // Update route state\n      function update() {\n        if (isMatch()) {\n          $element.addClass(activeClass);\n        } else {\n          $element.removeClass(activeClass);\n        }\n      }\n\n      function isMatch() {\n        if (typeof $attrs.uiSrefActiveEq !== 'undefined') {\n          return state && $state.is(state.name, params);\n        } else {\n          return state && $state.includes(state.name, params);\n        }\n      }\n    }]\n  };\n}\n\nangular.module('ui.router.state')\n  .directive('uiSref', $StateRefDirective)\n  .directive('uiSrefActive', $StateRefActiveDirective)\n  .directive('uiSrefActiveEq', $StateRefActiveDirective);\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n  var isFilter = function (state) {\n    return $state.is(state);\n  };\n  isFilter.$stateful = true;\n  return isFilter;\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n  var includesFilter = function (state) {\n    return $state.includes(state);\n  };\n  includesFilter.$stateful = true;\n  return  includesFilter;\n}\n\nangular.module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n})(window, window.angular);"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/ionic-angular.js",
    "content": "/*!\n * Copyright 2015 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.3.1\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n/* eslint no-unused-vars:0 */\nvar IonicModule = angular.module('ionic', ['ngAnimate', 'ngSanitize', 'ui.router', 'ngIOS9UIWebViewPatch']),\n  extend = angular.extend,\n  forEach = angular.forEach,\n  isDefined = angular.isDefined,\n  isNumber = angular.isNumber,\n  isString = angular.isString,\n  jqLite = angular.element,\n  noop = angular.noop;\n\n/**\n * @ngdoc service\n * @name $ionicActionSheet\n * @module ionic\n * @description\n * The Action Sheet is a slide-up pane that lets the user choose from a set of options.\n * Dangerous options are highlighted in red and made obvious.\n *\n * There are easy ways to cancel out of the action sheet, such as tapping the backdrop or even\n * hitting escape on the keyboard for desktop testing.\n *\n * ![Action Sheet](http://ionicframework.com.s3.amazonaws.com/docs/controllers/actionSheet.gif)\n *\n * @usage\n * To trigger an Action Sheet in your code, use the $ionicActionSheet service in your angular controllers:\n *\n * ```js\n * angular.module('mySuperApp', ['ionic'])\n * .controller(function($scope, $ionicActionSheet, $timeout) {\n *\n *  // Triggered on a button click, or some other target\n *  $scope.show = function() {\n *\n *    // Show the action sheet\n *    var hideSheet = $ionicActionSheet.show({\n *      buttons: [\n *        { text: '<b>Share</b> This' },\n *        { text: 'Move' }\n *      ],\n *      destructiveText: 'Delete',\n *      titleText: 'Modify your album',\n *      cancelText: 'Cancel',\n *      cancel: function() {\n          // add cancel code..\n        },\n *      buttonClicked: function(index) {\n *        return true;\n *      }\n *    });\n *\n *    // For example's sake, hide the sheet after two seconds\n *    $timeout(function() {\n *      hideSheet();\n *    }, 2000);\n *\n *  };\n * });\n * ```\n *\n */\nIonicModule\n.factory('$ionicActionSheet', [\n  '$rootScope',\n  '$compile',\n  '$animate',\n  '$timeout',\n  '$ionicTemplateLoader',\n  '$ionicPlatform',\n  '$ionicBody',\n  'IONIC_BACK_PRIORITY',\nfunction($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicPlatform, $ionicBody, IONIC_BACK_PRIORITY) {\n\n  return {\n    show: actionSheet\n  };\n\n  /**\n   * @ngdoc method\n   * @name $ionicActionSheet#show\n   * @description\n   * Load and return a new action sheet.\n   *\n   * A new isolated scope will be created for the\n   * action sheet and the new element will be appended into the body.\n   *\n   * @param {object} options The options for this ActionSheet. Properties:\n   *\n   *  - `[Object]` `buttons` Which buttons to show.  Each button is an object with a `text` field.\n   *  - `{string}` `titleText` The title to show on the action sheet.\n   *  - `{string=}` `cancelText` the text for a 'cancel' button on the action sheet.\n   *  - `{string=}` `destructiveText` The text for a 'danger' on the action sheet.\n   *  - `{function=}` `cancel` Called if the cancel button is pressed, the backdrop is tapped or\n   *     the hardware back button is pressed.\n   *  - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,\n   *     with the index of the button that was clicked and the button object. Return true to close\n   *     the action sheet, or false to keep it opened.\n   *  - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked.\n   *     Return true to close the action sheet, or false to keep it opened.\n   *  -  `{boolean=}` `cancelOnStateChange` Whether to cancel the actionSheet when navigating\n   *     to a new state.  Default true.\n   *  - `{string}` `cssClass` The custom CSS class name.\n   *\n   * @returns {function} `hideSheet` A function which, when called, hides & cancels the action sheet.\n   */\n  function actionSheet(opts) {\n    var scope = $rootScope.$new(true);\n\n    extend(scope, {\n      cancel: noop,\n      destructiveButtonClicked: noop,\n      buttonClicked: noop,\n      $deregisterBackButton: noop,\n      buttons: [],\n      cancelOnStateChange: true\n    }, opts || {});\n\n    function textForIcon(text) {\n      if (text && /icon/.test(text)) {\n        scope.$actionSheetHasIcon = true;\n      }\n    }\n\n    for (var x = 0; x < scope.buttons.length; x++) {\n      textForIcon(scope.buttons[x].text);\n    }\n    textForIcon(scope.cancelText);\n    textForIcon(scope.destructiveText);\n\n    // Compile the template\n    var element = scope.element = $compile('<ion-action-sheet ng-class=\"cssClass\" buttons=\"buttons\"></ion-action-sheet>')(scope);\n\n    // Grab the sheet element for animation\n    var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper'));\n\n    var stateChangeListenDone = scope.cancelOnStateChange ?\n      $rootScope.$on('$stateChangeSuccess', function() { scope.cancel(); }) :\n      noop;\n\n    // removes the actionSheet from the screen\n    scope.removeSheet = function(done) {\n      if (scope.removed) return;\n\n      scope.removed = true;\n      sheetEl.removeClass('action-sheet-up');\n      $timeout(function() {\n        // wait to remove this due to a 300ms delay native\n        // click which would trigging whatever was underneath this\n        $ionicBody.removeClass('action-sheet-open');\n      }, 400);\n      scope.$deregisterBackButton();\n      stateChangeListenDone();\n\n      $animate.removeClass(element, 'active').then(function() {\n        scope.$destroy();\n        element.remove();\n        // scope.cancel.$scope is defined near the bottom\n        scope.cancel.$scope = sheetEl = null;\n        (done || noop)(opts.buttons);\n      });\n    };\n\n    scope.showSheet = function(done) {\n      if (scope.removed) return;\n\n      $ionicBody.append(element)\n                .addClass('action-sheet-open');\n\n      $animate.addClass(element, 'active').then(function() {\n        if (scope.removed) return;\n        (done || noop)();\n      });\n      $timeout(function() {\n        if (scope.removed) return;\n        sheetEl.addClass('action-sheet-up');\n      }, 20, false);\n    };\n\n    // registerBackButtonAction returns a callback to deregister the action\n    scope.$deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n      function() {\n        $timeout(scope.cancel);\n      },\n      IONIC_BACK_PRIORITY.actionSheet\n    );\n\n    // called when the user presses the cancel button\n    scope.cancel = function() {\n      // after the animation is out, call the cancel callback\n      scope.removeSheet(opts.cancel);\n    };\n\n    scope.buttonClicked = function(index) {\n      // Check if the button click event returned true, which means\n      // we can close the action sheet\n      if (opts.buttonClicked(index, opts.buttons[index]) === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.destructiveButtonClicked = function() {\n      // Check if the destructive button click event returned true, which means\n      // we can close the action sheet\n      if (opts.destructiveButtonClicked() === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.showSheet();\n\n    // Expose the scope on $ionicActionSheet's return value for the sake\n    // of testing it.\n    scope.cancel.$scope = scope;\n\n    return scope.cancel;\n  }\n}]);\n\n\njqLite.prototype.addClass = function(cssClasses) {\n  var x, y, cssClass, el, splitClasses, existingClasses;\n  if (cssClasses && cssClasses != 'ng-scope' && cssClasses != 'ng-isolate-scope') {\n    for (x = 0; x < this.length; x++) {\n      el = this[x];\n      if (el.setAttribute) {\n\n        if (cssClasses.indexOf(' ') < 0 && el.classList.add) {\n          el.classList.add(cssClasses);\n        } else {\n          existingClasses = (' ' + (el.getAttribute('class') || '') + ' ')\n            .replace(/[\\n\\t]/g, \" \");\n          splitClasses = cssClasses.split(' ');\n\n          for (y = 0; y < splitClasses.length; y++) {\n            cssClass = splitClasses[y].trim();\n            if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n              existingClasses += cssClass + ' ';\n            }\n          }\n          el.setAttribute('class', existingClasses.trim());\n        }\n      }\n    }\n  }\n  return this;\n};\n\njqLite.prototype.removeClass = function(cssClasses) {\n  var x, y, splitClasses, cssClass, el;\n  if (cssClasses) {\n    for (x = 0; x < this.length; x++) {\n      el = this[x];\n      if (el.getAttribute) {\n        if (cssClasses.indexOf(' ') < 0 && el.classList.remove) {\n          el.classList.remove(cssClasses);\n        } else {\n          splitClasses = cssClasses.split(' ');\n\n          for (y = 0; y < splitClasses.length; y++) {\n            cssClass = splitClasses[y];\n            el.setAttribute('class', (\n                (\" \" + (el.getAttribute('class') || '') + \" \")\n                .replace(/[\\n\\t]/g, \" \")\n                .replace(\" \" + cssClass.trim() + \" \", \" \")).trim()\n            );\n          }\n        }\n      }\n    }\n  }\n  return this;\n};\n\n/**\n * @ngdoc service\n * @name $ionicBackdrop\n * @module ionic\n * @description\n * Shows and hides a backdrop over the UI.  Appears behind popups, loading,\n * and other overlays.\n *\n * Often, multiple UI components require a backdrop, but only one backdrop is\n * ever needed in the DOM at a time.\n *\n * Therefore, each component that requires the backdrop to be shown calls\n * `$ionicBackdrop.retain()` when it wants the backdrop, then `$ionicBackdrop.release()`\n * when it is done with the backdrop.\n *\n * For each time `retain` is called, the backdrop will be shown until `release` is called.\n *\n * For example, if `retain` is called three times, the backdrop will be shown until `release`\n * is called three times.\n *\n * **Notes:**\n * - The backdrop service will broadcast 'backdrop.shown' and 'backdrop.hidden' events from the root scope,\n * this is useful for alerting native components not in html.\n *\n * @usage\n *\n * ```js\n * function MyController($scope, $ionicBackdrop, $timeout, $rootScope) {\n *   //Show a backdrop for one second\n *   $scope.action = function() {\n *     $ionicBackdrop.retain();\n *     $timeout(function() {\n *       $ionicBackdrop.release();\n *     }, 1000);\n *   };\n *\n *   // Execute action on backdrop disappearing\n *   $scope.$on('backdrop.hidden', function() {\n *     // Execute action\n *   });\n *\n *   // Execute action on backdrop appearing\n *   $scope.$on('backdrop.shown', function() {\n *     // Execute action\n *   });\n *\n * }\n * ```\n */\nIonicModule\n.factory('$ionicBackdrop', [\n  '$document', '$timeout', '$$rAF', '$rootScope',\nfunction($document, $timeout, $$rAF, $rootScope) {\n\n  var el = jqLite('<div class=\"backdrop\">');\n  var backdropHolds = 0;\n\n  $document[0].body.appendChild(el[0]);\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#retain\n     * @description Retains the backdrop.\n     */\n    retain: retain,\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#release\n     * @description\n     * Releases the backdrop.\n     */\n    release: release,\n\n    getElement: getElement,\n\n    // exposed for testing\n    _element: el\n  };\n\n  function retain() {\n    backdropHolds++;\n    if (backdropHolds === 1) {\n      el.addClass('visible');\n      $rootScope.$broadcast('backdrop.shown');\n      $$rAF(function() {\n        // If we're still at >0 backdropHolds after async...\n        if (backdropHolds >= 1) el.addClass('active');\n      });\n    }\n  }\n  function release() {\n    if (backdropHolds === 1) {\n      el.removeClass('active');\n      $rootScope.$broadcast('backdrop.hidden');\n      $timeout(function() {\n        // If we're still at 0 backdropHolds after async...\n        if (backdropHolds === 0) el.removeClass('visible');\n      }, 400, false);\n    }\n    backdropHolds = Math.max(0, backdropHolds - 1);\n  }\n\n  function getElement() {\n    return el;\n  }\n\n}]);\n\n/**\n * @private\n */\nIonicModule\n.factory('$ionicBind', ['$parse', '$interpolate', function($parse, $interpolate) {\n  var LOCAL_REGEXP = /^\\s*([@=&])(\\??)\\s*(\\w*)\\s*$/;\n  return function(scope, attrs, bindDefinition) {\n    forEach(bindDefinition || {}, function(definition, scopeName) {\n      //Adapted from angular.js $compile\n      var match = definition.match(LOCAL_REGEXP) || [],\n        attrName = match[3] || scopeName,\n        mode = match[1], // @, =, or &\n        parentGet,\n        unwatch;\n\n      switch (mode) {\n        case '@':\n          if (!attrs[attrName]) {\n            return;\n          }\n          attrs.$observe(attrName, function(value) {\n            scope[scopeName] = value;\n          });\n          // we trigger an interpolation to ensure\n          // the value is there for use immediately\n          if (attrs[attrName]) {\n            scope[scopeName] = $interpolate(attrs[attrName])(scope);\n          }\n          break;\n\n        case '=':\n          if (!attrs[attrName]) {\n            return;\n          }\n          unwatch = scope.$watch(attrs[attrName], function(value) {\n            scope[scopeName] = value;\n          });\n          //Destroy parent scope watcher when this scope is destroyed\n          scope.$on('$destroy', unwatch);\n          break;\n\n        case '&':\n          /* jshint -W044 */\n          if (attrs[attrName] && attrs[attrName].match(RegExp(scopeName + '\\(.*?\\)'))) {\n            throw new Error('& expression binding \"' + scopeName + '\" looks like it will recursively call \"' +\n                          attrs[attrName] + '\" and cause a stack overflow! Please choose a different scopeName.');\n          }\n          parentGet = $parse(attrs[attrName]);\n          scope[scopeName] = function(locals) {\n            return parentGet(scope, locals);\n          };\n          break;\n      }\n    });\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicBody\n * @module ionic\n * @description An angular utility service to easily and efficiently\n * add and remove CSS classes from the document's body element.\n */\nIonicModule\n.factory('$ionicBody', ['$document', function($document) {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBody#addClass\n     * @description Add a class to the document's body element.\n     * @param {string} class Each argument will be added to the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    addClass: function() {\n      for (var x = 0; x < arguments.length; x++) {\n        $document[0].body.classList.add(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#removeClass\n     * @description Remove a class from the document's body element.\n     * @param {string} class Each argument will be removed from the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    removeClass: function() {\n      for (var x = 0; x < arguments.length; x++) {\n        $document[0].body.classList.remove(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#enableClass\n     * @description Similar to the `add` method, except the first parameter accepts a boolean\n     * value determining if the class should be added or removed. Rather than writing user code,\n     * such as \"if true then add the class, else then remove the class\", this method can be\n     * given a true or false value which reduces redundant code.\n     * @param {boolean} shouldEnableClass A true/false value if the class should be added or removed.\n     * @param {string} class Each remaining argument would be added or removed depending on\n     * the first argument.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    enableClass: function(shouldEnableClass) {\n      var args = Array.prototype.slice.call(arguments).slice(1);\n      if (shouldEnableClass) {\n        this.addClass.apply(this, args);\n      } else {\n        this.removeClass.apply(this, args);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#append\n     * @description Append a child to the document's body.\n     * @param {element} element The element to be appended to the body. The passed in element\n     * can be either a jqLite element, or a DOM element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    append: function(ele) {\n      $document[0].body.appendChild(ele.length ? ele[0] : ele);\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#get\n     * @description Get the document's body element.\n     * @returns {element} Returns the document's body element.\n     */\n    get: function() {\n      return $document[0].body;\n    }\n  };\n}]);\n\nIonicModule\n.factory('$ionicClickBlock', [\n  '$document',\n  '$ionicBody',\n  '$timeout',\nfunction($document, $ionicBody, $timeout) {\n  var CSS_HIDE = 'click-block-hide';\n  var cbEle, fallbackTimer, pendingShow;\n\n  function preventClick(ev) {\n    ev.preventDefault();\n    ev.stopPropagation();\n  }\n\n  function addClickBlock() {\n    if (pendingShow) {\n      if (cbEle) {\n        cbEle.classList.remove(CSS_HIDE);\n      } else {\n        cbEle = $document[0].createElement('div');\n        cbEle.className = 'click-block';\n        $ionicBody.append(cbEle);\n        cbEle.addEventListener('touchstart', preventClick);\n        cbEle.addEventListener('mousedown', preventClick);\n      }\n      pendingShow = false;\n    }\n  }\n\n  function removeClickBlock() {\n    cbEle && cbEle.classList.add(CSS_HIDE);\n  }\n\n  return {\n    show: function(autoExpire) {\n      pendingShow = true;\n      $timeout.cancel(fallbackTimer);\n      fallbackTimer = $timeout(this.hide, autoExpire || 310, false);\n      addClickBlock();\n    },\n    hide: function() {\n      pendingShow = false;\n      $timeout.cancel(fallbackTimer);\n      removeClickBlock();\n    }\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicGesture\n * @module ionic\n * @description An angular service exposing ionic\n * {@link ionic.utility:ionic.EventController}'s gestures.\n */\nIonicModule\n.factory('$ionicGesture', [function() {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#on\n     * @description Add an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#onGesture}.\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {element} $element The angular element to listen for the event on.\n     * @param {object} options object.\n     * @returns {ionic.Gesture} The gesture object (use this to remove the gesture later on).\n     */\n    on: function(eventType, cb, $element, options) {\n      return window.ionic.onGesture(eventType, cb, $element[0], options);\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#off\n     * @description Remove an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#offGesture}.\n     * @param {ionic.Gesture} gesture The gesture that should be removed.\n     * @param {string} eventType The gesture event to remove the listener for.\n     * @param {function(e)} callback The listener to remove.\n     */\n    off: function(gesture, eventType, cb) {\n      return window.ionic.offGesture(gesture, eventType, cb);\n    }\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicHistory\n * @module ionic\n * @description\n * $ionicHistory keeps track of views as the user navigates through an app. Similar to the way a\n * browser behaves, an Ionic app is able to keep track of the previous view, the current view, and\n * the forward view (if there is one).  However, a typical web browser only keeps track of one\n * history stack in a linear fashion.\n *\n * Unlike a traditional browser environment, apps and webapps have parallel independent histories,\n * such as with tabs. Should a user navigate few pages deep on one tab, and then switch to a new\n * tab and back, the back button relates not to the previous tab, but to the previous pages\n * visited within _that_ tab.\n *\n * `$ionicHistory` facilitates this parallel history architecture.\n */\n\nIonicModule\n.factory('$ionicHistory', [\n  '$rootScope',\n  '$state',\n  '$location',\n  '$window',\n  '$timeout',\n  '$ionicViewSwitcher',\n  '$ionicNavViewDelegate',\nfunction($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $ionicNavViewDelegate) {\n\n  // history actions while navigating views\n  var ACTION_INITIAL_VIEW = 'initialView';\n  var ACTION_NEW_VIEW = 'newView';\n  var ACTION_MOVE_BACK = 'moveBack';\n  var ACTION_MOVE_FORWARD = 'moveForward';\n\n  // direction of navigation\n  var DIRECTION_BACK = 'back';\n  var DIRECTION_FORWARD = 'forward';\n  var DIRECTION_ENTER = 'enter';\n  var DIRECTION_EXIT = 'exit';\n  var DIRECTION_SWAP = 'swap';\n  var DIRECTION_NONE = 'none';\n\n  var stateChangeCounter = 0;\n  var lastStateId, nextViewOptions, deregisterStateChangeListener, nextViewExpireTimer, forcedNav;\n\n  var viewHistory = {\n    histories: { root: { historyId: 'root', parentHistoryId: null, stack: [], cursor: -1 } },\n    views: {},\n    backView: null,\n    forwardView: null,\n    currentView: null\n  };\n\n  var View = function() {};\n  View.prototype.initialize = function(data) {\n    if (data) {\n      for (var name in data) this[name] = data[name];\n      return this;\n    }\n    return null;\n  };\n  View.prototype.go = function() {\n\n    if (this.stateName) {\n      return $state.go(this.stateName, this.stateParams);\n    }\n\n    if (this.url && this.url !== $location.url()) {\n\n      if (viewHistory.backView === this) {\n        return $window.history.go(-1);\n      } else if (viewHistory.forwardView === this) {\n        return $window.history.go(1);\n      }\n\n      $location.url(this.url);\n    }\n\n    return null;\n  };\n  View.prototype.destroy = function() {\n    if (this.scope) {\n      this.scope.$destroy && this.scope.$destroy();\n      this.scope = null;\n    }\n  };\n\n\n  function getViewById(viewId) {\n    return (viewId ? viewHistory.views[ viewId ] : null);\n  }\n\n  function getBackView(view) {\n    return (view ? getViewById(view.backViewId) : null);\n  }\n\n  function getForwardView(view) {\n    return (view ? getViewById(view.forwardViewId) : null);\n  }\n\n  function getHistoryById(historyId) {\n    return (historyId ? viewHistory.histories[ historyId ] : null);\n  }\n\n  function getHistory(scope) {\n    var histObj = getParentHistoryObj(scope);\n\n    if (!viewHistory.histories[ histObj.historyId ]) {\n      // this history object exists in parent scope, but doesn't\n      // exist in the history data yet\n      viewHistory.histories[ histObj.historyId ] = {\n        historyId: histObj.historyId,\n        parentHistoryId: getParentHistoryObj(histObj.scope.$parent).historyId,\n        stack: [],\n        cursor: -1\n      };\n    }\n    return getHistoryById(histObj.historyId);\n  }\n\n  function getParentHistoryObj(scope) {\n    var parentScope = scope;\n    while (parentScope) {\n      if (parentScope.hasOwnProperty('$historyId')) {\n        // this parent scope has a historyId\n        return { historyId: parentScope.$historyId, scope: parentScope };\n      }\n      // nothing found keep climbing up\n      parentScope = parentScope.$parent;\n    }\n    // no history for the parent, use the root\n    return { historyId: 'root', scope: $rootScope };\n  }\n\n  function setNavViews(viewId) {\n    viewHistory.currentView = getViewById(viewId);\n    viewHistory.backView = getBackView(viewHistory.currentView);\n    viewHistory.forwardView = getForwardView(viewHistory.currentView);\n  }\n\n  function getCurrentStateId() {\n    var id;\n    if ($state && $state.current && $state.current.name) {\n      id = $state.current.name;\n      if ($state.params) {\n        for (var key in $state.params) {\n          if ($state.params.hasOwnProperty(key) && $state.params[key]) {\n            id += \"_\" + key + \"=\" + $state.params[key];\n          }\n        }\n      }\n      return id;\n    }\n    // if something goes wrong make sure its got a unique stateId\n    return ionic.Utils.nextUid();\n  }\n\n  function getCurrentStateParams() {\n    var rtn;\n    if ($state && $state.params) {\n      for (var key in $state.params) {\n        if ($state.params.hasOwnProperty(key)) {\n          rtn = rtn || {};\n          rtn[key] = $state.params[key];\n        }\n      }\n    }\n    return rtn;\n  }\n\n\n  return {\n\n    register: function(parentScope, viewLocals) {\n\n      var currentStateId = getCurrentStateId(),\n          hist = getHistory(parentScope),\n          currentView = viewHistory.currentView,\n          backView = viewHistory.backView,\n          forwardView = viewHistory.forwardView,\n          viewId = null,\n          action = null,\n          direction = DIRECTION_NONE,\n          historyId = hist.historyId,\n          url = $location.url(),\n          tmp, x, ele;\n\n      if (lastStateId !== currentStateId) {\n        lastStateId = currentStateId;\n        stateChangeCounter++;\n      }\n\n      if (forcedNav) {\n        // we've previously set exactly what to do\n        viewId = forcedNav.viewId;\n        action = forcedNav.action;\n        direction = forcedNav.direction;\n        forcedNav = null;\n\n      } else if (backView && backView.stateId === currentStateId) {\n        // they went back one, set the old current view as a forward view\n        viewId = backView.viewId;\n        historyId = backView.historyId;\n        action = ACTION_MOVE_BACK;\n        if (backView.historyId === currentView.historyId) {\n          // went back in the same history\n          direction = DIRECTION_BACK;\n\n        } else if (currentView) {\n          direction = DIRECTION_EXIT;\n\n          tmp = getHistoryById(backView.historyId);\n          if (tmp && tmp.parentHistoryId === currentView.historyId) {\n            direction = DIRECTION_ENTER;\n\n          } else {\n            tmp = getHistoryById(currentView.historyId);\n            if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {\n              direction = DIRECTION_SWAP;\n            }\n          }\n        }\n\n      } else if (forwardView && forwardView.stateId === currentStateId) {\n        // they went to the forward one, set the forward view to no longer a forward view\n        viewId = forwardView.viewId;\n        historyId = forwardView.historyId;\n        action = ACTION_MOVE_FORWARD;\n        if (forwardView.historyId === currentView.historyId) {\n          direction = DIRECTION_FORWARD;\n\n        } else if (currentView) {\n          direction = DIRECTION_EXIT;\n\n          if (currentView.historyId === hist.parentHistoryId) {\n            direction = DIRECTION_ENTER;\n\n          } else {\n            tmp = getHistoryById(currentView.historyId);\n            if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {\n              direction = DIRECTION_SWAP;\n            }\n          }\n        }\n\n        tmp = getParentHistoryObj(parentScope);\n        if (forwardView.historyId && tmp.scope) {\n          // if a history has already been created by the forward view then make sure it stays the same\n          tmp.scope.$historyId = forwardView.historyId;\n          historyId = forwardView.historyId;\n        }\n\n      } else if (currentView && currentView.historyId !== historyId &&\n                hist.cursor > -1 && hist.stack.length > 0 && hist.cursor < hist.stack.length &&\n                hist.stack[hist.cursor].stateId === currentStateId) {\n        // they just changed to a different history and the history already has views in it\n        var switchToView = hist.stack[hist.cursor];\n        viewId = switchToView.viewId;\n        historyId = switchToView.historyId;\n        action = ACTION_MOVE_BACK;\n        direction = DIRECTION_SWAP;\n\n        tmp = getHistoryById(currentView.historyId);\n        if (tmp && tmp.parentHistoryId === historyId) {\n          direction = DIRECTION_EXIT;\n\n        } else {\n          tmp = getHistoryById(historyId);\n          if (tmp && tmp.parentHistoryId === currentView.historyId) {\n            direction = DIRECTION_ENTER;\n          }\n        }\n\n        // if switching to a different history, and the history of the view we're switching\n        // to has an existing back view from a different history than itself, then\n        // it's back view would be better represented using the current view as its back view\n        tmp = getViewById(switchToView.backViewId);\n        if (tmp && switchToView.historyId !== tmp.historyId) {\n          // the new view is being removed from it's old position in the history and being placed at the top,\n          // so we need to update any views that reference it as a backview, otherwise there will be infinitely loops\n          var viewIds = Object.keys(viewHistory.views);\n          viewIds.forEach(function(viewId) {\n            var view = viewHistory.views[viewId];\n            if ( view.backViewId === switchToView.viewId ) {\n              view.backViewId = null;\n            }\n          });\n\n          hist.stack[hist.cursor].backViewId = currentView.viewId;\n        }\n\n      } else {\n\n        // create an element from the viewLocals template\n        ele = $ionicViewSwitcher.createViewEle(viewLocals);\n        if (this.isAbstractEle(ele, viewLocals)) {\n          return {\n            action: 'abstractView',\n            direction: DIRECTION_NONE,\n            ele: ele\n          };\n        }\n\n        // set a new unique viewId\n        viewId = ionic.Utils.nextUid();\n\n        if (currentView) {\n          // set the forward view if there is a current view (ie: if its not the first view)\n          currentView.forwardViewId = viewId;\n\n          action = ACTION_NEW_VIEW;\n\n          // check if there is a new forward view within the same history\n          if (forwardView && currentView.stateId !== forwardView.stateId &&\n             currentView.historyId === forwardView.historyId) {\n            // they navigated to a new view but the stack already has a forward view\n            // since its a new view remove any forwards that existed\n            tmp = getHistoryById(forwardView.historyId);\n            if (tmp) {\n              // the forward has a history\n              for (x = tmp.stack.length - 1; x >= forwardView.index; x--) {\n                // starting from the end destroy all forwards in this history from this point\n                var stackItem = tmp.stack[x];\n                stackItem && stackItem.destroy && stackItem.destroy();\n                tmp.stack.splice(x);\n              }\n              historyId = forwardView.historyId;\n            }\n          }\n\n          // its only moving forward if its in the same history\n          if (hist.historyId === currentView.historyId) {\n            direction = DIRECTION_FORWARD;\n\n          } else if (currentView.historyId !== hist.historyId) {\n            // DB: this is a new view in a different tab\n            direction = DIRECTION_ENTER;\n\n            tmp = getHistoryById(currentView.historyId);\n            if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {\n              direction = DIRECTION_SWAP;\n\n            } else {\n              tmp = getHistoryById(tmp.parentHistoryId);\n              if (tmp && tmp.historyId === hist.historyId) {\n                direction = DIRECTION_EXIT;\n              }\n            }\n          }\n\n        } else {\n          // there's no current view, so this must be the initial view\n          action = ACTION_INITIAL_VIEW;\n        }\n\n        if (stateChangeCounter < 2) {\n          // views that were spun up on the first load should not animate\n          direction = DIRECTION_NONE;\n        }\n\n        // add the new view\n        viewHistory.views[viewId] = this.createView({\n          viewId: viewId,\n          index: hist.stack.length,\n          historyId: hist.historyId,\n          backViewId: (currentView && currentView.viewId ? currentView.viewId : null),\n          forwardViewId: null,\n          stateId: currentStateId,\n          stateName: this.currentStateName(),\n          stateParams: getCurrentStateParams(),\n          url: url,\n          canSwipeBack: canSwipeBack(ele, viewLocals)\n        });\n\n        // add the new view to this history's stack\n        hist.stack.push(viewHistory.views[viewId]);\n      }\n\n      deregisterStateChangeListener && deregisterStateChangeListener();\n      $timeout.cancel(nextViewExpireTimer);\n      if (nextViewOptions) {\n        if (nextViewOptions.disableAnimate) direction = DIRECTION_NONE;\n        if (nextViewOptions.disableBack) viewHistory.views[viewId].backViewId = null;\n        if (nextViewOptions.historyRoot) {\n          for (x = 0; x < hist.stack.length; x++) {\n            if (hist.stack[x].viewId === viewId) {\n              hist.stack[x].index = 0;\n              hist.stack[x].backViewId = hist.stack[x].forwardViewId = null;\n            } else {\n              delete viewHistory.views[hist.stack[x].viewId];\n            }\n          }\n          hist.stack = [viewHistory.views[viewId]];\n        }\n        nextViewOptions = null;\n      }\n\n      setNavViews(viewId);\n\n      if (viewHistory.backView && historyId == viewHistory.backView.historyId && currentStateId == viewHistory.backView.stateId && url == viewHistory.backView.url) {\n        for (x = 0; x < hist.stack.length; x++) {\n          if (hist.stack[x].viewId == viewId) {\n            action = 'dupNav';\n            direction = DIRECTION_NONE;\n            if (x > 0) {\n              hist.stack[x - 1].forwardViewId = null;\n            }\n            viewHistory.forwardView = null;\n            viewHistory.currentView.index = viewHistory.backView.index;\n            viewHistory.currentView.backViewId = viewHistory.backView.backViewId;\n            viewHistory.backView = getBackView(viewHistory.backView);\n            hist.stack.splice(x, 1);\n            break;\n          }\n        }\n      }\n\n      hist.cursor = viewHistory.currentView.index;\n\n      return {\n        viewId: viewId,\n        action: action,\n        direction: direction,\n        historyId: historyId,\n        enableBack: this.enabledBack(viewHistory.currentView),\n        isHistoryRoot: (viewHistory.currentView.index === 0),\n        ele: ele\n      };\n    },\n\n    registerHistory: function(scope) {\n      scope.$historyId = ionic.Utils.nextUid();\n    },\n\n    createView: function(data) {\n      var newView = new View();\n      return newView.initialize(data);\n    },\n\n    getViewById: getViewById,\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#viewHistory\n     * @description The app's view history data, such as all the views and histories, along\n     * with how they are ordered and linked together within the navigation stack.\n     * @returns {object} Returns an object containing the apps view history data.\n     */\n    viewHistory: function() {\n      return viewHistory;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentView\n     * @description The app's current view.\n     * @returns {object} Returns the current view.\n     */\n    currentView: function(view) {\n      if (arguments.length) {\n        viewHistory.currentView = view;\n      }\n      return viewHistory.currentView;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentHistoryId\n     * @description The ID of the history stack which is the parent container of the current view.\n     * @returns {string} Returns the current history ID.\n     */\n    currentHistoryId: function() {\n      return viewHistory.currentView ? viewHistory.currentView.historyId : null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentTitle\n     * @description Gets and sets the current view's title.\n     * @param {string=} val The title to update the current view with.\n     * @returns {string} Returns the current view's title.\n     */\n    currentTitle: function(val) {\n      if (viewHistory.currentView) {\n        if (arguments.length) {\n          viewHistory.currentView.title = val;\n        }\n        return viewHistory.currentView.title;\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#backView\n     * @description Returns the view that was before the current view in the history stack.\n     * If the user navigated from View A to View B, then View A would be the back view, and\n     * View B would be the current view.\n     * @returns {object} Returns the back view.\n     */\n    backView: function(view) {\n      if (arguments.length) {\n        viewHistory.backView = view;\n      }\n      return viewHistory.backView;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#backTitle\n     * @description Gets the back view's title.\n     * @returns {string} Returns the back view's title.\n     */\n    backTitle: function(view) {\n      var backView = (view && getViewById(view.backViewId)) || viewHistory.backView;\n      return backView && backView.title;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#forwardView\n     * @description Returns the view that was in front of the current view in the history stack.\n     * A forward view would exist if the user navigated from View A to View B, then\n     * navigated back to View A. At this point then View B would be the forward view, and View\n     * A would be the current view.\n     * @returns {object} Returns the forward view.\n     */\n    forwardView: function(view) {\n      if (arguments.length) {\n        viewHistory.forwardView = view;\n      }\n      return viewHistory.forwardView;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentStateName\n     * @description Returns the current state name.\n     * @returns {string}\n     */\n    currentStateName: function() {\n      return ($state && $state.current ? $state.current.name : null);\n    },\n\n    isCurrentStateNavView: function(navView) {\n      return !!($state && $state.current && $state.current.views && $state.current.views[navView]);\n    },\n\n    goToHistoryRoot: function(historyId) {\n      if (historyId) {\n        var hist = getHistoryById(historyId);\n        if (hist && hist.stack.length) {\n          if (viewHistory.currentView && viewHistory.currentView.viewId === hist.stack[0].viewId) {\n            return;\n          }\n          forcedNav = {\n            viewId: hist.stack[0].viewId,\n            action: ACTION_MOVE_BACK,\n            direction: DIRECTION_BACK\n          };\n          hist.stack[0].go();\n        }\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#goBack\n     * @param {number=} backCount Optional negative integer setting how many views to go\n     * back. By default it'll go back one view by using the value `-1`. To go back two\n     * views you would use `-2`. If the number goes farther back than the number of views\n     * in the current history's stack then it'll go to the first view in the current history's\n     * stack. If the number is zero or greater then it'll do nothing. It also does not\n     * cross history stacks, meaning it can only go as far back as the current history.\n     * @description Navigates the app to the back view, if a back view exists.\n     */\n    goBack: function(backCount) {\n      if (isDefined(backCount) && backCount !== -1) {\n        if (backCount > -1) return;\n\n        var currentHistory = viewHistory.histories[this.currentHistoryId()];\n        var newCursor = currentHistory.cursor + backCount + 1;\n        if (newCursor < 1) {\n          newCursor = 1;\n        }\n\n        currentHistory.cursor = newCursor;\n        setNavViews(currentHistory.stack[newCursor].viewId);\n\n        var cursor = newCursor - 1;\n        var clearStateIds = [];\n        var fwdView = getViewById(currentHistory.stack[cursor].forwardViewId);\n        while (fwdView) {\n          clearStateIds.push(fwdView.stateId || fwdView.viewId);\n          cursor++;\n          if (cursor >= currentHistory.stack.length) break;\n          fwdView = getViewById(currentHistory.stack[cursor].forwardViewId);\n        }\n\n        var self = this;\n        if (clearStateIds.length) {\n          $timeout(function() {\n            self.clearCache(clearStateIds);\n          }, 300);\n        }\n      }\n\n      viewHistory.backView && viewHistory.backView.go();\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#removeBackView\n     * @description Remove the previous view from the history completely, including the\n     * cached element and scope (if they exist).\n     */\n    removeBackView: function() {\n      var self = this;\n      var currentHistory = viewHistory.histories[this.currentHistoryId()];\n      var currentCursor = currentHistory.cursor;\n\n      var currentView = currentHistory.stack[currentCursor];\n      var backView = currentHistory.stack[currentCursor - 1];\n      var replacementView = currentHistory.stack[currentCursor - 2];\n\n      // fail if we dont have enough views in the history\n      if (!backView || !replacementView) {\n        return;\n      }\n\n      // remove the old backView and the cached element/scope\n      currentHistory.stack.splice(currentCursor - 1, 1);\n      self.clearCache([backView.viewId]);\n      // make the replacementView and currentView point to each other (bypass the old backView)\n      currentView.backViewId = replacementView.viewId;\n      currentView.index = currentView.index - 1;\n      replacementView.forwardViewId = currentView.viewId;\n      // update the cursor and set new backView\n      viewHistory.backView = replacementView;\n      currentHistory.currentCursor += -1;\n    },\n\n    enabledBack: function(view) {\n      var backView = getBackView(view);\n      return !!(backView && backView.historyId === view.historyId);\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#clearHistory\n     * @description Clears out the app's entire history, except for the current view.\n     */\n    clearHistory: function() {\n      var\n      histories = viewHistory.histories,\n      currentView = viewHistory.currentView;\n\n      if (histories) {\n        for (var historyId in histories) {\n\n          if (histories[historyId].stack) {\n            histories[historyId].stack = [];\n            histories[historyId].cursor = -1;\n          }\n\n          if (currentView && currentView.historyId === historyId) {\n            currentView.backViewId = currentView.forwardViewId = null;\n            histories[historyId].stack.push(currentView);\n          } else if (histories[historyId].destroy) {\n            histories[historyId].destroy();\n          }\n\n        }\n      }\n\n      for (var viewId in viewHistory.views) {\n        if (viewId !== currentView.viewId) {\n          delete viewHistory.views[viewId];\n        }\n      }\n\n      if (currentView) {\n        setNavViews(currentView.viewId);\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#clearCache\n\t * @return promise\n     * @description Removes all cached views within every {@link ionic.directive:ionNavView}.\n     * This both removes the view element from the DOM, and destroy it's scope.\n     */\n    clearCache: function(stateIds) {\n      return $timeout(function() {\n        $ionicNavViewDelegate._instances.forEach(function(instance) {\n          instance.clearCache(stateIds);\n        });\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#nextViewOptions\n     * @description Sets options for the next view. This method can be useful to override\n     * certain view/transition defaults right before a view transition happens. For example,\n     * the {@link ionic.directive:menuClose} directive uses this method internally to ensure\n     * an animated view transition does not happen when a side menu is open, and also sets\n     * the next view as the root of its history stack. After the transition these options\n     * are set back to null.\n     *\n     * Available options:\n     *\n     * * `disableAnimate`: Do not animate the next transition.\n     * * `disableBack`: The next view should forget its back view, and set it to null.\n     * * `historyRoot`: The next view should become the root view in its history stack.\n     *\n     * ```js\n     * $ionicHistory.nextViewOptions({\n     *   disableAnimate: true,\n     *   disableBack: true\n     * });\n     * ```\n     */\n    nextViewOptions: function(opts) {\n      deregisterStateChangeListener && deregisterStateChangeListener();\n      if (arguments.length) {\n        $timeout.cancel(nextViewExpireTimer);\n        if (opts === null) {\n          nextViewOptions = opts;\n        } else {\n          nextViewOptions = nextViewOptions || {};\n          extend(nextViewOptions, opts);\n          if (nextViewOptions.expire) {\n              deregisterStateChangeListener = $rootScope.$on('$stateChangeSuccess', function() {\n                nextViewExpireTimer = $timeout(function() {\n                  nextViewOptions = null;\n                  }, nextViewOptions.expire);\n              });\n          }\n        }\n      }\n      return nextViewOptions;\n    },\n\n    isAbstractEle: function(ele, viewLocals) {\n      if (viewLocals && viewLocals.$$state && viewLocals.$$state.self['abstract']) {\n        return true;\n      }\n      return !!(ele && (isAbstractTag(ele) || isAbstractTag(ele.children())));\n    },\n\n    isActiveScope: function(scope) {\n      if (!scope) return false;\n\n      var climbScope = scope;\n      var currentHistoryId = this.currentHistoryId();\n      var foundHistoryId;\n\n      while (climbScope) {\n        if (climbScope.$$disconnected) {\n          return false;\n        }\n\n        if (!foundHistoryId && climbScope.hasOwnProperty('$historyId')) {\n          foundHistoryId = true;\n        }\n\n        if (currentHistoryId) {\n          if (climbScope.hasOwnProperty('$historyId') && currentHistoryId == climbScope.$historyId) {\n            return true;\n          }\n          if (climbScope.hasOwnProperty('$activeHistoryId')) {\n            if (currentHistoryId == climbScope.$activeHistoryId) {\n              if (climbScope.hasOwnProperty('$historyId')) {\n                return true;\n              }\n              if (!foundHistoryId) {\n                return true;\n              }\n            }\n          }\n        }\n\n        if (foundHistoryId && climbScope.hasOwnProperty('$activeHistoryId')) {\n          foundHistoryId = false;\n        }\n\n        climbScope = climbScope.$parent;\n      }\n\n      return currentHistoryId ? currentHistoryId == 'root' : true;\n    }\n\n  };\n\n  function isAbstractTag(ele) {\n    return ele && ele.length && /ion-side-menus|ion-tabs/i.test(ele[0].tagName);\n  }\n\n  function canSwipeBack(ele, viewLocals) {\n    if (viewLocals && viewLocals.$$state && viewLocals.$$state.self.canSwipeBack === false) {\n      return false;\n    }\n    if (ele && ele.attr('can-swipe-back') === 'false') {\n      return false;\n    }\n    var eleChild = ele.find('ion-view');\n    if (eleChild && eleChild.attr('can-swipe-back') === 'false') {\n      return false;\n    }\n    return true;\n  }\n\n}])\n\n.run([\n  '$rootScope',\n  '$state',\n  '$location',\n  '$document',\n  '$ionicPlatform',\n  '$ionicHistory',\n  'IONIC_BACK_PRIORITY',\nfunction($rootScope, $state, $location, $document, $ionicPlatform, $ionicHistory, IONIC_BACK_PRIORITY) {\n\n  // always reset the keyboard state when change stage\n  $rootScope.$on('$ionicView.beforeEnter', function() {\n    ionic.keyboard && ionic.keyboard.hide && ionic.keyboard.hide();\n  });\n\n  $rootScope.$on('$ionicHistory.change', function(e, data) {\n    if (!data) return null;\n\n    var viewHistory = $ionicHistory.viewHistory();\n\n    var hist = (data.historyId ? viewHistory.histories[ data.historyId ] : null);\n    if (hist && hist.cursor > -1 && hist.cursor < hist.stack.length) {\n      // the history they're going to already exists\n      // go to it's last view in its stack\n      var view = hist.stack[ hist.cursor ];\n      return view.go(data);\n    }\n\n    // this history does not have a URL, but it does have a uiSref\n    // figure out its URL from the uiSref\n    if (!data.url && data.uiSref) {\n      data.url = $state.href(data.uiSref);\n    }\n\n    if (data.url) {\n      // don't let it start with a #, messes with $location.url()\n      if (data.url.indexOf('#') === 0) {\n        data.url = data.url.replace('#', '');\n      }\n      if (data.url !== $location.url()) {\n        // we've got a good URL, ready GO!\n        $location.url(data.url);\n      }\n    }\n  });\n\n  $rootScope.$ionicGoBack = function(backCount) {\n    $ionicHistory.goBack(backCount);\n  };\n\n  // Set the document title when a new view is shown\n  $rootScope.$on('$ionicView.afterEnter', function(ev, data) {\n    if (data && data.title) {\n      $document[0].title = data.title;\n    }\n  });\n\n  // Triggered when devices with a hardware back button (Android) is clicked by the user\n  // This is a Cordova/Phonegap platform specifc method\n  function onHardwareBackButton(e) {\n    var backView = $ionicHistory.backView();\n    if (backView) {\n      // there is a back view, go to it\n      backView.go();\n    } else {\n      // there is no back view, so close the app instead\n      ionic.Platform.exitApp();\n    }\n    e.preventDefault();\n    return false;\n  }\n  $ionicPlatform.registerBackButtonAction(\n    onHardwareBackButton,\n    IONIC_BACK_PRIORITY.view\n  );\n\n}]);\n\n/**\n * @ngdoc provider\n * @name $ionicConfigProvider\n * @module ionic\n * @description\n * Ionic automatically takes platform configurations into account to adjust things like what\n * transition style to use and whether tab icons should show on the top or bottom. For example,\n * iOS will move forward by transitioning the entering view from right to center and the leaving\n * view from center to left. However, Android will transition with the entering view going from\n * bottom to center, covering the previous view, which remains stationary. It should be noted\n * that when a platform is not iOS or Android, then it'll default to iOS. So if you are\n * developing on a desktop browser, it's going to take on iOS default configs.\n *\n * These configs can be changed using the `$ionicConfigProvider` during the configuration phase\n * of your app. Additionally, `$ionicConfig` can also set and get config values during the run\n * phase and within the app itself.\n *\n * By default, all base config variables are set to `'platform'`, which means it'll take on the\n * default config of the platform on which it's running. Config variables can be set at this\n * level so all platforms follow the same setting, rather than its platform config.\n * The following code would set the same config variable for all platforms:\n *\n * ```js\n * $ionicConfigProvider.views.maxCache(10);\n * ```\n *\n * Additionally, each platform can have it's own config within the `$ionicConfigProvider.platform`\n * property. The config below would only apply to Android devices.\n *\n * ```js\n * $ionicConfigProvider.platform.android.views.maxCache(5);\n * ```\n *\n * @usage\n * ```js\n * var myApp = angular.module('reallyCoolApp', ['ionic']);\n *\n * myApp.config(function($ionicConfigProvider) {\n *   $ionicConfigProvider.views.maxCache(5);\n *\n *   // note that you can also chain configs\n *   $ionicConfigProvider.backButton.text('Go Back').icon('ion-chevron-left');\n * });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#views.transition\n * @description Animation style when transitioning between views. Default `platform`.\n *\n * @param {string} transition Which style of view transitioning to use.\n *\n * * `platform`: Dynamically choose the correct transition style depending on the platform\n * the app is running from. If the platform is not `ios` or `android` then it will default\n * to `ios`.\n * * `ios`: iOS style transition.\n * * `android`: Android style transition.\n * * `none`: Do not perform animated transitions.\n *\n * @returns {string} value\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#views.maxCache\n * @description  Maximum number of view elements to cache in the DOM. When the max number is\n * exceeded, the view with the longest time period since it was accessed is removed. Views that\n * stay in the DOM cache the view's scope, current state, and scroll position. The scope is\n * disconnected from the `$watch` cycle when it is cached and reconnected when it enters again.\n * When the maximum cache is `0`, the leaving view's element will be removed from the DOM after\n * each view transition, and the next time the same view is shown, it will have to re-compile,\n * attach to the DOM, and link the element again. This disables caching, in effect.\n * @param {number} maxNumber Maximum number of views to retain. Default `10`.\n * @returns {number} How many views Ionic will hold onto until the a view is removed.\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#views.forwardCache\n * @description  By default, when navigating, views that were recently visited are cached, and\n * the same instance data and DOM elements are referenced when navigating back. However, when\n * navigating back in the history, the \"forward\" views are removed from the cache. If you\n * navigate forward to the same view again, it'll create a new DOM element and controller\n * instance. Basically, any forward views are reset each time. Set this config to `true` to have\n * forward views cached and not reset on each load.\n * @param {boolean} value\n * @returns {boolean}\n */\n\n /**\n  * @ngdoc method\n  * @name $ionicConfigProvider#views.swipeBackEnabled\n  * @description  By default on iOS devices, swipe to go back functionality is enabled by default.\n  * This method can be used to disable it globally, or on a per-view basis.\n  * Note: This functionality is only supported on iOS.\n  * @param {boolean} value\n  * @returns {boolean}\n  */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#scrolling.jsScrolling\n * @description  Whether to use JS or Native scrolling. Defaults to native scrolling. Setting this to\n * `true` has the same effect as setting each `ion-content` to have `overflow-scroll='false'`.\n * @param {boolean} value Defaults to `false` as of Ionic 1.2\n * @returns {boolean}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#backButton.icon\n * @description Back button icon.\n * @param {string} value\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#backButton.text\n * @description Back button text.\n * @param {string} value Defaults to `Back`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#backButton.previousTitleText\n * @description If the previous title text should become the back button text. This\n * is the default for iOS.\n * @param {boolean} value\n * @returns {boolean}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#form.checkbox\n * @description Checkbox style. Android defaults to `square` and iOS defaults to `circle`.\n * @param {string} value\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#form.toggle\n * @description Toggle item style. Android defaults to `small` and iOS defaults to `large`.\n * @param {string} value\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#spinner.icon\n * @description Default spinner icon to use.\n * @param {string} value Can be: `android`, `ios`, `ios-small`, `bubbles`, `circles`, `crescent`,\n * `dots`, `lines`, `ripple`, or `spiral`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#tabs.style\n * @description Tab style. Android defaults to `striped` and iOS defaults to `standard`.\n * @param {string} value Available values include `striped` and `standard`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#tabs.position\n * @description Tab position. Android defaults to `top` and iOS defaults to `bottom`.\n * @param {string} value Available values include `top` and `bottom`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#templates.maxPrefetch\n * @description Sets the maximum number of templates to prefetch from the templateUrls defined in\n * $stateProvider.state. If set to `0`, the user will have to wait\n * for a template to be fetched the first time when navigating to a new page. Default `30`.\n * @param {integer} value Max number of template to prefetch from the templateUrls defined in\n * `$stateProvider.state()`.\n * @returns {integer}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#navBar.alignTitle\n * @description Which side of the navBar to align the title. Default `center`.\n *\n * @param {string} value side of the navBar to align the title.\n *\n * * `platform`: Dynamically choose the correct title style depending on the platform\n * the app is running from. If the platform is `ios`, it will default to `center`.\n * If the platform is `android`, it will default to `left`. If the platform is not\n * `ios` or `android`, it will default to `center`.\n *\n * * `left`: Left align the title in the navBar\n * * `center`: Center align the title in the navBar\n * * `right`: Right align the title in the navBar.\n *\n * @returns {string} value\n */\n\n/**\n  * @ngdoc method\n  * @name $ionicConfigProvider#navBar.positionPrimaryButtons\n  * @description Which side of the navBar to align the primary navBar buttons. Default `left`.\n  *\n  * @param {string} value side of the navBar to align the primary navBar buttons.\n  *\n  * * `platform`: Dynamically choose the correct title style depending on the platform\n  * the app is running from. If the platform is `ios`, it will default to `left`.\n  * If the platform is `android`, it will default to `right`. If the platform is not\n  * `ios` or `android`, it will default to `left`.\n  *\n  * * `left`: Left align the primary navBar buttons in the navBar\n  * * `right`: Right align the primary navBar buttons in the navBar.\n  *\n  * @returns {string} value\n  */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#navBar.positionSecondaryButtons\n * @description Which side of the navBar to align the secondary navBar buttons. Default `right`.\n *\n * @param {string} value side of the navBar to align the secondary navBar buttons.\n *\n * * `platform`: Dynamically choose the correct title style depending on the platform\n * the app is running from. If the platform is `ios`, it will default to `right`.\n * If the platform is `android`, it will default to `right`. If the platform is not\n * `ios` or `android`, it will default to `right`.\n *\n * * `left`: Left align the secondary navBar buttons in the navBar\n * * `right`: Right align the secondary navBar buttons in the navBar.\n *\n * @returns {string} value\n */\n\nIonicModule\n.provider('$ionicConfig', function() {\n\n  var provider = this;\n  provider.platform = {};\n  var PLATFORM = 'platform';\n\n  var configProperties = {\n    views: {\n      maxCache: PLATFORM,\n      forwardCache: PLATFORM,\n      transition: PLATFORM,\n      swipeBackEnabled: PLATFORM,\n      swipeBackHitWidth: PLATFORM\n    },\n    navBar: {\n      alignTitle: PLATFORM,\n      positionPrimaryButtons: PLATFORM,\n      positionSecondaryButtons: PLATFORM,\n      transition: PLATFORM\n    },\n    backButton: {\n      icon: PLATFORM,\n      text: PLATFORM,\n      previousTitleText: PLATFORM\n    },\n    form: {\n      checkbox: PLATFORM,\n      toggle: PLATFORM\n    },\n    scrolling: {\n      jsScrolling: PLATFORM\n    },\n    spinner: {\n      icon: PLATFORM\n    },\n    tabs: {\n      style: PLATFORM,\n      position: PLATFORM\n    },\n    templates: {\n      maxPrefetch: PLATFORM\n    },\n    platform: {}\n  };\n  createConfig(configProperties, provider, '');\n\n\n\n  // Default\n  // -------------------------\n  setPlatformConfig('default', {\n\n    views: {\n      maxCache: 10,\n      forwardCache: false,\n      transition: 'ios',\n      swipeBackEnabled: true,\n      swipeBackHitWidth: 45\n    },\n\n    navBar: {\n      alignTitle: 'center',\n      positionPrimaryButtons: 'left',\n      positionSecondaryButtons: 'right',\n      transition: 'view'\n    },\n\n    backButton: {\n      icon: 'ion-ios-arrow-back',\n      text: 'Back',\n      previousTitleText: true\n    },\n\n    form: {\n      checkbox: 'circle',\n      toggle: 'large'\n    },\n\n    scrolling: {\n      jsScrolling: true\n    },\n\n    spinner: {\n      icon: 'ios'\n    },\n\n    tabs: {\n      style: 'standard',\n      position: 'bottom'\n    },\n\n    templates: {\n      maxPrefetch: 30\n    }\n\n  });\n\n\n\n  // iOS (it is the default already)\n  // -------------------------\n  setPlatformConfig('ios', {});\n\n\n\n  // Android\n  // -------------------------\n  setPlatformConfig('android', {\n\n    views: {\n      transition: 'android',\n      swipeBackEnabled: false\n    },\n\n    navBar: {\n      alignTitle: 'left',\n      positionPrimaryButtons: 'right',\n      positionSecondaryButtons: 'right'\n    },\n\n    backButton: {\n      icon: 'ion-android-arrow-back',\n      text: false,\n      previousTitleText: false\n    },\n\n    form: {\n      checkbox: 'square',\n      toggle: 'small'\n    },\n\n    spinner: {\n      icon: 'android'\n    },\n\n    tabs: {\n      style: 'striped',\n      position: 'top'\n    },\n\n    scrolling: {\n      jsScrolling: false\n    }\n  });\n\n  // Windows Phone\n  // -------------------------\n  setPlatformConfig('windowsphone', {\n    //scrolling: {\n    //  jsScrolling: false\n    //}\n    spinner: {\n      icon: 'android'\n    }\n  });\n\n\n  provider.transitions = {\n    views: {},\n    navBar: {}\n  };\n\n\n  // iOS Transitions\n  // -----------------------\n  provider.transitions.views.ios = function(enteringEle, leavingEle, direction, shouldAnimate) {\n\n    function setStyles(ele, opacity, x, boxShadowOpacity) {\n      var css = {};\n      css[ionic.CSS.TRANSITION_DURATION] = d.shouldAnimate ? '' : 0;\n      css.opacity = opacity;\n      if (boxShadowOpacity > -1) {\n        css.boxShadow = '0 0 10px rgba(0,0,0,' + (d.shouldAnimate ? boxShadowOpacity * 0.45 : 0.3) + ')';\n      }\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + x + '%,0,0)';\n      ionic.DomUtil.cachedStyles(ele, css);\n    }\n\n    var d = {\n      run: function(step) {\n        if (direction == 'forward') {\n          setStyles(enteringEle, 1, (1 - step) * 99, 1 - step); // starting at 98% prevents a flicker\n          setStyles(leavingEle, (1 - 0.1 * step), step * -33, -1);\n\n        } else if (direction == 'back') {\n          setStyles(enteringEle, (1 - 0.1 * (1 - step)), (1 - step) * -33, -1);\n          setStyles(leavingEle, 1, step * 100, 1 - step);\n\n        } else {\n          // swap, enter, exit\n          setStyles(enteringEle, 1, 0, -1);\n          setStyles(leavingEle, 0, 0, -1);\n        }\n      },\n      shouldAnimate: shouldAnimate && (direction == 'forward' || direction == 'back')\n    };\n\n    return d;\n  };\n\n  provider.transitions.navBar.ios = function(enteringHeaderBar, leavingHeaderBar, direction, shouldAnimate) {\n\n    function setStyles(ctrl, opacity, titleX, backTextX) {\n      var css = {};\n      css[ionic.CSS.TRANSITION_DURATION] = d.shouldAnimate ? '' : '0ms';\n      css.opacity = opacity === 1 ? '' : opacity;\n\n      ctrl.setCss('buttons-left', css);\n      ctrl.setCss('buttons-right', css);\n      ctrl.setCss('back-button', css);\n\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + backTextX + 'px,0,0)';\n      ctrl.setCss('back-text', css);\n\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + titleX + 'px,0,0)';\n      ctrl.setCss('title', css);\n    }\n\n    function enter(ctrlA, ctrlB, step) {\n      if (!ctrlA || !ctrlB) return;\n      var titleX = (ctrlA.titleTextX() + ctrlA.titleWidth()) * (1 - step);\n      var backTextX = (ctrlB && (ctrlB.titleTextX() - ctrlA.backButtonTextLeft()) * (1 - step)) || 0;\n      setStyles(ctrlA, step, titleX, backTextX);\n    }\n\n    function leave(ctrlA, ctrlB, step) {\n      if (!ctrlA || !ctrlB) return;\n      var titleX = (-(ctrlA.titleTextX() - ctrlB.backButtonTextLeft()) - (ctrlA.titleLeftRight())) * step;\n      setStyles(ctrlA, 1 - step, titleX, 0);\n    }\n\n    var d = {\n      run: function(step) {\n        var enteringHeaderCtrl = enteringHeaderBar.controller();\n        var leavingHeaderCtrl = leavingHeaderBar && leavingHeaderBar.controller();\n        if (d.direction == 'back') {\n          leave(enteringHeaderCtrl, leavingHeaderCtrl, 1 - step);\n          enter(leavingHeaderCtrl, enteringHeaderCtrl, 1 - step);\n        } else {\n          enter(enteringHeaderCtrl, leavingHeaderCtrl, step);\n          leave(leavingHeaderCtrl, enteringHeaderCtrl, step);\n        }\n      },\n      direction: direction,\n      shouldAnimate: shouldAnimate && (direction == 'forward' || direction == 'back')\n    };\n\n    return d;\n  };\n\n\n  // Android Transitions\n  // -----------------------\n\n  provider.transitions.views.android = function(enteringEle, leavingEle, direction, shouldAnimate) {\n    shouldAnimate = shouldAnimate && (direction == 'forward' || direction == 'back');\n\n    function setStyles(ele, x, opacity) {\n      var css = {};\n      css[ionic.CSS.TRANSITION_DURATION] = d.shouldAnimate ? '' : 0;\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + x + '%,0,0)';\n      css.opacity = opacity;\n      ionic.DomUtil.cachedStyles(ele, css);\n    }\n\n    var d = {\n      run: function(step) {\n        if (direction == 'forward') {\n          setStyles(enteringEle, (1 - step) * 99, 1); // starting at 98% prevents a flicker\n          setStyles(leavingEle, step * -100, 1);\n\n        } else if (direction == 'back') {\n          setStyles(enteringEle, (1 - step) * -100, 1);\n          setStyles(leavingEle, step * 100, 1);\n\n        } else {\n          // swap, enter, exit\n          setStyles(enteringEle, 0, 1);\n          setStyles(leavingEle, 0, 0);\n        }\n      },\n      shouldAnimate: shouldAnimate\n    };\n\n    return d;\n  };\n\n  provider.transitions.navBar.android = function(enteringHeaderBar, leavingHeaderBar, direction, shouldAnimate) {\n\n    function setStyles(ctrl, opacity) {\n      if (!ctrl) return;\n      var css = {};\n      css.opacity = opacity === 1 ? '' : opacity;\n\n      ctrl.setCss('buttons-left', css);\n      ctrl.setCss('buttons-right', css);\n      ctrl.setCss('back-button', css);\n      ctrl.setCss('back-text', css);\n      ctrl.setCss('title', css);\n    }\n\n    return {\n      run: function(step) {\n        setStyles(enteringHeaderBar.controller(), step);\n        setStyles(leavingHeaderBar && leavingHeaderBar.controller(), 1 - step);\n      },\n      shouldAnimate: shouldAnimate && (direction == 'forward' || direction == 'back')\n    };\n  };\n\n\n  // No Transition\n  // -----------------------\n\n  provider.transitions.views.none = function(enteringEle, leavingEle) {\n    return {\n      run: function(step) {\n        provider.transitions.views.android(enteringEle, leavingEle, false, false).run(step);\n      },\n      shouldAnimate: false\n    };\n  };\n\n  provider.transitions.navBar.none = function(enteringHeaderBar, leavingHeaderBar) {\n    return {\n      run: function(step) {\n        provider.transitions.navBar.ios(enteringHeaderBar, leavingHeaderBar, false, false).run(step);\n        provider.transitions.navBar.android(enteringHeaderBar, leavingHeaderBar, false, false).run(step);\n      },\n      shouldAnimate: false\n    };\n  };\n\n\n  // private: used to set platform configs\n  function setPlatformConfig(platformName, platformConfigs) {\n    configProperties.platform[platformName] = platformConfigs;\n    provider.platform[platformName] = {};\n\n    addConfig(configProperties, configProperties.platform[platformName]);\n\n    createConfig(configProperties.platform[platformName], provider.platform[platformName], '');\n  }\n\n\n  // private: used to recursively add new platform configs\n  function addConfig(configObj, platformObj) {\n    for (var n in configObj) {\n      if (n != PLATFORM && configObj.hasOwnProperty(n)) {\n        if (angular.isObject(configObj[n])) {\n          if (!isDefined(platformObj[n])) {\n            platformObj[n] = {};\n          }\n          addConfig(configObj[n], platformObj[n]);\n\n        } else if (!isDefined(platformObj[n])) {\n          platformObj[n] = null;\n        }\n      }\n    }\n  }\n\n\n  // private: create methods for each config to get/set\n  function createConfig(configObj, providerObj, platformPath) {\n    forEach(configObj, function(value, namespace) {\n\n      if (angular.isObject(configObj[namespace])) {\n        // recursively drill down the config object so we can create a method for each one\n        providerObj[namespace] = {};\n        createConfig(configObj[namespace], providerObj[namespace], platformPath + '.' + namespace);\n\n      } else {\n        // create a method for the provider/config methods that will be exposed\n        providerObj[namespace] = function(newValue) {\n          if (arguments.length) {\n            configObj[namespace] = newValue;\n            return providerObj;\n          }\n          if (configObj[namespace] == PLATFORM) {\n            // if the config is set to 'platform', then get this config's platform value\n            var platformConfig = stringObj(configProperties.platform, ionic.Platform.platform() + platformPath + '.' + namespace);\n            if (platformConfig || platformConfig === false) {\n              return platformConfig;\n            }\n            // didnt find a specific platform config, now try the default\n            return stringObj(configProperties.platform, 'default' + platformPath + '.' + namespace);\n          }\n          return configObj[namespace];\n        };\n      }\n\n    });\n  }\n\n  function stringObj(obj, str) {\n    str = str.split(\".\");\n    for (var i = 0; i < str.length; i++) {\n      if (obj && isDefined(obj[str[i]])) {\n        obj = obj[str[i]];\n      } else {\n        return null;\n      }\n    }\n    return obj;\n  }\n\n  provider.setPlatformConfig = setPlatformConfig;\n\n\n  // private: Service definition for internal Ionic use\n  /**\n   * @ngdoc service\n   * @name $ionicConfig\n   * @module ionic\n   * @private\n   */\n  provider.$get = function() {\n    return provider;\n  };\n})\n// Fix for URLs in Cordova apps on Windows Phone\n// http://blogs.msdn.com/b/msdn_answers/archive/2015/02/10/\n// running-cordova-apps-on-windows-and-windows-phone-8-1-using-ionic-angularjs-and-other-frameworks.aspx\n.config(['$compileProvider', function($compileProvider) {\n  $compileProvider.aHrefSanitizationWhitelist(/^\\s*(https?|sms|tel|geo|ftp|mailto|file|ghttps?|ms-appx-web|ms-appx|x-wmapp0):/);\n  $compileProvider.imgSrcSanitizationWhitelist(/^\\s*(https?|ftp|file|content|blob|ms-appx|ms-appx-web|x-wmapp0):|data:image\\//);\n}]);\n\n\nvar LOADING_TPL =\n  '<div class=\"loading-container\">' +\n    '<div class=\"loading\">' +\n    '</div>' +\n  '</div>';\n\n/**\n * @ngdoc service\n * @name $ionicLoading\n * @module ionic\n * @description\n * An overlay that can be used to indicate activity while blocking user\n * interaction.\n *\n * @usage\n * ```js\n * angular.module('LoadingApp', ['ionic'])\n * .controller('LoadingCtrl', function($scope, $ionicLoading) {\n *   $scope.show = function() {\n *     $ionicLoading.show({\n *       template: 'Loading...'\n *     }).then(function(){\n *        console.log(\"The loading indicator is now displayed\");\n *     });\n *   };\n *   $scope.hide = function(){\n *     $ionicLoading.hide().then(function(){\n *        console.log(\"The loading indicator is now hidden\");\n *     });\n *   };\n * });\n * ```\n */\n/**\n * @ngdoc object\n * @name $ionicLoadingConfig\n * @module ionic\n * @description\n * Set the default options to be passed to the {@link ionic.service:$ionicLoading} service.\n *\n * @usage\n * ```js\n * var app = angular.module('myApp', ['ionic'])\n * app.constant('$ionicLoadingConfig', {\n *   template: 'Default Loading Template...'\n * });\n * app.controller('AppCtrl', function($scope, $ionicLoading) {\n *   $scope.showLoading = function() {\n *     //options default to values in $ionicLoadingConfig\n *     $ionicLoading.show().then(function(){\n *        console.log(\"The loading indicator is now displayed\");\n *     });\n *   };\n * });\n * ```\n */\nIonicModule\n.constant('$ionicLoadingConfig', {\n  template: '<ion-spinner></ion-spinner>'\n})\n.factory('$ionicLoading', [\n  '$ionicLoadingConfig',\n  '$ionicBody',\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$timeout',\n  '$q',\n  '$log',\n  '$compile',\n  '$ionicPlatform',\n  '$rootScope',\n  'IONIC_BACK_PRIORITY',\nfunction($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $compile, $ionicPlatform, $rootScope, IONIC_BACK_PRIORITY) {\n\n  var loaderInstance;\n  //default values\n  var deregisterBackAction = noop;\n  var deregisterStateListener1 = noop;\n  var deregisterStateListener2 = noop;\n  var loadingShowDelay = $q.when();\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#show\n     * @description Shows a loading indicator. If the indicator is already shown,\n     * it will set the options given and keep the indicator shown.\n     * @returns {promise} A promise which is resolved when the loading indicator is presented.\n     * @param {object} opts The options for the loading indicator. Available properties:\n     *  - `{string=}` `template` The html content of the indicator.\n     *  - `{string=}` `templateUrl` The url of an html template to load as the content of the indicator.\n     *  - `{object=}` `scope` The scope to be a child of. Default: creates a child of $rootScope.\n     *  - `{boolean=}` `noBackdrop` Whether to hide the backdrop. By default it will be shown.\n     *  - `{boolean=}` `hideOnStateChange` Whether to hide the loading spinner when navigating\n     *    to a new state. Default false.\n     *  - `{number=}` `delay` How many milliseconds to delay showing the indicator. By default there is no delay.\n     *  - `{number=}` `duration` How many milliseconds to wait until automatically\n     *  hiding the indicator. By default, the indicator will be shown until `.hide()` is called.\n     */\n    show: showLoader,\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#hide\n     * @description Hides the loading indicator, if shown.\n     * @returns {promise} A promise which is resolved when the loading indicator is hidden.\n     */\n    hide: hideLoader,\n    /**\n     * @private for testing\n     */\n    _getLoader: getLoader\n  };\n\n  function getLoader() {\n    if (!loaderInstance) {\n      loaderInstance = $ionicTemplateLoader.compile({\n        template: LOADING_TPL,\n        appendTo: $ionicBody.get()\n      })\n      .then(function(self) {\n        self.show = function(options) {\n          var templatePromise = options.templateUrl ?\n            $ionicTemplateLoader.load(options.templateUrl) :\n            //options.content: deprecated\n            $q.when(options.template || options.content || '');\n\n          self.scope = options.scope || self.scope;\n\n          if (!self.isShown) {\n            //options.showBackdrop: deprecated\n            self.hasBackdrop = !options.noBackdrop && options.showBackdrop !== false;\n            if (self.hasBackdrop) {\n              $ionicBackdrop.retain();\n              $ionicBackdrop.getElement().addClass('backdrop-loading');\n            }\n          }\n\n          if (options.duration) {\n            $timeout.cancel(self.durationTimeout);\n            self.durationTimeout = $timeout(\n              angular.bind(self, self.hide),\n              +options.duration\n            );\n          }\n\n          deregisterBackAction();\n          //Disable hardware back button while loading\n          deregisterBackAction = $ionicPlatform.registerBackButtonAction(\n            noop,\n            IONIC_BACK_PRIORITY.loading\n          );\n\n          templatePromise.then(function(html) {\n            if (html) {\n              var loading = self.element.children();\n              loading.html(html);\n              $compile(loading.contents())(self.scope);\n            }\n\n            //Don't show until template changes\n            if (self.isShown) {\n              self.element.addClass('visible');\n              ionic.requestAnimationFrame(function() {\n                if (self.isShown) {\n                  self.element.addClass('active');\n                  $ionicBody.addClass('loading-active');\n                }\n              });\n            }\n          });\n\n          self.isShown = true;\n        };\n        self.hide = function() {\n\n          deregisterBackAction();\n          if (self.isShown) {\n            if (self.hasBackdrop) {\n              $ionicBackdrop.release();\n              $ionicBackdrop.getElement().removeClass('backdrop-loading');\n            }\n            self.element.removeClass('active');\n            $ionicBody.removeClass('loading-active');\n            self.element.removeClass('visible');\n            ionic.requestAnimationFrame(function() {\n              !self.isShown && self.element.removeClass('visible');\n            });\n          }\n          $timeout.cancel(self.durationTimeout);\n          self.isShown = false;\n          var loading = self.element.children();\n          loading.html(\"\");\n        };\n\n        return self;\n      });\n    }\n    return loaderInstance;\n  }\n\n  function showLoader(options) {\n    options = extend({}, $ionicLoadingConfig || {}, options || {});\n    // use a default delay of 100 to avoid some issues reported on github\n    // https://github.com/driftyco/ionic/issues/3717\n    var delay = options.delay || options.showDelay || 0;\n\n    deregisterStateListener1();\n    deregisterStateListener2();\n    if (options.hideOnStateChange) {\n      deregisterStateListener1 = $rootScope.$on('$stateChangeSuccess', hideLoader);\n      deregisterStateListener2 = $rootScope.$on('$stateChangeError', hideLoader);\n    }\n\n    //If loading.show() was called previously, cancel it and show with our new options\n    $timeout.cancel(loadingShowDelay);\n    loadingShowDelay = $timeout(noop, delay);\n    return loadingShowDelay.then(getLoader).then(function(loader) {\n      return loader.show(options);\n    });\n  }\n\n  function hideLoader() {\n    deregisterStateListener1();\n    deregisterStateListener2();\n    $timeout.cancel(loadingShowDelay);\n    return getLoader().then(function(loader) {\n      return loader.hide();\n    });\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicModal\n * @module ionic\n * @codepen gblny\n * @description\n *\n * Related: {@link ionic.controller:ionicModal ionicModal controller}.\n *\n * The Modal is a content pane that can go over the user's main view\n * temporarily.  Usually used for making a choice or editing an item.\n *\n * Put the content of the modal inside of an `<ion-modal-view>` element.\n *\n * **Notes:**\n * - A modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n * scope, passing in itself as an event argument. Both the modal.removed and modal.hidden events are\n * called when the modal is removed.\n *\n * - This example assumes your modal is in your main index file or another template file. If it is in its own\n * template file, remove the script tags and call it by file name.\n *\n * @usage\n * ```html\n * <script id=\"my-modal.html\" type=\"text/ng-template\">\n *   <ion-modal-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Modal title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-modal-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicModal) {\n *   $ionicModal.fromTemplateUrl('my-modal.html', {\n *     scope: $scope,\n *     animation: 'slide-in-up'\n *   }).then(function(modal) {\n *     $scope.modal = modal;\n *   });\n *   $scope.openModal = function() {\n *     $scope.modal.show();\n *   };\n *   $scope.closeModal = function() {\n *     $scope.modal.hide();\n *   };\n *   // Cleanup the modal when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.modal.remove();\n *   });\n *   // Execute action on hide modal\n *   $scope.$on('modal.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove modal\n *   $scope.$on('modal.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\nIonicModule\n.factory('$ionicModal', [\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$timeout',\n  '$ionicPlatform',\n  '$ionicTemplateLoader',\n  '$$q',\n  '$log',\n  '$ionicClickBlock',\n  '$window',\n  'IONIC_BACK_PRIORITY',\nfunction($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTemplateLoader, $$q, $log, $ionicClickBlock, $window, IONIC_BACK_PRIORITY) {\n\n  /**\n   * @ngdoc controller\n   * @name ionicModal\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicModal} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each modal\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n   * scope, passing in itself as an event argument. Note: both modal.removed and modal.hidden are\n   * called when the modal is removed.\n   */\n  var ModalView = ionic.views.Modal.inherit({\n    /**\n     * @ngdoc method\n     * @name ionicModal#initialize\n     * @description Creates a new modal controller instance.\n     * @param {object} options An options object with the following properties:\n     *  - `{object=}` `scope` The scope to be a child of.\n     *    Default: creates a child of $rootScope.\n     *  - `{string=}` `animation` The animation to show & hide with.\n     *    Default: 'slide-in-up'\n     *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n     *    the modal when shown. Will only show the keyboard on iOS, to force the keyboard to show\n     *    on Android, please use the [Ionic keyboard plugin](https://github.com/driftyco/ionic-plugin-keyboard#keyboardshow).\n     *    Default: false.\n     *  - `{boolean=}` `backdropClickToClose` Whether to close the modal on clicking the backdrop.\n     *    Default: true.\n     *  - `{boolean=}` `hardwareBackButtonClose` Whether the modal can be closed using the hardware\n     *    back button on Android and similar devices.  Default: true.\n     */\n    initialize: function(opts) {\n      ionic.views.Modal.prototype.initialize.call(this, opts);\n      this.animation = opts.animation || 'slide-in-up';\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#show\n     * @description Show this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating in.\n     */\n    show: function(target) {\n      var self = this;\n\n      if (self.scope.$$destroyed) {\n        $log.error('Cannot call ' + self.viewType + '.show() after remove(). Please create a new ' + self.viewType + ' instance.');\n        return $$q.when();\n      }\n\n      // on iOS, clicks will sometimes bleed through/ghost click on underlying\n      // elements\n      $ionicClickBlock.show(600);\n      stack.add(self);\n\n      var modalEl = jqLite(self.modalEl);\n\n      self.el.classList.remove('hide');\n      $timeout(function() {\n        if (!self._isShown) return;\n        $ionicBody.addClass(self.viewType + '-open');\n      }, 400, false);\n\n      if (!self.el.parentElement) {\n        modalEl.addClass(self.animation);\n        $ionicBody.append(self.el);\n      }\n\n      // if modal was closed while the keyboard was up, reset scroll view on\n      // next show since we can only resize it once it's visible\n      var scrollCtrl = modalEl.data('$$ionicScrollController');\n      scrollCtrl && scrollCtrl.resize();\n\n      if (target && self.positionView) {\n        self.positionView(target, modalEl);\n        // set up a listener for in case the window size changes\n\n        self._onWindowResize = function() {\n          if (self._isShown) self.positionView(target, modalEl);\n        };\n        ionic.on('resize', self._onWindowResize, window);\n      }\n\n      modalEl.addClass('ng-enter active')\n             .removeClass('ng-leave ng-leave-active');\n\n      self._isShown = true;\n      self._deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n        self.hardwareBackButtonClose ? angular.bind(self, self.hide) : noop,\n        IONIC_BACK_PRIORITY.modal\n      );\n\n      ionic.views.Modal.prototype.show.call(self);\n\n      $timeout(function() {\n        if (!self._isShown) return;\n        modalEl.addClass('ng-enter-active');\n        ionic.trigger('resize');\n        self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.shown', self);\n        self.el.classList.add('active');\n        self.scope.$broadcast('$ionicHeader.align');\n        self.scope.$broadcast('$ionicFooter.align');\n        self.scope.$broadcast('$ionic.modalPresented');\n      }, 20);\n\n      return $timeout(function() {\n        if (!self._isShown) return;\n        self.$el.on('touchmove', function(e) {\n          //Don't allow scrolling while open by dragging on backdrop\n          var isInScroll = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'scroll');\n          if (!isInScroll) {\n            e.preventDefault();\n          }\n        });\n        //After animating in, allow hide on backdrop click\n        self.$el.on('click', function(e) {\n          if (self.backdropClickToClose && e.target === self.el && stack.isHighest(self)) {\n            self.hide();\n          }\n        });\n      }, 400);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#hide\n     * @description Hide this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    hide: function() {\n      var self = this;\n      var modalEl = jqLite(self.modalEl);\n\n      // on iOS, clicks will sometimes bleed through/ghost click on underlying\n      // elements\n      $ionicClickBlock.show(600);\n      stack.remove(self);\n\n      self.el.classList.remove('active');\n      modalEl.addClass('ng-leave');\n\n      $timeout(function() {\n        if (self._isShown) return;\n        modalEl.addClass('ng-leave-active')\n               .removeClass('ng-enter ng-enter-active active');\n\n        self.scope.$broadcast('$ionic.modalRemoved');\n      }, 20, false);\n\n      self.$el.off('click');\n      self._isShown = false;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.hidden', self);\n      self._deregisterBackButton && self._deregisterBackButton();\n\n      ionic.views.Modal.prototype.hide.call(self);\n\n      // clean up event listeners\n      if (self.positionView) {\n        ionic.off('resize', self._onWindowResize, window);\n      }\n\n      return $timeout(function() {\n        $ionicBody.removeClass(self.viewType + '-open');\n        self.el.classList.add('hide');\n      }, self.hideDelay || 320);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#remove\n     * @description Remove this modal instance from the DOM and clean up.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    remove: function() {\n      var self = this,\n          deferred, promise;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.removed', self);\n\n      // Only hide modal, when it is actually shown!\n      // The hide function shows a click-block-div for a split second, because on iOS,\n      // clicks will sometimes bleed through/ghost click on underlying elements.\n      // However, this will make the app unresponsive for short amount of time.\n      // We don't want that, if the modal window is already hidden.\n      if (self._isShown) {\n        promise = self.hide();\n      } else {\n        deferred = $$q.defer();\n        deferred.resolve();\n        promise = deferred.promise;\n      }\n\n      return promise.then(function() {\n        self.scope.$destroy();\n        self.$el.remove();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#isShown\n     * @returns boolean Whether this modal is currently shown.\n     */\n    isShown: function() {\n      return !!this._isShown;\n    }\n  });\n\n  var createModal = function(templateString, options) {\n    // Create a new scope for the modal\n    var scope = options.scope && options.scope.$new() || $rootScope.$new(true);\n\n    options.viewType = options.viewType || 'modal';\n\n    extend(scope, {\n      $hasHeader: false,\n      $hasSubheader: false,\n      $hasFooter: false,\n      $hasSubfooter: false,\n      $hasTabs: false,\n      $hasTabsTop: false\n    });\n\n    // Compile the template\n    var element = $compile('<ion-' + options.viewType + '>' + templateString + '</ion-' + options.viewType + '>')(scope);\n\n    options.$el = element;\n    options.el = element[0];\n    options.modalEl = options.el.querySelector('.' + options.viewType);\n    var modal = new ModalView(options);\n\n    modal.scope = scope;\n\n    // If this wasn't a defined scope, we can assign the viewType to the isolated scope\n    // we created\n    if (!options.scope) {\n      scope[ options.viewType ] = modal;\n    }\n\n    return modal;\n  };\n\n  var modalStack = [];\n  var stack = {\n    add: function(modal) {\n      modalStack.push(modal);\n    },\n    remove: function(modal) {\n      var index = modalStack.indexOf(modal);\n      if (index > -1 && index < modalStack.length) {\n        modalStack.splice(index, 1);\n      }\n    },\n    isHighest: function(modal) {\n      var index = modalStack.indexOf(modal);\n      return (index > -1 && index === modalStack.length - 1);\n    }\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplate\n     * @param {string} templateString The template string to use as the modal's\n     * content.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicModal}\n     * controller.\n     */\n    fromTemplate: function(templateString, options) {\n      var modal = createModal(templateString, options || {});\n      return modal;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * options object.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicModal} controller.\n     */\n    fromTemplateUrl: function(url, options, _) {\n      var cb;\n      //Deprecated: allow a callback as second parameter. Now we return a promise.\n      if (angular.isFunction(options)) {\n        cb = options;\n        options = _;\n      }\n      return $ionicTemplateLoader.load(url).then(function(templateString) {\n        var modal = createModal(templateString, options || {});\n        cb && cb(modal);\n        return modal;\n      });\n    },\n\n    stack: stack\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicNavBarDelegate\n * @module ionic\n * @description\n * Delegate for controlling the {@link ionic.directive:ionNavBar} directive.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-nav-bar>\n *     <button ng-click=\"setNavTitle('banana')\">\n *       Set title to banana!\n *     </button>\n *   </ion-nav-bar>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.setNavTitle = function(title) {\n *     $ionicNavBarDelegate.title(title);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicNavBarDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#align\n   * @description Aligns the title with the buttons in a given direction.\n   * @param {string=} direction The direction to the align the title text towards.\n   * Available: 'left', 'right', 'center'. Default: 'center'.\n   */\n  'align',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBackButton\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBackButton} is shown\n   * (if it exists and there is a previous view that can be navigated to).\n   * @param {boolean=} show Whether to show the back button.\n   * @returns {boolean} Whether the back button is shown.\n   */\n  'showBackButton',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBar\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBar} is shown.\n   * @param {boolean} show Whether to show the bar.\n   * @returns {boolean} Whether the bar is shown.\n   */\n  'showBar',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#title\n   * @description\n   * Set the title for the {@link ionic.directive:ionNavBar}.\n   * @param {string} title The new title to show.\n   */\n  'title',\n\n  // DEPRECATED, as of v1.0.0-beta14 -------\n  'changeTitle',\n  'setTitle',\n  'getTitle',\n  'back',\n  'getPreviousTitle'\n  // END DEPRECATED -------\n]));\n\n\nIonicModule\n.service('$ionicNavViewDelegate', ionic.DelegateService([\n  'clearCache'\n]));\n\n\n\n/**\n * @ngdoc service\n * @name $ionicPlatform\n * @module ionic\n * @description\n * An angular abstraction of {@link ionic.utility:ionic.Platform}.\n *\n * Used to detect the current platform, as well as do things like override the\n * Android back button in PhoneGap/Cordova.\n */\nIonicModule\n.constant('IONIC_BACK_PRIORITY', {\n  view: 100,\n  sideMenu: 150,\n  modal: 200,\n  actionSheet: 300,\n  popup: 400,\n  loading: 500\n})\n.provider('$ionicPlatform', function() {\n  return {\n    $get: ['$q', '$ionicScrollDelegate', function($q, $ionicScrollDelegate) {\n      var self = {\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#onHardwareBackButton\n         * @description\n         * Some platforms have a hardware back button, so this is one way to\n         * bind to it.\n         * @param {function} callback the callback to trigger when this event occurs\n         */\n        onHardwareBackButton: function(cb) {\n          ionic.Platform.ready(function() {\n            document.addEventListener('backbutton', cb, false);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#offHardwareBackButton\n         * @description\n         * Remove an event listener for the backbutton.\n         * @param {function} callback The listener function that was\n         * originally bound.\n         */\n        offHardwareBackButton: function(fn) {\n          ionic.Platform.ready(function() {\n            document.removeEventListener('backbutton', fn);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#registerBackButtonAction\n         * @description\n         * Register a hardware back button action. Only one action will execute\n         * when the back button is clicked, so this method decides which of\n         * the registered back button actions has the highest priority.\n         *\n         * For example, if an actionsheet is showing, the back button should\n         * close the actionsheet, but it should not also go back a page view\n         * or close a modal which may be open.\n         *\n         * The priorities for the existing back button hooks are as follows:\n         *   Return to previous view = 100\n         *   Close side menu = 150\n         *   Dismiss modal = 200\n         *   Close action sheet = 300\n         *   Dismiss popup = 400\n         *   Dismiss loading overlay = 500\n         *\n         * Your back button action will override each of the above actions\n         * whose priority is less than the priority you provide. For example,\n         * an action assigned a priority of 101 will override the 'return to\n         * previous view' action, but not any of the other actions.\n         *\n         * @param {function} callback Called when the back button is pressed,\n         * if this listener is the highest priority.\n         * @param {number} priority Only the highest priority will execute.\n         * @param {*=} actionId The id to assign this action. Default: a\n         * random unique id.\n         * @returns {function} A function that, when called, will deregister\n         * this backButtonAction.\n         */\n        $backButtonActions: {},\n        registerBackButtonAction: function(fn, priority, actionId) {\n\n          if (!self._hasBackButtonHandler) {\n            // add a back button listener if one hasn't been setup yet\n            self.$backButtonActions = {};\n            self.onHardwareBackButton(self.hardwareBackButtonClick);\n            self._hasBackButtonHandler = true;\n          }\n\n          var action = {\n            id: (actionId ? actionId : ionic.Utils.nextUid()),\n            priority: (priority ? priority : 0),\n            fn: fn\n          };\n          self.$backButtonActions[action.id] = action;\n\n          // return a function to de-register this back button action\n          return function() {\n            delete self.$backButtonActions[action.id];\n          };\n        },\n\n        /**\n         * @private\n         */\n        hardwareBackButtonClick: function(e) {\n          // loop through all the registered back button actions\n          // and only run the last one of the highest priority\n          var priorityAction, actionId;\n          for (actionId in self.$backButtonActions) {\n            if (!priorityAction || self.$backButtonActions[actionId].priority >= priorityAction.priority) {\n              priorityAction = self.$backButtonActions[actionId];\n            }\n          }\n          if (priorityAction) {\n            priorityAction.fn(e);\n            return priorityAction;\n          }\n        },\n\n        is: function(type) {\n          return ionic.Platform.is(type);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#on\n         * @description\n         * Add Cordova event listeners, such as `pause`, `resume`, `volumedownbutton`, `batterylow`,\n         * `offline`, etc. More information about available event types can be found in\n         * [Cordova's event documentation](https://cordova.apache.org/docs/en/edge/cordova_events_events.md.html#Events).\n         * @param {string} type Cordova [event type](https://cordova.apache.org/docs/en/edge/cordova_events_events.md.html#Events).\n         * @param {function} callback Called when the Cordova event is fired.\n         * @returns {function} Returns a deregistration function to remove the event listener.\n         */\n        on: function(type, cb) {\n          ionic.Platform.ready(function() {\n            document.addEventListener(type, cb, false);\n          });\n          return function() {\n            ionic.Platform.ready(function() {\n              document.removeEventListener(type, cb);\n            });\n          };\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#ready\n         * @description\n         * Trigger a callback once the device is ready,\n         * or immediately if the device is already ready.\n         * @param {function=} callback The function to call.\n         * @returns {promise} A promise which is resolved when the device is ready.\n         */\n        ready: function(cb) {\n          var q = $q.defer();\n\n          ionic.Platform.ready(function() {\n\n            window.addEventListener('statusTap', function() {\n              $ionicScrollDelegate.scrollTop(true);\n            });\n\n            q.resolve();\n            cb && cb();\n          });\n\n          return q.promise;\n        }\n      };\n\n      return self;\n    }]\n  };\n\n});\n\n/**\n * @ngdoc service\n * @name $ionicPopover\n * @module ionic\n * @description\n *\n * Related: {@link ionic.controller:ionicPopover ionicPopover controller}.\n *\n * The Popover is a view that floats above an app’s content. Popovers provide an\n * easy way to present or gather information from the user and are\n * commonly used in the following situations:\n *\n * - Show more info about the current view\n * - Select a commonly used tool or configuration\n * - Present a list of actions to perform inside one of your views\n *\n * Put the content of the popover inside of an `<ion-popover-view>` element.\n *\n * @usage\n * ```html\n * <p>\n *   <button ng-click=\"openPopover($event)\">Open Popover</button>\n * </p>\n *\n * <script id=\"my-popover.html\" type=\"text/ng-template\">\n *   <ion-popover-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Popover Title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-popover-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicPopover) {\n *\n *   // .fromTemplate() method\n *   var template = '<ion-popover-view><ion-header-bar> <h1 class=\"title\">My Popover Title</h1> </ion-header-bar> <ion-content> Hello! </ion-content></ion-popover-view>';\n *\n *   $scope.popover = $ionicPopover.fromTemplate(template, {\n *     scope: $scope\n *   });\n *\n *   // .fromTemplateUrl() method\n *   $ionicPopover.fromTemplateUrl('my-popover.html', {\n *     scope: $scope\n *   }).then(function(popover) {\n *     $scope.popover = popover;\n *   });\n *\n *\n *   $scope.openPopover = function($event) {\n *     $scope.popover.show($event);\n *   };\n *   $scope.closePopover = function() {\n *     $scope.popover.hide();\n *   };\n *   //Cleanup the popover when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.popover.remove();\n *   });\n *   // Execute action on hide popover\n *   $scope.$on('popover.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove popover\n *   $scope.$on('popover.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\n\n\nIonicModule\n.factory('$ionicPopover', ['$ionicModal', '$ionicPosition', '$document', '$window',\nfunction($ionicModal, $ionicPosition, $document, $window) {\n\n  var POPOVER_BODY_PADDING = 6;\n\n  var POPOVER_OPTIONS = {\n    viewType: 'popover',\n    hideDelay: 1,\n    animation: 'none',\n    positionView: positionView\n  };\n\n  function positionView(target, popoverEle) {\n    var targetEle = jqLite(target.target || target);\n    var buttonOffset = $ionicPosition.offset(targetEle);\n    var popoverWidth = popoverEle.prop('offsetWidth');\n    var popoverHeight = popoverEle.prop('offsetHeight');\n    // Use innerWidth and innerHeight, because clientWidth and clientHeight\n    // doesn't work consistently for body on all platforms\n    var bodyWidth = $window.innerWidth;\n    var bodyHeight = $window.innerHeight;\n\n    var popoverCSS = {\n      left: buttonOffset.left + buttonOffset.width / 2 - popoverWidth / 2\n    };\n    var arrowEle = jqLite(popoverEle[0].querySelector('.popover-arrow'));\n\n    if (popoverCSS.left < POPOVER_BODY_PADDING) {\n      popoverCSS.left = POPOVER_BODY_PADDING;\n    } else if (popoverCSS.left + popoverWidth + POPOVER_BODY_PADDING > bodyWidth) {\n      popoverCSS.left = bodyWidth - popoverWidth - POPOVER_BODY_PADDING;\n    }\n\n    // If the popover when popped down stretches past bottom of screen,\n    // make it pop up if there's room above\n    if (buttonOffset.top + buttonOffset.height + popoverHeight > bodyHeight &&\n        buttonOffset.top - popoverHeight > 0) {\n      popoverCSS.top = buttonOffset.top - popoverHeight;\n      popoverEle.addClass('popover-bottom');\n    } else {\n      popoverCSS.top = buttonOffset.top + buttonOffset.height;\n      popoverEle.removeClass('popover-bottom');\n    }\n\n    arrowEle.css({\n      left: buttonOffset.left + buttonOffset.width / 2 -\n        arrowEle.prop('offsetWidth') / 2 - popoverCSS.left + 'px'\n    });\n\n    popoverEle.css({\n      top: popoverCSS.top + 'px',\n      left: popoverCSS.left + 'px',\n      marginLeft: '0',\n      opacity: '1'\n    });\n\n  }\n\n  /**\n   * @ngdoc controller\n   * @name ionicPopover\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicPopover} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each popover\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a popover will broadcast 'popover.shown', 'popover.hidden', and 'popover.removed' events from its originating\n   * scope, passing in itself as an event argument. Both the popover.removed and popover.hidden events are\n   * called when the popover is removed.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#initialize\n   * @description Creates a new popover controller instance.\n   * @param {object} options An options object with the following properties:\n   *  - `{object=}` `scope` The scope to be a child of.\n   *    Default: creates a child of $rootScope.\n   *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n   *    the popover when shown.  Default: false.\n   *  - `{boolean=}` `backdropClickToClose` Whether to close the popover on clicking the backdrop.\n   *    Default: true.\n   *  - `{boolean=}` `hardwareBackButtonClose` Whether the popover can be closed using the hardware\n   *    back button on Android and similar devices.  Default: true.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#show\n   * @description Show this popover instance.\n   * @param {$event} $event The $event or target element which the popover should align\n   * itself next to.\n   * @returns {promise} A promise which is resolved when the popover is finished animating in.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#hide\n   * @description Hide this popover instance.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#remove\n   * @description Remove this popover instance from the DOM and clean up.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#isShown\n   * @returns boolean Whether this popover is currently shown.\n   */\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplate\n     * @param {string} templateString The template string to use as the popovers's\n     * content.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicPopover}\n     * controller (ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplate: function(templateString, options) {\n      return $ionicModal.fromTemplate(templateString, ionic.Utils.extend({}, POPOVER_OPTIONS, options));\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicPopover} controller (ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplateUrl: function(url, options) {\n      return $ionicModal.fromTemplateUrl(url, ionic.Utils.extend({}, POPOVER_OPTIONS, options));\n    }\n  };\n\n}]);\n\n\nvar POPUP_TPL =\n  '<div class=\"popup-container\" ng-class=\"cssClass\">' +\n    '<div class=\"popup\">' +\n      '<div class=\"popup-head\">' +\n        '<h3 class=\"popup-title\" ng-bind-html=\"title\"></h3>' +\n        '<h5 class=\"popup-sub-title\" ng-bind-html=\"subTitle\" ng-if=\"subTitle\"></h5>' +\n      '</div>' +\n      '<div class=\"popup-body\">' +\n      '</div>' +\n      '<div class=\"popup-buttons\" ng-show=\"buttons.length\">' +\n        '<button ng-repeat=\"button in buttons\" ng-click=\"$buttonTapped(button, $event)\" class=\"button\" ng-class=\"button.type || \\'button-default\\'\" ng-bind-html=\"button.text\"></button>' +\n      '</div>' +\n    '</div>' +\n  '</div>';\n\n/**\n * @ngdoc service\n * @name $ionicPopup\n * @module ionic\n * @restrict E\n * @codepen zkmhJ\n * @description\n *\n * The Ionic Popup service allows programmatically creating and showing popup\n * windows that require the user to respond in order to continue.\n *\n * The popup system has support for more flexible versions of the built in `alert()`, `prompt()`,\n * and `confirm()` functions that users are used to, in addition to allowing popups with completely\n * custom content and look.\n *\n * An input can be given an `autofocus` attribute so it automatically receives focus when\n * the popup first shows. However, depending on certain use-cases this can cause issues with\n * the tap/click system, which is why Ionic prefers using the `autofocus` attribute as\n * an opt-in feature and not the default.\n *\n * @usage\n * A few basic examples, see below for details about all of the options available.\n *\n * ```js\n *angular.module('mySuperApp', ['ionic'])\n *.controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {\n *\n * // Triggered on a button click, or some other target\n * $scope.showPopup = function() {\n *   $scope.data = {};\n *\n *   // An elaborate, custom popup\n *   var myPopup = $ionicPopup.show({\n *     template: '<input type=\"password\" ng-model=\"data.wifi\">',\n *     title: 'Enter Wi-Fi Password',\n *     subTitle: 'Please use normal things',\n *     scope: $scope,\n *     buttons: [\n *       { text: 'Cancel' },\n *       {\n *         text: '<b>Save</b>',\n *         type: 'button-positive',\n *         onTap: function(e) {\n *           if (!$scope.data.wifi) {\n *             //don't allow the user to close unless he enters wifi password\n *             e.preventDefault();\n *           } else {\n *             return $scope.data.wifi;\n *           }\n *         }\n *       }\n *     ]\n *   });\n *\n *   myPopup.then(function(res) {\n *     console.log('Tapped!', res);\n *   });\n *\n *   $timeout(function() {\n *      myPopup.close(); //close the popup after 3 seconds for some reason\n *   }, 3000);\n *  };\n *\n *  // A confirm dialog\n *  $scope.showConfirm = function() {\n *    var confirmPopup = $ionicPopup.confirm({\n *      title: 'Consume Ice Cream',\n *      template: 'Are you sure you want to eat this ice cream?'\n *    });\n *\n *    confirmPopup.then(function(res) {\n *      if(res) {\n *        console.log('You are sure');\n *      } else {\n *        console.log('You are not sure');\n *      }\n *    });\n *  };\n *\n *  // An alert dialog\n *  $scope.showAlert = function() {\n *    var alertPopup = $ionicPopup.alert({\n *      title: 'Don\\'t eat that!',\n *      template: 'It might taste good'\n *    });\n *\n *    alertPopup.then(function(res) {\n *      console.log('Thank you for not eating my delicious ice cream cone');\n *    });\n *  };\n *});\n *```\n */\n\nIonicModule\n.factory('$ionicPopup', [\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$q',\n  '$timeout',\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$ionicPlatform',\n  '$ionicModal',\n  'IONIC_BACK_PRIORITY',\nfunction($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicBody, $compile, $ionicPlatform, $ionicModal, IONIC_BACK_PRIORITY) {\n  //TODO allow this to be configured\n  var config = {\n    stackPushDelay: 75\n  };\n  var popupStack = [];\n\n  var $ionicPopup = {\n    /**\n     * @ngdoc method\n     * @description\n     * Show a complex popup. This is the master show function for all popups.\n     *\n     * A complex popup has a `buttons` array, with each button having a `text` and `type`\n     * field, in addition to an `onTap` function.  The `onTap` function, called when\n     * the corresponding button on the popup is tapped, will by default close the popup\n     * and resolve the popup promise with its return value.  If you wish to prevent the\n     * default and keep the popup open on button tap, call `event.preventDefault()` on the\n     * passed in tap event.  Details below.\n     *\n     * @name $ionicPopup#show\n     * @param {object} options The options for the new popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   scope: null, // Scope (optional). A scope to link to the popup content.\n     *   buttons: [{ // Array[Object] (optional). Buttons to place in the popup footer.\n     *     text: 'Cancel',\n     *     type: 'button-default',\n     *     onTap: function(e) {\n     *       // e.preventDefault() will stop the popup from closing when tapped.\n     *       e.preventDefault();\n     *     }\n     *   }, {\n     *     text: 'OK',\n     *     type: 'button-positive',\n     *     onTap: function(e) {\n     *       // Returning a value will cause the promise to resolve with the given value.\n     *       return scope.data.response;\n     *     }\n     *   }]\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has an additional\n     * `close` function, which can be used to programmatically close the popup.\n     */\n    show: showPopup,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#alert\n     * @description Show a simple alert popup with a message and one button that the user can\n     * tap to close the popup.\n     *\n     * @param {object} options The options for showing the alert, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    alert: showAlert,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#confirm\n     * @description\n     * Show a simple confirm popup with a Cancel and OK button.\n     *\n     * Resolves the promise with true if the user presses the OK button, and false if the\n     * user presses the Cancel button.\n     *\n     * @param {object} options The options for showing the confirm popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.\n     *   cancelType: '', // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    confirm: showConfirm,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#prompt\n     * @description Show a simple prompt popup, which has an input, OK button, and Cancel button.\n     * Resolves the promise with the value of the input if the user presses OK, and with undefined\n     * if the user presses Cancel.\n     *\n     * ```javascript\n     *  $ionicPopup.prompt({\n     *    title: 'Password Check',\n     *    template: 'Enter your secret password',\n     *    inputType: 'password',\n     *    inputPlaceholder: 'Your password'\n     *  }).then(function(res) {\n     *    console.log('Your password is', res);\n     *  });\n     * ```\n     * @param {object} options The options for showing the prompt popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup body.\n     *   inputType: // String (default: 'text'). The type of input to use\n     *   defaultText: // String (default: ''). The initial value placed into the input.\n     *   maxLength: // Integer (default: null). Specify a maxlength attribute for the input.\n     *   inputPlaceholder: // String (default: ''). A placeholder to use for the input.\n     *   cancelText: // String (default: 'Cancel'. The text of the Cancel button.\n     *   cancelType: // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: // String (default: 'OK'). The text of the OK button.\n     *   okType: // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    prompt: showPrompt,\n    /**\n     * @private for testing\n     */\n    _createPopup: createPopup,\n    _popupStack: popupStack\n  };\n\n  return $ionicPopup;\n\n  function createPopup(options) {\n    options = extend({\n      scope: null,\n      title: '',\n      buttons: []\n    }, options || {});\n\n    var self = {};\n    self.scope = (options.scope || $rootScope).$new();\n    self.element = jqLite(POPUP_TPL);\n    self.responseDeferred = $q.defer();\n\n    $ionicBody.get().appendChild(self.element[0]);\n    $compile(self.element)(self.scope);\n\n    extend(self.scope, {\n      title: options.title,\n      buttons: options.buttons,\n      subTitle: options.subTitle,\n      cssClass: options.cssClass,\n      $buttonTapped: function(button, event) {\n        var result = (button.onTap || noop).apply(self, [event]);\n        event = event.originalEvent || event; //jquery events\n\n        if (!event.defaultPrevented) {\n          self.responseDeferred.resolve(result);\n        }\n      }\n    });\n\n    $q.when(\n      options.templateUrl ?\n      $ionicTemplateLoader.load(options.templateUrl) :\n        (options.template || options.content || '')\n    ).then(function(template) {\n      var popupBody = jqLite(self.element[0].querySelector('.popup-body'));\n      if (template) {\n        popupBody.html(template);\n        $compile(popupBody.contents())(self.scope);\n      } else {\n        popupBody.remove();\n      }\n    });\n\n    self.show = function() {\n      if (self.isShown || self.removed) return;\n\n      $ionicModal.stack.add(self);\n      self.isShown = true;\n      ionic.requestAnimationFrame(function() {\n        //if hidden while waiting for raf, don't show\n        if (!self.isShown) return;\n\n        self.element.removeClass('popup-hidden');\n        self.element.addClass('popup-showing active');\n        focusInput(self.element);\n      });\n    };\n\n    self.hide = function(callback) {\n      callback = callback || noop;\n      if (!self.isShown) return callback();\n\n      $ionicModal.stack.remove(self);\n      self.isShown = false;\n      self.element.removeClass('active');\n      self.element.addClass('popup-hidden');\n      $timeout(callback, 250, false);\n    };\n\n    self.remove = function() {\n      if (self.removed) return;\n\n      self.hide(function() {\n        self.element.remove();\n        self.scope.$destroy();\n      });\n\n      self.removed = true;\n    };\n\n    return self;\n  }\n\n  function onHardwareBackButton() {\n    var last = popupStack[popupStack.length - 1];\n    last && last.responseDeferred.resolve();\n  }\n\n  function showPopup(options) {\n    var popup = $ionicPopup._createPopup(options);\n    var showDelay = 0;\n\n    if (popupStack.length > 0) {\n      showDelay = config.stackPushDelay;\n      $timeout(popupStack[popupStack.length - 1].hide, showDelay, false);\n    } else {\n      //Add popup-open & backdrop if this is first popup\n      $ionicBody.addClass('popup-open');\n      $ionicBackdrop.retain();\n      //only show the backdrop on the first popup\n      $ionicPopup._backButtonActionDone = $ionicPlatform.registerBackButtonAction(\n        onHardwareBackButton,\n        IONIC_BACK_PRIORITY.popup\n      );\n    }\n\n    // Expose a 'close' method on the returned promise\n    popup.responseDeferred.promise.close = function popupClose(result) {\n      if (!popup.removed) popup.responseDeferred.resolve(result);\n    };\n    //DEPRECATED: notify the promise with an object with a close method\n    popup.responseDeferred.notify({ close: popup.responseDeferred.close });\n\n    doShow();\n\n    return popup.responseDeferred.promise;\n\n    function doShow() {\n      popupStack.push(popup);\n      $timeout(popup.show, showDelay, false);\n\n      popup.responseDeferred.promise.then(function(result) {\n        var index = popupStack.indexOf(popup);\n        if (index !== -1) {\n          popupStack.splice(index, 1);\n        }\n\n        popup.remove();\n\n        if (popupStack.length > 0) {\n          popupStack[popupStack.length - 1].show();\n        } else {\n          $ionicBackdrop.release();\n          //Remove popup-open & backdrop if this is last popup\n          $timeout(function() {\n            // wait to remove this due to a 300ms delay native\n            // click which would trigging whatever was underneath this\n            if (!popupStack.length) {\n              $ionicBody.removeClass('popup-open');\n            }\n          }, 400, false);\n          ($ionicPopup._backButtonActionDone || noop)();\n        }\n\n\n        return result;\n      });\n\n    }\n\n  }\n\n  function focusInput(element) {\n    var focusOn = element[0].querySelector('[autofocus]');\n    if (focusOn) {\n      focusOn.focus();\n    }\n  }\n\n  function showAlert(opts) {\n    return showPopup(extend({\n      buttons: [{\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function() {\n          return true;\n        }\n      }]\n    }, opts || {}));\n  }\n\n  function showConfirm(opts) {\n    return showPopup(extend({\n      buttons: [{\n        text: opts.cancelText || 'Cancel',\n        type: opts.cancelType || 'button-default',\n        onTap: function() { return false; }\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function() { return true; }\n      }]\n    }, opts || {}));\n  }\n\n  function showPrompt(opts) {\n    var scope = $rootScope.$new(true);\n    scope.data = {};\n    scope.data.fieldtype = opts.inputType ? opts.inputType : 'text';\n    scope.data.response = opts.defaultText ? opts.defaultText : '';\n    scope.data.placeholder = opts.inputPlaceholder ? opts.inputPlaceholder : '';\n    scope.data.maxlength = opts.maxLength ? parseInt(opts.maxLength) : '';\n    var text = '';\n    if (opts.template && /<[a-z][\\s\\S]*>/i.test(opts.template) === false) {\n      text = '<span>' + opts.template + '</span>';\n      delete opts.template;\n    }\n    return showPopup(extend({\n      template: text + '<input ng-model=\"data.response\" '\n        + 'type=\"{{ data.fieldtype }}\"'\n        + 'maxlength=\"{{ data.maxlength }}\"'\n        + 'placeholder=\"{{ data.placeholder }}\"'\n        + '>',\n      scope: scope,\n      buttons: [{\n        text: opts.cancelText || 'Cancel',\n        type: opts.cancelType || 'button-default',\n        onTap: function() {}\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function() {\n          return scope.data.response || '';\n        }\n      }]\n    }, opts || {}));\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicPosition\n * @module ionic\n * @description\n * A set of utility methods that can be use to retrieve position of DOM elements.\n * It is meant to be used where we need to absolute-position DOM elements in\n * relation to other, existing elements (this is the case for tooltips, popovers, etc.).\n *\n * Adapted from [AngularUI Bootstrap](https://github.com/angular-ui/bootstrap/blob/master/src/position/position.js),\n * ([license](https://github.com/angular-ui/bootstrap/blob/master/LICENSE))\n */\nIonicModule\n.factory('$ionicPosition', ['$document', '$window', function($document, $window) {\n\n  function getStyle(el, cssprop) {\n    if (el.currentStyle) { //IE\n      return el.currentStyle[cssprop];\n    } else if ($window.getComputedStyle) {\n      return $window.getComputedStyle(el)[cssprop];\n    }\n    // finally try and get inline style\n    return el.style[cssprop];\n  }\n\n  /**\n   * Checks if a given element is statically positioned\n   * @param element - raw DOM element\n   */\n  function isStaticPositioned(element) {\n    return (getStyle(element, 'position') || 'static') === 'static';\n  }\n\n  /**\n   * returns the closest, non-statically positioned parentOffset of a given element\n   * @param element\n   */\n  var parentOffsetEl = function(element) {\n    var docDomEl = $document[0];\n    var offsetParent = element.offsetParent || docDomEl;\n    while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent)) {\n      offsetParent = offsetParent.offsetParent;\n    }\n    return offsetParent || docDomEl;\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#position\n     * @description Get the current coordinates of the element, relative to the offset parent.\n     * Read-only equivalent of [jQuery's position function](http://api.jquery.com/position/).\n     * @param {element} element The element to get the position of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    position: function(element) {\n      var elBCR = this.offset(element);\n      var offsetParentBCR = { top: 0, left: 0 };\n      var offsetParentEl = parentOffsetEl(element[0]);\n      if (offsetParentEl != $document[0]) {\n        offsetParentBCR = this.offset(jqLite(offsetParentEl));\n        offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop;\n        offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft;\n      }\n\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: elBCR.top - offsetParentBCR.top,\n        left: elBCR.left - offsetParentBCR.left\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#offset\n     * @description Get the current coordinates of the element, relative to the document.\n     * Read-only equivalent of [jQuery's offset function](http://api.jquery.com/offset/).\n     * @param {element} element The element to get the offset of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    offset: function(element) {\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: boundingClientRect.top + ($window.pageYOffset || $document[0].documentElement.scrollTop),\n        left: boundingClientRect.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft)\n      };\n    }\n\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicScrollDelegate\n * @module ionic\n * @description\n * Delegate for controlling scrollViews (created by\n * {@link ionic.directive:ionContent} and\n * {@link ionic.directive:ionScroll} directives).\n *\n * Methods called directly on the $ionicScrollDelegate service will control all scroll\n * views.  Use the {@link ionic.service:$ionicScrollDelegate#$getByHandle $getByHandle}\n * method to control specific scrollViews.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content>\n *     <button ng-click=\"scrollTop()\">Scroll to Top!</button>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollTop = function() {\n *     $ionicScrollDelegate.scrollTop();\n *   };\n * }\n * ```\n *\n * Example of advanced usage, with two scroll areas using `delegate-handle`\n * for fine control.\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content delegate-handle=\"mainScroll\">\n *     <button ng-click=\"scrollMainToTop()\">\n *       Scroll content to top!\n *     </button>\n *     <ion-scroll delegate-handle=\"small\" style=\"height: 100px;\">\n *       <button ng-click=\"scrollSmallToTop()\">\n *         Scroll small area to top!\n *       </button>\n *     </ion-scroll>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollMainToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();\n *   };\n *   $scope.scrollSmallToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('small').scrollTop();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicScrollDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#resize\n   * @description Tell the scrollView to recalculate the size of its container.\n   */\n  'resize',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTop\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTop',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBottom\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBottom',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTo\n   * @param {number} left The x-value to scroll to.\n   * @param {number} top The y-value to scroll to.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBy\n   * @param {number} left The x-offset to scroll by.\n   * @param {number} top The y-offset to scroll by.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomTo\n   * @param {number} level Level to zoom to.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomBy\n   * @param {number} factor The factor to zoom by.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollPosition\n   * @returns {object} The scroll position of this view, with the following properties:\n   *  - `{number}` `left` The distance the user has scrolled from the left (starts at 0).\n   *  - `{number}` `top` The distance the user has scrolled from the top (starts at 0).\n   *  - `{number}` `zoom` The current zoom level.\n   */\n  'getScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#anchorScroll\n   * @description Tell the scrollView to scroll to the element with an id\n   * matching window.location.hash.\n   *\n   * If no matching element is found, it will scroll to top.\n   *\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'anchorScroll',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#freezeScroll\n   * @description Does not allow this scroll view to scroll either x or y.\n   * @param {boolean=} shouldFreeze Should this scroll view be prevented from scrolling or not.\n   * @returns {boolean} If the scroll view is being prevented from scrolling or not.\n   */\n  'freezeScroll',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#freezeAllScrolls\n   * @description Does not allow any of the app's scroll views to scroll either x or y.\n   * @param {boolean=} shouldFreeze Should all app scrolls be prevented from scrolling or not.\n   */\n  'freezeAllScrolls',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollView\n   * @returns {object} The scrollView associated with this delegate.\n   */\n  'getScrollView'\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * scrollViews with `delegate-handle` matching the given handle.\n   *\n   * Example: `$ionicScrollDelegate.$getByHandle('my-handle').scrollTop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSideMenuDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionSideMenus} directive.\n *\n * Methods called directly on the $ionicSideMenuDelegate service will control all side\n * menus.  Use the {@link ionic.service:$ionicSideMenuDelegate#$getByHandle $getByHandle}\n * method to control specific ionSideMenus instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-side-menus>\n *     <ion-side-menu-content>\n *       Content!\n *       <button ng-click=\"toggleLeftSideMenu()\">\n *         Toggle Left Side Menu\n *       </button>\n *     </ion-side-menu-content>\n *     <ion-side-menu side=\"left\">\n *       Left Menu!\n *     <ion-side-menu>\n *   </ion-side-menus>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeftSideMenu = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicSideMenuDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleLeft\n   * @description Toggle the left side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleRight\n   * @description Toggle the right side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#getOpenRatio\n   * @description Gets the ratio of open amount over menu width. For example, a\n   * menu of width 100 that is opened by 50 pixels is 50% opened, and would return\n   * a ratio of 0.5.\n   *\n   * @returns {float} 0 if nothing is open, between 0 and 1 if left menu is\n   * opened/opening, and between 0 and -1 if right menu is opened/opening.\n   */\n  'getOpenRatio',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpen\n   * @returns {boolean} Whether either the left or right menu is currently opened.\n   */\n  'isOpen',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenLeft\n   * @returns {boolean} Whether the left menu is currently opened.\n   */\n  'isOpenLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenRight\n   * @returns {boolean} Whether the right menu is currently opened.\n   */\n  'isOpenRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#canDragContent\n   * @param {boolean=} canDrag Set whether the content can or cannot be dragged to open\n   * side menus.\n   * @returns {boolean} Whether the content can be dragged to open side menus.\n   */\n  'canDragContent',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#edgeDragThreshold\n   * @param {boolean|number=} value Set whether the content drag can only start if it is below a certain threshold distance from the edge of the screen. Accepts three different values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n   * @returns {boolean} Whether the drag can start only from within the edge of screen threshold.\n   */\n  'edgeDragThreshold'\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSideMenus} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSideMenuDelegate.$getByHandle('my-handle').toggleLeft();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSlideBoxDelegate\n * @module ionic\n * @description\n * Delegate that controls the {@link ionic.directive:ionSlideBox} directive.\n *\n * Methods called directly on the $ionicSlideBoxDelegate service will control all slide boxes.  Use the {@link ionic.service:$ionicSlideBoxDelegate#$getByHandle $getByHandle}\n * method to control specific slide box instances.\n *\n * @usage\n *\n * ```html\n * <ion-view>\n *   <ion-slide-box>\n *     <ion-slide>\n *       <div class=\"box blue\">\n *         <button ng-click=\"nextSlide()\">Next slide!</button>\n *       </div>\n *     </ion-slide>\n *     <ion-slide>\n *       <div class=\"box red\">\n *         Slide 2!\n *       </div>\n *     </ion-slide>\n *   </ion-slide-box>\n * </ion-view>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicSlideBoxDelegate) {\n *   $scope.nextSlide = function() {\n *     $ionicSlideBoxDelegate.next();\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicSlideBoxDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#update\n   * @description\n   * Update the slidebox (for example if using Angular with ng-repeat,\n   * resize it for the elements inside).\n   */\n  'update',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slide\n   * @param {number} to The index to slide to.\n   * @param {number=} speed The number of milliseconds the change should take.\n   */\n  'slide',\n  'select',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#enableSlide\n   * @param {boolean=} shouldEnable Whether to enable sliding the slidebox.\n   * @returns {boolean} Whether sliding is enabled.\n   */\n  'enableSlide',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#previous\n   * @param {number=} speed The number of milliseconds the change should take.\n   * @description Go to the previous slide. Wraps around if at the beginning.\n   */\n  'previous',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#next\n   * @param {number=} speed The number of milliseconds the change should take.\n   * @description Go to the next slide. Wraps around if at the end.\n   */\n  'next',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#stop\n   * @description Stop sliding. The slideBox will not move again until\n   * explicitly told to do so.\n   */\n  'stop',\n  'autoPlay',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#start\n   * @description Start sliding again if the slideBox was stopped.\n   */\n  'start',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#currentIndex\n   * @returns number The index of the current slide.\n   */\n  'currentIndex',\n  'selected',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slidesCount\n   * @returns number The number of slides there are currently.\n   */\n  'slidesCount',\n  'count',\n  'loop'\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSlideBox} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSlideBoxDelegate.$getByHandle('my-handle').stop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicTabsDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionTabs} directive.\n *\n * Methods called directly on the $ionicTabsDelegate service will control all ionTabs\n * directives. Use the {@link ionic.service:$ionicTabsDelegate#$getByHandle $getByHandle}\n * method to control specific ionTabs instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-tabs>\n *\n *     <ion-tab title=\"Tab 1\">\n *       Hello tab 1!\n *       <button ng-click=\"selectTabWithIndex(1)\">Select tab 2!</button>\n *     </ion-tab>\n *     <ion-tab title=\"Tab 2\">Hello tab 2!</ion-tab>\n *\n *   </ion-tabs>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicTabsDelegate) {\n *   $scope.selectTabWithIndex = function(index) {\n *     $ionicTabsDelegate.select(index);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicTabsDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#select\n   * @description Select the tab matching the given index.\n   *\n   * @param {number} index Index of the tab to select.\n   */\n  'select',\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#selectedIndex\n   * @returns `number` The index of the selected tab, or -1.\n   */\n  'selectedIndex',\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#showBar\n   * @description\n   * Set/get whether the {@link ionic.directive:ionTabs} is shown\n   * @param {boolean} show Whether to show the bar.\n   * @returns {boolean} Whether the bar is shown.\n   */\n  'showBar'\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionTabs} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicTabsDelegate.$getByHandle('my-handle').select(0);`\n   */\n]));\n\n// closure to keep things neat\n(function() {\n  var templatesToCache = [];\n\n/**\n * @ngdoc service\n * @name $ionicTemplateCache\n * @module ionic\n * @description A service that preemptively caches template files to eliminate transition flicker and boost performance.\n * @usage\n * State templates are cached automatically, but you can optionally cache other templates.\n *\n * ```js\n * $ionicTemplateCache('myNgIncludeTemplate.html');\n * ```\n *\n * Optionally disable all preemptive caching with the `$ionicConfigProvider` or individual states by setting `prefetchTemplate`\n * in the `$state` definition\n *\n * ```js\n *   angular.module('myApp', ['ionic'])\n *   .config(function($stateProvider, $ionicConfigProvider) {\n *\n *     // disable preemptive template caching globally\n *     $ionicConfigProvider.templates.prefetch(false);\n *\n *     // disable individual states\n *     $stateProvider\n *       .state('tabs', {\n *         url: \"/tab\",\n *         abstract: true,\n *         prefetchTemplate: false,\n *         templateUrl: \"tabs-templates/tabs.html\"\n *       })\n *       .state('tabs.home', {\n *         url: \"/home\",\n *         views: {\n *           'home-tab': {\n *             prefetchTemplate: false,\n *             templateUrl: \"tabs-templates/home.html\",\n *             controller: 'HomeTabCtrl'\n *           }\n *         }\n *       });\n *   });\n * ```\n */\nIonicModule\n.factory('$ionicTemplateCache', [\n'$http',\n'$templateCache',\n'$timeout',\nfunction($http, $templateCache, $timeout) {\n  var toCache = templatesToCache,\n      hasRun;\n\n  function $ionicTemplateCache(templates) {\n    if (typeof templates === 'undefined') {\n      return run();\n    }\n    if (isString(templates)) {\n      templates = [templates];\n    }\n    forEach(templates, function(template) {\n      toCache.push(template);\n    });\n    if (hasRun) {\n      run();\n    }\n  }\n\n  // run through methods - internal method\n  function run() {\n    var template;\n    $ionicTemplateCache._runCount++;\n\n    hasRun = true;\n    // ignore if race condition already zeroed out array\n    if (toCache.length === 0) return;\n\n    var i = 0;\n    while (i < 4 && (template = toCache.pop())) {\n      // note that inline templates are ignored by this request\n      if (isString(template)) $http.get(template, { cache: $templateCache });\n      i++;\n    }\n    // only preload 3 templates a second\n    if (toCache.length) {\n      $timeout(run, 1000);\n    }\n  }\n\n  // exposing for testing\n  $ionicTemplateCache._runCount = 0;\n  // default method\n  return $ionicTemplateCache;\n}])\n\n// Intercepts the $stateprovider.state() command to look for templateUrls that can be cached\n.config([\n'$stateProvider',\n'$ionicConfigProvider',\nfunction($stateProvider, $ionicConfigProvider) {\n  var stateProviderState = $stateProvider.state;\n  $stateProvider.state = function(stateName, definition) {\n    // don't even bother if it's disabled. note, another config may run after this, so it's not a catch-all\n    if (typeof definition === 'object') {\n      var enabled = definition.prefetchTemplate !== false && templatesToCache.length < $ionicConfigProvider.templates.maxPrefetch();\n      if (enabled && isString(definition.templateUrl)) templatesToCache.push(definition.templateUrl);\n      if (angular.isObject(definition.views)) {\n        for (var key in definition.views) {\n          enabled = definition.views[key].prefetchTemplate !== false && templatesToCache.length < $ionicConfigProvider.templates.maxPrefetch();\n          if (enabled && isString(definition.views[key].templateUrl)) templatesToCache.push(definition.views[key].templateUrl);\n        }\n      }\n    }\n    return stateProviderState.call($stateProvider, stateName, definition);\n  };\n}])\n\n// process the templateUrls collected by the $stateProvider, adding them to the cache\n.run(['$ionicTemplateCache', function($ionicTemplateCache) {\n  $ionicTemplateCache();\n}]);\n\n})();\n\nIonicModule\n.factory('$ionicTemplateLoader', [\n  '$compile',\n  '$controller',\n  '$http',\n  '$q',\n  '$rootScope',\n  '$templateCache',\nfunction($compile, $controller, $http, $q, $rootScope, $templateCache) {\n\n  return {\n    load: fetchTemplate,\n    compile: loadAndCompile\n  };\n\n  function fetchTemplate(url) {\n    return $http.get(url, {cache: $templateCache})\n    .then(function(response) {\n      return response.data && response.data.trim();\n    });\n  }\n\n  function loadAndCompile(options) {\n    options = extend({\n      template: '',\n      templateUrl: '',\n      scope: null,\n      controller: null,\n      locals: {},\n      appendTo: null\n    }, options || {});\n\n    var templatePromise = options.templateUrl ?\n      this.load(options.templateUrl) :\n      $q.when(options.template);\n\n    return templatePromise.then(function(template) {\n      var controller;\n      var scope = options.scope || $rootScope.$new();\n\n      //Incase template doesn't have just one root element, do this\n      var element = jqLite('<div>').html(template).contents();\n\n      if (options.controller) {\n        controller = $controller(\n          options.controller,\n          extend(options.locals, {\n            $scope: scope\n          })\n        );\n        element.children().data('$ngControllerController', controller);\n      }\n      if (options.appendTo) {\n        jqLite(options.appendTo).append(element);\n      }\n\n      $compile(element)(scope);\n\n      return {\n        element: element,\n        scope: scope\n      };\n    });\n  }\n\n}]);\n\n/**\n * @private\n * DEPRECATED, as of v1.0.0-beta14 -------\n */\nIonicModule\n.factory('$ionicViewService', ['$ionicHistory', '$log', function($ionicHistory, $log) {\n\n  function warn(oldMethod, newMethod) {\n    $log.warn('$ionicViewService' + oldMethod + ' is deprecated, please use $ionicHistory' + newMethod + ' instead: http://ionicframework.com/docs/nightly/api/service/$ionicHistory/');\n  }\n\n  warn('', '');\n\n  var methodsMap = {\n    getCurrentView: 'currentView',\n    getBackView: 'backView',\n    getForwardView: 'forwardView',\n    getCurrentStateName: 'currentStateName',\n    nextViewOptions: 'nextViewOptions',\n    clearHistory: 'clearHistory'\n  };\n\n  forEach(methodsMap, function(newMethod, oldMethod) {\n    methodsMap[oldMethod] = function() {\n      warn('.' + oldMethod, '.' + newMethod);\n      return $ionicHistory[newMethod].apply(this, arguments);\n    };\n  });\n\n  return methodsMap;\n\n}]);\n\n/**\n * @private\n * TODO document\n */\n\nIonicModule.factory('$ionicViewSwitcher', [\n  '$timeout',\n  '$document',\n  '$q',\n  '$ionicClickBlock',\n  '$ionicConfig',\n  '$ionicNavBarDelegate',\nfunction($timeout, $document, $q, $ionicClickBlock, $ionicConfig, $ionicNavBarDelegate) {\n\n  var TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';\n  var DATA_NO_CACHE = '$noCache';\n  var DATA_DESTROY_ELE = '$destroyEle';\n  var DATA_ELE_IDENTIFIER = '$eleId';\n  var DATA_VIEW_ACCESSED = '$accessed';\n  var DATA_FALLBACK_TIMER = '$fallbackTimer';\n  var DATA_VIEW = '$viewData';\n  var NAV_VIEW_ATTR = 'nav-view';\n  var VIEW_STATUS_ACTIVE = 'active';\n  var VIEW_STATUS_CACHED = 'cached';\n  var VIEW_STATUS_STAGED = 'stage';\n\n  var transitionCounter = 0;\n  var nextTransition, nextDirection;\n  ionic.transition = ionic.transition || {};\n  ionic.transition.isActive = false;\n  var isActiveTimer;\n  var cachedAttr = ionic.DomUtil.cachedAttr;\n  var transitionPromises = [];\n  var defaultTimeout = 1100;\n\n  var ionicViewSwitcher = {\n\n    create: function(navViewCtrl, viewLocals, enteringView, leavingView, renderStart, renderEnd) {\n      // get a reference to an entering/leaving element if they exist\n      // loop through to see if the view is already in the navViewElement\n      var enteringEle, leavingEle;\n      var transitionId = ++transitionCounter;\n      var alreadyInDom;\n\n      var switcher = {\n\n        init: function(registerData, callback) {\n          ionicViewSwitcher.isTransitioning(true);\n\n          switcher.loadViewElements(registerData);\n\n          switcher.render(registerData, function() {\n            callback && callback();\n          });\n        },\n\n        loadViewElements: function(registerData) {\n          var x, l, viewEle;\n          var viewElements = navViewCtrl.getViewElements();\n          var enteringEleIdentifier = getViewElementIdentifier(viewLocals, enteringView);\n          var navViewActiveEleId = navViewCtrl.activeEleId();\n\n          for (x = 0, l = viewElements.length; x < l; x++) {\n            viewEle = viewElements.eq(x);\n\n            if (viewEle.data(DATA_ELE_IDENTIFIER) === enteringEleIdentifier) {\n              // we found an existing element in the DOM that should be entering the view\n              if (viewEle.data(DATA_NO_CACHE)) {\n                // the existing element should not be cached, don't use it\n                viewEle.data(DATA_ELE_IDENTIFIER, enteringEleIdentifier + ionic.Utils.nextUid());\n                viewEle.data(DATA_DESTROY_ELE, true);\n\n              } else {\n                enteringEle = viewEle;\n              }\n\n            } else if (isDefined(navViewActiveEleId) && viewEle.data(DATA_ELE_IDENTIFIER) === navViewActiveEleId) {\n              leavingEle = viewEle;\n            }\n\n            if (enteringEle && leavingEle) break;\n          }\n\n          alreadyInDom = !!enteringEle;\n\n          if (!alreadyInDom) {\n            // still no existing element to use\n            // create it using existing template/scope/locals\n            enteringEle = registerData.ele || ionicViewSwitcher.createViewEle(viewLocals);\n\n            // existing elements in the DOM are looked up by their state name and state id\n            enteringEle.data(DATA_ELE_IDENTIFIER, enteringEleIdentifier);\n          }\n\n          if (renderEnd) {\n            navViewCtrl.activeEleId(enteringEleIdentifier);\n          }\n\n          registerData.ele = null;\n        },\n\n        render: function(registerData, callback) {\n          if (alreadyInDom) {\n            // it was already found in the DOM, just reconnect the scope\n            ionic.Utils.reconnectScope(enteringEle.scope());\n\n          } else {\n            // the entering element is not already in the DOM\n            // set that the entering element should be \"staged\" and its\n            // styles of where this element will go before it hits the DOM\n            navViewAttr(enteringEle, VIEW_STATUS_STAGED);\n\n            var enteringData = getTransitionData(viewLocals, enteringEle, registerData.direction, enteringView);\n            var transitionFn = $ionicConfig.transitions.views[enteringData.transition] || $ionicConfig.transitions.views.none;\n            transitionFn(enteringEle, null, enteringData.direction, true).run(0);\n\n            enteringEle.data(DATA_VIEW, {\n              viewId: enteringData.viewId,\n              historyId: enteringData.historyId,\n              stateName: enteringData.stateName,\n              stateParams: enteringData.stateParams\n            });\n\n            // if the current state has cache:false\n            // or the element has cache-view=\"false\" attribute\n            if (viewState(viewLocals).cache === false || viewState(viewLocals).cache === 'false' ||\n                enteringEle.attr('cache-view') == 'false' || $ionicConfig.views.maxCache() === 0) {\n              enteringEle.data(DATA_NO_CACHE, true);\n            }\n\n            // append the entering element to the DOM, create a new scope and run link\n            var viewScope = navViewCtrl.appendViewElement(enteringEle, viewLocals);\n\n            delete enteringData.direction;\n            delete enteringData.transition;\n            viewScope.$emit('$ionicView.loaded', enteringData);\n          }\n\n          // update that this view was just accessed\n          enteringEle.data(DATA_VIEW_ACCESSED, Date.now());\n\n          callback && callback();\n        },\n\n        transition: function(direction, enableBack, allowAnimate) {\n          var deferred;\n          var enteringData = getTransitionData(viewLocals, enteringEle, direction, enteringView);\n          var leavingData = extend(extend({}, enteringData), getViewData(leavingView));\n          enteringData.transitionId = leavingData.transitionId = transitionId;\n          enteringData.fromCache = !!alreadyInDom;\n          enteringData.enableBack = !!enableBack;\n          enteringData.renderStart = renderStart;\n          enteringData.renderEnd = renderEnd;\n\n          cachedAttr(enteringEle.parent(), 'nav-view-transition', enteringData.transition);\n          cachedAttr(enteringEle.parent(), 'nav-view-direction', enteringData.direction);\n\n          // cancel any previous transition complete fallbacks\n          $timeout.cancel(enteringEle.data(DATA_FALLBACK_TIMER));\n\n          // get the transition ready and see if it'll animate\n          var transitionFn = $ionicConfig.transitions.views[enteringData.transition] || $ionicConfig.transitions.views.none;\n          var viewTransition = transitionFn(enteringEle, leavingEle, enteringData.direction,\n                                            enteringData.shouldAnimate && allowAnimate && renderEnd);\n\n          if (viewTransition.shouldAnimate) {\n            // attach transitionend events (and fallback timer)\n            enteringEle.on(TRANSITIONEND_EVENT, completeOnTransitionEnd);\n            enteringEle.data(DATA_FALLBACK_TIMER, $timeout(transitionComplete, defaultTimeout));\n            $ionicClickBlock.show(defaultTimeout);\n          }\n\n          if (renderStart) {\n            // notify the views \"before\" the transition starts\n            switcher.emit('before', enteringData, leavingData);\n\n            // stage entering element, opacity 0, no transition duration\n            navViewAttr(enteringEle, VIEW_STATUS_STAGED);\n\n            // render the elements in the correct location for their starting point\n            viewTransition.run(0);\n          }\n\n          if (renderEnd) {\n            // create a promise so we can keep track of when all transitions finish\n            // only required if this transition should complete\n            deferred = $q.defer();\n            transitionPromises.push(deferred.promise);\n          }\n\n          if (renderStart && renderEnd) {\n            // CSS \"auto\" transitioned, not manually transitioned\n            // wait a frame so the styles apply before auto transitioning\n            $timeout(function() {\n              ionic.requestAnimationFrame(onReflow);\n            });\n          } else if (!renderEnd) {\n            // just the start of a manual transition\n            // but it will not render the end of the transition\n            navViewAttr(enteringEle, 'entering');\n            navViewAttr(leavingEle, 'leaving');\n\n            // return the transition run method so each step can be ran manually\n            return {\n              run: viewTransition.run,\n              cancel: function(shouldAnimate) {\n                if (shouldAnimate) {\n                  enteringEle.on(TRANSITIONEND_EVENT, cancelOnTransitionEnd);\n                  enteringEle.data(DATA_FALLBACK_TIMER, $timeout(cancelTransition, defaultTimeout));\n                  $ionicClickBlock.show(defaultTimeout);\n                } else {\n                  cancelTransition();\n                }\n                viewTransition.shouldAnimate = shouldAnimate;\n                viewTransition.run(0);\n                viewTransition = null;\n              }\n            };\n\n          } else if (renderEnd) {\n            // just the end of a manual transition\n            // happens after the manual transition has completed\n            // and a full history change has happened\n            onReflow();\n          }\n\n\n          function onReflow() {\n            // remove that we're staging the entering element so it can auto transition\n            navViewAttr(enteringEle, viewTransition.shouldAnimate ? 'entering' : VIEW_STATUS_ACTIVE);\n            navViewAttr(leavingEle, viewTransition.shouldAnimate ? 'leaving' : VIEW_STATUS_CACHED);\n\n            // start the auto transition and let the CSS take over\n            viewTransition.run(1);\n\n            // trigger auto transitions on the associated nav bars\n            $ionicNavBarDelegate._instances.forEach(function(instance) {\n              instance.triggerTransitionStart(transitionId);\n            });\n\n            if (!viewTransition.shouldAnimate) {\n              // no animated auto transition\n              transitionComplete();\n            }\n          }\n\n          // Make sure that transitionend events bubbling up from children won't fire\n          // transitionComplete. Will only go forward if ev.target == the element listening.\n          function completeOnTransitionEnd(ev) {\n            if (ev.target !== this) return;\n            transitionComplete();\n          }\n          function transitionComplete() {\n            if (transitionComplete.x) return;\n            transitionComplete.x = true;\n\n            enteringEle.off(TRANSITIONEND_EVENT, completeOnTransitionEnd);\n            $timeout.cancel(enteringEle.data(DATA_FALLBACK_TIMER));\n            leavingEle && $timeout.cancel(leavingEle.data(DATA_FALLBACK_TIMER));\n\n            // resolve that this one transition (there could be many w/ nested views)\n            deferred && deferred.resolve(navViewCtrl);\n\n            // the most recent transition added has completed and all the active\n            // transition promises should be added to the services array of promises\n            if (transitionId === transitionCounter) {\n              $q.all(transitionPromises).then(ionicViewSwitcher.transitionEnd);\n\n              // emit that the views have finished transitioning\n              // each parent nav-view will update which views are active and cached\n              switcher.emit('after', enteringData, leavingData);\n              switcher.cleanup(enteringData);\n            }\n\n            // tell the nav bars that the transition has ended\n            $ionicNavBarDelegate._instances.forEach(function(instance) {\n              instance.triggerTransitionEnd();\n            });\n\n\n            // remove any references that could cause memory issues\n            nextTransition = nextDirection = enteringView = leavingView = enteringEle = leavingEle = null;\n          }\n\n          // Make sure that transitionend events bubbling up from children won't fire\n          // transitionComplete. Will only go forward if ev.target == the element listening.\n          function cancelOnTransitionEnd(ev) {\n            if (ev.target !== this) return;\n            cancelTransition();\n          }\n          function cancelTransition() {\n            navViewAttr(enteringEle, VIEW_STATUS_CACHED);\n            navViewAttr(leavingEle, VIEW_STATUS_ACTIVE);\n            enteringEle.off(TRANSITIONEND_EVENT, cancelOnTransitionEnd);\n            $timeout.cancel(enteringEle.data(DATA_FALLBACK_TIMER));\n            ionicViewSwitcher.transitionEnd([navViewCtrl]);\n          }\n\n        },\n\n      emit: function(step, enteringData, leavingData) {\n          var enteringScope = getScopeForElement(enteringEle, enteringData);\n          var leavingScope = getScopeForElement(leavingEle, leavingData);\n\n          var prefixesAreEqual;\n\n          if ( !enteringData.viewId || enteringData.abstractView ) {\n            // it's an abstract view, so treat it accordingly\n\n            // we only get access to the leaving scope once in the transition,\n            // so dispatch all events right away if it exists\n            if ( leavingScope ) {\n              leavingScope.$emit('$ionicView.beforeLeave', leavingData);\n              leavingScope.$emit('$ionicView.leave', leavingData);\n              leavingScope.$emit('$ionicView.afterLeave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.beforeLeave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.leave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.afterLeave', leavingData);\n            }\n          }\n          else {\n            // it's a regular view, so do the normal process\n            if (step == 'after') {\n              if (enteringScope) {\n                enteringScope.$emit('$ionicView.enter', enteringData);\n                enteringScope.$broadcast('$ionicParentView.enter', enteringData);\n              }\n\n              if (leavingScope) {\n                leavingScope.$emit('$ionicView.leave', leavingData);\n                leavingScope.$broadcast('$ionicParentView.leave', leavingData);\n              }\n              else if (enteringScope && leavingData && leavingData.viewId && enteringData.stateName !== leavingData.stateName) {\n                // we only want to dispatch this when we are doing a single-tier\n                // state change such as changing a tab, so compare the state\n                // for the same state-prefix but different suffix\n                prefixesAreEqual = compareStatePrefixes(enteringData.stateName, leavingData.stateName);\n                if ( prefixesAreEqual ) {\n                  enteringScope.$emit('$ionicNavView.leave', leavingData);\n                }\n              }\n            }\n\n            if (enteringScope) {\n              enteringScope.$emit('$ionicView.' + step + 'Enter', enteringData);\n              enteringScope.$broadcast('$ionicParentView.' + step + 'Enter', enteringData);\n            }\n\n            if (leavingScope) {\n              leavingScope.$emit('$ionicView.' + step + 'Leave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.' + step + 'Leave', leavingData);\n\n            } else if (enteringScope && leavingData && leavingData.viewId && enteringData.stateName !== leavingData.stateName) {\n              // we only want to dispatch this when we are doing a single-tier\n              // state change such as changing a tab, so compare the state\n              // for the same state-prefix but different suffix\n              prefixesAreEqual = compareStatePrefixes(enteringData.stateName, leavingData.stateName);\n              if ( prefixesAreEqual ) {\n                enteringScope.$emit('$ionicNavView.' + step + 'Leave', leavingData);\n              }\n            }\n          }\n        },\n\n        cleanup: function(transData) {\n          // check if any views should be removed\n          if (leavingEle && transData.direction == 'back' && !$ionicConfig.views.forwardCache()) {\n            // if they just navigated back we can destroy the forward view\n            // do not remove forward views if cacheForwardViews config is true\n            destroyViewEle(leavingEle);\n          }\n\n          var viewElements = navViewCtrl.getViewElements();\n          var viewElementsLength = viewElements.length;\n          var x, viewElement;\n          var removeOldestAccess = (viewElementsLength - 1) > $ionicConfig.views.maxCache();\n          var removableEle;\n          var oldestAccess = Date.now();\n\n          for (x = 0; x < viewElementsLength; x++) {\n            viewElement = viewElements.eq(x);\n\n            if (removeOldestAccess && viewElement.data(DATA_VIEW_ACCESSED) < oldestAccess) {\n              // remember what was the oldest element to be accessed so it can be destroyed\n              oldestAccess = viewElement.data(DATA_VIEW_ACCESSED);\n              removableEle = viewElements.eq(x);\n\n            } else if (viewElement.data(DATA_DESTROY_ELE) && navViewAttr(viewElement) != VIEW_STATUS_ACTIVE) {\n              destroyViewEle(viewElement);\n            }\n          }\n\n          destroyViewEle(removableEle);\n\n          if (enteringEle.data(DATA_NO_CACHE)) {\n            enteringEle.data(DATA_DESTROY_ELE, true);\n          }\n        },\n\n        enteringEle: function() { return enteringEle; },\n        leavingEle: function() { return leavingEle; }\n\n      };\n\n      return switcher;\n    },\n\n    transitionEnd: function(navViewCtrls) {\n      forEach(navViewCtrls, function(navViewCtrl) {\n        navViewCtrl.transitionEnd();\n      });\n\n      ionicViewSwitcher.isTransitioning(false);\n      $ionicClickBlock.hide();\n      transitionPromises = [];\n    },\n\n    nextTransition: function(val) {\n      nextTransition = val;\n    },\n\n    nextDirection: function(val) {\n      nextDirection = val;\n    },\n\n    isTransitioning: function(val) {\n      if (arguments.length) {\n        ionic.transition.isActive = !!val;\n        $timeout.cancel(isActiveTimer);\n        if (val) {\n          isActiveTimer = $timeout(function() {\n            ionicViewSwitcher.isTransitioning(false);\n          }, 999);\n        }\n      }\n      return ionic.transition.isActive;\n    },\n\n    createViewEle: function(viewLocals) {\n      var containerEle = $document[0].createElement('div');\n      if (viewLocals && viewLocals.$template) {\n        containerEle.innerHTML = viewLocals.$template;\n        if (containerEle.children.length === 1) {\n          containerEle.children[0].classList.add('pane');\n          if ( viewLocals.$$state && viewLocals.$$state.self && viewLocals.$$state.self['abstract'] ) {\n            angular.element(containerEle.children[0]).attr(\"abstract\", \"true\");\n          }\n          else {\n            if ( viewLocals.$$state && viewLocals.$$state.self ) {\n              angular.element(containerEle.children[0]).attr(\"state\", viewLocals.$$state.self.name);\n            }\n\n          }\n          return jqLite(containerEle.children[0]);\n        }\n      }\n      containerEle.className = \"pane\";\n      return jqLite(containerEle);\n    },\n\n    viewEleIsActive: function(viewEle, isActiveAttr) {\n      navViewAttr(viewEle, isActiveAttr ? VIEW_STATUS_ACTIVE : VIEW_STATUS_CACHED);\n    },\n\n    getTransitionData: getTransitionData,\n    navViewAttr: navViewAttr,\n    destroyViewEle: destroyViewEle\n\n  };\n\n  return ionicViewSwitcher;\n\n\n  function getViewElementIdentifier(locals, view) {\n    if (viewState(locals)['abstract']) return viewState(locals).name;\n    if (view) return view.stateId || view.viewId;\n    return ionic.Utils.nextUid();\n  }\n\n  function viewState(locals) {\n    return locals && locals.$$state && locals.$$state.self || {};\n  }\n\n  function getTransitionData(viewLocals, enteringEle, direction, view) {\n    // Priority\n    // 1) attribute directive on the button/link to this view\n    // 2) entering element's attribute\n    // 3) entering view's $state config property\n    // 4) view registration data\n    // 5) global config\n    // 6) fallback value\n\n    var state = viewState(viewLocals);\n    var viewTransition = nextTransition || cachedAttr(enteringEle, 'view-transition') || state.viewTransition || $ionicConfig.views.transition() || 'ios';\n    var navBarTransition = $ionicConfig.navBar.transition();\n    direction = nextDirection || cachedAttr(enteringEle, 'view-direction') || state.viewDirection || direction || 'none';\n\n    return extend(getViewData(view), {\n      transition: viewTransition,\n      navBarTransition: navBarTransition === 'view' ? viewTransition : navBarTransition,\n      direction: direction,\n      shouldAnimate: (viewTransition !== 'none' && direction !== 'none')\n    });\n  }\n\n  function getViewData(view) {\n    view = view || {};\n    return {\n      viewId: view.viewId,\n      historyId: view.historyId,\n      stateId: view.stateId,\n      stateName: view.stateName,\n      stateParams: view.stateParams\n    };\n  }\n\n  function navViewAttr(ele, value) {\n    if (arguments.length > 1) {\n      cachedAttr(ele, NAV_VIEW_ATTR, value);\n    } else {\n      return cachedAttr(ele, NAV_VIEW_ATTR);\n    }\n  }\n\n  function destroyViewEle(ele) {\n    // we found an element that should be removed\n    // destroy its scope, then remove the element\n    if (ele && ele.length) {\n      var viewScope = ele.scope();\n      if (viewScope) {\n        viewScope.$emit('$ionicView.unloaded', ele.data(DATA_VIEW));\n        viewScope.$destroy();\n      }\n      ele.remove();\n    }\n  }\n\n  function compareStatePrefixes(enteringStateName, exitingStateName) {\n    var enteringStateSuffixIndex = enteringStateName.lastIndexOf('.');\n    var exitingStateSuffixIndex = exitingStateName.lastIndexOf('.');\n\n    // if either of the prefixes are empty, just return false\n    if ( enteringStateSuffixIndex < 0 || exitingStateSuffixIndex < 0 ) {\n      return false;\n    }\n\n    var enteringPrefix = enteringStateName.substring(0, enteringStateSuffixIndex);\n    var exitingPrefix = exitingStateName.substring(0, exitingStateSuffixIndex);\n\n    return enteringPrefix === exitingPrefix;\n  }\n\n  function getScopeForElement(element, stateData) {\n    if ( !element ) {\n      return null;\n    }\n    // check if it's abstract\n    var attributeValue = angular.element(element).attr(\"abstract\");\n    var stateValue = angular.element(element).attr(\"state\");\n\n    if ( attributeValue !== \"true\" ) {\n      // it's not an abstract view, so make sure the element\n      // matches the state.  Due to abstract view weirdness,\n      // sometimes it doesn't. If it doesn't, don't dispatch events\n      // so leave the scope undefined\n      if ( stateValue === stateData.stateName ) {\n        return angular.element(element).scope();\n      }\n      return null;\n    }\n    else {\n      // it is an abstract element, so look for element with the \"state\" attributeValue\n      // set to the name of the stateData state\n      var elements = aggregateNavViewChildren(element);\n      for ( var i = 0; i < elements.length; i++ ) {\n          var state = angular.element(elements[i]).attr(\"state\");\n          if ( state === stateData.stateName ) {\n            stateData.abstractView = true;\n            return angular.element(elements[i]).scope();\n          }\n      }\n      // we didn't find a match, so return null\n      return null;\n    }\n  }\n\n  function aggregateNavViewChildren(element) {\n    var aggregate = [];\n    var navViews = angular.element(element).find(\"ion-nav-view\");\n    for ( var i = 0; i < navViews.length; i++ ) {\n      var children = angular.element(navViews[i]).children();\n      var childrenAggregated = [];\n      for ( var j = 0; j < children.length; j++ ) {\n        childrenAggregated = childrenAggregated.concat(children[j]);\n      }\n      aggregate = aggregate.concat(childrenAggregated);\n    }\n    return aggregate;\n  }\n\n}]);\n\n/**\n * ==================  angular-ios9-uiwebview.patch.js v1.1.1 ==================\n *\n * This patch works around iOS9 UIWebView regression that causes infinite digest\n * errors in Angular.\n *\n * The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular\n * have the workaround baked in.\n *\n * To apply this patch load/bundle this file with your application and add a\n * dependency on the \"ngIOS9UIWebViewPatch\" module to your main app module.\n *\n * For example:\n *\n * ```\n * angular.module('myApp', ['ngRoute'])`\n * ```\n *\n * becomes\n *\n * ```\n * angular.module('myApp', ['ngRoute', 'ngIOS9UIWebViewPatch'])\n * ```\n *\n *\n * More info:\n * - https://openradar.appspot.com/22186109\n * - https://github.com/angular/angular.js/issues/12241\n * - https://github.com/driftyco/ionic/issues/4082\n *\n *\n * @license AngularJS\n * (c) 2010-2015 Google, Inc. http://angularjs.org\n * License: MIT\n */\n\nangular.module('ngIOS9UIWebViewPatch', ['ng']).config(['$provide', function($provide) {\n  'use strict';\n\n  $provide.decorator('$browser', ['$delegate', '$window', function($delegate, $window) {\n\n    if (isIOS9UIWebView($window.navigator.userAgent)) {\n      return applyIOS9Shim($delegate);\n    }\n\n    return $delegate;\n\n    function isIOS9UIWebView(userAgent) {\n      return /(iPhone|iPad|iPod).* OS 9_\\d/.test(userAgent) && !/Version\\/9\\./.test(userAgent);\n    }\n\n    function applyIOS9Shim(browser) {\n      var pendingLocationUrl = null;\n      var originalUrlFn = browser.url;\n\n      browser.url = function() {\n        if (arguments.length) {\n          pendingLocationUrl = arguments[0];\n          return originalUrlFn.apply(browser, arguments);\n        }\n\n        return pendingLocationUrl || originalUrlFn.apply(browser, arguments);\n      };\n\n      window.addEventListener('popstate', clearPendingLocationUrl, false);\n      window.addEventListener('hashchange', clearPendingLocationUrl, false);\n\n      function clearPendingLocationUrl() {\n        pendingLocationUrl = null;\n      }\n\n      return browser;\n    }\n  }]);\n}]);\n\n/**\n * @private\n * Parts of Ionic requires that $scope data is attached to the element.\n * We do not want to disable adding $scope data to the $element when\n * $compileProvider.debugInfoEnabled(false) is used.\n */\nIonicModule.config(['$provide', function($provide) {\n  $provide.decorator('$compile', ['$delegate', function($compile) {\n     $compile.$$addScopeInfo = function $$addScopeInfo($element, scope, isolated, noTemplate) {\n       var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';\n       $element.data(dataName, scope);\n     };\n     return $compile;\n  }]);\n}]);\n\n/**\n * @private\n */\nIonicModule.config([\n  '$provide',\nfunction($provide) {\n  function $LocationDecorator($location, $timeout) {\n\n    $location.__hash = $location.hash;\n    //Fix: when window.location.hash is set, the scrollable area\n    //found nearest to body's scrollTop is set to scroll to an element\n    //with that ID.\n    $location.hash = function(value) {\n      if (isDefined(value) && value.length > 0) {\n        $timeout(function() {\n          var scroll = document.querySelector('.scroll-content');\n          if (scroll) {\n            scroll.scrollTop = 0;\n          }\n        }, 0, false);\n      }\n      return $location.__hash(value);\n    };\n\n    return $location;\n  }\n\n  $provide.decorator('$location', ['$delegate', '$timeout', $LocationDecorator]);\n}]);\n\nIonicModule\n\n.controller('$ionicHeaderBar', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$q',\n  '$ionicConfig',\n  '$ionicHistory',\nfunction($scope, $element, $attrs, $q, $ionicConfig, $ionicHistory) {\n  var TITLE = 'title';\n  var BACK_TEXT = 'back-text';\n  var BACK_BUTTON = 'back-button';\n  var DEFAULT_TITLE = 'default-title';\n  var PREVIOUS_TITLE = 'previous-title';\n  var HIDE = 'hide';\n\n  var self = this;\n  var titleText = '';\n  var previousTitleText = '';\n  var titleLeft = 0;\n  var titleRight = 0;\n  var titleCss = '';\n  var isBackEnabled = false;\n  var isBackShown = true;\n  var isNavBackShown = true;\n  var isBackElementShown = false;\n  var titleTextWidth = 0;\n\n\n  self.beforeEnter = function(viewData) {\n    $scope.$broadcast('$ionicView.beforeEnter', viewData);\n  };\n\n\n  self.title = function(newTitleText) {\n    if (arguments.length && newTitleText !== titleText) {\n      getEle(TITLE).innerHTML = newTitleText;\n      titleText = newTitleText;\n      titleTextWidth = 0;\n    }\n    return titleText;\n  };\n\n\n  self.enableBack = function(shouldEnable, disableReset) {\n    // whether or not the back button show be visible, according\n    // to the navigation and history\n    if (arguments.length) {\n      isBackEnabled = shouldEnable;\n      if (!disableReset) self.updateBackButton();\n    }\n    return isBackEnabled;\n  };\n\n\n  self.showBack = function(shouldShow, disableReset) {\n    // different from enableBack() because this will always have the back\n    // visually hidden if false, even if the history says it should show\n    if (arguments.length) {\n      isBackShown = shouldShow;\n      if (!disableReset) self.updateBackButton();\n    }\n    return isBackShown;\n  };\n\n\n  self.showNavBack = function(shouldShow) {\n    // different from showBack() because this is for the entire nav bar's\n    // setting for all of it's child headers. For internal use.\n    isNavBackShown = shouldShow;\n    self.updateBackButton();\n  };\n\n\n  self.updateBackButton = function() {\n    var ele;\n    if ((isBackShown && isNavBackShown && isBackEnabled) !== isBackElementShown) {\n      isBackElementShown = isBackShown && isNavBackShown && isBackEnabled;\n      ele = getEle(BACK_BUTTON);\n      ele && ele.classList[ isBackElementShown ? 'remove' : 'add' ](HIDE);\n    }\n\n    if (isBackEnabled) {\n      ele = ele || getEle(BACK_BUTTON);\n      if (ele) {\n        if (self.backButtonIcon !== $ionicConfig.backButton.icon()) {\n          ele = getEle(BACK_BUTTON + ' .icon');\n          if (ele) {\n            self.backButtonIcon = $ionicConfig.backButton.icon();\n            ele.className = 'icon ' + self.backButtonIcon;\n          }\n        }\n\n        if (self.backButtonText !== $ionicConfig.backButton.text()) {\n          ele = getEle(BACK_BUTTON + ' .back-text');\n          if (ele) {\n            ele.textContent = self.backButtonText = $ionicConfig.backButton.text();\n          }\n        }\n      }\n    }\n  };\n\n\n  self.titleTextWidth = function() {\n    var element = getEle(TITLE);\n    if ( element ) {\n      // If the element has a nav-bar-title, use that instead\n      // to calculate the width of the title\n      var children = angular.element(element).children();\n      for ( var i = 0; i < children.length; i++ ) {\n        if ( angular.element(children[i]).hasClass('nav-bar-title') ) {\n          element = children[i];\n          break;\n        }\n      }\n    }\n    var bounds = ionic.DomUtil.getTextBounds(element);\n    titleTextWidth = Math.min(bounds && bounds.width || 30);\n    return titleTextWidth;\n  };\n\n\n  self.titleWidth = function() {\n    var titleWidth = self.titleTextWidth();\n    var offsetWidth = getEle(TITLE).offsetWidth;\n    if (offsetWidth < titleWidth) {\n      titleWidth = offsetWidth + (titleLeft - titleRight - 5);\n    }\n    return titleWidth;\n  };\n\n\n  self.titleTextX = function() {\n    return ($element[0].offsetWidth / 2) - (self.titleWidth() / 2);\n  };\n\n\n  self.titleLeftRight = function() {\n    return titleLeft - titleRight;\n  };\n\n\n  self.backButtonTextLeft = function() {\n    var offsetLeft = 0;\n    var ele = getEle(BACK_TEXT);\n    while (ele) {\n      offsetLeft += ele.offsetLeft;\n      ele = ele.parentElement;\n    }\n    return offsetLeft;\n  };\n\n\n  self.resetBackButton = function(viewData) {\n    if ($ionicConfig.backButton.previousTitleText()) {\n      var previousTitleEle = getEle(PREVIOUS_TITLE);\n      if (previousTitleEle) {\n        previousTitleEle.classList.remove(HIDE);\n\n        var view = (viewData && $ionicHistory.getViewById(viewData.viewId));\n        var newPreviousTitleText = $ionicHistory.backTitle(view);\n\n        if (newPreviousTitleText !== previousTitleText) {\n          previousTitleText = previousTitleEle.innerHTML = newPreviousTitleText;\n        }\n      }\n      var defaultTitleEle = getEle(DEFAULT_TITLE);\n      if (defaultTitleEle) {\n        defaultTitleEle.classList.remove(HIDE);\n      }\n    }\n  };\n\n\n  self.align = function(textAlign) {\n    var titleEle = getEle(TITLE);\n\n    textAlign = textAlign || $attrs.alignTitle || $ionicConfig.navBar.alignTitle();\n\n    var widths = self.calcWidths(textAlign, false);\n\n    if (isBackShown && previousTitleText && $ionicConfig.backButton.previousTitleText()) {\n      var previousTitleWidths = self.calcWidths(textAlign, true);\n\n      var availableTitleWidth = $element[0].offsetWidth - previousTitleWidths.titleLeft - previousTitleWidths.titleRight;\n\n      if (self.titleTextWidth() <= availableTitleWidth) {\n        widths = previousTitleWidths;\n      }\n    }\n\n    return self.updatePositions(titleEle, widths.titleLeft, widths.titleRight, widths.buttonsLeft, widths.buttonsRight, widths.css, widths.showPrevTitle);\n  };\n\n\n  self.calcWidths = function(textAlign, isPreviousTitle) {\n    var titleEle = getEle(TITLE);\n    var backBtnEle = getEle(BACK_BUTTON);\n    var x, y, z, b, c, d, childSize, bounds;\n    var childNodes = $element[0].childNodes;\n    var buttonsLeft = 0;\n    var buttonsRight = 0;\n    var isCountRightOfTitle;\n    var updateTitleLeft = 0;\n    var updateTitleRight = 0;\n    var updateCss = '';\n    var backButtonWidth = 0;\n\n    // Compute how wide the left children are\n    // Skip all titles (there may still be two titles, one leaving the dom)\n    // Once we encounter a titleEle, realize we are now counting the right-buttons, not left\n    for (x = 0; x < childNodes.length; x++) {\n      c = childNodes[x];\n\n      childSize = 0;\n      if (c.nodeType == 1) {\n        // element node\n        if (c === titleEle) {\n          isCountRightOfTitle = true;\n          continue;\n        }\n\n        if (c.classList.contains(HIDE)) {\n          continue;\n        }\n\n        if (isBackShown && c === backBtnEle) {\n\n          for (y = 0; y < c.childNodes.length; y++) {\n            b = c.childNodes[y];\n\n            if (b.nodeType == 1) {\n\n              if (b.classList.contains(BACK_TEXT)) {\n                for (z = 0; z < b.children.length; z++) {\n                  d = b.children[z];\n\n                  if (isPreviousTitle) {\n                    if (d.classList.contains(DEFAULT_TITLE)) continue;\n                    backButtonWidth += d.offsetWidth;\n                  } else {\n                    if (d.classList.contains(PREVIOUS_TITLE)) continue;\n                    backButtonWidth += d.offsetWidth;\n                  }\n                }\n\n              } else {\n                backButtonWidth += b.offsetWidth;\n              }\n\n            } else if (b.nodeType == 3 && b.nodeValue.trim()) {\n              bounds = ionic.DomUtil.getTextBounds(b);\n              backButtonWidth += bounds && bounds.width || 0;\n            }\n\n          }\n          childSize = backButtonWidth || c.offsetWidth;\n\n        } else {\n          // not the title, not the back button, not a hidden element\n          childSize = c.offsetWidth;\n        }\n\n      } else if (c.nodeType == 3 && c.nodeValue.trim()) {\n        // text node\n        bounds = ionic.DomUtil.getTextBounds(c);\n        childSize = bounds && bounds.width || 0;\n      }\n\n      if (isCountRightOfTitle) {\n        buttonsRight += childSize;\n      } else {\n        buttonsLeft += childSize;\n      }\n    }\n\n    // Size and align the header titleEle based on the sizes of the left and\n    // right children, and the desired alignment mode\n    if (textAlign == 'left') {\n      updateCss = 'title-left';\n      if (buttonsLeft) {\n        updateTitleLeft = buttonsLeft + 15;\n      }\n      if (buttonsRight) {\n        updateTitleRight = buttonsRight + 15;\n      }\n\n    } else if (textAlign == 'right') {\n      updateCss = 'title-right';\n      if (buttonsLeft) {\n        updateTitleLeft = buttonsLeft + 15;\n      }\n      if (buttonsRight) {\n        updateTitleRight = buttonsRight + 15;\n      }\n\n    } else {\n      // center the default\n      var margin = Math.max(buttonsLeft, buttonsRight) + 10;\n      if (margin > 10) {\n        updateTitleLeft = updateTitleRight = margin;\n      }\n    }\n\n    return {\n      backButtonWidth: backButtonWidth,\n      buttonsLeft: buttonsLeft,\n      buttonsRight: buttonsRight,\n      titleLeft: updateTitleLeft,\n      titleRight: updateTitleRight,\n      showPrevTitle: isPreviousTitle,\n      css: updateCss\n    };\n  };\n\n\n  self.updatePositions = function(titleEle, updateTitleLeft, updateTitleRight, buttonsLeft, buttonsRight, updateCss, showPreviousTitle) {\n    var deferred = $q.defer();\n\n    // only make DOM updates when there are actual changes\n    if (titleEle) {\n      if (updateTitleLeft !== titleLeft) {\n        titleEle.style.left = updateTitleLeft ? updateTitleLeft + 'px' : '';\n        titleLeft = updateTitleLeft;\n      }\n      if (updateTitleRight !== titleRight) {\n        titleEle.style.right = updateTitleRight ? updateTitleRight + 'px' : '';\n        titleRight = updateTitleRight;\n      }\n\n      if (updateCss !== titleCss) {\n        updateCss && titleEle.classList.add(updateCss);\n        titleCss && titleEle.classList.remove(titleCss);\n        titleCss = updateCss;\n      }\n    }\n\n    if ($ionicConfig.backButton.previousTitleText()) {\n      var prevTitle = getEle(PREVIOUS_TITLE);\n      var defaultTitle = getEle(DEFAULT_TITLE);\n\n      prevTitle && prevTitle.classList[ showPreviousTitle ? 'remove' : 'add'](HIDE);\n      defaultTitle && defaultTitle.classList[ showPreviousTitle ? 'add' : 'remove'](HIDE);\n    }\n\n    ionic.requestAnimationFrame(function() {\n      if (titleEle && titleEle.offsetWidth + 10 < titleEle.scrollWidth) {\n        var minRight = buttonsRight + 5;\n        var testRight = $element[0].offsetWidth - titleLeft - self.titleTextWidth() - 20;\n        updateTitleRight = testRight < minRight ? minRight : testRight;\n        if (updateTitleRight !== titleRight) {\n          titleEle.style.right = updateTitleRight + 'px';\n          titleRight = updateTitleRight;\n        }\n      }\n      deferred.resolve();\n    });\n\n    return deferred.promise;\n  };\n\n\n  self.setCss = function(elementClassname, css) {\n    ionic.DomUtil.cachedStyles(getEle(elementClassname), css);\n  };\n\n\n  var eleCache = {};\n  function getEle(className) {\n    if (!eleCache[className]) {\n      eleCache[className] = $element[0].querySelector('.' + className);\n    }\n    return eleCache[className];\n  }\n\n\n  $scope.$on('$destroy', function() {\n    for (var n in eleCache) eleCache[n] = null;\n  });\n\n}]);\n\nIonicModule\n.controller('$ionInfiniteScroll', [\n  '$scope',\n  '$attrs',\n  '$element',\n  '$timeout',\nfunction($scope, $attrs, $element, $timeout) {\n  var self = this;\n  self.isLoading = false;\n\n  $scope.icon = function() {\n    return isDefined($attrs.icon) ? $attrs.icon : 'ion-load-d';\n  };\n\n  $scope.spinner = function() {\n    return isDefined($attrs.spinner) ? $attrs.spinner : '';\n  };\n\n  $scope.$on('scroll.infiniteScrollComplete', function() {\n    finishInfiniteScroll();\n  });\n\n  $scope.$on('$destroy', function() {\n    if (self.scrollCtrl && self.scrollCtrl.$element) self.scrollCtrl.$element.off('scroll', self.checkBounds);\n    if (self.scrollEl && self.scrollEl.removeEventListener) {\n      self.scrollEl.removeEventListener('scroll', self.checkBounds);\n    }\n  });\n\n  // debounce checking infinite scroll events\n  self.checkBounds = ionic.Utils.throttle(checkInfiniteBounds, 300);\n\n  function onInfinite() {\n    ionic.requestAnimationFrame(function() {\n      $element[0].classList.add('active');\n    });\n    self.isLoading = true;\n    $scope.$parent && $scope.$parent.$apply($attrs.onInfinite || '');\n  }\n\n  function finishInfiniteScroll() {\n    ionic.requestAnimationFrame(function() {\n      $element[0].classList.remove('active');\n    });\n    $timeout(function() {\n      if (self.jsScrolling) self.scrollView.resize();\n      // only check bounds again immediately if the page isn't cached (scroll el has height)\n      if ((self.jsScrolling && self.scrollView.__container && self.scrollView.__container.offsetHeight > 0) ||\n      !self.jsScrolling) {\n        self.checkBounds();\n      }\n    }, 30, false);\n    self.isLoading = false;\n  }\n\n  // check if we've scrolled far enough to trigger an infinite scroll\n  function checkInfiniteBounds() {\n    if (self.isLoading) return;\n    var maxScroll = {};\n\n    if (self.jsScrolling) {\n      maxScroll = self.getJSMaxScroll();\n      var scrollValues = self.scrollView.getValues();\n      if ((maxScroll.left !== -1 && scrollValues.left >= maxScroll.left) ||\n        (maxScroll.top !== -1 && scrollValues.top >= maxScroll.top)) {\n        onInfinite();\n      }\n    } else {\n      maxScroll = self.getNativeMaxScroll();\n      if ((\n        maxScroll.left !== -1 &&\n        self.scrollEl.scrollLeft >= maxScroll.left - self.scrollEl.clientWidth\n        ) || (\n        maxScroll.top !== -1 &&\n        self.scrollEl.scrollTop >= maxScroll.top - self.scrollEl.clientHeight\n        )) {\n        onInfinite();\n      }\n    }\n  }\n\n  // determine the threshold at which we should fire an infinite scroll\n  // note: this gets processed every scroll event, can it be cached?\n  self.getJSMaxScroll = function() {\n    var maxValues = self.scrollView.getScrollMax();\n    return {\n      left: self.scrollView.options.scrollingX ?\n        calculateMaxValue(maxValues.left) :\n        -1,\n      top: self.scrollView.options.scrollingY ?\n        calculateMaxValue(maxValues.top) :\n        -1\n    };\n  };\n\n  self.getNativeMaxScroll = function() {\n    var maxValues = {\n      left: self.scrollEl.scrollWidth,\n      top: self.scrollEl.scrollHeight\n    };\n    var computedStyle = window.getComputedStyle(self.scrollEl) || {};\n    return {\n      left: maxValues.left &&\n        (computedStyle.overflowX === 'scroll' ||\n        computedStyle.overflowX === 'auto' ||\n        self.scrollEl.style['overflow-x'] === 'scroll') ?\n        calculateMaxValue(maxValues.left) : -1,\n      top: maxValues.top &&\n        (computedStyle.overflowY === 'scroll' ||\n        computedStyle.overflowY === 'auto' ||\n        self.scrollEl.style['overflow-y'] === 'scroll' ) ?\n        calculateMaxValue(maxValues.top) : -1\n    };\n  };\n\n  // determine pixel refresh distance based on % or value\n  function calculateMaxValue(maximum) {\n    var distance = ($attrs.distance || '2.5%').trim();\n    var isPercent = distance.indexOf('%') !== -1;\n    return isPercent ?\n    maximum * (1 - parseFloat(distance) / 100) :\n    maximum - parseFloat(distance);\n  }\n\n  //for testing\n  self.__finishInfiniteScroll = finishInfiniteScroll;\n\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicListDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionList} directive.\n *\n * Methods called directly on the $ionicListDelegate service will control all lists.\n * Use the {@link ionic.service:$ionicListDelegate#$getByHandle $getByHandle}\n * method to control specific ionList instances.\n *\n * @usage\n * ```html\n * {% raw %}\n * <ion-content ng-controller=\"MyCtrl\">\n *   <button class=\"button\" ng-click=\"showDeleteButtons()\"></button>\n *   <ion-list>\n *     <ion-item ng-repeat=\"i in items\">\n *       Hello, {{i}}!\n *       <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n *     </ion-item>\n *   </ion-list>\n * </ion-content>\n * {% endraw %}\n * ```\n\n * ```js\n * function MyCtrl($scope, $ionicListDelegate) {\n *   $scope.showDeleteButtons = function() {\n *     $ionicListDelegate.showDelete(true);\n *   };\n * }\n * ```\n */\nIonicModule.service('$ionicListDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showReorder\n   * @param {boolean=} showReorder Set whether or not this list is showing its reorder buttons.\n   * @returns {boolean} Whether the reorder buttons are shown.\n   */\n  'showReorder',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showDelete\n   * @param {boolean=} showDelete Set whether or not this list is showing its delete buttons.\n   * @returns {boolean} Whether the delete buttons are shown.\n   */\n  'showDelete',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#canSwipeItems\n   * @param {boolean=} canSwipeItems Set whether or not this list is able to swipe to show\n   * option buttons.\n   * @returns {boolean} Whether the list is able to swipe to show option buttons.\n   */\n  'canSwipeItems',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#closeOptionButtons\n   * @description Closes any option buttons on the list that are swiped open.\n   */\n  'closeOptionButtons'\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionList} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicListDelegate.$getByHandle('my-handle').showReorder(true);`\n   */\n]))\n\n.controller('$ionicList', [\n  '$scope',\n  '$attrs',\n  '$ionicListDelegate',\n  '$ionicHistory',\nfunction($scope, $attrs, $ionicListDelegate, $ionicHistory) {\n  var self = this;\n  var isSwipeable = true;\n  var isReorderShown = false;\n  var isDeleteShown = false;\n\n  var deregisterInstance = $ionicListDelegate._registerInstance(\n    self, $attrs.delegateHandle, function() {\n      return $ionicHistory.isActiveScope($scope);\n    }\n  );\n  $scope.$on('$destroy', deregisterInstance);\n\n  self.showReorder = function(show) {\n    if (arguments.length) {\n      isReorderShown = !!show;\n    }\n    return isReorderShown;\n  };\n\n  self.showDelete = function(show) {\n    if (arguments.length) {\n      isDeleteShown = !!show;\n    }\n    return isDeleteShown;\n  };\n\n  self.canSwipeItems = function(can) {\n    if (arguments.length) {\n      isSwipeable = !!can;\n    }\n    return isSwipeable;\n  };\n\n  self.closeOptionButtons = function() {\n    self.listView && self.listView.clearDragEffects();\n  };\n}]);\n\nIonicModule\n\n.controller('$ionicNavBar', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$compile',\n  '$timeout',\n  '$ionicNavBarDelegate',\n  '$ionicConfig',\n  '$ionicHistory',\nfunction($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $ionicConfig, $ionicHistory) {\n\n  var CSS_HIDE = 'hide';\n  var DATA_NAV_BAR_CTRL = '$ionNavBarController';\n  var PRIMARY_BUTTONS = 'primaryButtons';\n  var SECONDARY_BUTTONS = 'secondaryButtons';\n  var BACK_BUTTON = 'backButton';\n  var ITEM_TYPES = 'primaryButtons secondaryButtons leftButtons rightButtons title'.split(' ');\n\n  var self = this;\n  var headerBars = [];\n  var navElementHtml = {};\n  var isVisible = true;\n  var queuedTransitionStart, queuedTransitionEnd, latestTransitionId;\n\n  $element.parent().data(DATA_NAV_BAR_CTRL, self);\n\n  var delegateHandle = $attrs.delegateHandle || 'navBar' + ionic.Utils.nextUid();\n\n  var deregisterInstance = $ionicNavBarDelegate._registerInstance(self, delegateHandle);\n\n\n  self.init = function() {\n    $element.addClass('nav-bar-container');\n    ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', $ionicConfig.views.transition());\n\n    // create two nav bar blocks which will trade out which one is shown\n    self.createHeaderBar(false);\n    self.createHeaderBar(true);\n\n    $scope.$emit('ionNavBar.init', delegateHandle);\n  };\n\n\n  self.createHeaderBar = function(isActive) {\n    var containerEle = jqLite('<div class=\"nav-bar-block\">');\n    ionic.DomUtil.cachedAttr(containerEle, 'nav-bar', isActive ? 'active' : 'cached');\n\n    var alignTitle = $attrs.alignTitle || $ionicConfig.navBar.alignTitle();\n    var headerBarEle = jqLite('<ion-header-bar>').addClass($attrs['class']).attr('align-title', alignTitle);\n    if (isDefined($attrs.noTapScroll)) headerBarEle.attr('no-tap-scroll', $attrs.noTapScroll);\n    var titleEle = jqLite('<div class=\"title title-' + alignTitle + '\">');\n    var navEle = {};\n    var lastViewItemEle = {};\n    var leftButtonsEle, rightButtonsEle;\n\n    navEle[BACK_BUTTON] = createNavElement(BACK_BUTTON);\n    navEle[BACK_BUTTON] && headerBarEle.append(navEle[BACK_BUTTON]);\n\n    // append title in the header, this is the rock to where buttons append\n    headerBarEle.append(titleEle);\n\n    forEach(ITEM_TYPES, function(itemType) {\n      // create default button elements\n      navEle[itemType] = createNavElement(itemType);\n      // append and position buttons\n      positionItem(navEle[itemType], itemType);\n    });\n\n    // add header-item to the root children\n    for (var x = 0; x < headerBarEle[0].children.length; x++) {\n      headerBarEle[0].children[x].classList.add('header-item');\n    }\n\n    // compile header and append to the DOM\n    containerEle.append(headerBarEle);\n    $element.append($compile(containerEle)($scope.$new()));\n\n    var headerBarCtrl = headerBarEle.data('$ionHeaderBarController');\n    headerBarCtrl.backButtonIcon = $ionicConfig.backButton.icon();\n    headerBarCtrl.backButtonText = $ionicConfig.backButton.text();\n\n    var headerBarInstance = {\n      isActive: isActive,\n      title: function(newTitleText) {\n        headerBarCtrl.title(newTitleText);\n      },\n      setItem: function(navBarItemEle, itemType) {\n        // first make sure any exiting nav bar item has been removed\n        headerBarInstance.removeItem(itemType);\n\n        if (navBarItemEle) {\n          if (itemType === 'title') {\n            // clear out the text based title\n            headerBarInstance.title(\"\");\n          }\n\n          // there's a custom nav bar item\n          positionItem(navBarItemEle, itemType);\n\n          if (navEle[itemType]) {\n            // make sure the default on this itemType is hidden\n            navEle[itemType].addClass(CSS_HIDE);\n          }\n          lastViewItemEle[itemType] = navBarItemEle;\n\n        } else if (navEle[itemType]) {\n          // there's a default button for this side and no view button\n          navEle[itemType].removeClass(CSS_HIDE);\n        }\n      },\n      removeItem: function(itemType) {\n        if (lastViewItemEle[itemType]) {\n          lastViewItemEle[itemType].scope().$destroy();\n          lastViewItemEle[itemType].remove();\n          lastViewItemEle[itemType] = null;\n        }\n      },\n      containerEle: function() {\n        return containerEle;\n      },\n      headerBarEle: function() {\n        return headerBarEle;\n      },\n      afterLeave: function() {\n        forEach(ITEM_TYPES, function(itemType) {\n          headerBarInstance.removeItem(itemType);\n        });\n        headerBarCtrl.resetBackButton();\n      },\n      controller: function() {\n        return headerBarCtrl;\n      },\n      destroy: function() {\n        forEach(ITEM_TYPES, function(itemType) {\n          headerBarInstance.removeItem(itemType);\n        });\n        containerEle.scope().$destroy();\n        for (var n in navEle) {\n          if (navEle[n]) {\n            navEle[n].removeData();\n            navEle[n] = null;\n          }\n        }\n        leftButtonsEle && leftButtonsEle.removeData();\n        rightButtonsEle && rightButtonsEle.removeData();\n        titleEle.removeData();\n        headerBarEle.removeData();\n        containerEle.remove();\n        containerEle = headerBarEle = titleEle = leftButtonsEle = rightButtonsEle = null;\n      }\n    };\n\n    function positionItem(ele, itemType) {\n      if (!ele) return;\n\n      if (itemType === 'title') {\n        // title element\n        titleEle.append(ele);\n\n      } else if (itemType == 'rightButtons' ||\n                (itemType == SECONDARY_BUTTONS && $ionicConfig.navBar.positionSecondaryButtons() != 'left') ||\n                (itemType == PRIMARY_BUTTONS && $ionicConfig.navBar.positionPrimaryButtons() == 'right')) {\n        // right side\n        if (!rightButtonsEle) {\n          rightButtonsEle = jqLite('<div class=\"buttons buttons-right\">');\n          headerBarEle.append(rightButtonsEle);\n        }\n        if (itemType == SECONDARY_BUTTONS) {\n          rightButtonsEle.append(ele);\n        } else {\n          rightButtonsEle.prepend(ele);\n        }\n\n      } else {\n        // left side\n        if (!leftButtonsEle) {\n          leftButtonsEle = jqLite('<div class=\"buttons buttons-left\">');\n          if (navEle[BACK_BUTTON]) {\n            navEle[BACK_BUTTON].after(leftButtonsEle);\n          } else {\n            headerBarEle.prepend(leftButtonsEle);\n          }\n        }\n        if (itemType == SECONDARY_BUTTONS) {\n          leftButtonsEle.append(ele);\n        } else {\n          leftButtonsEle.prepend(ele);\n        }\n      }\n\n    }\n\n    headerBars.push(headerBarInstance);\n\n    return headerBarInstance;\n  };\n\n\n  self.navElement = function(type, html) {\n    if (isDefined(html)) {\n      navElementHtml[type] = html;\n    }\n    return navElementHtml[type];\n  };\n\n\n  self.update = function(viewData) {\n    var showNavBar = !viewData.hasHeaderBar && viewData.showNavBar;\n    viewData.transition = $ionicConfig.views.transition();\n\n    if (!showNavBar) {\n      viewData.direction = 'none';\n    }\n\n    self.enable(showNavBar);\n    var enteringHeaderBar = self.isInitialized ? getOffScreenHeaderBar() : getOnScreenHeaderBar();\n    var leavingHeaderBar = self.isInitialized ? getOnScreenHeaderBar() : null;\n    var enteringHeaderCtrl = enteringHeaderBar.controller();\n\n    // update if the entering header should show the back button or not\n    enteringHeaderCtrl.enableBack(viewData.enableBack, true);\n    enteringHeaderCtrl.showBack(viewData.showBack, true);\n    enteringHeaderCtrl.updateBackButton();\n\n    // update the entering header bar's title\n    self.title(viewData.title, enteringHeaderBar);\n\n    self.showBar(showNavBar);\n\n    // update the nav bar items, depending if the view has their own or not\n    if (viewData.navBarItems) {\n      forEach(ITEM_TYPES, function(itemType) {\n        enteringHeaderBar.setItem(viewData.navBarItems[itemType], itemType);\n      });\n    }\n\n    // begin transition of entering and leaving header bars\n    self.transition(enteringHeaderBar, leavingHeaderBar, viewData);\n\n    self.isInitialized = true;\n    navSwipeAttr('');\n  };\n\n\n  self.transition = function(enteringHeaderBar, leavingHeaderBar, viewData) {\n    var enteringHeaderBarCtrl = enteringHeaderBar.controller();\n    var transitionFn = $ionicConfig.transitions.navBar[viewData.navBarTransition] || $ionicConfig.transitions.navBar.none;\n    var transitionId = viewData.transitionId;\n\n    enteringHeaderBarCtrl.beforeEnter(viewData);\n\n    var navBarTransition = transitionFn(enteringHeaderBar, leavingHeaderBar, viewData.direction, viewData.shouldAnimate && self.isInitialized);\n\n    ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', viewData.navBarTransition);\n    ionic.DomUtil.cachedAttr($element, 'nav-bar-direction', viewData.direction);\n\n    if (navBarTransition.shouldAnimate && viewData.renderEnd) {\n      navBarAttr(enteringHeaderBar, 'stage');\n    } else {\n      navBarAttr(enteringHeaderBar, 'entering');\n      navBarAttr(leavingHeaderBar, 'leaving');\n    }\n\n    enteringHeaderBarCtrl.resetBackButton(viewData);\n\n    navBarTransition.run(0);\n\n    self.activeTransition = {\n      run: function(step) {\n        navBarTransition.shouldAnimate = false;\n        navBarTransition.direction = 'back';\n        navBarTransition.run(step);\n      },\n      cancel: function(shouldAnimate, speed, cancelData) {\n        navSwipeAttr(speed);\n        navBarAttr(leavingHeaderBar, 'active');\n        navBarAttr(enteringHeaderBar, 'cached');\n        navBarTransition.shouldAnimate = shouldAnimate;\n        navBarTransition.run(0);\n        self.activeTransition = navBarTransition = null;\n\n        var runApply;\n        if (cancelData.showBar !== self.showBar()) {\n          self.showBar(cancelData.showBar);\n        }\n        if (cancelData.showBackButton !== self.showBackButton()) {\n          self.showBackButton(cancelData.showBackButton);\n        }\n        if (runApply) {\n          $scope.$apply();\n        }\n      },\n      complete: function(shouldAnimate, speed) {\n        navSwipeAttr(speed);\n        navBarTransition.shouldAnimate = shouldAnimate;\n        navBarTransition.run(1);\n        queuedTransitionEnd = transitionEnd;\n      }\n    };\n\n    $timeout(enteringHeaderBarCtrl.align, 16);\n\n    queuedTransitionStart = function() {\n      if (latestTransitionId !== transitionId) return;\n\n      navBarAttr(enteringHeaderBar, 'entering');\n      navBarAttr(leavingHeaderBar, 'leaving');\n\n      navBarTransition.run(1);\n\n      queuedTransitionEnd = function() {\n        if (latestTransitionId == transitionId || !navBarTransition.shouldAnimate) {\n          transitionEnd();\n        }\n      };\n\n      queuedTransitionStart = null;\n    };\n\n    function transitionEnd() {\n      for (var x = 0; x < headerBars.length; x++) {\n        headerBars[x].isActive = false;\n      }\n      enteringHeaderBar.isActive = true;\n\n      navBarAttr(enteringHeaderBar, 'active');\n      navBarAttr(leavingHeaderBar, 'cached');\n\n      self.activeTransition = navBarTransition = queuedTransitionEnd = null;\n    }\n\n    queuedTransitionStart();\n  };\n\n\n  self.triggerTransitionStart = function(triggerTransitionId) {\n    latestTransitionId = triggerTransitionId;\n    queuedTransitionStart && queuedTransitionStart();\n  };\n\n\n  self.triggerTransitionEnd = function() {\n    queuedTransitionEnd && queuedTransitionEnd();\n  };\n\n\n  self.showBar = function(shouldShow) {\n    if (arguments.length) {\n      self.visibleBar(shouldShow);\n      $scope.$parent.$hasHeader = !!shouldShow;\n    }\n    return !!$scope.$parent.$hasHeader;\n  };\n\n\n  self.visibleBar = function(shouldShow) {\n    if (shouldShow && !isVisible) {\n      $element.removeClass(CSS_HIDE);\n      self.align();\n    } else if (!shouldShow && isVisible) {\n      $element.addClass(CSS_HIDE);\n    }\n    isVisible = shouldShow;\n  };\n\n\n  self.enable = function(val) {\n    // set primary to show first\n    self.visibleBar(val);\n\n    // set non primary to hide second\n    for (var x = 0; x < $ionicNavBarDelegate._instances.length; x++) {\n      if ($ionicNavBarDelegate._instances[x] !== self) $ionicNavBarDelegate._instances[x].visibleBar(false);\n    }\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavBar#showBackButton\n   * @description Show/hide the nav bar back button when there is a\n   * back view. If the back button is not possible, for example, the\n   * first view in the stack, then this will not force the back button\n   * to show.\n   */\n  self.showBackButton = function(shouldShow) {\n    if (arguments.length) {\n      for (var x = 0; x < headerBars.length; x++) {\n        headerBars[x].controller().showNavBack(!!shouldShow);\n      }\n      $scope.$isBackButtonShown = !!shouldShow;\n    }\n    return $scope.$isBackButtonShown;\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavBar#showActiveBackButton\n   * @description Show/hide only the active header bar's back button.\n   */\n  self.showActiveBackButton = function(shouldShow) {\n    var headerBar = getOnScreenHeaderBar();\n    if (headerBar) {\n      if (arguments.length) {\n        return headerBar.controller().showBack(shouldShow);\n      }\n      return headerBar.controller().showBack();\n    }\n  };\n\n\n  self.title = function(newTitleText, headerBar) {\n    if (isDefined(newTitleText)) {\n      newTitleText = newTitleText || '';\n      headerBar = headerBar || getOnScreenHeaderBar();\n      headerBar && headerBar.title(newTitleText);\n      $scope.$title = newTitleText;\n      $ionicHistory.currentTitle(newTitleText);\n    }\n    return $scope.$title;\n  };\n\n\n  self.align = function(val, headerBar) {\n    headerBar = headerBar || getOnScreenHeaderBar();\n    headerBar && headerBar.controller().align(val);\n  };\n\n\n  self.hasTabsTop = function(isTabsTop) {\n    $element[isTabsTop ? 'addClass' : 'removeClass']('nav-bar-tabs-top');\n  };\n\n  self.hasBarSubheader = function(isBarSubheader) {\n    $element[isBarSubheader ? 'addClass' : 'removeClass']('nav-bar-has-subheader');\n  };\n\n  // DEPRECATED, as of v1.0.0-beta14 -------\n  self.changeTitle = function(val) {\n    deprecatedWarning('changeTitle(val)', 'title(val)');\n    self.title(val);\n  };\n  self.setTitle = function(val) {\n    deprecatedWarning('setTitle(val)', 'title(val)');\n    self.title(val);\n  };\n  self.getTitle = function() {\n    deprecatedWarning('getTitle()', 'title()');\n    return self.title();\n  };\n  self.back = function() {\n    deprecatedWarning('back()', '$ionicHistory.goBack()');\n    $ionicHistory.goBack();\n  };\n  self.getPreviousTitle = function() {\n    deprecatedWarning('getPreviousTitle()', '$ionicHistory.backTitle()');\n    $ionicHistory.goBack();\n  };\n  function deprecatedWarning(oldMethod, newMethod) {\n    var warn = console.warn || console.log;\n    warn && warn.call(console, 'navBarController.' + oldMethod + ' is deprecated, please use ' + newMethod + ' instead');\n  }\n  // END DEPRECATED -------\n\n\n  function createNavElement(type) {\n    if (navElementHtml[type]) {\n      return jqLite(navElementHtml[type]);\n    }\n  }\n\n\n  function getOnScreenHeaderBar() {\n    for (var x = 0; x < headerBars.length; x++) {\n      if (headerBars[x].isActive) return headerBars[x];\n    }\n  }\n\n\n  function getOffScreenHeaderBar() {\n    for (var x = 0; x < headerBars.length; x++) {\n      if (!headerBars[x].isActive) return headerBars[x];\n    }\n  }\n\n\n  function navBarAttr(ctrl, val) {\n    ctrl && ionic.DomUtil.cachedAttr(ctrl.containerEle(), 'nav-bar', val);\n  }\n\n  function navSwipeAttr(val) {\n    ionic.DomUtil.cachedAttr($element, 'nav-swipe', val);\n  }\n\n\n  $scope.$on('$destroy', function() {\n    $scope.$parent.$hasHeader = false;\n    $element.parent().removeData(DATA_NAV_BAR_CTRL);\n    for (var x = 0; x < headerBars.length; x++) {\n      headerBars[x].destroy();\n    }\n    $element.remove();\n    $element = headerBars = null;\n    deregisterInstance();\n  });\n\n}]);\n\nIonicModule\n.controller('$ionicNavView', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$compile',\n  '$controller',\n  '$ionicNavBarDelegate',\n  '$ionicNavViewDelegate',\n  '$ionicHistory',\n  '$ionicViewSwitcher',\n  '$ionicConfig',\n  '$ionicScrollDelegate',\n  '$ionicSideMenuDelegate',\nfunction($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate, $ionicNavViewDelegate, $ionicHistory, $ionicViewSwitcher, $ionicConfig, $ionicScrollDelegate, $ionicSideMenuDelegate) {\n\n  var DATA_ELE_IDENTIFIER = '$eleId';\n  var DATA_DESTROY_ELE = '$destroyEle';\n  var DATA_NO_CACHE = '$noCache';\n  var VIEW_STATUS_ACTIVE = 'active';\n  var VIEW_STATUS_CACHED = 'cached';\n\n  var self = this;\n  var direction;\n  var isPrimary = false;\n  var navBarDelegate;\n  var activeEleId;\n  var navViewAttr = $ionicViewSwitcher.navViewAttr;\n  var disableRenderStartViewId, disableAnimation;\n\n  self.scope = $scope;\n  self.element = $element;\n\n  self.init = function() {\n    var navViewName = $attrs.name || '';\n\n    // Find the details of the parent view directive (if any) and use it\n    // to derive our own qualified view name, then hang our own details\n    // off the DOM so child directives can find it.\n    var parent = $element.parent().inheritedData('$uiView');\n    var parentViewName = ((parent && parent.state) ? parent.state.name : '');\n    if (navViewName.indexOf('@') < 0) navViewName = navViewName + '@' + parentViewName;\n\n    var viewData = { name: navViewName, state: null };\n    $element.data('$uiView', viewData);\n\n    var deregisterInstance = $ionicNavViewDelegate._registerInstance(self, $attrs.delegateHandle);\n    $scope.$on('$destroy', function() {\n      deregisterInstance();\n\n      // ensure no scrolls have been left frozen\n      if (self.isSwipeFreeze) {\n        $ionicScrollDelegate.freezeAllScrolls(false);\n      }\n    });\n\n    $scope.$on('$ionicHistory.deselect', self.cacheCleanup);\n    $scope.$on('$ionicTabs.top', onTabsTop);\n    $scope.$on('$ionicSubheader', onBarSubheader);\n\n    $scope.$on('$ionicTabs.beforeLeave', onTabsLeave);\n    $scope.$on('$ionicTabs.afterLeave', onTabsLeave);\n    $scope.$on('$ionicTabs.leave', onTabsLeave);\n\n    ionic.Platform.ready(function() {\n      if ( ionic.Platform.isWebView() && ionic.Platform.isIOS() ) {\n          self.initSwipeBack();\n      }\n    });\n\n    return viewData;\n  };\n\n\n  self.register = function(viewLocals) {\n    var leavingView = extend({}, $ionicHistory.currentView());\n\n    // register that a view is coming in and get info on how it should transition\n    var registerData = $ionicHistory.register($scope, viewLocals);\n\n    // update which direction\n    self.update(registerData);\n\n    // begin rendering and transitioning\n    var enteringView = $ionicHistory.getViewById(registerData.viewId) || {};\n\n    var renderStart = (disableRenderStartViewId !== registerData.viewId);\n    self.render(registerData, viewLocals, enteringView, leavingView, renderStart, true);\n  };\n\n\n  self.update = function(registerData) {\n    // always reset that this is the primary navView\n    isPrimary = true;\n\n    // remember what direction this navView should use\n    // this may get updated later by a child navView\n    direction = registerData.direction;\n\n    var parentNavViewCtrl = $element.parent().inheritedData('$ionNavViewController');\n    if (parentNavViewCtrl) {\n      // this navView is nested inside another one\n      // update the parent to use this direction and not\n      // the other it originally was set to\n\n      // inform the parent navView that it is not the primary navView\n      parentNavViewCtrl.isPrimary(false);\n\n      if (direction === 'enter' || direction === 'exit') {\n        // they're entering/exiting a history\n        // find parent navViewController\n        parentNavViewCtrl.direction(direction);\n\n        if (direction === 'enter') {\n          // reset the direction so this navView doesn't animate\n          // because it's parent will\n          direction = 'none';\n        }\n      }\n    }\n  };\n\n\n  self.render = function(registerData, viewLocals, enteringView, leavingView, renderStart, renderEnd) {\n    // register the view and figure out where it lives in the various\n    // histories and nav stacks, along with how views should enter/leave\n    var switcher = $ionicViewSwitcher.create(self, viewLocals, enteringView, leavingView, renderStart, renderEnd);\n\n    // init the rendering of views for this navView directive\n    switcher.init(registerData, function() {\n      // the view is now compiled, in the dom and linked, now lets transition the views.\n      // this uses a callback incase THIS nav-view has a nested nav-view, and after the NESTED\n      // nav-view links, the NESTED nav-view would update which direction THIS nav-view should use\n\n      // kick off the transition of views\n      switcher.transition(self.direction(), registerData.enableBack, !disableAnimation);\n\n      // reset private vars for next time\n      disableRenderStartViewId = disableAnimation = null;\n    });\n\n  };\n\n\n  self.beforeEnter = function(transitionData) {\n    if (isPrimary) {\n      // only update this nav-view's nav-bar if this is the primary nav-view\n      navBarDelegate = transitionData.navBarDelegate;\n      var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n      associatedNavBarCtrl && associatedNavBarCtrl.update(transitionData);\n      navSwipeAttr('');\n    }\n  };\n\n\n  self.activeEleId = function(eleId) {\n    if (arguments.length) {\n      activeEleId = eleId;\n    }\n    return activeEleId;\n  };\n\n\n  self.transitionEnd = function() {\n    var viewElements = $element.children();\n    var x, l, viewElement;\n\n    for (x = 0, l = viewElements.length; x < l; x++) {\n      viewElement = viewElements.eq(x);\n\n      if (viewElement.data(DATA_ELE_IDENTIFIER) === activeEleId) {\n        // this is the active element\n        navViewAttr(viewElement, VIEW_STATUS_ACTIVE);\n\n      } else if (navViewAttr(viewElement) === 'leaving' || navViewAttr(viewElement) === VIEW_STATUS_ACTIVE || navViewAttr(viewElement) === VIEW_STATUS_CACHED) {\n        // this is a leaving element or was the former active element, or is an cached element\n        if (viewElement.data(DATA_DESTROY_ELE) || viewElement.data(DATA_NO_CACHE)) {\n          // this element shouldn't stay cached\n          $ionicViewSwitcher.destroyViewEle(viewElement);\n\n        } else {\n          // keep in the DOM, mark as cached\n          navViewAttr(viewElement, VIEW_STATUS_CACHED);\n\n          // disconnect the leaving scope\n          ionic.Utils.disconnectScope(viewElement.scope());\n        }\n      }\n    }\n\n    navSwipeAttr('');\n\n    // ensure no scrolls have been left frozen\n    if (self.isSwipeFreeze) {\n      $ionicScrollDelegate.freezeAllScrolls(false);\n    }\n  };\n\n\n  function onTabsLeave(ev, data) {\n    var viewElements = $element.children();\n    var viewElement, viewScope;\n\n    for (var x = 0, l = viewElements.length; x < l; x++) {\n      viewElement = viewElements.eq(x);\n      if (navViewAttr(viewElement) == VIEW_STATUS_ACTIVE) {\n        viewScope = viewElement.scope();\n        viewScope && viewScope.$emit(ev.name.replace('Tabs', 'View'), data);\n        viewScope && viewScope.$broadcast(ev.name.replace('Tabs', 'ParentView'), data);\n        break;\n      }\n    }\n  }\n\n\n  self.cacheCleanup = function() {\n    var viewElements = $element.children();\n    for (var x = 0, l = viewElements.length; x < l; x++) {\n      if (viewElements.eq(x).data(DATA_DESTROY_ELE)) {\n        $ionicViewSwitcher.destroyViewEle(viewElements.eq(x));\n      }\n    }\n  };\n\n\n  self.clearCache = function(stateIds) {\n    var viewElements = $element.children();\n    var viewElement, viewScope, x, l, y, eleIdentifier;\n\n    for (x = 0, l = viewElements.length; x < l; x++) {\n      viewElement = viewElements.eq(x);\n\n      if (stateIds) {\n        eleIdentifier = viewElement.data(DATA_ELE_IDENTIFIER);\n\n        for (y = 0; y < stateIds.length; y++) {\n          if (eleIdentifier === stateIds[y]) {\n            $ionicViewSwitcher.destroyViewEle(viewElement);\n          }\n        }\n        continue;\n      }\n\n      if (navViewAttr(viewElement) == VIEW_STATUS_CACHED) {\n        $ionicViewSwitcher.destroyViewEle(viewElement);\n\n      } else if (navViewAttr(viewElement) == VIEW_STATUS_ACTIVE) {\n        viewScope = viewElement.scope();\n        viewScope && viewScope.$broadcast('$ionicView.clearCache');\n      }\n\n    }\n  };\n\n\n  self.getViewElements = function() {\n    return $element.children();\n  };\n\n\n  self.appendViewElement = function(viewEle, viewLocals) {\n    // compile the entering element and get the link function\n    var linkFn = $compile(viewEle);\n\n    $element.append(viewEle);\n\n    var viewScope = $scope.$new();\n\n    if (viewLocals && viewLocals.$$controller) {\n      viewLocals.$scope = viewScope;\n      var controller = $controller(viewLocals.$$controller, viewLocals);\n      if (viewLocals.$$controllerAs) {\n        viewScope[viewLocals.$$controllerAs] = controller;\n      }\n      $element.children().data('$ngControllerController', controller);\n    }\n\n    linkFn(viewScope);\n\n    return viewScope;\n  };\n\n\n  self.title = function(val) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.title(val);\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavView#enableBackButton\n   * @description Enable/disable if the back button can be shown or not. For\n   * example, the very first view in the navigation stack would not have a\n   * back view, so the back button would be disabled.\n   */\n  self.enableBackButton = function(shouldEnable) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.enableBackButton(shouldEnable);\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavView#showBackButton\n   * @description Show/hide the nav bar active back button. If the back button\n   * is not possible this will not force the back button to show. The\n   * `enableBackButton()` method handles if a back button is even possible or not.\n   */\n  self.showBackButton = function(shouldShow) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    if (associatedNavBarCtrl) {\n      if (arguments.length) {\n        return associatedNavBarCtrl.showActiveBackButton(shouldShow);\n      }\n      return associatedNavBarCtrl.showActiveBackButton();\n    }\n    return true;\n  };\n\n\n  self.showBar = function(val) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    if (associatedNavBarCtrl) {\n      if (arguments.length) {\n        return associatedNavBarCtrl.showBar(val);\n      }\n      return associatedNavBarCtrl.showBar();\n    }\n    return true;\n  };\n\n\n  self.isPrimary = function(val) {\n    if (arguments.length) {\n      isPrimary = val;\n    }\n    return isPrimary;\n  };\n\n\n  self.direction = function(val) {\n    if (arguments.length) {\n      direction = val;\n    }\n    return direction;\n  };\n\n\n  self.initSwipeBack = function() {\n    var swipeBackHitWidth = $ionicConfig.views.swipeBackHitWidth();\n    var viewTransition, associatedNavBarCtrl, backView;\n    var deregDragStart, deregDrag, deregRelease;\n    var windowWidth, startDragX, dragPoints;\n    var cancelData = {};\n\n    function onDragStart(ev) {\n      if (!isPrimary || !$ionicConfig.views.swipeBackEnabled() || $ionicSideMenuDelegate.isOpenRight() ) return;\n\n\n      startDragX = getDragX(ev);\n      if (startDragX > swipeBackHitWidth) return;\n\n      backView = $ionicHistory.backView();\n\n      var currentView = $ionicHistory.currentView();\n\n      if (!backView || backView.historyId !== currentView.historyId || currentView.canSwipeBack === false) return;\n\n      if (!windowWidth) windowWidth = window.innerWidth;\n\n      self.isSwipeFreeze = $ionicScrollDelegate.freezeAllScrolls(true);\n\n      var registerData = {\n        direction: 'back'\n      };\n\n      dragPoints = [];\n\n      cancelData = {\n        showBar: self.showBar(),\n        showBackButton: self.showBackButton()\n      };\n\n      var switcher = $ionicViewSwitcher.create(self, registerData, backView, currentView, true, false);\n      switcher.loadViewElements(registerData);\n      switcher.render(registerData);\n\n      viewTransition = switcher.transition('back', $ionicHistory.enabledBack(backView), true);\n\n      associatedNavBarCtrl = getAssociatedNavBarCtrl();\n\n      deregDrag = ionic.onGesture('drag', onDrag, $element[0]);\n      deregRelease = ionic.onGesture('release', onRelease, $element[0]);\n    }\n\n    function onDrag(ev) {\n      if (isPrimary && viewTransition) {\n        var dragX = getDragX(ev);\n\n        dragPoints.push({\n          t: Date.now(),\n          x: dragX\n        });\n\n        if (dragX >= windowWidth - 15) {\n          onRelease(ev);\n\n        } else {\n          var step = Math.min(Math.max(getSwipeCompletion(dragX), 0), 1);\n          viewTransition.run(step);\n          associatedNavBarCtrl && associatedNavBarCtrl.activeTransition && associatedNavBarCtrl.activeTransition.run(step);\n        }\n\n      }\n    }\n\n    function onRelease(ev) {\n      if (isPrimary && viewTransition && dragPoints && dragPoints.length > 1) {\n\n        var now = Date.now();\n        var releaseX = getDragX(ev);\n        var startDrag = dragPoints[dragPoints.length - 1];\n\n        for (var x = dragPoints.length - 2; x >= 0; x--) {\n          if (now - startDrag.t > 200) {\n            break;\n          }\n          startDrag = dragPoints[x];\n        }\n\n        var isSwipingRight = (releaseX >= dragPoints[dragPoints.length - 2].x);\n        var releaseSwipeCompletion = getSwipeCompletion(releaseX);\n        var velocity = Math.abs(startDrag.x - releaseX) / (now - startDrag.t);\n\n        // private variables because ui-router has no way to pass custom data using $state.go\n        disableRenderStartViewId = backView.viewId;\n        disableAnimation = (releaseSwipeCompletion < 0.03 || releaseSwipeCompletion > 0.97);\n\n        if (isSwipingRight && (releaseSwipeCompletion > 0.5 || velocity > 0.1)) {\n          // complete view transition on release\n          var speed = (velocity > 0.5 || velocity < 0.05 || releaseX > windowWidth - 45) ? 'fast' : 'slow';\n          navSwipeAttr(disableAnimation ? '' : speed);\n          backView.go();\n          associatedNavBarCtrl && associatedNavBarCtrl.activeTransition && associatedNavBarCtrl.activeTransition.complete(!disableAnimation, speed);\n\n        } else {\n          // cancel view transition on release\n          navSwipeAttr(disableAnimation ? '' : 'fast');\n          disableRenderStartViewId = null;\n          viewTransition.cancel(!disableAnimation);\n          associatedNavBarCtrl && associatedNavBarCtrl.activeTransition && associatedNavBarCtrl.activeTransition.cancel(!disableAnimation, 'fast', cancelData);\n          disableAnimation = null;\n        }\n\n      }\n\n      ionic.offGesture(deregDrag, 'drag', onDrag);\n      ionic.offGesture(deregRelease, 'release', onRelease);\n\n      windowWidth = viewTransition = dragPoints = null;\n\n      self.isSwipeFreeze = $ionicScrollDelegate.freezeAllScrolls(false);\n    }\n\n    function getDragX(ev) {\n      return ionic.tap.pointerCoord(ev.gesture.srcEvent).x;\n    }\n\n    function getSwipeCompletion(dragX) {\n      return (dragX - startDragX) / windowWidth;\n    }\n\n    deregDragStart = ionic.onGesture('dragstart', onDragStart, $element[0]);\n\n    $scope.$on('$destroy', function() {\n      ionic.offGesture(deregDragStart, 'dragstart', onDragStart);\n      ionic.offGesture(deregDrag, 'drag', onDrag);\n      ionic.offGesture(deregRelease, 'release', onRelease);\n      self.element = viewTransition = associatedNavBarCtrl = null;\n    });\n  };\n\n\n  function navSwipeAttr(val) {\n    ionic.DomUtil.cachedAttr($element, 'nav-swipe', val);\n  }\n\n\n  function onTabsTop(ev, isTabsTop) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.hasTabsTop(isTabsTop);\n  }\n\n  function onBarSubheader(ev, isBarSubheader) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.hasBarSubheader(isBarSubheader);\n  }\n\n  function getAssociatedNavBarCtrl() {\n    if (navBarDelegate) {\n      for (var x = 0; x < $ionicNavBarDelegate._instances.length; x++) {\n        if ($ionicNavBarDelegate._instances[x].$$delegateHandle == navBarDelegate) {\n          return $ionicNavBarDelegate._instances[x];\n        }\n      }\n    }\n    return $element.inheritedData('$ionNavBarController');\n  }\n\n}]);\n\nIonicModule\n.controller('$ionicRefresher', [\n  '$scope',\n  '$attrs',\n  '$element',\n  '$ionicBind',\n  '$timeout',\n  function($scope, $attrs, $element, $ionicBind, $timeout) {\n    var self = this,\n        isDragging = false,\n        isOverscrolling = false,\n        dragOffset = 0,\n        lastOverscroll = 0,\n        ptrThreshold = 60,\n        activated = false,\n        scrollTime = 500,\n        startY = null,\n        deltaY = null,\n        canOverscroll = true,\n        scrollParent,\n        scrollChild;\n\n    if (!isDefined($attrs.pullingIcon)) {\n      $attrs.$set('pullingIcon', 'ion-android-arrow-down');\n    }\n\n    $scope.showSpinner = !isDefined($attrs.refreshingIcon) && $attrs.spinner != 'none';\n\n    $scope.showIcon = isDefined($attrs.refreshingIcon);\n\n    $ionicBind($scope, $attrs, {\n      pullingIcon: '@',\n      pullingText: '@',\n      refreshingIcon: '@',\n      refreshingText: '@',\n      spinner: '@',\n      disablePullingRotation: '@',\n      $onRefresh: '&onRefresh',\n      $onPulling: '&onPulling'\n    });\n\n    function handleMousedown(e) {\n      e.touches = e.touches || [{\n        screenX: e.screenX,\n        screenY: e.screenY\n      }];\n      // Mouse needs this\n      startY = Math.floor(e.touches[0].screenY);\n    }\n\n    function handleTouchstart(e) {\n      e.touches = e.touches || [{\n        screenX: e.screenX,\n        screenY: e.screenY\n      }];\n\n      startY = e.touches[0].screenY;\n    }\n\n    function handleTouchend() {\n      // reset Y\n      startY = null;\n      // if this wasn't an overscroll, get out immediately\n      if (!canOverscroll && !isDragging) {\n        return;\n      }\n      // the user has overscrolled but went back to native scrolling\n      if (!isDragging) {\n        dragOffset = 0;\n        isOverscrolling = false;\n        setScrollLock(false);\n      } else {\n        isDragging = false;\n        dragOffset = 0;\n\n        // the user has scroll far enough to trigger a refresh\n        if (lastOverscroll > ptrThreshold) {\n          start();\n          scrollTo(ptrThreshold, scrollTime);\n\n        // the user has overscrolled but not far enough to trigger a refresh\n        } else {\n          scrollTo(0, scrollTime, deactivate);\n          isOverscrolling = false;\n        }\n      }\n    }\n\n    function handleTouchmove(e) {\n      e.touches = e.touches || [{\n        screenX: e.screenX,\n        screenY: e.screenY\n      }];\n\n      // Force mouse events to have had a down event first\n      if (!startY && e.type == 'mousemove') {\n        return;\n      }\n\n      // if multitouch or regular scroll event, get out immediately\n      if (!canOverscroll || e.touches.length > 1) {\n        return;\n      }\n      //if this is a new drag, keep track of where we start\n      if (startY === null) {\n        startY = e.touches[0].screenY;\n      }\n\n      deltaY = e.touches[0].screenY - startY;\n\n      // how far have we dragged so far?\n      // kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch\n      // Only do this if we're not on crosswalk\n      if (ionic.Platform.isAndroid() && ionic.Platform.version() === 4.4 && !ionic.Platform.isCrosswalk() && scrollParent.scrollTop === 0 && deltaY > 0) {\n        isDragging = true;\n        e.preventDefault();\n      }\n\n\n      // if we've dragged up and back down in to native scroll territory\n      if (deltaY - dragOffset <= 0 || scrollParent.scrollTop !== 0) {\n\n        if (isOverscrolling) {\n          isOverscrolling = false;\n          setScrollLock(false);\n        }\n\n        if (isDragging) {\n          nativescroll(scrollParent, deltaY - dragOffset * -1);\n        }\n\n        // if we're not at overscroll 0 yet, 0 out\n        if (lastOverscroll !== 0) {\n          overscroll(0);\n        }\n        return;\n\n      } else if (deltaY > 0 && scrollParent.scrollTop === 0 && !isOverscrolling) {\n        // starting overscroll, but drag started below scrollTop 0, so we need to offset the position\n        dragOffset = deltaY;\n      }\n\n      // prevent native scroll events while overscrolling\n      e.preventDefault();\n\n      // if not overscrolling yet, initiate overscrolling\n      if (!isOverscrolling) {\n        isOverscrolling = true;\n        setScrollLock(true);\n      }\n\n      isDragging = true;\n      // overscroll according to the user's drag so far\n      overscroll((deltaY - dragOffset) / 3);\n\n      // update the icon accordingly\n      if (!activated && lastOverscroll > ptrThreshold) {\n        activated = true;\n        ionic.requestAnimationFrame(activate);\n\n      } else if (activated && lastOverscroll < ptrThreshold) {\n        activated = false;\n        ionic.requestAnimationFrame(deactivate);\n      }\n    }\n\n    function handleScroll(e) {\n      // canOverscrol is used to greatly simplify the drag handler during normal scrolling\n      canOverscroll = (e.target.scrollTop === 0) || isDragging;\n    }\n\n    function overscroll(val) {\n      scrollChild.style[ionic.CSS.TRANSFORM] = 'translate3d(0px, ' + val + 'px, 0px)';\n      lastOverscroll = val;\n    }\n\n    function nativescroll(target, newScrollTop) {\n      // creates a scroll event that bubbles, can be cancelled, and with its view\n      // and detail property initialized to window and 1, respectively\n      target.scrollTop = newScrollTop;\n      var e = document.createEvent(\"UIEvents\");\n      e.initUIEvent(\"scroll\", true, true, window, 1);\n      target.dispatchEvent(e);\n    }\n\n    function setScrollLock(enabled) {\n      // set the scrollbar to be position:fixed in preparation to overscroll\n      // or remove it so the app can be natively scrolled\n      if (enabled) {\n        ionic.requestAnimationFrame(function() {\n          scrollChild.classList.add('overscroll');\n          show();\n        });\n\n      } else {\n        ionic.requestAnimationFrame(function() {\n          scrollChild.classList.remove('overscroll');\n          hide();\n          deactivate();\n        });\n      }\n    }\n\n    $scope.$on('scroll.refreshComplete', function() {\n      // prevent the complete from firing before the scroll has started\n      $timeout(function() {\n\n        ionic.requestAnimationFrame(tail);\n\n        // scroll back to home during tail animation\n        scrollTo(0, scrollTime, deactivate);\n\n        // return to native scrolling after tail animation has time to finish\n        $timeout(function() {\n\n          if (isOverscrolling) {\n            isOverscrolling = false;\n            setScrollLock(false);\n          }\n\n        }, scrollTime);\n\n      }, scrollTime);\n    });\n\n    function scrollTo(Y, duration, callback) {\n      // scroll animation loop w/ easing\n      // credit https://gist.github.com/dezinezync/5487119\n      var start = Date.now(),\n          from = lastOverscroll;\n\n      if (from === Y) {\n        callback();\n        return; /* Prevent scrolling to the Y point if already there */\n      }\n\n      // decelerating to zero velocity\n      function easeOutCubic(t) {\n        return (--t) * t * t + 1;\n      }\n\n      // scroll loop\n      function scroll() {\n        var currentTime = Date.now(),\n          time = Math.min(1, ((currentTime - start) / duration)),\n          // where .5 would be 50% of time on a linear scale easedT gives a\n          // fraction based on the easing method\n          easedT = easeOutCubic(time);\n\n        overscroll(Math.floor((easedT * (Y - from)) + from));\n\n        if (time < 1) {\n          ionic.requestAnimationFrame(scroll);\n\n        } else {\n\n          if (Y < 5 && Y > -5) {\n            isOverscrolling = false;\n            setScrollLock(false);\n          }\n\n          callback && callback();\n        }\n      }\n\n      // start scroll loop\n      ionic.requestAnimationFrame(scroll);\n    }\n\n\n    var touchStartEvent, touchMoveEvent, touchEndEvent;\n    if (window.navigator.pointerEnabled) {\n      touchStartEvent = 'pointerdown';\n      touchMoveEvent = 'pointermove';\n      touchEndEvent = 'pointerup';\n    } else if (window.navigator.msPointerEnabled) {\n      touchStartEvent = 'MSPointerDown';\n      touchMoveEvent = 'MSPointerMove';\n      touchEndEvent = 'MSPointerUp';\n    } else {\n      touchStartEvent = 'touchstart';\n      touchMoveEvent = 'touchmove';\n      touchEndEvent = 'touchend';\n    }\n\n    self.init = function() {\n      scrollParent = $element.parent().parent()[0];\n      scrollChild = $element.parent()[0];\n\n      if (!scrollParent || !scrollParent.classList.contains('ionic-scroll') ||\n        !scrollChild || !scrollChild.classList.contains('scroll')) {\n        throw new Error('Refresher must be immediate child of ion-content or ion-scroll');\n      }\n\n\n      ionic.on(touchStartEvent, handleTouchstart, scrollChild);\n      ionic.on(touchMoveEvent, handleTouchmove, scrollChild);\n      ionic.on(touchEndEvent, handleTouchend, scrollChild);\n      ionic.on('mousedown', handleMousedown, scrollChild);\n      ionic.on('mousemove', handleTouchmove, scrollChild);\n      ionic.on('mouseup', handleTouchend, scrollChild);\n      ionic.on('scroll', handleScroll, scrollParent);\n\n      // cleanup when done\n      $scope.$on('$destroy', destroy);\n    };\n\n    function destroy() {\n      if ( scrollChild ) {\n        ionic.off(touchStartEvent, handleTouchstart, scrollChild);\n        ionic.off(touchMoveEvent, handleTouchmove, scrollChild);\n        ionic.off(touchEndEvent, handleTouchend, scrollChild);\n        ionic.off('mousedown', handleMousedown, scrollChild);\n        ionic.off('mousemove', handleTouchmove, scrollChild);\n        ionic.off('mouseup', handleTouchend, scrollChild);\n      }\n      if ( scrollParent ) {\n        ionic.off('scroll', handleScroll, scrollParent);\n      }\n      scrollParent = null;\n      scrollChild = null;\n    }\n\n    // DOM manipulation and broadcast methods shared by JS and Native Scrolling\n    // getter used by JS Scrolling\n    self.getRefresherDomMethods = function() {\n      return {\n        activate: activate,\n        deactivate: deactivate,\n        start: start,\n        show: show,\n        hide: hide,\n        tail: tail\n      };\n    };\n\n    function activate() {\n      $element[0].classList.add('active');\n      $scope.$onPulling();\n    }\n\n    function deactivate() {\n      // give tail 150ms to finish\n      $timeout(function() {\n        // deactivateCallback\n        $element.removeClass('active refreshing refreshing-tail');\n        if (activated) activated = false;\n      }, 150);\n    }\n\n    function start() {\n      // startCallback\n      $element[0].classList.add('refreshing');\n      var q = $scope.$onRefresh();\n\n      if (q && q.then) {\n        q['finally'](function() {\n          $scope.$broadcast('scroll.refreshComplete');\n        });\n      }\n    }\n\n    function show() {\n      // showCallback\n      $element[0].classList.remove('invisible');\n    }\n\n    function hide() {\n      // showCallback\n      $element[0].classList.add('invisible');\n    }\n\n    function tail() {\n      // tailCallback\n      $element[0].classList.add('refreshing-tail');\n    }\n\n    // for testing\n    self.__handleTouchmove = handleTouchmove;\n    self.__getScrollChild = function() { return scrollChild; };\n    self.__getScrollParent = function() { return scrollParent; };\n  }\n]);\n\n/**\n * @private\n */\nIonicModule\n\n.controller('$ionicScroll', [\n  '$scope',\n  'scrollViewOptions',\n  '$timeout',\n  '$window',\n  '$location',\n  '$document',\n  '$ionicScrollDelegate',\n  '$ionicHistory',\nfunction($scope,\n         scrollViewOptions,\n         $timeout,\n         $window,\n         $location,\n         $document,\n         $ionicScrollDelegate,\n         $ionicHistory) {\n\n  var self = this;\n  // for testing\n  self.__timeout = $timeout;\n\n  self._scrollViewOptions = scrollViewOptions; //for testing\n  self.isNative = function() {\n    return !!scrollViewOptions.nativeScrolling;\n  };\n\n  var element = self.element = scrollViewOptions.el;\n  var $element = self.$element = jqLite(element);\n  var scrollView;\n  if (self.isNative()) {\n    scrollView = self.scrollView = new ionic.views.ScrollNative(scrollViewOptions);\n  } else {\n    scrollView = self.scrollView = new ionic.views.Scroll(scrollViewOptions);\n  }\n\n\n  //Attach self to element as a controller so other directives can require this controller\n  //through `require: '$ionicScroll'\n  //Also attach to parent so that sibling elements can require this\n  ($element.parent().length ? $element.parent() : $element)\n    .data('$$ionicScrollController', self);\n\n  var deregisterInstance = $ionicScrollDelegate._registerInstance(\n    self, scrollViewOptions.delegateHandle, function() {\n      return $ionicHistory.isActiveScope($scope);\n    }\n  );\n\n  if (!isDefined(scrollViewOptions.bouncing)) {\n    ionic.Platform.ready(function() {\n      if (scrollView && scrollView.options) {\n        scrollView.options.bouncing = true;\n        if (ionic.Platform.isAndroid()) {\n          // No bouncing by default on Android\n          scrollView.options.bouncing = false;\n          // Faster scroll decel\n          scrollView.options.deceleration = 0.95;\n        }\n      }\n    });\n  }\n\n  var resize = angular.bind(scrollView, scrollView.resize);\n  angular.element($window).on('resize', resize);\n\n  var scrollFunc = function(e) {\n    var detail = (e.originalEvent || e).detail || {};\n    $scope.$onScroll && $scope.$onScroll({\n      event: e,\n      scrollTop: detail.scrollTop || 0,\n      scrollLeft: detail.scrollLeft || 0\n    });\n  };\n\n  $element.on('scroll', scrollFunc);\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    scrollView && scrollView.__cleanup && scrollView.__cleanup();\n    angular.element($window).off('resize', resize);\n    if ( $element ) {\n      $element.off('scroll', scrollFunc);\n    }\n    if ( self._scrollViewOptions ) {\n      self._scrollViewOptions.el = null;\n    }\n    if ( scrollViewOptions ) {\n        scrollViewOptions.el = null;\n    }\n\n    scrollView = self.scrollView = scrollViewOptions = self._scrollViewOptions = element = self.$element = $element = null;\n  });\n\n  $timeout(function() {\n    scrollView && scrollView.run && scrollView.run();\n  });\n\n  self.getScrollView = function() {\n    return scrollView;\n  };\n\n  self.getScrollPosition = function() {\n    return scrollView.getValues();\n  };\n\n  self.resize = function() {\n    return $timeout(resize, 0, false).then(function() {\n      $element && $element.triggerHandler('scroll-resize');\n    });\n  };\n\n  self.scrollTop = function(shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.scrollTo(0, 0, !!shouldAnimate);\n    });\n  };\n\n  self.scrollBottom = function(shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      var max = scrollView.getScrollMax();\n      scrollView.scrollTo(max.left, max.top, !!shouldAnimate);\n    });\n  };\n\n  self.scrollTo = function(left, top, shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.scrollTo(left, top, !!shouldAnimate);\n    });\n  };\n\n  self.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  self.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  self.scrollBy = function(left, top, shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.scrollBy(left, top, !!shouldAnimate);\n    });\n  };\n\n  self.anchorScroll = function(shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      var hash = $location.hash();\n      var elm = hash && $document[0].getElementById(hash);\n      if (!(hash && elm)) {\n        scrollView.scrollTo(0, 0, !!shouldAnimate);\n        return;\n      }\n      var curElm = elm;\n      var scrollLeft = 0, scrollTop = 0;\n      do {\n        if (curElm !== null) scrollLeft += curElm.offsetLeft;\n        if (curElm !== null) scrollTop += curElm.offsetTop;\n        curElm = curElm.offsetParent;\n      } while (curElm.attributes != self.element.attributes && curElm.offsetParent);\n      scrollView.scrollTo(scrollLeft, scrollTop, !!shouldAnimate);\n    });\n  };\n\n  self.freezeScroll = scrollView.freeze;\n  self.freezeScrollShut = scrollView.freezeShut;\n\n  self.freezeAllScrolls = function(shouldFreeze) {\n    for (var i = 0; i < $ionicScrollDelegate._instances.length; i++) {\n      $ionicScrollDelegate._instances[i].freezeScroll(shouldFreeze);\n    }\n  };\n\n\n  /**\n   * @private\n   */\n  self._setRefresher = function(refresherScope, refresherElement, refresherMethods) {\n    self.refresher = refresherElement;\n    var refresherHeight = self.refresher.clientHeight || 60;\n    scrollView.activatePullToRefresh(\n      refresherHeight,\n      refresherMethods\n    );\n  };\n\n}]);\n\nIonicModule\n.controller('$ionicSideMenus', [\n  '$scope',\n  '$attrs',\n  '$ionicSideMenuDelegate',\n  '$ionicPlatform',\n  '$ionicBody',\n  '$ionicHistory',\n  '$ionicScrollDelegate',\n  'IONIC_BACK_PRIORITY',\n  '$rootScope',\nfunction($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory, $ionicScrollDelegate, IONIC_BACK_PRIORITY, $rootScope) {\n  var self = this;\n  var rightShowing, leftShowing, isDragging;\n  var startX, lastX, offsetX, isAsideExposed;\n  var enableMenuWithBackViews = true;\n\n  self.$scope = $scope;\n\n  self.initialize = function(options) {\n    self.left = options.left;\n    self.right = options.right;\n    self.setContent(options.content);\n    self.dragThresholdX = options.dragThresholdX || 10;\n    $ionicHistory.registerHistory(self.$scope);\n  };\n\n  /**\n   * Set the content view controller if not passed in the constructor options.\n   *\n   * @param {object} content\n   */\n  self.setContent = function(content) {\n    if (content) {\n      self.content = content;\n\n      self.content.onDrag = function(e) {\n        self._handleDrag(e);\n      };\n\n      self.content.endDrag = function(e) {\n        self._endDrag(e);\n      };\n    }\n  };\n\n  self.isOpenLeft = function() {\n    return self.getOpenAmount() > 0;\n  };\n\n  self.isOpenRight = function() {\n    return self.getOpenAmount() < 0;\n  };\n\n  /**\n   * Toggle the left menu to open 100%\n   */\n  self.toggleLeft = function(shouldOpen) {\n    if (isAsideExposed || !self.left.isEnabled) return;\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount <= 0;\n    }\n    self.content.enableAnimation();\n    if (!shouldOpen) {\n      self.openPercentage(0);\n      $rootScope.$emit('$ionicSideMenuClose', 'left');\n    } else {\n      self.openPercentage(100);\n      $rootScope.$emit('$ionicSideMenuOpen', 'left');\n    }\n  };\n\n  /**\n   * Toggle the right menu to open 100%\n   */\n  self.toggleRight = function(shouldOpen) {\n    if (isAsideExposed || !self.right.isEnabled) return;\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount >= 0;\n    }\n    self.content.enableAnimation();\n    if (!shouldOpen) {\n      self.openPercentage(0);\n      $rootScope.$emit('$ionicSideMenuClose', 'right');\n    } else {\n      self.openPercentage(-100);\n      $rootScope.$emit('$ionicSideMenuOpen', 'right');\n    }\n  };\n\n  self.toggle = function(side) {\n    if (side == 'right') {\n      self.toggleRight();\n    } else {\n      self.toggleLeft();\n    }\n  };\n\n  /**\n   * Close all menus.\n   */\n  self.close = function() {\n    self.openPercentage(0);\n    $rootScope.$emit('$ionicSideMenuClose', 'left');\n    $rootScope.$emit('$ionicSideMenuClose', 'right');\n  };\n\n  /**\n   * @return {float} The amount the side menu is open, either positive or negative for left (positive), or right (negative)\n   */\n  self.getOpenAmount = function() {\n    return self.content && self.content.getTranslateX() || 0;\n  };\n\n  /**\n   * @return {float} The ratio of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50% or a ratio of 0.5. Value is negative\n   * for right menu.\n   */\n  self.getOpenRatio = function() {\n    var amount = self.getOpenAmount();\n    if (amount >= 0) {\n      return amount / self.left.width;\n    }\n    return amount / self.right.width;\n  };\n\n  self.isOpen = function() {\n    return self.getOpenAmount() !== 0;\n  };\n\n  /**\n   * @return {float} The percentage of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50%. Value is negative\n   * for right menu.\n   */\n  self.getOpenPercentage = function() {\n    return self.getOpenRatio() * 100;\n  };\n\n  /**\n   * Open the menu with a given percentage amount.\n   * @param {float} percentage The percentage (positive or negative for left/right) to open the menu.\n   */\n  self.openPercentage = function(percentage) {\n    var p = percentage / 100;\n\n    if (self.left && percentage >= 0) {\n      self.openAmount(self.left.width * p);\n    } else if (self.right && percentage < 0) {\n      self.openAmount(self.right.width * p);\n    }\n\n    // add the CSS class \"menu-open\" if the percentage does not\n    // equal 0, otherwise remove the class from the body element\n    $ionicBody.enableClass((percentage !== 0), 'menu-open');\n\n    self.content.setCanScroll(percentage == 0);\n  };\n\n  /*\n  function freezeAllScrolls(shouldFreeze) {\n    if (shouldFreeze && !self.isScrollFreeze) {\n      $ionicScrollDelegate.freezeAllScrolls(shouldFreeze);\n\n    } else if (!shouldFreeze && self.isScrollFreeze) {\n      $ionicScrollDelegate.freezeAllScrolls(false);\n    }\n    self.isScrollFreeze = shouldFreeze;\n  }\n  */\n\n  /**\n   * Open the menu the given pixel amount.\n   * @param {float} amount the pixel amount to open the menu. Positive value for left menu,\n   * negative value for right menu (only one menu will be visible at a time).\n   */\n  self.openAmount = function(amount) {\n    var maxLeft = self.left && self.left.width || 0;\n    var maxRight = self.right && self.right.width || 0;\n\n    // Check if we can move to that side, depending if the left/right panel is enabled\n    if (!(self.left && self.left.isEnabled) && amount > 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if (!(self.right && self.right.isEnabled) && amount < 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if (leftShowing && amount > maxLeft) {\n      self.content.setTranslateX(maxLeft);\n      return;\n    }\n\n    if (rightShowing && amount < -maxRight) {\n      self.content.setTranslateX(-maxRight);\n      return;\n    }\n\n    self.content.setTranslateX(amount);\n\n    if (amount >= 0) {\n      leftShowing = true;\n      rightShowing = false;\n\n      if (amount > 0) {\n        // Push the z-index of the right menu down\n        self.right && self.right.pushDown && self.right.pushDown();\n        // Bring the z-index of the left menu up\n        self.left && self.left.bringUp && self.left.bringUp();\n      }\n    } else {\n      rightShowing = true;\n      leftShowing = false;\n\n      // Bring the z-index of the right menu up\n      self.right && self.right.bringUp && self.right.bringUp();\n      // Push the z-index of the left menu down\n      self.left && self.left.pushDown && self.left.pushDown();\n    }\n  };\n\n  /**\n   * Given an event object, find the final resting position of this side\n   * menu. For example, if the user \"throws\" the content to the right and\n   * releases the touch, the left menu should snap open (animated, of course).\n   *\n   * @param {Event} e the gesture event to use for snapping\n   */\n  self.snapToRest = function(e) {\n    // We want to animate at the end of this\n    self.content.enableAnimation();\n    isDragging = false;\n\n    // Check how much the panel is open after the drag, and\n    // what the drag velocity is\n    var ratio = self.getOpenRatio();\n\n    if (ratio === 0) {\n      // Just to be safe\n      self.openPercentage(0);\n      return;\n    }\n\n    var velocityThreshold = 0.3;\n    var velocityX = e.gesture.velocityX;\n    var direction = e.gesture.direction;\n\n    // Going right, less than half, too slow (snap back)\n    if (ratio > 0 && ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going left, more than half, too slow (snap back)\n    else if (ratio > 0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(100);\n    }\n\n    // Going left, less than half, too slow (snap back)\n    else if (ratio < 0 && ratio > -0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going right, more than half, too slow (snap back)\n    else if (ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(-100);\n    }\n\n    // Going right, more than half, or quickly (snap open)\n    else if (direction == 'right' && ratio >= 0 && (ratio >= 0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(100);\n    }\n\n    // Going left, more than half, or quickly (span open)\n    else if (direction == 'left' && ratio <= 0 && (ratio <= -0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(-100);\n    }\n\n    // Snap back for safety\n    else {\n      self.openPercentage(0);\n    }\n  };\n\n  self.enableMenuWithBackViews = function(val) {\n    if (arguments.length) {\n      enableMenuWithBackViews = !!val;\n    }\n    return enableMenuWithBackViews;\n  };\n\n  self.isAsideExposed = function() {\n    return !!isAsideExposed;\n  };\n\n  self.exposeAside = function(shouldExposeAside) {\n    if (!(self.left && self.left.isEnabled) && !(self.right && self.right.isEnabled)) return;\n    self.close();\n\n    isAsideExposed = shouldExposeAside;\n    if ((self.left && self.left.isEnabled) && (self.right && self.right.isEnabled)) {\n      self.content.setMarginLeftAndRight(isAsideExposed ? self.left.width : 0, isAsideExposed ? self.right.width : 0);\n    } else if (self.left && self.left.isEnabled) {\n      // set the left marget width if it should be exposed\n      // otherwise set false so there's no left margin\n      self.content.setMarginLeft(isAsideExposed ? self.left.width : 0);\n    } else if (self.right && self.right.isEnabled) {\n      self.content.setMarginRight(isAsideExposed ? self.right.width : 0);\n    }\n    self.$scope.$emit('$ionicExposeAside', isAsideExposed);\n  };\n\n  self.activeAsideResizing = function(isResizing) {\n    $ionicBody.enableClass(isResizing, 'aside-resizing');\n  };\n\n  // End a drag with the given event\n  self._endDrag = function(e) {\n    if (isAsideExposed) return;\n\n    if (isDragging) {\n      self.snapToRest(e);\n    }\n    startX = null;\n    lastX = null;\n    offsetX = null;\n  };\n\n  // Handle a drag event\n  self._handleDrag = function(e) {\n    if (isAsideExposed || !$scope.dragContent) return;\n\n    // If we don't have start coords, grab and store them\n    if (!startX) {\n      startX = e.gesture.touches[0].pageX;\n      lastX = startX;\n    } else {\n      // Grab the current tap coords\n      lastX = e.gesture.touches[0].pageX;\n    }\n\n    // Calculate difference from the tap points\n    if (!isDragging && Math.abs(lastX - startX) > self.dragThresholdX) {\n      // if the difference is greater than threshold, start dragging using the current\n      // point as the starting point\n      startX = lastX;\n\n      isDragging = true;\n      // Initialize dragging\n      self.content.disableAnimation();\n      offsetX = self.getOpenAmount();\n    }\n\n    if (isDragging) {\n      self.openAmount(offsetX + (lastX - startX));\n      //self.content.setCanScroll(false);\n    }\n  };\n\n  self.canDragContent = function(canDrag) {\n    if (arguments.length) {\n      $scope.dragContent = !!canDrag;\n    }\n    return $scope.dragContent;\n  };\n\n  self.edgeThreshold = 25;\n  self.edgeThresholdEnabled = false;\n  self.edgeDragThreshold = function(value) {\n    if (arguments.length) {\n      if (isNumber(value) && value > 0) {\n        self.edgeThreshold = value;\n        self.edgeThresholdEnabled = true;\n      } else {\n        self.edgeThresholdEnabled = !!value;\n      }\n    }\n    return self.edgeThresholdEnabled;\n  };\n\n  self.isDraggableTarget = function(e) {\n    //Only restrict edge when sidemenu is closed and restriction is enabled\n    var shouldOnlyAllowEdgeDrag = self.edgeThresholdEnabled && !self.isOpen();\n    var startX = e.gesture.startEvent && e.gesture.startEvent.center &&\n      e.gesture.startEvent.center.pageX;\n\n    var dragIsWithinBounds = !shouldOnlyAllowEdgeDrag ||\n      startX <= self.edgeThreshold ||\n      startX >= self.content.element.offsetWidth - self.edgeThreshold;\n\n    var backView = $ionicHistory.backView();\n    var menuEnabled = enableMenuWithBackViews ? true : !backView;\n    if (!menuEnabled) {\n      var currentView = $ionicHistory.currentView() || {};\n      return (dragIsWithinBounds && (backView.historyId !== currentView.historyId));\n    }\n\n    return ($scope.dragContent || self.isOpen()) &&\n      dragIsWithinBounds &&\n      !e.gesture.srcEvent.defaultPrevented &&\n      menuEnabled &&\n      !e.target.tagName.match(/input|textarea|select|object|embed/i) &&\n      !e.target.isContentEditable &&\n      !(e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll') == 'true');\n  };\n\n  $scope.sideMenuContentTranslateX = 0;\n\n  var deregisterBackButtonAction = noop;\n  var closeSideMenu = angular.bind(self, self.close);\n\n  $scope.$watch(function() {\n    return self.getOpenAmount() !== 0;\n  }, function(isOpen) {\n    deregisterBackButtonAction();\n    if (isOpen) {\n      deregisterBackButtonAction = $ionicPlatform.registerBackButtonAction(\n        closeSideMenu,\n        IONIC_BACK_PRIORITY.sideMenu\n      );\n    }\n  });\n\n  var deregisterInstance = $ionicSideMenuDelegate._registerInstance(\n    self, $attrs.delegateHandle, function() {\n      return $ionicHistory.isActiveScope($scope);\n    }\n  );\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    deregisterBackButtonAction();\n    self.$scope = null;\n    if (self.content) {\n      self.content.setCanScroll(true);\n      self.content.element = null;\n      self.content = null;\n    }\n  });\n\n  self.initialize({\n    left: {\n      width: 275\n    },\n    right: {\n      width: 275\n    }\n  });\n\n}]);\n\n(function(ionic) {\n\n  var TRANSLATE32 = 'translate(32,32)';\n  var STROKE_OPACITY = 'stroke-opacity';\n  var ROUND = 'round';\n  var INDEFINITE = 'indefinite';\n  var DURATION = '750ms';\n  var NONE = 'none';\n  var SHORTCUTS = {\n    a: 'animate',\n    an: 'attributeName',\n    at: 'animateTransform',\n    c: 'circle',\n    da: 'stroke-dasharray',\n    os: 'stroke-dashoffset',\n    f: 'fill',\n    lc: 'stroke-linecap',\n    rc: 'repeatCount',\n    sw: 'stroke-width',\n    t: 'transform',\n    v: 'values'\n  };\n\n  var SPIN_ANIMATION = {\n    v: '0,32,32;360,32,32',\n    an: 'transform',\n    type: 'rotate',\n    rc: INDEFINITE,\n    dur: DURATION\n  };\n\n  function createSvgElement(tagName, data, parent, spinnerName) {\n    var ele = document.createElement(SHORTCUTS[tagName] || tagName);\n    var k, x, y;\n\n    for (k in data) {\n\n      if (angular.isArray(data[k])) {\n        for (x = 0; x < data[k].length; x++) {\n          if (data[k][x].fn) {\n            for (y = 0; y < data[k][x].t; y++) {\n              createSvgElement(k, data[k][x].fn(y, spinnerName), ele, spinnerName);\n            }\n          } else {\n            createSvgElement(k, data[k][x], ele, spinnerName);\n          }\n        }\n\n      } else {\n        setSvgAttribute(ele, k, data[k]);\n      }\n    }\n\n    parent.appendChild(ele);\n  }\n\n  function setSvgAttribute(ele, k, v) {\n    ele.setAttribute(SHORTCUTS[k] || k, v);\n  }\n\n  function animationValues(strValues, i) {\n    var values = strValues.split(';');\n    var back = values.slice(i);\n    var front = values.slice(0, values.length - back.length);\n    values = back.concat(front).reverse();\n    return values.join(';') + ';' + values[0];\n  }\n\n  var IOS_SPINNER = {\n    sw: 4,\n    lc: ROUND,\n    line: [{\n      fn: function(i, spinnerName) {\n        return {\n          y1: spinnerName == 'ios' ? 17 : 12,\n          y2: spinnerName == 'ios' ? 29 : 20,\n          t: TRANSLATE32 + ' rotate(' + (30 * i + (i < 6 ? 180 : -180)) + ')',\n          a: [{\n            fn: function() {\n              return {\n                an: STROKE_OPACITY,\n                dur: DURATION,\n                v: animationValues('0;.1;.15;.25;.35;.45;.55;.65;.7;.85;1', i),\n                rc: INDEFINITE\n              };\n            },\n            t: 1\n          }]\n        };\n      },\n      t: 12\n    }]\n  };\n\n  var spinners = {\n\n    android: {\n      c: [{\n        sw: 6,\n        da: 128,\n        os: 82,\n        r: 26,\n        cx: 32,\n        cy: 32,\n        f: NONE\n      }]\n    },\n\n    ios: IOS_SPINNER,\n\n    'ios-small': IOS_SPINNER,\n\n    bubbles: {\n      sw: 0,\n      c: [{\n        fn: function(i) {\n          return {\n            cx: 24 * Math.cos(2 * Math.PI * i / 8),\n            cy: 24 * Math.sin(2 * Math.PI * i / 8),\n            t: TRANSLATE32,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'r',\n                  dur: DURATION,\n                  v: animationValues('1;2;3;4;5;6;7;8', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 8\n      }]\n    },\n\n    circles: {\n\n      c: [{\n        fn: function(i) {\n          return {\n            r: 5,\n            cx: 24 * Math.cos(2 * Math.PI * i / 8),\n            cy: 24 * Math.sin(2 * Math.PI * i / 8),\n            t: TRANSLATE32,\n            sw: 0,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'fill-opacity',\n                  dur: DURATION,\n                  v: animationValues('.3;.3;.3;.4;.7;.85;.9;1', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 8\n      }]\n    },\n\n    crescent: {\n      c: [{\n        sw: 4,\n        da: 128,\n        os: 82,\n        r: 26,\n        cx: 32,\n        cy: 32,\n        f: NONE,\n        at: [SPIN_ANIMATION]\n      }]\n    },\n\n    dots: {\n\n      c: [{\n        fn: function(i) {\n          return {\n            cx: 16 + (16 * i),\n            cy: 32,\n            sw: 0,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'fill-opacity',\n                  dur: DURATION,\n                  v: animationValues('.5;.6;.8;1;.8;.6;.5', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: 'r',\n                  dur: DURATION,\n                  v: animationValues('4;5;6;5;4;3;3', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 3\n      }]\n    },\n\n    lines: {\n      sw: 7,\n      lc: ROUND,\n      line: [{\n        fn: function(i) {\n          return {\n            x1: 10 + (i * 14),\n            x2: 10 + (i * 14),\n            a: [{\n              fn: function() {\n                return {\n                  an: 'y1',\n                  dur: DURATION,\n                  v: animationValues('16;18;28;18;16', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: 'y2',\n                  dur: DURATION,\n                  v: animationValues('48;44;36;46;48', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: STROKE_OPACITY,\n                  dur: DURATION,\n                  v: animationValues('1;.8;.5;.4;1', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 4\n      }]\n    },\n\n    ripple: {\n      f: NONE,\n      'fill-rule': 'evenodd',\n      sw: 3,\n      circle: [{\n        fn: function(i) {\n          return {\n            cx: 32,\n            cy: 32,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'r',\n                  begin: (i * -1) + 's',\n                  dur: '2s',\n                  v: '0;24',\n                  keyTimes: '0;1',\n                  keySplines: '0.1,0.2,0.3,1',\n                  calcMode: 'spline',\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: STROKE_OPACITY,\n                  begin: (i * -1) + 's',\n                  dur: '2s',\n                  v: '.2;1;.2;0',\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 2\n      }]\n    },\n\n    spiral: {\n      defs: [{\n        linearGradient: [{\n          id: 'sGD',\n          gradientUnits: 'userSpaceOnUse',\n          x1: 55, y1: 46, x2: 2, y2: 46,\n          stop: [{\n            offset: 0.1,\n            class: 'stop1'\n          }, {\n            offset: 1,\n            class: 'stop2'\n          }]\n        }]\n      }],\n      g: [{\n        sw: 4,\n        lc: ROUND,\n        f: NONE,\n        path: [{\n          stroke: 'url(#sGD)',\n          d: 'M4,32 c0,15,12,28,28,28c8,0,16-4,21-9'\n        }, {\n          d: 'M60,32 C60,16,47.464,4,32,4S4,16,4,32'\n        }],\n        at: [SPIN_ANIMATION]\n      }]\n    }\n\n  };\n\n  var animations = {\n\n    android: function(ele) {\n      // Note that this is called as a function, not a constructor.\n      var self = {};\n\n      this.stop = false;\n\n      var rIndex = 0;\n      var rotateCircle = 0;\n      var startTime;\n      var svgEle = ele.querySelector('g');\n      var circleEle = ele.querySelector('circle');\n\n      function run() {\n        if (self.stop) return;\n\n        var v = easeInOutCubic(Date.now() - startTime, 650);\n        var scaleX = 1;\n        var translateX = 0;\n        var dasharray = (188 - (58 * v));\n        var dashoffset = (182 - (182 * v));\n\n        if (rIndex % 2) {\n          scaleX = -1;\n          translateX = -64;\n          dasharray = (128 - (-58 * v));\n          dashoffset = (182 * v);\n        }\n\n        var rotateLine = [0, -101, -90, -11, -180, 79, -270, -191][rIndex];\n\n        setSvgAttribute(circleEle, 'da', Math.max(Math.min(dasharray, 188), 128));\n        setSvgAttribute(circleEle, 'os', Math.max(Math.min(dashoffset, 182), 0));\n        setSvgAttribute(circleEle, 't', 'scale(' + scaleX + ',1) translate(' + translateX + ',0) rotate(' + rotateLine + ',32,32)');\n\n        rotateCircle += 4.1;\n        if (rotateCircle > 359) rotateCircle = 0;\n        setSvgAttribute(svgEle, 't', 'rotate(' + rotateCircle + ',32,32)');\n\n        if (v >= 1) {\n          rIndex++;\n          if (rIndex > 7) rIndex = 0;\n          startTime = Date.now();\n        }\n\n        ionic.requestAnimationFrame(run);\n      }\n\n      return function() {\n        startTime = Date.now();\n        run();\n        return self;\n      };\n\n    }\n\n  };\n\n  function easeInOutCubic(t, c) {\n    t /= c / 2;\n    if (t < 1) return 1 / 2 * t * t * t;\n    t -= 2;\n    return 1 / 2 * (t * t * t + 2);\n  }\n\n\n  IonicModule\n  .controller('$ionicSpinner', [\n    '$element',\n    '$attrs',\n    '$ionicConfig',\n  function($element, $attrs, $ionicConfig) {\n    var spinnerName, anim;\n\n    this.init = function() {\n      spinnerName = $attrs.icon || $ionicConfig.spinner.icon();\n\n      var container = document.createElement('div');\n      createSvgElement('svg', {\n        viewBox: '0 0 64 64',\n        g: [spinners[spinnerName]]\n      }, container, spinnerName);\n\n      // Specifically for animations to work,\n      // Android 4.3 and below requires the element to be\n      // added as an html string, rather than dynmically\n      // building up the svg element and appending it.\n      $element.html(container.innerHTML);\n\n      this.start();\n\n      return spinnerName;\n    };\n\n    this.start = function() {\n      animations[spinnerName] && (anim = animations[spinnerName]($element[0])());\n    };\n\n    this.stop = function() {\n      animations[spinnerName] && (anim.stop = true);\n    };\n\n  }]);\n\n})(ionic);\n\nIonicModule\n.controller('$ionicTab', [\n  '$scope',\n  '$ionicHistory',\n  '$attrs',\n  '$location',\n  '$state',\nfunction($scope, $ionicHistory, $attrs, $location, $state) {\n  this.$scope = $scope;\n\n  //All of these exposed for testing\n  this.hrefMatchesState = function() {\n    return $attrs.href && $location.path().indexOf(\n      $attrs.href.replace(/^#/, '').replace(/\\/$/, '')\n    ) === 0;\n  };\n  this.srefMatchesState = function() {\n    return $attrs.uiSref && $state.includes($attrs.uiSref.split('(')[0]);\n  };\n  this.navNameMatchesState = function() {\n    return this.navViewName && $ionicHistory.isCurrentStateNavView(this.navViewName);\n  };\n\n  this.tabMatchesState = function() {\n    return this.hrefMatchesState() || this.srefMatchesState() || this.navNameMatchesState();\n  };\n}]);\n\nIonicModule\n.controller('$ionicTabs', [\n  '$scope',\n  '$element',\n  '$ionicHistory',\nfunction($scope, $element, $ionicHistory) {\n  var self = this;\n  var selectedTab = null;\n  var previousSelectedTab = null;\n  var selectedTabIndex;\n  var isVisible = true;\n  self.tabs = [];\n\n  self.selectedIndex = function() {\n    return self.tabs.indexOf(selectedTab);\n  };\n  self.selectedTab = function() {\n    return selectedTab;\n  };\n  self.previousSelectedTab = function() {\n    return previousSelectedTab;\n  };\n\n  self.add = function(tab) {\n    $ionicHistory.registerHistory(tab);\n    self.tabs.push(tab);\n  };\n\n  self.remove = function(tab) {\n    var tabIndex = self.tabs.indexOf(tab);\n    if (tabIndex === -1) {\n      return;\n    }\n    //Use a field like '$tabSelected' so developers won't accidentally set it in controllers etc\n    if (tab.$tabSelected) {\n      self.deselect(tab);\n      //Try to select a new tab if we're removing a tab\n      if (self.tabs.length === 1) {\n        //Do nothing if there are no other tabs to select\n      } else {\n        //Select previous tab if it's the last tab, else select next tab\n        var newTabIndex = tabIndex === self.tabs.length - 1 ? tabIndex - 1 : tabIndex + 1;\n        self.select(self.tabs[newTabIndex]);\n      }\n    }\n    self.tabs.splice(tabIndex, 1);\n  };\n\n  self.deselect = function(tab) {\n    if (tab.$tabSelected) {\n      previousSelectedTab = selectedTab;\n      selectedTab = selectedTabIndex = null;\n      tab.$tabSelected = false;\n      (tab.onDeselect || noop)();\n      tab.$broadcast && tab.$broadcast('$ionicHistory.deselect');\n    }\n  };\n\n  self.select = function(tab, shouldEmitEvent) {\n    var tabIndex;\n    if (isNumber(tab)) {\n      tabIndex = tab;\n      if (tabIndex >= self.tabs.length) return;\n      tab = self.tabs[tabIndex];\n    } else {\n      tabIndex = self.tabs.indexOf(tab);\n    }\n\n    if (arguments.length === 1) {\n      shouldEmitEvent = !!(tab.navViewName || tab.uiSref);\n    }\n\n    if (selectedTab && selectedTab.$historyId == tab.$historyId) {\n      if (shouldEmitEvent) {\n        $ionicHistory.goToHistoryRoot(tab.$historyId);\n      }\n\n    } else if (selectedTabIndex !== tabIndex) {\n      forEach(self.tabs, function(tab) {\n        self.deselect(tab);\n      });\n\n      selectedTab = tab;\n      selectedTabIndex = tabIndex;\n\n      if (self.$scope && self.$scope.$parent) {\n        self.$scope.$parent.$activeHistoryId = tab.$historyId;\n      }\n\n      //Use a funny name like $tabSelected so the developer doesn't overwrite the var in a child scope\n      tab.$tabSelected = true;\n      (tab.onSelect || noop)();\n\n      if (shouldEmitEvent) {\n        $scope.$emit('$ionicHistory.change', {\n          type: 'tab',\n          tabIndex: tabIndex,\n          historyId: tab.$historyId,\n          navViewName: tab.navViewName,\n          hasNavView: !!tab.navViewName,\n          title: tab.title,\n          url: tab.href,\n          uiSref: tab.uiSref\n        });\n      }\n\n      $scope.$broadcast(\"tabSelected\", { selectedTab: tab, selectedTabIndex: tabIndex});\n    }\n  };\n\n  self.hasActiveScope = function() {\n    for (var x = 0; x < self.tabs.length; x++) {\n      if ($ionicHistory.isActiveScope(self.tabs[x])) {\n        return true;\n      }\n    }\n    return false;\n  };\n\n  self.showBar = function(show) {\n    if (arguments.length) {\n      if (show) {\n        $element.removeClass('tabs-item-hide');\n      } else {\n        $element.addClass('tabs-item-hide');\n      }\n      isVisible = !!show;\n    }\n    return isVisible;\n  };\n}]);\n\nIonicModule\n.controller('$ionicView', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$compile',\n  '$rootScope',\nfunction($scope, $element, $attrs, $compile, $rootScope) {\n  var self = this;\n  var navElementHtml = {};\n  var navViewCtrl;\n  var navBarDelegateHandle;\n  var hasViewHeaderBar;\n  var deregisters = [];\n  var viewTitle;\n\n  var deregIonNavBarInit = $scope.$on('ionNavBar.init', function(ev, delegateHandle) {\n    // this view has its own ion-nav-bar, remember the navBarDelegateHandle for this view\n    ev.stopPropagation();\n    navBarDelegateHandle = delegateHandle;\n  });\n\n\n  self.init = function() {\n    deregIonNavBarInit();\n\n    var modalCtrl = $element.inheritedData('$ionModalController');\n    navViewCtrl = $element.inheritedData('$ionNavViewController');\n\n    // don't bother if inside a modal or there's no parent navView\n    if (!navViewCtrl || modalCtrl) return;\n\n    // add listeners for when this view changes\n    $scope.$on('$ionicView.beforeEnter', self.beforeEnter);\n    $scope.$on('$ionicView.afterEnter', afterEnter);\n    $scope.$on('$ionicView.beforeLeave', deregisterFns);\n  };\n\n  self.beforeEnter = function(ev, transData) {\n    // this event was emitted, starting at intial ion-view, then bubbles up\n    // only the first ion-view should do something with it, parent ion-views should ignore\n    if (transData && !transData.viewNotified) {\n      transData.viewNotified = true;\n\n      if (!$rootScope.$$phase) $scope.$digest();\n      viewTitle = isDefined($attrs.viewTitle) ? $attrs.viewTitle : $attrs.title;\n\n      var navBarItems = {};\n      for (var n in navElementHtml) {\n        navBarItems[n] = generateNavBarItem(navElementHtml[n]);\n      }\n\n      navViewCtrl.beforeEnter(extend(transData, {\n        title: viewTitle,\n        showBack: !attrTrue('hideBackButton'),\n        navBarItems: navBarItems,\n        navBarDelegate: navBarDelegateHandle || null,\n        showNavBar: !attrTrue('hideNavBar'),\n        hasHeaderBar: !!hasViewHeaderBar\n      }));\n\n      // make sure any existing observers are cleaned up\n      deregisterFns();\n    }\n  };\n\n\n  function afterEnter() {\n    // only listen for title updates after it has entered\n    // but also deregister the observe before it leaves\n    var viewTitleAttr = isDefined($attrs.viewTitle) && 'viewTitle' || isDefined($attrs.title) && 'title';\n    if (viewTitleAttr) {\n      titleUpdate($attrs[viewTitleAttr]);\n      deregisters.push($attrs.$observe(viewTitleAttr, titleUpdate));\n    }\n\n    if (isDefined($attrs.hideBackButton)) {\n      deregisters.push($scope.$watch($attrs.hideBackButton, function(val) {\n        navViewCtrl.showBackButton(!val);\n      }));\n    }\n\n    if (isDefined($attrs.hideNavBar)) {\n      deregisters.push($scope.$watch($attrs.hideNavBar, function(val) {\n        navViewCtrl.showBar(!val);\n      }));\n    }\n  }\n\n\n  function titleUpdate(newTitle) {\n    if (isDefined(newTitle) && newTitle !== viewTitle) {\n      viewTitle = newTitle;\n      navViewCtrl.title(viewTitle);\n    }\n  }\n\n\n  function deregisterFns() {\n    // remove all existing $attrs.$observe's\n    for (var x = 0; x < deregisters.length; x++) {\n      deregisters[x]();\n    }\n    deregisters = [];\n  }\n\n\n  function generateNavBarItem(html) {\n    if (html) {\n      // every time a view enters we need to recreate its view buttons if they exist\n      return $compile(html)($scope.$new());\n    }\n  }\n\n\n  function attrTrue(key) {\n    return !!$scope.$eval($attrs[key]);\n  }\n\n\n  self.navElement = function(type, html) {\n    navElementHtml[type] = html;\n  };\n\n}]);\n\n/*\n * We don't document the ionActionSheet directive, we instead document\n * the $ionicActionSheet service\n */\nIonicModule\n.directive('ionActionSheet', ['$document', function($document) {\n  return {\n    restrict: 'E',\n    scope: true,\n    replace: true,\n    link: function($scope, $element) {\n\n      var keyUp = function(e) {\n        if (e.which == 27) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n\n      var backdropClick = function(e) {\n        if (e.target == $element[0]) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n      $scope.$on('$destroy', function() {\n        $element.remove();\n        $document.unbind('keyup', keyUp);\n      });\n\n      $document.bind('keyup', keyUp);\n      $element.bind('click', backdropClick);\n    },\n    template: '<div class=\"action-sheet-backdrop\">' +\n                '<div class=\"action-sheet-wrapper\">' +\n                  '<div class=\"action-sheet\" ng-class=\"{\\'action-sheet-has-icons\\': $actionSheetHasIcon}\">' +\n                    '<div class=\"action-sheet-group action-sheet-options\">' +\n                      '<div class=\"action-sheet-title\" ng-if=\"titleText\" ng-bind-html=\"titleText\"></div>' +\n                      '<button class=\"button action-sheet-option\" ng-click=\"buttonClicked($index)\" ng-class=\"b.className\" ng-repeat=\"b in buttons\" ng-bind-html=\"b.text\"></button>' +\n                      '<button class=\"button destructive action-sheet-destructive\" ng-if=\"destructiveText\" ng-click=\"destructiveButtonClicked()\" ng-bind-html=\"destructiveText\"></button>' +\n                    '</div>' +\n                    '<div class=\"action-sheet-group action-sheet-cancel\" ng-if=\"cancelText\">' +\n                      '<button class=\"button\" ng-click=\"cancel()\" ng-bind-html=\"cancelText\"></button>' +\n                    '</div>' +\n                  '</div>' +\n                '</div>' +\n              '</div>'\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionCheckbox\n * @module ionic\n * @restrict E\n * @codepen hqcju\n * @description\n * The checkbox is no different than the HTML checkbox input, except it's styled differently.\n *\n * The checkbox behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]).\n *\n * @usage\n * ```html\n * <ion-checkbox ng-model=\"isChecked\">Checkbox Label</ion-checkbox>\n * ```\n */\n\nIonicModule\n.directive('ionCheckbox', ['$ionicConfig', function($ionicConfig) {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-checkbox\">' +\n        '<div class=\"checkbox checkbox-input-hidden disable-pointer-events\">' +\n          '<input type=\"checkbox\">' +\n          '<i class=\"checkbox-icon\"></i>' +\n        '</div>' +\n        '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n      '</label>',\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange,\n        'ng-required': attr.ngRequired,\n        'required': attr.required\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n      var checkboxWrapper = element[0].querySelector('.checkbox');\n      checkboxWrapper.classList.add('checkbox-' + $ionicConfig.form.checkbox());\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @restrict A\n * @name collectionRepeat\n * @module ionic\n * @codepen 7ec1ec58f2489ab8f359fa1a0fe89c15\n * @description\n * `collection-repeat` allows an app to show huge lists of items much more performantly than\n * `ng-repeat`.\n *\n * It renders into the DOM only as many items as are currently visible.\n *\n * This means that on a phone screen that can fit eight items, only the eight items matching\n * the current scroll position will be rendered.\n *\n * **The Basics**:\n *\n * - The data given to collection-repeat must be an array.\n * - If the `item-height` and `item-width` attributes are not supplied, it will be assumed that\n *   every item in the list has the same dimensions as the first item.\n * - Don't use angular one-time binding (`::`) with collection-repeat. The scope of each item is\n *   assigned new data and re-digested as you scroll. Bindings need to update, and one-time bindings\n *   won't.\n *\n * **Performance Tips**:\n *\n * - The iOS webview has a performance bottleneck when switching out `<img src>` attributes.\n *   To increase performance of images on iOS, cache your images in advance and,\n *   if possible, lower the number of unique images. We're working on [a solution](https://github.com/driftyco/ionic/issues/3194).\n *\n * @usage\n * #### Basic Item List ([codepen](http://codepen.io/ionic/pen/0c2c35a34a8b18ad4d793fef0b081693))\n * ```html\n * <ion-content>\n *   <ion-item collection-repeat=\"item in items\">\n *     {% raw %}{{item}}{% endraw %}\n *   </ion-item>\n * </ion-content>\n * ```\n *\n * #### Grid of Images ([codepen](http://codepen.io/ionic/pen/5515d4efd9d66f780e96787387f41664))\n * ```html\n * <ion-content>\n *   <img collection-repeat=\"photo in photos\"\n *     item-width=\"33%\"\n *     item-height=\"200px\"\n *     ng-src=\"{% raw %}{{photo.url}}{% endraw %}\">\n * </ion-content>\n * ```\n *\n * #### Horizontal Scroller, Dynamic Item Width ([codepen](http://codepen.io/ionic/pen/67cc56b349124a349acb57a0740e030e))\n * ```html\n * <ion-content>\n *   <h2>Available Kittens:</h2>\n *   <ion-scroll direction=\"x\" class=\"available-scroller\">\n *     <div class=\"photo\" collection-repeat=\"photo in main.photos\"\n *        item-height=\"250\" item-width=\"photo.width + 30\">\n *        <img ng-src=\"{% raw %}{{photo.src}}{% endraw %}\">\n *     </div>\n *   </ion-scroll>\n * </ion-content>\n * ```\n *\n * @param {expression} collection-repeat The expression indicating how to enumerate a collection,\n *   of the format  `variable in expression` – where variable is the user defined loop variable\n *   and `expression` is a scope expression giving the collection to enumerate.\n *   For example: `album in artist.albums` or `album in artist.albums | orderBy:'name'`.\n * @param {expression=} item-width The width of the repeated element. The expression must return\n *   a number (pixels) or a percentage. Defaults to the width of the first item in the list.\n *   (previously named collection-item-width)\n * @param {expression=} item-height The height of the repeated element. The expression must return\n *   a number (pixels) or a percentage. Defaults to the height of the first item in the list.\n *   (previously named collection-item-height)\n * @param {number=} item-render-buffer The number of items to load before and after the visible\n *   items in the list. Default 3. Tip: set this higher if you have lots of images to preload, but\n *   don't set it too high or you'll see performance loss.\n * @param {boolean=} force-refresh-images Force images to refresh as you scroll. This fixes a problem\n *   where, when an element is interchanged as scrolling, its image will still have the old src\n *   while the new src loads. Setting this to true comes with a small performance loss.\n */\n\nIonicModule\n.directive('collectionRepeat', CollectionRepeatDirective)\n.factory('$ionicCollectionManager', RepeatManagerFactory);\n\nvar ONE_PX_TRANSPARENT_IMG_SRC = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';\nvar WIDTH_HEIGHT_REGEX = /height:.*?px;\\s*width:.*?px/;\nvar DEFAULT_RENDER_BUFFER = 3;\n\nCollectionRepeatDirective.$inject = ['$ionicCollectionManager', '$parse', '$window', '$$rAF', '$rootScope', '$timeout'];\nfunction CollectionRepeatDirective($ionicCollectionManager, $parse, $window, $$rAF, $rootScope, $timeout) {\n  return {\n    restrict: 'A',\n    priority: 1000,\n    transclude: 'element',\n    $$tlb: true,\n    require: '^^$ionicScroll',\n    link: postLink\n  };\n\n  function postLink(scope, element, attr, scrollCtrl, transclude) {\n    var scrollView = scrollCtrl.scrollView;\n    var node = element[0];\n    var containerNode = angular.element('<div class=\"collection-repeat-container\">')[0];\n    node.parentNode.replaceChild(containerNode, node);\n\n    if (scrollView.options.scrollingX && scrollView.options.scrollingY) {\n      throw new Error(\"collection-repeat expected a parent x or y scrollView, not \" +\n                      \"an xy scrollView.\");\n    }\n\n    var repeatExpr = attr.collectionRepeat;\n    var match = repeatExpr.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n    if (!match) {\n      throw new Error(\"collection-repeat expected expression in form of '_item_ in \" +\n                      \"_collection_[ track by _id_]' but got '\" + attr.collectionRepeat + \"'.\");\n    }\n    var keyExpr = match[1];\n    var listExpr = match[2];\n    var listGetter = $parse(listExpr);\n    var heightData = {};\n    var widthData = {};\n    var computedStyleDimensions = {};\n    var data = [];\n    var repeatManager;\n\n    // attr.collectionBufferSize is deprecated\n    var renderBufferExpr = attr.itemRenderBuffer || attr.collectionBufferSize;\n    var renderBuffer = angular.isDefined(renderBufferExpr) ?\n      parseInt(renderBufferExpr) :\n      DEFAULT_RENDER_BUFFER;\n\n    // attr.collectionItemHeight is deprecated\n    var heightExpr = attr.itemHeight || attr.collectionItemHeight;\n    // attr.collectionItemWidth is deprecated\n    var widthExpr = attr.itemWidth || attr.collectionItemWidth;\n\n    var afterItemsContainer = initAfterItemsContainer();\n\n    var changeValidator = makeChangeValidator();\n    initDimensions();\n\n    // Dimensions are refreshed on resize or data change.\n    scrollCtrl.$element.on('scroll-resize', refreshDimensions);\n\n    angular.element($window).on('resize', onResize);\n    var unlistenToExposeAside = $rootScope.$on('$ionicExposeAside', ionic.animationFrameThrottle(function() {\n      scrollCtrl.scrollView.resize();\n      onResize();\n    }));\n    $timeout(refreshDimensions, 0, false);\n\n    function onResize() {\n      if (changeValidator.resizeRequiresRefresh(scrollView.__clientWidth, scrollView.__clientHeight)) {\n        refreshDimensions();\n      }\n    }\n\n    scope.$watchCollection(listGetter, function(newValue) {\n      data = newValue || (newValue = []);\n      if (!angular.isArray(newValue)) {\n        throw new Error(\"collection-repeat expected an array for '\" + listExpr + \"', \" +\n          \"but got a \" + typeof value);\n      }\n      // Wait for this digest to end before refreshing everything.\n      scope.$$postDigest(function() {\n        getRepeatManager().setData(data);\n        if (changeValidator.dataChangeRequiresRefresh(data)) refreshDimensions();\n      });\n    });\n\n    scope.$on('$destroy', function() {\n      angular.element($window).off('resize', onResize);\n      unlistenToExposeAside();\n      scrollCtrl.$element && scrollCtrl.$element.off('scroll-resize', refreshDimensions);\n\n      computedStyleNode && computedStyleNode.parentNode &&\n        computedStyleNode.parentNode.removeChild(computedStyleNode);\n      computedStyleScope && computedStyleScope.$destroy();\n      computedStyleScope = computedStyleNode = null;\n\n      repeatManager && repeatManager.destroy();\n      repeatManager = null;\n    });\n\n    function makeChangeValidator() {\n      var self;\n      return (self = {\n        dataLength: 0,\n        width: 0,\n        height: 0,\n        // A resize triggers a refresh only if we have data, the scrollView has size,\n        // and the size has changed.\n        resizeRequiresRefresh: function(newWidth, newHeight) {\n          var requiresRefresh = self.dataLength && newWidth && newHeight &&\n            (newWidth !== self.width || newHeight !== self.height);\n\n          self.width = newWidth;\n          self.height = newHeight;\n\n          return !!requiresRefresh;\n        },\n        // A change in data only triggers a refresh if the data has length, or if the data's\n        // length is less than before.\n        dataChangeRequiresRefresh: function(newData) {\n          var requiresRefresh = newData.length > 0 || newData.length < self.dataLength;\n\n          self.dataLength = newData.length;\n\n          return !!requiresRefresh;\n        }\n      });\n    }\n\n    function getRepeatManager() {\n      return repeatManager || (repeatManager = new $ionicCollectionManager({\n        afterItemsNode: afterItemsContainer[0],\n        containerNode: containerNode,\n        heightData: heightData,\n        widthData: widthData,\n        forceRefreshImages: !!(isDefined(attr.forceRefreshImages) && attr.forceRefreshImages !== 'false'),\n        keyExpression: keyExpr,\n        renderBuffer: renderBuffer,\n        scope: scope,\n        scrollView: scrollCtrl.scrollView,\n        transclude: transclude\n      }));\n    }\n\n    function initAfterItemsContainer() {\n      var container = angular.element(\n        scrollView.__content.querySelector('.collection-repeat-after-container')\n      );\n      // Put everything in the view after the repeater into a container.\n      if (!container.length) {\n        var elementIsAfterRepeater = false;\n        var afterNodes = [].filter.call(scrollView.__content.childNodes, function(node) {\n          if (ionic.DomUtil.contains(node, containerNode)) {\n            elementIsAfterRepeater = true;\n            return false;\n          }\n          return elementIsAfterRepeater;\n        });\n        container = angular.element('<span class=\"collection-repeat-after-container\">');\n        if (scrollView.options.scrollingX) {\n          container.addClass('horizontal');\n        }\n        container.append(afterNodes);\n        scrollView.__content.appendChild(container[0]);\n      }\n      return container;\n    }\n\n    function initDimensions() {\n      //Height and width have four 'modes':\n      //1) Computed Mode\n      //  - Nothing is supplied, so we getComputedStyle() on one element in the list and use\n      //    that width and height value for the width and height of every item. This is re-computed\n      //    every resize.\n      //2) Constant Mode, Static Integer\n      //  - The user provides a constant number for width or height, in pixels. We parse it,\n      //    store it on the `value` field, and it never changes\n      //3) Constant Mode, Percent\n      //  - The user provides a percent string for width or height. The getter for percent is\n      //    stored on the `getValue()` field, and is re-evaluated once every resize. The result\n      //    is stored on the `value` field.\n      //4) Dynamic Mode\n      //  - The user provides a dynamic expression for the width or height.  This is re-evaluated\n      //    for every item, stored on the `.getValue()` field.\n      if (heightExpr) {\n        parseDimensionAttr(heightExpr, heightData);\n      } else {\n        heightData.computed = true;\n      }\n      if (widthExpr) {\n        parseDimensionAttr(widthExpr, widthData);\n      } else {\n        widthData.computed = true;\n      }\n    }\n\n    function refreshDimensions() {\n      var hasData = data.length > 0;\n\n      if (hasData && (heightData.computed || widthData.computed)) {\n        computeStyleDimensions();\n      }\n\n      if (hasData && heightData.computed) {\n        heightData.value = computedStyleDimensions.height;\n        if (!heightData.value) {\n          throw new Error('collection-repeat tried to compute the height of repeated elements \"' +\n            repeatExpr + '\", but was unable to. Please provide the \"item-height\" attribute. ' +\n            'http://ionicframework.com/docs/api/directive/collectionRepeat/');\n        }\n      } else if (!heightData.dynamic && heightData.getValue) {\n        // If it's a constant with a getter (eg percent), we just refresh .value after resize\n        heightData.value = heightData.getValue();\n      }\n\n      if (hasData && widthData.computed) {\n        widthData.value = computedStyleDimensions.width;\n        if (!widthData.value) {\n          throw new Error('collection-repeat tried to compute the width of repeated elements \"' +\n            repeatExpr + '\", but was unable to. Please provide the \"item-width\" attribute. ' +\n            'http://ionicframework.com/docs/api/directive/collectionRepeat/');\n        }\n      } else if (!widthData.dynamic && widthData.getValue) {\n        // If it's a constant with a getter (eg percent), we just refresh .value after resize\n        widthData.value = widthData.getValue();\n      }\n      // Dynamic dimensions aren't updated on resize. Since they're already dynamic anyway,\n      // .getValue() will be used.\n\n      getRepeatManager().refreshLayout();\n    }\n\n    function parseDimensionAttr(attrValue, dimensionData) {\n      if (!attrValue) return;\n\n      var parsedValue;\n      // Try to just parse the plain attr value\n      try {\n        parsedValue = $parse(attrValue);\n      } catch (e) {\n        // If the parse fails and the value has `px` or `%` in it, surround the attr in\n        // quotes, to attempt to let the user provide a simple `attr=\"100%\"` or `attr=\"100px\"`\n        if (attrValue.trim().match(/\\d+(px|%)$/)) {\n          attrValue = '\"' + attrValue + '\"';\n        }\n        parsedValue = $parse(attrValue);\n      }\n\n      var constantAttrValue = attrValue.replace(/(\\'|\\\"|px|%)/g, '').trim();\n      var isConstant = constantAttrValue.length && !/([a-zA-Z]|\\$|:|\\?)/.test(constantAttrValue);\n      dimensionData.attrValue = attrValue;\n\n      // If it's a constant, it's either a percent or just a constant pixel number.\n      if (isConstant) {\n        // For percents, store the percent getter on .getValue()\n        if (attrValue.indexOf('%') > -1) {\n          var decimalValue = parseFloat(parsedValue()) / 100;\n          dimensionData.getValue = dimensionData === heightData ?\n            function() { return Math.floor(decimalValue * scrollView.__clientHeight); } :\n            function() { return Math.floor(decimalValue * scrollView.__clientWidth); };\n        } else {\n          // For static constants, just store the static constant.\n          dimensionData.value = parseInt(parsedValue());\n        }\n\n      } else {\n        dimensionData.dynamic = true;\n        dimensionData.getValue = dimensionData === heightData ?\n          function heightGetter(scope, locals) {\n            var result = parsedValue(scope, locals);\n            if (result.charAt && result.charAt(result.length - 1) === '%') {\n              return Math.floor(parseFloat(result) / 100 * scrollView.__clientHeight);\n            }\n            return parseInt(result);\n          } :\n          function widthGetter(scope, locals) {\n            var result = parsedValue(scope, locals);\n            if (result.charAt && result.charAt(result.length - 1) === '%') {\n              return Math.floor(parseFloat(result) / 100 * scrollView.__clientWidth);\n            }\n            return parseInt(result);\n          };\n      }\n    }\n\n    var computedStyleNode;\n    var computedStyleScope;\n    function computeStyleDimensions() {\n      if (!computedStyleNode) {\n        transclude(computedStyleScope = scope.$new(), function(clone) {\n          clone[0].removeAttribute('collection-repeat'); // remove absolute position styling\n          computedStyleNode = clone[0];\n        });\n      }\n\n      computedStyleScope[keyExpr] = (listGetter(scope) || [])[0];\n      if (!$rootScope.$$phase) computedStyleScope.$digest();\n      containerNode.appendChild(computedStyleNode);\n\n      var style = $window.getComputedStyle(computedStyleNode);\n      computedStyleDimensions.width = parseInt(style.width);\n      computedStyleDimensions.height = parseInt(style.height);\n\n      containerNode.removeChild(computedStyleNode);\n    }\n\n  }\n\n}\n\nRepeatManagerFactory.$inject = ['$rootScope', '$window', '$$rAF'];\nfunction RepeatManagerFactory($rootScope, $window, $$rAF) {\n  var EMPTY_DIMENSION = { primaryPos: 0, secondaryPos: 0, primarySize: 0, secondarySize: 0, rowPrimarySize: 0 };\n\n  return function RepeatController(options) {\n    var afterItemsNode = options.afterItemsNode;\n    var containerNode = options.containerNode;\n    var forceRefreshImages = options.forceRefreshImages;\n    var heightData = options.heightData;\n    var widthData = options.widthData;\n    var keyExpression = options.keyExpression;\n    var renderBuffer = options.renderBuffer;\n    var scope = options.scope;\n    var scrollView = options.scrollView;\n    var transclude = options.transclude;\n\n    var data = [];\n\n    var getterLocals = {};\n    var heightFn = heightData.getValue || function() { return heightData.value; };\n    var heightGetter = function(index, value) {\n      getterLocals[keyExpression] = value;\n      getterLocals.$index = index;\n      return heightFn(scope, getterLocals);\n    };\n\n    var widthFn = widthData.getValue || function() { return widthData.value; };\n    var widthGetter = function(index, value) {\n      getterLocals[keyExpression] = value;\n      getterLocals.$index = index;\n      return widthFn(scope, getterLocals);\n    };\n\n    var isVertical = !!scrollView.options.scrollingY;\n\n    // We say it's a grid view if we're either dynamic or not 100% width\n    var isGridView = isVertical ?\n      (widthData.dynamic || widthData.value !== scrollView.__clientWidth) :\n      (heightData.dynamic || heightData.value !== scrollView.__clientHeight);\n\n    var isStaticView = !heightData.dynamic && !widthData.dynamic;\n\n    var PRIMARY = 'PRIMARY';\n    var SECONDARY = 'SECONDARY';\n    var TRANSLATE_TEMPLATE_STR = isVertical ?\n      'translate3d(SECONDARYpx,PRIMARYpx,0)' :\n      'translate3d(PRIMARYpx,SECONDARYpx,0)';\n    var WIDTH_HEIGHT_TEMPLATE_STR = isVertical ?\n      'height: PRIMARYpx; width: SECONDARYpx;' :\n      'height: SECONDARYpx; width: PRIMARYpx;';\n\n    var estimatedHeight;\n    var estimatedWidth;\n\n    var repeaterBeforeSize = 0;\n    var repeaterAfterSize = 0;\n\n    var renderStartIndex = -1;\n    var renderEndIndex = -1;\n    var renderAfterBoundary = -1;\n    var renderBeforeBoundary = -1;\n\n    var itemsPool = [];\n    var itemsLeaving = [];\n    var itemsEntering = [];\n    var itemsShownMap = {};\n    var nextItemId = 0;\n\n    var scrollViewSetDimensions = isVertical ?\n      function() { scrollView.setDimensions(null, null, null, view.getContentSize(), true); } :\n      function() { scrollView.setDimensions(null, null, view.getContentSize(), null, true); };\n\n    // view is a mix of list/grid methods + static/dynamic methods.\n    // See bottom for implementations. Available methods:\n    //\n    // getEstimatedPrimaryPos(i), getEstimatedSecondaryPos(i), getEstimatedIndex(scrollTop),\n    // calculateDimensions(toIndex), getDimensions(index),\n    // updateRenderRange(scrollTop, scrollValueEnd), onRefreshLayout(), onRefreshData()\n    var view = isVertical ? new VerticalViewType() : new HorizontalViewType();\n    (isGridView ? GridViewType : ListViewType).call(view);\n    (isStaticView ? StaticViewType : DynamicViewType).call(view);\n\n    var contentSizeStr = isVertical ? 'getContentHeight' : 'getContentWidth';\n    var originalGetContentSize = scrollView.options[contentSizeStr];\n    scrollView.options[contentSizeStr] = angular.bind(view, view.getContentSize);\n\n    scrollView.__$callback = scrollView.__callback;\n    scrollView.__callback = function(transformLeft, transformTop, zoom, wasResize) {\n      var scrollValue = view.getScrollValue();\n      if (renderStartIndex === -1 ||\n          scrollValue + view.scrollPrimarySize > renderAfterBoundary ||\n          scrollValue < renderBeforeBoundary) {\n        render();\n      }\n      scrollView.__$callback(transformLeft, transformTop, zoom, wasResize);\n    };\n\n    var isLayoutReady = false;\n    var isDataReady = false;\n    this.refreshLayout = function() {\n      if (data.length) {\n        estimatedHeight = heightGetter(0, data[0]);\n        estimatedWidth = widthGetter(0, data[0]);\n      } else {\n        // If we don't have any data in our array, just guess.\n        estimatedHeight = 100;\n        estimatedWidth = 100;\n      }\n\n      // Get the size of every element AFTER the repeater. We have to get the margin before and\n      // after the first/last element to fix a browser bug with getComputedStyle() not counting\n      // the first/last child's margins into height.\n      var style = getComputedStyle(afterItemsNode) || {};\n      var firstStyle = afterItemsNode.firstElementChild && getComputedStyle(afterItemsNode.firstElementChild) || {};\n      var lastStyle = afterItemsNode.lastElementChild && getComputedStyle(afterItemsNode.lastElementChild) || {};\n      repeaterAfterSize = (parseInt(style[isVertical ? 'height' : 'width']) || 0) +\n        (firstStyle && parseInt(firstStyle[isVertical ? 'marginTop' : 'marginLeft']) || 0) +\n        (lastStyle && parseInt(lastStyle[isVertical ? 'marginBottom' : 'marginRight']) || 0);\n\n      // Get the offsetTop of the repeater.\n      repeaterBeforeSize = 0;\n      var current = containerNode;\n      do {\n        repeaterBeforeSize += current[isVertical ? 'offsetTop' : 'offsetLeft'];\n      } while ( ionic.DomUtil.contains(scrollView.__content, current = current.offsetParent) );\n\n      var containerPrevNode = containerNode.previousElementSibling;\n      var beforeStyle = containerPrevNode ? $window.getComputedStyle(containerPrevNode) : {};\n      var beforeMargin = parseInt(beforeStyle[isVertical ? 'marginBottom' : 'marginRight'] || 0);\n\n      // Because we position the collection container with position: relative, it doesn't take\n      // into account where to position itself relative to the previous element's marginBottom.\n      // To compensate, we translate the container up by the previous element's margin.\n      containerNode.style[ionic.CSS.TRANSFORM] = TRANSLATE_TEMPLATE_STR\n        .replace(PRIMARY, -beforeMargin)\n        .replace(SECONDARY, 0);\n      repeaterBeforeSize -= beforeMargin;\n\n      if (!scrollView.__clientHeight || !scrollView.__clientWidth) {\n        scrollView.__clientWidth = scrollView.__container.clientWidth;\n        scrollView.__clientHeight = scrollView.__container.clientHeight;\n      }\n\n      (view.onRefreshLayout || angular.noop)();\n      view.refreshDirection();\n      scrollViewSetDimensions();\n\n      // Create the pool of items for reuse, setting the size to (estimatedItemsOnScreen) * 2,\n      // plus the size of the renderBuffer.\n      if (!isLayoutReady) {\n        var poolSize = Math.max(20, renderBuffer * 3);\n        for (var i = 0; i < poolSize; i++) {\n          itemsPool.push(new RepeatItem());\n        }\n      }\n\n      isLayoutReady = true;\n      if (isLayoutReady && isDataReady) {\n        // If the resize or latest data change caused the scrollValue to\n        // now be out of bounds, resize the scrollView.\n        if (scrollView.__scrollLeft > scrollView.__maxScrollLeft ||\n            scrollView.__scrollTop > scrollView.__maxScrollTop) {\n          scrollView.resize();\n        }\n        forceRerender(true);\n      }\n    };\n\n    this.setData = function(newData) {\n      data = newData;\n      (view.onRefreshData || angular.noop)();\n      isDataReady = true;\n    };\n\n    this.destroy = function() {\n      render.destroyed = true;\n\n      itemsPool.forEach(function(item) {\n        item.scope.$destroy();\n        item.scope = item.element = item.node = item.images = null;\n      });\n      itemsPool.length = itemsEntering.length = itemsLeaving.length = 0;\n      itemsShownMap = {};\n\n      //Restore the scrollView's normal behavior and resize it to normal size.\n      scrollView.options[contentSizeStr] = originalGetContentSize;\n      scrollView.__callback = scrollView.__$callback;\n      scrollView.resize();\n\n      (view.onDestroy || angular.noop)();\n    };\n\n    function forceRerender() {\n      return render(true);\n    }\n    function render(forceRerender) {\n      if (render.destroyed) return;\n      var i;\n      var ii;\n      var item;\n      var dim;\n      var scope;\n      var scrollValue = view.getScrollValue();\n      var scrollValueEnd = scrollValue + view.scrollPrimarySize;\n\n      view.updateRenderRange(scrollValue, scrollValueEnd);\n\n      renderStartIndex = Math.max(0, renderStartIndex - renderBuffer);\n      renderEndIndex = Math.min(data.length - 1, renderEndIndex + renderBuffer);\n\n      for (i in itemsShownMap) {\n        if (i < renderStartIndex || i > renderEndIndex) {\n          item = itemsShownMap[i];\n          delete itemsShownMap[i];\n          itemsLeaving.push(item);\n          item.isShown = false;\n        }\n      }\n\n      // Render indicies that aren't shown yet\n      //\n      // NOTE(ajoslin): this may sound crazy, but calling any other functions during this render\n      // loop will often push the render time over the edge from less than one frame to over\n      // one frame, causing visible jank.\n      // DON'T call any other functions inside this loop unless it's vital.\n      for (i = renderStartIndex; i <= renderEndIndex; i++) {\n        // We only go forward with render if the index is in data, the item isn't already shown,\n        // or forceRerender is on.\n        if (i >= data.length || (itemsShownMap[i] && !forceRerender)) continue;\n\n        item = itemsShownMap[i] || (itemsShownMap[i] = itemsLeaving.length ? itemsLeaving.pop() :\n                                    itemsPool.length ? itemsPool.shift() :\n                                    new RepeatItem());\n        itemsEntering.push(item);\n        item.isShown = true;\n\n        scope = item.scope;\n        scope.$index = i;\n        scope[keyExpression] = data[i];\n        scope.$first = (i === 0);\n        scope.$last = (i === (data.length - 1));\n        scope.$middle = !(scope.$first || scope.$last);\n        scope.$odd = !(scope.$even = (i & 1) === 0);\n\n        if (scope.$$disconnected) ionic.Utils.reconnectScope(item.scope);\n\n        dim = view.getDimensions(i);\n        if (item.secondaryPos !== dim.secondaryPos || item.primaryPos !== dim.primaryPos) {\n          item.node.style[ionic.CSS.TRANSFORM] = TRANSLATE_TEMPLATE_STR\n            .replace(PRIMARY, (item.primaryPos = dim.primaryPos))\n            .replace(SECONDARY, (item.secondaryPos = dim.secondaryPos));\n        }\n        if (item.secondarySize !== dim.secondarySize || item.primarySize !== dim.primarySize) {\n          item.node.style.cssText = item.node.style.cssText\n            .replace(WIDTH_HEIGHT_REGEX, WIDTH_HEIGHT_TEMPLATE_STR\n              //TODO fix item.primarySize + 1 hack\n              .replace(PRIMARY, (item.primarySize = dim.primarySize) + 1)\n              .replace(SECONDARY, (item.secondarySize = dim.secondarySize))\n            );\n        }\n\n      }\n\n      // If we reach the end of the list, render the afterItemsNode - this contains all the\n      // elements the developer placed after the collection-repeat\n      if (renderEndIndex === data.length - 1) {\n        dim = view.getDimensions(data.length - 1) || EMPTY_DIMENSION;\n        afterItemsNode.style[ionic.CSS.TRANSFORM] = TRANSLATE_TEMPLATE_STR\n          .replace(PRIMARY, dim.primaryPos + dim.primarySize)\n          .replace(SECONDARY, 0);\n      }\n\n      while (itemsLeaving.length) {\n        item = itemsLeaving.pop();\n        item.scope.$broadcast('$collectionRepeatLeave');\n        ionic.Utils.disconnectScope(item.scope);\n        itemsPool.push(item);\n        item.node.style[ionic.CSS.TRANSFORM] = 'translate3d(-9999px,-9999px,0)';\n        item.primaryPos = item.secondaryPos = null;\n      }\n\n      if (forceRefreshImages) {\n        for (i = 0, ii = itemsEntering.length; i < ii && (item = itemsEntering[i]); i++) {\n          if (!item.images) continue;\n          for (var j = 0, jj = item.images.length, img; j < jj && (img = item.images[j]); j++) {\n            var src = img.src;\n            img.src = ONE_PX_TRANSPARENT_IMG_SRC;\n            img.src = src;\n          }\n        }\n      }\n      if (forceRerender) {\n        var rootScopePhase = $rootScope.$$phase;\n        while (itemsEntering.length) {\n          item = itemsEntering.pop();\n          if (!rootScopePhase) item.scope.$digest();\n        }\n      } else {\n        digestEnteringItems();\n      }\n    }\n\n    function digestEnteringItems() {\n      var item;\n      if (digestEnteringItems.running) return;\n      digestEnteringItems.running = true;\n\n      $$rAF(function process() {\n        var rootScopePhase = $rootScope.$$phase;\n        while (itemsEntering.length) {\n          item = itemsEntering.pop();\n          if (item.isShown) {\n            if (!rootScopePhase) item.scope.$digest();\n          }\n        }\n        digestEnteringItems.running = false;\n      });\n    }\n\n    function RepeatItem() {\n      var self = this;\n      this.scope = scope.$new();\n      this.id = 'item' + (nextItemId++);\n      transclude(this.scope, function(clone) {\n        self.element = clone;\n        self.element.data('$$collectionRepeatItem', self);\n        // TODO destroy\n        self.node = clone[0];\n        // Batch style setting to lower repaints\n        self.node.style[ionic.CSS.TRANSFORM] = 'translate3d(-9999px,-9999px,0)';\n        self.node.style.cssText += ' height: 0px; width: 0px;';\n        ionic.Utils.disconnectScope(self.scope);\n        containerNode.appendChild(self.node);\n        self.images = clone[0].getElementsByTagName('img');\n      });\n    }\n\n    function VerticalViewType() {\n      this.getItemPrimarySize = heightGetter;\n      this.getItemSecondarySize = widthGetter;\n\n      this.getScrollValue = function() {\n        return Math.max(0, Math.min(scrollView.__scrollTop - repeaterBeforeSize,\n          scrollView.__maxScrollTop - repeaterBeforeSize - repeaterAfterSize));\n      };\n\n      this.refreshDirection = function() {\n        this.scrollPrimarySize = scrollView.__clientHeight;\n        this.scrollSecondarySize = scrollView.__clientWidth;\n\n        this.estimatedPrimarySize = estimatedHeight;\n        this.estimatedSecondarySize = estimatedWidth;\n        this.estimatedItemsAcross = isGridView &&\n          Math.floor(scrollView.__clientWidth / estimatedWidth) ||\n          1;\n      };\n    }\n    function HorizontalViewType() {\n      this.getItemPrimarySize = widthGetter;\n      this.getItemSecondarySize = heightGetter;\n\n      this.getScrollValue = function() {\n        return Math.max(0, Math.min(scrollView.__scrollLeft - repeaterBeforeSize,\n          scrollView.__maxScrollLeft - repeaterBeforeSize - repeaterAfterSize));\n      };\n\n      this.refreshDirection = function() {\n        this.scrollPrimarySize = scrollView.__clientWidth;\n        this.scrollSecondarySize = scrollView.__clientHeight;\n\n        this.estimatedPrimarySize = estimatedWidth;\n        this.estimatedSecondarySize = estimatedHeight;\n        this.estimatedItemsAcross = isGridView &&\n          Math.floor(scrollView.__clientHeight / estimatedHeight) ||\n          1;\n      };\n    }\n\n    function GridViewType() {\n      this.getEstimatedSecondaryPos = function(index) {\n        return (index % this.estimatedItemsAcross) * this.estimatedSecondarySize;\n      };\n      this.getEstimatedPrimaryPos = function(index) {\n        return Math.floor(index / this.estimatedItemsAcross) * this.estimatedPrimarySize;\n      };\n      this.getEstimatedIndex = function(scrollValue) {\n        return Math.floor(scrollValue / this.estimatedPrimarySize) *\n          this.estimatedItemsAcross;\n      };\n    }\n\n    function ListViewType() {\n      this.getEstimatedSecondaryPos = function() {\n        return 0;\n      };\n      this.getEstimatedPrimaryPos = function(index) {\n        return index * this.estimatedPrimarySize;\n      };\n      this.getEstimatedIndex = function(scrollValue) {\n        return Math.floor((scrollValue) / this.estimatedPrimarySize);\n      };\n    }\n\n    function StaticViewType() {\n      this.getContentSize = function() {\n        return this.getEstimatedPrimaryPos(data.length - 1) + this.estimatedPrimarySize +\n          repeaterBeforeSize + repeaterAfterSize;\n      };\n      // static view always returns the same object for getDimensions, to avoid memory allocation\n      // while scrolling. This could be dangerous if this was a public function, but it's not.\n      // Only we use it.\n      var dim = {};\n      this.getDimensions = function(index) {\n        dim.primaryPos = this.getEstimatedPrimaryPos(index);\n        dim.secondaryPos = this.getEstimatedSecondaryPos(index);\n        dim.primarySize = this.estimatedPrimarySize;\n        dim.secondarySize = this.estimatedSecondarySize;\n        return dim;\n      };\n      this.updateRenderRange = function(scrollValue, scrollValueEnd) {\n        renderStartIndex = Math.max(0, this.getEstimatedIndex(scrollValue));\n\n        // Make sure the renderEndIndex takes into account all the items on the row\n        renderEndIndex = Math.min(data.length - 1,\n          this.getEstimatedIndex(scrollValueEnd) + this.estimatedItemsAcross - 1);\n\n        renderBeforeBoundary = Math.max(0,\n          this.getEstimatedPrimaryPos(renderStartIndex));\n        renderAfterBoundary = this.getEstimatedPrimaryPos(renderEndIndex) +\n          this.estimatedPrimarySize;\n      };\n    }\n\n    function DynamicViewType() {\n      var self = this;\n      var debouncedScrollViewSetDimensions = ionic.debounce(scrollViewSetDimensions, 25, true);\n      var calculateDimensions = isGridView ? calculateDimensionsGrid : calculateDimensionsList;\n      var dimensionsIndex;\n      var dimensions = [];\n\n\n      // Get the dimensions at index. {width, height, left, top}.\n      // We start with no dimensions calculated, then any time dimensions are asked for at an\n      // index we calculate dimensions up to there.\n      function calculateDimensionsList(toIndex) {\n        var i, prevDimension, dim;\n        for (i = Math.max(0, dimensionsIndex); i <= toIndex && (dim = dimensions[i]); i++) {\n          prevDimension = dimensions[i - 1] || EMPTY_DIMENSION;\n          dim.primarySize = self.getItemPrimarySize(i, data[i]);\n          dim.secondarySize = self.scrollSecondarySize;\n          dim.primaryPos = prevDimension.primaryPos + prevDimension.primarySize;\n          dim.secondaryPos = 0;\n        }\n      }\n      function calculateDimensionsGrid(toIndex) {\n        var i, prevDimension, dim;\n        for (i = Math.max(dimensionsIndex, 0); i <= toIndex && (dim = dimensions[i]); i++) {\n          prevDimension = dimensions[i - 1] || EMPTY_DIMENSION;\n          dim.secondarySize = Math.min(\n            self.getItemSecondarySize(i, data[i]),\n            self.scrollSecondarySize\n          );\n          dim.secondaryPos = prevDimension.secondaryPos + prevDimension.secondarySize;\n\n          if (i === 0 || dim.secondaryPos + dim.secondarySize > self.scrollSecondarySize) {\n            dim.secondaryPos = 0;\n            dim.primarySize = self.getItemPrimarySize(i, data[i]);\n            dim.primaryPos = prevDimension.primaryPos + prevDimension.rowPrimarySize;\n\n            dim.rowStartIndex = i;\n            dim.rowPrimarySize = dim.primarySize;\n          } else {\n            dim.primarySize = self.getItemPrimarySize(i, data[i]);\n            dim.primaryPos = prevDimension.primaryPos;\n            dim.rowStartIndex = prevDimension.rowStartIndex;\n\n            dimensions[dim.rowStartIndex].rowPrimarySize = dim.rowPrimarySize = Math.max(\n              dimensions[dim.rowStartIndex].rowPrimarySize,\n              dim.primarySize\n            );\n            dim.rowPrimarySize = Math.max(dim.primarySize, dim.rowPrimarySize);\n          }\n        }\n      }\n\n      this.getContentSize = function() {\n        var dim = dimensions[dimensionsIndex] || EMPTY_DIMENSION;\n        return ((dim.primaryPos + dim.primarySize) || 0) +\n          this.getEstimatedPrimaryPos(data.length - dimensionsIndex - 1) +\n          repeaterBeforeSize + repeaterAfterSize;\n      };\n      this.onDestroy = function() {\n        dimensions.length = 0;\n      };\n\n      this.onRefreshData = function() {\n        var i;\n        var ii;\n        // Make sure dimensions has as many items as data.length.\n        // This is to be sure we don't have to allocate objects while scrolling.\n        for (i = dimensions.length, ii = data.length; i < ii; i++) {\n          dimensions.push({});\n        }\n        dimensionsIndex = -1;\n      };\n      this.onRefreshLayout = function() {\n        dimensionsIndex = -1;\n      };\n      this.getDimensions = function(index) {\n        index = Math.min(index, data.length - 1);\n\n        if (dimensionsIndex < index) {\n          // Once we start asking for dimensions near the end of the list, go ahead and calculate\n          // everything. This is to make sure when the user gets to the end of the list, the\n          // scroll height of the list is 100% accurate (not estimated anymore).\n          if (index > data.length * 0.9) {\n            calculateDimensions(data.length - 1);\n            dimensionsIndex = data.length - 1;\n            scrollViewSetDimensions();\n          } else {\n            calculateDimensions(index);\n            dimensionsIndex = index;\n            debouncedScrollViewSetDimensions();\n          }\n\n        }\n        return dimensions[index];\n      };\n\n      var oldRenderStartIndex = -1;\n      var oldScrollValue = -1;\n      this.updateRenderRange = function(scrollValue, scrollValueEnd) {\n        var i;\n        var len;\n        var dim;\n\n        // Calculate more dimensions than we estimate we'll need, to be sure.\n        this.getDimensions( this.getEstimatedIndex(scrollValueEnd) * 2 );\n\n        // -- Calculate renderStartIndex\n        // base case: start at 0\n        if (oldRenderStartIndex === -1 || scrollValue === 0) {\n          i = 0;\n        // scrolling down\n        } else if (scrollValue >= oldScrollValue) {\n          for (i = oldRenderStartIndex, len = data.length; i < len; i++) {\n            if ((dim = this.getDimensions(i)) && dim.primaryPos + dim.rowPrimarySize >= scrollValue) {\n              break;\n            }\n          }\n        // scrolling up\n        } else {\n          for (i = oldRenderStartIndex; i >= 0; i--) {\n            if ((dim = this.getDimensions(i)) && dim.primaryPos <= scrollValue) {\n              // when grid view, make sure the render starts at the beginning of a row.\n              i = isGridView ? dim.rowStartIndex : i;\n              break;\n            }\n          }\n        }\n\n        renderStartIndex = Math.min(Math.max(0, i), data.length - 1);\n        renderBeforeBoundary = renderStartIndex !== -1 ? this.getDimensions(renderStartIndex).primaryPos : -1;\n\n        // -- Calculate renderEndIndex\n        var lastRowDim;\n        for (i = renderStartIndex + 1, len = data.length; i < len; i++) {\n          if ((dim = this.getDimensions(i)) && dim.primaryPos + dim.rowPrimarySize > scrollValueEnd) {\n\n            // Go all the way to the end of the row if we're in a grid\n            if (isGridView) {\n              lastRowDim = dim;\n              while (i < len - 1 &&\n                    (dim = this.getDimensions(i + 1)).primaryPos === lastRowDim.primaryPos) {\n                i++;\n              }\n            }\n            break;\n          }\n        }\n\n        renderEndIndex = Math.min(i, data.length - 1);\n        renderAfterBoundary = renderEndIndex !== -1 ?\n          ((dim = this.getDimensions(renderEndIndex)).primaryPos + (dim.rowPrimarySize || dim.primarySize)) :\n          -1;\n\n        oldScrollValue = scrollValue;\n        oldRenderStartIndex = renderStartIndex;\n      };\n    }\n\n\n  };\n\n}\n\n/**\n * @ngdoc directive\n * @name ionContent\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @restrict E\n *\n * @description\n * The ionContent directive provides an easy to use content area that can be configured\n * to use Ionic's custom Scroll View, or the built in overflow scrolling of the browser.\n *\n * While we recommend using the custom Scroll features in Ionic in most cases, sometimes\n * (for performance reasons) only the browser's native overflow scrolling will suffice,\n * and so we've made it easy to toggle between the Ionic scroll implementation and\n * overflow scrolling.\n *\n * You can implement pull-to-refresh with the {@link ionic.directive:ionRefresher}\n * directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}\n * directive.\n *\n * If there is any dynamic content inside the ion-content, be sure to call `.resize()` with {@link ionic.service:$ionicScrollDelegate}\n * after the content has been added.\n *\n * Be aware that this directive gets its own child scope. If you do not understand why this\n * is important, you can read [https://docs.angularjs.org/guide/scope](https://docs.angularjs.org/guide/scope).\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} padding Whether to add padding to the content.\n * Defaults to true on iOS, false on Android.\n * @param {boolean=} scroll Whether to allow scrolling of content.  Defaults to true.\n * @param {boolean=} overflow-scroll Whether to use overflow-scrolling instead of\n * Ionic scroll. See {@link ionic.provider:$ionicConfigProvider} to set this as the global default.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {string=} start-x Initial horizontal scroll position. Default 0.\n * @param {string=} start-y Initial vertical scroll position. Default 0.\n * @param {expression=} on-scroll Expression to evaluate when the content is scrolled.\n * @param {expression=} on-scroll-complete Expression to evaluate when a scroll action completes. Has access to 'scrollLeft' and 'scrollTop' locals.\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n * @param {number=} scroll-event-interval Number of milliseconds between each firing of the 'on-scroll' expression. Default 10.\n */\nIonicModule\n.directive('ionContent', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\n  '$ionicConfig',\nfunction($timeout, $controller, $ionicBind, $ionicConfig) {\n  return {\n    restrict: 'E',\n    require: '^?ionNavView',\n    scope: true,\n    priority: 800,\n    compile: function(element, attr) {\n      var innerElement;\n      var scrollCtrl;\n\n      element.addClass('scroll-content ionic-scroll');\n\n      if (attr.scroll != 'false') {\n        //We cannot use normal transclude here because it breaks element.data()\n        //inheritance on compile\n        innerElement = jqLite('<div class=\"scroll\"></div>');\n        innerElement.append(element.contents());\n        element.append(innerElement);\n      } else {\n        element.addClass('scroll-content-false');\n      }\n\n      var nativeScrolling = attr.overflowScroll !== \"false\" && (attr.overflowScroll === \"true\" || !$ionicConfig.scrolling.jsScrolling());\n\n      // collection-repeat requires JS scrolling\n      if (nativeScrolling) {\n        nativeScrolling = !element[0].querySelector('[collection-repeat]');\n      }\n      return { pre: prelink };\n      function prelink($scope, $element, $attr) {\n        var parentScope = $scope.$parent;\n        $scope.$watch(function() {\n          return (parentScope.$hasHeader ? ' has-header' : '') +\n            (parentScope.$hasSubheader ? ' has-subheader' : '') +\n            (parentScope.$hasFooter ? ' has-footer' : '') +\n            (parentScope.$hasSubfooter ? ' has-subfooter' : '') +\n            (parentScope.$hasTabs ? ' has-tabs' : '') +\n            (parentScope.$hasTabsTop ? ' has-tabs-top' : '');\n        }, function(className, oldClassName) {\n          $element.removeClass(oldClassName);\n          $element.addClass(className);\n        });\n\n        //Only this ionContent should use these variables from parent scopes\n        $scope.$hasHeader = $scope.$hasSubheader =\n          $scope.$hasFooter = $scope.$hasSubfooter =\n          $scope.$hasTabs = $scope.$hasTabsTop =\n          false;\n        $ionicBind($scope, $attr, {\n          $onScroll: '&onScroll',\n          $onScrollComplete: '&onScrollComplete',\n          hasBouncing: '@',\n          padding: '@',\n          direction: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          startX: '@',\n          startY: '@',\n          scrollEventInterval: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n              (innerElement || $element).toggleClass('padding', !!newVal);\n          });\n        }\n\n        if ($attr.scroll === \"false\") {\n          //do nothing\n        } else {\n          var scrollViewOptions = {};\n\n          // determined in compile phase above\n          if (nativeScrolling) {\n            // use native scrolling\n            $element.addClass('overflow-scroll');\n\n            scrollViewOptions = {\n              el: $element[0],\n              delegateHandle: attr.delegateHandle,\n              startX: $scope.$eval($scope.startX) || 0,\n              startY: $scope.$eval($scope.startY) || 0,\n              nativeScrolling: true\n            };\n\n          } else {\n            // Use JS scrolling\n            scrollViewOptions = {\n              el: $element[0],\n              delegateHandle: attr.delegateHandle,\n              locking: (attr.locking || 'true') === 'true',\n              bouncing: $scope.$eval($scope.hasBouncing),\n              startX: $scope.$eval($scope.startX) || 0,\n              startY: $scope.$eval($scope.startY) || 0,\n              scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n              scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n              scrollingX: $scope.direction.indexOf('x') >= 0,\n              scrollingY: $scope.direction.indexOf('y') >= 0,\n              scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 10,\n              scrollingComplete: onScrollComplete\n            };\n          }\n\n          // init scroll controller with appropriate options\n          scrollCtrl = $controller('$ionicScroll', {\n            $scope: $scope,\n            scrollViewOptions: scrollViewOptions\n          });\n\n          $scope.scrollCtrl = scrollCtrl;\n\n          $scope.$on('$destroy', function() {\n            if (scrollViewOptions) {\n              scrollViewOptions.scrollingComplete = noop;\n              delete scrollViewOptions.el;\n            }\n            innerElement = null;\n            $element = null;\n            attr.$$element = null;\n          });\n        }\n\n        function onScrollComplete() {\n          $scope.$onScrollComplete({\n            scrollTop: scrollCtrl.scrollView.__scrollTop,\n            scrollLeft: scrollCtrl.scrollView.__scrollLeft\n          });\n        }\n\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name exposeAsideWhen\n * @module ionic\n * @restrict A\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * It is common for a tablet application to hide a menu when in portrait mode, but to show the\n * same menu on the left side when the tablet is in landscape mode. The `exposeAsideWhen` attribute\n * directive can be used to accomplish a similar interface.\n *\n * By default, side menus are hidden underneath its side menu content, and can be opened by either\n * swiping the content left or right, or toggling a button to show the side menu. However, by adding the\n * `exposeAsideWhen` attribute directive to an {@link ionic.directive:ionSideMenu} element directive,\n * a side menu can be given instructions on \"when\" the menu should be exposed (always viewable). For\n * example, the `expose-aside-when=\"large\"` attribute will keep the side menu hidden when the viewport's\n * width is less than `768px`, but when the viewport's width is `768px` or greater, the menu will then\n * always be shown and can no longer be opened or closed like it could when it was hidden for smaller\n * viewports.\n *\n * Using `large` as the attribute's value is a shortcut value to `(min-width:768px)` since it is\n * the most common use-case. However, for added flexibility, any valid media query could be added\n * as the value, such as `(min-width:600px)` or even multiple queries such as\n * `(min-width:750px) and (max-width:1200px)`.\n * @usage\n * ```html\n * <ion-side-menus>\n *   <!-- Center content -->\n *   <ion-side-menu-content>\n *   </ion-side-menu-content>\n *\n *   <!-- Left menu -->\n *   <ion-side-menu expose-aside-when=\"large\">\n *   </ion-side-menu>\n * </ion-side-menus>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n */\n\nIonicModule.directive('exposeAsideWhen', ['$window', function($window) {\n  return {\n    restrict: 'A',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n\n      var prevInnerWidth = $window.innerWidth;\n      var prevInnerHeight = $window.innerHeight;\n\n      ionic.on('resize', function() {\n        if (prevInnerWidth === $window.innerWidth && prevInnerHeight === $window.innerHeight) {\n          return;\n        }\n        prevInnerWidth = $window.innerWidth;\n        prevInnerHeight = $window.innerHeight;\n        onResize();\n      }, $window);\n\n      function checkAsideExpose() {\n        var mq = $attr.exposeAsideWhen == 'large' ? '(min-width:768px)' : $attr.exposeAsideWhen;\n        sideMenuCtrl.exposeAside($window.matchMedia(mq).matches);\n        sideMenuCtrl.activeAsideResizing(false);\n      }\n\n      function onResize() {\n        sideMenuCtrl.activeAsideResizing(true);\n        debouncedCheck();\n      }\n\n      var debouncedCheck = ionic.debounce(function() {\n        $scope.$apply(checkAsideExpose);\n      }, 300, false);\n\n      $scope.$evalAsync(checkAsideExpose);\n    }\n  };\n}]);\n\nvar GESTURE_DIRECTIVES = 'onHold onTap onDoubleTap onTouch onRelease onDragStart onDrag onDragEnd onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeDown onSwipeLeft'.split(' ');\n\nGESTURE_DIRECTIVES.forEach(function(name) {\n  IonicModule.directive(name, gestureDirective(name));\n});\n\n\n/**\n * @ngdoc directive\n * @name onHold\n * @module ionic\n * @restrict A\n *\n * @description\n * Touch stays at the same location for 500ms. Similar to long touch events available for AngularJS and jQuery.\n *\n * @usage\n * ```html\n * <button on-hold=\"onHold()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTap\n * @module ionic\n * @restrict A\n *\n * @description\n * Quick touch at a location. If the duration of the touch goes\n * longer than 250ms it is no longer a tap gesture.\n *\n * @usage\n * ```html\n * <button on-tap=\"onTap()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDoubleTap\n * @module ionic\n * @restrict A\n *\n * @description\n * Double tap touch at a location.\n *\n * @usage\n * ```html\n * <button on-double-tap=\"onDoubleTap()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTouch\n * @module ionic\n * @restrict A\n *\n * @description\n * Called immediately when the user first begins a touch. This\n * gesture does not wait for a touchend/mouseup.\n *\n * @usage\n * ```html\n * <button on-touch=\"onTouch()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onRelease\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the user ends a touch.\n *\n * @usage\n * ```html\n * <button on-release=\"onRelease()\" class=\"button\">Test</button>\n * ```\n */\n\n/**\n * @ngdoc directive\n * @name onDragStart\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a drag gesture has started.\n *\n * @usage\n * ```html\n * <button on-drag-start=\"onDragStart()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDrag\n * @module ionic\n * @restrict A\n *\n * @description\n * Move with one touch around on the page. Blocking the scrolling when\n * moving left and right is a good practice. When all the drag events are\n * blocking you disable scrolling on that area.\n *\n * @usage\n * ```html\n * <button on-drag=\"onDrag()\" class=\"button\">Test</button>\n * ```\n */\n\n/**\n * @ngdoc directive\n * @name onDragEnd\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a drag gesture has ended.\n *\n * @usage\n * ```html\n * <button on-drag-end=\"onDragEnd()\" class=\"button\">Test</button>\n * ```\n */\n\n/**\n * @ngdoc directive\n * @name onDragUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged up.\n *\n * @usage\n * ```html\n * <button on-drag-up=\"onDragUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the right.\n *\n * @usage\n * ```html\n * <button on-drag-right=\"onDragRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged down.\n *\n * @usage\n * ```html\n * <button on-drag-down=\"onDragDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the left.\n *\n * @usage\n * ```html\n * <button on-drag-left=\"onDragLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipe\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity in any direction.\n *\n * @usage\n * ```html\n * <button on-swipe=\"onSwipe()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving up.\n *\n * @usage\n * ```html\n * <button on-swipe-up=\"onSwipeUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the right.\n *\n * @usage\n * ```html\n * <button on-swipe-right=\"onSwipeRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving down.\n *\n * @usage\n * ```html\n * <button on-swipe-down=\"onSwipeDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the left.\n *\n * @usage\n * ```html\n * <button on-swipe-left=\"onSwipeLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\nfunction gestureDirective(directiveName) {\n  return ['$ionicGesture', '$parse', function($ionicGesture, $parse) {\n    var eventType = directiveName.substr(2).toLowerCase();\n\n    return function(scope, element, attr) {\n      var fn = $parse( attr[directiveName] );\n\n      var listener = function(ev) {\n        scope.$apply(function() {\n          fn(scope, {\n            $event: ev\n          });\n        });\n      };\n\n      var gesture = $ionicGesture.on(eventType, listener, element);\n\n      scope.$on('$destroy', function() {\n        $ionicGesture.off(gesture, eventType, listener);\n      });\n    };\n  }];\n}\n\n\nIonicModule\n//.directive('ionHeaderBar', tapScrollToTopDirective())\n\n/**\n * @ngdoc directive\n * @name ionHeaderBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed header bar above some content.\n *\n * Can also be a subheader (lower down) if the 'bar-subheader' class is applied.\n * See [the header CSS docs](/docs/components/#subheader).\n *\n * @param {string=} align-title How to align the title. By default the title\n * will be aligned the same as how the platform aligns its titles (iOS centers\n * titles, Android aligns them left).\n * Available: 'left', 'right', or 'center'.  Defaults to the same as the platform.\n * @param {boolean=} no-tap-scroll By default, the header bar will scroll the\n * content to the top when tapped.  Set no-tap-scroll to true to disable this\n * behavior.\n * Available: true or false.  Defaults to false.\n *\n * @usage\n * ```html\n * <ion-header-bar align-title=\"left\" class=\"bar-positive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\" ng-click=\"doSomething()\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-header-bar>\n * <ion-content class=\"has-header\">\n *   Some content!\n * </ion-content>\n * ```\n */\n.directive('ionHeaderBar', headerFooterBarDirective(true))\n\n/**\n * @ngdoc directive\n * @name ionFooterBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed footer bar below some content.\n *\n * Can also be a subfooter (higher up) if the 'bar-subfooter' class is applied.\n * See [the footer CSS docs](/docs/components/#footer).\n *\n * Note: If you use ionFooterBar in combination with ng-if, the surrounding content\n * will not align correctly.  This will be fixed soon.\n *\n * @param {string=} align-title Where to align the title.\n * Available: 'left', 'right', or 'center'.  Defaults to 'center'.\n *\n * @usage\n * ```html\n * <ion-content class=\"has-footer\">\n *   Some content!\n * </ion-content>\n * <ion-footer-bar align-title=\"left\" class=\"bar-assertive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\" ng-click=\"doSomething()\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-footer-bar>\n * ```\n */\n.directive('ionFooterBar', headerFooterBarDirective(false));\n\nfunction tapScrollToTopDirective() { //eslint-disable-line no-unused-vars\n  return ['$ionicScrollDelegate', function($ionicScrollDelegate) {\n    return {\n      restrict: 'E',\n      link: function($scope, $element, $attr) {\n        if ($attr.noTapScroll == 'true') {\n          return;\n        }\n        ionic.on('tap', onTap, $element[0]);\n        $scope.$on('$destroy', function() {\n          ionic.off('tap', onTap, $element[0]);\n        });\n\n        function onTap(e) {\n          var depth = 3;\n          var current = e.target;\n          //Don't scroll to top in certain cases\n          while (depth-- && current) {\n            if (current.classList.contains('button') ||\n                current.tagName.match(/input|textarea|select/i) ||\n                current.isContentEditable) {\n              return;\n            }\n            current = current.parentNode;\n          }\n          var touch = e.gesture && e.gesture.touches[0] || e.detail.touches[0];\n          var bounds = $element[0].getBoundingClientRect();\n          if (ionic.DomUtil.rectContains(\n            touch.pageX, touch.pageY,\n            bounds.left, bounds.top - 20,\n            bounds.left + bounds.width, bounds.top + bounds.height\n          )) {\n            $ionicScrollDelegate.scrollTop(true);\n          }\n        }\n      }\n    };\n  }];\n}\n\nfunction headerFooterBarDirective(isHeader) {\n  return ['$document', '$timeout', function($document, $timeout) {\n    return {\n      restrict: 'E',\n      controller: '$ionicHeaderBar',\n      compile: function(tElement) {\n        tElement.addClass(isHeader ? 'bar bar-header' : 'bar bar-footer');\n        // top style tabs? if so, remove bottom border for seamless display\n        $timeout(function() {\n          if (isHeader && $document[0].getElementsByClassName('tabs-top').length) tElement.addClass('has-tabs-top');\n        });\n\n        return { pre: prelink };\n        function prelink($scope, $element, $attr, ctrl) {\n          if (isHeader) {\n            $scope.$watch(function() { return $element[0].className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubheader = value.indexOf('bar-subheader') !== -1;\n              $scope.$hasHeader = isShown && !isSubheader;\n              $scope.$hasSubheader = isShown && isSubheader;\n              $scope.$emit('$ionicSubheader', $scope.$hasSubheader);\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasHeader;\n              delete $scope.$hasSubheader;\n            });\n            ctrl.align();\n            $scope.$on('$ionicHeader.align', function() {\n              ionic.requestAnimationFrame(function() {\n                ctrl.align();\n              });\n            });\n\n          } else {\n            $scope.$watch(function() { return $element[0].className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubfooter = value.indexOf('bar-subfooter') !== -1;\n              $scope.$hasFooter = isShown && !isSubfooter;\n              $scope.$hasSubfooter = isShown && isSubfooter;\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasFooter;\n              delete $scope.$hasSubfooter;\n            });\n            $scope.$watch('$hasTabs', function(val) {\n              $element.toggleClass('has-tabs', !!val);\n            });\n            ctrl.align();\n            $scope.$on('$ionicFooter.align', function() {\n              ionic.requestAnimationFrame(function() {\n                ctrl.align();\n              });\n            });\n          }\n        }\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ionInfiniteScroll\n * @module ionic\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @restrict E\n *\n * @description\n * The ionInfiniteScroll directive allows you to call a function whenever\n * the user gets to the bottom of the page or near the bottom of the page.\n *\n * The expression you pass in for `on-infinite` is called when the user scrolls\n * greater than `distance` away from the bottom of the content.  Once `on-infinite`\n * is done loading new data, it should broadcast the `scroll.infiniteScrollComplete`\n * event from your controller (see below example).\n *\n * @param {expression} on-infinite What to call when the scroller reaches the\n * bottom.\n * @param {string=} distance The distance from the bottom that the scroll must\n * reach to trigger the on-infinite expression. Default: 1%.\n * @param {string=} spinner The {@link ionic.directive:ionSpinner} to show while loading. The SVG\n * {@link ionic.directive:ionSpinner} is now the default, replacing rotating font icons.\n * @param {string=} icon The icon to show while loading. Default: 'ion-load-d'.  This is depreicated\n * in favor of the SVG {@link ionic.directive:ionSpinner}.\n * @param {boolean=} immediate-check Whether to check the infinite scroll bounds immediately on load.\n *\n * @usage\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-list>\n *   ....\n *   ....\n *   </ion-list>\n *\n *   <ion-infinite-scroll\n *     on-infinite=\"loadMore()\"\n *     distance=\"1%\">\n *   </ion-infinite-scroll>\n * </ion-content>\n * ```\n * ```js\n * function MyController($scope, $http) {\n *   $scope.items = [];\n *   $scope.loadMore = function() {\n *     $http.get('/more-items').success(function(items) {\n *       useItems(items);\n *       $scope.$broadcast('scroll.infiniteScrollComplete');\n *     });\n *   };\n *\n *   $scope.$on('$stateChangeSuccess', function() {\n *     $scope.loadMore();\n *   });\n * }\n * ```\n *\n * An easy to way to stop infinite scroll once there is no more data to load\n * is to use angular's `ng-if` directive:\n *\n * ```html\n * <ion-infinite-scroll\n *   ng-if=\"moreDataCanBeLoaded()\"\n *   icon=\"ion-loading-c\"\n *   on-infinite=\"loadMoreData()\">\n * </ion-infinite-scroll>\n * ```\n */\nIonicModule\n.directive('ionInfiniteScroll', ['$timeout', function($timeout) {\n  return {\n    restrict: 'E',\n    require: ['?^$ionicScroll', 'ionInfiniteScroll'],\n    template: function($element, $attrs) {\n      if ($attrs.icon) return '<i class=\"icon {{icon()}} icon-refreshing {{scrollingType}}\"></i>';\n      return '<ion-spinner icon=\"{{spinner()}}\"></ion-spinner>';\n    },\n    scope: true,\n    controller: '$ionInfiniteScroll',\n    link: function($scope, $element, $attrs, ctrls) {\n      var infiniteScrollCtrl = ctrls[1];\n      var scrollCtrl = infiniteScrollCtrl.scrollCtrl = ctrls[0];\n      var jsScrolling = infiniteScrollCtrl.jsScrolling = !scrollCtrl.isNative();\n\n      // if this view is not beneath a scrollCtrl, it can't be injected, proceed w/ native scrolling\n      if (jsScrolling) {\n        infiniteScrollCtrl.scrollView = scrollCtrl.scrollView;\n        $scope.scrollingType = 'js-scrolling';\n        //bind to JS scroll events\n        scrollCtrl.$element.on('scroll', infiniteScrollCtrl.checkBounds);\n      } else {\n        // grabbing the scrollable element, to determine dimensions, and current scroll pos\n        var scrollEl = ionic.DomUtil.getParentOrSelfWithClass($element[0].parentNode, 'overflow-scroll');\n        infiniteScrollCtrl.scrollEl = scrollEl;\n        // if there's no scroll controller, and no overflow scroll div, infinite scroll wont work\n        if (!scrollEl) {\n          throw 'Infinite scroll must be used inside a scrollable div';\n        }\n        //bind to native scroll events\n        infiniteScrollCtrl.scrollEl.addEventListener('scroll', infiniteScrollCtrl.checkBounds);\n      }\n\n      // Optionally check bounds on start after scrollView is fully rendered\n      var doImmediateCheck = isDefined($attrs.immediateCheck) ? $scope.$eval($attrs.immediateCheck) : true;\n      if (doImmediateCheck) {\n        $timeout(function() { infiniteScrollCtrl.checkBounds(); });\n      }\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionInput\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n* Creates a text input group that can easily be focused\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-input>\n*     <input type=\"text\" placeholder=\"First Name\">\n*   </ion-input>\n*\n*   <ion-input>\n*     <ion-label>Username</ion-label>\n*     <input type=\"text\">\n*   </ion-input>\n* </ion-list>\n* ```\n*/\n\nvar labelIds = -1;\n\nIonicModule\n.directive('ionInput', [function() {\n  return {\n    restrict: 'E',\n    controller: ['$scope', '$element', function($scope, $element) {\n      this.$scope = $scope;\n      this.$element = $element;\n\n      this.setInputAriaLabeledBy = function(id) {\n        var inputs = $element[0].querySelectorAll('input,textarea');\n        inputs.length && inputs[0].setAttribute('aria-labelledby', id);\n      };\n\n      this.focus = function() {\n        var inputs = $element[0].querySelectorAll('input,textarea');\n        inputs.length && inputs[0].focus();\n      };\n    }]\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionLabel\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n*\n* New in Ionic 1.2. It is strongly recommended that you use `<ion-label>` in place\n* of any `<label>` elements for maximum cross-browser support and performance.\n*\n* Creates a label for a form input.\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-input>\n*     <ion-label>Username</ion-label>\n*     <input type=\"text\">\n*   </ion-input>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionLabel', [function() {\n  return {\n    restrict: 'E',\n    require: '?^ionInput',\n    compile: function() {\n\n      return function link($scope, $element, $attrs, ionInputCtrl) {\n        var element = $element[0];\n\n        $element.addClass('input-label');\n\n        $element.attr('aria-label', $element.text());\n        var id = element.id || '_label-' + ++labelIds;\n\n        if (!element.id) {\n          $element.attr('id', id);\n        }\n\n        if (ionInputCtrl) {\n\n          ionInputCtrl.setInputAriaLabeledBy(id);\n\n          $element.on('click', function() {\n            ionInputCtrl.focus();\n          });\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * Input label adds accessibility to <span class=\"input-label\">.\n */\nIonicModule\n.directive('inputLabel', [function() {\n  return {\n    restrict: 'C',\n    require: '?^ionInput',\n    compile: function() {\n\n      return function link($scope, $element, $attrs, ionInputCtrl) {\n        var element = $element[0];\n\n        $element.attr('aria-label', $element.text());\n        var id = element.id || '_label-' + ++labelIds;\n\n        if (!element.id) {\n          $element.attr('id', id);\n        }\n\n        if (ionInputCtrl) {\n          ionInputCtrl.setInputAriaLabeledBy(id);\n        }\n\n      };\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionItem\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n* Creates a list-item that can easily be swiped,\n* deleted, reordered, edited, and more.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* Can be assigned any item class name. See the\n* [list CSS documentation](/docs/components/#list).\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>Hello!</ion-item>\n*   <ion-item href=\"#/detail\">\n*     Link to detail page\n*   </ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionItem', ['$$rAF', function($$rAF) {\n  return {\n    restrict: 'E',\n    controller: ['$scope', '$element', function($scope, $element) {\n      this.$scope = $scope;\n      this.$element = $element;\n    }],\n    scope: true,\n    compile: function($element, $attrs) {\n      var isAnchor = isDefined($attrs.href) ||\n                     isDefined($attrs.ngHref) ||\n                     isDefined($attrs.uiSref);\n      var isComplexItem = isAnchor ||\n        //Lame way of testing, but we have to know at compile what to do with the element\n        /ion-(delete|option|reorder)-button/i.test($element.html());\n\n      if (isComplexItem) {\n        var innerElement = jqLite(isAnchor ? '<a></a>' : '<div></div>');\n        innerElement.addClass('item-content');\n\n        if (isDefined($attrs.href) || isDefined($attrs.ngHref)) {\n          innerElement.attr('ng-href', '{{$href()}}');\n          if (isDefined($attrs.target)) {\n            innerElement.attr('target', '{{$target()}}');\n          }\n        }\n\n        innerElement.append($element.contents());\n\n        $element.addClass('item item-complex')\n                .append(innerElement);\n      } else {\n        $element.addClass('item');\n      }\n\n      return function link($scope, $element, $attrs) {\n        $scope.$href = function() {\n          return $attrs.href || $attrs.ngHref;\n        };\n        $scope.$target = function() {\n          return $attrs.target;\n        };\n\n        var content = $element[0].querySelector('.item-content');\n        if (content) {\n          $scope.$on('$collectionRepeatLeave', function() {\n            if (content && content.$$ionicOptionsOpen) {\n              content.style[ionic.CSS.TRANSFORM] = '';\n              content.style[ionic.CSS.TRANSITION] = 'none';\n              $$rAF(function() {\n                content.style[ionic.CSS.TRANSITION] = '';\n              });\n              content.$$ionicOptionsOpen = false;\n            }\n          });\n        }\n      };\n\n    }\n  };\n}]);\n\nvar ITEM_TPL_DELETE_BUTTON =\n  '<div class=\"item-left-edit item-delete enable-pointer-events\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionDeleteButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a delete button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-delete` evaluates to true or\n* `$ionicListDelegate.showDelete(true)` is called.\n*\n* Takes any ionicon as a class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list show-delete=\"shouldShowDelete\">\n*   <ion-item>\n*     <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n*     Hello, list item!\n*   </ion-item>\n* </ion-list>\n* <ion-toggle ng-model=\"shouldShowDelete\">\n*   Show Delete?\n* </ion-toggle>\n* ```\n*/\nIonicModule\n.directive('ionDeleteButton', function() {\n\n  function stopPropagation(ev) {\n    ev.stopPropagation();\n  }\n\n  return {\n    restrict: 'E',\n    require: ['^^ionItem', '^?ionList'],\n    //Run before anything else, so we can move it before other directives process\n    //its location (eg ngIf relies on the location of the directive in the dom)\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      //Add the classes we need during the compile phase, so that they stay\n      //even if something else like ngIf removes the element and re-addss it\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var container = jqLite(ITEM_TPL_DELETE_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-left-editable');\n\n        //Don't bubble click up to main .item\n        $element.on('click', stopPropagation);\n\n        init();\n        $scope.$on('$ionic.reconnectScope', init);\n        function init() {\n          listCtrl = listCtrl || $element.controller('ionList');\n          if (listCtrl && listCtrl.showDelete()) {\n            container.addClass('visible active');\n          }\n        }\n      };\n    }\n  };\n});\n\n\nIonicModule\n.directive('itemFloatingLabel', function() {\n  return {\n    restrict: 'C',\n    link: function(scope, element) {\n      var el = element[0];\n      var input = el.querySelector('input, textarea');\n      var inputLabel = el.querySelector('.input-label');\n\n      if (!input || !inputLabel) return;\n\n      var onInput = function() {\n        if (input.value) {\n          inputLabel.classList.add('has-input');\n        } else {\n          inputLabel.classList.remove('has-input');\n        }\n      };\n\n      input.addEventListener('input', onInput);\n\n      var ngModelCtrl = jqLite(input).controller('ngModel');\n      if (ngModelCtrl) {\n        ngModelCtrl.$render = function() {\n          input.value = ngModelCtrl.$viewValue || '';\n          onInput();\n        };\n      }\n\n      scope.$on('$destroy', function() {\n        input.removeEventListener('input', onInput);\n      });\n    }\n  };\n});\n\nvar ITEM_TPL_OPTION_BUTTONS =\n  '<div class=\"item-options invisible\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionOptionButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* @description\n* Creates an option button inside a list item, that is visible when the item is swiped\n* to the left by the user.  Swiped open option buttons can be hidden with\n* {@link ionic.service:$ionicListDelegate#closeOptionButtons $ionicListDelegate.closeOptionButtons}.\n*\n* Can be assigned any button class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>\n*     I love kittens!\n*     <ion-option-button class=\"button-positive\">Share</ion-option-button>\n*     <ion-option-button class=\"button-assertive\">Edit</ion-option-button>\n*   </ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule.directive('ionOptionButton', [function() {\n  function stopPropagation(e) {\n    e.stopPropagation();\n  }\n  return {\n    restrict: 'E',\n    require: '^ionItem',\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button', true);\n      return function($scope, $element, $attr, itemCtrl) {\n        if (!itemCtrl.optionsContainer) {\n          itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS);\n          itemCtrl.$element.append(itemCtrl.optionsContainer);\n        }\n        itemCtrl.optionsContainer.append($element);\n\n        itemCtrl.$element.addClass('item-right-editable');\n\n        //Don't bubble click up to main .item\n        $element.on('click', stopPropagation);\n      };\n    }\n  };\n}]);\n\nvar ITEM_TPL_REORDER_BUTTON =\n  '<div data-prevent-scroll=\"true\" class=\"item-right-edit item-reorder enable-pointer-events\">' +\n  '</div>';\n\n/**\n* @ngdoc directive\n* @name ionReorderButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a reorder button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-reorder` evaluates to true or\n* `$ionicListDelegate.showReorder(true)` is called.\n*\n* Can be dragged to reorder items in the list. Takes any ionicon class.\n*\n* Note: Reordering works best when used with `ng-repeat`.  Be sure that all `ion-item` children of an `ion-list` are part of the same `ng-repeat` expression.\n*\n* When an item reorder is complete, the expression given in the `on-reorder` attribute is called. The `on-reorder` expression is given two locals that can be used: `$fromIndex` and `$toIndex`.  See below for an example.\n*\n* Look at {@link ionic.directive:ionList} for more examples.\n*\n* @usage\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\" show-reorder=\"true\">\n*   <ion-item ng-repeat=\"item in items\">\n*     Item {{item}}\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"moveItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*   </ion-item>\n* </ion-list>\n* ```\n* ```js\n* function MyCtrl($scope) {\n*   $scope.items = [1, 2, 3, 4];\n*   $scope.moveItem = function(item, fromIndex, toIndex) {\n*     //Move the item in the array\n*     $scope.items.splice(fromIndex, 1);\n*     $scope.items.splice(toIndex, 0, item);\n*   };\n* }\n* ```\n*\n* @param {expression=} on-reorder Expression to call when an item is reordered.\n* Parameters given: $fromIndex, $toIndex.\n*/\nIonicModule\n.directive('ionReorderButton', ['$parse', function($parse) {\n  return {\n    restrict: 'E',\n    require: ['^ionItem', '^?ionList'],\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      $element[0].setAttribute('data-prevent-scroll', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var onReorderFn = $parse($attr.onReorder);\n\n        $scope.$onReorder = function(oldIndex, newIndex) {\n          onReorderFn($scope, {\n            $fromIndex: oldIndex,\n            $toIndex: newIndex\n          });\n        };\n\n        // prevent clicks from bubbling up to the item\n        if (!$attr.ngClick && !$attr.onClick && !$attr.onclick) {\n          $element[0].onclick = function(e) {\n            e.stopPropagation();\n            return false;\n          };\n        }\n\n        var container = jqLite(ITEM_TPL_REORDER_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-right-editable');\n\n        if (listCtrl && listCtrl.showReorder()) {\n          container.addClass('visible active');\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name keyboardAttach\n * @module ionic\n * @restrict A\n *\n * @description\n * keyboard-attach is an attribute directive which will cause an element to float above\n * the keyboard when the keyboard shows. Currently only supports the\n * [ion-footer-bar]({{ page.versionHref }}/api/directive/ionFooterBar/) directive.\n *\n * ### Notes\n * - This directive requires the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard).\n * - On Android not in fullscreen mode, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"false\" />` or no preference in your `config.xml` file,\n *   this directive is unnecessary since it is the default behavior.\n * - On iOS, if there is an input in your footer, you will need to set\n *   `cordova.plugins.Keyboard.disableScroll(true)`.\n *\n * @usage\n *\n * ```html\n *  <ion-footer-bar align-title=\"left\" keyboard-attach class=\"bar-assertive\">\n *    <h1 class=\"title\">Title!</h1>\n *  </ion-footer-bar>\n * ```\n */\n\nIonicModule\n.directive('keyboardAttach', function() {\n  return function(scope, element) {\n    ionic.on('native.keyboardshow', onShow, window);\n    ionic.on('native.keyboardhide', onHide, window);\n\n    //deprecated\n    ionic.on('native.showkeyboard', onShow, window);\n    ionic.on('native.hidekeyboard', onHide, window);\n\n\n    var scrollCtrl;\n\n    function onShow(e) {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      //for testing\n      var keyboardHeight = e.keyboardHeight || (e.detail && e.detail.keyboardHeight);\n      element.css('bottom', keyboardHeight + \"px\");\n      scrollCtrl = element.controller('$ionicScroll');\n      if (scrollCtrl) {\n        scrollCtrl.scrollView.__container.style.bottom = keyboardHeight + keyboardAttachGetClientHeight(element[0]) + \"px\";\n      }\n    }\n\n    function onHide() {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      element.css('bottom', '');\n      if (scrollCtrl) {\n        scrollCtrl.scrollView.__container.style.bottom = '';\n      }\n    }\n\n    scope.$on('$destroy', function() {\n      ionic.off('native.keyboardshow', onShow, window);\n      ionic.off('native.keyboardhide', onHide, window);\n\n      //deprecated\n      ionic.off('native.showkeyboard', onShow, window);\n      ionic.off('native.hidekeyboard', onHide, window);\n    });\n  };\n});\n\nfunction keyboardAttachGetClientHeight(element) {\n  return element.clientHeight;\n}\n\n/**\n* @ngdoc directive\n* @name ionList\n* @module ionic\n* @delegate ionic.service:$ionicListDelegate\n* @codepen JsHjf\n* @restrict E\n* @description\n* The List is a widely used interface element in almost any mobile app, and can include\n* content ranging from basic text all the way to buttons, toggles, icons, and thumbnails.\n*\n* Both the list, which contains items, and the list items themselves can be any HTML\n* element. The containing element requires the `list` class and each list item requires\n* the `item` class.\n*\n* However, using the ionList and ionItem directives make it easy to support various\n* interaction modes such as swipe to edit, drag to reorder, and removing items.\n*\n* Related: {@link ionic.directive:ionItem}, {@link ionic.directive:ionOptionButton}\n* {@link ionic.directive:ionReorderButton}, {@link ionic.directive:ionDeleteButton}, [`list CSS documentation`](/docs/components/#list).\n*\n* @usage\n*\n* Basic Usage:\n*\n* ```html\n* <ion-list>\n*   <ion-item ng-repeat=\"item in items\">\n*     {% raw %}Hello, {{item}}!{% endraw %}\n*   </ion-item>\n* </ion-list>\n* ```\n*\n* Advanced Usage: Thumbnails, Delete buttons, Reordering, Swiping\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\"\n*           show-delete=\"shouldShowDelete\"\n*           show-reorder=\"shouldShowReorder\"\n*           can-swipe=\"listCanSwipe\">\n*   <ion-item ng-repeat=\"item in items\"\n*             class=\"item-thumbnail-left\">\n*\n*     {% raw %}<img ng-src=\"{{item.img}}\">\n*     <h2>{{item.title}}</h2>\n*     <p>{{item.description}}</p>{% endraw %}\n*     <ion-option-button class=\"button-positive\"\n*                        ng-click=\"share(item)\">\n*       Share\n*     </ion-option-button>\n*     <ion-option-button class=\"button-info\"\n*                        ng-click=\"edit(item)\">\n*       Edit\n*     </ion-option-button>\n*     <ion-delete-button class=\"ion-minus-circled\"\n*                        ng-click=\"items.splice($index, 1)\">\n*     </ion-delete-button>\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"reorderItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*\n*   </ion-item>\n* </ion-list>\n* ```\n*\n*```javascript\n* app.controller('MyCtrl', function($scope) {\n*  $scope.shouldShowDelete = false;\n*  $scope.shouldShowReorder = false;\n*  $scope.listCanSwipe = true\n* });\n*```\n*\n* @param {string=} delegate-handle The handle used to identify this list with\n* {@link ionic.service:$ionicListDelegate}.\n* @param type {string=} The type of list to use (list-inset or card)\n* @param show-delete {boolean=} Whether the delete buttons for the items in the list are\n* currently shown or hidden.\n* @param show-reorder {boolean=} Whether the reorder buttons for the items in the list are\n* currently shown or hidden.\n* @param can-swipe {boolean=} Whether the items in the list are allowed to be swiped to reveal\n* option buttons. Default: true.\n*/\nIonicModule\n.directive('ionList', [\n  '$timeout',\nfunction($timeout) {\n  return {\n    restrict: 'E',\n    require: ['ionList', '^?$ionicScroll'],\n    controller: '$ionicList',\n    compile: function($element, $attr) {\n      var listEl = jqLite('<div class=\"list\">')\n        .append($element.contents())\n        .addClass($attr.type);\n\n      $element.append(listEl);\n\n      return function($scope, $element, $attrs, ctrls) {\n        var listCtrl = ctrls[0];\n        var scrollCtrl = ctrls[1];\n\n        // Wait for child elements to render...\n        $timeout(init);\n\n        function init() {\n          var listView = listCtrl.listView = new ionic.views.ListView({\n            el: $element[0],\n            listEl: $element.children()[0],\n            scrollEl: scrollCtrl && scrollCtrl.element,\n            scrollView: scrollCtrl && scrollCtrl.scrollView,\n            onReorder: function(el, oldIndex, newIndex) {\n              var itemScope = jqLite(el).scope();\n              if (itemScope && itemScope.$onReorder) {\n                // Make sure onReorder is called in apply cycle,\n                // but also make sure it has no conflicts by doing\n                // $evalAsync\n                $timeout(function() {\n                  itemScope.$onReorder(oldIndex, newIndex);\n                });\n              }\n            },\n            canSwipe: function() {\n              return listCtrl.canSwipeItems();\n            }\n          });\n\n          $scope.$on('$destroy', function() {\n            if (listView) {\n              listView.deregister && listView.deregister();\n              listView = null;\n            }\n          });\n\n          if (isDefined($attr.canSwipe)) {\n            $scope.$watch('!!(' + $attr.canSwipe + ')', function(value) {\n              listCtrl.canSwipeItems(value);\n            });\n          }\n          if (isDefined($attr.showDelete)) {\n            $scope.$watch('!!(' + $attr.showDelete + ')', function(value) {\n              listCtrl.showDelete(value);\n            });\n          }\n          if (isDefined($attr.showReorder)) {\n            $scope.$watch('!!(' + $attr.showReorder + ')', function(value) {\n              listCtrl.showReorder(value);\n            });\n          }\n\n          $scope.$watch(function() {\n            return listCtrl.showDelete();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-left-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var deleteButton = jqLite($element[0].getElementsByClassName('item-delete'));\n            setButtonShown(deleteButton, listCtrl.showDelete);\n          });\n\n          $scope.$watch(function() {\n            return listCtrl.showReorder();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-right-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var reorderButton = jqLite($element[0].getElementsByClassName('item-reorder'));\n            setButtonShown(reorderButton, listCtrl.showReorder);\n          });\n\n          function setButtonShown(el, shown) {\n            shown() && el.addClass('visible') || el.removeClass('active');\n            ionic.requestAnimationFrame(function() {\n              shown() && el.addClass('active') || el.removeClass('visible');\n            });\n          }\n        }\n\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuClose\n * @module ionic\n * @restrict AC\n *\n * @description\n * `menu-close` is an attribute directive that closes a currently opened side menu.\n * Note that by default, navigation transitions will not animate between views when\n * the menu is open. Additionally, this directive will reset the entering view's\n * history stack, making the new page the root of the history stack. This is done\n * to replicate the user experience seen in most side menu implementations, which is\n * to not show the back button at the root of the stack and show only the\n * menu button. We recommend that you also use the `enable-menu-with-back-views=\"false\"`\n * {@link ionic.directive:ionSideMenus} attribute when using the menuClose directive.\n *\n * @usage\n * Below is an example of a link within a side menu. Tapping this link would\n * automatically close the currently opened menu.\n *\n * ```html\n * <a menu-close href=\"#/home\" class=\"item\">Home</a>\n * ```\n *\n * Note that if your destination state uses a resolve and that resolve asynchronously\n * takes longer than a standard transition (300ms), you'll need to set the\n * `nextViewOptions` manually as your resolve completes.\n *\n * ```js\n * $ionicHistory.nextViewOptions({\n *  historyRoot: true,\n *  disableAnimate: true,\n *  expire: 300\n * });\n * ```\n */\nIonicModule\n.directive('menuClose', ['$ionicHistory', '$timeout', function($ionicHistory, $timeout) {\n  return {\n    restrict: 'AC',\n    link: function($scope, $element) {\n      $element.bind('click', function() {\n        var sideMenuCtrl = $element.inheritedData('$ionSideMenusController');\n        if (sideMenuCtrl) {\n          $ionicHistory.nextViewOptions({\n            historyRoot: true,\n            disableAnimate: true,\n            expire: 300\n          });\n          // if no transition in 300ms, reset nextViewOptions\n          // the expire should take care of it, but will be cancelled in some\n          // cases. This directive is an exception to the rules of history.js\n          $timeout( function() {\n            $ionicHistory.nextViewOptions({\n              historyRoot: false,\n              disableAnimate: false\n            });\n          }, 300);\n          sideMenuCtrl.close();\n        }\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuToggle\n * @module ionic\n * @restrict AC\n *\n * @description\n * Toggle a side menu on the given side.\n *\n * @usage\n * Below is an example of a link within a nav bar. Tapping this button\n * would open the given side menu, and tapping it again would close it.\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-buttons side=\"left\">\n *    <!-- Toggle left side menu -->\n *    <button menu-toggle=\"left\" class=\"button button-icon icon ion-navicon\"></button>\n *   </ion-nav-buttons>\n *   <ion-nav-buttons side=\"right\">\n *    <!-- Toggle right side menu -->\n *    <button menu-toggle=\"right\" class=\"button button-icon icon ion-navicon\"></button>\n *   </ion-nav-buttons>\n * </ion-nav-bar>\n * ```\n *\n * ### Button Hidden On Child Views\n * By default, the menu toggle button will only appear on a root\n * level side-menu page. Navigating in to child views will hide the menu-\n * toggle button. They can be made visible on child pages by setting the\n * enable-menu-with-back-views attribute of the {@link ionic.directive:ionSideMenus}\n * directive to true.\n *\n * ```html\n * <ion-side-menus enable-menu-with-back-views=\"true\">\n * ```\n */\nIonicModule\n.directive('menuToggle', function() {\n  return {\n    restrict: 'AC',\n    link: function($scope, $element, $attr) {\n      $scope.$on('$ionicView.beforeEnter', function(ev, viewData) {\n        if (viewData.enableBack) {\n          var sideMenuCtrl = $element.inheritedData('$ionSideMenusController');\n          if (!sideMenuCtrl.enableMenuWithBackViews()) {\n            $element.addClass('hide');\n          }\n        } else {\n          $element.removeClass('hide');\n        }\n      });\n\n      $element.bind('click', function() {\n        var sideMenuCtrl = $element.inheritedData('$ionSideMenusController');\n        sideMenuCtrl && sideMenuCtrl.toggle($attr.menuToggle);\n      });\n    }\n  };\n});\n\n/*\n * We don't document the ionModal directive, we instead document\n * the $ionicModal service\n */\nIonicModule\n.directive('ionModal', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function() {}],\n    template: '<div class=\"modal-backdrop\">' +\n                '<div class=\"modal-backdrop-bg\"></div>' +\n                '<div class=\"modal-wrapper\" ng-transclude></div>' +\n              '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionModalView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.addClass('modal');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionNavBackButton\n * @module ionic\n * @restrict E\n * @parent ionNavBar\n * @description\n * Creates a back button inside an {@link ionic.directive:ionNavBar}.\n *\n * The back button will appear when the user is able to go back in the current navigation stack. By\n * default, the markup of the back button is automatically built using platform-appropriate defaults\n * (iOS back button icon on iOS and Android icon on Android).\n *\n * Additionally, the button is automatically set to `$ionicGoBack()` on click/tap. By default, the\n * app will navigate back one view when the back button is clicked.  More advanced behavior is also\n * possible, as outlined below.\n *\n * @usage\n *\n * Recommended markup for default settings:\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-back-button>\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n *\n * With custom inner markup, and automatically adds a default click action:\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-back-button class=\"button-clear\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n *\n * With custom inner markup and custom click action, using {@link ionic.service:$ionicHistory}:\n *\n * ```html\n * <ion-nav-bar ng-controller=\"MyCtrl\">\n *   <ion-nav-back-button class=\"button-clear\"\n *     ng-click=\"myGoBack()\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicHistory) {\n *   $scope.myGoBack = function() {\n *     $ionicHistory.goBack();\n *   };\n * }\n * ```\n */\nIonicModule\n.directive('ionNavBackButton', ['$ionicConfig', '$document', function($ionicConfig, $document) {\n  return {\n    restrict: 'E',\n    require: '^ionNavBar',\n    compile: function(tElement, tAttrs) {\n\n      // clone the back button, but as a <div>\n      var buttonEle = $document[0].createElement('button');\n      for (var n in tAttrs.$attr) {\n        buttonEle.setAttribute(tAttrs.$attr[n], tAttrs[n]);\n      }\n\n      if (!tAttrs.ngClick) {\n        buttonEle.setAttribute('ng-click', '$ionicGoBack()');\n      }\n\n      buttonEle.className = 'button back-button hide buttons ' + (tElement.attr('class') || '');\n      buttonEle.innerHTML = tElement.html() || '';\n\n      var childNode;\n      var hasIcon = hasIconClass(tElement[0]);\n      var hasInnerText;\n      var hasButtonText;\n      var hasPreviousTitle;\n\n      for (var x = 0; x < tElement[0].childNodes.length; x++) {\n        childNode = tElement[0].childNodes[x];\n        if (childNode.nodeType === 1) {\n          if (hasIconClass(childNode)) {\n            hasIcon = true;\n          } else if (childNode.classList.contains('default-title')) {\n            hasButtonText = true;\n          } else if (childNode.classList.contains('previous-title')) {\n            hasPreviousTitle = true;\n          }\n        } else if (!hasInnerText && childNode.nodeType === 3) {\n          hasInnerText = !!childNode.nodeValue.trim();\n        }\n      }\n\n      function hasIconClass(ele) {\n        return /ion-|icon/.test(ele.className);\n      }\n\n      var defaultIcon = $ionicConfig.backButton.icon();\n      if (!hasIcon && defaultIcon && defaultIcon !== 'none') {\n        buttonEle.innerHTML = '<i class=\"icon ' + defaultIcon + '\"></i> ' + buttonEle.innerHTML;\n        buttonEle.className += ' button-clear';\n      }\n\n      if (!hasInnerText) {\n        var buttonTextEle = $document[0].createElement('span');\n        buttonTextEle.className = 'back-text';\n\n        if (!hasButtonText && $ionicConfig.backButton.text()) {\n          buttonTextEle.innerHTML += '<span class=\"default-title\">' + $ionicConfig.backButton.text() + '</span>';\n        }\n        if (!hasPreviousTitle && $ionicConfig.backButton.previousTitleText()) {\n          buttonTextEle.innerHTML += '<span class=\"previous-title\"></span>';\n        }\n        buttonEle.appendChild(buttonTextEle);\n\n      }\n\n      tElement.attr('class', 'hide');\n      tElement.empty();\n\n      return {\n        pre: function($scope, $element, $attr, navBarCtrl) {\n          // only register the plain HTML, the navBarCtrl takes care of scope/compile/link\n          navBarCtrl.navElement('backButton', buttonEle.outerHTML);\n          buttonEle = null;\n        }\n      };\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionNavBar\n * @module ionic\n * @delegate ionic.service:$ionicNavBarDelegate\n * @restrict E\n *\n * @description\n * If we have an {@link ionic.directive:ionNavView} directive, we can also create an\n * `<ion-nav-bar>`, which will create a topbar that updates as the application state changes.\n *\n * We can add a back button by putting an {@link ionic.directive:ionNavBackButton} inside.\n *\n * We can add buttons depending on the currently visible view using\n * {@link ionic.directive:ionNavButtons}.\n *\n * Note that the ion-nav-bar element will only work correctly if your content has an\n * ionView around it.\n *\n * @usage\n *\n * ```html\n * <body ng-app=\"starter\">\n *   <!-- The nav bar that will be updated as we navigate -->\n *   <ion-nav-bar class=\"bar-positive\">\n *   </ion-nav-bar>\n *\n *   <!-- where the initial view template will be rendered -->\n *   <ion-nav-view>\n *     <ion-view>\n *       <ion-content>Hello!</ion-content>\n *     </ion-view>\n *   </ion-nav-view>\n * </body>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this navBar\n * with {@link ionic.service:$ionicNavBarDelegate}.\n * @param align-title {string=} Where to align the title of the navbar.\n * Available: 'left', 'right', 'center'. Defaults to 'center'.\n * @param {boolean=} no-tap-scroll By default, the navbar will scroll the content\n * to the top when tapped.  Set no-tap-scroll to true to disable this behavior.\n *\n * </table><br/>\n */\nIonicModule\n.directive('ionNavBar', function() {\n  return {\n    restrict: 'E',\n    controller: '$ionicNavBar',\n    scope: true,\n    link: function($scope, $element, $attr, ctrl) {\n      ctrl.init();\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionNavButtons\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * Use nav buttons to set the buttons on your {@link ionic.directive:ionNavBar}\n * from within an {@link ionic.directive:ionView}. This gives each\n * view template the ability to specify which buttons should show in the nav bar,\n * overriding any default buttons already placed in the nav bar.\n *\n * Any buttons you declare will be positioned on the navbar's corresponding side. Primary\n * buttons generally map to the left side of the header, and secondary buttons are\n * generally on the right side. However, their exact locations are platform-specific.\n * For example, in iOS, the primary buttons are on the far left of the header, and\n * secondary buttons are on the far right, with the header title centered between them.\n * For Android, however, both groups of buttons are on the far right of the header,\n * with the header title aligned left.\n *\n * We recommend always using `primary` and `secondary`, so the buttons correctly map\n * to the side familiar to users of each platform. However, in cases where buttons should\n * always be on an exact side, both `left` and `right` sides are still available. For\n * example, a toggle button for a left side menu should be on the left side; in this case,\n * we'd recommend using `side=\"left\"`, so it's always on the left, no matter the platform.\n *\n * ***Note*** that `ion-nav-buttons` must be immediate descendants of the `ion-view` or\n * `ion-nav-bar` element (basically, don't wrap it in another div).\n *\n * @usage\n * ```html\n * <ion-nav-bar>\n * </ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view>\n *     <ion-nav-buttons side=\"primary\">\n *       <button class=\"button\" ng-click=\"doSomething()\">\n *         I'm a button on the primary of the navbar!\n *       </button>\n *     </ion-nav-buttons>\n *     <ion-content>\n *       Some super content here!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * @param {string} side The side to place the buttons in the\n * {@link ionic.directive:ionNavBar}. Available sides: `primary`, `secondary`, `left`, and `right`.\n */\nIonicModule\n.directive('ionNavButtons', ['$document', function($document) {\n  return {\n    require: '^ionNavBar',\n    restrict: 'E',\n    compile: function(tElement, tAttrs) {\n      var side = 'left';\n\n      if (/^primary|secondary|right$/i.test(tAttrs.side || '')) {\n        side = tAttrs.side.toLowerCase();\n      }\n\n      var spanEle = $document[0].createElement('span');\n      spanEle.className = side + '-buttons';\n      spanEle.innerHTML = tElement.html();\n\n      var navElementType = side + 'Buttons';\n\n      tElement.attr('class', 'hide');\n      tElement.empty();\n\n      return {\n        pre: function($scope, $element, $attrs, navBarCtrl) {\n          // only register the plain HTML, the navBarCtrl takes care of scope/compile/link\n\n          var parentViewCtrl = $element.parent().data('$ionViewController');\n          if (parentViewCtrl) {\n            // if the parent is an ion-view, then these are ion-nav-buttons for JUST this ion-view\n            parentViewCtrl.navElement(navElementType, spanEle.outerHTML);\n\n          } else {\n            // these are buttons for all views that do not have their own ion-nav-buttons\n            navBarCtrl.navElement(navElementType, spanEle.outerHTML);\n          }\n\n          spanEle = null;\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name navDirection\n * @module ionic\n * @restrict A\n *\n * @description\n * The direction which the nav view transition should animate. Available options\n * are: `forward`, `back`, `enter`, `exit`, `swap`.\n *\n * @usage\n *\n * ```html\n * <a nav-direction=\"forward\" href=\"#/home\">Home</a>\n * ```\n */\nIonicModule\n.directive('navDirection', ['$ionicViewSwitcher', function($ionicViewSwitcher) {\n  return {\n    restrict: 'A',\n    priority: 1000,\n    link: function($scope, $element, $attr) {\n      $element.bind('click', function() {\n        $ionicViewSwitcher.nextDirection($attr.navDirection);\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionNavTitle\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n *\n * The nav title directive replaces an {@link ionic.directive:ionNavBar} title text with\n * custom HTML from within an {@link ionic.directive:ionView} template. This gives each\n * view the ability to specify its own custom title element, such as an image or any HTML,\n * rather than being text-only. Alternatively, text-only titles can be updated using the\n * `view-title` {@link ionic.directive:ionView} attribute.\n *\n * Note that `ion-nav-title` must be an immediate descendant of the `ion-view` or\n * `ion-nav-bar` element (basically don't wrap it in another div).\n *\n * @usage\n * ```html\n * <ion-nav-bar>\n * </ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view>\n *     <ion-nav-title>\n *       <img src=\"logo.svg\">\n *     </ion-nav-title>\n *     <ion-content>\n *       Some super content here!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n */\nIonicModule\n.directive('ionNavTitle', ['$document', function($document) {\n  return {\n    require: '^ionNavBar',\n    restrict: 'E',\n    compile: function(tElement, tAttrs) {\n      var navElementType = 'title';\n      var spanEle = $document[0].createElement('span');\n      for (var n in tAttrs.$attr) {\n        spanEle.setAttribute(tAttrs.$attr[n], tAttrs[n]);\n      }\n      spanEle.classList.add('nav-bar-title');\n      spanEle.innerHTML = tElement.html();\n\n      tElement.attr('class', 'hide');\n      tElement.empty();\n\n      return {\n        pre: function($scope, $element, $attrs, navBarCtrl) {\n          // only register the plain HTML, the navBarCtrl takes care of scope/compile/link\n\n          var parentViewCtrl = $element.parent().data('$ionViewController');\n          if (parentViewCtrl) {\n            // if the parent is an ion-view, then these are ion-nav-buttons for JUST this ion-view\n            parentViewCtrl.navElement(navElementType, spanEle.outerHTML);\n\n          } else {\n            // these are buttons for all views that do not have their own ion-nav-buttons\n            navBarCtrl.navElement(navElementType, spanEle.outerHTML);\n          }\n\n          spanEle = null;\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name navTransition\n * @module ionic\n * @restrict A\n *\n * @description\n * The transition type which the nav view transition should use when it animates.\n * Current, options are `ios`, `android`, and `none`. More options coming soon.\n *\n * @usage\n *\n * ```html\n * <a nav-transition=\"none\" href=\"#/home\">Home</a>\n * ```\n */\nIonicModule\n.directive('navTransition', ['$ionicViewSwitcher', function($ionicViewSwitcher) {\n  return {\n    restrict: 'A',\n    priority: 1000,\n    link: function($scope, $element, $attr) {\n      $element.bind('click', function() {\n        $ionicViewSwitcher.nextTransition($attr.navTransition);\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionNavView\n * @module ionic\n * @restrict E\n * @codepen odqCz\n *\n * @description\n * As a user navigates throughout your app, Ionic is able to keep track of their\n * navigation history. By knowing their history, transitions between views\n * correctly enter and exit using the platform's transition style. An additional\n * benefit to Ionic's navigation system is its ability to manage multiple\n * histories. For example, each tab can have it's own navigation history stack.\n *\n * Ionic uses the AngularUI Router module so app interfaces can be organized\n * into various \"states\". Like Angular's core $route service, URLs can be used\n * to control the views. However, the AngularUI Router provides a more powerful\n * state manager in that states are bound to named, nested, and parallel views,\n * allowing more than one template to be rendered on the same page.\n * Additionally, each state is not required to be bound to a URL, and data can\n * be pushed to each state which allows much flexibility.\n *\n * The ionNavView directive is used to render templates in your application. Each template\n * is part of a state. States are usually mapped to a url, and are defined programatically\n * using angular-ui-router (see [their docs](https://github.com/angular-ui/ui-router/wiki),\n * and remember to replace ui-view with ion-nav-view in examples).\n *\n * @usage\n * In this example, we will create a navigation view that contains our different states for the app.\n *\n * To do this, in our markup we use ionNavView top level directive. To display a header bar we use\n * the {@link ionic.directive:ionNavBar} directive that updates as we navigate through the\n * navigation stack.\n *\n * Next, we need to setup our states that will be rendered.\n *\n * ```js\n * var app = angular.module('myApp', ['ionic']);\n * app.config(function($stateProvider) {\n *   $stateProvider\n *   .state('index', {\n *     url: '/',\n *     templateUrl: 'home.html'\n *   })\n *   .state('music', {\n *     url: '/music',\n *     templateUrl: 'music.html'\n *   });\n * });\n * ```\n * Then on app start, $stateProvider will look at the url, see if it matches the index state,\n * and then try to load home.html into the `<ion-nav-view>`.\n *\n * Pages are loaded by the URLs given. One simple way to create templates in Angular is to put\n * them directly into your HTML file and use the `<script type=\"text/ng-template\">` syntax.\n * So here is one way to put home.html into our app:\n *\n * ```html\n * <script id=\"home\" type=\"text/ng-template\">\n *   <!-- The title of the ion-view will be shown on the navbar -->\n *   <ion-view view-title=\"Home\">\n *     <ion-content ng-controller=\"HomeCtrl\">\n *       <!-- The content of the page -->\n *       <a href=\"#/music\">Go to music page!</a>\n *     </ion-content>\n *   </ion-view>\n * </script>\n * ```\n *\n * This is good to do because the template will be cached for very fast loading, instead of\n * having to fetch them from the network.\n *\n * ## Caching\n *\n * By default, views are cached to improve performance. When a view is navigated away from, its\n * element is left in the DOM, and its scope is disconnected from the `$watch` cycle. When\n * navigating to a view that is already cached, its scope is then reconnected, and the existing\n * element that was left in the DOM becomes the active view. This also allows for the scroll\n * position of previous views to be maintained.\n *\n * Caching can be disabled and enabled in multiple ways. By default, Ionic will cache a maximum of\n * 10 views, and not only can this be configured, but apps can also explicitly state which views\n * should and should not be cached.\n *\n * Note that because we are caching these views, *we aren’t destroying scopes*. Instead, scopes\n * are being disconnected from the watch cycle. Because scopes are not being destroyed and\n * recreated, controllers are not loading again on a subsequent viewing. If the app/controller\n * needs to know when a view has entered or has left, then view events emitted from the\n * {@link ionic.directive:ionView} scope, such as `$ionicView.enter`, may be useful.\n *\n * By default, when navigating back in the history, the \"forward\" views are removed from the cache.\n * If you navigate forward to the same view again, it'll create a new DOM element and controller\n * instance. Basically, any forward views are reset each time. This can be configured using the\n * {@link ionic.provider:$ionicConfigProvider}:\n *\n * ```js\n * $ionicConfigProvider.views.forwardCache(true);\n * ```\n *\n * #### Disable cache globally\n *\n * The {@link ionic.provider:$ionicConfigProvider} can be used to set the maximum allowable views\n * which can be cached, but this can also be use to disable all caching by setting it to 0.\n *\n * ```js\n * $ionicConfigProvider.views.maxCache(0);\n * ```\n *\n * #### Disable cache within state provider\n *\n * ```js\n * $stateProvider.state('myState', {\n *    cache: false,\n *    url : '/myUrl',\n *    templateUrl : 'my-template.html'\n * })\n * ```\n *\n * #### Disable cache with an attribute\n *\n * ```html\n * <ion-view cache-view=\"false\" view-title=\"My Title!\">\n *   ...\n * </ion-view>\n * ```\n *\n *\n * ## AngularUI Router\n *\n * Please visit [AngularUI Router's docs](https://github.com/angular-ui/ui-router/wiki) for\n * more info. Below is a great video by the AngularUI Router team that may help to explain\n * how it all works:\n *\n * <iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/dqJRoh8MnBo\"\n * frameborder=\"0\" allowfullscreen></iframe>\n *\n * Note: We do not recommend using [resolve](https://github.com/angular-ui/ui-router/wiki#resolve)\n * of AngularUI Router. The recommended approach is to execute any logic needed before beginning the state transition.\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states. For more\n * information, see ui-router's\n * [ui-view documentation](http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.directive:ui-view).\n */\nIonicModule\n.directive('ionNavView', [\n  '$state',\n  '$ionicConfig',\nfunction($state, $ionicConfig) {\n  // IONIC's fork of Angular UI Router, v0.2.10\n  // the navView handles registering views in the history and how to transition between them\n  return {\n    restrict: 'E',\n    terminal: true,\n    priority: 2000,\n    transclude: true,\n    controller: '$ionicNavView',\n    compile: function(tElement, tAttrs, transclude) {\n\n      // a nav view element is a container for numerous views\n      tElement.addClass('view-container');\n      ionic.DomUtil.cachedAttr(tElement, 'nav-view-transition', $ionicConfig.views.transition());\n\n      return function($scope, $element, $attr, navViewCtrl) {\n        var latestLocals;\n\n        // Put in the compiled initial view\n        transclude($scope, function(clone) {\n          $element.append(clone);\n        });\n\n        var viewData = navViewCtrl.init();\n\n        // listen for $stateChangeSuccess\n        $scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        $scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        // initial load, ready go\n        updateView(true);\n\n\n        function updateView(firstTime) {\n          // get the current local according to the $state\n          var viewLocals = $state.$current && $state.$current.locals[viewData.name];\n\n          // do not update THIS nav-view if its is not the container for the given state\n          // if the viewLocals are the same as THIS latestLocals, then nothing to do\n          if (!viewLocals || (!firstTime && viewLocals === latestLocals)) return;\n\n          // update the latestLocals\n          latestLocals = viewLocals;\n          viewData.state = viewLocals.$$state;\n\n          // register, update and transition to the new view\n          navViewCtrl.register(viewLocals);\n        }\n\n      };\n    }\n  };\n}]);\n\nIonicModule\n\n.config(['$provide', function($provide) {\n  $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {\n    // drop the default ngClick directive\n    $delegate.shift();\n    return $delegate;\n  }]);\n}])\n\n/**\n * @private\n */\n.factory('$ionicNgClick', ['$parse', function($parse) {\n  return function(scope, element, clickExpr) {\n    var clickHandler = angular.isFunction(clickExpr) ?\n      clickExpr :\n      $parse(clickExpr);\n\n    element.on('click', function(event) {\n      scope.$apply(function() {\n        clickHandler(scope, {$event: (event)});\n      });\n    });\n\n    // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click\n    // something else nearby.\n    element.onclick = noop;\n  };\n}])\n\n.directive('ngClick', ['$ionicNgClick', function($ionicNgClick) {\n  return function(scope, element, attr) {\n    $ionicNgClick(scope, element, attr.ngClick);\n  };\n}])\n\n.directive('ionStopEvent', function() {\n  return {\n    restrict: 'A',\n    link: function(scope, element, attr) {\n      element.bind(attr.ionStopEvent, eventStopPropagation);\n    }\n  };\n});\nfunction eventStopPropagation(e) {\n  e.stopPropagation();\n}\n\n\n/**\n * @ngdoc directive\n * @name ionPane\n * @module ionic\n * @restrict E\n *\n * @description A simple container that fits content, with no side effects.  Adds the 'pane' class to the element.\n */\nIonicModule\n.directive('ionPane', function() {\n  return {\n    restrict: 'E',\n    link: function(scope, element) {\n      element.addClass('pane');\n    }\n  };\n});\n\n/*\n * We don't document the ionPopover directive, we instead document\n * the $ionicPopover service\n */\nIonicModule\n.directive('ionPopover', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function() {}],\n    template: '<div class=\"popover-backdrop\">' +\n                '<div class=\"popover-wrapper\" ng-transclude></div>' +\n              '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionPopoverView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.append(jqLite('<div class=\"popover-arrow\">'));\n      element.addClass('popover');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionRadio\n * @module ionic\n * @restrict E\n * @codepen saoBG\n * @description\n * The radio directive is no different than the HTML radio input, except it's styled differently.\n *\n * Radio behaves like [AngularJS radio](http://docs.angularjs.org/api/ng/input/input[radio]).\n *\n * @usage\n * ```html\n * <ion-radio ng-model=\"choice\" ng-value=\"'A'\">Choose A</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'B'\">Choose B</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'C'\">Choose C</ion-radio>\n * ```\n *\n * @param {string=} name The name of the radio input.\n * @param {expression=} value The value of the radio input.\n * @param {boolean=} disabled The state of the radio input.\n * @param {string=} icon The icon to use when the radio input is selected.\n * @param {expression=} ng-value Angular equivalent of the value attribute.\n * @param {expression=} ng-model The angular model for the radio input.\n * @param {boolean=} ng-disabled Angular equivalent of the disabled attribute.\n * @param {expression=} ng-change Triggers given expression when radio input's model changes\n */\nIonicModule\n.directive('ionRadio', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-radio\">' +\n        '<input type=\"radio\" name=\"radio-group\">' +\n        '<div class=\"radio-content\">' +\n          '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n          '<i class=\"radio-icon disable-pointer-events icon ion-checkmark\"></i>' +\n        '</div>' +\n      '</label>',\n\n    compile: function(element, attr) {\n      if (attr.icon) {\n        var iconElm = element.find('i');\n        iconElm.removeClass('ion-checkmark').addClass(attr.icon);\n      }\n\n      var input = element.find('input');\n      forEach({\n          'name': attr.name,\n          'value': attr.value,\n          'disabled': attr.disabled,\n          'ng-value': attr.ngValue,\n          'ng-model': attr.ngModel,\n          'ng-disabled': attr.ngDisabled,\n          'ng-change': attr.ngChange,\n          'ng-required': attr.ngRequired,\n          'required': attr.required\n      }, function(value, name) {\n        if (isDefined(value)) {\n            input.attr(name, value);\n          }\n      });\n\n      return function(scope, element, attr) {\n        scope.getValue = function() {\n          return scope.ngValue || attr.value;\n        };\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionRefresher\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @description\n * Allows you to add pull-to-refresh to a scrollView.\n *\n * Place it as the first child of your {@link ionic.directive:ionContent} or\n * {@link ionic.directive:ionScroll} element.\n *\n * When refreshing is complete, $broadcast the 'scroll.refreshComplete' event\n * from your controller.\n *\n * @usage\n *\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-refresher\n *     pulling-text=\"Pull to refresh...\"\n *     on-refresh=\"doRefresh()\">\n *   </ion-refresher>\n *   <ion-list>\n *     <ion-item ng-repeat=\"item in items\"></ion-item>\n *   </ion-list>\n * </ion-content>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $http) {\n *   $scope.items = [1,2,3];\n *   $scope.doRefresh = function() {\n *     $http.get('/new-items')\n *      .success(function(newItems) {\n *        $scope.items = newItems;\n *      })\n *      .finally(function() {\n *        // Stop the ion-refresher from spinning\n *        $scope.$broadcast('scroll.refreshComplete');\n *      });\n *   };\n * });\n * ```\n *\n * @param {expression=} on-refresh Called when the user pulls down enough and lets go\n * of the refresher.\n * @param {expression=} on-pulling Called when the user starts to pull down\n * on the refresher.\n * @param {string=} pulling-text The text to display while the user is pulling down.\n * @param {string=} pulling-icon The icon to display while the user is pulling down.\n * Default: 'ion-android-arrow-down'.\n * @param {string=} spinner The {@link ionic.directive:ionSpinner} icon to display\n * after user lets go of the refresher. The SVG {@link ionic.directive:ionSpinner}\n * is now the default, replacing rotating font icons. Set to `none` to disable both the\n * spinner and the icon.\n * @param {string=} refreshing-icon The font icon to display after user lets go of the\n * refresher. This is deprecated in favor of the SVG {@link ionic.directive:ionSpinner}.\n * @param {boolean=} disable-pulling-rotation Disables the rotation animation of the pulling\n * icon when it reaches its activated threshold. To be used with a custom `pulling-icon`.\n *\n */\nIonicModule\n.directive('ionRefresher', [function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: ['?^$ionicScroll', 'ionRefresher'],\n    controller: '$ionicRefresher',\n    template:\n    '<div class=\"scroll-refresher invisible\" collection-repeat-ignore>' +\n      '<div class=\"ionic-refresher-content\" ' +\n      'ng-class=\"{\\'ionic-refresher-with-text\\': pullingText || refreshingText}\">' +\n        '<div class=\"icon-pulling\" ng-class=\"{\\'pulling-rotation-disabled\\':disablePullingRotation}\">' +\n          '<i class=\"icon {{pullingIcon}}\"></i>' +\n        '</div>' +\n        '<div class=\"text-pulling\" ng-bind-html=\"pullingText\"></div>' +\n        '<div class=\"icon-refreshing\">' +\n          '<ion-spinner ng-if=\"showSpinner\" icon=\"{{spinner}}\"></ion-spinner>' +\n          '<i ng-if=\"showIcon\" class=\"icon {{refreshingIcon}}\"></i>' +\n        '</div>' +\n        '<div class=\"text-refreshing\" ng-bind-html=\"refreshingText\"></div>' +\n      '</div>' +\n    '</div>',\n    link: function($scope, $element, $attrs, ctrls) {\n\n      // JS Scrolling uses the scroll controller\n      var scrollCtrl = ctrls[0],\n          refresherCtrl = ctrls[1];\n      if (!scrollCtrl || scrollCtrl.isNative()) {\n        // Kick off native scrolling\n        refresherCtrl.init();\n      } else {\n        $element[0].classList.add('js-scrolling');\n        scrollCtrl._setRefresher(\n          $scope,\n          $element[0],\n          refresherCtrl.getRefresherDomMethods()\n        );\n\n        $scope.$on('scroll.refreshComplete', function() {\n          $scope.$evalAsync(function() {\n            scrollCtrl.scrollView.finishPullToRefresh();\n          });\n        });\n      }\n\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionScroll\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @codepen mwFuh\n * @restrict E\n *\n * @description\n * Creates a scrollable container for all content inside.\n *\n * @usage\n *\n * Basic usage:\n *\n * ```html\n * <ion-scroll zooming=\"true\" direction=\"xy\" style=\"width: 500px; height: 500px\">\n *   <div style=\"width: 5000px; height: 5000px; background: url('https://upload.wikimedia.org/wikipedia/commons/a/ad/Europe_geological_map-en.jpg') repeat\"></div>\n *  </ion-scroll>\n * ```\n *\n * Note that it's important to set the height of the scroll box as well as the height of the inner\n * content to enable scrolling. This makes it possible to have full control over scrollable areas.\n *\n * If you'd just like to have a center content scrolling area, use {@link ionic.directive:ionContent} instead.\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} paging Whether to scroll with paging.\n * @param {expression=} on-refresh Called on pull-to-refresh, triggered by an {@link ionic.directive:ionRefresher}.\n * @param {expression=} on-scroll Called whenever the user scrolls.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {boolean=} zooming Whether to support pinch-to-zoom\n * @param {integer=} min-zoom The smallest zoom amount allowed (default is 0.5)\n * @param {integer=} max-zoom The largest zoom amount allowed (default is 3)\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n */\nIonicModule\n.directive('ionScroll', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\n  '$ionicConfig',\nfunction($timeout, $controller, $ionicBind, $ionicConfig) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: function() {},\n    compile: function(element, attr) {\n      element.addClass('scroll-view ionic-scroll');\n\n      //We cannot transclude here because it breaks element.data() inheritance on compile\n      var innerElement = jqLite('<div class=\"scroll\"></div>');\n      innerElement.append(element.contents());\n      element.append(innerElement);\n\n      var nativeScrolling = attr.overflowScroll !== \"false\" && (attr.overflowScroll === \"true\" || !$ionicConfig.scrolling.jsScrolling());\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr) {\n        $ionicBind($scope, $attr, {\n          direction: '@',\n          paging: '@',\n          $onScroll: '&onScroll',\n          scroll: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          zooming: '@',\n          minZoom: '@',\n          maxZoom: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n            innerElement.toggleClass('padding', !!newVal);\n          });\n        }\n        if ($scope.$eval($scope.paging) === true) {\n          innerElement.addClass('scroll-paging');\n        }\n\n        if (!$scope.direction) { $scope.direction = 'y'; }\n        var isPaging = $scope.$eval($scope.paging) === true;\n\n        if (nativeScrolling) {\n          $element.addClass('overflow-scroll');\n        }\n\n        $element.addClass('scroll-' + $scope.direction);\n\n        var scrollViewOptions = {\n          el: $element[0],\n          delegateHandle: $attr.delegateHandle,\n          locking: ($attr.locking || 'true') === 'true',\n          bouncing: $scope.$eval($attr.hasBouncing),\n          paging: isPaging,\n          scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n          scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n          scrollingX: $scope.direction.indexOf('x') >= 0,\n          scrollingY: $scope.direction.indexOf('y') >= 0,\n          zooming: $scope.$eval($scope.zooming) === true,\n          maxZoom: $scope.$eval($scope.maxZoom) || 3,\n          minZoom: $scope.$eval($scope.minZoom) || 0.5,\n          preventDefault: true,\n          nativeScrolling: nativeScrolling\n        };\n\n        if (isPaging) {\n          scrollViewOptions.speedMultiplier = 0.8;\n          scrollViewOptions.bouncing = false;\n        }\n\n        $controller('$ionicScroll', {\n          $scope: $scope,\n          scrollViewOptions: scrollViewOptions\n        });\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionSideMenu\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for a side menu, sibling to an {@link ionic.directive:ionSideMenuContent} directive.\n *\n * @usage\n * ```html\n * <ion-side-menu\n *   side=\"left\"\n *   width=\"myWidthValue + 20\"\n *   is-enabled=\"shouldLeftSideMenuBeEnabled()\">\n * </ion-side-menu>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {string} side Which side the side menu is currently on.  Allowed values: 'left' or 'right'.\n * @param {boolean=} is-enabled Whether this side menu is enabled.\n * @param {number=} width How many pixels wide the side menu should be.  Defaults to 275.\n */\nIonicModule\n.directive('ionSideMenu', function() {\n  return {\n    restrict: 'E',\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      angular.isUndefined(attr.isEnabled) && attr.$set('isEnabled', 'true');\n      angular.isUndefined(attr.width) && attr.$set('width', '275');\n\n      element.addClass('menu menu-' + attr.side);\n\n      return function($scope, $element, $attr, sideMenuCtrl) {\n        $scope.side = $attr.side || 'left';\n\n        var sideMenu = sideMenuCtrl[$scope.side] = new ionic.views.SideMenu({\n          width: attr.width,\n          el: $element[0],\n          isEnabled: true\n        });\n\n        $scope.$watch($attr.width, function(val) {\n          var numberVal = +val;\n          if (numberVal && numberVal == val) {\n            sideMenu.setWidth(+val);\n          }\n        });\n        $scope.$watch($attr.isEnabled, function(val) {\n          sideMenu.setIsEnabled(!!val);\n        });\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionSideMenuContent\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for the main visible content, sibling to one or more\n * {@link ionic.directive:ionSideMenu} directives.\n *\n * @usage\n * ```html\n * <ion-side-menu-content\n *   edge-drag-threshold=\"true\"\n *   drag-content=\"true\">\n * </ion-side-menu-content>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {boolean=} drag-content Whether the content can be dragged. Default true.\n * @param {boolean|number=} edge-drag-threshold Whether the content drag can only start if it is below a certain threshold distance from the edge of the screen.  Default false. Accepts three types of values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n *\n */\nIonicModule\n.directive('ionSideMenuContent', [\n  '$timeout',\n  '$ionicGesture',\n  '$window',\nfunction($timeout, $ionicGesture, $window) {\n\n  return {\n    restrict: 'EA', //DEPRECATED 'A'\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      element.addClass('menu-content pane');\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, sideMenuCtrl) {\n        var startCoord = null;\n        var primaryScrollAxis = null;\n\n        if (isDefined(attr.dragContent)) {\n          $scope.$watch(attr.dragContent, function(value) {\n            sideMenuCtrl.canDragContent(value);\n          });\n        } else {\n          sideMenuCtrl.canDragContent(true);\n        }\n\n        if (isDefined(attr.edgeDragThreshold)) {\n          $scope.$watch(attr.edgeDragThreshold, function(value) {\n            sideMenuCtrl.edgeDragThreshold(value);\n          });\n        }\n\n        // Listen for taps on the content to close the menu\n        function onContentTap(gestureEvt) {\n          if (sideMenuCtrl.getOpenAmount() !== 0) {\n            sideMenuCtrl.close();\n            gestureEvt.gesture.srcEvent.preventDefault();\n            startCoord = null;\n            primaryScrollAxis = null;\n          } else if (!startCoord) {\n            startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n          }\n        }\n\n        function onDragX(e) {\n          if (!sideMenuCtrl.isDraggableTarget(e)) return;\n\n          if (getPrimaryScrollAxis(e) == 'x') {\n            sideMenuCtrl._handleDrag(e);\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragY(e) {\n          if (getPrimaryScrollAxis(e) == 'x') {\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragRelease(e) {\n          sideMenuCtrl._endDrag(e);\n          startCoord = null;\n          primaryScrollAxis = null;\n        }\n\n        function getPrimaryScrollAxis(gestureEvt) {\n          // gets whether the user is primarily scrolling on the X or Y\n          // If a majority of the drag has been on the Y since the start of\n          // the drag, but the X has moved a little bit, it's still a Y drag\n\n          if (primaryScrollAxis) {\n            // we already figured out which way they're scrolling\n            return primaryScrollAxis;\n          }\n\n          if (gestureEvt && gestureEvt.gesture) {\n\n            if (!startCoord) {\n              // get the starting point\n              startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n            } else {\n              // we already have a starting point, figure out which direction they're going\n              var endCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n              var xDistance = Math.abs(endCoord.x - startCoord.x);\n              var yDistance = Math.abs(endCoord.y - startCoord.y);\n\n              var scrollAxis = (xDistance < yDistance ? 'y' : 'x');\n\n              if (Math.max(xDistance, yDistance) > 30) {\n                // ok, we pretty much know which way they're going\n                // let's lock it in\n                primaryScrollAxis = scrollAxis;\n              }\n\n              return scrollAxis;\n            }\n          }\n          return 'y';\n        }\n\n        var content = {\n          element: element[0],\n          onDrag: function() {},\n          endDrag: function() {},\n          setCanScroll: function(canScroll) {\n            var c = $element[0].querySelector('.scroll');\n\n            if (!c) {\n              return;\n            }\n\n            var content = angular.element(c.parentElement);\n            if (!content) {\n              return;\n            }\n\n            // freeze our scroll container if we have one\n            var scrollScope = content.scope();\n            scrollScope.scrollCtrl && scrollScope.scrollCtrl.freezeScrollShut(!canScroll);\n          },\n          getTranslateX: function() {\n            return $scope.sideMenuContentTranslateX || 0;\n          },\n          setTranslateX: ionic.animationFrameThrottle(function(amount) {\n            var xTransform = content.offsetX + amount;\n            $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + xTransform + 'px,0,0)';\n            $timeout(function() {\n              $scope.sideMenuContentTranslateX = amount;\n            });\n          }),\n          setMarginLeft: ionic.animationFrameThrottle(function(amount) {\n            if (amount) {\n              amount = parseInt(amount, 10);\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amount + 'px,0,0)';\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amount;\n            } else {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n          }),\n          setMarginRight: ionic.animationFrameThrottle(function(amount) {\n            if (amount) {\n              amount = parseInt(amount, 10);\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amount;\n            } else {\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n            // reset incase left gets grabby\n            $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n          }),\n          setMarginLeftAndRight: ionic.animationFrameThrottle(function(amountLeft, amountRight) {\n            amountLeft = amountLeft && parseInt(amountLeft, 10) || 0;\n            amountRight = amountRight && parseInt(amountRight, 10) || 0;\n\n            var amount = amountLeft + amountRight;\n\n            if (amount > 0) {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amountLeft + 'px,0,0)';\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amountLeft;\n            } else {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n            // reset incase left gets grabby\n            //$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n          }),\n          enableAnimation: function() {\n            $scope.animationEnabled = true;\n            $element[0].classList.add('menu-animated');\n          },\n          disableAnimation: function() {\n            $scope.animationEnabled = false;\n            $element[0].classList.remove('menu-animated');\n          },\n          offsetX: 0\n        };\n\n        sideMenuCtrl.setContent(content);\n\n        // add gesture handlers\n        var gestureOpts = { stop_browser_behavior: false };\n        gestureOpts.prevent_default_directions = ['left', 'right'];\n        var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element, gestureOpts);\n        var dragRightGesture = $ionicGesture.on('dragright', onDragX, $element, gestureOpts);\n        var dragLeftGesture = $ionicGesture.on('dragleft', onDragX, $element, gestureOpts);\n        var dragUpGesture = $ionicGesture.on('dragup', onDragY, $element, gestureOpts);\n        var dragDownGesture = $ionicGesture.on('dragdown', onDragY, $element, gestureOpts);\n        var releaseGesture = $ionicGesture.on('release', onDragRelease, $element, gestureOpts);\n\n        // Cleanup\n        $scope.$on('$destroy', function() {\n          if (content) {\n            content.element = null;\n            content = null;\n          }\n          $ionicGesture.off(dragLeftGesture, 'dragleft', onDragX);\n          $ionicGesture.off(dragRightGesture, 'dragright', onDragX);\n          $ionicGesture.off(dragUpGesture, 'dragup', onDragY);\n          $ionicGesture.off(dragDownGesture, 'dragdown', onDragY);\n          $ionicGesture.off(releaseGesture, 'release', onDragRelease);\n          $ionicGesture.off(contentTapGesture, 'tap', onContentTap);\n        });\n      }\n    }\n  };\n}]);\n\nIonicModule\n\n/**\n * @ngdoc directive\n * @name ionSideMenus\n * @module ionic\n * @delegate ionic.service:$ionicSideMenuDelegate\n * @restrict E\n *\n * @description\n * A container element for side menu(s) and the main content. Allows the left and/or right side menu\n * to be toggled by dragging the main content area side to side.\n *\n * To automatically close an opened menu, you can add the {@link ionic.directive:menuClose} attribute\n * directive. The `menu-close` attribute is usually added to links and buttons within\n * `ion-side-menu-content`, so that when the element is clicked, the opened side menu will\n * automatically close.\n *\n * \"Burger Icon\" toggles can be added to the header with the {@link ionic.directive:menuToggle}\n * attribute directive. Clicking the toggle will open and close the side menu like the `menu-close`\n * directive. The side menu will automatically hide on child pages, but can be overridden with the\n * enable-menu-with-back-views attribute mentioned below.\n *\n * By default, side menus are hidden underneath their side menu content and can be opened by swiping\n * the content left or right or by toggling a button to show the side menu. Additionally, by adding the\n * {@link ionic.directive:exposeAsideWhen} attribute directive to an\n * {@link ionic.directive:ionSideMenu} element directive, a side menu can be given instructions about\n * \"when\" the menu should be exposed (always viewable).\n *\n * ![Side Menu](http://ionicframework.com.s3.amazonaws.com/docs/controllers/sidemenu.gif)\n *\n * For more information on side menus, check out:\n *\n * - {@link ionic.directive:ionSideMenuContent}\n * - {@link ionic.directive:ionSideMenu}\n * - {@link ionic.directive:menuToggle}\n * - {@link ionic.directive:menuClose}\n * - {@link ionic.directive:exposeAsideWhen}\n *\n * @usage\n * To use side menus, add an `<ion-side-menus>` parent element. This will encompass all pages that have a\n * side menu, and have at least 2 child elements: 1 `<ion-side-menu-content>` for the center content,\n * and one or more `<ion-side-menu>` directives for each side menu(left/right) that you wish to place.\n *\n * ```html\n * <ion-side-menus>\n *   <!-- Left menu -->\n *   <ion-side-menu side=\"left\">\n *   </ion-side-menu>\n *\n *   <ion-side-menu-content>\n *   <!-- Main content, usually <ion-nav-view> -->\n *   </ion-side-menu-content>\n *\n *   <!-- Right menu -->\n *   <ion-side-menu side=\"right\">\n *   </ion-side-menu>\n *\n * </ion-side-menus>\n * ```\n * ```js\n * function ContentController($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeft = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n *\n * @param {bool=} enable-menu-with-back-views Determines whether the side menu is enabled when the\n * back button is showing. When set to `false`, any {@link ionic.directive:menuToggle} will be hidden,\n * and the user cannot swipe to open the menu. When going back to the root page of the side menu (the\n * page without a back button visible), then any menuToggle buttons will show again, and menus will be\n * enabled again.\n * @param {string=} delegate-handle The handle used to identify this side menu\n * with {@link ionic.service:$ionicSideMenuDelegate}.\n *\n */\n.directive('ionSideMenus', ['$ionicBody', function($ionicBody) {\n  return {\n    restrict: 'ECA',\n    controller: '$ionicSideMenus',\n    compile: function(element, attr) {\n      attr.$set('class', (attr['class'] || '') + ' view');\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attrs, ctrl) {\n\n        ctrl.enableMenuWithBackViews($scope.$eval($attrs.enableMenuWithBackViews));\n\n        $scope.$on('$ionicExposeAside', function(evt, isAsideExposed) {\n          if (!$scope.$exposeAside) $scope.$exposeAside = {};\n          $scope.$exposeAside.active = isAsideExposed;\n          $ionicBody.enableClass(isAsideExposed, 'aside-open');\n        });\n\n        $scope.$on('$ionicView.beforeEnter', function(ev, d) {\n          if (d.historyId) {\n            $scope.$activeHistoryId = d.historyId;\n          }\n        });\n\n        $scope.$on('$destroy', function() {\n          $ionicBody.removeClass('menu-open', 'aside-open');\n        });\n\n      }\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionSlideBox\n * @module ionic\n * @codepen AjgEB\n * @deprecated will be removed in the next Ionic release in favor of the new ion-slides component.\n * Don't depend on the internal behavior of this widget.\n * @delegate ionic.service:$ionicSlideBoxDelegate\n * @restrict E\n * @description\n * The Slide Box is a multi-page container where each page can be swiped or dragged between:\n *\n *\n * @usage\n * ```html\n * <ion-slide-box on-slide-changed=\"slideHasChanged($index)\">\n *   <ion-slide>\n *     <div class=\"box blue\"><h1>BLUE</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box yellow\"><h1>YELLOW</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box pink\"><h1>PINK</h1></div>\n *   </ion-slide>\n * </ion-slide-box>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this slideBox\n * with {@link ionic.service:$ionicSlideBoxDelegate}.\n * @param {boolean=} does-continue Whether the slide box should loop.\n * @param {boolean=} auto-play Whether the slide box should automatically slide. Default true if does-continue is true.\n * @param {number=} slide-interval How many milliseconds to wait to change slides (if does-continue is true). Defaults to 4000.\n * @param {boolean=} show-pager Whether a pager should be shown for this slide box. Accepts expressions via `show-pager=\"{{shouldShow()}}\"`. Defaults to true.\n * @param {expression=} pager-click Expression to call when a pager is clicked (if show-pager is true). Is passed the 'index' variable.\n * @param {expression=} on-slide-changed Expression called whenever the slide is changed.  Is passed an '$index' variable.\n * @param {expression=} active-slide Model to bind the current slide index to.\n */\nIonicModule\n.directive('ionSlideBox', [\n  '$animate',\n  '$timeout',\n  '$compile',\n  '$ionicSlideBoxDelegate',\n  '$ionicHistory',\n  '$ionicScrollDelegate',\nfunction($animate, $timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $ionicScrollDelegate) {\n  return {\n    restrict: 'E',\n    replace: true,\n    transclude: true,\n    scope: {\n      autoPlay: '=',\n      doesContinue: '@',\n      slideInterval: '@',\n      showPager: '@',\n      pagerClick: '&',\n      disableScroll: '@',\n      onSlideChanged: '&',\n      activeSlide: '=?',\n      bounce: '@'\n    },\n    controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {\n      var _this = this;\n\n      var continuous = $scope.$eval($scope.doesContinue) === true;\n      var bouncing = ($scope.$eval($scope.bounce) !== false); //Default to true\n      var shouldAutoPlay = isDefined($attrs.autoPlay) ? !!$scope.autoPlay : false;\n      var slideInterval = shouldAutoPlay ? $scope.$eval($scope.slideInterval) || 4000 : 0;\n\n      var slider = new ionic.views.Slider({\n        el: $element[0],\n        auto: slideInterval,\n        continuous: continuous,\n        startSlide: $scope.activeSlide,\n        bouncing: bouncing,\n        slidesChanged: function() {\n          $scope.currentSlide = slider.currentIndex();\n\n          // Try to trigger a digest\n          $timeout(function() {});\n        },\n        callback: function(slideIndex) {\n          $scope.currentSlide = slideIndex;\n          $scope.onSlideChanged({ index: $scope.currentSlide, $index: $scope.currentSlide});\n          $scope.$parent.$broadcast('slideBox.slideChanged', slideIndex);\n          $scope.activeSlide = slideIndex;\n          // Try to trigger a digest\n          $timeout(function() {});\n        },\n        onDrag: function() {\n          freezeAllScrolls(true);\n        },\n        onDragEnd: function() {\n          freezeAllScrolls(false);\n        }\n      });\n\n      function freezeAllScrolls(shouldFreeze) {\n        if (shouldFreeze && !_this.isScrollFreeze) {\n          $ionicScrollDelegate.freezeAllScrolls(shouldFreeze);\n\n        } else if (!shouldFreeze && _this.isScrollFreeze) {\n          $ionicScrollDelegate.freezeAllScrolls(false);\n        }\n        _this.isScrollFreeze = shouldFreeze;\n      }\n\n      slider.enableSlide($scope.$eval($attrs.disableScroll) !== true);\n\n      $scope.$watch('activeSlide', function(nv) {\n        if (isDefined(nv)) {\n          slider.slide(nv);\n        }\n      });\n\n      $scope.$on('slideBox.nextSlide', function() {\n        slider.next();\n      });\n\n      $scope.$on('slideBox.prevSlide', function() {\n        slider.prev();\n      });\n\n      $scope.$on('slideBox.setSlide', function(e, index) {\n        slider.slide(index);\n      });\n\n      //Exposed for testing\n      this.__slider = slider;\n\n      var deregisterInstance = $ionicSlideBoxDelegate._registerInstance(\n        slider, $attrs.delegateHandle, function() {\n          return $ionicHistory.isActiveScope($scope);\n        }\n      );\n      $scope.$on('$destroy', function() {\n        deregisterInstance();\n        slider.kill();\n      });\n\n      this.slidesCount = function() {\n        return slider.slidesCount();\n      };\n\n      this.onPagerClick = function(index) {\n        $scope.pagerClick({index: index});\n      };\n\n      $timeout(function() {\n        slider.load();\n      });\n    }],\n    template: '<div class=\"slider\">' +\n      '<div class=\"slider-slides\" ng-transclude>' +\n      '</div>' +\n    '</div>',\n\n    link: function($scope, $element, $attr) {\n      // Disable ngAnimate for slidebox and its children\n      $animate.enabled($element, false);\n\n      // if showPager is undefined, show the pager\n      if (!isDefined($attr.showPager)) {\n        $scope.showPager = true;\n        getPager().toggleClass('hide', !true);\n      }\n\n      $attr.$observe('showPager', function(show) {\n        if (show === undefined) return;\n        show = $scope.$eval(show);\n        getPager().toggleClass('hide', !show);\n      });\n\n      var pager;\n      function getPager() {\n        if (!pager) {\n          var childScope = $scope.$new();\n          pager = jqLite('<ion-pager></ion-pager>');\n          $element.append(pager);\n          pager = $compile(pager)(childScope);\n        }\n        return pager;\n      }\n    }\n  };\n}])\n.directive('ionSlide', function() {\n  return {\n    restrict: 'E',\n    require: '?^ionSlideBox',\n    compile: function(element) {\n      element.addClass('slider-slide');\n    }\n  };\n})\n\n.directive('ionPager', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '^ionSlideBox',\n    template: '<div class=\"slider-pager\"><span class=\"slider-pager-page\" ng-repeat=\"slide in numSlides() track by $index\" ng-class=\"{active: $index == currentSlide}\" ng-click=\"pagerClick($index)\"><i class=\"icon ion-record\"></i></span></div>',\n    link: function($scope, $element, $attr, slideBox) {\n      var selectPage = function(index) {\n        var children = $element[0].children;\n        var length = children.length;\n        for (var i = 0; i < length; i++) {\n          if (i == index) {\n            children[i].classList.add('active');\n          } else {\n            children[i].classList.remove('active');\n          }\n        }\n      };\n\n      $scope.pagerClick = function(index) {\n        slideBox.onPagerClick(index);\n      };\n\n      $scope.numSlides = function() {\n        return new Array(slideBox.slidesCount());\n      };\n\n      $scope.$watch('currentSlide', function(v) {\n        selectPage(v);\n      });\n    }\n  };\n\n});\n\n\n/**\n * @ngdoc directive\n * @name ionSlides\n * @module ionic\n * @delegate ionic.service:$ionicSlideBoxDelegate\n * @restrict E\n * @description\n * The Slides component is a powerful multi-page container where each page can be swiped or dragged between.\n *\n * Note: this is a new version of the Ionic Slide Box based on the [Swiper](http://www.idangero.us/swiper/#.Vmc1J-ODFBc) widget from\n * [idangerous](http://www.idangero.us/).\n *\n * ![SlideBox](http://ionicframework.com.s3.amazonaws.com/docs/controllers/slideBox.gif)\n *\n * @usage\n * ```html\n * <ion-content scroll=\"false\">\n *   <ion-slides  options=\"options\" slider=\"data.slider\">\n *     <ion-slide-page>\n *       <div class=\"box blue\"><h1>BLUE</h1></div>\n *     </ion-slide-page>\n *     <ion-slide-page>\n *       <div class=\"box yellow\"><h1>YELLOW</h1></div>\n *     </ion-slide-page>\n *     <ion-slide-page>\n *       <div class=\"box pink\"><h1>PINK</h1></div>\n *     </ion-slide-page>\n *   </ion-slides>\n * </ion-content>\n * ```\n *\n * ```js\n * $scope.options = {\n *   loop: false,\n *   effect: 'fade',\n *   speed: 500,\n * }\n *\n * $scope.$on(\"$ionicSlides.sliderInitialized\", function(event, data){\n *   // data.slider is the instance of Swiper\n *   $scope.slider = data.slider;\n * });\n *\n * $scope.$on(\"$ionicSlides.slideChangeStart\", function(event, data){\n *   console.log('Slide change is beginning');\n * });\n *\n * $scope.$on(\"$ionicSlides.slideChangeEnd\", function(event, data){\n *   // note: the indexes are 0-based\n *   $scope.activeIndex = data.activeIndex;\n *   $scope.previousIndex = data.previousIndex;\n * });\n *\n * ```\n *\n * ## Slide Events\n *\n * The slides component dispatches events when the active slide changes\n *\n * <table class=\"table\">\n *   <tr>\n *     <td><code>$ionicSlides.slideChangeStart</code></td>\n *     <td>This event is emitted when a slide change begins</td>\n *   </tr>\n *   <tr>\n *     <td><code>$ionicSlides.slideChangeEnd</code></td>\n *     <td>This event is emitted when a slide change completes</td>\n *   </tr>\n *   <tr>\n *     <td><code>$ionicSlides.sliderInitialized</code></td>\n *     <td>This event is emitted when the slider is initialized. It provides access to an instance of the slider.</td>\n *   </tr>\n * </table>\n *\n *\n * ## Updating Slides Dynamically\n * When applying data to the slider at runtime, typically everything will work as expected.\n *\n * In the event that the slides are looped, use the `updateLoop` method on the slider to ensure the slides update correctly.\n *\n * ```\n * $scope.$on(\"$ionicSlides.sliderInitialized\", function(event, data){\n *   // grab an instance of the slider\n *   $scope.slider = data.slider;\n * });\n *\n * function dataChangeHandler(){\n *   // call this function when data changes, such as an HTTP request, etc\n *   if ( $scope.slider ){\n *     $scope.slider.updateLoop();\n *   }\n * }\n * ```\n *\n */\nIonicModule\n.directive('ionSlides', [\n  '$animate',\n  '$timeout',\n  '$compile',\nfunction($animate, $timeout, $compile) {\n  return {\n    restrict: 'E',\n    transclude: true,\n    scope: {\n      options: '=',\n      slider: '='\n    },\n    template: '<div class=\"swiper-container\">' +\n      '<div class=\"swiper-wrapper\" ng-transclude>' +\n      '</div>' +\n        '<div ng-hide=\"!showPager\" class=\"swiper-pagination\"></div>' +\n      '</div>',\n    controller: ['$scope', '$element', function($scope, $element) {\n      var _this = this;\n\n      this.update = function() {\n        $timeout(function() {\n          if (!_this.__slider) {\n            return;\n          }\n\n          _this.__slider.update();\n          if (_this._options.loop) {\n            _this.__slider.createLoop();\n          }\n\n          var slidesLength = _this.__slider.slides.length;\n\n          // Don't allow pager to show with > 10 slides\n          if (slidesLength > 10) {\n            $scope.showPager = false;\n          }\n\n          // When slide index is greater than total then slide to last index\n          if (_this.__slider.activeIndex > slidesLength - 1) {\n            _this.__slider.slideTo(slidesLength - 1);\n          }\n        });\n      };\n\n      this.rapidUpdate = ionic.debounce(function() {\n        _this.update();\n      }, 50);\n\n      this.getSlider = function() {\n        return _this.__slider;\n      };\n\n      var options = $scope.options || {};\n\n      var newOptions = angular.extend({\n        pagination: $element.children().children()[1],\n        paginationClickable: true,\n        lazyLoading: true,\n        preloadImages: false\n      }, options);\n\n      this._options = newOptions;\n\n      $timeout(function() {\n        var slider = new ionic.views.Swiper($element.children()[0], newOptions, $scope, $compile);\n\n        $scope.$emit(\"$ionicSlides.sliderInitialized\", { slider: slider });\n\n        _this.__slider = slider;\n        $scope.slider = _this.__slider;\n\n        $scope.$on('$destroy', function() {\n          slider.destroy();\n          _this.__slider = null;\n        });\n      });\n\n      $timeout(function() {\n        // if it's a loop, render the slides again just incase\n        _this.rapidUpdate();\n      }, 200);\n\n    }],\n\n    link: function($scope) {\n      $scope.showPager = true;\n      // Disable ngAnimate for slidebox and its children\n      //$animate.enabled(false, $element);\n    }\n  };\n}])\n.directive('ionSlidePage', [function() {\n  return {\n    restrict: 'E',\n    require: '?^ionSlides',\n    transclude: true,\n    replace: true,\n    template: '<div class=\"swiper-slide\" ng-transclude></div>',\n    link: function($scope, $element, $attr, ionSlidesCtrl) {\n      ionSlidesCtrl.rapidUpdate();\n\n      $scope.$on('$destroy', function() {\n        ionSlidesCtrl.rapidUpdate();\n      });\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionSpinner\n* @module ionic\n* @restrict E\n *\n * @description\n * The `ionSpinner` directive provides a variety of animated spinners.\n * Spinners enables you to give your users feedback that the app is\n * processing/thinking/waiting/chillin' out, or whatever you'd like it to indicate.\n * By default, the {@link ionic.directive:ionRefresher} feature uses this spinner, rather\n * than rotating font icons (previously included in [ionicons](http://ionicons.com/)).\n * While font icons are great for simple or stationary graphics, they're not suited to\n * provide great animations, which is why Ionic uses SVG instead.\n *\n * Ionic offers ten spinners out of the box, and by default, it will use the appropriate spinner\n * for the platform on which it's running. Under the hood, the `ionSpinner` directive dynamically\n * builds the required SVG element, which allows Ionic to provide all ten of the animated SVGs\n * within 3KB.\n *\n * <style>\n * .spinner-table {\n *   max-width: 280px;\n * }\n * .spinner-table tbody > tr > th, .spinner-table tbody > tr > td {\n *   vertical-align: middle;\n *   width: 42px;\n *   height: 42px;\n * }\n * .spinner {\n *   stroke: #444;\n *   fill: #444; }\n *   .spinner svg {\n *     width: 28px;\n *     height: 28px; }\n *   .spinner.spinner-inverse {\n *     stroke: #fff;\n *     fill: #fff; }\n *\n * .spinner-android {\n *   stroke: #4b8bf4; }\n *\n * .spinner-ios, .spinner-ios-small {\n *   stroke: #69717d; }\n *\n * .spinner-spiral .stop1 {\n *   stop-color: #fff;\n *   stop-opacity: 0; }\n * .spinner-spiral.spinner-inverse .stop1 {\n *   stop-color: #000; }\n * .spinner-spiral.spinner-inverse .stop2 {\n *   stop-color: #fff; }\n * </style>\n *\n * <script src=\"http://code.ionicframework.com/nightly/js/ionic.bundle.min.js\"></script>\n * <table class=\"table spinner-table\" ng-app=\"ionic\">\n *  <tr>\n *    <th>\n *      <code>android</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"android\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>ios</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"ios\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>ios-small</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"ios-small\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>bubbles</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"bubbles\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>circles</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"circles\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>crescent</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"crescent\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>dots</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"dots\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>lines</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"lines\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>ripple</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"ripple\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>spiral</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"spiral\"></ion-spinner>\n *    </td>\n *  </tr>\n * </table>\n *\n * Each spinner uses SVG with SMIL animations, however, the Android spinner also uses JavaScript\n * so it also works on Android 4.0-4.3. Additionally, each spinner can be styled with CSS,\n * and scaled to any size.\n *\n *\n * @usage\n * The following code would use the default spinner for the platform it's running from. If it's neither\n * iOS or Android, it'll default to use `ios`.\n *\n * ```html\n * <ion-spinner></ion-spinner>\n * ```\n *\n * By setting the `icon` attribute, you can specify which spinner to use, no matter what\n * the platform is.\n *\n * ```html\n * <ion-spinner icon=\"spiral\"></ion-spinner>\n * ```\n *\n * ## Spinner Colors\n * Like with most of Ionic's other components, spinners can also be styled using\n * Ionic's standard color naming convention. For example:\n *\n * ```html\n * <ion-spinner class=\"spinner-energized\"></ion-spinner>\n * ```\n *\n *\n * ## Styling SVG with CSS\n * One cool thing about SVG is its ability to be styled with CSS! Some of the properties\n * have different names, for example, SVG uses the term `stroke` instead of `border`, and\n * `fill` instead of `background-color`.\n *\n * ```css\n * .spinner svg {\n *   width: 28px;\n *   height: 28px;\n *   stroke: #444;\n *   fill: #444;\n * }\n * ```\n *\n*/\nIonicModule\n.directive('ionSpinner', function() {\n  return {\n    restrict: 'E',\n    controller: '$ionicSpinner',\n    link: function($scope, $element, $attrs, ctrl) {\n      var spinnerName = ctrl.init();\n      $element.addClass('spinner spinner-' + spinnerName);\n\n      $element.on('$destroy', function onDestroy() {\n        ctrl.stop();\n      });\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionTab\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionTabs\n *\n * @description\n * Contains a tab's content.  The content only exists while the given tab is selected.\n *\n * Each ionTab has its own view history.\n *\n * @usage\n * ```html\n * <ion-tab\n *   title=\"Tab!\"\n *   icon=\"my-icon\"\n *   href=\"#/tab/tab-link\"\n *   on-select=\"onTabSelected()\"\n *   on-deselect=\"onTabDeselected()\">\n * </ion-tab>\n * ```\n * For a complete, working tab bar example, see the {@link ionic.directive:ionTabs} documentation.\n *\n * @param {string} title The title of the tab.\n * @param {string=} href The link that this tab will navigate to when tapped.\n * @param {string=} icon The icon of the tab. If given, this will become the default for icon-on and icon-off.\n * @param {string=} icon-on The icon of the tab while it is selected.\n * @param {string=} icon-off The icon of the tab while it is not selected.\n * @param {expression=} badge The badge to put on this tab (usually a number).\n * @param {expression=} badge-style The style of badge to put on this tab (eg: badge-positive).\n * @param {expression=} on-select Called when this tab is selected.\n * @param {expression=} on-deselect Called when this tab is deselected.\n * @param {expression=} ng-click By default, the tab will be selected on click. If ngClick is set, it will not.  You can explicitly switch tabs using {@link ionic.service:$ionicTabsDelegate#select $ionicTabsDelegate.select()}.\n * @param {expression=} hidden Whether the tab is to be hidden or not.\n * @param {expression=} disabled Whether the tab is to be disabled or not.\n */\nIonicModule\n.directive('ionTab', [\n  '$compile',\n  '$ionicConfig',\n  '$ionicBind',\n  '$ionicViewSwitcher',\nfunction($compile, $ionicConfig, $ionicBind, $ionicViewSwitcher) {\n\n  //Returns ' key=\"value\"' if value exists\n  function attrStr(k, v) {\n    return isDefined(v) ? ' ' + k + '=\"' + v + '\"' : '';\n  }\n  return {\n    restrict: 'E',\n    require: ['^ionTabs', 'ionTab'],\n    controller: '$ionicTab',\n    scope: true,\n    compile: function(element, attr) {\n\n      //We create the tabNavTemplate in the compile phase so that the\n      //attributes we pass down won't be interpolated yet - we want\n      //to pass down the 'raw' versions of the attributes\n      var tabNavTemplate = '<ion-tab-nav' +\n        attrStr('ng-click', attr.ngClick) +\n        attrStr('title', attr.title) +\n        attrStr('icon', attr.icon) +\n        attrStr('icon-on', attr.iconOn) +\n        attrStr('icon-off', attr.iconOff) +\n        attrStr('badge', attr.badge) +\n        attrStr('badge-style', attr.badgeStyle) +\n        attrStr('hidden', attr.hidden) +\n        attrStr('disabled', attr.disabled) +\n        attrStr('class', attr['class']) +\n        '></ion-tab-nav>';\n\n      //Remove the contents of the element so we can compile them later, if tab is selected\n      var tabContentEle = document.createElement('div');\n      for (var x = 0; x < element[0].children.length; x++) {\n        tabContentEle.appendChild(element[0].children[x].cloneNode(true));\n      }\n      var childElementCount = tabContentEle.childElementCount;\n      element.empty();\n\n      var navViewName, isNavView;\n      if (childElementCount) {\n        if (tabContentEle.children[0].tagName === 'ION-NAV-VIEW') {\n          // get the name if it's a nav-view\n          navViewName = tabContentEle.children[0].getAttribute('name');\n          tabContentEle.children[0].classList.add('view-container');\n          isNavView = true;\n        }\n        if (childElementCount === 1) {\n          // make the 1 child element the primary tab content container\n          tabContentEle = tabContentEle.children[0];\n        }\n        if (!isNavView) tabContentEle.classList.add('pane');\n        tabContentEle.classList.add('tab-content');\n      }\n\n      return function link($scope, $element, $attr, ctrls) {\n        var childScope;\n        var childElement;\n        var tabsCtrl = ctrls[0];\n        var tabCtrl = ctrls[1];\n        var isTabContentAttached = false;\n        $scope.$tabSelected = false;\n\n        $ionicBind($scope, $attr, {\n          onSelect: '&',\n          onDeselect: '&',\n          title: '@',\n          uiSref: '@',\n          href: '@'\n        });\n\n        tabsCtrl.add($scope);\n        $scope.$on('$destroy', function() {\n          if (!$scope.$tabsDestroy) {\n            // if the containing ionTabs directive is being destroyed\n            // then don't bother going through the controllers remove\n            // method, since remove will reset the active tab as each tab\n            // is being destroyed, causing unnecessary view loads and transitions\n            tabsCtrl.remove($scope);\n          }\n          tabNavElement.isolateScope().$destroy();\n          tabNavElement.remove();\n          tabNavElement = tabContentEle = childElement = null;\n        });\n\n        //Remove title attribute so browser-tooltip does not apear\n        $element[0].removeAttribute('title');\n\n        if (navViewName) {\n          tabCtrl.navViewName = $scope.navViewName = navViewName;\n        }\n        $scope.$on('$stateChangeSuccess', selectIfMatchesState);\n        selectIfMatchesState();\n        function selectIfMatchesState() {\n          if (tabCtrl.tabMatchesState()) {\n            tabsCtrl.select($scope, false);\n          }\n        }\n\n        var tabNavElement = jqLite(tabNavTemplate);\n        tabNavElement.data('$ionTabsController', tabsCtrl);\n        tabNavElement.data('$ionTabController', tabCtrl);\n        tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope));\n\n\n        function tabSelected(isSelected) {\n          if (isSelected && childElementCount) {\n            // this tab is being selected\n\n            // check if the tab is already in the DOM\n            // only do this if the tab has child elements\n            if (!isTabContentAttached) {\n              // tab should be selected and is NOT in the DOM\n              // create a new scope and append it\n              childScope = $scope.$new();\n              childElement = jqLite(tabContentEle);\n              $ionicViewSwitcher.viewEleIsActive(childElement, true);\n              tabsCtrl.$element.append(childElement);\n              $compile(childElement)(childScope);\n              isTabContentAttached = true;\n            }\n\n            // remove the hide class so the tabs content shows up\n            $ionicViewSwitcher.viewEleIsActive(childElement, true);\n\n          } else if (isTabContentAttached && childElement) {\n            // this tab should NOT be selected, and it is already in the DOM\n\n            if ($ionicConfig.views.maxCache() > 0) {\n              // keep the tabs in the DOM, only css hide it\n              $ionicViewSwitcher.viewEleIsActive(childElement, false);\n\n            } else {\n              // do not keep tabs in the DOM\n              destroyTab();\n            }\n\n          }\n        }\n\n        function destroyTab() {\n          childScope && childScope.$destroy();\n          isTabContentAttached && childElement && childElement.remove();\n          tabContentEle.innerHTML = '';\n          isTabContentAttached = childScope = childElement = null;\n        }\n\n        $scope.$watch('$tabSelected', tabSelected);\n\n        $scope.$on('$ionicView.afterEnter', function() {\n          $ionicViewSwitcher.viewEleIsActive(childElement, $scope.$tabSelected);\n        });\n\n        $scope.$on('$ionicView.clearCache', function() {\n          if (!$scope.$tabSelected) {\n            destroyTab();\n          }\n        });\n\n      };\n    }\n  };\n}]);\n\nIonicModule\n.directive('ionTabNav', [function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: ['^ionTabs', '^ionTab'],\n    template:\n    '<a ng-class=\"{\\'has-badge\\':badge, \\'tab-hidden\\':isHidden(), \\'tab-item-active\\': isTabActive()}\" ' +\n      ' ng-disabled=\"disabled()\" class=\"tab-item\">' +\n      '<span class=\"badge {{badgeStyle}}\" ng-if=\"badge\">{{badge}}</span>' +\n      '<i class=\"icon {{getIcon()}}\" ng-if=\"getIcon()\"></i>' +\n      '<span class=\"tab-title\" ng-bind-html=\"title\"></span>' +\n    '</a>',\n    scope: {\n      title: '@',\n      icon: '@',\n      iconOn: '@',\n      iconOff: '@',\n      badge: '=',\n      hidden: '@',\n      disabled: '&',\n      badgeStyle: '@',\n      'class': '@'\n    },\n    link: function($scope, $element, $attrs, ctrls) {\n      var tabsCtrl = ctrls[0],\n        tabCtrl = ctrls[1];\n\n      //Remove title attribute so browser-tooltip does not apear\n      $element[0].removeAttribute('title');\n\n      $scope.selectTab = function(e) {\n        e.preventDefault();\n        tabsCtrl.select(tabCtrl.$scope, true);\n      };\n      if (!$attrs.ngClick) {\n        $element.on('click', function(event) {\n          $scope.$apply(function() {\n            $scope.selectTab(event);\n          });\n        });\n      }\n\n      $scope.isHidden = function() {\n        if ($attrs.hidden === 'true' || $attrs.hidden === true) return true;\n        return false;\n      };\n\n      $scope.getIconOn = function() {\n        return $scope.iconOn || $scope.icon;\n      };\n      $scope.getIconOff = function() {\n        return $scope.iconOff || $scope.icon;\n      };\n\n      $scope.isTabActive = function() {\n        return tabsCtrl.selectedTab() === tabCtrl.$scope;\n      };\n\n      $scope.getIcon = function() {\n        if ( tabsCtrl.selectedTab() === tabCtrl.$scope ) {\n          // active\n          return $scope.iconOn || $scope.icon;\n        }\n        else {\n          // inactive\n          return $scope.iconOff || $scope.icon;\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionTabs\n * @module ionic\n * @delegate ionic.service:$ionicTabsDelegate\n * @restrict E\n * @codepen odqCz\n *\n * @description\n * Powers a multi-tabbed interface with a Tab Bar and a set of \"pages\" that can be tabbed\n * through.\n *\n * Assign any [tabs class](/docs/components#tabs) to the element to define\n * its look and feel.\n *\n * For iOS, tabs will appear at the bottom of the screen. For Android, tabs will be at the top\n * of the screen, below the nav-bar. This follows each OS's design specification, but can be\n * configured with the {@link ionic.provider:$ionicConfigProvider}.\n *\n * See the {@link ionic.directive:ionTab} directive's documentation for more details on\n * individual tabs.\n *\n * Note: do not place ion-tabs inside of an ion-content element; it has been known to cause a\n * certain CSS bug.\n *\n * @usage\n * ```html\n * <ion-tabs class=\"tabs-positive tabs-icon-top\">\n *\n *   <ion-tab title=\"Home\" icon-on=\"ion-ios-filing\" icon-off=\"ion-ios-filing-outline\">\n *     <!-- Tab 1 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"About\" icon-on=\"ion-ios-clock\" icon-off=\"ion-ios-clock-outline\">\n *     <!-- Tab 2 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"Settings\" icon-on=\"ion-ios-gear\" icon-off=\"ion-ios-gear-outline\">\n *     <!-- Tab 3 content -->\n *   </ion-tab>\n *\n * </ion-tabs>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify these tabs\n * with {@link ionic.service:$ionicTabsDelegate}.\n */\n\nIonicModule\n.directive('ionTabs', [\n  '$ionicTabsDelegate',\n  '$ionicConfig',\nfunction($ionicTabsDelegate, $ionicConfig) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: '$ionicTabs',\n    compile: function(tElement) {\n      //We cannot use regular transclude here because it breaks element.data()\n      //inheritance on compile\n      var innerElement = jqLite('<div class=\"tab-nav tabs\">');\n      innerElement.append(tElement.contents());\n\n      tElement.append(innerElement)\n              .addClass('tabs-' + $ionicConfig.tabs.position() + ' tabs-' + $ionicConfig.tabs.style());\n\n      return { pre: prelink, post: postLink };\n      function prelink($scope, $element, $attr, tabsCtrl) {\n        var deregisterInstance = $ionicTabsDelegate._registerInstance(\n          tabsCtrl, $attr.delegateHandle, tabsCtrl.hasActiveScope\n        );\n\n        tabsCtrl.$scope = $scope;\n        tabsCtrl.$element = $element;\n        tabsCtrl.$tabsElement = jqLite($element[0].querySelector('.tabs'));\n\n        $scope.$watch(function() { return $element[0].className; }, function(value) {\n          var isTabsTop = value.indexOf('tabs-top') !== -1;\n          var isHidden = value.indexOf('tabs-item-hide') !== -1;\n          $scope.$hasTabs = !isTabsTop && !isHidden;\n          $scope.$hasTabsTop = isTabsTop && !isHidden;\n          $scope.$emit('$ionicTabs.top', $scope.$hasTabsTop);\n        });\n\n        function emitLifecycleEvent(ev, data) {\n          ev.stopPropagation();\n          var previousSelectedTab = tabsCtrl.previousSelectedTab();\n          if (previousSelectedTab) {\n            previousSelectedTab.$broadcast(ev.name.replace('NavView', 'Tabs'), data);\n          }\n        }\n\n        $scope.$on('$ionicNavView.beforeLeave', emitLifecycleEvent);\n        $scope.$on('$ionicNavView.afterLeave', emitLifecycleEvent);\n        $scope.$on('$ionicNavView.leave', emitLifecycleEvent);\n\n        $scope.$on('$destroy', function() {\n          // variable to inform child tabs that they're all being blown away\n          // used so that while destorying an individual tab, each one\n          // doesn't select the next tab as the active one, which causes unnecessary\n          // loading of tab views when each will eventually all go away anyway\n          $scope.$tabsDestroy = true;\n          deregisterInstance();\n          tabsCtrl.$tabsElement = tabsCtrl.$element = tabsCtrl.$scope = innerElement = null;\n          delete $scope.$hasTabs;\n          delete $scope.$hasTabsTop;\n        });\n      }\n\n      function postLink($scope, $element, $attr, tabsCtrl) {\n        if (!tabsCtrl.selectedTab()) {\n          // all the tabs have been added\n          // but one hasn't been selected yet\n          tabsCtrl.select(0);\n        }\n      }\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionTitle\n* @module ionic\n* @restrict E\n*\n* Used for titles in header and nav bars. New in 1.2\n*\n* Identical to <div class=\"title\"> but with future compatibility for Ionic 2\n*\n* @usage\n*\n* ```html\n* <ion-nav-bar>\n*   <ion-title>Hello</ion-title>\n* <ion-nav-bar>\n* ```\n*/\nIonicModule\n.directive('ionTitle', [function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.addClass('title');\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionToggle\n * @module ionic\n * @codepen tfAzj\n * @restrict E\n *\n * @description\n * A toggle is an animated switch which binds a given model to a boolean.\n *\n * Allows dragging of the switch's nub.\n *\n * The toggle behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]) otherwise.\n *\n * @param toggle-class {string=} Sets the CSS class on the inner `label.toggle` element created by the directive.\n *\n * @usage\n * Below is an example of a toggle directive which is wired up to the `airplaneMode` model\n * and has the `toggle-calm` CSS class assigned to the inner element.\n *\n * ```html\n * <ion-toggle ng-model=\"airplaneMode\" toggle-class=\"toggle-calm\">Airplane Mode</ion-toggle>\n * ```\n */\nIonicModule\n.directive('ionToggle', [\n  '$timeout',\n  '$ionicConfig',\nfunction($timeout, $ionicConfig) {\n\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<div class=\"item item-toggle\">' +\n        '<div ng-transclude></div>' +\n        '<label class=\"toggle\">' +\n          '<input type=\"checkbox\">' +\n          '<div class=\"track\">' +\n            '<div class=\"handle\"></div>' +\n          '</div>' +\n        '</label>' +\n      '</div>',\n\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange,\n        'ng-required': attr.ngRequired,\n        'required': attr.required\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n\n      if (attr.toggleClass) {\n        element[0].getElementsByTagName('label')[0].classList.add(attr.toggleClass);\n      }\n\n      element.addClass('toggle-' + $ionicConfig.form.toggle());\n\n      return function($scope, $element) {\n        var el = $element[0].getElementsByTagName('label')[0];\n        var checkbox = el.children[0];\n        var track = el.children[1];\n        var handle = track.children[0];\n\n        var ngModelController = jqLite(checkbox).controller('ngModel');\n\n        $scope.toggle = new ionic.views.Toggle({\n          el: el,\n          track: track,\n          checkbox: checkbox,\n          handle: handle,\n          onChange: function() {\n            if (ngModelController) {\n              ngModelController.$setViewValue(checkbox.checked);\n              $scope.$apply();\n            }\n          }\n        });\n\n        $scope.$on('$destroy', function() {\n          $scope.toggle.destroy();\n        });\n      };\n    }\n\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionView\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * A container for view content and any navigational and header bar information. When a view\n * enters and exits its parent {@link ionic.directive:ionNavView}, the view also emits view\n * information, such as its title, whether the back button should be displayed or not, whether the\n * corresponding {@link ionic.directive:ionNavBar} should be displayed or not, which transition the view\n * should use to animate, and which direction to animate.\n *\n * *Views are cached to improve performance.* When a view is navigated away from, its element is\n * left in the DOM, and its scope is disconnected from the `$watch` cycle. When navigating to a\n * view that is already cached, its scope is reconnected, and the existing element, which was\n * left in the DOM, becomes active again. This can be disabled, or the maximum number of cached\n * views changed in {@link ionic.provider:$ionicConfigProvider}, in the view's `$state` configuration, or\n * as an attribute on the view itself (see below).\n *\n * @usage\n * Below is an example where our page will load with a {@link ionic.directive:ionNavBar} containing\n * \"My Page\" as the title.\n *\n * ```html\n * <ion-nav-bar></ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view view-title=\"My Page\">\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * ## View LifeCycle and Events\n *\n * Views can be cached, which means ***controllers normally only load once***, which may\n * affect your controller logic. To know when a view has entered or left, events\n * have been added that are emitted from the view's scope. These events also\n * contain data about the view, such as the title and whether the back button should\n * show. Also contained is transition data, such as the transition type and\n * direction that will be or was used.\n *\n * Life cycle events are emitted upwards from the transitioning view's scope. In some cases, it is\n * desirable for a child/nested view to be notified of the event.\n * For this use case, `$ionicParentView` life cycle events are broadcast downwards.\n *\n * <table class=\"table\">\n *  <tr>\n *   <td><code>$ionicView.loaded</code></td>\n *   <td>The view has loaded. This event only happens once per\n * view being created and added to the DOM. If a view leaves but is cached,\n * then this event will not fire again on a subsequent viewing. The loaded event\n * is good place to put your setup code for the view; however, it is not the\n * recommended event to listen to when a view becomes active.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.enter</code></td>\n *   <td>The view has fully entered and is now the active view.\n * This event will fire, whether it was the first load or a cached view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.leave</code></td>\n *   <td>The view has finished leaving and is no longer the\n * active view. This event will fire, whether it is cached or destroyed.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.beforeEnter</code></td>\n *   <td>The view is about to enter and become the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.beforeLeave</code></td>\n *   <td>The view is about to leave and no longer be the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.afterEnter</code></td>\n *   <td>The view has fully entered and is now the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.afterLeave</code></td>\n *   <td>The view has finished leaving and is no longer the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.unloaded</code></td>\n *   <td>The view's controller has been destroyed and its element has been\n * removed from the DOM.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.enter</code></td>\n *   <td>The parent view has fully entered and is now the active view.\n * This event will fire, whether it was the first load or a cached view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.leave</code></td>\n *   <td>The parent view has finished leaving and is no longer the\n * active view. This event will fire, whether it is cached or destroyed.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.beforeEnter</code></td>\n *   <td>The parent view is about to enter and become the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.beforeLeave</code></td>\n *   <td>The parent view is about to leave and no longer be the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.afterEnter</code></td>\n *   <td>The parent view has fully entered and is now the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.afterLeave</code></td>\n *   <td>The parent view has finished leaving and is no longer the active view.</td>\n *  </tr>\n * </table>\n *\n * ## LifeCycle Event Usage\n *\n * Below is an example of how to listen to life cycle events and\n * access state parameter data\n *\n * ```js\n * $scope.$on(\"$ionicView.beforeEnter\", function(event, data){\n *    // handle event\n *    console.log(\"State Params: \", data.stateParams);\n * });\n *\n * $scope.$on(\"$ionicView.enter\", function(event, data){\n *    // handle event\n *    console.log(\"State Params: \", data.stateParams);\n * });\n *\n * $scope.$on(\"$ionicView.afterEnter\", function(event, data){\n *    // handle event\n *    console.log(\"State Params: \", data.stateParams);\n * });\n * ```\n *\n * ## Caching\n *\n * Caching can be disabled and enabled in multiple ways. By default, Ionic will\n * cache a maximum of 10 views. You can optionally choose to disable caching at\n * either an individual view basis, or by global configuration. Please see the\n * _Caching_ section in {@link ionic.directive:ionNavView} for more info.\n *\n * @param {string=} view-title A text-only title to display on the parent {@link ionic.directive:ionNavBar}.\n * For an HTML title, such as an image, see {@link ionic.directive:ionNavTitle} instead.\n * @param {boolean=} cache-view If this view should be allowed to be cached or not.\n * Please see the _Caching_ section in {@link ionic.directive:ionNavView} for\n * more info. Default `true`\n * @param {boolean=} can-swipe-back If this view should be allowed to use the swipe to go back gesture or not.\n * This does not enable the swipe to go back feature if it is not available for the platform it's running\n * from, or there isn't a previous view. Default `true`\n * @param {boolean=} hide-back-button Whether to hide the back button on the parent\n * {@link ionic.directive:ionNavBar} by default.\n * @param {boolean=} hide-nav-bar Whether to hide the parent\n * {@link ionic.directive:ionNavBar} by default.\n */\nIonicModule\n.directive('ionView', function() {\n  return {\n    restrict: 'EA',\n    priority: 1000,\n    controller: '$ionicView',\n    compile: function(tElement) {\n      tElement.addClass('pane');\n      tElement[0].removeAttribute('title');\n      return function link($scope, $element, $attrs, viewCtrl) {\n        viewCtrl.init();\n      };\n    }\n  };\n});\n\n})();"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/ionic.bundle.js",
    "content": "/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/*!\n * Copyright 2015 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.3.1\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n\n// Create global ionic obj and its namespaces\n// build processes may have already created an ionic obj\nwindow.ionic = window.ionic || {};\nwindow.ionic.views = {};\nwindow.ionic.version = '1.3.1';\n\n(function (ionic) {\n\n  ionic.DelegateService = function(methodNames) {\n\n    if (methodNames.indexOf('$getByHandle') > -1) {\n      throw new Error(\"Method '$getByHandle' is implicitly added to each delegate service. Do not list it as a method.\");\n    }\n\n    function trueFn() { return true; }\n\n    return ['$log', function($log) {\n\n      /*\n       * Creates a new object that will have all the methodNames given,\n       * and call them on the given the controller instance matching given\n       * handle.\n       * The reason we don't just let $getByHandle return the controller instance\n       * itself is that the controller instance might not exist yet.\n       *\n       * We want people to be able to do\n       * `var instance = $ionicScrollDelegate.$getByHandle('foo')` on controller\n       * instantiation, but on controller instantiation a child directive\n       * may not have been compiled yet!\n       *\n       * So this is our way of solving this problem: we create an object\n       * that will only try to fetch the controller with given handle\n       * once the methods are actually called.\n       */\n      function DelegateInstance(instances, handle) {\n        this._instances = instances;\n        this.handle = handle;\n      }\n      methodNames.forEach(function(methodName) {\n        DelegateInstance.prototype[methodName] = instanceMethodCaller(methodName);\n      });\n\n\n      /**\n       * The delegate service (eg $ionicNavBarDelegate) is just an instance\n       * with a non-defined handle, a couple extra methods for registering\n       * and narrowing down to a specific handle.\n       */\n      function DelegateService() {\n        this._instances = [];\n      }\n      DelegateService.prototype = DelegateInstance.prototype;\n      DelegateService.prototype._registerInstance = function(instance, handle, filterFn) {\n        var instances = this._instances;\n        instance.$$delegateHandle = handle;\n        instance.$$filterFn = filterFn || trueFn;\n        instances.push(instance);\n\n        return function deregister() {\n          var index = instances.indexOf(instance);\n          if (index !== -1) {\n            instances.splice(index, 1);\n          }\n        };\n      };\n      DelegateService.prototype.$getByHandle = function(handle) {\n        return new DelegateInstance(this._instances, handle);\n      };\n\n      return new DelegateService();\n\n      function instanceMethodCaller(methodName) {\n        return function caller() {\n          var handle = this.handle;\n          var args = arguments;\n          var foundInstancesCount = 0;\n          var returnValue;\n\n          this._instances.forEach(function(instance) {\n            if ((!handle || handle == instance.$$delegateHandle) && instance.$$filterFn(instance)) {\n              foundInstancesCount++;\n              var ret = instance[methodName].apply(instance, args);\n              //Only return the value from the first call\n              if (foundInstancesCount === 1) {\n                returnValue = ret;\n              }\n            }\n          });\n\n          if (!foundInstancesCount && handle) {\n            return $log.warn(\n              'Delegate for handle \"' + handle + '\" could not find a ' +\n              'corresponding element with delegate-handle=\"' + handle + '\"! ' +\n              methodName + '() was not called!\\n' +\n              'Possible cause: If you are calling ' + methodName + '() immediately, and ' +\n              'your element with delegate-handle=\"' + handle + '\" is a child of your ' +\n              'controller, then your element may not be compiled yet. Put a $timeout ' +\n              'around your call to ' + methodName + '() and try again.'\n            );\n          }\n          return returnValue;\n        };\n      }\n\n    }];\n  };\n\n})(window.ionic);\n\n(function(window, document, ionic) {\n\n  var readyCallbacks = [];\n  var isDomReady = document.readyState === 'complete' || document.readyState === 'interactive';\n\n  function domReady() {\n    isDomReady = true;\n    for (var x = 0; x < readyCallbacks.length; x++) {\n      ionic.requestAnimationFrame(readyCallbacks[x]);\n    }\n    readyCallbacks = [];\n    document.removeEventListener('DOMContentLoaded', domReady);\n  }\n  if (!isDomReady) {\n    document.addEventListener('DOMContentLoaded', domReady);\n  }\n\n\n  // From the man himself, Mr. Paul Irish.\n  // The requestAnimationFrame polyfill\n  // Put it on window just to preserve its context\n  // without having to use .call\n  window._rAF = (function() {\n    return window.requestAnimationFrame ||\n           window.webkitRequestAnimationFrame ||\n           window.mozRequestAnimationFrame ||\n           function(callback) {\n             window.setTimeout(callback, 16);\n           };\n  })();\n\n  var cancelAnimationFrame = window.cancelAnimationFrame ||\n    window.webkitCancelAnimationFrame ||\n    window.mozCancelAnimationFrame ||\n    window.webkitCancelRequestAnimationFrame;\n\n  /**\n  * @ngdoc utility\n  * @name ionic.DomUtil\n  * @module ionic\n  */\n  ionic.DomUtil = {\n    //Call with proper context\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#requestAnimationFrame\n     * @alias ionic.requestAnimationFrame\n     * @description Calls [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame), or a polyfill if not available.\n     * @param {function} callback The function to call when the next frame\n     * happens.\n     */\n    requestAnimationFrame: function(cb) {\n      return window._rAF(cb);\n    },\n\n    cancelAnimationFrame: function(requestId) {\n      cancelAnimationFrame(requestId);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#animationFrameThrottle\n     * @alias ionic.animationFrameThrottle\n     * @description\n     * When given a callback, if that callback is called 100 times between\n     * animation frames, adding Throttle will make it only run the last of\n     * the 100 calls.\n     *\n     * @param {function} callback a function which will be throttled to\n     * requestAnimationFrame\n     * @returns {function} A function which will then call the passed in callback.\n     * The passed in callback will receive the context the returned function is\n     * called with.\n     */\n    animationFrameThrottle: function(cb) {\n      var args, isQueued, context;\n      return function() {\n        args = arguments;\n        context = this;\n        if (!isQueued) {\n          isQueued = true;\n          ionic.requestAnimationFrame(function() {\n            cb.apply(context, args);\n            isQueued = false;\n          });\n        }\n      };\n    },\n\n    contains: function(parentNode, otherNode) {\n      var current = otherNode;\n      while (current) {\n        if (current === parentNode) return true;\n        current = current.parentNode;\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getPositionInParent\n     * @description\n     * Find an element's scroll offset within its container.\n     * @param {DOMElement} element The element to find the offset of.\n     * @returns {object} A position object with the following properties:\n     *   - `{number}` `left` The left offset of the element.\n     *   - `{number}` `top` The top offset of the element.\n     */\n    getPositionInParent: function(el) {\n      return {\n        left: el.offsetLeft,\n        top: el.offsetTop\n      };\n    },\n\n    getOffsetTop: function(el) {\n      var curtop = 0;\n      if (el.offsetParent) {\n        do {\n          curtop += el.offsetTop;\n          el = el.offsetParent;\n        } while (el)\n        return curtop;\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#ready\n     * @description\n     * Call a function when the DOM is ready, or if it is already ready\n     * call the function immediately.\n     * @param {function} callback The function to be called.\n     */\n    ready: function(cb) {\n      if (isDomReady) {\n        ionic.requestAnimationFrame(cb);\n      } else {\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getTextBounds\n     * @description\n     * Get a rect representing the bounds of the given textNode.\n     * @param {DOMElement} textNode The textNode to find the bounds of.\n     * @returns {object} An object representing the bounds of the node. Properties:\n     *   - `{number}` `left` The left position of the textNode.\n     *   - `{number}` `right` The right position of the textNode.\n     *   - `{number}` `top` The top position of the textNode.\n     *   - `{number}` `bottom` The bottom position of the textNode.\n     *   - `{number}` `width` The width of the textNode.\n     *   - `{number}` `height` The height of the textNode.\n     */\n    getTextBounds: function(textNode) {\n      if (document.createRange) {\n        var range = document.createRange();\n        range.selectNodeContents(textNode);\n        if (range.getBoundingClientRect) {\n          var rect = range.getBoundingClientRect();\n          if (rect) {\n            var sx = window.scrollX;\n            var sy = window.scrollY;\n\n            return {\n              top: rect.top + sy,\n              left: rect.left + sx,\n              right: rect.left + sx + rect.width,\n              bottom: rect.top + sy + rect.height,\n              width: rect.width,\n              height: rect.height\n            };\n          }\n        }\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getChildIndex\n     * @description\n     * Get the first index of a child node within the given element of the\n     * specified type.\n     * @param {DOMElement} element The element to find the index of.\n     * @param {string} type The nodeName to match children of element against.\n     * @returns {number} The index, or -1, of a child with nodeName matching type.\n     */\n    getChildIndex: function(element, type) {\n      if (type) {\n        var ch = element.parentNode.children;\n        var c;\n        for (var i = 0, k = 0, j = ch.length; i < j; i++) {\n          c = ch[i];\n          if (c.nodeName && c.nodeName.toLowerCase() == type) {\n            if (c == element) {\n              return k;\n            }\n            k++;\n          }\n        }\n      }\n      return Array.prototype.slice.call(element.parentNode.children).indexOf(element);\n    },\n\n    /**\n     * @private\n     */\n    swapNodes: function(src, dest) {\n      dest.parentNode.insertBefore(src, dest);\n    },\n\n    elementIsDescendant: function(el, parent, stopAt) {\n      var current = el;\n      do {\n        if (current === parent) return true;\n        current = current.parentNode;\n      } while (current && current !== stopAt);\n      return false;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent of element matching the\n     * className, or null.\n     */\n    getParentWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while (e.parentNode && depth--) {\n        if (e.parentNode.classList && e.parentNode.classList.contains(className)) {\n          return e.parentNode;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentOrSelfWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent or self matching the\n     * className, or null.\n     */\n    getParentOrSelfWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while (e && depth--) {\n        if (e.classList && e.classList.contains(className)) {\n          return e;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#rectContains\n     * @param {number} x\n     * @param {number} y\n     * @param {number} x1\n     * @param {number} y1\n     * @param {number} x2\n     * @param {number} y2\n     * @returns {boolean} Whether {x,y} fits within the rectangle defined by\n     * {x1,y1,x2,y2}.\n     */\n    rectContains: function(x, y, x1, y1, x2, y2) {\n      if (x < x1 || x > x2) return false;\n      if (y < y1 || y > y2) return false;\n      return true;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#blurAll\n     * @description\n     * Blurs any currently focused input element\n     * @returns {DOMElement} The element blurred or null\n     */\n    blurAll: function() {\n      if (document.activeElement && document.activeElement != document.body) {\n        document.activeElement.blur();\n        return document.activeElement;\n      }\n      return null;\n    },\n\n    cachedAttr: function(ele, key, value) {\n      ele = ele && ele.length && ele[0] || ele;\n      if (ele && ele.setAttribute) {\n        var dataKey = '$attr-' + key;\n        if (arguments.length > 2) {\n          if (ele[dataKey] !== value) {\n            ele.setAttribute(key, value);\n            ele[dataKey] = value;\n          }\n        } else if (typeof ele[dataKey] == 'undefined') {\n          ele[dataKey] = ele.getAttribute(key);\n        }\n        return ele[dataKey];\n      }\n    },\n\n    cachedStyles: function(ele, styles) {\n      ele = ele && ele.length && ele[0] || ele;\n      if (ele && ele.style) {\n        for (var prop in styles) {\n          if (ele['$style-' + prop] !== styles[prop]) {\n            ele.style[prop] = ele['$style-' + prop] = styles[prop];\n          }\n        }\n      }\n    }\n\n  };\n\n  //Shortcuts\n  ionic.requestAnimationFrame = ionic.DomUtil.requestAnimationFrame;\n  ionic.cancelAnimationFrame = ionic.DomUtil.cancelAnimationFrame;\n  ionic.animationFrameThrottle = ionic.DomUtil.animationFrameThrottle;\n\n})(window, document, ionic);\n\n/**\n * ion-events.js\n *\n * Author: Max Lynch <max@drifty.com>\n *\n * Framework events handles various mobile browser events, and\n * detects special events like tap/swipe/etc. and emits them\n * as custom events that can be used in an app.\n *\n * Portions lovingly adapted from github.com/maker/ratchet and github.com/alexgibson/tap.js - thanks guys!\n */\n\n(function(ionic) {\n\n  // Custom event polyfill\n  ionic.CustomEvent = (function() {\n    if( typeof window.CustomEvent === 'function' ) return CustomEvent;\n\n    var customEvent = function(event, params) {\n      var evt;\n      params = params || {\n        bubbles: false,\n        cancelable: false,\n        detail: undefined\n      };\n      try {\n        evt = document.createEvent(\"CustomEvent\");\n        evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n      } catch (error) {\n        // fallback for browsers that don't support createEvent('CustomEvent')\n        evt = document.createEvent(\"Event\");\n        for (var param in params) {\n          evt[param] = params[param];\n        }\n        evt.initEvent(event, params.bubbles, params.cancelable);\n      }\n      return evt;\n    };\n    customEvent.prototype = window.Event.prototype;\n    return customEvent;\n  })();\n\n\n  /**\n   * @ngdoc utility\n   * @name ionic.EventController\n   * @module ionic\n   */\n  ionic.EventController = {\n    VIRTUALIZED_EVENTS: ['tap', 'swipe', 'swiperight', 'swipeleft', 'drag', 'hold', 'release'],\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#trigger\n     * @alias ionic.trigger\n     * @param {string} eventType The event to trigger.\n     * @param {object} data The data for the event. Hint: pass in\n     * `{target: targetElement}`\n     * @param {boolean=} bubbles Whether the event should bubble up the DOM.\n     * @param {boolean=} cancelable Whether the event should be cancelable.\n     */\n    // Trigger a new event\n    trigger: function(eventType, data, bubbles, cancelable) {\n      var event = new ionic.CustomEvent(eventType, {\n        detail: data,\n        bubbles: !!bubbles,\n        cancelable: !!cancelable\n      });\n\n      // Make sure to trigger the event on the given target, or dispatch it from\n      // the window if we don't have an event target\n      data && data.target && data.target.dispatchEvent && data.target.dispatchEvent(event) || window.dispatchEvent(event);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#on\n     * @alias ionic.on\n     * @description Listen to an event on an element.\n     * @param {string} type The event to listen for.\n     * @param {function} callback The listener to be called.\n     * @param {DOMElement} element The element to listen for the event on.\n     */\n    on: function(type, callback, element) {\n      var e = element || window;\n\n      // Bind a gesture if it's a virtual event\n      for(var i = 0, j = this.VIRTUALIZED_EVENTS.length; i < j; i++) {\n        if(type == this.VIRTUALIZED_EVENTS[i]) {\n          var gesture = new ionic.Gesture(element);\n          gesture.on(type, callback);\n          return gesture;\n        }\n      }\n\n      // Otherwise bind a normal event\n      e.addEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#off\n     * @alias ionic.off\n     * @description Remove an event listener.\n     * @param {string} type\n     * @param {function} callback\n     * @param {DOMElement} element\n     */\n    off: function(type, callback, element) {\n      element.removeEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#onGesture\n     * @alias ionic.onGesture\n     * @description Add an event listener for a gesture on an element.\n     *\n     * Available eventTypes (from [hammer.js](http://eightmedia.github.io/hammer.js/)):\n     *\n     * `hold`, `tap`, `doubletap`, `drag`, `dragstart`, `dragend`, `dragup`, `dragdown`, <br/>\n     * `dragleft`, `dragright`, `swipe`, `swipeup`, `swipedown`, `swipeleft`, `swiperight`, <br/>\n     * `transform`, `transformstart`, `transformend`, `rotate`, `pinch`, `pinchin`, `pinchout`, <br/>\n     * `touch`, `release`\n     *\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {DOMElement} element The angular element to listen for the event on.\n     * @param {object} options object.\n     * @returns {ionic.Gesture} The gesture object (use this to remove the gesture later on).\n     */\n    onGesture: function(type, callback, element, options) {\n      var gesture = new ionic.Gesture(element, options);\n      gesture.on(type, callback);\n      return gesture;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#offGesture\n     * @alias ionic.offGesture\n     * @description Remove an event listener for a gesture created on an element.\n     * @param {ionic.Gesture} gesture The gesture that should be removed.\n     * @param {string} eventType The gesture event to remove the listener for.\n     * @param {function(e)} callback The listener to remove.\n\n     */\n    offGesture: function(gesture, type, callback) {\n      gesture && gesture.off(type, callback);\n    },\n\n    handlePopState: function() {}\n  };\n\n\n  // Map some convenient top-level functions for event handling\n  ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); };\n  ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); };\n  ionic.trigger = ionic.EventController.trigger;//function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); };\n  ionic.onGesture = function() { return ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); };\n  ionic.offGesture = function() { return ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); };\n\n})(window.ionic);\n\n/* eslint camelcase:0 */\n/**\n  * Simple gesture controllers with some common gestures that emit\n  * gesture events.\n  *\n  * Ported from github.com/EightMedia/hammer.js Gestures - thanks!\n  */\n(function(ionic) {\n\n  /**\n   * ionic.Gestures\n   * use this to create instances\n   * @param   {HTMLElement}   element\n   * @param   {Object}        options\n   * @returns {ionic.Gestures.Instance}\n   * @constructor\n   */\n  ionic.Gesture = function(element, options) {\n    return new ionic.Gestures.Instance(element, options || {});\n  };\n\n  ionic.Gestures = {};\n\n  // default settings\n  ionic.Gestures.defaults = {\n    // add css to the element to prevent the browser from doing\n    // its native behavior. this doesnt prevent the scrolling,\n    // but cancels the contextmenu, tap highlighting etc\n    // set to false to disable this\n    stop_browser_behavior: 'disable-user-behavior'\n  };\n\n  // detect touchevents\n  ionic.Gestures.HAS_POINTEREVENTS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;\n  ionic.Gestures.HAS_TOUCHEVENTS = ('ontouchstart' in window);\n\n  // dont use mouseevents on mobile devices\n  ionic.Gestures.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;\n  ionic.Gestures.NO_MOUSEEVENTS = ionic.Gestures.HAS_TOUCHEVENTS && window.navigator.userAgent.match(ionic.Gestures.MOBILE_REGEX);\n\n  // eventtypes per touchevent (start, move, end)\n  // are filled by ionic.Gestures.event.determineEventTypes on setup\n  ionic.Gestures.EVENT_TYPES = {};\n\n  // direction defines\n  ionic.Gestures.DIRECTION_DOWN = 'down';\n  ionic.Gestures.DIRECTION_LEFT = 'left';\n  ionic.Gestures.DIRECTION_UP = 'up';\n  ionic.Gestures.DIRECTION_RIGHT = 'right';\n\n  // pointer type\n  ionic.Gestures.POINTER_MOUSE = 'mouse';\n  ionic.Gestures.POINTER_TOUCH = 'touch';\n  ionic.Gestures.POINTER_PEN = 'pen';\n\n  // touch event defines\n  ionic.Gestures.EVENT_START = 'start';\n  ionic.Gestures.EVENT_MOVE = 'move';\n  ionic.Gestures.EVENT_END = 'end';\n\n  // hammer document where the base events are added at\n  ionic.Gestures.DOCUMENT = window.document;\n\n  // plugins namespace\n  ionic.Gestures.plugins = {};\n\n  // if the window events are set...\n  ionic.Gestures.READY = false;\n\n  /**\n   * setup events to detect gestures on the document\n   */\n  function setup() {\n    if(ionic.Gestures.READY) {\n      return;\n    }\n\n    // find what eventtypes we add listeners to\n    ionic.Gestures.event.determineEventTypes();\n\n    // Register all gestures inside ionic.Gestures.gestures\n    for(var name in ionic.Gestures.gestures) {\n      if(ionic.Gestures.gestures.hasOwnProperty(name)) {\n        ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);\n      }\n    }\n\n    // Add touch events on the document\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_MOVE, ionic.Gestures.detection.detect);\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_END, ionic.Gestures.detection.detect);\n\n    // ionic.Gestures is ready...!\n    ionic.Gestures.READY = true;\n  }\n\n  /**\n   * create new hammer instance\n   * all methods should return the instance itself, so it is chainable.\n   * @param   {HTMLElement}       element\n   * @param   {Object}            [options={}]\n   * @returns {ionic.Gestures.Instance}\n   * @name Gesture.Instance\n   * @constructor\n   */\n  ionic.Gestures.Instance = function(element, options) {\n    var self = this;\n\n    // A null element was passed into the instance, which means\n    // whatever lookup was done to find this element failed to find it\n    // so we can't listen for events on it.\n    if(element === null) {\n      void 0;\n      return this;\n    }\n\n    // setup ionic.GesturesJS window events and register all gestures\n    // this also sets up the default options\n    setup();\n\n    this.element = element;\n\n    // start/stop detection option\n    this.enabled = true;\n\n    // merge options\n    this.options = ionic.Gestures.utils.extend(\n        ionic.Gestures.utils.extend({}, ionic.Gestures.defaults),\n        options || {});\n\n    // add some css to the element to prevent the browser from doing its native behavoir\n    if(this.options.stop_browser_behavior) {\n      ionic.Gestures.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);\n    }\n\n    // start detection on touchstart\n    ionic.Gestures.event.onTouch(element, ionic.Gestures.EVENT_START, function(ev) {\n      if(self.enabled) {\n        ionic.Gestures.detection.startDetect(self, ev);\n      }\n    });\n\n    // return instance\n    return this;\n  };\n\n\n  ionic.Gestures.Instance.prototype = {\n    /**\n     * bind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    on: function onEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t = 0; t < gestures.length; t++) {\n        this.element.addEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * unbind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    off: function offEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t = 0; t < gestures.length; t++) {\n        this.element.removeEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * trigger gesture event\n     * @param   {String}      gesture\n     * @param   {Object}      eventData\n     * @returns {ionic.Gestures.Instance}\n     */\n    trigger: function triggerEvent(gesture, eventData){\n      // create DOM event\n      var event = ionic.Gestures.DOCUMENT.createEvent('Event');\n      event.initEvent(gesture, true, true);\n      event.gesture = eventData;\n\n      // trigger on the target if it is in the instance element,\n      // this is for event delegation tricks\n      var element = this.element;\n      if(ionic.Gestures.utils.hasParent(eventData.target, element)) {\n        element = eventData.target;\n      }\n\n      element.dispatchEvent(event);\n      return this;\n    },\n\n\n    /**\n     * enable of disable hammer.js detection\n     * @param   {Boolean}   state\n     * @returns {ionic.Gestures.Instance}\n     */\n    enable: function enable(state) {\n      this.enabled = state;\n      return this;\n    }\n  };\n\n  /**\n   * this holds the last move event,\n   * used to fix empty touchend issue\n   * see the onTouch event for an explanation\n   * type {Object}\n   */\n  var last_move_event = null;\n\n\n  /**\n   * when the mouse is hold down, this is true\n   * type {Boolean}\n   */\n  var enable_detect = false;\n\n\n  /**\n   * when touch events have been fired, this is true\n   * type {Boolean}\n   */\n  var touch_triggered = false;\n\n\n  ionic.Gestures.event = {\n    /**\n     * simple addEventListener\n     * @param   {HTMLElement}   element\n     * @param   {String}        type\n     * @param   {Function}      handler\n     */\n    bindDom: function(element, type, handler) {\n      var types = type.split(' ');\n      for(var t = 0; t < types.length; t++) {\n        element.addEventListener(types[t], handler, false);\n      }\n    },\n\n\n    /**\n     * touch events with mouse fallback\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Function}      handler\n     */\n    onTouch: function onTouch(element, eventType, handler) {\n      var self = this;\n\n      this.bindDom(element, ionic.Gestures.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {\n        var sourceEventType = ev.type.toLowerCase();\n\n        // onmouseup, but when touchend has been fired we do nothing.\n        // this is for touchdevices which also fire a mouseup on touchend\n        if(sourceEventType.match(/mouse/) && touch_triggered) {\n          return;\n        }\n\n        // mousebutton must be down or a touch event\n        else if( sourceEventType.match(/touch/) ||   // touch events are always on screen\n          sourceEventType.match(/pointerdown/) || // pointerevents touch\n          (sourceEventType.match(/mouse/) && ev.which === 1)   // mouse is pressed\n          ){\n            enable_detect = true;\n          }\n\n        // mouse isn't pressed\n        else if(sourceEventType.match(/mouse/) && ev.which !== 1) {\n          enable_detect = false;\n        }\n\n\n        // we are in a touch event, set the touch triggered bool to true,\n        // this for the conflicts that may occur on ios and android\n        if(sourceEventType.match(/touch|pointer/)) {\n          touch_triggered = true;\n        }\n\n        // count the total touches on the screen\n        var count_touches = 0;\n\n        // when touch has been triggered in this detection session\n        // and we are now handling a mouse event, we stop that to prevent conflicts\n        if(enable_detect) {\n          // update pointerevent\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType != ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n          // touch\n          else if(sourceEventType.match(/touch/)) {\n            count_touches = ev.touches.length;\n          }\n          // mouse\n          else if(!touch_triggered) {\n            count_touches = sourceEventType.match(/up/) ? 0 : 1;\n          }\n\n          // if we are in a end event, but when we remove one touch and\n          // we still have enough, set eventType to move\n          if(count_touches > 0 && eventType == ionic.Gestures.EVENT_END) {\n            eventType = ionic.Gestures.EVENT_MOVE;\n          }\n          // no touches, force the end event\n          else if(!count_touches) {\n            eventType = ionic.Gestures.EVENT_END;\n          }\n\n          // store the last move event\n          if(count_touches || last_move_event === null) {\n            last_move_event = ev;\n          }\n\n          // trigger the handler\n          handler.call(ionic.Gestures.detection, self.collectEventData(element, eventType, self.getTouchList(last_move_event, eventType), ev));\n\n          // remove pointerevent from list\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType == ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n        }\n\n        //debug(sourceEventType +\" \"+ eventType);\n\n        // on the end we reset everything\n        if(!count_touches) {\n          last_move_event = null;\n          enable_detect = false;\n          touch_triggered = false;\n          ionic.Gestures.PointerEvent.reset();\n        }\n      });\n    },\n\n\n    /**\n     * we have different events for each device/browser\n     * determine what we need and set them in the ionic.Gestures.EVENT_TYPES constant\n     */\n    determineEventTypes: function determineEventTypes() {\n      // determine the eventtype we want to set\n      var types;\n\n      // pointerEvents magic\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        types = ionic.Gestures.PointerEvent.getEvents();\n      }\n      // on Android, iOS, blackberry, windows mobile we dont want any mouseevents\n      else if(ionic.Gestures.NO_MOUSEEVENTS) {\n        types = [\n          'touchstart',\n          'touchmove',\n          'touchend touchcancel'];\n      }\n      // for non pointer events browsers and mixed browsers,\n      // like chrome on windows8 touch laptop\n      else {\n        types = [\n          'touchstart mousedown',\n          'touchmove mousemove',\n          'touchend touchcancel mouseup'];\n      }\n\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_START] = types[0];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_MOVE] = types[1];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_END] = types[2];\n    },\n\n\n    /**\n     * create touchlist depending on the event\n     * @param   {Object}    ev\n     * @param   {String}    eventType   used by the fakemultitouch plugin\n     */\n    getTouchList: function getTouchList(ev/*, eventType*/) {\n      // get the fake pointerEvent touchlist\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        return ionic.Gestures.PointerEvent.getTouchList();\n      }\n      // get the touchlist\n      else if(ev.touches) {\n        return ev.touches;\n      }\n      // make fake touchlist from mouse position\n      else {\n        ev.identifier = 1;\n        return [ev];\n      }\n    },\n\n\n    /**\n     * collect event data for ionic.Gestures js\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Object}        eventData\n     */\n    collectEventData: function collectEventData(element, eventType, touches, ev) {\n\n      // find out pointerType\n      var pointerType = ionic.Gestures.POINTER_TOUCH;\n      if(ev.type.match(/mouse/) || ionic.Gestures.PointerEvent.matchType(ionic.Gestures.POINTER_MOUSE, ev)) {\n        pointerType = ionic.Gestures.POINTER_MOUSE;\n      }\n\n      return {\n        center: ionic.Gestures.utils.getCenter(touches),\n        timeStamp: new Date().getTime(),\n        target: ev.target,\n        touches: touches,\n        eventType: eventType,\n        pointerType: pointerType,\n        srcEvent: ev,\n\n        /**\n         * prevent the browser default actions\n         * mostly used to disable scrolling of the browser\n         */\n        preventDefault: function() {\n          if(this.srcEvent.preventManipulation) {\n            this.srcEvent.preventManipulation();\n          }\n\n          if(this.srcEvent.preventDefault) {\n            // this.srcEvent.preventDefault();\n          }\n        },\n\n        /**\n         * stop bubbling the event up to its parents\n         */\n        stopPropagation: function() {\n          this.srcEvent.stopPropagation();\n        },\n\n        /**\n         * immediately stop gesture detection\n         * might be useful after a swipe was detected\n         * @return {*}\n         */\n        stopDetect: function() {\n          return ionic.Gestures.detection.stopDetect();\n        }\n      };\n    }\n  };\n\n  ionic.Gestures.PointerEvent = {\n    /**\n     * holds all pointers\n     * type {Object}\n     */\n    pointers: {},\n\n    /**\n     * get a list of pointers\n     * @returns {Array}     touchlist\n     */\n    getTouchList: function() {\n      var self = this;\n      var touchlist = [];\n\n      // we can use forEach since pointerEvents only is in IE10\n      Object.keys(self.pointers).sort().forEach(function(id) {\n        touchlist.push(self.pointers[id]);\n      });\n      return touchlist;\n    },\n\n    /**\n     * update the position of a pointer\n     * @param   {String}   type             ionic.Gestures.EVENT_END\n     * @param   {Object}   pointerEvent\n     */\n    updatePointer: function(type, pointerEvent) {\n      if(type == ionic.Gestures.EVENT_END) {\n        this.pointers = {};\n      }\n      else {\n        pointerEvent.identifier = pointerEvent.pointerId;\n        this.pointers[pointerEvent.pointerId] = pointerEvent;\n      }\n\n      return Object.keys(this.pointers).length;\n    },\n\n    /**\n     * check if ev matches pointertype\n     * @param   {String}        pointerType     ionic.Gestures.POINTER_MOUSE\n     * @param   {PointerEvent}  ev\n     */\n    matchType: function(pointerType, ev) {\n      if(!ev.pointerType) {\n        return false;\n      }\n\n      var types = {};\n      types[ionic.Gestures.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == ionic.Gestures.POINTER_MOUSE);\n      types[ionic.Gestures.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == ionic.Gestures.POINTER_TOUCH);\n      types[ionic.Gestures.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == ionic.Gestures.POINTER_PEN);\n      return types[pointerType];\n    },\n\n\n    /**\n     * get events\n     */\n    getEvents: function() {\n      return [\n        'pointerdown MSPointerDown',\n      'pointermove MSPointerMove',\n      'pointerup pointercancel MSPointerUp MSPointerCancel'\n        ];\n    },\n\n    /**\n     * reset the list\n     */\n    reset: function() {\n      this.pointers = {};\n    }\n  };\n\n\n  ionic.Gestures.utils = {\n    /**\n     * extend method,\n     * also used for cloning when dest is an empty object\n     * @param   {Object}    dest\n     * @param   {Object}    src\n     * @param\t{Boolean}\tmerge\t\tdo a merge\n     * @returns {Object}    dest\n     */\n    extend: function extend(dest, src, merge) {\n      for (var key in src) {\n        if(dest[key] !== undefined && merge) {\n          continue;\n        }\n        dest[key] = src[key];\n      }\n      return dest;\n    },\n\n\n    /**\n     * find if a node is in the given parent\n     * used for event delegation tricks\n     * @param   {HTMLElement}   node\n     * @param   {HTMLElement}   parent\n     * @returns {boolean}       has_parent\n     */\n    hasParent: function(node, parent) {\n      while(node){\n        if(node == parent) {\n          return true;\n        }\n        node = node.parentNode;\n      }\n      return false;\n    },\n\n\n    /**\n     * get the center of all the touches\n     * @param   {Array}     touches\n     * @returns {Object}    center\n     */\n    getCenter: function getCenter(touches) {\n      var valuesX = [], valuesY = [];\n\n      for(var t = 0, len = touches.length; t < len; t++) {\n        valuesX.push(touches[t].pageX);\n        valuesY.push(touches[t].pageY);\n      }\n\n      return {\n        pageX: ((Math.min.apply(Math, valuesX) + Math.max.apply(Math, valuesX)) / 2),\n          pageY: ((Math.min.apply(Math, valuesY) + Math.max.apply(Math, valuesY)) / 2)\n      };\n    },\n\n\n    /**\n     * calculate the velocity between two points\n     * @param   {Number}    delta_time\n     * @param   {Number}    delta_x\n     * @param   {Number}    delta_y\n     * @returns {Object}    velocity\n     */\n    getVelocity: function getVelocity(delta_time, delta_x, delta_y) {\n      return {\n        x: Math.abs(delta_x / delta_time) || 0,\n        y: Math.abs(delta_y / delta_time) || 0\n      };\n    },\n\n\n    /**\n     * calculate the angle between two coordinates\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    angle\n     */\n    getAngle: function getAngle(touch1, touch2) {\n      var y = touch2.pageY - touch1.pageY,\n      x = touch2.pageX - touch1.pageX;\n      return Math.atan2(y, x) * 180 / Math.PI;\n    },\n\n\n    /**\n     * angle to direction define\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {String}    direction constant, like ionic.Gestures.DIRECTION_LEFT\n     */\n    getDirection: function getDirection(touch1, touch2) {\n      var x = Math.abs(touch1.pageX - touch2.pageX),\n      y = Math.abs(touch1.pageY - touch2.pageY);\n\n      if(x >= y) {\n        return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n      }\n      else {\n        return touch1.pageY - touch2.pageY > 0 ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n      }\n    },\n\n\n    /**\n     * calculate the distance between two touches\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    distance\n     */\n    getDistance: function getDistance(touch1, touch2) {\n      var x = touch2.pageX - touch1.pageX,\n      y = touch2.pageY - touch1.pageY;\n      return Math.sqrt((x * x) + (y * y));\n    },\n\n\n    /**\n     * calculate the scale factor between two touchLists (fingers)\n     * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    scale\n     */\n    getScale: function getScale(start, end) {\n      // need two fingers...\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getDistance(end[0], end[1]) /\n          this.getDistance(start[0], start[1]);\n      }\n      return 1;\n    },\n\n\n    /**\n     * calculate the rotation degrees between two touchLists (fingers)\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    rotation\n     */\n    getRotation: function getRotation(start, end) {\n      // need two fingers\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getAngle(end[1], end[0]) -\n          this.getAngle(start[1], start[0]);\n      }\n      return 0;\n    },\n\n\n    /**\n     * boolean if the direction is vertical\n     * @param    {String}    direction\n     * @returns  {Boolean}   is_vertical\n     */\n    isVertical: function isVertical(direction) {\n      return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);\n    },\n\n\n    /**\n     * stop browser default behavior with css class\n     * @param   {HtmlElement}   element\n     * @param   {Object}        css_class\n     */\n    stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_class) {\n      // changed from making many style changes to just adding a preset classname\n      // less DOM manipulations, less code, and easier to control in the CSS side of things\n      // hammer.js doesn't come with CSS, but ionic does, which is why we prefer this method\n      if(element && element.classList) {\n        element.classList.add(css_class);\n        element.onselectstart = function() {\n          return false;\n        };\n      }\n    }\n  };\n\n\n  ionic.Gestures.detection = {\n    // contains all registred ionic.Gestures.gestures in the correct order\n    gestures: [],\n\n    // data of the current ionic.Gestures.gesture detection session\n    current: null,\n\n    // the previous ionic.Gestures.gesture session data\n    // is a full clone of the previous gesture.current object\n    previous: null,\n\n    // when this becomes true, no gestures are fired\n    stopped: false,\n\n\n    /**\n     * start ionic.Gestures.gesture detection\n     * @param   {ionic.Gestures.Instance}   inst\n     * @param   {Object}            eventData\n     */\n    startDetect: function startDetect(inst, eventData) {\n      // already busy with a ionic.Gestures.gesture detection on an element\n      if(this.current) {\n        return;\n      }\n\n      this.stopped = false;\n\n      this.current = {\n        inst: inst, // reference to ionic.GesturesInstance we're working for\n        startEvent: ionic.Gestures.utils.extend({}, eventData), // start eventData for distances, timing etc\n        lastEvent: false, // last eventData\n        name: '' // current gesture we're in/detected, can be 'tap', 'hold' etc\n      };\n\n      this.detect(eventData);\n    },\n\n\n    /**\n     * ionic.Gestures.gesture detection\n     * @param   {Object}    eventData\n     */\n    detect: function detect(eventData) {\n      if(!this.current || this.stopped) {\n        return null;\n      }\n\n      // extend event data with calculations about scale, distance etc\n      eventData = this.extendEventData(eventData);\n\n      // instance options\n      var inst_options = this.current.inst.options;\n\n      // call ionic.Gestures.gesture handlers\n      for(var g = 0, len = this.gestures.length; g < len; g++) {\n        var gesture = this.gestures[g];\n\n        // only when the instance options have enabled this gesture\n        if(!this.stopped && inst_options[gesture.name] !== false) {\n          // if a handler returns false, we stop with the detection\n          if(gesture.handler.call(gesture, eventData, this.current.inst) === false) {\n            this.stopDetect();\n            break;\n          }\n        }\n      }\n\n      // store as previous event event\n      if(this.current) {\n        this.current.lastEvent = eventData;\n      }\n\n      // endevent, but not the last touch, so dont stop\n      if(eventData.eventType == ionic.Gestures.EVENT_END && !eventData.touches.length - 1) {\n        this.stopDetect();\n      }\n\n      return eventData;\n    },\n\n\n    /**\n     * clear the ionic.Gestures.gesture vars\n     * this is called on endDetect, but can also be used when a final ionic.Gestures.gesture has been detected\n     * to stop other ionic.Gestures.gestures from being fired\n     */\n    stopDetect: function stopDetect() {\n      // clone current data to the store as the previous gesture\n      // used for the double tap gesture, since this is an other gesture detect session\n      this.previous = ionic.Gestures.utils.extend({}, this.current);\n\n      // reset the current\n      this.current = null;\n\n      // stopped!\n      this.stopped = true;\n    },\n\n\n    /**\n     * extend eventData for ionic.Gestures.gestures\n     * @param   {Object}   ev\n     * @returns {Object}   ev\n     */\n    extendEventData: function extendEventData(ev) {\n      var startEv = this.current.startEvent;\n\n      // if the touches change, set the new touches over the startEvent touches\n      // this because touchevents don't have all the touches on touchstart, or the\n      // user must place his fingers at the EXACT same time on the screen, which is not realistic\n      // but, sometimes it happens that both fingers are touching at the EXACT same time\n      if(startEv && (ev.touches.length != startEv.touches.length || ev.touches === startEv.touches)) {\n        // extend 1 level deep to get the touchlist with the touch objects\n        startEv.touches = [];\n        for(var i = 0, len = ev.touches.length; i < len; i++) {\n          startEv.touches.push(ionic.Gestures.utils.extend({}, ev.touches[i]));\n        }\n      }\n\n      var delta_time = ev.timeStamp - startEv.timeStamp,\n          delta_x = ev.center.pageX - startEv.center.pageX,\n          delta_y = ev.center.pageY - startEv.center.pageY,\n          velocity = ionic.Gestures.utils.getVelocity(delta_time, delta_x, delta_y);\n\n      ionic.Gestures.utils.extend(ev, {\n        deltaTime: delta_time,\n        deltaX: delta_x,\n        deltaY: delta_y,\n\n        velocityX: velocity.x,\n        velocityY: velocity.y,\n\n        distance: ionic.Gestures.utils.getDistance(startEv.center, ev.center),\n        angle: ionic.Gestures.utils.getAngle(startEv.center, ev.center),\n        direction: ionic.Gestures.utils.getDirection(startEv.center, ev.center),\n\n        scale: ionic.Gestures.utils.getScale(startEv.touches, ev.touches),\n        rotation: ionic.Gestures.utils.getRotation(startEv.touches, ev.touches),\n\n        startEvent: startEv\n      });\n\n      return ev;\n    },\n\n\n    /**\n     * register new gesture\n     * @param   {Object}    gesture object, see gestures.js for documentation\n     * @returns {Array}     gestures\n     */\n    register: function register(gesture) {\n      // add an enable gesture options if there is no given\n      var options = gesture.defaults || {};\n      if(options[gesture.name] === undefined) {\n        options[gesture.name] = true;\n      }\n\n      // extend ionic.Gestures default options with the ionic.Gestures.gesture options\n      ionic.Gestures.utils.extend(ionic.Gestures.defaults, options, true);\n\n      // set its index\n      gesture.index = gesture.index || 1000;\n\n      // add ionic.Gestures.gesture to the list\n      this.gestures.push(gesture);\n\n      // sort the list by index\n      this.gestures.sort(function(a, b) {\n        if (a.index < b.index) {\n          return -1;\n        }\n        if (a.index > b.index) {\n          return 1;\n        }\n        return 0;\n      });\n\n      return this.gestures;\n    }\n  };\n\n\n  ionic.Gestures.gestures = ionic.Gestures.gestures || {};\n\n  /**\n   * Custom gestures\n   * ==============================\n   *\n   * Gesture object\n   * --------------------\n   * The object structure of a gesture:\n   *\n   * { name: 'mygesture',\n   *   index: 1337,\n   *   defaults: {\n   *     mygesture_option: true\n   *   }\n   *   handler: function(type, ev, inst) {\n   *     // trigger gesture event\n   *     inst.trigger(this.name, ev);\n   *   }\n   * }\n\n   * @param   {String}    name\n   * this should be the name of the gesture, lowercase\n   * it is also being used to disable/enable the gesture per instance config.\n   *\n   * @param   {Number}    [index=1000]\n   * the index of the gesture, where it is going to be in the stack of gestures detection\n   * like when you build an gesture that depends on the drag gesture, it is a good\n   * idea to place it after the index of the drag gesture.\n   *\n   * @param   {Object}    [defaults={}]\n   * the default settings of the gesture. these are added to the instance settings,\n   * and can be overruled per instance. you can also add the name of the gesture,\n   * but this is also added by default (and set to true).\n   *\n   * @param   {Function}  handler\n   * this handles the gesture detection of your custom gesture and receives the\n   * following arguments:\n   *\n   *      @param  {Object}    eventData\n   *      event data containing the following properties:\n   *          timeStamp   {Number}        time the event occurred\n   *          target      {HTMLElement}   target element\n   *          touches     {Array}         touches (fingers, pointers, mouse) on the screen\n   *          pointerType {String}        kind of pointer that was used. matches ionic.Gestures.POINTER_MOUSE|TOUCH\n   *          center      {Object}        center position of the touches. contains pageX and pageY\n   *          deltaTime   {Number}        the total time of the touches in the screen\n   *          deltaX      {Number}        the delta on x axis we haved moved\n   *          deltaY      {Number}        the delta on y axis we haved moved\n   *          velocityX   {Number}        the velocity on the x\n   *          velocityY   {Number}        the velocity on y\n   *          angle       {Number}        the angle we are moving\n   *          direction   {String}        the direction we are moving. matches ionic.Gestures.DIRECTION_UP|DOWN|LEFT|RIGHT\n   *          distance    {Number}        the distance we haved moved\n   *          scale       {Number}        scaling of the touches, needs 2 touches\n   *          rotation    {Number}        rotation of the touches, needs 2 touches *\n   *          eventType   {String}        matches ionic.Gestures.EVENT_START|MOVE|END\n   *          srcEvent    {Object}        the source event, like TouchStart or MouseDown *\n   *          startEvent  {Object}        contains the same properties as above,\n   *                                      but from the first touch. this is used to calculate\n   *                                      distances, deltaTime, scaling etc\n   *\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we are doing the detection for. you can get the options from\n   *      the inst.options object and trigger the gesture event by calling inst.trigger\n   *\n   *\n   * Handle gestures\n   * --------------------\n   * inside the handler you can get/set ionic.Gestures.detectionic.current. This is the current\n   * detection sessionic. It has the following properties\n   *      @param  {String}    name\n   *      contains the name of the gesture we have detected. it has not a real function,\n   *      only to check in other gestures if something is detected.\n   *      like in the drag gesture we set it to 'drag' and in the swipe gesture we can\n   *      check if the current gesture is 'drag' by accessing ionic.Gestures.detectionic.current.name\n   *\n   *      readonly\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we do the detection for\n   *\n   *      readonly\n   *      @param  {Object}    startEvent\n   *      contains the properties of the first gesture detection in this sessionic.\n   *      Used for calculations about timing, distance, etc.\n   *\n   *      readonly\n   *      @param  {Object}    lastEvent\n   *      contains all the properties of the last gesture detect in this sessionic.\n   *\n   * after the gesture detection session has been completed (user has released the screen)\n   * the ionic.Gestures.detectionic.current object is copied into ionic.Gestures.detectionic.previous,\n   * this is usefull for gestures like doubletap, where you need to know if the\n   * previous gesture was a tap\n   *\n   * options that have been set by the instance can be received by calling inst.options\n   *\n   * You can trigger a gesture event by calling inst.trigger(\"mygesture\", event).\n   * The first param is the name of your gesture, the second the event argument\n   *\n   *\n   * Register gestures\n   * --------------------\n   * When an gesture is added to the ionic.Gestures.gestures object, it is auto registered\n   * at the setup of the first ionic.Gestures instance. You can also call ionic.Gestures.detectionic.register\n   * manually and pass your gesture object as a param\n   *\n   */\n\n  /**\n   * Hold\n   * Touch stays at the same place for x time\n   * events  hold\n   */\n  ionic.Gestures.gestures.Hold = {\n    name: 'hold',\n    index: 10,\n    defaults: {\n      hold_timeout: 500,\n      hold_threshold: 9\n    },\n    timer: null,\n    handler: function holdGesture(ev, inst) {\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          // clear any running timers\n          clearTimeout(this.timer);\n\n          // set the gesture so we can check in the timeout if it still is\n          ionic.Gestures.detection.current.name = this.name;\n\n          // set timer and if after the timeout it still is hold,\n          // we trigger the hold event\n          this.timer = setTimeout(function() {\n            if(ionic.Gestures.detection.current.name == 'hold') {\n              ionic.tap.cancelClick();\n              inst.trigger('hold', ev);\n            }\n          }, inst.options.hold_timeout);\n          break;\n\n          // when you move or end we clear the timer\n        case ionic.Gestures.EVENT_MOVE:\n          if(ev.distance > inst.options.hold_threshold) {\n            clearTimeout(this.timer);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          clearTimeout(this.timer);\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Tap/DoubleTap\n   * Quick touch at a place or double at the same place\n   * events  tap, doubletap\n   */\n  ionic.Gestures.gestures.Tap = {\n    name: 'tap',\n    index: 100,\n    defaults: {\n      tap_max_touchtime: 250,\n      tap_max_distance: 10,\n      tap_always: true,\n      doubletap_distance: 20,\n      doubletap_interval: 300\n    },\n    handler: function tapGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END && ev.srcEvent.type != 'touchcancel') {\n        // previous gesture, for the double tap since these are two different gesture detections\n        var prev = ionic.Gestures.detection.previous,\n        did_doubletap = false;\n\n        // when the touchtime is higher then the max touch time\n        // or when the moving distance is too much\n        if(ev.deltaTime > inst.options.tap_max_touchtime ||\n            ev.distance > inst.options.tap_max_distance) {\n              return;\n            }\n\n        // check if double tap\n        if(prev && prev.name == 'tap' &&\n            (ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval &&\n            ev.distance < inst.options.doubletap_distance) {\n              inst.trigger('doubletap', ev);\n              did_doubletap = true;\n            }\n\n        // do a single tap\n        if(!did_doubletap || inst.options.tap_always) {\n          ionic.Gestures.detection.current.name = 'tap';\n          inst.trigger('tap', ev);\n        }\n      }\n    }\n  };\n\n\n  /**\n   * Swipe\n   * triggers swipe events when the end velocity is above the threshold\n   * events  swipe, swipeleft, swiperight, swipeup, swipedown\n   */\n  ionic.Gestures.gestures.Swipe = {\n    name: 'swipe',\n    index: 40,\n    defaults: {\n      // set 0 for unlimited, but this can conflict with transform\n      swipe_max_touches: 1,\n      swipe_velocity: 0.4\n    },\n    handler: function swipeGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END) {\n        // max touches\n        if(inst.options.swipe_max_touches > 0 &&\n            ev.touches.length > inst.options.swipe_max_touches) {\n              return;\n            }\n\n        // when the distance we moved is too small we skip this gesture\n        // or we can be already in dragging\n        if(ev.velocityX > inst.options.swipe_velocity ||\n            ev.velocityY > inst.options.swipe_velocity) {\n              // trigger swipe events\n              inst.trigger(this.name, ev);\n              inst.trigger(this.name + ev.direction, ev);\n            }\n      }\n    }\n  };\n\n\n  /**\n   * Drag\n   * Move with x fingers (default 1) around on the page. Blocking the scrolling when\n   * moving left and right is a good practice. When all the drag events are blocking\n   * you disable scrolling on that area.\n   * events  drag, drapleft, dragright, dragup, dragdown\n   */\n  ionic.Gestures.gestures.Drag = {\n    name: 'drag',\n    index: 50,\n    defaults: {\n      drag_min_distance: 10,\n      // Set correct_for_drag_min_distance to true to make the starting point of the drag\n      // be calculated from where the drag was triggered, not from where the touch started.\n      // Useful to avoid a jerk-starting drag, which can make fine-adjustments\n      // through dragging difficult, and be visually unappealing.\n      correct_for_drag_min_distance: true,\n      // set 0 for unlimited, but this can conflict with transform\n      drag_max_touches: 1,\n      // prevent default browser behavior when dragging occurs\n      // be careful with it, it makes the element a blocking element\n      // when you are using the drag gesture, it is a good practice to set this true\n      drag_block_horizontal: true,\n      drag_block_vertical: true,\n      // drag_lock_to_axis keeps the drag gesture on the axis that it started on,\n      // It disallows vertical directions if the initial direction was horizontal, and vice versa.\n      drag_lock_to_axis: false,\n      // drag lock only kicks in when distance > drag_lock_min_distance\n      // This way, locking occurs only when the distance has become large enough to reliably determine the direction\n      drag_lock_min_distance: 25,\n      // prevent default if the gesture is going the given direction\n      prevent_default_directions: []\n    },\n    triggered: false,\n    handler: function dragGesture(ev, inst) {\n      if (ev.srcEvent.type == 'touchstart' || ev.srcEvent.type == 'touchend') {\n        this.preventedFirstMove = false;\n\n      } else if (!this.preventedFirstMove && ev.srcEvent.type == 'touchmove') {\n        // Prevent gestures that are not intended for this event handler from firing subsequent times\n        if (inst.options.prevent_default_directions.length > 0\n            && inst.options.prevent_default_directions.indexOf(ev.direction) != -1) {\n          ev.srcEvent.preventDefault();\n        }\n        this.preventedFirstMove = true;\n      }\n\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name + 'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // max touches\n      if(inst.options.drag_max_touches > 0 &&\n          ev.touches.length > inst.options.drag_max_touches) {\n            return;\n          }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(ev.distance < inst.options.drag_min_distance &&\n              ionic.Gestures.detection.current.name != this.name) {\n                return;\n              }\n\n          // we are dragging!\n          if(ionic.Gestures.detection.current.name != this.name) {\n            ionic.Gestures.detection.current.name = this.name;\n            if (inst.options.correct_for_drag_min_distance) {\n              // When a drag is triggered, set the event center to drag_min_distance pixels from the original event center.\n              // Without this correction, the dragged distance would jumpstart at drag_min_distance pixels instead of at 0.\n              // It might be useful to save the original start point somewhere\n              var factor = Math.abs(inst.options.drag_min_distance / ev.distance);\n              ionic.Gestures.detection.current.startEvent.center.pageX += ev.deltaX * factor;\n              ionic.Gestures.detection.current.startEvent.center.pageY += ev.deltaY * factor;\n\n              // recalculate event data using new start point\n              ev = ionic.Gestures.detection.extendEventData(ev);\n            }\n          }\n\n          // lock drag to axis?\n          if(ionic.Gestures.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance <= ev.distance)) {\n            ev.drag_locked_to_axis = true;\n          }\n          var last_direction = ionic.Gestures.detection.current.lastEvent.direction;\n          if(ev.drag_locked_to_axis && last_direction !== ev.direction) {\n            // keep direction on the axis that the drag gesture started on\n            if(ionic.Gestures.utils.isVertical(last_direction)) {\n              ev.direction = (ev.deltaY < 0) ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n            }\n            else {\n              ev.direction = (ev.deltaX < 0) ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n            }\n          }\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name + 'start', ev);\n            this.triggered = true;\n          }\n\n          // trigger normal event\n          inst.trigger(this.name, ev);\n\n          // direction event, like dragdown\n          inst.trigger(this.name + ev.direction, ev);\n\n          // block the browser events\n          if( (inst.options.drag_block_vertical && ionic.Gestures.utils.isVertical(ev.direction)) ||\n              (inst.options.drag_block_horizontal && !ionic.Gestures.utils.isVertical(ev.direction))) {\n                ev.preventDefault();\n              }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name + 'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Transform\n   * User want to scale or rotate with 2 fingers\n   * events  transform, pinch, pinchin, pinchout, rotate\n   */\n  ionic.Gestures.gestures.Transform = {\n    name: 'transform',\n    index: 45,\n    defaults: {\n      // factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1\n      transform_min_scale: 0.01,\n      // rotation in degrees\n      transform_min_rotation: 1,\n      // prevent default browser behavior when two touches are on the screen\n      // but it makes the element a blocking element\n      // when you are using the transform gesture, it is a good practice to set this true\n      transform_always_block: false\n    },\n    triggered: false,\n    handler: function transformGesture(ev, inst) {\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name + 'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // atleast multitouch\n      if(ev.touches.length < 2) {\n        return;\n      }\n\n      // prevent default when two fingers are on the screen\n      if(inst.options.transform_always_block) {\n        ev.preventDefault();\n      }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          var scale_threshold = Math.abs(1 - ev.scale);\n          var rotation_threshold = Math.abs(ev.rotation);\n\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(scale_threshold < inst.options.transform_min_scale &&\n              rotation_threshold < inst.options.transform_min_rotation) {\n                return;\n              }\n\n          // we are transforming!\n          ionic.Gestures.detection.current.name = this.name;\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name + 'start', ev);\n            this.triggered = true;\n          }\n\n          inst.trigger(this.name, ev); // basic transform event\n\n          // trigger rotate event\n          if(rotation_threshold > inst.options.transform_min_rotation) {\n            inst.trigger('rotate', ev);\n          }\n\n          // trigger pinch event\n          if(scale_threshold > inst.options.transform_min_scale) {\n            inst.trigger('pinch', ev);\n            inst.trigger('pinch' + ((ev.scale < 1) ? 'in' : 'out'), ev);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name + 'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Touch\n   * Called as first, tells the user has touched the screen\n   * events  touch\n   */\n  ionic.Gestures.gestures.Touch = {\n    name: 'touch',\n    index: -Infinity,\n    defaults: {\n      // call preventDefault at touchstart, and makes the element blocking by\n      // disabling the scrolling of the page, but it improves gestures like\n      // transforming and dragging.\n      // be careful with using this, it can be very annoying for users to be stuck\n      // on the page\n      prevent_default: false,\n\n      // disable mouse events, so only touch (or pen!) input triggers events\n      prevent_mouseevents: false\n    },\n    handler: function touchGesture(ev, inst) {\n      if(inst.options.prevent_mouseevents && ev.pointerType == ionic.Gestures.POINTER_MOUSE) {\n        ev.stopDetect();\n        return;\n      }\n\n      if(inst.options.prevent_default) {\n        ev.preventDefault();\n      }\n\n      if(ev.eventType == ionic.Gestures.EVENT_START) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n\n\n  /**\n   * Release\n   * Called as last, tells the user has released the screen\n   * events  release\n   */\n  ionic.Gestures.gestures.Release = {\n    name: 'release',\n    index: Infinity,\n    handler: function releaseGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n})(window.ionic);\n\n(function(window, document, ionic) {\n\n  function getParameterByName(name) {\n    name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n    var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n    results = regex.exec(location.search);\n    return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n  }\n\n  var IOS = 'ios';\n  var ANDROID = 'android';\n  var WINDOWS_PHONE = 'windowsphone';\n  var EDGE = 'edge';\n  var CROSSWALK = 'crosswalk';\n  var requestAnimationFrame = ionic.requestAnimationFrame;\n\n  /**\n   * @ngdoc utility\n   * @name ionic.Platform\n   * @module ionic\n   * @description\n   * A set of utility methods that can be used to retrieve the device ready state and\n   * various other information such as what kind of platform the app is currently installed on.\n   *\n   * @usage\n   * ```js\n   * angular.module('PlatformApp', ['ionic'])\n   * .controller('PlatformCtrl', function($scope) {\n   *\n   *   ionic.Platform.ready(function(){\n   *     // will execute when device is ready, or immediately if the device is already ready.\n   *   });\n   *\n   *   var deviceInformation = ionic.Platform.device();\n   *\n   *   var isWebView = ionic.Platform.isWebView();\n   *   var isIPad = ionic.Platform.isIPad();\n   *   var isIOS = ionic.Platform.isIOS();\n   *   var isAndroid = ionic.Platform.isAndroid();\n   *   var isWindowsPhone = ionic.Platform.isWindowsPhone();\n   *\n   *   var currentPlatform = ionic.Platform.platform();\n   *   var currentPlatformVersion = ionic.Platform.version();\n   *\n   *   ionic.Platform.exitApp(); // stops the app\n   * });\n   * ```\n   */\n  var self = ionic.Platform = {\n\n    // Put navigator on platform so it can be mocked and set\n    // the browser does not allow window.navigator to be set\n    navigator: window.navigator,\n\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isReady\n     * @returns {boolean} Whether the device is ready.\n     */\n    isReady: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isFullScreen\n     * @returns {boolean} Whether the device is fullscreen.\n     */\n    isFullScreen: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#platforms\n     * @returns {Array(string)} An array of all platforms found.\n     */\n    platforms: null,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#grade\n     * @returns {string} What grade the current platform is.\n     */\n    grade: null,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#ua\n     * @returns {string} What User Agent is.\n     */\n    ua: navigator.userAgent,\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#ready\n     * @description\n     * Trigger a callback once the device is ready, or immediately\n     * if the device is already ready. This method can be run from\n     * anywhere and does not need to be wrapped by any additonal methods.\n     * When the app is within a WebView (Cordova), it'll fire\n     * the callback once the device is ready. If the app is within\n     * a web browser, it'll fire the callback after `window.load`.\n     * Please remember that Cordova features (Camera, FileSystem, etc) still\n     * will not work in a web browser.\n     * @param {function} callback The function to call.\n     */\n    ready: function(cb) {\n      // run through tasks to complete now that the device is ready\n      if (self.isReady) {\n        cb();\n      } else {\n        // the platform isn't ready yet, add it to this array\n        // which will be called once the platform is ready\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @private\n     */\n    detect: function() {\n      self._checkPlatforms();\n\n      requestAnimationFrame(function() {\n        // only add to the body class if we got platform info\n        for (var i = 0; i < self.platforms.length; i++) {\n          document.body.classList.add('platform-' + self.platforms[i]);\n        }\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#setGrade\n     * @description Set the grade of the device: 'a', 'b', or 'c'. 'a' is the best\n     * (most css features enabled), 'c' is the worst.  By default, sets the grade\n     * depending on the current device.\n     * @param {string} grade The new grade to set.\n     */\n    setGrade: function(grade) {\n      var oldGrade = self.grade;\n      self.grade = grade;\n      requestAnimationFrame(function() {\n        if (oldGrade) {\n          document.body.classList.remove('grade-' + oldGrade);\n        }\n        document.body.classList.add('grade-' + grade);\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#device\n     * @description Return the current device (given by cordova).\n     * @returns {object} The device object.\n     */\n    device: function() {\n      return window.device || {};\n    },\n\n    _checkPlatforms: function() {\n      self.platforms = [];\n      var grade = 'a';\n\n      if (self.isWebView()) {\n        self.platforms.push('webview');\n        if (!(!window.cordova && !window.PhoneGap && !window.phonegap)) {\n          self.platforms.push('cordova');\n        } else if (typeof window.forge === 'object') {\n          self.platforms.push('trigger');\n        }\n      } else {\n        self.platforms.push('browser');\n      }\n      if (self.isIPad()) self.platforms.push('ipad');\n\n      var platform = self.platform();\n      if (platform) {\n        self.platforms.push(platform);\n\n        var version = self.version();\n        if (version) {\n          var v = version.toString();\n          if (v.indexOf('.') > 0) {\n            v = v.replace('.', '_');\n          } else {\n            v += '_0';\n          }\n          self.platforms.push(platform + v.split('_')[0]);\n          self.platforms.push(platform + v);\n\n          if (self.isAndroid() && version < 4.4) {\n            grade = (version < 4 ? 'c' : 'b');\n          } else if (self.isWindowsPhone()) {\n            grade = 'b';\n          }\n        }\n      }\n\n      self.setGrade(grade);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWebView\n     * @returns {boolean} Check if we are running within a WebView (such as Cordova).\n     */\n    isWebView: function() {\n      return !(!window.cordova && !window.PhoneGap && !window.phonegap && window.forge !== 'object');\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIPad\n     * @returns {boolean} Whether we are running on iPad.\n     */\n    isIPad: function() {\n      if (/iPad/i.test(self.navigator.platform)) {\n        return true;\n      }\n      return /iPad/i.test(self.ua);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIOS\n     * @returns {boolean} Whether we are running on iOS.\n     */\n    isIOS: function() {\n      return self.is(IOS);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isAndroid\n     * @returns {boolean} Whether we are running on Android.\n     */\n    isAndroid: function() {\n      return self.is(ANDROID);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWindowsPhone\n     * @returns {boolean} Whether we are running on Windows Phone.\n     */\n    isWindowsPhone: function() {\n      return self.is(WINDOWS_PHONE);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isEdge\n     * @returns {boolean} Whether we are running on MS Edge/Windows 10 (inc. Phone)\n     */\n    isEdge: function() {\n      return self.is(EDGE);\n    },\n\n    isCrosswalk: function() {\n      return self.is(CROSSWALK);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#platform\n     * @returns {string} The name of the current platform.\n     */\n    platform: function() {\n      // singleton to get the platform name\n      if (platformName === null) self.setPlatform(self.device().platform);\n      return platformName;\n    },\n\n    /**\n     * @private\n     */\n    setPlatform: function(n) {\n      if (typeof n != 'undefined' && n !== null && n.length) {\n        platformName = n.toLowerCase();\n      } else if (getParameterByName('ionicplatform')) {\n        platformName = getParameterByName('ionicplatform');\n      } else if (self.ua.indexOf('Edge') > -1) {\n        platformName = EDGE;\n      } else if (self.ua.indexOf('Windows Phone') > -1) {\n        platformName = WINDOWS_PHONE;\n      } else if (self.ua.indexOf('Android') > 0) {\n        platformName = ANDROID;\n      } else if (/iPhone|iPad|iPod/.test(self.ua)) {\n        platformName = IOS;\n      } else {\n        platformName = self.navigator.platform && navigator.platform.toLowerCase().split(' ')[0] || '';\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#version\n     * @returns {number} The version of the current device platform.\n     */\n    version: function() {\n      // singleton to get the platform version\n      if (platformVersion === null) self.setVersion(self.device().version);\n      return platformVersion;\n    },\n\n    /**\n     * @private\n     */\n    setVersion: function(v) {\n      if (typeof v != 'undefined' && v !== null) {\n        v = v.split('.');\n        v = parseFloat(v[0] + '.' + (v.length > 1 ? v[1] : 0));\n        if (!isNaN(v)) {\n          platformVersion = v;\n          return;\n        }\n      }\n\n      platformVersion = 0;\n\n      // fallback to user-agent checking\n      var pName = self.platform();\n      var versionMatch = {\n        'android': /Android (\\d+).(\\d+)?/,\n        'ios': /OS (\\d+)_(\\d+)?/,\n        'windowsphone': /Windows Phone (\\d+).(\\d+)?/\n      };\n      if (versionMatch[pName]) {\n        v = self.ua.match(versionMatch[pName]);\n        if (v && v.length > 2) {\n          platformVersion = parseFloat(v[1] + '.' + v[2]);\n        }\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#is\n     * @param {string} Platform name.\n     * @returns {boolean} Whether the platform name provided is detected.\n     */\n    is: function(type) {\n      type = type.toLowerCase();\n      // check if it has an array of platforms\n      if (self.platforms) {\n        for (var x = 0; x < self.platforms.length; x++) {\n          if (self.platforms[x] === type) return true;\n        }\n      }\n      // exact match\n      var pName = self.platform();\n      if (pName) {\n        return pName === type.toLowerCase();\n      }\n\n      // A quick hack for to check userAgent\n      return self.ua.toLowerCase().indexOf(type) >= 0;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#exitApp\n     * @description Exit the app.\n     */\n    exitApp: function() {\n      self.ready(function() {\n        navigator.app && navigator.app.exitApp && navigator.app.exitApp();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#showStatusBar\n     * @description Shows or hides the device status bar (in Cordova). Requires `cordova plugin add org.apache.cordova.statusbar`\n     * @param {boolean} shouldShow Whether or not to show the status bar.\n     */\n    showStatusBar: function(val) {\n      // Only useful when run within cordova\n      self._showStatusBar = val;\n      self.ready(function() {\n        // run this only when or if the platform (cordova) is ready\n        requestAnimationFrame(function() {\n          if (self._showStatusBar) {\n            // they do not want it to be full screen\n            window.StatusBar && window.StatusBar.show();\n            document.body.classList.remove('status-bar-hide');\n          } else {\n            // it should be full screen\n            window.StatusBar && window.StatusBar.hide();\n            document.body.classList.add('status-bar-hide');\n          }\n        });\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#fullScreen\n     * @description\n     * Sets whether the app is fullscreen or not (in Cordova).\n     * @param {boolean=} showFullScreen Whether or not to set the app to fullscreen. Defaults to true. Requires `cordova plugin add org.apache.cordova.statusbar`\n     * @param {boolean=} showStatusBar Whether or not to show the device's status bar. Defaults to false.\n     */\n    fullScreen: function(showFullScreen, showStatusBar) {\n      // showFullScreen: default is true if no param provided\n      self.isFullScreen = (showFullScreen !== false);\n\n      // add/remove the fullscreen classname to the body\n      ionic.DomUtil.ready(function() {\n        // run this only when or if the DOM is ready\n        requestAnimationFrame(function() {\n          if (self.isFullScreen) {\n            document.body.classList.add('fullscreen');\n          } else {\n            document.body.classList.remove('fullscreen');\n          }\n        });\n        // showStatusBar: default is false if no param provided\n        self.showStatusBar((showStatusBar === true));\n      });\n    }\n\n  };\n\n  var platformName = null, // just the name, like iOS or Android\n  platformVersion = null, // a float of the major and minor, like 7.1\n  readyCallbacks = [],\n  windowLoadListenderAttached,\n  platformReadyTimer = 2000; // How long to wait for platform ready before emitting a warning\n\n  verifyPlatformReady();\n\n  // Warn the user if deviceready did not fire in a reasonable amount of time, and how to fix it.\n  function verifyPlatformReady() {\n    setTimeout(function() {\n      if(!self.isReady && self.isWebView()) {\n        void 0;\n      }\n    }, platformReadyTimer);\n  }\n\n  // setup listeners to know when the device is ready to go\n  function onWindowLoad() {\n    if (self.isWebView()) {\n      // the window and scripts are fully loaded, and a cordova/phonegap\n      // object exists then let's listen for the deviceready\n      document.addEventListener(\"deviceready\", onPlatformReady, false);\n    } else {\n      // the window and scripts are fully loaded, but the window object doesn't have the\n      // cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova\n      onPlatformReady();\n    }\n    if (windowLoadListenderAttached) {\n      window.removeEventListener(\"load\", onWindowLoad, false);\n    }\n  }\n  if (document.readyState === 'complete') {\n    onWindowLoad();\n  } else {\n    windowLoadListenderAttached = true;\n    window.addEventListener(\"load\", onWindowLoad, false);\n  }\n\n  function onPlatformReady() {\n    // the device is all set to go, init our own stuff then fire off our event\n    self.isReady = true;\n    self.detect();\n    for (var x = 0; x < readyCallbacks.length; x++) {\n      // fire off all the callbacks that were added before the platform was ready\n      readyCallbacks[x]();\n    }\n    readyCallbacks = [];\n    ionic.trigger('platformready', { target: document });\n\n    requestAnimationFrame(function() {\n      document.body.classList.add('platform-ready');\n    });\n  }\n\n})(window, document, ionic);\n\n(function(document, ionic) {\n  'use strict';\n\n  // Ionic CSS polyfills\n  ionic.CSS = {};\n  ionic.CSS.TRANSITION = [];\n  ionic.CSS.TRANSFORM = [];\n\n  ionic.EVENTS = {};\n\n  (function() {\n\n    // transform\n    var i, keys = ['webkitTransform', 'transform', '-webkit-transform', 'webkit-transform',\n                   '-moz-transform', 'moz-transform', 'MozTransform', 'mozTransform', 'msTransform'];\n\n    for (i = 0; i < keys.length; i++) {\n      if (document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSFORM = keys[i];\n        break;\n      }\n    }\n\n    // transition\n    keys = ['webkitTransition', 'mozTransition', 'msTransition', 'transition'];\n    for (i = 0; i < keys.length; i++) {\n      if (document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSITION = keys[i];\n        break;\n      }\n    }\n\n    // Fallback in case the keys don't exist at all\n    ionic.CSS.TRANSITION = ionic.CSS.TRANSITION || 'transition';\n\n    // The only prefix we care about is webkit for transitions.\n    var isWebkit = ionic.CSS.TRANSITION.indexOf('webkit') > -1;\n\n    // transition duration\n    ionic.CSS.TRANSITION_DURATION = (isWebkit ? '-webkit-' : '') + 'transition-duration';\n\n    // To be sure transitionend works everywhere, include *both* the webkit and non-webkit events\n    ionic.CSS.TRANSITIONEND = (isWebkit ? 'webkitTransitionEnd ' : '') + 'transitionend';\n  })();\n\n  (function() {\n      var touchStartEvent = 'touchstart';\n      var touchMoveEvent = 'touchmove';\n      var touchEndEvent = 'touchend';\n      var touchCancelEvent = 'touchcancel';\n\n      if (window.navigator.pointerEnabled) {\n        touchStartEvent = 'pointerdown';\n        touchMoveEvent = 'pointermove';\n        touchEndEvent = 'pointerup';\n        touchCancelEvent = 'pointercancel';\n      } else if (window.navigator.msPointerEnabled) {\n        touchStartEvent = 'MSPointerDown';\n        touchMoveEvent = 'MSPointerMove';\n        touchEndEvent = 'MSPointerUp';\n        touchCancelEvent = 'MSPointerCancel';\n      }\n\n      ionic.EVENTS.touchstart = touchStartEvent;\n      ionic.EVENTS.touchmove = touchMoveEvent;\n      ionic.EVENTS.touchend = touchEndEvent;\n      ionic.EVENTS.touchcancel = touchCancelEvent;\n  })();\n\n  // classList polyfill for them older Androids\n  // https://gist.github.com/devongovett/1381839\n  if (!(\"classList\" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') {\n    Object.defineProperty(HTMLElement.prototype, 'classList', {\n      get: function() {\n        var self = this;\n        function update(fn) {\n          return function() {\n            var x, classes = self.className.split(/\\s+/);\n\n            for (x = 0; x < arguments.length; x++) {\n              fn(classes, classes.indexOf(arguments[x]), arguments[x]);\n            }\n\n            self.className = classes.join(\" \");\n          };\n        }\n\n        return {\n          add: update(function(classes, index, value) {\n            ~index || classes.push(value);\n          }),\n\n          remove: update(function(classes, index) {\n            ~index && classes.splice(index, 1);\n          }),\n\n          toggle: update(function(classes, index, value) {\n            ~index ? classes.splice(index, 1) : classes.push(value);\n          }),\n\n          contains: function(value) {\n            return !!~self.className.split(/\\s+/).indexOf(value);\n          },\n\n          item: function(i) {\n            return self.className.split(/\\s+/)[i] || null;\n          }\n        };\n\n      }\n    });\n  }\n\n})(document, ionic);\n\n\n/**\n * @ngdoc page\n * @name tap\n * @module ionic\n * @description\n * On touch devices such as a phone or tablet, some browsers implement a 300ms delay between\n * the time the user stops touching the display and the moment the browser executes the\n * click. This delay was initially introduced so the browser can know whether the user wants to\n * double-tap to zoom in on the webpage.  Basically, the browser waits roughly 300ms to see if\n * the user is double-tapping, or just tapping on the display once.\n *\n * Out of the box, Ionic automatically removes the 300ms delay in order to make Ionic apps\n * feel more \"native\" like. Resultingly, other solutions such as\n * [fastclick](https://github.com/ftlabs/fastclick) and Angular's\n * [ngTouch](https://docs.angularjs.org/api/ngTouch) should not be included, to avoid conflicts.\n *\n * Some browsers already remove the delay with certain settings, such as the CSS property\n * `touch-events: none` or with specific meta tag viewport values. However, each of these\n * browsers still handle clicks differently, such as when to fire off or cancel the event\n * (like scrolling when the target is a button, or holding a button down).\n * For browsers that already remove the 300ms delay, consider Ionic's tap system as a way to\n * normalize how clicks are handled across the various devices so there's an expected response\n * no matter what the device, platform or version. Additionally, Ionic will prevent\n * ghostclicks which even browsers that remove the delay still experience.\n *\n * In some cases, third-party libraries may also be working with touch events which can interfere\n * with the tap system. For example, mapping libraries like Google or Leaflet Maps often implement\n * a touch detection system which conflicts with Ionic's tap system.\n *\n * ### Disabling the tap system\n *\n * To disable the tap for an element and all of its children elements,\n * add the attribute `data-tap-disabled=\"true\"`.\n *\n * ```html\n * <div data-tap-disabled=\"true\">\n *     <div id=\"google-map\"></div>\n * </div>\n * ```\n *\n * ### Additional Notes:\n *\n * - Ionic tap  works with Ionic's JavaScript scrolling\n * - Elements can come and go from the DOM and Ionic tap doesn't keep adding and removing\n *   listeners\n * - No \"tap delay\" after the first \"tap\" (you can tap as fast as you want, they all click)\n * - Minimal events listeners, only being added to document\n * - Correct focus in/out on each input type (select, textearea, range) on each platform/device\n * - Shows and hides virtual keyboard correctly for each platform/device\n * - Works with labels surrounding inputs\n * - Does not fire off a click if the user moves the pointer too far\n * - Adds and removes an 'activated' css class\n * - Multiple [unit tests](https://github.com/driftyco/ionic/blob/master/test/unit/utils/tap.unit.js) for each scenario\n *\n */\n/*\n\n IONIC TAP\n ---------------\n - Both touch and mouse events are added to the document.body on DOM ready\n - If a touch event happens, it does not use mouse event listeners\n - On touchend, if the distance between start and end was small, trigger a click\n - In the triggered click event, add a 'isIonicTap' property\n - The triggered click receives the same x,y coordinates as as the end event\n - On document.body click listener (with useCapture=true), only allow clicks with 'isIonicTap'\n - Triggering clicks with mouse events work the same as touch, except with mousedown/mouseup\n - Tapping inputs is disabled during scrolling\n*/\n\nvar tapDoc; // the element which the listeners are on (document.body)\nvar tapActiveEle; // the element which is active (probably has focus)\nvar tapEnabledTouchEvents;\nvar tapMouseResetTimer;\nvar tapPointerMoved;\nvar tapPointerStart;\nvar tapTouchFocusedInput;\nvar tapLastTouchTarget;\nvar tapTouchMoveListener = 'touchmove';\n\n// how much the coordinates can be off between start/end, but still a click\nvar TAP_RELEASE_TOLERANCE = 12; // default tolerance\nvar TAP_RELEASE_BUTTON_TOLERANCE = 50; // button elements should have a larger tolerance\n\nvar tapEventListeners = {\n  'click': tapClickGateKeeper,\n\n  'mousedown': tapMouseDown,\n  'mouseup': tapMouseUp,\n  'mousemove': tapMouseMove,\n\n  'touchstart': tapTouchStart,\n  'touchend': tapTouchEnd,\n  'touchcancel': tapTouchCancel,\n  'touchmove': tapTouchMove,\n\n  'pointerdown': tapTouchStart,\n  'pointerup': tapTouchEnd,\n  'pointercancel': tapTouchCancel,\n  'pointermove': tapTouchMove,\n\n  'MSPointerDown': tapTouchStart,\n  'MSPointerUp': tapTouchEnd,\n  'MSPointerCancel': tapTouchCancel,\n  'MSPointerMove': tapTouchMove,\n\n  'focusin': tapFocusIn,\n  'focusout': tapFocusOut\n};\n\nionic.tap = {\n\n  register: function(ele) {\n    tapDoc = ele;\n\n    tapEventListener('click', true, true);\n    tapEventListener('mouseup');\n    tapEventListener('mousedown');\n\n    if (window.navigator.pointerEnabled) {\n      tapEventListener('pointerdown');\n      tapEventListener('pointerup');\n      tapEventListener('pointercancel');\n      tapTouchMoveListener = 'pointermove';\n\n    } else if (window.navigator.msPointerEnabled) {\n      tapEventListener('MSPointerDown');\n      tapEventListener('MSPointerUp');\n      tapEventListener('MSPointerCancel');\n      tapTouchMoveListener = 'MSPointerMove';\n\n    } else {\n      tapEventListener('touchstart');\n      tapEventListener('touchend');\n      tapEventListener('touchcancel');\n    }\n\n    tapEventListener('focusin');\n    tapEventListener('focusout');\n\n    return function() {\n      for (var type in tapEventListeners) {\n        tapEventListener(type, false);\n      }\n      tapDoc = null;\n      tapActiveEle = null;\n      tapEnabledTouchEvents = false;\n      tapPointerMoved = false;\n      tapPointerStart = null;\n    };\n  },\n\n  ignoreScrollStart: function(e) {\n    return (e.defaultPrevented) ||  // defaultPrevented has been assigned by another component handling the event\n           (/^(file|range)$/i).test(e.target.type) ||\n           (e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll')) == 'true' || // manually set within an elements attributes\n           (!!(/^(object|embed)$/i).test(e.target.tagName)) ||  // flash/movie/object touches should not try to scroll\n           ionic.tap.isElementTapDisabled(e.target); // check if this element, or an ancestor, has `data-tap-disabled` attribute\n  },\n\n  isTextInput: function(ele) {\n    return !!ele &&\n           (ele.tagName == 'TEXTAREA' ||\n            ele.contentEditable === 'true' ||\n            (ele.tagName == 'INPUT' && !(/^(radio|checkbox|range|file|submit|reset|color|image|button)$/i).test(ele.type)));\n  },\n\n  isDateInput: function(ele) {\n    return !!ele &&\n            (ele.tagName == 'INPUT' && (/^(date|time|datetime-local|month|week)$/i).test(ele.type));\n  },\n\n  isVideo: function(ele) {\n    return !!ele &&\n            (ele.tagName == 'VIDEO');\n  },\n\n  isKeyboardElement: function(ele) {\n    if ( !ionic.Platform.isIOS() || ionic.Platform.isIPad() ) {\n      return ionic.tap.isTextInput(ele) && !ionic.tap.isDateInput(ele);\n    } else {\n      return ionic.tap.isTextInput(ele) || ( !!ele && ele.tagName == \"SELECT\");\n    }\n  },\n\n  isLabelWithTextInput: function(ele) {\n    var container = tapContainingElement(ele, false);\n\n    return !!container &&\n           ionic.tap.isTextInput(tapTargetElement(container));\n  },\n\n  containsOrIsTextInput: function(ele) {\n    return ionic.tap.isTextInput(ele) || ionic.tap.isLabelWithTextInput(ele);\n  },\n\n  cloneFocusedInput: function(container) {\n    if (ionic.tap.hasCheckedClone) return;\n    ionic.tap.hasCheckedClone = true;\n\n    ionic.requestAnimationFrame(function() {\n      var focusInput = container.querySelector(':focus');\n      if (ionic.tap.isTextInput(focusInput) && !ionic.tap.isDateInput(focusInput)) {\n        var clonedInput = focusInput.cloneNode(true);\n\n        clonedInput.value = focusInput.value;\n        clonedInput.classList.add('cloned-text-input');\n        clonedInput.readOnly = true;\n        if (focusInput.isContentEditable) {\n          clonedInput.contentEditable = focusInput.contentEditable;\n          clonedInput.innerHTML = focusInput.innerHTML;\n        }\n        focusInput.parentElement.insertBefore(clonedInput, focusInput);\n        focusInput.classList.add('previous-input-focus');\n\n        clonedInput.scrollTop = focusInput.scrollTop;\n      }\n    });\n  },\n\n  hasCheckedClone: false,\n\n  removeClonedInputs: function(container) {\n    ionic.tap.hasCheckedClone = false;\n\n    ionic.requestAnimationFrame(function() {\n      var clonedInputs = container.querySelectorAll('.cloned-text-input');\n      var previousInputFocus = container.querySelectorAll('.previous-input-focus');\n      var x;\n\n      for (x = 0; x < clonedInputs.length; x++) {\n        clonedInputs[x].parentElement.removeChild(clonedInputs[x]);\n      }\n\n      for (x = 0; x < previousInputFocus.length; x++) {\n        previousInputFocus[x].classList.remove('previous-input-focus');\n        previousInputFocus[x].style.top = '';\n        if ( ionic.keyboard.isOpen && !ionic.keyboard.isClosing ) previousInputFocus[x].focus();\n      }\n    });\n  },\n\n  requiresNativeClick: function(ele) {\n    if (ionic.Platform.isWindowsPhone() && (ele.tagName == 'A' || ele.tagName == 'BUTTON' || ele.hasAttribute('ng-click') || (ele.tagName == 'INPUT' && (ele.type == 'button' || ele.type == 'submit')))) {\n      return true; //Windows Phone edge case, prevent ng-click (and similar) events from firing twice on this platform\n    }\n    if (!ele || ele.disabled || (/^(file|range)$/i).test(ele.type) || (/^(object|video)$/i).test(ele.tagName) || ionic.tap.isLabelContainingFileInput(ele)) {\n      return true;\n    }\n    return ionic.tap.isElementTapDisabled(ele);\n  },\n\n  isLabelContainingFileInput: function(ele) {\n    var lbl = tapContainingElement(ele);\n    if (lbl.tagName !== 'LABEL') return false;\n    var fileInput = lbl.querySelector('input[type=file]');\n    if (fileInput && fileInput.disabled === false) return true;\n    return false;\n  },\n\n  isElementTapDisabled: function(ele) {\n    if (ele && ele.nodeType === 1) {\n      var element = ele;\n      while (element) {\n        if (element.getAttribute && element.getAttribute('data-tap-disabled') == 'true') {\n          return true;\n        }\n        element = element.parentElement;\n      }\n    }\n    return false;\n  },\n\n  setTolerance: function(releaseTolerance, releaseButtonTolerance) {\n    TAP_RELEASE_TOLERANCE = releaseTolerance;\n    TAP_RELEASE_BUTTON_TOLERANCE = releaseButtonTolerance;\n  },\n\n  cancelClick: function() {\n    // used to cancel any simulated clicks which may happen on a touchend/mouseup\n    // gestures uses this method within its tap and hold events\n    tapPointerMoved = true;\n  },\n\n  pointerCoord: function(event) {\n    // This method can get coordinates for both a mouse click\n    // or a touch depending on the given event\n    var c = { x: 0, y: 0 };\n    if (event) {\n      var touches = event.touches && event.touches.length ? event.touches : [event];\n      var e = (event.changedTouches && event.changedTouches[0]) || touches[0];\n      if (e) {\n        c.x = e.clientX || e.pageX || 0;\n        c.y = e.clientY || e.pageY || 0;\n      }\n    }\n    return c;\n  }\n\n};\n\nfunction tapEventListener(type, enable, useCapture) {\n  if (enable !== false) {\n    tapDoc.addEventListener(type, tapEventListeners[type], useCapture);\n  } else {\n    tapDoc.removeEventListener(type, tapEventListeners[type]);\n  }\n}\n\nfunction tapClick(e) {\n  // simulate a normal click by running the element's click method then focus on it\n  var container = tapContainingElement(e.target);\n  var ele = tapTargetElement(container);\n\n  if (ionic.tap.requiresNativeClick(ele) || tapPointerMoved) return false;\n\n  var c = ionic.tap.pointerCoord(e);\n\n  //console.log('tapClick', e.type, ele.tagName, '('+c.x+','+c.y+')');\n  triggerMouseEvent('click', ele, c.x, c.y);\n\n  // if it's an input, focus in on the target, otherwise blur\n  tapHandleFocus(ele);\n}\n\nfunction triggerMouseEvent(type, ele, x, y) {\n  // using initMouseEvent instead of MouseEvent for our Android friends\n  var clickEvent = document.createEvent(\"MouseEvents\");\n  clickEvent.initMouseEvent(type, true, true, window, 1, 0, 0, x, y, false, false, false, false, 0, null);\n  clickEvent.isIonicTap = true;\n  ele.dispatchEvent(clickEvent);\n}\n\nfunction tapClickGateKeeper(e) {\n  //console.log('click ' + Date.now() + ' isIonicTap: ' + (e.isIonicTap ? true : false));\n  if (e.target.type == 'submit' && e.detail === 0) {\n    // do not prevent click if it came from an \"Enter\" or \"Go\" keypress submit\n    return null;\n  }\n\n  // do not allow through any click events that were not created by ionic.tap\n  if ((ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target)) ||\n      (!e.isIonicTap && !ionic.tap.requiresNativeClick(e.target))) {\n    //console.log('clickPrevent', e.target.tagName);\n    e.stopPropagation();\n\n    if (!ionic.tap.isLabelWithTextInput(e.target)) {\n      // labels clicks from native should not preventDefault othersize keyboard will not show on input focus\n      e.preventDefault();\n    }\n    return false;\n  }\n}\n\n// MOUSE\nfunction tapMouseDown(e) {\n  //console.log('mousedown ' + Date.now());\n  if (e.isIonicTap || tapIgnoreEvent(e)) return null;\n\n  if (tapEnabledTouchEvents) {\n    //console.log('mousedown', 'stop event');\n    e.stopPropagation();\n\n    if (!ionic.Platform.isEdge() && (!ionic.tap.isTextInput(e.target) || tapLastTouchTarget !== e.target) &&\n      !isSelectOrOption(e.target.tagName) && !ionic.tap.isVideo(e.target)) {\n      // If you preventDefault on a text input then you cannot move its text caret/cursor.\n      // Allow through only the text input default. However, without preventDefault on an\n      // input the 300ms delay can change focus on inputs after the keyboard shows up.\n      // The focusin event handles the chance of focus changing after the keyboard shows.\n      // Windows Phone - if you preventDefault on a video element then you cannot operate\n      // its native controls.\n      e.preventDefault();\n    }\n\n    return false;\n  }\n\n  tapPointerMoved = false;\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener('mousemove');\n  ionic.activator.start(e);\n}\n\nfunction tapMouseUp(e) {\n  //console.log(\"mouseup \" + Date.now());\n  if (tapEnabledTouchEvents) {\n    e.stopPropagation();\n    e.preventDefault();\n    return false;\n  }\n\n  if (tapIgnoreEvent(e) || isSelectOrOption(e.target.tagName)) return false;\n\n  if (!tapHasPointerMoved(e)) {\n    tapClick(e);\n  }\n  tapEventListener('mousemove', false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapMouseMove(e) {\n  if (tapHasPointerMoved(e)) {\n    tapEventListener('mousemove', false);\n    ionic.activator.end();\n    tapPointerMoved = true;\n    return false;\n  }\n}\n\n\n// TOUCH\nfunction tapTouchStart(e) {\n  //console.log(\"touchstart \" + Date.now());\n  if (tapIgnoreEvent(e)) return;\n\n  tapPointerMoved = false;\n\n  tapEnableTouchEvents();\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener(tapTouchMoveListener);\n  ionic.activator.start(e);\n\n  if (ionic.Platform.isIOS() && ionic.tap.isLabelWithTextInput(e.target)) {\n    // if the tapped element is a label, which has a child input\n    // then preventDefault so iOS doesn't ugly auto scroll to the input\n    // but do not prevent default on Android or else you cannot move the text caret\n    // and do not prevent default on Android or else no virtual keyboard shows up\n\n    var textInput = tapTargetElement(tapContainingElement(e.target));\n    if (textInput !== tapActiveEle) {\n      // don't preventDefault on an already focused input or else iOS's text caret isn't usable\n      //console.log('Would prevent default here');\n      e.preventDefault();\n    }\n  }\n}\n\nfunction tapTouchEnd(e) {\n  //console.log('touchend ' + Date.now());\n  if (tapIgnoreEvent(e)) return;\n\n  tapEnableTouchEvents();\n  if (!tapHasPointerMoved(e)) {\n    tapClick(e);\n\n    if (isSelectOrOption(e.target.tagName)) {\n      e.preventDefault();\n    }\n  }\n\n  tapLastTouchTarget = e.target;\n  tapTouchCancel();\n}\n\nfunction tapTouchMove(e) {\n  if (tapHasPointerMoved(e)) {\n    tapPointerMoved = true;\n    tapEventListener(tapTouchMoveListener, false);\n    ionic.activator.end();\n    return false;\n  }\n}\n\nfunction tapTouchCancel() {\n  tapEventListener(tapTouchMoveListener, false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapEnableTouchEvents() {\n  tapEnabledTouchEvents = true;\n  clearTimeout(tapMouseResetTimer);\n  tapMouseResetTimer = setTimeout(function() {\n    tapEnabledTouchEvents = false;\n  }, 600);\n}\n\nfunction tapIgnoreEvent(e) {\n  if (e.isTapHandled) return true;\n  e.isTapHandled = true;\n\n  if(ionic.tap.isElementTapDisabled(e.target)) {\n    return true;\n  }\n\n  if (ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target)) {\n    e.preventDefault();\n    return true;\n  }\n}\n\nfunction tapHandleFocus(ele) {\n  tapTouchFocusedInput = null;\n\n  var triggerFocusIn = false;\n\n  if (ele.tagName == 'SELECT') {\n    // trick to force Android options to show up\n    triggerMouseEvent('mousedown', ele, 0, 0);\n    ele.focus && ele.focus();\n    triggerFocusIn = true;\n\n  } else if (tapActiveElement() === ele) {\n    // already is the active element and has focus\n    triggerFocusIn = true;\n\n  } else if ((/^(input|textarea|ion-label)$/i).test(ele.tagName) || ele.isContentEditable) {\n    triggerFocusIn = true;\n    ele.focus && ele.focus();\n    ele.value = ele.value;\n    if (tapEnabledTouchEvents) {\n      tapTouchFocusedInput = ele;\n    }\n\n  } else {\n    tapFocusOutActive();\n  }\n\n  if (triggerFocusIn) {\n    tapActiveElement(ele);\n    ionic.trigger('ionic.focusin', {\n      target: ele\n    }, true);\n  }\n}\n\nfunction tapFocusOutActive() {\n  var ele = tapActiveElement();\n  if (ele && ((/^(input|textarea|select)$/i).test(ele.tagName) || ele.isContentEditable)) {\n    //console.log('tapFocusOutActive', ele.tagName);\n    ele.blur();\n  }\n  tapActiveElement(null);\n}\n\nfunction tapFocusIn(e) {\n  //console.log('focusin ' + Date.now());\n  // Because a text input doesn't preventDefault (so the caret still works) there's a chance\n  // that its mousedown event 300ms later will change the focus to another element after\n  // the keyboard shows up.\n\n  if (tapEnabledTouchEvents &&\n      ionic.tap.isTextInput(tapActiveElement()) &&\n      ionic.tap.isTextInput(tapTouchFocusedInput) &&\n      tapTouchFocusedInput !== e.target) {\n\n    // 1) The pointer is from touch events\n    // 2) There is an active element which is a text input\n    // 3) A text input was just set to be focused on by a touch event\n    // 4) A new focus has been set, however the target isn't the one the touch event wanted\n    //console.log('focusin', 'tapTouchFocusedInput');\n    tapTouchFocusedInput.focus();\n    tapTouchFocusedInput = null;\n  }\n  ionic.scroll.isScrolling = false;\n}\n\nfunction tapFocusOut() {\n  //console.log(\"focusout\");\n  tapActiveElement(null);\n}\n\nfunction tapActiveElement(ele) {\n  if (arguments.length) {\n    tapActiveEle = ele;\n  }\n  return tapActiveEle || document.activeElement;\n}\n\nfunction tapHasPointerMoved(endEvent) {\n  if (!endEvent || endEvent.target.nodeType !== 1 || !tapPointerStart || (tapPointerStart.x === 0 && tapPointerStart.y === 0)) {\n    return false;\n  }\n  var endCoordinates = ionic.tap.pointerCoord(endEvent);\n\n  var hasClassList = !!(endEvent.target.classList && endEvent.target.classList.contains &&\n    typeof endEvent.target.classList.contains === 'function');\n  var releaseTolerance = hasClassList && endEvent.target.classList.contains('button') ?\n    TAP_RELEASE_BUTTON_TOLERANCE :\n    TAP_RELEASE_TOLERANCE;\n\n  return Math.abs(tapPointerStart.x - endCoordinates.x) > releaseTolerance ||\n         Math.abs(tapPointerStart.y - endCoordinates.y) > releaseTolerance;\n}\n\nfunction tapContainingElement(ele, allowSelf) {\n  var climbEle = ele;\n  for (var x = 0; x < 6; x++) {\n    if (!climbEle) break;\n    if (climbEle.tagName === 'LABEL') return climbEle;\n    climbEle = climbEle.parentElement;\n  }\n  if (allowSelf !== false) return ele;\n}\n\nfunction tapTargetElement(ele) {\n  if (ele && ele.tagName === 'LABEL') {\n    if (ele.control) return ele.control;\n\n    // older devices do not support the \"control\" property\n    if (ele.querySelector) {\n      var control = ele.querySelector('input,textarea,select');\n      if (control) return control;\n    }\n  }\n  return ele;\n}\n\nfunction isSelectOrOption(tagName){\n  return (/^(select|option)$/i).test(tagName);\n}\n\nionic.DomUtil.ready(function() {\n  var ng = typeof angular !== 'undefined' ? angular : null;\n  //do nothing for e2e tests\n  if (!ng || (ng && !ng.scenario)) {\n    ionic.tap.register(document);\n  }\n});\n\n(function(document, ionic) {\n  'use strict';\n\n  var queueElements = {};   // elements that should get an active state in XX milliseconds\n  var activeElements = {};  // elements that are currently active\n  var keyId = 0;            // a counter for unique keys for the above ojects\n  var ACTIVATED_CLASS = 'activated';\n\n  ionic.activator = {\n\n    start: function(e) {\n      var hitX = ionic.tap.pointerCoord(e).x;\n      if (hitX > 0 && hitX < 30) {\n        return;\n      }\n\n      // when an element is touched/clicked, it climbs up a few\n      // parents to see if it is an .item or .button element\n      ionic.requestAnimationFrame(function() {\n        if ((ionic.scroll && ionic.scroll.isScrolling) || ionic.tap.requiresNativeClick(e.target)) return;\n        var ele = e.target;\n        var eleToActivate;\n\n        for (var x = 0; x < 6; x++) {\n          if (!ele || ele.nodeType !== 1) break;\n          if (eleToActivate && ele.classList && ele.classList.contains('item')) {\n            eleToActivate = ele;\n            break;\n          }\n          if (ele.tagName == 'A' || ele.tagName == 'BUTTON' || ele.hasAttribute('ng-click')) {\n            eleToActivate = ele;\n            break;\n          }\n          if (ele.classList && ele.classList.contains('button')) {\n            eleToActivate = ele;\n            break;\n          }\n          // no sense climbing past these\n          if (ele.tagName == 'ION-CONTENT' || (ele.classList && ele.classList.contains('pane')) || ele.tagName == 'BODY') {\n            break;\n          }\n          ele = ele.parentElement;\n        }\n\n        if (eleToActivate) {\n          // queue that this element should be set to active\n          queueElements[keyId] = eleToActivate;\n\n          // on the next frame, set the queued elements to active\n          ionic.requestAnimationFrame(activateElements);\n\n          keyId = (keyId > 29 ? 0 : keyId + 1);\n        }\n\n      });\n    },\n\n    end: function() {\n      // clear out any active/queued elements after XX milliseconds\n      setTimeout(clear, 200);\n    }\n\n  };\n\n  function clear() {\n    // clear out any elements that are queued to be set to active\n    queueElements = {};\n\n    // in the next frame, remove the active class from all active elements\n    ionic.requestAnimationFrame(deactivateElements);\n  }\n\n  function activateElements() {\n    // activate all elements in the queue\n    for (var key in queueElements) {\n      if (queueElements[key]) {\n        queueElements[key].classList.add(ACTIVATED_CLASS);\n        activeElements[key] = queueElements[key];\n      }\n    }\n    queueElements = {};\n  }\n\n  function deactivateElements() {\n    if (ionic.transition && ionic.transition.isActive) {\n      setTimeout(deactivateElements, 400);\n      return;\n    }\n\n    for (var key in activeElements) {\n      if (activeElements[key]) {\n        activeElements[key].classList.remove(ACTIVATED_CLASS);\n        delete activeElements[key];\n      }\n    }\n  }\n\n})(document, ionic);\n\n(function(ionic) {\n  /* for nextUid function below */\n  var nextId = 0;\n\n  /**\n   * Various utilities used throughout Ionic\n   *\n   * Some of these are adopted from underscore.js and backbone.js, both also MIT licensed.\n   */\n  ionic.Utils = {\n\n    arrayMove: function(arr, oldIndex, newIndex) {\n      if (newIndex >= arr.length) {\n        var k = newIndex - arr.length;\n        while ((k--) + 1) {\n          arr.push(undefined);\n        }\n      }\n      arr.splice(newIndex, 0, arr.splice(oldIndex, 1)[0]);\n      return arr;\n    },\n\n    /**\n     * Return a function that will be called with the given context\n     */\n    proxy: function(func, context) {\n      var args = Array.prototype.slice.call(arguments, 2);\n      return function() {\n        return func.apply(context, args.concat(Array.prototype.slice.call(arguments)));\n      };\n    },\n\n    /**\n     * Only call a function once in the given interval.\n     *\n     * @param func {Function} the function to call\n     * @param wait {int} how long to wait before/after to allow function calls\n     * @param immediate {boolean} whether to call immediately or after the wait interval\n     */\n     debounce: function(func, wait, immediate) {\n      var timeout, args, context, timestamp, result;\n      return function() {\n        context = this;\n        args = arguments;\n        timestamp = new Date();\n        var later = function() {\n          var last = (new Date()) - timestamp;\n          if (last < wait) {\n            timeout = setTimeout(later, wait - last);\n          } else {\n            timeout = null;\n            if (!immediate) result = func.apply(context, args);\n          }\n        };\n        var callNow = immediate && !timeout;\n        if (!timeout) {\n          timeout = setTimeout(later, wait);\n        }\n        if (callNow) result = func.apply(context, args);\n        return result;\n      };\n    },\n\n    /**\n     * Throttle the given fun, only allowing it to be\n     * called at most every `wait` ms.\n     */\n    throttle: function(func, wait, options) {\n      var context, args, result;\n      var timeout = null;\n      var previous = 0;\n      options || (options = {});\n      var later = function() {\n        previous = options.leading === false ? 0 : Date.now();\n        timeout = null;\n        result = func.apply(context, args);\n      };\n      return function() {\n        var now = Date.now();\n        if (!previous && options.leading === false) previous = now;\n        var remaining = wait - (now - previous);\n        context = this;\n        args = arguments;\n        if (remaining <= 0) {\n          clearTimeout(timeout);\n          timeout = null;\n          previous = now;\n          result = func.apply(context, args);\n        } else if (!timeout && options.trailing !== false) {\n          timeout = setTimeout(later, remaining);\n        }\n        return result;\n      };\n    },\n     // Borrowed from Backbone.js's extend\n     // Helper function to correctly set up the prototype chain, for subclasses.\n     // Similar to `goog.inherits`, but uses a hash of prototype properties and\n     // class properties to be extended.\n    inherit: function(protoProps, staticProps) {\n      var parent = this;\n      var child;\n\n      // The constructor function for the new subclass is either defined by you\n      // (the \"constructor\" property in your `extend` definition), or defaulted\n      // by us to simply call the parent's constructor.\n      if (protoProps && protoProps.hasOwnProperty('constructor')) {\n        child = protoProps.constructor;\n      } else {\n        child = function() { return parent.apply(this, arguments); };\n      }\n\n      // Add static properties to the constructor function, if supplied.\n      ionic.extend(child, parent, staticProps);\n\n      // Set the prototype chain to inherit from `parent`, without calling\n      // `parent`'s constructor function.\n      var Surrogate = function() { this.constructor = child; };\n      Surrogate.prototype = parent.prototype;\n      child.prototype = new Surrogate();\n\n      // Add prototype properties (instance properties) to the subclass,\n      // if supplied.\n      if (protoProps) ionic.extend(child.prototype, protoProps);\n\n      // Set a convenience property in case the parent's prototype is needed\n      // later.\n      child.__super__ = parent.prototype;\n\n      return child;\n    },\n\n    // Extend adapted from Underscore.js\n    extend: function(obj) {\n       var args = Array.prototype.slice.call(arguments, 1);\n       for (var i = 0; i < args.length; i++) {\n         var source = args[i];\n         if (source) {\n           for (var prop in source) {\n             obj[prop] = source[prop];\n           }\n         }\n       }\n       return obj;\n    },\n\n    nextUid: function() {\n      return 'ion' + (nextId++);\n    },\n\n    disconnectScope: function disconnectScope(scope) {\n      if (!scope) return;\n\n      if (scope.$root === scope) {\n        return; // we can't disconnect the root node;\n      }\n      var parent = scope.$parent;\n      scope.$$disconnected = true;\n      scope.$broadcast('$ionic.disconnectScope', scope);\n\n      // See Scope.$destroy\n      if (parent.$$childHead === scope) {\n        parent.$$childHead = scope.$$nextSibling;\n      }\n      if (parent.$$childTail === scope) {\n        parent.$$childTail = scope.$$prevSibling;\n      }\n      if (scope.$$prevSibling) {\n        scope.$$prevSibling.$$nextSibling = scope.$$nextSibling;\n      }\n      if (scope.$$nextSibling) {\n        scope.$$nextSibling.$$prevSibling = scope.$$prevSibling;\n      }\n      scope.$$nextSibling = scope.$$prevSibling = null;\n    },\n\n    reconnectScope: function reconnectScope(scope) {\n      if (!scope) return;\n\n      if (scope.$root === scope) {\n        return; // we can't disconnect the root node;\n      }\n      if (!scope.$$disconnected) {\n        return;\n      }\n      var parent = scope.$parent;\n      scope.$$disconnected = false;\n      scope.$broadcast('$ionic.reconnectScope', scope);\n      // See Scope.$new for this logic...\n      scope.$$prevSibling = parent.$$childTail;\n      if (parent.$$childHead) {\n        parent.$$childTail.$$nextSibling = scope;\n        parent.$$childTail = scope;\n      } else {\n        parent.$$childHead = parent.$$childTail = scope;\n      }\n    },\n\n    isScopeDisconnected: function(scope) {\n      var climbScope = scope;\n      while (climbScope) {\n        if (climbScope.$$disconnected) return true;\n        climbScope = climbScope.$parent;\n      }\n      return false;\n    }\n  };\n\n  // Bind a few of the most useful functions to the ionic scope\n  ionic.inherit = ionic.Utils.inherit;\n  ionic.extend = ionic.Utils.extend;\n  ionic.throttle = ionic.Utils.throttle;\n  ionic.proxy = ionic.Utils.proxy;\n  ionic.debounce = ionic.Utils.debounce;\n\n})(window.ionic);\n\n/**\n * @ngdoc page\n * @name keyboard\n * @module ionic\n * @description\n * On both Android and iOS, Ionic will attempt to prevent the keyboard from\n * obscuring inputs and focusable elements when it appears by scrolling them\n * into view.  In order for this to work, any focusable elements must be within\n * a [Scroll View](http://ionicframework.com/docs/api/directive/ionScroll/)\n * or a directive such as [Content](http://ionicframework.com/docs/api/directive/ionContent/)\n * that has a Scroll View.\n *\n * It will also attempt to prevent the native overflow scrolling on focus,\n * which can cause layout issues such as pushing headers up and out of view.\n *\n * The keyboard fixes work best in conjunction with the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard),\n * although it will perform reasonably well without.  However, if you are using\n * Cordova there is no reason not to use the plugin.\n *\n * ### Hide when keyboard shows\n *\n * To hide an element when the keyboard is open, add the class `hide-on-keyboard-open`.\n *\n * ```html\n * <div class=\"hide-on-keyboard-open\">\n *   <div id=\"google-map\"></div>\n * </div>\n * ```\n *\n * Note: For performance reasons, elements will not be hidden for 400ms after the start of the `native.keyboardshow` event\n * from the Ionic Keyboard plugin. If you would like them to disappear immediately, you could do something\n * like:\n *\n * ```js\n *   window.addEventListener('native.keyboardshow', function(){\n *     document.body.classList.add('keyboard-open');\n *   });\n * ```\n * This adds the same `keyboard-open` class that is normally added by Ionic 400ms after the keyboard\n * opens. However, bear in mind that adding this class to the body immediately may cause jank in any\n * animations on Android that occur when the keyboard opens (for example, scrolling any obscured inputs into view).\n *\n * ----------\n *\n * ### Plugin Usage\n * Information on using the plugin can be found at\n * [https://github.com/driftyco/ionic-plugins-keyboard](https://github.com/driftyco/ionic-plugins-keyboard).\n *\n * ----------\n *\n * ### Android Notes\n * - If your app is running in fullscreen, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"true\" />` in your `config.xml` file\n *   you will need to set `ionic.Platform.isFullScreen = true` manually.\n *\n * - You can configure the behavior of the web view when the keyboard shows by setting\n *   [android:windowSoftInputMode](http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode)\n *   to either `adjustPan`, `adjustResize` or `adjustNothing` in your app's\n *   activity in `AndroidManifest.xml`. `adjustResize` is the recommended setting\n *   for Ionic, but if for some reason you do use `adjustPan` you will need to\n *   set `ionic.Platform.isFullScreen = true`.\n *\n *   ```xml\n *   <activity android:windowSoftInputMode=\"adjustResize\">\n *\n *   ```\n *\n * ### iOS Notes\n * - If the content of your app (including the header) is being pushed up and\n *   out of view on input focus, try setting `cordova.plugins.Keyboard.disableScroll(true)`.\n *   This does **not** disable scrolling in the Ionic scroll view, rather it\n *   disables the native overflow scrolling that happens automatically as a\n *   result of focusing on inputs below the keyboard.\n *\n */\n\n/**\n * The current viewport height.\n */\nvar keyboardCurrentViewportHeight = 0;\n\n/**\n * The viewport height when in portrait orientation.\n */\nvar keyboardPortraitViewportHeight = 0;\n\n/**\n * The viewport height when in landscape orientation.\n */\nvar keyboardLandscapeViewportHeight = 0;\n\n/**\n * The currently focused input.\n */\nvar keyboardActiveElement;\n\n/**\n * The previously focused input used to reset keyboard after focusing on a\n * new non-keyboard element\n */\nvar lastKeyboardActiveElement;\n\n/**\n * The scroll view containing the currently focused input.\n */\nvar scrollView;\n\n/**\n * Timer for the setInterval that polls window.innerHeight to determine whether\n * the layout has updated for the keyboard showing/hiding.\n */\nvar waitForResizeTimer;\n\n/**\n * Sometimes when switching inputs or orientations, focusout will fire before\n * focusin, so this timer is for the small setTimeout to determine if we should\n * really focusout/hide the keyboard.\n */\nvar keyboardFocusOutTimer;\n\n/**\n * on Android, orientationchange will fire before the keyboard plugin notifies\n * the browser that the keyboard will show/is showing, so this flag indicates\n * to nativeShow that there was an orientationChange and we should update\n * the viewport height with an accurate keyboard height value\n */\nvar wasOrientationChange = false;\n\n/**\n * CSS class added to the body indicating the keyboard is open.\n */\nvar KEYBOARD_OPEN_CSS = 'keyboard-open';\n\n/**\n * CSS class that indicates a scroll container.\n */\nvar SCROLL_CONTAINER_CSS = 'scroll-content';\n\n/**\n * Debounced keyboardFocusIn function\n */\nvar debouncedKeyboardFocusIn = ionic.debounce(keyboardFocusIn, 200, true);\n\n/**\n * Debounced keyboardNativeShow function\n */\nvar debouncedKeyboardNativeShow = ionic.debounce(keyboardNativeShow, 100, true);\n\n/**\n * Ionic keyboard namespace.\n * @namespace keyboard\n */\nionic.keyboard = {\n\n  /**\n   * Whether the keyboard is open or not.\n   */\n  isOpen: false,\n\n  /**\n   * Whether the keyboard is closing or not.\n   */\n  isClosing: false,\n\n  /**\n   * Whether the keyboard is opening or not.\n   */\n  isOpening: false,\n\n  /**\n   * The height of the keyboard in pixels, as reported by the keyboard plugin.\n   * If the plugin is not available, calculated as the difference in\n   * window.innerHeight after the keyboard has shown.\n   */\n  height: 0,\n\n  /**\n   * Whether the device is in landscape orientation or not.\n   */\n  isLandscape: false,\n\n  /**\n   * Whether the keyboard event listeners have been added or not\n   */\n  isInitialized: false,\n\n  /**\n   * Hide the keyboard, if it is open.\n   */\n  hide: function() {\n    if (keyboardHasPlugin()) {\n      cordova.plugins.Keyboard.close();\n    }\n    keyboardActiveElement && keyboardActiveElement.blur();\n  },\n\n  /**\n   * An alias for cordova.plugins.Keyboard.show(). If the keyboard plugin\n   * is installed, show the keyboard.\n   */\n  show: function() {\n    if (keyboardHasPlugin()) {\n      cordova.plugins.Keyboard.show();\n    }\n  },\n\n  /**\n   * Remove all keyboard related event listeners, effectively disabling Ionic's\n   * keyboard adjustments.\n   */\n  disable: function() {\n    if (keyboardHasPlugin()) {\n      window.removeEventListener('native.keyboardshow', debouncedKeyboardNativeShow );\n      window.removeEventListener('native.keyboardhide', keyboardFocusOut);\n    } else {\n      document.body.removeEventListener('focusout', keyboardFocusOut);\n    }\n\n    document.body.removeEventListener('ionic.focusin', debouncedKeyboardFocusIn);\n    document.body.removeEventListener('focusin', debouncedKeyboardFocusIn);\n\n    window.removeEventListener('orientationchange', keyboardOrientationChange);\n\n    if ( window.navigator.msPointerEnabled ) {\n      document.removeEventListener(\"MSPointerDown\", keyboardInit);\n    } else {\n      document.removeEventListener('touchstart', keyboardInit);\n    }\n    ionic.keyboard.isInitialized = false;\n  },\n\n  /**\n   * Alias for keyboardInit, initialize all keyboard related event listeners.\n   */\n  enable: function() {\n    keyboardInit();\n  }\n};\n\n// Initialize the viewport height (after ionic.keyboard.height has been\n// defined).\nkeyboardCurrentViewportHeight = getViewportHeight();\n\n\n                             /* Event handlers */\n/* ------------------------------------------------------------------------- */\n\n/**\n * Event handler for first touch event, initializes all event listeners\n * for keyboard related events. Also aliased by ionic.keyboard.enable.\n */\nfunction keyboardInit() {\n\n  if (ionic.keyboard.isInitialized) return;\n\n  if (keyboardHasPlugin()) {\n    window.addEventListener('native.keyboardshow', debouncedKeyboardNativeShow);\n    window.addEventListener('native.keyboardhide', keyboardFocusOut);\n  } else {\n    document.body.addEventListener('focusout', keyboardFocusOut);\n  }\n\n  document.body.addEventListener('ionic.focusin', debouncedKeyboardFocusIn);\n  document.body.addEventListener('focusin', debouncedKeyboardFocusIn);\n\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerDown\", keyboardInit);\n  } else {\n    document.removeEventListener('touchstart', keyboardInit);\n  }\n\n  ionic.keyboard.isInitialized = true;\n}\n\n/**\n * Event handler for 'native.keyboardshow' event, sets keyboard.height to the\n * reported height and keyboard.isOpening to true. Then calls\n * keyboardWaitForResize with keyboardShow or keyboardUpdateViewportHeight as\n * the callback depending on whether the event was triggered by a focusin or\n * an orientationchange.\n */\nfunction keyboardNativeShow(e) {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardNativeShow fired at: \" + Date.now());\n  //console.log(\"keyboardNativeshow window.innerHeight: \" + window.innerHeight);\n\n  if (!ionic.keyboard.isOpen || ionic.keyboard.isClosing) {\n    ionic.keyboard.isOpening = true;\n    ionic.keyboard.isClosing = false;\n  }\n\n  ionic.keyboard.height = e.keyboardHeight;\n  //console.log('nativeshow keyboard height:' + e.keyboardHeight);\n\n  if (wasOrientationChange) {\n    keyboardWaitForResize(keyboardUpdateViewportHeight, true);\n  } else {\n    keyboardWaitForResize(keyboardShow, true);\n  }\n}\n\n/**\n * Event handler for 'focusin' and 'ionic.focusin' events. Initializes\n * keyboard state (keyboardActiveElement and keyboard.isOpening) for the\n * appropriate adjustments once the window has resized.  If not using the\n * keyboard plugin, calls keyboardWaitForResize with keyboardShow as the\n * callback or keyboardShow right away if the keyboard is already open.  If\n * using the keyboard plugin does nothing and lets keyboardNativeShow handle\n * adjustments with a more accurate keyboard height.\n */\nfunction keyboardFocusIn(e) {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardFocusIn from: \" + e.type + \" at: \" + Date.now());\n\n  if (!e.target ||\n      e.target.readOnly ||\n      !ionic.tap.isKeyboardElement(e.target) ||\n      !(scrollView = ionic.DomUtil.getParentWithClass(e.target, SCROLL_CONTAINER_CSS))) {\n    if (keyboardActiveElement) {\n        lastKeyboardActiveElement = keyboardActiveElement;\n    }\n    keyboardActiveElement = null;\n    return;\n  }\n\n  keyboardActiveElement = e.target;\n\n  // if using JS scrolling, undo the effects of native overflow scroll so the\n  // scroll view is positioned correctly\n  if (!scrollView.classList.contains(\"overflow-scroll\")) {\n    document.body.scrollTop = 0;\n    scrollView.scrollTop = 0;\n    ionic.requestAnimationFrame(function(){\n      document.body.scrollTop = 0;\n      scrollView.scrollTop = 0;\n    });\n\n    // any showing part of the document that isn't within the scroll the user\n    // could touchmove and cause some ugly changes to the app, so disable\n    // any touchmove events while the keyboard is open using e.preventDefault()\n    if (window.navigator.msPointerEnabled) {\n      document.addEventListener(\"MSPointerMove\", keyboardPreventDefault, false);\n    } else {\n      document.addEventListener('touchmove', keyboardPreventDefault, false);\n    }\n  }\n\n  if (!ionic.keyboard.isOpen || ionic.keyboard.isClosing) {\n    ionic.keyboard.isOpening = true;\n    ionic.keyboard.isClosing = false;\n  }\n\n  // attempt to prevent browser from natively scrolling input into view while\n  // we are trying to do the same (while we are scrolling) if the user taps the\n  // keyboard\n  document.addEventListener('keydown', keyboardOnKeyDown, false);\n\n\n\n  // if we aren't using the plugin and the keyboard isn't open yet, wait for the\n  // window to resize so we can get an accurate estimate of the keyboard size,\n  // otherwise we do nothing and let nativeShow call keyboardShow once we have\n  // an exact keyboard height\n  // if the keyboard is already open, go ahead and scroll the input into view\n  // if necessary\n  if (!ionic.keyboard.isOpen && !keyboardHasPlugin()) {\n    keyboardWaitForResize(keyboardShow, true);\n\n  } else if (ionic.keyboard.isOpen) {\n    keyboardShow();\n  }\n}\n\n/**\n * Event handler for 'focusout' events. Sets keyboard.isClosing to true and\n * calls keyboardWaitForResize with keyboardHide as the callback after a small\n * timeout.\n */\nfunction keyboardFocusOut() {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardFocusOut fired at: \" + Date.now());\n  //console.log(\"keyboardFocusOut event type: \" + e.type);\n\n  if (ionic.keyboard.isOpen || ionic.keyboard.isOpening) {\n    ionic.keyboard.isClosing = true;\n    ionic.keyboard.isOpening = false;\n  }\n\n  // Call keyboardHide with a slight delay because sometimes on focus or\n  // orientation change focusin is called immediately after, so we give it time\n  // to cancel keyboardHide\n  keyboardFocusOutTimer = setTimeout(function() {\n    ionic.requestAnimationFrame(function() {\n      // focusOut during or right after an orientationchange, so we didn't get\n      // a chance to update the viewport height yet, do it and keyboardHide\n      //console.log(\"focusOut, wasOrientationChange: \" + wasOrientationChange);\n      if (wasOrientationChange) {\n        keyboardWaitForResize(function(){\n          keyboardUpdateViewportHeight();\n          keyboardHide();\n        }, false);\n      } else {\n        keyboardWaitForResize(keyboardHide, false);\n      }\n    });\n  }, 50);\n}\n\n/**\n * Event handler for 'orientationchange' events. If using the keyboard plugin\n * and the keyboard is open on Android, sets wasOrientationChange to true so\n * nativeShow can update the viewport height with an accurate keyboard height.\n * If the keyboard isn't open or keyboard plugin isn't being used,\n * waits for the window to resize before updating the viewport height.\n *\n * On iOS, where orientationchange fires after the keyboard has already shown,\n * updates the viewport immediately, regardless of if the keyboard is already\n * open.\n */\nfunction keyboardOrientationChange() {\n  //console.log(\"orientationchange fired at: \" + Date.now());\n  //console.log(\"orientation was: \" + (ionic.keyboard.isLandscape ? \"landscape\" : \"portrait\"));\n\n  // toggle orientation\n  ionic.keyboard.isLandscape = !ionic.keyboard.isLandscape;\n  // //console.log(\"now orientation is: \" + (ionic.keyboard.isLandscape ? \"landscape\" : \"portrait\"));\n\n  // no need to wait for resizing on iOS, and orientationchange always fires\n  // after the keyboard has opened, so it doesn't matter if it's open or not\n  if (ionic.Platform.isIOS()) {\n    keyboardUpdateViewportHeight();\n  }\n\n  // On Android, if the keyboard isn't open or we aren't using the keyboard\n  // plugin, update the viewport height once everything has resized. If the\n  // keyboard is open and we are using the keyboard plugin do nothing and let\n  // nativeShow handle it using an accurate keyboard height.\n  if ( ionic.Platform.isAndroid()) {\n    if (!ionic.keyboard.isOpen || !keyboardHasPlugin()) {\n      keyboardWaitForResize(keyboardUpdateViewportHeight, false);\n    } else {\n      wasOrientationChange = true;\n    }\n  }\n}\n\n/**\n * Event handler for 'keydown' event. Tries to prevent browser from natively\n * scrolling an input into view when a user taps the keyboard while we are\n * scrolling the input into view ourselves with JS.\n */\nfunction keyboardOnKeyDown(e) {\n  if (ionic.scroll.isScrolling) {\n    keyboardPreventDefault(e);\n  }\n}\n\n/**\n * Event for 'touchmove' or 'MSPointerMove'. Prevents native scrolling on\n * elements outside the scroll view while the keyboard is open.\n */\nfunction keyboardPreventDefault(e) {\n  if (e.target.tagName !== 'TEXTAREA') {\n    e.preventDefault();\n  }\n}\n\n                              /* Private API */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Polls window.innerHeight until it has updated to an expected value (or\n * sufficient time has passed) before calling the specified callback function.\n * Only necessary for non-fullscreen Android which sometimes reports multiple\n * window.innerHeight values during interim layouts while it is resizing.\n *\n * On iOS, the window.innerHeight will already be updated, but we use the 50ms\n * delay as essentially a timeout so that scroll view adjustments happen after\n * the keyboard has shown so there isn't a white flash from us resizing too\n * quickly.\n *\n * @param {Function} callback the function to call once the window has resized\n * @param {boolean} isOpening whether the resize is from the keyboard opening\n * or not\n */\nfunction keyboardWaitForResize(callback, isOpening) {\n  clearInterval(waitForResizeTimer);\n  var count = 0;\n  var maxCount;\n  var initialHeight = getViewportHeight();\n  var viewportHeight = initialHeight;\n\n  //console.log(\"waitForResize initial viewport height: \" + viewportHeight);\n  //var start = Date.now();\n  //console.log(\"start: \" + start);\n\n  // want to fail relatively quickly on modern android devices, since it's much\n  // more likely we just have a bad keyboard height\n  if (ionic.Platform.isAndroid() && ionic.Platform.version() < 4.4) {\n    maxCount = 30;\n  } else if (ionic.Platform.isAndroid()) {\n    maxCount = 10;\n  } else {\n    maxCount = 1;\n  }\n\n  // poll timer\n  waitForResizeTimer = setInterval(function(){\n    viewportHeight = getViewportHeight();\n\n    // height hasn't updated yet, try again in 50ms\n    // if not using plugin, wait for maxCount to ensure we have waited long enough\n    // to get an accurate keyboard height\n    if (++count < maxCount &&\n        ((!isPortraitViewportHeight(viewportHeight) &&\n         !isLandscapeViewportHeight(viewportHeight)) ||\n         !ionic.keyboard.height)) {\n      return;\n    }\n\n    // infer the keyboard height from the resize if not using the keyboard plugin\n    if (!keyboardHasPlugin()) {\n      ionic.keyboard.height = Math.abs(initialHeight - window.innerHeight);\n    }\n\n    // set to true if we were waiting for the keyboard to open\n    ionic.keyboard.isOpen = isOpening;\n\n    clearInterval(waitForResizeTimer);\n    //var end = Date.now();\n    //console.log(\"waitForResize count: \" + count);\n    //console.log(\"end: \" + end);\n    //console.log(\"difference: \" + ( end - start ) + \"ms\");\n\n    //console.log(\"callback: \" + callback.name);\n    callback();\n\n  }, 50);\n\n  return maxCount; //for tests\n}\n\n/**\n * On keyboard close sets keyboard state to closed, resets the scroll view,\n * removes CSS from body indicating keyboard was open, removes any event\n * listeners for when the keyboard is open and on Android blurs the active\n * element (which in some cases will still have focus even if the keyboard\n * is closed and can cause it to reappear on subsequent taps).\n */\nfunction keyboardHide() {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardHide\");\n\n  ionic.keyboard.isOpen = false;\n  ionic.keyboard.isClosing = false;\n\n  if (keyboardActiveElement || lastKeyboardActiveElement) {\n    ionic.trigger('resetScrollView', {\n      target: keyboardActiveElement || lastKeyboardActiveElement\n    }, true);\n  }\n\n  ionic.requestAnimationFrame(function(){\n    document.body.classList.remove(KEYBOARD_OPEN_CSS);\n  });\n\n  // the keyboard is gone now, remove the touchmove that disables native scroll\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerMove\", keyboardPreventDefault);\n  } else {\n    document.removeEventListener('touchmove', keyboardPreventDefault);\n  }\n  document.removeEventListener('keydown', keyboardOnKeyDown);\n\n  if (ionic.Platform.isAndroid()) {\n    // on android closing the keyboard with the back/dismiss button won't remove\n    // focus and keyboard can re-appear on subsequent taps (like scrolling)\n    if (keyboardHasPlugin()) cordova.plugins.Keyboard.close();\n    keyboardActiveElement && keyboardActiveElement.blur();\n  }\n\n  keyboardActiveElement = null;\n  lastKeyboardActiveElement = null;\n}\n\n/**\n * On keyboard open sets keyboard state to open, adds CSS to the body\n * indicating the keyboard is open and tells the scroll view to resize and\n * the currently focused input into view if necessary.\n */\nfunction keyboardShow() {\n\n  ionic.keyboard.isOpen = true;\n  ionic.keyboard.isOpening = false;\n\n  var details = {\n    keyboardHeight: keyboardGetHeight(),\n    viewportHeight: keyboardCurrentViewportHeight\n  };\n\n  if (keyboardActiveElement) {\n    details.target = keyboardActiveElement;\n\n    var elementBounds = keyboardActiveElement.getBoundingClientRect();\n\n    details.elementTop = Math.round(elementBounds.top);\n    details.elementBottom = Math.round(elementBounds.bottom);\n\n    details.windowHeight = details.viewportHeight - details.keyboardHeight;\n    //console.log(\"keyboardShow viewportHeight: \" + details.viewportHeight +\n    //\", windowHeight: \" + details.windowHeight +\n    //\", keyboardHeight: \" + details.keyboardHeight);\n\n    // figure out if the element is under the keyboard\n    details.isElementUnderKeyboard = (details.elementBottom > details.windowHeight);\n    //console.log(\"isUnderKeyboard: \" + details.isElementUnderKeyboard);\n    //console.log(\"elementBottom: \" + details.elementBottom);\n\n    // send event so the scroll view adjusts\n    ionic.trigger('scrollChildIntoView', details, true);\n  }\n\n  setTimeout(function(){\n    document.body.classList.add(KEYBOARD_OPEN_CSS);\n  }, 400);\n\n  return details; //for testing\n}\n\n/* eslint no-unused-vars:0 */\nfunction keyboardGetHeight() {\n  // check if we already have a keyboard height from the plugin or resize calculations\n  if (ionic.keyboard.height) {\n    return ionic.keyboard.height;\n  }\n\n  if (ionic.Platform.isAndroid()) {\n    // should be using the plugin, no way to know how big the keyboard is, so guess\n    if ( ionic.Platform.isFullScreen ) {\n      return 275;\n    }\n    // otherwise just calculate it\n    var contentHeight = window.innerHeight;\n    if (contentHeight < keyboardCurrentViewportHeight) {\n      return keyboardCurrentViewportHeight - contentHeight;\n    } else {\n      return 0;\n    }\n  }\n\n  // fallback for when it's the webview without the plugin\n  // or for just the standard web browser\n  // TODO: have these be based on device\n  if (ionic.Platform.isIOS()) {\n    if (ionic.keyboard.isLandscape) {\n      return 206;\n    }\n\n    if (!ionic.Platform.isWebView()) {\n      return 216;\n    }\n\n    return 260;\n  }\n\n  // safe guess\n  return 275;\n}\n\nfunction isPortraitViewportHeight(viewportHeight) {\n  return !!(!ionic.keyboard.isLandscape &&\n         keyboardPortraitViewportHeight &&\n         (Math.abs(keyboardPortraitViewportHeight - viewportHeight) < 2));\n}\n\nfunction isLandscapeViewportHeight(viewportHeight) {\n  return !!(ionic.keyboard.isLandscape &&\n         keyboardLandscapeViewportHeight &&\n         (Math.abs(keyboardLandscapeViewportHeight - viewportHeight) < 2));\n}\n\nfunction keyboardUpdateViewportHeight() {\n  wasOrientationChange = false;\n  keyboardCurrentViewportHeight = getViewportHeight();\n\n  if (ionic.keyboard.isLandscape && !keyboardLandscapeViewportHeight) {\n    //console.log(\"saved landscape: \" + keyboardCurrentViewportHeight);\n    keyboardLandscapeViewportHeight = keyboardCurrentViewportHeight;\n\n  } else if (!ionic.keyboard.isLandscape && !keyboardPortraitViewportHeight) {\n    //console.log(\"saved portrait: \" + keyboardCurrentViewportHeight);\n    keyboardPortraitViewportHeight = keyboardCurrentViewportHeight;\n  }\n\n  if (keyboardActiveElement) {\n    ionic.trigger('resetScrollView', {\n      target: keyboardActiveElement\n    }, true);\n  }\n\n  if (ionic.keyboard.isOpen && ionic.tap.isTextInput(keyboardActiveElement)) {\n    keyboardShow();\n  }\n}\n\nfunction keyboardInitViewportHeight() {\n  var viewportHeight = getViewportHeight();\n  //console.log(\"Keyboard init VP: \" + viewportHeight + \" \" + window.innerWidth);\n  // can't just use window.innerHeight in case the keyboard is opened immediately\n  if ((viewportHeight / window.innerWidth) < 1) {\n    ionic.keyboard.isLandscape = true;\n  }\n  //console.log(\"ionic.keyboard.isLandscape is: \" + ionic.keyboard.isLandscape);\n\n  // initialize or update the current viewport height values\n  keyboardCurrentViewportHeight = viewportHeight;\n  if (ionic.keyboard.isLandscape && !keyboardLandscapeViewportHeight) {\n    keyboardLandscapeViewportHeight = keyboardCurrentViewportHeight;\n  } else if (!ionic.keyboard.isLandscape && !keyboardPortraitViewportHeight) {\n    keyboardPortraitViewportHeight = keyboardCurrentViewportHeight;\n  }\n}\n\nfunction getViewportHeight() {\n  var windowHeight = window.innerHeight;\n  //console.log('window.innerHeight is: ' + windowHeight);\n  //console.log('kb height is: ' + ionic.keyboard.height);\n  //console.log('kb isOpen: ' + ionic.keyboard.isOpen);\n\n  //TODO: add iPad undocked/split kb once kb plugin supports it\n  // the keyboard overlays the window on Android fullscreen\n  if (!(ionic.Platform.isAndroid() && ionic.Platform.isFullScreen) &&\n      (ionic.keyboard.isOpen || ionic.keyboard.isOpening) &&\n      !ionic.keyboard.isClosing) {\n\n     return windowHeight + keyboardGetHeight();\n  }\n  return windowHeight;\n}\n\nfunction keyboardHasPlugin() {\n  return !!(window.cordova && cordova.plugins && cordova.plugins.Keyboard);\n}\n\nionic.Platform.ready(function() {\n  keyboardInitViewportHeight();\n\n  window.addEventListener('orientationchange', keyboardOrientationChange);\n\n  // if orientation changes while app is in background, update on resuming\n  /*\n  if ( ionic.Platform.isWebView() ) {\n    document.addEventListener('resume', keyboardInitViewportHeight);\n\n    if (ionic.Platform.isAndroid()) {\n      //TODO: onbackpressed to detect keyboard close without focusout or plugin\n    }\n  }\n  */\n\n  // if orientation changes while app is in background, update on resuming\n/*  if ( ionic.Platform.isWebView() ) {\n    document.addEventListener('pause', function() {\n      window.removeEventListener('orientationchange', keyboardOrientationChange);\n    })\n    document.addEventListener('resume', function() {\n      keyboardInitViewportHeight();\n      window.addEventListener('orientationchange', keyboardOrientationChange)\n    });\n  }*/\n\n  // Android sometimes reports bad innerHeight on window.load\n  // try it again in a lil bit to play it safe\n  setTimeout(keyboardInitViewportHeight, 999);\n\n  // only initialize the adjustments for the virtual keyboard\n  // if a touchstart event happens\n  if (window.navigator.msPointerEnabled) {\n    document.addEventListener(\"MSPointerDown\", keyboardInit, false);\n  } else {\n    document.addEventListener('touchstart', keyboardInit, false);\n  }\n});\n\n\n\nvar viewportTag;\nvar viewportProperties = {};\n\nionic.viewport = {\n  orientation: function() {\n    // 0 = Portrait\n    // 90 = Landscape\n    // not using window.orientation because each device has a different implementation\n    return (window.innerWidth > window.innerHeight ? 90 : 0);\n  }\n};\n\nfunction viewportLoadTag() {\n  var x;\n\n  for (x = 0; x < document.head.children.length; x++) {\n    if (document.head.children[x].name == 'viewport') {\n      viewportTag = document.head.children[x];\n      break;\n    }\n  }\n\n  if (viewportTag) {\n    var props = viewportTag.content.toLowerCase().replace(/\\s+/g, '').split(',');\n    var keyValue;\n    for (x = 0; x < props.length; x++) {\n      if (props[x]) {\n        keyValue = props[x].split('=');\n        viewportProperties[ keyValue[0] ] = (keyValue.length > 1 ? keyValue[1] : '_');\n      }\n    }\n    viewportUpdate();\n  }\n}\n\nfunction viewportUpdate() {\n  // unit tests in viewport.unit.js\n\n  var initWidth = viewportProperties.width;\n  var initHeight = viewportProperties.height;\n  var p = ionic.Platform;\n  var version = p.version();\n  var DEVICE_WIDTH = 'device-width';\n  var DEVICE_HEIGHT = 'device-height';\n  var orientation = ionic.viewport.orientation();\n\n  // Most times we're removing the height and adding the width\n  // So this is the default to start with, then modify per platform/version/oreintation\n  delete viewportProperties.height;\n  viewportProperties.width = DEVICE_WIDTH;\n\n  if (p.isIPad()) {\n    // iPad\n\n    if (version > 7) {\n      // iPad >= 7.1\n      // https://issues.apache.org/jira/browse/CB-4323\n      delete viewportProperties.width;\n\n    } else {\n      // iPad <= 7.0\n\n      if (p.isWebView()) {\n        // iPad <= 7.0 WebView\n\n        if (orientation == 90) {\n          // iPad <= 7.0 WebView Landscape\n          viewportProperties.height = '0';\n\n        } else if (version == 7) {\n          // iPad <= 7.0 WebView Portait\n          viewportProperties.height = DEVICE_HEIGHT;\n        }\n      } else {\n        // iPad <= 6.1 Browser\n        if (version < 7) {\n          viewportProperties.height = '0';\n        }\n      }\n    }\n\n  } else if (p.isIOS()) {\n    // iPhone\n\n    if (p.isWebView()) {\n      // iPhone WebView\n\n      if (version > 7) {\n        // iPhone >= 7.1 WebView\n        delete viewportProperties.width;\n\n      } else if (version < 7) {\n        // iPhone <= 6.1 WebView\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if (initHeight) viewportProperties.height = '0';\n\n      } else if (version == 7) {\n        //iPhone == 7.0 WebView\n        viewportProperties.height = DEVICE_HEIGHT;\n      }\n\n    } else {\n      // iPhone Browser\n\n      if (version < 7) {\n        // iPhone <= 6.1 Browser\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if (initHeight) viewportProperties.height = '0';\n      }\n    }\n\n  }\n\n  // only update the viewport tag if there was a change\n  if (initWidth !== viewportProperties.width || initHeight !== viewportProperties.height) {\n    viewportTagUpdate();\n  }\n}\n\nfunction viewportTagUpdate() {\n  var key, props = [];\n  for (key in viewportProperties) {\n    if (viewportProperties[key]) {\n      props.push(key + (viewportProperties[key] == '_' ? '' : '=' + viewportProperties[key]));\n    }\n  }\n\n  viewportTag.content = props.join(', ');\n}\n\nionic.Platform.ready(function() {\n  viewportLoadTag();\n\n  window.addEventListener(\"orientationchange\", function() {\n    setTimeout(viewportUpdate, 1000);\n  }, false);\n});\n\n(function(ionic) {\n'use strict';\n  ionic.views.View = function() {\n    this.initialize.apply(this, arguments);\n  };\n\n  ionic.views.View.inherit = ionic.inherit;\n\n  ionic.extend(ionic.views.View.prototype, {\n    initialize: function() {}\n  });\n\n})(window.ionic);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\n/* jshint eqnull: true */\n\n/**\n * Generic animation class with support for dropped frames both optional easing and duration.\n *\n * Optional duration is useful when the lifetime is defined by another condition than time\n * e.g. speed of an animating object, etc.\n *\n * Dropped frame logic allows to keep using the same updater logic independent from the actual\n * rendering. This eases a lot of cases where it might be pretty complex to break down a state\n * based on the pure time difference.\n */\nvar zyngaCore = { effect: {} };\n(function(global) {\n  var time = Date.now || function() {\n    return +new Date();\n  };\n  var desiredFrames = 60;\n  var millisecondsPerSecond = 1000;\n  var running = {};\n  var counter = 1;\n\n  zyngaCore.effect.Animate = {\n\n    /**\n     * A requestAnimationFrame wrapper / polyfill.\n     *\n     * @param callback {Function} The callback to be invoked before the next repaint.\n     * @param root {HTMLElement} The root element for the repaint\n     */\n    requestAnimationFrame: (function() {\n\n      // Check for request animation Frame support\n      var requestFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || global.oRequestAnimationFrame;\n      var isNative = !!requestFrame;\n\n      if (requestFrame && !/requestAnimationFrame\\(\\)\\s*\\{\\s*\\[native code\\]\\s*\\}/i.test(requestFrame.toString())) {\n        isNative = false;\n      }\n\n      if (isNative) {\n        return function(callback, root) {\n          requestFrame(callback, root);\n        };\n      }\n\n      var TARGET_FPS = 60;\n      var requests = {};\n      var requestCount = 0;\n      var rafHandle = 1;\n      var intervalHandle = null;\n      var lastActive = +new Date();\n\n      return function(callback) {\n        var callbackHandle = rafHandle++;\n\n        // Store callback\n        requests[callbackHandle] = callback;\n        requestCount++;\n\n        // Create timeout at first request\n        if (intervalHandle === null) {\n\n          intervalHandle = setInterval(function() {\n\n            var time = +new Date();\n            var currentRequests = requests;\n\n            // Reset data structure before executing callbacks\n            requests = {};\n            requestCount = 0;\n\n            for(var key in currentRequests) {\n              if (currentRequests.hasOwnProperty(key)) {\n                currentRequests[key](time);\n                lastActive = time;\n              }\n            }\n\n            // Disable the timeout when nothing happens for a certain\n            // period of time\n            if (time - lastActive > 2500) {\n              clearInterval(intervalHandle);\n              intervalHandle = null;\n            }\n\n          }, 1000 / TARGET_FPS);\n        }\n\n        return callbackHandle;\n      };\n\n    })(),\n\n\n    /**\n     * Stops the given animation.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation was stopped (aka, was running before)\n     */\n    stop: function(id) {\n      var cleared = running[id] != null;\n      if (cleared) {\n        running[id] = null;\n      }\n\n      return cleared;\n    },\n\n\n    /**\n     * Whether the given animation is still running.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation is still running\n     */\n    isRunning: function(id) {\n      return running[id] != null;\n    },\n\n\n    /**\n     * Start the animation.\n     *\n     * @param stepCallback {Function} Pointer to function which is executed on every step.\n     *   Signature of the method should be `function(percent, now, virtual) { return continueWithAnimation; }`\n     * @param verifyCallback {Function} Executed before every animation step.\n     *   Signature of the method should be `function() { return continueWithAnimation; }`\n     * @param completedCallback {Function}\n     *   Signature of the method should be `function(droppedFrames, finishedAnimation) {}`\n     * @param duration {Integer} Milliseconds to run the animation\n     * @param easingMethod {Function} Pointer to easing function\n     *   Signature of the method should be `function(percent) { return modifiedValue; }`\n     * @param root {Element} Render root, when available. Used for internal\n     *   usage of requestAnimationFrame.\n     * @return {Integer} Identifier of animation. Can be used to stop it any time.\n     */\n    start: function(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) {\n\n      var start = time();\n      var lastFrame = start;\n      var percent = 0;\n      var dropCounter = 0;\n      var id = counter++;\n\n      if (!root) {\n        root = document.body;\n      }\n\n      // Compacting running db automatically every few new animations\n      if (id % 20 === 0) {\n        var newRunning = {};\n        for (var usedId in running) {\n          newRunning[usedId] = true;\n        }\n        running = newRunning;\n      }\n\n      // This is the internal step method which is called every few milliseconds\n      var step = function(virtual) {\n\n        // Normalize virtual value\n        var render = virtual !== true;\n\n        // Get current time\n        var now = time();\n\n        // Verification is executed before next animation step\n        if (!running[id] || (verifyCallback && !verifyCallback(id))) {\n\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, false);\n          return;\n\n        }\n\n        // For the current rendering to apply let's update omitted steps in memory.\n        // This is important to bring internal state variables up-to-date with progress in time.\n        if (render) {\n\n          var droppedFrames = Math.round((now - lastFrame) / (millisecondsPerSecond / desiredFrames)) - 1;\n          for (var j = 0; j < Math.min(droppedFrames, 4); j++) {\n            step(true);\n            dropCounter++;\n          }\n\n        }\n\n        // Compute percent value\n        if (duration) {\n          percent = (now - start) / duration;\n          if (percent > 1) {\n            percent = 1;\n          }\n        }\n\n        // Execute step callback, then...\n        var value = easingMethod ? easingMethod(percent) : percent;\n        if ((stepCallback(value, now, render) === false || percent === 1) && render) {\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration == null);\n        } else if (render) {\n          lastFrame = now;\n          zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n        }\n      };\n\n      // Mark as running\n      running[id] = true;\n\n      // Init first step\n      zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n\n      // Return unique animation ID\n      return id;\n    }\n  };\n})(window);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\n(function(ionic) {\n  var NOOP = function(){};\n\n  // Easing Equations (c) 2003 Robert Penner, all rights reserved.\n  // Open source under the BSD License.\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeOutCubic = function(pos) {\n    return (Math.pow((pos - 1), 3) + 1);\n  };\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeInOutCubic = function(pos) {\n    if ((pos /= 0.5) < 1) {\n      return 0.5 * Math.pow(pos, 3);\n    }\n\n    return 0.5 * (Math.pow((pos - 2), 3) + 2);\n  };\n\n\n/**\n * ionic.views.Scroll\n * A powerful scroll view with support for bouncing, pull to refresh, and paging.\n * @param   {Object}        options options for the scroll view\n * @class A scroll view system\n * @memberof ionic.views\n */\nionic.views.Scroll = ionic.views.View.inherit({\n  initialize: function(options) {\n    var self = this;\n\n    self.__container = options.el;\n    self.__content = options.el.firstElementChild;\n\n    //Remove any scrollTop attached to these elements; they are virtual scroll now\n    //This also stops on-load-scroll-to-window.location.hash that the browser does\n    setTimeout(function() {\n      if (self.__container && self.__content) {\n        self.__container.scrollTop = 0;\n        self.__content.scrollTop = 0;\n      }\n    });\n\n    self.options = {\n\n      /** Disable scrolling on x-axis by default */\n      scrollingX: false,\n      scrollbarX: true,\n\n      /** Enable scrolling on y-axis */\n      scrollingY: true,\n      scrollbarY: true,\n\n      startX: 0,\n      startY: 0,\n\n      /** The amount to dampen mousewheel events */\n      wheelDampen: 6,\n\n      /** The minimum size the scrollbars scale to while scrolling */\n      minScrollbarSizeX: 5,\n      minScrollbarSizeY: 5,\n\n      /** Scrollbar fading after scrolling */\n      scrollbarsFade: true,\n      scrollbarFadeDelay: 300,\n      /** The initial fade delay when the pane is resized or initialized */\n      scrollbarResizeFadeDelay: 1000,\n\n      /** Enable animations for deceleration, snap back, zooming and scrolling */\n      animating: true,\n\n      /** duration for animations triggered by scrollTo/zoomTo */\n      animationDuration: 250,\n\n      /** The velocity required to make the scroll view \"slide\" after touchend */\n      decelVelocityThreshold: 4,\n\n      /** The velocity required to make the scroll view \"slide\" after touchend when using paging */\n      decelVelocityThresholdPaging: 4,\n\n      /** Enable bouncing (content can be slowly moved outside and jumps back after releasing) */\n      bouncing: true,\n\n      /** Enable locking to the main axis if user moves only slightly on one of them at start */\n      locking: true,\n\n      /** Enable pagination mode (switching between full page content panes) */\n      paging: false,\n\n      /** Enable snapping of content to a configured pixel grid */\n      snapping: false,\n\n      /** Enable zooming of content via API, fingers and mouse wheel */\n      zooming: false,\n\n      /** Minimum zoom level */\n      minZoom: 0.5,\n\n      /** Maximum zoom level */\n      maxZoom: 3,\n\n      /** Multiply or decrease scrolling speed **/\n      speedMultiplier: 1,\n\n      deceleration: 0.97,\n\n      /** Whether to prevent default on a scroll operation to capture drag events **/\n      preventDefault: false,\n\n      /** Callback that is fired on the later of touch end or deceleration end,\n        provided that another scrolling action has not begun. Used to know\n        when to fade out a scrollbar. */\n      scrollingComplete: NOOP,\n\n      /** This configures the amount of change applied to deceleration when reaching boundaries  **/\n      penetrationDeceleration: 0.03,\n\n      /** This configures the amount of change applied to acceleration when reaching boundaries  **/\n      penetrationAcceleration: 0.08,\n\n      // The ms interval for triggering scroll events\n      scrollEventInterval: 10,\n\n      freeze: false,\n\n      getContentWidth: function() {\n        return Math.max(self.__content.scrollWidth, self.__content.offsetWidth);\n      },\n      getContentHeight: function() {\n        return Math.max(self.__content.scrollHeight, self.__content.offsetHeight + (self.__content.offsetTop * 2));\n      }\n    };\n\n    for (var key in options) {\n      self.options[key] = options[key];\n    }\n\n    self.hintResize = ionic.debounce(function() {\n      self.resize();\n    }, 1000, true);\n\n    self.onScroll = function() {\n\n      if (!ionic.scroll.isScrolling) {\n        setTimeout(self.setScrollStart, 50);\n      } else {\n        clearTimeout(self.scrollTimer);\n        self.scrollTimer = setTimeout(self.setScrollStop, 80);\n      }\n\n    };\n\n    self.freeze = function(shouldFreeze) {\n      if (arguments.length) {\n        self.options.freeze = shouldFreeze;\n      }\n      return self.options.freeze;\n    };\n\n    // We can just use the standard freeze pop in our mouth\n    self.freezeShut = self.freeze;\n\n    self.setScrollStart = function() {\n      ionic.scroll.isScrolling = Math.abs(ionic.scroll.lastTop - self.__scrollTop) > 1;\n      clearTimeout(self.scrollTimer);\n      self.scrollTimer = setTimeout(self.setScrollStop, 80);\n    };\n\n    self.setScrollStop = function() {\n      ionic.scroll.isScrolling = false;\n      ionic.scroll.lastTop = self.__scrollTop;\n    };\n\n    self.triggerScrollEvent = ionic.throttle(function() {\n      self.onScroll();\n      ionic.trigger('scroll', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    }, self.options.scrollEventInterval);\n\n    self.triggerScrollEndEvent = function() {\n      ionic.trigger('scrollend', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    };\n\n    self.__scrollLeft = self.options.startX;\n    self.__scrollTop = self.options.startY;\n\n    // Get the render update function, initialize event handlers,\n    // and calculate the size of the scroll container\n    self.__callback = self.getRenderFn();\n    self.__initEventHandlers();\n    self.__createScrollbars();\n\n  },\n\n  run: function() {\n    this.resize();\n\n    // Fade them out\n    this.__fadeScrollbars('out', this.options.scrollbarResizeFadeDelay);\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: STATUS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Whether only a single finger is used in touch handling */\n  __isSingleTouch: false,\n\n  /** Whether a touch event sequence is in progress */\n  __isTracking: false,\n\n  /** Whether a deceleration animation went to completion. */\n  __didDecelerationComplete: false,\n\n  /**\n   * Whether a gesture zoom/rotate event is in progress. Activates when\n   * a gesturestart event happens. This has higher priority than dragging.\n   */\n  __isGesturing: false,\n\n  /**\n   * Whether the user has moved by such a distance that we have enabled\n   * dragging mode. Hint: It's only enabled after some pixels of movement to\n   * not interrupt with clicks etc.\n   */\n  __isDragging: false,\n\n  /**\n   * Not touching and dragging anymore, and smoothly animating the\n   * touch sequence using deceleration.\n   */\n  __isDecelerating: false,\n\n  /**\n   * Smoothly animating the currently configured change\n   */\n  __isAnimating: false,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DIMENSIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Available outer left position (from document perspective) */\n  __clientLeft: 0,\n\n  /** Available outer top position (from document perspective) */\n  __clientTop: 0,\n\n  /** Available outer width */\n  __clientWidth: 0,\n\n  /** Available outer height */\n  __clientHeight: 0,\n\n  /** Outer width of content */\n  __contentWidth: 0,\n\n  /** Outer height of content */\n  __contentHeight: 0,\n\n  /** Snapping width for content */\n  __snapWidth: 100,\n\n  /** Snapping height for content */\n  __snapHeight: 100,\n\n  /** Height to assign to refresh area */\n  __refreshHeight: null,\n\n  /** Whether the refresh process is enabled when the event is released now */\n  __refreshActive: false,\n\n  /** Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release */\n  __refreshActivate: null,\n\n  /** Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled */\n  __refreshDeactivate: null,\n\n  /** Callback to execute to start the actual refresh. Call {@link #refreshFinish} when done */\n  __refreshStart: null,\n\n  /** Zoom level */\n  __zoomLevel: 1,\n\n  /** Scroll position on x-axis */\n  __scrollLeft: 0,\n\n  /** Scroll position on y-axis */\n  __scrollTop: 0,\n\n  /** Maximum allowed scroll position on x-axis */\n  __maxScrollLeft: 0,\n\n  /** Maximum allowed scroll position on y-axis */\n  __maxScrollTop: 0,\n\n  /* Scheduled left position (final position when animating) */\n  __scheduledLeft: 0,\n\n  /* Scheduled top position (final position when animating) */\n  __scheduledTop: 0,\n\n  /* Scheduled zoom level (final scale when animating) */\n  __scheduledZoom: 0,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: LAST POSITIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Left position of finger at start */\n  __lastTouchLeft: null,\n\n  /** Top position of finger at start */\n  __lastTouchTop: null,\n\n  /** Timestamp of last move of finger. Used to limit tracking range for deceleration speed. */\n  __lastTouchMove: null,\n\n  /** List of positions, uses three indexes for each state: left, top, timestamp */\n  __positions: null,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DECELERATION SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /** Minimum left scroll position during deceleration */\n  __minDecelerationScrollLeft: null,\n\n  /** Minimum top scroll position during deceleration */\n  __minDecelerationScrollTop: null,\n\n  /** Maximum left scroll position during deceleration */\n  __maxDecelerationScrollLeft: null,\n\n  /** Maximum top scroll position during deceleration */\n  __maxDecelerationScrollTop: null,\n\n  /** Current factor to modify horizontal scroll position with on every step */\n  __decelerationVelocityX: null,\n\n  /** Current factor to modify vertical scroll position with on every step */\n  __decelerationVelocityY: null,\n\n\n  /** the browser-specific property to use for transforms */\n  __transformProperty: null,\n  __perspectiveProperty: null,\n\n  /** scrollbar indicators */\n  __indicatorX: null,\n  __indicatorY: null,\n\n  /** Timeout for scrollbar fading */\n  __scrollbarFadeTimeout: null,\n\n  /** whether we've tried to wait for size already */\n  __didWaitForSize: null,\n  __sizerTimeout: null,\n\n  __initEventHandlers: function() {\n    var self = this;\n\n    // Event Handler\n    var container = self.__container;\n\n    // save height when scroll view is shrunk so we don't need to reflow\n    var scrollViewOffsetHeight;\n\n    /**\n     * Shrink the scroll view when the keyboard is up if necessary and if the\n     * focused input is below the bottom of the shrunk scroll view, scroll it\n     * into view.\n     */\n    self.scrollChildIntoView = function(e) {\n      //console.log(\"scrollChildIntoView at: \" + Date.now());\n\n      // D\n      var scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n      // D - A\n      scrollViewOffsetHeight = container.offsetHeight;\n      var alreadyShrunk = self.isShrunkForKeyboard;\n\n      var isModal = container.parentNode.classList.contains('modal');\n      // 680px is when the media query for 60% modal width kicks in\n      var isInsetModal = isModal && window.innerWidth >= 680;\n\n     /*\n      *  _______\n      * |---A---| <- top of scroll view\n      * |       |\n      * |---B---| <- keyboard\n      * |   C   | <- input\n      * |---D---| <- initial bottom of scroll view\n      * |___E___| <- bottom of viewport\n      *\n      *  All commented calculations relative to the top of the viewport (ie E\n      *  is the viewport height, not 0)\n      */\n      if (!alreadyShrunk) {\n        // shrink scrollview so we can actually scroll if the input is hidden\n        // if it isn't shrink so we can scroll to inputs under the keyboard\n        // inset modals won't shrink on Android on their own when the keyboard appears\n        if ( ionic.Platform.isIOS() || ionic.Platform.isFullScreen || isInsetModal ) {\n          // if there are things below the scroll view account for them and\n          // subtract them from the keyboard height when resizing\n          // E - D                         E                         D\n          var scrollBottomOffsetToBottom = e.detail.viewportHeight - scrollBottomOffsetToTop;\n\n          // 0 or D - B if D > B           E - B                     E - D\n          var keyboardOffset = Math.max(0, e.detail.keyboardHeight - scrollBottomOffsetToBottom);\n\n          ionic.requestAnimationFrame(function(){\n            // D - A or B - A if D > B       D - A             max(0, D - B)\n            scrollViewOffsetHeight = scrollViewOffsetHeight - keyboardOffset;\n            container.style.height = scrollViewOffsetHeight + \"px\";\n            container.style.overflow = \"visible\";\n\n            //update scroll view\n            self.resize();\n          });\n        }\n\n        self.isShrunkForKeyboard = true;\n      }\n\n      /*\n       *  _______\n       * |---A---| <- top of scroll view\n       * |   *   | <- where we want to scroll to\n       * |--B-D--| <- keyboard, bottom of scroll view\n       * |   C   | <- input\n       * |       |\n       * |___E___| <- bottom of viewport\n       *\n       *  All commented calculations relative to the top of the viewport (ie E\n       *  is the viewport height, not 0)\n       */\n      // if the element is positioned under the keyboard scroll it into view\n      if (e.detail.isElementUnderKeyboard) {\n\n        ionic.requestAnimationFrame(function(){\n          container.scrollTop = 0;\n          // update D if we shrunk\n          if (self.isShrunkForKeyboard && !alreadyShrunk) {\n            scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n          }\n\n          // middle of the scrollview, this is where we want to scroll to\n          // (D - A) / 2\n          var scrollMidpointOffset = scrollViewOffsetHeight * 0.5;\n          //console.log(\"container.offsetHeight: \" + scrollViewOffsetHeight);\n\n          // middle of the input we want to scroll into view\n          // C\n          var inputMidpoint = ((e.detail.elementBottom + e.detail.elementTop) / 2);\n\n          // distance from middle of input to the bottom of the scroll view\n          // C - D                                C               D\n          var inputMidpointOffsetToScrollBottom = inputMidpoint - scrollBottomOffsetToTop;\n\n          //C - D + (D - A)/2          C - D                     (D - A)/ 2\n          var scrollTop = inputMidpointOffsetToScrollBottom + scrollMidpointOffset;\n\n          if ( scrollTop > 0) {\n            if (ionic.Platform.isIOS()) ionic.tap.cloneFocusedInput(container, self);\n            self.scrollBy(0, scrollTop, true);\n            self.onScroll();\n          }\n        });\n      }\n\n      // Only the first scrollView parent of the element that broadcasted this event\n      // (the active element that needs to be shown) should receive this event\n      e.stopPropagation();\n    };\n\n    self.resetScrollView = function() {\n      //return scrollview to original height once keyboard has hidden\n      if ( self.isShrunkForKeyboard ) {\n        self.isShrunkForKeyboard = false;\n        container.style.height = \"\";\n        container.style.overflow = \"\";\n      }\n      self.resize();\n    };\n\n    //Broadcasted when keyboard is shown on some platforms.\n    //See js/utils/keyboard.js\n    container.addEventListener('scrollChildIntoView', self.scrollChildIntoView);\n\n    // Listen on document because container may not have had the last\n    // keyboardActiveElement, for example after closing a modal with a focused\n    // input and returning to a previously resized scroll view in an ion-content.\n    // Since we can only resize scroll views that are currently visible, just resize\n    // the current scroll view when the keyboard is closed.\n    document.addEventListener('resetScrollView', self.resetScrollView);\n\n    function getEventTouches(e) {\n      return e.touches && e.touches.length ? e.touches : [{\n        pageX: e.pageX,\n        pageY: e.pageY\n      }];\n    }\n\n    self.touchStart = function(e) {\n      self.startCoordinates = ionic.tap.pointerCoord(e);\n\n      if ( ionic.tap.ignoreScrollStart(e) ) {\n        return;\n      }\n\n      self.__isDown = true;\n\n      if ( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) {\n        // do not start if the target is a text input\n        // if there is a touchmove on this input, then we can start the scroll\n        self.__hasStarted = false;\n        return;\n      }\n\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n      self.__hasStarted = true;\n      self.doTouchStart(getEventTouches(e), e.timeStamp);\n      e.preventDefault();\n    };\n\n    self.touchMove = function(e) {\n      if (self.options.freeze || !self.__isDown ||\n        (!self.__isDown && e.defaultPrevented) ||\n        (e.target.tagName === 'TEXTAREA' && e.target.parentElement.querySelector(':focus')) ) {\n        return;\n      }\n\n      if ( !self.__hasStarted && ( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) ) {\n        // the target is a text input and scroll has started\n        // since the text input doesn't start on touchStart, do it here\n        self.__hasStarted = true;\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n        e.preventDefault();\n        return;\n      }\n\n      if (self.startCoordinates) {\n        // we have start coordinates, so get this touch move's current coordinates\n        var currentCoordinates = ionic.tap.pointerCoord(e);\n\n        if ( self.__isSelectable &&\n            ionic.tap.isTextInput(e.target) &&\n            Math.abs(self.startCoordinates.x - currentCoordinates.x) > 20 ) {\n          // user slid the text input's caret on its x axis, disable any future y scrolling\n          self.__enableScrollY = false;\n          self.__isSelectable = true;\n        }\n\n        if ( self.__enableScrollY && Math.abs(self.startCoordinates.y - currentCoordinates.y) > 10 ) {\n          // user scrolled the entire view on the y axis\n          // disabled being able to select text on an input\n          // hide the input which has focus, and show a cloned one that doesn't have focus\n          self.__isSelectable = false;\n          ionic.tap.cloneFocusedInput(container, self);\n        }\n      }\n\n      self.doTouchMove(getEventTouches(e), e.timeStamp, e.scale);\n      self.__isDown = true;\n    };\n\n    self.touchMoveBubble = function(e) {\n      if(self.__isDown && self.options.preventDefault) {\n        e.preventDefault();\n      }\n    };\n\n    self.touchEnd = function(e) {\n      if (!self.__isDown) return;\n\n      self.doTouchEnd(e, e.timeStamp);\n      self.__isDown = false;\n      self.__hasStarted = false;\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n\n      if ( !self.__isDragging && !self.__isDecelerating && !self.__isAnimating ) {\n        ionic.tap.removeClonedInputs(container, self);\n      }\n    };\n\n    self.mouseWheel = ionic.animationFrameThrottle(function(e) {\n      var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll');\n      if (!self.options.freeze && scrollParent === self.__container) {\n\n        self.hintResize();\n        self.scrollBy(\n          (e.wheelDeltaX || e.deltaX || 0) / self.options.wheelDampen,\n          (-e.wheelDeltaY || e.deltaY || 0) / self.options.wheelDampen\n        );\n\n        self.__fadeScrollbars('in');\n        clearTimeout(self.__wheelHideBarTimeout);\n        self.__wheelHideBarTimeout = setTimeout(function() {\n          self.__fadeScrollbars('out');\n        }, 100);\n      }\n    });\n\n    if ('ontouchstart' in window) {\n      // Touch Events\n      container.addEventListener(\"touchstart\", self.touchStart, false);\n      if(self.options.preventDefault) container.addEventListener(\"touchmove\", self.touchMoveBubble, false);\n      document.addEventListener(\"touchmove\", self.touchMove, false);\n      document.addEventListener(\"touchend\", self.touchEnd, false);\n      document.addEventListener(\"touchcancel\", self.touchEnd, false);\n      document.addEventListener(\"wheel\", self.mouseWheel, false);\n\n    } else if (window.navigator.pointerEnabled) {\n      // Pointer Events\n      container.addEventListener(\"pointerdown\", self.touchStart, false);\n      if(self.options.preventDefault) container.addEventListener(\"pointermove\", self.touchMoveBubble, false);\n      document.addEventListener(\"pointermove\", self.touchMove, false);\n      document.addEventListener(\"pointerup\", self.touchEnd, false);\n      document.addEventListener(\"pointercancel\", self.touchEnd, false);\n      document.addEventListener(\"wheel\", self.mouseWheel, false);\n\n    } else if (window.navigator.msPointerEnabled) {\n      // IE10, WP8 (Pointer Events)\n      container.addEventListener(\"MSPointerDown\", self.touchStart, false);\n      if(self.options.preventDefault) container.addEventListener(\"MSPointerMove\", self.touchMoveBubble, false);\n      document.addEventListener(\"MSPointerMove\", self.touchMove, false);\n      document.addEventListener(\"MSPointerUp\", self.touchEnd, false);\n      document.addEventListener(\"MSPointerCancel\", self.touchEnd, false);\n      document.addEventListener(\"wheel\", self.mouseWheel, false);\n\n    } else {\n      // Mouse Events\n      var mousedown = false;\n\n      self.mouseDown = function(e) {\n        if ( ionic.tap.ignoreScrollStart(e) || e.target.tagName === 'SELECT' ) {\n          return;\n        }\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n\n        if ( !ionic.tap.isTextInput(e.target) ) {\n          e.preventDefault();\n        }\n        mousedown = true;\n      };\n\n      self.mouseMove = function(e) {\n        if (self.options.freeze || !mousedown || (!mousedown && e.defaultPrevented)) {\n          return;\n        }\n\n        self.doTouchMove(getEventTouches(e), e.timeStamp);\n\n        mousedown = true;\n      };\n\n      self.mouseMoveBubble = function(e) {\n        if (mousedown && self.options.preventDefault) {\n          e.preventDefault();\n        }\n      };\n\n      self.mouseUp = function(e) {\n        if (!mousedown) {\n          return;\n        }\n\n        self.doTouchEnd(e, e.timeStamp);\n\n        mousedown = false;\n      };\n\n      container.addEventListener(\"mousedown\", self.mouseDown, false);\n      if(self.options.preventDefault) container.addEventListener(\"mousemove\", self.mouseMoveBubble, false);\n      document.addEventListener(\"mousemove\", self.mouseMove, false);\n      document.addEventListener(\"mouseup\", self.mouseUp, false);\n      document.addEventListener('mousewheel', self.mouseWheel, false);\n      document.addEventListener('wheel', self.mouseWheel, false);\n    }\n  },\n\n  __cleanup: function() {\n    var self = this;\n    var container = self.__container;\n\n    container.removeEventListener('touchstart', self.touchStart);\n    container.removeEventListener('touchmove', self.touchMoveBubble);\n    document.removeEventListener('touchmove', self.touchMove);\n    document.removeEventListener('touchend', self.touchEnd);\n    document.removeEventListener('touchcancel', self.touchEnd);\n\n    container.removeEventListener(\"pointerdown\", self.touchStart);\n    container.removeEventListener(\"pointermove\", self.touchMoveBubble);\n    document.removeEventListener(\"pointermove\", self.touchMove);\n    document.removeEventListener(\"pointerup\", self.touchEnd);\n    document.removeEventListener(\"pointercancel\", self.touchEnd);\n\n    container.removeEventListener(\"MSPointerDown\", self.touchStart);\n    container.removeEventListener(\"MSPointerMove\", self.touchMoveBubble);\n    document.removeEventListener(\"MSPointerMove\", self.touchMove);\n    document.removeEventListener(\"MSPointerUp\", self.touchEnd);\n    document.removeEventListener(\"MSPointerCancel\", self.touchEnd);\n\n    container.removeEventListener(\"mousedown\", self.mouseDown);\n    container.removeEventListener(\"mousemove\", self.mouseMoveBubble);\n    document.removeEventListener(\"mousemove\", self.mouseMove);\n    document.removeEventListener(\"mouseup\", self.mouseUp);\n    document.removeEventListener('mousewheel', self.mouseWheel);\n    document.removeEventListener('wheel', self.mouseWheel);\n\n    container.removeEventListener('scrollChildIntoView', self.scrollChildIntoView);\n    document.removeEventListener('resetScrollView', self.resetScrollView);\n\n    ionic.tap.removeClonedInputs(container, self);\n\n    delete self.__container;\n    delete self.__content;\n    delete self.__indicatorX;\n    delete self.__indicatorY;\n    delete self.options.el;\n\n    self.__callback = self.scrollChildIntoView = self.resetScrollView = NOOP;\n\n    self.mouseMove = self.mouseDown = self.mouseUp = self.mouseWheel =\n      self.touchStart = self.touchMove = self.touchEnd = self.touchCancel = NOOP;\n\n    self.resize = self.scrollTo = self.zoomTo =\n      self.__scrollingComplete = NOOP;\n    container = null;\n  },\n\n  /** Create a scroll bar div with the given direction **/\n  __createScrollbar: function(direction) {\n    var bar = document.createElement('div'),\n      indicator = document.createElement('div');\n\n    indicator.className = 'scroll-bar-indicator scroll-bar-fade-out';\n\n    if (direction == 'h') {\n      bar.className = 'scroll-bar scroll-bar-h';\n    } else {\n      bar.className = 'scroll-bar scroll-bar-v';\n    }\n\n    bar.appendChild(indicator);\n    return bar;\n  },\n\n  __createScrollbars: function() {\n    var self = this;\n    var indicatorX, indicatorY;\n\n    if (self.options.scrollingX) {\n      indicatorX = {\n        el: self.__createScrollbar('h'),\n        sizeRatio: 1\n      };\n      indicatorX.indicator = indicatorX.el.children[0];\n\n      if (self.options.scrollbarX) {\n        self.__container.appendChild(indicatorX.el);\n      }\n      self.__indicatorX = indicatorX;\n    }\n\n    if (self.options.scrollingY) {\n      indicatorY = {\n        el: self.__createScrollbar('v'),\n        sizeRatio: 1\n      };\n      indicatorY.indicator = indicatorY.el.children[0];\n\n      if (self.options.scrollbarY) {\n        self.__container.appendChild(indicatorY.el);\n      }\n      self.__indicatorY = indicatorY;\n    }\n  },\n\n  __resizeScrollbars: function() {\n    var self = this;\n\n    // Update horiz bar\n    if (self.__indicatorX) {\n      var width = Math.max(Math.round(self.__clientWidth * self.__clientWidth / (self.__contentWidth)), 20);\n      if (width > self.__contentWidth) {\n        width = 0;\n      }\n      if (width !== self.__indicatorX.size) {\n        ionic.requestAnimationFrame(function(){\n          self.__indicatorX.indicator.style.width = width + 'px';\n        });\n      }\n      self.__indicatorX.size = width;\n      self.__indicatorX.minScale = self.options.minScrollbarSizeX / width;\n      self.__indicatorX.maxPos = self.__clientWidth - width;\n      self.__indicatorX.sizeRatio = self.__maxScrollLeft ? self.__indicatorX.maxPos / self.__maxScrollLeft : 1;\n    }\n\n    // Update vert bar\n    if (self.__indicatorY) {\n      var height = Math.max(Math.round(self.__clientHeight * self.__clientHeight / (self.__contentHeight)), 20);\n      if (height > self.__contentHeight) {\n        height = 0;\n      }\n      if (height !== self.__indicatorY.size) {\n        ionic.requestAnimationFrame(function(){\n          self.__indicatorY && (self.__indicatorY.indicator.style.height = height + 'px');\n        });\n      }\n      self.__indicatorY.size = height;\n      self.__indicatorY.minScale = self.options.minScrollbarSizeY / height;\n      self.__indicatorY.maxPos = self.__clientHeight - height;\n      self.__indicatorY.sizeRatio = self.__maxScrollTop ? self.__indicatorY.maxPos / self.__maxScrollTop : 1;\n    }\n  },\n\n  /**\n   * Move and scale the scrollbars as the page scrolls.\n   */\n  __repositionScrollbars: function() {\n    var self = this,\n        heightScale, widthScale,\n        widthDiff, heightDiff,\n        x, y,\n        xstop = 0, ystop = 0;\n\n    if (self.__indicatorX) {\n      // Handle the X scrollbar\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if (self.__indicatorY) xstop = 10;\n\n      x = Math.round(self.__indicatorX.sizeRatio * self.__scrollLeft) || 0;\n\n      // The the difference between the last content X position, and our overscrolled one\n      widthDiff = self.__scrollLeft - (self.__maxScrollLeft - xstop);\n\n      if (self.__scrollLeft < 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - Math.abs(self.__scrollLeft)) / self.__indicatorX.size);\n\n        // Stay at left\n        x = 0;\n\n        // Make sure scale is transformed from the left/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'left center';\n      } else if (widthDiff > 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - widthDiff) / self.__indicatorX.size);\n\n        // Stay at the furthest x for the scrollable viewport\n        x = self.__indicatorX.maxPos - xstop;\n\n        // Make sure scale is transformed from the right/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'right center';\n\n      } else {\n\n        // Normal motion\n        x = Math.min(self.__maxScrollLeft, Math.max(0, x));\n        widthScale = 1;\n\n      }\n\n      var translate3dX = 'translate3d(' + x + 'px, 0, 0) scaleX(' + widthScale + ')';\n      if (self.__indicatorX.transformProp !== translate3dX) {\n        self.__indicatorX.indicator.style[self.__transformProperty] = translate3dX;\n        self.__indicatorX.transformProp = translate3dX;\n      }\n    }\n\n    if (self.__indicatorY) {\n\n      y = Math.round(self.__indicatorY.sizeRatio * self.__scrollTop) || 0;\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if (self.__indicatorX) ystop = 10;\n\n      heightDiff = self.__scrollTop - (self.__maxScrollTop - ystop);\n\n      if (self.__scrollTop < 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - Math.abs(self.__scrollTop)) / self.__indicatorY.size);\n\n        // Stay at top\n        y = 0;\n\n        // Make sure scale is transformed from the center/top origin point\n        if (self.__indicatorY.originProp !== 'center top') {\n          self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center top';\n          self.__indicatorY.originProp = 'center top';\n        }\n\n      } else if (heightDiff > 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - heightDiff) / self.__indicatorY.size);\n\n        // Stay at bottom of scrollable viewport\n        y = self.__indicatorY.maxPos - ystop;\n\n        // Make sure scale is transformed from the center/bottom origin point\n        if (self.__indicatorY.originProp !== 'center bottom') {\n          self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center bottom';\n          self.__indicatorY.originProp = 'center bottom';\n        }\n\n      } else {\n\n        // Normal motion\n        y = Math.min(self.__maxScrollTop, Math.max(0, y));\n        heightScale = 1;\n\n      }\n\n      var translate3dY = 'translate3d(0,' + y + 'px, 0) scaleY(' + heightScale + ')';\n      if (self.__indicatorY.transformProp !== translate3dY) {\n        self.__indicatorY.indicator.style[self.__transformProperty] = translate3dY;\n        self.__indicatorY.transformProp = translate3dY;\n      }\n    }\n  },\n\n  __fadeScrollbars: function(direction, delay) {\n    var self = this;\n\n    if (!self.options.scrollbarsFade) {\n      return;\n    }\n\n    var className = 'scroll-bar-fade-out';\n\n    if (self.options.scrollbarsFade === true) {\n      clearTimeout(self.__scrollbarFadeTimeout);\n\n      if (direction == 'in') {\n        if (self.__indicatorX) { self.__indicatorX.indicator.classList.remove(className); }\n        if (self.__indicatorY) { self.__indicatorY.indicator.classList.remove(className); }\n      } else {\n        self.__scrollbarFadeTimeout = setTimeout(function() {\n          if (self.__indicatorX) { self.__indicatorX.indicator.classList.add(className); }\n          if (self.__indicatorY) { self.__indicatorY.indicator.classList.add(className); }\n        }, delay || self.options.scrollbarFadeDelay);\n      }\n    }\n  },\n\n  __scrollingComplete: function() {\n    this.options.scrollingComplete();\n    ionic.tap.removeClonedInputs(this.__container, this);\n    this.__fadeScrollbars('out');\n  },\n\n  resize: function(continueScrolling) {\n    var self = this;\n    if (!self.__container || !self.options) return;\n\n    // Update Scroller dimensions for changed content\n    // Add padding to bottom of content\n    self.setDimensions(\n      self.__container.clientWidth,\n      self.__container.clientHeight,\n      self.options.getContentWidth(),\n      self.options.getContentHeight(),\n      continueScrolling\n    );\n  },\n  /*\n  ---------------------------------------------------------------------------\n    PUBLIC API\n  ---------------------------------------------------------------------------\n  */\n\n  getRenderFn: function() {\n    var self = this;\n\n    var content = self.__content;\n\n    var docStyle = document.documentElement.style;\n\n    var engine;\n    if ('MozAppearance' in docStyle) {\n      engine = 'gecko';\n    } else if ('WebkitAppearance' in docStyle) {\n      engine = 'webkit';\n    } else if (typeof navigator.cpuClass === 'string') {\n      engine = 'trident';\n    }\n\n    var vendorPrefix = {\n      trident: 'ms',\n      gecko: 'Moz',\n      webkit: 'Webkit',\n      presto: 'O'\n    }[engine];\n\n    var helperElem = document.createElement(\"div\");\n    var undef;\n\n    var perspectiveProperty = vendorPrefix + \"Perspective\";\n    var transformProperty = vendorPrefix + \"Transform\";\n    var transformOriginProperty = vendorPrefix + 'TransformOrigin';\n\n    self.__perspectiveProperty = transformProperty;\n    self.__transformProperty = transformProperty;\n    self.__transformOriginProperty = transformOriginProperty;\n\n    if (helperElem.style[perspectiveProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        var translate3d = 'translate3d(' + (-left) + 'px,' + (-top) + 'px,0) scale(' + zoom + ')';\n        if (translate3d !== self.contentTransform) {\n          content.style[transformProperty] = translate3d;\n          self.contentTransform = translate3d;\n        }\n        self.__repositionScrollbars();\n        if (!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else if (helperElem.style[transformProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        content.style[transformProperty] = 'translate(' + (-left) + 'px,' + (-top) + 'px) scale(' + zoom + ')';\n        self.__repositionScrollbars();\n        if (!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else {\n\n      return function(left, top, zoom, wasResize) {\n        content.style.marginLeft = left ? (-left / zoom) + 'px' : '';\n        content.style.marginTop = top ? (-top / zoom) + 'px' : '';\n        content.style.zoom = zoom || '';\n        self.__repositionScrollbars();\n        if (!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    }\n  },\n\n\n  /**\n   * Configures the dimensions of the client (outer) and content (inner) elements.\n   * Requires the available space for the outer element and the outer size of the inner element.\n   * All values which are falsy (null or zero etc.) are ignored and the old value is kept.\n   *\n   * @param clientWidth {Integer} Inner width of outer element\n   * @param clientHeight {Integer} Inner height of outer element\n   * @param contentWidth {Integer} Outer width of inner element\n   * @param contentHeight {Integer} Outer height of inner element\n   */\n  setDimensions: function(clientWidth, clientHeight, contentWidth, contentHeight, continueScrolling) {\n    var self = this;\n\n    if (!clientWidth && !clientHeight && !contentWidth && !contentHeight) {\n      // this scrollview isn't rendered, don't bother\n      return;\n    }\n\n    // Only update values which are defined\n    if (clientWidth === +clientWidth) {\n      self.__clientWidth = clientWidth;\n    }\n\n    if (clientHeight === +clientHeight) {\n      self.__clientHeight = clientHeight;\n    }\n\n    if (contentWidth === +contentWidth) {\n      self.__contentWidth = contentWidth;\n    }\n\n    if (contentHeight === +contentHeight) {\n      self.__contentHeight = contentHeight;\n    }\n\n    // Refresh maximums\n    self.__computeScrollMax();\n    self.__resizeScrollbars();\n\n    // Refresh scroll position\n    if (!continueScrolling) {\n      self.scrollTo(self.__scrollLeft, self.__scrollTop, true, null, true);\n    }\n\n  },\n\n\n  /**\n   * Sets the client coordinates in relation to the document.\n   *\n   * @param left {Integer} Left position of outer element\n   * @param top {Integer} Top position of outer element\n   */\n  setPosition: function(left, top) {\n    this.__clientLeft = left || 0;\n    this.__clientTop = top || 0;\n  },\n\n\n  /**\n   * Configures the snapping (when snapping is active)\n   *\n   * @param width {Integer} Snapping width\n   * @param height {Integer} Snapping height\n   */\n  setSnapSize: function(width, height) {\n    this.__snapWidth = width;\n    this.__snapHeight = height;\n  },\n\n\n  /**\n   * Activates pull-to-refresh. A special zone on the top of the list to start a list refresh whenever\n   * the user event is released during visibility of this zone. This was introduced by some apps on iOS like\n   * the official Twitter client.\n   *\n   * @param height {Integer} Height of pull-to-refresh zone on top of rendered list\n   * @param activateCallback {Function} Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release.\n   * @param deactivateCallback {Function} Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled.\n   * @param startCallback {Function} Callback to execute to start the real async refresh action. Call {@link #finishPullToRefresh} after finish of refresh.\n   * @param showCallback {Function} Callback to execute when the refresher should be shown. This is for showing the refresher during a negative scrollTop.\n   * @param hideCallback {Function} Callback to execute when the refresher should be hidden. This is for hiding the refresher when it's behind the nav bar.\n   * @param tailCallback {Function} Callback to execute just before the refresher returns to it's original state. This is for zooming out the refresher.\n   * @param pullProgressCallback Callback to state the progress while pulling to refresh\n   */\n  activatePullToRefresh: function(height, refresherMethods) {\n    var self = this;\n\n    self.__refreshHeight = height;\n    self.__refreshActivate = function() { ionic.requestAnimationFrame(refresherMethods.activate); };\n    self.__refreshDeactivate = function() { ionic.requestAnimationFrame(refresherMethods.deactivate); };\n    self.__refreshStart = function() { ionic.requestAnimationFrame(refresherMethods.start); };\n    self.__refreshShow = function() { ionic.requestAnimationFrame(refresherMethods.show); };\n    self.__refreshHide = function() { ionic.requestAnimationFrame(refresherMethods.hide); };\n    self.__refreshTail = function() { ionic.requestAnimationFrame(refresherMethods.tail); };\n    self.__refreshTailTime = 100;\n    self.__minSpinTime = 600;\n  },\n\n\n  /**\n   * Starts pull-to-refresh manually.\n   */\n  triggerPullToRefresh: function() {\n    // Use publish instead of scrollTo to allow scrolling to out of boundary position\n    // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n    this.__publish(this.__scrollLeft, -this.__refreshHeight, this.__zoomLevel, true);\n\n    var d = new Date();\n    this.refreshStartTime = d.getTime();\n\n    if (this.__refreshStart) {\n      this.__refreshStart();\n    }\n  },\n\n\n  /**\n   * Signalizes that pull-to-refresh is finished.\n   */\n  finishPullToRefresh: function() {\n    var self = this;\n    // delay to make sure the spinner has a chance to spin for a split second before it's dismissed\n    var d = new Date();\n    var delay = 0;\n    if (self.refreshStartTime + self.__minSpinTime > d.getTime()) {\n      delay = self.refreshStartTime + self.__minSpinTime - d.getTime();\n    }\n    setTimeout(function() {\n      if (self.__refreshTail) {\n        self.__refreshTail();\n      }\n      setTimeout(function() {\n        self.__refreshActive = false;\n        if (self.__refreshDeactivate) {\n          self.__refreshDeactivate();\n        }\n        if (self.__refreshHide) {\n          self.__refreshHide();\n        }\n\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, true);\n      }, self.__refreshTailTime);\n    }, delay);\n  },\n\n\n  /**\n   * Returns the scroll position and zooming values\n   *\n   * @return {Map} `left` and `top` scroll position and `zoom` level\n   */\n  getValues: function() {\n    return {\n      left: this.__scrollLeft,\n      top: this.__scrollTop,\n      zoom: this.__zoomLevel\n    };\n  },\n\n\n  /**\n   * Returns the maximum scroll values\n   *\n   * @return {Map} `left` and `top` maximum scroll values\n   */\n  getScrollMax: function() {\n    return {\n      left: this.__maxScrollLeft,\n      top: this.__maxScrollTop\n    };\n  },\n\n\n  /**\n   * Zooms to the given level. Supports optional animation. Zooms\n   * the center when no coordinates are given.\n   *\n   * @param level {Number} Level to zoom to\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomTo: function(level, animate, originLeft, originTop) {\n    var self = this;\n\n    if (!self.options.zooming) {\n      throw new Error(\"Zooming is not enabled!\");\n    }\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    var oldLevel = self.__zoomLevel;\n\n    // Normalize input origin to center of viewport if not defined\n    if (originLeft == null) {\n      originLeft = self.__clientWidth / 2;\n    }\n\n    if (originTop == null) {\n      originTop = self.__clientHeight / 2;\n    }\n\n    // Limit level according to configuration\n    level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n    // Recompute maximum values while temporary tweaking maximum scroll ranges\n    self.__computeScrollMax(level);\n\n    // Recompute left and top coordinates based on new zoom level\n    var left = ((originLeft + self.__scrollLeft) * level / oldLevel) - originLeft;\n    var top = ((originTop + self.__scrollTop) * level / oldLevel) - originTop;\n\n    // Limit x-axis\n    if (left > self.__maxScrollLeft) {\n      left = self.__maxScrollLeft;\n    } else if (left < 0) {\n      left = 0;\n    }\n\n    // Limit y-axis\n    if (top > self.__maxScrollTop) {\n      top = self.__maxScrollTop;\n    } else if (top < 0) {\n      top = 0;\n    }\n\n    // Push values out\n    self.__publish(left, top, level, animate);\n\n  },\n\n\n  /**\n   * Zooms the content by the given factor.\n   *\n   * @param factor {Number} Zoom by given factor\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomBy: function(factor, animate, originLeft, originTop) {\n    this.zoomTo(this.__zoomLevel * factor, animate, originLeft, originTop);\n  },\n\n\n  /**\n   * Scrolls to the given position. Respect limitations and snapping automatically.\n   *\n   * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n   * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n   * @param animate {Boolean} Whether the scrolling should happen using an animation\n   * @param zoom {Number} Zoom level to go to\n   */\n  scrollTo: function(left, top, animate, zoom, wasResize) {\n    var self = this;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    // Correct coordinates based on new zoom level\n    if (zoom != null && zoom !== self.__zoomLevel) {\n\n      if (!self.options.zooming) {\n        throw new Error(\"Zooming is not enabled!\");\n      }\n\n      left *= zoom;\n      top *= zoom;\n\n      // Recompute maximum values while temporary tweaking maximum scroll ranges\n      self.__computeScrollMax(zoom);\n\n    } else {\n\n      // Keep zoom when not defined\n      zoom = self.__zoomLevel;\n\n    }\n\n    if (!self.options.scrollingX) {\n\n      left = self.__scrollLeft;\n\n    } else {\n\n      if (self.options.paging) {\n        left = Math.round(left / self.__clientWidth) * self.__clientWidth;\n      } else if (self.options.snapping) {\n        left = Math.round(left / self.__snapWidth) * self.__snapWidth;\n      }\n\n    }\n\n    if (!self.options.scrollingY) {\n\n      top = self.__scrollTop;\n\n    } else {\n\n      if (self.options.paging) {\n        top = Math.round(top / self.__clientHeight) * self.__clientHeight;\n      } else if (self.options.snapping) {\n        top = Math.round(top / self.__snapHeight) * self.__snapHeight;\n      }\n\n    }\n\n    // Limit for allowed ranges\n    left = Math.max(Math.min(self.__maxScrollLeft, left), 0);\n    top = Math.max(Math.min(self.__maxScrollTop, top), 0);\n\n    // Don't animate when no change detected, still call publish to make sure\n    // that rendered position is really in-sync with internal data\n    if (left === self.__scrollLeft && top === self.__scrollTop) {\n      animate = false;\n    }\n\n    // Publish new values\n    self.__publish(left, top, zoom, animate, wasResize);\n\n  },\n\n\n  /**\n   * Scroll by the given offset\n   *\n   * @param left {Number} Scroll x-axis by given offset\n   * @param top {Number} Scroll y-axis by given offset\n   * @param animate {Boolean} Whether to animate the given change\n   */\n  scrollBy: function(left, top, animate) {\n    var self = this;\n\n    var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft;\n    var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop;\n\n    self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate);\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    EVENT CALLBACKS\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Mouse wheel handler for zooming support\n   */\n  doMouseZoom: function(wheelDelta, timeStamp, pageX, pageY) {\n    var change = wheelDelta > 0 ? 0.97 : 1.03;\n    return this.zoomTo(this.__zoomLevel * change, false, pageX - this.__clientLeft, pageY - this.__clientTop);\n  },\n\n  /**\n   * Touch start handler for scrolling support\n   */\n  doTouchStart: function(touches, timeStamp) {\n    var self = this;\n\n    // remember if the deceleration was just stopped\n    self.__decStopped = !!(self.__isDecelerating || self.__isAnimating);\n\n    self.hintResize();\n\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    // Reset interruptedAnimation flag\n    self.__interruptedAnimation = true;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Stop animation\n    if (self.__isAnimating) {\n      zyngaCore.effect.Animate.stop(self.__isAnimating);\n      self.__isAnimating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Use center point when dealing with two fingers\n    var currentTouchLeft, currentTouchTop;\n    var isSingleTouch = touches.length === 1;\n    if (isSingleTouch) {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    } else {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n    }\n\n    // Store initial positions\n    self.__initialTouchLeft = currentTouchLeft;\n    self.__initialTouchTop = currentTouchTop;\n\n    // Store initial touchList for scale calculation\n    self.__initialTouches = touches;\n\n    // Store current zoom level\n    self.__zoomLevelStart = self.__zoomLevel;\n\n    // Store initial touch positions\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n\n    // Store initial move time stamp\n    self.__lastTouchMove = timeStamp;\n\n    // Reset initial scale\n    self.__lastScale = 1;\n\n    // Reset locking flags\n    self.__enableScrollX = !isSingleTouch && self.options.scrollingX;\n    self.__enableScrollY = !isSingleTouch && self.options.scrollingY;\n\n    // Reset tracking flag\n    self.__isTracking = true;\n\n    // Reset deceleration complete flag\n    self.__didDecelerationComplete = false;\n\n    // Dragging starts directly with two fingers, otherwise lazy with an offset\n    self.__isDragging = !isSingleTouch;\n\n    // Some features are disabled in multi touch scenarios\n    self.__isSingleTouch = isSingleTouch;\n\n    // Clearing data structure\n    self.__positions = [];\n\n  },\n\n\n  /**\n   * Touch move handler for scrolling support\n   */\n  doTouchMove: function(touches, timeStamp, scale) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (event might be outside of element)\n    if (!self.__isTracking) {\n      return;\n    }\n\n    var currentTouchLeft, currentTouchTop;\n\n    // Compute move based around of center of fingers\n    if (touches.length === 2) {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n\n      // Calculate scale when not present and only when touches are used\n      if (!scale && self.options.zooming) {\n        scale = self.__getScale(self.__initialTouches, touches);\n      }\n    } else {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    }\n\n    var positions = self.__positions;\n\n    // Are we already is dragging mode?\n    if (self.__isDragging) {\n        self.__decStopped = false;\n\n      // Compute move distance\n      var moveX = currentTouchLeft - self.__lastTouchLeft;\n      var moveY = currentTouchTop - self.__lastTouchTop;\n\n      // Read previous scroll position and zooming\n      var scrollLeft = self.__scrollLeft;\n      var scrollTop = self.__scrollTop;\n      var level = self.__zoomLevel;\n\n      // Work with scaling\n      if (scale != null && self.options.zooming) {\n\n        var oldLevel = level;\n\n        // Recompute level based on previous scale and new scale\n        level = level / self.__lastScale * scale;\n\n        // Limit level according to configuration\n        level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n        // Only do further compution when change happened\n        if (oldLevel !== level) {\n\n          // Compute relative event position to container\n          var currentTouchLeftRel = currentTouchLeft - self.__clientLeft;\n          var currentTouchTopRel = currentTouchTop - self.__clientTop;\n\n          // Recompute left and top coordinates based on new zoom level\n          scrollLeft = ((currentTouchLeftRel + scrollLeft) * level / oldLevel) - currentTouchLeftRel;\n          scrollTop = ((currentTouchTopRel + scrollTop) * level / oldLevel) - currentTouchTopRel;\n\n          // Recompute max scroll values\n          self.__computeScrollMax(level);\n\n        }\n      }\n\n      if (self.__enableScrollX) {\n\n        scrollLeft -= moveX * self.options.speedMultiplier;\n        var maxScrollLeft = self.__maxScrollLeft;\n\n        if (scrollLeft > maxScrollLeft || scrollLeft < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing) {\n\n            scrollLeft += (moveX / 2 * self.options.speedMultiplier);\n\n          } else if (scrollLeft > maxScrollLeft) {\n\n            scrollLeft = maxScrollLeft;\n\n          } else {\n\n            scrollLeft = 0;\n\n          }\n        }\n      }\n\n      // Compute new vertical scroll position\n      if (self.__enableScrollY) {\n\n        scrollTop -= moveY * self.options.speedMultiplier;\n        var maxScrollTop = self.__maxScrollTop;\n\n        if (scrollTop > maxScrollTop || scrollTop < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing || (self.__refreshHeight && scrollTop < 0)) {\n\n            scrollTop += (moveY / 2 * self.options.speedMultiplier);\n\n            // Support pull-to-refresh (only when only y is scrollable)\n            if (!self.__enableScrollX && self.__refreshHeight != null) {\n\n              // hide the refresher when it's behind the header bar in case of header transparency\n              if (scrollTop < 0) {\n                self.__refreshHidden = false;\n                self.__refreshShow();\n              } else {\n                self.__refreshHide();\n                self.__refreshHidden = true;\n              }\n\n              if (!self.__refreshActive && scrollTop <= -self.__refreshHeight) {\n\n                self.__refreshActive = true;\n                if (self.__refreshActivate) {\n                  self.__refreshActivate();\n                }\n\n              } else if (self.__refreshActive && scrollTop > -self.__refreshHeight) {\n\n                self.__refreshActive = false;\n                if (self.__refreshDeactivate) {\n                  self.__refreshDeactivate();\n                }\n\n              }\n            }\n\n          } else if (scrollTop > maxScrollTop) {\n\n            scrollTop = maxScrollTop;\n\n          } else {\n\n            scrollTop = 0;\n\n          }\n        } else if (self.__refreshHeight && !self.__refreshHidden) {\n          // if a positive scroll value and the refresher is still not hidden, hide it\n          self.__refreshHide();\n          self.__refreshHidden = true;\n        }\n      }\n\n      // Keep list from growing infinitely (holding min 10, max 20 measure points)\n      if (positions.length > 60) {\n        positions.splice(0, 30);\n      }\n\n      // Track scroll movement for decleration\n      positions.push(scrollLeft, scrollTop, timeStamp);\n\n      // Sync scroll position\n      self.__publish(scrollLeft, scrollTop, level);\n\n    // Otherwise figure out whether we are switching into dragging mode now.\n    } else {\n\n      var minimumTrackingForScroll = self.options.locking ? 3 : 0;\n      var minimumTrackingForDrag = 5;\n\n      var distanceX = Math.abs(currentTouchLeft - self.__initialTouchLeft);\n      var distanceY = Math.abs(currentTouchTop - self.__initialTouchTop);\n\n      self.__enableScrollX = self.options.scrollingX && distanceX >= minimumTrackingForScroll;\n      self.__enableScrollY = self.options.scrollingY && distanceY >= minimumTrackingForScroll;\n\n      positions.push(self.__scrollLeft, self.__scrollTop, timeStamp);\n\n      self.__isDragging = (self.__enableScrollX || self.__enableScrollY) && (distanceX >= minimumTrackingForDrag || distanceY >= minimumTrackingForDrag);\n      if (self.__isDragging) {\n        self.__interruptedAnimation = false;\n        self.__fadeScrollbars('in');\n      }\n\n    }\n\n    // Update last touch positions and time stamp for next event\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n    self.__lastTouchMove = timeStamp;\n    self.__lastScale = scale;\n\n  },\n\n\n  /**\n   * Touch end handler for scrolling support\n   */\n  doTouchEnd: function(e, timeStamp) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (no touchstart event on element)\n    // This is required as this listener ('touchmove') sits on the document and not on the element itself.\n    if (!self.__isTracking) {\n      return;\n    }\n\n    // Not touching anymore (when two finger hit the screen there are two touch end events)\n    self.__isTracking = false;\n\n    // Be sure to reset the dragging flag now. Here we also detect whether\n    // the finger has moved fast enough to switch into a deceleration animation.\n    if (self.__isDragging) {\n\n      // Reset dragging flag\n      self.__isDragging = false;\n\n      // Start deceleration\n      // Verify that the last move detected was in some relevant time frame\n      if (self.__isSingleTouch && self.options.animating && (timeStamp - self.__lastTouchMove) <= 100) {\n\n        // Then figure out what the scroll position was about 100ms ago\n        var positions = self.__positions;\n        var endPos = positions.length - 1;\n        var startPos = endPos;\n\n        // Move pointer to position measured 100ms ago\n        for (var i = endPos; i > 0 && positions[i] > (self.__lastTouchMove - 100); i -= 3) {\n          startPos = i;\n        }\n\n        // If start and stop position is identical in a 100ms timeframe,\n        // we cannot compute any useful deceleration.\n        if (startPos !== endPos) {\n\n          // Compute relative movement between these two points\n          var timeOffset = positions[endPos] - positions[startPos];\n          var movedLeft = self.__scrollLeft - positions[startPos - 2];\n          var movedTop = self.__scrollTop - positions[startPos - 1];\n\n          // Based on 50ms compute the movement to apply for each render step\n          self.__decelerationVelocityX = movedLeft / timeOffset * (1000 / 60);\n          self.__decelerationVelocityY = movedTop / timeOffset * (1000 / 60);\n\n          // How much velocity is required to start the deceleration\n          var minVelocityToStartDeceleration = self.options.paging || self.options.snapping ? self.options.decelVelocityThresholdPaging : self.options.decelVelocityThreshold;\n\n          // Verify that we have enough velocity to start deceleration\n          if (Math.abs(self.__decelerationVelocityX) > minVelocityToStartDeceleration || Math.abs(self.__decelerationVelocityY) > minVelocityToStartDeceleration) {\n\n            // Deactivate pull-to-refresh when decelerating\n            if (!self.__refreshActive) {\n              self.__startDeceleration(timeStamp);\n            }\n          }\n        } else {\n          self.__scrollingComplete();\n        }\n      } else if ((timeStamp - self.__lastTouchMove) > 100) {\n        self.__scrollingComplete();\n      }\n\n    } else if (self.__decStopped) {\n      // the deceleration was stopped\n      // user flicked the scroll fast, and stop dragging, then did a touchstart to stop the srolling\n      // tell the touchend event code to do nothing, we don't want to actually send a click\n      e.isTapHandled = true;\n      self.__decStopped = false;\n    }\n\n    // If this was a slower move it is per default non decelerated, but this\n    // still means that we want snap back to the bounds which is done here.\n    // This is placed outside the condition above to improve edge case stability\n    // e.g. touchend fired without enabled dragging. This should normally do not\n    // have modified the scroll positions or even showed the scrollbars though.\n    if (!self.__isDecelerating) {\n\n      if (self.__refreshActive && self.__refreshStart) {\n\n        // Use publish instead of scrollTo to allow scrolling to out of boundary position\n        // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n        self.__publish(self.__scrollLeft, -self.__refreshHeight, self.__zoomLevel, true);\n\n        var d = new Date();\n        self.refreshStartTime = d.getTime();\n\n        if (self.__refreshStart) {\n          self.__refreshStart();\n        }\n        // for iOS-ey style scrolling\n        if (!ionic.Platform.isAndroid())self.__startDeceleration();\n      } else {\n\n        if (self.__interruptedAnimation || self.__isDragging) {\n          self.__scrollingComplete();\n        }\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, true, self.__zoomLevel);\n\n        // Directly signalize deactivation (nothing todo on refresh?)\n        if (self.__refreshActive) {\n\n          self.__refreshActive = false;\n          if (self.__refreshDeactivate) {\n            self.__refreshDeactivate();\n          }\n\n        }\n      }\n    }\n\n    // Fully cleanup list\n    self.__positions.length = 0;\n\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    PRIVATE API\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Applies the scroll position to the content element\n   *\n   * @param left {Number} Left scroll position\n   * @param top {Number} Top scroll position\n   * @param animate {Boolean} Whether animation should be used to move to the new coordinates\n   */\n  __publish: function(left, top, zoom, animate, wasResize) {\n\n    var self = this;\n\n    // Remember whether we had an animation, then we try to continue based on the current \"drive\" of the animation\n    var wasAnimating = self.__isAnimating;\n    if (wasAnimating) {\n      zyngaCore.effect.Animate.stop(wasAnimating);\n      self.__isAnimating = false;\n    }\n\n    if (animate && self.options.animating) {\n\n      // Keep scheduled positions for scrollBy/zoomBy functionality\n      self.__scheduledLeft = left;\n      self.__scheduledTop = top;\n      self.__scheduledZoom = zoom;\n\n      var oldLeft = self.__scrollLeft;\n      var oldTop = self.__scrollTop;\n      var oldZoom = self.__zoomLevel;\n\n      var diffLeft = left - oldLeft;\n      var diffTop = top - oldTop;\n      var diffZoom = zoom - oldZoom;\n\n      var step = function(percent, now, render) {\n\n        if (render) {\n\n          self.__scrollLeft = oldLeft + (diffLeft * percent);\n          self.__scrollTop = oldTop + (diffTop * percent);\n          self.__zoomLevel = oldZoom + (diffZoom * percent);\n\n          // Push values out\n          if (self.__callback) {\n            self.__callback(self.__scrollLeft, self.__scrollTop, self.__zoomLevel, wasResize);\n          }\n\n        }\n      };\n\n      var verify = function(id) {\n        return self.__isAnimating === id;\n      };\n\n      var completed = function(renderedFramesPerSecond, animationId, wasFinished) {\n        if (animationId === self.__isAnimating) {\n          self.__isAnimating = false;\n        }\n        if (self.__didDecelerationComplete || wasFinished) {\n          self.__scrollingComplete();\n        }\n\n        if (self.options.zooming) {\n          self.__computeScrollMax();\n        }\n      };\n\n      // When continuing based on previous animation we choose an ease-out animation instead of ease-in-out\n      self.__isAnimating = zyngaCore.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic);\n\n    } else {\n\n      self.__scheduledLeft = self.__scrollLeft = left;\n      self.__scheduledTop = self.__scrollTop = top;\n      self.__scheduledZoom = self.__zoomLevel = zoom;\n\n      // Push values out\n      if (self.__callback) {\n        self.__callback(left, top, zoom, wasResize);\n      }\n\n      // Fix max scroll ranges\n      if (self.options.zooming) {\n        self.__computeScrollMax();\n      }\n    }\n  },\n\n\n  /**\n   * Recomputes scroll minimum values based on client dimensions and content dimensions.\n   */\n  __computeScrollMax: function(zoomLevel) {\n    var self = this;\n\n    if (zoomLevel == null) {\n      zoomLevel = self.__zoomLevel;\n    }\n\n    self.__maxScrollLeft = Math.max((self.__contentWidth * zoomLevel) - self.__clientWidth, 0);\n    self.__maxScrollTop = Math.max((self.__contentHeight * zoomLevel) - self.__clientHeight, 0);\n\n    if (!self.__didWaitForSize && !self.__maxScrollLeft && !self.__maxScrollTop) {\n      self.__didWaitForSize = true;\n      self.__waitForSize();\n    }\n  },\n\n\n  /**\n   * If the scroll view isn't sized correctly on start, wait until we have at least some size\n   */\n  __waitForSize: function() {\n    var self = this;\n\n    clearTimeout(self.__sizerTimeout);\n\n    var sizer = function() {\n      self.resize(true);\n    };\n\n    sizer();\n    self.__sizerTimeout = setTimeout(sizer, 500);\n  },\n\n  /*\n  ---------------------------------------------------------------------------\n    ANIMATION (DECELERATION) SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Called when a touch sequence end and the speed of the finger was high enough\n   * to switch into deceleration mode.\n   */\n  __startDeceleration: function() {\n    var self = this;\n\n    if (self.options.paging) {\n\n      var scrollLeft = Math.max(Math.min(self.__scrollLeft, self.__maxScrollLeft), 0);\n      var scrollTop = Math.max(Math.min(self.__scrollTop, self.__maxScrollTop), 0);\n      var clientWidth = self.__clientWidth;\n      var clientHeight = self.__clientHeight;\n\n      // We limit deceleration not to the min/max values of the allowed range, but to the size of the visible client area.\n      // Each page should have exactly the size of the client area.\n      self.__minDecelerationScrollLeft = Math.floor(scrollLeft / clientWidth) * clientWidth;\n      self.__minDecelerationScrollTop = Math.floor(scrollTop / clientHeight) * clientHeight;\n      self.__maxDecelerationScrollLeft = Math.ceil(scrollLeft / clientWidth) * clientWidth;\n      self.__maxDecelerationScrollTop = Math.ceil(scrollTop / clientHeight) * clientHeight;\n\n    } else {\n\n      self.__minDecelerationScrollLeft = 0;\n      self.__minDecelerationScrollTop = 0;\n      self.__maxDecelerationScrollLeft = self.__maxScrollLeft;\n      self.__maxDecelerationScrollTop = self.__maxScrollTop;\n      if (self.__refreshActive) self.__minDecelerationScrollTop = self.__refreshHeight * -1;\n    }\n\n    // Wrap class method\n    var step = function(percent, now, render) {\n      self.__stepThroughDeceleration(render);\n    };\n\n    // How much velocity is required to keep the deceleration running\n    self.__minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.1;\n\n    // Detect whether it's still worth to continue animating steps\n    // If we are already slow enough to not being user perceivable anymore, we stop the whole process here.\n    var verify = function() {\n      var shouldContinue = Math.abs(self.__decelerationVelocityX) >= self.__minVelocityToKeepDecelerating ||\n        Math.abs(self.__decelerationVelocityY) >= self.__minVelocityToKeepDecelerating;\n      if (!shouldContinue) {\n        self.__didDecelerationComplete = true;\n\n        //Make sure the scroll values are within the boundaries after a bounce,\n        //not below 0 or above maximum\n        if (self.options.bouncing && !self.__refreshActive) {\n          self.scrollTo(\n            Math.min( Math.max(self.__scrollLeft, 0), self.__maxScrollLeft ),\n            Math.min( Math.max(self.__scrollTop, 0), self.__maxScrollTop ),\n            self.__refreshActive\n          );\n        }\n      }\n      return shouldContinue;\n    };\n\n    var completed = function() {\n      self.__isDecelerating = false;\n      if (self.__didDecelerationComplete) {\n        self.__scrollingComplete();\n      }\n\n      // Animate to grid when snapping is active, otherwise just fix out-of-boundary positions\n      if (self.options.paging) {\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, self.options.snapping);\n      }\n    };\n\n    // Start animation and switch on flag\n    self.__isDecelerating = zyngaCore.effect.Animate.start(step, verify, completed);\n\n  },\n\n\n  /**\n   * Called on every step of the animation\n   *\n   * @param inMemory {Boolean} Whether to not render the current step, but keep it in memory only. Used internally only!\n   */\n  __stepThroughDeceleration: function(render) {\n    var self = this;\n\n\n    //\n    // COMPUTE NEXT SCROLL POSITION\n    //\n\n    // Add deceleration to scroll position\n    var scrollLeft = self.__scrollLeft + self.__decelerationVelocityX;// * self.options.deceleration);\n    var scrollTop = self.__scrollTop + self.__decelerationVelocityY;// * self.options.deceleration);\n\n\n    //\n    // HARD LIMIT SCROLL POSITION FOR NON BOUNCING MODE\n    //\n\n    if (!self.options.bouncing) {\n\n      var scrollLeftFixed = Math.max(Math.min(self.__maxDecelerationScrollLeft, scrollLeft), self.__minDecelerationScrollLeft);\n      if (scrollLeftFixed !== scrollLeft) {\n        scrollLeft = scrollLeftFixed;\n        self.__decelerationVelocityX = 0;\n      }\n\n      var scrollTopFixed = Math.max(Math.min(self.__maxDecelerationScrollTop, scrollTop), self.__minDecelerationScrollTop);\n      if (scrollTopFixed !== scrollTop) {\n        scrollTop = scrollTopFixed;\n        self.__decelerationVelocityY = 0;\n      }\n\n    }\n\n\n    //\n    // UPDATE SCROLL POSITION\n    //\n\n    if (render) {\n\n      self.__publish(scrollLeft, scrollTop, self.__zoomLevel);\n\n    } else {\n\n      self.__scrollLeft = scrollLeft;\n      self.__scrollTop = scrollTop;\n\n    }\n\n\n    //\n    // SLOW DOWN\n    //\n\n    // Slow down velocity on every iteration\n    if (!self.options.paging) {\n\n      // This is the factor applied to every iteration of the animation\n      // to slow down the process. This should emulate natural behavior where\n      // objects slow down when the initiator of the movement is removed\n      var frictionFactor = self.options.deceleration;\n\n      self.__decelerationVelocityX *= frictionFactor;\n      self.__decelerationVelocityY *= frictionFactor;\n\n    }\n\n\n    //\n    // BOUNCING SUPPORT\n    //\n\n    if (self.options.bouncing) {\n\n      var scrollOutsideX = 0;\n      var scrollOutsideY = 0;\n\n      // This configures the amount of change applied to deceleration/acceleration when reaching boundaries\n      var penetrationDeceleration = self.options.penetrationDeceleration;\n      var penetrationAcceleration = self.options.penetrationAcceleration;\n\n      // Check limits\n      if (scrollLeft < self.__minDecelerationScrollLeft) {\n        scrollOutsideX = self.__minDecelerationScrollLeft - scrollLeft;\n      } else if (scrollLeft > self.__maxDecelerationScrollLeft) {\n        scrollOutsideX = self.__maxDecelerationScrollLeft - scrollLeft;\n      }\n\n      if (scrollTop < self.__minDecelerationScrollTop) {\n        scrollOutsideY = self.__minDecelerationScrollTop - scrollTop;\n      } else if (scrollTop > self.__maxDecelerationScrollTop) {\n        scrollOutsideY = self.__maxDecelerationScrollTop - scrollTop;\n      }\n\n      // Slow down until slow enough, then flip back to snap position\n      if (scrollOutsideX !== 0) {\n        var isHeadingOutwardsX = scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft;\n        if (isHeadingOutwardsX) {\n          self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration;\n        }\n        var isStoppedX = Math.abs(self.__decelerationVelocityX) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsX || isStoppedX) {\n          self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration;\n        }\n      }\n\n      if (scrollOutsideY !== 0) {\n        var isHeadingOutwardsY = scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop;\n        if (isHeadingOutwardsY) {\n          self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration;\n        }\n        var isStoppedY = Math.abs(self.__decelerationVelocityY) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsY || isStoppedY) {\n          self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration;\n        }\n      }\n    }\n  },\n\n\n  /**\n   * calculate the distance between two touches\n   * @param   {Touch}     touch1\n   * @param   {Touch}     touch2\n   * @returns {Number}    distance\n   */\n  __getDistance: function getDistance(touch1, touch2) {\n    var x = touch2.pageX - touch1.pageX,\n    y = touch2.pageY - touch1.pageY;\n    return Math.sqrt((x * x) + (y * y));\n  },\n\n\n  /**\n   * calculate the scale factor between two touchLists (fingers)\n   * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n   * @param   {Array}     start\n   * @param   {Array}     end\n   * @returns {Number}    scale\n   */\n  __getScale: function getScale(start, end) {\n    // need two fingers...\n    if (start.length >= 2 && end.length >= 2) {\n      return this.__getDistance(end[0], end[1]) /\n        this.__getDistance(start[0], start[1]);\n    }\n    return 1;\n  }\n});\n\nionic.scroll = {\n  isScrolling: false,\n  lastTop: 0\n};\n\n})(ionic);\n\n(function(ionic) {\n  var NOOP = function() {};\n  var deprecated = function(name) {\n    void 0;\n  };\n  ionic.views.ScrollNative = ionic.views.View.inherit({\n\n    initialize: function(options) {\n      var self = this;\n      self.__container = self.el = options.el;\n      self.__content = options.el.firstElementChild;\n      // Whether scrolling is frozen or not\n      self.__frozen = false;\n      self.isNative = true;\n\n      self.__scrollTop = self.el.scrollTop;\n      self.__scrollLeft = self.el.scrollLeft;\n      self.__clientHeight = self.__content.clientHeight;\n      self.__clientWidth = self.__content.clientWidth;\n      self.__maxScrollTop = Math.max((self.__contentHeight) - self.__clientHeight, 0);\n      self.__maxScrollLeft = Math.max((self.__contentWidth) - self.__clientWidth, 0);\n\n      if(options.startY >= 0 || options.startX >= 0) {\n        ionic.requestAnimationFrame(function() {\n          self.el.scrollTop = options.startY || 0;\n          self.el.scrollLeft = options.startX || 0;\n\n          self.__scrollTop = self.el.scrollTop;\n          self.__scrollLeft = self.el.scrollLeft;\n        });\n      }\n\n      self.options = {\n\n        freeze: false,\n\n        getContentWidth: function() {\n          return Math.max(self.__content.scrollWidth, self.__content.offsetWidth);\n        },\n\n        getContentHeight: function() {\n          return Math.max(self.__content.scrollHeight, self.__content.offsetHeight + (self.__content.offsetTop * 2));\n        }\n\n      };\n\n      for (var key in options) {\n        self.options[key] = options[key];\n      }\n\n      /**\n       * Sets isScrolling to true, and automatically deactivates if not called again in 80ms.\n       */\n      self.onScroll = function() {\n        if (!ionic.scroll.isScrolling) {\n          ionic.scroll.isScrolling = true;\n        }\n\n        clearTimeout(self.scrollTimer);\n        self.scrollTimer = setTimeout(function() {\n          ionic.scroll.isScrolling = false;\n        }, 80);\n      };\n\n      self.freeze = function(shouldFreeze) {\n        self.__frozen = shouldFreeze;\n      };\n      // A more powerful freeze pop that dominates all other freeze pops\n      self.freezeShut = function(shouldFreezeShut) {\n        self.__frozenShut = shouldFreezeShut;\n      };\n\n      self.__initEventHandlers();\n    },\n\n    /**  Methods not used in native scrolling */\n    __callback: function() { deprecated('__callback'); },\n    zoomTo: function() { deprecated('zoomTo'); },\n    zoomBy: function() { deprecated('zoomBy'); },\n    activatePullToRefresh: function() { deprecated('activatePullToRefresh'); },\n\n    /**\n     * Returns the scroll position and zooming values\n     *\n     * @return {Map} `left` and `top` scroll position and `zoom` level\n     */\n    resize: function(continueScrolling) {\n      var self = this;\n      if (!self.__container || !self.options) return;\n\n      // Update Scroller dimensions for changed content\n      // Add padding to bottom of content\n      self.setDimensions(\n        self.__container.clientWidth,\n        self.__container.clientHeight,\n        self.options.getContentWidth(),\n        self.options.getContentHeight(),\n        continueScrolling\n      );\n    },\n\n    /**\n     * Initialize the scrollview\n     * In native scrolling, this only means we need to gather size information\n     */\n    run: function() {\n      this.resize();\n    },\n\n    /**\n     * Returns the scroll position and zooming values\n     *\n     * @return {Map} `left` and `top` scroll position and `zoom` level\n     */\n    getValues: function() {\n      var self = this;\n      self.update();\n      return {\n        left: self.__scrollLeft,\n        top: self.__scrollTop,\n        zoom: 1\n      };\n    },\n\n    /**\n     * Updates the __scrollLeft and __scrollTop values to el's current value\n     */\n    update: function() {\n      var self = this;\n      self.__scrollLeft = self.el.scrollLeft;\n      self.__scrollTop = self.el.scrollTop;\n    },\n\n    /**\n     * Configures the dimensions of the client (outer) and content (inner) elements.\n     * Requires the available space for the outer element and the outer size of the inner element.\n     * All values which are falsy (null or zero etc.) are ignored and the old value is kept.\n     *\n     * @param clientWidth {Integer} Inner width of outer element\n     * @param clientHeight {Integer} Inner height of outer element\n     * @param contentWidth {Integer} Outer width of inner element\n     * @param contentHeight {Integer} Outer height of inner element\n     */\n    setDimensions: function(clientWidth, clientHeight, contentWidth, contentHeight) {\n      var self = this;\n\n      if (!clientWidth && !clientHeight && !contentWidth && !contentHeight) {\n        // this scrollview isn't rendered, don't bother\n        return;\n      }\n\n      // Only update values which are defined\n      if (clientWidth === +clientWidth) {\n        self.__clientWidth = clientWidth;\n      }\n\n      if (clientHeight === +clientHeight) {\n        self.__clientHeight = clientHeight;\n      }\n\n      if (contentWidth === +contentWidth) {\n        self.__contentWidth = contentWidth;\n      }\n\n      if (contentHeight === +contentHeight) {\n        self.__contentHeight = contentHeight;\n      }\n\n      // Refresh maximums\n      self.__computeScrollMax();\n    },\n\n    /**\n     * Returns the maximum scroll values\n     *\n     * @return {Map} `left` and `top` maximum scroll values\n     */\n    getScrollMax: function() {\n      return {\n        left: this.__maxScrollLeft,\n        top: this.__maxScrollTop\n      };\n    },\n\n    /**\n     * Scrolls by the given amount in px.\n     *\n     * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n     * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n     * @param animate {Boolean} Whether the scrolling should happen using an animation\n     */\n\n    scrollBy: function(left, top, animate) {\n      var self = this;\n\n      // update scroll vars before refferencing them\n      self.update();\n\n      var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft;\n      var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop;\n\n      self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate);\n    },\n\n    /**\n     * Scrolls to the given position in px.\n     *\n     * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n     * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n     * @param animate {Boolean} Whether the scrolling should happen using an animation\n     */\n    scrollTo: function(left, top, animate) {\n      var self = this;\n      if (!animate) {\n        self.el.scrollTop = top;\n        self.el.scrollLeft = left;\n        self.resize();\n        return;\n      }\n\n      var oldOverflowX = self.el.style.overflowX;\n      var oldOverflowY = self.el.style.overflowY;\n\n      clearTimeout(self.__scrollToCleanupTimeout);\n      self.__scrollToCleanupTimeout = setTimeout(function() {\n        self.el.style.overflowX = oldOverflowX;\n        self.el.style.overflowY = oldOverflowY;\n      }, 500);\n\n      self.el.style.overflowY = 'hidden';\n      self.el.style.overflowX = 'hidden';\n\n      animateScroll(top, left);\n\n      function animateScroll(Y, X) {\n        // scroll animation loop w/ easing\n        // credit https://gist.github.com/dezinezync/5487119\n        var start = Date.now(),\n          duration = 250, //milliseconds\n          fromY = self.el.scrollTop,\n          fromX = self.el.scrollLeft;\n\n        if (fromY === Y && fromX === X) {\n          self.el.style.overflowX = oldOverflowX;\n          self.el.style.overflowY = oldOverflowY;\n          self.resize();\n          return; /* Prevent scrolling to the Y point if already there */\n        }\n\n        // decelerating to zero velocity\n        function easeOutCubic(t) {\n          return (--t) * t * t + 1;\n        }\n\n        // scroll loop\n        function animateScrollStep() {\n          var currentTime = Date.now(),\n            time = Math.min(1, ((currentTime - start) / duration)),\n          // where .5 would be 50% of time on a linear scale easedT gives a\n          // fraction based on the easing method\n            easedT = easeOutCubic(time);\n\n          if (fromY != Y) {\n            self.el.scrollTop = parseInt((easedT * (Y - fromY)) + fromY, 10);\n          }\n          if (fromX != X) {\n            self.el.scrollLeft = parseInt((easedT * (X - fromX)) + fromX, 10);\n          }\n\n          if (time < 1) {\n            ionic.requestAnimationFrame(animateScrollStep);\n\n          } else {\n            // done\n            ionic.tap.removeClonedInputs(self.__container, self);\n            self.el.style.overflowX = oldOverflowX;\n            self.el.style.overflowY = oldOverflowY;\n            self.resize();\n          }\n        }\n\n        // start scroll loop\n        ionic.requestAnimationFrame(animateScrollStep);\n      }\n    },\n\n\n\n    /*\n     ---------------------------------------------------------------------------\n     PRIVATE API\n     ---------------------------------------------------------------------------\n     */\n\n    /**\n     * If the scroll view isn't sized correctly on start, wait until we have at least some size\n     */\n    __waitForSize: function() {\n      var self = this;\n\n      clearTimeout(self.__sizerTimeout);\n\n      var sizer = function() {\n        self.resize(true);\n      };\n\n      sizer();\n      self.__sizerTimeout = setTimeout(sizer, 500);\n    },\n\n\n    /**\n     * Recomputes scroll minimum values based on client dimensions and content dimensions.\n     */\n    __computeScrollMax: function() {\n      var self = this;\n\n      self.__maxScrollLeft = Math.max((self.__contentWidth) - self.__clientWidth, 0);\n      self.__maxScrollTop = Math.max((self.__contentHeight) - self.__clientHeight, 0);\n\n      if (!self.__didWaitForSize && !self.__maxScrollLeft && !self.__maxScrollTop) {\n        self.__didWaitForSize = true;\n        self.__waitForSize();\n      }\n    },\n\n    __initEventHandlers: function() {\n      var self = this;\n\n      // Event Handler\n      var container = self.__container;\n      // save height when scroll view is shrunk so we don't need to reflow\n      var scrollViewOffsetHeight;\n\n      var lastKeyboardHeight;\n\n      /**\n       * Shrink the scroll view when the keyboard is up if necessary and if the\n       * focused input is below the bottom of the shrunk scroll view, scroll it\n       * into view.\n       */\n      self.scrollChildIntoView = function(e) {\n        var rect = container.getBoundingClientRect();\n        if(!self.__originalContainerHeight) {\n          self.__originalContainerHeight = rect.height;\n        }\n\n        // D\n        //var scrollBottomOffsetToTop = rect.bottom;\n        // D - A\n        scrollViewOffsetHeight = self.__originalContainerHeight;\n        //console.log('Scroll view offset height', scrollViewOffsetHeight);\n        //console.dir(container);\n        var alreadyShrunk = self.isShrunkForKeyboard;\n\n        var isModal = container.parentNode.classList.contains('modal');\n        var isPopover = container.parentNode.classList.contains('popover');\n        // 680px is when the media query for 60% modal width kicks in\n        var isInsetModal = isModal && window.innerWidth >= 680;\n\n       /*\n        *  _______\n        * |---A---| <- top of scroll view\n        * |       |\n        * |---B---| <- keyboard\n        * |   C   | <- input\n        * |---D---| <- initial bottom of scroll view\n        * |___E___| <- bottom of viewport\n        *\n        *  All commented calculations relative to the top of the viewport (ie E\n        *  is the viewport height, not 0)\n        */\n\n\n        var changedKeyboardHeight = lastKeyboardHeight && (lastKeyboardHeight !== e.detail.keyboardHeight);\n\n        if (!alreadyShrunk || changedKeyboardHeight) {\n          // shrink scrollview so we can actually scroll if the input is hidden\n          // if it isn't shrink so we can scroll to inputs under the keyboard\n          // inset modals won't shrink on Android on their own when the keyboard appears\n          if ( !isPopover && (ionic.Platform.isIOS() || ionic.Platform.isFullScreen || isInsetModal) ) {\n            // if there are things below the scroll view account for them and\n            // subtract them from the keyboard height when resizing\n            // E - D                         E                         D\n            //var scrollBottomOffsetToBottom = e.detail.viewportHeight - scrollBottomOffsetToTop;\n\n            // 0 or D - B if D > B           E - B                     E - D\n            //var keyboardOffset = e.detail.keyboardHeight - scrollBottomOffsetToBottom;\n\n            ionic.requestAnimationFrame(function(){\n              // D - A or B - A if D > B       D - A             max(0, D - B)\n              scrollViewOffsetHeight = Math.max(0, Math.min(self.__originalContainerHeight, self.__originalContainerHeight - (e.detail.keyboardHeight - 43)));//keyboardOffset >= 0 ? scrollViewOffsetHeight - keyboardOffset : scrollViewOffsetHeight + keyboardOffset;\n\n              //console.log('Old container height', self.__originalContainerHeight, 'New container height', scrollViewOffsetHeight, 'Keyboard height', e.detail.keyboardHeight);\n\n              container.style.height = scrollViewOffsetHeight + \"px\";\n\n              /*\n              if (ionic.Platform.isIOS()) {\n                // Force redraw to avoid disappearing content\n                var disp = container.style.display;\n                container.style.display = 'none';\n                var trick = container.offsetHeight;\n                container.style.display = disp;\n              }\n              */\n              container.classList.add('keyboard-up');\n              //update scroll view\n              self.resize();\n            });\n          }\n\n          self.isShrunkForKeyboard = true;\n        }\n\n        lastKeyboardHeight = e.detail.keyboardHeight;\n\n        /*\n         *  _______\n         * |---A---| <- top of scroll view\n         * |   *   | <- where we want to scroll to\n         * |--B-D--| <- keyboard, bottom of scroll view\n         * |   C   | <- input\n         * |       |\n         * |___E___| <- bottom of viewport\n         *\n         *  All commented calculations relative to the top of the viewport (ie E\n         *  is the viewport height, not 0)\n         */\n        // if the element is positioned under the keyboard scroll it into view\n        if (e.detail.isElementUnderKeyboard) {\n\n          ionic.requestAnimationFrame(function(){\n            var pos = ionic.DomUtil.getOffsetTop(e.detail.target);\n            setTimeout(function() {\n              if (ionic.Platform.isIOS()) {\n                ionic.tap.cloneFocusedInput(container, self);\n              }\n              // Scroll the input into view, with a 100px buffer\n              self.scrollTo(0, pos - (rect.top + 100), true);\n              self.onScroll();\n            }, 32);\n\n            /*\n            // update D if we shrunk\n            if (self.isShrunkForKeyboard && !alreadyShrunk) {\n              scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n              console.log('Scroll bottom', scrollBottomOffsetToTop);\n            }\n\n            // middle of the scrollview, this is where we want to scroll to\n            // (D - A) / 2\n            var scrollMidpointOffset = scrollViewOffsetHeight * 0.5;\n            console.log('Midpoint', scrollMidpointOffset);\n            //console.log(\"container.offsetHeight: \" + scrollViewOffsetHeight);\n\n            // middle of the input we want to scroll into view\n            // C\n            var inputMidpoint = ((e.detail.elementBottom + e.detail.elementTop) / 2);\n            console.log('Input midpoint');\n\n            // distance from middle of input to the bottom of the scroll view\n            // C - D                                C               D\n            var inputMidpointOffsetToScrollBottom = inputMidpoint - scrollBottomOffsetToTop;\n            console.log('Input midpoint offset', inputMidpointOffsetToScrollBottom);\n\n            //C - D + (D - A)/2          C - D                     (D - A)/ 2\n            var scrollTop = inputMidpointOffsetToScrollBottom + scrollMidpointOffset;\n            console.log('Scroll top', scrollTop);\n\n            if ( scrollTop > 0) {\n              if (ionic.Platform.isIOS()) {\n                //just shrank scroll view, give it some breathing room before scrolling\n                setTimeout(function(){\n                  ionic.tap.cloneFocusedInput(container, self);\n                  self.scrollBy(0, scrollTop, true);\n                  self.onScroll();\n                }, 32);\n              } else {\n                self.scrollBy(0, scrollTop, true);\n                self.onScroll();\n              }\n            }\n            */\n          });\n        }\n\n        // Only the first scrollView parent of the element that broadcasted this event\n        // (the active element that needs to be shown) should receive this event\n        e.stopPropagation();\n      };\n\n      self.resetScrollView = function() {\n        //return scrollview to original height once keyboard has hidden\n        if (self.isShrunkForKeyboard) {\n          self.isShrunkForKeyboard = false;\n          container.style.height = \"\";\n\n          /*\n          if (ionic.Platform.isIOS()) {\n            // Force redraw to avoid disappearing content\n            var disp = container.style.display;\n            container.style.display = 'none';\n            var trick = container.offsetHeight;\n            container.style.display = disp;\n          }\n          */\n\n          self.__originalContainerHeight = container.getBoundingClientRect().height;\n\n          if (ionic.Platform.isIOS()) {\n            ionic.requestAnimationFrame(function() {\n              container.classList.remove('keyboard-up');\n            });\n          }\n\n        }\n        self.resize();\n      };\n\n      self.handleTouchMove = function(e) {\n        if (self.__frozenShut) {\n          e.preventDefault();\n          e.stopPropagation();\n          return false;\n\n        } else if ( self.__frozen ){\n          e.preventDefault();\n          // let it propagate so other events such as drag events can happen,\n          // but don't let it actually scroll\n          return false;\n        }\n        return true;\n      };\n\n      container.addEventListener('scroll', self.onScroll);\n\n      //Broadcasted when keyboard is shown on some platforms.\n      //See js/utils/keyboard.js\n      container.addEventListener('scrollChildIntoView', self.scrollChildIntoView);\n\n      container.addEventListener(ionic.EVENTS.touchstart, self.handleTouchMove);\n      container.addEventListener(ionic.EVENTS.touchmove, self.handleTouchMove);\n\n      // Listen on document because container may not have had the last\n      // keyboardActiveElement, for example after closing a modal with a focused\n      // input and returning to a previously resized scroll view in an ion-content.\n      // Since we can only resize scroll views that are currently visible, just resize\n      // the current scroll view when the keyboard is closed.\n      document.addEventListener('resetScrollView', self.resetScrollView);\n    },\n\n    __cleanup: function() {\n      var self = this;\n      var container = self.__container;\n\n      container.removeEventListener('resetScrollView', self.resetScrollView);\n      container.removeEventListener('scroll', self.onScroll);\n\n      container.removeEventListener('scrollChildIntoView', self.scrollChildIntoView);\n      container.removeEventListener('resetScrollView', self.resetScrollView);\n\n      container.removeEventListener(ionic.EVENTS.touchstart, self.handleTouchMove);\n      container.removeEventListener(ionic.EVENTS.touchmove, self.handleTouchMove);\n\n      ionic.tap.removeClonedInputs(container, self);\n\n      delete self.__container;\n      delete self.__content;\n      delete self.__indicatorX;\n      delete self.__indicatorY;\n      delete self.options.el;\n\n      self.resize = self.scrollTo = self.onScroll = self.resetScrollView = NOOP;\n      self.scrollChildIntoView = NOOP;\n      container = null;\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  var ITEM_CLASS = 'item';\n  var ITEM_CONTENT_CLASS = 'item-content';\n  var ITEM_SLIDING_CLASS = 'item-sliding';\n  var ITEM_OPTIONS_CLASS = 'item-options';\n  var ITEM_PLACEHOLDER_CLASS = 'item-placeholder';\n  var ITEM_REORDERING_CLASS = 'item-reordering';\n  var ITEM_REORDER_BTN_CLASS = 'item-reorder';\n\n  var DragOp = function() {};\n  DragOp.prototype = {\n    start: function(){},\n    drag: function(){},\n    end: function(){},\n    isSameItem: function() {\n      return false;\n    }\n  };\n\n  var SlideDrag = function(opts) {\n    this.dragThresholdX = opts.dragThresholdX || 10;\n    this.el = opts.el;\n    this.item = opts.item;\n    this.canSwipe = opts.canSwipe;\n  };\n\n  SlideDrag.prototype = new DragOp();\n\n  SlideDrag.prototype.start = function(e) {\n    var content, buttons, offsetX, buttonsWidth;\n\n    if (!this.canSwipe()) {\n      return;\n    }\n\n    if (e.target.classList.contains(ITEM_CONTENT_CLASS)) {\n      content = e.target;\n    } else if (e.target.classList.contains(ITEM_CLASS)) {\n      content = e.target.querySelector('.' + ITEM_CONTENT_CLASS);\n    } else {\n      content = ionic.DomUtil.getParentWithClass(e.target, ITEM_CONTENT_CLASS);\n    }\n\n    // If we don't have a content area as one of our children (or ourselves), skip\n    if (!content) {\n      return;\n    }\n\n    // Make sure we aren't animating as we slide\n    content.classList.remove(ITEM_SLIDING_CLASS);\n\n    // Grab the starting X point for the item (for example, so we can tell whether it is open or closed to start)\n    offsetX = parseFloat(content.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]) || 0;\n\n    // Grab the buttons\n    buttons = content.parentNode.querySelector('.' + ITEM_OPTIONS_CLASS);\n    if (!buttons) {\n      return;\n    }\n    buttons.classList.remove('invisible');\n\n    buttonsWidth = buttons.offsetWidth;\n\n    this._currentDrag = {\n      buttons: buttons,\n      buttonsWidth: buttonsWidth,\n      content: content,\n      startOffsetX: offsetX\n    };\n  };\n\n  /**\n   * Check if this is the same item that was previously dragged.\n   */\n  SlideDrag.prototype.isSameItem = function(op) {\n    if (op._lastDrag && this._currentDrag) {\n      return this._currentDrag.content == op._lastDrag.content;\n    }\n    return false;\n  };\n\n  SlideDrag.prototype.clean = function(isInstant) {\n    var lastDrag = this._lastDrag;\n\n    if (!lastDrag || !lastDrag.content) return;\n\n    lastDrag.content.style[ionic.CSS.TRANSITION] = '';\n    lastDrag.content.style[ionic.CSS.TRANSFORM] = '';\n    if (isInstant) {\n      lastDrag.content.style[ionic.CSS.TRANSITION] = 'none';\n      makeInvisible();\n      ionic.requestAnimationFrame(function() {\n        lastDrag.content.style[ionic.CSS.TRANSITION] = '';\n      });\n    } else {\n      ionic.requestAnimationFrame(function() {\n        setTimeout(makeInvisible, 250);\n      });\n    }\n    function makeInvisible() {\n      lastDrag.buttons && lastDrag.buttons.classList.add('invisible');\n    }\n  };\n\n  SlideDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    var buttonsWidth;\n\n    // We really aren't dragging\n    if (!this._currentDrag) {\n      return;\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if (!this._isDragging &&\n        ((Math.abs(e.gesture.deltaX) > this.dragThresholdX) ||\n        (Math.abs(this._currentDrag.startOffsetX) > 0))) {\n      this._isDragging = true;\n    }\n\n    if (this._isDragging) {\n      buttonsWidth = this._currentDrag.buttonsWidth;\n\n      // Grab the new X point, capping it at zero\n      var newX = Math.min(0, this._currentDrag.startOffsetX + e.gesture.deltaX);\n\n      // If the new X position is past the buttons, we need to slow down the drag (rubber band style)\n      if (newX < -buttonsWidth) {\n        // Calculate the new X position, capped at the top of the buttons\n        newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));\n      }\n\n      this._currentDrag.content.$$ionicOptionsOpen = newX !== 0;\n\n      this._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + newX + 'px, 0, 0)';\n      this._currentDrag.content.style[ionic.CSS.TRANSITION] = 'none';\n    }\n  });\n\n  SlideDrag.prototype.end = function(e, doneCallback) {\n    var self = this;\n\n    // There is no drag, just end immediately\n    if (!self._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    // If we are currently dragging, we want to snap back into place\n    // The final resting point X will be the width of the exposed buttons\n    var restingPoint = -self._currentDrag.buttonsWidth;\n\n    // Check if the drag didn't clear the buttons mid-point\n    // and we aren't moving fast enough to swipe open\n    if (e.gesture.deltaX > -(self._currentDrag.buttonsWidth / 2)) {\n\n      // If we are going left but too slow, or going right, go back to resting\n      if (e.gesture.direction == \"left\" && Math.abs(e.gesture.velocityX) < 0.3) {\n        restingPoint = 0;\n\n      } else if (e.gesture.direction == \"right\") {\n        restingPoint = 0;\n      }\n\n    }\n\n    ionic.requestAnimationFrame(function() {\n      if (restingPoint === 0) {\n        self._currentDrag.content.style[ionic.CSS.TRANSFORM] = '';\n        var buttons = self._currentDrag.buttons;\n        setTimeout(function() {\n          buttons && buttons.classList.add('invisible');\n        }, 250);\n      } else {\n        self._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + restingPoint + 'px,0,0)';\n      }\n      self._currentDrag.content.style[ionic.CSS.TRANSITION] = '';\n\n\n      // Kill the current drag\n      if (!self._lastDrag) {\n        self._lastDrag = {};\n      }\n      ionic.extend(self._lastDrag, self._currentDrag);\n      if (self._currentDrag) {\n        self._currentDrag.buttons = null;\n        self._currentDrag.content = null;\n      }\n      self._currentDrag = null;\n\n      // We are done, notify caller\n      doneCallback && doneCallback();\n    });\n  };\n\n  var ReorderDrag = function(opts) {\n    var self = this;\n\n    self.dragThresholdY = opts.dragThresholdY || 0;\n    self.onReorder = opts.onReorder;\n    self.listEl = opts.listEl;\n    self.el = self.item = opts.el;\n    self.scrollEl = opts.scrollEl;\n    self.scrollView = opts.scrollView;\n    // Get the True Top of the list el http://www.quirksmode.org/js/findpos.html\n    self.listElTrueTop = 0;\n    if (self.listEl.offsetParent) {\n      var obj = self.listEl;\n      do {\n        self.listElTrueTop += obj.offsetTop;\n        obj = obj.offsetParent;\n      } while (obj);\n    }\n  };\n\n  ReorderDrag.prototype = new DragOp();\n\n  ReorderDrag.prototype._moveElement = function(e) {\n    var y = e.gesture.center.pageY +\n      this.scrollView.getValues().top -\n      (this._currentDrag.elementHeight / 2) -\n      this.listElTrueTop;\n    this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, ' + y + 'px, 0)';\n  };\n\n  ReorderDrag.prototype.deregister = function() {\n    this.listEl = this.el = this.scrollEl = this.scrollView = null;\n  };\n\n  ReorderDrag.prototype.start = function(e) {\n\n    var startIndex = ionic.DomUtil.getChildIndex(this.el, this.el.nodeName.toLowerCase());\n    var elementHeight = this.el.scrollHeight;\n    var placeholder = this.el.cloneNode(true);\n\n    placeholder.classList.add(ITEM_PLACEHOLDER_CLASS);\n\n    this.el.parentNode.insertBefore(placeholder, this.el);\n    this.el.classList.add(ITEM_REORDERING_CLASS);\n\n    this._currentDrag = {\n      elementHeight: elementHeight,\n      startIndex: startIndex,\n      placeholder: placeholder,\n      scrollHeight: scroll,\n      list: placeholder.parentNode\n    };\n\n    this._moveElement(e);\n  };\n\n  ReorderDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    // We really aren't dragging\n    var self = this;\n    if (!this._currentDrag) {\n      return;\n    }\n\n    var scrollY = 0;\n    var pageY = e.gesture.center.pageY;\n    var offset = this.listElTrueTop;\n\n    //If we have a scrollView, check scroll boundaries for dragged element and scroll if necessary\n    if (this.scrollView) {\n\n      var container = this.scrollView.__container;\n      scrollY = this.scrollView.getValues().top;\n\n      var containerTop = container.offsetTop;\n      var pixelsPastTop = containerTop - pageY + this._currentDrag.elementHeight / 2;\n      var pixelsPastBottom = pageY + this._currentDrag.elementHeight / 2 - containerTop - container.offsetHeight;\n\n      if (e.gesture.deltaY < 0 && pixelsPastTop > 0 && scrollY > 0) {\n        this.scrollView.scrollBy(null, -pixelsPastTop);\n        //Trigger another drag so the scrolling keeps going\n        ionic.requestAnimationFrame(function() {\n          self.drag(e);\n        });\n      }\n      if (e.gesture.deltaY > 0 && pixelsPastBottom > 0) {\n        if (scrollY < this.scrollView.getScrollMax().top) {\n          this.scrollView.scrollBy(null, pixelsPastBottom);\n          //Trigger another drag so the scrolling keeps going\n          ionic.requestAnimationFrame(function() {\n            self.drag(e);\n          });\n        }\n      }\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if (!this._isDragging && Math.abs(e.gesture.deltaY) > this.dragThresholdY) {\n      this._isDragging = true;\n    }\n\n    if (this._isDragging) {\n      this._moveElement(e);\n\n      this._currentDrag.currentY = scrollY + pageY - offset;\n\n      // this._reorderItems();\n    }\n  });\n\n  // When an item is dragged, we need to reorder any items for sorting purposes\n  ReorderDrag.prototype._getReorderIndex = function() {\n    var self = this;\n\n    var siblings = Array.prototype.slice.call(self._currentDrag.placeholder.parentNode.children)\n      .filter(function(el) {\n        return el.nodeName === self.el.nodeName && el !== self.el;\n      });\n\n    var dragOffsetTop = self._currentDrag.currentY;\n    var el;\n    for (var i = 0, len = siblings.length; i < len; i++) {\n      el = siblings[i];\n      if (i === len - 1) {\n        if (dragOffsetTop > el.offsetTop) {\n          return i;\n        }\n      } else if (i === 0) {\n        if (dragOffsetTop < el.offsetTop + el.offsetHeight) {\n          return i;\n        }\n      } else if (dragOffsetTop > el.offsetTop - el.offsetHeight / 2 &&\n                 dragOffsetTop < el.offsetTop + el.offsetHeight) {\n        return i;\n      }\n    }\n    return self._currentDrag.startIndex;\n  };\n\n  ReorderDrag.prototype.end = function(e, doneCallback) {\n    if (!this._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    var placeholder = this._currentDrag.placeholder;\n    var finalIndex = this._getReorderIndex();\n\n    // Reposition the element\n    this.el.classList.remove(ITEM_REORDERING_CLASS);\n    this.el.style[ionic.CSS.TRANSFORM] = '';\n\n    placeholder.parentNode.insertBefore(this.el, placeholder);\n    placeholder.parentNode.removeChild(placeholder);\n\n    this.onReorder && this.onReorder(this.el, this._currentDrag.startIndex, finalIndex);\n\n    this._currentDrag = {\n      placeholder: null,\n      content: null\n    };\n    this._currentDrag = null;\n    doneCallback && doneCallback();\n  };\n\n\n\n  /**\n   * The ListView handles a list of items. It will process drag animations, edit mode,\n   * and other operations that are common on mobile lists or table views.\n   */\n  ionic.views.ListView = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var self = this;\n\n      opts = ionic.extend({\n        onReorder: function() {},\n        virtualRemoveThreshold: -200,\n        virtualAddThreshold: 200,\n        canSwipe: function() {\n          return true;\n        }\n      }, opts);\n\n      ionic.extend(self, opts);\n\n      if (!self.itemHeight && self.listEl) {\n        self.itemHeight = self.listEl.children[0] && parseInt(self.listEl.children[0].style.height, 10);\n      }\n\n      self.onRefresh = opts.onRefresh || function() {};\n      self.onRefreshOpening = opts.onRefreshOpening || function() {};\n      self.onRefreshHolding = opts.onRefreshHolding || function() {};\n\n      var gestureOpts = {};\n      // don't prevent native scrolling\n      if (ionic.DomUtil.getParentOrSelfWithClass(self.el, 'overflow-scroll')) {\n        gestureOpts.prevent_default_directions = ['left', 'right'];\n      }\n\n      window.ionic.onGesture('release', function(e) {\n        self._handleEndDrag(e);\n      }, self.el, gestureOpts);\n\n      window.ionic.onGesture('drag', function(e) {\n        self._handleDrag(e);\n      }, self.el, gestureOpts);\n      // Start the drag states\n      self._initDrag();\n    },\n\n    /**\n     * Be sure to cleanup references.\n     */\n    deregister: function() {\n      this.el = this.listEl = this.scrollEl = this.scrollView = null;\n\n      // ensure no scrolls have been left frozen\n      if (this.isScrollFreeze) {\n        self.scrollView.freeze(false);\n      }\n    },\n\n    /**\n     * Called to tell the list to stop refreshing. This is useful\n     * if you are refreshing the list and are done with refreshing.\n     */\n    stopRefreshing: function() {\n      var refresher = this.el.querySelector('.list-refresher');\n      refresher.style.height = '0';\n    },\n\n    /**\n     * If we scrolled and have virtual mode enabled, compute the window\n     * of active elements in order to figure out the viewport to render.\n     */\n    didScroll: function(e) {\n      var self = this;\n\n      if (self.isVirtual) {\n        var itemHeight = self.itemHeight;\n\n        // Grab the total height of the list\n        var scrollHeight = e.target.scrollHeight;\n\n        // Get the viewport height\n        var viewportHeight = self.el.parentNode.offsetHeight;\n\n        // High water is the pixel position of the first element to include (everything before\n        // that will be removed)\n        var highWater = Math.max(0, e.scrollTop + self.virtualRemoveThreshold);\n\n        // Low water is the pixel position of the last element to include (everything after\n        // that will be removed)\n        var lowWater = Math.min(scrollHeight, Math.abs(e.scrollTop) + viewportHeight + self.virtualAddThreshold);\n\n        // Get the first and last elements in the list based on how many can fit\n        // between the pixel range of lowWater and highWater\n        var first = parseInt(Math.abs(highWater / itemHeight), 10);\n        var last = parseInt(Math.abs(lowWater / itemHeight), 10);\n\n        // Get the items we need to remove\n        self._virtualItemsToRemove = Array.prototype.slice.call(self.listEl.children, 0, first);\n\n        self.renderViewport && self.renderViewport(highWater, lowWater, first, last);\n      }\n    },\n\n    didStopScrolling: function() {\n      if (this.isVirtual) {\n        for (var i = 0; i < this._virtualItemsToRemove.length; i++) {\n          //el.parentNode.removeChild(el);\n          this.didHideItem && this.didHideItem(i);\n        }\n        // Once scrolling stops, check if we need to remove old items\n\n      }\n    },\n\n    /**\n     * Clear any active drag effects on the list.\n     */\n    clearDragEffects: function(isInstant) {\n      if (this._lastDragOp) {\n        this._lastDragOp.clean && this._lastDragOp.clean(isInstant);\n        this._lastDragOp.deregister && this._lastDragOp.deregister();\n        this._lastDragOp = null;\n      }\n    },\n\n    _initDrag: function() {\n      // Store the last one\n      if (this._lastDragOp) {\n        this._lastDragOp.deregister && this._lastDragOp.deregister();\n      }\n      this._lastDragOp = this._dragOp;\n\n      this._dragOp = null;\n    },\n\n    // Return the list item from the given target\n    _getItem: function(target) {\n      while (target) {\n        if (target.classList && target.classList.contains(ITEM_CLASS)) {\n          return target;\n        }\n        target = target.parentNode;\n      }\n      return null;\n    },\n\n\n    _startDrag: function(e) {\n      var self = this;\n\n      self._isDragging = false;\n\n      var lastDragOp = self._lastDragOp;\n      var item;\n\n      // If we have an open SlideDrag and we're scrolling the list. Clear it.\n      if (self._didDragUpOrDown && lastDragOp instanceof SlideDrag) {\n          lastDragOp.clean && lastDragOp.clean();\n      }\n\n      // Check if this is a reorder drag\n      if (ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_REORDER_BTN_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {\n        item = self._getItem(e.target);\n\n        if (item) {\n          self._dragOp = new ReorderDrag({\n            listEl: self.el,\n            el: item,\n            scrollEl: self.scrollEl,\n            scrollView: self.scrollView,\n            onReorder: function(el, start, end) {\n              self.onReorder && self.onReorder(el, start, end);\n            }\n          });\n          self._dragOp.start(e);\n          e.preventDefault();\n        }\n      }\n\n      // Or check if this is a swipe to the side drag\n      else if (!self._didDragUpOrDown && (e.gesture.direction == 'left' || e.gesture.direction == 'right') && Math.abs(e.gesture.deltaX) > 5) {\n\n        // Make sure this is an item with buttons\n        item = self._getItem(e.target);\n        if (item && item.querySelector('.item-options')) {\n          self._dragOp = new SlideDrag({\n            el: self.el,\n            item: item,\n            canSwipe: self.canSwipe\n          });\n          self._dragOp.start(e);\n          e.preventDefault();\n          self.isScrollFreeze = self.scrollView.freeze(true);\n        }\n      }\n\n      // If we had a last drag operation and this is a new one on a different item, clean that last one\n      if (lastDragOp && self._dragOp && !self._dragOp.isSameItem(lastDragOp) && e.defaultPrevented) {\n        lastDragOp.clean && lastDragOp.clean();\n      }\n    },\n\n\n    _handleEndDrag: function(e) {\n      var self = this;\n\n      if (self.scrollView) {\n        self.isScrollFreeze = self.scrollView.freeze(false);\n      }\n\n      self._didDragUpOrDown = false;\n\n      if (!self._dragOp) {\n        return;\n      }\n\n      self._dragOp.end(e, function() {\n        self._initDrag();\n      });\n    },\n\n    /**\n     * Process the drag event to move the item to the left or right.\n     */\n    _handleDrag: function(e) {\n      var self = this;\n\n      if (Math.abs(e.gesture.deltaY) > 5) {\n        self._didDragUpOrDown = true;\n      }\n\n      // If we get a drag event, make sure we aren't in another drag, then check if we should\n      // start one\n      if (!self.isDragging && !self._dragOp) {\n        self._startDrag(e);\n      }\n\n      // No drag still, pass it up\n      if (!self._dragOp) {\n        return;\n      }\n\n      e.gesture.srcEvent.preventDefault();\n      self._dragOp.drag(e);\n    }\n\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Modal = ionic.views.View.inherit({\n    initialize: function(opts) {\n      opts = ionic.extend({\n        focusFirstInput: false,\n        unfocusOnHide: true,\n        focusFirstDelay: 600,\n        backdropClickToClose: true,\n        hardwareBackButtonClose: true,\n      }, opts);\n\n      ionic.extend(this, opts);\n\n      this.el = opts.el;\n    },\n    show: function() {\n      var self = this;\n\n      if(self.focusFirstInput) {\n        // Let any animations run first\n        window.setTimeout(function() {\n          var input = self.el.querySelector('input, textarea');\n          input && input.focus && input.focus();\n        }, self.focusFirstDelay);\n      }\n    },\n    hide: function() {\n      // Unfocus all elements\n      if(this.unfocusOnHide) {\n        var inputs = this.el.querySelectorAll('input, textarea');\n        // Let any animations run first\n        window.setTimeout(function() {\n          for(var i = 0; i < inputs.length; i++) {\n            inputs[i].blur && inputs[i].blur();\n          }\n        });\n      }\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  /**\n   * The side menu view handles one of the side menu's in a Side Menu Controller\n   * configuration.\n   * It takes a DOM reference to that side menu element.\n   */\n  ionic.views.SideMenu = ionic.views.View.inherit({\n    initialize: function(opts) {\n      this.el = opts.el;\n      this.isEnabled = (typeof opts.isEnabled === 'undefined') ? true : opts.isEnabled;\n      this.setWidth(opts.width);\n    },\n    getFullWidth: function() {\n      return this.width;\n    },\n    setWidth: function(width) {\n      this.width = width;\n      this.el.style.width = width + 'px';\n    },\n    setIsEnabled: function(isEnabled) {\n      this.isEnabled = isEnabled;\n    },\n    bringUp: function() {\n      if(this.el.style.zIndex !== '0') {\n        this.el.style.zIndex = '0';\n      }\n    },\n    pushDown: function() {\n      if(this.el.style.zIndex !== '-1') {\n        this.el.style.zIndex = '-1';\n      }\n    }\n  });\n\n  ionic.views.SideMenuContent = ionic.views.View.inherit({\n    initialize: function(opts) {\n      ionic.extend(this, {\n        animationClass: 'menu-animated',\n        onDrag: function() {},\n        onEndDrag: function() {}\n      }, opts);\n\n      ionic.onGesture('drag', ionic.proxy(this._onDrag, this), this.el);\n      ionic.onGesture('release', ionic.proxy(this._onEndDrag, this), this.el);\n    },\n    _onDrag: function(e) {\n      this.onDrag && this.onDrag(e);\n    },\n    _onEndDrag: function(e) {\n      this.onEndDrag && this.onEndDrag(e);\n    },\n    disableAnimation: function() {\n      this.el.classList.remove(this.animationClass);\n    },\n    enableAnimation: function() {\n      this.el.classList.add(this.animationClass);\n    },\n    getTranslateX: function() {\n      return parseFloat(this.el.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]);\n    },\n    setTranslateX: ionic.animationFrameThrottle(function(x) {\n      this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(' + x + 'px, 0, 0)';\n    })\n  });\n\n})(ionic);\n\n/*\n * Adapted from Swipe.js 2.0\n *\n * Brad Birdsall\n * Copyright 2013, MIT License\n *\n*/\n\n(function(ionic) {\n'use strict';\n\nionic.views.Slider = ionic.views.View.inherit({\n  initialize: function (options) {\n    var slider = this;\n\n    var touchStartEvent, touchMoveEvent, touchEndEvent;\n    if (window.navigator.pointerEnabled) {\n      touchStartEvent = 'pointerdown';\n      touchMoveEvent = 'pointermove';\n      touchEndEvent = 'pointerup';\n    } else if (window.navigator.msPointerEnabled) {\n      touchStartEvent = 'MSPointerDown';\n      touchMoveEvent = 'MSPointerMove';\n      touchEndEvent = 'MSPointerUp';\n    } else {\n      touchStartEvent = 'touchstart';\n      touchMoveEvent = 'touchmove';\n      touchEndEvent = 'touchend';\n    }\n\n    var mouseStartEvent = 'mousedown';\n    var mouseMoveEvent = 'mousemove';\n    var mouseEndEvent = 'mouseup';\n\n    // utilities\n    var noop = function() {}; // simple no operation function\n    var offloadFn = function(fn) { setTimeout(fn || noop, 0); }; // offload a functions execution\n\n    // check browser capabilities\n    var browser = {\n      addEventListener: !!window.addEventListener,\n      transitions: (function(temp) {\n        var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition'];\n        for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true;\n        return false;\n      })(document.createElement('swipe'))\n    };\n\n\n    var container = options.el;\n\n    // quit if no root element\n    if (!container) return;\n    var element = container.children[0];\n    var slides, slidePos, width, length;\n    options = options || {};\n    var index = parseInt(options.startSlide, 10) || 0;\n    var speed = options.speed || 300;\n    options.continuous = options.continuous !== undefined ? options.continuous : true;\n\n    function setup() {\n\n      // do not setup if the container has no width\n      if (!container.offsetWidth) {\n        return;\n      }\n\n      // cache slides\n      slides = element.children;\n      length = slides.length;\n\n      // set continuous to false if only one slide\n      if (slides.length < 2) options.continuous = false;\n\n      //special case if two slides\n      if (browser.transitions && options.continuous && slides.length < 3) {\n        element.appendChild(slides[0].cloneNode(true));\n        element.appendChild(element.children[1].cloneNode(true));\n        slides = element.children;\n      }\n\n      // create an array to store current positions of each slide\n      slidePos = new Array(slides.length);\n\n      // determine width of each slide\n      width = container.offsetWidth || container.getBoundingClientRect().width;\n\n      element.style.width = (slides.length * width) + 'px';\n\n      // stack elements\n      var pos = slides.length;\n      while(pos--) {\n\n        var slide = slides[pos];\n\n        slide.style.width = width + 'px';\n        slide.setAttribute('data-index', pos);\n\n        if (browser.transitions) {\n          slide.style.left = (pos * -width) + 'px';\n          move(pos, index > pos ? -width : (index < pos ? width : 0), 0);\n        }\n\n      }\n\n      // reposition elements before and after index\n      if (options.continuous && browser.transitions) {\n        move(circle(index - 1), -width, 0);\n        move(circle(index + 1), width, 0);\n      }\n\n      if (!browser.transitions) element.style.left = (index * -width) + 'px';\n\n      container.style.visibility = 'visible';\n\n      options.slidesChanged && options.slidesChanged();\n    }\n\n    function prev(slideSpeed) {\n\n      if (options.continuous) slide(index - 1, slideSpeed);\n      else if (index) slide(index - 1, slideSpeed);\n\n    }\n\n    function next(slideSpeed) {\n\n      if (options.continuous) slide(index + 1, slideSpeed);\n      else if (index < slides.length - 1) slide(index + 1, slideSpeed);\n\n    }\n\n    function circle(index) {\n\n      // a simple positive modulo using slides.length\n      return (slides.length + (index % slides.length)) % slides.length;\n\n    }\n\n    function slide(to, slideSpeed) {\n\n      // do nothing if already on requested slide\n      if (index == to) return;\n\n      if (!slides) {\n        index = to;\n        return;\n      }\n\n      if (browser.transitions) {\n\n        var direction = Math.abs(index - to) / (index - to); // 1: backward, -1: forward\n\n        // get the actual position of the slide\n        if (options.continuous) {\n          var naturalDirection = direction;\n          direction = -slidePos[circle(to)] / width;\n\n          // if going forward but to < index, use to = slides.length + to\n          // if going backward but to > index, use to = -slides.length + to\n          if (direction !== naturalDirection) to = -direction * slides.length + to;\n\n        }\n\n        var diff = Math.abs(index - to) - 1;\n\n        // move all the slides between index and to in the right direction\n        while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0);\n\n        to = circle(to);\n\n        move(index, width * direction, slideSpeed || speed);\n        move(to, 0, slideSpeed || speed);\n\n        if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place\n\n      } else {\n\n        to = circle(to);\n        animate(index * -width, to * -width, slideSpeed || speed);\n        //no fallback for a circular continuous if the browser does not accept transitions\n      }\n\n      index = to;\n      offloadFn(options.callback && options.callback(index, slides[index]));\n    }\n\n    function move(index, dist, speed) {\n\n      translate(index, dist, speed);\n      slidePos[index] = dist;\n\n    }\n\n    function translate(index, dist, speed) {\n\n      var slide = slides[index];\n      var style = slide && slide.style;\n\n      if (!style) return;\n\n      style.webkitTransitionDuration =\n      style.MozTransitionDuration =\n      style.msTransitionDuration =\n      style.OTransitionDuration =\n      style.transitionDuration = speed + 'ms';\n\n      style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)';\n      style.msTransform =\n      style.MozTransform =\n      style.OTransform = 'translateX(' + dist + 'px)';\n\n    }\n\n    function animate(from, to, speed) {\n\n      // if not an animation, just reposition\n      if (!speed) {\n\n        element.style.left = to + 'px';\n        return;\n\n      }\n\n      var start = +new Date();\n\n      var timer = setInterval(function() {\n\n        var timeElap = +new Date() - start;\n\n        if (timeElap > speed) {\n\n          element.style.left = to + 'px';\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n          clearInterval(timer);\n          return;\n\n        }\n\n        element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px';\n\n      }, 4);\n\n    }\n\n    // setup auto slideshow\n    var delay = options.auto || 0;\n    var interval;\n\n    function begin() {\n\n      interval = setTimeout(next, delay);\n\n    }\n\n    function stop() {\n\n      delay = options.auto || 0;\n      clearTimeout(interval);\n\n    }\n\n\n    // setup initial vars\n    var start = {};\n    var delta = {};\n    var isScrolling;\n\n    // setup event capturing\n    var events = {\n\n      handleEvent: function(event) {\n        if(!event.touches && event.pageX && event.pageY) {\n          event.touches = [{\n            pageX: event.pageX,\n            pageY: event.pageY\n          }];\n        }\n\n        switch (event.type) {\n          case touchStartEvent: this.start(event); break;\n          case mouseStartEvent: this.start(event); break;\n          case touchMoveEvent: this.touchmove(event); break;\n          case mouseMoveEvent: this.touchmove(event); break;\n          case touchEndEvent: offloadFn(this.end(event)); break;\n          case mouseEndEvent: offloadFn(this.end(event)); break;\n          case 'webkitTransitionEnd':\n          case 'msTransitionEnd':\n          case 'oTransitionEnd':\n          case 'otransitionend':\n          case 'transitionend': offloadFn(this.transitionEnd(event)); break;\n          case 'resize': offloadFn(setup); break;\n        }\n\n        if (options.stopPropagation) event.stopPropagation();\n\n      },\n      start: function(event) {\n\n        // prevent to start if there is no valid event\n        if (!event.touches) {\n          return;\n        }\n\n        var touches = event.touches[0];\n\n        // measure start values\n        start = {\n\n          // get initial touch coords\n          x: touches.pageX,\n          y: touches.pageY,\n\n          // store time to determine touch duration\n          time: +new Date()\n\n        };\n\n        // used for testing first move event\n        isScrolling = undefined;\n\n        // reset delta and end measurements\n        delta = {};\n\n        // attach touchmove and touchend listeners\n        element.addEventListener(touchMoveEvent, this, false);\n        element.addEventListener(mouseMoveEvent, this, false);\n\n        element.addEventListener(touchEndEvent, this, false);\n        element.addEventListener(mouseEndEvent, this, false);\n\n        document.addEventListener(touchEndEvent, this, false);\n        document.addEventListener(mouseEndEvent, this, false);\n      },\n      touchmove: function(event) {\n\n        // ensure there is a valid event\n        // ensure swiping with one touch and not pinching\n        // ensure sliding is enabled\n        if (!event.touches ||\n            event.touches.length > 1 ||\n            event.scale && event.scale !== 1 ||\n            slider.slideIsDisabled) {\n          return;\n        }\n\n        if (options.disableScroll) event.preventDefault();\n\n        var touches = event.touches[0];\n\n        // measure change in x and y\n        delta = {\n          x: touches.pageX - start.x,\n          y: touches.pageY - start.y\n        };\n\n        // determine if scrolling test has run - one time test\n        if ( typeof isScrolling == 'undefined') {\n          isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );\n        }\n\n        // if user is not trying to scroll vertically\n        if (!isScrolling) {\n\n          // prevent native scrolling\n          event.preventDefault();\n\n          // stop slideshow\n          stop();\n\n          // increase resistance if first or last slide\n          if (options.continuous) { // we don't add resistance at the end\n\n            translate(circle(index - 1), delta.x + slidePos[circle(index - 1)], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(circle(index + 1), delta.x + slidePos[circle(index + 1)], 0);\n\n          } else {\n            // If the slider bounces, do the bounce!\n            if(options.bouncing) {\n              delta.x =\n               delta.x /\n                 ( (!index && delta.x > 0 ||         // if first slide and sliding left\n                   index == slides.length - 1 &&     // or if last slide and sliding right\n                   delta.x < 0                       // and if sliding at all\n                 ) ?\n                 ( Math.abs(delta.x) / width + 1 )      // determine resistance level\n                 : 1 );                                 // no resistance if false\n             } else {\n               if(width * index - delta.x < 0) {               //We are trying scroll past left boundary\n                 delta.x = Math.min(delta.x, width * index);  //Set delta.x so we don't go past left screen\n               }\n               if(Math.abs(delta.x) > width * (slides.length - index - 1)){         //We are trying to scroll past right bondary\n                 delta.x = Math.max( -width * (slides.length - index - 1), delta.x);  //Set delta.x so we don't go past right screen\n               }\n             }\n\n            // translate 1:1\n            translate(index - 1, delta.x + slidePos[index - 1], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(index + 1, delta.x + slidePos[index + 1], 0);\n          }\n\n          options.onDrag && options.onDrag();\n        }\n\n      },\n      end: function() {\n\n        // measure duration\n        var duration = +new Date() - start.time;\n\n        // determine if slide attempt triggers next/prev slide\n        var isValidSlide =\n              Number(duration) < 250 &&         // if slide duration is less than 250ms\n              Math.abs(delta.x) > 20 ||         // and if slide amt is greater than 20px\n              Math.abs(delta.x) > width / 2;      // or if slide amt is greater than half the width\n\n        // determine if slide attempt is past start and end\n        var isPastBounds = (!index && delta.x > 0) ||      // if first slide and slide amt is greater than 0\n              (index == slides.length - 1 && delta.x < 0); // or if last slide and slide amt is less than 0\n\n        if (options.continuous) isPastBounds = false;\n\n        // determine direction of swipe (true:right, false:left)\n        var direction = delta.x < 0;\n\n        // if not scrolling vertically\n        if (!isScrolling) {\n\n          if (isValidSlide && !isPastBounds) {\n\n            if (direction) {\n\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index - 1), -width, 0);\n                move(circle(index + 2), width, 0);\n\n              } else {\n                move(index - 1, -width, 0);\n              }\n\n              move(index, slidePos[index] - width, speed);\n              move(circle(index + 1), slidePos[circle(index + 1)] - width, speed);\n              index = circle(index + 1);\n\n            } else {\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index + 1), width, 0);\n                move(circle(index - 2), -width, 0);\n\n              } else {\n                move(index + 1, width, 0);\n              }\n\n              move(index, slidePos[index] + width, speed);\n              move(circle(index - 1), slidePos[circle(index - 1)] + width, speed);\n              index = circle(index - 1);\n\n            }\n\n            options.callback && options.callback(index, slides[index]);\n\n          } else {\n\n            if (options.continuous) {\n\n              move(circle(index - 1), -width, speed);\n              move(index, 0, speed);\n              move(circle(index + 1), width, speed);\n\n            } else {\n\n              move(index - 1, -width, speed);\n              move(index, 0, speed);\n              move(index + 1, width, speed);\n            }\n\n          }\n\n        }\n\n        // kill touchmove and touchend event listeners until touchstart called again\n        element.removeEventListener(touchMoveEvent, events, false);\n        element.removeEventListener(mouseMoveEvent, events, false);\n\n        element.removeEventListener(touchEndEvent, events, false);\n        element.removeEventListener(mouseEndEvent, events, false);\n\n        document.removeEventListener(touchEndEvent, events, false);\n        document.removeEventListener(mouseEndEvent, events, false);\n\n        options.onDragEnd && options.onDragEnd();\n      },\n      transitionEnd: function(event) {\n\n        if (parseInt(event.target.getAttribute('data-index'), 10) == index) {\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n        }\n\n      }\n\n    };\n\n    // Public API\n    this.update = function() {\n      setTimeout(setup);\n    };\n    this.setup = function() {\n      setup();\n    };\n\n    this.loop = function(value) {\n      if (arguments.length) options.continuous = !!value;\n      return options.continuous;\n    };\n\n    this.enableSlide = function(shouldEnable) {\n      if (arguments.length) {\n        this.slideIsDisabled = !shouldEnable;\n      }\n      return !this.slideIsDisabled;\n    };\n\n    this.slide = this.select = function(to, speed) {\n      // cancel slideshow\n      stop();\n\n      slide(to, speed);\n    };\n\n    this.prev = this.previous = function() {\n      // cancel slideshow\n      stop();\n\n      prev();\n    };\n\n    this.next = function() {\n      // cancel slideshow\n      stop();\n\n      next();\n    };\n\n    this.stop = function() {\n      // cancel slideshow\n      stop();\n    };\n\n    this.start = function() {\n      begin();\n    };\n\n    this.autoPlay = function(newDelay) {\n      if (!delay || delay < 0) {\n        stop();\n      } else {\n        delay = newDelay;\n        begin();\n      }\n    };\n\n    this.currentIndex = this.selected = function() {\n      // return current index position\n      return index;\n    };\n\n    this.slidesCount = this.count = function() {\n      // return total number of slides\n      return length;\n    };\n\n    this.kill = function() {\n      // cancel slideshow\n      stop();\n\n      // reset element\n      element.style.width = '';\n      element.style.left = '';\n\n      // reset slides so no refs are held on to\n      slides && (slides = []);\n\n      // removed event listeners\n      if (browser.addEventListener) {\n\n        // remove current event listeners\n        element.removeEventListener(touchStartEvent, events, false);\n        element.removeEventListener(mouseStartEvent, events, false);\n        element.removeEventListener('webkitTransitionEnd', events, false);\n        element.removeEventListener('msTransitionEnd', events, false);\n        element.removeEventListener('oTransitionEnd', events, false);\n        element.removeEventListener('otransitionend', events, false);\n        element.removeEventListener('transitionend', events, false);\n        window.removeEventListener('resize', events, false);\n\n      }\n      else {\n\n        window.onresize = null;\n\n      }\n    };\n\n    this.load = function() {\n      // trigger setup\n      setup();\n\n      // start auto slideshow if applicable\n      if (delay) begin();\n\n\n      // add event listeners\n      if (browser.addEventListener) {\n\n        // set touchstart event on element\n        element.addEventListener(touchStartEvent, events, false);\n        element.addEventListener(mouseStartEvent, events, false);\n\n        if (browser.transitions) {\n          element.addEventListener('webkitTransitionEnd', events, false);\n          element.addEventListener('msTransitionEnd', events, false);\n          element.addEventListener('oTransitionEnd', events, false);\n          element.addEventListener('otransitionend', events, false);\n          element.addEventListener('transitionend', events, false);\n        }\n\n        // set resize event on window\n        window.addEventListener('resize', events, false);\n\n      } else {\n\n        window.onresize = function () { setup(); }; // to play nice with old IE\n\n      }\n    };\n\n  }\n});\n\n})(ionic);\n\n/*eslint space-after-keywords: 0*/\n\n/**\n * Swiper 3.2.7\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n *\n * http://www.idangero.us/swiper/\n *\n * Copyright 2015, Vladimir Kharlampidi\n * The iDangero.us\n * http://www.idangero.us/\n *\n * Licensed under MIT\n *\n * Released on: December 7, 2015\n */\n(function () {\n    'use strict';\n    var $;\n    /*===========================\n    Swiper\n    ===========================*/\n    var Swiper = function (container, params, _scope, $compile) {\n\n        if (!(this instanceof Swiper)) return new Swiper(container, params);\n\n        var defaults = {\n            direction: 'horizontal',\n            touchEventsTarget: 'container',\n            initialSlide: 0,\n            speed: 300,\n            // autoplay\n            autoplay: false,\n            autoplayDisableOnInteraction: true,\n            // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).\n            iOSEdgeSwipeDetection: false,\n            iOSEdgeSwipeThreshold: 20,\n            // Free mode\n            freeMode: false,\n            freeModeMomentum: true,\n            freeModeMomentumRatio: 1,\n            freeModeMomentumBounce: true,\n            freeModeMomentumBounceRatio: 1,\n            freeModeSticky: false,\n            freeModeMinimumVelocity: 0.02,\n            // Autoheight\n            autoHeight: false,\n            // Set wrapper width\n            setWrapperSize: false,\n            // Virtual Translate\n            virtualTranslate: false,\n            // Effects\n            effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow'\n            coverflow: {\n                rotate: 50,\n                stretch: 0,\n                depth: 100,\n                modifier: 1,\n                slideShadows : true\n            },\n            cube: {\n                slideShadows: true,\n                shadow: true,\n                shadowOffset: 20,\n                shadowScale: 0.94\n            },\n            fade: {\n                crossFade: false\n            },\n            // Parallax\n            parallax: false,\n            // Scrollbar\n            scrollbar: null,\n            scrollbarHide: true,\n            scrollbarDraggable: false,\n            scrollbarSnapOnRelease: false,\n            // Keyboard Mousewheel\n            keyboardControl: false,\n            mousewheelControl: false,\n            mousewheelReleaseOnEdges: false,\n            mousewheelInvert: false,\n            mousewheelForceToAxis: false,\n            mousewheelSensitivity: 1,\n            // Hash Navigation\n            hashnav: false,\n            // Breakpoints\n            breakpoints: undefined,\n            // Slides grid\n            spaceBetween: 0,\n            slidesPerView: 1,\n            slidesPerColumn: 1,\n            slidesPerColumnFill: 'column',\n            slidesPerGroup: 1,\n            centeredSlides: false,\n            slidesOffsetBefore: 0, // in px\n            slidesOffsetAfter: 0, // in px\n            // Round length\n            roundLengths: false,\n            // Touches\n            touchRatio: 1,\n            touchAngle: 45,\n            simulateTouch: true,\n            shortSwipes: true,\n            longSwipes: true,\n            longSwipesRatio: 0.5,\n            longSwipesMs: 300,\n            followFinger: true,\n            onlyExternal: false,\n            threshold: 0,\n            touchMoveStopPropagation: true,\n            // Pagination\n            pagination: null,\n            paginationElement: 'span',\n            paginationClickable: false,\n            paginationHide: false,\n            paginationBulletRender: null,\n            // Resistance\n            resistance: true,\n            resistanceRatio: 0.85,\n            // Next/prev buttons\n            nextButton: null,\n            prevButton: null,\n            // Progress\n            watchSlidesProgress: false,\n            watchSlidesVisibility: false,\n            // Cursor\n            grabCursor: false,\n            // Clicks\n            preventClicks: true,\n            preventClicksPropagation: true,\n            slideToClickedSlide: false,\n            // Lazy Loading\n            lazyLoading: false,\n            lazyLoadingInPrevNext: false,\n            lazyLoadingOnTransitionStart: false,\n            // Images\n            preloadImages: true,\n            updateOnImagesReady: true,\n            // loop\n            loop: false,\n            loopAdditionalSlides: 0,\n            loopedSlides: null,\n            // Control\n            control: undefined,\n            controlInverse: false,\n            controlBy: 'slide', //or 'container'\n            // Swiping/no swiping\n            allowSwipeToPrev: true,\n            allowSwipeToNext: true,\n            swipeHandler: null, //'.swipe-handler',\n            noSwiping: true,\n            noSwipingClass: 'swiper-no-swiping',\n            // NS\n            slideClass: 'swiper-slide',\n            slideActiveClass: 'swiper-slide-active',\n            slideVisibleClass: 'swiper-slide-visible',\n            slideDuplicateClass: 'swiper-slide-duplicate',\n            slideNextClass: 'swiper-slide-next',\n            slidePrevClass: 'swiper-slide-prev',\n            wrapperClass: 'swiper-wrapper',\n            bulletClass: 'swiper-pagination-bullet',\n            bulletActiveClass: 'swiper-pagination-bullet-active',\n            buttonDisabledClass: 'swiper-button-disabled',\n            paginationHiddenClass: 'swiper-pagination-hidden',\n            // Observer\n            observer: false,\n            observeParents: false,\n            // Accessibility\n            a11y: false,\n            prevSlideMessage: 'Previous slide',\n            nextSlideMessage: 'Next slide',\n            firstSlideMessage: 'This is the first slide',\n            lastSlideMessage: 'This is the last slide',\n            paginationBulletMessage: 'Go to slide {{index}}',\n            // Callbacks\n            runCallbacksOnInit: true\n            /*\n            Callbacks:\n            onInit: function (swiper)\n            onDestroy: function (swiper)\n            onClick: function (swiper, e)\n            onTap: function (swiper, e)\n            onDoubleTap: function (swiper, e)\n            onSliderMove: function (swiper, e)\n            onSlideChangeStart: function (swiper)\n            onSlideChangeEnd: function (swiper)\n            onTransitionStart: function (swiper)\n            onTransitionEnd: function (swiper)\n            onImagesReady: function (swiper)\n            onProgress: function (swiper, progress)\n            onTouchStart: function (swiper, e)\n            onTouchMove: function (swiper, e)\n            onTouchMoveOpposite: function (swiper, e)\n            onTouchEnd: function (swiper, e)\n            onReachBeginning: function (swiper)\n            onReachEnd: function (swiper)\n            onSetTransition: function (swiper, duration)\n            onSetTranslate: function (swiper, translate)\n            onAutoplayStart: function (swiper)\n            onAutoplayStop: function (swiper),\n            onLazyImageLoad: function (swiper, slide, image)\n            onLazyImageReady: function (swiper, slide, image)\n            */\n\n        };\n        var initialVirtualTranslate = params && params.virtualTranslate;\n\n        params = params || {};\n        var originalParams = {};\n        for (var param in params) {\n            if (typeof params[param] === 'object' && !(params[param].nodeType || params[param] === window || params[param] === document || (typeof Dom7 !== 'undefined' && params[param] instanceof Dom7) || (typeof jQuery !== 'undefined' && params[param] instanceof jQuery))) {\n                originalParams[param] = {};\n                for (var deepParam in params[param]) {\n                    originalParams[param][deepParam] = params[param][deepParam];\n                }\n            }\n            else {\n                originalParams[param] = params[param];\n            }\n        }\n        for (var def in defaults) {\n            if (typeof params[def] === 'undefined') {\n                params[def] = defaults[def];\n            }\n            else if (typeof params[def] === 'object') {\n                for (var deepDef in defaults[def]) {\n                    if (typeof params[def][deepDef] === 'undefined') {\n                        params[def][deepDef] = defaults[def][deepDef];\n                    }\n                }\n            }\n        }\n\n        // Swiper\n        var s = this;\n\n        // Params\n        s.params = params;\n        s.originalParams = originalParams;\n\n        // Classname\n        s.classNames = [];\n        /*=========================\n          Dom Library and plugins\n          ===========================*/\n        if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined'){\n            $ = Dom7;\n        }\n        if (typeof $ === 'undefined') {\n            if (typeof Dom7 === 'undefined') {\n                $ = window.Dom7 || window.Zepto || window.jQuery;\n            }\n            else {\n                $ = Dom7;\n            }\n            if (!$) return;\n        }\n        // Export it to Swiper instance\n        s.$ = $;\n\n        /*=========================\n          Breakpoints\n          ===========================*/\n        s.currentBreakpoint = undefined;\n        s.getActiveBreakpoint = function () {\n            //Get breakpoint for window width\n            if (!s.params.breakpoints) return false;\n            var breakpoint = false;\n            var points = [], point;\n            for ( point in s.params.breakpoints ) {\n                if (s.params.breakpoints.hasOwnProperty(point)) {\n                    points.push(point);\n                }\n            }\n            points.sort(function (a, b) {\n                return parseInt(a, 10) > parseInt(b, 10);\n            });\n            for (var i = 0; i < points.length; i++) {\n                point = points[i];\n                if (point >= window.innerWidth && !breakpoint) {\n                    breakpoint = point;\n                }\n            }\n            return breakpoint || 'max';\n        };\n        s.setBreakpoint = function () {\n            //Set breakpoint for window width and update parameters\n            var breakpoint = s.getActiveBreakpoint();\n            if (breakpoint && s.currentBreakpoint !== breakpoint) {\n                var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;\n                for ( var param in breakPointsParams ) {\n                    s.params[param] = breakPointsParams[param];\n                }\n                s.currentBreakpoint = breakpoint;\n            }\n        };\n        // Set breakpoint on load\n        if (s.params.breakpoints) {\n            s.setBreakpoint();\n        }\n\n        /*=========================\n          Preparation - Define Container, Wrapper and Pagination\n          ===========================*/\n        s.container = $(container);\n        if (s.container.length === 0) return;\n        if (s.container.length > 1) {\n            s.container.each(function () {\n                new Swiper(this, params);\n            });\n            return;\n        }\n\n        // Save instance in container HTML Element and in data\n        s.container[0].swiper = s;\n        s.container.data('swiper', s);\n\n        s.classNames.push('swiper-container-' + s.params.direction);\n\n        if (s.params.freeMode) {\n            s.classNames.push('swiper-container-free-mode');\n        }\n        if (!s.support.flexbox) {\n            s.classNames.push('swiper-container-no-flexbox');\n            s.params.slidesPerColumn = 1;\n        }\n        if (s.params.autoHeight) {\n            s.classNames.push('swiper-container-autoheight');\n        }\n        // Enable slides progress when required\n        if (s.params.parallax || s.params.watchSlidesVisibility) {\n            s.params.watchSlidesProgress = true;\n        }\n        // Coverflow / 3D\n        if (['cube', 'coverflow'].indexOf(s.params.effect) >= 0) {\n            if (s.support.transforms3d) {\n                s.params.watchSlidesProgress = true;\n                s.classNames.push('swiper-container-3d');\n            }\n            else {\n                s.params.effect = 'slide';\n            }\n        }\n        if (s.params.effect !== 'slide') {\n            s.classNames.push('swiper-container-' + s.params.effect);\n        }\n        if (s.params.effect === 'cube') {\n            s.params.resistanceRatio = 0;\n            s.params.slidesPerView = 1;\n            s.params.slidesPerColumn = 1;\n            s.params.slidesPerGroup = 1;\n            s.params.centeredSlides = false;\n            s.params.spaceBetween = 0;\n            s.params.virtualTranslate = true;\n            s.params.setWrapperSize = false;\n        }\n        if (s.params.effect === 'fade') {\n            s.params.slidesPerView = 1;\n            s.params.slidesPerColumn = 1;\n            s.params.slidesPerGroup = 1;\n            s.params.watchSlidesProgress = true;\n            s.params.spaceBetween = 0;\n            if (typeof initialVirtualTranslate === 'undefined') {\n                s.params.virtualTranslate = true;\n            }\n        }\n\n        // Grab Cursor\n        if (s.params.grabCursor && s.support.touch) {\n            s.params.grabCursor = false;\n        }\n\n        // Wrapper\n        s.wrapper = s.container.children('.' + s.params.wrapperClass);\n\n        // Pagination\n        if (s.params.pagination) {\n            s.paginationContainer = $(s.params.pagination);\n            if (s.params.paginationClickable) {\n                s.paginationContainer.addClass('swiper-pagination-clickable');\n            }\n        }\n\n        // Is Horizontal\n        function isH() {\n            return s.params.direction === 'horizontal';\n        }\n\n        // RTL\n        s.rtl = isH() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');\n        if (s.rtl) {\n            s.classNames.push('swiper-container-rtl');\n        }\n\n        // Wrong RTL support\n        if (s.rtl) {\n            s.wrongRTL = s.wrapper.css('display') === '-webkit-box';\n        }\n\n        // Columns\n        if (s.params.slidesPerColumn > 1) {\n            s.classNames.push('swiper-container-multirow');\n        }\n\n        // Check for Android\n        if (s.device.android) {\n            s.classNames.push('swiper-container-android');\n        }\n\n        // Add classes\n        s.container.addClass(s.classNames.join(' '));\n\n        // Translate\n        s.translate = 0;\n\n        // Progress\n        s.progress = 0;\n\n        // Velocity\n        s.velocity = 0;\n\n        /*=========================\n          Locks, unlocks\n          ===========================*/\n        s.lockSwipeToNext = function () {\n            s.params.allowSwipeToNext = false;\n        };\n        s.lockSwipeToPrev = function () {\n            s.params.allowSwipeToPrev = false;\n        };\n        s.lockSwipes = function () {\n            s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;\n        };\n        s.unlockSwipeToNext = function () {\n            s.params.allowSwipeToNext = true;\n        };\n        s.unlockSwipeToPrev = function () {\n            s.params.allowSwipeToPrev = true;\n        };\n        s.unlockSwipes = function () {\n            s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;\n        };\n\n        /*=========================\n          Round helper\n          ===========================*/\n        function round(a) {\n            return Math.floor(a);\n        }\n        /*=========================\n          Set grab cursor\n          ===========================*/\n        if (s.params.grabCursor) {\n            s.container[0].style.cursor = 'move';\n            s.container[0].style.cursor = '-webkit-grab';\n            s.container[0].style.cursor = '-moz-grab';\n            s.container[0].style.cursor = 'grab';\n        }\n        /*=========================\n          Update on Images Ready\n          ===========================*/\n        s.imagesToLoad = [];\n        s.imagesLoaded = 0;\n\n        s.loadImage = function (imgElement, src, srcset, checkForComplete, callback) {\n            var image;\n            function onReady () {\n                if (callback) callback();\n            }\n            if (!imgElement.complete || !checkForComplete) {\n                if (src) {\n                    image = new window.Image();\n                    image.onload = onReady;\n                    image.onerror = onReady;\n                    if (srcset) {\n                        image.srcset = srcset;\n                    }\n                    if (src) {\n                        image.src = src;\n                    }\n                } else {\n                    onReady();\n                }\n\n            } else {//image already loaded...\n                onReady();\n            }\n        };\n        s.preloadImages = function () {\n            s.imagesToLoad = s.container.find('img');\n            function _onReady() {\n                if (typeof s === 'undefined' || s === null) return;\n                if (s.imagesLoaded !== undefined) s.imagesLoaded++;\n                if (s.imagesLoaded === s.imagesToLoad.length) {\n                    if (s.params.updateOnImagesReady) s.update();\n                    s.emit('onImagesReady', s);\n                }\n            }\n            for (var i = 0; i < s.imagesToLoad.length; i++) {\n                s.loadImage(s.imagesToLoad[i], (s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src')), (s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset')), true, _onReady);\n            }\n        };\n\n        /*=========================\n          Autoplay\n          ===========================*/\n        s.autoplayTimeoutId = undefined;\n        s.autoplaying = false;\n        s.autoplayPaused = false;\n        function autoplay() {\n            s.autoplayTimeoutId = setTimeout(function () {\n                if (s.params.loop) {\n                    s.fixLoop();\n                    s._slideNext();\n                }\n                else {\n                    if (!s.isEnd) {\n                        s._slideNext();\n                    }\n                    else {\n                        if (!params.autoplayStopOnLast) {\n                            s._slideTo(0);\n                        }\n                        else {\n                            s.stopAutoplay();\n                        }\n                    }\n                }\n            }, s.params.autoplay);\n        }\n        s.startAutoplay = function () {\n            if (typeof s.autoplayTimeoutId !== 'undefined') return false;\n            if (!s.params.autoplay) return false;\n            if (s.autoplaying) return false;\n            s.autoplaying = true;\n            s.emit('onAutoplayStart', s);\n            autoplay();\n        };\n        s.stopAutoplay = function (internal) {\n            if (!s.autoplayTimeoutId) return;\n            if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);\n            s.autoplaying = false;\n            s.autoplayTimeoutId = undefined;\n            s.emit('onAutoplayStop', s);\n        };\n        s.pauseAutoplay = function (speed) {\n            if (s.autoplayPaused) return;\n            if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);\n            s.autoplayPaused = true;\n            if (speed === 0) {\n                s.autoplayPaused = false;\n                autoplay();\n            }\n            else {\n                s.wrapper.transitionEnd(function () {\n                    if (!s) return;\n                    s.autoplayPaused = false;\n                    if (!s.autoplaying) {\n                        s.stopAutoplay();\n                    }\n                    else {\n                        autoplay();\n                    }\n                });\n            }\n        };\n        /*=========================\n          Min/Max Translate\n          ===========================*/\n        s.minTranslate = function () {\n            return (-s.snapGrid[0]);\n        };\n        s.maxTranslate = function () {\n            return (-s.snapGrid[s.snapGrid.length - 1]);\n        };\n        /*=========================\n          Slider/slides sizes\n          ===========================*/\n        s.updateAutoHeight = function () {\n            // Update Height\n            var newHeight = s.slides.eq(s.activeIndex)[0].offsetHeight;\n            if (newHeight) s.wrapper.css('height', s.slides.eq(s.activeIndex)[0].offsetHeight + 'px');\n        };\n        s.updateContainerSize = function () {\n            var width, height;\n            if (typeof s.params.width !== 'undefined') {\n                width = s.params.width;\n            }\n            else {\n                width = s.container[0].clientWidth;\n            }\n            if (typeof s.params.height !== 'undefined') {\n                height = s.params.height;\n            }\n            else {\n                height = s.container[0].clientHeight;\n            }\n            if (width === 0 && isH() || height === 0 && !isH()) {\n                return;\n            }\n\n            //Subtract paddings\n            width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);\n            height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);\n\n            // Store values\n            s.width = width;\n            s.height = height;\n            s.size = isH() ? s.width : s.height;\n        };\n\n        s.updateSlidesSize = function () {\n            s.slides = s.wrapper.children('.' + s.params.slideClass);\n            s.snapGrid = [];\n            s.slidesGrid = [];\n            s.slidesSizesGrid = [];\n\n            var spaceBetween = s.params.spaceBetween,\n                slidePosition = -s.params.slidesOffsetBefore,\n                i,\n                prevSlideSize = 0,\n                index = 0;\n            if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n                spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;\n            }\n\n            s.virtualSize = -spaceBetween;\n            // reset margins\n            if (s.rtl) s.slides.css({marginLeft: '', marginTop: ''});\n            else s.slides.css({marginRight: '', marginBottom: ''});\n\n            var slidesNumberEvenToRows;\n            if (s.params.slidesPerColumn > 1) {\n                if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {\n                    slidesNumberEvenToRows = s.slides.length;\n                }\n                else {\n                    slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;\n                }\n                if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {\n                    slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);\n                }\n            }\n\n            // Calc slides\n            var slideSize;\n            var slidesPerColumn = s.params.slidesPerColumn;\n            var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;\n            var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);\n            for (i = 0; i < s.slides.length; i++) {\n                slideSize = 0;\n                var slide = s.slides.eq(i);\n                if (s.params.slidesPerColumn > 1) {\n                    // Set slides order\n                    var newSlideOrderIndex;\n                    var column, row;\n                    if (s.params.slidesPerColumnFill === 'column') {\n                        column = Math.floor(i / slidesPerColumn);\n                        row = i - column * slidesPerColumn;\n                        if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn-1)) {\n                            if (++row >= slidesPerColumn) {\n                                row = 0;\n                                column++;\n                            }\n                        }\n                        newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;\n                        slide\n                            .css({\n                                '-webkit-box-ordinal-group': newSlideOrderIndex,\n                                '-moz-box-ordinal-group': newSlideOrderIndex,\n                                '-ms-flex-order': newSlideOrderIndex,\n                                '-webkit-order': newSlideOrderIndex,\n                                'order': newSlideOrderIndex\n                            });\n                    }\n                    else {\n                        row = Math.floor(i / slidesPerRow);\n                        column = i - row * slidesPerRow;\n                    }\n                    slide\n                        .css({\n                            'margin-top': (row !== 0 && s.params.spaceBetween) && (s.params.spaceBetween + 'px')\n                        })\n                        .attr('data-swiper-column', column)\n                        .attr('data-swiper-row', row);\n\n                }\n                if (slide.css('display') === 'none') continue;\n                if (s.params.slidesPerView === 'auto') {\n                    slideSize = isH() ? slide.outerWidth(true) : slide.outerHeight(true);\n                    if (s.params.roundLengths) slideSize = round(slideSize);\n                }\n                else {\n                    slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;\n                    if (s.params.roundLengths) slideSize = round(slideSize);\n\n                    if (isH()) {\n                        s.slides[i].style.width = slideSize + 'px';\n                    }\n                    else {\n                        s.slides[i].style.height = slideSize + 'px';\n                    }\n                }\n                s.slides[i].swiperSlideSize = slideSize;\n                s.slidesSizesGrid.push(slideSize);\n\n\n                if (s.params.centeredSlides) {\n                    slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;\n                    if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;\n                    if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;\n                    if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);\n                    s.slidesGrid.push(slidePosition);\n                }\n                else {\n                    if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);\n                    s.slidesGrid.push(slidePosition);\n                    slidePosition = slidePosition + slideSize + spaceBetween;\n                }\n\n                s.virtualSize += slideSize + spaceBetween;\n\n                prevSlideSize = slideSize;\n\n                index ++;\n            }\n            s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;\n            var newSlidesGrid;\n\n            if (\n                s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {\n                s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n            }\n            if (!s.support.flexbox || s.params.setWrapperSize) {\n                if (isH()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n                else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});\n            }\n\n            if (s.params.slidesPerColumn > 1) {\n                s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;\n                s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;\n                s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n                if (s.params.centeredSlides) {\n                    newSlidesGrid = [];\n                    for (i = 0; i < s.snapGrid.length; i++) {\n                        if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);\n                    }\n                    s.snapGrid = newSlidesGrid;\n                }\n            }\n\n            // Remove last grid elements depending on width\n            if (!s.params.centeredSlides) {\n                newSlidesGrid = [];\n                for (i = 0; i < s.snapGrid.length; i++) {\n                    if (s.snapGrid[i] <= s.virtualSize - s.size) {\n                        newSlidesGrid.push(s.snapGrid[i]);\n                    }\n                }\n                s.snapGrid = newSlidesGrid;\n                if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {\n                    s.snapGrid.push(s.virtualSize - s.size);\n                }\n            }\n            if (s.snapGrid.length === 0) s.snapGrid = [0];\n\n            if (s.params.spaceBetween !== 0) {\n                if (isH()) {\n                    if (s.rtl) s.slides.css({marginLeft: spaceBetween + 'px'});\n                    else s.slides.css({marginRight: spaceBetween + 'px'});\n                }\n                else s.slides.css({marginBottom: spaceBetween + 'px'});\n            }\n            if (s.params.watchSlidesProgress) {\n                s.updateSlidesOffset();\n            }\n        };\n        s.updateSlidesOffset = function () {\n            for (var i = 0; i < s.slides.length; i++) {\n                s.slides[i].swiperSlideOffset = isH() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;\n            }\n        };\n\n        /*=========================\n          Slider/slides progress\n          ===========================*/\n        s.updateSlidesProgress = function (translate) {\n            if (typeof translate === 'undefined') {\n                translate = s.translate || 0;\n            }\n            if (s.slides.length === 0) return;\n            if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();\n\n            var offsetCenter = -translate;\n            if (s.rtl) offsetCenter = translate;\n\n            // Visible Slides\n            s.slides.removeClass(s.params.slideVisibleClass);\n            for (var i = 0; i < s.slides.length; i++) {\n                var slide = s.slides[i];\n                var slideProgress = (offsetCenter - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);\n                if (s.params.watchSlidesVisibility) {\n                    var slideBefore = -(offsetCenter - slide.swiperSlideOffset);\n                    var slideAfter = slideBefore + s.slidesSizesGrid[i];\n                    var isVisible =\n                        (slideBefore >= 0 && slideBefore < s.size) ||\n                        (slideAfter > 0 && slideAfter <= s.size) ||\n                        (slideBefore <= 0 && slideAfter >= s.size);\n                    if (isVisible) {\n                        s.slides.eq(i).addClass(s.params.slideVisibleClass);\n                    }\n                }\n                slide.progress = s.rtl ? -slideProgress : slideProgress;\n            }\n        };\n        s.updateProgress = function (translate) {\n            if (typeof translate === 'undefined') {\n                translate = s.translate || 0;\n            }\n            var translatesDiff = s.maxTranslate() - s.minTranslate();\n            var wasBeginning = s.isBeginning;\n            var wasEnd = s.isEnd;\n            if (translatesDiff === 0) {\n                s.progress = 0;\n                s.isBeginning = s.isEnd = true;\n            }\n            else {\n                s.progress = (translate - s.minTranslate()) / (translatesDiff);\n                s.isBeginning = s.progress <= 0;\n                s.isEnd = s.progress >= 1;\n            }\n            if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);\n            if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);\n\n            if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);\n            s.emit('onProgress', s, s.progress);\n        };\n        s.updateActiveIndex = function () {\n            var translate = s.rtl ? s.translate : -s.translate;\n            var newActiveIndex, i, snapIndex;\n            for (i = 0; i < s.slidesGrid.length; i ++) {\n                if (typeof s.slidesGrid[i + 1] !== 'undefined') {\n                    if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {\n                        newActiveIndex = i;\n                    }\n                    else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {\n                        newActiveIndex = i + 1;\n                    }\n                }\n                else {\n                    if (translate >= s.slidesGrid[i]) {\n                        newActiveIndex = i;\n                    }\n                }\n            }\n            // Normalize slideIndex\n            if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;\n            // for (i = 0; i < s.slidesGrid.length; i++) {\n                // if (- translate >= s.slidesGrid[i]) {\n                    // newActiveIndex = i;\n                // }\n            // }\n            snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);\n            if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;\n\n            if (newActiveIndex === s.activeIndex) {\n                return;\n            }\n            s.snapIndex = snapIndex;\n            s.previousIndex = s.activeIndex;\n            s.activeIndex = newActiveIndex;\n            s.updateClasses();\n        };\n\n        /*=========================\n          Classes\n          ===========================*/\n        s.updateClasses = function () {\n            s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass);\n            var activeSlide = s.slides.eq(s.activeIndex);\n            // Active classes\n            activeSlide.addClass(s.params.slideActiveClass);\n            activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);\n            activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);\n\n            // Pagination\n            if (s.bullets && s.bullets.length > 0) {\n                s.bullets.removeClass(s.params.bulletActiveClass);\n                var bulletIndex;\n                if (s.params.loop) {\n                    bulletIndex = Math.ceil(s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup;\n                    if (bulletIndex > s.slides.length - 1 - s.loopedSlides * 2) {\n                        bulletIndex = bulletIndex - (s.slides.length - s.loopedSlides * 2);\n                    }\n                    if (bulletIndex > s.bullets.length - 1) bulletIndex = bulletIndex - s.bullets.length;\n                }\n                else {\n                    if (typeof s.snapIndex !== 'undefined') {\n                        bulletIndex = s.snapIndex;\n                    }\n                    else {\n                        bulletIndex = s.activeIndex || 0;\n                    }\n                }\n                if (s.paginationContainer.length > 1) {\n                    s.bullets.each(function () {\n                        if ($(this).index() === bulletIndex) $(this).addClass(s.params.bulletActiveClass);\n                    });\n                }\n                else {\n                    s.bullets.eq(bulletIndex).addClass(s.params.bulletActiveClass);\n                }\n            }\n\n            // Next/active buttons\n            if (!s.params.loop) {\n                if (s.params.prevButton) {\n                    if (s.isBeginning) {\n                        $(s.params.prevButton).addClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));\n                    }\n                    else {\n                        $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));\n                    }\n                }\n                if (s.params.nextButton) {\n                    if (s.isEnd) {\n                        $(s.params.nextButton).addClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));\n                    }\n                    else {\n                        $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));\n                    }\n                }\n            }\n        };\n\n        /*=========================\n          Pagination\n          ===========================*/\n        s.updatePagination = function () {\n            if (!s.params.pagination) return;\n            if (s.paginationContainer && s.paginationContainer.length > 0) {\n                var bulletsHTML = '';\n                var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;\n                for (var i = 0; i < numberOfBullets; i++) {\n                    if (s.params.paginationBulletRender) {\n                        bulletsHTML += s.params.paginationBulletRender(i, s.params.bulletClass);\n                    }\n                    else {\n                        bulletsHTML += '<' + s.params.paginationElement+' class=\"' + s.params.bulletClass + '\"></' + s.params.paginationElement + '>';\n                    }\n                }\n                s.paginationContainer.html(bulletsHTML);\n                s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);\n                if (s.params.paginationClickable && s.params.a11y && s.a11y) {\n                    s.a11y.initPagination();\n                }\n            }\n        };\n        /*=========================\n          Common update method\n          ===========================*/\n        s.update = function (updateTranslate) {\n            s.updateContainerSize();\n            s.updateSlidesSize();\n            s.updateProgress();\n            s.updatePagination();\n            s.updateClasses();\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.set();\n            }\n            function forceSetTranslate() {\n                newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());\n                s.setWrapperTranslate(newTranslate);\n                s.updateActiveIndex();\n                s.updateClasses();\n            }\n            if (updateTranslate) {\n                var translated, newTranslate;\n                if (s.controller && s.controller.spline) {\n                    s.controller.spline = undefined;\n                }\n                if (s.params.freeMode) {\n                    forceSetTranslate();\n                    if (s.params.autoHeight) {\n                        s.updateAutoHeight();\n                    }\n                }\n                else {\n                    if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {\n                        translated = s.slideTo(s.slides.length - 1, 0, false, true);\n                    }\n                    else {\n                        translated = s.slideTo(s.activeIndex, 0, false, true);\n                    }\n                    if (!translated) {\n                        forceSetTranslate();\n                    }\n                }\n            }\n            else if (s.params.autoHeight) {\n                s.updateAutoHeight();\n            }\n        };\n\n        /*=========================\n          Resize Handler\n          ===========================*/\n        s.onResize = function (forceUpdatePagination) {\n            //Breakpoints\n            if (s.params.breakpoints) {\n                s.setBreakpoint();\n            }\n\n            // Disable locks on resize\n            var allowSwipeToPrev = s.params.allowSwipeToPrev;\n            var allowSwipeToNext = s.params.allowSwipeToNext;\n            s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;\n\n            s.updateContainerSize();\n            s.updateSlidesSize();\n            if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination();\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.set();\n            }\n            if (s.controller && s.controller.spline) {\n                s.controller.spline = undefined;\n            }\n            if (s.params.freeMode) {\n                var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());\n                s.setWrapperTranslate(newTranslate);\n                s.updateActiveIndex();\n                s.updateClasses();\n\n                if (s.params.autoHeight) {\n                    s.updateAutoHeight();\n                }\n            }\n            else {\n                s.updateClasses();\n                if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {\n                    s.slideTo(s.slides.length - 1, 0, false, true);\n                }\n                else {\n                    s.slideTo(s.activeIndex, 0, false, true);\n                }\n            }\n            // Return locks after resize\n            s.params.allowSwipeToPrev = allowSwipeToPrev;\n            s.params.allowSwipeToNext = allowSwipeToNext;\n        };\n\n        /*=========================\n          Events\n          ===========================*/\n\n        //Define Touch Events\n        var desktopEvents = ['mousedown', 'mousemove', 'mouseup'];\n        if (window.navigator.pointerEnabled) desktopEvents = ['pointerdown', 'pointermove', 'pointerup'];\n        else if (window.navigator.msPointerEnabled) desktopEvents = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp'];\n        s.touchEvents = {\n            start : s.support.touch || !s.params.simulateTouch  ? 'touchstart' : desktopEvents[0],\n            move : s.support.touch || !s.params.simulateTouch ? 'touchmove' : desktopEvents[1],\n            end : s.support.touch || !s.params.simulateTouch ? 'touchend' : desktopEvents[2]\n        };\n\n\n        // WP8 Touch Events Fix\n        if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {\n            (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);\n        }\n\n        // Attach/detach events\n        s.initEvents = function (detach) {\n            var actionDom = detach ? 'off' : 'on';\n            var action = detach ? 'removeEventListener' : 'addEventListener';\n            var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0];\n            var target = s.support.touch ? touchEventsTarget : document;\n\n            var moveCapture = s.params.nested ? true : false;\n\n            //Touch Events\n            if (s.browser.ie) {\n                touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);\n                target[action](s.touchEvents.move, s.onTouchMove, moveCapture);\n                target[action](s.touchEvents.end, s.onTouchEnd, false);\n            }\n            else {\n                if (s.support.touch) {\n                    touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);\n                    touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);\n                    touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, false);\n                }\n                if (params.simulateTouch && !s.device.ios && !s.device.android) {\n                    touchEventsTarget[action]('mousedown', s.onTouchStart, false);\n                    document[action]('mousemove', s.onTouchMove, moveCapture);\n                    document[action]('mouseup', s.onTouchEnd, false);\n                }\n            }\n            window[action]('resize', s.onResize);\n\n            // Next, Prev, Index\n            if (s.params.nextButton) {\n                $(s.params.nextButton)[actionDom]('click', s.onClickNext);\n                if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);\n            }\n            if (s.params.prevButton) {\n                $(s.params.prevButton)[actionDom]('click', s.onClickPrev);\n                if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);\n            }\n            if (s.params.pagination && s.params.paginationClickable) {\n                $(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);\n                if (s.params.a11y && s.a11y) $(s.paginationContainer)[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);\n            }\n\n            // Prevent Links Clicks\n            if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);\n        };\n        s.attachEvents = function (detach) {\n            s.initEvents();\n        };\n        s.detachEvents = function () {\n            s.initEvents(true);\n        };\n\n        /*=========================\n          Handle Clicks\n          ===========================*/\n        // Prevent Clicks\n        s.allowClick = true;\n        s.preventClicks = function (e) {\n            if (!s.allowClick) {\n                if (s.params.preventClicks) e.preventDefault();\n                if (s.params.preventClicksPropagation && s.animating) {\n                    e.stopPropagation();\n                    e.stopImmediatePropagation();\n                }\n            }\n        };\n        // Clicks\n        s.onClickNext = function (e) {\n            e.preventDefault();\n            if (s.isEnd && !s.params.loop) return;\n            s.slideNext();\n        };\n        s.onClickPrev = function (e) {\n            e.preventDefault();\n            if (s.isBeginning && !s.params.loop) return;\n            s.slidePrev();\n        };\n        s.onClickIndex = function (e) {\n            e.preventDefault();\n            var index = $(this).index() * s.params.slidesPerGroup;\n            if (s.params.loop) index = index + s.loopedSlides;\n            s.slideTo(index);\n        };\n\n        /*=========================\n          Handle Touches\n          ===========================*/\n        function findElementInEvent(e, selector) {\n            var el = $(e.target);\n            if (!el.is(selector)) {\n                if (typeof selector === 'string') {\n                    el = el.parents(selector);\n                }\n                else if (selector.nodeType) {\n                    var found;\n                    el.parents().each(function (index, _el) {\n                        if (_el === selector) found = selector;\n                    });\n                    if (!found) return undefined;\n                    else return selector;\n                }\n            }\n            if (el.length === 0) {\n                return undefined;\n            }\n            return el[0];\n        }\n        s.updateClickedSlide = function (e) {\n            var slide = findElementInEvent(e, '.' + s.params.slideClass);\n            var slideFound = false;\n            if (slide) {\n                for (var i = 0; i < s.slides.length; i++) {\n                    if (s.slides[i] === slide) slideFound = true;\n                }\n            }\n\n            if (slide && slideFound) {\n                s.clickedSlide = slide;\n                s.clickedIndex = $(slide).index();\n            }\n            else {\n                s.clickedSlide = undefined;\n                s.clickedIndex = undefined;\n                return;\n            }\n            if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {\n                var slideToIndex = s.clickedIndex,\n                    realIndex,\n                    duplicatedSlides;\n                if (s.params.loop) {\n                    if (s.animating) return;\n                    realIndex = $(s.clickedSlide).attr('data-swiper-slide-index');\n                    if (s.params.centeredSlides) {\n                        if ((slideToIndex < s.loopedSlides - s.params.slidesPerView/2) || (slideToIndex > s.slides.length - s.loopedSlides + s.params.slidesPerView/2)) {\n                            s.fixLoop();\n                            slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index=\"' + realIndex + '\"]:not(.swiper-slide-duplicate)').eq(0).index();\n                            setTimeout(function () {\n                                s.slideTo(slideToIndex);\n                            }, 0);\n                        }\n                        else {\n                            s.slideTo(slideToIndex);\n                        }\n                    }\n                    else {\n                        if (slideToIndex > s.slides.length - s.params.slidesPerView) {\n                            s.fixLoop();\n                            slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index=\"' + realIndex + '\"]:not(.swiper-slide-duplicate)').eq(0).index();\n                            setTimeout(function () {\n                                s.slideTo(slideToIndex);\n                            }, 0);\n                        }\n                        else {\n                            s.slideTo(slideToIndex);\n                        }\n                    }\n                }\n                else {\n                    s.slideTo(slideToIndex);\n                }\n            }\n        };\n\n        var isTouched,\n            isMoved,\n            allowTouchCallbacks,\n            touchStartTime,\n            isScrolling,\n            currentTranslate,\n            startTranslate,\n            allowThresholdMove,\n            // Form elements to match\n            formElements = 'input, select, textarea, button',\n            // Last click time\n            lastClickTime = Date.now(), clickTimeout,\n            //Velocities\n            velocities = [],\n            allowMomentumBounce;\n\n        // Animating Flag\n        s.animating = false;\n\n        // Touches information\n        s.touches = {\n            startX: 0,\n            startY: 0,\n            currentX: 0,\n            currentY: 0,\n            diff: 0\n        };\n\n        // Touch handlers\n        var isTouchEvent, startMoving;\n        s.onTouchStart = function (e) {\n            if (e.originalEvent) e = e.originalEvent;\n            isTouchEvent = e.type === 'touchstart';\n            if (!isTouchEvent && 'which' in e && e.which === 3) return;\n            if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {\n                s.allowClick = true;\n                return;\n            }\n            if (s.params.swipeHandler) {\n                if (!findElementInEvent(e, s.params.swipeHandler)) return;\n            }\n\n            var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n            var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n\n            // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore\n            if(s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {\n                return;\n            }\n\n            isTouched = true;\n            isMoved = false;\n            allowTouchCallbacks = true;\n            isScrolling = undefined;\n            startMoving = undefined;\n            s.touches.startX = startX;\n            s.touches.startY = startY;\n            touchStartTime = Date.now();\n            s.allowClick = true;\n            s.updateContainerSize();\n            s.swipeDirection = undefined;\n            if (s.params.threshold > 0) allowThresholdMove = false;\n            if (e.type !== 'touchstart') {\n                var preventDefault = true;\n                if ($(e.target).is(formElements)) preventDefault = false;\n                if (document.activeElement && $(document.activeElement).is(formElements)) {\n                    document.activeElement.blur();\n                }\n                if (preventDefault) {\n                    e.preventDefault();\n                }\n            }\n            s.emit('onTouchStart', s, e);\n        };\n\n        s.onTouchMove = function (e) {\n            if (e.originalEvent) e = e.originalEvent;\n            if (isTouchEvent && e.type === 'mousemove') return;\n            if (e.preventedByNestedSwiper) return;\n            if (s.params.onlyExternal) {\n                // isMoved = true;\n                s.allowClick = false;\n                if (isTouched) {\n                    s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n                    s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n                    touchStartTime = Date.now();\n                }\n                return;\n            }\n            if (isTouchEvent && document.activeElement) {\n                if (e.target === document.activeElement && $(e.target).is(formElements)) {\n                    isMoved = true;\n                    s.allowClick = false;\n                    return;\n                }\n            }\n            if (allowTouchCallbacks) {\n                s.emit('onTouchMove', s, e);\n            }\n            if (e.targetTouches && e.targetTouches.length > 1) return;\n\n            s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n            s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n\n            if (typeof isScrolling === 'undefined') {\n                var touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;\n                isScrolling = isH() ? touchAngle > s.params.touchAngle : (90 - touchAngle > s.params.touchAngle);\n            }\n            if (isScrolling) {\n                s.emit('onTouchMoveOpposite', s, e);\n            }\n            if (typeof startMoving === 'undefined' && s.browser.ieTouch) {\n                if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {\n                    startMoving = true;\n                }\n            }\n            if (!isTouched) return;\n            if (isScrolling)  {\n                isTouched = false;\n                return;\n            }\n            if (!startMoving && s.browser.ieTouch) {\n                return;\n            }\n            s.allowClick = false;\n            s.emit('onSliderMove', s, e);\n            e.preventDefault();\n            if (s.params.touchMoveStopPropagation && !s.params.nested) {\n                e.stopPropagation();\n            }\n\n            if (!isMoved) {\n                if (params.loop) {\n                    s.fixLoop();\n                }\n                startTranslate = s.getWrapperTranslate();\n                s.setWrapperTransition(0);\n                if (s.animating) {\n                    s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');\n                }\n                if (s.params.autoplay && s.autoplaying) {\n                    if (s.params.autoplayDisableOnInteraction) {\n                        s.stopAutoplay();\n                    }\n                    else {\n                        s.pauseAutoplay();\n                    }\n                }\n                allowMomentumBounce = false;\n                //Grab Cursor\n                if (s.params.grabCursor) {\n                    s.container[0].style.cursor = 'move';\n                    s.container[0].style.cursor = '-webkit-grabbing';\n                    s.container[0].style.cursor = '-moz-grabbin';\n                    s.container[0].style.cursor = 'grabbing';\n                }\n            }\n            isMoved = true;\n\n            var diff = s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;\n\n            diff = diff * s.params.touchRatio;\n            if (s.rtl) diff = -diff;\n\n            s.swipeDirection = diff > 0 ? 'prev' : 'next';\n            currentTranslate = diff + startTranslate;\n\n            var disableParentSwiper = true;\n            if ((diff > 0 && currentTranslate > s.minTranslate())) {\n                disableParentSwiper = false;\n                if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);\n            }\n            else if (diff < 0 && currentTranslate < s.maxTranslate()) {\n                disableParentSwiper = false;\n                if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);\n            }\n\n            if (disableParentSwiper) {\n                e.preventedByNestedSwiper = true;\n            }\n\n            // Directions locks\n            if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {\n                currentTranslate = startTranslate;\n            }\n            if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {\n                currentTranslate = startTranslate;\n            }\n\n            if (!s.params.followFinger) return;\n\n            // Threshold\n            if (s.params.threshold > 0) {\n                if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {\n                    if (!allowThresholdMove) {\n                        allowThresholdMove = true;\n                        s.touches.startX = s.touches.currentX;\n                        s.touches.startY = s.touches.currentY;\n                        currentTranslate = startTranslate;\n                        s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;\n                        return;\n                    }\n                }\n                else {\n                    currentTranslate = startTranslate;\n                    return;\n                }\n            }\n            // Update active index in free mode\n            if (s.params.freeMode || s.params.watchSlidesProgress) {\n                s.updateActiveIndex();\n            }\n            if (s.params.freeMode) {\n                //Velocity\n                if (velocities.length === 0) {\n                    velocities.push({\n                        position: s.touches[isH() ? 'startX' : 'startY'],\n                        time: touchStartTime\n                    });\n                }\n                velocities.push({\n                    position: s.touches[isH() ? 'currentX' : 'currentY'],\n                    time: (new window.Date()).getTime()\n                });\n            }\n            // Update progress\n            s.updateProgress(currentTranslate);\n            // Update translate\n            s.setWrapperTranslate(currentTranslate);\n        };\n        s.onTouchEnd = function (e) {\n            if (e.originalEvent) e = e.originalEvent;\n            if (allowTouchCallbacks) {\n                s.emit('onTouchEnd', s, e);\n            }\n            allowTouchCallbacks = false;\n            if (!isTouched) return;\n            //Return Grab Cursor\n            if (s.params.grabCursor && isMoved && isTouched) {\n                s.container[0].style.cursor = 'move';\n                s.container[0].style.cursor = '-webkit-grab';\n                s.container[0].style.cursor = '-moz-grab';\n                s.container[0].style.cursor = 'grab';\n            }\n\n            // Time diff\n            var touchEndTime = Date.now();\n            var timeDiff = touchEndTime - touchStartTime;\n\n            // Tap, doubleTap, Click\n            if (s.allowClick) {\n                s.updateClickedSlide(e);\n                s.emit('onTap', s, e);\n                if (timeDiff < 300 && (touchEndTime - lastClickTime) > 300) {\n                    if (clickTimeout) clearTimeout(clickTimeout);\n                    clickTimeout = setTimeout(function () {\n                        if (!s) return;\n                        if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {\n                            s.paginationContainer.toggleClass(s.params.paginationHiddenClass);\n                        }\n                        s.emit('onClick', s, e);\n                    }, 300);\n\n                }\n                if (timeDiff < 300 && (touchEndTime - lastClickTime) < 300) {\n                    if (clickTimeout) clearTimeout(clickTimeout);\n                    s.emit('onDoubleTap', s, e);\n                }\n            }\n\n            lastClickTime = Date.now();\n            setTimeout(function () {\n                if (s) s.allowClick = true;\n            }, 0);\n\n            if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {\n                isTouched = isMoved = false;\n                return;\n            }\n            isTouched = isMoved = false;\n\n            var currentPos;\n            if (s.params.followFinger) {\n                currentPos = s.rtl ? s.translate : -s.translate;\n            }\n            else {\n                currentPos = -currentTranslate;\n            }\n            if (s.params.freeMode) {\n                if (currentPos < -s.minTranslate()) {\n                    s.slideTo(s.activeIndex);\n                    return;\n                }\n                else if (currentPos > -s.maxTranslate()) {\n                    if (s.slides.length < s.snapGrid.length) {\n                        s.slideTo(s.snapGrid.length - 1);\n                    }\n                    else {\n                        s.slideTo(s.slides.length - 1);\n                    }\n                    return;\n                }\n\n                if (s.params.freeModeMomentum) {\n                    if (velocities.length > 1) {\n                        var lastMoveEvent = velocities.pop(), velocityEvent = velocities.pop();\n\n                        var distance = lastMoveEvent.position - velocityEvent.position;\n                        var time = lastMoveEvent.time - velocityEvent.time;\n                        s.velocity = distance / time;\n                        s.velocity = s.velocity / 2;\n                        if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {\n                            s.velocity = 0;\n                        }\n                        // this implies that the user stopped moving a finger then released.\n                        // There would be no events with distance zero, so the last event is stale.\n                        if (time > 150 || (new window.Date().getTime() - lastMoveEvent.time) > 300) {\n                            s.velocity = 0;\n                        }\n                    } else {\n                        s.velocity = 0;\n                    }\n\n                    velocities.length = 0;\n                    var momentumDuration = 1000 * s.params.freeModeMomentumRatio;\n                    var momentumDistance = s.velocity * momentumDuration;\n\n                    var newPosition = s.translate + momentumDistance;\n                    if (s.rtl) newPosition = - newPosition;\n                    var doBounce = false;\n                    var afterBouncePosition;\n                    var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;\n                    if (newPosition < s.maxTranslate()) {\n                        if (s.params.freeModeMomentumBounce) {\n                            if (newPosition + s.maxTranslate() < -bounceAmount) {\n                                newPosition = s.maxTranslate() - bounceAmount;\n                            }\n                            afterBouncePosition = s.maxTranslate();\n                            doBounce = true;\n                            allowMomentumBounce = true;\n                        }\n                        else {\n                            newPosition = s.maxTranslate();\n                        }\n                    }\n                    else if (newPosition > s.minTranslate()) {\n                        if (s.params.freeModeMomentumBounce) {\n                            if (newPosition - s.minTranslate() > bounceAmount) {\n                                newPosition = s.minTranslate() + bounceAmount;\n                            }\n                            afterBouncePosition = s.minTranslate();\n                            doBounce = true;\n                            allowMomentumBounce = true;\n                        }\n                        else {\n                            newPosition = s.minTranslate();\n                        }\n                    }\n                    else if (s.params.freeModeSticky) {\n                        var j = 0,\n                            nextSlide;\n                        for (j = 0; j < s.snapGrid.length; j += 1) {\n                            if (s.snapGrid[j] > -newPosition) {\n                                nextSlide = j;\n                                break;\n                            }\n\n                        }\n                        if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {\n                            newPosition = s.snapGrid[nextSlide];\n                        } else {\n                            newPosition = s.snapGrid[nextSlide - 1];\n                        }\n                        if (!s.rtl) newPosition = - newPosition;\n                    }\n                    //Fix duration\n                    if (s.velocity !== 0) {\n                        if (s.rtl) {\n                            momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);\n                        }\n                        else {\n                            momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);\n                        }\n                    }\n                    else if (s.params.freeModeSticky) {\n                        s.slideReset();\n                        return;\n                    }\n\n                    if (s.params.freeModeMomentumBounce && doBounce) {\n                        s.updateProgress(afterBouncePosition);\n                        s.setWrapperTransition(momentumDuration);\n                        s.setWrapperTranslate(newPosition);\n                        s.onTransitionStart();\n                        s.animating = true;\n                        s.wrapper.transitionEnd(function () {\n                            if (!s || !allowMomentumBounce) return;\n                            s.emit('onMomentumBounce', s);\n\n                            s.setWrapperTransition(s.params.speed);\n                            s.setWrapperTranslate(afterBouncePosition);\n                            s.wrapper.transitionEnd(function () {\n                                if (!s) return;\n                                s.onTransitionEnd();\n                            });\n                        });\n                    } else if (s.velocity) {\n                        s.updateProgress(newPosition);\n                        s.setWrapperTransition(momentumDuration);\n                        s.setWrapperTranslate(newPosition);\n                        s.onTransitionStart();\n                        if (!s.animating) {\n                            s.animating = true;\n                            s.wrapper.transitionEnd(function () {\n                                if (!s) return;\n                                s.onTransitionEnd();\n                            });\n                        }\n\n                    } else {\n                        s.updateProgress(newPosition);\n                    }\n\n                    s.updateActiveIndex();\n                }\n                if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {\n                    s.updateProgress();\n                    s.updateActiveIndex();\n                }\n                return;\n            }\n\n            // Find current slide\n            var i, stopIndex = 0, groupSize = s.slidesSizesGrid[0];\n            for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {\n                if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {\n                    if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {\n                        stopIndex = i;\n                        groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];\n                    }\n                }\n                else {\n                    if (currentPos >= s.slidesGrid[i]) {\n                        stopIndex = i;\n                        groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];\n                    }\n                }\n            }\n\n            // Find current slide size\n            var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;\n\n            if (timeDiff > s.params.longSwipesMs) {\n                // Long touches\n                if (!s.params.longSwipes) {\n                    s.slideTo(s.activeIndex);\n                    return;\n                }\n                if (s.swipeDirection === 'next') {\n                    if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);\n                    else s.slideTo(stopIndex);\n\n                }\n                if (s.swipeDirection === 'prev') {\n                    if (ratio > (1 - s.params.longSwipesRatio)) s.slideTo(stopIndex + s.params.slidesPerGroup);\n                    else s.slideTo(stopIndex);\n                }\n            }\n            else {\n                // Short swipes\n                if (!s.params.shortSwipes) {\n                    s.slideTo(s.activeIndex);\n                    return;\n                }\n                if (s.swipeDirection === 'next') {\n                    s.slideTo(stopIndex + s.params.slidesPerGroup);\n\n                }\n                if (s.swipeDirection === 'prev') {\n                    s.slideTo(stopIndex);\n                }\n            }\n        };\n        /*=========================\n          Transitions\n          ===========================*/\n        s._slideTo = function (slideIndex, speed) {\n            return s.slideTo(slideIndex, speed, true, true);\n        };\n        s.slideTo = function (slideIndex, speed, runCallbacks, internal) {\n            if (typeof runCallbacks === 'undefined') runCallbacks = true;\n            if (typeof slideIndex === 'undefined') slideIndex = 0;\n            if (slideIndex < 0) slideIndex = 0;\n            s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);\n            if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;\n\n            var translate = - s.snapGrid[s.snapIndex];\n            // Stop autoplay\n            if (s.params.autoplay && s.autoplaying) {\n                if (internal || !s.params.autoplayDisableOnInteraction) {\n                    s.pauseAutoplay(speed);\n                }\n                else {\n                    s.stopAutoplay();\n                }\n            }\n            // Update progress\n            s.updateProgress(translate);\n\n            // Normalize slideIndex\n            for (var i = 0; i < s.slidesGrid.length; i++) {\n                if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {\n                    slideIndex = i;\n                }\n            }\n\n            // Directions locks\n            if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {\n                return false;\n            }\n            if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {\n                if ((s.activeIndex || 0) !== slideIndex ) return false;\n            }\n\n            // Update Index\n            if (typeof speed === 'undefined') speed = s.params.speed;\n            s.previousIndex = s.activeIndex || 0;\n            s.activeIndex = slideIndex;\n\n            if ((s.rtl && -translate === s.translate) || (!s.rtl && translate === s.translate)) {\n                // Update Height\n                if (s.params.autoHeight) {\n                    s.updateAutoHeight();\n                }\n                s.updateClasses();\n                if (s.params.effect !== 'slide') {\n                    s.setWrapperTranslate(translate);\n                }\n                return false;\n            }\n            s.updateClasses();\n            s.onTransitionStart(runCallbacks);\n\n            if (speed === 0) {\n                s.setWrapperTranslate(translate);\n                s.setWrapperTransition(0);\n                s.onTransitionEnd(runCallbacks);\n            }\n            else {\n                s.setWrapperTranslate(translate);\n                s.setWrapperTransition(speed);\n                if (!s.animating) {\n                    s.animating = true;\n                    s.wrapper.transitionEnd(function () {\n                        if (!s) return;\n                        s.onTransitionEnd(runCallbacks);\n                    });\n                }\n\n            }\n\n            return true;\n        };\n\n        s.onTransitionStart = function (runCallbacks) {\n            if (typeof runCallbacks === 'undefined') runCallbacks = true;\n            if (s.params.autoHeight) {\n                s.updateAutoHeight();\n            }\n            if (s.lazy) s.lazy.onTransitionStart();\n            if (runCallbacks) {\n                s.emit('onTransitionStart', s);\n                if (s.activeIndex !== s.previousIndex) {\n                    s.emit('onSlideChangeStart', s);\n                    _scope.$emit(\"$ionicSlides.slideChangeStart\", {\n                      slider: s,\n                      activeIndex: s.getSlideDataIndex(s.activeIndex),\n                      previousIndex: s.getSlideDataIndex(s.previousIndex)\n                    });\n                    if (s.activeIndex > s.previousIndex) {\n                        s.emit('onSlideNextStart', s);\n                    }\n                    else {\n                        s.emit('onSlidePrevStart', s);\n                    }\n                }\n\n            }\n        };\n        s.onTransitionEnd = function (runCallbacks) {\n            s.animating = false;\n            s.setWrapperTransition(0);\n            if (typeof runCallbacks === 'undefined') runCallbacks = true;\n            if (s.lazy) s.lazy.onTransitionEnd();\n            if (runCallbacks) {\n                s.emit('onTransitionEnd', s);\n                if (s.activeIndex !== s.previousIndex) {\n                    s.emit('onSlideChangeEnd', s);\n                    _scope.$emit(\"$ionicSlides.slideChangeEnd\", {\n                      slider: s,\n                      activeIndex: s.getSlideDataIndex(s.activeIndex),\n                      previousIndex: s.getSlideDataIndex(s.previousIndex)\n                    });\n                    if (s.activeIndex > s.previousIndex) {\n                        s.emit('onSlideNextEnd', s);\n                    }\n                    else {\n                        s.emit('onSlidePrevEnd', s);\n                    }\n                }\n            }\n            if (s.params.hashnav && s.hashnav) {\n                s.hashnav.setHash();\n            }\n\n        };\n        s.slideNext = function (runCallbacks, speed, internal) {\n            if (s.params.loop) {\n                if (s.animating) return false;\n                s.fixLoop();\n                var clientLeft = s.container[0].clientLeft;\n                return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);\n            }\n            else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);\n        };\n        s._slideNext = function (speed) {\n            return s.slideNext(true, speed, true);\n        };\n        s.slidePrev = function (runCallbacks, speed, internal) {\n            if (s.params.loop) {\n                if (s.animating) return false;\n                s.fixLoop();\n                var clientLeft = s.container[0].clientLeft;\n                return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);\n            }\n            else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);\n        };\n        s._slidePrev = function (speed) {\n            return s.slidePrev(true, speed, true);\n        };\n        s.slideReset = function (runCallbacks, speed, internal) {\n            return s.slideTo(s.activeIndex, speed, runCallbacks);\n        };\n\n        /*=========================\n          Translate/transition helpers\n          ===========================*/\n        s.setWrapperTransition = function (duration, byController) {\n            s.wrapper.transition(duration);\n            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n                s.effects[s.params.effect].setTransition(duration);\n            }\n            if (s.params.parallax && s.parallax) {\n                s.parallax.setTransition(duration);\n            }\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.setTransition(duration);\n            }\n            if (s.params.control && s.controller) {\n                s.controller.setTransition(duration, byController);\n            }\n            s.emit('onSetTransition', s, duration);\n        };\n        s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {\n            var x = 0, y = 0, z = 0;\n            if (isH()) {\n                x = s.rtl ? -translate : translate;\n            }\n            else {\n                y = translate;\n            }\n\n            if (s.params.roundLengths) {\n                x = round(x);\n                y = round(y);\n            }\n\n            if (!s.params.virtualTranslate) {\n                if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');\n                else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');\n            }\n\n            s.translate = isH() ? x : y;\n\n            // Check if we need to update progress\n            var progress;\n            var translatesDiff = s.maxTranslate() - s.minTranslate();\n            if (translatesDiff === 0) {\n                progress = 0;\n            }\n            else {\n                progress = (translate - s.minTranslate()) / (translatesDiff);\n            }\n            if (progress !== s.progress) {\n                s.updateProgress(translate);\n            }\n\n            if (updateActiveIndex) s.updateActiveIndex();\n            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n                s.effects[s.params.effect].setTranslate(s.translate);\n            }\n            if (s.params.parallax && s.parallax) {\n                s.parallax.setTranslate(s.translate);\n            }\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.setTranslate(s.translate);\n            }\n            if (s.params.control && s.controller) {\n                s.controller.setTranslate(s.translate, byController);\n            }\n            s.emit('onSetTranslate', s, s.translate);\n        };\n\n        s.getTranslate = function (el, axis) {\n            var matrix, curTransform, curStyle, transformMatrix;\n\n            // automatic axis detection\n            if (typeof axis === 'undefined') {\n                axis = 'x';\n            }\n\n            if (s.params.virtualTranslate) {\n                return s.rtl ? -s.translate : s.translate;\n            }\n\n            curStyle = window.getComputedStyle(el, null);\n            if (window.WebKitCSSMatrix) {\n                curTransform = curStyle.transform || curStyle.webkitTransform;\n                if (curTransform.split(',').length > 6) {\n                    curTransform = curTransform.split(', ').map(function(a){\n                        return a.replace(',','.');\n                    }).join(', ');\n                }\n                // Some old versions of Webkit choke when 'none' is passed; pass\n                // empty string instead in this case\n                transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);\n            }\n            else {\n                transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform  || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');\n                matrix = transformMatrix.toString().split(',');\n            }\n\n            if (axis === 'x') {\n                //Latest Chrome and webkits Fix\n                if (window.WebKitCSSMatrix)\n                    curTransform = transformMatrix.m41;\n                //Crazy IE10 Matrix\n                else if (matrix.length === 16)\n                    curTransform = parseFloat(matrix[12]);\n                //Normal Browsers\n                else\n                    curTransform = parseFloat(matrix[4]);\n            }\n            if (axis === 'y') {\n                //Latest Chrome and webkits Fix\n                if (window.WebKitCSSMatrix)\n                    curTransform = transformMatrix.m42;\n                //Crazy IE10 Matrix\n                else if (matrix.length === 16)\n                    curTransform = parseFloat(matrix[13]);\n                //Normal Browsers\n                else\n                    curTransform = parseFloat(matrix[5]);\n            }\n            if (s.rtl && curTransform) curTransform = -curTransform;\n            return curTransform || 0;\n        };\n        s.getWrapperTranslate = function (axis) {\n            if (typeof axis === 'undefined') {\n                axis = isH() ? 'x' : 'y';\n            }\n            return s.getTranslate(s.wrapper[0], axis);\n        };\n\n        /*=========================\n          Observer\n          ===========================*/\n        s.observers = [];\n        function initObserver(target, options) {\n            options = options || {};\n            // create an observer instance\n            var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;\n            var observer = new ObserverFunc(function (mutations) {\n                mutations.forEach(function (mutation) {\n                    s.onResize(true);\n                    s.emit('onObserverUpdate', s, mutation);\n                });\n            });\n\n            observer.observe(target, {\n                attributes: typeof options.attributes === 'undefined' ? true : options.attributes,\n                childList: typeof options.childList === 'undefined' ? true : options.childList,\n                characterData: typeof options.characterData === 'undefined' ? true : options.characterData\n            });\n\n            s.observers.push(observer);\n        }\n        s.initObservers = function () {\n            if (s.params.observeParents) {\n                var containerParents = s.container.parents();\n                for (var i = 0; i < containerParents.length; i++) {\n                    initObserver(containerParents[i]);\n                }\n            }\n\n            // Observe container\n            initObserver(s.container[0], {childList: false});\n\n            // Observe wrapper\n            initObserver(s.wrapper[0], {attributes: false});\n        };\n        s.disconnectObservers = function () {\n            for (var i = 0; i < s.observers.length; i++) {\n                s.observers[i].disconnect();\n            }\n            s.observers = [];\n        };\n\n        s.updateLoop = function(){\n          var currentSlide = s.slides.eq(s.activeIndex);\n          if ( angular.element(currentSlide).hasClass(s.params.slideDuplicateClass) ){\n            // we're on a duplicate, so slide to the non-duplicate\n            var swiperSlideIndex = angular.element(currentSlide).attr(\"data-swiper-slide-index\");\n            var slides = s.wrapper.children('.' + s.params.slideClass);\n            for ( var i = 0; i < slides.length; i++ ){\n              if ( !angular.element(slides[i]).hasClass(s.params.slideDuplicateClass) && angular.element(slides[i]).attr(\"data-swiper-slide-index\") === swiperSlideIndex ){\n                s.slideTo(i, 0, false, true);\n                break;\n              }\n            }\n            // if we needed to switch slides, we did that.  So, now call the createLoop function internally\n            setTimeout(function(){\n              s.createLoop();\n            }, 50);\n          }\n        }\n\n        s.getSlideDataIndex = function(slideIndex){\n          // this is an Ionic custom function\n          // Swiper loops utilize duplicate DOM elements for slides when in a loop\n          // which means that we cannot rely on the actual slide index for our events\n          // because index 0 does not necessarily point to index 0\n          // and index n+1 does not necessarily point to the expected piece of data\n          // therefore, rather than using the actual slide index we should\n          // use the data index that swiper includes as an attribute on the dom elements\n          // because this is what will be meaningful to the consumer of our events\n          var slide = s.slides.eq(slideIndex);\n          var attributeIndex = angular.element(slide).attr(\"data-swiper-slide-index\");\n          return parseInt(attributeIndex);\n        }\n\n        /*=========================\n          Loop\n          ===========================*/\n        // Create looped slides\n        s.createLoop = function () {\n          //console.log(\"Slider create loop method\");\n            //var toRemove = s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass);\n            //angular.element(toRemove).remove();\n            s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();\n\n            var slides = s.wrapper.children('.' + s.params.slideClass);\n\n            if(s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;\n\n            s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);\n            s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;\n            if (s.loopedSlides > slides.length) {\n                s.loopedSlides = slides.length;\n            }\n\n            var prependSlides = [], appendSlides = [], i, scope, newNode;\n            slides.each(function (index, el) {\n                var slide = $(this);\n                if (index < s.loopedSlides) appendSlides.push(el);\n                if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);\n                slide.attr('data-swiper-slide-index', index);\n            });\n            for (i = 0; i < appendSlides.length; i++) {\n\n              newNode = angular.element(appendSlides[i]).clone().addClass(s.params.slideDuplicateClass);\n              newNode.removeAttr('ng-transclude');\n              newNode.removeAttr('ng-repeat');\n              scope = angular.element(appendSlides[i]).scope();\n              newNode = $compile(newNode)(scope);\n              angular.element(s.wrapper).append(newNode);\n              //s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));\n            }\n            for (i = prependSlides.length - 1; i >= 0; i--) {\n              //s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));\n\n              newNode = angular.element(prependSlides[i]).clone().addClass(s.params.slideDuplicateClass);\n              newNode.removeAttr('ng-transclude');\n              newNode.removeAttr('ng-repeat');\n\n              scope = angular.element(prependSlides[i]).scope();\n              newNode = $compile(newNode)(scope);\n              angular.element(s.wrapper).prepend(newNode);\n            }\n        };\n        s.destroyLoop = function () {\n            s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();\n            s.slides.removeAttr('data-swiper-slide-index');\n        };\n        s.fixLoop = function () {\n            var newIndex;\n            //Fix For Negative Oversliding\n            if (s.activeIndex < s.loopedSlides) {\n                newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;\n                newIndex = newIndex + s.loopedSlides;\n                s.slideTo(newIndex, 0, false, true);\n            }\n            //Fix For Positive Oversliding\n            else if ((s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2) || (s.activeIndex > s.slides.length - s.params.slidesPerView * 2)) {\n                newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;\n                newIndex = newIndex + s.loopedSlides;\n                s.slideTo(newIndex, 0, false, true);\n            }\n        };\n        /*=========================\n          Append/Prepend/Remove Slides\n          ===========================*/\n        s.appendSlide = function (slides) {\n            if (s.params.loop) {\n                s.destroyLoop();\n            }\n            if (typeof slides === 'object' && slides.length) {\n                for (var i = 0; i < slides.length; i++) {\n                    if (slides[i]) s.wrapper.append(slides[i]);\n                }\n            }\n            else {\n                s.wrapper.append(slides);\n            }\n            if (s.params.loop) {\n                s.createLoop();\n            }\n            if (!(s.params.observer && s.support.observer)) {\n                s.update(true);\n            }\n        };\n        s.prependSlide = function (slides) {\n            if (s.params.loop) {\n                s.destroyLoop();\n            }\n            var newActiveIndex = s.activeIndex + 1;\n            if (typeof slides === 'object' && slides.length) {\n                for (var i = 0; i < slides.length; i++) {\n                    if (slides[i]) s.wrapper.prepend(slides[i]);\n                }\n                newActiveIndex = s.activeIndex + slides.length;\n            }\n            else {\n                s.wrapper.prepend(slides);\n            }\n            if (s.params.loop) {\n                s.createLoop();\n            }\n            if (!(s.params.observer && s.support.observer)) {\n                s.update(true);\n            }\n            s.slideTo(newActiveIndex, 0, false);\n        };\n        s.removeSlide = function (slidesIndexes) {\n            if (s.params.loop) {\n                s.destroyLoop();\n                s.slides = s.wrapper.children('.' + s.params.slideClass);\n            }\n            var newActiveIndex = s.activeIndex,\n                indexToRemove;\n            if (typeof slidesIndexes === 'object' && slidesIndexes.length) {\n                for (var i = 0; i < slidesIndexes.length; i++) {\n                    indexToRemove = slidesIndexes[i];\n                    if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();\n                    if (indexToRemove < newActiveIndex) newActiveIndex--;\n                }\n                newActiveIndex = Math.max(newActiveIndex, 0);\n            }\n            else {\n                indexToRemove = slidesIndexes;\n                if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();\n                if (indexToRemove < newActiveIndex) newActiveIndex--;\n                newActiveIndex = Math.max(newActiveIndex, 0);\n            }\n\n            if (s.params.loop) {\n                s.createLoop();\n            }\n\n            if (!(s.params.observer && s.support.observer)) {\n                s.update(true);\n            }\n            if (s.params.loop) {\n                s.slideTo(newActiveIndex + s.loopedSlides, 0, false);\n            }\n            else {\n                s.slideTo(newActiveIndex, 0, false);\n            }\n\n        };\n        s.removeAllSlides = function () {\n            var slidesIndexes = [];\n            for (var i = 0; i < s.slides.length; i++) {\n                slidesIndexes.push(i);\n            }\n            s.removeSlide(slidesIndexes);\n        };\n\n\n        /*=========================\n          Effects\n          ===========================*/\n        s.effects = {\n            fade: {\n                setTranslate: function () {\n                    for (var i = 0; i < s.slides.length; i++) {\n                        var slide = s.slides.eq(i);\n                        var offset = slide[0].swiperSlideOffset;\n                        var tx = -offset;\n                        if (!s.params.virtualTranslate) tx = tx - s.translate;\n                        var ty = 0;\n                        if (!isH()) {\n                            ty = tx;\n                            tx = 0;\n                        }\n                        var slideOpacity = s.params.fade.crossFade ?\n                                Math.max(1 - Math.abs(slide[0].progress), 0) :\n                                1 + Math.min(Math.max(slide[0].progress, -1), 0);\n                        slide\n                            .css({\n                                opacity: slideOpacity\n                            })\n                            .transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');\n\n                    }\n\n                },\n                setTransition: function (duration) {\n                    s.slides.transition(duration);\n                    if (s.params.virtualTranslate && duration !== 0) {\n                        var eventTriggered = false;\n                        s.slides.transitionEnd(function () {\n                            if (eventTriggered) return;\n                            if (!s) return;\n                            eventTriggered = true;\n                            s.animating = false;\n                            var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];\n                            for (var i = 0; i < triggerEvents.length; i++) {\n                                s.wrapper.trigger(triggerEvents[i]);\n                            }\n                        });\n                    }\n                }\n            },\n            cube: {\n                setTranslate: function () {\n                    var wrapperRotate = 0, cubeShadow;\n                    if (s.params.cube.shadow) {\n                        if (isH()) {\n                            cubeShadow = s.wrapper.find('.swiper-cube-shadow');\n                            if (cubeShadow.length === 0) {\n                                cubeShadow = $('<div class=\"swiper-cube-shadow\"></div>');\n                                s.wrapper.append(cubeShadow);\n                            }\n                            cubeShadow.css({height: s.width + 'px'});\n                        }\n                        else {\n                            cubeShadow = s.container.find('.swiper-cube-shadow');\n                            if (cubeShadow.length === 0) {\n                                cubeShadow = $('<div class=\"swiper-cube-shadow\"></div>');\n                                s.container.append(cubeShadow);\n                            }\n                        }\n                    }\n                    for (var i = 0; i < s.slides.length; i++) {\n                        var slide = s.slides.eq(i);\n                        var slideAngle = i * 90;\n                        var round = Math.floor(slideAngle / 360);\n                        if (s.rtl) {\n                            slideAngle = -slideAngle;\n                            round = Math.floor(-slideAngle / 360);\n                        }\n                        var progress = Math.max(Math.min(slide[0].progress, 1), -1);\n                        var tx = 0, ty = 0, tz = 0;\n                        if (i % 4 === 0) {\n                            tx = - round * 4 * s.size;\n                            tz = 0;\n                        }\n                        else if ((i - 1) % 4 === 0) {\n                            tx = 0;\n                            tz = - round * 4 * s.size;\n                        }\n                        else if ((i - 2) % 4 === 0) {\n                            tx = s.size + round * 4 * s.size;\n                            tz = s.size;\n                        }\n                        else if ((i - 3) % 4 === 0) {\n                            tx = - s.size;\n                            tz = 3 * s.size + s.size * 4 * round;\n                        }\n                        if (s.rtl) {\n                            tx = -tx;\n                        }\n\n                        if (!isH()) {\n                            ty = tx;\n                            tx = 0;\n                        }\n\n                        var transform = 'rotateX(' + (isH() ? 0 : -slideAngle) + 'deg) rotateY(' + (isH() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';\n                        if (progress <= 1 && progress > -1) {\n                            wrapperRotate = i * 90 + progress * 90;\n                            if (s.rtl) wrapperRotate = -i * 90 - progress * 90;\n                        }\n                        slide.transform(transform);\n                        if (s.params.cube.slideShadows) {\n                            //Set shadows\n                            var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');\n                            var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');\n                            if (shadowBefore.length === 0) {\n                                shadowBefore = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '\"></div>');\n                                slide.append(shadowBefore);\n                            }\n                            if (shadowAfter.length === 0) {\n                                shadowAfter = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '\"></div>');\n                                slide.append(shadowAfter);\n                            }\n                            var shadowOpacity = slide[0].progress;\n                            if (shadowBefore.length) shadowBefore[0].style.opacity = -slide[0].progress;\n                            if (shadowAfter.length) shadowAfter[0].style.opacity = slide[0].progress;\n                        }\n                    }\n                    s.wrapper.css({\n                        '-webkit-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n                        '-moz-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n                        '-ms-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n                        'transform-origin': '50% 50% -' + (s.size / 2) + 'px'\n                    });\n\n                    if (s.params.cube.shadow) {\n                        if (isH()) {\n                            cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + (-s.width / 2) + 'px) rotateX(90deg) rotateZ(0deg) scale(' + (s.params.cube.shadowScale) + ')');\n                        }\n                        else {\n                            var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;\n                            var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);\n                            var scale1 = s.params.cube.shadowScale,\n                                scale2 = s.params.cube.shadowScale / multiplier,\n                                offset = s.params.cube.shadowOffset;\n                            cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + (-s.height / 2 / scale2) + 'px) rotateX(-90deg)');\n                        }\n                    }\n                    var zFactor = (s.isSafari || s.isUiWebView) ? (-s.size / 2) : 0;\n                    s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (isH() ? 0 : wrapperRotate) + 'deg) rotateY(' + (isH() ? -wrapperRotate : 0) + 'deg)');\n                },\n                setTransition: function (duration) {\n                    s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);\n                    if (s.params.cube.shadow && !isH()) {\n                        s.container.find('.swiper-cube-shadow').transition(duration);\n                    }\n                }\n            },\n            coverflow: {\n                setTranslate: function () {\n                    var transform = s.translate;\n                    var center = isH() ? -transform + s.width / 2 : -transform + s.height / 2;\n                    var rotate = isH() ? s.params.coverflow.rotate: -s.params.coverflow.rotate;\n                    var translate = s.params.coverflow.depth;\n                    //Each slide offset from center\n                    for (var i = 0, length = s.slides.length; i < length; i++) {\n                        var slide = s.slides.eq(i);\n                        var slideSize = s.slidesSizesGrid[i];\n                        var slideOffset = slide[0].swiperSlideOffset;\n                        var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;\n\n                        var rotateY = isH() ? rotate * offsetMultiplier : 0;\n                        var rotateX = isH() ? 0 : rotate * offsetMultiplier;\n                        // var rotateZ = 0\n                        var translateZ = -translate * Math.abs(offsetMultiplier);\n\n                        var translateY = isH() ? 0 : s.params.coverflow.stretch * (offsetMultiplier);\n                        var translateX = isH() ? s.params.coverflow.stretch * (offsetMultiplier) : 0;\n\n                        //Fix for ultra small values\n                        if (Math.abs(translateX) < 0.001) translateX = 0;\n                        if (Math.abs(translateY) < 0.001) translateY = 0;\n                        if (Math.abs(translateZ) < 0.001) translateZ = 0;\n                        if (Math.abs(rotateY) < 0.001) rotateY = 0;\n                        if (Math.abs(rotateX) < 0.001) rotateX = 0;\n\n                        var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px)  rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';\n\n                        slide.transform(slideTransform);\n                        slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;\n                        if (s.params.coverflow.slideShadows) {\n                            //Set shadows\n                            var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');\n                            var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');\n                            if (shadowBefore.length === 0) {\n                                shadowBefore = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '\"></div>');\n                                slide.append(shadowBefore);\n                            }\n                            if (shadowAfter.length === 0) {\n                                shadowAfter = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '\"></div>');\n                                slide.append(shadowAfter);\n                            }\n                            if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;\n                            if (shadowAfter.length) shadowAfter[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0;\n                        }\n                    }\n\n                    //Set correct perspective for IE10\n                    if (s.browser.ie) {\n                        var ws = s.wrapper[0].style;\n                        ws.perspectiveOrigin = center + 'px 50%';\n                    }\n                },\n                setTransition: function (duration) {\n                    s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);\n                }\n            }\n        };\n\n        /*=========================\n          Images Lazy Loading\n          ===========================*/\n        s.lazy = {\n            initialImageLoaded: false,\n            loadImageInSlide: function (index, loadInDuplicate) {\n                if (typeof index === 'undefined') return;\n                if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;\n                if (s.slides.length === 0) return;\n\n                var slide = s.slides.eq(index);\n                var img = slide.find('.swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)');\n                if (slide.hasClass('swiper-lazy') && !slide.hasClass('swiper-lazy-loaded') && !slide.hasClass('swiper-lazy-loading')) {\n                    img = img.add(slide[0]);\n                }\n                if (img.length === 0) return;\n\n                img.each(function () {\n                    var _img = $(this);\n                    _img.addClass('swiper-lazy-loading');\n                    var background = _img.attr('data-background');\n                    var src = _img.attr('data-src'),\n                        srcset = _img.attr('data-srcset');\n                    s.loadImage(_img[0], (src || background), srcset, false, function () {\n                        if (background) {\n                            _img.css('background-image', 'url(' + background + ')');\n                            _img.removeAttr('data-background');\n                        }\n                        else {\n                            if (srcset) {\n                                _img.attr('srcset', srcset);\n                                _img.removeAttr('data-srcset');\n                            }\n                            if (src) {\n                                _img.attr('src', src);\n                                _img.removeAttr('data-src');\n                            }\n\n                        }\n\n                        _img.addClass('swiper-lazy-loaded').removeClass('swiper-lazy-loading');\n                        slide.find('.swiper-lazy-preloader, .preloader').remove();\n                        if (s.params.loop && loadInDuplicate) {\n                            var slideOriginalIndex = slide.attr('data-swiper-slide-index');\n                            if (slide.hasClass(s.params.slideDuplicateClass)) {\n                                var originalSlide = s.wrapper.children('[data-swiper-slide-index=\"' + slideOriginalIndex + '\"]:not(.' + s.params.slideDuplicateClass + ')');\n                                s.lazy.loadImageInSlide(originalSlide.index(), false);\n                            }\n                            else {\n                                var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index=\"' + slideOriginalIndex + '\"]');\n                                s.lazy.loadImageInSlide(duplicatedSlide.index(), false);\n                            }\n                        }\n                        s.emit('onLazyImageReady', s, slide[0], _img[0]);\n                    });\n\n                    s.emit('onLazyImageLoad', s, slide[0], _img[0]);\n                });\n\n            },\n            load: function () {\n                var i;\n                if (s.params.watchSlidesVisibility) {\n                    s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {\n                        s.lazy.loadImageInSlide($(this).index());\n                    });\n                }\n                else {\n                    if (s.params.slidesPerView > 1) {\n                        for (i = s.activeIndex; i < s.activeIndex + s.params.slidesPerView ; i++) {\n                            if (s.slides[i]) s.lazy.loadImageInSlide(i);\n                        }\n                    }\n                    else {\n                        s.lazy.loadImageInSlide(s.activeIndex);\n                    }\n                }\n                if (s.params.lazyLoadingInPrevNext) {\n                    if (s.params.slidesPerView > 1) {\n                        // Next Slides\n                        for (i = s.activeIndex + s.params.slidesPerView; i < s.activeIndex + s.params.slidesPerView + s.params.slidesPerView; i++) {\n                            if (s.slides[i]) s.lazy.loadImageInSlide(i);\n                        }\n                        // Prev Slides\n                        for (i = s.activeIndex - s.params.slidesPerView; i < s.activeIndex ; i++) {\n                            if (s.slides[i]) s.lazy.loadImageInSlide(i);\n                        }\n                    }\n                    else {\n                        var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);\n                        if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());\n\n                        var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);\n                        if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());\n                    }\n                }\n            },\n            onTransitionStart: function () {\n                if (s.params.lazyLoading) {\n                    if (s.params.lazyLoadingOnTransitionStart || (!s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded)) {\n                        s.lazy.load();\n                    }\n                }\n            },\n            onTransitionEnd: function () {\n                if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {\n                    s.lazy.load();\n                }\n            }\n        };\n\n\n        /*=========================\n          Scrollbar\n          ===========================*/\n        s.scrollbar = {\n            isTouched: false,\n            setDragPosition: function (e) {\n                var sb = s.scrollbar;\n                var x = 0, y = 0;\n                var translate;\n                var pointerPosition = isH() ?\n                    ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageX : e.pageX || e.clientX) :\n                    ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageY : e.pageY || e.clientY) ;\n                var position = (pointerPosition) - sb.track.offset()[isH() ? 'left' : 'top'] - sb.dragSize / 2;\n                var positionMin = -s.minTranslate() * sb.moveDivider;\n                var positionMax = -s.maxTranslate() * sb.moveDivider;\n                if (position < positionMin) {\n                    position = positionMin;\n                }\n                else if (position > positionMax) {\n                    position = positionMax;\n                }\n                position = -position / sb.moveDivider;\n                s.updateProgress(position);\n                s.setWrapperTranslate(position, true);\n            },\n            dragStart: function (e) {\n                var sb = s.scrollbar;\n                sb.isTouched = true;\n                e.preventDefault();\n                e.stopPropagation();\n\n                sb.setDragPosition(e);\n                clearTimeout(sb.dragTimeout);\n\n                sb.track.transition(0);\n                if (s.params.scrollbarHide) {\n                    sb.track.css('opacity', 1);\n                }\n                s.wrapper.transition(100);\n                sb.drag.transition(100);\n                s.emit('onScrollbarDragStart', s);\n            },\n            dragMove: function (e) {\n                var sb = s.scrollbar;\n                if (!sb.isTouched) return;\n                if (e.preventDefault) e.preventDefault();\n                else e.returnValue = false;\n                sb.setDragPosition(e);\n                s.wrapper.transition(0);\n                sb.track.transition(0);\n                sb.drag.transition(0);\n                s.emit('onScrollbarDragMove', s);\n            },\n            dragEnd: function (e) {\n                var sb = s.scrollbar;\n                if (!sb.isTouched) return;\n                sb.isTouched = false;\n                if (s.params.scrollbarHide) {\n                    clearTimeout(sb.dragTimeout);\n                    sb.dragTimeout = setTimeout(function () {\n                        sb.track.css('opacity', 0);\n                        sb.track.transition(400);\n                    }, 1000);\n\n                }\n                s.emit('onScrollbarDragEnd', s);\n                if (s.params.scrollbarSnapOnRelease) {\n                    s.slideReset();\n                }\n            },\n            enableDraggable: function () {\n                var sb = s.scrollbar;\n                var target = s.support.touch ? sb.track : document;\n                $(sb.track).on(s.touchEvents.start, sb.dragStart);\n                $(target).on(s.touchEvents.move, sb.dragMove);\n                $(target).on(s.touchEvents.end, sb.dragEnd);\n            },\n            disableDraggable: function () {\n                var sb = s.scrollbar;\n                var target = s.support.touch ? sb.track : document;\n                $(sb.track).off(s.touchEvents.start, sb.dragStart);\n                $(target).off(s.touchEvents.move, sb.dragMove);\n                $(target).off(s.touchEvents.end, sb.dragEnd);\n            },\n            set: function () {\n                if (!s.params.scrollbar) return;\n                var sb = s.scrollbar;\n                sb.track = $(s.params.scrollbar);\n                sb.drag = sb.track.find('.swiper-scrollbar-drag');\n                if (sb.drag.length === 0) {\n                    sb.drag = $('<div class=\"swiper-scrollbar-drag\"></div>');\n                    sb.track.append(sb.drag);\n                }\n                sb.drag[0].style.width = '';\n                sb.drag[0].style.height = '';\n                sb.trackSize = isH() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;\n\n                sb.divider = s.size / s.virtualSize;\n                sb.moveDivider = sb.divider * (sb.trackSize / s.size);\n                sb.dragSize = sb.trackSize * sb.divider;\n\n                if (isH()) {\n                    sb.drag[0].style.width = sb.dragSize + 'px';\n                }\n                else {\n                    sb.drag[0].style.height = sb.dragSize + 'px';\n                }\n\n                if (sb.divider >= 1) {\n                    sb.track[0].style.display = 'none';\n                }\n                else {\n                    sb.track[0].style.display = '';\n                }\n                if (s.params.scrollbarHide) {\n                    sb.track[0].style.opacity = 0;\n                }\n            },\n            setTranslate: function () {\n                if (!s.params.scrollbar) return;\n                var diff;\n                var sb = s.scrollbar;\n                var translate = s.translate || 0;\n                var newPos;\n\n                var newSize = sb.dragSize;\n                newPos = (sb.trackSize - sb.dragSize) * s.progress;\n                if (s.rtl && isH()) {\n                    newPos = -newPos;\n                    if (newPos > 0) {\n                        newSize = sb.dragSize - newPos;\n                        newPos = 0;\n                    }\n                    else if (-newPos + sb.dragSize > sb.trackSize) {\n                        newSize = sb.trackSize + newPos;\n                    }\n                }\n                else {\n                    if (newPos < 0) {\n                        newSize = sb.dragSize + newPos;\n                        newPos = 0;\n                    }\n                    else if (newPos + sb.dragSize > sb.trackSize) {\n                        newSize = sb.trackSize - newPos;\n                    }\n                }\n                if (isH()) {\n                    if (s.support.transforms3d) {\n                        sb.drag.transform('translate3d(' + (newPos) + 'px, 0, 0)');\n                    }\n                    else {\n                        sb.drag.transform('translateX(' + (newPos) + 'px)');\n                    }\n                    sb.drag[0].style.width = newSize + 'px';\n                }\n                else {\n                    if (s.support.transforms3d) {\n                        sb.drag.transform('translate3d(0px, ' + (newPos) + 'px, 0)');\n                    }\n                    else {\n                        sb.drag.transform('translateY(' + (newPos) + 'px)');\n                    }\n                    sb.drag[0].style.height = newSize + 'px';\n                }\n                if (s.params.scrollbarHide) {\n                    clearTimeout(sb.timeout);\n                    sb.track[0].style.opacity = 1;\n                    sb.timeout = setTimeout(function () {\n                        sb.track[0].style.opacity = 0;\n                        sb.track.transition(400);\n                    }, 1000);\n                }\n            },\n            setTransition: function (duration) {\n                if (!s.params.scrollbar) return;\n                s.scrollbar.drag.transition(duration);\n            }\n        };\n\n        /*=========================\n          Controller\n          ===========================*/\n        s.controller = {\n            LinearSpline: function (x, y) {\n                this.x = x;\n                this.y = y;\n                this.lastIndex = x.length - 1;\n                // Given an x value (x2), return the expected y2 value:\n                // (x1,y1) is the known point before given value,\n                // (x3,y3) is the known point after given value.\n                var i1, i3;\n                var l = this.x.length;\n\n                this.interpolate = function (x2) {\n                    if (!x2) return 0;\n\n                    // Get the indexes of x1 and x3 (the array indexes before and after given x2):\n                    i3 = binarySearch(this.x, x2);\n                    i1 = i3 - 1;\n\n                    // We have our indexes i1 & i3, so we can calculate already:\n                    // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1\n                    return ((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1]) + this.y[i1];\n                };\n\n                var binarySearch = (function() {\n                    var maxIndex, minIndex, guess;\n                    return function(array, val) {\n                        minIndex = -1;\n                        maxIndex = array.length;\n                        while (maxIndex - minIndex > 1)\n                            if (array[guess = maxIndex + minIndex >> 1] <= val) {\n                                minIndex = guess;\n                            } else {\n                                maxIndex = guess;\n                            }\n                        return maxIndex;\n                    };\n                })();\n            },\n            //xxx: for now i will just save one spline function to to\n            getInterpolateFunction: function(c){\n                if(!s.controller.spline) s.controller.spline = s.params.loop ?\n                    new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) :\n                    new s.controller.LinearSpline(s.snapGrid, c.snapGrid);\n            },\n            setTranslate: function (translate, byController) {\n               var controlled = s.params.control;\n               var multiplier, controlledTranslate;\n               function setControlledTranslate(c) {\n                    // this will create an Interpolate function based on the snapGrids\n                    // x is the Grid of the scrolled scroller and y will be the controlled scroller\n                    // it makes sense to create this only once and recall it for the interpolation\n                    // the function does a lot of value caching for performance\n                    translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;\n                    if (s.params.controlBy === 'slide') {\n                        s.controller.getInterpolateFunction(c);\n                        // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid\n                        // but it did not work out\n                        controlledTranslate = -s.controller.spline.interpolate(-translate);\n                    }\n\n                    if(!controlledTranslate || s.params.controlBy === 'container'){\n                        multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());\n                        controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();\n                    }\n\n                    if (s.params.controlInverse) {\n                        controlledTranslate = c.maxTranslate() - controlledTranslate;\n                    }\n                    c.updateProgress(controlledTranslate);\n                    c.setWrapperTranslate(controlledTranslate, false, s);\n                    c.updateActiveIndex();\n               }\n               if (s.isArray(controlled)) {\n                   for (var i = 0; i < controlled.length; i++) {\n                       if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n                           setControlledTranslate(controlled[i]);\n                       }\n                   }\n               }\n               else if (controlled instanceof Swiper && byController !== controlled) {\n\n                   setControlledTranslate(controlled);\n               }\n            },\n            setTransition: function (duration, byController) {\n                var controlled = s.params.control;\n                var i;\n                function setControlledTransition(c) {\n                    c.setWrapperTransition(duration, s);\n                    if (duration !== 0) {\n                        c.onTransitionStart();\n                        c.wrapper.transitionEnd(function(){\n                            if (!controlled) return;\n                            if (c.params.loop && s.params.controlBy === 'slide') {\n                                c.fixLoop();\n                            }\n                            c.onTransitionEnd();\n\n                        });\n                    }\n                }\n                if (s.isArray(controlled)) {\n                    for (i = 0; i < controlled.length; i++) {\n                        if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n                            setControlledTransition(controlled[i]);\n                        }\n                    }\n                }\n                else if (controlled instanceof Swiper && byController !== controlled) {\n                    setControlledTransition(controlled);\n                }\n            }\n        };\n\n        /*=========================\n          Hash Navigation\n          ===========================*/\n        s.hashnav = {\n            init: function () {\n                if (!s.params.hashnav) return;\n                s.hashnav.initialized = true;\n                var hash = document.location.hash.replace('#', '');\n                if (!hash) return;\n                var speed = 0;\n                for (var i = 0, length = s.slides.length; i < length; i++) {\n                    var slide = s.slides.eq(i);\n                    var slideHash = slide.attr('data-hash');\n                    if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {\n                        var index = slide.index();\n                        s.slideTo(index, speed, s.params.runCallbacksOnInit, true);\n                    }\n                }\n            },\n            setHash: function () {\n                if (!s.hashnav.initialized || !s.params.hashnav) return;\n                document.location.hash = s.slides.eq(s.activeIndex).attr('data-hash') || '';\n            }\n        };\n\n        /*=========================\n          Keyboard Control\n          ===========================*/\n        function handleKeyboard(e) {\n            if (e.originalEvent) e = e.originalEvent; //jquery fix\n            var kc = e.keyCode || e.charCode;\n            // Directions locks\n            if (!s.params.allowSwipeToNext && (isH() && kc === 39 || !isH() && kc === 40)) {\n                return false;\n            }\n            if (!s.params.allowSwipeToPrev && (isH() && kc === 37 || !isH() && kc === 38)) {\n                return false;\n            }\n            if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {\n                return;\n            }\n            if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {\n                return;\n            }\n            if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {\n                var inView = false;\n                //Check that swiper should be inside of visible area of window\n                if (s.container.parents('.swiper-slide').length > 0 && s.container.parents('.swiper-slide-active').length === 0) {\n                    return;\n                }\n                var windowScroll = {\n                    left: window.pageXOffset,\n                    top: window.pageYOffset\n                };\n                var windowWidth = window.innerWidth;\n                var windowHeight = window.innerHeight;\n                var swiperOffset = s.container.offset();\n                if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;\n                var swiperCoord = [\n                    [swiperOffset.left, swiperOffset.top],\n                    [swiperOffset.left + s.width, swiperOffset.top],\n                    [swiperOffset.left, swiperOffset.top + s.height],\n                    [swiperOffset.left + s.width, swiperOffset.top + s.height]\n                ];\n                for (var i = 0; i < swiperCoord.length; i++) {\n                    var point = swiperCoord[i];\n                    if (\n                        point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth &&\n                        point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight\n                    ) {\n                        inView = true;\n                    }\n\n                }\n                if (!inView) return;\n            }\n            if (isH()) {\n                if (kc === 37 || kc === 39) {\n                    if (e.preventDefault) e.preventDefault();\n                    else e.returnValue = false;\n                }\n                if ((kc === 39 && !s.rtl) || (kc === 37 && s.rtl)) s.slideNext();\n                if ((kc === 37 && !s.rtl) || (kc === 39 && s.rtl)) s.slidePrev();\n            }\n            else {\n                if (kc === 38 || kc === 40) {\n                    if (e.preventDefault) e.preventDefault();\n                    else e.returnValue = false;\n                }\n                if (kc === 40) s.slideNext();\n                if (kc === 38) s.slidePrev();\n            }\n        }\n        s.disableKeyboardControl = function () {\n            s.params.keyboardControl = false;\n            $(document).off('keydown', handleKeyboard);\n        };\n        s.enableKeyboardControl = function () {\n            s.params.keyboardControl = true;\n            $(document).on('keydown', handleKeyboard);\n        };\n\n\n        /*=========================\n          Mousewheel Control\n          ===========================*/\n        s.mousewheel = {\n            event: false,\n            lastScrollTime: (new window.Date()).getTime()\n        };\n        if (s.params.mousewheelControl) {\n            try {\n                new window.WheelEvent('wheel');\n                s.mousewheel.event = 'wheel';\n            } catch (e) {}\n\n            if (!s.mousewheel.event && document.onmousewheel !== undefined) {\n                s.mousewheel.event = 'mousewheel';\n            }\n            if (!s.mousewheel.event) {\n                s.mousewheel.event = 'DOMMouseScroll';\n            }\n        }\n        function handleMousewheel(e) {\n            if (e.originalEvent) e = e.originalEvent; //jquery fix\n            var we = s.mousewheel.event;\n            var delta = 0;\n            var rtlFactor = s.rtl ? -1 : 1;\n            //Opera & IE\n            if (e.detail) delta = -e.detail;\n            //WebKits\n            else if (we === 'mousewheel') {\n                if (s.params.mousewheelForceToAxis) {\n                    if (isH()) {\n                        if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;\n                        else return;\n                    }\n                    else {\n                        if (Math.abs(e.wheelDeltaY) > Math.abs(e.wheelDeltaX)) delta = e.wheelDeltaY;\n                        else return;\n                    }\n                }\n                else {\n                    delta = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY) ? - e.wheelDeltaX * rtlFactor : - e.wheelDeltaY;\n                }\n            }\n            //Old FireFox\n            else if (we === 'DOMMouseScroll') delta = -e.detail;\n            //New FireFox\n            else if (we === 'wheel') {\n                if (s.params.mousewheelForceToAxis) {\n                    if (isH()) {\n                        if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) delta = -e.deltaX * rtlFactor;\n                        else return;\n                    }\n                    else {\n                        if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) delta = -e.deltaY;\n                        else return;\n                    }\n                }\n                else {\n                    delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? - e.deltaX * rtlFactor : - e.deltaY;\n                }\n            }\n            if (delta === 0) return;\n\n            if (s.params.mousewheelInvert) delta = -delta;\n\n            if (!s.params.freeMode) {\n                if ((new window.Date()).getTime() - s.mousewheel.lastScrollTime > 60) {\n                    if (delta < 0) {\n                        if ((!s.isEnd || s.params.loop) && !s.animating) s.slideNext();\n                        else if (s.params.mousewheelReleaseOnEdges) return true;\n                    }\n                    else {\n                        if ((!s.isBeginning || s.params.loop) && !s.animating) s.slidePrev();\n                        else if (s.params.mousewheelReleaseOnEdges) return true;\n                    }\n                }\n                s.mousewheel.lastScrollTime = (new window.Date()).getTime();\n\n            }\n            else {\n                //Freemode or scrollContainer:\n                var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;\n                var wasBeginning = s.isBeginning,\n                    wasEnd = s.isEnd;\n\n                if (position >= s.minTranslate()) position = s.minTranslate();\n                if (position <= s.maxTranslate()) position = s.maxTranslate();\n\n                s.setWrapperTransition(0);\n                s.setWrapperTranslate(position);\n                s.updateProgress();\n                s.updateActiveIndex();\n\n                if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {\n                    s.updateClasses();\n                }\n\n                if (s.params.freeModeSticky) {\n                    clearTimeout(s.mousewheel.timeout);\n                    s.mousewheel.timeout = setTimeout(function () {\n                        s.slideReset();\n                    }, 300);\n                }\n\n                // Return page scroll on edge positions\n                if (position === 0 || position === s.maxTranslate()) return;\n            }\n            if (s.params.autoplay) s.stopAutoplay();\n\n            if (e.preventDefault) e.preventDefault();\n            else e.returnValue = false;\n            return false;\n        }\n        s.disableMousewheelControl = function () {\n            if (!s.mousewheel.event) return false;\n            s.container.off(s.mousewheel.event, handleMousewheel);\n            return true;\n        };\n\n        s.enableMousewheelControl = function () {\n            if (!s.mousewheel.event) return false;\n            s.container.on(s.mousewheel.event, handleMousewheel);\n            return true;\n        };\n\n\n        /*=========================\n          Parallax\n          ===========================*/\n        function setParallaxTransform(el, progress) {\n            el = $(el);\n            var p, pX, pY;\n            var rtlFactor = s.rtl ? -1 : 1;\n\n            p = el.attr('data-swiper-parallax') || '0';\n            pX = el.attr('data-swiper-parallax-x');\n            pY = el.attr('data-swiper-parallax-y');\n            if (pX || pY) {\n                pX = pX || '0';\n                pY = pY || '0';\n            }\n            else {\n                if (isH()) {\n                    pX = p;\n                    pY = '0';\n                }\n                else {\n                    pY = p;\n                    pX = '0';\n                }\n            }\n\n            if ((pX).indexOf('%') >= 0) {\n                pX = parseInt(pX, 10) * progress * rtlFactor + '%';\n            }\n            else {\n                pX = pX * progress * rtlFactor + 'px' ;\n            }\n            if ((pY).indexOf('%') >= 0) {\n                pY = parseInt(pY, 10) * progress + '%';\n            }\n            else {\n                pY = pY * progress + 'px' ;\n            }\n\n            el.transform('translate3d(' + pX + ', ' + pY + ',0px)');\n        }\n        s.parallax = {\n            setTranslate: function () {\n                s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){\n                    setParallaxTransform(this, s.progress);\n\n                });\n                s.slides.each(function () {\n                    var slide = $(this);\n                    slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {\n                        var progress = Math.min(Math.max(slide[0].progress, -1), 1);\n                        setParallaxTransform(this, progress);\n                    });\n                });\n            },\n            setTransition: function (duration) {\n                if (typeof duration === 'undefined') duration = s.params.speed;\n                s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){\n                    var el = $(this);\n                    var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;\n                    if (duration === 0) parallaxDuration = 0;\n                    el.transition(parallaxDuration);\n                });\n            }\n        };\n\n\n        /*=========================\n          Plugins API. Collect all and init all plugins\n          ===========================*/\n        s._plugins = [];\n        for (var plugin in s.plugins) {\n            var p = s.plugins[plugin](s, s.params[plugin]);\n            if (p) s._plugins.push(p);\n        }\n        // Method to call all plugins event/method\n        s.callPlugins = function (eventName) {\n            for (var i = 0; i < s._plugins.length; i++) {\n                if (eventName in s._plugins[i]) {\n                    s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n                }\n            }\n        };\n\n        /*=========================\n          Events/Callbacks/Plugins Emitter\n          ===========================*/\n        function normalizeEventName (eventName) {\n            if (eventName.indexOf('on') !== 0) {\n                if (eventName[0] !== eventName[0].toUpperCase()) {\n                    eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);\n                }\n                else {\n                    eventName = 'on' + eventName;\n                }\n            }\n            return eventName;\n        }\n        s.emitterEventListeners = {\n\n        };\n        s.emit = function (eventName) {\n            // Trigger callbacks\n            if (s.params[eventName]) {\n                s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n            }\n            var i;\n            // Trigger events\n            if (s.emitterEventListeners[eventName]) {\n                for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {\n                    s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n                }\n            }\n            // Trigger plugins\n            if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n        };\n        s.on = function (eventName, handler) {\n            eventName = normalizeEventName(eventName);\n            if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];\n            s.emitterEventListeners[eventName].push(handler);\n            return s;\n        };\n        s.off = function (eventName, handler) {\n            var i;\n            eventName = normalizeEventName(eventName);\n            if (typeof handler === 'undefined') {\n                // Remove all handlers for such event\n                s.emitterEventListeners[eventName] = [];\n                return s;\n            }\n            if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;\n            for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {\n                if(s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);\n            }\n            return s;\n        };\n        s.once = function (eventName, handler) {\n            eventName = normalizeEventName(eventName);\n            var _handler = function () {\n                handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);\n                s.off(eventName, _handler);\n            };\n            s.on(eventName, _handler);\n            return s;\n        };\n\n        // Accessibility tools\n        s.a11y = {\n            makeFocusable: function ($el) {\n                $el.attr('tabIndex', '0');\n                return $el;\n            },\n            addRole: function ($el, role) {\n                $el.attr('role', role);\n                return $el;\n            },\n\n            addLabel: function ($el, label) {\n                $el.attr('aria-label', label);\n                return $el;\n            },\n\n            disable: function ($el) {\n                $el.attr('aria-disabled', true);\n                return $el;\n            },\n\n            enable: function ($el) {\n                $el.attr('aria-disabled', false);\n                return $el;\n            },\n\n            onEnterKey: function (event) {\n                if (event.keyCode !== 13) return;\n                if ($(event.target).is(s.params.nextButton)) {\n                    s.onClickNext(event);\n                    if (s.isEnd) {\n                        s.a11y.notify(s.params.lastSlideMessage);\n                    }\n                    else {\n                        s.a11y.notify(s.params.nextSlideMessage);\n                    }\n                }\n                else if ($(event.target).is(s.params.prevButton)) {\n                    s.onClickPrev(event);\n                    if (s.isBeginning) {\n                        s.a11y.notify(s.params.firstSlideMessage);\n                    }\n                    else {\n                        s.a11y.notify(s.params.prevSlideMessage);\n                    }\n                }\n                if ($(event.target).is('.' + s.params.bulletClass)) {\n                    $(event.target)[0].click();\n                }\n            },\n\n            liveRegion: $('<span class=\"swiper-notification\" aria-live=\"assertive\" aria-atomic=\"true\"></span>'),\n\n            notify: function (message) {\n                var notification = s.a11y.liveRegion;\n                if (notification.length === 0) return;\n                notification.html('');\n                notification.html(message);\n            },\n            init: function () {\n                // Setup accessibility\n                if (s.params.nextButton) {\n                    var nextButton = $(s.params.nextButton);\n                    s.a11y.makeFocusable(nextButton);\n                    s.a11y.addRole(nextButton, 'button');\n                    s.a11y.addLabel(nextButton, s.params.nextSlideMessage);\n                }\n                if (s.params.prevButton) {\n                    var prevButton = $(s.params.prevButton);\n                    s.a11y.makeFocusable(prevButton);\n                    s.a11y.addRole(prevButton, 'button');\n                    s.a11y.addLabel(prevButton, s.params.prevSlideMessage);\n                }\n\n                $(s.container).append(s.a11y.liveRegion);\n            },\n            initPagination: function () {\n                if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {\n                    s.bullets.each(function () {\n                        var bullet = $(this);\n                        s.a11y.makeFocusable(bullet);\n                        s.a11y.addRole(bullet, 'button');\n                        s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));\n                    });\n                }\n            },\n            destroy: function () {\n                if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();\n            }\n        };\n\n\n        /*=========================\n          Init/Destroy\n          ===========================*/\n        s.init = function () {\n            if (s.params.loop) s.createLoop();\n            s.updateContainerSize();\n            s.updateSlidesSize();\n            s.updatePagination();\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.set();\n                if (s.params.scrollbarDraggable) {\n                    s.scrollbar.enableDraggable();\n                }\n            }\n            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n                if (!s.params.loop) s.updateProgress();\n                s.effects[s.params.effect].setTranslate();\n            }\n            if (s.params.loop) {\n                s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);\n            }\n            else {\n                s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);\n                if (s.params.initialSlide === 0) {\n                    if (s.parallax && s.params.parallax) s.parallax.setTranslate();\n                    if (s.lazy && s.params.lazyLoading) {\n                        s.lazy.load();\n                        s.lazy.initialImageLoaded = true;\n                    }\n                }\n            }\n            s.attachEvents();\n            if (s.params.observer && s.support.observer) {\n                s.initObservers();\n            }\n            if (s.params.preloadImages && !s.params.lazyLoading) {\n                s.preloadImages();\n            }\n            if (s.params.autoplay) {\n                s.startAutoplay();\n            }\n            if (s.params.keyboardControl) {\n                if (s.enableKeyboardControl) s.enableKeyboardControl();\n            }\n            if (s.params.mousewheelControl) {\n                if (s.enableMousewheelControl) s.enableMousewheelControl();\n            }\n            if (s.params.hashnav) {\n                if (s.hashnav) s.hashnav.init();\n            }\n            if (s.params.a11y && s.a11y) s.a11y.init();\n            s.emit('onInit', s);\n        };\n\n        // Cleanup dynamic styles\n        s.cleanupStyles = function () {\n            // Container\n            s.container.removeClass(s.classNames.join(' ')).removeAttr('style');\n\n            // Wrapper\n            s.wrapper.removeAttr('style');\n\n            // Slides\n            if (s.slides && s.slides.length) {\n                s.slides\n                    .removeClass([\n                      s.params.slideVisibleClass,\n                      s.params.slideActiveClass,\n                      s.params.slideNextClass,\n                      s.params.slidePrevClass\n                    ].join(' '))\n                    .removeAttr('style')\n                    .removeAttr('data-swiper-column')\n                    .removeAttr('data-swiper-row');\n            }\n\n            // Pagination/Bullets\n            if (s.paginationContainer && s.paginationContainer.length) {\n                s.paginationContainer.removeClass(s.params.paginationHiddenClass);\n            }\n            if (s.bullets && s.bullets.length) {\n                s.bullets.removeClass(s.params.bulletActiveClass);\n            }\n\n            // Buttons\n            if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);\n            if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);\n\n            // Scrollbar\n            if (s.params.scrollbar && s.scrollbar) {\n                if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');\n                if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');\n            }\n        };\n\n        // Destroy\n        s.destroy = function (deleteInstance, cleanupStyles) {\n            // Detach evebts\n            s.detachEvents();\n            // Stop autoplay\n            s.stopAutoplay();\n            // Disable draggable\n            if (s.params.scrollbar && s.scrollbar) {\n                if (s.params.scrollbarDraggable) {\n                    s.scrollbar.disableDraggable();\n                }\n            }\n            // Destroy loop\n            if (s.params.loop) {\n                s.destroyLoop();\n            }\n            // Cleanup styles\n            if (cleanupStyles) {\n                s.cleanupStyles();\n            }\n            // Disconnect observer\n            s.disconnectObservers();\n            // Disable keyboard/mousewheel\n            if (s.params.keyboardControl) {\n                if (s.disableKeyboardControl) s.disableKeyboardControl();\n            }\n            if (s.params.mousewheelControl) {\n                if (s.disableMousewheelControl) s.disableMousewheelControl();\n            }\n            // Disable a11y\n            if (s.params.a11y && s.a11y) s.a11y.destroy();\n            // Destroy callback\n            s.emit('onDestroy');\n            // Delete instance\n            if (deleteInstance !== false) s = null;\n        };\n\n        s.init();\n\n\n\n        // Return swiper instance\n        return s;\n    };\n\n\n    /*==================================================\n        Prototype\n    ====================================================*/\n    Swiper.prototype = {\n        isSafari: (function () {\n            var ua = navigator.userAgent.toLowerCase();\n            return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);\n        })(),\n        isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),\n        isArray: function (arr) {\n            return Object.prototype.toString.apply(arr) === '[object Array]';\n        },\n        /*==================================================\n        Browser\n        ====================================================*/\n        browser: {\n            ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,\n            ieTouch: (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1) || (window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1)\n        },\n        /*==================================================\n        Devices\n        ====================================================*/\n        device: (function () {\n            var ua = navigator.userAgent;\n            var android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/);\n            var ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/);\n            var ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/);\n            var iphone = !ipad && ua.match(/(iPhone\\sOS)\\s([\\d_]+)/);\n            return {\n                ios: ipad || iphone || ipod,\n                android: android\n            };\n        })(),\n        /*==================================================\n        Feature Detection\n        ====================================================*/\n        support: {\n            touch : (window.Modernizr && Modernizr.touch === true) || (function () {\n                return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);\n            })(),\n\n            transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {\n                var div = document.createElement('div').style;\n                return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div);\n            })(),\n\n            flexbox: (function () {\n                var div = document.createElement('div').style;\n                var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' ');\n                for (var i = 0; i < styles.length; i++) {\n                    if (styles[i] in div) return true;\n                }\n            })(),\n\n            observer: (function () {\n                return ('MutationObserver' in window || 'WebkitMutationObserver' in window);\n            })()\n        },\n        /*==================================================\n        Plugins\n        ====================================================*/\n        plugins: {}\n    };\n\n\n    /*===========================\n    Dom7 Library\n    ===========================*/\n    var Dom7 = (function () {\n        var Dom7 = function (arr) {\n            var _this = this, i = 0;\n            // Create array-like object\n            for (i = 0; i < arr.length; i++) {\n                _this[i] = arr[i];\n            }\n            _this.length = arr.length;\n            // Return collection with methods\n            return this;\n        };\n        var $ = function (selector, context) {\n            var arr = [], i = 0;\n            if (selector && !context) {\n                if (selector instanceof Dom7) {\n                    return selector;\n                }\n            }\n            if (selector) {\n                // String\n                if (typeof selector === 'string') {\n                    var els, tempParent, html = selector.trim();\n                    if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {\n                        var toCreate = 'div';\n                        if (html.indexOf('<li') === 0) toCreate = 'ul';\n                        if (html.indexOf('<tr') === 0) toCreate = 'tbody';\n                        if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';\n                        if (html.indexOf('<tbody') === 0) toCreate = 'table';\n                        if (html.indexOf('<option') === 0) toCreate = 'select';\n                        tempParent = document.createElement(toCreate);\n                        tempParent.innerHTML = selector;\n                        for (i = 0; i < tempParent.childNodes.length; i++) {\n                            arr.push(tempParent.childNodes[i]);\n                        }\n                    }\n                    else {\n                        if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {\n                            // Pure ID selector\n                            els = [document.getElementById(selector.split('#')[1])];\n                        }\n                        else {\n                            // Other selectors\n                            els = (context || document).querySelectorAll(selector);\n                        }\n                        for (i = 0; i < els.length; i++) {\n                            if (els[i]) arr.push(els[i]);\n                        }\n                    }\n                }\n                // Node/element\n                else if (selector.nodeType || selector === window || selector === document) {\n                    arr.push(selector);\n                }\n                //Array of elements or instance of Dom\n                else if (selector.length > 0 && selector[0].nodeType) {\n                    for (i = 0; i < selector.length; i++) {\n                        arr.push(selector[i]);\n                    }\n                }\n            }\n            return new Dom7(arr);\n        };\n        Dom7.prototype = {\n            // Classes and attriutes\n            addClass: function (className) {\n                if (typeof className === 'undefined') {\n                    return this;\n                }\n                var classes = className.split(' ');\n                for (var i = 0; i < classes.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        this[j].classList.add(classes[i]);\n                    }\n                }\n                return this;\n            },\n            removeClass: function (className) {\n                var classes = className.split(' ');\n                for (var i = 0; i < classes.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        this[j].classList.remove(classes[i]);\n                    }\n                }\n                return this;\n            },\n            hasClass: function (className) {\n                if (!this[0]) return false;\n                else return this[0].classList.contains(className);\n            },\n            toggleClass: function (className) {\n                var classes = className.split(' ');\n                for (var i = 0; i < classes.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        this[j].classList.toggle(classes[i]);\n                    }\n                }\n                return this;\n            },\n            attr: function (attrs, value) {\n                if (arguments.length === 1 && typeof attrs === 'string') {\n                    // Get attr\n                    if (this[0]) return this[0].getAttribute(attrs);\n                    else return undefined;\n                }\n                else {\n                    // Set attrs\n                    for (var i = 0; i < this.length; i++) {\n                        if (arguments.length === 2) {\n                            // String\n                            this[i].setAttribute(attrs, value);\n                        }\n                        else {\n                            // Object\n                            for (var attrName in attrs) {\n                                this[i][attrName] = attrs[attrName];\n                                this[i].setAttribute(attrName, attrs[attrName]);\n                            }\n                        }\n                    }\n                    return this;\n                }\n            },\n            removeAttr: function (attr) {\n                for (var i = 0; i < this.length; i++) {\n                    this[i].removeAttribute(attr);\n                }\n                return this;\n            },\n            data: function (key, value) {\n                if (typeof value === 'undefined') {\n                    // Get value\n                    if (this[0]) {\n                        var dataKey = this[0].getAttribute('data-' + key);\n                        if (dataKey) return dataKey;\n                        else if (this[0].dom7ElementDataStorage && (key in this[0].dom7ElementDataStorage)) return this[0].dom7ElementDataStorage[key];\n                        else return undefined;\n                    }\n                    else return undefined;\n                }\n                else {\n                    // Set value\n                    for (var i = 0; i < this.length; i++) {\n                        var el = this[i];\n                        if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};\n                        el.dom7ElementDataStorage[key] = value;\n                    }\n                    return this;\n                }\n            },\n            // Transforms\n            transform : function (transform) {\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;\n                }\n                return this;\n            },\n            transition: function (duration) {\n                if (typeof duration !== 'string') {\n                    duration = duration + 'ms';\n                }\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;\n                }\n                return this;\n            },\n            //Events\n            on: function (eventName, targetSelector, listener, capture) {\n                function handleLiveEvent(e) {\n                    var target = e.target;\n                    if ($(target).is(targetSelector)) listener.call(target, e);\n                    else {\n                        var parents = $(target).parents();\n                        for (var k = 0; k < parents.length; k++) {\n                            if ($(parents[k]).is(targetSelector)) listener.call(parents[k], e);\n                        }\n                    }\n                }\n                var events = eventName.split(' ');\n                var i, j;\n                for (i = 0; i < this.length; i++) {\n                    if (typeof targetSelector === 'function' || targetSelector === false) {\n                        // Usual events\n                        if (typeof targetSelector === 'function') {\n                            listener = arguments[1];\n                            capture = arguments[2] || false;\n                        }\n                        for (j = 0; j < events.length; j++) {\n                            this[i].addEventListener(events[j], listener, capture);\n                        }\n                    }\n                    else {\n                        //Live events\n                        for (j = 0; j < events.length; j++) {\n                            if (!this[i].dom7LiveListeners) this[i].dom7LiveListeners = [];\n                            this[i].dom7LiveListeners.push({listener: listener, liveListener: handleLiveEvent});\n                            this[i].addEventListener(events[j], handleLiveEvent, capture);\n                        }\n                    }\n                }\n\n                return this;\n            },\n            off: function (eventName, targetSelector, listener, capture) {\n                var events = eventName.split(' ');\n                for (var i = 0; i < events.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        if (typeof targetSelector === 'function' || targetSelector === false) {\n                            // Usual events\n                            if (typeof targetSelector === 'function') {\n                                listener = arguments[1];\n                                capture = arguments[2] || false;\n                            }\n                            this[j].removeEventListener(events[i], listener, capture);\n                        }\n                        else {\n                            // Live event\n                            if (this[j].dom7LiveListeners) {\n                                for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {\n                                    if (this[j].dom7LiveListeners[k].listener === listener) {\n                                        this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n                return this;\n            },\n            once: function (eventName, targetSelector, listener, capture) {\n                var dom = this;\n                if (typeof targetSelector === 'function') {\n                    targetSelector = false;\n                    listener = arguments[1];\n                    capture = arguments[2];\n                }\n                function proxy(e) {\n                    listener(e);\n                    dom.off(eventName, targetSelector, proxy, capture);\n                }\n                dom.on(eventName, targetSelector, proxy, capture);\n            },\n            trigger: function (eventName, eventData) {\n                for (var i = 0; i < this.length; i++) {\n                    var evt;\n                    try {\n                        evt = new window.CustomEvent(eventName, {detail: eventData, bubbles: true, cancelable: true});\n                    }\n                    catch (e) {\n                        evt = document.createEvent('Event');\n                        evt.initEvent(eventName, true, true);\n                        evt.detail = eventData;\n                    }\n                    this[i].dispatchEvent(evt);\n                }\n                return this;\n            },\n            transitionEnd: function (callback) {\n                var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],\n                    i, j, dom = this;\n                function fireCallBack(e) {\n                    /*jshint validthis:true */\n                    if (e.target !== this) return;\n                    callback.call(this, e);\n                    for (i = 0; i < events.length; i++) {\n                        dom.off(events[i], fireCallBack);\n                    }\n                }\n                if (callback) {\n                    for (i = 0; i < events.length; i++) {\n                        dom.on(events[i], fireCallBack);\n                    }\n                }\n                return this;\n            },\n            // Sizing/Styles\n            width: function () {\n                if (this[0] === window) {\n                    return window.innerWidth;\n                }\n                else {\n                    if (this.length > 0) {\n                        return parseFloat(this.css('width'));\n                    }\n                    else {\n                        return null;\n                    }\n                }\n            },\n            outerWidth: function (includeMargins) {\n                if (this.length > 0) {\n                    if (includeMargins)\n                        return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));\n                    else\n                        return this[0].offsetWidth;\n                }\n                else return null;\n            },\n            height: function () {\n                if (this[0] === window) {\n                    return window.innerHeight;\n                }\n                else {\n                    if (this.length > 0) {\n                        return parseFloat(this.css('height'));\n                    }\n                    else {\n                        return null;\n                    }\n                }\n            },\n            outerHeight: function (includeMargins) {\n                if (this.length > 0) {\n                    if (includeMargins)\n                        return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));\n                    else\n                        return this[0].offsetHeight;\n                }\n                else return null;\n            },\n            offset: function () {\n                if (this.length > 0) {\n                    var el = this[0];\n                    var box = el.getBoundingClientRect();\n                    var body = document.body;\n                    var clientTop  = el.clientTop  || body.clientTop  || 0;\n                    var clientLeft = el.clientLeft || body.clientLeft || 0;\n                    var scrollTop  = window.pageYOffset || el.scrollTop;\n                    var scrollLeft = window.pageXOffset || el.scrollLeft;\n                    return {\n                        top: box.top  + scrollTop  - clientTop,\n                        left: box.left + scrollLeft - clientLeft\n                    };\n                }\n                else {\n                    return null;\n                }\n            },\n            css: function (props, value) {\n                var i;\n                if (arguments.length === 1) {\n                    if (typeof props === 'string') {\n                        if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);\n                    }\n                    else {\n                        for (i = 0; i < this.length; i++) {\n                            for (var prop in props) {\n                                this[i].style[prop] = props[prop];\n                            }\n                        }\n                        return this;\n                    }\n                }\n                if (arguments.length === 2 && typeof props === 'string') {\n                    for (i = 0; i < this.length; i++) {\n                        this[i].style[props] = value;\n                    }\n                    return this;\n                }\n                return this;\n            },\n\n            //Dom manipulation\n            each: function (callback) {\n                for (var i = 0; i < this.length; i++) {\n                    callback.call(this[i], i, this[i]);\n                }\n                return this;\n            },\n            html: function (html) {\n                if (typeof html === 'undefined') {\n                    return this[0] ? this[0].innerHTML : undefined;\n                }\n                else {\n                    for (var i = 0; i < this.length; i++) {\n                        this[i].innerHTML = html;\n                    }\n                    return this;\n                }\n            },\n            is: function (selector) {\n                if (!this[0]) return false;\n                var compareWith, i;\n                if (typeof selector === 'string') {\n                    var el = this[0];\n                    if (el === document) return selector === document;\n                    if (el === window) return selector === window;\n\n                    if (el.matches) return el.matches(selector);\n                    else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);\n                    else if (el.mozMatchesSelector) return el.mozMatchesSelector(selector);\n                    else if (el.msMatchesSelector) return el.msMatchesSelector(selector);\n                    else {\n                        compareWith = $(selector);\n                        for (i = 0; i < compareWith.length; i++) {\n                            if (compareWith[i] === this[0]) return true;\n                        }\n                        return false;\n                    }\n                }\n                else if (selector === document) return this[0] === document;\n                else if (selector === window) return this[0] === window;\n                else {\n                    if (selector.nodeType || selector instanceof Dom7) {\n                        compareWith = selector.nodeType ? [selector] : selector;\n                        for (i = 0; i < compareWith.length; i++) {\n                            if (compareWith[i] === this[0]) return true;\n                        }\n                        return false;\n                    }\n                    return false;\n                }\n\n            },\n            index: function () {\n                if (this[0]) {\n                    var child = this[0];\n                    var i = 0;\n                    while ((child = child.previousSibling) !== null) {\n                        if (child.nodeType === 1) i++;\n                    }\n                    return i;\n                }\n                else return undefined;\n            },\n            eq: function (index) {\n                if (typeof index === 'undefined') return this;\n                var length = this.length;\n                var returnIndex;\n                if (index > length - 1) {\n                    return new Dom7([]);\n                }\n                if (index < 0) {\n                    returnIndex = length + index;\n                    if (returnIndex < 0) return new Dom7([]);\n                    else return new Dom7([this[returnIndex]]);\n                }\n                return new Dom7([this[index]]);\n            },\n            append: function (newChild) {\n                var i, j;\n                for (i = 0; i < this.length; i++) {\n                    if (typeof newChild === 'string') {\n                        var tempDiv = document.createElement('div');\n                        tempDiv.innerHTML = newChild;\n                        while (tempDiv.firstChild) {\n                            this[i].appendChild(tempDiv.firstChild);\n                        }\n                    }\n                    else if (newChild instanceof Dom7) {\n                        for (j = 0; j < newChild.length; j++) {\n                            this[i].appendChild(newChild[j]);\n                        }\n                    }\n                    else {\n                        this[i].appendChild(newChild);\n                    }\n                }\n                return this;\n            },\n            prepend: function (newChild) {\n                var i, j;\n                for (i = 0; i < this.length; i++) {\n                    if (typeof newChild === 'string') {\n                        var tempDiv = document.createElement('div');\n                        tempDiv.innerHTML = newChild;\n                        for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {\n                            this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);\n                        }\n                        // this[i].insertAdjacentHTML('afterbegin', newChild);\n                    }\n                    else if (newChild instanceof Dom7) {\n                        for (j = 0; j < newChild.length; j++) {\n                            this[i].insertBefore(newChild[j], this[i].childNodes[0]);\n                        }\n                    }\n                    else {\n                        this[i].insertBefore(newChild, this[i].childNodes[0]);\n                    }\n                }\n                return this;\n            },\n            insertBefore: function (selector) {\n                var before = $(selector);\n                for (var i = 0; i < this.length; i++) {\n                    if (before.length === 1) {\n                        before[0].parentNode.insertBefore(this[i], before[0]);\n                    }\n                    else if (before.length > 1) {\n                        for (var j = 0; j < before.length; j++) {\n                            before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);\n                        }\n                    }\n                }\n            },\n            insertAfter: function (selector) {\n                var after = $(selector);\n                for (var i = 0; i < this.length; i++) {\n                    if (after.length === 1) {\n                        after[0].parentNode.insertBefore(this[i], after[0].nextSibling);\n                    }\n                    else if (after.length > 1) {\n                        for (var j = 0; j < after.length; j++) {\n                            after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);\n                        }\n                    }\n                }\n            },\n            next: function (selector) {\n                if (this.length > 0) {\n                    if (selector) {\n                        if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return new Dom7([this[0].nextElementSibling]);\n                        else return new Dom7([]);\n                    }\n                    else {\n                        if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);\n                        else return new Dom7([]);\n                    }\n                }\n                else return new Dom7([]);\n            },\n            nextAll: function (selector) {\n                var nextEls = [];\n                var el = this[0];\n                if (!el) return new Dom7([]);\n                while (el.nextElementSibling) {\n                    var next = el.nextElementSibling;\n                    if (selector) {\n                        if($(next).is(selector)) nextEls.push(next);\n                    }\n                    else nextEls.push(next);\n                    el = next;\n                }\n                return new Dom7(nextEls);\n            },\n            prev: function (selector) {\n                if (this.length > 0) {\n                    if (selector) {\n                        if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector)) return new Dom7([this[0].previousElementSibling]);\n                        else return new Dom7([]);\n                    }\n                    else {\n                        if (this[0].previousElementSibling) return new Dom7([this[0].previousElementSibling]);\n                        else return new Dom7([]);\n                    }\n                }\n                else return new Dom7([]);\n            },\n            prevAll: function (selector) {\n                var prevEls = [];\n                var el = this[0];\n                if (!el) return new Dom7([]);\n                while (el.previousElementSibling) {\n                    var prev = el.previousElementSibling;\n                    if (selector) {\n                        if($(prev).is(selector)) prevEls.push(prev);\n                    }\n                    else prevEls.push(prev);\n                    el = prev;\n                }\n                return new Dom7(prevEls);\n            },\n            parent: function (selector) {\n                var parents = [];\n                for (var i = 0; i < this.length; i++) {\n                    if (selector) {\n                        if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);\n                    }\n                    else {\n                        parents.push(this[i].parentNode);\n                    }\n                }\n                return $($.unique(parents));\n            },\n            parents: function (selector) {\n                var parents = [];\n                for (var i = 0; i < this.length; i++) {\n                    var parent = this[i].parentNode;\n                    while (parent) {\n                        if (selector) {\n                            if ($(parent).is(selector)) parents.push(parent);\n                        }\n                        else {\n                            parents.push(parent);\n                        }\n                        parent = parent.parentNode;\n                    }\n                }\n                return $($.unique(parents));\n            },\n            find : function (selector) {\n                var foundElements = [];\n                for (var i = 0; i < this.length; i++) {\n                    var found = this[i].querySelectorAll(selector);\n                    for (var j = 0; j < found.length; j++) {\n                        foundElements.push(found[j]);\n                    }\n                }\n                return new Dom7(foundElements);\n            },\n            children: function (selector) {\n                var children = [];\n                for (var i = 0; i < this.length; i++) {\n                    var childNodes = this[i].childNodes;\n\n                    for (var j = 0; j < childNodes.length; j++) {\n                        if (!selector) {\n                            if (childNodes[j].nodeType === 1) children.push(childNodes[j]);\n                        }\n                        else {\n                            if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) children.push(childNodes[j]);\n                        }\n                    }\n                }\n                return new Dom7($.unique(children));\n            },\n            remove: function () {\n                for (var i = 0; i < this.length; i++) {\n                    if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);\n                }\n                return this;\n            },\n            add: function () {\n                var dom = this;\n                var i, j;\n                for (i = 0; i < arguments.length; i++) {\n                    var toAdd = $(arguments[i]);\n                    for (j = 0; j < toAdd.length; j++) {\n                        dom[dom.length] = toAdd[j];\n                        dom.length++;\n                    }\n                }\n                return dom;\n            }\n        };\n        $.fn = Dom7.prototype;\n        $.unique = function (arr) {\n            var unique = [];\n            for (var i = 0; i < arr.length; i++) {\n                if (unique.indexOf(arr[i]) === -1) unique.push(arr[i]);\n            }\n            return unique;\n        };\n\n        return $;\n    })();\n\n\n    /*===========================\n     Get Dom libraries\n     ===========================*/\n    var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];\n    for (var i = 0; i < swiperDomPlugins.length; i++) {\n    \tif (window[swiperDomPlugins[i]]) {\n    \t\taddLibraryPlugin(window[swiperDomPlugins[i]]);\n    \t}\n    }\n    // Required DOM Plugins\n    var domLib;\n    if (typeof Dom7 === 'undefined') {\n    \tdomLib = window.Dom7 || window.Zepto || window.jQuery;\n    }\n    else {\n    \tdomLib = Dom7;\n    }\n\n    /*===========================\n    Add .swiper plugin from Dom libraries\n    ===========================*/\n    function addLibraryPlugin(lib) {\n        lib.fn.swiper = function (params) {\n            var firstInstance;\n            lib(this).each(function () {\n                var s = new Swiper(this, params);\n                if (!firstInstance) firstInstance = s;\n            });\n            return firstInstance;\n        };\n    }\n\n    if (domLib) {\n        if (!('transitionEnd' in domLib.fn)) {\n            domLib.fn.transitionEnd = function (callback) {\n                var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],\n                    i, j, dom = this;\n                function fireCallBack(e) {\n                    /*jshint validthis:true */\n                    if (e.target !== this) return;\n                    callback.call(this, e);\n                    for (i = 0; i < events.length; i++) {\n                        dom.off(events[i], fireCallBack);\n                    }\n                }\n                if (callback) {\n                    for (i = 0; i < events.length; i++) {\n                        dom.on(events[i], fireCallBack);\n                    }\n                }\n                return this;\n            };\n        }\n        if (!('transform' in domLib.fn)) {\n            domLib.fn.transform = function (transform) {\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;\n                }\n                return this;\n            };\n        }\n        if (!('transition' in domLib.fn)) {\n            domLib.fn.transition = function (duration) {\n                if (typeof duration !== 'string') {\n                    duration = duration + 'ms';\n                }\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;\n                }\n                return this;\n            };\n        }\n    }\n\n    ionic.views.Swiper = Swiper;\n})();\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Toggle = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var self = this;\n\n      this.el = opts.el;\n      this.checkbox = opts.checkbox;\n      this.track = opts.track;\n      this.handle = opts.handle;\n      this.openPercent = -1;\n      this.onChange = opts.onChange || function() {};\n\n      this.triggerThreshold = opts.triggerThreshold || 20;\n\n      this.dragStartHandler = function(e) {\n        self.dragStart(e);\n      };\n      this.dragHandler = function(e) {\n        self.drag(e);\n      };\n      this.holdHandler = function(e) {\n        self.hold(e);\n      };\n      this.releaseHandler = function(e) {\n        self.release(e);\n      };\n\n      this.dragStartGesture = ionic.onGesture('dragstart', this.dragStartHandler, this.el);\n      this.dragGesture = ionic.onGesture('drag', this.dragHandler, this.el);\n      this.dragHoldGesture = ionic.onGesture('hold', this.holdHandler, this.el);\n      this.dragReleaseGesture = ionic.onGesture('release', this.releaseHandler, this.el);\n    },\n\n    destroy: function() {\n      ionic.offGesture(this.dragStartGesture, 'dragstart', this.dragStartGesture);\n      ionic.offGesture(this.dragGesture, 'drag', this.dragGesture);\n      ionic.offGesture(this.dragHoldGesture, 'hold', this.holdHandler);\n      ionic.offGesture(this.dragReleaseGesture, 'release', this.releaseHandler);\n    },\n\n    tap: function() {\n      if(this.el.getAttribute('disabled') !== 'disabled') {\n        this.val( !this.checkbox.checked );\n      }\n    },\n\n    dragStart: function(e) {\n      if(this.checkbox.disabled) return;\n\n      this._dragInfo = {\n        width: this.el.offsetWidth,\n        left: this.el.offsetLeft,\n        right: this.el.offsetLeft + this.el.offsetWidth,\n        triggerX: this.el.offsetWidth / 2,\n        initialState: this.checkbox.checked\n      };\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      // Trigger hold styles\n      this.hold(e);\n    },\n\n    drag: function(e) {\n      var self = this;\n      if(!this._dragInfo) { return; }\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      ionic.requestAnimationFrame(function () {\n        if (!self._dragInfo) { return; }\n\n        var px = e.gesture.touches[0].pageX - self._dragInfo.left;\n        var mx = self._dragInfo.width - self.triggerThreshold;\n\n        // The initial state was on, so \"tend towards\" on\n        if(self._dragInfo.initialState) {\n          if(px < self.triggerThreshold) {\n            self.setOpenPercent(0);\n          } else if(px > self._dragInfo.triggerX) {\n            self.setOpenPercent(100);\n          }\n        } else {\n          // The initial state was off, so \"tend towards\" off\n          if(px < self._dragInfo.triggerX) {\n            self.setOpenPercent(0);\n          } else if(px > mx) {\n            self.setOpenPercent(100);\n          }\n        }\n      });\n    },\n\n    endDrag: function() {\n      this._dragInfo = null;\n    },\n\n    hold: function() {\n      this.el.classList.add('dragging');\n    },\n    release: function(e) {\n      this.el.classList.remove('dragging');\n      this.endDrag(e);\n    },\n\n\n    setOpenPercent: function(openPercent) {\n      // only make a change if the new open percent has changed\n      if(this.openPercent < 0 || (openPercent < (this.openPercent - 3) || openPercent > (this.openPercent + 3) ) ) {\n        this.openPercent = openPercent;\n\n        if(openPercent === 0) {\n          this.val(false);\n        } else if(openPercent === 100) {\n          this.val(true);\n        } else {\n          var openPixel = Math.round( (openPercent / 100) * this.track.offsetWidth - (this.handle.offsetWidth) );\n          openPixel = (openPixel < 1 ? 0 : openPixel);\n          this.handle.style[ionic.CSS.TRANSFORM] = 'translate3d(' + openPixel + 'px,0,0)';\n        }\n      }\n    },\n\n    val: function(value) {\n      if(value === true || value === false) {\n        if(this.handle.style[ionic.CSS.TRANSFORM] !== \"\") {\n          this.handle.style[ionic.CSS.TRANSFORM] = \"\";\n        }\n        this.checkbox.checked = value;\n        this.openPercent = (value ? 100 : 0);\n        this.onChange && this.onChange();\n      }\n      return this.checkbox.checked;\n    }\n\n  });\n\n})(ionic);\n\n})();\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, document, undefined) {'use strict';\n\n/**\n * @description\n *\n * This object provides a utility for producing rich Error messages within\n * Angular. It can be called as follows:\n *\n * var exampleMinErr = minErr('example');\n * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);\n *\n * The above creates an instance of minErr in the example namespace. The\n * resulting error will have a namespaced error code of example.one.  The\n * resulting error will replace {0} with the value of foo, and {1} with the\n * value of bar. The object is not restricted in the number of arguments it can\n * take.\n *\n * If fewer arguments are specified than necessary for interpolation, the extra\n * interpolation markers will be preserved in the final string.\n *\n * Since data will be parsed statically during a build step, some restrictions\n * are applied with respect to how minErr instances are created and called.\n * Instances should have names of the form namespaceMinErr for a minErr created\n * using minErr('namespace') . Error codes, namespaces and template strings\n * should all be static strings, not variables or general expressions.\n *\n * @param {string} module The namespace to use for the new minErr instance.\n * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning\n *   error from returned function, for cases when a particular type of error is useful.\n * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance\n */\n\nfunction minErr(module, ErrorConstructor) {\n  ErrorConstructor = ErrorConstructor || Error;\n  return function() {\n    var SKIP_INDEXES = 2;\n\n    var templateArgs = arguments,\n      code = templateArgs[0],\n      message = '[' + (module ? module + ':' : '') + code + '] ',\n      template = templateArgs[1],\n      paramPrefix, i;\n\n    message += template.replace(/\\{\\d+\\}/g, function(match) {\n      var index = +match.slice(1, -1),\n        shiftedIndex = index + SKIP_INDEXES;\n\n      if (shiftedIndex < templateArgs.length) {\n        return toDebugString(templateArgs[shiftedIndex]);\n      }\n\n      return match;\n    });\n\n    message += '\\nhttp://errors.angularjs.org/1.5.3/' +\n      (module ? module + '/' : '') + code;\n\n    for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {\n      message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +\n        encodeURIComponent(toDebugString(templateArgs[i]));\n    }\n\n    return new ErrorConstructor(message);\n  };\n}\n\n/* We need to tell jshint what variables are being exported */\n/* global angular: true,\n  msie: true,\n  jqLite: true,\n  jQuery: true,\n  slice: true,\n  splice: true,\n  push: true,\n  toString: true,\n  ngMinErr: true,\n  angularModule: true,\n  uid: true,\n  REGEX_STRING_REGEXP: true,\n  VALIDITY_STATE_PROPERTY: true,\n\n  lowercase: true,\n  uppercase: true,\n  manualLowercase: true,\n  manualUppercase: true,\n  nodeName_: true,\n  isArrayLike: true,\n  forEach: true,\n  forEachSorted: true,\n  reverseParams: true,\n  nextUid: true,\n  setHashKey: true,\n  extend: true,\n  toInt: true,\n  inherit: true,\n  merge: true,\n  noop: true,\n  identity: true,\n  valueFn: true,\n  isUndefined: true,\n  isDefined: true,\n  isObject: true,\n  isBlankObject: true,\n  isString: true,\n  isNumber: true,\n  isDate: true,\n  isArray: true,\n  isFunction: true,\n  isRegExp: true,\n  isWindow: true,\n  isScope: true,\n  isFile: true,\n  isFormData: true,\n  isBlob: true,\n  isBoolean: true,\n  isPromiseLike: true,\n  trim: true,\n  escapeForRegexp: true,\n  isElement: true,\n  makeMap: true,\n  includes: true,\n  arrayRemove: true,\n  copy: true,\n  shallowCopy: true,\n  equals: true,\n  csp: true,\n  jq: true,\n  concat: true,\n  sliceArgs: true,\n  bind: true,\n  toJsonReplacer: true,\n  toJson: true,\n  fromJson: true,\n  convertTimezoneToLocal: true,\n  timezoneToOffset: true,\n  startingTag: true,\n  tryDecodeURIComponent: true,\n  parseKeyValue: true,\n  toKeyValue: true,\n  encodeUriSegment: true,\n  encodeUriQuery: true,\n  angularInit: true,\n  bootstrap: true,\n  getTestability: true,\n  snake_case: true,\n  bindJQuery: true,\n  assertArg: true,\n  assertArgFn: true,\n  assertNotHasOwnProperty: true,\n  getter: true,\n  getBlockNodes: true,\n  hasOwnProperty: true,\n  createMap: true,\n\n  NODE_TYPE_ELEMENT: true,\n  NODE_TYPE_ATTRIBUTE: true,\n  NODE_TYPE_TEXT: true,\n  NODE_TYPE_COMMENT: true,\n  NODE_TYPE_DOCUMENT: true,\n  NODE_TYPE_DOCUMENT_FRAGMENT: true,\n*/\n\n////////////////////////////////////\n\n/**\n * @ngdoc module\n * @name ng\n * @module ng\n * @description\n *\n * # ng (core module)\n * The ng module is loaded by default when an AngularJS application is started. The module itself\n * contains the essential components for an AngularJS application to function. The table below\n * lists a high level breakdown of each of the services/factories, filters, directives and testing\n * components available within this core module.\n *\n * <div doc-module-components=\"ng\"></div>\n */\n\nvar REGEX_STRING_REGEXP = /^\\/(.+)\\/([a-z]*)$/;\n\n// The name of a form control's ValidityState property.\n// This is used so that it's possible for internal tests to create mock ValidityStates.\nvar VALIDITY_STATE_PROPERTY = 'validity';\n\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};\nvar uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};\n\n\nvar manualLowercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})\n      : s;\n};\nvar manualUppercase = function(s) {\n  /* jshint bitwise: false */\n  return isString(s)\n      ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})\n      : s;\n};\n\n\n// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish\n// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods\n// with correct but slower alternatives. See https://github.com/angular/angular.js/issues/11387\nif ('i' !== 'I'.toLowerCase()) {\n  lowercase = manualLowercase;\n  uppercase = manualUppercase;\n}\n\n\nvar\n    msie,             // holds major version number for IE, or NaN if UA is not IE.\n    jqLite,           // delay binding since jQuery could be loaded after us.\n    jQuery,           // delay binding\n    slice             = [].slice,\n    splice            = [].splice,\n    push              = [].push,\n    toString          = Object.prototype.toString,\n    getPrototypeOf    = Object.getPrototypeOf,\n    ngMinErr          = minErr('ng'),\n\n    /** @name angular */\n    angular           = window.angular || (window.angular = {}),\n    angularModule,\n    uid               = 0;\n\n/**\n * documentMode is an IE-only property\n * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx\n */\nmsie = document.documentMode;\n\n\n/**\n * @private\n * @param {*} obj\n * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,\n *                   String ...)\n */\nfunction isArrayLike(obj) {\n\n  // `null`, `undefined` and `window` are not array-like\n  if (obj == null || isWindow(obj)) return false;\n\n  // arrays, strings and jQuery/jqLite objects are array like\n  // * jqLite is either the jQuery or jqLite constructor function\n  // * we have to check the existence of jqLite first as this method is called\n  //   via the forEach method when constructing the jqLite object in the first place\n  if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;\n\n  // Support: iOS 8.2 (not reproducible in simulator)\n  // \"length\" in obj used to prevent JIT error (gh-11508)\n  var length = \"length\" in Object(obj) && obj.length;\n\n  // NodeList objects (with `item` method) and\n  // other objects with suitable length characteristics are array-like\n  return isNumber(length) &&\n    (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');\n\n}\n\n/**\n * @ngdoc function\n * @name angular.forEach\n * @module ng\n * @kind function\n *\n * @description\n * Invokes the `iterator` function once for each item in `obj` collection, which can be either an\n * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`\n * is the value of an object property or an array element, `key` is the object property key or\n * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.\n *\n * It is worth noting that `.forEach` does not iterate over inherited properties because it filters\n * using the `hasOwnProperty` method.\n *\n * Unlike ES262's\n * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),\n * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just\n * return the value provided.\n *\n   ```js\n     var values = {name: 'misko', gender: 'male'};\n     var log = [];\n     angular.forEach(values, function(value, key) {\n       this.push(key + ': ' + value);\n     }, log);\n     expect(log).toEqual(['name: misko', 'gender: male']);\n   ```\n *\n * @param {Object|Array} obj Object to iterate over.\n * @param {Function} iterator Iterator function.\n * @param {Object=} context Object to become context (`this`) for the iterator function.\n * @returns {Object|Array} Reference to `obj`.\n */\n\nfunction forEach(obj, iterator, context) {\n  var key, length;\n  if (obj) {\n    if (isFunction(obj)) {\n      for (key in obj) {\n        // Need to check if hasOwnProperty exists,\n        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function\n        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else if (isArray(obj) || isArrayLike(obj)) {\n      var isPrimitive = typeof obj !== 'object';\n      for (key = 0, length = obj.length; key < length; key++) {\n        if (isPrimitive || key in obj) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else if (obj.forEach && obj.forEach !== forEach) {\n        obj.forEach(iterator, context, obj);\n    } else if (isBlankObject(obj)) {\n      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n      for (key in obj) {\n        iterator.call(context, obj[key], key, obj);\n      }\n    } else if (typeof obj.hasOwnProperty === 'function') {\n      // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed\n      for (key in obj) {\n        if (obj.hasOwnProperty(key)) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    } else {\n      // Slow path for objects which do not have a method `hasOwnProperty`\n      for (key in obj) {\n        if (hasOwnProperty.call(obj, key)) {\n          iterator.call(context, obj[key], key, obj);\n        }\n      }\n    }\n  }\n  return obj;\n}\n\nfunction forEachSorted(obj, iterator, context) {\n  var keys = Object.keys(obj).sort();\n  for (var i = 0; i < keys.length; i++) {\n    iterator.call(context, obj[keys[i]], keys[i]);\n  }\n  return keys;\n}\n\n\n/**\n * when using forEach the params are value, key, but it is often useful to have key, value.\n * @param {function(string, *)} iteratorFn\n * @returns {function(*, string)}\n */\nfunction reverseParams(iteratorFn) {\n  return function(value, key) {iteratorFn(key, value);};\n}\n\n/**\n * A consistent way of creating unique IDs in angular.\n *\n * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before\n * we hit number precision issues in JavaScript.\n *\n * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M\n *\n * @returns {number} an unique alpha-numeric string\n */\nfunction nextUid() {\n  return ++uid;\n}\n\n\n/**\n * Set or clear the hashkey for an object.\n * @param obj object\n * @param h the hashkey (!truthy to delete the hashkey)\n */\nfunction setHashKey(obj, h) {\n  if (h) {\n    obj.$$hashKey = h;\n  } else {\n    delete obj.$$hashKey;\n  }\n}\n\n\nfunction baseExtend(dst, objs, deep) {\n  var h = dst.$$hashKey;\n\n  for (var i = 0, ii = objs.length; i < ii; ++i) {\n    var obj = objs[i];\n    if (!isObject(obj) && !isFunction(obj)) continue;\n    var keys = Object.keys(obj);\n    for (var j = 0, jj = keys.length; j < jj; j++) {\n      var key = keys[j];\n      var src = obj[key];\n\n      if (deep && isObject(src)) {\n        if (isDate(src)) {\n          dst[key] = new Date(src.valueOf());\n        } else if (isRegExp(src)) {\n          dst[key] = new RegExp(src);\n        } else if (src.nodeName) {\n          dst[key] = src.cloneNode(true);\n        } else if (isElement(src)) {\n          dst[key] = src.clone();\n        } else {\n          if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};\n          baseExtend(dst[key], [src], true);\n        }\n      } else {\n        dst[key] = src;\n      }\n    }\n  }\n\n  setHashKey(dst, h);\n  return dst;\n}\n\n/**\n * @ngdoc function\n * @name angular.extend\n * @module ng\n * @kind function\n *\n * @description\n * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.\n *\n * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use\n * {@link angular.merge} for this.\n *\n * @param {Object} dst Destination object.\n * @param {...Object} src Source object(s).\n * @returns {Object} Reference to `dst`.\n */\nfunction extend(dst) {\n  return baseExtend(dst, slice.call(arguments, 1), false);\n}\n\n\n/**\n* @ngdoc function\n* @name angular.merge\n* @module ng\n* @kind function\n*\n* @description\n* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)\n* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so\n* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.\n*\n* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source\n* objects, performing a deep copy.\n*\n* @param {Object} dst Destination object.\n* @param {...Object} src Source object(s).\n* @returns {Object} Reference to `dst`.\n*/\nfunction merge(dst) {\n  return baseExtend(dst, slice.call(arguments, 1), true);\n}\n\n\n\nfunction toInt(str) {\n  return parseInt(str, 10);\n}\n\n\nfunction inherit(parent, extra) {\n  return extend(Object.create(parent), extra);\n}\n\n/**\n * @ngdoc function\n * @name angular.noop\n * @module ng\n * @kind function\n *\n * @description\n * A function that performs no operations. This function can be useful when writing code in the\n * functional style.\n   ```js\n     function foo(callback) {\n       var result = calculateResult();\n       (callback || angular.noop)(result);\n     }\n   ```\n */\nfunction noop() {}\nnoop.$inject = [];\n\n\n/**\n * @ngdoc function\n * @name angular.identity\n * @module ng\n * @kind function\n *\n * @description\n * A function that returns its first argument. This function is useful when writing code in the\n * functional style.\n *\n   ```js\n     function transformer(transformationFn, value) {\n       return (transformationFn || angular.identity)(value);\n     };\n   ```\n  * @param {*} value to be returned.\n  * @returns {*} the value passed in.\n */\nfunction identity($) {return $;}\nidentity.$inject = [];\n\n\nfunction valueFn(value) {return function valueRef() {return value;};}\n\nfunction hasCustomToString(obj) {\n  return isFunction(obj.toString) && obj.toString !== toString;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isUndefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is undefined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is undefined.\n */\nfunction isUndefined(value) {return typeof value === 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDefined\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is defined.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is defined.\n */\nfunction isDefined(value) {return typeof value !== 'undefined';}\n\n\n/**\n * @ngdoc function\n * @name angular.isObject\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not\n * considered to be objects. Note that JavaScript arrays are objects.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Object` but not `null`.\n */\nfunction isObject(value) {\n  // http://jsperf.com/isobject4\n  return value !== null && typeof value === 'object';\n}\n\n\n/**\n * Determine if a value is an object with a null prototype\n *\n * @returns {boolean} True if `value` is an `Object` with a null prototype\n */\nfunction isBlankObject(value) {\n  return value !== null && typeof value === 'object' && !getPrototypeOf(value);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isString\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `String`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `String`.\n */\nfunction isString(value) {return typeof value === 'string';}\n\n\n/**\n * @ngdoc function\n * @name angular.isNumber\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Number`.\n *\n * This includes the \"special\" numbers `NaN`, `+Infinity` and `-Infinity`.\n *\n * If you wish to exclude these then you can use the native\n * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)\n * method.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Number`.\n */\nfunction isNumber(value) {return typeof value === 'number';}\n\n\n/**\n * @ngdoc function\n * @name angular.isDate\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a value is a date.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Date`.\n */\nfunction isDate(value) {\n  return toString.call(value) === '[object Date]';\n}\n\n\n/**\n * @ngdoc function\n * @name angular.isArray\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is an `Array`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is an `Array`.\n */\nvar isArray = Array.isArray;\n\n/**\n * @ngdoc function\n * @name angular.isFunction\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a `Function`.\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `Function`.\n */\nfunction isFunction(value) {return typeof value === 'function';}\n\n\n/**\n * Determines if a value is a regular expression object.\n *\n * @private\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a `RegExp`.\n */\nfunction isRegExp(value) {\n  return toString.call(value) === '[object RegExp]';\n}\n\n\n/**\n * Checks if `obj` is a window object.\n *\n * @private\n * @param {*} obj Object to check\n * @returns {boolean} True if `obj` is a window obj.\n */\nfunction isWindow(obj) {\n  return obj && obj.window === obj;\n}\n\n\nfunction isScope(obj) {\n  return obj && obj.$evalAsync && obj.$watch;\n}\n\n\nfunction isFile(obj) {\n  return toString.call(obj) === '[object File]';\n}\n\n\nfunction isFormData(obj) {\n  return toString.call(obj) === '[object FormData]';\n}\n\n\nfunction isBlob(obj) {\n  return toString.call(obj) === '[object Blob]';\n}\n\n\nfunction isBoolean(value) {\n  return typeof value === 'boolean';\n}\n\n\nfunction isPromiseLike(obj) {\n  return obj && isFunction(obj.then);\n}\n\n\nvar TYPED_ARRAY_REGEXP = /^\\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\\]$/;\nfunction isTypedArray(value) {\n  return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));\n}\n\nfunction isArrayBuffer(obj) {\n  return toString.call(obj) === '[object ArrayBuffer]';\n}\n\n\nvar trim = function(value) {\n  return isString(value) ? value.trim() : value;\n};\n\n// Copied from:\n// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021\n// Prereq: s is a string.\nvar escapeForRegexp = function(s) {\n  return s.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g, '\\\\$1').\n           replace(/\\x08/g, '\\\\x08');\n};\n\n\n/**\n * @ngdoc function\n * @name angular.isElement\n * @module ng\n * @kind function\n *\n * @description\n * Determines if a reference is a DOM element (or wrapped jQuery element).\n *\n * @param {*} value Reference to check.\n * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).\n */\nfunction isElement(node) {\n  return !!(node &&\n    (node.nodeName  // we are a direct element\n    || (node.prop && node.attr && node.find)));  // we have an on and find method part of jQuery API\n}\n\n/**\n * @param str 'key1,key2,...'\n * @returns {object} in the form of {key1:true, key2:true, ...}\n */\nfunction makeMap(str) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) {\n    obj[items[i]] = true;\n  }\n  return obj;\n}\n\n\nfunction nodeName_(element) {\n  return lowercase(element.nodeName || (element[0] && element[0].nodeName));\n}\n\nfunction includes(array, obj) {\n  return Array.prototype.indexOf.call(array, obj) != -1;\n}\n\nfunction arrayRemove(array, value) {\n  var index = array.indexOf(value);\n  if (index >= 0) {\n    array.splice(index, 1);\n  }\n  return index;\n}\n\n/**\n * @ngdoc function\n * @name angular.copy\n * @module ng\n * @kind function\n *\n * @description\n * Creates a deep copy of `source`, which should be an object or an array.\n *\n * * If no destination is supplied, a copy of the object or array is created.\n * * If a destination is provided, all of its elements (for arrays) or properties (for objects)\n *   are deleted and then all elements/properties from the source are copied to it.\n * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.\n * * If `source` is identical to 'destination' an exception will be thrown.\n *\n * @param {*} source The source that will be used to make a copy.\n *                   Can be any type, including primitives, `null`, and `undefined`.\n * @param {(Object|Array)=} destination Destination into which the source is copied. If\n *     provided, must be of the same type as `source`.\n * @returns {*} The copy or updated `destination`, if `destination` was specified.\n *\n * @example\n <example module=\"copyExample\">\n <file name=\"index.html\">\n <div ng-controller=\"ExampleController\">\n <form novalidate class=\"simple-form\">\n Name: <input type=\"text\" ng-model=\"user.name\" /><br />\n E-mail: <input type=\"email\" ng-model=\"user.email\" /><br />\n Gender: <input type=\"radio\" ng-model=\"user.gender\" value=\"male\" />male\n <input type=\"radio\" ng-model=\"user.gender\" value=\"female\" />female<br />\n <button ng-click=\"reset()\">RESET</button>\n <button ng-click=\"update(user)\">SAVE</button>\n </form>\n <pre>form = {{user | json}}</pre>\n <pre>master = {{master | json}}</pre>\n </div>\n\n <script>\n  angular.module('copyExample', [])\n    .controller('ExampleController', ['$scope', function($scope) {\n      $scope.master= {};\n\n      $scope.update = function(user) {\n        // Example with 1 argument\n        $scope.master= angular.copy(user);\n      };\n\n      $scope.reset = function() {\n        // Example with 2 arguments\n        angular.copy($scope.master, $scope.user);\n      };\n\n      $scope.reset();\n    }]);\n </script>\n </file>\n </example>\n */\nfunction copy(source, destination) {\n  var stackSource = [];\n  var stackDest = [];\n\n  if (destination) {\n    if (isTypedArray(destination) || isArrayBuffer(destination)) {\n      throw ngMinErr('cpta', \"Can't copy! TypedArray destination cannot be mutated.\");\n    }\n    if (source === destination) {\n      throw ngMinErr('cpi', \"Can't copy! Source and destination are identical.\");\n    }\n\n    // Empty the destination object\n    if (isArray(destination)) {\n      destination.length = 0;\n    } else {\n      forEach(destination, function(value, key) {\n        if (key !== '$$hashKey') {\n          delete destination[key];\n        }\n      });\n    }\n\n    stackSource.push(source);\n    stackDest.push(destination);\n    return copyRecurse(source, destination);\n  }\n\n  return copyElement(source);\n\n  function copyRecurse(source, destination) {\n    var h = destination.$$hashKey;\n    var key;\n    if (isArray(source)) {\n      for (var i = 0, ii = source.length; i < ii; i++) {\n        destination.push(copyElement(source[i]));\n      }\n    } else if (isBlankObject(source)) {\n      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty\n      for (key in source) {\n        destination[key] = copyElement(source[key]);\n      }\n    } else if (source && typeof source.hasOwnProperty === 'function') {\n      // Slow path, which must rely on hasOwnProperty\n      for (key in source) {\n        if (source.hasOwnProperty(key)) {\n          destination[key] = copyElement(source[key]);\n        }\n      }\n    } else {\n      // Slowest path --- hasOwnProperty can't be called as a method\n      for (key in source) {\n        if (hasOwnProperty.call(source, key)) {\n          destination[key] = copyElement(source[key]);\n        }\n      }\n    }\n    setHashKey(destination, h);\n    return destination;\n  }\n\n  function copyElement(source) {\n    // Simple values\n    if (!isObject(source)) {\n      return source;\n    }\n\n    // Already copied values\n    var index = stackSource.indexOf(source);\n    if (index !== -1) {\n      return stackDest[index];\n    }\n\n    if (isWindow(source) || isScope(source)) {\n      throw ngMinErr('cpws',\n        \"Can't copy! Making copies of Window or Scope instances is not supported.\");\n    }\n\n    var needsRecurse = false;\n    var destination = copyType(source);\n\n    if (destination === undefined) {\n      destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));\n      needsRecurse = true;\n    }\n\n    stackSource.push(source);\n    stackDest.push(destination);\n\n    return needsRecurse\n      ? copyRecurse(source, destination)\n      : destination;\n  }\n\n  function copyType(source) {\n    switch (toString.call(source)) {\n      case '[object Int8Array]':\n      case '[object Int16Array]':\n      case '[object Int32Array]':\n      case '[object Float32Array]':\n      case '[object Float64Array]':\n      case '[object Uint8Array]':\n      case '[object Uint8ClampedArray]':\n      case '[object Uint16Array]':\n      case '[object Uint32Array]':\n        return new source.constructor(copyElement(source.buffer));\n\n      case '[object ArrayBuffer]':\n        //Support: IE10\n        if (!source.slice) {\n          var copied = new ArrayBuffer(source.byteLength);\n          new Uint8Array(copied).set(new Uint8Array(source));\n          return copied;\n        }\n        return source.slice(0);\n\n      case '[object Boolean]':\n      case '[object Number]':\n      case '[object String]':\n      case '[object Date]':\n        return new source.constructor(source.valueOf());\n\n      case '[object RegExp]':\n        var re = new RegExp(source.source, source.toString().match(/[^\\/]*$/)[0]);\n        re.lastIndex = source.lastIndex;\n        return re;\n\n      case '[object Blob]':\n        return new source.constructor([source], {type: source.type});\n    }\n\n    if (isFunction(source.cloneNode)) {\n      return source.cloneNode(true);\n    }\n  }\n}\n\n/**\n * Creates a shallow copy of an object, an array or a primitive.\n *\n * Assumes that there are no proto properties for objects.\n */\nfunction shallowCopy(src, dst) {\n  if (isArray(src)) {\n    dst = dst || [];\n\n    for (var i = 0, ii = src.length; i < ii; i++) {\n      dst[i] = src[i];\n    }\n  } else if (isObject(src)) {\n    dst = dst || {};\n\n    for (var key in src) {\n      if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {\n        dst[key] = src[key];\n      }\n    }\n  }\n\n  return dst || src;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.equals\n * @module ng\n * @kind function\n *\n * @description\n * Determines if two objects or two values are equivalent. Supports value types, regular\n * expressions, arrays and objects.\n *\n * Two objects or values are considered equivalent if at least one of the following is true:\n *\n * * Both objects or values pass `===` comparison.\n * * Both objects or values are of the same type and all of their properties are equal by\n *   comparing them with `angular.equals`.\n * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)\n * * Both values represent the same regular expression (In JavaScript,\n *   /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual\n *   representation matches).\n *\n * During a property comparison, properties of `function` type and properties with names\n * that begin with `$` are ignored.\n *\n * Scope and DOMWindow objects are being compared only by identify (`===`).\n *\n * @param {*} o1 Object or value to compare.\n * @param {*} o2 Object or value to compare.\n * @returns {boolean} True if arguments are equal.\n */\nfunction equals(o1, o2) {\n  if (o1 === o2) return true;\n  if (o1 === null || o2 === null) return false;\n  if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n  var t1 = typeof o1, t2 = typeof o2, length, key, keySet;\n  if (t1 == t2 && t1 == 'object') {\n    if (isArray(o1)) {\n      if (!isArray(o2)) return false;\n      if ((length = o1.length) == o2.length) {\n        for (key = 0; key < length; key++) {\n          if (!equals(o1[key], o2[key])) return false;\n        }\n        return true;\n      }\n    } else if (isDate(o1)) {\n      if (!isDate(o2)) return false;\n      return equals(o1.getTime(), o2.getTime());\n    } else if (isRegExp(o1)) {\n      if (!isRegExp(o2)) return false;\n      return o1.toString() == o2.toString();\n    } else {\n      if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||\n        isArray(o2) || isDate(o2) || isRegExp(o2)) return false;\n      keySet = createMap();\n      for (key in o1) {\n        if (key.charAt(0) === '$' || isFunction(o1[key])) continue;\n        if (!equals(o1[key], o2[key])) return false;\n        keySet[key] = true;\n      }\n      for (key in o2) {\n        if (!(key in keySet) &&\n            key.charAt(0) !== '$' &&\n            isDefined(o2[key]) &&\n            !isFunction(o2[key])) return false;\n      }\n      return true;\n    }\n  }\n  return false;\n}\n\nvar csp = function() {\n  if (!isDefined(csp.rules)) {\n\n\n    var ngCspElement = (document.querySelector('[ng-csp]') ||\n                    document.querySelector('[data-ng-csp]'));\n\n    if (ngCspElement) {\n      var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||\n                    ngCspElement.getAttribute('data-ng-csp');\n      csp.rules = {\n        noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),\n        noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)\n      };\n    } else {\n      csp.rules = {\n        noUnsafeEval: noUnsafeEval(),\n        noInlineStyle: false\n      };\n    }\n  }\n\n  return csp.rules;\n\n  function noUnsafeEval() {\n    try {\n      /* jshint -W031, -W054 */\n      new Function('');\n      /* jshint +W031, +W054 */\n      return false;\n    } catch (e) {\n      return true;\n    }\n  }\n};\n\n/**\n * @ngdoc directive\n * @module ng\n * @name ngJq\n *\n * @element ANY\n * @param {string=} ngJq the name of the library available under `window`\n * to be used for angular.element\n * @description\n * Use this directive to force the angular.element library.  This should be\n * used to force either jqLite by leaving ng-jq blank or setting the name of\n * the jquery variable under window (eg. jQuery).\n *\n * Since angular looks for this directive when it is loaded (doesn't wait for the\n * DOMContentLoaded event), it must be placed on an element that comes before the script\n * which loads angular. Also, only the first instance of `ng-jq` will be used and all\n * others ignored.\n *\n * @example\n * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.\n ```html\n <!doctype html>\n <html ng-app ng-jq>\n ...\n ...\n </html>\n ```\n * @example\n * This example shows how to use a jQuery based library of a different name.\n * The library name must be available at the top most 'window'.\n ```html\n <!doctype html>\n <html ng-app ng-jq=\"jQueryLib\">\n ...\n ...\n </html>\n ```\n */\nvar jq = function() {\n  if (isDefined(jq.name_)) return jq.name_;\n  var el;\n  var i, ii = ngAttrPrefixes.length, prefix, name;\n  for (i = 0; i < ii; ++i) {\n    prefix = ngAttrPrefixes[i];\n    if (el = document.querySelector('[' + prefix.replace(':', '\\\\:') + 'jq]')) {\n      name = el.getAttribute(prefix + 'jq');\n      break;\n    }\n  }\n\n  return (jq.name_ = name);\n};\n\nfunction concat(array1, array2, index) {\n  return array1.concat(slice.call(array2, index));\n}\n\nfunction sliceArgs(args, startIndex) {\n  return slice.call(args, startIndex || 0);\n}\n\n\n/* jshint -W101 */\n/**\n * @ngdoc function\n * @name angular.bind\n * @module ng\n * @kind function\n *\n * @description\n * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for\n * `fn`). You can supply optional `args` that are prebound to the function. This feature is also\n * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as\n * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).\n *\n * @param {Object} self Context which `fn` should be evaluated in.\n * @param {function()} fn Function to be bound.\n * @param {...*} args Optional arguments to be prebound to the `fn` function call.\n * @returns {function()} Function that wraps the `fn` with all the specified bindings.\n */\n/* jshint +W101 */\nfunction bind(self, fn) {\n  var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];\n  if (isFunction(fn) && !(fn instanceof RegExp)) {\n    return curryArgs.length\n      ? function() {\n          return arguments.length\n            ? fn.apply(self, concat(curryArgs, arguments, 0))\n            : fn.apply(self, curryArgs);\n        }\n      : function() {\n          return arguments.length\n            ? fn.apply(self, arguments)\n            : fn.call(self);\n        };\n  } else {\n    // in IE, native methods are not functions so they cannot be bound (note: they don't need to be)\n    return fn;\n  }\n}\n\n\nfunction toJsonReplacer(key, value) {\n  var val = value;\n\n  if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {\n    val = undefined;\n  } else if (isWindow(value)) {\n    val = '$WINDOW';\n  } else if (value &&  document === value) {\n    val = '$DOCUMENT';\n  } else if (isScope(value)) {\n    val = '$SCOPE';\n  }\n\n  return val;\n}\n\n\n/**\n * @ngdoc function\n * @name angular.toJson\n * @module ng\n * @kind function\n *\n * @description\n * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be\n * stripped since angular uses this notation internally.\n *\n * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.\n * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.\n *    If set to an integer, the JSON output will contain that many spaces per indentation.\n * @returns {string|undefined} JSON-ified string representing `obj`.\n */\nfunction toJson(obj, pretty) {\n  if (isUndefined(obj)) return undefined;\n  if (!isNumber(pretty)) {\n    pretty = pretty ? 2 : null;\n  }\n  return JSON.stringify(obj, toJsonReplacer, pretty);\n}\n\n\n/**\n * @ngdoc function\n * @name angular.fromJson\n * @module ng\n * @kind function\n *\n * @description\n * Deserializes a JSON string.\n *\n * @param {string} json JSON string to deserialize.\n * @returns {Object|Array|string|number} Deserialized JSON string.\n */\nfunction fromJson(json) {\n  return isString(json)\n      ? JSON.parse(json)\n      : json;\n}\n\n\nvar ALL_COLONS = /:/g;\nfunction timezoneToOffset(timezone, fallback) {\n  // IE/Edge do not \"understand\" colon (`:`) in timezone\n  timezone = timezone.replace(ALL_COLONS, '');\n  var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;\n  return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;\n}\n\n\nfunction addDateMinutes(date, minutes) {\n  date = new Date(date.getTime());\n  date.setMinutes(date.getMinutes() + minutes);\n  return date;\n}\n\n\nfunction convertTimezoneToLocal(date, timezone, reverse) {\n  reverse = reverse ? -1 : 1;\n  var dateTimezoneOffset = date.getTimezoneOffset();\n  var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n  return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));\n}\n\n\n/**\n * @returns {string} Returns the string representation of the element.\n */\nfunction startingTag(element) {\n  element = jqLite(element).clone();\n  try {\n    // turns out IE does not let you set .html() on elements which\n    // are not allowed to have children. So we just ignore it.\n    element.empty();\n  } catch (e) {}\n  var elemHtml = jqLite('<div>').append(element).html();\n  try {\n    return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :\n        elemHtml.\n          match(/^(<[^>]+>)/)[1].\n          replace(/^<([\\w\\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});\n  } catch (e) {\n    return lowercase(elemHtml);\n  }\n\n}\n\n\n/////////////////////////////////////////////////\n\n/**\n * Tries to decode the URI component without throwing an exception.\n *\n * @private\n * @param str value potential URI component to check.\n * @returns {boolean} True if `value` can be decoded\n * with the decodeURIComponent function.\n */\nfunction tryDecodeURIComponent(value) {\n  try {\n    return decodeURIComponent(value);\n  } catch (e) {\n    // Ignore any invalid uri component\n  }\n}\n\n\n/**\n * Parses an escaped url query string into key-value pairs.\n * @returns {Object.<string,boolean|Array>}\n */\nfunction parseKeyValue(/**string*/keyValue) {\n  var obj = {};\n  forEach((keyValue || \"\").split('&'), function(keyValue) {\n    var splitPoint, key, val;\n    if (keyValue) {\n      key = keyValue = keyValue.replace(/\\+/g,'%20');\n      splitPoint = keyValue.indexOf('=');\n      if (splitPoint !== -1) {\n        key = keyValue.substring(0, splitPoint);\n        val = keyValue.substring(splitPoint + 1);\n      }\n      key = tryDecodeURIComponent(key);\n      if (isDefined(key)) {\n        val = isDefined(val) ? tryDecodeURIComponent(val) : true;\n        if (!hasOwnProperty.call(obj, key)) {\n          obj[key] = val;\n        } else if (isArray(obj[key])) {\n          obj[key].push(val);\n        } else {\n          obj[key] = [obj[key],val];\n        }\n      }\n    }\n  });\n  return obj;\n}\n\nfunction toKeyValue(obj) {\n  var parts = [];\n  forEach(obj, function(value, key) {\n    if (isArray(value)) {\n      forEach(value, function(arrayValue) {\n        parts.push(encodeUriQuery(key, true) +\n                   (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));\n      });\n    } else {\n    parts.push(encodeUriQuery(key, true) +\n               (value === true ? '' : '=' + encodeUriQuery(value, true)));\n    }\n  });\n  return parts.length ? parts.join('&') : '';\n}\n\n\n/**\n * We need our custom method because encodeURIComponent is too aggressive and doesn't follow\n * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path\n * segments:\n *    segment       = *pchar\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriSegment(val) {\n  return encodeUriQuery(val, true).\n             replace(/%26/gi, '&').\n             replace(/%3D/gi, '=').\n             replace(/%2B/gi, '+');\n}\n\n\n/**\n * This method is intended for encoding *key* or *value* parts of query component. We need a custom\n * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be\n * encoded per http://tools.ietf.org/html/rfc3986:\n *    query       = *( pchar / \"/\" / \"?\" )\n *    pchar         = unreserved / pct-encoded / sub-delims / \":\" / \"@\"\n *    unreserved    = ALPHA / DIGIT / \"-\" / \".\" / \"_\" / \"~\"\n *    pct-encoded   = \"%\" HEXDIG HEXDIG\n *    sub-delims    = \"!\" / \"$\" / \"&\" / \"'\" / \"(\" / \")\"\n *                     / \"*\" / \"+\" / \",\" / \";\" / \"=\"\n */\nfunction encodeUriQuery(val, pctEncodeSpaces) {\n  return encodeURIComponent(val).\n             replace(/%40/gi, '@').\n             replace(/%3A/gi, ':').\n             replace(/%24/g, '$').\n             replace(/%2C/gi, ',').\n             replace(/%3B/gi, ';').\n             replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));\n}\n\nvar ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];\n\nfunction getNgAttribute(element, ngAttr) {\n  var attr, i, ii = ngAttrPrefixes.length;\n  for (i = 0; i < ii; ++i) {\n    attr = ngAttrPrefixes[i] + ngAttr;\n    if (isString(attr = element.getAttribute(attr))) {\n      return attr;\n    }\n  }\n  return null;\n}\n\n/**\n * @ngdoc directive\n * @name ngApp\n * @module ng\n *\n * @element ANY\n * @param {angular.Module} ngApp an optional application\n *   {@link angular.module module} name to load.\n * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be\n *   created in \"strict-di\" mode. This means that the application will fail to invoke functions which\n *   do not use explicit function annotation (and are thus unsuitable for minification), as described\n *   in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in\n *   tracking down the root of these bugs.\n *\n * @description\n *\n * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive\n * designates the **root element** of the application and is typically placed near the root element\n * of the page - e.g. on the `<body>` or `<html>` tags.\n *\n * There are a few things to keep in mind when using `ngApp`:\n * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`\n *   found in the document will be used to define the root element to auto-bootstrap as an\n *   application. To run multiple applications in an HTML document you must manually bootstrap them using\n *   {@link angular.bootstrap} instead.\n * - AngularJS applications cannot be nested within each other.\n * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.\n *   This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and\n *   {@link ngRoute.ngView `ngView`}.\n *   Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},\n *   causing animations to stop working and making the injector inaccessible from outside the app.\n *\n * You can specify an **AngularJS module** to be used as the root module for the application.  This\n * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It\n * should contain the application code needed or have dependencies on other modules that will\n * contain the code. See {@link angular.module} for more information.\n *\n * In the example below if the `ngApp` directive were not placed on the `html` element then the\n * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`\n * would not be resolved to `3`.\n *\n * `ngApp` is the easiest, and most common way to bootstrap an application.\n *\n <example module=\"ngAppDemo\">\n   <file name=\"index.html\">\n   <div ng-controller=\"ngAppDemoController\">\n     I can add: {{a}} + {{b}} =  {{ a+b }}\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {\n     $scope.a = 1;\n     $scope.b = 2;\n   });\n   </file>\n </example>\n *\n * Using `ngStrictDi`, you would see something like this:\n *\n <example ng-app-included=\"true\">\n   <file name=\"index.html\">\n   <div ng-app=\"ngAppStrictDemo\" ng-strict-di>\n       <div ng-controller=\"GoodController1\">\n           I can add: {{a}} + {{b}} =  {{ a+b }}\n\n           <p>This renders because the controller does not fail to\n              instantiate, by using explicit annotation style (see\n              script.js for details)\n           </p>\n       </div>\n\n       <div ng-controller=\"GoodController2\">\n           Name: <input ng-model=\"name\"><br />\n           Hello, {{name}}!\n\n           <p>This renders because the controller does not fail to\n              instantiate, by using explicit annotation style\n              (see script.js for details)\n           </p>\n       </div>\n\n       <div ng-controller=\"BadController\">\n           I can add: {{a}} + {{b}} =  {{ a+b }}\n\n           <p>The controller could not be instantiated, due to relying\n              on automatic function annotations (which are disabled in\n              strict mode). As such, the content of this section is not\n              interpolated, and there should be an error in your web console.\n           </p>\n       </div>\n   </div>\n   </file>\n   <file name=\"script.js\">\n   angular.module('ngAppStrictDemo', [])\n     // BadController will fail to instantiate, due to relying on automatic function annotation,\n     // rather than an explicit annotation\n     .controller('BadController', function($scope) {\n       $scope.a = 1;\n       $scope.b = 2;\n     })\n     // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,\n     // due to using explicit annotations using the array style and $inject property, respectively.\n     .controller('GoodController1', ['$scope', function($scope) {\n       $scope.a = 1;\n       $scope.b = 2;\n     }])\n     .controller('GoodController2', GoodController2);\n     function GoodController2($scope) {\n       $scope.name = \"World\";\n     }\n     GoodController2.$inject = ['$scope'];\n   </file>\n   <file name=\"style.css\">\n   div[ng-controller] {\n       margin-bottom: 1em;\n       -webkit-border-radius: 4px;\n       border-radius: 4px;\n       border: 1px solid;\n       padding: .5em;\n   }\n   div[ng-controller^=Good] {\n       border-color: #d6e9c6;\n       background-color: #dff0d8;\n       color: #3c763d;\n   }\n   div[ng-controller^=Bad] {\n       border-color: #ebccd1;\n       background-color: #f2dede;\n       color: #a94442;\n       margin-bottom: 0;\n   }\n   </file>\n </example>\n */\nfunction angularInit(element, bootstrap) {\n  var appElement,\n      module,\n      config = {};\n\n  // The element `element` has priority over any other element\n  forEach(ngAttrPrefixes, function(prefix) {\n    var name = prefix + 'app';\n\n    if (!appElement && element.hasAttribute && element.hasAttribute(name)) {\n      appElement = element;\n      module = element.getAttribute(name);\n    }\n  });\n  forEach(ngAttrPrefixes, function(prefix) {\n    var name = prefix + 'app';\n    var candidate;\n\n    if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\\\:') + ']'))) {\n      appElement = candidate;\n      module = candidate.getAttribute(name);\n    }\n  });\n  if (appElement) {\n    config.strictDi = getNgAttribute(appElement, \"strict-di\") !== null;\n    bootstrap(appElement, module ? [module] : [], config);\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.bootstrap\n * @module ng\n * @description\n * Use this function to manually start up angular application.\n *\n * For more information, see the {@link guide/bootstrap Bootstrap guide}.\n *\n * Angular will detect if it has been loaded into the browser more than once and only allow the\n * first loaded script to be bootstrapped and will report a warning to the browser console for\n * each of the subsequent scripts. This prevents strange results in applications, where otherwise\n * multiple instances of Angular try to work on the DOM.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.\n * They must use {@link ng.directive:ngApp ngApp}.\n * </div>\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},\n * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.\n * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},\n * causing animations to stop working and making the injector inaccessible from outside the app.\n * </div>\n *\n * ```html\n * <!doctype html>\n * <html>\n * <body>\n * <div ng-controller=\"WelcomeController\">\n *   {{greeting}}\n * </div>\n *\n * <script src=\"angular.js\"></script>\n * <script>\n *   var app = angular.module('demo', [])\n *   .controller('WelcomeController', function($scope) {\n *       $scope.greeting = 'Welcome!';\n *   });\n *   angular.bootstrap(document, ['demo']);\n * </script>\n * </body>\n * </html>\n * ```\n *\n * @param {DOMElement} element DOM element which is the root of angular application.\n * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.\n *     Each item in the array should be the name of a predefined module or a (DI annotated)\n *     function that will be invoked by the injector as a `config` block.\n *     See: {@link angular.module modules}\n * @param {Object=} config an object for defining configuration options for the application. The\n *     following keys are supported:\n *\n * * `strictDi` - disable automatic function annotation for the application. This is meant to\n *   assist in finding bugs which break minified code. Defaults to `false`.\n *\n * @returns {auto.$injector} Returns the newly created injector for this app.\n */\nfunction bootstrap(element, modules, config) {\n  if (!isObject(config)) config = {};\n  var defaultConfig = {\n    strictDi: false\n  };\n  config = extend(defaultConfig, config);\n  var doBootstrap = function() {\n    element = jqLite(element);\n\n    if (element.injector()) {\n      var tag = (element[0] === document) ? 'document' : startingTag(element);\n      //Encode angle brackets to prevent input from being sanitized to empty string #8683\n      throw ngMinErr(\n          'btstrpd',\n          \"App Already Bootstrapped with this Element '{0}'\",\n          tag.replace(/</,'&lt;').replace(/>/,'&gt;'));\n    }\n\n    modules = modules || [];\n    modules.unshift(['$provide', function($provide) {\n      $provide.value('$rootElement', element);\n    }]);\n\n    if (config.debugInfoEnabled) {\n      // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.\n      modules.push(['$compileProvider', function($compileProvider) {\n        $compileProvider.debugInfoEnabled(true);\n      }]);\n    }\n\n    modules.unshift('ng');\n    var injector = createInjector(modules, config.strictDi);\n    injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',\n       function bootstrapApply(scope, element, compile, injector) {\n        scope.$apply(function() {\n          element.data('$injector', injector);\n          compile(element)(scope);\n        });\n      }]\n    );\n    return injector;\n  };\n\n  var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;\n  var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;\n\n  if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {\n    config.debugInfoEnabled = true;\n    window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');\n  }\n\n  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {\n    return doBootstrap();\n  }\n\n  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');\n  angular.resumeBootstrap = function(extraModules) {\n    forEach(extraModules, function(module) {\n      modules.push(module);\n    });\n    return doBootstrap();\n  };\n\n  if (isFunction(angular.resumeDeferredBootstrap)) {\n    angular.resumeDeferredBootstrap();\n  }\n}\n\n/**\n * @ngdoc function\n * @name angular.reloadWithDebugInfo\n * @module ng\n * @description\n * Use this function to reload the current application with debug information turned on.\n * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.\n *\n * See {@link ng.$compileProvider#debugInfoEnabled} for more.\n */\nfunction reloadWithDebugInfo() {\n  window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;\n  window.location.reload();\n}\n\n/**\n * @name angular.getTestability\n * @module ng\n * @description\n * Get the testability service for the instance of Angular on the given\n * element.\n * @param {DOMElement} element DOM element which is the root of angular application.\n */\nfunction getTestability(rootElement) {\n  var injector = angular.element(rootElement).injector();\n  if (!injector) {\n    throw ngMinErr('test',\n      'no injector found for element argument to getTestability');\n  }\n  return injector.get('$$testability');\n}\n\nvar SNAKE_CASE_REGEXP = /[A-Z]/g;\nfunction snake_case(name, separator) {\n  separator = separator || '_';\n  return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {\n    return (pos ? separator : '') + letter.toLowerCase();\n  });\n}\n\nvar bindJQueryFired = false;\nfunction bindJQuery() {\n  var originalCleanData;\n\n  if (bindJQueryFired) {\n    return;\n  }\n\n  // bind to jQuery if present;\n  var jqName = jq();\n  jQuery = isUndefined(jqName) ? window.jQuery :   // use jQuery (if present)\n           !jqName             ? undefined     :   // use jqLite\n                                 window[jqName];   // use jQuery specified by `ngJq`\n\n  // Use jQuery if it exists with proper functionality, otherwise default to us.\n  // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.\n  // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older\n  // versions. It will not work for sure with jQuery <1.7, though.\n  if (jQuery && jQuery.fn.on) {\n    jqLite = jQuery;\n    extend(jQuery.fn, {\n      scope: JQLitePrototype.scope,\n      isolateScope: JQLitePrototype.isolateScope,\n      controller: JQLitePrototype.controller,\n      injector: JQLitePrototype.injector,\n      inheritedData: JQLitePrototype.inheritedData\n    });\n\n    // All nodes removed from the DOM via various jQuery APIs like .remove()\n    // are passed through jQuery.cleanData. Monkey-patch this method to fire\n    // the $destroy event on all removed nodes.\n    originalCleanData = jQuery.cleanData;\n    jQuery.cleanData = function(elems) {\n      var events;\n      for (var i = 0, elem; (elem = elems[i]) != null; i++) {\n        events = jQuery._data(elem, \"events\");\n        if (events && events.$destroy) {\n          jQuery(elem).triggerHandler('$destroy');\n        }\n      }\n      originalCleanData(elems);\n    };\n  } else {\n    jqLite = JQLite;\n  }\n\n  angular.element = jqLite;\n\n  // Prevent double-proxying.\n  bindJQueryFired = true;\n}\n\n/**\n * throw error if the argument is falsy.\n */\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction assertArgFn(arg, name, acceptArrayAnnotation) {\n  if (acceptArrayAnnotation && isArray(arg)) {\n      arg = arg[arg.length - 1];\n  }\n\n  assertArg(isFunction(arg), name, 'not a function, got ' +\n      (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));\n  return arg;\n}\n\n/**\n * throw error if the name given is hasOwnProperty\n * @param  {String} name    the name to test\n * @param  {String} context the context in which the name is used, such as module or directive\n */\nfunction assertNotHasOwnProperty(name, context) {\n  if (name === 'hasOwnProperty') {\n    throw ngMinErr('badname', \"hasOwnProperty is not a valid {0} name\", context);\n  }\n}\n\n/**\n * Return the value accessible from the object by path. Any undefined traversals are ignored\n * @param {Object} obj starting object\n * @param {String} path path to traverse\n * @param {boolean} [bindFnToScope=true]\n * @returns {Object} value as accessible by path\n */\n//TODO(misko): this function needs to be removed\nfunction getter(obj, path, bindFnToScope) {\n  if (!path) return obj;\n  var keys = path.split('.');\n  var key;\n  var lastInstance = obj;\n  var len = keys.length;\n\n  for (var i = 0; i < len; i++) {\n    key = keys[i];\n    if (obj) {\n      obj = (lastInstance = obj)[key];\n    }\n  }\n  if (!bindFnToScope && isFunction(obj)) {\n    return bind(lastInstance, obj);\n  }\n  return obj;\n}\n\n/**\n * Return the DOM siblings between the first and last node in the given array.\n * @param {Array} array like object\n * @returns {Array} the inputted object or a jqLite collection containing the nodes\n */\nfunction getBlockNodes(nodes) {\n  // TODO(perf): update `nodes` instead of creating a new object?\n  var node = nodes[0];\n  var endNode = nodes[nodes.length - 1];\n  var blockNodes;\n\n  for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {\n    if (blockNodes || nodes[i] !== node) {\n      if (!blockNodes) {\n        blockNodes = jqLite(slice.call(nodes, 0, i));\n      }\n      blockNodes.push(node);\n    }\n  }\n\n  return blockNodes || nodes;\n}\n\n\n/**\n * Creates a new object without a prototype. This object is useful for lookup without having to\n * guard against prototypically inherited properties via hasOwnProperty.\n *\n * Related micro-benchmarks:\n * - http://jsperf.com/object-create2\n * - http://jsperf.com/proto-map-lookup/2\n * - http://jsperf.com/for-in-vs-object-keys2\n *\n * @returns {Object}\n */\nfunction createMap() {\n  return Object.create(null);\n}\n\nvar NODE_TYPE_ELEMENT = 1;\nvar NODE_TYPE_ATTRIBUTE = 2;\nvar NODE_TYPE_TEXT = 3;\nvar NODE_TYPE_COMMENT = 8;\nvar NODE_TYPE_DOCUMENT = 9;\nvar NODE_TYPE_DOCUMENT_FRAGMENT = 11;\n\n/**\n * @ngdoc type\n * @name angular.Module\n * @module ng\n * @description\n *\n * Interface for configuring angular {@link angular.module modules}.\n */\n\nfunction setupModuleLoader(window) {\n\n  var $injectorMinErr = minErr('$injector');\n  var ngMinErr = minErr('ng');\n\n  function ensure(obj, name, factory) {\n    return obj[name] || (obj[name] = factory());\n  }\n\n  var angular = ensure(window, 'angular', Object);\n\n  // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap\n  angular.$$minErr = angular.$$minErr || minErr;\n\n  return ensure(angular, 'module', function() {\n    /** @type {Object.<string, angular.Module>} */\n    var modules = {};\n\n    /**\n     * @ngdoc function\n     * @name angular.module\n     * @module ng\n     * @description\n     *\n     * The `angular.module` is a global place for creating, registering and retrieving Angular\n     * modules.\n     * All modules (angular core or 3rd party) that should be available to an application must be\n     * registered using this mechanism.\n     *\n     * Passing one argument retrieves an existing {@link angular.Module},\n     * whereas passing more than one argument creates a new {@link angular.Module}\n     *\n     *\n     * # Module\n     *\n     * A module is a collection of services, directives, controllers, filters, and configuration information.\n     * `angular.module` is used to configure the {@link auto.$injector $injector}.\n     *\n     * ```js\n     * // Create a new module\n     * var myModule = angular.module('myModule', []);\n     *\n     * // register a new service\n     * myModule.value('appName', 'MyCoolApp');\n     *\n     * // configure existing services inside initialization blocks.\n     * myModule.config(['$locationProvider', function($locationProvider) {\n     *   // Configure existing providers\n     *   $locationProvider.hashPrefix('!');\n     * }]);\n     * ```\n     *\n     * Then you can create an injector and load your modules like this:\n     *\n     * ```js\n     * var injector = angular.injector(['ng', 'myModule'])\n     * ```\n     *\n     * However it's more likely that you'll just use\n     * {@link ng.directive:ngApp ngApp} or\n     * {@link angular.bootstrap} to simplify this process for you.\n     *\n     * @param {!string} name The name of the module to create or retrieve.\n     * @param {!Array.<string>=} requires If specified then new module is being created. If\n     *        unspecified then the module is being retrieved for further configuration.\n     * @param {Function=} configFn Optional configuration function for the module. Same as\n     *        {@link angular.Module#config Module#config()}.\n     * @returns {angular.Module} new module with the {@link angular.Module} api.\n     */\n    return function module(name, requires, configFn) {\n      var assertNotHasOwnProperty = function(name, context) {\n        if (name === 'hasOwnProperty') {\n          throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);\n        }\n      };\n\n      assertNotHasOwnProperty(name, 'module');\n      if (requires && modules.hasOwnProperty(name)) {\n        modules[name] = null;\n      }\n      return ensure(modules, name, function() {\n        if (!requires) {\n          throw $injectorMinErr('nomod', \"Module '{0}' is not available! You either misspelled \" +\n             \"the module name or forgot to load it. If registering a module ensure that you \" +\n             \"specify the dependencies as the second argument.\", name);\n        }\n\n        /** @type {!Array.<Array.<*>>} */\n        var invokeQueue = [];\n\n        /** @type {!Array.<Function>} */\n        var configBlocks = [];\n\n        /** @type {!Array.<Function>} */\n        var runBlocks = [];\n\n        var config = invokeLater('$injector', 'invoke', 'push', configBlocks);\n\n        /** @type {angular.Module} */\n        var moduleInstance = {\n          // Private state\n          _invokeQueue: invokeQueue,\n          _configBlocks: configBlocks,\n          _runBlocks: runBlocks,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#requires\n           * @module ng\n           *\n           * @description\n           * Holds the list of modules which the injector will load before the current module is\n           * loaded.\n           */\n          requires: requires,\n\n          /**\n           * @ngdoc property\n           * @name angular.Module#name\n           * @module ng\n           *\n           * @description\n           * Name of the module.\n           */\n          name: name,\n\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#provider\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerType Construction function for creating new instance of the\n           *                                service.\n           * @description\n           * See {@link auto.$provide#provider $provide.provider()}.\n           */\n          provider: invokeLaterAndSetModuleName('$provide', 'provider'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#factory\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} providerFunction Function for creating new instance of the service.\n           * @description\n           * See {@link auto.$provide#factory $provide.factory()}.\n           */\n          factory: invokeLaterAndSetModuleName('$provide', 'factory'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#service\n           * @module ng\n           * @param {string} name service name\n           * @param {Function} constructor A constructor function that will be instantiated.\n           * @description\n           * See {@link auto.$provide#service $provide.service()}.\n           */\n          service: invokeLaterAndSetModuleName('$provide', 'service'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#value\n           * @module ng\n           * @param {string} name service name\n           * @param {*} object Service instance object.\n           * @description\n           * See {@link auto.$provide#value $provide.value()}.\n           */\n          value: invokeLater('$provide', 'value'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#constant\n           * @module ng\n           * @param {string} name constant name\n           * @param {*} object Constant value.\n           * @description\n           * Because the constants are fixed, they get applied before other provide methods.\n           * See {@link auto.$provide#constant $provide.constant()}.\n           */\n          constant: invokeLater('$provide', 'constant', 'unshift'),\n\n           /**\n           * @ngdoc method\n           * @name angular.Module#decorator\n           * @module ng\n           * @param {string} The name of the service to decorate.\n           * @param {Function} This function will be invoked when the service needs to be\n           *                                    instantiated and should return the decorated service instance.\n           * @description\n           * See {@link auto.$provide#decorator $provide.decorator()}.\n           */\n          decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#animation\n           * @module ng\n           * @param {string} name animation name\n           * @param {Function} animationFactory Factory function for creating new instance of an\n           *                                    animation.\n           * @description\n           *\n           * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.\n           *\n           *\n           * Defines an animation hook that can be later used with\n           * {@link $animate $animate} service and directives that use this service.\n           *\n           * ```js\n           * module.animation('.animation-name', function($inject1, $inject2) {\n           *   return {\n           *     eventName : function(element, done) {\n           *       //code to run the animation\n           *       //once complete, then run done()\n           *       return function cancellationFunction(element) {\n           *         //code to cancel the animation\n           *       }\n           *     }\n           *   }\n           * })\n           * ```\n           *\n           * See {@link ng.$animateProvider#register $animateProvider.register()} and\n           * {@link ngAnimate ngAnimate module} for more information.\n           */\n          animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#filter\n           * @module ng\n           * @param {string} name Filter name - this must be a valid angular expression identifier\n           * @param {Function} filterFactory Factory function for creating new instance of filter.\n           * @description\n           * See {@link ng.$filterProvider#register $filterProvider.register()}.\n           *\n           * <div class=\"alert alert-warning\">\n           * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n           * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n           * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n           * (`myapp_subsection_filterx`).\n           * </div>\n           */\n          filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#controller\n           * @module ng\n           * @param {string|Object} name Controller name, or an object map of controllers where the\n           *    keys are the names and the values are the constructors.\n           * @param {Function} constructor Controller constructor function.\n           * @description\n           * See {@link ng.$controllerProvider#register $controllerProvider.register()}.\n           */\n          controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#directive\n           * @module ng\n           * @param {string|Object} name Directive name, or an object map of directives where the\n           *    keys are the names and the values are the factories.\n           * @param {Function} directiveFactory Factory function for creating new instance of\n           * directives.\n           * @description\n           * See {@link ng.$compileProvider#directive $compileProvider.directive()}.\n           */\n          directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#component\n           * @module ng\n           * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)\n           * @param {Object} options Component definition object (a simplified\n           *    {@link ng.$compile#directive-definition-object directive definition object})\n           *\n           * @description\n           * See {@link ng.$compileProvider#component $compileProvider.component()}.\n           */\n          component: invokeLaterAndSetModuleName('$compileProvider', 'component'),\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#config\n           * @module ng\n           * @param {Function} configFn Execute this function on module load. Useful for service\n           *    configuration.\n           * @description\n           * Use this method to register work which needs to be performed on module loading.\n           * For more about how to configure services, see\n           * {@link providers#provider-recipe Provider Recipe}.\n           */\n          config: config,\n\n          /**\n           * @ngdoc method\n           * @name angular.Module#run\n           * @module ng\n           * @param {Function} initializationFn Execute this function after injector creation.\n           *    Useful for application initialization.\n           * @description\n           * Use this method to register work which should be performed when the injector is done\n           * loading all modules.\n           */\n          run: function(block) {\n            runBlocks.push(block);\n            return this;\n          }\n        };\n\n        if (configFn) {\n          config(configFn);\n        }\n\n        return moduleInstance;\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @param {String=} insertMethod\n         * @returns {angular.Module}\n         */\n        function invokeLater(provider, method, insertMethod, queue) {\n          if (!queue) queue = invokeQueue;\n          return function() {\n            queue[insertMethod || 'push']([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n\n        /**\n         * @param {string} provider\n         * @param {string} method\n         * @returns {angular.Module}\n         */\n        function invokeLaterAndSetModuleName(provider, method) {\n          return function(recipeName, factoryFunction) {\n            if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;\n            invokeQueue.push([provider, method, arguments]);\n            return moduleInstance;\n          };\n        }\n      });\n    };\n  });\n\n}\n\n/* global: toDebugString: true */\n\nfunction serializeObject(obj) {\n  var seen = [];\n\n  return JSON.stringify(obj, function(key, val) {\n    val = toJsonReplacer(key, val);\n    if (isObject(val)) {\n\n      if (seen.indexOf(val) >= 0) return '...';\n\n      seen.push(val);\n    }\n    return val;\n  });\n}\n\nfunction toDebugString(obj) {\n  if (typeof obj === 'function') {\n    return obj.toString().replace(/ \\{[\\s\\S]*$/, '');\n  } else if (isUndefined(obj)) {\n    return 'undefined';\n  } else if (typeof obj !== 'string') {\n    return serializeObject(obj);\n  }\n  return obj;\n}\n\n/* global angularModule: true,\n  version: true,\n\n  $CompileProvider,\n\n  htmlAnchorDirective,\n  inputDirective,\n  inputDirective,\n  formDirective,\n  scriptDirective,\n  selectDirective,\n  styleDirective,\n  optionDirective,\n  ngBindDirective,\n  ngBindHtmlDirective,\n  ngBindTemplateDirective,\n  ngClassDirective,\n  ngClassEvenDirective,\n  ngClassOddDirective,\n  ngCloakDirective,\n  ngControllerDirective,\n  ngFormDirective,\n  ngHideDirective,\n  ngIfDirective,\n  ngIncludeDirective,\n  ngIncludeFillContentDirective,\n  ngInitDirective,\n  ngNonBindableDirective,\n  ngPluralizeDirective,\n  ngRepeatDirective,\n  ngShowDirective,\n  ngStyleDirective,\n  ngSwitchDirective,\n  ngSwitchWhenDirective,\n  ngSwitchDefaultDirective,\n  ngOptionsDirective,\n  ngTranscludeDirective,\n  ngModelDirective,\n  ngListDirective,\n  ngChangeDirective,\n  patternDirective,\n  patternDirective,\n  requiredDirective,\n  requiredDirective,\n  minlengthDirective,\n  minlengthDirective,\n  maxlengthDirective,\n  maxlengthDirective,\n  ngValueDirective,\n  ngModelOptionsDirective,\n  ngAttributeAliasDirectives,\n  ngEventDirectives,\n\n  $AnchorScrollProvider,\n  $AnimateProvider,\n  $CoreAnimateCssProvider,\n  $$CoreAnimateJsProvider,\n  $$CoreAnimateQueueProvider,\n  $$AnimateRunnerFactoryProvider,\n  $$AnimateAsyncRunFactoryProvider,\n  $BrowserProvider,\n  $CacheFactoryProvider,\n  $ControllerProvider,\n  $DateProvider,\n  $DocumentProvider,\n  $ExceptionHandlerProvider,\n  $FilterProvider,\n  $$ForceReflowProvider,\n  $InterpolateProvider,\n  $IntervalProvider,\n  $$HashMapProvider,\n  $HttpProvider,\n  $HttpParamSerializerProvider,\n  $HttpParamSerializerJQLikeProvider,\n  $HttpBackendProvider,\n  $xhrFactoryProvider,\n  $LocationProvider,\n  $LogProvider,\n  $ParseProvider,\n  $RootScopeProvider,\n  $QProvider,\n  $$QProvider,\n  $$SanitizeUriProvider,\n  $SceProvider,\n  $SceDelegateProvider,\n  $SnifferProvider,\n  $TemplateCacheProvider,\n  $TemplateRequestProvider,\n  $$TestabilityProvider,\n  $TimeoutProvider,\n  $$RAFProvider,\n  $WindowProvider,\n  $$jqLiteProvider,\n  $$CookieReaderProvider\n*/\n\n\n/**\n * @ngdoc object\n * @name angular.version\n * @module ng\n * @description\n * An object that contains information about the current AngularJS version.\n *\n * This object has the following properties:\n *\n * - `full` – `{string}` – Full version string, such as \"0.9.18\".\n * - `major` – `{number}` – Major version number, such as \"0\".\n * - `minor` – `{number}` – Minor version number, such as \"9\".\n * - `dot` – `{number}` – Dot version number, such as \"18\".\n * - `codeName` – `{string}` – Code name of the release, such as \"jiggling-armfat\".\n */\nvar version = {\n  full: '1.5.3',    // all of these placeholder strings will be replaced by grunt's\n  major: 1,    // package task\n  minor: 5,\n  dot: 3,\n  codeName: 'diplohaplontic-meiosis'\n};\n\n\nfunction publishExternalAPI(angular) {\n  extend(angular, {\n    'bootstrap': bootstrap,\n    'copy': copy,\n    'extend': extend,\n    'merge': merge,\n    'equals': equals,\n    'element': jqLite,\n    'forEach': forEach,\n    'injector': createInjector,\n    'noop': noop,\n    'bind': bind,\n    'toJson': toJson,\n    'fromJson': fromJson,\n    'identity': identity,\n    'isUndefined': isUndefined,\n    'isDefined': isDefined,\n    'isString': isString,\n    'isFunction': isFunction,\n    'isObject': isObject,\n    'isNumber': isNumber,\n    'isElement': isElement,\n    'isArray': isArray,\n    'version': version,\n    'isDate': isDate,\n    'lowercase': lowercase,\n    'uppercase': uppercase,\n    'callbacks': {counter: 0},\n    'getTestability': getTestability,\n    '$$minErr': minErr,\n    '$$csp': csp,\n    'reloadWithDebugInfo': reloadWithDebugInfo\n  });\n\n  angularModule = setupModuleLoader(window);\n\n  angularModule('ng', ['ngLocale'], ['$provide',\n    function ngModule($provide) {\n      // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.\n      $provide.provider({\n        $$sanitizeUri: $$SanitizeUriProvider\n      });\n      $provide.provider('$compile', $CompileProvider).\n        directive({\n            a: htmlAnchorDirective,\n            input: inputDirective,\n            textarea: inputDirective,\n            form: formDirective,\n            script: scriptDirective,\n            select: selectDirective,\n            style: styleDirective,\n            option: optionDirective,\n            ngBind: ngBindDirective,\n            ngBindHtml: ngBindHtmlDirective,\n            ngBindTemplate: ngBindTemplateDirective,\n            ngClass: ngClassDirective,\n            ngClassEven: ngClassEvenDirective,\n            ngClassOdd: ngClassOddDirective,\n            ngCloak: ngCloakDirective,\n            ngController: ngControllerDirective,\n            ngForm: ngFormDirective,\n            ngHide: ngHideDirective,\n            ngIf: ngIfDirective,\n            ngInclude: ngIncludeDirective,\n            ngInit: ngInitDirective,\n            ngNonBindable: ngNonBindableDirective,\n            ngPluralize: ngPluralizeDirective,\n            ngRepeat: ngRepeatDirective,\n            ngShow: ngShowDirective,\n            ngStyle: ngStyleDirective,\n            ngSwitch: ngSwitchDirective,\n            ngSwitchWhen: ngSwitchWhenDirective,\n            ngSwitchDefault: ngSwitchDefaultDirective,\n            ngOptions: ngOptionsDirective,\n            ngTransclude: ngTranscludeDirective,\n            ngModel: ngModelDirective,\n            ngList: ngListDirective,\n            ngChange: ngChangeDirective,\n            pattern: patternDirective,\n            ngPattern: patternDirective,\n            required: requiredDirective,\n            ngRequired: requiredDirective,\n            minlength: minlengthDirective,\n            ngMinlength: minlengthDirective,\n            maxlength: maxlengthDirective,\n            ngMaxlength: maxlengthDirective,\n            ngValue: ngValueDirective,\n            ngModelOptions: ngModelOptionsDirective\n        }).\n        directive({\n          ngInclude: ngIncludeFillContentDirective\n        }).\n        directive(ngAttributeAliasDirectives).\n        directive(ngEventDirectives);\n      $provide.provider({\n        $anchorScroll: $AnchorScrollProvider,\n        $animate: $AnimateProvider,\n        $animateCss: $CoreAnimateCssProvider,\n        $$animateJs: $$CoreAnimateJsProvider,\n        $$animateQueue: $$CoreAnimateQueueProvider,\n        $$AnimateRunner: $$AnimateRunnerFactoryProvider,\n        $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,\n        $browser: $BrowserProvider,\n        $cacheFactory: $CacheFactoryProvider,\n        $controller: $ControllerProvider,\n        $document: $DocumentProvider,\n        $exceptionHandler: $ExceptionHandlerProvider,\n        $filter: $FilterProvider,\n        $$forceReflow: $$ForceReflowProvider,\n        $interpolate: $InterpolateProvider,\n        $interval: $IntervalProvider,\n        $http: $HttpProvider,\n        $httpParamSerializer: $HttpParamSerializerProvider,\n        $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,\n        $httpBackend: $HttpBackendProvider,\n        $xhrFactory: $xhrFactoryProvider,\n        $location: $LocationProvider,\n        $log: $LogProvider,\n        $parse: $ParseProvider,\n        $rootScope: $RootScopeProvider,\n        $q: $QProvider,\n        $$q: $$QProvider,\n        $sce: $SceProvider,\n        $sceDelegate: $SceDelegateProvider,\n        $sniffer: $SnifferProvider,\n        $templateCache: $TemplateCacheProvider,\n        $templateRequest: $TemplateRequestProvider,\n        $$testability: $$TestabilityProvider,\n        $timeout: $TimeoutProvider,\n        $window: $WindowProvider,\n        $$rAF: $$RAFProvider,\n        $$jqLite: $$jqLiteProvider,\n        $$HashMap: $$HashMapProvider,\n        $$cookieReader: $$CookieReaderProvider\n      });\n    }\n  ]);\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* global JQLitePrototype: true,\n  addEventListenerFn: true,\n  removeEventListenerFn: true,\n  BOOLEAN_ATTR: true,\n  ALIASED_ATTR: true,\n*/\n\n//////////////////////////////////\n//JQLite\n//////////////////////////////////\n\n/**\n * @ngdoc function\n * @name angular.element\n * @module ng\n * @kind function\n *\n * @description\n * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.\n *\n * If jQuery is available, `angular.element` is an alias for the\n * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`\n * delegates to Angular's built-in subset of jQuery, called \"jQuery lite\" or **jqLite**.\n *\n * jqLite is a tiny, API-compatible subset of jQuery that allows\n * Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most\n * commonly needed functionality with the goal of having a very small footprint.\n *\n * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the\n * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a\n * specific version of jQuery if multiple versions exist on the page.\n *\n * <div class=\"alert alert-info\">**Note:** All element references in Angular are always wrapped with jQuery or\n * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>\n *\n * <div class=\"alert alert-warning\">**Note:** Keep in mind that this function will not find elements\n * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`\n * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>\n *\n * ## Angular's jqLite\n * jqLite provides only the following jQuery methods:\n *\n * - [`addClass()`](http://api.jquery.com/addClass/)\n * - [`after()`](http://api.jquery.com/after/)\n * - [`append()`](http://api.jquery.com/append/)\n * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters\n * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData\n * - [`children()`](http://api.jquery.com/children/) - Does not support selectors\n * - [`clone()`](http://api.jquery.com/clone/)\n * - [`contents()`](http://api.jquery.com/contents/)\n * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`.\n *   As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.\n * - [`data()`](http://api.jquery.com/data/)\n * - [`detach()`](http://api.jquery.com/detach/)\n * - [`empty()`](http://api.jquery.com/empty/)\n * - [`eq()`](http://api.jquery.com/eq/)\n * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name\n * - [`hasClass()`](http://api.jquery.com/hasClass/)\n * - [`html()`](http://api.jquery.com/html/)\n * - [`next()`](http://api.jquery.com/next/) - Does not support selectors\n * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData\n * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter\n * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors\n * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors\n * - [`prepend()`](http://api.jquery.com/prepend/)\n * - [`prop()`](http://api.jquery.com/prop/)\n * - [`ready()`](http://api.jquery.com/ready/)\n * - [`remove()`](http://api.jquery.com/remove/)\n * - [`removeAttr()`](http://api.jquery.com/removeAttr/)\n * - [`removeClass()`](http://api.jquery.com/removeClass/)\n * - [`removeData()`](http://api.jquery.com/removeData/)\n * - [`replaceWith()`](http://api.jquery.com/replaceWith/)\n * - [`text()`](http://api.jquery.com/text/)\n * - [`toggleClass()`](http://api.jquery.com/toggleClass/)\n * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers.\n * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter\n * - [`val()`](http://api.jquery.com/val/)\n * - [`wrap()`](http://api.jquery.com/wrap/)\n *\n * ## jQuery/jqLite Extras\n * Angular also provides the following additional methods and events to both jQuery and jqLite:\n *\n * ### Events\n * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event\n *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM\n *    element before it is removed.\n *\n * ### Methods\n * - `controller(name)` - retrieves the controller of the current element or its parent. By default\n *   retrieves controller associated with the `ngController` directive. If `name` is provided as\n *   camelCase directive name, then the controller for this directive will be retrieved (e.g.\n *   `'ngModel'`).\n * - `injector()` - retrieves the injector of the current element or its parent.\n * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current\n *   element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to\n *   be enabled.\n * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the\n *   current element. This getter should be used only on elements that contain a directive which starts a new isolate\n *   scope. Calling `scope()` on this element always returns the original non-isolate scope.\n *   Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.\n * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top\n *   parent element is reached.\n *\n * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.\n * @returns {Object} jQuery object.\n */\n\nJQLite.expando = 'ng339';\n\nvar jqCache = JQLite.cache = {},\n    jqId = 1,\n    addEventListenerFn = function(element, type, fn) {\n      element.addEventListener(type, fn, false);\n    },\n    removeEventListenerFn = function(element, type, fn) {\n      element.removeEventListener(type, fn, false);\n    };\n\n/*\n * !!! This is an undocumented \"private\" function !!!\n */\nJQLite._data = function(node) {\n  //jQuery always returns an object on cache miss\n  return this.cache[node[this.expando]] || {};\n};\n\nfunction jqNextId() { return ++jqId; }\n\n\nvar SPECIAL_CHARS_REGEXP = /([\\:\\-\\_]+(.))/g;\nvar MOZ_HACK_REGEXP = /^moz([A-Z])/;\nvar MOUSE_EVENT_MAP= { mouseleave: \"mouseout\", mouseenter: \"mouseover\"};\nvar jqLiteMinErr = minErr('jqLite');\n\n/**\n * Converts snake_case to camelCase.\n * Also there is special case for Moz prefix starting with upper case letter.\n * @param name Name to normalize\n */\nfunction camelCase(name) {\n  return name.\n    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {\n      return offset ? letter.toUpperCase() : letter;\n    }).\n    replace(MOZ_HACK_REGEXP, 'Moz$1');\n}\n\nvar SINGLE_TAG_REGEXP = /^<([\\w-]+)\\s*\\/?>(?:<\\/\\1>|)$/;\nvar HTML_REGEXP = /<|&#?\\w+;/;\nvar TAG_NAME_REGEXP = /<([\\w:-]+)/;\nvar XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^>]*)\\/>/gi;\n\nvar wrapMap = {\n  'option': [1, '<select multiple=\"multiple\">', '</select>'],\n\n  'thead': [1, '<table>', '</table>'],\n  'col': [2, '<table><colgroup>', '</colgroup></table>'],\n  'tr': [2, '<table><tbody>', '</tbody></table>'],\n  'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],\n  '_default': [0, \"\", \"\"]\n};\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n\nfunction jqLiteIsTextNode(html) {\n  return !HTML_REGEXP.test(html);\n}\n\nfunction jqLiteAcceptsData(node) {\n  // The window object can accept data but has no nodeType\n  // Otherwise we are only interested in elements (1) and documents (9)\n  var nodeType = node.nodeType;\n  return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;\n}\n\nfunction jqLiteHasData(node) {\n  for (var key in jqCache[node.ng339]) {\n    return true;\n  }\n  return false;\n}\n\nfunction jqLiteCleanData(nodes) {\n  for (var i = 0, ii = nodes.length; i < ii; i++) {\n    jqLiteRemoveData(nodes[i]);\n  }\n}\n\nfunction jqLiteBuildFragment(html, context) {\n  var tmp, tag, wrap,\n      fragment = context.createDocumentFragment(),\n      nodes = [], i;\n\n  if (jqLiteIsTextNode(html)) {\n    // Convert non-html into a text node\n    nodes.push(context.createTextNode(html));\n  } else {\n    // Convert html into DOM nodes\n    tmp = tmp || fragment.appendChild(context.createElement(\"div\"));\n    tag = (TAG_NAME_REGEXP.exec(html) || [\"\", \"\"])[1].toLowerCase();\n    wrap = wrapMap[tag] || wrapMap._default;\n    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, \"<$1></$2>\") + wrap[2];\n\n    // Descend through wrappers to the right content\n    i = wrap[0];\n    while (i--) {\n      tmp = tmp.lastChild;\n    }\n\n    nodes = concat(nodes, tmp.childNodes);\n\n    tmp = fragment.firstChild;\n    tmp.textContent = \"\";\n  }\n\n  // Remove wrapper from fragment\n  fragment.textContent = \"\";\n  fragment.innerHTML = \"\"; // Clear inner HTML\n  forEach(nodes, function(node) {\n    fragment.appendChild(node);\n  });\n\n  return fragment;\n}\n\nfunction jqLiteParseHTML(html, context) {\n  context = context || document;\n  var parsed;\n\n  if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {\n    return [context.createElement(parsed[1])];\n  }\n\n  if ((parsed = jqLiteBuildFragment(html, context))) {\n    return parsed.childNodes;\n  }\n\n  return [];\n}\n\nfunction jqLiteWrapNode(node, wrapper) {\n  var parent = node.parentNode;\n\n  if (parent) {\n    parent.replaceChild(wrapper, node);\n  }\n\n  wrapper.appendChild(node);\n}\n\n\n// IE9-11 has no method \"contains\" in SVG element and in Node.prototype. Bug #10259.\nvar jqLiteContains = Node.prototype.contains || function(arg) {\n  // jshint bitwise: false\n  return !!(this.compareDocumentPosition(arg) & 16);\n  // jshint bitwise: true\n};\n\n/////////////////////////////////////////////\nfunction JQLite(element) {\n  if (element instanceof JQLite) {\n    return element;\n  }\n\n  var argIsString;\n\n  if (isString(element)) {\n    element = trim(element);\n    argIsString = true;\n  }\n  if (!(this instanceof JQLite)) {\n    if (argIsString && element.charAt(0) != '<') {\n      throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');\n    }\n    return new JQLite(element);\n  }\n\n  if (argIsString) {\n    jqLiteAddNodes(this, jqLiteParseHTML(element));\n  } else {\n    jqLiteAddNodes(this, element);\n  }\n}\n\nfunction jqLiteClone(element) {\n  return element.cloneNode(true);\n}\n\nfunction jqLiteDealoc(element, onlyDescendants) {\n  if (!onlyDescendants) jqLiteRemoveData(element);\n\n  if (element.querySelectorAll) {\n    var descendants = element.querySelectorAll('*');\n    for (var i = 0, l = descendants.length; i < l; i++) {\n      jqLiteRemoveData(descendants[i]);\n    }\n  }\n}\n\nfunction jqLiteOff(element, type, fn, unsupported) {\n  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');\n\n  var expandoStore = jqLiteExpandoStore(element);\n  var events = expandoStore && expandoStore.events;\n  var handle = expandoStore && expandoStore.handle;\n\n  if (!handle) return; //no listeners registered\n\n  if (!type) {\n    for (type in events) {\n      if (type !== '$destroy') {\n        removeEventListenerFn(element, type, handle);\n      }\n      delete events[type];\n    }\n  } else {\n\n    var removeHandler = function(type) {\n      var listenerFns = events[type];\n      if (isDefined(fn)) {\n        arrayRemove(listenerFns || [], fn);\n      }\n      if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {\n        removeEventListenerFn(element, type, handle);\n        delete events[type];\n      }\n    };\n\n    forEach(type.split(' '), function(type) {\n      removeHandler(type);\n      if (MOUSE_EVENT_MAP[type]) {\n        removeHandler(MOUSE_EVENT_MAP[type]);\n      }\n    });\n  }\n}\n\nfunction jqLiteRemoveData(element, name) {\n  var expandoId = element.ng339;\n  var expandoStore = expandoId && jqCache[expandoId];\n\n  if (expandoStore) {\n    if (name) {\n      delete expandoStore.data[name];\n      return;\n    }\n\n    if (expandoStore.handle) {\n      if (expandoStore.events.$destroy) {\n        expandoStore.handle({}, '$destroy');\n      }\n      jqLiteOff(element);\n    }\n    delete jqCache[expandoId];\n    element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it\n  }\n}\n\n\nfunction jqLiteExpandoStore(element, createIfNecessary) {\n  var expandoId = element.ng339,\n      expandoStore = expandoId && jqCache[expandoId];\n\n  if (createIfNecessary && !expandoStore) {\n    element.ng339 = expandoId = jqNextId();\n    expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};\n  }\n\n  return expandoStore;\n}\n\n\nfunction jqLiteData(element, key, value) {\n  if (jqLiteAcceptsData(element)) {\n\n    var isSimpleSetter = isDefined(value);\n    var isSimpleGetter = !isSimpleSetter && key && !isObject(key);\n    var massGetter = !key;\n    var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);\n    var data = expandoStore && expandoStore.data;\n\n    if (isSimpleSetter) { // data('key', value)\n      data[key] = value;\n    } else {\n      if (massGetter) {  // data()\n        return data;\n      } else {\n        if (isSimpleGetter) { // data('key')\n          // don't force creation of expandoStore if it doesn't exist yet\n          return data && data[key];\n        } else { // mass-setter: data({key1: val1, key2: val2})\n          extend(data, key);\n        }\n      }\n    }\n  }\n}\n\nfunction jqLiteHasClass(element, selector) {\n  if (!element.getAttribute) return false;\n  return ((\" \" + (element.getAttribute('class') || '') + \" \").replace(/[\\n\\t]/g, \" \").\n      indexOf(\" \" + selector + \" \") > -1);\n}\n\nfunction jqLiteRemoveClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    forEach(cssClasses.split(' '), function(cssClass) {\n      element.setAttribute('class', trim(\n          (\" \" + (element.getAttribute('class') || '') + \" \")\n          .replace(/[\\n\\t]/g, \" \")\n          .replace(\" \" + trim(cssClass) + \" \", \" \"))\n      );\n    });\n  }\n}\n\nfunction jqLiteAddClass(element, cssClasses) {\n  if (cssClasses && element.setAttribute) {\n    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')\n                            .replace(/[\\n\\t]/g, \" \");\n\n    forEach(cssClasses.split(' '), function(cssClass) {\n      cssClass = trim(cssClass);\n      if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n        existingClasses += cssClass + ' ';\n      }\n    });\n\n    element.setAttribute('class', trim(existingClasses));\n  }\n}\n\n\nfunction jqLiteAddNodes(root, elements) {\n  // THIS CODE IS VERY HOT. Don't make changes without benchmarking.\n\n  if (elements) {\n\n    // if a Node (the most common case)\n    if (elements.nodeType) {\n      root[root.length++] = elements;\n    } else {\n      var length = elements.length;\n\n      // if an Array or NodeList and not a Window\n      if (typeof length === 'number' && elements.window !== elements) {\n        if (length) {\n          for (var i = 0; i < length; i++) {\n            root[root.length++] = elements[i];\n          }\n        }\n      } else {\n        root[root.length++] = elements;\n      }\n    }\n  }\n}\n\n\nfunction jqLiteController(element, name) {\n  return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');\n}\n\nfunction jqLiteInheritedData(element, name, value) {\n  // if element is the document object work with the html element instead\n  // this makes $(document).scope() possible\n  if (element.nodeType == NODE_TYPE_DOCUMENT) {\n    element = element.documentElement;\n  }\n  var names = isArray(name) ? name : [name];\n\n  while (element) {\n    for (var i = 0, ii = names.length; i < ii; i++) {\n      if (isDefined(value = jqLite.data(element, names[i]))) return value;\n    }\n\n    // If dealing with a document fragment node with a host element, and no parent, use the host\n    // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM\n    // to lookup parent controllers.\n    element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);\n  }\n}\n\nfunction jqLiteEmpty(element) {\n  jqLiteDealoc(element, true);\n  while (element.firstChild) {\n    element.removeChild(element.firstChild);\n  }\n}\n\nfunction jqLiteRemove(element, keepData) {\n  if (!keepData) jqLiteDealoc(element);\n  var parent = element.parentNode;\n  if (parent) parent.removeChild(element);\n}\n\n\nfunction jqLiteDocumentLoaded(action, win) {\n  win = win || window;\n  if (win.document.readyState === 'complete') {\n    // Force the action to be run async for consistent behavior\n    // from the action's point of view\n    // i.e. it will definitely not be in a $apply\n    win.setTimeout(action);\n  } else {\n    // No need to unbind this handler as load is only ever called once\n    jqLite(win).on('load', action);\n  }\n}\n\n//////////////////////////////////////////\n// Functions which are declared directly.\n//////////////////////////////////////////\nvar JQLitePrototype = JQLite.prototype = {\n  ready: function(fn) {\n    var fired = false;\n\n    function trigger() {\n      if (fired) return;\n      fired = true;\n      fn();\n    }\n\n    // check if document is already loaded\n    if (document.readyState === 'complete') {\n      setTimeout(trigger);\n    } else {\n      this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9\n      // we can not use jqLite since we are not done loading and jQuery could be loaded later.\n      // jshint -W064\n      JQLite(window).on('load', trigger); // fallback to window.onload for others\n      // jshint +W064\n    }\n  },\n  toString: function() {\n    var value = [];\n    forEach(this, function(e) { value.push('' + e);});\n    return '[' + value.join(', ') + ']';\n  },\n\n  eq: function(index) {\n      return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);\n  },\n\n  length: 0,\n  push: push,\n  sort: [].sort,\n  splice: [].splice\n};\n\n//////////////////////////////////////////\n// Functions iterating getter/setters.\n// these functions return self on setter and\n// value on get.\n//////////////////////////////////////////\nvar BOOLEAN_ATTR = {};\nforEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {\n  BOOLEAN_ATTR[lowercase(value)] = value;\n});\nvar BOOLEAN_ELEMENTS = {};\nforEach('input,select,option,textarea,button,form,details'.split(','), function(value) {\n  BOOLEAN_ELEMENTS[value] = true;\n});\nvar ALIASED_ATTR = {\n  'ngMinlength': 'minlength',\n  'ngMaxlength': 'maxlength',\n  'ngMin': 'min',\n  'ngMax': 'max',\n  'ngPattern': 'pattern'\n};\n\nfunction getBooleanAttrName(element, name) {\n  // check dom last since we will most likely fail on name\n  var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];\n\n  // booleanAttr is here twice to minimize DOM access\n  return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;\n}\n\nfunction getAliasedAttrName(name) {\n  return ALIASED_ATTR[name];\n}\n\nforEach({\n  data: jqLiteData,\n  removeData: jqLiteRemoveData,\n  hasData: jqLiteHasData,\n  cleanData: jqLiteCleanData\n}, function(fn, name) {\n  JQLite[name] = fn;\n});\n\nforEach({\n  data: jqLiteData,\n  inheritedData: jqLiteInheritedData,\n\n  scope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);\n  },\n\n  isolateScope: function(element) {\n    // Can't use jqLiteData here directly so we stay compatible with jQuery!\n    return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');\n  },\n\n  controller: jqLiteController,\n\n  injector: function(element) {\n    return jqLiteInheritedData(element, '$injector');\n  },\n\n  removeAttr: function(element, name) {\n    element.removeAttribute(name);\n  },\n\n  hasClass: jqLiteHasClass,\n\n  css: function(element, name, value) {\n    name = camelCase(name);\n\n    if (isDefined(value)) {\n      element.style[name] = value;\n    } else {\n      return element.style[name];\n    }\n  },\n\n  attr: function(element, name, value) {\n    var nodeType = element.nodeType;\n    if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {\n      return;\n    }\n    var lowercasedName = lowercase(name);\n    if (BOOLEAN_ATTR[lowercasedName]) {\n      if (isDefined(value)) {\n        if (!!value) {\n          element[name] = true;\n          element.setAttribute(name, lowercasedName);\n        } else {\n          element[name] = false;\n          element.removeAttribute(lowercasedName);\n        }\n      } else {\n        return (element[name] ||\n                 (element.attributes.getNamedItem(name) || noop).specified)\n               ? lowercasedName\n               : undefined;\n      }\n    } else if (isDefined(value)) {\n      element.setAttribute(name, value);\n    } else if (element.getAttribute) {\n      // the extra argument \"2\" is to get the right thing for a.href in IE, see jQuery code\n      // some elements (e.g. Document) don't have get attribute, so return undefined\n      var ret = element.getAttribute(name, 2);\n      // normalize non-existing attributes to undefined (as jQuery)\n      return ret === null ? undefined : ret;\n    }\n  },\n\n  prop: function(element, name, value) {\n    if (isDefined(value)) {\n      element[name] = value;\n    } else {\n      return element[name];\n    }\n  },\n\n  text: (function() {\n    getText.$dv = '';\n    return getText;\n\n    function getText(element, value) {\n      if (isUndefined(value)) {\n        var nodeType = element.nodeType;\n        return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';\n      }\n      element.textContent = value;\n    }\n  })(),\n\n  val: function(element, value) {\n    if (isUndefined(value)) {\n      if (element.multiple && nodeName_(element) === 'select') {\n        var result = [];\n        forEach(element.options, function(option) {\n          if (option.selected) {\n            result.push(option.value || option.text);\n          }\n        });\n        return result.length === 0 ? null : result;\n      }\n      return element.value;\n    }\n    element.value = value;\n  },\n\n  html: function(element, value) {\n    if (isUndefined(value)) {\n      return element.innerHTML;\n    }\n    jqLiteDealoc(element, true);\n    element.innerHTML = value;\n  },\n\n  empty: jqLiteEmpty\n}, function(fn, name) {\n  /**\n   * Properties: writes return selection, reads return first value\n   */\n  JQLite.prototype[name] = function(arg1, arg2) {\n    var i, key;\n    var nodeCount = this.length;\n\n    // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it\n    // in a way that survives minification.\n    // jqLiteEmpty takes no arguments but is a setter.\n    if (fn !== jqLiteEmpty &&\n        (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {\n      if (isObject(arg1)) {\n\n        // we are a write, but the object properties are the key/values\n        for (i = 0; i < nodeCount; i++) {\n          if (fn === jqLiteData) {\n            // data() takes the whole object in jQuery\n            fn(this[i], arg1);\n          } else {\n            for (key in arg1) {\n              fn(this[i], key, arg1[key]);\n            }\n          }\n        }\n        // return self for chaining\n        return this;\n      } else {\n        // we are a read, so read the first child.\n        // TODO: do we still need this?\n        var value = fn.$dv;\n        // Only if we have $dv do we iterate over all, otherwise it is just the first element.\n        var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;\n        for (var j = 0; j < jj; j++) {\n          var nodeValue = fn(this[j], arg1, arg2);\n          value = value ? value + nodeValue : nodeValue;\n        }\n        return value;\n      }\n    } else {\n      // we are a write, so apply to all children\n      for (i = 0; i < nodeCount; i++) {\n        fn(this[i], arg1, arg2);\n      }\n      // return self for chaining\n      return this;\n    }\n  };\n});\n\nfunction createEventHandler(element, events) {\n  var eventHandler = function(event, type) {\n    // jQuery specific api\n    event.isDefaultPrevented = function() {\n      return event.defaultPrevented;\n    };\n\n    var eventFns = events[type || event.type];\n    var eventFnsLength = eventFns ? eventFns.length : 0;\n\n    if (!eventFnsLength) return;\n\n    if (isUndefined(event.immediatePropagationStopped)) {\n      var originalStopImmediatePropagation = event.stopImmediatePropagation;\n      event.stopImmediatePropagation = function() {\n        event.immediatePropagationStopped = true;\n\n        if (event.stopPropagation) {\n          event.stopPropagation();\n        }\n\n        if (originalStopImmediatePropagation) {\n          originalStopImmediatePropagation.call(event);\n        }\n      };\n    }\n\n    event.isImmediatePropagationStopped = function() {\n      return event.immediatePropagationStopped === true;\n    };\n\n    // Some events have special handlers that wrap the real handler\n    var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;\n\n    // Copy event handlers in case event handlers array is modified during execution.\n    if ((eventFnsLength > 1)) {\n      eventFns = shallowCopy(eventFns);\n    }\n\n    for (var i = 0; i < eventFnsLength; i++) {\n      if (!event.isImmediatePropagationStopped()) {\n        handlerWrapper(element, event, eventFns[i]);\n      }\n    }\n  };\n\n  // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all\n  //       events on `element`\n  eventHandler.elem = element;\n  return eventHandler;\n}\n\nfunction defaultHandlerWrapper(element, event, handler) {\n  handler.call(element, event);\n}\n\nfunction specialMouseHandlerWrapper(target, event, handler) {\n  // Refer to jQuery's implementation of mouseenter & mouseleave\n  // Read about mouseenter and mouseleave:\n  // http://www.quirksmode.org/js/events_mouse.html#link8\n  var related = event.relatedTarget;\n  // For mousenter/leave call the handler if related is outside the target.\n  // NB: No relatedTarget if the mouse left/entered the browser window\n  if (!related || (related !== target && !jqLiteContains.call(target, related))) {\n    handler.call(target, event);\n  }\n}\n\n//////////////////////////////////////////\n// Functions iterating traversal.\n// These functions chain results into a single\n// selector.\n//////////////////////////////////////////\nforEach({\n  removeData: jqLiteRemoveData,\n\n  on: function jqLiteOn(element, type, fn, unsupported) {\n    if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');\n\n    // Do not add event handlers to non-elements because they will not be cleaned up.\n    if (!jqLiteAcceptsData(element)) {\n      return;\n    }\n\n    var expandoStore = jqLiteExpandoStore(element, true);\n    var events = expandoStore.events;\n    var handle = expandoStore.handle;\n\n    if (!handle) {\n      handle = expandoStore.handle = createEventHandler(element, events);\n    }\n\n    // http://jsperf.com/string-indexof-vs-split\n    var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];\n    var i = types.length;\n\n    var addHandler = function(type, specialHandlerWrapper, noEventListener) {\n      var eventFns = events[type];\n\n      if (!eventFns) {\n        eventFns = events[type] = [];\n        eventFns.specialHandlerWrapper = specialHandlerWrapper;\n        if (type !== '$destroy' && !noEventListener) {\n          addEventListenerFn(element, type, handle);\n        }\n      }\n\n      eventFns.push(fn);\n    };\n\n    while (i--) {\n      type = types[i];\n      if (MOUSE_EVENT_MAP[type]) {\n        addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);\n        addHandler(type, undefined, true);\n      } else {\n        addHandler(type);\n      }\n    }\n  },\n\n  off: jqLiteOff,\n\n  one: function(element, type, fn) {\n    element = jqLite(element);\n\n    //add the listener twice so that when it is called\n    //you can remove the original function and still be\n    //able to call element.off(ev, fn) normally\n    element.on(type, function onFn() {\n      element.off(type, fn);\n      element.off(type, onFn);\n    });\n    element.on(type, fn);\n  },\n\n  replaceWith: function(element, replaceNode) {\n    var index, parent = element.parentNode;\n    jqLiteDealoc(element);\n    forEach(new JQLite(replaceNode), function(node) {\n      if (index) {\n        parent.insertBefore(node, index.nextSibling);\n      } else {\n        parent.replaceChild(node, element);\n      }\n      index = node;\n    });\n  },\n\n  children: function(element) {\n    var children = [];\n    forEach(element.childNodes, function(element) {\n      if (element.nodeType === NODE_TYPE_ELEMENT) {\n        children.push(element);\n      }\n    });\n    return children;\n  },\n\n  contents: function(element) {\n    return element.contentDocument || element.childNodes || [];\n  },\n\n  append: function(element, node) {\n    var nodeType = element.nodeType;\n    if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;\n\n    node = new JQLite(node);\n\n    for (var i = 0, ii = node.length; i < ii; i++) {\n      var child = node[i];\n      element.appendChild(child);\n    }\n  },\n\n  prepend: function(element, node) {\n    if (element.nodeType === NODE_TYPE_ELEMENT) {\n      var index = element.firstChild;\n      forEach(new JQLite(node), function(child) {\n        element.insertBefore(child, index);\n      });\n    }\n  },\n\n  wrap: function(element, wrapNode) {\n    jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);\n  },\n\n  remove: jqLiteRemove,\n\n  detach: function(element) {\n    jqLiteRemove(element, true);\n  },\n\n  after: function(element, newElement) {\n    var index = element, parent = element.parentNode;\n    newElement = new JQLite(newElement);\n\n    for (var i = 0, ii = newElement.length; i < ii; i++) {\n      var node = newElement[i];\n      parent.insertBefore(node, index.nextSibling);\n      index = node;\n    }\n  },\n\n  addClass: jqLiteAddClass,\n  removeClass: jqLiteRemoveClass,\n\n  toggleClass: function(element, selector, condition) {\n    if (selector) {\n      forEach(selector.split(' '), function(className) {\n        var classCondition = condition;\n        if (isUndefined(classCondition)) {\n          classCondition = !jqLiteHasClass(element, className);\n        }\n        (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);\n      });\n    }\n  },\n\n  parent: function(element) {\n    var parent = element.parentNode;\n    return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;\n  },\n\n  next: function(element) {\n    return element.nextElementSibling;\n  },\n\n  find: function(element, selector) {\n    if (element.getElementsByTagName) {\n      return element.getElementsByTagName(selector);\n    } else {\n      return [];\n    }\n  },\n\n  clone: jqLiteClone,\n\n  triggerHandler: function(element, event, extraParameters) {\n\n    var dummyEvent, eventFnsCopy, handlerArgs;\n    var eventName = event.type || event;\n    var expandoStore = jqLiteExpandoStore(element);\n    var events = expandoStore && expandoStore.events;\n    var eventFns = events && events[eventName];\n\n    if (eventFns) {\n      // Create a dummy event to pass to the handlers\n      dummyEvent = {\n        preventDefault: function() { this.defaultPrevented = true; },\n        isDefaultPrevented: function() { return this.defaultPrevented === true; },\n        stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },\n        isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },\n        stopPropagation: noop,\n        type: eventName,\n        target: element\n      };\n\n      // If a custom event was provided then extend our dummy event with it\n      if (event.type) {\n        dummyEvent = extend(dummyEvent, event);\n      }\n\n      // Copy event handlers in case event handlers array is modified during execution.\n      eventFnsCopy = shallowCopy(eventFns);\n      handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];\n\n      forEach(eventFnsCopy, function(fn) {\n        if (!dummyEvent.isImmediatePropagationStopped()) {\n          fn.apply(element, handlerArgs);\n        }\n      });\n    }\n  }\n}, function(fn, name) {\n  /**\n   * chaining functions\n   */\n  JQLite.prototype[name] = function(arg1, arg2, arg3) {\n    var value;\n\n    for (var i = 0, ii = this.length; i < ii; i++) {\n      if (isUndefined(value)) {\n        value = fn(this[i], arg1, arg2, arg3);\n        if (isDefined(value)) {\n          // any function which returns a value needs to be wrapped\n          value = jqLite(value);\n        }\n      } else {\n        jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));\n      }\n    }\n    return isDefined(value) ? value : this;\n  };\n\n  // bind legacy bind/unbind to on/off\n  JQLite.prototype.bind = JQLite.prototype.on;\n  JQLite.prototype.unbind = JQLite.prototype.off;\n});\n\n\n// Provider for private $$jqLite service\nfunction $$jqLiteProvider() {\n  this.$get = function $$jqLite() {\n    return extend(JQLite, {\n      hasClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteHasClass(node, classes);\n      },\n      addClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteAddClass(node, classes);\n      },\n      removeClass: function(node, classes) {\n        if (node.attr) node = node[0];\n        return jqLiteRemoveClass(node, classes);\n      }\n    });\n  };\n}\n\n/**\n * Computes a hash of an 'obj'.\n * Hash of a:\n *  string is string\n *  number is number as string\n *  object is either result of calling $$hashKey function on the object or uniquely generated id,\n *         that is also assigned to the $$hashKey property of the object.\n *\n * @param obj\n * @returns {string} hash string such that the same input will have the same hash string.\n *         The resulting string key is in 'type:hashKey' format.\n */\nfunction hashKey(obj, nextUidFn) {\n  var key = obj && obj.$$hashKey;\n\n  if (key) {\n    if (typeof key === 'function') {\n      key = obj.$$hashKey();\n    }\n    return key;\n  }\n\n  var objType = typeof obj;\n  if (objType == 'function' || (objType == 'object' && obj !== null)) {\n    key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();\n  } else {\n    key = objType + ':' + obj;\n  }\n\n  return key;\n}\n\n/**\n * HashMap which can use objects as keys\n */\nfunction HashMap(array, isolatedUid) {\n  if (isolatedUid) {\n    var uid = 0;\n    this.nextUid = function() {\n      return ++uid;\n    };\n  }\n  forEach(array, this.put, this);\n}\nHashMap.prototype = {\n  /**\n   * Store key value pair\n   * @param key key to store can be any type\n   * @param value value to store can be any type\n   */\n  put: function(key, value) {\n    this[hashKey(key, this.nextUid)] = value;\n  },\n\n  /**\n   * @param key\n   * @returns {Object} the value for the key\n   */\n  get: function(key) {\n    return this[hashKey(key, this.nextUid)];\n  },\n\n  /**\n   * Remove the key/value pair\n   * @param key\n   */\n  remove: function(key) {\n    var value = this[key = hashKey(key, this.nextUid)];\n    delete this[key];\n    return value;\n  }\n};\n\nvar $$HashMapProvider = [function() {\n  this.$get = [function() {\n    return HashMap;\n  }];\n}];\n\n/**\n * @ngdoc function\n * @module ng\n * @name angular.injector\n * @kind function\n *\n * @description\n * Creates an injector object that can be used for retrieving services as well as for\n * dependency injection (see {@link guide/di dependency injection}).\n *\n * @param {Array.<string|Function>} modules A list of module functions or their aliases. See\n *     {@link angular.module}. The `ng` module must be explicitly added.\n * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which\n *     disallows argument name annotation inference.\n * @returns {injector} Injector object. See {@link auto.$injector $injector}.\n *\n * @example\n * Typical usage\n * ```js\n *   // create an injector\n *   var $injector = angular.injector(['ng']);\n *\n *   // use the injector to kick off your application\n *   // use the type inference to auto inject arguments, or use implicit injection\n *   $injector.invoke(function($rootScope, $compile, $document) {\n *     $compile($document)($rootScope);\n *     $rootScope.$digest();\n *   });\n * ```\n *\n * Sometimes you want to get access to the injector of a currently running Angular app\n * from outside Angular. Perhaps, you want to inject and compile some markup after the\n * application has been bootstrapped. You can do this using the extra `injector()` added\n * to JQuery/jqLite elements. See {@link angular.element}.\n *\n * *This is fairly rare but could be the case if a third party library is injecting the\n * markup.*\n *\n * In the following example a new block of HTML containing a `ng-controller`\n * directive is added to the end of the document body by JQuery. We then compile and link\n * it into the current AngularJS scope.\n *\n * ```js\n * var $div = $('<div ng-controller=\"MyCtrl\">{{content.label}}</div>');\n * $(document.body).append($div);\n *\n * angular.element(document).injector().invoke(function($compile) {\n *   var scope = angular.element($div).scope();\n *   $compile($div)(scope);\n * });\n * ```\n */\n\n\n/**\n * @ngdoc module\n * @name auto\n * @description\n *\n * Implicit module which gets automatically added to each {@link auto.$injector $injector}.\n */\n\nvar ARROW_ARG = /^([^\\(]+?)=>/;\nvar FN_ARGS = /^[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar FN_ARG_SPLIT = /,/;\nvar FN_ARG = /^\\s*(_?)(\\S+?)\\1\\s*$/;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nvar $injectorMinErr = minErr('$injector');\n\nfunction extractArgs(fn) {\n  var fnText = fn.toString().replace(STRIP_COMMENTS, ''),\n      args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);\n  return args;\n}\n\nfunction anonFn(fn) {\n  // For anonymous functions, showing at the very least the function signature can help in\n  // debugging.\n  var args = extractArgs(fn);\n  if (args) {\n    return 'function(' + (args[1] || '').replace(/[\\s\\r\\n]+/, ' ') + ')';\n  }\n  return 'fn';\n}\n\nfunction annotate(fn, strictDi, name) {\n  var $inject,\n      argDecl,\n      last;\n\n  if (typeof fn === 'function') {\n    if (!($inject = fn.$inject)) {\n      $inject = [];\n      if (fn.length) {\n        if (strictDi) {\n          if (!isString(name) || !name) {\n            name = fn.name || anonFn(fn);\n          }\n          throw $injectorMinErr('strictdi',\n            '{0} is not using explicit annotation and cannot be invoked in strict mode', name);\n        }\n        argDecl = extractArgs(fn);\n        forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {\n          arg.replace(FN_ARG, function(all, underscore, name) {\n            $inject.push(name);\n          });\n        });\n      }\n      fn.$inject = $inject;\n    }\n  } else if (isArray(fn)) {\n    last = fn.length - 1;\n    assertArgFn(fn[last], 'fn');\n    $inject = fn.slice(0, last);\n  } else {\n    assertArgFn(fn, 'fn', true);\n  }\n  return $inject;\n}\n\n///////////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $injector\n *\n * @description\n *\n * `$injector` is used to retrieve object instances as defined by\n * {@link auto.$provide provider}, instantiate types, invoke methods,\n * and load modules.\n *\n * The following always holds true:\n *\n * ```js\n *   var $injector = angular.injector();\n *   expect($injector.get('$injector')).toBe($injector);\n *   expect($injector.invoke(function($injector) {\n *     return $injector;\n *   })).toBe($injector);\n * ```\n *\n * # Injection Function Annotation\n *\n * JavaScript does not have annotations, and annotations are needed for dependency injection. The\n * following are all valid ways of annotating function with injection arguments and are equivalent.\n *\n * ```js\n *   // inferred (only works if code not minified/obfuscated)\n *   $injector.invoke(function(serviceA){});\n *\n *   // annotated\n *   function explicit(serviceA) {};\n *   explicit.$inject = ['serviceA'];\n *   $injector.invoke(explicit);\n *\n *   // inline\n *   $injector.invoke(['serviceA', function(serviceA){}]);\n * ```\n *\n * ## Inference\n *\n * In JavaScript calling `toString()` on a function returns the function definition. The definition\n * can then be parsed and the function arguments can be extracted. This method of discovering\n * annotations is disallowed when the injector is in strict mode.\n * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the\n * argument names.\n *\n * ## `$inject` Annotation\n * By adding an `$inject` property onto a function the injection parameters can be specified.\n *\n * ## Inline\n * As an array of injection names, where the last item in the array is the function to call.\n */\n\n/**\n * @ngdoc method\n * @name $injector#get\n *\n * @description\n * Return an instance of the service.\n *\n * @param {string} name The name of the instance to retrieve.\n * @param {string=} caller An optional string to provide the origin of the function call for error messages.\n * @return {*} The instance.\n */\n\n/**\n * @ngdoc method\n * @name $injector#invoke\n *\n * @description\n * Invoke the method and supply the method arguments from the `$injector`.\n *\n * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are\n *   injected according to the {@link guide/di $inject Annotation} rules.\n * @param {Object=} self The `this` for the invoked method.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n *                         object first, before the `$injector` is consulted.\n * @returns {*} the value returned by the invoked `fn` function.\n */\n\n/**\n * @ngdoc method\n * @name $injector#has\n *\n * @description\n * Allows the user to query if the particular service exists.\n *\n * @param {string} name Name of the service to query.\n * @returns {boolean} `true` if injector has given service.\n */\n\n/**\n * @ngdoc method\n * @name $injector#instantiate\n * @description\n * Create a new instance of JS type. The method takes a constructor function, invokes the new\n * operator, and supplies all of the arguments to the constructor function as specified by the\n * constructor annotation.\n *\n * @param {Function} Type Annotated constructor function.\n * @param {Object=} locals Optional object. If preset then any argument names are read from this\n * object first, before the `$injector` is consulted.\n * @returns {Object} new instance of `Type`.\n */\n\n/**\n * @ngdoc method\n * @name $injector#annotate\n *\n * @description\n * Returns an array of service names which the function is requesting for injection. This API is\n * used by the injector to determine which services need to be injected into the function when the\n * function is invoked. There are three ways in which the function can be annotated with the needed\n * dependencies.\n *\n * # Argument names\n *\n * The simplest form is to extract the dependencies from the arguments of the function. This is done\n * by converting the function into a string using `toString()` method and extracting the argument\n * names.\n * ```js\n *   // Given\n *   function MyController($scope, $route) {\n *     // ...\n *   }\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * You can disallow this method by using strict injection mode.\n *\n * This method does not work with code minification / obfuscation. For this reason the following\n * annotation strategies are supported.\n *\n * # The `$inject` property\n *\n * If a function has an `$inject` property and its value is an array of strings, then the strings\n * represent names of services to be injected into the function.\n * ```js\n *   // Given\n *   var MyController = function(obfuscatedScope, obfuscatedRoute) {\n *     // ...\n *   }\n *   // Define function dependencies\n *   MyController['$inject'] = ['$scope', '$route'];\n *\n *   // Then\n *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);\n * ```\n *\n * # The array notation\n *\n * It is often desirable to inline Injected functions and that's when setting the `$inject` property\n * is very inconvenient. In these situations using the array notation to specify the dependencies in\n * a way that survives minification is a better choice:\n *\n * ```js\n *   // We wish to write this (not minification / obfuscation safe)\n *   injector.invoke(function($compile, $rootScope) {\n *     // ...\n *   });\n *\n *   // We are forced to write break inlining\n *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {\n *     // ...\n *   };\n *   tmpFn.$inject = ['$compile', '$rootScope'];\n *   injector.invoke(tmpFn);\n *\n *   // To better support inline function the inline annotation is supported\n *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {\n *     // ...\n *   }]);\n *\n *   // Therefore\n *   expect(injector.annotate(\n *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])\n *    ).toEqual(['$compile', '$rootScope']);\n * ```\n *\n * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to\n * be retrieved as described above.\n *\n * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.\n *\n * @returns {Array.<string>} The names of the services which the function requires.\n */\n\n\n\n\n/**\n * @ngdoc service\n * @name $provide\n *\n * @description\n *\n * The {@link auto.$provide $provide} service has a number of methods for registering components\n * with the {@link auto.$injector $injector}. Many of these functions are also exposed on\n * {@link angular.Module}.\n *\n * An Angular **service** is a singleton object created by a **service factory**.  These **service\n * factories** are functions which, in turn, are created by a **service provider**.\n * The **service providers** are constructor functions. When instantiated they must contain a\n * property called `$get`, which holds the **service factory** function.\n *\n * When you request a service, the {@link auto.$injector $injector} is responsible for finding the\n * correct **service provider**, instantiating it and then calling its `$get` **service factory**\n * function to get the instance of the **service**.\n *\n * Often services have no configuration options and there is no need to add methods to the service\n * provider.  The provider will be no more than a constructor function with a `$get` property. For\n * these cases the {@link auto.$provide $provide} service has additional helper methods to register\n * services without specifying a provider.\n *\n * * {@link auto.$provide#provider provider(provider)} - registers a **service provider** with the\n *     {@link auto.$injector $injector}\n * * {@link auto.$provide#constant constant(obj)} - registers a value/object that can be accessed by\n *     providers and services.\n * * {@link auto.$provide#value value(obj)} - registers a value/object that can only be accessed by\n *     services, not providers.\n * * {@link auto.$provide#factory factory(fn)} - registers a service **factory function**, `fn`,\n *     that will be wrapped in a **service provider** object, whose `$get` property will contain the\n *     given factory function.\n * * {@link auto.$provide#service service(class)} - registers a **constructor function**, `class`\n *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate\n *      a new object using the given constructor function.\n *\n * See the individual methods for more information and examples.\n */\n\n/**\n * @ngdoc method\n * @name $provide#provider\n * @description\n *\n * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions\n * are constructor functions, whose instances are responsible for \"providing\" a factory for a\n * service.\n *\n * Service provider names start with the name of the service they provide followed by `Provider`.\n * For example, the {@link ng.$log $log} service has a provider called\n * {@link ng.$logProvider $logProvider}.\n *\n * Service provider objects can have additional methods which allow configuration of the provider\n * and its service. Importantly, you can configure what kind of service is created by the `$get`\n * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a\n * method {@link ng.$logProvider#debugEnabled debugEnabled}\n * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the\n * console or not.\n *\n * @param {string} name The name of the instance. NOTE: the provider will be available under `name +\n                        'Provider'` key.\n * @param {(Object|function())} provider If the provider is:\n *\n *   - `Object`: then it should have a `$get` method. The `$get` method will be invoked using\n *     {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.\n *   - `Constructor`: a new instance of the provider will be created using\n *     {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.\n *\n * @returns {Object} registered provider instance\n\n * @example\n *\n * The following example shows how to create a simple event tracking service and register it using\n * {@link auto.$provide#provider $provide.provider()}.\n *\n * ```js\n *  // Define the eventTracker provider\n *  function EventTrackerProvider() {\n *    var trackingUrl = '/track';\n *\n *    // A provider method for configuring where the tracked events should been saved\n *    this.setTrackingUrl = function(url) {\n *      trackingUrl = url;\n *    };\n *\n *    // The service factory function\n *    this.$get = ['$http', function($http) {\n *      var trackedEvents = {};\n *      return {\n *        // Call this to track an event\n *        event: function(event) {\n *          var count = trackedEvents[event] || 0;\n *          count += 1;\n *          trackedEvents[event] = count;\n *          return count;\n *        },\n *        // Call this to save the tracked events to the trackingUrl\n *        save: function() {\n *          $http.post(trackingUrl, trackedEvents);\n *        }\n *      };\n *    }];\n *  }\n *\n *  describe('eventTracker', function() {\n *    var postSpy;\n *\n *    beforeEach(module(function($provide) {\n *      // Register the eventTracker provider\n *      $provide.provider('eventTracker', EventTrackerProvider);\n *    }));\n *\n *    beforeEach(module(function(eventTrackerProvider) {\n *      // Configure eventTracker provider\n *      eventTrackerProvider.setTrackingUrl('/custom-track');\n *    }));\n *\n *    it('tracks events', inject(function(eventTracker) {\n *      expect(eventTracker.event('login')).toEqual(1);\n *      expect(eventTracker.event('login')).toEqual(2);\n *    }));\n *\n *    it('saves to the tracking url', inject(function(eventTracker, $http) {\n *      postSpy = spyOn($http, 'post');\n *      eventTracker.event('login');\n *      eventTracker.save();\n *      expect(postSpy).toHaveBeenCalled();\n *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');\n *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');\n *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });\n *    }));\n *  });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $provide#factory\n * @description\n *\n * Register a **service factory**, which will be called to return the service instance.\n * This is short for registering a service where its provider consists of only a `$get` property,\n * which is the given service factory function.\n * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to\n * configure your service in a provider.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.\n *                      Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service\n * ```js\n *   $provide.factory('ping', ['$http', function($http) {\n *     return function ping() {\n *       return $http.send('/ping');\n *     };\n *   }]);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#service\n * @description\n *\n * Register a **service constructor**, which will be invoked with `new` to create the service\n * instance.\n * This is short for registering a service where its provider's `$get` property is a factory\n * function that returns an instance instantiated by the injector from the service constructor\n * function.\n *\n * Internally it looks a bit like this:\n *\n * ```\n * {\n *   $get: function() {\n *     return $injector.instantiate(constructor);\n *   }\n * }\n * ```\n *\n *\n * You should use {@link auto.$provide#service $provide.service(class)} if you define your service\n * as a type/class.\n *\n * @param {string} name The name of the instance.\n * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)\n *     that will be instantiated.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here is an example of registering a service using\n * {@link auto.$provide#service $provide.service(class)}.\n * ```js\n *   var Ping = function($http) {\n *     this.$http = $http;\n *   };\n *\n *   Ping.$inject = ['$http'];\n *\n *   Ping.prototype.send = function() {\n *     return this.$http.get('/ping');\n *   };\n *   $provide.service('ping', Ping);\n * ```\n * You would then inject and use this service like this:\n * ```js\n *   someModule.controller('Ctrl', ['ping', function(ping) {\n *     ping.send();\n *   }]);\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#value\n * @description\n *\n * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a\n * number, an array, an object or a function. This is short for registering a service where its\n * provider's `$get` property is a factory function that takes no arguments and returns the **value\n * service**. That also means it is not possible to inject other services into a value service.\n *\n * Value services are similar to constant services, except that they cannot be injected into a\n * module configuration function (see {@link angular.Module#config}) but they can be overridden by\n * an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the instance.\n * @param {*} value The value.\n * @returns {Object} registered provider instance\n *\n * @example\n * Here are some examples of creating value services.\n * ```js\n *   $provide.value('ADMIN_USER', 'admin');\n *\n *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });\n *\n *   $provide.value('halfOf', function(value) {\n *     return value / 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#constant\n * @description\n *\n * Register a **constant service** with the {@link auto.$injector $injector}, such as a string,\n * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not\n * possible to inject other services into a constant.\n *\n * But unlike {@link auto.$provide#value value}, a constant can be\n * injected into a module configuration function (see {@link angular.Module#config}) and it cannot\n * be overridden by an Angular {@link auto.$provide#decorator decorator}.\n *\n * @param {string} name The name of the constant.\n * @param {*} value The constant value.\n * @returns {Object} registered instance\n *\n * @example\n * Here a some examples of creating constants:\n * ```js\n *   $provide.constant('SHARD_HEIGHT', 306);\n *\n *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);\n *\n *   $provide.constant('double', function(value) {\n *     return value * 2;\n *   });\n * ```\n */\n\n\n/**\n * @ngdoc method\n * @name $provide#decorator\n * @description\n *\n * Register a **service decorator** with the {@link auto.$injector $injector}. A service decorator\n * intercepts the creation of a service, allowing it to override or modify the behavior of the\n * service. The object returned by the decorator may be the original service, or a new service\n * object which replaces or wraps and delegates to the original service.\n *\n * @param {string} name The name of the service to decorate.\n * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be\n *    instantiated and should return the decorated service instance. The function is called using\n *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.\n *    Local injection arguments:\n *\n *    * `$delegate` - The original service instance, which can be monkey patched, configured,\n *      decorated or delegated to.\n *\n * @example\n * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting\n * calls to {@link ng.$log#error $log.warn()}.\n * ```js\n *   $provide.decorator('$log', ['$delegate', function($delegate) {\n *     $delegate.warn = $delegate.error;\n *     return $delegate;\n *   }]);\n * ```\n */\n\n\nfunction createInjector(modulesToLoad, strictDi) {\n  strictDi = (strictDi === true);\n  var INSTANTIATING = {},\n      providerSuffix = 'Provider',\n      path = [],\n      loadedModules = new HashMap([], true),\n      providerCache = {\n        $provide: {\n            provider: supportObject(provider),\n            factory: supportObject(factory),\n            service: supportObject(service),\n            value: supportObject(value),\n            constant: supportObject(constant),\n            decorator: decorator\n          }\n      },\n      providerInjector = (providerCache.$injector =\n          createInternalInjector(providerCache, function(serviceName, caller) {\n            if (angular.isString(caller)) {\n              path.push(caller);\n            }\n            throw $injectorMinErr('unpr', \"Unknown provider: {0}\", path.join(' <- '));\n          })),\n      instanceCache = {},\n      protoInstanceInjector =\n          createInternalInjector(instanceCache, function(serviceName, caller) {\n            var provider = providerInjector.get(serviceName + providerSuffix, caller);\n            return instanceInjector.invoke(\n                provider.$get, provider, undefined, serviceName);\n          }),\n      instanceInjector = protoInstanceInjector;\n\n  providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };\n  var runBlocks = loadModules(modulesToLoad);\n  instanceInjector = protoInstanceInjector.get('$injector');\n  instanceInjector.strictDi = strictDi;\n  forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });\n\n  return instanceInjector;\n\n  ////////////////////////////////////\n  // $provider\n  ////////////////////////////////////\n\n  function supportObject(delegate) {\n    return function(key, value) {\n      if (isObject(key)) {\n        forEach(key, reverseParams(delegate));\n      } else {\n        return delegate(key, value);\n      }\n    };\n  }\n\n  function provider(name, provider_) {\n    assertNotHasOwnProperty(name, 'service');\n    if (isFunction(provider_) || isArray(provider_)) {\n      provider_ = providerInjector.instantiate(provider_);\n    }\n    if (!provider_.$get) {\n      throw $injectorMinErr('pget', \"Provider '{0}' must define $get factory method.\", name);\n    }\n    return providerCache[name + providerSuffix] = provider_;\n  }\n\n  function enforceReturnValue(name, factory) {\n    return function enforcedReturnValue() {\n      var result = instanceInjector.invoke(factory, this);\n      if (isUndefined(result)) {\n        throw $injectorMinErr('undef', \"Provider '{0}' must return a value from $get factory method.\", name);\n      }\n      return result;\n    };\n  }\n\n  function factory(name, factoryFn, enforce) {\n    return provider(name, {\n      $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn\n    });\n  }\n\n  function service(name, constructor) {\n    return factory(name, ['$injector', function($injector) {\n      return $injector.instantiate(constructor);\n    }]);\n  }\n\n  function value(name, val) { return factory(name, valueFn(val), false); }\n\n  function constant(name, value) {\n    assertNotHasOwnProperty(name, 'constant');\n    providerCache[name] = value;\n    instanceCache[name] = value;\n  }\n\n  function decorator(serviceName, decorFn) {\n    var origProvider = providerInjector.get(serviceName + providerSuffix),\n        orig$get = origProvider.$get;\n\n    origProvider.$get = function() {\n      var origInstance = instanceInjector.invoke(orig$get, origProvider);\n      return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});\n    };\n  }\n\n  ////////////////////////////////////\n  // Module Loading\n  ////////////////////////////////////\n  function loadModules(modulesToLoad) {\n    assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');\n    var runBlocks = [], moduleFn;\n    forEach(modulesToLoad, function(module) {\n      if (loadedModules.get(module)) return;\n      loadedModules.put(module, true);\n\n      function runInvokeQueue(queue) {\n        var i, ii;\n        for (i = 0, ii = queue.length; i < ii; i++) {\n          var invokeArgs = queue[i],\n              provider = providerInjector.get(invokeArgs[0]);\n\n          provider[invokeArgs[1]].apply(provider, invokeArgs[2]);\n        }\n      }\n\n      try {\n        if (isString(module)) {\n          moduleFn = angularModule(module);\n          runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);\n          runInvokeQueue(moduleFn._invokeQueue);\n          runInvokeQueue(moduleFn._configBlocks);\n        } else if (isFunction(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else if (isArray(module)) {\n            runBlocks.push(providerInjector.invoke(module));\n        } else {\n          assertArgFn(module, 'module');\n        }\n      } catch (e) {\n        if (isArray(module)) {\n          module = module[module.length - 1];\n        }\n        if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {\n          // Safari & FF's stack traces don't contain error.message content\n          // unlike those of Chrome and IE\n          // So if stack doesn't contain message, we create a new string that contains both.\n          // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.\n          /* jshint -W022 */\n          e = e.message + '\\n' + e.stack;\n        }\n        throw $injectorMinErr('modulerr', \"Failed to instantiate module {0} due to:\\n{1}\",\n                  module, e.stack || e.message || e);\n      }\n    });\n    return runBlocks;\n  }\n\n  ////////////////////////////////////\n  // internal Injector\n  ////////////////////////////////////\n\n  function createInternalInjector(cache, factory) {\n\n    function getService(serviceName, caller) {\n      if (cache.hasOwnProperty(serviceName)) {\n        if (cache[serviceName] === INSTANTIATING) {\n          throw $injectorMinErr('cdep', 'Circular dependency found: {0}',\n                    serviceName + ' <- ' + path.join(' <- '));\n        }\n        return cache[serviceName];\n      } else {\n        try {\n          path.unshift(serviceName);\n          cache[serviceName] = INSTANTIATING;\n          return cache[serviceName] = factory(serviceName, caller);\n        } catch (err) {\n          if (cache[serviceName] === INSTANTIATING) {\n            delete cache[serviceName];\n          }\n          throw err;\n        } finally {\n          path.shift();\n        }\n      }\n    }\n\n\n    function injectionArgs(fn, locals, serviceName) {\n      var args = [],\n          $inject = createInjector.$$annotate(fn, strictDi, serviceName);\n\n      for (var i = 0, length = $inject.length; i < length; i++) {\n        var key = $inject[i];\n        if (typeof key !== 'string') {\n          throw $injectorMinErr('itkn',\n                  'Incorrect injection token! Expected service name as string, got {0}', key);\n        }\n        args.push(locals && locals.hasOwnProperty(key) ? locals[key] :\n                                                         getService(key, serviceName));\n      }\n      return args;\n    }\n\n    function isClass(func) {\n      // IE 9-11 do not support classes and IE9 leaks with the code below.\n      if (msie <= 11) {\n        return false;\n      }\n      // Workaround for MS Edge.\n      // Check https://connect.microsoft.com/IE/Feedback/Details/2211653\n      return typeof func === 'function'\n        && /^(?:class\\s|constructor\\()/.test(Function.prototype.toString.call(func));\n    }\n\n    function invoke(fn, self, locals, serviceName) {\n      if (typeof locals === 'string') {\n        serviceName = locals;\n        locals = null;\n      }\n\n      var args = injectionArgs(fn, locals, serviceName);\n      if (isArray(fn)) {\n        fn = fn[fn.length - 1];\n      }\n\n      if (!isClass(fn)) {\n        // http://jsperf.com/angularjs-invoke-apply-vs-switch\n        // #5388\n        return fn.apply(self, args);\n      } else {\n        args.unshift(null);\n        return new (Function.prototype.bind.apply(fn, args))();\n      }\n    }\n\n\n    function instantiate(Type, locals, serviceName) {\n      // Check if Type is annotated and use just the given function at n-1 as parameter\n      // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);\n      var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);\n      var args = injectionArgs(Type, locals, serviceName);\n      // Empty object at position 0 is ignored for invocation with `new`, but required.\n      args.unshift(null);\n      return new (Function.prototype.bind.apply(ctor, args))();\n    }\n\n\n    return {\n      invoke: invoke,\n      instantiate: instantiate,\n      get: getService,\n      annotate: createInjector.$$annotate,\n      has: function(name) {\n        return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);\n      }\n    };\n  }\n}\n\ncreateInjector.$$annotate = annotate;\n\n/**\n * @ngdoc provider\n * @name $anchorScrollProvider\n *\n * @description\n * Use `$anchorScrollProvider` to disable automatic scrolling whenever\n * {@link ng.$location#hash $location.hash()} changes.\n */\nfunction $AnchorScrollProvider() {\n\n  var autoScrollingEnabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $anchorScrollProvider#disableAutoScrolling\n   *\n   * @description\n   * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to\n   * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />\n   * Use this method to disable automatic scrolling.\n   *\n   * If automatic scrolling is disabled, one must explicitly call\n   * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the\n   * current hash.\n   */\n  this.disableAutoScrolling = function() {\n    autoScrollingEnabled = false;\n  };\n\n  /**\n   * @ngdoc service\n   * @name $anchorScroll\n   * @kind function\n   * @requires $window\n   * @requires $location\n   * @requires $rootScope\n   *\n   * @description\n   * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the\n   * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified\n   * in the\n   * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#the-indicated-part-of-the-document).\n   *\n   * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to\n   * match any anchor whenever it changes. This can be disabled by calling\n   * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.\n   *\n   * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a\n   * vertical scroll-offset (either fixed or dynamic).\n   *\n   * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of\n   *                       {@link ng.$location#hash $location.hash()} will be used.\n   *\n   * @property {(number|function|jqLite)} yOffset\n   * If set, specifies a vertical scroll-offset. This is often useful when there are fixed\n   * positioned elements at the top of the page, such as navbars, headers etc.\n   *\n   * `yOffset` can be specified in various ways:\n   * - **number**: A fixed number of pixels to be used as offset.<br /><br />\n   * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return\n   *   a number representing the offset (in pixels).<br /><br />\n   * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from\n   *   the top of the page to the element's bottom will be used as offset.<br />\n   *   **Note**: The element will be taken into account only as long as its `position` is set to\n   *   `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust\n   *   their height and/or positioning according to the viewport's size.\n   *\n   * <br />\n   * <div class=\"alert alert-warning\">\n   * In order for `yOffset` to work properly, scrolling should take place on the document's root and\n   * not some child element.\n   * </div>\n   *\n   * @example\n     <example module=\"anchorScrollExample\">\n       <file name=\"index.html\">\n         <div id=\"scrollArea\" ng-controller=\"ScrollController\">\n           <a ng-click=\"gotoBottom()\">Go to bottom</a>\n           <a id=\"bottom\"></a> You're at the bottom!\n         </div>\n       </file>\n       <file name=\"script.js\">\n         angular.module('anchorScrollExample', [])\n           .controller('ScrollController', ['$scope', '$location', '$anchorScroll',\n             function ($scope, $location, $anchorScroll) {\n               $scope.gotoBottom = function() {\n                 // set the location.hash to the id of\n                 // the element you wish to scroll to.\n                 $location.hash('bottom');\n\n                 // call $anchorScroll()\n                 $anchorScroll();\n               };\n             }]);\n       </file>\n       <file name=\"style.css\">\n         #scrollArea {\n           height: 280px;\n           overflow: auto;\n         }\n\n         #bottom {\n           display: block;\n           margin-top: 2000px;\n         }\n       </file>\n     </example>\n   *\n   * <hr />\n   * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).\n   * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.\n   *\n   * @example\n     <example module=\"anchorScrollOffsetExample\">\n       <file name=\"index.html\">\n         <div class=\"fixed-header\" ng-controller=\"headerCtrl\">\n           <a href=\"\" ng-click=\"gotoAnchor(x)\" ng-repeat=\"x in [1,2,3,4,5]\">\n             Go to anchor {{x}}\n           </a>\n         </div>\n         <div id=\"anchor{{x}}\" class=\"anchor\" ng-repeat=\"x in [1,2,3,4,5]\">\n           Anchor {{x}} of 5\n         </div>\n       </file>\n       <file name=\"script.js\">\n         angular.module('anchorScrollOffsetExample', [])\n           .run(['$anchorScroll', function($anchorScroll) {\n             $anchorScroll.yOffset = 50;   // always scroll by 50 extra pixels\n           }])\n           .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',\n             function ($anchorScroll, $location, $scope) {\n               $scope.gotoAnchor = function(x) {\n                 var newHash = 'anchor' + x;\n                 if ($location.hash() !== newHash) {\n                   // set the $location.hash to `newHash` and\n                   // $anchorScroll will automatically scroll to it\n                   $location.hash('anchor' + x);\n                 } else {\n                   // call $anchorScroll() explicitly,\n                   // since $location.hash hasn't changed\n                   $anchorScroll();\n                 }\n               };\n             }\n           ]);\n       </file>\n       <file name=\"style.css\">\n         body {\n           padding-top: 50px;\n         }\n\n         .anchor {\n           border: 2px dashed DarkOrchid;\n           padding: 10px 10px 200px 10px;\n         }\n\n         .fixed-header {\n           background-color: rgba(0, 0, 0, 0.2);\n           height: 50px;\n           position: fixed;\n           top: 0; left: 0; right: 0;\n         }\n\n         .fixed-header > a {\n           display: inline-block;\n           margin: 5px 15px;\n         }\n       </file>\n     </example>\n   */\n  this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {\n    var document = $window.document;\n\n    // Helper function to get first anchor from a NodeList\n    // (using `Array#some()` instead of `angular#forEach()` since it's more performant\n    //  and working in all supported browsers.)\n    function getFirstAnchor(list) {\n      var result = null;\n      Array.prototype.some.call(list, function(element) {\n        if (nodeName_(element) === 'a') {\n          result = element;\n          return true;\n        }\n      });\n      return result;\n    }\n\n    function getYOffset() {\n\n      var offset = scroll.yOffset;\n\n      if (isFunction(offset)) {\n        offset = offset();\n      } else if (isElement(offset)) {\n        var elem = offset[0];\n        var style = $window.getComputedStyle(elem);\n        if (style.position !== 'fixed') {\n          offset = 0;\n        } else {\n          offset = elem.getBoundingClientRect().bottom;\n        }\n      } else if (!isNumber(offset)) {\n        offset = 0;\n      }\n\n      return offset;\n    }\n\n    function scrollTo(elem) {\n      if (elem) {\n        elem.scrollIntoView();\n\n        var offset = getYOffset();\n\n        if (offset) {\n          // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.\n          // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the\n          // top of the viewport.\n          //\n          // IF the number of pixels from the top of `elem` to the end of the page's content is less\n          // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some\n          // way down the page.\n          //\n          // This is often the case for elements near the bottom of the page.\n          //\n          // In such cases we do not need to scroll the whole `offset` up, just the difference between\n          // the top of the element and the offset, which is enough to align the top of `elem` at the\n          // desired position.\n          var elemTop = elem.getBoundingClientRect().top;\n          $window.scrollBy(0, elemTop - offset);\n        }\n      } else {\n        $window.scrollTo(0, 0);\n      }\n    }\n\n    function scroll(hash) {\n      hash = isString(hash) ? hash : $location.hash();\n      var elm;\n\n      // empty hash, scroll to the top of the page\n      if (!hash) scrollTo(null);\n\n      // element with given id\n      else if ((elm = document.getElementById(hash))) scrollTo(elm);\n\n      // first anchor with given name :-D\n      else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);\n\n      // no element and hash == 'top', scroll to the top of the page\n      else if (hash === 'top') scrollTo(null);\n    }\n\n    // does not scroll when user clicks on anchor link that is currently on\n    // (no url change, no $location.hash() change), browser native does scroll\n    if (autoScrollingEnabled) {\n      $rootScope.$watch(function autoScrollWatch() {return $location.hash();},\n        function autoScrollWatchAction(newVal, oldVal) {\n          // skip the initial scroll if $location.hash is empty\n          if (newVal === oldVal && newVal === '') return;\n\n          jqLiteDocumentLoaded(function() {\n            $rootScope.$evalAsync(scroll);\n          });\n        });\n    }\n\n    return scroll;\n  }];\n}\n\nvar $animateMinErr = minErr('$animate');\nvar ELEMENT_NODE = 1;\nvar NG_ANIMATE_CLASSNAME = 'ng-animate';\n\nfunction mergeClasses(a,b) {\n  if (!a && !b) return '';\n  if (!a) return b;\n  if (!b) return a;\n  if (isArray(a)) a = a.join(' ');\n  if (isArray(b)) b = b.join(' ');\n  return a + ' ' + b;\n}\n\nfunction extractElementNode(element) {\n  for (var i = 0; i < element.length; i++) {\n    var elm = element[i];\n    if (elm.nodeType === ELEMENT_NODE) {\n      return elm;\n    }\n  }\n}\n\nfunction splitClasses(classes) {\n  if (isString(classes)) {\n    classes = classes.split(' ');\n  }\n\n  // Use createMap() to prevent class assumptions involving property names in\n  // Object.prototype\n  var obj = createMap();\n  forEach(classes, function(klass) {\n    // sometimes the split leaves empty string values\n    // incase extra spaces were applied to the options\n    if (klass.length) {\n      obj[klass] = true;\n    }\n  });\n  return obj;\n}\n\n// if any other type of options value besides an Object value is\n// passed into the $animate.method() animation then this helper code\n// will be run which will ignore it. While this patch is not the\n// greatest solution to this, a lot of existing plugins depend on\n// $animate to either call the callback (< 1.2) or return a promise\n// that can be changed. This helper function ensures that the options\n// are wiped clean incase a callback function is provided.\nfunction prepareAnimateOptions(options) {\n  return isObject(options)\n      ? options\n      : {};\n}\n\nvar $$CoreAnimateJsProvider = function() {\n  this.$get = noop;\n};\n\n// this is prefixed with Core since it conflicts with\n// the animateQueueProvider defined in ngAnimate/animateQueue.js\nvar $$CoreAnimateQueueProvider = function() {\n  var postDigestQueue = new HashMap();\n  var postDigestElements = [];\n\n  this.$get = ['$$AnimateRunner', '$rootScope',\n       function($$AnimateRunner,   $rootScope) {\n    return {\n      enabled: noop,\n      on: noop,\n      off: noop,\n      pin: noop,\n\n      push: function(element, event, options, domOperation) {\n        domOperation        && domOperation();\n\n        options = options || {};\n        options.from        && element.css(options.from);\n        options.to          && element.css(options.to);\n\n        if (options.addClass || options.removeClass) {\n          addRemoveClassesPostDigest(element, options.addClass, options.removeClass);\n        }\n\n        var runner = new $$AnimateRunner(); // jshint ignore:line\n\n        // since there are no animations to run the runner needs to be\n        // notified that the animation call is complete.\n        runner.complete();\n        return runner;\n      }\n    };\n\n\n    function updateData(data, classes, value) {\n      var changed = false;\n      if (classes) {\n        classes = isString(classes) ? classes.split(' ') :\n                  isArray(classes) ? classes : [];\n        forEach(classes, function(className) {\n          if (className) {\n            changed = true;\n            data[className] = value;\n          }\n        });\n      }\n      return changed;\n    }\n\n    function handleCSSClassChanges() {\n      forEach(postDigestElements, function(element) {\n        var data = postDigestQueue.get(element);\n        if (data) {\n          var existing = splitClasses(element.attr('class'));\n          var toAdd = '';\n          var toRemove = '';\n          forEach(data, function(status, className) {\n            var hasClass = !!existing[className];\n            if (status !== hasClass) {\n              if (status) {\n                toAdd += (toAdd.length ? ' ' : '') + className;\n              } else {\n                toRemove += (toRemove.length ? ' ' : '') + className;\n              }\n            }\n          });\n\n          forEach(element, function(elm) {\n            toAdd    && jqLiteAddClass(elm, toAdd);\n            toRemove && jqLiteRemoveClass(elm, toRemove);\n          });\n          postDigestQueue.remove(element);\n        }\n      });\n      postDigestElements.length = 0;\n    }\n\n\n    function addRemoveClassesPostDigest(element, add, remove) {\n      var data = postDigestQueue.get(element) || {};\n\n      var classesAdded = updateData(data, add, true);\n      var classesRemoved = updateData(data, remove, false);\n\n      if (classesAdded || classesRemoved) {\n\n        postDigestQueue.put(element, data);\n        postDigestElements.push(element);\n\n        if (postDigestElements.length === 1) {\n          $rootScope.$$postDigest(handleCSSClassChanges);\n        }\n      }\n    }\n  }];\n};\n\n/**\n * @ngdoc provider\n * @name $animateProvider\n *\n * @description\n * Default implementation of $animate that doesn't perform any animations, instead just\n * synchronously performs DOM updates and resolves the returned runner promise.\n *\n * In order to enable animations the `ngAnimate` module has to be loaded.\n *\n * To see the functional implementation check out `src/ngAnimate/animate.js`.\n */\nvar $AnimateProvider = ['$provide', function($provide) {\n  var provider = this;\n\n  this.$$registeredAnimations = Object.create(null);\n\n   /**\n   * @ngdoc method\n   * @name $animateProvider#register\n   *\n   * @description\n   * Registers a new injectable animation factory function. The factory function produces the\n   * animation object which contains callback functions for each event that is expected to be\n   * animated.\n   *\n   *   * `eventFn`: `function(element, ... , doneFunction, options)`\n   *   The element to animate, the `doneFunction` and the options fed into the animation. Depending\n   *   on the type of animation additional arguments will be injected into the animation function. The\n   *   list below explains the function signatures for the different animation methods:\n   *\n   *   - setClass: function(element, addedClasses, removedClasses, doneFunction, options)\n   *   - addClass: function(element, addedClasses, doneFunction, options)\n   *   - removeClass: function(element, removedClasses, doneFunction, options)\n   *   - enter, leave, move: function(element, doneFunction, options)\n   *   - animate: function(element, fromStyles, toStyles, doneFunction, options)\n   *\n   *   Make sure to trigger the `doneFunction` once the animation is fully complete.\n   *\n   * ```js\n   *   return {\n   *     //enter, leave, move signature\n   *     eventFn : function(element, done, options) {\n   *       //code to run the animation\n   *       //once complete, then run done()\n   *       return function endFunction(wasCancelled) {\n   *         //code to cancel the animation\n   *       }\n   *     }\n   *   }\n   * ```\n   *\n   * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).\n   * @param {Function} factory The factory function that will be executed to return the animation\n   *                           object.\n   */\n  this.register = function(name, factory) {\n    if (name && name.charAt(0) !== '.') {\n      throw $animateMinErr('notcsel', \"Expecting class selector starting with '.' got '{0}'.\", name);\n    }\n\n    var key = name + '-animation';\n    provider.$$registeredAnimations[name.substr(1)] = key;\n    $provide.factory(key, factory);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $animateProvider#classNameFilter\n   *\n   * @description\n   * Sets and/or returns the CSS class regular expression that is checked when performing\n   * an animation. Upon bootstrap the classNameFilter value is not set at all and will\n   * therefore enable $animate to attempt to perform an animation on any element that is triggered.\n   * When setting the `classNameFilter` value, animations will only be performed on elements\n   * that successfully match the filter expression. This in turn can boost performance\n   * for low-powered devices as well as applications containing a lot of structural operations.\n   * @param {RegExp=} expression The className expression which will be checked against all animations\n   * @return {RegExp} The current CSS className expression value. If null then there is no expression value\n   */\n  this.classNameFilter = function(expression) {\n    if (arguments.length === 1) {\n      this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;\n      if (this.$$classNameFilter) {\n        var reservedRegex = new RegExp(\"(\\\\s+|\\\\/)\" + NG_ANIMATE_CLASSNAME + \"(\\\\s+|\\\\/)\");\n        if (reservedRegex.test(this.$$classNameFilter.toString())) {\n          throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the \"{0}\" CSS class.', NG_ANIMATE_CLASSNAME);\n\n        }\n      }\n    }\n    return this.$$classNameFilter;\n  };\n\n  this.$get = ['$$animateQueue', function($$animateQueue) {\n    function domInsert(element, parentElement, afterElement) {\n      // if for some reason the previous element was removed\n      // from the dom sometime before this code runs then let's\n      // just stick to using the parent element as the anchor\n      if (afterElement) {\n        var afterNode = extractElementNode(afterElement);\n        if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {\n          afterElement = null;\n        }\n      }\n      afterElement ? afterElement.after(element) : parentElement.prepend(element);\n    }\n\n    /**\n     * @ngdoc service\n     * @name $animate\n     * @description The $animate service exposes a series of DOM utility methods that provide support\n     * for animation hooks. The default behavior is the application of DOM operations, however,\n     * when an animation is detected (and animations are enabled), $animate will do the heavy lifting\n     * to ensure that animation runs with the triggered DOM operation.\n     *\n     * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't\n     * included and only when it is active then the animation hooks that `$animate` triggers will be\n     * functional. Once active then all structural `ng-` directives will trigger animations as they perform\n     * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,\n     * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.\n     *\n     * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.\n     *\n     * To learn more about enabling animation support, click here to visit the\n     * {@link ngAnimate ngAnimate module page}.\n     */\n    return {\n      // we don't call it directly since non-existant arguments may\n      // be interpreted as null within the sub enabled function\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#on\n       * @kind function\n       * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)\n       *    has fired on the given element or among any of its children. Once the listener is fired, the provided callback\n       *    is fired with the following params:\n       *\n       * ```js\n       * $animate.on('enter', container,\n       *    function callback(element, phase) {\n       *      // cool we detected an enter animation within the container\n       *    }\n       * );\n       * ```\n       *\n       * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)\n       * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself\n       *     as well as among its children\n       * @param {Function} callback the callback function that will be fired when the listener is triggered\n       *\n       * The arguments present in the callback function are:\n       * * `element` - The captured DOM element that the animation was fired on.\n       * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).\n       */\n      on: $$animateQueue.on,\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#off\n       * @kind function\n       * @description Deregisters an event listener based on the event which has been associated with the provided element. This method\n       * can be used in three different ways depending on the arguments:\n       *\n       * ```js\n       * // remove all the animation event listeners listening for `enter`\n       * $animate.off('enter');\n       *\n       * // remove all the animation event listeners listening for `enter` on the given element and its children\n       * $animate.off('enter', container);\n       *\n       * // remove the event listener function provided by `callback` that is set\n       * // to listen for `enter` on the given `container` as well as its children\n       * $animate.off('enter', container, callback);\n       * ```\n       *\n       * @param {string} event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)\n       * @param {DOMElement=} container the container element the event listener was placed on\n       * @param {Function=} callback the callback function that was registered as the listener\n       */\n      off: $$animateQueue.off,\n\n      /**\n       * @ngdoc method\n       * @name $animate#pin\n       * @kind function\n       * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists\n       *    outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the\n       *    element despite being outside the realm of the application or within another application. Say for example if the application\n       *    was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated\n       *    as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind\n       *    that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.\n       *\n       *    Note that this feature is only active when the `ngAnimate` module is used.\n       *\n       * @param {DOMElement} element the external element that will be pinned\n       * @param {DOMElement} parentElement the host parent element that will be associated with the external element\n       */\n      pin: $$animateQueue.pin,\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enabled\n       * @kind function\n       * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This\n       * function can be called in four ways:\n       *\n       * ```js\n       * // returns true or false\n       * $animate.enabled();\n       *\n       * // changes the enabled state for all animations\n       * $animate.enabled(false);\n       * $animate.enabled(true);\n       *\n       * // returns true or false if animations are enabled for an element\n       * $animate.enabled(element);\n       *\n       * // changes the enabled state for an element and its children\n       * $animate.enabled(element, true);\n       * $animate.enabled(element, false);\n       * ```\n       *\n       * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state\n       * @param {boolean=} enabled whether or not the animations will be enabled for the element\n       *\n       * @return {boolean} whether or not animations are enabled\n       */\n      enabled: $$animateQueue.enabled,\n\n      /**\n       * @ngdoc method\n       * @name $animate#cancel\n       * @kind function\n       * @description Cancels the provided animation.\n       *\n       * @param {Promise} animationPromise The animation promise that is returned when an animation is started.\n       */\n      cancel: function(runner) {\n        runner.end && runner.end();\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#enter\n       * @kind function\n       * @description Inserts the element into the DOM either after the `after` element (if provided) or\n       *   as the first child within the `parent` element and then triggers an animation.\n       *   A promise is returned that will be resolved during the next digest once the animation\n       *   has completed.\n       *\n       * @param {DOMElement} element the element which will be inserted into the DOM\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (so long as the after element is not present)\n       * @param {DOMElement=} after the sibling element after which the element will be appended\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      enter: function(element, parent, after, options) {\n        parent = parent && jqLite(parent);\n        after = after && jqLite(after);\n        parent = parent || after.parent();\n        domInsert(element, parent, after);\n        return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));\n      },\n\n      /**\n       *\n       * @ngdoc method\n       * @name $animate#move\n       * @kind function\n       * @description Inserts (moves) the element into its new position in the DOM either after\n       *   the `after` element (if provided) or as the first child within the `parent` element\n       *   and then triggers an animation. A promise is returned that will be resolved\n       *   during the next digest once the animation has completed.\n       *\n       * @param {DOMElement} element the element which will be moved into the new DOM position\n       * @param {DOMElement} parent the parent element which will append the element as\n       *   a child (so long as the after element is not present)\n       * @param {DOMElement=} after the sibling element after which the element will be appended\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      move: function(element, parent, after, options) {\n        parent = parent && jqLite(parent);\n        after = after && jqLite(after);\n        parent = parent || after.parent();\n        domInsert(element, parent, after);\n        return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#leave\n       * @kind function\n       * @description Triggers an animation and then removes the element from the DOM.\n       * When the function is called a promise is returned that will be resolved during the next\n       * digest once the animation has completed.\n       *\n       * @param {DOMElement} element the element which will be removed from the DOM\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      leave: function(element, options) {\n        return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {\n          element.remove();\n        });\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#addClass\n       * @kind function\n       *\n       * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon\n       *   execution, the addClass operation will only be handled after the next digest and it will not trigger an\n       *   animation if element already contains the CSS class or if the class is removed at a later step.\n       *   Note that class-based animations are treated differently compared to structural animations\n       *   (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *   depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      addClass: function(element, className, options) {\n        options = prepareAnimateOptions(options);\n        options.addClass = mergeClasses(options.addclass, className);\n        return $$animateQueue.push(element, 'addClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#removeClass\n       * @kind function\n       *\n       * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon\n       *   execution, the removeClass operation will only be handled after the next digest and it will not trigger an\n       *   animation if element does not contain the CSS class or if the class is added at a later step.\n       *   Note that class-based animations are treated differently compared to structural animations\n       *   (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *   depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      removeClass: function(element, className, options) {\n        options = prepareAnimateOptions(options);\n        options.removeClass = mergeClasses(options.removeClass, className);\n        return $$animateQueue.push(element, 'removeClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#setClass\n       * @kind function\n       *\n       * @description Performs both the addition and removal of a CSS classes on an element and (during the process)\n       *    triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and\n       *    `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has\n       *    passed. Note that class-based animations are treated differently compared to structural animations\n       *    (like enter, move and leave) since the CSS classes may be added/removed at different points\n       *    depending if CSS or JavaScript animations are used.\n       *\n       * @param {DOMElement} element the element which the CSS classes will be applied to\n       * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)\n       * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      setClass: function(element, add, remove, options) {\n        options = prepareAnimateOptions(options);\n        options.addClass = mergeClasses(options.addClass, add);\n        options.removeClass = mergeClasses(options.removeClass, remove);\n        return $$animateQueue.push(element, 'setClass', options);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $animate#animate\n       * @kind function\n       *\n       * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.\n       * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take\n       * on the provided styles. For example, if a transition animation is set for the given classNamem, then the provided `from` and\n       * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding\n       * style in `to`, the style in `from` is applied immediately, and no animation is run.\n       * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`\n       * method (or as part of the `options` parameter):\n       *\n       * ```js\n       * ngModule.animation('.my-inline-animation', function() {\n       *   return {\n       *     animate : function(element, from, to, done, options) {\n       *       //animation\n       *       done();\n       *     }\n       *   }\n       * });\n       * ```\n       *\n       * @param {DOMElement} element the element which the CSS styles will be applied to\n       * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.\n       * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.\n       * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If\n       *    this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.\n       *    (Note that if no animation is detected then this value will not be applied to the element.)\n       * @param {object=} options an optional collection of options/styles that will be applied to the element\n       *\n       * @return {Promise} the animation callback promise\n       */\n      animate: function(element, from, to, className, options) {\n        options = prepareAnimateOptions(options);\n        options.from = options.from ? extend(options.from, from) : from;\n        options.to   = options.to   ? extend(options.to, to)     : to;\n\n        className = className || 'ng-inline-animate';\n        options.tempClasses = mergeClasses(options.tempClasses, className);\n        return $$animateQueue.push(element, 'animate', options);\n      }\n    };\n  }];\n}];\n\nvar $$AnimateAsyncRunFactoryProvider = function() {\n  this.$get = ['$$rAF', function($$rAF) {\n    var waitQueue = [];\n\n    function waitForTick(fn) {\n      waitQueue.push(fn);\n      if (waitQueue.length > 1) return;\n      $$rAF(function() {\n        for (var i = 0; i < waitQueue.length; i++) {\n          waitQueue[i]();\n        }\n        waitQueue = [];\n      });\n    }\n\n    return function() {\n      var passed = false;\n      waitForTick(function() {\n        passed = true;\n      });\n      return function(callback) {\n        passed ? callback() : waitForTick(callback);\n      };\n    };\n  }];\n};\n\nvar $$AnimateRunnerFactoryProvider = function() {\n  this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',\n       function($q,   $sniffer,   $$animateAsyncRun,   $document,   $timeout) {\n\n    var INITIAL_STATE = 0;\n    var DONE_PENDING_STATE = 1;\n    var DONE_COMPLETE_STATE = 2;\n\n    AnimateRunner.chain = function(chain, callback) {\n      var index = 0;\n\n      next();\n      function next() {\n        if (index === chain.length) {\n          callback(true);\n          return;\n        }\n\n        chain[index](function(response) {\n          if (response === false) {\n            callback(false);\n            return;\n          }\n          index++;\n          next();\n        });\n      }\n    };\n\n    AnimateRunner.all = function(runners, callback) {\n      var count = 0;\n      var status = true;\n      forEach(runners, function(runner) {\n        runner.done(onProgress);\n      });\n\n      function onProgress(response) {\n        status = status && response;\n        if (++count === runners.length) {\n          callback(status);\n        }\n      }\n    };\n\n    function AnimateRunner(host) {\n      this.setHost(host);\n\n      var rafTick = $$animateAsyncRun();\n      var timeoutTick = function(fn) {\n        $timeout(fn, 0, false);\n      };\n\n      this._doneCallbacks = [];\n      this._tick = function(fn) {\n        var doc = $document[0];\n\n        // the document may not be ready or attached\n        // to the module for some internal tests\n        if (doc && doc.hidden) {\n          timeoutTick(fn);\n        } else {\n          rafTick(fn);\n        }\n      };\n      this._state = 0;\n    }\n\n    AnimateRunner.prototype = {\n      setHost: function(host) {\n        this.host = host || {};\n      },\n\n      done: function(fn) {\n        if (this._state === DONE_COMPLETE_STATE) {\n          fn();\n        } else {\n          this._doneCallbacks.push(fn);\n        }\n      },\n\n      progress: noop,\n\n      getPromise: function() {\n        if (!this.promise) {\n          var self = this;\n          this.promise = $q(function(resolve, reject) {\n            self.done(function(status) {\n              status === false ? reject() : resolve();\n            });\n          });\n        }\n        return this.promise;\n      },\n\n      then: function(resolveHandler, rejectHandler) {\n        return this.getPromise().then(resolveHandler, rejectHandler);\n      },\n\n      'catch': function(handler) {\n        return this.getPromise()['catch'](handler);\n      },\n\n      'finally': function(handler) {\n        return this.getPromise()['finally'](handler);\n      },\n\n      pause: function() {\n        if (this.host.pause) {\n          this.host.pause();\n        }\n      },\n\n      resume: function() {\n        if (this.host.resume) {\n          this.host.resume();\n        }\n      },\n\n      end: function() {\n        if (this.host.end) {\n          this.host.end();\n        }\n        this._resolve(true);\n      },\n\n      cancel: function() {\n        if (this.host.cancel) {\n          this.host.cancel();\n        }\n        this._resolve(false);\n      },\n\n      complete: function(response) {\n        var self = this;\n        if (self._state === INITIAL_STATE) {\n          self._state = DONE_PENDING_STATE;\n          self._tick(function() {\n            self._resolve(response);\n          });\n        }\n      },\n\n      _resolve: function(response) {\n        if (this._state !== DONE_COMPLETE_STATE) {\n          forEach(this._doneCallbacks, function(fn) {\n            fn(response);\n          });\n          this._doneCallbacks.length = 0;\n          this._state = DONE_COMPLETE_STATE;\n        }\n      }\n    };\n\n    return AnimateRunner;\n  }];\n};\n\n/**\n * @ngdoc service\n * @name $animateCss\n * @kind object\n *\n * @description\n * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,\n * then the `$animateCss` service will actually perform animations.\n *\n * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.\n */\nvar $CoreAnimateCssProvider = function() {\n  this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {\n\n    return function(element, initialOptions) {\n      // all of the animation functions should create\n      // a copy of the options data, however, if a\n      // parent service has already created a copy then\n      // we should stick to using that\n      var options = initialOptions || {};\n      if (!options.$$prepared) {\n        options = copy(options);\n      }\n\n      // there is no point in applying the styles since\n      // there is no animation that goes on at all in\n      // this version of $animateCss.\n      if (options.cleanupStyles) {\n        options.from = options.to = null;\n      }\n\n      if (options.from) {\n        element.css(options.from);\n        options.from = null;\n      }\n\n      /* jshint newcap: false */\n      var closed, runner = new $$AnimateRunner();\n      return {\n        start: run,\n        end: run\n      };\n\n      function run() {\n        $$rAF(function() {\n          applyAnimationContents();\n          if (!closed) {\n            runner.complete();\n          }\n          closed = true;\n        });\n        return runner;\n      }\n\n      function applyAnimationContents() {\n        if (options.addClass) {\n          element.addClass(options.addClass);\n          options.addClass = null;\n        }\n        if (options.removeClass) {\n          element.removeClass(options.removeClass);\n          options.removeClass = null;\n        }\n        if (options.to) {\n          element.css(options.to);\n          options.to = null;\n        }\n      }\n    };\n  }];\n};\n\n/* global stripHash: true */\n\n/**\n * ! This is a private undocumented service !\n *\n * @name $browser\n * @requires $log\n * @description\n * This object has two goals:\n *\n * - hide all the global state in the browser caused by the window object\n * - abstract away all the browser specific features and inconsistencies\n *\n * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`\n * service, which can be used for convenient testing of the application without the interaction with\n * the real browser apis.\n */\n/**\n * @param {object} window The global window object.\n * @param {object} document jQuery wrapped document.\n * @param {object} $log window.console or an object with the same interface.\n * @param {object} $sniffer $sniffer service\n */\nfunction Browser(window, document, $log, $sniffer) {\n  var self = this,\n      location = window.location,\n      history = window.history,\n      setTimeout = window.setTimeout,\n      clearTimeout = window.clearTimeout,\n      pendingDeferIds = {};\n\n  self.isMock = false;\n\n  var outstandingRequestCount = 0;\n  var outstandingRequestCallbacks = [];\n\n  // TODO(vojta): remove this temporary api\n  self.$$completeOutstandingRequest = completeOutstandingRequest;\n  self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };\n\n  /**\n   * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`\n   * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.\n   */\n  function completeOutstandingRequest(fn) {\n    try {\n      fn.apply(null, sliceArgs(arguments, 1));\n    } finally {\n      outstandingRequestCount--;\n      if (outstandingRequestCount === 0) {\n        while (outstandingRequestCallbacks.length) {\n          try {\n            outstandingRequestCallbacks.pop()();\n          } catch (e) {\n            $log.error(e);\n          }\n        }\n      }\n    }\n  }\n\n  function getHash(url) {\n    var index = url.indexOf('#');\n    return index === -1 ? '' : url.substr(index);\n  }\n\n  /**\n   * @private\n   * Note: this method is used only by scenario runner\n   * TODO(vojta): prefix this method with $$ ?\n   * @param {function()} callback Function that will be called when no outstanding request\n   */\n  self.notifyWhenNoOutstandingRequests = function(callback) {\n    if (outstandingRequestCount === 0) {\n      callback();\n    } else {\n      outstandingRequestCallbacks.push(callback);\n    }\n  };\n\n  //////////////////////////////////////////////////////////////\n  // URL API\n  //////////////////////////////////////////////////////////////\n\n  var cachedState, lastHistoryState,\n      lastBrowserUrl = location.href,\n      baseElement = document.find('base'),\n      pendingLocation = null,\n      getCurrentState = !$sniffer.history ? noop : function getCurrentState() {\n        try {\n          return history.state;\n        } catch (e) {\n          // MSIE can reportedly throw when there is no state (UNCONFIRMED).\n        }\n      };\n\n  cacheState();\n  lastHistoryState = cachedState;\n\n  /**\n   * @name $browser#url\n   *\n   * @description\n   * GETTER:\n   * Without any argument, this method just returns current value of location.href.\n   *\n   * SETTER:\n   * With at least one argument, this method sets url to new value.\n   * If html5 history api supported, pushState/replaceState is used, otherwise\n   * location.href/location.replace is used.\n   * Returns its own instance to allow chaining\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to change url.\n   *\n   * @param {string} url New url (when used as setter)\n   * @param {boolean=} replace Should new url replace current history record?\n   * @param {object=} state object to use with pushState/replaceState\n   */\n  self.url = function(url, replace, state) {\n    // In modern browsers `history.state` is `null` by default; treating it separately\n    // from `undefined` would cause `$browser.url('/foo')` to change `history.state`\n    // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.\n    if (isUndefined(state)) {\n      state = null;\n    }\n\n    // Android Browser BFCache causes location, history reference to become stale.\n    if (location !== window.location) location = window.location;\n    if (history !== window.history) history = window.history;\n\n    // setter\n    if (url) {\n      var sameState = lastHistoryState === state;\n\n      // Don't change anything if previous and current URLs and states match. This also prevents\n      // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.\n      // See https://github.com/angular/angular.js/commit/ffb2701\n      if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {\n        return self;\n      }\n      var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);\n      lastBrowserUrl = url;\n      lastHistoryState = state;\n      // Don't use history API if only the hash changed\n      // due to a bug in IE10/IE11 which leads\n      // to not firing a `hashchange` nor `popstate` event\n      // in some cases (see #9143).\n      if ($sniffer.history && (!sameBase || !sameState)) {\n        history[replace ? 'replaceState' : 'pushState'](state, '', url);\n        cacheState();\n        // Do the assignment again so that those two variables are referentially identical.\n        lastHistoryState = cachedState;\n      } else {\n        if (!sameBase || pendingLocation) {\n          pendingLocation = url;\n        }\n        if (replace) {\n          location.replace(url);\n        } else if (!sameBase) {\n          location.href = url;\n        } else {\n          location.hash = getHash(url);\n        }\n        if (location.href !== url) {\n          pendingLocation = url;\n        }\n      }\n      return self;\n    // getter\n    } else {\n      // - pendingLocation is needed as browsers don't allow to read out\n      //   the new location.href if a reload happened or if there is a bug like in iOS 9 (see\n      //   https://openradar.appspot.com/22186109).\n      // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172\n      return pendingLocation || location.href.replace(/%27/g,\"'\");\n    }\n  };\n\n  /**\n   * @name $browser#state\n   *\n   * @description\n   * This method is a getter.\n   *\n   * Return history.state or null if history.state is undefined.\n   *\n   * @returns {object} state\n   */\n  self.state = function() {\n    return cachedState;\n  };\n\n  var urlChangeListeners = [],\n      urlChangeInit = false;\n\n  function cacheStateAndFireUrlChange() {\n    pendingLocation = null;\n    cacheState();\n    fireUrlChange();\n  }\n\n  // This variable should be used *only* inside the cacheState function.\n  var lastCachedState = null;\n  function cacheState() {\n    // This should be the only place in $browser where `history.state` is read.\n    cachedState = getCurrentState();\n    cachedState = isUndefined(cachedState) ? null : cachedState;\n\n    // Prevent callbacks fo fire twice if both hashchange & popstate were fired.\n    if (equals(cachedState, lastCachedState)) {\n      cachedState = lastCachedState;\n    }\n    lastCachedState = cachedState;\n  }\n\n  function fireUrlChange() {\n    if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {\n      return;\n    }\n\n    lastBrowserUrl = self.url();\n    lastHistoryState = cachedState;\n    forEach(urlChangeListeners, function(listener) {\n      listener(self.url(), cachedState);\n    });\n  }\n\n  /**\n   * @name $browser#onUrlChange\n   *\n   * @description\n   * Register callback function that will be called, when url changes.\n   *\n   * It's only called when the url is changed from outside of angular:\n   * - user types different url into address bar\n   * - user clicks on history (forward/back) button\n   * - user clicks on a link\n   *\n   * It's not called when url is changed by $browser.url() method\n   *\n   * The listener gets called with new url as parameter.\n   *\n   * NOTE: this api is intended for use only by the $location service. Please use the\n   * {@link ng.$location $location service} to monitor url changes in angular apps.\n   *\n   * @param {function(string)} listener Listener function to be called when url changes.\n   * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.\n   */\n  self.onUrlChange = function(callback) {\n    // TODO(vojta): refactor to use node's syntax for events\n    if (!urlChangeInit) {\n      // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)\n      // don't fire popstate when user change the address bar and don't fire hashchange when url\n      // changed by push/replaceState\n\n      // html5 history api - popstate event\n      if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);\n      // hashchange event\n      jqLite(window).on('hashchange', cacheStateAndFireUrlChange);\n\n      urlChangeInit = true;\n    }\n\n    urlChangeListeners.push(callback);\n    return callback;\n  };\n\n  /**\n   * @private\n   * Remove popstate and hashchange handler from window.\n   *\n   * NOTE: this api is intended for use only by $rootScope.\n   */\n  self.$$applicationDestroyed = function() {\n    jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);\n  };\n\n  /**\n   * Checks whether the url has changed outside of Angular.\n   * Needs to be exported to be able to check for changes that have been done in sync,\n   * as hashchange/popstate events fire in async.\n   */\n  self.$$checkUrlChange = fireUrlChange;\n\n  //////////////////////////////////////////////////////////////\n  // Misc API\n  //////////////////////////////////////////////////////////////\n\n  /**\n   * @name $browser#baseHref\n   *\n   * @description\n   * Returns current <base href>\n   * (always relative - without domain)\n   *\n   * @returns {string} The current base href\n   */\n  self.baseHref = function() {\n    var href = baseElement.attr('href');\n    return href ? href.replace(/^(https?\\:)?\\/\\/[^\\/]*/, '') : '';\n  };\n\n  /**\n   * @name $browser#defer\n   * @param {function()} fn A function, who's execution should be deferred.\n   * @param {number=} [delay=0] of milliseconds to defer the function execution.\n   * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.\n   *\n   * @description\n   * Executes a fn asynchronously via `setTimeout(fn, delay)`.\n   *\n   * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using\n   * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed\n   * via `$browser.defer.flush()`.\n   *\n   */\n  self.defer = function(fn, delay) {\n    var timeoutId;\n    outstandingRequestCount++;\n    timeoutId = setTimeout(function() {\n      delete pendingDeferIds[timeoutId];\n      completeOutstandingRequest(fn);\n    }, delay || 0);\n    pendingDeferIds[timeoutId] = true;\n    return timeoutId;\n  };\n\n\n  /**\n   * @name $browser#defer.cancel\n   *\n   * @description\n   * Cancels a deferred task identified with `deferId`.\n   *\n   * @param {*} deferId Token returned by the `$browser.defer` function.\n   * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n   *                    canceled.\n   */\n  self.defer.cancel = function(deferId) {\n    if (pendingDeferIds[deferId]) {\n      delete pendingDeferIds[deferId];\n      clearTimeout(deferId);\n      completeOutstandingRequest(noop);\n      return true;\n    }\n    return false;\n  };\n\n}\n\nfunction $BrowserProvider() {\n  this.$get = ['$window', '$log', '$sniffer', '$document',\n      function($window, $log, $sniffer, $document) {\n        return new Browser($window, $document, $log, $sniffer);\n      }];\n}\n\n/**\n * @ngdoc service\n * @name $cacheFactory\n *\n * @description\n * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to\n * them.\n *\n * ```js\n *\n *  var cache = $cacheFactory('cacheId');\n *  expect($cacheFactory.get('cacheId')).toBe(cache);\n *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();\n *\n *  cache.put(\"key\", \"value\");\n *  cache.put(\"another key\", \"another value\");\n *\n *  // We've specified no options on creation\n *  expect(cache.info()).toEqual({id: 'cacheId', size: 2});\n *\n * ```\n *\n *\n * @param {string} cacheId Name or id of the newly created cache.\n * @param {object=} options Options object that specifies the cache behavior. Properties:\n *\n *   - `{number=}` `capacity` — turns the cache into LRU cache.\n *\n * @returns {object} Newly created cache object with the following set of methods:\n *\n * - `{object}` `info()` — Returns id, size, and options of cache.\n * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns\n *   it.\n * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.\n * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.\n * - `{void}` `removeAll()` — Removes all cached values.\n * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.\n *\n * @example\n   <example module=\"cacheExampleApp\">\n     <file name=\"index.html\">\n       <div ng-controller=\"CacheController\">\n         <input ng-model=\"newCacheKey\" placeholder=\"Key\">\n         <input ng-model=\"newCacheValue\" placeholder=\"Value\">\n         <button ng-click=\"put(newCacheKey, newCacheValue)\">Cache</button>\n\n         <p ng-if=\"keys.length\">Cached Values</p>\n         <div ng-repeat=\"key in keys\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"cache.get(key)\"></b>\n         </div>\n\n         <p>Cache Info</p>\n         <div ng-repeat=\"(key, value) in cache.info()\">\n           <span ng-bind=\"key\"></span>\n           <span>: </span>\n           <b ng-bind=\"value\"></b>\n         </div>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('cacheExampleApp', []).\n         controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {\n           $scope.keys = [];\n           $scope.cache = $cacheFactory('cacheId');\n           $scope.put = function(key, value) {\n             if (angular.isUndefined($scope.cache.get(key))) {\n               $scope.keys.push(key);\n             }\n             $scope.cache.put(key, angular.isUndefined(value) ? null : value);\n           };\n         }]);\n     </file>\n     <file name=\"style.css\">\n       p {\n         margin: 10px 0 3px;\n       }\n     </file>\n   </example>\n */\nfunction $CacheFactoryProvider() {\n\n  this.$get = function() {\n    var caches = {};\n\n    function cacheFactory(cacheId, options) {\n      if (cacheId in caches) {\n        throw minErr('$cacheFactory')('iid', \"CacheId '{0}' is already taken!\", cacheId);\n      }\n\n      var size = 0,\n          stats = extend({}, options, {id: cacheId}),\n          data = createMap(),\n          capacity = (options && options.capacity) || Number.MAX_VALUE,\n          lruHash = createMap(),\n          freshEnd = null,\n          staleEnd = null;\n\n      /**\n       * @ngdoc type\n       * @name $cacheFactory.Cache\n       *\n       * @description\n       * A cache object used to store and retrieve data, primarily used by\n       * {@link $http $http} and the {@link ng.directive:script script} directive to cache\n       * templates and other data.\n       *\n       * ```js\n       *  angular.module('superCache')\n       *    .factory('superCache', ['$cacheFactory', function($cacheFactory) {\n       *      return $cacheFactory('super-cache');\n       *    }]);\n       * ```\n       *\n       * Example test:\n       *\n       * ```js\n       *  it('should behave like a cache', inject(function(superCache) {\n       *    superCache.put('key', 'value');\n       *    superCache.put('another key', 'another value');\n       *\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 2\n       *    });\n       *\n       *    superCache.remove('another key');\n       *    expect(superCache.get('another key')).toBeUndefined();\n       *\n       *    superCache.removeAll();\n       *    expect(superCache.info()).toEqual({\n       *      id: 'super-cache',\n       *      size: 0\n       *    });\n       *  }));\n       * ```\n       */\n      return caches[cacheId] = {\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#put\n         * @kind function\n         *\n         * @description\n         * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be\n         * retrieved later, and incrementing the size of the cache if the key was not already\n         * present in the cache. If behaving like an LRU cache, it will also remove stale\n         * entries from the set.\n         *\n         * It will not insert undefined values into the cache.\n         *\n         * @param {string} key the key under which the cached data is stored.\n         * @param {*} value the value to store alongside the key. If it is undefined, the key\n         *    will not be stored.\n         * @returns {*} the value stored.\n         */\n        put: function(key, value) {\n          if (isUndefined(value)) return;\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key] || (lruHash[key] = {key: key});\n\n            refresh(lruEntry);\n          }\n\n          if (!(key in data)) size++;\n          data[key] = value;\n\n          if (size > capacity) {\n            this.remove(staleEnd.key);\n          }\n\n          return value;\n        },\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#get\n         * @kind function\n         *\n         * @description\n         * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the data to be retrieved\n         * @returns {*} the value stored.\n         */\n        get: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            refresh(lruEntry);\n          }\n\n          return data[key];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#remove\n         * @kind function\n         *\n         * @description\n         * Removes an entry from the {@link $cacheFactory.Cache Cache} object.\n         *\n         * @param {string} key the key of the entry to be removed\n         */\n        remove: function(key) {\n          if (capacity < Number.MAX_VALUE) {\n            var lruEntry = lruHash[key];\n\n            if (!lruEntry) return;\n\n            if (lruEntry == freshEnd) freshEnd = lruEntry.p;\n            if (lruEntry == staleEnd) staleEnd = lruEntry.n;\n            link(lruEntry.n,lruEntry.p);\n\n            delete lruHash[key];\n          }\n\n          if (!(key in data)) return;\n\n          delete data[key];\n          size--;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#removeAll\n         * @kind function\n         *\n         * @description\n         * Clears the cache object of any entries.\n         */\n        removeAll: function() {\n          data = createMap();\n          size = 0;\n          lruHash = createMap();\n          freshEnd = staleEnd = null;\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#destroy\n         * @kind function\n         *\n         * @description\n         * Destroys the {@link $cacheFactory.Cache Cache} object entirely,\n         * removing it from the {@link $cacheFactory $cacheFactory} set.\n         */\n        destroy: function() {\n          data = null;\n          stats = null;\n          lruHash = null;\n          delete caches[cacheId];\n        },\n\n\n        /**\n         * @ngdoc method\n         * @name $cacheFactory.Cache#info\n         * @kind function\n         *\n         * @description\n         * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.\n         *\n         * @returns {object} an object with the following properties:\n         *   <ul>\n         *     <li>**id**: the id of the cache instance</li>\n         *     <li>**size**: the number of entries kept in the cache instance</li>\n         *     <li>**...**: any additional properties from the options object when creating the\n         *       cache.</li>\n         *   </ul>\n         */\n        info: function() {\n          return extend({}, stats, {size: size});\n        }\n      };\n\n\n      /**\n       * makes the `entry` the freshEnd of the LRU linked list\n       */\n      function refresh(entry) {\n        if (entry != freshEnd) {\n          if (!staleEnd) {\n            staleEnd = entry;\n          } else if (staleEnd == entry) {\n            staleEnd = entry.n;\n          }\n\n          link(entry.n, entry.p);\n          link(entry, freshEnd);\n          freshEnd = entry;\n          freshEnd.n = null;\n        }\n      }\n\n\n      /**\n       * bidirectionally links two entries of the LRU linked list\n       */\n      function link(nextEntry, prevEntry) {\n        if (nextEntry != prevEntry) {\n          if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify\n          if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify\n        }\n      }\n    }\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#info\n   *\n   * @description\n   * Get information about all the caches that have been created\n   *\n   * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`\n   */\n    cacheFactory.info = function() {\n      var info = {};\n      forEach(caches, function(cache, cacheId) {\n        info[cacheId] = cache.info();\n      });\n      return info;\n    };\n\n\n  /**\n   * @ngdoc method\n   * @name $cacheFactory#get\n   *\n   * @description\n   * Get access to a cache object by the `cacheId` used when it was created.\n   *\n   * @param {string} cacheId Name or id of a cache to access.\n   * @returns {object} Cache object identified by the cacheId or undefined if no such cache.\n   */\n    cacheFactory.get = function(cacheId) {\n      return caches[cacheId];\n    };\n\n\n    return cacheFactory;\n  };\n}\n\n/**\n * @ngdoc service\n * @name $templateCache\n *\n * @description\n * The first time a template is used, it is loaded in the template cache for quick retrieval. You\n * can load templates directly into the cache in a `script` tag, or by consuming the\n * `$templateCache` service directly.\n *\n * Adding via the `script` tag:\n *\n * ```html\n *   <script type=\"text/ng-template\" id=\"templateId.html\">\n *     <p>This is the content of the template</p>\n *   </script>\n * ```\n *\n * **Note:** the `script` tag containing the template does not need to be included in the `head` of\n * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,\n * element with ng-app attribute), otherwise the template will be ignored.\n *\n * Adding via the `$templateCache` service:\n *\n * ```js\n * var myApp = angular.module('myApp', []);\n * myApp.run(function($templateCache) {\n *   $templateCache.put('templateId.html', 'This is the content of the template');\n * });\n * ```\n *\n * To retrieve the template later, simply use it in your HTML:\n * ```html\n * <div ng-include=\" 'templateId.html' \"></div>\n * ```\n *\n * or get it via Javascript:\n * ```js\n * $templateCache.get('templateId.html')\n * ```\n *\n * See {@link ng.$cacheFactory $cacheFactory}.\n *\n */\nfunction $TemplateCacheProvider() {\n  this.$get = ['$cacheFactory', function($cacheFactory) {\n    return $cacheFactory('templates');\n  }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\n/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!\n *\n * DOM-related variables:\n *\n * - \"node\" - DOM Node\n * - \"element\" - DOM Element or Node\n * - \"$node\" or \"$element\" - jqLite-wrapped node or element\n *\n *\n * Compiler related stuff:\n *\n * - \"linkFn\" - linking fn of a single directive\n * - \"nodeLinkFn\" - function that aggregates all linking fns for a particular node\n * - \"childLinkFn\" -  function that aggregates all linking fns for child nodes of a particular node\n * - \"compositeLinkFn\" - function that aggregates all linking fns for a compilation root (nodeList)\n */\n\n\n/**\n * @ngdoc service\n * @name $compile\n * @kind function\n *\n * @description\n * Compiles an HTML string or DOM into a template and produces a template function, which\n * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.\n *\n * The compilation is a process of walking the DOM tree and matching DOM elements to\n * {@link ng.$compileProvider#directive directives}.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** This document is an in-depth reference of all directive options.\n * For a gentle introduction to directives with examples of common use cases,\n * see the {@link guide/directive directive guide}.\n * </div>\n *\n * ## Comprehensive Directive API\n *\n * There are many different options for a directive.\n *\n * The difference resides in the return value of the factory function.\n * You can either return a \"Directive Definition Object\" (see below) that defines the directive properties,\n * or just the `postLink` function (all other properties will have the default values).\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's recommended to use the \"directive definition object\" form.\n * </div>\n *\n * Here's an example directive declared with a Directive Definition Object:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       priority: 0,\n *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },\n *       // or\n *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },\n *       transclude: false,\n *       restrict: 'A',\n *       templateNamespace: 'html',\n *       scope: false,\n *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },\n *       controllerAs: 'stringIdentifier',\n *       bindToController: false,\n *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],\n *       compile: function compile(tElement, tAttrs, transclude) {\n *         return {\n *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *           post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *         }\n *         // or\n *         // return function postLink( ... ) { ... }\n *       },\n *       // or\n *       // link: {\n *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },\n *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }\n *       // }\n *       // or\n *       // link: function postLink( ... ) { ... }\n *     };\n *     return directiveDefinitionObject;\n *   });\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Any unspecified options will use the default value. You can see the default values below.\n * </div>\n *\n * Therefore the above can be simplified as:\n *\n * ```js\n *   var myModule = angular.module(...);\n *\n *   myModule.directive('directiveName', function factory(injectables) {\n *     var directiveDefinitionObject = {\n *       link: function postLink(scope, iElement, iAttrs) { ... }\n *     };\n *     return directiveDefinitionObject;\n *     // or\n *     // return function postLink(scope, iElement, iAttrs) { ... }\n *   });\n * ```\n *\n *\n *\n * ### Directive Definition Object\n *\n * The directive definition object provides instructions to the {@link ng.$compile\n * compiler}. The attributes are:\n *\n * #### `multiElement`\n * When this property is set to true, the HTML compiler will collect DOM nodes between\n * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them\n * together as the directive elements. It is recommended that this feature be used on directives\n * which are not strictly behavioral (such as {@link ngClick}), and which\n * do not manipulate or replace child nodes (such as {@link ngInclude}).\n *\n * #### `priority`\n * When there are multiple directives defined on a single DOM element, sometimes it\n * is necessary to specify the order in which the directives are applied. The `priority` is used\n * to sort the directives before their `compile` functions get called. Priority is defined as a\n * number. Directives with greater numerical `priority` are compiled first. Pre-link functions\n * are also run in priority order, but post-link functions are run in reverse order. The order\n * of directives with the same priority is undefined. The default priority is `0`.\n *\n * #### `terminal`\n * If set to true then the current `priority` will be the last set of directives\n * which will execute (any directives at the current priority will still execute\n * as the order of execution on same `priority` is undefined). Note that expressions\n * and other directives used in the directive's template will also be excluded from execution.\n *\n * #### `scope`\n * The scope property can be `true`, an object or a falsy value:\n *\n * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.\n *\n * * **`true`:** A new child scope that prototypically inherits from its parent will be created for\n * the directive's element. If multiple directives on the same element request a new scope,\n * only one new scope is created. The new scope rule does not apply for the root of the template\n * since the root of the template always gets a new scope.\n *\n * * **`{...}` (an object hash):** A new \"isolate\" scope is created for the directive's element. The\n * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent\n * scope. This is useful when creating reusable components, which should not accidentally read or modify\n * data in the parent scope.\n *\n * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the\n * directive's element. These local properties are useful for aliasing values for templates. The keys in\n * the object hash map to the name of the property on the isolate scope; the values define how the property\n * is bound to the parent scope, via matching attributes on the directive's element:\n *\n * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is\n *   always a string since DOM attributes are strings. If no `attr` name is specified then the\n *   attribute name is assumed to be the same as the local name. Given `<my-component\n *   my-attr=\"hello {{name}}\">` and the isolate scope definition `scope: { localName:'@myAttr' }`,\n *   the directive's scope property `localName` will reflect the interpolated value of `hello\n *   {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's\n *   scope. The `name` is read from the parent scope (not the directive's scope).\n *\n * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression\n *   passed via the attribute `attr`. The expression is evaluated in the context of the parent scope.\n *   If no `attr` name is specified then the attribute name is assumed to be the same as the local\n *   name. Given `<my-component my-attr=\"parentModel\">` and the isolate scope definition `scope: {\n *   localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the\n *   value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in\n *   `localModel` and vice versa. Optional attributes should be marked as such with a question mark:\n *   `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't\n *   optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`})\n *   will be thrown upon discovering changes to the local value, since it will be impossible to sync\n *   them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`}\n *   method is used for tracking changes, and the equality check is based on object identity.\n *   However, if an object literal or an array literal is passed as the binding expression, the\n *   equality check is done by value (using the {@link angular.equals} function). It's also possible\n *   to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection\n *   `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional).\n *\n  * * `<` or `<attr` - set up a one-way (one-directional) binding between a local scope property and an\n *   expression passed via the attribute `attr`. The expression is evaluated in the context of the\n *   parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the\n *   local name. You can also make the binding optional by adding `?`: `<?` or `<?attr`.\n *\n *   For example, given `<my-component my-attr=\"parentModel\">` and directive definition of\n *   `scope: { localModel:'<myAttr' }`, then the isolated scope property `localModel` will reflect the\n *   value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected\n *   in `localModel`, but changes in `localModel` will not reflect in `parentModel`. There are however\n *   two caveats:\n *     1. one-way binding does not copy the value from the parent to the isolate scope, it simply\n *     sets the same value. That means if your bound value is an object, changes to its properties\n *     in the isolated scope will be reflected in the parent scope (because both reference the same object).\n *     2. one-way binding watches changes to the **identity** of the parent value. That means the\n *     {@link ng.$rootScope.Scope#$watch `$watch`} on the parent value only fires if the reference\n *     to the value has changed. In most cases, this should not be of concern, but can be important\n *     to know if you one-way bind to an object, and then replace that object in the isolated scope.\n *     If you now change a property of the object in your parent scope, the change will not be\n *     propagated to the isolated scope, because the identity of the object on the parent scope\n *     has not changed. Instead you must assign a new object.\n *\n *   One-way binding is useful if you do not plan to propagate changes to your isolated scope bindings\n *   back to the parent. However, it does not make this completely impossible.\n *\n * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If\n *   no `attr` name is specified then the attribute name is assumed to be the same as the local name.\n *   Given `<my-component my-attr=\"count = count + value\">` and the isolate scope definition `scope: {\n *   localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for\n *   the `count = count + value` expression. Often it's desirable to pass data from the isolated scope\n *   via an expression to the parent scope. This can be done by passing a map of local variable names\n *   and values into the expression wrapper fn. For example, if the expression is `increment(amount)`\n *   then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.\n *\n * In general it's possible to apply more than one directive to one element, but there might be limitations\n * depending on the type of scope required by the directives. The following points will help explain these limitations.\n * For simplicity only two directives are taken into account, but it is also applicable for several directives:\n *\n * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope\n * * **child scope** + **no scope** =>  Both directives will share one single child scope\n * * **child scope** + **child scope** =>  Both directives will share one single child scope\n * * **isolated scope** + **no scope** =>  The isolated directive will use it's own created isolated scope. The other directive will use\n * its parent's scope\n * * **isolated scope** + **child scope** =>  **Won't work!** Only one scope can be related to one element. Therefore these directives cannot\n * be applied to the same element.\n * * **isolated scope** + **isolated scope**  =>  **Won't work!** Only one scope can be related to one element. Therefore these directives\n * cannot be applied to the same element.\n *\n *\n * #### `bindToController`\n * This property is used to bind scope properties directly to the controller. It can be either\n * `true` or an object hash with the same format as the `scope` property. Additionally, a controller\n * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller\n * definition: `controller: 'myCtrl as myAlias'`.\n *\n * When an isolate scope is used for a directive (see above), `bindToController: true` will\n * allow a component to have its properties bound to the controller, rather than to scope.\n *\n * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller\n * properties. You can access these bindings once they have been initialized by providing a controller method called\n * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings\n * initialized.\n *\n * <div class=\"alert alert-warning\">\n * **Deprecation warning:** although bindings for non-ES6 class controllers are currently\n * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization\n * code that relies upon bindings inside a `$onInit` method on the controller, instead.\n * </div>\n *\n * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.\n * This will set up the scope bindings to the controller directly. Note that `scope` can still be used\n * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate\n * scope (useful for component directives).\n *\n * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.\n *\n *\n * #### `controller`\n * Controller constructor function. The controller is instantiated before the\n * pre-linking phase and can be accessed by other directives (see\n * `require` attribute). This allows the directives to communicate with each other and augment\n * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:\n *\n * * `$scope` - Current scope associated with the element\n * * `$element` - Current element\n * * `$attrs` - Current attributes object for the element\n * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:\n *   `function([scope], cloneLinkingFn, futureParentElement, slotName)`:\n *    * `scope`: (optional) override the scope.\n *    * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content.\n *    * `futureParentElement` (optional):\n *        * defines the parent to which the `cloneLinkingFn` will add the cloned elements.\n *        * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.\n *        * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)\n *          and when the `cloneLinkinFn` is passed,\n *          as those elements need to created and cloned in a special way when they are defined outside their\n *          usual containers (e.g. like `<svg>`).\n *        * See also the `directive.templateNamespace` property.\n *    * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`)\n *      then the default translusion is provided.\n *    The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns\n *    `true` if the specified slot contains content (i.e. one or more DOM nodes).\n *\n * The controller can provide the following methods that act as life-cycle hooks:\n * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and\n *   had their bindings initialized (and before the pre &amp; post linking functions for the directives on\n *   this element). This is a good place to put initialization code for your controller.\n * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The\n *   `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an\n *   object of the form `{ currentValue: ..., previousValue: ... }`. Use this hook to trigger updates within a component\n *   such as cloning the bound value to prevent accidental mutation of the outer value.\n * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing\n *   external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in\n *   the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent\n *   components will have their `$onDestroy()` hook called before child components.\n * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link\n *   function this hook can be used to set up DOM event handlers and do direct DOM manipulation.\n *   Note that child elements that contain `templateUrl` directives will not have been compiled and linked since\n *   they are waiting for their template to load asynchronously and their own compilation and linking has been\n *   suspended until that occurs.\n *\n *\n * #### `require`\n * Require another directive and inject its controller as the fourth argument to the linking function. The\n * `require` property can be a string, an array or an object:\n * * a **string** containing the name of the directive to pass to the linking function\n * * an **array** containing the names of directives to pass to the linking function. The argument passed to the\n * linking function will be an array of controllers in the same order as the names in the `require` property\n * * an **object** whose property values are the names of the directives to pass to the linking function. The argument\n * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding\n * controllers.\n *\n * If the `require` property is an object and `bindToController` is truthy, then the required controllers are\n * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers\n * have been constructed but before `$onInit` is called.\n * See the {@link $compileProvider#component} helper for an example of how this can be used.\n *\n * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is\n * raised (unless no link function is specified and the required controllers are not being bound to the directive\n * controller, in which case error checking is skipped). The name can be prefixed with:\n *\n * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.\n * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.\n * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.\n * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.\n * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass\n *   `null` to the `link` fn if not found.\n * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass\n *   `null` to the `link` fn if not found.\n *\n *\n * #### `controllerAs`\n * Identifier name for a reference to the controller in the directive's scope.\n * This allows the controller to be referenced from the directive template. This is especially\n * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible\n * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the\n * `controllerAs` reference might overwrite a property that already exists on the parent scope.\n *\n *\n * #### `restrict`\n * String of subset of `EACM` which restricts the directive to a specific directive\n * declaration style. If omitted, the defaults (elements and attributes) are used.\n *\n * * `E` - Element name (default): `<my-directive></my-directive>`\n * * `A` - Attribute (default): `<div my-directive=\"exp\"></div>`\n * * `C` - Class: `<div class=\"my-directive: exp;\"></div>`\n * * `M` - Comment: `<!-- directive: my-directive exp -->`\n *\n *\n * #### `templateNamespace`\n * String representing the document type used by the markup in the template.\n * AngularJS needs this information as those elements need to be created and cloned\n * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.\n *\n * * `html` - All root nodes in the template are HTML. Root nodes may also be\n *   top-level elements such as `<svg>` or `<math>`.\n * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).\n * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).\n *\n * If no `templateNamespace` is specified, then the namespace is considered to be `html`.\n *\n * #### `template`\n * HTML markup that may:\n * * Replace the contents of the directive's element (default).\n * * Replace the directive's element itself (if `replace` is true - DEPRECATED).\n * * Wrap the contents of the directive's element (if `transclude` is true).\n *\n * Value may be:\n *\n * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.\n * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`\n *   function api below) and returns a string value.\n *\n *\n * #### `templateUrl`\n * This is similar to `template` but the template is loaded from the specified URL, asynchronously.\n *\n * Because template loading is asynchronous the compiler will suspend compilation of directives on that element\n * for later when the template has been resolved.  In the meantime it will continue to compile and link\n * sibling and parent elements as though this element had not contained any directives.\n *\n * The compiler does not suspend the entire compilation to wait for templates to be loaded because this\n * would result in the whole app \"stalling\" until all templates are loaded asynchronously - even in the\n * case when only one deeply nested directive has `templateUrl`.\n *\n * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}\n *\n * You can specify `templateUrl` as a string representing the URL or as a function which takes two\n * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns\n * a string value representing the url.  In either case, the template URL is passed through {@link\n * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.\n *\n *\n * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)\n * specify what the template should replace. Defaults to `false`.\n *\n * * `true` - the template will replace the directive's element.\n * * `false` - the template will replace the contents of the directive's element.\n *\n * The replacement process migrates all of the attributes / classes from the old element to the new\n * one. See the {@link guide/directive#template-expanding-directive\n * Directives Guide} for an example.\n *\n * There are very few scenarios where element replacement is required for the application function,\n * the main one being reusable custom components that are used within SVG contexts\n * (because SVG doesn't work with custom elements in the DOM tree).\n *\n * #### `transclude`\n * Extract the contents of the element where the directive appears and make it available to the directive.\n * The contents are compiled and provided to the directive as a **transclusion function**. See the\n * {@link $compile#transclusion Transclusion} section below.\n *\n *\n * #### `compile`\n *\n * ```js\n *   function compile(tElement, tAttrs, transclude) { ... }\n * ```\n *\n * The compile function deals with transforming the template DOM. Since most directives do not do\n * template transformation, it is not used often. The compile function takes the following arguments:\n *\n *   * `tElement` - template element - The element where the directive has been declared. It is\n *     safe to do template transformation on the element and child elements only.\n *\n *   * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared\n *     between all directive compile functions.\n *\n *   * `transclude` -  [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`\n *\n * <div class=\"alert alert-warning\">\n * **Note:** The template instance and the link instance may be different objects if the template has\n * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that\n * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration\n * should be done in a linking function rather than in a compile function.\n * </div>\n\n * <div class=\"alert alert-warning\">\n * **Note:** The compile function cannot handle directives that recursively use themselves in their\n * own templates or compile functions. Compiling these directives results in an infinite loop and\n * stack overflow errors.\n *\n * This can be avoided by manually using $compile in the postLink function to imperatively compile\n * a directive's template instead of relying on automatic template compilation via `template` or\n * `templateUrl` declaration or manual compilation inside the compile function.\n * </div>\n *\n * <div class=\"alert alert-danger\">\n * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it\n *   e.g. does not know about the right outer scope. Please use the transclude function that is passed\n *   to the link function instead.\n * </div>\n\n * A compile function can have a return value which can be either a function or an object.\n *\n * * returning a (post-link) function - is equivalent to registering the linking function via the\n *   `link` property of the config object when the compile function is empty.\n *\n * * returning an object with function(s) registered via `pre` and `post` properties - allows you to\n *   control when a linking function should be called during the linking phase. See info about\n *   pre-linking and post-linking functions below.\n *\n *\n * #### `link`\n * This property is used only if the `compile` property is not defined.\n *\n * ```js\n *   function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }\n * ```\n *\n * The link function is responsible for registering DOM listeners as well as updating the DOM. It is\n * executed after the template has been cloned. This is where most of the directive logic will be\n * put.\n *\n *   * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the\n *     directive for registering {@link ng.$rootScope.Scope#$watch watches}.\n *\n *   * `iElement` - instance element - The element where the directive is to be used. It is safe to\n *     manipulate the children of the element only in `postLink` function since the children have\n *     already been linked.\n *\n *   * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared\n *     between all directive linking functions.\n *\n *   * `controller` - the directive's required controller instance(s) - Instances are shared\n *     among all directives, which allows the directives to use the controllers as a communication\n *     channel. The exact value depends on the directive's `require` property:\n *       * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one\n *       * `string`: the controller instance\n *       * `array`: array of controller instances\n *\n *     If a required controller cannot be found, and it is optional, the instance is `null`,\n *     otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.\n *\n *     Note that you can also require the directive's own controller - it will be made available like\n *     any other controller.\n *\n *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.\n *     This is the same as the `$transclude`\n *     parameter of directive controllers, see there for details.\n *     `function([scope], cloneLinkingFn, futureParentElement)`.\n *\n * #### Pre-linking function\n *\n * Executed before the child elements are linked. Not safe to do DOM transformation since the\n * compiler linking function will fail to locate the correct elements for linking.\n *\n * #### Post-linking function\n *\n * Executed after the child elements are linked.\n *\n * Note that child elements that contain `templateUrl` directives will not have been compiled\n * and linked since they are waiting for their template to load asynchronously and their own\n * compilation and linking has been suspended until that occurs.\n *\n * It is safe to do DOM transformation in the post-linking function on elements that are not waiting\n * for their async templates to be resolved.\n *\n *\n * ### Transclusion\n *\n * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and\n * copying them to another part of the DOM, while maintaining their connection to the original AngularJS\n * scope from where they were taken.\n *\n * Transclusion is used (often with {@link ngTransclude}) to insert the\n * original contents of a directive's element into a specified place in the template of the directive.\n * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded\n * content has access to the properties on the scope from which it was taken, even if the directive\n * has isolated scope.\n * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.\n *\n * This makes it possible for the widget to have private state for its template, while the transcluded\n * content has access to its originating scope.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** When testing an element transclude directive you must not place the directive at the root of the\n * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives\n * Testing Transclusion Directives}.\n * </div>\n *\n * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the\n * directive's element, the entire element or multiple parts of the element contents:\n *\n * * `true` - transclude the content (i.e. the child nodes) of the directive's element.\n * * `'element'` - transclude the whole of the directive's element including any directives on this\n *   element that defined at a lower priority than this directive. When used, the `template`\n *   property is ignored.\n * * **`{...}` (an object hash):** - map elements of the content onto transclusion \"slots\" in the template.\n *\n * **Mult-slot transclusion** is declared by providing an object for the `transclude` property.\n *\n * This object is a map where the keys are the name of the slot to fill and the value is an element selector\n * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)\n * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).\n *\n * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}\n *\n * If the element selector is prefixed with a `?` then that slot is optional.\n *\n * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `<my-custom-element>` elements to\n * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive.\n *\n * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements\n * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call\n * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and\n * injectable into the directive's controller.\n *\n *\n * #### Transclusion Functions\n *\n * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion\n * function** to the directive's `link` function and `controller`. This transclusion function is a special\n * **linking function** that will return the compiled contents linked to a new transclusion scope.\n *\n * <div class=\"alert alert-info\">\n * If you are just using {@link ngTransclude} then you don't need to worry about this function, since\n * ngTransclude will deal with it for us.\n * </div>\n *\n * If you want to manually control the insertion and removal of the transcluded content in your directive\n * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery\n * object that contains the compiled DOM, which is linked to the correct transclusion scope.\n *\n * When you call a transclusion function you can pass in a **clone attach function**. This function accepts\n * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded\n * content and the `scope` is the newly created transclusion scope, to which the clone is bound.\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function\n * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.\n * </div>\n *\n * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone\n * attach function**:\n *\n * ```js\n * var transcludedContent, transclusionScope;\n *\n * $transclude(function(clone, scope) {\n *   element.append(clone);\n *   transcludedContent = clone;\n *   transclusionScope = scope;\n * });\n * ```\n *\n * Later, if you want to remove the transcluded content from your DOM then you should also destroy the\n * associated transclusion scope:\n *\n * ```js\n * transcludedContent.remove();\n * transclusionScope.$destroy();\n * ```\n *\n * <div class=\"alert alert-info\">\n * **Best Practice**: if you intend to add and remove transcluded content manually in your directive\n * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),\n * then you are also responsible for calling `$destroy` on the transclusion scope.\n * </div>\n *\n * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}\n * automatically destroy their transcluded clones as necessary so you do not need to worry about this if\n * you are simply using {@link ngTransclude} to inject the transclusion into your directive.\n *\n *\n * #### Transclusion Scopes\n *\n * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion\n * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed\n * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it\n * was taken.\n *\n * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look\n * like this:\n *\n * ```html\n * <div ng-app>\n *   <div isolate>\n *     <div transclusion>\n *     </div>\n *   </div>\n * </div>\n * ```\n *\n * The `$parent` scope hierarchy will look like this:\n *\n   ```\n   - $rootScope\n     - isolate\n       - transclusion\n   ```\n *\n * but the scopes will inherit prototypically from different scopes to their `$parent`.\n *\n   ```\n   - $rootScope\n     - transclusion\n   - isolate\n   ```\n *\n *\n * ### Attributes\n *\n * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the\n * `link()` or `compile()` functions. It has a variety of uses.\n *\n * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:\n *   'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access\n *   to the attributes.\n *\n * * *Directive inter-communication:* All directives share the same instance of the attributes\n *   object which allows the directives to use the attributes object as inter directive\n *   communication.\n *\n * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object\n *   allowing other directives to read the interpolated value.\n *\n * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes\n *   that contain interpolation (e.g. `src=\"{{bar}}\"`). Not only is this very efficient but it's also\n *   the only way to easily get the actual value because during the linking phase the interpolation\n *   hasn't been evaluated yet and so the value is at this time set to `undefined`.\n *\n * ```js\n * function linkingFn(scope, elm, attrs, ctrl) {\n *   // get the attribute value\n *   console.log(attrs.ngModel);\n *\n *   // change the attribute\n *   attrs.$set('ngModel', 'new value');\n *\n *   // observe changes to interpolated attribute\n *   attrs.$observe('ngModel', function(value) {\n *     console.log('ngModel has changed value to ' + value);\n *   });\n * }\n * ```\n *\n * ## Example\n *\n * <div class=\"alert alert-warning\">\n * **Note**: Typically directives are registered with `module.directive`. The example below is\n * to illustrate how `$compile` works.\n * </div>\n *\n <example module=\"compileExample\">\n   <file name=\"index.html\">\n    <script>\n      angular.module('compileExample', [], function($compileProvider) {\n        // configure new 'compile' directive by passing a directive\n        // factory function. The factory function injects the '$compile'\n        $compileProvider.directive('compile', function($compile) {\n          // directive factory creates a link function\n          return function(scope, element, attrs) {\n            scope.$watch(\n              function(scope) {\n                 // watch the 'compile' expression for changes\n                return scope.$eval(attrs.compile);\n              },\n              function(value) {\n                // when the 'compile' expression changes\n                // assign it into the current DOM\n                element.html(value);\n\n                // compile the new DOM and link it to the current\n                // scope.\n                // NOTE: we only compile .childNodes so that\n                // we don't get into infinite loop compiling ourselves\n                $compile(element.contents())(scope);\n              }\n            );\n          };\n        });\n      })\n      .controller('GreeterController', ['$scope', function($scope) {\n        $scope.name = 'Angular';\n        $scope.html = 'Hello {{name}}';\n      }]);\n    </script>\n    <div ng-controller=\"GreeterController\">\n      <input ng-model=\"name\"> <br/>\n      <textarea ng-model=\"html\"></textarea> <br/>\n      <div compile=\"html\"></div>\n    </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should auto compile', function() {\n       var textarea = $('textarea');\n       var output = $('div[compile]');\n       // The initial state reads 'Hello Angular'.\n       expect(output.getText()).toBe('Hello Angular');\n       textarea.clear();\n       textarea.sendKeys('{{name}}!');\n       expect(output.getText()).toBe('Angular!');\n     });\n   </file>\n </example>\n\n *\n *\n * @param {string|DOMElement} element Element or HTML string to compile into a template function.\n * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.\n *\n * <div class=\"alert alert-danger\">\n * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it\n *   e.g. will not use the right outer scope. Please pass the transclude function as a\n *   `parentBoundTranscludeFn` to the link function instead.\n * </div>\n *\n * @param {number} maxPriority only apply directives lower than given priority (Only effects the\n *                 root element(s), not their children)\n * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template\n * (a DOM element/tree) to a scope. Where:\n *\n *  * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.\n *  * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the\n *  `template` and call the `cloneAttachFn` function allowing the caller to attach the\n *  cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is\n *  called as: <br/> `cloneAttachFn(clonedElement, scope)` where:\n *\n *      * `clonedElement` - is a clone of the original `element` passed into the compiler.\n *      * `scope` - is the current scope with which the linking function is working with.\n *\n *  * `options` - An optional object hash with linking options. If `options` is provided, then the following\n *  keys may be used to control linking behavior:\n *\n *      * `parentBoundTranscludeFn` - the transclude function made available to\n *        directives; if given, it will be passed through to the link functions of\n *        directives found in `element` during compilation.\n *      * `transcludeControllers` - an object hash with keys that map controller names\n *        to a hash with the key `instance`, which maps to the controller instance;\n *        if given, it will make the controllers available to directives on the compileNode:\n *        ```\n *        {\n *          parent: {\n *            instance: parentControllerInstance\n *          }\n *        }\n *        ```\n *      * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add\n *        the cloned elements; only needed for transcludes that are allowed to contain non html\n *        elements (e.g. SVG elements). See also the directive.controller property.\n *\n * Calling the linking function returns the element of the template. It is either the original\n * element passed in, or the clone of the element if the `cloneAttachFn` is provided.\n *\n * After linking the view is not updated until after a call to $digest which typically is done by\n * Angular automatically.\n *\n * If you need access to the bound view, there are two ways to do it:\n *\n * - If you are not asking the linking function to clone the template, create the DOM element(s)\n *   before you send them to the compiler and keep this reference around.\n *   ```js\n *     var element = $compile('<p>{{total}}</p>')(scope);\n *   ```\n *\n * - if on the other hand, you need the element to be cloned, the view reference from the original\n *   example would not point to the clone, but rather to the original template that was cloned. In\n *   this case, you can access the clone via the cloneAttachFn:\n *   ```js\n *     var templateElement = angular.element('<p>{{total}}</p>'),\n *         scope = ....;\n *\n *     var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {\n *       //attach the clone to DOM document at the right place\n *     });\n *\n *     //now we have reference to the cloned DOM via `clonedElement`\n *   ```\n *\n *\n * For information on how the compiler works, see the\n * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.\n */\n\nvar $compileMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $compileProvider\n *\n * @description\n */\n$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];\nfunction $CompileProvider($provide, $$sanitizeUriProvider) {\n  var hasDirectives = {},\n      Suffix = 'Directive',\n      COMMENT_DIRECTIVE_REGEXP = /^\\s*directive\\:\\s*([\\w\\-]+)\\s+(.*)$/,\n      CLASS_DIRECTIVE_REGEXP = /(([\\w\\-]+)(?:\\:([^;]+))?;?)/,\n      ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),\n      REQUIRE_PREFIX_REGEXP = /^(?:(\\^\\^?)?(\\?)?(\\^\\^?)?)?/;\n\n  // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes\n  // The assumption is that future DOM event attribute names will begin with\n  // 'on' and be composed of only English letters.\n  var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;\n  var bindingCache = createMap();\n\n  function parseIsolateBindings(scope, directiveName, isController) {\n    var LOCAL_REGEXP = /^\\s*([@&<]|=(\\*?))(\\??)\\s*(\\w*)\\s*$/;\n\n    var bindings = {};\n\n    forEach(scope, function(definition, scopeName) {\n      if (definition in bindingCache) {\n        bindings[scopeName] = bindingCache[definition];\n        return;\n      }\n      var match = definition.match(LOCAL_REGEXP);\n\n      if (!match) {\n        throw $compileMinErr('iscp',\n            \"Invalid {3} for directive '{0}'.\" +\n            \" Definition: {... {1}: '{2}' ...}\",\n            directiveName, scopeName, definition,\n            (isController ? \"controller bindings definition\" :\n            \"isolate scope definition\"));\n      }\n\n      bindings[scopeName] = {\n        mode: match[1][0],\n        collection: match[2] === '*',\n        optional: match[3] === '?',\n        attrName: match[4] || scopeName\n      };\n      if (match[4]) {\n        bindingCache[definition] = bindings[scopeName];\n      }\n    });\n\n    return bindings;\n  }\n\n  function parseDirectiveBindings(directive, directiveName) {\n    var bindings = {\n      isolateScope: null,\n      bindToController: null\n    };\n    if (isObject(directive.scope)) {\n      if (directive.bindToController === true) {\n        bindings.bindToController = parseIsolateBindings(directive.scope,\n                                                         directiveName, true);\n        bindings.isolateScope = {};\n      } else {\n        bindings.isolateScope = parseIsolateBindings(directive.scope,\n                                                     directiveName, false);\n      }\n    }\n    if (isObject(directive.bindToController)) {\n      bindings.bindToController =\n          parseIsolateBindings(directive.bindToController, directiveName, true);\n    }\n    if (isObject(bindings.bindToController)) {\n      var controller = directive.controller;\n      var controllerAs = directive.controllerAs;\n      if (!controller) {\n        // There is no controller, there may or may not be a controllerAs property\n        throw $compileMinErr('noctrl',\n              \"Cannot bind to controller without directive '{0}'s controller.\",\n              directiveName);\n      } else if (!identifierForController(controller, controllerAs)) {\n        // There is a controller, but no identifier or controllerAs property\n        throw $compileMinErr('noident',\n              \"Cannot bind to controller without identifier for directive '{0}'.\",\n              directiveName);\n      }\n    }\n    return bindings;\n  }\n\n  function assertValidDirectiveName(name) {\n    var letter = name.charAt(0);\n    if (!letter || letter !== lowercase(letter)) {\n      throw $compileMinErr('baddir', \"Directive/Component name '{0}' is invalid. The first character must be a lowercase letter\", name);\n    }\n    if (name !== name.trim()) {\n      throw $compileMinErr('baddir',\n            \"Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces\",\n            name);\n    }\n  }\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#directive\n   * @kind function\n   *\n   * @description\n   * Register a new directive with the compiler.\n   *\n   * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which\n   *    will match as <code>ng-bind</code>), or an object map of directives where the keys are the\n   *    names and the values are the factories.\n   * @param {Function|Array} directiveFactory An injectable directive factory function. See the\n   *    {@link guide/directive directive guide} and the {@link $compile compile API} for more info.\n   * @returns {ng.$compileProvider} Self for chaining.\n   */\n  this.directive = function registerDirective(name, directiveFactory) {\n    assertNotHasOwnProperty(name, 'directive');\n    if (isString(name)) {\n      assertValidDirectiveName(name);\n      assertArg(directiveFactory, 'directiveFactory');\n      if (!hasDirectives.hasOwnProperty(name)) {\n        hasDirectives[name] = [];\n        $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',\n          function($injector, $exceptionHandler) {\n            var directives = [];\n            forEach(hasDirectives[name], function(directiveFactory, index) {\n              try {\n                var directive = $injector.invoke(directiveFactory);\n                if (isFunction(directive)) {\n                  directive = { compile: valueFn(directive) };\n                } else if (!directive.compile && directive.link) {\n                  directive.compile = valueFn(directive.link);\n                }\n                directive.priority = directive.priority || 0;\n                directive.index = index;\n                directive.name = directive.name || name;\n                directive.require = directive.require || (directive.controller && directive.name);\n                directive.restrict = directive.restrict || 'EA';\n                directive.$$moduleName = directiveFactory.$$moduleName;\n                directives.push(directive);\n              } catch (e) {\n                $exceptionHandler(e);\n              }\n            });\n            return directives;\n          }]);\n      }\n      hasDirectives[name].push(directiveFactory);\n    } else {\n      forEach(name, reverseParams(registerDirective));\n    }\n    return this;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#component\n   * @module ng\n   * @param {string} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`)\n   * @param {Object} options Component definition object (a simplified\n   *    {@link ng.$compile#directive-definition-object directive definition object}),\n   *    with the following properties (all optional):\n   *\n   *    - `controller` – `{(string|function()=}` – controller constructor function that should be\n   *      associated with newly created scope or the name of a {@link ng.$compile#-controller-\n   *      registered controller} if passed as a string. An empty `noop` function by default.\n   *    - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope.\n   *      If present, the controller will be published to scope under the `controllerAs` name.\n   *      If not present, this will default to be `$ctrl`.\n   *    - `template` – `{string=|function()=}` – html template as a string or a function that\n   *      returns an html template as a string which should be used as the contents of this component.\n   *      Empty string by default.\n   *\n   *      If `template` is a function, then it is {@link auto.$injector#invoke injected} with\n   *      the following locals:\n   *\n   *      - `$element` - Current element\n   *      - `$attrs` - Current attributes object for the element\n   *\n   *    - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html\n   *      template that should be used  as the contents of this component.\n   *\n   *      If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with\n   *      the following locals:\n   *\n   *      - `$element` - Current element\n   *      - `$attrs` - Current attributes object for the element\n   *\n   *    - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties.\n   *      Component properties are always bound to the component controller and not to the scope.\n   *      See {@link ng.$compile#-bindtocontroller- `bindToController`}.\n   *    - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.\n   *      Disabled by default.\n   *    - `$...` – additional properties to attach to the directive factory function and the controller\n   *      constructor function. (This is used by the component router to annotate)\n   *\n   * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls.\n   * @description\n   * Register a **component definition** with the compiler. This is a shorthand for registering a special\n   * type of directive, which represents a self-contained UI component in your application. Such components\n   * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).\n   *\n   * Component definitions are very simple and do not require as much configuration as defining general\n   * directives. Component definitions usually consist only of a template and a controller backing it.\n   *\n   * In order to make the definition easier, components enforce best practices like use of `controllerAs`,\n   * `bindToController`. They always have **isolate scope** and are restricted to elements.\n   *\n   * Here are a few examples of how you would usually define components:\n   *\n   * ```js\n   *   var myMod = angular.module(...);\n   *   myMod.component('myComp', {\n   *     template: '<div>My name is {{$ctrl.name}}</div>',\n   *     controller: function() {\n   *       this.name = 'shahar';\n   *     }\n   *   });\n   *\n   *   myMod.component('myComp', {\n   *     template: '<div>My name is {{$ctrl.name}}</div>',\n   *     bindings: {name: '@'}\n   *   });\n   *\n   *   myMod.component('myComp', {\n   *     templateUrl: 'views/my-comp.html',\n   *     controller: 'MyCtrl',\n   *     controllerAs: 'ctrl',\n   *     bindings: {name: '@'}\n   *   });\n   *\n   * ```\n   * For more examples, and an in-depth guide, see the {@link guide/component component guide}.\n   *\n   * <br />\n   * See also {@link ng.$compileProvider#directive $compileProvider.directive()}.\n   */\n  this.component = function registerComponent(name, options) {\n    var controller = options.controller || noop;\n\n    function factory($injector) {\n      function makeInjectable(fn) {\n        if (isFunction(fn) || isArray(fn)) {\n          return function(tElement, tAttrs) {\n            return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});\n          };\n        } else {\n          return fn;\n        }\n      }\n\n      var template = (!options.template && !options.templateUrl ? '' : options.template);\n      return {\n        controller: controller,\n        controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',\n        template: makeInjectable(template),\n        templateUrl: makeInjectable(options.templateUrl),\n        transclude: options.transclude,\n        scope: {},\n        bindToController: options.bindings || {},\n        restrict: 'E',\n        require: options.require\n      };\n    }\n\n    // Copy any annotation properties (starting with $) over to the factory function\n    // These could be used by libraries such as the new component router\n    forEach(options, function(val, key) {\n      if (key.charAt(0) === '$') {\n        factory[key] = val;\n        controller[key] = val;\n      }\n    });\n\n    factory.$inject = ['$injector'];\n\n    return this.directive(name, factory);\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#aHrefSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at preventing XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.aHrefSanitizationWhitelist();\n    }\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $compileProvider#imgSrcSanitizationWhitelist\n   * @kind function\n   *\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);\n      return this;\n    } else {\n      return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name  $compileProvider#debugInfoEnabled\n   *\n   * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the\n   * current debugInfoEnabled state\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   *\n   * @kind function\n   *\n   * @description\n   * Call this method to enable/disable various debug runtime information in the compiler such as adding\n   * binding information and a reference to the current scope on to DOM elements.\n   * If enabled, the compiler will add the following to DOM elements that have been bound to the scope\n   * * `ng-binding` CSS class\n   * * `$binding` data property containing an array of the binding expressions\n   *\n   * You may want to disable this in production for a significant performance boost. See\n   * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.\n   *\n   * The default value is true.\n   */\n  var debugInfoEnabled = true;\n  this.debugInfoEnabled = function(enabled) {\n    if (isDefined(enabled)) {\n      debugInfoEnabled = enabled;\n      return this;\n    }\n    return debugInfoEnabled;\n  };\n\n\n  var TTL = 10;\n  /**\n   * @ngdoc method\n   * @name $compileProvider#onChangesTtl\n   * @description\n   *\n   * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and\n   * assuming that the model is unstable.\n   *\n   * The current default is 10 iterations.\n   *\n   * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result\n   * in several iterations of calls to these hooks. However if an application needs more than the default 10\n   * iterations to stabilize then you should investigate what is causing the model to continuously change during\n   * the `$onChanges` hook execution.\n   *\n   * Increasing the TTL could have performance implications, so you should not change it without proper justification.\n   *\n   * @param {number} limit The number of `$onChanges` hook iterations.\n   * @returns {number|object} the current limit (or `this` if called as a setter for chaining)\n   */\n  this.onChangesTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n      return this;\n    }\n    return TTL;\n  };\n\n  this.$get = [\n            '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',\n            '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',\n    function($injector,   $interpolate,   $exceptionHandler,   $templateRequest,   $parse,\n             $controller,   $rootScope,   $sce,   $animate,   $$sanitizeUri) {\n\n    var SIMPLE_ATTR_NAME = /^\\w/;\n    var specialAttrHolder = document.createElement('div');\n\n\n\n    var onChangesTtl = TTL;\n    // The onChanges hooks should all be run together in a single digest\n    // When changes occur, the call to trigger their hooks will be added to this queue\n    var onChangesQueue;\n\n    // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest\n    function flushOnChangesQueue() {\n      try {\n        if (!(--onChangesTtl)) {\n          // We have hit the TTL limit so reset everything\n          onChangesQueue = undefined;\n          throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\\n', TTL);\n        }\n        // We must run this hook in an apply since the $$postDigest runs outside apply\n        $rootScope.$apply(function() {\n          for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) {\n            onChangesQueue[i]();\n          }\n          // Reset the queue to trigger a new schedule next time there is a change\n          onChangesQueue = undefined;\n        });\n      } finally {\n        onChangesTtl++;\n      }\n    }\n\n\n    function Attributes(element, attributesToCopy) {\n      if (attributesToCopy) {\n        var keys = Object.keys(attributesToCopy);\n        var i, l, key;\n\n        for (i = 0, l = keys.length; i < l; i++) {\n          key = keys[i];\n          this[key] = attributesToCopy[key];\n        }\n      } else {\n        this.$attr = {};\n      }\n\n      this.$$element = element;\n    }\n\n    Attributes.prototype = {\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$normalize\n       * @kind function\n       *\n       * @description\n       * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or\n       * `data-`) to its normalized, camelCase form.\n       *\n       * Also there is special case for Moz prefix starting with upper case letter.\n       *\n       * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}\n       *\n       * @param {string} name Name to normalize\n       */\n      $normalize: directiveNormalize,\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$addClass\n       * @kind function\n       *\n       * @description\n       * Adds the CSS class value specified by the classVal parameter to the element. If animations\n       * are enabled then an animation will be triggered for the class addition.\n       *\n       * @param {string} classVal The className value that will be added to the element\n       */\n      $addClass: function(classVal) {\n        if (classVal && classVal.length > 0) {\n          $animate.addClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$removeClass\n       * @kind function\n       *\n       * @description\n       * Removes the CSS class value specified by the classVal parameter from the element. If\n       * animations are enabled then an animation will be triggered for the class removal.\n       *\n       * @param {string} classVal The className value that will be removed from the element\n       */\n      $removeClass: function(classVal) {\n        if (classVal && classVal.length > 0) {\n          $animate.removeClass(this.$$element, classVal);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$updateClass\n       * @kind function\n       *\n       * @description\n       * Adds and removes the appropriate CSS class values to the element based on the difference\n       * between the new and old CSS class values (specified as newClasses and oldClasses).\n       *\n       * @param {string} newClasses The current CSS className value\n       * @param {string} oldClasses The former CSS className value\n       */\n      $updateClass: function(newClasses, oldClasses) {\n        var toAdd = tokenDifference(newClasses, oldClasses);\n        if (toAdd && toAdd.length) {\n          $animate.addClass(this.$$element, toAdd);\n        }\n\n        var toRemove = tokenDifference(oldClasses, newClasses);\n        if (toRemove && toRemove.length) {\n          $animate.removeClass(this.$$element, toRemove);\n        }\n      },\n\n      /**\n       * Set a normalized attribute on the element in a way such that all directives\n       * can share the attribute. This function properly handles boolean attributes.\n       * @param {string} key Normalized key. (ie ngAttribute)\n       * @param {string|boolean} value The value to set. If `null` attribute will be deleted.\n       * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.\n       *     Defaults to true.\n       * @param {string=} attrName Optional none normalized name. Defaults to key.\n       */\n      $set: function(key, value, writeAttr, attrName) {\n        // TODO: decide whether or not to throw an error if \"class\"\n        //is set through this function since it may cause $updateClass to\n        //become unstable.\n\n        var node = this.$$element[0],\n            booleanKey = getBooleanAttrName(node, key),\n            aliasedKey = getAliasedAttrName(key),\n            observer = key,\n            nodeName;\n\n        if (booleanKey) {\n          this.$$element.prop(key, value);\n          attrName = booleanKey;\n        } else if (aliasedKey) {\n          this[aliasedKey] = value;\n          observer = aliasedKey;\n        }\n\n        this[key] = value;\n\n        // translate normalized key to actual key\n        if (attrName) {\n          this.$attr[key] = attrName;\n        } else {\n          attrName = this.$attr[key];\n          if (!attrName) {\n            this.$attr[key] = attrName = snake_case(key, '-');\n          }\n        }\n\n        nodeName = nodeName_(this.$$element);\n\n        if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||\n            (nodeName === 'img' && key === 'src')) {\n          // sanitize a[href] and img[src] values\n          this[key] = value = $$sanitizeUri(value, key === 'src');\n        } else if (nodeName === 'img' && key === 'srcset') {\n          // sanitize img[srcset] values\n          var result = \"\";\n\n          // first check if there are spaces because it's not the same pattern\n          var trimmedSrcset = trim(value);\n          //                (   999x   ,|   999w   ,|   ,|,   )\n          var srcPattern = /(\\s+\\d+x\\s*,|\\s+\\d+w\\s*,|\\s+,|,\\s+)/;\n          var pattern = /\\s/.test(trimmedSrcset) ? srcPattern : /(,)/;\n\n          // split srcset into tuple of uri and descriptor except for the last item\n          var rawUris = trimmedSrcset.split(pattern);\n\n          // for each tuples\n          var nbrUrisWith2parts = Math.floor(rawUris.length / 2);\n          for (var i = 0; i < nbrUrisWith2parts; i++) {\n            var innerIdx = i * 2;\n            // sanitize the uri\n            result += $$sanitizeUri(trim(rawUris[innerIdx]), true);\n            // add the descriptor\n            result += (\" \" + trim(rawUris[innerIdx + 1]));\n          }\n\n          // split the last item into uri and descriptor\n          var lastTuple = trim(rawUris[i * 2]).split(/\\s/);\n\n          // sanitize the last uri\n          result += $$sanitizeUri(trim(lastTuple[0]), true);\n\n          // and add the last descriptor if any\n          if (lastTuple.length === 2) {\n            result += (\" \" + trim(lastTuple[1]));\n          }\n          this[key] = value = result;\n        }\n\n        if (writeAttr !== false) {\n          if (value === null || isUndefined(value)) {\n            this.$$element.removeAttr(attrName);\n          } else {\n            if (SIMPLE_ATTR_NAME.test(attrName)) {\n              this.$$element.attr(attrName, value);\n            } else {\n              setSpecialAttr(this.$$element[0], attrName, value);\n            }\n          }\n        }\n\n        // fire observers\n        var $$observers = this.$$observers;\n        $$observers && forEach($$observers[observer], function(fn) {\n          try {\n            fn(value);\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        });\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $compile.directive.Attributes#$observe\n       * @kind function\n       *\n       * @description\n       * Observes an interpolated attribute.\n       *\n       * The observer function will be invoked once during the next `$digest` following\n       * compilation. The observer is then invoked whenever the interpolated value\n       * changes.\n       *\n       * @param {string} key Normalized key. (ie ngAttribute) .\n       * @param {function(interpolatedValue)} fn Function that will be called whenever\n                the interpolated value of the attribute changes.\n       *        See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation\n       *        guide} for more info.\n       * @returns {function()} Returns a deregistration function for this observer.\n       */\n      $observe: function(key, fn) {\n        var attrs = this,\n            $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),\n            listeners = ($$observers[key] || ($$observers[key] = []));\n\n        listeners.push(fn);\n        $rootScope.$evalAsync(function() {\n          if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {\n            // no one registered attribute interpolation function, so lets call it manually\n            fn(attrs[key]);\n          }\n        });\n\n        return function() {\n          arrayRemove(listeners, fn);\n        };\n      }\n    };\n\n    function setSpecialAttr(element, attrName, value) {\n      // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`\n      // so we have to jump through some hoops to get such an attribute\n      // https://github.com/angular/angular.js/pull/13318\n      specialAttrHolder.innerHTML = \"<span \" + attrName + \">\";\n      var attributes = specialAttrHolder.firstChild.attributes;\n      var attribute = attributes[0];\n      // We have to remove the attribute from its container element before we can add it to the destination element\n      attributes.removeNamedItem(attribute.name);\n      attribute.value = value;\n      element.attributes.setNamedItem(attribute);\n    }\n\n    function safeAddClass($element, className) {\n      try {\n        $element.addClass(className);\n      } catch (e) {\n        // ignore, since it means that we are trying to set class on\n        // SVG element, where class name is read-only.\n      }\n    }\n\n\n    var startSymbol = $interpolate.startSymbol(),\n        endSymbol = $interpolate.endSymbol(),\n        denormalizeTemplate = (startSymbol == '{{' && endSymbol  == '}}')\n            ? identity\n            : function denormalizeTemplate(template) {\n              return template.replace(/\\{\\{/g, startSymbol).replace(/}}/g, endSymbol);\n        },\n        NG_ATTR_BINDING = /^ngAttr[A-Z]/;\n    var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;\n\n    compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {\n      var bindings = $element.data('$binding') || [];\n\n      if (isArray(binding)) {\n        bindings = bindings.concat(binding);\n      } else {\n        bindings.push(binding);\n      }\n\n      $element.data('$binding', bindings);\n    } : noop;\n\n    compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {\n      safeAddClass($element, 'ng-binding');\n    } : noop;\n\n    compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {\n      var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';\n      $element.data(dataName, scope);\n    } : noop;\n\n    compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {\n      safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');\n    } : noop;\n\n    compile.$$createComment = function(directiveName, comment) {\n      var content = '';\n      if (debugInfoEnabled) {\n        content = ' ' + (directiveName || '') + ': ' + (comment || '') + ' ';\n      }\n      return document.createComment(content);\n    };\n\n    return compile;\n\n    //================================\n\n    function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,\n                        previousCompileContext) {\n      if (!($compileNodes instanceof jqLite)) {\n        // jquery always rewraps, whereas we need to preserve the original selector so that we can\n        // modify it.\n        $compileNodes = jqLite($compileNodes);\n      }\n\n      var NOT_EMPTY = /\\S+/;\n\n      // We can not compile top level text elements since text nodes can be merged and we will\n      // not be able to attach scope data to them, so we will wrap them in <span>\n      for (var i = 0, len = $compileNodes.length; i < len; i++) {\n        var domNode = $compileNodes[i];\n\n        if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {\n          jqLiteWrapNode(domNode, $compileNodes[i] = document.createElement('span'));\n        }\n      }\n\n      var compositeLinkFn =\n              compileNodes($compileNodes, transcludeFn, $compileNodes,\n                           maxPriority, ignoreDirective, previousCompileContext);\n      compile.$$addScopeClass($compileNodes);\n      var namespace = null;\n      return function publicLinkFn(scope, cloneConnectFn, options) {\n        assertArg(scope, 'scope');\n\n        if (previousCompileContext && previousCompileContext.needsNewScope) {\n          // A parent directive did a replace and a directive on this element asked\n          // for transclusion, which caused us to lose a layer of element on which\n          // we could hold the new transclusion scope, so we will create it manually\n          // here.\n          scope = scope.$parent.$new();\n        }\n\n        options = options || {};\n        var parentBoundTranscludeFn = options.parentBoundTranscludeFn,\n          transcludeControllers = options.transcludeControllers,\n          futureParentElement = options.futureParentElement;\n\n        // When `parentBoundTranscludeFn` is passed, it is a\n        // `controllersBoundTransclude` function (it was previously passed\n        // as `transclude` to directive.link) so we must unwrap it to get\n        // its `boundTranscludeFn`\n        if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {\n          parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;\n        }\n\n        if (!namespace) {\n          namespace = detectNamespaceForChildElements(futureParentElement);\n        }\n        var $linkNode;\n        if (namespace !== 'html') {\n          // When using a directive with replace:true and templateUrl the $compileNodes\n          // (or a child element inside of them)\n          // might change, so we need to recreate the namespace adapted compileNodes\n          // for call to the link function.\n          // Note: This will already clone the nodes...\n          $linkNode = jqLite(\n            wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())\n          );\n        } else if (cloneConnectFn) {\n          // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart\n          // and sometimes changes the structure of the DOM.\n          $linkNode = JQLitePrototype.clone.call($compileNodes);\n        } else {\n          $linkNode = $compileNodes;\n        }\n\n        if (transcludeControllers) {\n          for (var controllerName in transcludeControllers) {\n            $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);\n          }\n        }\n\n        compile.$$addScopeInfo($linkNode, scope);\n\n        if (cloneConnectFn) cloneConnectFn($linkNode, scope);\n        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);\n        return $linkNode;\n      };\n    }\n\n    function detectNamespaceForChildElements(parentElement) {\n      // TODO: Make this detect MathML as well...\n      var node = parentElement && parentElement[0];\n      if (!node) {\n        return 'html';\n      } else {\n        return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html';\n      }\n    }\n\n    /**\n     * Compile function matches each node in nodeList against the directives. Once all directives\n     * for a particular node are collected their compile functions are executed. The compile\n     * functions return values - the linking functions - are combined into a composite linking\n     * function, which is the a linking function for the node.\n     *\n     * @param {NodeList} nodeList an array of nodes or NodeList to compile\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *        scope argument is auto-generated to the new child of the transcluded parent scope.\n     * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then\n     *        the rootElement must be set the jqLite collection of the compile root. This is\n     *        needed so that the jqLite collection items can be replaced with widgets.\n     * @param {number=} maxPriority Max directive priority.\n     * @returns {Function} A composite linking function of all of the matched directives or null.\n     */\n    function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,\n                            previousCompileContext) {\n      var linkFns = [],\n          attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;\n\n      for (var i = 0; i < nodeList.length; i++) {\n        attrs = new Attributes();\n\n        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.\n        directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,\n                                        ignoreDirective);\n\n        nodeLinkFn = (directives.length)\n            ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,\n                                      null, [], [], previousCompileContext)\n            : null;\n\n        if (nodeLinkFn && nodeLinkFn.scope) {\n          compile.$$addScopeClass(attrs.$$element);\n        }\n\n        childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||\n                      !(childNodes = nodeList[i].childNodes) ||\n                      !childNodes.length)\n            ? null\n            : compileNodes(childNodes,\n                 nodeLinkFn ? (\n                  (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)\n                     && nodeLinkFn.transclude) : transcludeFn);\n\n        if (nodeLinkFn || childLinkFn) {\n          linkFns.push(i, nodeLinkFn, childLinkFn);\n          linkFnFound = true;\n          nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;\n        }\n\n        //use the previous context only for the first element in the virtual group\n        previousCompileContext = null;\n      }\n\n      // return a linking function if we have found anything, null otherwise\n      return linkFnFound ? compositeLinkFn : null;\n\n      function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {\n        var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;\n        var stableNodeList;\n\n\n        if (nodeLinkFnFound) {\n          // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our\n          // offsets don't get screwed up\n          var nodeListLength = nodeList.length;\n          stableNodeList = new Array(nodeListLength);\n\n          // create a sparse array by only copying the elements which have a linkFn\n          for (i = 0; i < linkFns.length; i+=3) {\n            idx = linkFns[i];\n            stableNodeList[idx] = nodeList[idx];\n          }\n        } else {\n          stableNodeList = nodeList;\n        }\n\n        for (i = 0, ii = linkFns.length; i < ii;) {\n          node = stableNodeList[linkFns[i++]];\n          nodeLinkFn = linkFns[i++];\n          childLinkFn = linkFns[i++];\n\n          if (nodeLinkFn) {\n            if (nodeLinkFn.scope) {\n              childScope = scope.$new();\n              compile.$$addScopeInfo(jqLite(node), childScope);\n            } else {\n              childScope = scope;\n            }\n\n            if (nodeLinkFn.transcludeOnThisElement) {\n              childBoundTranscludeFn = createBoundTranscludeFn(\n                  scope, nodeLinkFn.transclude, parentBoundTranscludeFn);\n\n            } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {\n              childBoundTranscludeFn = parentBoundTranscludeFn;\n\n            } else if (!parentBoundTranscludeFn && transcludeFn) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);\n\n            } else {\n              childBoundTranscludeFn = null;\n            }\n\n            nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);\n\n          } else if (childLinkFn) {\n            childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);\n          }\n        }\n      }\n    }\n\n    function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {\n      function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {\n\n        if (!transcludedScope) {\n          transcludedScope = scope.$new(false, containingScope);\n          transcludedScope.$$transcluded = true;\n        }\n\n        return transcludeFn(transcludedScope, cloneFn, {\n          parentBoundTranscludeFn: previousBoundTranscludeFn,\n          transcludeControllers: controllers,\n          futureParentElement: futureParentElement\n        });\n      }\n\n      // We need  to attach the transclusion slots onto the `boundTranscludeFn`\n      // so that they are available inside the `controllersBoundTransclude` function\n      var boundSlots = boundTranscludeFn.$$slots = createMap();\n      for (var slotName in transcludeFn.$$slots) {\n        if (transcludeFn.$$slots[slotName]) {\n          boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);\n        } else {\n          boundSlots[slotName] = null;\n        }\n      }\n\n      return boundTranscludeFn;\n    }\n\n    /**\n     * Looks for directives on the given node and adds them to the directive collection which is\n     * sorted.\n     *\n     * @param node Node to search.\n     * @param directives An array to which the directives are added to. This array is sorted before\n     *        the function returns.\n     * @param attrs The shared attrs object which is used to populate the normalized attributes.\n     * @param {number=} maxPriority Max directive priority.\n     */\n    function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {\n      var nodeType = node.nodeType,\n          attrsMap = attrs.$attr,\n          match,\n          className;\n\n      switch (nodeType) {\n        case NODE_TYPE_ELEMENT: /* Element */\n          // use the node name: <directive>\n          addDirective(directives,\n              directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);\n\n          // iterate over the attributes\n          for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,\n                   j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {\n            var attrStartName = false;\n            var attrEndName = false;\n\n            attr = nAttrs[j];\n            name = attr.name;\n            value = trim(attr.value);\n\n            // support ngAttr attribute binding\n            ngAttrName = directiveNormalize(name);\n            if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {\n              name = name.replace(PREFIX_REGEXP, '')\n                .substr(8).replace(/_(.)/g, function(match, letter) {\n                  return letter.toUpperCase();\n                });\n            }\n\n            var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);\n            if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {\n              attrStartName = name;\n              attrEndName = name.substr(0, name.length - 5) + 'end';\n              name = name.substr(0, name.length - 6);\n            }\n\n            nName = directiveNormalize(name.toLowerCase());\n            attrsMap[nName] = name;\n            if (isNgAttr || !attrs.hasOwnProperty(nName)) {\n                attrs[nName] = value;\n                if (getBooleanAttrName(node, nName)) {\n                  attrs[nName] = true; // presence means true\n                }\n            }\n            addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);\n            addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,\n                          attrEndName);\n          }\n\n          // use class as directive\n          className = node.className;\n          if (isObject(className)) {\n              // Maybe SVGAnimatedString\n              className = className.animVal;\n          }\n          if (isString(className) && className !== '') {\n            while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {\n              nName = directiveNormalize(match[2]);\n              if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[3]);\n              }\n              className = className.substr(match.index + match[0].length);\n            }\n          }\n          break;\n        case NODE_TYPE_TEXT: /* Text Node */\n          if (msie === 11) {\n            // Workaround for #11781\n            while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {\n              node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;\n              node.parentNode.removeChild(node.nextSibling);\n            }\n          }\n          addTextInterpolateDirective(directives, node.nodeValue);\n          break;\n        case NODE_TYPE_COMMENT: /* Comment */\n          try {\n            match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);\n            if (match) {\n              nName = directiveNormalize(match[1]);\n              if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {\n                attrs[nName] = trim(match[2]);\n              }\n            }\n          } catch (e) {\n            // turns out that under some circumstances IE9 throws errors when one attempts to read\n            // comment's node value.\n            // Just ignore it and continue. (Can't seem to reproduce in test case.)\n          }\n          break;\n      }\n\n      directives.sort(byPriority);\n      return directives;\n    }\n\n    /**\n     * Given a node with an directive-start it collects all of the siblings until it finds\n     * directive-end.\n     * @param node\n     * @param attrStart\n     * @param attrEnd\n     * @returns {*}\n     */\n    function groupScan(node, attrStart, attrEnd) {\n      var nodes = [];\n      var depth = 0;\n      if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {\n        do {\n          if (!node) {\n            throw $compileMinErr('uterdir',\n                      \"Unterminated attribute, found '{0}' but no matching '{1}' found.\",\n                      attrStart, attrEnd);\n          }\n          if (node.nodeType == NODE_TYPE_ELEMENT) {\n            if (node.hasAttribute(attrStart)) depth++;\n            if (node.hasAttribute(attrEnd)) depth--;\n          }\n          nodes.push(node);\n          node = node.nextSibling;\n        } while (depth > 0);\n      } else {\n        nodes.push(node);\n      }\n\n      return jqLite(nodes);\n    }\n\n    /**\n     * Wrapper for linking function which converts normal linking function into a grouped\n     * linking function.\n     * @param linkFn\n     * @param attrStart\n     * @param attrEnd\n     * @returns {Function}\n     */\n    function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {\n      return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) {\n        element = groupScan(element[0], attrStart, attrEnd);\n        return linkFn(scope, element, attrs, controllers, transcludeFn);\n      };\n    }\n\n    /**\n     * A function generator that is used to support both eager and lazy compilation\n     * linking function.\n     * @param eager\n     * @param $compileNodes\n     * @param transcludeFn\n     * @param maxPriority\n     * @param ignoreDirective\n     * @param previousCompileContext\n     * @returns {Function}\n     */\n    function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {\n      var compiled;\n\n      if (eager) {\n        return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);\n      }\n      return function lazyCompilation() {\n        if (!compiled) {\n          compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);\n\n          // Null out all of these references in order to make them eligible for garbage collection\n          // since this is a potentially long lived closure\n          $compileNodes = transcludeFn = previousCompileContext = null;\n        }\n        return compiled.apply(this, arguments);\n      };\n    }\n\n    /**\n     * Once the directives have been collected, their compile functions are executed. This method\n     * is responsible for inlining directive templates as well as terminating the application\n     * of the directives if the terminal directive has been reached.\n     *\n     * @param {Array} directives Array of collected directives to execute their compile function.\n     *        this needs to be pre-sorted by priority order.\n     * @param {Node} compileNode The raw DOM node to apply the compile functions to\n     * @param {Object} templateAttrs The shared attribute function\n     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the\n     *                                                  scope argument is auto-generated to the new\n     *                                                  child of the transcluded parent scope.\n     * @param {JQLite} jqCollection If we are working on the root of the compile tree then this\n     *                              argument has the root jqLite array so that we can replace nodes\n     *                              on it.\n     * @param {Object=} originalReplaceDirective An optional directive that will be ignored when\n     *                                           compiling the transclusion.\n     * @param {Array.<Function>} preLinkFns\n     * @param {Array.<Function>} postLinkFns\n     * @param {Object} previousCompileContext Context used for previous compilation of the current\n     *                                        node\n     * @returns {Function} linkFn\n     */\n    function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,\n                                   jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,\n                                   previousCompileContext) {\n      previousCompileContext = previousCompileContext || {};\n\n      var terminalPriority = -Number.MAX_VALUE,\n          newScopeDirective = previousCompileContext.newScopeDirective,\n          controllerDirectives = previousCompileContext.controllerDirectives,\n          newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,\n          templateDirective = previousCompileContext.templateDirective,\n          nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,\n          hasTranscludeDirective = false,\n          hasTemplate = false,\n          hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,\n          $compileNode = templateAttrs.$$element = jqLite(compileNode),\n          directive,\n          directiveName,\n          $template,\n          replaceDirective = originalReplaceDirective,\n          childTranscludeFn = transcludeFn,\n          linkFn,\n          didScanForMultipleTransclusion = false,\n          mightHaveMultipleTransclusionError = false,\n          directiveValue;\n\n      // executes all directives on the current element\n      for (var i = 0, ii = directives.length; i < ii; i++) {\n        directive = directives[i];\n        var attrStart = directive.$$start;\n        var attrEnd = directive.$$end;\n\n        // collect multiblock sections\n        if (attrStart) {\n          $compileNode = groupScan(compileNode, attrStart, attrEnd);\n        }\n        $template = undefined;\n\n        if (terminalPriority > directive.priority) {\n          break; // prevent further processing of directives\n        }\n\n        if (directiveValue = directive.scope) {\n\n          // skip the check for directives with async templates, we'll check the derived sync\n          // directive when the template arrives\n          if (!directive.templateUrl) {\n            if (isObject(directiveValue)) {\n              // This directive is trying to add an isolated scope.\n              // Check that there is no scope of any kind already\n              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,\n                                directive, $compileNode);\n              newIsolateScopeDirective = directive;\n            } else {\n              // This directive is trying to add a child scope.\n              // Check that there is no isolated scope already\n              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,\n                                $compileNode);\n            }\n          }\n\n          newScopeDirective = newScopeDirective || directive;\n        }\n\n        directiveName = directive.name;\n\n        // If we encounter a condition that can result in transclusion on the directive,\n        // then scan ahead in the remaining directives for others that may cause a multiple\n        // transclusion error to be thrown during the compilation process.  If a matching directive\n        // is found, then we know that when we encounter a transcluded directive, we need to eagerly\n        // compile the `transclude` function rather than doing it lazily in order to throw\n        // exceptions at the correct time\n        if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))\n            || (directive.transclude && !directive.$$tlb))) {\n                var candidateDirective;\n\n                for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {\n                    if ((candidateDirective.transclude && !candidateDirective.$$tlb)\n                        || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {\n                        mightHaveMultipleTransclusionError = true;\n                        break;\n                    }\n                }\n\n                didScanForMultipleTransclusion = true;\n        }\n\n        if (!directive.templateUrl && directive.controller) {\n          directiveValue = directive.controller;\n          controllerDirectives = controllerDirectives || createMap();\n          assertNoDuplicate(\"'\" + directiveName + \"' controller\",\n              controllerDirectives[directiveName], directive, $compileNode);\n          controllerDirectives[directiveName] = directive;\n        }\n\n        if (directiveValue = directive.transclude) {\n          hasTranscludeDirective = true;\n\n          // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.\n          // This option should only be used by directives that know how to safely handle element transclusion,\n          // where the transcluded nodes are added or replaced after linking.\n          if (!directive.$$tlb) {\n            assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);\n            nonTlbTranscludeDirective = directive;\n          }\n\n          if (directiveValue == 'element') {\n            hasElementTranscludeDirective = true;\n            terminalPriority = directive.priority;\n            $template = $compileNode;\n            $compileNode = templateAttrs.$$element =\n                jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName]));\n            compileNode = $compileNode[0];\n            replaceWith(jqCollection, sliceArgs($template), compileNode);\n\n            // Support: Chrome < 50\n            // https://github.com/angular/angular.js/issues/14041\n\n            // In the versions of V8 prior to Chrome 50, the document fragment that is created\n            // in the `replaceWith` function is improperly garbage collected despite still\n            // being referenced by the `parentNode` property of all of the child nodes.  By adding\n            // a reference to the fragment via a different property, we can avoid that incorrect\n            // behavior.\n            // TODO: remove this line after Chrome 50 has been released\n            $template[0].$$parentNode = $template[0].parentNode;\n\n            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,\n                                        replaceDirective && replaceDirective.name, {\n                                          // Don't pass in:\n                                          // - controllerDirectives - otherwise we'll create duplicates controllers\n                                          // - newIsolateScopeDirective or templateDirective - combining templates with\n                                          //   element transclusion doesn't make sense.\n                                          //\n                                          // We need only nonTlbTranscludeDirective so that we prevent putting transclusion\n                                          // on the same element more than once.\n                                          nonTlbTranscludeDirective: nonTlbTranscludeDirective\n                                        });\n          } else {\n\n            var slots = createMap();\n\n            $template = jqLite(jqLiteClone(compileNode)).contents();\n\n            if (isObject(directiveValue)) {\n\n              // We have transclusion slots,\n              // collect them up, compile them and store their transclusion functions\n              $template = [];\n\n              var slotMap = createMap();\n              var filledSlots = createMap();\n\n              // Parse the element selectors\n              forEach(directiveValue, function(elementSelector, slotName) {\n                // If an element selector starts with a ? then it is optional\n                var optional = (elementSelector.charAt(0) === '?');\n                elementSelector = optional ? elementSelector.substring(1) : elementSelector;\n\n                slotMap[elementSelector] = slotName;\n\n                // We explicitly assign `null` since this implies that a slot was defined but not filled.\n                // Later when calling boundTransclusion functions with a slot name we only error if the\n                // slot is `undefined`\n                slots[slotName] = null;\n\n                // filledSlots contains `true` for all slots that are either optional or have been\n                // filled. This is used to check that we have not missed any required slots\n                filledSlots[slotName] = optional;\n              });\n\n              // Add the matching elements into their slot\n              forEach($compileNode.contents(), function(node) {\n                var slotName = slotMap[directiveNormalize(nodeName_(node))];\n                if (slotName) {\n                  filledSlots[slotName] = true;\n                  slots[slotName] = slots[slotName] || [];\n                  slots[slotName].push(node);\n                } else {\n                  $template.push(node);\n                }\n              });\n\n              // Check for required slots that were not filled\n              forEach(filledSlots, function(filled, slotName) {\n                if (!filled) {\n                  throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);\n                }\n              });\n\n              for (var slotName in slots) {\n                if (slots[slotName]) {\n                  // Only define a transclusion function if the slot was filled\n                  slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);\n                }\n              }\n            }\n\n            $compileNode.empty(); // clear contents\n            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,\n                undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});\n            childTranscludeFn.$$slots = slots;\n          }\n        }\n\n        if (directive.template) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          directiveValue = (isFunction(directive.template))\n              ? directive.template($compileNode, templateAttrs)\n              : directive.template;\n\n          directiveValue = denormalizeTemplate(directiveValue);\n\n          if (directive.replace) {\n            replaceDirective = directive;\n            if (jqLiteIsTextNode(directiveValue)) {\n              $template = [];\n            } else {\n              $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  directiveName, '');\n            }\n\n            replaceWith(jqCollection, $compileNode, compileNode);\n\n            var newTemplateAttrs = {$attr: {}};\n\n            // combine directives from the original node and from the template:\n            // - take the array of directives for this element\n            // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)\n            // - collect directives from the template and sort them by priority\n            // - combine directives as: processed + template + unprocessed\n            var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);\n            var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));\n\n            if (newIsolateScopeDirective || newScopeDirective) {\n              // The original directive caused the current element to be replaced but this element\n              // also needs to have a new scope, so we need to tell the template directives\n              // that they would need to get their scope from further up, if they require transclusion\n              markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);\n            }\n            directives = directives.concat(templateDirectives).concat(unprocessedDirectives);\n            mergeTemplateAttributes(templateAttrs, newTemplateAttrs);\n\n            ii = directives.length;\n          } else {\n            $compileNode.html(directiveValue);\n          }\n        }\n\n        if (directive.templateUrl) {\n          hasTemplate = true;\n          assertNoDuplicate('template', templateDirective, directive, $compileNode);\n          templateDirective = directive;\n\n          if (directive.replace) {\n            replaceDirective = directive;\n          }\n\n          nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,\n              templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {\n                controllerDirectives: controllerDirectives,\n                newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,\n                newIsolateScopeDirective: newIsolateScopeDirective,\n                templateDirective: templateDirective,\n                nonTlbTranscludeDirective: nonTlbTranscludeDirective\n              });\n          ii = directives.length;\n        } else if (directive.compile) {\n          try {\n            linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);\n            if (isFunction(linkFn)) {\n              addLinkFns(null, linkFn, attrStart, attrEnd);\n            } else if (linkFn) {\n              addLinkFns(linkFn.pre, linkFn.post, attrStart, attrEnd);\n            }\n          } catch (e) {\n            $exceptionHandler(e, startingTag($compileNode));\n          }\n        }\n\n        if (directive.terminal) {\n          nodeLinkFn.terminal = true;\n          terminalPriority = Math.max(terminalPriority, directive.priority);\n        }\n\n      }\n\n      nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;\n      nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;\n      nodeLinkFn.templateOnThisElement = hasTemplate;\n      nodeLinkFn.transclude = childTranscludeFn;\n\n      previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;\n\n      // might be normal or delayed nodeLinkFn depending on if templateUrl is present\n      return nodeLinkFn;\n\n      ////////////////////\n\n      function addLinkFns(pre, post, attrStart, attrEnd) {\n        if (pre) {\n          if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);\n          pre.require = directive.require;\n          pre.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            pre = cloneAndAnnotateFn(pre, {isolateScope: true});\n          }\n          preLinkFns.push(pre);\n        }\n        if (post) {\n          if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);\n          post.require = directive.require;\n          post.directiveName = directiveName;\n          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {\n            post = cloneAndAnnotateFn(post, {isolateScope: true});\n          }\n          postLinkFns.push(post);\n        }\n      }\n\n      function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {\n        var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,\n            attrs, removeScopeBindingWatches, removeControllerBindingWatches;\n\n        if (compileNode === linkNode) {\n          attrs = templateAttrs;\n          $element = templateAttrs.$$element;\n        } else {\n          $element = jqLite(linkNode);\n          attrs = new Attributes($element, templateAttrs);\n        }\n\n        controllerScope = scope;\n        if (newIsolateScopeDirective) {\n          isolateScope = scope.$new(true);\n        } else if (newScopeDirective) {\n          controllerScope = scope.$parent;\n        }\n\n        if (boundTranscludeFn) {\n          // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`\n          // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`\n          transcludeFn = controllersBoundTransclude;\n          transcludeFn.$$boundTransclude = boundTranscludeFn;\n          // expose the slots on the `$transclude` function\n          transcludeFn.isSlotFilled = function(slotName) {\n            return !!boundTranscludeFn.$$slots[slotName];\n          };\n        }\n\n        if (controllerDirectives) {\n          elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective);\n        }\n\n        if (newIsolateScopeDirective) {\n          // Initialize isolate scope bindings for new isolate scope directive.\n          compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||\n              templateDirective === newIsolateScopeDirective.$$originalDirective)));\n          compile.$$addScopeClass($element, true);\n          isolateScope.$$isolateBindings =\n              newIsolateScopeDirective.$$isolateBindings;\n          removeScopeBindingWatches = initializeDirectiveBindings(scope, attrs, isolateScope,\n                                        isolateScope.$$isolateBindings,\n                                        newIsolateScopeDirective);\n          if (removeScopeBindingWatches) {\n            isolateScope.$on('$destroy', removeScopeBindingWatches);\n          }\n        }\n\n        // Initialize bindToController bindings\n        for (var name in elementControllers) {\n          var controllerDirective = controllerDirectives[name];\n          var controller = elementControllers[name];\n          var bindings = controllerDirective.$$bindings.bindToController;\n\n          if (controller.identifier && bindings) {\n            removeControllerBindingWatches =\n              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n          }\n\n          var controllerResult = controller();\n          if (controllerResult !== controller.instance) {\n            // If the controller constructor has a return value, overwrite the instance\n            // from setupControllers\n            controller.instance = controllerResult;\n            $element.data('$' + controllerDirective.name + 'Controller', controllerResult);\n            removeControllerBindingWatches && removeControllerBindingWatches();\n            removeControllerBindingWatches =\n              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);\n          }\n        }\n\n        // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy\n        forEach(controllerDirectives, function(controllerDirective, name) {\n          var require = controllerDirective.require;\n          if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {\n            extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));\n          }\n        });\n\n        // Handle the init and destroy lifecycle hooks on all controllers that have them\n        forEach(elementControllers, function(controller) {\n          var controllerInstance = controller.instance;\n          if (isFunction(controllerInstance.$onInit)) {\n            controllerInstance.$onInit();\n          }\n          if (isFunction(controllerInstance.$onDestroy)) {\n            controllerScope.$on('$destroy', function callOnDestroyHook() {\n              controllerInstance.$onDestroy();\n            });\n          }\n        });\n\n        // PRELINKING\n        for (i = 0, ii = preLinkFns.length; i < ii; i++) {\n          linkFn = preLinkFns[i];\n          invokeLinkFn(linkFn,\n              linkFn.isolateScope ? isolateScope : scope,\n              $element,\n              attrs,\n              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n              transcludeFn\n          );\n        }\n\n        // RECURSION\n        // We only pass the isolate scope, if the isolate directive has a template,\n        // otherwise the child elements do not belong to the isolate directive.\n        var scopeToChild = scope;\n        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {\n          scopeToChild = isolateScope;\n        }\n        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);\n\n        // POSTLINKING\n        for (i = postLinkFns.length - 1; i >= 0; i--) {\n          linkFn = postLinkFns[i];\n          invokeLinkFn(linkFn,\n              linkFn.isolateScope ? isolateScope : scope,\n              $element,\n              attrs,\n              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),\n              transcludeFn\n          );\n        }\n\n        // Trigger $postLink lifecycle hooks\n        forEach(elementControllers, function(controller) {\n          var controllerInstance = controller.instance;\n          if (isFunction(controllerInstance.$postLink)) {\n            controllerInstance.$postLink();\n          }\n        });\n\n        // This is the function that is injected as `$transclude`.\n        // Note: all arguments are optional!\n        function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {\n          var transcludeControllers;\n          // No scope passed in:\n          if (!isScope(scope)) {\n            slotName = futureParentElement;\n            futureParentElement = cloneAttachFn;\n            cloneAttachFn = scope;\n            scope = undefined;\n          }\n\n          if (hasElementTranscludeDirective) {\n            transcludeControllers = elementControllers;\n          }\n          if (!futureParentElement) {\n            futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;\n          }\n          if (slotName) {\n            // slotTranscludeFn can be one of three things:\n            //  * a transclude function - a filled slot\n            //  * `null` - an optional slot that was not filled\n            //  * `undefined` - a slot that was not declared (i.e. invalid)\n            var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];\n            if (slotTranscludeFn) {\n              return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);\n            } else if (isUndefined(slotTranscludeFn)) {\n              throw $compileMinErr('noslot',\n               'No parent directive that requires a transclusion with slot name \"{0}\". ' +\n               'Element: {1}',\n               slotName, startingTag($element));\n            }\n          } else {\n            return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);\n          }\n        }\n      }\n    }\n\n    function getControllers(directiveName, require, $element, elementControllers) {\n      var value;\n\n      if (isString(require)) {\n        var match = require.match(REQUIRE_PREFIX_REGEXP);\n        var name = require.substring(match[0].length);\n        var inheritType = match[1] || match[3];\n        var optional = match[2] === '?';\n\n        //If only parents then start at the parent element\n        if (inheritType === '^^') {\n          $element = $element.parent();\n        //Otherwise attempt getting the controller from elementControllers in case\n        //the element is transcluded (and has no data) and to avoid .data if possible\n        } else {\n          value = elementControllers && elementControllers[name];\n          value = value && value.instance;\n        }\n\n        if (!value) {\n          var dataName = '$' + name + 'Controller';\n          value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);\n        }\n\n        if (!value && !optional) {\n          throw $compileMinErr('ctreq',\n              \"Controller '{0}', required by directive '{1}', can't be found!\",\n              name, directiveName);\n        }\n      } else if (isArray(require)) {\n        value = [];\n        for (var i = 0, ii = require.length; i < ii; i++) {\n          value[i] = getControllers(directiveName, require[i], $element, elementControllers);\n        }\n      } else if (isObject(require)) {\n        value = {};\n        forEach(require, function(controller, property) {\n          value[property] = getControllers(directiveName, controller, $element, elementControllers);\n        });\n      }\n\n      return value || null;\n    }\n\n    function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {\n      var elementControllers = createMap();\n      for (var controllerKey in controllerDirectives) {\n        var directive = controllerDirectives[controllerKey];\n        var locals = {\n          $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,\n          $element: $element,\n          $attrs: attrs,\n          $transclude: transcludeFn\n        };\n\n        var controller = directive.controller;\n        if (controller == '@') {\n          controller = attrs[directive.name];\n        }\n\n        var controllerInstance = $controller(controller, locals, true, directive.controllerAs);\n\n        // For directives with element transclusion the element is a comment.\n        // In this case .data will not attach any data.\n        // Instead, we save the controllers for the element in a local hash and attach to .data\n        // later, once we have the actual element.\n        elementControllers[directive.name] = controllerInstance;\n        $element.data('$' + directive.name + 'Controller', controllerInstance.instance);\n      }\n      return elementControllers;\n    }\n\n    // Depending upon the context in which a directive finds itself it might need to have a new isolated\n    // or child scope created. For instance:\n    // * if the directive has been pulled into a template because another directive with a higher priority\n    // asked for element transclusion\n    // * if the directive itself asks for transclusion but it is at the root of a template and the original\n    // element was replaced. See https://github.com/angular/angular.js/issues/12936\n    function markDirectiveScope(directives, isolateScope, newScope) {\n      for (var j = 0, jj = directives.length; j < jj; j++) {\n        directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});\n      }\n    }\n\n    /**\n     * looks up the directive and decorates it with exception handling and proper parameters. We\n     * call this the boundDirective.\n     *\n     * @param {string} name name of the directive to look up.\n     * @param {string} location The directive must be found in specific format.\n     *   String containing any of theses characters:\n     *\n     *   * `E`: element name\n     *   * `A': attribute\n     *   * `C`: class\n     *   * `M`: comment\n     * @returns {boolean} true if directive was added.\n     */\n    function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,\n                          endAttrName) {\n      if (name === ignoreDirective) return null;\n      var match = null;\n      if (hasDirectives.hasOwnProperty(name)) {\n        for (var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i < ii; i++) {\n          try {\n            directive = directives[i];\n            if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&\n                 directive.restrict.indexOf(location) != -1) {\n              if (startAttrName) {\n                directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});\n              }\n              if (!directive.$$bindings) {\n                var bindings = directive.$$bindings =\n                    parseDirectiveBindings(directive, directive.name);\n                if (isObject(bindings.isolateScope)) {\n                  directive.$$isolateBindings = bindings.isolateScope;\n                }\n              }\n              tDirectives.push(directive);\n              match = directive;\n            }\n          } catch (e) { $exceptionHandler(e); }\n        }\n      }\n      return match;\n    }\n\n\n    /**\n     * looks up the directive and returns true if it is a multi-element directive,\n     * and therefore requires DOM nodes between -start and -end markers to be grouped\n     * together.\n     *\n     * @param {string} name name of the directive to look up.\n     * @returns true if directive was registered as multi-element.\n     */\n    function directiveIsMultiElement(name) {\n      if (hasDirectives.hasOwnProperty(name)) {\n        for (var directive, directives = $injector.get(name + Suffix),\n            i = 0, ii = directives.length; i < ii; i++) {\n          directive = directives[i];\n          if (directive.multiElement) {\n            return true;\n          }\n        }\n      }\n      return false;\n    }\n\n    /**\n     * When the element is replaced with HTML template then the new attributes\n     * on the template need to be merged with the existing attributes in the DOM.\n     * The desired effect is to have both of the attributes present.\n     *\n     * @param {object} dst destination attributes (original DOM)\n     * @param {object} src source attributes (from the directive template)\n     */\n    function mergeTemplateAttributes(dst, src) {\n      var srcAttr = src.$attr,\n          dstAttr = dst.$attr,\n          $element = dst.$$element;\n\n      // reapply the old attributes to the new element\n      forEach(dst, function(value, key) {\n        if (key.charAt(0) != '$') {\n          if (src[key] && src[key] !== value) {\n            value += (key === 'style' ? ';' : ' ') + src[key];\n          }\n          dst.$set(key, value, true, srcAttr[key]);\n        }\n      });\n\n      // copy the new attributes on the old attrs object\n      forEach(src, function(value, key) {\n        if (key == 'class') {\n          safeAddClass($element, value);\n          dst['class'] = (dst['class'] ? dst['class'] + ' ' : '') + value;\n        } else if (key == 'style') {\n          $element.attr('style', $element.attr('style') + ';' + value);\n          dst['style'] = (dst['style'] ? dst['style'] + ';' : '') + value;\n          // `dst` will never contain hasOwnProperty as DOM parser won't let it.\n          // You will get an \"InvalidCharacterError: DOM Exception 5\" error if you\n          // have an attribute like \"has-own-property\" or \"data-has-own-property\", etc.\n        } else if (key.charAt(0) != '$' && !dst.hasOwnProperty(key)) {\n          dst[key] = value;\n          dstAttr[key] = srcAttr[key];\n        }\n      });\n    }\n\n\n    function compileTemplateUrl(directives, $compileNode, tAttrs,\n        $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {\n      var linkQueue = [],\n          afterTemplateNodeLinkFn,\n          afterTemplateChildLinkFn,\n          beforeTemplateCompileNode = $compileNode[0],\n          origAsyncDirective = directives.shift(),\n          derivedSyncDirective = inherit(origAsyncDirective, {\n            templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective\n          }),\n          templateUrl = (isFunction(origAsyncDirective.templateUrl))\n              ? origAsyncDirective.templateUrl($compileNode, tAttrs)\n              : origAsyncDirective.templateUrl,\n          templateNamespace = origAsyncDirective.templateNamespace;\n\n      $compileNode.empty();\n\n      $templateRequest(templateUrl)\n        .then(function(content) {\n          var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;\n\n          content = denormalizeTemplate(content);\n\n          if (origAsyncDirective.replace) {\n            if (jqLiteIsTextNode(content)) {\n              $template = [];\n            } else {\n              $template = removeComments(wrapTemplate(templateNamespace, trim(content)));\n            }\n            compileNode = $template[0];\n\n            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {\n              throw $compileMinErr('tplrt',\n                  \"Template for directive '{0}' must have exactly one root element. {1}\",\n                  origAsyncDirective.name, templateUrl);\n            }\n\n            tempTemplateAttrs = {$attr: {}};\n            replaceWith($rootElement, $compileNode, compileNode);\n            var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);\n\n            if (isObject(origAsyncDirective.scope)) {\n              // the original directive that caused the template to be loaded async required\n              // an isolate scope\n              markDirectiveScope(templateDirectives, true);\n            }\n            directives = templateDirectives.concat(directives);\n            mergeTemplateAttributes(tAttrs, tempTemplateAttrs);\n          } else {\n            compileNode = beforeTemplateCompileNode;\n            $compileNode.html(content);\n          }\n\n          directives.unshift(derivedSyncDirective);\n\n          afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,\n              childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,\n              previousCompileContext);\n          forEach($rootElement, function(node, i) {\n            if (node == compileNode) {\n              $rootElement[i] = $compileNode[0];\n            }\n          });\n          afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);\n\n          while (linkQueue.length) {\n            var scope = linkQueue.shift(),\n                beforeTemplateLinkNode = linkQueue.shift(),\n                linkRootElement = linkQueue.shift(),\n                boundTranscludeFn = linkQueue.shift(),\n                linkNode = $compileNode[0];\n\n            if (scope.$$destroyed) continue;\n\n            if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {\n              var oldClasses = beforeTemplateLinkNode.className;\n\n              if (!(previousCompileContext.hasElementTranscludeDirective &&\n                  origAsyncDirective.replace)) {\n                // it was cloned therefore we have to clone as well.\n                linkNode = jqLiteClone(compileNode);\n              }\n              replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);\n\n              // Copy in CSS classes from original node\n              safeAddClass(jqLite(linkNode), oldClasses);\n            }\n            if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n              childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n            } else {\n              childBoundTranscludeFn = boundTranscludeFn;\n            }\n            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,\n              childBoundTranscludeFn);\n          }\n          linkQueue = null;\n        });\n\n      return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {\n        var childBoundTranscludeFn = boundTranscludeFn;\n        if (scope.$$destroyed) return;\n        if (linkQueue) {\n          linkQueue.push(scope,\n                         node,\n                         rootElement,\n                         childBoundTranscludeFn);\n        } else {\n          if (afterTemplateNodeLinkFn.transcludeOnThisElement) {\n            childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);\n          }\n          afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);\n        }\n      };\n    }\n\n\n    /**\n     * Sorting function for bound directives.\n     */\n    function byPriority(a, b) {\n      var diff = b.priority - a.priority;\n      if (diff !== 0) return diff;\n      if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;\n      return a.index - b.index;\n    }\n\n    function assertNoDuplicate(what, previousDirective, directive, element) {\n\n      function wrapModuleNameIfDefined(moduleName) {\n        return moduleName ?\n          (' (module: ' + moduleName + ')') :\n          '';\n      }\n\n      if (previousDirective) {\n        throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',\n            previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),\n            directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));\n      }\n    }\n\n\n    function addTextInterpolateDirective(directives, text) {\n      var interpolateFn = $interpolate(text, true);\n      if (interpolateFn) {\n        directives.push({\n          priority: 0,\n          compile: function textInterpolateCompileFn(templateNode) {\n            var templateNodeParent = templateNode.parent(),\n                hasCompileParent = !!templateNodeParent.length;\n\n            // When transcluding a template that has bindings in the root\n            // we don't have a parent and thus need to add the class during linking fn.\n            if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);\n\n            return function textInterpolateLinkFn(scope, node) {\n              var parent = node.parent();\n              if (!hasCompileParent) compile.$$addBindingClass(parent);\n              compile.$$addBindingInfo(parent, interpolateFn.expressions);\n              scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {\n                node[0].nodeValue = value;\n              });\n            };\n          }\n        });\n      }\n    }\n\n\n    function wrapTemplate(type, template) {\n      type = lowercase(type || 'html');\n      switch (type) {\n      case 'svg':\n      case 'math':\n        var wrapper = document.createElement('div');\n        wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';\n        return wrapper.childNodes[0].childNodes;\n      default:\n        return template;\n      }\n    }\n\n\n    function getTrustedContext(node, attrNormalizedName) {\n      if (attrNormalizedName == \"srcdoc\") {\n        return $sce.HTML;\n      }\n      var tag = nodeName_(node);\n      // maction[xlink:href] can source SVG.  It's not limited to <maction>.\n      if (attrNormalizedName == \"xlinkHref\" ||\n          (tag == \"form\" && attrNormalizedName == \"action\") ||\n          (tag != \"img\" && (attrNormalizedName == \"src\" ||\n                            attrNormalizedName == \"ngSrc\"))) {\n        return $sce.RESOURCE_URL;\n      }\n    }\n\n\n    function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {\n      var trustedContext = getTrustedContext(node, name);\n      allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;\n\n      var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);\n\n      // no interpolation found -> ignore\n      if (!interpolateFn) return;\n\n\n      if (name === \"multiple\" && nodeName_(node) === \"select\") {\n        throw $compileMinErr(\"selmulti\",\n            \"Binding to the 'multiple' attribute is not supported. Element: {0}\",\n            startingTag(node));\n      }\n\n      directives.push({\n        priority: 100,\n        compile: function() {\n            return {\n              pre: function attrInterpolatePreLinkFn(scope, element, attr) {\n                var $$observers = (attr.$$observers || (attr.$$observers = createMap()));\n\n                if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {\n                  throw $compileMinErr('nodomevents',\n                      \"Interpolations for HTML DOM event attributes are disallowed.  Please use the \" +\n                          \"ng- versions (such as ng-click instead of onclick) instead.\");\n                }\n\n                // If the attribute has changed since last $interpolate()ed\n                var newValue = attr[name];\n                if (newValue !== value) {\n                  // we need to interpolate again since the attribute value has been updated\n                  // (e.g. by another directive's compile function)\n                  // ensure unset/empty values make interpolateFn falsy\n                  interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);\n                  value = newValue;\n                }\n\n                // if attribute was updated so that there is no interpolation going on we don't want to\n                // register any observers\n                if (!interpolateFn) return;\n\n                // initialize attr object so that it's ready in case we need the value for isolate\n                // scope initialization, otherwise the value would not be available from isolate\n                // directive's linking fn during linking phase\n                attr[name] = interpolateFn(scope);\n\n                ($$observers[name] || ($$observers[name] = [])).$$inter = true;\n                (attr.$$observers && attr.$$observers[name].$$scope || scope).\n                  $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {\n                    //special case for class attribute addition + removal\n                    //so that class changes can tap into the animation\n                    //hooks provided by the $animate service. Be sure to\n                    //skip animations when the first digest occurs (when\n                    //both the new and the old values are the same) since\n                    //the CSS classes are the non-interpolated values\n                    if (name === 'class' && newValue != oldValue) {\n                      attr.$updateClass(newValue, oldValue);\n                    } else {\n                      attr.$set(name, newValue);\n                    }\n                  });\n              }\n            };\n          }\n      });\n    }\n\n\n    /**\n     * This is a special jqLite.replaceWith, which can replace items which\n     * have no parents, provided that the containing jqLite collection is provided.\n     *\n     * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes\n     *                               in the root of the tree.\n     * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep\n     *                                  the shell, but replace its DOM node reference.\n     * @param {Node} newNode The new DOM node.\n     */\n    function replaceWith($rootElement, elementsToRemove, newNode) {\n      var firstElementToRemove = elementsToRemove[0],\n          removeCount = elementsToRemove.length,\n          parent = firstElementToRemove.parentNode,\n          i, ii;\n\n      if ($rootElement) {\n        for (i = 0, ii = $rootElement.length; i < ii; i++) {\n          if ($rootElement[i] == firstElementToRemove) {\n            $rootElement[i++] = newNode;\n            for (var j = i, j2 = j + removeCount - 1,\n                     jj = $rootElement.length;\n                 j < jj; j++, j2++) {\n              if (j2 < jj) {\n                $rootElement[j] = $rootElement[j2];\n              } else {\n                delete $rootElement[j];\n              }\n            }\n            $rootElement.length -= removeCount - 1;\n\n            // If the replaced element is also the jQuery .context then replace it\n            // .context is a deprecated jQuery api, so we should set it only when jQuery set it\n            // http://api.jquery.com/context/\n            if ($rootElement.context === firstElementToRemove) {\n              $rootElement.context = newNode;\n            }\n            break;\n          }\n        }\n      }\n\n      if (parent) {\n        parent.replaceChild(newNode, firstElementToRemove);\n      }\n\n      // Append all the `elementsToRemove` to a fragment. This will...\n      // - remove them from the DOM\n      // - allow them to still be traversed with .nextSibling\n      // - allow a single fragment.qSA to fetch all elements being removed\n      var fragment = document.createDocumentFragment();\n      for (i = 0; i < removeCount; i++) {\n        fragment.appendChild(elementsToRemove[i]);\n      }\n\n      if (jqLite.hasData(firstElementToRemove)) {\n        // Copy over user data (that includes Angular's $scope etc.). Don't copy private\n        // data here because there's no public interface in jQuery to do that and copying over\n        // event listeners (which is the main use of private data) wouldn't work anyway.\n        jqLite.data(newNode, jqLite.data(firstElementToRemove));\n\n        // Remove $destroy event listeners from `firstElementToRemove`\n        jqLite(firstElementToRemove).off('$destroy');\n      }\n\n      // Cleanup any data/listeners on the elements and children.\n      // This includes invoking the $destroy event on any elements with listeners.\n      jqLite.cleanData(fragment.querySelectorAll('*'));\n\n      // Update the jqLite collection to only contain the `newNode`\n      for (i = 1; i < removeCount; i++) {\n        delete elementsToRemove[i];\n      }\n      elementsToRemove[0] = newNode;\n      elementsToRemove.length = 1;\n    }\n\n\n    function cloneAndAnnotateFn(fn, annotation) {\n      return extend(function() { return fn.apply(null, arguments); }, fn, annotation);\n    }\n\n\n    function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {\n      try {\n        linkFn(scope, $element, attrs, controllers, transcludeFn);\n      } catch (e) {\n        $exceptionHandler(e, startingTag($element));\n      }\n    }\n\n\n    // Set up $watches for isolate scope and controller bindings. This process\n    // only occurs for isolate scopes and new scopes with controllerAs.\n    function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {\n      var removeWatchCollection = [];\n      var changes;\n      forEach(bindings, function initializeBinding(definition, scopeName) {\n        var attrName = definition.attrName,\n        optional = definition.optional,\n        mode = definition.mode, // @, =, or &\n        lastValue,\n        parentGet, parentSet, compare, removeWatch;\n\n        switch (mode) {\n\n          case '@':\n            if (!optional && !hasOwnProperty.call(attrs, attrName)) {\n              destination[scopeName] = attrs[attrName] = void 0;\n            }\n            attrs.$observe(attrName, function(value) {\n              if (isString(value)) {\n                var oldValue = destination[scopeName];\n                recordChanges(scopeName, value, oldValue);\n                destination[scopeName] = value;\n              }\n            });\n            attrs.$$observers[attrName].$$scope = scope;\n            lastValue = attrs[attrName];\n            if (isString(lastValue)) {\n              // If the attribute has been provided then we trigger an interpolation to ensure\n              // the value is there for use in the link fn\n              destination[scopeName] = $interpolate(lastValue)(scope);\n            } else if (isBoolean(lastValue)) {\n              // If the attributes is one of the BOOLEAN_ATTR then Angular will have converted\n              // the value to boolean rather than a string, so we special case this situation\n              destination[scopeName] = lastValue;\n            }\n            break;\n\n          case '=':\n            if (!hasOwnProperty.call(attrs, attrName)) {\n              if (optional) break;\n              attrs[attrName] = void 0;\n            }\n            if (optional && !attrs[attrName]) break;\n\n            parentGet = $parse(attrs[attrName]);\n            if (parentGet.literal) {\n              compare = equals;\n            } else {\n              compare = function simpleCompare(a, b) { return a === b || (a !== a && b !== b); };\n            }\n            parentSet = parentGet.assign || function() {\n              // reset the change, or we will throw this exception on every $digest\n              lastValue = destination[scopeName] = parentGet(scope);\n              throw $compileMinErr('nonassign',\n                  \"Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!\",\n                  attrs[attrName], attrName, directive.name);\n            };\n            lastValue = destination[scopeName] = parentGet(scope);\n            var parentValueWatch = function parentValueWatch(parentValue) {\n              if (!compare(parentValue, destination[scopeName])) {\n                // we are out of sync and need to copy\n                if (!compare(parentValue, lastValue)) {\n                  // parent changed and it has precedence\n                  destination[scopeName] = parentValue;\n                } else {\n                  // if the parent can be assigned then do so\n                  parentSet(scope, parentValue = destination[scopeName]);\n                }\n              }\n              return lastValue = parentValue;\n            };\n            parentValueWatch.$stateful = true;\n            if (definition.collection) {\n              removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);\n            } else {\n              removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);\n            }\n            removeWatchCollection.push(removeWatch);\n            break;\n\n          case '<':\n            if (!hasOwnProperty.call(attrs, attrName)) {\n              if (optional) break;\n              attrs[attrName] = void 0;\n            }\n            if (optional && !attrs[attrName]) break;\n\n            parentGet = $parse(attrs[attrName]);\n\n            destination[scopeName] = parentGet(scope);\n\n            removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newParentValue) {\n              var oldValue = destination[scopeName];\n              recordChanges(scopeName, newParentValue, oldValue);\n              destination[scopeName] = newParentValue;\n            }, parentGet.literal);\n\n            removeWatchCollection.push(removeWatch);\n            break;\n\n          case '&':\n            // Don't assign Object.prototype method to scope\n            parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;\n\n            // Don't assign noop to destination if expression is not valid\n            if (parentGet === noop && optional) break;\n\n            destination[scopeName] = function(locals) {\n              return parentGet(scope, locals);\n            };\n            break;\n        }\n      });\n\n      function recordChanges(key, currentValue, previousValue) {\n        if (isFunction(destination.$onChanges) && currentValue !== previousValue) {\n          // If we have not already scheduled the top level onChangesQueue handler then do so now\n          if (!onChangesQueue) {\n            scope.$$postDigest(flushOnChangesQueue);\n            onChangesQueue = [];\n          }\n          // If we have not already queued a trigger of onChanges for this controller then do so now\n          if (!changes) {\n            changes = {};\n            onChangesQueue.push(triggerOnChangesHook);\n          }\n          // If the has been a change on this property already then we need to reuse the previous value\n          if (changes[key]) {\n            previousValue = changes[key].previousValue;\n          }\n          // Store this change\n          changes[key] = {previousValue: previousValue, currentValue: currentValue};\n        }\n      }\n\n      function triggerOnChangesHook() {\n        destination.$onChanges(changes);\n        // Now clear the changes so that we schedule onChanges when more changes arrive\n        changes = undefined;\n      }\n\n      return removeWatchCollection.length && function removeWatches() {\n        for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {\n          removeWatchCollection[i]();\n        }\n      };\n    }\n  }];\n}\n\nvar PREFIX_REGEXP = /^((?:x|data)[\\:\\-_])/i;\n/**\n * Converts all accepted directives format into proper directive name.\n * @param name Name to normalize\n */\nfunction directiveNormalize(name) {\n  return camelCase(name.replace(PREFIX_REGEXP, ''));\n}\n\n/**\n * @ngdoc type\n * @name $compile.directive.Attributes\n *\n * @description\n * A shared object between directive compile / linking functions which contains normalized DOM\n * element attributes. The values reflect current binding state `{{ }}`. The normalization is\n * needed since all of these are treated as equivalent in Angular:\n *\n * ```\n *    <span ng:bind=\"a\" ng-bind=\"a\" data-ng-bind=\"a\" x-ng-bind=\"a\">\n * ```\n */\n\n/**\n * @ngdoc property\n * @name $compile.directive.Attributes#$attr\n *\n * @description\n * A map of DOM element attribute names to the normalized name. This is\n * needed to do reverse lookup from normalized name back to actual name.\n */\n\n\n/**\n * @ngdoc method\n * @name $compile.directive.Attributes#$set\n * @kind function\n *\n * @description\n * Set DOM element attribute value.\n *\n *\n * @param {string} name Normalized element attribute name of the property to modify. The name is\n *          reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}\n *          property to the original name.\n * @param {string} value Value to set the attribute to. The value can be an interpolated string.\n */\n\n\n\n/**\n * Closure compiler type information\n */\n\nfunction nodesetLinkingFn(\n  /* angular.Scope */ scope,\n  /* NodeList */ nodeList,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction directiveLinkingFn(\n  /* nodesetLinkingFn */ nodesetLinkingFn,\n  /* angular.Scope */ scope,\n  /* Node */ node,\n  /* Element */ rootElement,\n  /* function(Function) */ boundTranscludeFn\n) {}\n\nfunction tokenDifference(str1, str2) {\n  var values = '',\n      tokens1 = str1.split(/\\s+/),\n      tokens2 = str2.split(/\\s+/);\n\n  outer:\n  for (var i = 0; i < tokens1.length; i++) {\n    var token = tokens1[i];\n    for (var j = 0; j < tokens2.length; j++) {\n      if (token == tokens2[j]) continue outer;\n    }\n    values += (values.length > 0 ? ' ' : '') + token;\n  }\n  return values;\n}\n\nfunction removeComments(jqNodes) {\n  jqNodes = jqLite(jqNodes);\n  var i = jqNodes.length;\n\n  if (i <= 1) {\n    return jqNodes;\n  }\n\n  while (i--) {\n    var node = jqNodes[i];\n    if (node.nodeType === NODE_TYPE_COMMENT) {\n      splice.call(jqNodes, i, 1);\n    }\n  }\n  return jqNodes;\n}\n\nvar $controllerMinErr = minErr('$controller');\n\n\nvar CNTRL_REG = /^(\\S+)(\\s+as\\s+([\\w$]+))?$/;\nfunction identifierForController(controller, ident) {\n  if (ident && isString(ident)) return ident;\n  if (isString(controller)) {\n    var match = CNTRL_REG.exec(controller);\n    if (match) return match[3];\n  }\n}\n\n\n/**\n * @ngdoc provider\n * @name $controllerProvider\n * @description\n * The {@link ng.$controller $controller service} is used by Angular to create new\n * controllers.\n *\n * This provider allows controller registration via the\n * {@link ng.$controllerProvider#register register} method.\n */\nfunction $ControllerProvider() {\n  var controllers = {},\n      globals = false;\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#has\n   * @param {string} name Controller name to check.\n   */\n  this.has = function(name) {\n    return controllers.hasOwnProperty(name);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#register\n   * @param {string|Object} name Controller name, or an object map of controllers where the keys are\n   *    the names and the values are the constructors.\n   * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI\n   *    annotations in the array notation).\n   */\n  this.register = function(name, constructor) {\n    assertNotHasOwnProperty(name, 'controller');\n    if (isObject(name)) {\n      extend(controllers, name);\n    } else {\n      controllers[name] = constructor;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $controllerProvider#allowGlobals\n   * @description If called, allows `$controller` to find controller constructors on `window`\n   */\n  this.allowGlobals = function() {\n    globals = true;\n  };\n\n\n  this.$get = ['$injector', '$window', function($injector, $window) {\n\n    /**\n     * @ngdoc service\n     * @name $controller\n     * @requires $injector\n     *\n     * @param {Function|string} constructor If called with a function then it's considered to be the\n     *    controller constructor function. Otherwise it's considered to be a string which is used\n     *    to retrieve the controller constructor using the following steps:\n     *\n     *    * check if a controller with given name is registered via `$controllerProvider`\n     *    * check if evaluating the string on the current scope returns a constructor\n     *    * if $controllerProvider#allowGlobals, check `window[constructor]` on the global\n     *      `window` object (not recommended)\n     *\n     *    The string can use the `controller as property` syntax, where the controller instance is published\n     *    as the specified property on the `scope`; the `scope` must be injected into `locals` param for this\n     *    to work correctly.\n     *\n     * @param {Object} locals Injection locals for Controller.\n     * @return {Object} Instance of given controller.\n     *\n     * @description\n     * `$controller` service is responsible for instantiating controllers.\n     *\n     * It's just a simple call to {@link auto.$injector $injector}, but extracted into\n     * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).\n     */\n    return function $controller(expression, locals, later, ident) {\n      // PRIVATE API:\n      //   param `later` --- indicates that the controller's constructor is invoked at a later time.\n      //                     If true, $controller will allocate the object with the correct\n      //                     prototype chain, but will not invoke the controller until a returned\n      //                     callback is invoked.\n      //   param `ident` --- An optional label which overrides the label parsed from the controller\n      //                     expression, if any.\n      var instance, match, constructor, identifier;\n      later = later === true;\n      if (ident && isString(ident)) {\n        identifier = ident;\n      }\n\n      if (isString(expression)) {\n        match = expression.match(CNTRL_REG);\n        if (!match) {\n          throw $controllerMinErr('ctrlfmt',\n            \"Badly formed controller string '{0}'. \" +\n            \"Must match `__name__ as __id__` or `__name__`.\", expression);\n        }\n        constructor = match[1],\n        identifier = identifier || match[3];\n        expression = controllers.hasOwnProperty(constructor)\n            ? controllers[constructor]\n            : getter(locals.$scope, constructor, true) ||\n                (globals ? getter($window, constructor, true) : undefined);\n\n        assertArgFn(expression, constructor, true);\n      }\n\n      if (later) {\n        // Instantiate controller later:\n        // This machinery is used to create an instance of the object before calling the\n        // controller's constructor itself.\n        //\n        // This allows properties to be added to the controller before the constructor is\n        // invoked. Primarily, this is used for isolate scope bindings in $compile.\n        //\n        // This feature is not intended for use by applications, and is thus not documented\n        // publicly.\n        // Object creation: http://jsperf.com/create-constructor/2\n        var controllerPrototype = (isArray(expression) ?\n          expression[expression.length - 1] : expression).prototype;\n        instance = Object.create(controllerPrototype || null);\n\n        if (identifier) {\n          addIdentifier(locals, identifier, instance, constructor || expression.name);\n        }\n\n        var instantiate;\n        return instantiate = extend(function $controllerInit() {\n          var result = $injector.invoke(expression, instance, locals, constructor);\n          if (result !== instance && (isObject(result) || isFunction(result))) {\n            instance = result;\n            if (identifier) {\n              // If result changed, re-assign controllerAs value to scope.\n              addIdentifier(locals, identifier, instance, constructor || expression.name);\n            }\n          }\n          return instance;\n        }, {\n          instance: instance,\n          identifier: identifier\n        });\n      }\n\n      instance = $injector.instantiate(expression, locals, constructor);\n\n      if (identifier) {\n        addIdentifier(locals, identifier, instance, constructor || expression.name);\n      }\n\n      return instance;\n    };\n\n    function addIdentifier(locals, identifier, instance, name) {\n      if (!(locals && isObject(locals.$scope))) {\n        throw minErr('$controller')('noscp',\n          \"Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.\",\n          name, identifier);\n      }\n\n      locals.$scope[identifier] = instance;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $document\n * @requires $window\n *\n * @description\n * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.\n *\n * @example\n   <example module=\"documentExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <p>$document title: <b ng-bind=\"title\"></b></p>\n         <p>window.document title: <b ng-bind=\"windowTitle\"></b></p>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('documentExample', [])\n         .controller('ExampleController', ['$scope', '$document', function($scope, $document) {\n           $scope.title = $document[0].title;\n           $scope.windowTitle = angular.element(window.document)[0].title;\n         }]);\n     </file>\n   </example>\n */\nfunction $DocumentProvider() {\n  this.$get = ['$window', function(window) {\n    return jqLite(window.document);\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $exceptionHandler\n * @requires ng.$log\n *\n * @description\n * Any uncaught exception in angular expressions is delegated to this service.\n * The default implementation simply delegates to `$log.error` which logs it into\n * the browser console.\n *\n * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by\n * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.\n *\n * ## Example:\n *\n * ```js\n *   angular.module('exceptionOverride', []).factory('$exceptionHandler', function() {\n *     return function(exception, cause) {\n *       exception.message += ' (caused by \"' + cause + '\")';\n *       throw exception;\n *     };\n *   });\n * ```\n *\n * This example will override the normal action of `$exceptionHandler`, to make angular\n * exceptions fail hard when they happen, instead of just logging to the console.\n *\n * <hr />\n * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`\n * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}\n * (unless executed during a digest).\n *\n * If you wish, you can manually delegate exceptions, e.g.\n * `try { ... } catch(e) { $exceptionHandler(e); }`\n *\n * @param {Error} exception Exception associated with the error.\n * @param {string=} cause optional information about the context in which\n *       the error was thrown.\n *\n */\nfunction $ExceptionHandlerProvider() {\n  this.$get = ['$log', function($log) {\n    return function(exception, cause) {\n      $log.error.apply($log, arguments);\n    };\n  }];\n}\n\nvar $$ForceReflowProvider = function() {\n  this.$get = ['$document', function($document) {\n    return function(domNode) {\n      //the line below will force the browser to perform a repaint so\n      //that all the animated elements within the animation frame will\n      //be properly updated and drawn on screen. This is required to\n      //ensure that the preparation animation is properly flushed so that\n      //the active state picks up from there. DO NOT REMOVE THIS LINE.\n      //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH\n      //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND\n      //WILL TAKE YEARS AWAY FROM YOUR LIFE.\n      if (domNode) {\n        if (!domNode.nodeType && domNode instanceof jqLite) {\n          domNode = domNode[0];\n        }\n      } else {\n        domNode = $document[0].body;\n      }\n      return domNode.offsetWidth + 1;\n    };\n  }];\n};\n\nvar APPLICATION_JSON = 'application/json';\nvar CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};\nvar JSON_START = /^\\[|^\\{(?!\\{)/;\nvar JSON_ENDS = {\n  '[': /]$/,\n  '{': /}$/\n};\nvar JSON_PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar $httpMinErr = minErr('$http');\nvar $httpMinErrLegacyFn = function(method) {\n  return function() {\n    throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);\n  };\n};\n\nfunction serializeValue(v) {\n  if (isObject(v)) {\n    return isDate(v) ? v.toISOString() : toJson(v);\n  }\n  return v;\n}\n\n\nfunction $HttpParamSerializerProvider() {\n  /**\n   * @ngdoc service\n   * @name $httpParamSerializer\n   * @description\n   *\n   * Default {@link $http `$http`} params serializer that converts objects to strings\n   * according to the following rules:\n   *\n   * * `{'foo': 'bar'}` results in `foo=bar`\n   * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)\n   * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)\n   * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D\"` (stringified and encoded representation of an object)\n   *\n   * Note that serializer will sort the request parameters alphabetically.\n   * */\n\n  this.$get = function() {\n    return function ngParamSerializer(params) {\n      if (!params) return '';\n      var parts = [];\n      forEachSorted(params, function(value, key) {\n        if (value === null || isUndefined(value)) return;\n        if (isArray(value)) {\n          forEach(value, function(v) {\n            parts.push(encodeUriQuery(key)  + '=' + encodeUriQuery(serializeValue(v)));\n          });\n        } else {\n          parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));\n        }\n      });\n\n      return parts.join('&');\n    };\n  };\n}\n\nfunction $HttpParamSerializerJQLikeProvider() {\n  /**\n   * @ngdoc service\n   * @name $httpParamSerializerJQLike\n   * @description\n   *\n   * Alternative {@link $http `$http`} params serializer that follows\n   * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.\n   * The serializer will also sort the params alphabetically.\n   *\n   * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:\n   *\n   * ```js\n   * $http({\n   *   url: myUrl,\n   *   method: 'GET',\n   *   params: myParams,\n   *   paramSerializer: '$httpParamSerializerJQLike'\n   * });\n   * ```\n   *\n   * It is also possible to set it as the default `paramSerializer` in the\n   * {@link $httpProvider#defaults `$httpProvider`}.\n   *\n   * Additionally, you can inject the serializer and use it explicitly, for example to serialize\n   * form data for submission:\n   *\n   * ```js\n   * .controller(function($http, $httpParamSerializerJQLike) {\n   *   //...\n   *\n   *   $http({\n   *     url: myUrl,\n   *     method: 'POST',\n   *     data: $httpParamSerializerJQLike(myData),\n   *     headers: {\n   *       'Content-Type': 'application/x-www-form-urlencoded'\n   *     }\n   *   });\n   *\n   * });\n   * ```\n   *\n   * */\n  this.$get = function() {\n    return function jQueryLikeParamSerializer(params) {\n      if (!params) return '';\n      var parts = [];\n      serialize(params, '', true);\n      return parts.join('&');\n\n      function serialize(toSerialize, prefix, topLevel) {\n        if (toSerialize === null || isUndefined(toSerialize)) return;\n        if (isArray(toSerialize)) {\n          forEach(toSerialize, function(value, index) {\n            serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');\n          });\n        } else if (isObject(toSerialize) && !isDate(toSerialize)) {\n          forEachSorted(toSerialize, function(value, key) {\n            serialize(value, prefix +\n                (topLevel ? '' : '[') +\n                key +\n                (topLevel ? '' : ']'));\n          });\n        } else {\n          parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));\n        }\n      }\n    };\n  };\n}\n\nfunction defaultHttpResponseTransform(data, headers) {\n  if (isString(data)) {\n    // Strip json vulnerability protection prefix and trim whitespace\n    var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();\n\n    if (tempData) {\n      var contentType = headers('Content-Type');\n      if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {\n        data = fromJson(tempData);\n      }\n    }\n  }\n\n  return data;\n}\n\nfunction isJsonLike(str) {\n    var jsonStart = str.match(JSON_START);\n    return jsonStart && JSON_ENDS[jsonStart[0]].test(str);\n}\n\n/**\n * Parse headers into key value object\n *\n * @param {string} headers Raw headers as a string\n * @returns {Object} Parsed headers as key value object\n */\nfunction parseHeaders(headers) {\n  var parsed = createMap(), i;\n\n  function fillInParsed(key, val) {\n    if (key) {\n      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n    }\n  }\n\n  if (isString(headers)) {\n    forEach(headers.split('\\n'), function(line) {\n      i = line.indexOf(':');\n      fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));\n    });\n  } else if (isObject(headers)) {\n    forEach(headers, function(headerVal, headerKey) {\n      fillInParsed(lowercase(headerKey), trim(headerVal));\n    });\n  }\n\n  return parsed;\n}\n\n\n/**\n * Returns a function that provides access to parsed headers.\n *\n * Headers are lazy parsed when first requested.\n * @see parseHeaders\n *\n * @param {(string|Object)} headers Headers to provide access to.\n * @returns {function(string=)} Returns a getter function which if called with:\n *\n *   - if called with single an argument returns a single header value or null\n *   - if called with no arguments returns an object containing all headers.\n */\nfunction headersGetter(headers) {\n  var headersObj;\n\n  return function(name) {\n    if (!headersObj) headersObj =  parseHeaders(headers);\n\n    if (name) {\n      var value = headersObj[lowercase(name)];\n      if (value === void 0) {\n        value = null;\n      }\n      return value;\n    }\n\n    return headersObj;\n  };\n}\n\n\n/**\n * Chain all given functions\n *\n * This function is used for both request and response transforming\n *\n * @param {*} data Data to transform.\n * @param {function(string=)} headers HTTP headers getter fn.\n * @param {number} status HTTP status code of the response.\n * @param {(Function|Array.<Function>)} fns Function or an array of functions.\n * @returns {*} Transformed data.\n */\nfunction transformData(data, headers, status, fns) {\n  if (isFunction(fns)) {\n    return fns(data, headers, status);\n  }\n\n  forEach(fns, function(fn) {\n    data = fn(data, headers, status);\n  });\n\n  return data;\n}\n\n\nfunction isSuccess(status) {\n  return 200 <= status && status < 300;\n}\n\n\n/**\n * @ngdoc provider\n * @name $httpProvider\n * @description\n * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.\n * */\nfunction $HttpProvider() {\n  /**\n   * @ngdoc property\n   * @name $httpProvider#defaults\n   * @description\n   *\n   * Object containing default values for all {@link ng.$http $http} requests.\n   *\n   * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with\n   * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses\n   * by default. See {@link $http#caching $http Caching} for more information.\n   *\n   * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.\n   * Defaults value is `'XSRF-TOKEN'`.\n   *\n   * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the\n   * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.\n   *\n   * - **`defaults.headers`** - {Object} - Default headers for all $http requests.\n   * Refer to {@link ng.$http#setting-http-headers $http} for documentation on\n   * setting default headers.\n   *     - **`defaults.headers.common`**\n   *     - **`defaults.headers.post`**\n   *     - **`defaults.headers.put`**\n   *     - **`defaults.headers.patch`**\n   *\n   *\n   * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function\n   *  used to the prepare string representation of request parameters (specified as an object).\n   *  If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.\n   *  Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.\n   *\n   **/\n  var defaults = this.defaults = {\n    // transform incoming response data\n    transformResponse: [defaultHttpResponseTransform],\n\n    // transform outgoing request data\n    transformRequest: [function(d) {\n      return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;\n    }],\n\n    // default headers\n    headers: {\n      common: {\n        'Accept': 'application/json, text/plain, */*'\n      },\n      post:   shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      put:    shallowCopy(CONTENT_TYPE_APPLICATION_JSON),\n      patch:  shallowCopy(CONTENT_TYPE_APPLICATION_JSON)\n    },\n\n    xsrfCookieName: 'XSRF-TOKEN',\n    xsrfHeaderName: 'X-XSRF-TOKEN',\n\n    paramSerializer: '$httpParamSerializer'\n  };\n\n  var useApplyAsync = false;\n  /**\n   * @ngdoc method\n   * @name $httpProvider#useApplyAsync\n   * @description\n   *\n   * Configure $http service to combine processing of multiple http responses received at around\n   * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in\n   * significant performance improvement for bigger applications that make many HTTP requests\n   * concurrently (common during application bootstrap).\n   *\n   * Defaults to false. If no value is specified, returns the current configured value.\n   *\n   * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred\n   *    \"apply\" on the next tick, giving time for subsequent requests in a roughly ~10ms window\n   *    to load and share the same digest cycle.\n   *\n   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n   *    otherwise, returns the current configured value.\n   **/\n  this.useApplyAsync = function(value) {\n    if (isDefined(value)) {\n      useApplyAsync = !!value;\n      return this;\n    }\n    return useApplyAsync;\n  };\n\n  var useLegacyPromise = true;\n  /**\n   * @ngdoc method\n   * @name $httpProvider#useLegacyPromiseExtensions\n   * @description\n   *\n   * Configure `$http` service to return promises without the shorthand methods `success` and `error`.\n   * This should be used to make sure that applications work without these methods.\n   *\n   * Defaults to true. If no value is specified, returns the current configured value.\n   *\n   * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.\n   *\n   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.\n   *    otherwise, returns the current configured value.\n   **/\n  this.useLegacyPromiseExtensions = function(value) {\n    if (isDefined(value)) {\n      useLegacyPromise = !!value;\n      return this;\n    }\n    return useLegacyPromise;\n  };\n\n  /**\n   * @ngdoc property\n   * @name $httpProvider#interceptors\n   * @description\n   *\n   * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}\n   * pre-processing of request or postprocessing of responses.\n   *\n   * These service factories are ordered by request, i.e. they are applied in the same order as the\n   * array, on request, but reverse order, on response.\n   *\n   * {@link ng.$http#interceptors Interceptors detailed info}\n   **/\n  var interceptorFactories = this.interceptors = [];\n\n  this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',\n      function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {\n\n    var defaultCache = $cacheFactory('$http');\n\n    /**\n     * Make sure that default param serializer is exposed as a function\n     */\n    defaults.paramSerializer = isString(defaults.paramSerializer) ?\n      $injector.get(defaults.paramSerializer) : defaults.paramSerializer;\n\n    /**\n     * Interceptors stored in reverse order. Inner interceptors before outer interceptors.\n     * The reversal is needed so that we can build up the interception chain around the\n     * server request.\n     */\n    var reversedInterceptors = [];\n\n    forEach(interceptorFactories, function(interceptorFactory) {\n      reversedInterceptors.unshift(isString(interceptorFactory)\n          ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));\n    });\n\n    /**\n     * @ngdoc service\n     * @kind function\n     * @name $http\n     * @requires ng.$httpBackend\n     * @requires $cacheFactory\n     * @requires $rootScope\n     * @requires $q\n     * @requires $injector\n     *\n     * @description\n     * The `$http` service is a core Angular service that facilitates communication with the remote\n     * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)\n     * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).\n     *\n     * For unit testing applications that use `$http` service, see\n     * {@link ngMock.$httpBackend $httpBackend mock}.\n     *\n     * For a higher level of abstraction, please check out the {@link ngResource.$resource\n     * $resource} service.\n     *\n     * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by\n     * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage\n     * it is important to familiarize yourself with these APIs and the guarantees they provide.\n     *\n     *\n     * ## General usage\n     * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —\n     * that is used to generate an HTTP request and returns  a {@link ng.$q promise}.\n     *\n     * ```js\n     *   // Simple GET request example:\n     *   $http({\n     *     method: 'GET',\n     *     url: '/someUrl'\n     *   }).then(function successCallback(response) {\n     *       // this callback will be called asynchronously\n     *       // when the response is available\n     *     }, function errorCallback(response) {\n     *       // called asynchronously if an error occurs\n     *       // or server returns response with an error status.\n     *     });\n     * ```\n     *\n     * The response object has these properties:\n     *\n     *   - **data** – `{string|Object}` – The response body transformed with the transform\n     *     functions.\n     *   - **status** – `{number}` – HTTP status code of the response.\n     *   - **headers** – `{function([headerName])}` – Header getter function.\n     *   - **config** – `{Object}` – The configuration object that was used to generate the request.\n     *   - **statusText** – `{string}` – HTTP status text of the response.\n     *\n     * A response status code between 200 and 299 is considered a success status and\n     * will result in the success callback being called. Note that if the response is a redirect,\n     * XMLHttpRequest will transparently follow it, meaning that the error callback will not be\n     * called for such responses.\n     *\n     *\n     * ## Shortcut methods\n     *\n     * Shortcut methods are also available. All shortcut methods require passing in the URL, and\n     * request data must be passed in for POST/PUT requests. An optional config can be passed as the\n     * last argument.\n     *\n     * ```js\n     *   $http.get('/someUrl', config).then(successCallback, errorCallback);\n     *   $http.post('/someUrl', data, config).then(successCallback, errorCallback);\n     * ```\n     *\n     * Complete list of shortcut methods:\n     *\n     * - {@link ng.$http#get $http.get}\n     * - {@link ng.$http#head $http.head}\n     * - {@link ng.$http#post $http.post}\n     * - {@link ng.$http#put $http.put}\n     * - {@link ng.$http#delete $http.delete}\n     * - {@link ng.$http#jsonp $http.jsonp}\n     * - {@link ng.$http#patch $http.patch}\n     *\n     *\n     * ## Writing Unit Tests that use $http\n     * When unit testing (using {@link ngMock ngMock}), it is necessary to call\n     * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending\n     * request using trained responses.\n     *\n     * ```\n     * $httpBackend.expectGET(...);\n     * $http.get(...);\n     * $httpBackend.flush();\n     * ```\n     *\n     * ## Deprecation Notice\n     * <div class=\"alert alert-danger\">\n     *   The `$http` legacy promise methods `success` and `error` have been deprecated.\n     *   Use the standard `then` method instead.\n     *   If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to\n     *   `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.\n     * </div>\n     *\n     * ## Setting HTTP Headers\n     *\n     * The $http service will automatically add certain HTTP headers to all requests. These defaults\n     * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration\n     * object, which currently contains this default configuration:\n     *\n     * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):\n     *   - `Accept: application/json, text/plain, * / *`\n     * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)\n     *   - `Content-Type: application/json`\n     * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)\n     *   - `Content-Type: application/json`\n     *\n     * To add or overwrite these defaults, simply add or remove a property from these configuration\n     * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object\n     * with the lowercased HTTP method name as the key, e.g.\n     * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.\n     *\n     * The defaults can also be set at runtime via the `$http.defaults` object in the same\n     * fashion. For example:\n     *\n     * ```\n     * module.run(function($http) {\n     *   $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';\n     * });\n     * ```\n     *\n     * In addition, you can supply a `headers` property in the config object passed when\n     * calling `$http(config)`, which overrides the defaults without changing them globally.\n     *\n     * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,\n     * Use the `headers` property, setting the desired header to `undefined`. For example:\n     *\n     * ```js\n     * var req = {\n     *  method: 'POST',\n     *  url: 'http://example.com',\n     *  headers: {\n     *    'Content-Type': undefined\n     *  },\n     *  data: { test: 'test' }\n     * }\n     *\n     * $http(req).then(function(){...}, function(){...});\n     * ```\n     *\n     * ## Transforming Requests and Responses\n     *\n     * Both requests and responses can be transformed using transformation functions: `transformRequest`\n     * and `transformResponse`. These properties can be a single function that returns\n     * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,\n     * which allows you to `push` or `unshift` a new transformation function into the transformation chain.\n     *\n     * <div class=\"alert alert-warning\">\n     * **Note:** Angular does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline.\n     * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference).\n     * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest\n     * function will be reflected on the scope and in any templates where the object is data-bound.\n     * To prevent his, transform functions should have no side-effects.\n     * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return.\n     * </div>\n     *\n     * ### Default Transformations\n     *\n     * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and\n     * `defaults.transformResponse` properties. If a request does not provide its own transformations\n     * then these will be applied.\n     *\n     * You can augment or replace the default transformations by modifying these properties by adding to or\n     * replacing the array.\n     *\n     * Angular provides the following default transformations:\n     *\n     * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):\n     *\n     * - If the `data` property of the request configuration object contains an object, serialize it\n     *   into JSON format.\n     *\n     * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):\n     *\n     *  - If XSRF prefix is detected, strip it (see Security Considerations section below).\n     *  - If JSON response is detected, deserialize it using a JSON parser.\n     *\n     *\n     * ### Overriding the Default Transformations Per Request\n     *\n     * If you wish override the request/response transformations only for a single request then provide\n     * `transformRequest` and/or `transformResponse` properties on the configuration object passed\n     * into `$http`.\n     *\n     * Note that if you provide these properties on the config object the default transformations will be\n     * overwritten. If you wish to augment the default transformations then you must include them in your\n     * local transformation array.\n     *\n     * The following code demonstrates adding a new response transformation to be run after the default response\n     * transformations have been run.\n     *\n     * ```js\n     * function appendTransform(defaults, transform) {\n     *\n     *   // We can't guarantee that the default transformation is an array\n     *   defaults = angular.isArray(defaults) ? defaults : [defaults];\n     *\n     *   // Append the new transformation to the defaults\n     *   return defaults.concat(transform);\n     * }\n     *\n     * $http({\n     *   url: '...',\n     *   method: 'GET',\n     *   transformResponse: appendTransform($http.defaults.transformResponse, function(value) {\n     *     return doTransform(value);\n     *   })\n     * });\n     * ```\n     *\n     *\n     * ## Caching\n     *\n     * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must\n     * set the config.cache value or the default cache value to TRUE or to a cache object (created\n     * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes\n     * precedence over the default cache value.\n     *\n     * In order to:\n     *   * cache all responses - set the default cache value to TRUE or to a cache object\n     *   * cache a specific response - set config.cache value to TRUE or to a cache object\n     *\n     * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,\n     * then the default `$cacheFactory($http)` object is used.\n     *\n     * The default cache value can be set by updating the\n     * {@link ng.$http#defaults `$http.defaults.cache`} property or the\n     * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property.\n     *\n     * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using\n     * the relevant cache object. The next time the same request is made, the response is returned\n     * from the cache without sending a request to the server.\n     *\n     * Take note that:\n     *\n     *   * Only GET and JSONP requests are cached.\n     *   * The cache key is the request URL including search parameters; headers are not considered.\n     *   * Cached responses are returned asynchronously, in the same way as responses from the server.\n     *   * If multiple identical requests are made using the same cache, which is not yet populated,\n     *     one request will be made to the server and remaining requests will return the same response.\n     *   * A cache-control header on the response does not affect if or how responses are cached.\n     *\n     *\n     * ## Interceptors\n     *\n     * Before you start creating interceptors, be sure to understand the\n     * {@link ng.$q $q and deferred/promise APIs}.\n     *\n     * For purposes of global error handling, authentication, or any kind of synchronous or\n     * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be\n     * able to intercept requests before they are handed to the server and\n     * responses before they are handed over to the application code that\n     * initiated these requests. The interceptors leverage the {@link ng.$q\n     * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.\n     *\n     * The interceptors are service factories that are registered with the `$httpProvider` by\n     * adding them to the `$httpProvider.interceptors` array. The factory is called and\n     * injected with dependencies (if specified) and returns the interceptor.\n     *\n     * There are two kinds of interceptors (and two kinds of rejection interceptors):\n     *\n     *   * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to\n     *     modify the `config` object or create a new one. The function needs to return the `config`\n     *     object directly, or a promise containing the `config` or a new `config` object.\n     *   * `requestError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *   * `response`: interceptors get called with http `response` object. The function is free to\n     *     modify the `response` object or create a new one. The function needs to return the `response`\n     *     object directly, or as a promise containing the `response` or a new `response` object.\n     *   * `responseError`: interceptor gets called when a previous interceptor threw an error or\n     *     resolved with a rejection.\n     *\n     *\n     * ```js\n     *   // register the interceptor as a service\n     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {\n     *     return {\n     *       // optional method\n     *       'request': function(config) {\n     *         // do something on success\n     *         return config;\n     *       },\n     *\n     *       // optional method\n     *      'requestError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       },\n     *\n     *\n     *\n     *       // optional method\n     *       'response': function(response) {\n     *         // do something on success\n     *         return response;\n     *       },\n     *\n     *       // optional method\n     *      'responseError': function(rejection) {\n     *         // do something on error\n     *         if (canRecover(rejection)) {\n     *           return responseOrNewPromise\n     *         }\n     *         return $q.reject(rejection);\n     *       }\n     *     };\n     *   });\n     *\n     *   $httpProvider.interceptors.push('myHttpInterceptor');\n     *\n     *\n     *   // alternatively, register the interceptor via an anonymous factory\n     *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {\n     *     return {\n     *      'request': function(config) {\n     *          // same as above\n     *       },\n     *\n     *       'response': function(response) {\n     *          // same as above\n     *       }\n     *     };\n     *   });\n     * ```\n     *\n     * ## Security Considerations\n     *\n     * When designing web applications, consider security threats from:\n     *\n     * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)\n     *\n     * Both server and the client must cooperate in order to eliminate these threats. Angular comes\n     * pre-configured with strategies that address these issues, but for this to work backend server\n     * cooperation is required.\n     *\n     * ### JSON Vulnerability Protection\n     *\n     * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)\n     * allows third party website to turn your JSON resource URL into\n     * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To\n     * counter this your server can prefix all JSON requests with following string `\")]}',\\n\"`.\n     * Angular will automatically strip the prefix before processing it as JSON.\n     *\n     * For example if your server needs to return:\n     * ```js\n     * ['one','two']\n     * ```\n     *\n     * which is vulnerable to attack, your server can return:\n     * ```js\n     * )]}',\n     * ['one','two']\n     * ```\n     *\n     * Angular will strip the prefix, before processing the JSON.\n     *\n     *\n     * ### Cross Site Request Forgery (XSRF) Protection\n     *\n     * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by\n     * which the attacker can trick an authenticated user into unknowingly executing actions on your\n     * website. Angular provides a mechanism to counter XSRF. When performing XHR requests, the\n     * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP\n     * header (`X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the\n     * cookie, your server can be assured that the XHR came from JavaScript running on your domain.\n     * The header will not be set for cross-domain requests.\n     *\n     * To take advantage of this, your server needs to set a token in a JavaScript readable session\n     * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the\n     * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure\n     * that only JavaScript running on your domain could have sent the request. The token must be\n     * unique for each user and must be verifiable by the server (to prevent the JavaScript from\n     * making up its own tokens). We recommend that the token is a digest of your site's\n     * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)\n     * for added security.\n     *\n     * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName\n     * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,\n     * or the per-request config object.\n     *\n     * In order to prevent collisions in environments where multiple Angular apps share the\n     * same domain or subdomain, we recommend that each application uses unique cookie name.\n     *\n     * @param {object} config Object describing the request to be made and how it should be\n     *    processed. The object has following properties:\n     *\n     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)\n     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.\n     *    - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized\n     *      with the `paramSerializer` and appended as GET parameters.\n     *    - **data** – `{string|Object}` – Data to be sent as the request message data.\n     *    - **headers** – `{Object}` – Map of strings or functions which return strings representing\n     *      HTTP headers to send to the server. If the return value of a function is null, the\n     *      header will not be sent. Functions accept a config object as an argument.\n     *    - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.\n     *    - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.\n     *    - **transformRequest** –\n     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      request body and headers and returns its transformed (typically serialized) version.\n     *      See {@link ng.$http#overriding-the-default-transformations-per-request\n     *      Overriding the Default Transformations}\n     *    - **transformResponse** –\n     *      `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –\n     *      transform function or an array of such functions. The transform function takes the http\n     *      response body, headers and status and returns its transformed (typically deserialized) version.\n     *      See {@link ng.$http#overriding-the-default-transformations-per-request\n     *      Overriding the Default Transformations}\n     *    - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to\n     *      prepare the string representation of request parameters (specified as an object).\n     *      If specified as string, it is interpreted as function registered with the\n     *      {@link $injector $injector}, which means you can create your own serializer\n     *      by registering it as a {@link auto.$provide#service service}.\n     *      The default serializer is the {@link $httpParamSerializer $httpParamSerializer};\n     *      alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}\n     *    - **cache** – `{boolean|Object}` – A boolean value or object created with\n     *      {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.\n     *      See {@link $http#caching $http Caching} for more information.\n     *    - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}\n     *      that should abort the request when resolved.\n     *    - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the\n     *      XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)\n     *      for more information.\n     *    - **responseType** - `{string}` - see\n     *      [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).\n     *\n     * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object\n     *                        when the request succeeds or fails.\n     *\n     *\n     * @property {Array.<Object>} pendingRequests Array of config objects for currently pending\n     *   requests. This is primarily meant to be used for debugging purposes.\n     *\n     *\n     * @example\n<example module=\"httpExample\">\n<file name=\"index.html\">\n  <div ng-controller=\"FetchController\">\n    <select ng-model=\"method\" aria-label=\"Request method\">\n      <option>GET</option>\n      <option>JSONP</option>\n    </select>\n    <input type=\"text\" ng-model=\"url\" size=\"80\" aria-label=\"URL\" />\n    <button id=\"fetchbtn\" ng-click=\"fetch()\">fetch</button><br>\n    <button id=\"samplegetbtn\" ng-click=\"updateModel('GET', 'http-hello.html')\">Sample GET</button>\n    <button id=\"samplejsonpbtn\"\n      ng-click=\"updateModel('JSONP',\n                    'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')\">\n      Sample JSONP\n    </button>\n    <button id=\"invalidjsonpbtn\"\n      ng-click=\"updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')\">\n        Invalid JSONP\n      </button>\n    <pre>http status code: {{status}}</pre>\n    <pre>http response data: {{data}}</pre>\n  </div>\n</file>\n<file name=\"script.js\">\n  angular.module('httpExample', [])\n    .controller('FetchController', ['$scope', '$http', '$templateCache',\n      function($scope, $http, $templateCache) {\n        $scope.method = 'GET';\n        $scope.url = 'http-hello.html';\n\n        $scope.fetch = function() {\n          $scope.code = null;\n          $scope.response = null;\n\n          $http({method: $scope.method, url: $scope.url, cache: $templateCache}).\n            then(function(response) {\n              $scope.status = response.status;\n              $scope.data = response.data;\n            }, function(response) {\n              $scope.data = response.data || \"Request failed\";\n              $scope.status = response.status;\n          });\n        };\n\n        $scope.updateModel = function(method, url) {\n          $scope.method = method;\n          $scope.url = url;\n        };\n      }]);\n</file>\n<file name=\"http-hello.html\">\n  Hello, $http!\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  var status = element(by.binding('status'));\n  var data = element(by.binding('data'));\n  var fetchBtn = element(by.id('fetchbtn'));\n  var sampleGetBtn = element(by.id('samplegetbtn'));\n  var sampleJsonpBtn = element(by.id('samplejsonpbtn'));\n  var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));\n\n  it('should make an xhr GET request', function() {\n    sampleGetBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('200');\n    expect(data.getText()).toMatch(/Hello, \\$http!/);\n  });\n\n// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185\n// it('should make a JSONP request to angularjs.org', function() {\n//   sampleJsonpBtn.click();\n//   fetchBtn.click();\n//   expect(status.getText()).toMatch('200');\n//   expect(data.getText()).toMatch(/Super Hero!/);\n// });\n\n  it('should make JSONP request to invalid URL and invoke the error handler',\n      function() {\n    invalidJsonpBtn.click();\n    fetchBtn.click();\n    expect(status.getText()).toMatch('0');\n    expect(data.getText()).toMatch('Request failed');\n  });\n</file>\n</example>\n     */\n    function $http(requestConfig) {\n\n      if (!isObject(requestConfig)) {\n        throw minErr('$http')('badreq', 'Http request configuration must be an object.  Received: {0}', requestConfig);\n      }\n\n      if (!isString(requestConfig.url)) {\n        throw minErr('$http')('badreq', 'Http request configuration url must be a string.  Received: {0}', requestConfig.url);\n      }\n\n      var config = extend({\n        method: 'get',\n        transformRequest: defaults.transformRequest,\n        transformResponse: defaults.transformResponse,\n        paramSerializer: defaults.paramSerializer\n      }, requestConfig);\n\n      config.headers = mergeHeaders(requestConfig);\n      config.method = uppercase(config.method);\n      config.paramSerializer = isString(config.paramSerializer) ?\n        $injector.get(config.paramSerializer) : config.paramSerializer;\n\n      var serverRequest = function(config) {\n        var headers = config.headers;\n        var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);\n\n        // strip content-type if data is undefined\n        if (isUndefined(reqData)) {\n          forEach(headers, function(value, header) {\n            if (lowercase(header) === 'content-type') {\n                delete headers[header];\n            }\n          });\n        }\n\n        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {\n          config.withCredentials = defaults.withCredentials;\n        }\n\n        // send request\n        return sendReq(config, reqData).then(transformResponse, transformResponse);\n      };\n\n      var chain = [serverRequest, undefined];\n      var promise = $q.when(config);\n\n      // apply interceptors\n      forEach(reversedInterceptors, function(interceptor) {\n        if (interceptor.request || interceptor.requestError) {\n          chain.unshift(interceptor.request, interceptor.requestError);\n        }\n        if (interceptor.response || interceptor.responseError) {\n          chain.push(interceptor.response, interceptor.responseError);\n        }\n      });\n\n      while (chain.length) {\n        var thenFn = chain.shift();\n        var rejectFn = chain.shift();\n\n        promise = promise.then(thenFn, rejectFn);\n      }\n\n      if (useLegacyPromise) {\n        promise.success = function(fn) {\n          assertArgFn(fn, 'fn');\n\n          promise.then(function(response) {\n            fn(response.data, response.status, response.headers, config);\n          });\n          return promise;\n        };\n\n        promise.error = function(fn) {\n          assertArgFn(fn, 'fn');\n\n          promise.then(null, function(response) {\n            fn(response.data, response.status, response.headers, config);\n          });\n          return promise;\n        };\n      } else {\n        promise.success = $httpMinErrLegacyFn('success');\n        promise.error = $httpMinErrLegacyFn('error');\n      }\n\n      return promise;\n\n      function transformResponse(response) {\n        // make a copy since the response must be cacheable\n        var resp = extend({}, response);\n        resp.data = transformData(response.data, response.headers, response.status,\n                                  config.transformResponse);\n        return (isSuccess(response.status))\n          ? resp\n          : $q.reject(resp);\n      }\n\n      function executeHeaderFns(headers, config) {\n        var headerContent, processedHeaders = {};\n\n        forEach(headers, function(headerFn, header) {\n          if (isFunction(headerFn)) {\n            headerContent = headerFn(config);\n            if (headerContent != null) {\n              processedHeaders[header] = headerContent;\n            }\n          } else {\n            processedHeaders[header] = headerFn;\n          }\n        });\n\n        return processedHeaders;\n      }\n\n      function mergeHeaders(config) {\n        var defHeaders = defaults.headers,\n            reqHeaders = extend({}, config.headers),\n            defHeaderName, lowercaseDefHeaderName, reqHeaderName;\n\n        defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);\n\n        // using for-in instead of forEach to avoid unnecessary iteration after header has been found\n        defaultHeadersIteration:\n        for (defHeaderName in defHeaders) {\n          lowercaseDefHeaderName = lowercase(defHeaderName);\n\n          for (reqHeaderName in reqHeaders) {\n            if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {\n              continue defaultHeadersIteration;\n            }\n          }\n\n          reqHeaders[defHeaderName] = defHeaders[defHeaderName];\n        }\n\n        // execute if header value is a function for merged headers\n        return executeHeaderFns(reqHeaders, shallowCopy(config));\n      }\n    }\n\n    $http.pendingRequests = [];\n\n    /**\n     * @ngdoc method\n     * @name $http#get\n     *\n     * @description\n     * Shortcut method to perform `GET` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#delete\n     *\n     * @description\n     * Shortcut method to perform `DELETE` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#head\n     *\n     * @description\n     * Shortcut method to perform `HEAD` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#jsonp\n     *\n     * @description\n     * Shortcut method to perform `JSONP` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request.\n     *                     The name of the callback should be the string `JSON_CALLBACK`.\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n    createShortMethods('get', 'delete', 'head', 'jsonp');\n\n    /**\n     * @ngdoc method\n     * @name $http#post\n     *\n     * @description\n     * Shortcut method to perform `POST` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n    /**\n     * @ngdoc method\n     * @name $http#put\n     *\n     * @description\n     * Shortcut method to perform `PUT` request.\n     *\n     * @param {string} url Relative or absolute URL specifying the destination of the request\n     * @param {*} data Request content\n     * @param {Object=} config Optional configuration object\n     * @returns {HttpPromise} Future object\n     */\n\n     /**\n      * @ngdoc method\n      * @name $http#patch\n      *\n      * @description\n      * Shortcut method to perform `PATCH` request.\n      *\n      * @param {string} url Relative or absolute URL specifying the destination of the request\n      * @param {*} data Request content\n      * @param {Object=} config Optional configuration object\n      * @returns {HttpPromise} Future object\n      */\n    createShortMethodsWithData('post', 'put', 'patch');\n\n        /**\n         * @ngdoc property\n         * @name $http#defaults\n         *\n         * @description\n         * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of\n         * default headers, withCredentials as well as request and response transformations.\n         *\n         * See \"Setting HTTP Headers\" and \"Transforming Requests and Responses\" sections above.\n         */\n    $http.defaults = defaults;\n\n\n    return $http;\n\n\n    function createShortMethods(names) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, config) {\n          return $http(extend({}, config || {}, {\n            method: name,\n            url: url\n          }));\n        };\n      });\n    }\n\n\n    function createShortMethodsWithData(name) {\n      forEach(arguments, function(name) {\n        $http[name] = function(url, data, config) {\n          return $http(extend({}, config || {}, {\n            method: name,\n            url: url,\n            data: data\n          }));\n        };\n      });\n    }\n\n\n    /**\n     * Makes the request.\n     *\n     * !!! ACCESSES CLOSURE VARS:\n     * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests\n     */\n    function sendReq(config, reqData) {\n      var deferred = $q.defer(),\n          promise = deferred.promise,\n          cache,\n          cachedResp,\n          reqHeaders = config.headers,\n          url = buildUrl(config.url, config.paramSerializer(config.params));\n\n      $http.pendingRequests.push(config);\n      promise.then(removePendingReq, removePendingReq);\n\n\n      if ((config.cache || defaults.cache) && config.cache !== false &&\n          (config.method === 'GET' || config.method === 'JSONP')) {\n        cache = isObject(config.cache) ? config.cache\n              : isObject(defaults.cache) ? defaults.cache\n              : defaultCache;\n      }\n\n      if (cache) {\n        cachedResp = cache.get(url);\n        if (isDefined(cachedResp)) {\n          if (isPromiseLike(cachedResp)) {\n            // cached request has already been sent, but there is no response yet\n            cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);\n          } else {\n            // serving from cache\n            if (isArray(cachedResp)) {\n              resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);\n            } else {\n              resolvePromise(cachedResp, 200, {}, 'OK');\n            }\n          }\n        } else {\n          // put the promise for the non-transformed response into cache as a placeholder\n          cache.put(url, promise);\n        }\n      }\n\n\n      // if we won't have the response in cache, set the xsrf headers and\n      // send the request to the backend\n      if (isUndefined(cachedResp)) {\n        var xsrfValue = urlIsSameOrigin(config.url)\n            ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]\n            : undefined;\n        if (xsrfValue) {\n          reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;\n        }\n\n        $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,\n            config.withCredentials, config.responseType);\n      }\n\n      return promise;\n\n\n      /**\n       * Callback registered to $httpBackend():\n       *  - caches the response if desired\n       *  - resolves the raw $http promise\n       *  - calls $apply\n       */\n      function done(status, response, headersString, statusText) {\n        if (cache) {\n          if (isSuccess(status)) {\n            cache.put(url, [status, response, parseHeaders(headersString), statusText]);\n          } else {\n            // remove promise from the cache\n            cache.remove(url);\n          }\n        }\n\n        function resolveHttpPromise() {\n          resolvePromise(response, status, headersString, statusText);\n        }\n\n        if (useApplyAsync) {\n          $rootScope.$applyAsync(resolveHttpPromise);\n        } else {\n          resolveHttpPromise();\n          if (!$rootScope.$$phase) $rootScope.$apply();\n        }\n      }\n\n\n      /**\n       * Resolves the raw $http promise.\n       */\n      function resolvePromise(response, status, headers, statusText) {\n        //status: HTTP response status code, 0, -1 (aborted by timeout / promise)\n        status = status >= -1 ? status : 0;\n\n        (isSuccess(status) ? deferred.resolve : deferred.reject)({\n          data: response,\n          status: status,\n          headers: headersGetter(headers),\n          config: config,\n          statusText: statusText\n        });\n      }\n\n      function resolvePromiseWithResult(result) {\n        resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);\n      }\n\n      function removePendingReq() {\n        var idx = $http.pendingRequests.indexOf(config);\n        if (idx !== -1) $http.pendingRequests.splice(idx, 1);\n      }\n    }\n\n\n    function buildUrl(url, serializedParams) {\n      if (serializedParams.length > 0) {\n        url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;\n      }\n      return url;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $xhrFactory\n *\n * @description\n * Factory function used to create XMLHttpRequest objects.\n *\n * Replace or decorate this service to create your own custom XMLHttpRequest objects.\n *\n * ```\n * angular.module('myApp', [])\n * .factory('$xhrFactory', function() {\n *   return function createXhr(method, url) {\n *     return new window.XMLHttpRequest({mozSystem: true});\n *   };\n * });\n * ```\n *\n * @param {string} method HTTP method of the request (GET, POST, PUT, ..)\n * @param {string} url URL of the request.\n */\nfunction $xhrFactoryProvider() {\n  this.$get = function() {\n    return function createXhr() {\n      return new window.XMLHttpRequest();\n    };\n  };\n}\n\n/**\n * @ngdoc service\n * @name $httpBackend\n * @requires $window\n * @requires $document\n * @requires $xhrFactory\n *\n * @description\n * HTTP backend used by the {@link ng.$http service} that delegates to\n * XMLHttpRequest object or JSONP and deals with browser incompatibilities.\n *\n * You should never need to use this service directly, instead use the higher-level abstractions:\n * {@link ng.$http $http} or {@link ngResource.$resource $resource}.\n *\n * During testing this implementation is swapped with {@link ngMock.$httpBackend mock\n * $httpBackend} which can be trained with responses.\n */\nfunction $HttpBackendProvider() {\n  this.$get = ['$browser', '$window', '$document', '$xhrFactory', function($browser, $window, $document, $xhrFactory) {\n    return createHttpBackend($browser, $xhrFactory, $browser.defer, $window.angular.callbacks, $document[0]);\n  }];\n}\n\nfunction createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {\n  // TODO(vojta): fix the signature\n  return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {\n    $browser.$$incOutstandingRequestCount();\n    url = url || $browser.url();\n\n    if (lowercase(method) == 'jsonp') {\n      var callbackId = '_' + (callbacks.counter++).toString(36);\n      callbacks[callbackId] = function(data) {\n        callbacks[callbackId].data = data;\n        callbacks[callbackId].called = true;\n      };\n\n      var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),\n          callbackId, function(status, text) {\n        completeRequest(callback, status, callbacks[callbackId].data, \"\", text);\n        callbacks[callbackId] = noop;\n      });\n    } else {\n\n      var xhr = createXhr(method, url);\n\n      xhr.open(method, url, true);\n      forEach(headers, function(value, key) {\n        if (isDefined(value)) {\n            xhr.setRequestHeader(key, value);\n        }\n      });\n\n      xhr.onload = function requestLoaded() {\n        var statusText = xhr.statusText || '';\n\n        // responseText is the old-school way of retrieving response (supported by IE9)\n        // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)\n        var response = ('response' in xhr) ? xhr.response : xhr.responseText;\n\n        // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)\n        var status = xhr.status === 1223 ? 204 : xhr.status;\n\n        // fix status code when it is 0 (0 status is undocumented).\n        // Occurs when accessing file resources or on Android 4.1 stock browser\n        // while retrieving files from application cache.\n        if (status === 0) {\n          status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;\n        }\n\n        completeRequest(callback,\n            status,\n            response,\n            xhr.getAllResponseHeaders(),\n            statusText);\n      };\n\n      var requestError = function() {\n        // The response is always empty\n        // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error\n        completeRequest(callback, -1, null, null, '');\n      };\n\n      xhr.onerror = requestError;\n      xhr.onabort = requestError;\n\n      if (withCredentials) {\n        xhr.withCredentials = true;\n      }\n\n      if (responseType) {\n        try {\n          xhr.responseType = responseType;\n        } catch (e) {\n          // WebKit added support for the json responseType value on 09/03/2013\n          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are\n          // known to throw when setting the value \"json\" as the response type. Other older\n          // browsers implementing the responseType\n          //\n          // The json response type can be ignored if not supported, because JSON payloads are\n          // parsed on the client-side regardless.\n          if (responseType !== 'json') {\n            throw e;\n          }\n        }\n      }\n\n      xhr.send(isUndefined(post) ? null : post);\n    }\n\n    if (timeout > 0) {\n      var timeoutId = $browserDefer(timeoutRequest, timeout);\n    } else if (isPromiseLike(timeout)) {\n      timeout.then(timeoutRequest);\n    }\n\n\n    function timeoutRequest() {\n      jsonpDone && jsonpDone();\n      xhr && xhr.abort();\n    }\n\n    function completeRequest(callback, status, response, headersString, statusText) {\n      // cancel timeout and subsequent timeout promise resolution\n      if (isDefined(timeoutId)) {\n        $browserDefer.cancel(timeoutId);\n      }\n      jsonpDone = xhr = null;\n\n      callback(status, response, headersString, statusText);\n      $browser.$$completeOutstandingRequest(noop);\n    }\n  };\n\n  function jsonpReq(url, callbackId, done) {\n    // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:\n    // - fetches local scripts via XHR and evals them\n    // - adds and immediately removes script elements from the document\n    var script = rawDocument.createElement('script'), callback = null;\n    script.type = \"text/javascript\";\n    script.src = url;\n    script.async = true;\n\n    callback = function(event) {\n      removeEventListenerFn(script, \"load\", callback);\n      removeEventListenerFn(script, \"error\", callback);\n      rawDocument.body.removeChild(script);\n      script = null;\n      var status = -1;\n      var text = \"unknown\";\n\n      if (event) {\n        if (event.type === \"load\" && !callbacks[callbackId].called) {\n          event = { type: \"error\" };\n        }\n        text = event.type;\n        status = event.type === \"error\" ? 404 : 200;\n      }\n\n      if (done) {\n        done(status, text);\n      }\n    };\n\n    addEventListenerFn(script, \"load\", callback);\n    addEventListenerFn(script, \"error\", callback);\n    rawDocument.body.appendChild(script);\n    return callback;\n  }\n}\n\nvar $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');\n$interpolateMinErr.throwNoconcat = function(text) {\n  throw $interpolateMinErr('noconcat',\n      \"Error while interpolating: {0}\\nStrict Contextual Escaping disallows \" +\n      \"interpolations that concatenate multiple expressions when a trusted value is \" +\n      \"required.  See http://docs.angularjs.org/api/ng.$sce\", text);\n};\n\n$interpolateMinErr.interr = function(text, err) {\n  return $interpolateMinErr('interr', \"Can't interpolate: {0}\\n{1}\", text, err.toString());\n};\n\n/**\n * @ngdoc provider\n * @name $interpolateProvider\n *\n * @description\n *\n * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.\n *\n * <div class=\"alert alert-danger\">\n * This feature is sometimes used to mix different markup languages, e.g. to wrap an Angular\n * template within a Python Jinja template (or any other template language). Mixing templating\n * languages is **very dangerous**. The embedding template language will not safely escape Angular\n * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS)\n * security bugs!\n * </div>\n *\n * @example\n<example name=\"custom-interpolation-markup\" module=\"customInterpolationApp\">\n<file name=\"index.html\">\n<script>\n  var customInterpolationApp = angular.module('customInterpolationApp', []);\n\n  customInterpolationApp.config(function($interpolateProvider) {\n    $interpolateProvider.startSymbol('//');\n    $interpolateProvider.endSymbol('//');\n  });\n\n\n  customInterpolationApp.controller('DemoController', function() {\n      this.label = \"This binding is brought you by // interpolation symbols.\";\n  });\n</script>\n<div ng-controller=\"DemoController as demo\">\n    //demo.label//\n</div>\n</file>\n<file name=\"protractor.js\" type=\"protractor\">\n  it('should interpolate binding with custom symbols', function() {\n    expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');\n  });\n</file>\n</example>\n */\nfunction $InterpolateProvider() {\n  var startSymbol = '{{';\n  var endSymbol = '}}';\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#startSymbol\n   * @description\n   * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.\n   *\n   * @param {string=} value new value to set the starting symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.startSymbol = function(value) {\n    if (value) {\n      startSymbol = value;\n      return this;\n    } else {\n      return startSymbol;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $interpolateProvider#endSymbol\n   * @description\n   * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n   *\n   * @param {string=} value new value to set the ending symbol to.\n   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.\n   */\n  this.endSymbol = function(value) {\n    if (value) {\n      endSymbol = value;\n      return this;\n    } else {\n      return endSymbol;\n    }\n  };\n\n\n  this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {\n    var startSymbolLength = startSymbol.length,\n        endSymbolLength = endSymbol.length,\n        escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),\n        escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');\n\n    function escape(ch) {\n      return '\\\\\\\\\\\\' + ch;\n    }\n\n    function unescapeText(text) {\n      return text.replace(escapedStartRegexp, startSymbol).\n        replace(escapedEndRegexp, endSymbol);\n    }\n\n    function stringify(value) {\n      if (value == null) { // null || undefined\n        return '';\n      }\n      switch (typeof value) {\n        case 'string':\n          break;\n        case 'number':\n          value = '' + value;\n          break;\n        default:\n          value = toJson(value);\n      }\n\n      return value;\n    }\n\n    //TODO: this is the same as the constantWatchDelegate in parse.js\n    function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {\n      var unwatch;\n      return unwatch = scope.$watch(function constantInterpolateWatch(scope) {\n        unwatch();\n        return constantInterp(scope);\n      }, listener, objectEquality);\n    }\n\n    /**\n     * @ngdoc service\n     * @name $interpolate\n     * @kind function\n     *\n     * @requires $parse\n     * @requires $sce\n     *\n     * @description\n     *\n     * Compiles a string with markup into an interpolation function. This service is used by the\n     * HTML {@link ng.$compile $compile} service for data binding. See\n     * {@link ng.$interpolateProvider $interpolateProvider} for configuring the\n     * interpolation markup.\n     *\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var exp = $interpolate('Hello {{name | uppercase}}!');\n     *   expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');\n     * ```\n     *\n     * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is\n     * `true`, the interpolation function will return `undefined` unless all embedded expressions\n     * evaluate to a value other than `undefined`.\n     *\n     * ```js\n     *   var $interpolate = ...; // injected\n     *   var context = {greeting: 'Hello', name: undefined };\n     *\n     *   // default \"forgiving\" mode\n     *   var exp = $interpolate('{{greeting}} {{name}}!');\n     *   expect(exp(context)).toEqual('Hello !');\n     *\n     *   // \"allOrNothing\" mode\n     *   exp = $interpolate('{{greeting}} {{name}}!', false, null, true);\n     *   expect(exp(context)).toBeUndefined();\n     *   context.name = 'Angular';\n     *   expect(exp(context)).toEqual('Hello Angular!');\n     * ```\n     *\n     * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.\n     *\n     * ####Escaped Interpolation\n     * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers\n     * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).\n     * It will be rendered as a regular start/end marker, and will not be interpreted as an expression\n     * or binding.\n     *\n     * This enables web-servers to prevent script injection attacks and defacing attacks, to some\n     * degree, while also enabling code examples to work without relying on the\n     * {@link ng.directive:ngNonBindable ngNonBindable} directive.\n     *\n     * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,\n     * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all\n     * interpolation start/end markers with their escaped counterparts.**\n     *\n     * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered\n     * output when the $interpolate service processes the text. So, for HTML elements interpolated\n     * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter\n     * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,\n     * this is typically useful only when user-data is used in rendering a template from the server, or\n     * when otherwise untrusted data is used by a directive.\n     *\n     * <example>\n     *  <file name=\"index.html\">\n     *    <div ng-init=\"username='A user'\">\n     *      <p ng-init=\"apptitle='Escaping demo'\">{{apptitle}}: \\{\\{ username = \"defaced value\"; \\}\\}\n     *        </p>\n     *      <p><strong>{{username}}</strong> attempts to inject code which will deface the\n     *        application, but fails to accomplish their task, because the server has correctly\n     *        escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)\n     *        characters.</p>\n     *      <p>Instead, the result of the attempted script injection is visible, and can be removed\n     *        from the database by an administrator.</p>\n     *    </div>\n     *  </file>\n     * </example>\n     *\n     * @param {string} text The text with markup to interpolate.\n     * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have\n     *    embedded expression in order to return an interpolation function. Strings with no\n     *    embedded expression will return null for the interpolation function.\n     * @param {string=} trustedContext when provided, the returned function passes the interpolated\n     *    result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,\n     *    trustedContext)} before returning it.  Refer to the {@link ng.$sce $sce} service that\n     *    provides Strict Contextual Escaping for details.\n     * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined\n     *    unless all embedded expressions evaluate to a value other than `undefined`.\n     * @returns {function(context)} an interpolation function which is used to compute the\n     *    interpolated string. The function has these parameters:\n     *\n     * - `context`: evaluation context for all expressions embedded in the interpolated text\n     */\n    function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {\n      // Provide a quick exit and simplified result function for text with no interpolation\n      if (!text.length || text.indexOf(startSymbol) === -1) {\n        var constantInterp;\n        if (!mustHaveExpression) {\n          var unescapedText = unescapeText(text);\n          constantInterp = valueFn(unescapedText);\n          constantInterp.exp = text;\n          constantInterp.expressions = [];\n          constantInterp.$$watchDelegate = constantWatchDelegate;\n        }\n        return constantInterp;\n      }\n\n      allOrNothing = !!allOrNothing;\n      var startIndex,\n          endIndex,\n          index = 0,\n          expressions = [],\n          parseFns = [],\n          textLength = text.length,\n          exp,\n          concat = [],\n          expressionPositions = [];\n\n      while (index < textLength) {\n        if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&\n             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {\n          if (index !== startIndex) {\n            concat.push(unescapeText(text.substring(index, startIndex)));\n          }\n          exp = text.substring(startIndex + startSymbolLength, endIndex);\n          expressions.push(exp);\n          parseFns.push($parse(exp, parseStringifyInterceptor));\n          index = endIndex + endSymbolLength;\n          expressionPositions.push(concat.length);\n          concat.push('');\n        } else {\n          // we did not find an interpolation, so we have to add the remainder to the separators array\n          if (index !== textLength) {\n            concat.push(unescapeText(text.substring(index)));\n          }\n          break;\n        }\n      }\n\n      // Concatenating expressions makes it hard to reason about whether some combination of\n      // concatenated values are unsafe to use and could easily lead to XSS.  By requiring that a\n      // single expression be used for iframe[src], object[src], etc., we ensure that the value\n      // that's used is assigned or constructed by some JS code somewhere that is more testable or\n      // make it obvious that you bound the value to some user controlled value.  This helps reduce\n      // the load when auditing for XSS issues.\n      if (trustedContext && concat.length > 1) {\n          $interpolateMinErr.throwNoconcat(text);\n      }\n\n      if (!mustHaveExpression || expressions.length) {\n        var compute = function(values) {\n          for (var i = 0, ii = expressions.length; i < ii; i++) {\n            if (allOrNothing && isUndefined(values[i])) return;\n            concat[expressionPositions[i]] = values[i];\n          }\n          return concat.join('');\n        };\n\n        var getValue = function(value) {\n          return trustedContext ?\n            $sce.getTrusted(trustedContext, value) :\n            $sce.valueOf(value);\n        };\n\n        return extend(function interpolationFn(context) {\n            var i = 0;\n            var ii = expressions.length;\n            var values = new Array(ii);\n\n            try {\n              for (; i < ii; i++) {\n                values[i] = parseFns[i](context);\n              }\n\n              return compute(values);\n            } catch (err) {\n              $exceptionHandler($interpolateMinErr.interr(text, err));\n            }\n\n          }, {\n          // all of these properties are undocumented for now\n          exp: text, //just for compatibility with regular watchers created via $watch\n          expressions: expressions,\n          $$watchDelegate: function(scope, listener) {\n            var lastValue;\n            return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {\n              var currValue = compute(values);\n              if (isFunction(listener)) {\n                listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);\n              }\n              lastValue = currValue;\n            });\n          }\n        });\n      }\n\n      function parseStringifyInterceptor(value) {\n        try {\n          value = getValue(value);\n          return allOrNothing && !isDefined(value) ? value : stringify(value);\n        } catch (err) {\n          $exceptionHandler($interpolateMinErr.interr(text, err));\n        }\n      }\n    }\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#startSymbol\n     * @description\n     * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.\n     *\n     * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} start symbol.\n     */\n    $interpolate.startSymbol = function() {\n      return startSymbol;\n    };\n\n\n    /**\n     * @ngdoc method\n     * @name $interpolate#endSymbol\n     * @description\n     * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.\n     *\n     * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change\n     * the symbol.\n     *\n     * @returns {string} end symbol.\n     */\n    $interpolate.endSymbol = function() {\n      return endSymbol;\n    };\n\n    return $interpolate;\n  }];\n}\n\nfunction $IntervalProvider() {\n  this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',\n       function($rootScope,   $window,   $q,   $$q,   $browser) {\n    var intervals = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $interval\n      *\n      * @description\n      * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`\n      * milliseconds.\n      *\n      * The return value of registering an interval function is a promise. This promise will be\n      * notified upon each tick of the interval, and will be resolved after `count` iterations, or\n      * run indefinitely if `count` is not defined. The value of the notification will be the\n      * number of iterations that have run.\n      * To cancel an interval, call `$interval.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to\n      * move forward by `millis` milliseconds and trigger any functions scheduled to run in that\n      * time.\n      *\n      * <div class=\"alert alert-warning\">\n      * **Note**: Intervals created by this service must be explicitly destroyed when you are finished\n      * with them.  In particular they are not automatically destroyed when a controller's scope or a\n      * directive's element are destroyed.\n      * You should take this into consideration and make sure to always cancel the interval at the\n      * appropriate moment.  See the example below for more details on how and when to do this.\n      * </div>\n      *\n      * @param {function()} fn A function that should be called repeatedly.\n      * @param {number} delay Number of milliseconds between each function call.\n      * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat\n      *   indefinitely.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @param {...*=} Pass additional parameters to the executed function.\n      * @returns {promise} A promise which will be notified on each iteration.\n      *\n      * @example\n      * <example module=\"intervalExample\">\n      * <file name=\"index.html\">\n      *   <script>\n      *     angular.module('intervalExample', [])\n      *       .controller('ExampleController', ['$scope', '$interval',\n      *         function($scope, $interval) {\n      *           $scope.format = 'M/d/yy h:mm:ss a';\n      *           $scope.blood_1 = 100;\n      *           $scope.blood_2 = 120;\n      *\n      *           var stop;\n      *           $scope.fight = function() {\n      *             // Don't start a new fight if we are already fighting\n      *             if ( angular.isDefined(stop) ) return;\n      *\n      *             stop = $interval(function() {\n      *               if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {\n      *                 $scope.blood_1 = $scope.blood_1 - 3;\n      *                 $scope.blood_2 = $scope.blood_2 - 4;\n      *               } else {\n      *                 $scope.stopFight();\n      *               }\n      *             }, 100);\n      *           };\n      *\n      *           $scope.stopFight = function() {\n      *             if (angular.isDefined(stop)) {\n      *               $interval.cancel(stop);\n      *               stop = undefined;\n      *             }\n      *           };\n      *\n      *           $scope.resetFight = function() {\n      *             $scope.blood_1 = 100;\n      *             $scope.blood_2 = 120;\n      *           };\n      *\n      *           $scope.$on('$destroy', function() {\n      *             // Make sure that the interval is destroyed too\n      *             $scope.stopFight();\n      *           });\n      *         }])\n      *       // Register the 'myCurrentTime' directive factory method.\n      *       // We inject $interval and dateFilter service since the factory method is DI.\n      *       .directive('myCurrentTime', ['$interval', 'dateFilter',\n      *         function($interval, dateFilter) {\n      *           // return the directive link function. (compile function not needed)\n      *           return function(scope, element, attrs) {\n      *             var format,  // date format\n      *                 stopTime; // so that we can cancel the time updates\n      *\n      *             // used to update the UI\n      *             function updateTime() {\n      *               element.text(dateFilter(new Date(), format));\n      *             }\n      *\n      *             // watch the expression, and update the UI on change.\n      *             scope.$watch(attrs.myCurrentTime, function(value) {\n      *               format = value;\n      *               updateTime();\n      *             });\n      *\n      *             stopTime = $interval(updateTime, 1000);\n      *\n      *             // listen on DOM destroy (removal) event, and cancel the next UI update\n      *             // to prevent updating time after the DOM element was removed.\n      *             element.on('$destroy', function() {\n      *               $interval.cancel(stopTime);\n      *             });\n      *           }\n      *         }]);\n      *   </script>\n      *\n      *   <div>\n      *     <div ng-controller=\"ExampleController\">\n      *       <label>Date format: <input ng-model=\"format\"></label> <hr/>\n      *       Current time is: <span my-current-time=\"format\"></span>\n      *       <hr/>\n      *       Blood 1 : <font color='red'>{{blood_1}}</font>\n      *       Blood 2 : <font color='red'>{{blood_2}}</font>\n      *       <button type=\"button\" data-ng-click=\"fight()\">Fight</button>\n      *       <button type=\"button\" data-ng-click=\"stopFight()\">StopFight</button>\n      *       <button type=\"button\" data-ng-click=\"resetFight()\">resetFight</button>\n      *     </div>\n      *   </div>\n      *\n      * </file>\n      * </example>\n      */\n    function interval(fn, delay, count, invokeApply) {\n      var hasParams = arguments.length > 4,\n          args = hasParams ? sliceArgs(arguments, 4) : [],\n          setInterval = $window.setInterval,\n          clearInterval = $window.clearInterval,\n          iteration = 0,\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          deferred = (skipApply ? $$q : $q).defer(),\n          promise = deferred.promise;\n\n      count = isDefined(count) ? count : 0;\n\n      promise.$$intervalId = setInterval(function tick() {\n        if (skipApply) {\n          $browser.defer(callback);\n        } else {\n          $rootScope.$evalAsync(callback);\n        }\n        deferred.notify(iteration++);\n\n        if (count > 0 && iteration >= count) {\n          deferred.resolve(iteration);\n          clearInterval(promise.$$intervalId);\n          delete intervals[promise.$$intervalId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n\n      }, delay);\n\n      intervals[promise.$$intervalId] = deferred;\n\n      return promise;\n\n      function callback() {\n        if (!hasParams) {\n          fn(iteration);\n        } else {\n          fn.apply(null, args);\n        }\n      }\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $interval#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`.\n      *\n      * @param {Promise=} promise returned by the `$interval` function.\n      * @returns {boolean} Returns `true` if the task was successfully canceled.\n      */\n    interval.cancel = function(promise) {\n      if (promise && promise.$$intervalId in intervals) {\n        intervals[promise.$$intervalId].reject('canceled');\n        $window.clearInterval(promise.$$intervalId);\n        delete intervals[promise.$$intervalId];\n        return true;\n      }\n      return false;\n    };\n\n    return interval;\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $locale\n *\n * @description\n * $locale service provides localization rules for various Angular components. As of right now the\n * only public api is:\n *\n * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)\n */\n\nvar PATH_MATCH = /^([^\\?#]*)(\\?([^#]*))?(#(.*))?$/,\n    DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};\nvar $locationMinErr = minErr('$location');\n\n\n/**\n * Encode path using encodeUriSegment, ignoring forward slashes\n *\n * @param {string} path Path to encode\n * @returns {string}\n */\nfunction encodePath(path) {\n  var segments = path.split('/'),\n      i = segments.length;\n\n  while (i--) {\n    segments[i] = encodeUriSegment(segments[i]);\n  }\n\n  return segments.join('/');\n}\n\nfunction parseAbsoluteUrl(absoluteUrl, locationObj) {\n  var parsedUrl = urlResolve(absoluteUrl);\n\n  locationObj.$$protocol = parsedUrl.protocol;\n  locationObj.$$host = parsedUrl.hostname;\n  locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;\n}\n\n\nfunction parseAppUrl(relativeUrl, locationObj) {\n  var prefixed = (relativeUrl.charAt(0) !== '/');\n  if (prefixed) {\n    relativeUrl = '/' + relativeUrl;\n  }\n  var match = urlResolve(relativeUrl);\n  locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?\n      match.pathname.substring(1) : match.pathname);\n  locationObj.$$search = parseKeyValue(match.search);\n  locationObj.$$hash = decodeURIComponent(match.hash);\n\n  // make sure path starts with '/';\n  if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {\n    locationObj.$$path = '/' + locationObj.$$path;\n  }\n}\n\n\n/**\n *\n * @param {string} begin\n * @param {string} whole\n * @returns {string} returns text from whole after begin or undefined if it does not begin with\n *                   expected string.\n */\nfunction beginsWith(begin, whole) {\n  if (whole.indexOf(begin) === 0) {\n    return whole.substr(begin.length);\n  }\n}\n\n\nfunction stripHash(url) {\n  var index = url.indexOf('#');\n  return index == -1 ? url : url.substr(0, index);\n}\n\nfunction trimEmptyHash(url) {\n  return url.replace(/(#.+)|#$/, '$1');\n}\n\n\nfunction stripFile(url) {\n  return url.substr(0, stripHash(url).lastIndexOf('/') + 1);\n}\n\n/* return the server only (scheme://host:port) */\nfunction serverBase(url) {\n  return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));\n}\n\n\n/**\n * LocationHtml5Url represents an url\n * This object is exposed as $location service when HTML5 mode is enabled and supported\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} basePrefix url path prefix\n */\nfunction LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {\n  this.$$html5 = true;\n  basePrefix = basePrefix || '';\n  parseAbsoluteUrl(appBase, this);\n\n\n  /**\n   * Parse given html5 (regular) url string into properties\n   * @param {string} url HTML5 url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var pathUrl = beginsWith(appBaseNoFile, url);\n    if (!isString(pathUrl)) {\n      throw $locationMinErr('ipthprfx', 'Invalid url \"{0}\", missing path prefix \"{1}\".', url,\n          appBaseNoFile);\n    }\n\n    parseAppUrl(pathUrl, this);\n\n    if (!this.$$path) {\n      this.$$path = '/';\n    }\n\n    this.$$compose();\n  };\n\n  /**\n   * Compose url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'\n  };\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (relHref && relHref[0] === '#') {\n      // special case for links to hash fragments:\n      // keep the old url and only replace the hash fragment\n      this.hash(relHref.slice(1));\n      return true;\n    }\n    var appUrl, prevAppUrl;\n    var rewrittenUrl;\n\n    if (isDefined(appUrl = beginsWith(appBase, url))) {\n      prevAppUrl = appUrl;\n      if (isDefined(appUrl = beginsWith(basePrefix, appUrl))) {\n        rewrittenUrl = appBaseNoFile + (beginsWith('/', appUrl) || appUrl);\n      } else {\n        rewrittenUrl = appBase + prevAppUrl;\n      }\n    } else if (isDefined(appUrl = beginsWith(appBaseNoFile, url))) {\n      rewrittenUrl = appBaseNoFile + appUrl;\n    } else if (appBaseNoFile == url + '/') {\n      rewrittenUrl = appBaseNoFile;\n    }\n    if (rewrittenUrl) {\n      this.$$parse(rewrittenUrl);\n    }\n    return !!rewrittenUrl;\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when developer doesn't opt into html5 mode.\n * It also serves as the base class for html5 mode fallback on legacy browsers.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {\n\n  parseAbsoluteUrl(appBase, this);\n\n\n  /**\n   * Parse given hashbang url into properties\n   * @param {string} url Hashbang url\n   * @private\n   */\n  this.$$parse = function(url) {\n    var withoutBaseUrl = beginsWith(appBase, url) || beginsWith(appBaseNoFile, url);\n    var withoutHashUrl;\n\n    if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {\n\n      // The rest of the url starts with a hash so we have\n      // got either a hashbang path or a plain hash fragment\n      withoutHashUrl = beginsWith(hashPrefix, withoutBaseUrl);\n      if (isUndefined(withoutHashUrl)) {\n        // There was no hashbang prefix so we just have a hash fragment\n        withoutHashUrl = withoutBaseUrl;\n      }\n\n    } else {\n      // There was no hashbang path nor hash fragment:\n      // If we are in HTML5 mode we use what is left as the path;\n      // Otherwise we ignore what is left\n      if (this.$$html5) {\n        withoutHashUrl = withoutBaseUrl;\n      } else {\n        withoutHashUrl = '';\n        if (isUndefined(withoutBaseUrl)) {\n          appBase = url;\n          this.replace();\n        }\n      }\n    }\n\n    parseAppUrl(withoutHashUrl, this);\n\n    this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);\n\n    this.$$compose();\n\n    /*\n     * In Windows, on an anchor node on documents loaded from\n     * the filesystem, the browser will return a pathname\n     * prefixed with the drive name ('/C:/path') when a\n     * pathname without a drive is set:\n     *  * a.setAttribute('href', '/foo')\n     *   * a.pathname === '/C:/foo' //true\n     *\n     * Inside of Angular, we're always using pathnames that\n     * do not include drive names for routing.\n     */\n    function removeWindowsDriveName(path, url, base) {\n      /*\n      Matches paths for file protocol on windows,\n      such as /C:/foo/bar, and captures only /foo/bar.\n      */\n      var windowsFilePathExp = /^\\/[A-Z]:(\\/.*)/;\n\n      var firstPathSegmentMatch;\n\n      //Get the relative path from the input URL.\n      if (url.indexOf(base) === 0) {\n        url = url.replace(base, '');\n      }\n\n      // The input URL intentionally contains a first path segment that ends with a colon.\n      if (windowsFilePathExp.exec(url)) {\n        return path;\n      }\n\n      firstPathSegmentMatch = windowsFilePathExp.exec(path);\n      return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;\n    }\n  };\n\n  /**\n   * Compose hashbang url and update `absUrl` property\n   * @private\n   */\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');\n  };\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (stripHash(appBase) == stripHash(url)) {\n      this.$$parse(url);\n      return true;\n    }\n    return false;\n  };\n}\n\n\n/**\n * LocationHashbangUrl represents url\n * This object is exposed as $location service when html5 history api is enabled but the browser\n * does not support it.\n *\n * @constructor\n * @param {string} appBase application base URL\n * @param {string} appBaseNoFile application base URL stripped of any filename\n * @param {string} hashPrefix hashbang prefix\n */\nfunction LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {\n  this.$$html5 = true;\n  LocationHashbangUrl.apply(this, arguments);\n\n  this.$$parseLinkUrl = function(url, relHref) {\n    if (relHref && relHref[0] === '#') {\n      // special case for links to hash fragments:\n      // keep the old url and only replace the hash fragment\n      this.hash(relHref.slice(1));\n      return true;\n    }\n\n    var rewrittenUrl;\n    var appUrl;\n\n    if (appBase == stripHash(url)) {\n      rewrittenUrl = url;\n    } else if ((appUrl = beginsWith(appBaseNoFile, url))) {\n      rewrittenUrl = appBase + hashPrefix + appUrl;\n    } else if (appBaseNoFile === url + '/') {\n      rewrittenUrl = appBaseNoFile;\n    }\n    if (rewrittenUrl) {\n      this.$$parse(rewrittenUrl);\n    }\n    return !!rewrittenUrl;\n  };\n\n  this.$$compose = function() {\n    var search = toKeyValue(this.$$search),\n        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';\n\n    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;\n    // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'\n    this.$$absUrl = appBase + hashPrefix + this.$$url;\n  };\n\n}\n\n\nvar locationPrototype = {\n\n  /**\n   * Are we in html5 mode?\n   * @private\n   */\n  $$html5: false,\n\n  /**\n   * Has any change been replacing?\n   * @private\n   */\n  $$replace: false,\n\n  /**\n   * @ngdoc method\n   * @name $location#absUrl\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return full url representation with all segments encoded according to rules specified in\n   * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var absUrl = $location.absUrl();\n   * // => \"http://example.com/#/some/path?foo=bar&baz=xoxo\"\n   * ```\n   *\n   * @return {string} full url\n   */\n  absUrl: locationGetter('$$absUrl'),\n\n  /**\n   * @ngdoc method\n   * @name $location#url\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return url (e.g. `/path?a=b#hash`) when called without any parameter.\n   *\n   * Change path, search and hash, when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var url = $location.url();\n   * // => \"/some/path?foo=bar&baz=xoxo\"\n   * ```\n   *\n   * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)\n   * @return {string} url\n   */\n  url: function(url) {\n    if (isUndefined(url)) {\n      return this.$$url;\n    }\n\n    var match = PATH_MATCH.exec(url);\n    if (match[1] || url === '') this.path(decodeURIComponent(match[1]));\n    if (match[2] || match[1] || url === '') this.search(match[3] || '');\n    this.hash(match[5] || '');\n\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#protocol\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return protocol of current url.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var protocol = $location.protocol();\n   * // => \"http\"\n   * ```\n   *\n   * @return {string} protocol of current url\n   */\n  protocol: locationGetter('$$protocol'),\n\n  /**\n   * @ngdoc method\n   * @name $location#host\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return host of current url.\n   *\n   * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var host = $location.host();\n   * // => \"example.com\"\n   *\n   * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo\n   * host = $location.host();\n   * // => \"example.com\"\n   * host = location.host;\n   * // => \"example.com:8080\"\n   * ```\n   *\n   * @return {string} host of current url.\n   */\n  host: locationGetter('$$host'),\n\n  /**\n   * @ngdoc method\n   * @name $location#port\n   *\n   * @description\n   * This method is getter only.\n   *\n   * Return port of current url.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var port = $location.port();\n   * // => 80\n   * ```\n   *\n   * @return {Number} port\n   */\n  port: locationGetter('$$port'),\n\n  /**\n   * @ngdoc method\n   * @name $location#path\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return path of current url when called without any parameter.\n   *\n   * Change path when called with parameter and return `$location`.\n   *\n   * Note: Path should always begin with forward slash (/), this method will add the forward slash\n   * if it is missing.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var path = $location.path();\n   * // => \"/some/path\"\n   * ```\n   *\n   * @param {(string|number)=} path New path\n   * @return {string} path\n   */\n  path: locationGetterSetter('$$path', function(path) {\n    path = path !== null ? path.toString() : '';\n    return path.charAt(0) == '/' ? path : '/' + path;\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#search\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return search part (as object) of current url when called without any parameter.\n   *\n   * Change search part when called with parameter and return `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo\n   * var searchObject = $location.search();\n   * // => {foo: 'bar', baz: 'xoxo'}\n   *\n   * // set foo to 'yipee'\n   * $location.search('foo', 'yipee');\n   * // $location.search() => {foo: 'yipee', baz: 'xoxo'}\n   * ```\n   *\n   * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or\n   * hash object.\n   *\n   * When called with a single argument the method acts as a setter, setting the `search` component\n   * of `$location` to the specified value.\n   *\n   * If the argument is a hash object containing an array of values, these values will be encoded\n   * as duplicate search parameters in the url.\n   *\n   * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`\n   * will override only a single search property.\n   *\n   * If `paramValue` is an array, it will override the property of the `search` component of\n   * `$location` specified via the first argument.\n   *\n   * If `paramValue` is `null`, the property specified via the first argument will be deleted.\n   *\n   * If `paramValue` is `true`, the property specified via the first argument will be added with no\n   * value nor trailing equal sign.\n   *\n   * @return {Object} If called with no arguments returns the parsed `search` object. If called with\n   * one or more arguments returns `$location` object itself.\n   */\n  search: function(search, paramValue) {\n    switch (arguments.length) {\n      case 0:\n        return this.$$search;\n      case 1:\n        if (isString(search) || isNumber(search)) {\n          search = search.toString();\n          this.$$search = parseKeyValue(search);\n        } else if (isObject(search)) {\n          search = copy(search, {});\n          // remove object undefined or null properties\n          forEach(search, function(value, key) {\n            if (value == null) delete search[key];\n          });\n\n          this.$$search = search;\n        } else {\n          throw $locationMinErr('isrcharg',\n              'The first argument of the `$location#search()` call must be a string or an object.');\n        }\n        break;\n      default:\n        if (isUndefined(paramValue) || paramValue === null) {\n          delete this.$$search[search];\n        } else {\n          this.$$search[search] = paramValue;\n        }\n    }\n\n    this.$$compose();\n    return this;\n  },\n\n  /**\n   * @ngdoc method\n   * @name $location#hash\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Returns the hash fragment when called without any parameters.\n   *\n   * Changes the hash fragment when called with a parameter and returns `$location`.\n   *\n   *\n   * ```js\n   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue\n   * var hash = $location.hash();\n   * // => \"hashValue\"\n   * ```\n   *\n   * @param {(string|number)=} hash New hash fragment\n   * @return {string} hash\n   */\n  hash: locationGetterSetter('$$hash', function(hash) {\n    return hash !== null ? hash.toString() : '';\n  }),\n\n  /**\n   * @ngdoc method\n   * @name $location#replace\n   *\n   * @description\n   * If called, all changes to $location during the current `$digest` will replace the current history\n   * record, instead of adding a new one.\n   */\n  replace: function() {\n    this.$$replace = true;\n    return this;\n  }\n};\n\nforEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {\n  Location.prototype = Object.create(locationPrototype);\n\n  /**\n   * @ngdoc method\n   * @name $location#state\n   *\n   * @description\n   * This method is getter / setter.\n   *\n   * Return the history state object when called without any parameter.\n   *\n   * Change the history state object when called with one parameter and return `$location`.\n   * The state object is later passed to `pushState` or `replaceState`.\n   *\n   * NOTE: This method is supported only in HTML5 mode and only in browsers supporting\n   * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support\n   * older browsers (like IE9 or Android < 4.0), don't use this method.\n   *\n   * @param {object=} state State object for pushState or replaceState\n   * @return {object} state\n   */\n  Location.prototype.state = function(state) {\n    if (!arguments.length) {\n      return this.$$state;\n    }\n\n    if (Location !== LocationHtml5Url || !this.$$html5) {\n      throw $locationMinErr('nostate', 'History API state support is available only ' +\n        'in HTML5 mode and only in browsers supporting HTML5 History API');\n    }\n    // The user might modify `stateObject` after invoking `$location.state(stateObject)`\n    // but we're changing the $$state reference to $browser.state() during the $digest\n    // so the modification window is narrow.\n    this.$$state = isUndefined(state) ? null : state;\n\n    return this;\n  };\n});\n\n\nfunction locationGetter(property) {\n  return function() {\n    return this[property];\n  };\n}\n\n\nfunction locationGetterSetter(property, preprocess) {\n  return function(value) {\n    if (isUndefined(value)) {\n      return this[property];\n    }\n\n    this[property] = preprocess(value);\n    this.$$compose();\n\n    return this;\n  };\n}\n\n\n/**\n * @ngdoc service\n * @name $location\n *\n * @requires $rootElement\n *\n * @description\n * The $location service parses the URL in the browser address bar (based on the\n * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL\n * available to your application. Changes to the URL in the address bar are reflected into\n * $location service and changes to $location are reflected into the browser address bar.\n *\n * **The $location service:**\n *\n * - Exposes the current URL in the browser address bar, so you can\n *   - Watch and observe the URL.\n *   - Change the URL.\n * - Synchronizes the URL with the browser when the user\n *   - Changes the address bar.\n *   - Clicks the back or forward button (or clicks a History link).\n *   - Clicks on a link.\n * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).\n *\n * For more information see {@link guide/$location Developer Guide: Using $location}\n */\n\n/**\n * @ngdoc provider\n * @name $locationProvider\n * @description\n * Use the `$locationProvider` to configure how the application deep linking paths are stored.\n */\nfunction $LocationProvider() {\n  var hashPrefix = '',\n      html5Mode = {\n        enabled: false,\n        requireBase: true,\n        rewriteLinks: true\n      };\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#hashPrefix\n   * @description\n   * @param {string=} prefix Prefix for hash part (containing path and search)\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.hashPrefix = function(prefix) {\n    if (isDefined(prefix)) {\n      hashPrefix = prefix;\n      return this;\n    } else {\n      return hashPrefix;\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $locationProvider#html5Mode\n   * @description\n   * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.\n   *   If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported\n   *   properties:\n   *   - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to\n   *     change urls where supported. Will fall back to hash-prefixed paths in browsers that do not\n   *     support `pushState`.\n   *   - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies\n   *     whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are\n   *     true, and a base tag is not present, an error will be thrown when `$location` is injected.\n   *     See the {@link guide/$location $location guide for more information}\n   *   - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,\n   *     enables/disables url rewriting for relative links.\n   *\n   * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter\n   */\n  this.html5Mode = function(mode) {\n    if (isBoolean(mode)) {\n      html5Mode.enabled = mode;\n      return this;\n    } else if (isObject(mode)) {\n\n      if (isBoolean(mode.enabled)) {\n        html5Mode.enabled = mode.enabled;\n      }\n\n      if (isBoolean(mode.requireBase)) {\n        html5Mode.requireBase = mode.requireBase;\n      }\n\n      if (isBoolean(mode.rewriteLinks)) {\n        html5Mode.rewriteLinks = mode.rewriteLinks;\n      }\n\n      return this;\n    } else {\n      return html5Mode;\n    }\n  };\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeStart\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted before a URL will change.\n   *\n   * This change can be prevented by calling\n   * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more\n   * details about event object. Upon successful change\n   * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.\n   *\n   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n   * the browser supports the HTML5 History API.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   * @param {string=} newState New history state object\n   * @param {string=} oldState History state object that was before it was changed.\n   */\n\n  /**\n   * @ngdoc event\n   * @name $location#$locationChangeSuccess\n   * @eventType broadcast on root scope\n   * @description\n   * Broadcasted after a URL was changed.\n   *\n   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when\n   * the browser supports the HTML5 History API.\n   *\n   * @param {Object} angularEvent Synthetic event object.\n   * @param {string} newUrl New URL\n   * @param {string=} oldUrl URL that was before it was changed.\n   * @param {string=} newState New history state object\n   * @param {string=} oldState History state object that was before it was changed.\n   */\n\n  this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',\n      function($rootScope, $browser, $sniffer, $rootElement, $window) {\n    var $location,\n        LocationMode,\n        baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''\n        initialUrl = $browser.url(),\n        appBase;\n\n    if (html5Mode.enabled) {\n      if (!baseHref && html5Mode.requireBase) {\n        throw $locationMinErr('nobase',\n          \"$location in HTML5 mode requires a <base> tag to be present!\");\n      }\n      appBase = serverBase(initialUrl) + (baseHref || '/');\n      LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;\n    } else {\n      appBase = stripHash(initialUrl);\n      LocationMode = LocationHashbangUrl;\n    }\n    var appBaseNoFile = stripFile(appBase);\n\n    $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);\n    $location.$$parseLinkUrl(initialUrl, initialUrl);\n\n    $location.$$state = $browser.state();\n\n    var IGNORE_URI_REGEXP = /^\\s*(javascript|mailto):/i;\n\n    function setBrowserUrlWithFallback(url, replace, state) {\n      var oldUrl = $location.url();\n      var oldState = $location.$$state;\n      try {\n        $browser.url(url, replace, state);\n\n        // Make sure $location.state() returns referentially identical (not just deeply equal)\n        // state object; this makes possible quick checking if the state changed in the digest\n        // loop. Checking deep equality would be too expensive.\n        $location.$$state = $browser.state();\n      } catch (e) {\n        // Restore old values if pushState fails\n        $location.url(oldUrl);\n        $location.$$state = oldState;\n\n        throw e;\n      }\n    }\n\n    $rootElement.on('click', function(event) {\n      // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)\n      // currently we open nice url link and redirect then\n\n      if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;\n\n      var elm = jqLite(event.target);\n\n      // traverse the DOM up to find first A tag\n      while (nodeName_(elm[0]) !== 'a') {\n        // ignore rewriting if no A tag (reached root element, or no parent - removed from document)\n        if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;\n      }\n\n      var absHref = elm.prop('href');\n      // get the actual href attribute - see\n      // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx\n      var relHref = elm.attr('href') || elm.attr('xlink:href');\n\n      if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {\n        // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during\n        // an animation.\n        absHref = urlResolve(absHref.animVal).href;\n      }\n\n      // Ignore when url is started with javascript: or mailto:\n      if (IGNORE_URI_REGEXP.test(absHref)) return;\n\n      if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {\n        if ($location.$$parseLinkUrl(absHref, relHref)) {\n          // We do a preventDefault for all urls that are part of the angular application,\n          // in html5mode and also without, so that we are able to abort navigation without\n          // getting double entries in the location history.\n          event.preventDefault();\n          // update location manually\n          if ($location.absUrl() != $browser.url()) {\n            $rootScope.$apply();\n            // hack to work around FF6 bug 684208 when scenario runner clicks on links\n            $window.angular['ff-684208-preventDefault'] = true;\n          }\n        }\n      }\n    });\n\n\n    // rewrite hashbang url <> html5 url\n    if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {\n      $browser.url($location.absUrl(), true);\n    }\n\n    var initializing = true;\n\n    // update $location when $browser url changes\n    $browser.onUrlChange(function(newUrl, newState) {\n\n      if (isUndefined(beginsWith(appBaseNoFile, newUrl))) {\n        // If we are navigating outside of the app then force a reload\n        $window.location.href = newUrl;\n        return;\n      }\n\n      $rootScope.$evalAsync(function() {\n        var oldUrl = $location.absUrl();\n        var oldState = $location.$$state;\n        var defaultPrevented;\n        newUrl = trimEmptyHash(newUrl);\n        $location.$$parse(newUrl);\n        $location.$$state = newState;\n\n        defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n            newState, oldState).defaultPrevented;\n\n        // if the location was changed by a `$locationChangeStart` handler then stop\n        // processing this location change\n        if ($location.absUrl() !== newUrl) return;\n\n        if (defaultPrevented) {\n          $location.$$parse(oldUrl);\n          $location.$$state = oldState;\n          setBrowserUrlWithFallback(oldUrl, false, oldState);\n        } else {\n          initializing = false;\n          afterLocationChange(oldUrl, oldState);\n        }\n      });\n      if (!$rootScope.$$phase) $rootScope.$digest();\n    });\n\n    // update browser\n    $rootScope.$watch(function $locationWatch() {\n      var oldUrl = trimEmptyHash($browser.url());\n      var newUrl = trimEmptyHash($location.absUrl());\n      var oldState = $browser.state();\n      var currentReplace = $location.$$replace;\n      var urlOrStateChanged = oldUrl !== newUrl ||\n        ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);\n\n      if (initializing || urlOrStateChanged) {\n        initializing = false;\n\n        $rootScope.$evalAsync(function() {\n          var newUrl = $location.absUrl();\n          var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,\n              $location.$$state, oldState).defaultPrevented;\n\n          // if the location was changed by a `$locationChangeStart` handler then stop\n          // processing this location change\n          if ($location.absUrl() !== newUrl) return;\n\n          if (defaultPrevented) {\n            $location.$$parse(oldUrl);\n            $location.$$state = oldState;\n          } else {\n            if (urlOrStateChanged) {\n              setBrowserUrlWithFallback(newUrl, currentReplace,\n                                        oldState === $location.$$state ? null : $location.$$state);\n            }\n            afterLocationChange(oldUrl, oldState);\n          }\n        });\n      }\n\n      $location.$$replace = false;\n\n      // we don't need to return anything because $evalAsync will make the digest loop dirty when\n      // there is a change\n    });\n\n    return $location;\n\n    function afterLocationChange(oldUrl, oldState) {\n      $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,\n        $location.$$state, oldState);\n    }\n}];\n}\n\n/**\n * @ngdoc service\n * @name $log\n * @requires $window\n *\n * @description\n * Simple service for logging. Default implementation safely writes the message\n * into the browser's console (if present).\n *\n * The main purpose of this service is to simplify debugging and troubleshooting.\n *\n * The default is to log `debug` messages. You can use\n * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.\n *\n * @example\n   <example module=\"logExample\">\n     <file name=\"script.js\">\n       angular.module('logExample', [])\n         .controller('LogController', ['$scope', '$log', function($scope, $log) {\n           $scope.$log = $log;\n           $scope.message = 'Hello World!';\n         }]);\n     </file>\n     <file name=\"index.html\">\n       <div ng-controller=\"LogController\">\n         <p>Reload this page with open console, enter text and hit the log button...</p>\n         <label>Message:\n         <input type=\"text\" ng-model=\"message\" /></label>\n         <button ng-click=\"$log.log(message)\">log</button>\n         <button ng-click=\"$log.warn(message)\">warn</button>\n         <button ng-click=\"$log.info(message)\">info</button>\n         <button ng-click=\"$log.error(message)\">error</button>\n         <button ng-click=\"$log.debug(message)\">debug</button>\n       </div>\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc provider\n * @name $logProvider\n * @description\n * Use the `$logProvider` to configure how the application logs messages\n */\nfunction $LogProvider() {\n  var debug = true,\n      self = this;\n\n  /**\n   * @ngdoc method\n   * @name $logProvider#debugEnabled\n   * @description\n   * @param {boolean=} flag enable or disable debug level messages\n   * @returns {*} current value if used as getter or itself (chaining) if used as setter\n   */\n  this.debugEnabled = function(flag) {\n    if (isDefined(flag)) {\n      debug = flag;\n    return this;\n    } else {\n      return debug;\n    }\n  };\n\n  this.$get = ['$window', function($window) {\n    return {\n      /**\n       * @ngdoc method\n       * @name $log#log\n       *\n       * @description\n       * Write a log message\n       */\n      log: consoleLog('log'),\n\n      /**\n       * @ngdoc method\n       * @name $log#info\n       *\n       * @description\n       * Write an information message\n       */\n      info: consoleLog('info'),\n\n      /**\n       * @ngdoc method\n       * @name $log#warn\n       *\n       * @description\n       * Write a warning message\n       */\n      warn: consoleLog('warn'),\n\n      /**\n       * @ngdoc method\n       * @name $log#error\n       *\n       * @description\n       * Write an error message\n       */\n      error: consoleLog('error'),\n\n      /**\n       * @ngdoc method\n       * @name $log#debug\n       *\n       * @description\n       * Write a debug message\n       */\n      debug: (function() {\n        var fn = consoleLog('debug');\n\n        return function() {\n          if (debug) {\n            fn.apply(self, arguments);\n          }\n        };\n      }())\n    };\n\n    function formatError(arg) {\n      if (arg instanceof Error) {\n        if (arg.stack) {\n          arg = (arg.message && arg.stack.indexOf(arg.message) === -1)\n              ? 'Error: ' + arg.message + '\\n' + arg.stack\n              : arg.stack;\n        } else if (arg.sourceURL) {\n          arg = arg.message + '\\n' + arg.sourceURL + ':' + arg.line;\n        }\n      }\n      return arg;\n    }\n\n    function consoleLog(type) {\n      var console = $window.console || {},\n          logFn = console[type] || console.log || noop,\n          hasApply = false;\n\n      // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.\n      // The reason behind this is that console.log has type \"object\" in IE8...\n      try {\n        hasApply = !!logFn.apply;\n      } catch (e) {}\n\n      if (hasApply) {\n        return function() {\n          var args = [];\n          forEach(arguments, function(arg) {\n            args.push(formatError(arg));\n          });\n          return logFn.apply(console, args);\n        };\n      }\n\n      // we are IE which either doesn't have window.console => this is noop and we do nothing,\n      // or we are IE where console.log doesn't have apply so we log at least first 2 args\n      return function(arg1, arg2) {\n        logFn(arg1, arg2 == null ? '' : arg2);\n      };\n    }\n  }];\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $parseMinErr = minErr('$parse');\n\n// Sandboxing Angular Expressions\n// ------------------------------\n// Angular expressions are generally considered safe because these expressions only have direct\n// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by\n// obtaining a reference to native JS functions such as the Function constructor.\n//\n// As an example, consider the following Angular expression:\n//\n//   {}.toString.constructor('alert(\"evil JS code\")')\n//\n// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits\n// against the expression language, but not to prevent exploits that were enabled by exposing\n// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good\n// practice and therefore we are not even trying to protect against interaction with an object\n// explicitly exposed in this way.\n//\n// In general, it is not possible to access a Window object from an angular expression unless a\n// window or some DOM object that has a reference to window is published onto a Scope.\n// Similarly we prevent invocations of function known to be dangerous, as well as assignments to\n// native objects.\n//\n// See https://docs.angularjs.org/guide/security\n\n\nfunction ensureSafeMemberName(name, fullExpression) {\n  if (name === \"__defineGetter__\" || name === \"__defineSetter__\"\n      || name === \"__lookupGetter__\" || name === \"__lookupSetter__\"\n      || name === \"__proto__\") {\n    throw $parseMinErr('isecfld',\n        'Attempting to access a disallowed field in Angular expressions! '\n        + 'Expression: {0}', fullExpression);\n  }\n  return name;\n}\n\nfunction getStringValue(name) {\n  // Property names must be strings. This means that non-string objects cannot be used\n  // as keys in an object. Any non-string object, including a number, is typecasted\n  // into a string via the toString method.\n  // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names\n  //\n  // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it\n  // to a string. It's not always possible. If `name` is an object and its `toString` method is\n  // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown:\n  //\n  // TypeError: Cannot convert object to primitive value\n  //\n  // For performance reasons, we don't catch this error here and allow it to propagate up the call\n  // stack. Note that you'll get the same error in JavaScript if you try to access a property using\n  // such a 'broken' object as a key.\n  return name + '';\n}\n\nfunction ensureSafeObject(obj, fullExpression) {\n  // nifty check if obj is Function that is fast and works across iframes and other contexts\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n          'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isWindow(obj)\n        obj.window === obj) {\n      throw $parseMinErr('isecwindow',\n          'Referencing the Window in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// isElement(obj)\n        obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {\n      throw $parseMinErr('isecdom',\n          'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    } else if (// block Object so that we can't get hold of dangerous Object.* methods\n        obj === Object) {\n      throw $parseMinErr('isecobj',\n          'Referencing Object in Angular expressions is disallowed! Expression: {0}',\n          fullExpression);\n    }\n  }\n  return obj;\n}\n\nvar CALL = Function.prototype.call;\nvar APPLY = Function.prototype.apply;\nvar BIND = Function.prototype.bind;\n\nfunction ensureSafeFunction(obj, fullExpression) {\n  if (obj) {\n    if (obj.constructor === obj) {\n      throw $parseMinErr('isecfn',\n        'Referencing Function in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    } else if (obj === CALL || obj === APPLY || obj === BIND) {\n      throw $parseMinErr('isecff',\n        'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',\n        fullExpression);\n    }\n  }\n}\n\nfunction ensureSafeAssignContext(obj, fullExpression) {\n  if (obj) {\n    if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||\n        obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {\n      throw $parseMinErr('isecaf',\n        'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);\n    }\n  }\n}\n\nvar OPERATORS = createMap();\nforEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });\nvar ESCAPE = {\"n\":\"\\n\", \"f\":\"\\f\", \"r\":\"\\r\", \"t\":\"\\t\", \"v\":\"\\v\", \"'\":\"'\", '\"':'\"'};\n\n\n/////////////////////////////////////////\n\n\n/**\n * @constructor\n */\nvar Lexer = function(options) {\n  this.options = options;\n};\n\nLexer.prototype = {\n  constructor: Lexer,\n\n  lex: function(text) {\n    this.text = text;\n    this.index = 0;\n    this.tokens = [];\n\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      if (ch === '\"' || ch === \"'\") {\n        this.readString(ch);\n      } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {\n        this.readNumber();\n      } else if (this.isIdent(ch)) {\n        this.readIdent();\n      } else if (this.is(ch, '(){}[].,;:?')) {\n        this.tokens.push({index: this.index, text: ch});\n        this.index++;\n      } else if (this.isWhitespace(ch)) {\n        this.index++;\n      } else {\n        var ch2 = ch + this.peek();\n        var ch3 = ch2 + this.peek(2);\n        var op1 = OPERATORS[ch];\n        var op2 = OPERATORS[ch2];\n        var op3 = OPERATORS[ch3];\n        if (op1 || op2 || op3) {\n          var token = op3 ? ch3 : (op2 ? ch2 : ch);\n          this.tokens.push({index: this.index, text: token, operator: true});\n          this.index += token.length;\n        } else {\n          this.throwError('Unexpected next character ', this.index, this.index + 1);\n        }\n      }\n    }\n    return this.tokens;\n  },\n\n  is: function(ch, chars) {\n    return chars.indexOf(ch) !== -1;\n  },\n\n  peek: function(i) {\n    var num = i || 1;\n    return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;\n  },\n\n  isNumber: function(ch) {\n    return ('0' <= ch && ch <= '9') && typeof ch === \"string\";\n  },\n\n  isWhitespace: function(ch) {\n    // IE treats non-breaking space as \\u00A0\n    return (ch === ' ' || ch === '\\r' || ch === '\\t' ||\n            ch === '\\n' || ch === '\\v' || ch === '\\u00A0');\n  },\n\n  isIdent: function(ch) {\n    return ('a' <= ch && ch <= 'z' ||\n            'A' <= ch && ch <= 'Z' ||\n            '_' === ch || ch === '$');\n  },\n\n  isExpOperator: function(ch) {\n    return (ch === '-' || ch === '+' || this.isNumber(ch));\n  },\n\n  throwError: function(error, start, end) {\n    end = end || this.index;\n    var colStr = (isDefined(start)\n            ? 's ' + start +  '-' + this.index + ' [' + this.text.substring(start, end) + ']'\n            : ' ' + end);\n    throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',\n        error, colStr, this.text);\n  },\n\n  readNumber: function() {\n    var number = '';\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = lowercase(this.text.charAt(this.index));\n      if (ch == '.' || this.isNumber(ch)) {\n        number += ch;\n      } else {\n        var peekCh = this.peek();\n        if (ch == 'e' && this.isExpOperator(peekCh)) {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            peekCh && this.isNumber(peekCh) &&\n            number.charAt(number.length - 1) == 'e') {\n          number += ch;\n        } else if (this.isExpOperator(ch) &&\n            (!peekCh || !this.isNumber(peekCh)) &&\n            number.charAt(number.length - 1) == 'e') {\n          this.throwError('Invalid exponent');\n        } else {\n          break;\n        }\n      }\n      this.index++;\n    }\n    this.tokens.push({\n      index: start,\n      text: number,\n      constant: true,\n      value: Number(number)\n    });\n  },\n\n  readIdent: function() {\n    var start = this.index;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      if (!(this.isIdent(ch) || this.isNumber(ch))) {\n        break;\n      }\n      this.index++;\n    }\n    this.tokens.push({\n      index: start,\n      text: this.text.slice(start, this.index),\n      identifier: true\n    });\n  },\n\n  readString: function(quote) {\n    var start = this.index;\n    this.index++;\n    var string = '';\n    var rawString = quote;\n    var escape = false;\n    while (this.index < this.text.length) {\n      var ch = this.text.charAt(this.index);\n      rawString += ch;\n      if (escape) {\n        if (ch === 'u') {\n          var hex = this.text.substring(this.index + 1, this.index + 5);\n          if (!hex.match(/[\\da-f]{4}/i)) {\n            this.throwError('Invalid unicode escape [\\\\u' + hex + ']');\n          }\n          this.index += 4;\n          string += String.fromCharCode(parseInt(hex, 16));\n        } else {\n          var rep = ESCAPE[ch];\n          string = string + (rep || ch);\n        }\n        escape = false;\n      } else if (ch === '\\\\') {\n        escape = true;\n      } else if (ch === quote) {\n        this.index++;\n        this.tokens.push({\n          index: start,\n          text: rawString,\n          constant: true,\n          value: string\n        });\n        return;\n      } else {\n        string += ch;\n      }\n      this.index++;\n    }\n    this.throwError('Unterminated quote', start);\n  }\n};\n\nvar AST = function(lexer, options) {\n  this.lexer = lexer;\n  this.options = options;\n};\n\nAST.Program = 'Program';\nAST.ExpressionStatement = 'ExpressionStatement';\nAST.AssignmentExpression = 'AssignmentExpression';\nAST.ConditionalExpression = 'ConditionalExpression';\nAST.LogicalExpression = 'LogicalExpression';\nAST.BinaryExpression = 'BinaryExpression';\nAST.UnaryExpression = 'UnaryExpression';\nAST.CallExpression = 'CallExpression';\nAST.MemberExpression = 'MemberExpression';\nAST.Identifier = 'Identifier';\nAST.Literal = 'Literal';\nAST.ArrayExpression = 'ArrayExpression';\nAST.Property = 'Property';\nAST.ObjectExpression = 'ObjectExpression';\nAST.ThisExpression = 'ThisExpression';\nAST.LocalsExpression = 'LocalsExpression';\n\n// Internal use only\nAST.NGValueParameter = 'NGValueParameter';\n\nAST.prototype = {\n  ast: function(text) {\n    this.text = text;\n    this.tokens = this.lexer.lex(text);\n\n    var value = this.program();\n\n    if (this.tokens.length !== 0) {\n      this.throwError('is an unexpected token', this.tokens[0]);\n    }\n\n    return value;\n  },\n\n  program: function() {\n    var body = [];\n    while (true) {\n      if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))\n        body.push(this.expressionStatement());\n      if (!this.expect(';')) {\n        return { type: AST.Program, body: body};\n      }\n    }\n  },\n\n  expressionStatement: function() {\n    return { type: AST.ExpressionStatement, expression: this.filterChain() };\n  },\n\n  filterChain: function() {\n    var left = this.expression();\n    var token;\n    while ((token = this.expect('|'))) {\n      left = this.filter(left);\n    }\n    return left;\n  },\n\n  expression: function() {\n    return this.assignment();\n  },\n\n  assignment: function() {\n    var result = this.ternary();\n    if (this.expect('=')) {\n      result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};\n    }\n    return result;\n  },\n\n  ternary: function() {\n    var test = this.logicalOR();\n    var alternate;\n    var consequent;\n    if (this.expect('?')) {\n      alternate = this.expression();\n      if (this.consume(':')) {\n        consequent = this.expression();\n        return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};\n      }\n    }\n    return test;\n  },\n\n  logicalOR: function() {\n    var left = this.logicalAND();\n    while (this.expect('||')) {\n      left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };\n    }\n    return left;\n  },\n\n  logicalAND: function() {\n    var left = this.equality();\n    while (this.expect('&&')) {\n      left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};\n    }\n    return left;\n  },\n\n  equality: function() {\n    var left = this.relational();\n    var token;\n    while ((token = this.expect('==','!=','===','!=='))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };\n    }\n    return left;\n  },\n\n  relational: function() {\n    var left = this.additive();\n    var token;\n    while ((token = this.expect('<', '>', '<=', '>='))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };\n    }\n    return left;\n  },\n\n  additive: function() {\n    var left = this.multiplicative();\n    var token;\n    while ((token = this.expect('+','-'))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };\n    }\n    return left;\n  },\n\n  multiplicative: function() {\n    var left = this.unary();\n    var token;\n    while ((token = this.expect('*','/','%'))) {\n      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };\n    }\n    return left;\n  },\n\n  unary: function() {\n    var token;\n    if ((token = this.expect('+', '-', '!'))) {\n      return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };\n    } else {\n      return this.primary();\n    }\n  },\n\n  primary: function() {\n    var primary;\n    if (this.expect('(')) {\n      primary = this.filterChain();\n      this.consume(')');\n    } else if (this.expect('[')) {\n      primary = this.arrayDeclaration();\n    } else if (this.expect('{')) {\n      primary = this.object();\n    } else if (this.selfReferential.hasOwnProperty(this.peek().text)) {\n      primary = copy(this.selfReferential[this.consume().text]);\n    } else if (this.options.literals.hasOwnProperty(this.peek().text)) {\n      primary = { type: AST.Literal, value: this.options.literals[this.consume().text]};\n    } else if (this.peek().identifier) {\n      primary = this.identifier();\n    } else if (this.peek().constant) {\n      primary = this.constant();\n    } else {\n      this.throwError('not a primary expression', this.peek());\n    }\n\n    var next;\n    while ((next = this.expect('(', '[', '.'))) {\n      if (next.text === '(') {\n        primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };\n        this.consume(')');\n      } else if (next.text === '[') {\n        primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };\n        this.consume(']');\n      } else if (next.text === '.') {\n        primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };\n      } else {\n        this.throwError('IMPOSSIBLE');\n      }\n    }\n    return primary;\n  },\n\n  filter: function(baseExpression) {\n    var args = [baseExpression];\n    var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};\n\n    while (this.expect(':')) {\n      args.push(this.expression());\n    }\n\n    return result;\n  },\n\n  parseArguments: function() {\n    var args = [];\n    if (this.peekToken().text !== ')') {\n      do {\n        args.push(this.expression());\n      } while (this.expect(','));\n    }\n    return args;\n  },\n\n  identifier: function() {\n    var token = this.consume();\n    if (!token.identifier) {\n      this.throwError('is not a valid identifier', token);\n    }\n    return { type: AST.Identifier, name: token.text };\n  },\n\n  constant: function() {\n    // TODO check that it is a constant\n    return { type: AST.Literal, value: this.consume().value };\n  },\n\n  arrayDeclaration: function() {\n    var elements = [];\n    if (this.peekToken().text !== ']') {\n      do {\n        if (this.peek(']')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        elements.push(this.expression());\n      } while (this.expect(','));\n    }\n    this.consume(']');\n\n    return { type: AST.ArrayExpression, elements: elements };\n  },\n\n  object: function() {\n    var properties = [], property;\n    if (this.peekToken().text !== '}') {\n      do {\n        if (this.peek('}')) {\n          // Support trailing commas per ES5.1.\n          break;\n        }\n        property = {type: AST.Property, kind: 'init'};\n        if (this.peek().constant) {\n          property.key = this.constant();\n        } else if (this.peek().identifier) {\n          property.key = this.identifier();\n        } else {\n          this.throwError(\"invalid key\", this.peek());\n        }\n        this.consume(':');\n        property.value = this.expression();\n        properties.push(property);\n      } while (this.expect(','));\n    }\n    this.consume('}');\n\n    return {type: AST.ObjectExpression, properties: properties };\n  },\n\n  throwError: function(msg, token) {\n    throw $parseMinErr('syntax',\n        'Syntax Error: Token \\'{0}\\' {1} at column {2} of the expression [{3}] starting at [{4}].',\n          token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));\n  },\n\n  consume: function(e1) {\n    if (this.tokens.length === 0) {\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    }\n\n    var token = this.expect(e1);\n    if (!token) {\n      this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());\n    }\n    return token;\n  },\n\n  peekToken: function() {\n    if (this.tokens.length === 0) {\n      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);\n    }\n    return this.tokens[0];\n  },\n\n  peek: function(e1, e2, e3, e4) {\n    return this.peekAhead(0, e1, e2, e3, e4);\n  },\n\n  peekAhead: function(i, e1, e2, e3, e4) {\n    if (this.tokens.length > i) {\n      var token = this.tokens[i];\n      var t = token.text;\n      if (t === e1 || t === e2 || t === e3 || t === e4 ||\n          (!e1 && !e2 && !e3 && !e4)) {\n        return token;\n      }\n    }\n    return false;\n  },\n\n  expect: function(e1, e2, e3, e4) {\n    var token = this.peek(e1, e2, e3, e4);\n    if (token) {\n      this.tokens.shift();\n      return token;\n    }\n    return false;\n  },\n\n  selfReferential: {\n    'this': {type: AST.ThisExpression },\n    '$locals': {type: AST.LocalsExpression }\n  }\n};\n\nfunction ifDefined(v, d) {\n  return typeof v !== 'undefined' ? v : d;\n}\n\nfunction plusFn(l, r) {\n  if (typeof l === 'undefined') return r;\n  if (typeof r === 'undefined') return l;\n  return l + r;\n}\n\nfunction isStateless($filter, filterName) {\n  var fn = $filter(filterName);\n  return !fn.$stateful;\n}\n\nfunction findConstantAndWatchExpressions(ast, $filter) {\n  var allConstants;\n  var argsToWatch;\n  switch (ast.type) {\n  case AST.Program:\n    allConstants = true;\n    forEach(ast.body, function(expr) {\n      findConstantAndWatchExpressions(expr.expression, $filter);\n      allConstants = allConstants && expr.expression.constant;\n    });\n    ast.constant = allConstants;\n    break;\n  case AST.Literal:\n    ast.constant = true;\n    ast.toWatch = [];\n    break;\n  case AST.UnaryExpression:\n    findConstantAndWatchExpressions(ast.argument, $filter);\n    ast.constant = ast.argument.constant;\n    ast.toWatch = ast.argument.toWatch;\n    break;\n  case AST.BinaryExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);\n    break;\n  case AST.LogicalExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = ast.constant ? [] : [ast];\n    break;\n  case AST.ConditionalExpression:\n    findConstantAndWatchExpressions(ast.test, $filter);\n    findConstantAndWatchExpressions(ast.alternate, $filter);\n    findConstantAndWatchExpressions(ast.consequent, $filter);\n    ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;\n    ast.toWatch = ast.constant ? [] : [ast];\n    break;\n  case AST.Identifier:\n    ast.constant = false;\n    ast.toWatch = [ast];\n    break;\n  case AST.MemberExpression:\n    findConstantAndWatchExpressions(ast.object, $filter);\n    if (ast.computed) {\n      findConstantAndWatchExpressions(ast.property, $filter);\n    }\n    ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);\n    ast.toWatch = [ast];\n    break;\n  case AST.CallExpression:\n    allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;\n    argsToWatch = [];\n    forEach(ast.arguments, function(expr) {\n      findConstantAndWatchExpressions(expr, $filter);\n      allConstants = allConstants && expr.constant;\n      if (!expr.constant) {\n        argsToWatch.push.apply(argsToWatch, expr.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];\n    break;\n  case AST.AssignmentExpression:\n    findConstantAndWatchExpressions(ast.left, $filter);\n    findConstantAndWatchExpressions(ast.right, $filter);\n    ast.constant = ast.left.constant && ast.right.constant;\n    ast.toWatch = [ast];\n    break;\n  case AST.ArrayExpression:\n    allConstants = true;\n    argsToWatch = [];\n    forEach(ast.elements, function(expr) {\n      findConstantAndWatchExpressions(expr, $filter);\n      allConstants = allConstants && expr.constant;\n      if (!expr.constant) {\n        argsToWatch.push.apply(argsToWatch, expr.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = argsToWatch;\n    break;\n  case AST.ObjectExpression:\n    allConstants = true;\n    argsToWatch = [];\n    forEach(ast.properties, function(property) {\n      findConstantAndWatchExpressions(property.value, $filter);\n      allConstants = allConstants && property.value.constant;\n      if (!property.value.constant) {\n        argsToWatch.push.apply(argsToWatch, property.value.toWatch);\n      }\n    });\n    ast.constant = allConstants;\n    ast.toWatch = argsToWatch;\n    break;\n  case AST.ThisExpression:\n    ast.constant = false;\n    ast.toWatch = [];\n    break;\n  case AST.LocalsExpression:\n    ast.constant = false;\n    ast.toWatch = [];\n    break;\n  }\n}\n\nfunction getInputs(body) {\n  if (body.length != 1) return;\n  var lastExpression = body[0].expression;\n  var candidate = lastExpression.toWatch;\n  if (candidate.length !== 1) return candidate;\n  return candidate[0] !== lastExpression ? candidate : undefined;\n}\n\nfunction isAssignable(ast) {\n  return ast.type === AST.Identifier || ast.type === AST.MemberExpression;\n}\n\nfunction assignableAST(ast) {\n  if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {\n    return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};\n  }\n}\n\nfunction isLiteral(ast) {\n  return ast.body.length === 0 ||\n      ast.body.length === 1 && (\n      ast.body[0].expression.type === AST.Literal ||\n      ast.body[0].expression.type === AST.ArrayExpression ||\n      ast.body[0].expression.type === AST.ObjectExpression);\n}\n\nfunction isConstant(ast) {\n  return ast.constant;\n}\n\nfunction ASTCompiler(astBuilder, $filter) {\n  this.astBuilder = astBuilder;\n  this.$filter = $filter;\n}\n\nASTCompiler.prototype = {\n  compile: function(expression, expensiveChecks) {\n    var self = this;\n    var ast = this.astBuilder.ast(expression);\n    this.state = {\n      nextId: 0,\n      filters: {},\n      expensiveChecks: expensiveChecks,\n      fn: {vars: [], body: [], own: {}},\n      assign: {vars: [], body: [], own: {}},\n      inputs: []\n    };\n    findConstantAndWatchExpressions(ast, self.$filter);\n    var extra = '';\n    var assignable;\n    this.stage = 'assign';\n    if ((assignable = assignableAST(ast))) {\n      this.state.computing = 'assign';\n      var result = this.nextId();\n      this.recurse(assignable, result);\n      this.return_(result);\n      extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');\n    }\n    var toWatch = getInputs(ast.body);\n    self.stage = 'inputs';\n    forEach(toWatch, function(watch, key) {\n      var fnKey = 'fn' + key;\n      self.state[fnKey] = {vars: [], body: [], own: {}};\n      self.state.computing = fnKey;\n      var intoId = self.nextId();\n      self.recurse(watch, intoId);\n      self.return_(intoId);\n      self.state.inputs.push(fnKey);\n      watch.watchId = key;\n    });\n    this.state.computing = 'fn';\n    this.stage = 'main';\n    this.recurse(ast);\n    var fnString =\n      // The build and minification steps remove the string \"use strict\" from the code, but this is done using a regex.\n      // This is a workaround for this until we do a better job at only removing the prefix only when we should.\n      '\"' + this.USE + ' ' + this.STRICT + '\";\\n' +\n      this.filterPrefix() +\n      'var fn=' + this.generateFunction('fn', 's,l,a,i') +\n      extra +\n      this.watchFns() +\n      'return fn;';\n\n    /* jshint -W054 */\n    var fn = (new Function('$filter',\n        'ensureSafeMemberName',\n        'ensureSafeObject',\n        'ensureSafeFunction',\n        'getStringValue',\n        'ensureSafeAssignContext',\n        'ifDefined',\n        'plus',\n        'text',\n        fnString))(\n          this.$filter,\n          ensureSafeMemberName,\n          ensureSafeObject,\n          ensureSafeFunction,\n          getStringValue,\n          ensureSafeAssignContext,\n          ifDefined,\n          plusFn,\n          expression);\n    /* jshint +W054 */\n    this.state = this.stage = undefined;\n    fn.literal = isLiteral(ast);\n    fn.constant = isConstant(ast);\n    return fn;\n  },\n\n  USE: 'use',\n\n  STRICT: 'strict',\n\n  watchFns: function() {\n    var result = [];\n    var fns = this.state.inputs;\n    var self = this;\n    forEach(fns, function(name) {\n      result.push('var ' + name + '=' + self.generateFunction(name, 's'));\n    });\n    if (fns.length) {\n      result.push('fn.inputs=[' + fns.join(',') + '];');\n    }\n    return result.join('');\n  },\n\n  generateFunction: function(name, params) {\n    return 'function(' + params + '){' +\n        this.varsPrefix(name) +\n        this.body(name) +\n        '};';\n  },\n\n  filterPrefix: function() {\n    var parts = [];\n    var self = this;\n    forEach(this.state.filters, function(id, filter) {\n      parts.push(id + '=$filter(' + self.escape(filter) + ')');\n    });\n    if (parts.length) return 'var ' + parts.join(',') + ';';\n    return '';\n  },\n\n  varsPrefix: function(section) {\n    return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';\n  },\n\n  body: function(section) {\n    return this.state[section].body.join('');\n  },\n\n  recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n    var left, right, self = this, args, expression;\n    recursionFn = recursionFn || noop;\n    if (!skipWatchIdCheck && isDefined(ast.watchId)) {\n      intoId = intoId || this.nextId();\n      this.if_('i',\n        this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),\n        this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)\n      );\n      return;\n    }\n    switch (ast.type) {\n    case AST.Program:\n      forEach(ast.body, function(expression, pos) {\n        self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });\n        if (pos !== ast.body.length - 1) {\n          self.current().body.push(right, ';');\n        } else {\n          self.return_(right);\n        }\n      });\n      break;\n    case AST.Literal:\n      expression = this.escape(ast.value);\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.UnaryExpression:\n      this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });\n      expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.BinaryExpression:\n      this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });\n      this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });\n      if (ast.operator === '+') {\n        expression = this.plus(left, right);\n      } else if (ast.operator === '-') {\n        expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);\n      } else {\n        expression = '(' + left + ')' + ast.operator + '(' + right + ')';\n      }\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.LogicalExpression:\n      intoId = intoId || this.nextId();\n      self.recurse(ast.left, intoId);\n      self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));\n      recursionFn(intoId);\n      break;\n    case AST.ConditionalExpression:\n      intoId = intoId || this.nextId();\n      self.recurse(ast.test, intoId);\n      self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));\n      recursionFn(intoId);\n      break;\n    case AST.Identifier:\n      intoId = intoId || this.nextId();\n      if (nameId) {\n        nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');\n        nameId.computed = false;\n        nameId.name = ast.name;\n      }\n      ensureSafeMemberName(ast.name);\n      self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),\n        function() {\n          self.if_(self.stage === 'inputs' || 's', function() {\n            if (create && create !== 1) {\n              self.if_(\n                self.not(self.nonComputedMember('s', ast.name)),\n                self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));\n            }\n            self.assign(intoId, self.nonComputedMember('s', ast.name));\n          });\n        }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))\n        );\n      if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {\n        self.addEnsureSafeObject(intoId);\n      }\n      recursionFn(intoId);\n      break;\n    case AST.MemberExpression:\n      left = nameId && (nameId.context = this.nextId()) || this.nextId();\n      intoId = intoId || this.nextId();\n      self.recurse(ast.object, left, undefined, function() {\n        self.if_(self.notNull(left), function() {\n          if (create && create !== 1) {\n            self.addEnsureSafeAssignContext(left);\n          }\n          if (ast.computed) {\n            right = self.nextId();\n            self.recurse(ast.property, right);\n            self.getStringValue(right);\n            self.addEnsureSafeMemberName(right);\n            if (create && create !== 1) {\n              self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));\n            }\n            expression = self.ensureSafeObject(self.computedMember(left, right));\n            self.assign(intoId, expression);\n            if (nameId) {\n              nameId.computed = true;\n              nameId.name = right;\n            }\n          } else {\n            ensureSafeMemberName(ast.property.name);\n            if (create && create !== 1) {\n              self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));\n            }\n            expression = self.nonComputedMember(left, ast.property.name);\n            if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {\n              expression = self.ensureSafeObject(expression);\n            }\n            self.assign(intoId, expression);\n            if (nameId) {\n              nameId.computed = false;\n              nameId.name = ast.property.name;\n            }\n          }\n        }, function() {\n          self.assign(intoId, 'undefined');\n        });\n        recursionFn(intoId);\n      }, !!create);\n      break;\n    case AST.CallExpression:\n      intoId = intoId || this.nextId();\n      if (ast.filter) {\n        right = self.filter(ast.callee.name);\n        args = [];\n        forEach(ast.arguments, function(expr) {\n          var argument = self.nextId();\n          self.recurse(expr, argument);\n          args.push(argument);\n        });\n        expression = right + '(' + args.join(',') + ')';\n        self.assign(intoId, expression);\n        recursionFn(intoId);\n      } else {\n        right = self.nextId();\n        left = {};\n        args = [];\n        self.recurse(ast.callee, right, left, function() {\n          self.if_(self.notNull(right), function() {\n            self.addEnsureSafeFunction(right);\n            forEach(ast.arguments, function(expr) {\n              self.recurse(expr, self.nextId(), undefined, function(argument) {\n                args.push(self.ensureSafeObject(argument));\n              });\n            });\n            if (left.name) {\n              if (!self.state.expensiveChecks) {\n                self.addEnsureSafeObject(left.context);\n              }\n              expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';\n            } else {\n              expression = right + '(' + args.join(',') + ')';\n            }\n            expression = self.ensureSafeObject(expression);\n            self.assign(intoId, expression);\n          }, function() {\n            self.assign(intoId, 'undefined');\n          });\n          recursionFn(intoId);\n        });\n      }\n      break;\n    case AST.AssignmentExpression:\n      right = this.nextId();\n      left = {};\n      if (!isAssignable(ast.left)) {\n        throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');\n      }\n      this.recurse(ast.left, undefined, left, function() {\n        self.if_(self.notNull(left.context), function() {\n          self.recurse(ast.right, right);\n          self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));\n          self.addEnsureSafeAssignContext(left.context);\n          expression = self.member(left.context, left.name, left.computed) + ast.operator + right;\n          self.assign(intoId, expression);\n          recursionFn(intoId || expression);\n        });\n      }, 1);\n      break;\n    case AST.ArrayExpression:\n      args = [];\n      forEach(ast.elements, function(expr) {\n        self.recurse(expr, self.nextId(), undefined, function(argument) {\n          args.push(argument);\n        });\n      });\n      expression = '[' + args.join(',') + ']';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.ObjectExpression:\n      args = [];\n      forEach(ast.properties, function(property) {\n        self.recurse(property.value, self.nextId(), undefined, function(expr) {\n          args.push(self.escape(\n              property.key.type === AST.Identifier ? property.key.name :\n                ('' + property.key.value)) +\n              ':' + expr);\n        });\n      });\n      expression = '{' + args.join(',') + '}';\n      this.assign(intoId, expression);\n      recursionFn(expression);\n      break;\n    case AST.ThisExpression:\n      this.assign(intoId, 's');\n      recursionFn('s');\n      break;\n    case AST.LocalsExpression:\n      this.assign(intoId, 'l');\n      recursionFn('l');\n      break;\n    case AST.NGValueParameter:\n      this.assign(intoId, 'v');\n      recursionFn('v');\n      break;\n    }\n  },\n\n  getHasOwnProperty: function(element, property) {\n    var key = element + '.' + property;\n    var own = this.current().own;\n    if (!own.hasOwnProperty(key)) {\n      own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');\n    }\n    return own[key];\n  },\n\n  assign: function(id, value) {\n    if (!id) return;\n    this.current().body.push(id, '=', value, ';');\n    return id;\n  },\n\n  filter: function(filterName) {\n    if (!this.state.filters.hasOwnProperty(filterName)) {\n      this.state.filters[filterName] = this.nextId(true);\n    }\n    return this.state.filters[filterName];\n  },\n\n  ifDefined: function(id, defaultValue) {\n    return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';\n  },\n\n  plus: function(left, right) {\n    return 'plus(' + left + ',' + right + ')';\n  },\n\n  return_: function(id) {\n    this.current().body.push('return ', id, ';');\n  },\n\n  if_: function(test, alternate, consequent) {\n    if (test === true) {\n      alternate();\n    } else {\n      var body = this.current().body;\n      body.push('if(', test, '){');\n      alternate();\n      body.push('}');\n      if (consequent) {\n        body.push('else{');\n        consequent();\n        body.push('}');\n      }\n    }\n  },\n\n  not: function(expression) {\n    return '!(' + expression + ')';\n  },\n\n  notNull: function(expression) {\n    return expression + '!=null';\n  },\n\n  nonComputedMember: function(left, right) {\n    return left + '.' + right;\n  },\n\n  computedMember: function(left, right) {\n    return left + '[' + right + ']';\n  },\n\n  member: function(left, right, computed) {\n    if (computed) return this.computedMember(left, right);\n    return this.nonComputedMember(left, right);\n  },\n\n  addEnsureSafeObject: function(item) {\n    this.current().body.push(this.ensureSafeObject(item), ';');\n  },\n\n  addEnsureSafeMemberName: function(item) {\n    this.current().body.push(this.ensureSafeMemberName(item), ';');\n  },\n\n  addEnsureSafeFunction: function(item) {\n    this.current().body.push(this.ensureSafeFunction(item), ';');\n  },\n\n  addEnsureSafeAssignContext: function(item) {\n    this.current().body.push(this.ensureSafeAssignContext(item), ';');\n  },\n\n  ensureSafeObject: function(item) {\n    return 'ensureSafeObject(' + item + ',text)';\n  },\n\n  ensureSafeMemberName: function(item) {\n    return 'ensureSafeMemberName(' + item + ',text)';\n  },\n\n  ensureSafeFunction: function(item) {\n    return 'ensureSafeFunction(' + item + ',text)';\n  },\n\n  getStringValue: function(item) {\n    this.assign(item, 'getStringValue(' + item + ')');\n  },\n\n  ensureSafeAssignContext: function(item) {\n    return 'ensureSafeAssignContext(' + item + ',text)';\n  },\n\n  lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {\n    var self = this;\n    return function() {\n      self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);\n    };\n  },\n\n  lazyAssign: function(id, value) {\n    var self = this;\n    return function() {\n      self.assign(id, value);\n    };\n  },\n\n  stringEscapeRegex: /[^ a-zA-Z0-9]/g,\n\n  stringEscapeFn: function(c) {\n    return '\\\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);\n  },\n\n  escape: function(value) {\n    if (isString(value)) return \"'\" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + \"'\";\n    if (isNumber(value)) return value.toString();\n    if (value === true) return 'true';\n    if (value === false) return 'false';\n    if (value === null) return 'null';\n    if (typeof value === 'undefined') return 'undefined';\n\n    throw $parseMinErr('esc', 'IMPOSSIBLE');\n  },\n\n  nextId: function(skip, init) {\n    var id = 'v' + (this.state.nextId++);\n    if (!skip) {\n      this.current().vars.push(id + (init ? '=' + init : ''));\n    }\n    return id;\n  },\n\n  current: function() {\n    return this.state[this.state.computing];\n  }\n};\n\n\nfunction ASTInterpreter(astBuilder, $filter) {\n  this.astBuilder = astBuilder;\n  this.$filter = $filter;\n}\n\nASTInterpreter.prototype = {\n  compile: function(expression, expensiveChecks) {\n    var self = this;\n    var ast = this.astBuilder.ast(expression);\n    this.expression = expression;\n    this.expensiveChecks = expensiveChecks;\n    findConstantAndWatchExpressions(ast, self.$filter);\n    var assignable;\n    var assign;\n    if ((assignable = assignableAST(ast))) {\n      assign = this.recurse(assignable);\n    }\n    var toWatch = getInputs(ast.body);\n    var inputs;\n    if (toWatch) {\n      inputs = [];\n      forEach(toWatch, function(watch, key) {\n        var input = self.recurse(watch);\n        watch.input = input;\n        inputs.push(input);\n        watch.watchId = key;\n      });\n    }\n    var expressions = [];\n    forEach(ast.body, function(expression) {\n      expressions.push(self.recurse(expression.expression));\n    });\n    var fn = ast.body.length === 0 ? noop :\n             ast.body.length === 1 ? expressions[0] :\n             function(scope, locals) {\n               var lastValue;\n               forEach(expressions, function(exp) {\n                 lastValue = exp(scope, locals);\n               });\n               return lastValue;\n             };\n    if (assign) {\n      fn.assign = function(scope, value, locals) {\n        return assign(scope, locals, value);\n      };\n    }\n    if (inputs) {\n      fn.inputs = inputs;\n    }\n    fn.literal = isLiteral(ast);\n    fn.constant = isConstant(ast);\n    return fn;\n  },\n\n  recurse: function(ast, context, create) {\n    var left, right, self = this, args, expression;\n    if (ast.input) {\n      return this.inputs(ast.input, ast.watchId);\n    }\n    switch (ast.type) {\n    case AST.Literal:\n      return this.value(ast.value, context);\n    case AST.UnaryExpression:\n      right = this.recurse(ast.argument);\n      return this['unary' + ast.operator](right, context);\n    case AST.BinaryExpression:\n      left = this.recurse(ast.left);\n      right = this.recurse(ast.right);\n      return this['binary' + ast.operator](left, right, context);\n    case AST.LogicalExpression:\n      left = this.recurse(ast.left);\n      right = this.recurse(ast.right);\n      return this['binary' + ast.operator](left, right, context);\n    case AST.ConditionalExpression:\n      return this['ternary?:'](\n        this.recurse(ast.test),\n        this.recurse(ast.alternate),\n        this.recurse(ast.consequent),\n        context\n      );\n    case AST.Identifier:\n      ensureSafeMemberName(ast.name, self.expression);\n      return self.identifier(ast.name,\n                             self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),\n                             context, create, self.expression);\n    case AST.MemberExpression:\n      left = this.recurse(ast.object, false, !!create);\n      if (!ast.computed) {\n        ensureSafeMemberName(ast.property.name, self.expression);\n        right = ast.property.name;\n      }\n      if (ast.computed) right = this.recurse(ast.property);\n      return ast.computed ?\n        this.computedMember(left, right, context, create, self.expression) :\n        this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);\n    case AST.CallExpression:\n      args = [];\n      forEach(ast.arguments, function(expr) {\n        args.push(self.recurse(expr));\n      });\n      if (ast.filter) right = this.$filter(ast.callee.name);\n      if (!ast.filter) right = this.recurse(ast.callee, true);\n      return ast.filter ?\n        function(scope, locals, assign, inputs) {\n          var values = [];\n          for (var i = 0; i < args.length; ++i) {\n            values.push(args[i](scope, locals, assign, inputs));\n          }\n          var value = right.apply(undefined, values, inputs);\n          return context ? {context: undefined, name: undefined, value: value} : value;\n        } :\n        function(scope, locals, assign, inputs) {\n          var rhs = right(scope, locals, assign, inputs);\n          var value;\n          if (rhs.value != null) {\n            ensureSafeObject(rhs.context, self.expression);\n            ensureSafeFunction(rhs.value, self.expression);\n            var values = [];\n            for (var i = 0; i < args.length; ++i) {\n              values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));\n            }\n            value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);\n          }\n          return context ? {value: value} : value;\n        };\n    case AST.AssignmentExpression:\n      left = this.recurse(ast.left, true, 1);\n      right = this.recurse(ast.right);\n      return function(scope, locals, assign, inputs) {\n        var lhs = left(scope, locals, assign, inputs);\n        var rhs = right(scope, locals, assign, inputs);\n        ensureSafeObject(lhs.value, self.expression);\n        ensureSafeAssignContext(lhs.context);\n        lhs.context[lhs.name] = rhs;\n        return context ? {value: rhs} : rhs;\n      };\n    case AST.ArrayExpression:\n      args = [];\n      forEach(ast.elements, function(expr) {\n        args.push(self.recurse(expr));\n      });\n      return function(scope, locals, assign, inputs) {\n        var value = [];\n        for (var i = 0; i < args.length; ++i) {\n          value.push(args[i](scope, locals, assign, inputs));\n        }\n        return context ? {value: value} : value;\n      };\n    case AST.ObjectExpression:\n      args = [];\n      forEach(ast.properties, function(property) {\n        args.push({key: property.key.type === AST.Identifier ?\n                        property.key.name :\n                        ('' + property.key.value),\n                   value: self.recurse(property.value)\n        });\n      });\n      return function(scope, locals, assign, inputs) {\n        var value = {};\n        for (var i = 0; i < args.length; ++i) {\n          value[args[i].key] = args[i].value(scope, locals, assign, inputs);\n        }\n        return context ? {value: value} : value;\n      };\n    case AST.ThisExpression:\n      return function(scope) {\n        return context ? {value: scope} : scope;\n      };\n    case AST.LocalsExpression:\n      return function(scope, locals) {\n        return context ? {value: locals} : locals;\n      };\n    case AST.NGValueParameter:\n      return function(scope, locals, assign) {\n        return context ? {value: assign} : assign;\n      };\n    }\n  },\n\n  'unary+': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = argument(scope, locals, assign, inputs);\n      if (isDefined(arg)) {\n        arg = +arg;\n      } else {\n        arg = 0;\n      }\n      return context ? {value: arg} : arg;\n    };\n  },\n  'unary-': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = argument(scope, locals, assign, inputs);\n      if (isDefined(arg)) {\n        arg = -arg;\n      } else {\n        arg = 0;\n      }\n      return context ? {value: arg} : arg;\n    };\n  },\n  'unary!': function(argument, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = !argument(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary+': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs = right(scope, locals, assign, inputs);\n      var arg = plusFn(lhs, rhs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary-': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs = right(scope, locals, assign, inputs);\n      var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary*': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary/': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary%': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary===': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary!==': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary==': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary!=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary<': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary>': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary<=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary>=': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary&&': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'binary||': function(left, right, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  'ternary?:': function(test, alternate, consequent, context) {\n    return function(scope, locals, assign, inputs) {\n      var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);\n      return context ? {value: arg} : arg;\n    };\n  },\n  value: function(value, context) {\n    return function() { return context ? {context: undefined, name: undefined, value: value} : value; };\n  },\n  identifier: function(name, expensiveChecks, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var base = locals && (name in locals) ? locals : scope;\n      if (create && create !== 1 && base && !(base[name])) {\n        base[name] = {};\n      }\n      var value = base ? base[name] : undefined;\n      if (expensiveChecks) {\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: base, name: name, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  computedMember: function(left, right, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      var rhs;\n      var value;\n      if (lhs != null) {\n        rhs = right(scope, locals, assign, inputs);\n        rhs = getStringValue(rhs);\n        ensureSafeMemberName(rhs, expression);\n        if (create && create !== 1) {\n          ensureSafeAssignContext(lhs);\n          if (lhs && !(lhs[rhs])) {\n            lhs[rhs] = {};\n          }\n        }\n        value = lhs[rhs];\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: lhs, name: rhs, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {\n    return function(scope, locals, assign, inputs) {\n      var lhs = left(scope, locals, assign, inputs);\n      if (create && create !== 1) {\n        ensureSafeAssignContext(lhs);\n        if (lhs && !(lhs[right])) {\n          lhs[right] = {};\n        }\n      }\n      var value = lhs != null ? lhs[right] : undefined;\n      if (expensiveChecks || isPossiblyDangerousMemberName(right)) {\n        ensureSafeObject(value, expression);\n      }\n      if (context) {\n        return {context: lhs, name: right, value: value};\n      } else {\n        return value;\n      }\n    };\n  },\n  inputs: function(input, watchId) {\n    return function(scope, value, locals, inputs) {\n      if (inputs) return inputs[watchId];\n      return input(scope, value, locals);\n    };\n  }\n};\n\n/**\n * @constructor\n */\nvar Parser = function(lexer, $filter, options) {\n  this.lexer = lexer;\n  this.$filter = $filter;\n  this.options = options;\n  this.ast = new AST(lexer, options);\n  this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :\n                                   new ASTCompiler(this.ast, $filter);\n};\n\nParser.prototype = {\n  constructor: Parser,\n\n  parse: function(text) {\n    return this.astCompiler.compile(text, this.options.expensiveChecks);\n  }\n};\n\nfunction isPossiblyDangerousMemberName(name) {\n  return name == 'constructor';\n}\n\nvar objectValueOf = Object.prototype.valueOf;\n\nfunction getValueOf(value) {\n  return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);\n}\n\n///////////////////////////////////\n\n/**\n * @ngdoc service\n * @name $parse\n * @kind function\n *\n * @description\n *\n * Converts Angular {@link guide/expression expression} into a function.\n *\n * ```js\n *   var getter = $parse('user.name');\n *   var setter = getter.assign;\n *   var context = {user:{name:'angular'}};\n *   var locals = {user:{name:'local'}};\n *\n *   expect(getter(context)).toEqual('angular');\n *   setter(context, 'newValue');\n *   expect(context.user.name).toEqual('newValue');\n *   expect(getter(context, locals)).toEqual('local');\n * ```\n *\n *\n * @param {string} expression String expression to compile.\n * @returns {function(context, locals)} a function which represents the compiled expression:\n *\n *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n *      are evaluated against (typically a scope object).\n *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n *      `context`.\n *\n *    The returned function also has the following properties:\n *      * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript\n *        literal.\n *      * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript\n *        constant literals.\n *      * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be\n *        set to a function to change its value on the given context.\n *\n */\n\n\n/**\n * @ngdoc provider\n * @name $parseProvider\n *\n * @description\n * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}\n *  service.\n */\nfunction $ParseProvider() {\n  var cacheDefault = createMap();\n  var cacheExpensive = createMap();\n  var literals = {\n    'true': true,\n    'false': false,\n    'null': null,\n    'undefined': undefined\n  };\n\n  /**\n   * @ngdoc method\n   * @name $parseProvider#addLiteral\n   * @description\n   *\n   * Configure $parse service to add literal values that will be present as literal at expressions.\n   *\n   * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.\n   * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.\n   *\n   **/\n  this.addLiteral = function(literalName, literalValue) {\n    literals[literalName] = literalValue;\n  };\n\n  this.$get = ['$filter', function($filter) {\n    var noUnsafeEval = csp().noUnsafeEval;\n    var $parseOptions = {\n          csp: noUnsafeEval,\n          expensiveChecks: false,\n          literals: copy(literals)\n        },\n        $parseOptionsExpensive = {\n          csp: noUnsafeEval,\n          expensiveChecks: true,\n          literals: copy(literals)\n        };\n    var runningChecksEnabled = false;\n\n    $parse.$$runningExpensiveChecks = function() {\n      return runningChecksEnabled;\n    };\n\n    return $parse;\n\n    function $parse(exp, interceptorFn, expensiveChecks) {\n      var parsedExpression, oneTime, cacheKey;\n\n      expensiveChecks = expensiveChecks || runningChecksEnabled;\n\n      switch (typeof exp) {\n        case 'string':\n          exp = exp.trim();\n          cacheKey = exp;\n\n          var cache = (expensiveChecks ? cacheExpensive : cacheDefault);\n          parsedExpression = cache[cacheKey];\n\n          if (!parsedExpression) {\n            if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {\n              oneTime = true;\n              exp = exp.substring(2);\n            }\n            var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;\n            var lexer = new Lexer(parseOptions);\n            var parser = new Parser(lexer, $filter, parseOptions);\n            parsedExpression = parser.parse(exp);\n            if (parsedExpression.constant) {\n              parsedExpression.$$watchDelegate = constantWatchDelegate;\n            } else if (oneTime) {\n              parsedExpression.$$watchDelegate = parsedExpression.literal ?\n                  oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;\n            } else if (parsedExpression.inputs) {\n              parsedExpression.$$watchDelegate = inputsWatchDelegate;\n            }\n            if (expensiveChecks) {\n              parsedExpression = expensiveChecksInterceptor(parsedExpression);\n            }\n            cache[cacheKey] = parsedExpression;\n          }\n          return addInterceptor(parsedExpression, interceptorFn);\n\n        case 'function':\n          return addInterceptor(exp, interceptorFn);\n\n        default:\n          return addInterceptor(noop, interceptorFn);\n      }\n    }\n\n    function expensiveChecksInterceptor(fn) {\n      if (!fn) return fn;\n      expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;\n      expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);\n      expensiveCheckFn.constant = fn.constant;\n      expensiveCheckFn.literal = fn.literal;\n      for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {\n        fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);\n      }\n      expensiveCheckFn.inputs = fn.inputs;\n\n      return expensiveCheckFn;\n\n      function expensiveCheckFn(scope, locals, assign, inputs) {\n        var expensiveCheckOldValue = runningChecksEnabled;\n        runningChecksEnabled = true;\n        try {\n          return fn(scope, locals, assign, inputs);\n        } finally {\n          runningChecksEnabled = expensiveCheckOldValue;\n        }\n      }\n    }\n\n    function expressionInputDirtyCheck(newValue, oldValueOfValue) {\n\n      if (newValue == null || oldValueOfValue == null) { // null/undefined\n        return newValue === oldValueOfValue;\n      }\n\n      if (typeof newValue === 'object') {\n\n        // attempt to convert the value to a primitive type\n        // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can\n        //             be cheaply dirty-checked\n        newValue = getValueOf(newValue);\n\n        if (typeof newValue === 'object') {\n          // objects/arrays are not supported - deep-watching them would be too expensive\n          return false;\n        }\n\n        // fall-through to the primitive equality check\n      }\n\n      //Primitive or NaN\n      return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);\n    }\n\n    function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {\n      var inputExpressions = parsedExpression.inputs;\n      var lastResult;\n\n      if (inputExpressions.length === 1) {\n        var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails\n        inputExpressions = inputExpressions[0];\n        return scope.$watch(function expressionInputWatch(scope) {\n          var newInputValue = inputExpressions(scope);\n          if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {\n            lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);\n            oldInputValueOf = newInputValue && getValueOf(newInputValue);\n          }\n          return lastResult;\n        }, listener, objectEquality, prettyPrintExpression);\n      }\n\n      var oldInputValueOfValues = [];\n      var oldInputValues = [];\n      for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n        oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails\n        oldInputValues[i] = null;\n      }\n\n      return scope.$watch(function expressionInputsWatch(scope) {\n        var changed = false;\n\n        for (var i = 0, ii = inputExpressions.length; i < ii; i++) {\n          var newInputValue = inputExpressions[i](scope);\n          if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {\n            oldInputValues[i] = newInputValue;\n            oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);\n          }\n        }\n\n        if (changed) {\n          lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);\n        }\n\n        return lastResult;\n      }, listener, objectEquality, prettyPrintExpression);\n    }\n\n    function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch, lastValue;\n      return unwatch = scope.$watch(function oneTimeWatch(scope) {\n        return parsedExpression(scope);\n      }, function oneTimeListener(value, old, scope) {\n        lastValue = value;\n        if (isFunction(listener)) {\n          listener.apply(this, arguments);\n        }\n        if (isDefined(value)) {\n          scope.$$postDigest(function() {\n            if (isDefined(lastValue)) {\n              unwatch();\n            }\n          });\n        }\n      }, objectEquality);\n    }\n\n    function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch, lastValue;\n      return unwatch = scope.$watch(function oneTimeWatch(scope) {\n        return parsedExpression(scope);\n      }, function oneTimeListener(value, old, scope) {\n        lastValue = value;\n        if (isFunction(listener)) {\n          listener.call(this, value, old, scope);\n        }\n        if (isAllDefined(value)) {\n          scope.$$postDigest(function() {\n            if (isAllDefined(lastValue)) unwatch();\n          });\n        }\n      }, objectEquality);\n\n      function isAllDefined(value) {\n        var allDefined = true;\n        forEach(value, function(val) {\n          if (!isDefined(val)) allDefined = false;\n        });\n        return allDefined;\n      }\n    }\n\n    function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {\n      var unwatch;\n      return unwatch = scope.$watch(function constantWatch(scope) {\n        unwatch();\n        return parsedExpression(scope);\n      }, listener, objectEquality);\n    }\n\n    function addInterceptor(parsedExpression, interceptorFn) {\n      if (!interceptorFn) return parsedExpression;\n      var watchDelegate = parsedExpression.$$watchDelegate;\n      var useInputs = false;\n\n      var regularWatch =\n          watchDelegate !== oneTimeLiteralWatchDelegate &&\n          watchDelegate !== oneTimeWatchDelegate;\n\n      var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {\n        var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);\n        return interceptorFn(value, scope, locals);\n      } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {\n        var value = parsedExpression(scope, locals, assign, inputs);\n        var result = interceptorFn(value, scope, locals);\n        // we only return the interceptor's result if the\n        // initial value is defined (for bind-once)\n        return isDefined(value) ? result : value;\n      };\n\n      // Propagate $$watchDelegates other then inputsWatchDelegate\n      if (parsedExpression.$$watchDelegate &&\n          parsedExpression.$$watchDelegate !== inputsWatchDelegate) {\n        fn.$$watchDelegate = parsedExpression.$$watchDelegate;\n      } else if (!interceptorFn.$stateful) {\n        // If there is an interceptor, but no watchDelegate then treat the interceptor like\n        // we treat filters - it is assumed to be a pure function unless flagged with $stateful\n        fn.$$watchDelegate = inputsWatchDelegate;\n        useInputs = !parsedExpression.inputs;\n        fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];\n      }\n\n      return fn;\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $q\n * @requires $rootScope\n *\n * @description\n * A service that helps you run functions asynchronously, and use their return values (or exceptions)\n * when they are done processing.\n *\n * This is an implementation of promises/deferred objects inspired by\n * [Kris Kowal's Q](https://github.com/kriskowal/q).\n *\n * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred\n * implementations, and the other which resembles ES6 (ES2015) promises to some degree.\n *\n * # $q constructor\n *\n * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`\n * function as the first argument. This is similar to the native Promise implementation from ES6,\n * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).\n *\n * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are\n * available yet.\n *\n * It can be used like so:\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     // perform some asynchronous operation, resolve or reject the promise when appropriate.\n *     return $q(function(resolve, reject) {\n *       setTimeout(function() {\n *         if (okToGreet(name)) {\n *           resolve('Hello, ' + name + '!');\n *         } else {\n *           reject('Greeting ' + name + ' is not allowed.');\n *         }\n *       }, 1000);\n *     });\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   });\n * ```\n *\n * Note: progress/notify callbacks are not currently supported via the ES6-style interface.\n *\n * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.\n *\n * However, the more traditional CommonJS-style usage is still available, and documented below.\n *\n * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an\n * interface for interacting with an object that represents the result of an action that is\n * performed asynchronously, and may or may not be finished at any given point in time.\n *\n * From the perspective of dealing with error handling, deferred and promise APIs are to\n * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.\n *\n * ```js\n *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`\n *   // are available in the current lexical scope (they could have been injected or passed in).\n *\n *   function asyncGreet(name) {\n *     var deferred = $q.defer();\n *\n *     setTimeout(function() {\n *       deferred.notify('About to greet ' + name + '.');\n *\n *       if (okToGreet(name)) {\n *         deferred.resolve('Hello, ' + name + '!');\n *       } else {\n *         deferred.reject('Greeting ' + name + ' is not allowed.');\n *       }\n *     }, 1000);\n *\n *     return deferred.promise;\n *   }\n *\n *   var promise = asyncGreet('Robin Hood');\n *   promise.then(function(greeting) {\n *     alert('Success: ' + greeting);\n *   }, function(reason) {\n *     alert('Failed: ' + reason);\n *   }, function(update) {\n *     alert('Got notification: ' + update);\n *   });\n * ```\n *\n * At first it might not be obvious why this extra complexity is worth the trouble. The payoff\n * comes in the way of guarantees that promise and deferred APIs make, see\n * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.\n *\n * Additionally the promise api allows for composition that is very hard to do with the\n * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.\n * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the\n * section on serial or parallel joining of promises.\n *\n * # The Deferred API\n *\n * A new instance of deferred is constructed by calling `$q.defer()`.\n *\n * The purpose of the deferred object is to expose the associated Promise instance as well as APIs\n * that can be used for signaling the successful or unsuccessful completion, as well as the status\n * of the task.\n *\n * **Methods**\n *\n * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection\n *   constructed via `$q.reject`, the promise will be rejected instead.\n * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to\n *   resolving it with a rejection constructed via `$q.reject`.\n * - `notify(value)` - provides updates on the status of the promise's execution. This may be called\n *   multiple times before the promise is either resolved or rejected.\n *\n * **Properties**\n *\n * - promise – `{Promise}` – promise object associated with this deferred.\n *\n *\n * # The Promise API\n *\n * A new promise instance is created when a deferred instance is created and can be retrieved by\n * calling `deferred.promise`.\n *\n * The purpose of the promise object is to allow for interested parties to get access to the result\n * of the deferred task when it completes.\n *\n * **Methods**\n *\n * - `then(successCallback, errorCallback, notifyCallback)` – regardless of when the promise was or\n *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously\n *   as soon as the result is available. The callbacks are called with a single argument: the result\n *   or rejection reason. Additionally, the notify callback may be called zero or more times to\n *   provide a progress indication, before the promise is resolved or rejected.\n *\n *   This method *returns a new promise* which is resolved or rejected via the return value of the\n *   `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved\n *   with the value which is resolved in that promise using\n *   [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).\n *   It also notifies via the return value of the `notifyCallback` method. The promise cannot be\n *   resolved or rejected from the notifyCallback method.\n *\n * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`\n *\n * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,\n *   but to do so without modifying the final value. This is useful to release resources or do some\n *   clean-up that needs to be done whether the promise was rejected or resolved. See the [full\n *   specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for\n *   more information.\n *\n * # Chaining promises\n *\n * Because calling the `then` method of a promise returns a new derived promise, it is easily\n * possible to create a chain of promises:\n *\n * ```js\n *   promiseB = promiseA.then(function(result) {\n *     return result + 1;\n *   });\n *\n *   // promiseB will be resolved immediately after promiseA is resolved and its value\n *   // will be the result of promiseA incremented by 1\n * ```\n *\n * It is possible to create chains of any length and since a promise can be resolved with another\n * promise (which will defer its resolution further), it is possible to pause/defer resolution of\n * the promises at any point in the chain. This makes it possible to implement powerful APIs like\n * $http's response interceptors.\n *\n *\n * # Differences between Kris Kowal's Q and $q\n *\n *  There are two main differences:\n *\n * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation\n *   mechanism in angular, which means faster propagation of resolution or rejection into your\n *   models and avoiding unnecessary browser repaints, which would result in flickering UI.\n * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains\n *   all the important functionality needed for common async tasks.\n *\n * # Testing\n *\n *  ```js\n *    it('should simulate promise', inject(function($q, $rootScope) {\n *      var deferred = $q.defer();\n *      var promise = deferred.promise;\n *      var resolvedValue;\n *\n *      promise.then(function(value) { resolvedValue = value; });\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Simulate resolving of promise\n *      deferred.resolve(123);\n *      // Note that the 'then' function does not get called synchronously.\n *      // This is because we want the promise API to always be async, whether or not\n *      // it got called synchronously or asynchronously.\n *      expect(resolvedValue).toBeUndefined();\n *\n *      // Propagate promise resolution to 'then' functions using $apply().\n *      $rootScope.$apply();\n *      expect(resolvedValue).toEqual(123);\n *    }));\n *  ```\n *\n * @param {function(function, function)} resolver Function which is responsible for resolving or\n *   rejecting the newly created promise. The first parameter is a function which resolves the\n *   promise, the second parameter is a function which rejects the promise.\n *\n * @returns {Promise} The newly created promise.\n */\nfunction $QProvider() {\n\n  this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $rootScope.$evalAsync(callback);\n    }, $exceptionHandler);\n  }];\n}\n\nfunction $$QProvider() {\n  this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {\n    return qFactory(function(callback) {\n      $browser.defer(callback);\n    }, $exceptionHandler);\n  }];\n}\n\n/**\n * Constructs a promise manager.\n *\n * @param {function(function)} nextTick Function for executing functions in the next turn.\n * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for\n *     debugging purposes.\n * @returns {object} Promise manager.\n */\nfunction qFactory(nextTick, exceptionHandler) {\n  var $qMinErr = minErr('$q', TypeError);\n\n  /**\n   * @ngdoc method\n   * @name ng.$q#defer\n   * @kind function\n   *\n   * @description\n   * Creates a `Deferred` object which represents a task which will finish in the future.\n   *\n   * @returns {Deferred} Returns a new instance of deferred.\n   */\n  var defer = function() {\n    var d = new Deferred();\n    //Necessary to support unbound execution :/\n    d.resolve = simpleBind(d, d.resolve);\n    d.reject = simpleBind(d, d.reject);\n    d.notify = simpleBind(d, d.notify);\n    return d;\n  };\n\n  function Promise() {\n    this.$$state = { status: 0 };\n  }\n\n  extend(Promise.prototype, {\n    then: function(onFulfilled, onRejected, progressBack) {\n      if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {\n        return this;\n      }\n      var result = new Deferred();\n\n      this.$$state.pending = this.$$state.pending || [];\n      this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);\n      if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);\n\n      return result.promise;\n    },\n\n    \"catch\": function(callback) {\n      return this.then(null, callback);\n    },\n\n    \"finally\": function(callback, progressBack) {\n      return this.then(function(value) {\n        return handleCallback(value, true, callback);\n      }, function(error) {\n        return handleCallback(error, false, callback);\n      }, progressBack);\n    }\n  });\n\n  //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native\n  function simpleBind(context, fn) {\n    return function(value) {\n      fn.call(context, value);\n    };\n  }\n\n  function processQueue(state) {\n    var fn, deferred, pending;\n\n    pending = state.pending;\n    state.processScheduled = false;\n    state.pending = undefined;\n    for (var i = 0, ii = pending.length; i < ii; ++i) {\n      deferred = pending[i][0];\n      fn = pending[i][state.status];\n      try {\n        if (isFunction(fn)) {\n          deferred.resolve(fn(state.value));\n        } else if (state.status === 1) {\n          deferred.resolve(state.value);\n        } else {\n          deferred.reject(state.value);\n        }\n      } catch (e) {\n        deferred.reject(e);\n        exceptionHandler(e);\n      }\n    }\n  }\n\n  function scheduleProcessQueue(state) {\n    if (state.processScheduled || !state.pending) return;\n    state.processScheduled = true;\n    nextTick(function() { processQueue(state); });\n  }\n\n  function Deferred() {\n    this.promise = new Promise();\n  }\n\n  extend(Deferred.prototype, {\n    resolve: function(val) {\n      if (this.promise.$$state.status) return;\n      if (val === this.promise) {\n        this.$$reject($qMinErr(\n          'qcycle',\n          \"Expected promise to be resolved with value other than itself '{0}'\",\n          val));\n      } else {\n        this.$$resolve(val);\n      }\n\n    },\n\n    $$resolve: function(val) {\n      var then;\n      var that = this;\n      var done = false;\n      try {\n        if ((isObject(val) || isFunction(val))) then = val && val.then;\n        if (isFunction(then)) {\n          this.promise.$$state.status = -1;\n          then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));\n        } else {\n          this.promise.$$state.value = val;\n          this.promise.$$state.status = 1;\n          scheduleProcessQueue(this.promise.$$state);\n        }\n      } catch (e) {\n        rejectPromise(e);\n        exceptionHandler(e);\n      }\n\n      function resolvePromise(val) {\n        if (done) return;\n        done = true;\n        that.$$resolve(val);\n      }\n      function rejectPromise(val) {\n        if (done) return;\n        done = true;\n        that.$$reject(val);\n      }\n    },\n\n    reject: function(reason) {\n      if (this.promise.$$state.status) return;\n      this.$$reject(reason);\n    },\n\n    $$reject: function(reason) {\n      this.promise.$$state.value = reason;\n      this.promise.$$state.status = 2;\n      scheduleProcessQueue(this.promise.$$state);\n    },\n\n    notify: function(progress) {\n      var callbacks = this.promise.$$state.pending;\n\n      if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {\n        nextTick(function() {\n          var callback, result;\n          for (var i = 0, ii = callbacks.length; i < ii; i++) {\n            result = callbacks[i][0];\n            callback = callbacks[i][3];\n            try {\n              result.notify(isFunction(callback) ? callback(progress) : progress);\n            } catch (e) {\n              exceptionHandler(e);\n            }\n          }\n        });\n      }\n    }\n  });\n\n  /**\n   * @ngdoc method\n   * @name $q#reject\n   * @kind function\n   *\n   * @description\n   * Creates a promise that is resolved as rejected with the specified `reason`. This api should be\n   * used to forward rejection in a chain of promises. If you are dealing with the last promise in\n   * a promise chain, you don't need to worry about it.\n   *\n   * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of\n   * `reject` as the `throw` keyword in JavaScript. This also means that if you \"catch\" an error via\n   * a promise error callback and you want to forward the error to the promise derived from the\n   * current promise, you have to \"rethrow\" the error by returning a rejection constructed via\n   * `reject`.\n   *\n   * ```js\n   *   promiseB = promiseA.then(function(result) {\n   *     // success: do something and resolve promiseB\n   *     //          with the old or a new result\n   *     return result;\n   *   }, function(reason) {\n   *     // error: handle the error if possible and\n   *     //        resolve promiseB with newPromiseOrValue,\n   *     //        otherwise forward the rejection to promiseB\n   *     if (canHandle(reason)) {\n   *      // handle the error and recover\n   *      return newPromiseOrValue;\n   *     }\n   *     return $q.reject(reason);\n   *   });\n   * ```\n   *\n   * @param {*} reason Constant, message, exception or an object representing the rejection reason.\n   * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.\n   */\n  var reject = function(reason) {\n    var result = new Deferred();\n    result.reject(reason);\n    return result.promise;\n  };\n\n  var makePromise = function makePromise(value, resolved) {\n    var result = new Deferred();\n    if (resolved) {\n      result.resolve(value);\n    } else {\n      result.reject(value);\n    }\n    return result.promise;\n  };\n\n  var handleCallback = function handleCallback(value, isResolved, callback) {\n    var callbackOutput = null;\n    try {\n      if (isFunction(callback)) callbackOutput = callback();\n    } catch (e) {\n      return makePromise(e, false);\n    }\n    if (isPromiseLike(callbackOutput)) {\n      return callbackOutput.then(function() {\n        return makePromise(value, isResolved);\n      }, function(error) {\n        return makePromise(error, false);\n      });\n    } else {\n      return makePromise(value, isResolved);\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name $q#when\n   * @kind function\n   *\n   * @description\n   * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.\n   * This is useful when you are dealing with an object that might or might not be a promise, or if\n   * the promise comes from a source that can't be trusted.\n   *\n   * @param {*} value Value or a promise\n   * @param {Function=} successCallback\n   * @param {Function=} errorCallback\n   * @param {Function=} progressCallback\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n\n\n  var when = function(value, callback, errback, progressBack) {\n    var result = new Deferred();\n    result.resolve(value);\n    return result.promise.then(callback, errback, progressBack);\n  };\n\n  /**\n   * @ngdoc method\n   * @name $q#resolve\n   * @kind function\n   *\n   * @description\n   * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.\n   *\n   * @param {*} value Value or a promise\n   * @param {Function=} successCallback\n   * @param {Function=} errorCallback\n   * @param {Function=} progressCallback\n   * @returns {Promise} Returns a promise of the passed value or promise\n   */\n  var resolve = when;\n\n  /**\n   * @ngdoc method\n   * @name $q#all\n   * @kind function\n   *\n   * @description\n   * Combines multiple promises into a single promise that is resolved when all of the input\n   * promises are resolved.\n   *\n   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.\n   * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,\n   *   each value corresponding to the promise at the same index/key in the `promises` array/hash.\n   *   If any of the promises is resolved with a rejection, this resulting promise will be rejected\n   *   with the same rejection value.\n   */\n\n  function all(promises) {\n    var deferred = new Deferred(),\n        counter = 0,\n        results = isArray(promises) ? [] : {};\n\n    forEach(promises, function(promise, key) {\n      counter++;\n      when(promise).then(function(value) {\n        if (results.hasOwnProperty(key)) return;\n        results[key] = value;\n        if (!(--counter)) deferred.resolve(results);\n      }, function(reason) {\n        if (results.hasOwnProperty(key)) return;\n        deferred.reject(reason);\n      });\n    });\n\n    if (counter === 0) {\n      deferred.resolve(results);\n    }\n\n    return deferred.promise;\n  }\n\n  var $Q = function Q(resolver) {\n    if (!isFunction(resolver)) {\n      throw $qMinErr('norslvr', \"Expected resolverFn, got '{0}'\", resolver);\n    }\n\n    var deferred = new Deferred();\n\n    function resolveFn(value) {\n      deferred.resolve(value);\n    }\n\n    function rejectFn(reason) {\n      deferred.reject(reason);\n    }\n\n    resolver(resolveFn, rejectFn);\n\n    return deferred.promise;\n  };\n\n  // Let's make the instanceof operator work for promises, so that\n  // `new $q(fn) instanceof $q` would evaluate to true.\n  $Q.prototype = Promise.prototype;\n\n  $Q.defer = defer;\n  $Q.reject = reject;\n  $Q.when = when;\n  $Q.resolve = resolve;\n  $Q.all = all;\n\n  return $Q;\n}\n\nfunction $$RAFProvider() { //rAF\n  this.$get = ['$window', '$timeout', function($window, $timeout) {\n    var requestAnimationFrame = $window.requestAnimationFrame ||\n                                $window.webkitRequestAnimationFrame;\n\n    var cancelAnimationFrame = $window.cancelAnimationFrame ||\n                               $window.webkitCancelAnimationFrame ||\n                               $window.webkitCancelRequestAnimationFrame;\n\n    var rafSupported = !!requestAnimationFrame;\n    var raf = rafSupported\n      ? function(fn) {\n          var id = requestAnimationFrame(fn);\n          return function() {\n            cancelAnimationFrame(id);\n          };\n        }\n      : function(fn) {\n          var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666\n          return function() {\n            $timeout.cancel(timer);\n          };\n        };\n\n    raf.supported = rafSupported;\n\n    return raf;\n  }];\n}\n\n/**\n * DESIGN NOTES\n *\n * The design decisions behind the scope are heavily favored for speed and memory consumption.\n *\n * The typical use of scope is to watch the expressions, which most of the time return the same\n * value as last time so we optimize the operation.\n *\n * Closures construction is expensive in terms of speed as well as memory:\n *   - No closures, instead use prototypical inheritance for API\n *   - Internal state needs to be stored on scope directly, which means that private state is\n *     exposed as $$____ properties\n *\n * Loop operations are optimized by using while(count--) { ... }\n *   - This means that in order to keep the same order of execution as addition we have to add\n *     items to the array at the beginning (unshift) instead of at the end (push)\n *\n * Child scopes are created and removed often\n *   - Using an array would be slow since inserts in the middle are expensive; so we use linked lists\n *\n * There are fewer watches than observers. This is why you don't want the observer to be implemented\n * in the same way as watch. Watch requires return of the initialization function which is expensive\n * to construct.\n */\n\n\n/**\n * @ngdoc provider\n * @name $rootScopeProvider\n * @description\n *\n * Provider for the $rootScope service.\n */\n\n/**\n * @ngdoc method\n * @name $rootScopeProvider#digestTtl\n * @description\n *\n * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and\n * assuming that the model is unstable.\n *\n * The current default is 10 iterations.\n *\n * In complex applications it's possible that the dependencies between `$watch`s will result in\n * several digest iterations. However if an application needs more than the default 10 digest\n * iterations for its model to stabilize then you should investigate what is causing the model to\n * continuously change during the digest.\n *\n * Increasing the TTL could have performance implications, so you should not change it without\n * proper justification.\n *\n * @param {number} limit The number of digest iterations.\n */\n\n\n/**\n * @ngdoc service\n * @name $rootScope\n * @description\n *\n * Every application has a single root {@link ng.$rootScope.Scope scope}.\n * All other scopes are descendant scopes of the root scope. Scopes provide separation\n * between the model and the view, via a mechanism for watching the model for changes.\n * They also provide event emission/broadcast and subscription facility. See the\n * {@link guide/scope developer guide on scopes}.\n */\nfunction $RootScopeProvider() {\n  var TTL = 10;\n  var $rootScopeMinErr = minErr('$rootScope');\n  var lastDirtyWatch = null;\n  var applyAsyncId = null;\n\n  this.digestTtl = function(value) {\n    if (arguments.length) {\n      TTL = value;\n    }\n    return TTL;\n  };\n\n  function createChildScopeClass(parent) {\n    function ChildScope() {\n      this.$$watchers = this.$$nextSibling =\n          this.$$childHead = this.$$childTail = null;\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$watchersCount = 0;\n      this.$id = nextUid();\n      this.$$ChildScope = null;\n    }\n    ChildScope.prototype = parent;\n    return ChildScope;\n  }\n\n  this.$get = ['$exceptionHandler', '$parse', '$browser',\n      function($exceptionHandler, $parse, $browser) {\n\n    function destroyChildScope($event) {\n        $event.currentScope.$$destroyed = true;\n    }\n\n    function cleanUpScope($scope) {\n\n      if (msie === 9) {\n        // There is a memory leak in IE9 if all child scopes are not disconnected\n        // completely when a scope is destroyed. So this code will recurse up through\n        // all this scopes children\n        //\n        // See issue https://github.com/angular/angular.js/issues/10706\n        $scope.$$childHead && cleanUpScope($scope.$$childHead);\n        $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);\n      }\n\n      // The code below works around IE9 and V8's memory leaks\n      //\n      // See:\n      // - https://code.google.com/p/v8/issues/detail?id=2073#c26\n      // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909\n      // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451\n\n      $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =\n          $scope.$$childTail = $scope.$root = $scope.$$watchers = null;\n    }\n\n    /**\n     * @ngdoc type\n     * @name $rootScope.Scope\n     *\n     * @description\n     * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the\n     * {@link auto.$injector $injector}. Child scopes are created using the\n     * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when\n     * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for\n     * an in-depth introduction and usage examples.\n     *\n     *\n     * # Inheritance\n     * A scope can inherit from a parent scope, as in this example:\n     * ```js\n         var parent = $rootScope;\n         var child = parent.$new();\n\n         parent.salutation = \"Hello\";\n         expect(child.salutation).toEqual('Hello');\n\n         child.salutation = \"Welcome\";\n         expect(child.salutation).toEqual('Welcome');\n         expect(parent.salutation).toEqual('Hello');\n     * ```\n     *\n     * When interacting with `Scope` in tests, additional helper methods are available on the\n     * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional\n     * details.\n     *\n     *\n     * @param {Object.<string, function()>=} providers Map of service factory which need to be\n     *                                       provided for the current scope. Defaults to {@link ng}.\n     * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should\n     *                              append/override services provided by `providers`. This is handy\n     *                              when unit-testing and having the need to override a default\n     *                              service.\n     * @returns {Object} Newly created scope.\n     *\n     */\n    function Scope() {\n      this.$id = nextUid();\n      this.$$phase = this.$parent = this.$$watchers =\n                     this.$$nextSibling = this.$$prevSibling =\n                     this.$$childHead = this.$$childTail = null;\n      this.$root = this;\n      this.$$destroyed = false;\n      this.$$listeners = {};\n      this.$$listenerCount = {};\n      this.$$watchersCount = 0;\n      this.$$isolateBindings = null;\n    }\n\n    /**\n     * @ngdoc property\n     * @name $rootScope.Scope#$id\n     *\n     * @description\n     * Unique scope ID (monotonically increasing) useful for debugging.\n     */\n\n     /**\n      * @ngdoc property\n      * @name $rootScope.Scope#$parent\n      *\n      * @description\n      * Reference to the parent scope.\n      */\n\n      /**\n       * @ngdoc property\n       * @name $rootScope.Scope#$root\n       *\n       * @description\n       * Reference to the root scope.\n       */\n\n    Scope.prototype = {\n      constructor: Scope,\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$new\n       * @kind function\n       *\n       * @description\n       * Creates a new child {@link ng.$rootScope.Scope scope}.\n       *\n       * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.\n       * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.\n       *\n       * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is\n       * desired for the scope and its child scopes to be permanently detached from the parent and\n       * thus stop participating in model change detection and listener notification by invoking.\n       *\n       * @param {boolean} isolate If true, then the scope does not prototypically inherit from the\n       *         parent scope. The scope is isolated, as it can not see parent scope properties.\n       *         When creating widgets, it is useful for the widget to not accidentally read parent\n       *         state.\n       *\n       * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`\n       *                              of the newly created scope. Defaults to `this` scope if not provided.\n       *                              This is used when creating a transclude scope to correctly place it\n       *                              in the scope hierarchy while maintaining the correct prototypical\n       *                              inheritance.\n       *\n       * @returns {Object} The newly created child scope.\n       *\n       */\n      $new: function(isolate, parent) {\n        var child;\n\n        parent = parent || this;\n\n        if (isolate) {\n          child = new Scope();\n          child.$root = this.$root;\n        } else {\n          // Only create a child scope class if somebody asks for one,\n          // but cache it to allow the VM to optimize lookups.\n          if (!this.$$ChildScope) {\n            this.$$ChildScope = createChildScopeClass(this);\n          }\n          child = new this.$$ChildScope();\n        }\n        child.$parent = parent;\n        child.$$prevSibling = parent.$$childTail;\n        if (parent.$$childHead) {\n          parent.$$childTail.$$nextSibling = child;\n          parent.$$childTail = child;\n        } else {\n          parent.$$childHead = parent.$$childTail = child;\n        }\n\n        // When the new scope is not isolated or we inherit from `this`, and\n        // the parent scope is destroyed, the property `$$destroyed` is inherited\n        // prototypically. In all other cases, this property needs to be set\n        // when the parent scope is destroyed.\n        // The listener needs to be added after the parent is set\n        if (isolate || parent != this) child.$on('$destroy', destroyChildScope);\n\n        return child;\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watch\n       * @kind function\n       *\n       * @description\n       * Registers a `listener` callback to be executed whenever the `watchExpression` changes.\n       *\n       * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest\n       *   $digest()} and should return the value that will be watched. (`watchExpression` should not change\n       *   its value when executed multiple times with the same input because it may be executed multiple\n       *   times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be\n       *   [idempotent](http://en.wikipedia.org/wiki/Idempotence).\n       * - The `listener` is called only when the value from the current `watchExpression` and the\n       *   previous call to `watchExpression` are not equal (with the exception of the initial run,\n       *   see below). Inequality is determined according to reference inequality,\n       *   [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)\n       *    via the `!==` Javascript operator, unless `objectEquality == true`\n       *   (see next point)\n       * - When `objectEquality == true`, inequality of the `watchExpression` is determined\n       *   according to the {@link angular.equals} function. To save the value of the object for\n       *   later comparison, the {@link angular.copy} function is used. This therefore means that\n       *   watching complex objects will have adverse memory and performance implications.\n       * - The watch `listener` may change the model, which may trigger other `listener`s to fire.\n       *   This is achieved by rerunning the watchers until no changes are detected. The rerun\n       *   iteration limit is 10 to prevent an infinite loop deadlock.\n       *\n       *\n       * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,\n       * you can register a `watchExpression` function with no `listener`. (Be prepared for\n       * multiple calls to your `watchExpression` because it will execute multiple times in a\n       * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)\n       *\n       * After a watcher is registered with the scope, the `listener` fn is called asynchronously\n       * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the\n       * watcher. In rare cases, this is undesirable because the listener is called when the result\n       * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you\n       * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the\n       * listener was called due to initialization.\n       *\n       *\n       *\n       * # Example\n       * ```js\n           // let's assume that scope was dependency injected as the $rootScope\n           var scope = $rootScope;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n\n\n\n           // Using a function as a watchExpression\n           var food;\n           scope.foodCounter = 0;\n           expect(scope.foodCounter).toEqual(0);\n           scope.$watch(\n             // This function returns the value being watched. It is called for each turn of the $digest loop\n             function() { return food; },\n             // This is the change listener, called when the value returned from the above function changes\n             function(newValue, oldValue) {\n               if ( newValue !== oldValue ) {\n                 // Only increment the counter if the value changed\n                 scope.foodCounter = scope.foodCounter + 1;\n               }\n             }\n           );\n           // No digest has been run so the counter will be zero\n           expect(scope.foodCounter).toEqual(0);\n\n           // Run the digest but since food has not changed count will still be zero\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(0);\n\n           // Update food and run digest.  Now the counter will increment\n           food = 'cheeseburger';\n           scope.$digest();\n           expect(scope.foodCounter).toEqual(1);\n\n       * ```\n       *\n       *\n       *\n       * @param {(function()|string)} watchExpression Expression that is evaluated on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers\n       *    a call to the `listener`.\n       *\n       *    - `string`: Evaluated as {@link guide/expression expression}\n       *    - `function(scope)`: called with current `scope` as a parameter.\n       * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value\n       *    of `watchExpression` changes.\n       *\n       *    - `newVal` contains the current value of the `watchExpression`\n       *    - `oldVal` contains the previous value of the `watchExpression`\n       *    - `scope` refers to the current scope\n       * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of\n       *     comparing for reference equality.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {\n        var get = $parse(watchExp);\n\n        if (get.$$watchDelegate) {\n          return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);\n        }\n        var scope = this,\n            array = scope.$$watchers,\n            watcher = {\n              fn: listener,\n              last: initWatchVal,\n              get: get,\n              exp: prettyPrintExpression || watchExp,\n              eq: !!objectEquality\n            };\n\n        lastDirtyWatch = null;\n\n        if (!isFunction(listener)) {\n          watcher.fn = noop;\n        }\n\n        if (!array) {\n          array = scope.$$watchers = [];\n        }\n        // we use unshift since we use a while loop in $digest for speed.\n        // the while loop reads in reverse order.\n        array.unshift(watcher);\n        incrementWatchersCount(this, 1);\n\n        return function deregisterWatch() {\n          if (arrayRemove(array, watcher) >= 0) {\n            incrementWatchersCount(scope, -1);\n          }\n          lastDirtyWatch = null;\n        };\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchGroup\n       * @kind function\n       *\n       * @description\n       * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.\n       * If any one expression in the collection changes the `listener` is executed.\n       *\n       * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every\n       *   call to $digest() to see if any items changes.\n       * - The `listener` is called whenever any expression in the `watchExpressions` array changes.\n       *\n       * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually\n       * watched using {@link ng.$rootScope.Scope#$watch $watch()}\n       *\n       * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any\n       *    expression in `watchExpressions` changes\n       *    The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching\n       *    those of `watchExpression`\n       *    and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching\n       *    those of `watchExpression`\n       *    The `scope` refers to the current scope.\n       * @returns {function()} Returns a de-registration function for all listeners.\n       */\n      $watchGroup: function(watchExpressions, listener) {\n        var oldValues = new Array(watchExpressions.length);\n        var newValues = new Array(watchExpressions.length);\n        var deregisterFns = [];\n        var self = this;\n        var changeReactionScheduled = false;\n        var firstRun = true;\n\n        if (!watchExpressions.length) {\n          // No expressions means we call the listener ASAP\n          var shouldCall = true;\n          self.$evalAsync(function() {\n            if (shouldCall) listener(newValues, newValues, self);\n          });\n          return function deregisterWatchGroup() {\n            shouldCall = false;\n          };\n        }\n\n        if (watchExpressions.length === 1) {\n          // Special case size of one\n          return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {\n            newValues[0] = value;\n            oldValues[0] = oldValue;\n            listener(newValues, (value === oldValue) ? newValues : oldValues, scope);\n          });\n        }\n\n        forEach(watchExpressions, function(expr, i) {\n          var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {\n            newValues[i] = value;\n            oldValues[i] = oldValue;\n            if (!changeReactionScheduled) {\n              changeReactionScheduled = true;\n              self.$evalAsync(watchGroupAction);\n            }\n          });\n          deregisterFns.push(unwatchFn);\n        });\n\n        function watchGroupAction() {\n          changeReactionScheduled = false;\n\n          if (firstRun) {\n            firstRun = false;\n            listener(newValues, newValues, self);\n          } else {\n            listener(newValues, oldValues, self);\n          }\n        }\n\n        return function deregisterWatchGroup() {\n          while (deregisterFns.length) {\n            deregisterFns.shift()();\n          }\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$watchCollection\n       * @kind function\n       *\n       * @description\n       * Shallow watches the properties of an object and fires whenever any of the properties change\n       * (for arrays, this implies watching the array items; for object maps, this implies watching\n       * the properties). If a change is detected, the `listener` callback is fired.\n       *\n       * - The `obj` collection is observed via standard $watch operation and is examined on every\n       *   call to $digest() to see if any items have been added, removed, or moved.\n       * - The `listener` is called whenever anything within the `obj` has changed. Examples include\n       *   adding, removing, and moving items belonging to an object or array.\n       *\n       *\n       * # Example\n       * ```js\n          $scope.names = ['igor', 'matias', 'misko', 'james'];\n          $scope.dataCount = 4;\n\n          $scope.$watchCollection('names', function(newNames, oldNames) {\n            $scope.dataCount = newNames.length;\n          });\n\n          expect($scope.dataCount).toEqual(4);\n          $scope.$digest();\n\n          //still at 4 ... no changes\n          expect($scope.dataCount).toEqual(4);\n\n          $scope.names.pop();\n          $scope.$digest();\n\n          //now there's been a change\n          expect($scope.dataCount).toEqual(3);\n       * ```\n       *\n       *\n       * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The\n       *    expression value should evaluate to an object or an array which is observed on each\n       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the\n       *    collection will trigger a call to the `listener`.\n       *\n       * @param {function(newCollection, oldCollection, scope)} listener a callback function called\n       *    when a change is detected.\n       *    - The `newCollection` object is the newly modified data obtained from the `obj` expression\n       *    - The `oldCollection` object is a copy of the former collection data.\n       *      Due to performance considerations, the`oldCollection` value is computed only if the\n       *      `listener` function declares two or more arguments.\n       *    - The `scope` argument refers to the current scope.\n       *\n       * @returns {function()} Returns a de-registration function for this listener. When the\n       *    de-registration function is executed, the internal watch operation is terminated.\n       */\n      $watchCollection: function(obj, listener) {\n        $watchCollectionInterceptor.$stateful = true;\n\n        var self = this;\n        // the current value, updated on each dirty-check run\n        var newValue;\n        // a shallow copy of the newValue from the last dirty-check run,\n        // updated to match newValue during dirty-check run\n        var oldValue;\n        // a shallow copy of the newValue from when the last change happened\n        var veryOldValue;\n        // only track veryOldValue if the listener is asking for it\n        var trackVeryOldValue = (listener.length > 1);\n        var changeDetected = 0;\n        var changeDetector = $parse(obj, $watchCollectionInterceptor);\n        var internalArray = [];\n        var internalObject = {};\n        var initRun = true;\n        var oldLength = 0;\n\n        function $watchCollectionInterceptor(_value) {\n          newValue = _value;\n          var newLength, key, bothNaN, newItem, oldItem;\n\n          // If the new value is undefined, then return undefined as the watch may be a one-time watch\n          if (isUndefined(newValue)) return;\n\n          if (!isObject(newValue)) { // if primitive\n            if (oldValue !== newValue) {\n              oldValue = newValue;\n              changeDetected++;\n            }\n          } else if (isArrayLike(newValue)) {\n            if (oldValue !== internalArray) {\n              // we are transitioning from something which was not an array into array.\n              oldValue = internalArray;\n              oldLength = oldValue.length = 0;\n              changeDetected++;\n            }\n\n            newLength = newValue.length;\n\n            if (oldLength !== newLength) {\n              // if lengths do not match we need to trigger change notification\n              changeDetected++;\n              oldValue.length = oldLength = newLength;\n            }\n            // copy the items to oldValue and look for changes.\n            for (var i = 0; i < newLength; i++) {\n              oldItem = oldValue[i];\n              newItem = newValue[i];\n\n              bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n              if (!bothNaN && (oldItem !== newItem)) {\n                changeDetected++;\n                oldValue[i] = newItem;\n              }\n            }\n          } else {\n            if (oldValue !== internalObject) {\n              // we are transitioning from something which was not an object into object.\n              oldValue = internalObject = {};\n              oldLength = 0;\n              changeDetected++;\n            }\n            // copy the items to oldValue and look for changes.\n            newLength = 0;\n            for (key in newValue) {\n              if (hasOwnProperty.call(newValue, key)) {\n                newLength++;\n                newItem = newValue[key];\n                oldItem = oldValue[key];\n\n                if (key in oldValue) {\n                  bothNaN = (oldItem !== oldItem) && (newItem !== newItem);\n                  if (!bothNaN && (oldItem !== newItem)) {\n                    changeDetected++;\n                    oldValue[key] = newItem;\n                  }\n                } else {\n                  oldLength++;\n                  oldValue[key] = newItem;\n                  changeDetected++;\n                }\n              }\n            }\n            if (oldLength > newLength) {\n              // we used to have more keys, need to find them and destroy them.\n              changeDetected++;\n              for (key in oldValue) {\n                if (!hasOwnProperty.call(newValue, key)) {\n                  oldLength--;\n                  delete oldValue[key];\n                }\n              }\n            }\n          }\n          return changeDetected;\n        }\n\n        function $watchCollectionAction() {\n          if (initRun) {\n            initRun = false;\n            listener(newValue, newValue, self);\n          } else {\n            listener(newValue, veryOldValue, self);\n          }\n\n          // make a copy for the next time a collection is changed\n          if (trackVeryOldValue) {\n            if (!isObject(newValue)) {\n              //primitive\n              veryOldValue = newValue;\n            } else if (isArrayLike(newValue)) {\n              veryOldValue = new Array(newValue.length);\n              for (var i = 0; i < newValue.length; i++) {\n                veryOldValue[i] = newValue[i];\n              }\n            } else { // if object\n              veryOldValue = {};\n              for (var key in newValue) {\n                if (hasOwnProperty.call(newValue, key)) {\n                  veryOldValue[key] = newValue[key];\n                }\n              }\n            }\n          }\n        }\n\n        return this.$watch(changeDetector, $watchCollectionAction);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$digest\n       * @kind function\n       *\n       * @description\n       * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and\n       * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change\n       * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}\n       * until no more listeners are firing. This means that it is possible to get into an infinite\n       * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of\n       * iterations exceeds 10.\n       *\n       * Usually, you don't call `$digest()` directly in\n       * {@link ng.directive:ngController controllers} or in\n       * {@link ng.$compileProvider#directive directives}.\n       * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within\n       * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.\n       *\n       * If you want to be notified whenever `$digest()` is called,\n       * you can register a `watchExpression` function with\n       * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.\n       *\n       * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.\n       *\n       * # Example\n       * ```js\n           var scope = ...;\n           scope.name = 'misko';\n           scope.counter = 0;\n\n           expect(scope.counter).toEqual(0);\n           scope.$watch('name', function(newValue, oldValue) {\n             scope.counter = scope.counter + 1;\n           });\n           expect(scope.counter).toEqual(0);\n\n           scope.$digest();\n           // the listener is always called during the first $digest loop after it was registered\n           expect(scope.counter).toEqual(1);\n\n           scope.$digest();\n           // but now it will not be called unless the value changes\n           expect(scope.counter).toEqual(1);\n\n           scope.name = 'adam';\n           scope.$digest();\n           expect(scope.counter).toEqual(2);\n       * ```\n       *\n       */\n      $digest: function() {\n        var watch, value, last, fn, get,\n            watchers,\n            length,\n            dirty, ttl = TTL,\n            next, current, target = this,\n            watchLog = [],\n            logIdx, asyncTask;\n\n        beginPhase('$digest');\n        // Check for changes to browser url that happened in sync before the call to $digest\n        $browser.$$checkUrlChange();\n\n        if (this === $rootScope && applyAsyncId !== null) {\n          // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then\n          // cancel the scheduled $apply and flush the queue of expressions to be evaluated.\n          $browser.defer.cancel(applyAsyncId);\n          flushApplyAsync();\n        }\n\n        lastDirtyWatch = null;\n\n        do { // \"while dirty\" loop\n          dirty = false;\n          current = target;\n\n          while (asyncQueue.length) {\n            try {\n              asyncTask = asyncQueue.shift();\n              asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n            lastDirtyWatch = null;\n          }\n\n          traverseScopesLoop:\n          do { // \"traverse the scopes\" loop\n            if ((watchers = current.$$watchers)) {\n              // process our watches\n              length = watchers.length;\n              while (length--) {\n                try {\n                  watch = watchers[length];\n                  // Most common watches are on primitives, in which case we can short\n                  // circuit it with === operator, only when === fails do we use .equals\n                  if (watch) {\n                    get = watch.get;\n                    if ((value = get(current)) !== (last = watch.last) &&\n                        !(watch.eq\n                            ? equals(value, last)\n                            : (typeof value === 'number' && typeof last === 'number'\n                               && isNaN(value) && isNaN(last)))) {\n                      dirty = true;\n                      lastDirtyWatch = watch;\n                      watch.last = watch.eq ? copy(value, null) : value;\n                      fn = watch.fn;\n                      fn(value, ((last === initWatchVal) ? value : last), current);\n                      if (ttl < 5) {\n                        logIdx = 4 - ttl;\n                        if (!watchLog[logIdx]) watchLog[logIdx] = [];\n                        watchLog[logIdx].push({\n                          msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,\n                          newVal: value,\n                          oldVal: last\n                        });\n                      }\n                    } else if (watch === lastDirtyWatch) {\n                      // If the most recently dirty watcher is now clean, short circuit since the remaining watchers\n                      // have already been tested.\n                      dirty = false;\n                      break traverseScopesLoop;\n                    }\n                  }\n                } catch (e) {\n                  $exceptionHandler(e);\n                }\n              }\n            }\n\n            // Insanity Warning: scope depth-first traversal\n            // yes, this code is a bit crazy, but it works and we have tests to prove it!\n            // this piece should be kept in sync with the traversal in $broadcast\n            if (!(next = ((current.$$watchersCount && current.$$childHead) ||\n                (current !== target && current.$$nextSibling)))) {\n              while (current !== target && !(next = current.$$nextSibling)) {\n                current = current.$parent;\n              }\n            }\n          } while ((current = next));\n\n          // `break traverseScopesLoop;` takes us to here\n\n          if ((dirty || asyncQueue.length) && !(ttl--)) {\n            clearPhase();\n            throw $rootScopeMinErr('infdig',\n                '{0} $digest() iterations reached. Aborting!\\n' +\n                'Watchers fired in the last 5 iterations: {1}',\n                TTL, watchLog);\n          }\n\n        } while (dirty || asyncQueue.length);\n\n        clearPhase();\n\n        while (postDigestQueue.length) {\n          try {\n            postDigestQueue.shift()();\n          } catch (e) {\n            $exceptionHandler(e);\n          }\n        }\n      },\n\n\n      /**\n       * @ngdoc event\n       * @name $rootScope.Scope#$destroy\n       * @eventType broadcast on scope being destroyed\n       *\n       * @description\n       * Broadcasted when a scope and its children are being destroyed.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$destroy\n       * @kind function\n       *\n       * @description\n       * Removes the current scope (and all of its children) from the parent scope. Removal implies\n       * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer\n       * propagate to the current scope and its children. Removal also implies that the current\n       * scope is eligible for garbage collection.\n       *\n       * The `$destroy()` is usually used by directives such as\n       * {@link ng.directive:ngRepeat ngRepeat} for managing the\n       * unrolling of the loop.\n       *\n       * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.\n       * Application code can register a `$destroy` event handler that will give it a chance to\n       * perform any necessary cleanup.\n       *\n       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to\n       * clean up DOM bindings before an element is removed from the DOM.\n       */\n      $destroy: function() {\n        // We can't destroy a scope that has been already destroyed.\n        if (this.$$destroyed) return;\n        var parent = this.$parent;\n\n        this.$broadcast('$destroy');\n        this.$$destroyed = true;\n\n        if (this === $rootScope) {\n          //Remove handlers attached to window when $rootScope is removed\n          $browser.$$applicationDestroyed();\n        }\n\n        incrementWatchersCount(this, -this.$$watchersCount);\n        for (var eventName in this.$$listenerCount) {\n          decrementListenerCount(this, this.$$listenerCount[eventName], eventName);\n        }\n\n        // sever all the references to parent scopes (after this cleanup, the current scope should\n        // not be retained by any of our references and should be eligible for garbage collection)\n        if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;\n        if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;\n        if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;\n        if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;\n\n        // Disable listeners, watchers and apply/digest methods\n        this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;\n        this.$on = this.$watch = this.$watchGroup = function() { return noop; };\n        this.$$listeners = {};\n\n        // Disconnect the next sibling to prevent `cleanUpScope` destroying those too\n        this.$$nextSibling = null;\n        cleanUpScope(this);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$eval\n       * @kind function\n       *\n       * @description\n       * Executes the `expression` on the current scope and returns the result. Any exceptions in\n       * the expression are propagated (uncaught). This is useful when evaluating Angular\n       * expressions.\n       *\n       * # Example\n       * ```js\n           var scope = ng.$rootScope.Scope();\n           scope.a = 1;\n           scope.b = 2;\n\n           expect(scope.$eval('a+b')).toEqual(3);\n           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);\n       * ```\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in  {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       * @returns {*} The result of evaluating the expression.\n       */\n      $eval: function(expr, locals) {\n        return $parse(expr)(this, locals);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$evalAsync\n       * @kind function\n       *\n       * @description\n       * Executes the expression on the current scope at a later point in time.\n       *\n       * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only\n       * that:\n       *\n       *   - it will execute after the function that scheduled the evaluation (preferably before DOM\n       *     rendering).\n       *   - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after\n       *     `expression` execution.\n       *\n       * Any exceptions from the execution of the expression are forwarded to the\n       * {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle\n       * will be scheduled. However, it is encouraged to always call code that changes the model\n       * from within an `$apply` call. That includes code evaluated via `$evalAsync`.\n       *\n       * @param {(string|function())=} expression An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with the current `scope` parameter.\n       *\n       * @param {(object)=} locals Local variables object, useful for overriding values in scope.\n       */\n      $evalAsync: function(expr, locals) {\n        // if we are outside of an $digest loop and this is the first time we are scheduling async\n        // task also schedule async auto-flush\n        if (!$rootScope.$$phase && !asyncQueue.length) {\n          $browser.defer(function() {\n            if (asyncQueue.length) {\n              $rootScope.$digest();\n            }\n          });\n        }\n\n        asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});\n      },\n\n      $$postDigest: function(fn) {\n        postDigestQueue.push(fn);\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$apply\n       * @kind function\n       *\n       * @description\n       * `$apply()` is used to execute an expression in angular from outside of the angular\n       * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).\n       * Because we are calling into the angular framework we need to perform proper scope life\n       * cycle of {@link ng.$exceptionHandler exception handling},\n       * {@link ng.$rootScope.Scope#$digest executing watches}.\n       *\n       * ## Life cycle\n       *\n       * # Pseudo-Code of `$apply()`\n       * ```js\n           function $apply(expr) {\n             try {\n               return $eval(expr);\n             } catch (e) {\n               $exceptionHandler(e);\n             } finally {\n               $root.$digest();\n             }\n           }\n       * ```\n       *\n       *\n       * Scope's `$apply()` method transitions through the following stages:\n       *\n       * 1. The {@link guide/expression expression} is executed using the\n       *    {@link ng.$rootScope.Scope#$eval $eval()} method.\n       * 2. Any exceptions from the execution of the expression are forwarded to the\n       *    {@link ng.$exceptionHandler $exceptionHandler} service.\n       * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the\n       *    expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.\n       *\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       *\n       * @returns {*} The result of evaluating the expression.\n       */\n      $apply: function(expr) {\n        try {\n          beginPhase('$apply');\n          try {\n            return this.$eval(expr);\n          } finally {\n            clearPhase();\n          }\n        } catch (e) {\n          $exceptionHandler(e);\n        } finally {\n          try {\n            $rootScope.$digest();\n          } catch (e) {\n            $exceptionHandler(e);\n            throw e;\n          }\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$applyAsync\n       * @kind function\n       *\n       * @description\n       * Schedule the invocation of $apply to occur at a later time. The actual time difference\n       * varies across browsers, but is typically around ~10 milliseconds.\n       *\n       * This can be used to queue up multiple expressions which need to be evaluated in the same\n       * digest.\n       *\n       * @param {(string|function())=} exp An angular expression to be executed.\n       *\n       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.\n       *    - `function(scope)`: execute the function with current `scope` parameter.\n       */\n      $applyAsync: function(expr) {\n        var scope = this;\n        expr && applyAsyncQueue.push($applyAsyncExpression);\n        expr = $parse(expr);\n        scheduleApplyAsync();\n\n        function $applyAsyncExpression() {\n          scope.$eval(expr);\n        }\n      },\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$on\n       * @kind function\n       *\n       * @description\n       * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for\n       * discussion of event life cycle.\n       *\n       * The event listener function format is: `function(event, args...)`. The `event` object\n       * passed into the listener has the following attributes:\n       *\n       *   - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or\n       *     `$broadcast`-ed.\n       *   - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the\n       *     event propagates through the scope hierarchy, this property is set to null.\n       *   - `name` - `{string}`: name of the event.\n       *   - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel\n       *     further event propagation (available only for events that were `$emit`-ed).\n       *   - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag\n       *     to true.\n       *   - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.\n       *\n       * @param {string} name Event name to listen on.\n       * @param {function(event, ...args)} listener Function to call when the event is emitted.\n       * @returns {function()} Returns a deregistration function for this listener.\n       */\n      $on: function(name, listener) {\n        var namedListeners = this.$$listeners[name];\n        if (!namedListeners) {\n          this.$$listeners[name] = namedListeners = [];\n        }\n        namedListeners.push(listener);\n\n        var current = this;\n        do {\n          if (!current.$$listenerCount[name]) {\n            current.$$listenerCount[name] = 0;\n          }\n          current.$$listenerCount[name]++;\n        } while ((current = current.$parent));\n\n        var self = this;\n        return function() {\n          var indexOfListener = namedListeners.indexOf(listener);\n          if (indexOfListener !== -1) {\n            namedListeners[indexOfListener] = null;\n            decrementListenerCount(self, 1, name);\n          }\n        };\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$emit\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` upwards through the scope hierarchy notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$emit` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event traverses upwards toward the root scope and calls all\n       * registered listeners along the way. The event will stop propagating if one of the listeners\n       * cancels it.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to emit.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).\n       */\n      $emit: function(name, args) {\n        var empty = [],\n            namedListeners,\n            scope = this,\n            stopPropagation = false,\n            event = {\n              name: name,\n              targetScope: scope,\n              stopPropagation: function() {stopPropagation = true;},\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            },\n            listenerArgs = concat([event], arguments, 1),\n            i, length;\n\n        do {\n          namedListeners = scope.$$listeners[name] || empty;\n          event.currentScope = scope;\n          for (i = 0, length = namedListeners.length; i < length; i++) {\n\n            // if listeners were deregistered, defragment the array\n            if (!namedListeners[i]) {\n              namedListeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n            try {\n              //allow all listeners attached to the current scope to run\n              namedListeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n          //if any listener on the current scope stops propagation, prevent bubbling\n          if (stopPropagation) {\n            event.currentScope = null;\n            return event;\n          }\n          //traverse upwards\n          scope = scope.$parent;\n        } while (scope);\n\n        event.currentScope = null;\n\n        return event;\n      },\n\n\n      /**\n       * @ngdoc method\n       * @name $rootScope.Scope#$broadcast\n       * @kind function\n       *\n       * @description\n       * Dispatches an event `name` downwards to all child scopes (and their children) notifying the\n       * registered {@link ng.$rootScope.Scope#$on} listeners.\n       *\n       * The event life cycle starts at the scope on which `$broadcast` was called. All\n       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get\n       * notified. Afterwards, the event propagates to all direct and indirect scopes of the current\n       * scope and calls all registered listeners along the way. The event cannot be canceled.\n       *\n       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed\n       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.\n       *\n       * @param {string} name Event name to broadcast.\n       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.\n       * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}\n       */\n      $broadcast: function(name, args) {\n        var target = this,\n            current = target,\n            next = target,\n            event = {\n              name: name,\n              targetScope: target,\n              preventDefault: function() {\n                event.defaultPrevented = true;\n              },\n              defaultPrevented: false\n            };\n\n        if (!target.$$listenerCount[name]) return event;\n\n        var listenerArgs = concat([event], arguments, 1),\n            listeners, i, length;\n\n        //down while you can, then up and next sibling or up and next sibling until back at root\n        while ((current = next)) {\n          event.currentScope = current;\n          listeners = current.$$listeners[name] || [];\n          for (i = 0, length = listeners.length; i < length; i++) {\n            // if listeners were deregistered, defragment the array\n            if (!listeners[i]) {\n              listeners.splice(i, 1);\n              i--;\n              length--;\n              continue;\n            }\n\n            try {\n              listeners[i].apply(null, listenerArgs);\n            } catch (e) {\n              $exceptionHandler(e);\n            }\n          }\n\n          // Insanity Warning: scope depth-first traversal\n          // yes, this code is a bit crazy, but it works and we have tests to prove it!\n          // this piece should be kept in sync with the traversal in $digest\n          // (though it differs due to having the extra check for $$listenerCount)\n          if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||\n              (current !== target && current.$$nextSibling)))) {\n            while (current !== target && !(next = current.$$nextSibling)) {\n              current = current.$parent;\n            }\n          }\n        }\n\n        event.currentScope = null;\n        return event;\n      }\n    };\n\n    var $rootScope = new Scope();\n\n    //The internal queues. Expose them on the $rootScope for debugging/testing purposes.\n    var asyncQueue = $rootScope.$$asyncQueue = [];\n    var postDigestQueue = $rootScope.$$postDigestQueue = [];\n    var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];\n\n    return $rootScope;\n\n\n    function beginPhase(phase) {\n      if ($rootScope.$$phase) {\n        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);\n      }\n\n      $rootScope.$$phase = phase;\n    }\n\n    function clearPhase() {\n      $rootScope.$$phase = null;\n    }\n\n    function incrementWatchersCount(current, count) {\n      do {\n        current.$$watchersCount += count;\n      } while ((current = current.$parent));\n    }\n\n    function decrementListenerCount(current, count, name) {\n      do {\n        current.$$listenerCount[name] -= count;\n\n        if (current.$$listenerCount[name] === 0) {\n          delete current.$$listenerCount[name];\n        }\n      } while ((current = current.$parent));\n    }\n\n    /**\n     * function used as an initial value for watchers.\n     * because it's unique we can easily tell it apart from other values\n     */\n    function initWatchVal() {}\n\n    function flushApplyAsync() {\n      while (applyAsyncQueue.length) {\n        try {\n          applyAsyncQueue.shift()();\n        } catch (e) {\n          $exceptionHandler(e);\n        }\n      }\n      applyAsyncId = null;\n    }\n\n    function scheduleApplyAsync() {\n      if (applyAsyncId === null) {\n        applyAsyncId = $browser.defer(function() {\n          $rootScope.$apply(flushApplyAsync);\n        });\n      }\n    }\n  }];\n}\n\n/**\n * @ngdoc service\n * @name $rootElement\n *\n * @description\n * The root element of Angular application. This is either the element where {@link\n * ng.directive:ngApp ngApp} was declared or the element passed into\n * {@link angular.bootstrap}. The element represents the root element of application. It is also the\n * location where the application's {@link auto.$injector $injector} service gets\n * published, and can be retrieved using `$rootElement.injector()`.\n */\n\n\n// the implementation is in angular.bootstrap\n\n/**\n * @description\n * Private service to sanitize uris for links and images. Used by $compile and $sanitize.\n */\nfunction $$SanitizeUriProvider() {\n  var aHrefSanitizationWhitelist = /^\\s*(https?|ftp|mailto|tel|file):/,\n    imgSrcSanitizationWhitelist = /^\\s*((https?|ftp|file|blob):|data:image\\/)/;\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during a[href] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.aHrefSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      aHrefSanitizationWhitelist = regexp;\n      return this;\n    }\n    return aHrefSanitizationWhitelist;\n  };\n\n\n  /**\n   * @description\n   * Retrieves or overrides the default regular expression that is used for whitelisting of safe\n   * urls during img[src] sanitization.\n   *\n   * The sanitization is a security measure aimed at prevent XSS attacks via html links.\n   *\n   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into\n   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`\n   * regular expression. If a match is found, the original url is written into the dom. Otherwise,\n   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.\n   *\n   * @param {RegExp=} regexp New regexp to whitelist urls with.\n   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for\n   *    chaining otherwise.\n   */\n  this.imgSrcSanitizationWhitelist = function(regexp) {\n    if (isDefined(regexp)) {\n      imgSrcSanitizationWhitelist = regexp;\n      return this;\n    }\n    return imgSrcSanitizationWhitelist;\n  };\n\n  this.$get = function() {\n    return function sanitizeUri(uri, isImage) {\n      var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;\n      var normalizedVal;\n      normalizedVal = urlResolve(uri).href;\n      if (normalizedVal !== '' && !normalizedVal.match(regex)) {\n        return 'unsafe:' + normalizedVal;\n      }\n      return uri;\n    };\n  };\n}\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sceMinErr = minErr('$sce');\n\nvar SCE_CONTEXTS = {\n  HTML: 'html',\n  CSS: 'css',\n  URL: 'url',\n  // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a\n  // url.  (e.g. ng-include, script src, templateUrl)\n  RESOURCE_URL: 'resourceUrl',\n  JS: 'js'\n};\n\n// Helper functions follow.\n\nfunction adjustMatcher(matcher) {\n  if (matcher === 'self') {\n    return matcher;\n  } else if (isString(matcher)) {\n    // Strings match exactly except for 2 wildcards - '*' and '**'.\n    // '*' matches any character except those from the set ':/.?&'.\n    // '**' matches any character (like .* in a RegExp).\n    // More than 2 *'s raises an error as it's ill defined.\n    if (matcher.indexOf('***') > -1) {\n      throw $sceMinErr('iwcard',\n          'Illegal sequence *** in string matcher.  String: {0}', matcher);\n    }\n    matcher = escapeForRegexp(matcher).\n                  replace('\\\\*\\\\*', '.*').\n                  replace('\\\\*', '[^:/.?&;]*');\n    return new RegExp('^' + matcher + '$');\n  } else if (isRegExp(matcher)) {\n    // The only other type of matcher allowed is a Regexp.\n    // Match entire URL / disallow partial matches.\n    // Flags are reset (i.e. no global, ignoreCase or multiline)\n    return new RegExp('^' + matcher.source + '$');\n  } else {\n    throw $sceMinErr('imatcher',\n        'Matchers may only be \"self\", string patterns or RegExp objects');\n  }\n}\n\n\nfunction adjustMatchers(matchers) {\n  var adjustedMatchers = [];\n  if (isDefined(matchers)) {\n    forEach(matchers, function(matcher) {\n      adjustedMatchers.push(adjustMatcher(matcher));\n    });\n  }\n  return adjustedMatchers;\n}\n\n\n/**\n * @ngdoc service\n * @name $sceDelegate\n * @kind function\n *\n * @description\n *\n * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict\n * Contextual Escaping (SCE)} services to AngularJS.\n *\n * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of\n * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is\n * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to\n * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things\n * work because `$sce` delegates to `$sceDelegate` for these operations.\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.\n *\n * The default instance of `$sceDelegate` should work out of the box with little pain.  While you\n * can override it completely to change the behavior of `$sce`, the common case would\n * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting\n * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as\n * templates.  Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist\n * $sceDelegateProvider.resourceUrlWhitelist} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n */\n\n/**\n * @ngdoc provider\n * @name $sceDelegateProvider\n * @description\n *\n * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate\n * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure\n * that the URLs used for sourcing Angular templates are safe.  Refer {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and\n * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}\n *\n * For the general details about this service in Angular, read the main page for {@link ng.$sce\n * Strict Contextual Escaping (SCE)}.\n *\n * **Example**:  Consider the following case. <a name=\"example\"></a>\n *\n * - your app is hosted at url `http://myapp.example.com/`\n * - but some of your templates are hosted on other domains you control such as\n *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.\n * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.\n *\n * Here is what a secure configuration for this scenario might look like:\n *\n * ```\n *  angular.module('myApp', []).config(function($sceDelegateProvider) {\n *    $sceDelegateProvider.resourceUrlWhitelist([\n *      // Allow same origin resource loads.\n *      'self',\n *      // Allow loading from our assets domain.  Notice the difference between * and **.\n *      'http://srv*.assets.example.com/**'\n *    ]);\n *\n *    // The blacklist overrides the whitelist so the open redirect here is blocked.\n *    $sceDelegateProvider.resourceUrlBlacklist([\n *      'http://myapp.example.com/clickThru**'\n *    ]);\n *  });\n * ```\n */\n\nfunction $SceDelegateProvider() {\n  this.SCE_CONTEXTS = SCE_CONTEXTS;\n\n  // Resource URLs can also be trusted by policy.\n  var resourceUrlWhitelist = ['self'],\n      resourceUrlBlacklist = [];\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlWhitelist\n   * @kind function\n   *\n   * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value\n   *    provided.  This must be an array or null.  A snapshot of this array is used so further\n   *    changes to the array are ignored.\n   *\n   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *    allowed in this array.\n   *\n   *    <div class=\"alert alert-warning\">\n   *    **Note:** an empty whitelist array will block all URLs!\n   *    </div>\n   *\n   * @return {Array} the currently set whitelist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is `['self']` allowing only\n   * same origin resource requests.\n   *\n   * @description\n   * Sets/Gets the whitelist of trusted resource URLs.\n   */\n  this.resourceUrlWhitelist = function(value) {\n    if (arguments.length) {\n      resourceUrlWhitelist = adjustMatchers(value);\n    }\n    return resourceUrlWhitelist;\n  };\n\n  /**\n   * @ngdoc method\n   * @name $sceDelegateProvider#resourceUrlBlacklist\n   * @kind function\n   *\n   * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value\n   *    provided.  This must be an array or null.  A snapshot of this array is used so further\n   *    changes to the array are ignored.\n   *\n   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items\n   *    allowed in this array.\n   *\n   *    The typical usage for the blacklist is to **block\n   *    [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as\n   *    these would otherwise be trusted but actually return content from the redirected domain.\n   *\n   *    Finally, **the blacklist overrides the whitelist** and has the final say.\n   *\n   * @return {Array} the currently set blacklist array.\n   *\n   * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there\n   * is no blacklist.)\n   *\n   * @description\n   * Sets/Gets the blacklist of trusted resource URLs.\n   */\n\n  this.resourceUrlBlacklist = function(value) {\n    if (arguments.length) {\n      resourceUrlBlacklist = adjustMatchers(value);\n    }\n    return resourceUrlBlacklist;\n  };\n\n  this.$get = ['$injector', function($injector) {\n\n    var htmlSanitizer = function htmlSanitizer(html) {\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    };\n\n    if ($injector.has('$sanitize')) {\n      htmlSanitizer = $injector.get('$sanitize');\n    }\n\n\n    function matchUrl(matcher, parsedUrl) {\n      if (matcher === 'self') {\n        return urlIsSameOrigin(parsedUrl);\n      } else {\n        // definitely a regex.  See adjustMatchers()\n        return !!matcher.exec(parsedUrl.href);\n      }\n    }\n\n    function isResourceUrlAllowedByPolicy(url) {\n      var parsedUrl = urlResolve(url.toString());\n      var i, n, allowed = false;\n      // Ensure that at least one item from the whitelist allows this url.\n      for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {\n        if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {\n          allowed = true;\n          break;\n        }\n      }\n      if (allowed) {\n        // Ensure that no item from the blacklist blocked this url.\n        for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {\n          if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {\n            allowed = false;\n            break;\n          }\n        }\n      }\n      return allowed;\n    }\n\n    function generateHolderType(Base) {\n      var holderType = function TrustedValueHolderType(trustedValue) {\n        this.$$unwrapTrustedValue = function() {\n          return trustedValue;\n        };\n      };\n      if (Base) {\n        holderType.prototype = new Base();\n      }\n      holderType.prototype.valueOf = function sceValueOf() {\n        return this.$$unwrapTrustedValue();\n      };\n      holderType.prototype.toString = function sceToString() {\n        return this.$$unwrapTrustedValue().toString();\n      };\n      return holderType;\n    }\n\n    var trustedValueHolderBase = generateHolderType(),\n        byType = {};\n\n    byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);\n    byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#trustAs\n     *\n     * @description\n     * Returns an object that is trusted by angular for use in specified strict\n     * contextual escaping contexts (such as ng-bind-html, ng-include, any src\n     * attribute interpolation, any dom event binding attribute interpolation\n     * such as for onclick,  etc.) that uses the provided value.\n     * See {@link ng.$sce $sce} for enabling strict contextual escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n    function trustAs(type, trustedValue) {\n      var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (!Constructor) {\n        throw $sceMinErr('icontext',\n            'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',\n            type, trustedValue);\n      }\n      if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {\n        return trustedValue;\n      }\n      // All the current contexts in SCE_CONTEXTS happen to be strings.  In order to avoid trusting\n      // mutable objects, we ensure here that the value passed in is actually a string.\n      if (typeof trustedValue !== 'string') {\n        throw $sceMinErr('itype',\n            'Attempted to trust a non-string value in a content requiring a string: Context: {0}',\n            type);\n      }\n      return new Constructor(trustedValue);\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#valueOf\n     *\n     * @description\n     * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs\n     * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.\n     *\n     * If the passed parameter is not a value that had been returned by {@link\n     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.\n     *\n     * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}\n     *      call or anything else.\n     * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns\n     *     `value` unchanged.\n     */\n    function valueOf(maybeTrusted) {\n      if (maybeTrusted instanceof trustedValueHolderBase) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      } else {\n        return maybeTrusted;\n      }\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sceDelegate#getTrusted\n     *\n     * @description\n     * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and\n     * returns the originally supplied value if the queried context type is a supertype of the\n     * created type.  If this condition isn't satisfied, throws an exception.\n     *\n     * <div class=\"alert alert-danger\">\n     * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting\n     * (XSS) vulnerability in your application.\n     * </div>\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} call.\n     * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs\n     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.\n     */\n    function getTrusted(type, maybeTrusted) {\n      if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {\n        return maybeTrusted;\n      }\n      var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);\n      if (constructor && maybeTrusted instanceof constructor) {\n        return maybeTrusted.$$unwrapTrustedValue();\n      }\n      // If we get here, then we may only take one of two actions.\n      // 1. sanitize the value for the requested type, or\n      // 2. throw an exception.\n      if (type === SCE_CONTEXTS.RESOURCE_URL) {\n        if (isResourceUrlAllowedByPolicy(maybeTrusted)) {\n          return maybeTrusted;\n        } else {\n          throw $sceMinErr('insecurl',\n              'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}',\n              maybeTrusted.toString());\n        }\n      } else if (type === SCE_CONTEXTS.HTML) {\n        return htmlSanitizer(maybeTrusted);\n      }\n      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');\n    }\n\n    return { trustAs: trustAs,\n             getTrusted: getTrusted,\n             valueOf: valueOf };\n  }];\n}\n\n\n/**\n * @ngdoc provider\n * @name $sceProvider\n * @description\n *\n * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.\n * -   enable/disable Strict Contextual Escaping (SCE) in a module\n * -   override the default implementation with a custom delegate\n *\n * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.\n */\n\n/* jshint maxlen: false*/\n\n/**\n * @ngdoc service\n * @name $sce\n * @kind function\n *\n * @description\n *\n * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.\n *\n * # Strict Contextual Escaping\n *\n * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain\n * contexts to result in a value that is marked as safe to use for that context.  One example of\n * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer\n * to these contexts as privileged or SCE contexts.\n *\n * As of version 1.2, Angular ships with SCE enabled by default.\n *\n * Note:  When enabled (the default), IE<11 in quirks mode is not supported.  In this mode, IE<11 allow\n * one to execute arbitrary javascript by the use of the expression() syntax.  Refer\n * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.\n * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`\n * to the top of your HTML document.\n *\n * SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for\n * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.\n *\n * Here's an example of a binding in a privileged context:\n *\n * ```\n * <input ng-model=\"userHtml\" aria-label=\"User input\">\n * <div ng-bind-html=\"userHtml\"></div>\n * ```\n *\n * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE\n * disabled, this application allows the user to render arbitrary HTML into the DIV.\n * In a more realistic example, one may be rendering user comments, blog articles, etc. via\n * bindings.  (HTML is just one example of a context where rendering user controlled input creates\n * security vulnerabilities.)\n *\n * For the case of HTML, you might use a library, either on the client side, or on the server side,\n * to sanitize unsafe HTML before binding to the value and rendering it in the document.\n *\n * How would you ensure that every place that used these types of bindings was bound to a value that\n * was sanitized by your library (or returned as safe for rendering by your server?)  How can you\n * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some\n * properties/fields and forgot to update the binding to the sanitized value?\n *\n * To be secure by default, you want to ensure that any such bindings are disallowed unless you can\n * determine that something explicitly says it's safe to use a value for binding in that\n * context.  You can then audit your code (a simple grep would do) to ensure that this is only done\n * for those values that you can easily tell are safe - because they were received from your server,\n * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps\n * allowing only the files in a specific directory to do this.  Ensuring that the internal API\n * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.\n *\n * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}\n * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to\n * obtain values that will be accepted by SCE / privileged contexts.\n *\n *\n * ## How does it work?\n *\n * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted\n * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link\n * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the\n * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.\n *\n * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link\n * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly\n * simplified):\n *\n * ```\n * var ngBindHtmlDirective = ['$sce', function($sce) {\n *   return function(scope, element, attr) {\n *     scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {\n *       element.html(value || '');\n *     });\n *   };\n * }];\n * ```\n *\n * ## Impact on loading templates\n *\n * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as\n * `templateUrl`'s specified by {@link guide/directive directives}.\n *\n * By default, Angular only loads templates from the same domain and protocol as the application\n * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or\n * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist\n * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.\n *\n * *Please note*:\n * The browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy apply in addition to this and may further restrict whether the template is successfully\n * loaded.  This means that without the right CORS policy, loading templates from a different domain\n * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some\n * browsers.\n *\n * ## This feels like too much overhead\n *\n * It's important to remember that SCE only applies to interpolation expressions.\n *\n * If your expressions are constant literals, they're automatically trusted and you don't need to\n * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.\n * `<div ng-bind-html=\"'<b>implicitly trusted</b>'\"></div>`) just works.\n *\n * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them\n * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.\n *\n * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load\n * templates in `ng-include` from your application's domain without having to even know about SCE.\n * It blocks loading templates from other domains or loading templates over http from an https\n * served document.  You can change these by setting your own custom {@link\n * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link\n * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.\n *\n * This significantly reduces the overhead.  It is far easier to pay the small overhead and have an\n * application that's secure and can be audited to verify that with much more ease than bolting\n * security onto an application later.\n *\n * <a name=\"contexts\"></a>\n * ## What trusted context types are supported?\n *\n * | Context             | Notes          |\n * |---------------------|----------------|\n * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |\n * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |\n * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |\n * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |\n * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |\n *\n * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name=\"resourceUrlPatternItem\"></a>\n *\n *  Each element in these arrays must be one of the following:\n *\n *  - **'self'**\n *    - The special **string**, `'self'`, can be used to match against all URLs of the **same\n *      domain** as the application document using the **same protocol**.\n *  - **String** (except the special value `'self'`)\n *    - The string is matched against the full *normalized / absolute URL* of the resource\n *      being tested (substring matches are not good enough.)\n *    - There are exactly **two wildcard sequences** - `*` and `**`.  All other characters\n *      match themselves.\n *    - `*`: matches zero or more occurrences of any character other than one of the following 6\n *      characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'.  It's a useful wildcard for use\n *      in a whitelist.\n *    - `**`: matches zero or more occurrences of *any* character.  As such, it's not\n *      appropriate for use in a scheme, domain, etc. as it would match too much.  (e.g.\n *      http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might\n *      not have been the intention.)  Its usage at the very end of the path is ok.  (e.g.\n *      http://foo.example.com/templates/**).\n *  - **RegExp** (*see caveat below*)\n *    - *Caveat*:  While regular expressions are powerful and offer great flexibility,  their syntax\n *      (and all the inevitable escaping) makes them *harder to maintain*.  It's easy to\n *      accidentally introduce a bug when one updates a complex expression (imho, all regexes should\n *      have good test coverage).  For instance, the use of `.` in the regex is correct only in a\n *      small number of cases.  A `.` character in the regex used when matching the scheme or a\n *      subdomain could be matched against a `:` or literal `.` that was likely not intended.   It\n *      is highly recommended to use the string patterns and only fall back to regular expressions\n *      as a last resort.\n *    - The regular expression must be an instance of RegExp (i.e. not a string.)  It is\n *      matched against the **entire** *normalized / absolute URL* of the resource being tested\n *      (even when the RegExp did not have the `^` and `$` codes.)  In addition, any flags\n *      present on the RegExp (such as multiline, global, ignoreCase) are ignored.\n *    - If you are generating your JavaScript from some other templating engine (not\n *      recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),\n *      remember to escape your regular expression (and be aware that you might need more than\n *      one level of escaping depending on your templating engine and the way you interpolated\n *      the value.)  Do make use of your platform's escaping mechanism as it might be good\n *      enough before coding your own.  E.g. Ruby has\n *      [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)\n *      and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).\n *      Javascript lacks a similar built in function for escaping.  Take a look at Google\n *      Closure library's [goog.string.regExpEscape(s)](\n *      http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).\n *\n * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.\n *\n * ## Show me an example using SCE.\n *\n * <example module=\"mySceApp\" deps=\"angular-sanitize.js\">\n * <file name=\"index.html\">\n *   <div ng-controller=\"AppController as myCtrl\">\n *     <i ng-bind-html=\"myCtrl.explicitlyTrustedHtml\" id=\"explicitlyTrustedHtml\"></i><br><br>\n *     <b>User comments</b><br>\n *     By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when\n *     $sanitize is available.  If $sanitize isn't available, this results in an error instead of an\n *     exploit.\n *     <div class=\"well\">\n *       <div ng-repeat=\"userComment in myCtrl.userComments\">\n *         <b>{{userComment.name}}</b>:\n *         <span ng-bind-html=\"userComment.htmlComment\" class=\"htmlComment\"></span>\n *         <br>\n *       </div>\n *     </div>\n *   </div>\n * </file>\n *\n * <file name=\"script.js\">\n *   angular.module('mySceApp', ['ngSanitize'])\n *     .controller('AppController', ['$http', '$templateCache', '$sce',\n *       function($http, $templateCache, $sce) {\n *         var self = this;\n *         $http.get(\"test_data.json\", {cache: $templateCache}).success(function(userComments) {\n *           self.userComments = userComments;\n *         });\n *         self.explicitlyTrustedHtml = $sce.trustAsHtml(\n *             '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *             'sanitization.&quot;\">Hover over this text.</span>');\n *       }]);\n * </file>\n *\n * <file name=\"test_data.json\">\n * [\n *   { \"name\": \"Alice\",\n *     \"htmlComment\":\n *         \"<span onmouseover='this.textContent=\\\"PWN3D!\\\"'>Is <i>anyone</i> reading this?</span>\"\n *   },\n *   { \"name\": \"Bob\",\n *     \"htmlComment\": \"<i>Yes!</i>  Am I the only other one?\"\n *   }\n * ]\n * </file>\n *\n * <file name=\"protractor.js\" type=\"protractor\">\n *   describe('SCE doc demo', function() {\n *     it('should sanitize untrusted values', function() {\n *       expect(element.all(by.css('.htmlComment')).first().getInnerHtml())\n *           .toBe('<span>Is <i>anyone</i> reading this?</span>');\n *     });\n *\n *     it('should NOT sanitize explicitly trusted values', function() {\n *       expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(\n *           '<span onmouseover=\"this.textContent=&quot;Explicitly trusted HTML bypasses ' +\n *           'sanitization.&quot;\">Hover over this text.</span>');\n *     });\n *   });\n * </file>\n * </example>\n *\n *\n *\n * ## Can I disable SCE completely?\n *\n * Yes, you can.  However, this is strongly discouraged.  SCE gives you a lot of security benefits\n * for little coding overhead.  It will be much harder to take an SCE disabled application and\n * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE\n * for cases where you have a lot of existing code that was written before SCE was introduced and\n * you're migrating them a module at a time.\n *\n * That said, here's how you can completely disable SCE:\n *\n * ```\n * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {\n *   // Completely disable SCE.  For demonstration purposes only!\n *   // Do not use in new projects.\n *   $sceProvider.enabled(false);\n * });\n * ```\n *\n */\n/* jshint maxlen: 100 */\n\nfunction $SceProvider() {\n  var enabled = true;\n\n  /**\n   * @ngdoc method\n   * @name $sceProvider#enabled\n   * @kind function\n   *\n   * @param {boolean=} value If provided, then enables/disables SCE.\n   * @return {boolean} true if SCE is enabled, false otherwise.\n   *\n   * @description\n   * Enables/disables SCE and returns the current value.\n   */\n  this.enabled = function(value) {\n    if (arguments.length) {\n      enabled = !!value;\n    }\n    return enabled;\n  };\n\n\n  /* Design notes on the default implementation for SCE.\n   *\n   * The API contract for the SCE delegate\n   * -------------------------------------\n   * The SCE delegate object must provide the following 3 methods:\n   *\n   * - trustAs(contextEnum, value)\n   *     This method is used to tell the SCE service that the provided value is OK to use in the\n   *     contexts specified by contextEnum.  It must return an object that will be accepted by\n   *     getTrusted() for a compatible contextEnum and return this value.\n   *\n   * - valueOf(value)\n   *     For values that were not produced by trustAs(), return them as is.  For values that were\n   *     produced by trustAs(), return the corresponding input value to trustAs.  Basically, if\n   *     trustAs is wrapping the given values into some type, this operation unwraps it when given\n   *     such a value.\n   *\n   * - getTrusted(contextEnum, value)\n   *     This function should return the a value that is safe to use in the context specified by\n   *     contextEnum or throw and exception otherwise.\n   *\n   * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be\n   * opaque or wrapped in some holder object.  That happens to be an implementation detail.  For\n   * instance, an implementation could maintain a registry of all trusted objects by context.  In\n   * such a case, trustAs() would return the same object that was passed in.  getTrusted() would\n   * return the same object passed in if it was found in the registry under a compatible context or\n   * throw an exception otherwise.  An implementation might only wrap values some of the time based\n   * on some criteria.  getTrusted() might return a value and not throw an exception for special\n   * constants or objects even if not wrapped.  All such implementations fulfill this contract.\n   *\n   *\n   * A note on the inheritance model for SCE contexts\n   * ------------------------------------------------\n   * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types.  This\n   * is purely an implementation details.\n   *\n   * The contract is simply this:\n   *\n   *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)\n   *     will also succeed.\n   *\n   * Inheritance happens to capture this in a natural way.  In some future, we\n   * may not use inheritance anymore.  That is OK because no code outside of\n   * sce.js and sceSpecs.js would need to be aware of this detail.\n   */\n\n  this.$get = ['$parse', '$sceDelegate', function(\n                $parse,   $sceDelegate) {\n    // Prereq: Ensure that we're not running in IE<11 quirks mode.  In that mode, IE < 11 allow\n    // the \"expression(javascript expression)\" syntax which is insecure.\n    if (enabled && msie < 8) {\n      throw $sceMinErr('iequirks',\n        'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +\n        'mode.  You can fix this by adding the text <!doctype html> to the top of your HTML ' +\n        'document.  See http://docs.angularjs.org/api/ng.$sce for more information.');\n    }\n\n    var sce = shallowCopy(SCE_CONTEXTS);\n\n    /**\n     * @ngdoc method\n     * @name $sce#isEnabled\n     * @kind function\n     *\n     * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you\n     * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.\n     *\n     * @description\n     * Returns a boolean indicating if SCE is enabled.\n     */\n    sce.isEnabled = function() {\n      return enabled;\n    };\n    sce.trustAs = $sceDelegate.trustAs;\n    sce.getTrusted = $sceDelegate.getTrusted;\n    sce.valueOf = $sceDelegate.valueOf;\n\n    if (!enabled) {\n      sce.trustAs = sce.getTrusted = function(type, value) { return value; };\n      sce.valueOf = identity;\n    }\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAs\n     *\n     * @description\n     * Converts Angular {@link guide/expression expression} into a function.  This is like {@link\n     * ng.$parse $parse} and is identical when the expression is a literal constant.  Otherwise, it\n     * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,\n     * *result*)}\n     *\n     * @param {string} type The kind of SCE context in which this result will be used.\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n    sce.parseAs = function sceParseAs(type, expr) {\n      var parsed = $parse(expr);\n      if (parsed.literal && parsed.constant) {\n        return parsed;\n      } else {\n        return $parse(expr, function(value) {\n          return sce.getTrusted(type, value);\n        });\n      }\n    };\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAs\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,\n     * returns an object that is trusted by angular for use in specified strict contextual\n     * escaping contexts (such as ng-bind-html, ng-include, any src attribute\n     * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)\n     * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual\n     * escaping.\n     *\n     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,\n     *   resourceUrl, html, js and css.\n     * @param {*} value The value that that should be considered trusted/safe.\n     * @returns {*} A value that can be used to stand in for the provided `value` in places\n     * where Angular expects a $sce.trustAs() return value.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsHtml(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml\n     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl\n     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl\n     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the return\n     *     value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#trustAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.trustAsJs(value)` →\n     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}\n     *\n     * @param {*} value The value to trustAs.\n     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs\n     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives\n     *     only accept expressions that are either literal constants or are the\n     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrusted\n     *\n     * @description\n     * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,\n     * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the\n     * originally supplied value if the queried context type is a supertype of the created type.\n     * If this condition isn't satisfied, throws an exception.\n     *\n     * @param {string} type The kind of context in which this value is to be used.\n     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}\n     *                         call.\n     * @returns {*} The value the was originally provided to\n     *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.\n     *              Otherwise, throws an exception.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedHtml(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedCss\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedCss(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedResourceUrl(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}\n     *\n     * @param {*} value The value to pass to `$sceDelegate.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#getTrustedJs\n     *\n     * @description\n     * Shorthand method.  `$sce.getTrustedJs(value)` →\n     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}\n     *\n     * @param {*} value The value to pass to `$sce.getTrusted`.\n     * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsHtml\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsHtml(expression string)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsCss\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsCss(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsUrl(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsResourceUrl\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsResourceUrl(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    /**\n     * @ngdoc method\n     * @name $sce#parseAsJs\n     *\n     * @description\n     * Shorthand method.  `$sce.parseAsJs(value)` →\n     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}\n     *\n     * @param {string} expression String expression to compile.\n     * @returns {function(context, locals)} a function which represents the compiled expression:\n     *\n     *    * `context` – `{object}` – an object against which any expressions embedded in the strings\n     *      are evaluated against (typically a scope object).\n     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in\n     *      `context`.\n     */\n\n    // Shorthand delegations.\n    var parse = sce.parseAs,\n        getTrusted = sce.getTrusted,\n        trustAs = sce.trustAs;\n\n    forEach(SCE_CONTEXTS, function(enumValue, name) {\n      var lName = lowercase(name);\n      sce[camelCase(\"parse_as_\" + lName)] = function(expr) {\n        return parse(enumValue, expr);\n      };\n      sce[camelCase(\"get_trusted_\" + lName)] = function(value) {\n        return getTrusted(enumValue, value);\n      };\n      sce[camelCase(\"trust_as_\" + lName)] = function(value) {\n        return trustAs(enumValue, value);\n      };\n    });\n\n    return sce;\n  }];\n}\n\n/**\n * !!! This is an undocumented \"private\" service !!!\n *\n * @name $sniffer\n * @requires $window\n * @requires $document\n *\n * @property {boolean} history Does the browser support html5 history api ?\n * @property {boolean} transitions Does the browser support CSS transition events ?\n * @property {boolean} animations Does the browser support CSS animation events ?\n *\n * @description\n * This is very simple implementation of testing browser's features.\n */\nfunction $SnifferProvider() {\n  this.$get = ['$window', '$document', function($window, $document) {\n    var eventSupport = {},\n        // Chrome Packaged Apps are not allowed to access `history.pushState`. They can be detected by\n        // the presence of `chrome.app.runtime` (see https://developer.chrome.com/apps/api_index)\n        isChromePackagedApp = $window.chrome && $window.chrome.app && $window.chrome.app.runtime,\n        hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState,\n        android =\n          toInt((/android (\\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),\n        boxee = /Boxee/i.test(($window.navigator || {}).userAgent),\n        document = $document[0] || {},\n        vendorPrefix,\n        vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,\n        bodyStyle = document.body && document.body.style,\n        transitions = false,\n        animations = false,\n        match;\n\n    if (bodyStyle) {\n      for (var prop in bodyStyle) {\n        if (match = vendorRegex.exec(prop)) {\n          vendorPrefix = match[0];\n          vendorPrefix = vendorPrefix.substr(0, 1).toUpperCase() + vendorPrefix.substr(1);\n          break;\n        }\n      }\n\n      if (!vendorPrefix) {\n        vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';\n      }\n\n      transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));\n      animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));\n\n      if (android && (!transitions ||  !animations)) {\n        transitions = isString(bodyStyle.webkitTransition);\n        animations = isString(bodyStyle.webkitAnimation);\n      }\n    }\n\n\n    return {\n      // Android has history.pushState, but it does not update location correctly\n      // so let's not use the history API at all.\n      // http://code.google.com/p/android/issues/detail?id=17471\n      // https://github.com/angular/angular.js/issues/904\n\n      // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has\n      // so let's not use the history API also\n      // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined\n      // jshint -W018\n      history: !!(hasHistoryPushState && !(android < 4) && !boxee),\n      // jshint +W018\n      hasEvent: function(event) {\n        // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have\n        // it. In particular the event is not fired when backspace or delete key are pressed or\n        // when cut operation is performed.\n        // IE10+ implements 'input' event but it erroneously fires under various situations,\n        // e.g. when placeholder changes, or a form is focused.\n        if (event === 'input' && msie <= 11) return false;\n\n        if (isUndefined(eventSupport[event])) {\n          var divElm = document.createElement('div');\n          eventSupport[event] = 'on' + event in divElm;\n        }\n\n        return eventSupport[event];\n      },\n      csp: csp(),\n      vendorPrefix: vendorPrefix,\n      transitions: transitions,\n      animations: animations,\n      android: android\n    };\n  }];\n}\n\nvar $templateRequestMinErr = minErr('$compile');\n\n/**\n * @ngdoc provider\n * @name $templateRequestProvider\n * @description\n * Used to configure the options passed to the {@link $http} service when making a template request.\n *\n * For example, it can be used for specifying the \"Accept\" header that is sent to the server, when\n * requesting a template.\n */\nfunction $TemplateRequestProvider() {\n\n  var httpOptions;\n\n  /**\n   * @ngdoc method\n   * @name $templateRequestProvider#httpOptions\n   * @description\n   * The options to be passed to the {@link $http} service when making the request.\n   * You can use this to override options such as the \"Accept\" header for template requests.\n   *\n   * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the\n   * options if not overridden here.\n   *\n   * @param {string=} value new value for the {@link $http} options.\n   * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.\n   */\n  this.httpOptions = function(val) {\n    if (val) {\n      httpOptions = val;\n      return this;\n    }\n    return httpOptions;\n  };\n\n  /**\n   * @ngdoc service\n   * @name $templateRequest\n   *\n   * @description\n   * The `$templateRequest` service runs security checks then downloads the provided template using\n   * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request\n   * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the\n   * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the\n   * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted\n   * when `tpl` is of type string and `$templateCache` has the matching entry.\n   *\n   * If you want to pass custom options to the `$http` service, such as setting the Accept header you\n   * can configure this via {@link $templateRequestProvider#httpOptions}.\n   *\n   * @param {string|TrustedResourceUrl} tpl The HTTP request template URL\n   * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty\n   *\n   * @return {Promise} a promise for the HTTP response data of the given URL.\n   *\n   * @property {number} totalPendingRequests total amount of pending template requests being downloaded.\n   */\n  this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {\n\n    function handleRequestFn(tpl, ignoreRequestError) {\n      handleRequestFn.totalPendingRequests++;\n\n      // We consider the template cache holds only trusted templates, so\n      // there's no need to go through whitelisting again for keys that already\n      // are included in there. This also makes Angular accept any script\n      // directive, no matter its name. However, we still need to unwrap trusted\n      // types.\n      if (!isString(tpl) || !$templateCache.get(tpl)) {\n        tpl = $sce.getTrustedResourceUrl(tpl);\n      }\n\n      var transformResponse = $http.defaults && $http.defaults.transformResponse;\n\n      if (isArray(transformResponse)) {\n        transformResponse = transformResponse.filter(function(transformer) {\n          return transformer !== defaultHttpResponseTransform;\n        });\n      } else if (transformResponse === defaultHttpResponseTransform) {\n        transformResponse = null;\n      }\n\n      return $http.get(tpl, extend({\n          cache: $templateCache,\n          transformResponse: transformResponse\n        }, httpOptions))\n        ['finally'](function() {\n          handleRequestFn.totalPendingRequests--;\n        })\n        .then(function(response) {\n          $templateCache.put(tpl, response.data);\n          return response.data;\n        }, handleError);\n\n      function handleError(resp) {\n        if (!ignoreRequestError) {\n          throw $templateRequestMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',\n            tpl, resp.status, resp.statusText);\n        }\n        return $q.reject(resp);\n      }\n    }\n\n    handleRequestFn.totalPendingRequests = 0;\n\n    return handleRequestFn;\n  }];\n}\n\nfunction $$TestabilityProvider() {\n  this.$get = ['$rootScope', '$browser', '$location',\n       function($rootScope,   $browser,   $location) {\n\n    /**\n     * @name $testability\n     *\n     * @description\n     * The private $$testability service provides a collection of methods for use when debugging\n     * or by automated test and debugging tools.\n     */\n    var testability = {};\n\n    /**\n     * @name $$testability#findBindings\n     *\n     * @description\n     * Returns an array of elements that are bound (via ng-bind or {{}})\n     * to expressions matching the input.\n     *\n     * @param {Element} element The element root to search from.\n     * @param {string} expression The binding expression to match.\n     * @param {boolean} opt_exactMatch If true, only returns exact matches\n     *     for the expression. Filters and whitespace are ignored.\n     */\n    testability.findBindings = function(element, expression, opt_exactMatch) {\n      var bindings = element.getElementsByClassName('ng-binding');\n      var matches = [];\n      forEach(bindings, function(binding) {\n        var dataBinding = angular.element(binding).data('$binding');\n        if (dataBinding) {\n          forEach(dataBinding, function(bindingName) {\n            if (opt_exactMatch) {\n              var matcher = new RegExp('(^|\\\\s)' + escapeForRegexp(expression) + '(\\\\s|\\\\||$)');\n              if (matcher.test(bindingName)) {\n                matches.push(binding);\n              }\n            } else {\n              if (bindingName.indexOf(expression) != -1) {\n                matches.push(binding);\n              }\n            }\n          });\n        }\n      });\n      return matches;\n    };\n\n    /**\n     * @name $$testability#findModels\n     *\n     * @description\n     * Returns an array of elements that are two-way found via ng-model to\n     * expressions matching the input.\n     *\n     * @param {Element} element The element root to search from.\n     * @param {string} expression The model expression to match.\n     * @param {boolean} opt_exactMatch If true, only returns exact matches\n     *     for the expression.\n     */\n    testability.findModels = function(element, expression, opt_exactMatch) {\n      var prefixes = ['ng-', 'data-ng-', 'ng\\\\:'];\n      for (var p = 0; p < prefixes.length; ++p) {\n        var attributeEquals = opt_exactMatch ? '=' : '*=';\n        var selector = '[' + prefixes[p] + 'model' + attributeEquals + '\"' + expression + '\"]';\n        var elements = element.querySelectorAll(selector);\n        if (elements.length) {\n          return elements;\n        }\n      }\n    };\n\n    /**\n     * @name $$testability#getLocation\n     *\n     * @description\n     * Shortcut for getting the location in a browser agnostic way. Returns\n     *     the path, search, and hash. (e.g. /path?a=b#hash)\n     */\n    testability.getLocation = function() {\n      return $location.url();\n    };\n\n    /**\n     * @name $$testability#setLocation\n     *\n     * @description\n     * Shortcut for navigating to a location without doing a full page reload.\n     *\n     * @param {string} url The location url (path, search and hash,\n     *     e.g. /path?a=b#hash) to go to.\n     */\n    testability.setLocation = function(url) {\n      if (url !== $location.url()) {\n        $location.url(url);\n        $rootScope.$digest();\n      }\n    };\n\n    /**\n     * @name $$testability#whenStable\n     *\n     * @description\n     * Calls the callback when $timeout and $http requests are completed.\n     *\n     * @param {function} callback\n     */\n    testability.whenStable = function(callback) {\n      $browser.notifyWhenNoOutstandingRequests(callback);\n    };\n\n    return testability;\n  }];\n}\n\nfunction $TimeoutProvider() {\n  this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',\n       function($rootScope,   $browser,   $q,   $$q,   $exceptionHandler) {\n\n    var deferreds = {};\n\n\n     /**\n      * @ngdoc service\n      * @name $timeout\n      *\n      * @description\n      * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch\n      * block and delegates any exceptions to\n      * {@link ng.$exceptionHandler $exceptionHandler} service.\n      *\n      * The return value of calling `$timeout` is a promise, which will be resolved when\n      * the delay has passed and the timeout function, if provided, is executed.\n      *\n      * To cancel a timeout request, call `$timeout.cancel(promise)`.\n      *\n      * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to\n      * synchronously flush the queue of deferred functions.\n      *\n      * If you only want a promise that will be resolved after some specified delay\n      * then you can call `$timeout` without the `fn` function.\n      *\n      * @param {function()=} fn A function, whose execution should be delayed.\n      * @param {number=} [delay=0] Delay in milliseconds.\n      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise\n      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.\n      * @param {...*=} Pass additional parameters to the executed function.\n      * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise\n      *   will be resolved with the return value of the `fn` function.\n      *\n      */\n    function timeout(fn, delay, invokeApply) {\n      if (!isFunction(fn)) {\n        invokeApply = delay;\n        delay = fn;\n        fn = noop;\n      }\n\n      var args = sliceArgs(arguments, 3),\n          skipApply = (isDefined(invokeApply) && !invokeApply),\n          deferred = (skipApply ? $$q : $q).defer(),\n          promise = deferred.promise,\n          timeoutId;\n\n      timeoutId = $browser.defer(function() {\n        try {\n          deferred.resolve(fn.apply(null, args));\n        } catch (e) {\n          deferred.reject(e);\n          $exceptionHandler(e);\n        }\n        finally {\n          delete deferreds[promise.$$timeoutId];\n        }\n\n        if (!skipApply) $rootScope.$apply();\n      }, delay);\n\n      promise.$$timeoutId = timeoutId;\n      deferreds[timeoutId] = deferred;\n\n      return promise;\n    }\n\n\n     /**\n      * @ngdoc method\n      * @name $timeout#cancel\n      *\n      * @description\n      * Cancels a task associated with the `promise`. As a result of this, the promise will be\n      * resolved with a rejection.\n      *\n      * @param {Promise=} promise Promise returned by the `$timeout` function.\n      * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully\n      *   canceled.\n      */\n    timeout.cancel = function(promise) {\n      if (promise && promise.$$timeoutId in deferreds) {\n        deferreds[promise.$$timeoutId].reject('canceled');\n        delete deferreds[promise.$$timeoutId];\n        return $browser.defer.cancel(promise.$$timeoutId);\n      }\n      return false;\n    };\n\n    return timeout;\n  }];\n}\n\n// NOTE:  The usage of window and document instead of $window and $document here is\n// deliberate.  This service depends on the specific behavior of anchor nodes created by the\n// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and\n// cause us to break tests.  In addition, when the browser resolves a URL for XHR, it\n// doesn't know about mocked locations and resolves URLs to the real document - which is\n// exactly the behavior needed here.  There is little value is mocking these out for this\n// service.\nvar urlParsingNode = document.createElement(\"a\");\nvar originUrl = urlResolve(window.location.href);\n\n\n/**\n *\n * Implementation Notes for non-IE browsers\n * ----------------------------------------\n * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,\n * results both in the normalizing and parsing of the URL.  Normalizing means that a relative\n * URL will be resolved into an absolute URL in the context of the application document.\n * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related\n * properties are all populated to reflect the normalized URL.  This approach has wide\n * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See\n * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *\n * Implementation Notes for IE\n * ---------------------------\n * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other\n * browsers.  However, the parsed components will not be set if the URL assigned did not specify\n * them.  (e.g. if you assign a.href = \"foo\", then a.protocol, a.host, etc. will be empty.)  We\n * work around that by performing the parsing in a 2nd step by taking a previously normalized\n * URL (e.g. by assigning to a.href) and assigning it a.href again.  This correctly populates the\n * properties such as protocol, hostname, port, etc.\n *\n * References:\n *   http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement\n *   http://www.aptana.com/reference/html/api/HTMLAnchorElement.html\n *   http://url.spec.whatwg.org/#urlutils\n *   https://github.com/angular/angular.js/pull/2902\n *   http://james.padolsey.com/javascript/parsing-urls-with-the-dom/\n *\n * @kind function\n * @param {string} url The URL to be parsed.\n * @description Normalizes and parses a URL.\n * @returns {object} Returns the normalized URL as a dictionary.\n *\n *   | member name   | Description    |\n *   |---------------|----------------|\n *   | href          | A normalized version of the provided URL if it was not an absolute URL |\n *   | protocol      | The protocol including the trailing colon                              |\n *   | host          | The host and port (if the port is non-default) of the normalizedUrl    |\n *   | search        | The search params, minus the question mark                             |\n *   | hash          | The hash string, minus the hash symbol\n *   | hostname      | The hostname\n *   | port          | The port, without \":\"\n *   | pathname      | The pathname, beginning with \"/\"\n *\n */\nfunction urlResolve(url) {\n  var href = url;\n\n  if (msie) {\n    // Normalize before parse.  Refer Implementation Notes on why this is\n    // done in two steps on IE.\n    urlParsingNode.setAttribute(\"href\", href);\n    href = urlParsingNode.href;\n  }\n\n  urlParsingNode.setAttribute('href', href);\n\n  // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n  return {\n    href: urlParsingNode.href,\n    protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n    host: urlParsingNode.host,\n    search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n    hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n    hostname: urlParsingNode.hostname,\n    port: urlParsingNode.port,\n    pathname: (urlParsingNode.pathname.charAt(0) === '/')\n      ? urlParsingNode.pathname\n      : '/' + urlParsingNode.pathname\n  };\n}\n\n/**\n * Parse a request URL and determine whether this is a same-origin request as the application document.\n *\n * @param {string|object} requestUrl The url of the request as a string that will be resolved\n * or a parsed URL object.\n * @returns {boolean} Whether the request is for the same origin as the application document.\n */\nfunction urlIsSameOrigin(requestUrl) {\n  var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;\n  return (parsed.protocol === originUrl.protocol &&\n          parsed.host === originUrl.host);\n}\n\n/**\n * @ngdoc service\n * @name $window\n *\n * @description\n * A reference to the browser's `window` object. While `window`\n * is globally available in JavaScript, it causes testability problems, because\n * it is a global variable. In angular we always refer to it through the\n * `$window` service, so it may be overridden, removed or mocked for testing.\n *\n * Expressions, like the one defined for the `ngClick` directive in the example\n * below, are evaluated with respect to the current scope.  Therefore, there is\n * no risk of inadvertently coding in a dependency on a global value in such an\n * expression.\n *\n * @example\n   <example module=\"windowExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('windowExample', [])\n           .controller('ExampleController', ['$scope', '$window', function($scope, $window) {\n             $scope.greeting = 'Hello, World!';\n             $scope.doGreeting = function(greeting) {\n               $window.alert(greeting);\n             };\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"text\" ng-model=\"greeting\" aria-label=\"greeting\" />\n         <button ng-click=\"doGreeting(greeting)\">ALERT</button>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n      it('should display the greeting in the input box', function() {\n       element(by.model('greeting')).sendKeys('Hello, E2E Tests');\n       // If we click the button it will block the test runner\n       // element(':button').click();\n      });\n     </file>\n   </example>\n */\nfunction $WindowProvider() {\n  this.$get = valueFn(window);\n}\n\n/**\n * @name $$cookieReader\n * @requires $document\n *\n * @description\n * This is a private service for reading cookies used by $http and ngCookies\n *\n * @return {Object} a key/value map of the current cookies\n */\nfunction $$CookieReader($document) {\n  var rawDocument = $document[0] || {};\n  var lastCookies = {};\n  var lastCookieString = '';\n\n  function safeDecodeURIComponent(str) {\n    try {\n      return decodeURIComponent(str);\n    } catch (e) {\n      return str;\n    }\n  }\n\n  return function() {\n    var cookieArray, cookie, i, index, name;\n    var currentCookieString = rawDocument.cookie || '';\n\n    if (currentCookieString !== lastCookieString) {\n      lastCookieString = currentCookieString;\n      cookieArray = lastCookieString.split('; ');\n      lastCookies = {};\n\n      for (i = 0; i < cookieArray.length; i++) {\n        cookie = cookieArray[i];\n        index = cookie.indexOf('=');\n        if (index > 0) { //ignore nameless cookies\n          name = safeDecodeURIComponent(cookie.substring(0, index));\n          // the first value that is seen for a cookie is the most\n          // specific one.  values for the same cookie name that\n          // follow are for less specific paths.\n          if (isUndefined(lastCookies[name])) {\n            lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));\n          }\n        }\n      }\n    }\n    return lastCookies;\n  };\n}\n\n$$CookieReader.$inject = ['$document'];\n\nfunction $$CookieReaderProvider() {\n  this.$get = $$CookieReader;\n}\n\n/* global currencyFilter: true,\n dateFilter: true,\n filterFilter: true,\n jsonFilter: true,\n limitToFilter: true,\n lowercaseFilter: true,\n numberFilter: true,\n orderByFilter: true,\n uppercaseFilter: true,\n */\n\n/**\n * @ngdoc provider\n * @name $filterProvider\n * @description\n *\n * Filters are just functions which transform input to an output. However filters need to be\n * Dependency Injected. To achieve this a filter definition consists of a factory function which is\n * annotated with dependencies and is responsible for creating a filter function.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n * (`myapp_subsection_filterx`).\n * </div>\n *\n * ```js\n *   // Filter registration\n *   function MyModule($provide, $filterProvider) {\n *     // create a service to demonstrate injection (not always needed)\n *     $provide.value('greet', function(name){\n *       return 'Hello ' + name + '!';\n *     });\n *\n *     // register a filter factory which uses the\n *     // greet service to demonstrate DI.\n *     $filterProvider.register('greet', function(greet){\n *       // return the filter function which uses the greet service\n *       // to generate salutation\n *       return function(text) {\n *         // filters need to be forgiving so check input validity\n *         return text && greet(text) || text;\n *       };\n *     });\n *   }\n * ```\n *\n * The filter function is registered with the `$injector` under the filter name suffix with\n * `Filter`.\n *\n * ```js\n *   it('should be the same instance', inject(\n *     function($filterProvider) {\n *       $filterProvider.register('reverse', function(){\n *         return ...;\n *       });\n *     },\n *     function($filter, reverseFilter) {\n *       expect($filter('reverse')).toBe(reverseFilter);\n *     });\n * ```\n *\n *\n * For more information about how angular filters work, and how to create your own filters, see\n * {@link guide/filter Filters} in the Angular Developer Guide.\n */\n\n/**\n * @ngdoc service\n * @name $filter\n * @kind function\n * @description\n * Filters are used for formatting data displayed to the user.\n *\n * The general syntax in templates is as follows:\n *\n *         {{ expression [| filter_name[:parameter_value] ... ] }}\n *\n * @param {String} name Name of the filter function to retrieve\n * @return {Function} the filter function\n * @example\n   <example name=\"$filter\" module=\"filterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"MainCtrl\">\n        <h3>{{ originalText }}</h3>\n        <h3>{{ filteredText }}</h3>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n      angular.module('filterExample', [])\n      .controller('MainCtrl', function($scope, $filter) {\n        $scope.originalText = 'hello';\n        $scope.filteredText = $filter('uppercase')($scope.originalText);\n      });\n     </file>\n   </example>\n  */\n$FilterProvider.$inject = ['$provide'];\nfunction $FilterProvider($provide) {\n  var suffix = 'Filter';\n\n  /**\n   * @ngdoc method\n   * @name $filterProvider#register\n   * @param {string|Object} name Name of the filter function, or an object map of filters where\n   *    the keys are the filter names and the values are the filter factories.\n   *\n   *    <div class=\"alert alert-warning\">\n   *    **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.\n   *    Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace\n   *    your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores\n   *    (`myapp_subsection_filterx`).\n   *    </div>\n    * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.\n   * @returns {Object} Registered filter instance, or if a map of filters was provided then a map\n   *    of the registered filter instances.\n   */\n  function register(name, factory) {\n    if (isObject(name)) {\n      var filters = {};\n      forEach(name, function(filter, key) {\n        filters[key] = register(key, filter);\n      });\n      return filters;\n    } else {\n      return $provide.factory(name + suffix, factory);\n    }\n  }\n  this.register = register;\n\n  this.$get = ['$injector', function($injector) {\n    return function(name) {\n      return $injector.get(name + suffix);\n    };\n  }];\n\n  ////////////////////////////////////////\n\n  /* global\n    currencyFilter: false,\n    dateFilter: false,\n    filterFilter: false,\n    jsonFilter: false,\n    limitToFilter: false,\n    lowercaseFilter: false,\n    numberFilter: false,\n    orderByFilter: false,\n    uppercaseFilter: false,\n  */\n\n  register('currency', currencyFilter);\n  register('date', dateFilter);\n  register('filter', filterFilter);\n  register('json', jsonFilter);\n  register('limitTo', limitToFilter);\n  register('lowercase', lowercaseFilter);\n  register('number', numberFilter);\n  register('orderBy', orderByFilter);\n  register('uppercase', uppercaseFilter);\n}\n\n/**\n * @ngdoc filter\n * @name filter\n * @kind function\n *\n * @description\n * Selects a subset of items from `array` and returns it as a new array.\n *\n * @param {Array} array The source array.\n * @param {string|Object|function()} expression The predicate to be used for selecting items from\n *   `array`.\n *\n *   Can be one of:\n *\n *   - `string`: The string is used for matching against the contents of the `array`. All strings or\n *     objects with string properties in `array` that match this string will be returned. This also\n *     applies to nested object properties.\n *     The predicate can be negated by prefixing the string with `!`.\n *\n *   - `Object`: A pattern object can be used to filter specific properties on objects contained\n *     by `array`. For example `{name:\"M\", phone:\"1\"}` predicate will return an array of items\n *     which have property `name` containing \"M\" and property `phone` containing \"1\". A special\n *     property name `$` can be used (as in `{$:\"text\"}`) to accept a match against any\n *     property of the object or its nested object properties. That's equivalent to the simple\n *     substring match with a `string` as described above. The predicate can be negated by prefixing\n *     the string with `!`.\n *     For example `{name: \"!M\"}` predicate will return an array of items which have property `name`\n *     not containing \"M\".\n *\n *     Note that a named property will match properties on the same level only, while the special\n *     `$` property will match properties on the same level or deeper. E.g. an array item like\n *     `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but\n *     **will** be matched by `{$: 'John'}`.\n *\n *   - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.\n *     The function is called for each element of the array, with the element, its index, and\n *     the entire array itself as arguments.\n *\n *     The final result is an array of those elements that the predicate returned true for.\n *\n * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in\n *     determining if the expected value (from the filter expression) and actual value (from\n *     the object in the array) should be considered a match.\n *\n *   Can be one of:\n *\n *   - `function(actual, expected)`:\n *     The function will be given the object value and the predicate value to compare and\n *     should return true if both values should be considered equal.\n *\n *   - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.\n *     This is essentially strict comparison of expected and actual.\n *\n *   - `false|undefined`: A short hand for a function which will look for a substring match in case\n *     insensitive way.\n *\n *     Primitive values are converted to strings. Objects are not compared against primitives,\n *     unless they have a custom `toString` method (e.g. `Date` objects).\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <div ng-init=\"friends = [{name:'John', phone:'555-1276'},\n                                {name:'Mary', phone:'800-BIG-MARY'},\n                                {name:'Mike', phone:'555-4321'},\n                                {name:'Adam', phone:'555-5678'},\n                                {name:'Julie', phone:'555-8765'},\n                                {name:'Juliette', phone:'555-5678'}]\"></div>\n\n       <label>Search: <input ng-model=\"searchText\"></label>\n       <table id=\"searchTextResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friend in friends | filter:searchText\">\n           <td>{{friend.name}}</td>\n           <td>{{friend.phone}}</td>\n         </tr>\n       </table>\n       <hr>\n       <label>Any: <input ng-model=\"search.$\"></label> <br>\n       <label>Name only <input ng-model=\"search.name\"></label><br>\n       <label>Phone only <input ng-model=\"search.phone\"></label><br>\n       <label>Equality <input type=\"checkbox\" ng-model=\"strict\"></label><br>\n       <table id=\"searchObjResults\">\n         <tr><th>Name</th><th>Phone</th></tr>\n         <tr ng-repeat=\"friendObj in friends | filter:search:strict\">\n           <td>{{friendObj.name}}</td>\n           <td>{{friendObj.phone}}</td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var expectFriendNames = function(expectedNames, key) {\n         element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {\n           arr.forEach(function(wd, i) {\n             expect(wd.getText()).toMatch(expectedNames[i]);\n           });\n         });\n       };\n\n       it('should search across all fields when filtering with a string', function() {\n         var searchText = element(by.model('searchText'));\n         searchText.clear();\n         searchText.sendKeys('m');\n         expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');\n\n         searchText.clear();\n         searchText.sendKeys('76');\n         expectFriendNames(['John', 'Julie'], 'friend');\n       });\n\n       it('should search in specific fields when filtering with a predicate object', function() {\n         var searchAny = element(by.model('search.$'));\n         searchAny.clear();\n         searchAny.sendKeys('i');\n         expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');\n       });\n       it('should use a equal comparison when comparator is true', function() {\n         var searchName = element(by.model('search.name'));\n         var strict = element(by.model('strict'));\n         searchName.clear();\n         searchName.sendKeys('Julie');\n         strict.click();\n         expectFriendNames(['Julie'], 'friendObj');\n       });\n     </file>\n   </example>\n */\nfunction filterFilter() {\n  return function(array, expression, comparator) {\n    if (!isArrayLike(array)) {\n      if (array == null) {\n        return array;\n      } else {\n        throw minErr('filter')('notarray', 'Expected array but received: {0}', array);\n      }\n    }\n\n    var expressionType = getTypeForFilter(expression);\n    var predicateFn;\n    var matchAgainstAnyProp;\n\n    switch (expressionType) {\n      case 'function':\n        predicateFn = expression;\n        break;\n      case 'boolean':\n      case 'null':\n      case 'number':\n      case 'string':\n        matchAgainstAnyProp = true;\n        //jshint -W086\n      case 'object':\n        //jshint +W086\n        predicateFn = createPredicateFn(expression, comparator, matchAgainstAnyProp);\n        break;\n      default:\n        return array;\n    }\n\n    return Array.prototype.filter.call(array, predicateFn);\n  };\n}\n\n// Helper functions for `filterFilter`\nfunction createPredicateFn(expression, comparator, matchAgainstAnyProp) {\n  var shouldMatchPrimitives = isObject(expression) && ('$' in expression);\n  var predicateFn;\n\n  if (comparator === true) {\n    comparator = equals;\n  } else if (!isFunction(comparator)) {\n    comparator = function(actual, expected) {\n      if (isUndefined(actual)) {\n        // No substring matching against `undefined`\n        return false;\n      }\n      if ((actual === null) || (expected === null)) {\n        // No substring matching against `null`; only match against `null`\n        return actual === expected;\n      }\n      if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {\n        // Should not compare primitives against objects, unless they have custom `toString` method\n        return false;\n      }\n\n      actual = lowercase('' + actual);\n      expected = lowercase('' + expected);\n      return actual.indexOf(expected) !== -1;\n    };\n  }\n\n  predicateFn = function(item) {\n    if (shouldMatchPrimitives && !isObject(item)) {\n      return deepCompare(item, expression.$, comparator, false);\n    }\n    return deepCompare(item, expression, comparator, matchAgainstAnyProp);\n  };\n\n  return predicateFn;\n}\n\nfunction deepCompare(actual, expected, comparator, matchAgainstAnyProp, dontMatchWholeObject) {\n  var actualType = getTypeForFilter(actual);\n  var expectedType = getTypeForFilter(expected);\n\n  if ((expectedType === 'string') && (expected.charAt(0) === '!')) {\n    return !deepCompare(actual, expected.substring(1), comparator, matchAgainstAnyProp);\n  } else if (isArray(actual)) {\n    // In case `actual` is an array, consider it a match\n    // if ANY of it's items matches `expected`\n    return actual.some(function(item) {\n      return deepCompare(item, expected, comparator, matchAgainstAnyProp);\n    });\n  }\n\n  switch (actualType) {\n    case 'object':\n      var key;\n      if (matchAgainstAnyProp) {\n        for (key in actual) {\n          if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, true)) {\n            return true;\n          }\n        }\n        return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, false);\n      } else if (expectedType === 'object') {\n        for (key in expected) {\n          var expectedVal = expected[key];\n          if (isFunction(expectedVal) || isUndefined(expectedVal)) {\n            continue;\n          }\n\n          var matchAnyProperty = key === '$';\n          var actualVal = matchAnyProperty ? actual : actual[key];\n          if (!deepCompare(actualVal, expectedVal, comparator, matchAnyProperty, matchAnyProperty)) {\n            return false;\n          }\n        }\n        return true;\n      } else {\n        return comparator(actual, expected);\n      }\n      break;\n    case 'function':\n      return false;\n    default:\n      return comparator(actual, expected);\n  }\n}\n\n// Used for easily differentiating between `null` and actual `object`\nfunction getTypeForFilter(val) {\n  return (val === null) ? 'null' : typeof val;\n}\n\nvar MAX_DIGITS = 22;\nvar DECIMAL_SEP = '.';\nvar ZERO_CHAR = '0';\n\n/**\n * @ngdoc filter\n * @name currency\n * @kind function\n *\n * @description\n * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default\n * symbol for current locale is used.\n *\n * @param {number} amount Input to filter.\n * @param {string=} symbol Currency symbol or identifier to be displayed.\n * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale\n * @returns {string} Formatted number.\n *\n *\n * @example\n   <example module=\"currencyExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('currencyExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.amount = 1234.56;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <input type=\"number\" ng-model=\"amount\" aria-label=\"amount\"> <br>\n         default currency symbol ($): <span id=\"currency-default\">{{amount | currency}}</span><br>\n         custom currency identifier (USD$): <span id=\"currency-custom\">{{amount | currency:\"USD$\"}}</span>\n         no fractions (0): <span id=\"currency-no-fractions\">{{amount | currency:\"USD$\":0}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should init with 1234.56', function() {\n         expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');\n         expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');\n         expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');\n       });\n       it('should update', function() {\n         if (browser.params.browser == 'safari') {\n           // Safari does not understand the minus key. See\n           // https://github.com/angular/protractor/issues/481\n           return;\n         }\n         element(by.model('amount')).clear();\n         element(by.model('amount')).sendKeys('-1234');\n         expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');\n         expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');\n         expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');\n       });\n     </file>\n   </example>\n */\ncurrencyFilter.$inject = ['$locale'];\nfunction currencyFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(amount, currencySymbol, fractionSize) {\n    if (isUndefined(currencySymbol)) {\n      currencySymbol = formats.CURRENCY_SYM;\n    }\n\n    if (isUndefined(fractionSize)) {\n      fractionSize = formats.PATTERNS[1].maxFrac;\n    }\n\n    // if null or undefined pass it through\n    return (amount == null)\n        ? amount\n        : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).\n            replace(/\\u00A4/g, currencySymbol);\n  };\n}\n\n/**\n * @ngdoc filter\n * @name number\n * @kind function\n *\n * @description\n * Formats a number as text.\n *\n * If the input is null or undefined, it will just be returned.\n * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively.\n * If the input is not a number an empty string is returned.\n *\n *\n * @param {number|string} number Number to format.\n * @param {(number|string)=} fractionSize Number of decimal places to round the number to.\n * If this is not provided then the fraction size is computed from the current locale's number\n * formatting pattern. In the case of the default locale, it will be 3.\n * @returns {string} Number rounded to fractionSize and places a “,” after each third digit.\n *\n * @example\n   <example module=\"numberFilterExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('numberFilterExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.val = 1234.56789;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>Enter number: <input ng-model='val'></label><br>\n         Default formatting: <span id='number-default'>{{val | number}}</span><br>\n         No fractions: <span>{{val | number:0}}</span><br>\n         Negative number: <span>{{-val | number:4}}</span>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format numbers', function() {\n         expect(element(by.id('number-default')).getText()).toBe('1,234.568');\n         expect(element(by.binding('val | number:0')).getText()).toBe('1,235');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');\n       });\n\n       it('should update', function() {\n         element(by.model('val')).clear();\n         element(by.model('val')).sendKeys('3374.333');\n         expect(element(by.id('number-default')).getText()).toBe('3,374.333');\n         expect(element(by.binding('val | number:0')).getText()).toBe('3,374');\n         expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');\n      });\n     </file>\n   </example>\n */\nnumberFilter.$inject = ['$locale'];\nfunction numberFilter($locale) {\n  var formats = $locale.NUMBER_FORMATS;\n  return function(number, fractionSize) {\n\n    // if null or undefined pass it through\n    return (number == null)\n        ? number\n        : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,\n                       fractionSize);\n  };\n}\n\n/**\n * Parse a number (as a string) into three components that can be used\n * for formatting the number.\n *\n * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)\n *\n * @param  {string} numStr The number to parse\n * @return {object} An object describing this number, containing the following keys:\n *  - d : an array of digits containing leading zeros as necessary\n *  - i : the number of the digits in `d` that are to the left of the decimal point\n *  - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d`\n *\n */\nfunction parse(numStr) {\n  var exponent = 0, digits, numberOfIntegerDigits;\n  var i, j, zeros;\n\n  // Decimal point?\n  if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {\n    numStr = numStr.replace(DECIMAL_SEP, '');\n  }\n\n  // Exponential form?\n  if ((i = numStr.search(/e/i)) > 0) {\n    // Work out the exponent.\n    if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;\n    numberOfIntegerDigits += +numStr.slice(i + 1);\n    numStr = numStr.substring(0, i);\n  } else if (numberOfIntegerDigits < 0) {\n    // There was no decimal point or exponent so it is an integer.\n    numberOfIntegerDigits = numStr.length;\n  }\n\n  // Count the number of leading zeros.\n  for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++) {/* jshint noempty: false */}\n\n  if (i == (zeros = numStr.length)) {\n    // The digits are all zero.\n    digits = [0];\n    numberOfIntegerDigits = 1;\n  } else {\n    // Count the number of trailing zeros\n    zeros--;\n    while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;\n\n    // Trailing zeros are insignificant so ignore them\n    numberOfIntegerDigits -= i;\n    digits = [];\n    // Convert string to array of digits without leading/trailing zeros.\n    for (j = 0; i <= zeros; i++, j++) {\n      digits[j] = +numStr.charAt(i);\n    }\n  }\n\n  // If the number overflows the maximum allowed digits then use an exponent.\n  if (numberOfIntegerDigits > MAX_DIGITS) {\n    digits = digits.splice(0, MAX_DIGITS - 1);\n    exponent = numberOfIntegerDigits - 1;\n    numberOfIntegerDigits = 1;\n  }\n\n  return { d: digits, e: exponent, i: numberOfIntegerDigits };\n}\n\n/**\n * Round the parsed number to the specified number of decimal places\n * This function changed the parsedNumber in-place\n */\nfunction roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {\n    var digits = parsedNumber.d;\n    var fractionLen = digits.length - parsedNumber.i;\n\n    // determine fractionSize if it is not specified; `+fractionSize` converts it to a number\n    fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;\n\n    // The index of the digit to where rounding is to occur\n    var roundAt = fractionSize + parsedNumber.i;\n    var digit = digits[roundAt];\n\n    if (roundAt > 0) {\n      // Drop fractional digits beyond `roundAt`\n      digits.splice(Math.max(parsedNumber.i, roundAt));\n\n      // Set non-fractional digits beyond `roundAt` to 0\n      for (var j = roundAt; j < digits.length; j++) {\n        digits[j] = 0;\n      }\n    } else {\n      // We rounded to zero so reset the parsedNumber\n      fractionLen = Math.max(0, fractionLen);\n      parsedNumber.i = 1;\n      digits.length = Math.max(1, roundAt = fractionSize + 1);\n      digits[0] = 0;\n      for (var i = 1; i < roundAt; i++) digits[i] = 0;\n    }\n\n    if (digit >= 5) {\n      if (roundAt - 1 < 0) {\n        for (var k = 0; k > roundAt; k--) {\n          digits.unshift(0);\n          parsedNumber.i++;\n        }\n        digits.unshift(1);\n        parsedNumber.i++;\n      } else {\n        digits[roundAt - 1]++;\n      }\n    }\n\n    // Pad out with zeros to get the required fraction length\n    for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);\n\n\n    // Do any carrying, e.g. a digit was rounded up to 10\n    var carry = digits.reduceRight(function(carry, d, i, digits) {\n      d = d + carry;\n      digits[i] = d % 10;\n      return Math.floor(d / 10);\n    }, 0);\n    if (carry) {\n      digits.unshift(carry);\n      parsedNumber.i++;\n    }\n}\n\n/**\n * Format a number into a string\n * @param  {number} number       The number to format\n * @param  {{\n *           minFrac, // the minimum number of digits required in the fraction part of the number\n *           maxFrac, // the maximum number of digits required in the fraction part of the number\n *           gSize,   // number of digits in each group of separated digits\n *           lgSize,  // number of digits in the last group of digits before the decimal separator\n *           negPre,  // the string to go in front of a negative number (e.g. `-` or `(`))\n *           posPre,  // the string to go in front of a positive number\n *           negSuf,  // the string to go after a negative number (e.g. `)`)\n *           posSuf   // the string to go after a positive number\n *         }} pattern\n * @param  {string} groupSep     The string to separate groups of number (e.g. `,`)\n * @param  {string} decimalSep   The string to act as the decimal separator (e.g. `.`)\n * @param  {[type]} fractionSize The size of the fractional part of the number\n * @return {string}              The number formatted as a string\n */\nfunction formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {\n\n  if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';\n\n  var isInfinity = !isFinite(number);\n  var isZero = false;\n  var numStr = Math.abs(number) + '',\n      formattedText = '',\n      parsedNumber;\n\n  if (isInfinity) {\n    formattedText = '\\u221e';\n  } else {\n    parsedNumber = parse(numStr);\n\n    roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);\n\n    var digits = parsedNumber.d;\n    var integerLen = parsedNumber.i;\n    var exponent = parsedNumber.e;\n    var decimals = [];\n    isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);\n\n    // pad zeros for small numbers\n    while (integerLen < 0) {\n      digits.unshift(0);\n      integerLen++;\n    }\n\n    // extract decimals digits\n    if (integerLen > 0) {\n      decimals = digits.splice(integerLen);\n    } else {\n      decimals = digits;\n      digits = [0];\n    }\n\n    // format the integer digits with grouping separators\n    var groups = [];\n    if (digits.length >= pattern.lgSize) {\n      groups.unshift(digits.splice(-pattern.lgSize).join(''));\n    }\n    while (digits.length > pattern.gSize) {\n      groups.unshift(digits.splice(-pattern.gSize).join(''));\n    }\n    if (digits.length) {\n      groups.unshift(digits.join(''));\n    }\n    formattedText = groups.join(groupSep);\n\n    // append the decimal digits\n    if (decimals.length) {\n      formattedText += decimalSep + decimals.join('');\n    }\n\n    if (exponent) {\n      formattedText += 'e+' + exponent;\n    }\n  }\n  if (number < 0 && !isZero) {\n    return pattern.negPre + formattedText + pattern.negSuf;\n  } else {\n    return pattern.posPre + formattedText + pattern.posSuf;\n  }\n}\n\nfunction padNumber(num, digits, trim, negWrap) {\n  var neg = '';\n  if (num < 0 || (negWrap && num <= 0)) {\n    if (negWrap) {\n      num = -num + 1;\n    } else {\n      num = -num;\n      neg = '-';\n    }\n  }\n  num = '' + num;\n  while (num.length < digits) num = ZERO_CHAR + num;\n  if (trim) {\n    num = num.substr(num.length - digits);\n  }\n  return neg + num;\n}\n\n\nfunction dateGetter(name, size, offset, trim, negWrap) {\n  offset = offset || 0;\n  return function(date) {\n    var value = date['get' + name]();\n    if (offset > 0 || value > -offset) {\n      value += offset;\n    }\n    if (value === 0 && offset == -12) value = 12;\n    return padNumber(value, size, trim, negWrap);\n  };\n}\n\nfunction dateStrGetter(name, shortForm, standAlone) {\n  return function(date, formats) {\n    var value = date['get' + name]();\n    var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : '');\n    var get = uppercase(propPrefix + name);\n\n    return formats[get][value];\n  };\n}\n\nfunction timeZoneGetter(date, formats, offset) {\n  var zone = -1 * offset;\n  var paddedZone = (zone >= 0) ? \"+\" : \"\";\n\n  paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +\n                padNumber(Math.abs(zone % 60), 2);\n\n  return paddedZone;\n}\n\nfunction getFirstThursdayOfYear(year) {\n    // 0 = index of January\n    var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();\n    // 4 = index of Thursday (+1 to account for 1st = 5)\n    // 11 = index of *next* Thursday (+1 account for 1st = 12)\n    return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);\n}\n\nfunction getThursdayThisWeek(datetime) {\n    return new Date(datetime.getFullYear(), datetime.getMonth(),\n      // 4 = index of Thursday\n      datetime.getDate() + (4 - datetime.getDay()));\n}\n\nfunction weekGetter(size) {\n   return function(date) {\n      var firstThurs = getFirstThursdayOfYear(date.getFullYear()),\n         thisThurs = getThursdayThisWeek(date);\n\n      var diff = +thisThurs - +firstThurs,\n         result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week\n\n      return padNumber(result, size);\n   };\n}\n\nfunction ampmGetter(date, formats) {\n  return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];\n}\n\nfunction eraGetter(date, formats) {\n  return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];\n}\n\nfunction longEraGetter(date, formats) {\n  return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];\n}\n\nvar DATE_FORMATS = {\n  yyyy: dateGetter('FullYear', 4, 0, false, true),\n    yy: dateGetter('FullYear', 2, 0, true, true),\n     y: dateGetter('FullYear', 1, 0, false, true),\n  MMMM: dateStrGetter('Month'),\n   MMM: dateStrGetter('Month', true),\n    MM: dateGetter('Month', 2, 1),\n     M: dateGetter('Month', 1, 1),\n  LLLL: dateStrGetter('Month', false, true),\n    dd: dateGetter('Date', 2),\n     d: dateGetter('Date', 1),\n    HH: dateGetter('Hours', 2),\n     H: dateGetter('Hours', 1),\n    hh: dateGetter('Hours', 2, -12),\n     h: dateGetter('Hours', 1, -12),\n    mm: dateGetter('Minutes', 2),\n     m: dateGetter('Minutes', 1),\n    ss: dateGetter('Seconds', 2),\n     s: dateGetter('Seconds', 1),\n     // while ISO 8601 requires fractions to be prefixed with `.` or `,`\n     // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions\n   sss: dateGetter('Milliseconds', 3),\n  EEEE: dateStrGetter('Day'),\n   EEE: dateStrGetter('Day', true),\n     a: ampmGetter,\n     Z: timeZoneGetter,\n    ww: weekGetter(2),\n     w: weekGetter(1),\n     G: eraGetter,\n     GG: eraGetter,\n     GGG: eraGetter,\n     GGGG: longEraGetter\n};\n\nvar DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,\n    NUMBER_STRING = /^\\-?\\d+$/;\n\n/**\n * @ngdoc filter\n * @name date\n * @kind function\n *\n * @description\n *   Formats `date` to a string based on the requested `format`.\n *\n *   `format` string can be composed of the following elements:\n *\n *   * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)\n *   * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)\n *   * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)\n *   * `'MMMM'`: Month in year (January-December)\n *   * `'MMM'`: Month in year (Jan-Dec)\n *   * `'MM'`: Month in year, padded (01-12)\n *   * `'M'`: Month in year (1-12)\n *   * `'LLLL'`: Stand-alone month in year (January-December)\n *   * `'dd'`: Day in month, padded (01-31)\n *   * `'d'`: Day in month (1-31)\n *   * `'EEEE'`: Day in Week,(Sunday-Saturday)\n *   * `'EEE'`: Day in Week, (Sun-Sat)\n *   * `'HH'`: Hour in day, padded (00-23)\n *   * `'H'`: Hour in day (0-23)\n *   * `'hh'`: Hour in AM/PM, padded (01-12)\n *   * `'h'`: Hour in AM/PM, (1-12)\n *   * `'mm'`: Minute in hour, padded (00-59)\n *   * `'m'`: Minute in hour (0-59)\n *   * `'ss'`: Second in minute, padded (00-59)\n *   * `'s'`: Second in minute (0-59)\n *   * `'sss'`: Millisecond in second, padded (000-999)\n *   * `'a'`: AM/PM marker\n *   * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)\n *   * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year\n *   * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year\n *   * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')\n *   * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')\n *\n *   `format` string can also be one of the following predefined\n *   {@link guide/i18n localizable formats}:\n *\n *   * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale\n *     (e.g. Sep 3, 2010 12:05:08 PM)\n *   * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US  locale (e.g. 9/3/10 12:05 PM)\n *   * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US  locale\n *     (e.g. Friday, September 3, 2010)\n *   * `'longDate'`: equivalent to `'MMMM d, y'` for en_US  locale (e.g. September 3, 2010)\n *   * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US  locale (e.g. Sep 3, 2010)\n *   * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)\n *   * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)\n *   * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)\n *\n *   `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.\n *   `\"h 'in the morning'\"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence\n *   (e.g. `\"h 'o''clock'\"`).\n *\n * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or\n *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its\n *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is\n *    specified in the string input, the time is considered to be in the local timezone.\n * @param {string=} format Formatting rules (see Description). If not specified,\n *    `mediumDate` is used.\n * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the\n *    continental US time zone abbreviations, but for general use, use a time zone offset, for\n *    example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n *    If not specified, the timezone of the browser will be used.\n * @returns {string} Formatted string or the input if input is not recognized as date/millis.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:\n           <span>{{1288323623006 | date:'medium'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:\n          <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:\n          <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>\n       <span ng-non-bindable>{{1288323623006 | date:\"MM/dd/yyyy 'at' h:mma\"}}</span>:\n          <span>{{'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"}}</span><br>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should format date', function() {\n         expect(element(by.binding(\"1288323623006 | date:'medium'\")).getText()).\n            toMatch(/Oct 2\\d, 2010 \\d{1,2}:\\d{2}:\\d{2} (AM|PM)/);\n         expect(element(by.binding(\"1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'\")).getText()).\n            toMatch(/2010\\-10\\-2\\d \\d{2}:\\d{2}:\\d{2} (\\-|\\+)?\\d{4}/);\n         expect(element(by.binding(\"'1288323623006' | date:'MM/dd/yyyy @ h:mma'\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 @ \\d{1,2}:\\d{2}(AM|PM)/);\n         expect(element(by.binding(\"'1288323623006' | date:\\\"MM/dd/yyyy 'at' h:mma\\\"\")).getText()).\n            toMatch(/10\\/2\\d\\/2010 at \\d{1,2}:\\d{2}(AM|PM)/);\n       });\n     </file>\n   </example>\n */\ndateFilter.$inject = ['$locale'];\nfunction dateFilter($locale) {\n\n\n  var R_ISO8601_STR = /^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;\n                     // 1        2       3         4          5          6          7          8  9     10      11\n  function jsonStringToDate(string) {\n    var match;\n    if (match = string.match(R_ISO8601_STR)) {\n      var date = new Date(0),\n          tzHour = 0,\n          tzMin  = 0,\n          dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,\n          timeSetter = match[8] ? date.setUTCHours : date.setHours;\n\n      if (match[9]) {\n        tzHour = toInt(match[9] + match[10]);\n        tzMin = toInt(match[9] + match[11]);\n      }\n      dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));\n      var h = toInt(match[4] || 0) - tzHour;\n      var m = toInt(match[5] || 0) - tzMin;\n      var s = toInt(match[6] || 0);\n      var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);\n      timeSetter.call(date, h, m, s, ms);\n      return date;\n    }\n    return string;\n  }\n\n\n  return function(date, format, timezone) {\n    var text = '',\n        parts = [],\n        fn, match;\n\n    format = format || 'mediumDate';\n    format = $locale.DATETIME_FORMATS[format] || format;\n    if (isString(date)) {\n      date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);\n    }\n\n    if (isNumber(date)) {\n      date = new Date(date);\n    }\n\n    if (!isDate(date) || !isFinite(date.getTime())) {\n      return date;\n    }\n\n    while (format) {\n      match = DATE_FORMATS_SPLIT.exec(format);\n      if (match) {\n        parts = concat(parts, match, 1);\n        format = parts.pop();\n      } else {\n        parts.push(format);\n        format = null;\n      }\n    }\n\n    var dateTimezoneOffset = date.getTimezoneOffset();\n    if (timezone) {\n      dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);\n      date = convertTimezoneToLocal(date, timezone, true);\n    }\n    forEach(parts, function(value) {\n      fn = DATE_FORMATS[value];\n      text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)\n                 : value === \"''\" ? \"'\" : value.replace(/(^'|'$)/g, '').replace(/''/g, \"'\");\n    });\n\n    return text;\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name json\n * @kind function\n *\n * @description\n *   Allows you to convert a JavaScript object into JSON string.\n *\n *   This filter is mostly useful for debugging. When using the double curly {{value}} notation\n *   the binding is automatically converted to JSON.\n *\n * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.\n * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.\n * @returns {string} JSON string.\n *\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <pre id=\"default-spacing\">{{ {'name':'value'} | json }}</pre>\n       <pre id=\"custom-spacing\">{{ {'name':'value'} | json:4 }}</pre>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should jsonify filtered objects', function() {\n         expect(element(by.id('default-spacing')).getText()).toMatch(/\\{\\n  \"name\": ?\"value\"\\n}/);\n         expect(element(by.id('custom-spacing')).getText()).toMatch(/\\{\\n    \"name\": ?\"value\"\\n}/);\n       });\n     </file>\n   </example>\n *\n */\nfunction jsonFilter() {\n  return function(object, spacing) {\n    if (isUndefined(spacing)) {\n        spacing = 2;\n    }\n    return toJson(object, spacing);\n  };\n}\n\n\n/**\n * @ngdoc filter\n * @name lowercase\n * @kind function\n * @description\n * Converts string to lowercase.\n * @see angular.lowercase\n */\nvar lowercaseFilter = valueFn(lowercase);\n\n\n/**\n * @ngdoc filter\n * @name uppercase\n * @kind function\n * @description\n * Converts string to uppercase.\n * @see angular.uppercase\n */\nvar uppercaseFilter = valueFn(uppercase);\n\n/**\n * @ngdoc filter\n * @name limitTo\n * @kind function\n *\n * @description\n * Creates a new array or string containing only a specified number of elements. The elements\n * are taken from either the beginning or the end of the source array, string or number, as specified by\n * the value and sign (positive or negative) of `limit`. If a number is used as input, it is\n * converted to a string.\n *\n * @param {Array|string|number} input Source array, string or number to be limited.\n * @param {string|number} limit The length of the returned array or string. If the `limit` number\n *     is positive, `limit` number of items from the beginning of the source array/string are copied.\n *     If the number is negative, `limit` number  of items from the end of the source array/string\n *     are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,\n *     the input will be returned unchanged.\n * @param {(string|number)=} begin Index at which to begin limitation. As a negative index, `begin`\n *     indicates an offset from the end of `input`. Defaults to `0`.\n * @returns {Array|string} A new sub-array or substring of length `limit` or less if input array\n *     had less than `limit` elements.\n *\n * @example\n   <example module=\"limitToExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('limitToExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.numbers = [1,2,3,4,5,6,7,8,9];\n             $scope.letters = \"abcdefghi\";\n             $scope.longNumber = 2345432342;\n             $scope.numLimit = 3;\n             $scope.letterLimit = 3;\n             $scope.longNumberLimit = 3;\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>\n            Limit {{numbers}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"numLimit\">\n         </label>\n         <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>\n         <label>\n            Limit {{letters}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"letterLimit\">\n         </label>\n         <p>Output letters: {{ letters | limitTo:letterLimit }}</p>\n         <label>\n            Limit {{longNumber}} to:\n            <input type=\"number\" step=\"1\" ng-model=\"longNumberLimit\">\n         </label>\n         <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var numLimitInput = element(by.model('numLimit'));\n       var letterLimitInput = element(by.model('letterLimit'));\n       var longNumberLimitInput = element(by.model('longNumberLimit'));\n       var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));\n       var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));\n       var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));\n\n       it('should limit the number array to first three items', function() {\n         expect(numLimitInput.getAttribute('value')).toBe('3');\n         expect(letterLimitInput.getAttribute('value')).toBe('3');\n         expect(longNumberLimitInput.getAttribute('value')).toBe('3');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abc');\n         expect(limitedLongNumber.getText()).toEqual('Output long number: 234');\n       });\n\n       // There is a bug in safari and protractor that doesn't like the minus key\n       // it('should update the output when -3 is entered', function() {\n       //   numLimitInput.clear();\n       //   numLimitInput.sendKeys('-3');\n       //   letterLimitInput.clear();\n       //   letterLimitInput.sendKeys('-3');\n       //   longNumberLimitInput.clear();\n       //   longNumberLimitInput.sendKeys('-3');\n       //   expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');\n       //   expect(limitedLetters.getText()).toEqual('Output letters: ghi');\n       //   expect(limitedLongNumber.getText()).toEqual('Output long number: 342');\n       // });\n\n       it('should not exceed the maximum size of input array', function() {\n         numLimitInput.clear();\n         numLimitInput.sendKeys('100');\n         letterLimitInput.clear();\n         letterLimitInput.sendKeys('100');\n         longNumberLimitInput.clear();\n         longNumberLimitInput.sendKeys('100');\n         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');\n         expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');\n         expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');\n       });\n     </file>\n   </example>\n*/\nfunction limitToFilter() {\n  return function(input, limit, begin) {\n    if (Math.abs(Number(limit)) === Infinity) {\n      limit = Number(limit);\n    } else {\n      limit = toInt(limit);\n    }\n    if (isNaN(limit)) return input;\n\n    if (isNumber(input)) input = input.toString();\n    if (!isArray(input) && !isString(input)) return input;\n\n    begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);\n    begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;\n\n    if (limit >= 0) {\n      return input.slice(begin, begin + limit);\n    } else {\n      if (begin === 0) {\n        return input.slice(limit, input.length);\n      } else {\n        return input.slice(Math.max(0, begin + limit), begin);\n      }\n    }\n  };\n}\n\n/**\n * @ngdoc filter\n * @name orderBy\n * @kind function\n *\n * @description\n * Orders a specified `array` by the `expression` predicate. It is ordered alphabetically\n * for strings and numerically for numbers. Note: if you notice numbers are not being sorted\n * as expected, make sure they are actually being saved as numbers and not strings.\n * Array-like values (e.g. NodeLists, jQuery objects, TypedArrays, Strings, etc) are also supported.\n *\n * @param {Array} array The array (or array-like object) to sort.\n * @param {function(*)|string|Array.<(function(*)|string)>=} expression A predicate to be\n *    used by the comparator to determine the order of elements.\n *\n *    Can be one of:\n *\n *    - `function`: Getter function. The result of this function will be sorted using the\n *      `<`, `===`, `>` operator.\n *    - `string`: An Angular expression. The result of this expression is used to compare elements\n *      (for example `name` to sort by a property called `name` or `name.substr(0, 3)` to sort by\n *      3 first characters of a property called `name`). The result of a constant expression\n *      is interpreted as a property name to be used in comparisons (for example `\"special name\"`\n *      to sort object by the value of their `special name` property). An expression can be\n *      optionally prefixed with `+` or `-` to control ascending or descending sort order\n *      (for example, `+name` or `-name`). If no property is provided, (e.g. `'+'`) then the array\n *      element itself is used to compare where sorting.\n *    - `Array`: An array of function or string predicates. The first predicate in the array\n *      is used for sorting, but when two items are equivalent, the next predicate is used.\n *\n *    If the predicate is missing or empty then it defaults to `'+'`.\n *\n * @param {boolean=} reverse Reverse the order of the array.\n * @returns {Array} Sorted copy of the source array.\n *\n *\n * @example\n * The example below demonstrates a simple ngRepeat, where the data is sorted\n * by age in descending order (predicate is set to `'-age'`).\n * `reverse` is not set, which means it defaults to `false`.\n   <example module=\"orderByExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <table class=\"friend\">\n           <tr>\n             <th>Name</th>\n             <th>Phone Number</th>\n             <th>Age</th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:'-age'\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('orderByExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.friends =\n               [{name:'John', phone:'555-1212', age:10},\n                {name:'Mary', phone:'555-9876', age:19},\n                {name:'Mike', phone:'555-4321', age:21},\n                {name:'Adam', phone:'555-5678', age:35},\n                {name:'Julie', phone:'555-8765', age:29}];\n         }]);\n     </file>\n   </example>\n *\n * The predicate and reverse parameters can be controlled dynamically through scope properties,\n * as shown in the next example.\n * @example\n   <example module=\"orderByExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n         <hr/>\n         <button ng-click=\"predicate=''\">Set to unsorted</button>\n         <table class=\"friend\">\n           <tr>\n            <th>\n                <button ng-click=\"order('name')\">Name</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n            <th>\n                <button ng-click=\"order('phone')\">Phone Number</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n            <th>\n                <button ng-click=\"order('age')\">Age</button>\n                <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n            </th>\n           </tr>\n           <tr ng-repeat=\"friend in friends | orderBy:predicate:reverse\">\n             <td>{{friend.name}}</td>\n             <td>{{friend.phone}}</td>\n             <td>{{friend.age}}</td>\n           </tr>\n         </table>\n       </div>\n     </file>\n     <file name=\"script.js\">\n       angular.module('orderByExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.friends =\n               [{name:'John', phone:'555-1212', age:10},\n                {name:'Mary', phone:'555-9876', age:19},\n                {name:'Mike', phone:'555-4321', age:21},\n                {name:'Adam', phone:'555-5678', age:35},\n                {name:'Julie', phone:'555-8765', age:29}];\n           $scope.predicate = 'age';\n           $scope.reverse = true;\n           $scope.order = function(predicate) {\n             $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n             $scope.predicate = predicate;\n           };\n         }]);\n      </file>\n     <file name=\"style.css\">\n       .sortorder:after {\n         content: '\\25b2';\n       }\n       .sortorder.reverse:after {\n         content: '\\25bc';\n       }\n     </file>\n   </example>\n *\n * It's also possible to call the orderBy filter manually, by injecting `$filter`, retrieving the\n * filter routine with `$filter('orderBy')`, and calling the returned filter routine with the\n * desired parameters.\n *\n * Example:\n *\n * @example\n  <example module=\"orderByExample\">\n    <file name=\"index.html\">\n    <div ng-controller=\"ExampleController\">\n      <pre>Sorting predicate = {{predicate}}; reverse = {{reverse}}</pre>\n      <table class=\"friend\">\n        <tr>\n          <th>\n              <button ng-click=\"order('name')\">Name</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'name'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n          <th>\n              <button ng-click=\"order('phone')\">Phone Number</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'phone'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n          <th>\n              <button ng-click=\"order('age')\">Age</button>\n              <span class=\"sortorder\" ng-show=\"predicate === 'age'\" ng-class=\"{reverse:reverse}\"></span>\n          </th>\n        </tr>\n        <tr ng-repeat=\"friend in friends\">\n          <td>{{friend.name}}</td>\n          <td>{{friend.phone}}</td>\n          <td>{{friend.age}}</td>\n        </tr>\n      </table>\n    </div>\n    </file>\n\n    <file name=\"script.js\">\n      angular.module('orderByExample', [])\n        .controller('ExampleController', ['$scope', '$filter', function($scope, $filter) {\n          var orderBy = $filter('orderBy');\n          $scope.friends = [\n            { name: 'John',    phone: '555-1212',    age: 10 },\n            { name: 'Mary',    phone: '555-9876',    age: 19 },\n            { name: 'Mike',    phone: '555-4321',    age: 21 },\n            { name: 'Adam',    phone: '555-5678',    age: 35 },\n            { name: 'Julie',   phone: '555-8765',    age: 29 }\n          ];\n          $scope.order = function(predicate) {\n            $scope.predicate = predicate;\n            $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;\n            $scope.friends = orderBy($scope.friends, predicate, $scope.reverse);\n          };\n          $scope.order('age', true);\n        }]);\n    </file>\n\n    <file name=\"style.css\">\n       .sortorder:after {\n         content: '\\25b2';\n       }\n       .sortorder.reverse:after {\n         content: '\\25bc';\n       }\n    </file>\n</example>\n */\norderByFilter.$inject = ['$parse'];\nfunction orderByFilter($parse) {\n  return function(array, sortPredicate, reverseOrder) {\n\n    if (array == null) return array;\n    if (!isArrayLike(array)) {\n      throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);\n    }\n\n    if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }\n    if (sortPredicate.length === 0) { sortPredicate = ['+']; }\n\n    var predicates = processPredicates(sortPredicate, reverseOrder);\n    // Add a predicate at the end that evaluates to the element index. This makes the\n    // sort stable as it works as a tie-breaker when all the input predicates cannot\n    // distinguish between two elements.\n    predicates.push({ get: function() { return {}; }, descending: reverseOrder ? -1 : 1});\n\n    // The next three lines are a version of a Swartzian Transform idiom from Perl\n    // (sometimes called the Decorate-Sort-Undecorate idiom)\n    // See https://en.wikipedia.org/wiki/Schwartzian_transform\n    var compareValues = Array.prototype.map.call(array, getComparisonObject);\n    compareValues.sort(doComparison);\n    array = compareValues.map(function(item) { return item.value; });\n\n    return array;\n\n    function getComparisonObject(value, index) {\n      return {\n        value: value,\n        predicateValues: predicates.map(function(predicate) {\n          return getPredicateValue(predicate.get(value), index);\n        })\n      };\n    }\n\n    function doComparison(v1, v2) {\n      var result = 0;\n      for (var index=0, length = predicates.length; index < length; ++index) {\n        result = compare(v1.predicateValues[index], v2.predicateValues[index]) * predicates[index].descending;\n        if (result) break;\n      }\n      return result;\n    }\n  };\n\n  function processPredicates(sortPredicate, reverseOrder) {\n    reverseOrder = reverseOrder ? -1 : 1;\n    return sortPredicate.map(function(predicate) {\n      var descending = 1, get = identity;\n\n      if (isFunction(predicate)) {\n        get = predicate;\n      } else if (isString(predicate)) {\n        if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {\n          descending = predicate.charAt(0) == '-' ? -1 : 1;\n          predicate = predicate.substring(1);\n        }\n        if (predicate !== '') {\n          get = $parse(predicate);\n          if (get.constant) {\n            var key = get();\n            get = function(value) { return value[key]; };\n          }\n        }\n      }\n      return { get: get, descending: descending * reverseOrder };\n    });\n  }\n\n  function isPrimitive(value) {\n    switch (typeof value) {\n      case 'number': /* falls through */\n      case 'boolean': /* falls through */\n      case 'string':\n        return true;\n      default:\n        return false;\n    }\n  }\n\n  function objectValue(value, index) {\n    // If `valueOf` is a valid function use that\n    if (typeof value.valueOf === 'function') {\n      value = value.valueOf();\n      if (isPrimitive(value)) return value;\n    }\n    // If `toString` is a valid function and not the one from `Object.prototype` use that\n    if (hasCustomToString(value)) {\n      value = value.toString();\n      if (isPrimitive(value)) return value;\n    }\n    // We have a basic object so we use the position of the object in the collection\n    return index;\n  }\n\n  function getPredicateValue(value, index) {\n    var type = typeof value;\n    if (value === null) {\n      type = 'string';\n      value = 'null';\n    } else if (type === 'string') {\n      value = value.toLowerCase();\n    } else if (type === 'object') {\n      value = objectValue(value, index);\n    }\n    return { value: value, type: type };\n  }\n\n  function compare(v1, v2) {\n    var result = 0;\n    if (v1.type === v2.type) {\n      if (v1.value !== v2.value) {\n        result = v1.value < v2.value ? -1 : 1;\n      }\n    } else {\n      result = v1.type < v2.type ? -1 : 1;\n    }\n    return result;\n  }\n}\n\nfunction ngDirective(directive) {\n  if (isFunction(directive)) {\n    directive = {\n      link: directive\n    };\n  }\n  directive.restrict = directive.restrict || 'AC';\n  return valueFn(directive);\n}\n\n/**\n * @ngdoc directive\n * @name a\n * @restrict E\n *\n * @description\n * Modifies the default behavior of the html A tag so that the default action is prevented when\n * the href attribute is empty.\n *\n * This change permits the easy creation of action links with the `ngClick` directive\n * without changing the location or causing page reloads, e.g.:\n * `<a href=\"\" ng-click=\"list.addItem()\">Add Item</a>`\n */\nvar htmlAnchorDirective = valueFn({\n  restrict: 'E',\n  compile: function(element, attr) {\n    if (!attr.href && !attr.xlinkHref) {\n      return function(scope, element) {\n        // If the linked element is not an anchor tag anymore, do nothing\n        if (element[0].nodeName.toLowerCase() !== 'a') return;\n\n        // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n        var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?\n                   'xlink:href' : 'href';\n        element.on('click', function(event) {\n          // if we have no href url, then don't navigate anywhere.\n          if (!element.attr(href)) {\n            event.preventDefault();\n          }\n        });\n      };\n    }\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngHref\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in an href attribute will\n * make the link go to the wrong URL if the user clicks it before\n * Angular has a chance to replace the `{{hash}}` markup with its\n * value. Until Angular replaces the markup the link will be broken\n * and will most likely return a 404 error. The `ngHref` directive\n * solves this problem.\n *\n * The wrong way to write it:\n * ```html\n * <a href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <a ng-href=\"http://www.gravatar.com/avatar/{{hash}}\">link1</a>\n * ```\n *\n * @element A\n * @param {template} ngHref any string which can contain `{{}}` markup.\n *\n * @example\n * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes\n * in links and their different behaviors:\n    <example>\n      <file name=\"index.html\">\n        <input ng-model=\"value\" /><br />\n        <a id=\"link-1\" href ng-click=\"value = 1\">link 1</a> (link, don't reload)<br />\n        <a id=\"link-2\" href=\"\" ng-click=\"value = 2\">link 2</a> (link, don't reload)<br />\n        <a id=\"link-3\" ng-href=\"/{{'123'}}\">link 3</a> (link, reload!)<br />\n        <a id=\"link-4\" href=\"\" name=\"xx\" ng-click=\"value = 4\">anchor</a> (link, don't reload)<br />\n        <a id=\"link-5\" name=\"xxx\" ng-click=\"value = 5\">anchor</a> (no link)<br />\n        <a id=\"link-6\" ng-href=\"{{value}}\">link</a> (link, change location)\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should execute ng-click but not reload when href without value', function() {\n          element(by.id('link-1')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('1');\n          expect(element(by.id('link-1')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when href empty string', function() {\n          element(by.id('link-2')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('2');\n          expect(element(by.id('link-2')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click and change url when ng-href specified', function() {\n          expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\\/123$/);\n\n          element(by.id('link-3')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/123$/);\n            });\n          }, 5000, 'page should navigate to /123');\n        });\n\n        it('should execute ng-click but not reload when href empty string and name specified', function() {\n          element(by.id('link-4')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('4');\n          expect(element(by.id('link-4')).getAttribute('href')).toBe('');\n        });\n\n        it('should execute ng-click but not reload when no href but name specified', function() {\n          element(by.id('link-5')).click();\n          expect(element(by.model('value')).getAttribute('value')).toEqual('5');\n          expect(element(by.id('link-5')).getAttribute('href')).toBe(null);\n        });\n\n        it('should only change url when only ng-href', function() {\n          element(by.model('value')).clear();\n          element(by.model('value')).sendKeys('6');\n          expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\\/6$/);\n\n          element(by.id('link-6')).click();\n\n          // At this point, we navigate away from an Angular page, so we need\n          // to use browser.driver to get the base webdriver.\n          browser.wait(function() {\n            return browser.driver.getCurrentUrl().then(function(url) {\n              return url.match(/\\/6$/);\n            });\n          }, 5000, 'page should navigate to /6');\n        });\n      </file>\n    </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngSrc\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `src` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrc` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-src=\"http://www.gravatar.com/avatar/{{hash}}\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrc any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngSrcset\n * @restrict A\n * @priority 99\n *\n * @description\n * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't\n * work right: The browser will fetch from the URL with the literal\n * text `{{hash}}` until Angular replaces the expression inside\n * `{{hash}}`. The `ngSrcset` directive solves this problem.\n *\n * The buggy way to write it:\n * ```html\n * <img srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\"/>\n * ```\n *\n * The correct way to write it:\n * ```html\n * <img ng-srcset=\"http://www.gravatar.com/avatar/{{hash}} 2x\" alt=\"Description\" />\n * ```\n *\n * @element IMG\n * @param {template} ngSrcset any string which can contain `{{}}` markup.\n */\n\n/**\n * @ngdoc directive\n * @name ngDisabled\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * This directive sets the `disabled` attribute on the element if the\n * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `disabled`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Click me to toggle: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n        <button ng-model=\"button\" ng-disabled=\"checked\">Button</button>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle button', function() {\n          expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,\n *     then the `disabled` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngChecked\n * @restrict A\n * @priority 100\n *\n * @description\n * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.\n *\n * Note that this directive should not be used together with {@link ngModel `ngModel`},\n * as this can lead to unexpected behavior.\n *\n * A special directive is necessary because we cannot use interpolation inside the `checked`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to check both: <input type=\"checkbox\" ng-model=\"master\"></label><br/>\n        <input id=\"checkSlave\" type=\"checkbox\" ng-checked=\"master\" aria-label=\"Slave input\">\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should check both checkBoxes', function() {\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();\n          element(by.model('master')).click();\n          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,\n *     then the `checked` attribute will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngReadonly\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `readOnly` attribute on the element, if the expression inside `ngReadonly` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `readOnly`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to make text readonly: <input type=\"checkbox\" ng-model=\"checked\"></label><br/>\n        <input type=\"text\" ng-readonly=\"checked\" value=\"I'm Angular\" aria-label=\"Readonly field\" />\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should toggle readonly attr', function() {\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeFalsy();\n          element(by.model('checked')).click();\n          expect(element(by.css('[type=\"text\"]')).getAttribute('readonly')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element INPUT\n * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,\n *     then special attribute \"readonly\" will be set on the element\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSelected\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `selected`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <label>Check me to select: <input type=\"checkbox\" ng-model=\"selected\"></label><br/>\n        <select aria-label=\"ngSelected demo\">\n          <option>Hello!</option>\n          <option id=\"greet\" ng-selected=\"selected\">Greetings!</option>\n        </select>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should select Greetings!', function() {\n          expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();\n          element(by.model('selected')).click();\n          expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();\n        });\n      </file>\n    </example>\n *\n * @element OPTION\n * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,\n *     then special attribute \"selected\" will be set on the element\n */\n\n/**\n * @ngdoc directive\n * @name ngOpen\n * @restrict A\n * @priority 100\n *\n * @description\n *\n * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.\n *\n * A special directive is necessary because we cannot use interpolation inside the `open`\n * attribute. See the {@link guide/interpolation interpolation guide} for more info.\n *\n * @example\n     <example>\n       <file name=\"index.html\">\n         <label>Check me check multiple: <input type=\"checkbox\" ng-model=\"open\"></label><br/>\n         <details id=\"details\" ng-open=\"open\">\n            <summary>Show/Hide me</summary>\n         </details>\n       </file>\n       <file name=\"protractor.js\" type=\"protractor\">\n         it('should toggle open', function() {\n           expect(element(by.id('details')).getAttribute('open')).toBeFalsy();\n           element(by.model('open')).click();\n           expect(element(by.id('details')).getAttribute('open')).toBeTruthy();\n         });\n       </file>\n     </example>\n *\n * @element DETAILS\n * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,\n *     then special attribute \"open\" will be set on the element\n */\n\nvar ngAttributeAliasDirectives = {};\n\n// boolean attrs are evaluated\nforEach(BOOLEAN_ATTR, function(propName, attrName) {\n  // binding to multiple is not supported\n  if (propName == \"multiple\") return;\n\n  function defaultLinkFn(scope, element, attr) {\n    scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {\n      attr.$set(attrName, !!value);\n    });\n  }\n\n  var normalized = directiveNormalize('ng-' + attrName);\n  var linkFn = defaultLinkFn;\n\n  if (propName === 'checked') {\n    linkFn = function(scope, element, attr) {\n      // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input\n      if (attr.ngModel !== attr[normalized]) {\n        defaultLinkFn(scope, element, attr);\n      }\n    };\n  }\n\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      restrict: 'A',\n      priority: 100,\n      link: linkFn\n    };\n  };\n});\n\n// aliased input attrs are evaluated\nforEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {\n  ngAttributeAliasDirectives[ngAttr] = function() {\n    return {\n      priority: 100,\n      link: function(scope, element, attr) {\n        //special case ngPattern when a literal regular expression value\n        //is used as the expression (this way we don't have to watch anything).\n        if (ngAttr === \"ngPattern\" && attr.ngPattern.charAt(0) == \"/\") {\n          var match = attr.ngPattern.match(REGEX_STRING_REGEXP);\n          if (match) {\n            attr.$set(\"ngPattern\", new RegExp(match[1], match[2]));\n            return;\n          }\n        }\n\n        scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {\n          attr.$set(ngAttr, value);\n        });\n      }\n    };\n  };\n});\n\n// ng-src, ng-srcset, ng-href are interpolated\nforEach(['src', 'srcset', 'href'], function(attrName) {\n  var normalized = directiveNormalize('ng-' + attrName);\n  ngAttributeAliasDirectives[normalized] = function() {\n    return {\n      priority: 99, // it needs to run after the attributes are interpolated\n      link: function(scope, element, attr) {\n        var propName = attrName,\n            name = attrName;\n\n        if (attrName === 'href' &&\n            toString.call(element.prop('href')) === '[object SVGAnimatedString]') {\n          name = 'xlinkHref';\n          attr.$attr[name] = 'xlink:href';\n          propName = null;\n        }\n\n        attr.$observe(normalized, function(value) {\n          if (!value) {\n            if (attrName === 'href') {\n              attr.$set(name, null);\n            }\n            return;\n          }\n\n          attr.$set(name, value);\n\n          // on IE, if \"ng:src\" directive declaration is used and \"src\" attribute doesn't exist\n          // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need\n          // to set the property as well to achieve the desired effect.\n          // we use attr[attrName] value since $set can sanitize the url.\n          if (msie && propName) element.prop(propName, attr[name]);\n        });\n      }\n    };\n  };\n});\n\n/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true\n */\nvar nullFormCtrl = {\n  $addControl: noop,\n  $$renameControl: nullFormRenameControl,\n  $removeControl: noop,\n  $setValidity: noop,\n  $setDirty: noop,\n  $setPristine: noop,\n  $setSubmitted: noop\n},\nSUBMITTED_CLASS = 'ng-submitted';\n\nfunction nullFormRenameControl(control, name) {\n  control.$name = name;\n}\n\n/**\n * @ngdoc type\n * @name form.FormController\n *\n * @property {boolean} $pristine True if user has not interacted with the form yet.\n * @property {boolean} $dirty True if user has already interacted with the form.\n * @property {boolean} $valid True if all of the containing forms and controls are valid.\n * @property {boolean} $invalid True if at least one containing control or form is invalid.\n * @property {boolean} $pending True if at least one containing control or form is pending.\n * @property {boolean} $submitted True if user has submitted the form even if its invalid.\n *\n * @property {Object} $error Is an object hash, containing references to controls or\n *  forms with failing validators, where:\n *\n *  - keys are validation tokens (error names),\n *  - values are arrays of controls or forms that have a failing validator for given error name.\n *\n *  Built-in validation tokens:\n *\n *  - `email`\n *  - `max`\n *  - `maxlength`\n *  - `min`\n *  - `minlength`\n *  - `number`\n *  - `pattern`\n *  - `required`\n *  - `url`\n *  - `date`\n *  - `datetimelocal`\n *  - `time`\n *  - `week`\n *  - `month`\n *\n * @description\n * `FormController` keeps track of all its controls and nested forms as well as the state of them,\n * such as being valid/invalid or dirty/pristine.\n *\n * Each {@link ng.directive:form form} directive creates an instance\n * of `FormController`.\n *\n */\n//asks for $scope to fool the BC controller module\nFormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];\nfunction FormController(element, attrs, $scope, $animate, $interpolate) {\n  var form = this,\n      controls = [];\n\n  // init state\n  form.$error = {};\n  form.$$success = {};\n  form.$pending = undefined;\n  form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);\n  form.$dirty = false;\n  form.$pristine = true;\n  form.$valid = true;\n  form.$invalid = false;\n  form.$submitted = false;\n  form.$$parentForm = nullFormCtrl;\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$rollbackViewValue\n   *\n   * @description\n   * Rollback all form controls pending updates to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. This method is typically needed by the reset button of\n   * a form that uses `ng-model-options` to pend updates.\n   */\n  form.$rollbackViewValue = function() {\n    forEach(controls, function(control) {\n      control.$rollbackViewValue();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$commitViewValue\n   *\n   * @description\n   * Commit all form controls pending updates to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`\n   * usually handles calling this in response to input events.\n   */\n  form.$commitViewValue = function() {\n    forEach(controls, function(control) {\n      control.$commitViewValue();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$addControl\n   * @param {object} control control object, either a {@link form.FormController} or an\n   * {@link ngModel.NgModelController}\n   *\n   * @description\n   * Register a control with the form. Input elements using ngModelController do this automatically\n   * when they are linked.\n   *\n   * Note that the current state of the control will not be reflected on the new parent form. This\n   * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`\n   * state.\n   *\n   * However, if the method is used programmatically, for example by adding dynamically created controls,\n   * or controls that have been previously removed without destroying their corresponding DOM element,\n   * it's the developers responsibility to make sure the current state propagates to the parent form.\n   *\n   * For example, if an input control is added that is already `$dirty` and has `$error` properties,\n   * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.\n   */\n  form.$addControl = function(control) {\n    // Breaking change - before, inputs whose name was \"hasOwnProperty\" were quietly ignored\n    // and not added to the scope.  Now we throw an error.\n    assertNotHasOwnProperty(control.$name, 'input');\n    controls.push(control);\n\n    if (control.$name) {\n      form[control.$name] = control;\n    }\n\n    control.$$parentForm = form;\n  };\n\n  // Private API: rename a form control\n  form.$$renameControl = function(control, newName) {\n    var oldName = control.$name;\n\n    if (form[oldName] === control) {\n      delete form[oldName];\n    }\n    form[newName] = control;\n    control.$name = newName;\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$removeControl\n   * @param {object} control control object, either a {@link form.FormController} or an\n   * {@link ngModel.NgModelController}\n   *\n   * @description\n   * Deregister a control from the form.\n   *\n   * Input elements using ngModelController do this automatically when they are destroyed.\n   *\n   * Note that only the removed control's validation state (`$errors`etc.) will be removed from the\n   * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be\n   * different from case to case. For example, removing the only `$dirty` control from a form may or\n   * may not mean that the form is still `$dirty`.\n   */\n  form.$removeControl = function(control) {\n    if (control.$name && form[control.$name] === control) {\n      delete form[control.$name];\n    }\n    forEach(form.$pending, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n    forEach(form.$error, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n    forEach(form.$$success, function(value, name) {\n      form.$setValidity(name, null, control);\n    });\n\n    arrayRemove(controls, control);\n    control.$$parentForm = nullFormCtrl;\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setValidity\n   *\n   * @description\n   * Sets the validity of a form control.\n   *\n   * This method will also propagate to parent forms.\n   */\n  addSetValidityMethod({\n    ctrl: this,\n    $element: element,\n    set: function(object, property, controller) {\n      var list = object[property];\n      if (!list) {\n        object[property] = [controller];\n      } else {\n        var index = list.indexOf(controller);\n        if (index === -1) {\n          list.push(controller);\n        }\n      }\n    },\n    unset: function(object, property, controller) {\n      var list = object[property];\n      if (!list) {\n        return;\n      }\n      arrayRemove(list, controller);\n      if (list.length === 0) {\n        delete object[property];\n      }\n    },\n    $animate: $animate\n  });\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setDirty\n   *\n   * @description\n   * Sets the form to a dirty state.\n   *\n   * This method can be called to add the 'ng-dirty' class and set the form to a dirty\n   * state (ng-dirty class). This method will also propagate to parent forms.\n   */\n  form.$setDirty = function() {\n    $animate.removeClass(element, PRISTINE_CLASS);\n    $animate.addClass(element, DIRTY_CLASS);\n    form.$dirty = true;\n    form.$pristine = false;\n    form.$$parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setPristine\n   *\n   * @description\n   * Sets the form to its pristine state.\n   *\n   * This method can be called to remove the 'ng-dirty' class and set the form to its pristine\n   * state (ng-pristine class). This method will also propagate to all the controls contained\n   * in this form.\n   *\n   * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after\n   * saving or resetting it.\n   */\n  form.$setPristine = function() {\n    $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);\n    form.$dirty = false;\n    form.$pristine = true;\n    form.$submitted = false;\n    forEach(controls, function(control) {\n      control.$setPristine();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setUntouched\n   *\n   * @description\n   * Sets the form to its untouched state.\n   *\n   * This method can be called to remove the 'ng-touched' class and set the form controls to their\n   * untouched state (ng-untouched class).\n   *\n   * Setting a form controls back to their untouched state is often useful when setting the form\n   * back to its pristine state.\n   */\n  form.$setUntouched = function() {\n    forEach(controls, function(control) {\n      control.$setUntouched();\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name form.FormController#$setSubmitted\n   *\n   * @description\n   * Sets the form to its submitted state.\n   */\n  form.$setSubmitted = function() {\n    $animate.addClass(element, SUBMITTED_CLASS);\n    form.$submitted = true;\n    form.$$parentForm.$setSubmitted();\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ngForm\n * @restrict EAC\n *\n * @description\n * Nestable alias of {@link ng.directive:form `form`} directive. HTML\n * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a\n * sub-group of controls needs to be determined.\n *\n * Note: the purpose of `ngForm` is to group controls,\n * but not to be a replacement for the `<form>` tag with all of its capabilities\n * (e.g. posting to the server, ...).\n *\n * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n *\n */\n\n /**\n * @ngdoc directive\n * @name form\n * @restrict E\n *\n * @description\n * Directive that instantiates\n * {@link form.FormController FormController}.\n *\n * If the `name` attribute is specified, the form controller is published onto the current scope under\n * this name.\n *\n * # Alias: {@link ng.directive:ngForm `ngForm`}\n *\n * In Angular, forms can be nested. This means that the outer form is valid when all of the child\n * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so\n * Angular provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to\n * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group\n * of controls needs to be determined.\n *\n * # CSS classes\n *  - `ng-valid` is set if the form is valid.\n *  - `ng-invalid` is set if the form is invalid.\n *  - `ng-pending` is set if the form is pending.\n *  - `ng-pristine` is set if the form is pristine.\n *  - `ng-dirty` is set if the form is dirty.\n *  - `ng-submitted` is set if the form was submitted.\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n *\n * # Submitting a form and preventing the default action\n *\n * Since the role of forms in client-side Angular applications is different than in classical\n * roundtrip apps, it is desirable for the browser not to translate the form submission into a full\n * page reload that sends the data to the server. Instead some javascript logic should be triggered\n * to handle the form submission in an application-specific way.\n *\n * For this reason, Angular prevents the default action (form submission to the server) unless the\n * `<form>` element has an `action` attribute specified.\n *\n * You can use one of the following two ways to specify what javascript method should be called when\n * a form is submitted:\n *\n * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element\n * - {@link ng.directive:ngClick ngClick} directive on the first\n  *  button or input field of type submit (input[type=submit])\n *\n * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}\n * or {@link ng.directive:ngClick ngClick} directives.\n * This is because of the following form submission rules in the HTML specification:\n *\n * - If a form has only one input field then hitting enter in this field triggers form submit\n * (`ngSubmit`)\n * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter\n * doesn't trigger submit\n * - if a form has one or more input fields and one or more buttons or input[type=submit] then\n * hitting enter in any of the input fields will trigger the click handler on the *first* button or\n * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)\n *\n * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is\n * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * ## Animation Hooks\n *\n * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.\n * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any\n * other validations that are performed within the form. Animations in ngForm are similar to how\n * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well\n * as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style a form element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-form {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-form.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n    <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"formExample\">\n      <file name=\"index.html\">\n       <script>\n         angular.module('formExample', [])\n           .controller('FormController', ['$scope', function($scope) {\n             $scope.userType = 'guest';\n           }]);\n       </script>\n       <style>\n        .my-form {\n          transition:all linear 0.5s;\n          background: transparent;\n        }\n        .my-form.ng-invalid {\n          background: red;\n        }\n       </style>\n       <form name=\"myForm\" ng-controller=\"FormController\" class=\"my-form\">\n         userType: <input name=\"input\" ng-model=\"userType\" required>\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">Required!</span><br>\n         <code>userType = {{userType}}</code><br>\n         <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>\n         <code>myForm.input.$error = {{myForm.input.$error}}</code><br>\n         <code>myForm.$valid = {{myForm.$valid}}</code><br>\n         <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should initialize to model', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n\n          expect(userType.getText()).toContain('guest');\n          expect(valid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty', function() {\n          var userType = element(by.binding('userType'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var userInput = element(by.model('userType'));\n\n          userInput.clear();\n          userInput.sendKeys('');\n\n          expect(userType.getText()).toEqual('userType =');\n          expect(valid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n *\n * @param {string=} name Name of the form. If specified, the form controller will be published into\n *                       related scope, under this name.\n */\nvar formDirectiveFactory = function(isNgForm) {\n  return ['$timeout', '$parse', function($timeout, $parse) {\n    var formDirective = {\n      name: 'form',\n      restrict: isNgForm ? 'EAC' : 'E',\n      require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form\n      controller: FormController,\n      compile: function ngFormCompile(formElement, attr) {\n        // Setup initial state of the control\n        formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);\n\n        var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);\n\n        return {\n          pre: function ngFormPreLink(scope, formElement, attr, ctrls) {\n            var controller = ctrls[0];\n\n            // if `action` attr is not present on the form, prevent the default action (submission)\n            if (!('action' in attr)) {\n              // we can't use jq events because if a form is destroyed during submission the default\n              // action is not prevented. see #1238\n              //\n              // IE 9 is not affected because it doesn't fire a submit event and try to do a full\n              // page reload if the form was destroyed by submission of the form via a click handler\n              // on a button in the form. Looks like an IE9 specific bug.\n              var handleFormSubmission = function(event) {\n                scope.$apply(function() {\n                  controller.$commitViewValue();\n                  controller.$setSubmitted();\n                });\n\n                event.preventDefault();\n              };\n\n              addEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n\n              // unregister the preventDefault listener so that we don't not leak memory but in a\n              // way that will achieve the prevention of the default action.\n              formElement.on('$destroy', function() {\n                $timeout(function() {\n                  removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);\n                }, 0, false);\n              });\n            }\n\n            var parentFormCtrl = ctrls[1] || controller.$$parentForm;\n            parentFormCtrl.$addControl(controller);\n\n            var setter = nameAttr ? getSetter(controller.$name) : noop;\n\n            if (nameAttr) {\n              setter(scope, controller);\n              attr.$observe(nameAttr, function(newValue) {\n                if (controller.$name === newValue) return;\n                setter(scope, undefined);\n                controller.$$parentForm.$$renameControl(controller, newValue);\n                setter = getSetter(controller.$name);\n                setter(scope, controller);\n              });\n            }\n            formElement.on('$destroy', function() {\n              controller.$$parentForm.$removeControl(controller);\n              setter(scope, undefined);\n              extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards\n            });\n          }\n        };\n      }\n    };\n\n    return formDirective;\n\n    function getSetter(expression) {\n      if (expression === '') {\n        //create an assignable expression, so forms with an empty name can be renamed later\n        return $parse('this[\"\"]').assign;\n      }\n      return $parse(expression).assign || noop;\n    }\n  }];\n};\n\nvar formDirective = formDirectiveFactory();\nvar ngFormDirective = formDirectiveFactory(true);\n\n/* global VALID_CLASS: false,\n  INVALID_CLASS: false,\n  PRISTINE_CLASS: false,\n  DIRTY_CLASS: false,\n  UNTOUCHED_CLASS: false,\n  TOUCHED_CLASS: false,\n  ngModelMinErr: false,\n*/\n\n// Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231\nvar ISO_DATE_REGEXP = /^\\d{4,}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+(?:[+-][0-2]\\d:[0-5]\\d|Z)$/;\n// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)\n// Note: We are being more lenient, because browsers are too.\n//   1. Scheme\n//   2. Slashes\n//   3. Username\n//   4. Password\n//   5. Hostname\n//   6. Port\n//   7. Path\n//   8. Query\n//   9. Fragment\n//                 1111111111111111 222   333333    44444        555555555555555555555555    666     77777777     8888888     999\nvar URL_REGEXP = /^[a-z][a-z\\d.+-]*:\\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\\s:/?#]+|\\[[a-f\\d:]+\\])(?::\\d+)?(?:\\/[^?#]*)?(?:\\?[^#]*)?(?:#.*)?$/i;\nvar EMAIL_REGEXP = /^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;\nvar NUMBER_REGEXP = /^\\s*(\\-|\\+)?(\\d+|(\\d*(\\.\\d*)))([eE][+-]?\\d+)?\\s*$/;\nvar DATE_REGEXP = /^(\\d{4,})-(\\d{2})-(\\d{2})$/;\nvar DATETIMELOCAL_REGEXP = /^(\\d{4,})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\nvar WEEK_REGEXP = /^(\\d{4,})-W(\\d\\d)$/;\nvar MONTH_REGEXP = /^(\\d{4,})-(\\d\\d)$/;\nvar TIME_REGEXP = /^(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/;\n\nvar PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown';\nvar PARTIAL_VALIDATION_TYPES = createMap();\nforEach('date,datetime-local,month,time,week'.split(','), function(type) {\n  PARTIAL_VALIDATION_TYPES[type] = true;\n});\n\nvar inputType = {\n\n  /**\n   * @ngdoc input\n   * @name input[text]\n   *\n   * @description\n   * Standard HTML text input with angular data binding, inherited by most of the `input` elements.\n   *\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Adds `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n   *    This parameter is ignored for input[type=password] controls, which will never trim the\n   *    input.\n   *\n   * @example\n      <example name=\"text-input-directive\" module=\"textInputExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('textInputExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.example = {\n                 text: 'guest',\n                 word: /^\\s*\\w*\\s*$/\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Single word:\n             <input type=\"text\" name=\"input\" ng-model=\"example.text\"\n                    ng-pattern=\"example.word\" required ng-trim=\"false\">\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.pattern\">\n               Single word only!</span>\n           </div>\n           <tt>text = {{example.text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('example.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('example.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('guest');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if multi word', function() {\n            input.clear();\n            input.sendKeys('hello world');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'text': textInputType,\n\n    /**\n     * @ngdoc input\n     * @name input[date]\n     *\n     * @description\n     * Input with date validation and transformation. In browsers that do not yet support\n     * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601\n     * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many\n     * modern browsers do not yet support this input type, it is important to provide cues to users on the\n     * expected input format via a placeholder or label.\n     *\n     * The model must always be a Date object, otherwise Angular will throw an error.\n     * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n     *\n     * The timezone to be used to read/write the `Date` instance in the model can be defined using\n     * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n     *\n     * @param {string} ngModel Assignable angular expression to data-bind to.\n     * @param {string=} name Property name of the form under which the control is published.\n     * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a\n     *   valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n     *   (e.g. `min=\"{{minDate | date:'yyyy-MM-dd'}}\"`). Note that `min` will also add native HTML5\n     *   constraint validation.\n     * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be\n     *   a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute\n     *   (e.g. `max=\"{{maxDate | date:'yyyy-MM-dd'}}\"`). Note that `max` will also add native HTML5\n     *   constraint validation.\n     * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string\n     *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n     * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string\n     *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n     * @param {string=} required Sets `required` validation error key if the value is not entered.\n     * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n     *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n     *    `required` when you want to data-bind to the `required` attribute.\n     * @param {string=} ngChange Angular expression to be executed when input changes due to user\n     *    interaction with the input element.\n     *\n     * @example\n     <example name=\"date-input-directive\" module=\"dateInputExample\">\n     <file name=\"index.html\">\n       <script>\n          angular.module('dateInputExample', [])\n            .controller('DateController', ['$scope', function($scope) {\n              $scope.example = {\n                value: new Date(2013, 9, 22)\n              };\n            }]);\n       </script>\n       <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n          <label for=\"exampleInput\">Pick a date in 2013:</label>\n          <input type=\"date\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n              placeholder=\"yyyy-MM-dd\" min=\"2013-01-01\" max=\"2013-12-31\" required />\n          <div role=\"alert\">\n            <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n                Required!</span>\n            <span class=\"error\" ng-show=\"myForm.input.$error.date\">\n                Not a valid date!</span>\n           </div>\n           <tt>value = {{example.value | date: \"yyyy-MM-dd\"}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n       </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n        var value = element(by.binding('example.value | date: \"yyyy-MM-dd\"'));\n        var valid = element(by.binding('myForm.input.$valid'));\n        var input = element(by.model('example.value'));\n\n        // currently protractor/webdriver does not support\n        // sending keys to all known HTML5 input controls\n        // for various browsers (see https://github.com/angular/protractor/issues/562).\n        function setInput(val) {\n          // set the value of the element and force validation.\n          var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n          \"ipt.value = '\" + val + \"';\" +\n          \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n          browser.executeScript(scr);\n        }\n\n        it('should initialize to model', function() {\n          expect(value.getText()).toContain('2013-10-22');\n          expect(valid.getText()).toContain('myForm.input.$valid = true');\n        });\n\n        it('should be invalid if empty', function() {\n          setInput('');\n          expect(value.getText()).toEqual('value =');\n          expect(valid.getText()).toContain('myForm.input.$valid = false');\n        });\n\n        it('should be invalid if over max', function() {\n          setInput('2015-01-01');\n          expect(value.getText()).toContain('');\n          expect(valid.getText()).toContain('myForm.input.$valid = false');\n        });\n     </file>\n     </example>\n     */\n  'date': createDateInputType('date', DATE_REGEXP,\n         createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),\n         'yyyy-MM-dd'),\n\n   /**\n    * @ngdoc input\n    * @name input[datetime-local]\n    *\n    * @description\n    * Input with datetime validation and transformation. In browsers that do not yet support\n    * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n    * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.\n    *\n    * The model must always be a Date object, otherwise Angular will throw an error.\n    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n    *\n    * The timezone to be used to read/write the `Date` instance in the model can be defined using\n    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n    *\n    * @param {string} ngModel Assignable angular expression to data-bind to.\n    * @param {string=} name Property name of the form under which the control is published.\n    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n    *   inside this attribute (e.g. `min=\"{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n    *   Note that `min` will also add native HTML5 constraint validation.\n    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation\n    *   inside this attribute (e.g. `max=\"{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}\"`).\n    *   Note that `max` will also add native HTML5 constraint validation.\n    * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string\n    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n    * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string\n    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n    * @param {string=} required Sets `required` validation error key if the value is not entered.\n    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n    *    `required` when you want to data-bind to the `required` attribute.\n    * @param {string=} ngChange Angular expression to be executed when input changes due to user\n    *    interaction with the input element.\n    *\n    * @example\n    <example name=\"datetimelocal-input-directive\" module=\"dateExample\">\n    <file name=\"index.html\">\n      <script>\n        angular.module('dateExample', [])\n          .controller('DateController', ['$scope', function($scope) {\n            $scope.example = {\n              value: new Date(2010, 11, 28, 14, 57)\n            };\n          }]);\n      </script>\n      <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label for=\"exampleInput\">Pick a date between in 2013:</label>\n        <input type=\"datetime-local\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n            placeholder=\"yyyy-MM-ddTHH:mm:ss\" min=\"2001-01-01T00:00:00\" max=\"2013-12-31T00:00:00\" required />\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.datetimelocal\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"yyyy-MM-ddTHH:mm:ss\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-MM-ddTHH:mm:ss\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2010-12-28T14:57:00');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-01-01T23:59:00');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n    </file>\n    </example>\n    */\n  'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,\n      createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),\n      'yyyy-MM-ddTHH:mm:ss.sss'),\n\n  /**\n   * @ngdoc input\n   * @name input[time]\n   *\n   * @description\n   * Input with time validation and transformation. In browsers that do not yet support\n   * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n   * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a\n   * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.\n   *\n   * The model must always be a Date object, otherwise Angular will throw an error.\n   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n   *\n   * The timezone to be used to read/write the `Date` instance in the model can be defined using\n   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n   *   attribute (e.g. `min=\"{{minTime | date:'HH:mm:ss'}}\"`). Note that `min` will also add\n   *   native HTML5 constraint validation.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this\n   *   attribute (e.g. `max=\"{{maxTime | date:'HH:mm:ss'}}\"`). Note that `max` will also add\n   *   native HTML5 constraint validation.\n   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the\n   *   `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the\n   *   `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n   <example name=\"time-input-directive\" module=\"timeExample\">\n   <file name=\"index.html\">\n     <script>\n      angular.module('timeExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(1970, 0, 1, 14, 57, 0)\n          };\n        }]);\n     </script>\n     <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label for=\"exampleInput\">Pick a time between 8am and 5pm:</label>\n        <input type=\"time\" id=\"exampleInput\" name=\"input\" ng-model=\"example.value\"\n            placeholder=\"HH:mm:ss\" min=\"08:00:00\" max=\"17:00:00\" required />\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.time\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"HH:mm:ss\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n     </form>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"HH:mm:ss\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('14:57:00');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('23:59:00');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n   </file>\n   </example>\n   */\n  'time': createDateInputType('time', TIME_REGEXP,\n      createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),\n     'HH:mm:ss.sss'),\n\n   /**\n    * @ngdoc input\n    * @name input[week]\n    *\n    * @description\n    * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support\n    * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n    * week format (yyyy-W##), for example: `2013-W02`.\n    *\n    * The model must always be a Date object, otherwise Angular will throw an error.\n    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n    *\n    * The timezone to be used to read/write the `Date` instance in the model can be defined using\n    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n    *\n    * @param {string} ngModel Assignable angular expression to data-bind to.\n    * @param {string=} name Property name of the form under which the control is published.\n    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n    *   attribute (e.g. `min=\"{{minWeek | date:'yyyy-Www'}}\"`). Note that `min` will also add\n    *   native HTML5 constraint validation.\n    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this\n    *   attribute (e.g. `max=\"{{maxWeek | date:'yyyy-Www'}}\"`). Note that `max` will also add\n    *   native HTML5 constraint validation.\n    * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n    * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n    * @param {string=} required Sets `required` validation error key if the value is not entered.\n    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n    *    `required` when you want to data-bind to the `required` attribute.\n    * @param {string=} ngChange Angular expression to be executed when input changes due to user\n    *    interaction with the input element.\n    *\n    * @example\n    <example name=\"week-input-directive\" module=\"weekExample\">\n    <file name=\"index.html\">\n      <script>\n      angular.module('weekExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(2013, 0, 3)\n          };\n        }]);\n      </script>\n      <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n        <label>Pick a date between in 2013:\n          <input id=\"exampleInput\" type=\"week\" name=\"input\" ng-model=\"example.value\"\n                 placeholder=\"YYYY-W##\" min=\"2012-W32\"\n                 max=\"2013-W52\" required />\n        </label>\n        <div role=\"alert\">\n          <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n              Required!</span>\n          <span class=\"error\" ng-show=\"myForm.input.$error.week\">\n              Not a valid date!</span>\n        </div>\n        <tt>value = {{example.value | date: \"yyyy-Www\"}}</tt><br/>\n        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-Www\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2013-W01');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-W01');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n    </file>\n    </example>\n    */\n  'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),\n\n  /**\n   * @ngdoc input\n   * @name input[month]\n   *\n   * @description\n   * Input with month validation and transformation. In browsers that do not yet support\n   * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601\n   * month format (yyyy-MM), for example: `2009-01`.\n   *\n   * The model must always be a Date object, otherwise Angular will throw an error.\n   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.\n   * If the model is not set to the first of the month, the next view to model update will set it\n   * to the first of the month.\n   *\n   * The timezone to be used to read/write the `Date` instance in the model can be defined using\n   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n   *   attribute (e.g. `min=\"{{minMonth | date:'yyyy-MM'}}\"`). Note that `min` will also add\n   *   native HTML5 constraint validation.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this\n   *   attribute (e.g. `max=\"{{maxMonth | date:'yyyy-MM'}}\"`). Note that `max` will also add\n   *   native HTML5 constraint validation.\n   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string\n   *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.\n   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string\n   *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.\n\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n   <example name=\"month-input-directive\" module=\"monthExample\">\n   <file name=\"index.html\">\n     <script>\n      angular.module('monthExample', [])\n        .controller('DateController', ['$scope', function($scope) {\n          $scope.example = {\n            value: new Date(2013, 9, 1)\n          };\n        }]);\n     </script>\n     <form name=\"myForm\" ng-controller=\"DateController as dateCtrl\">\n       <label for=\"exampleInput\">Pick a month in 2013:</label>\n       <input id=\"exampleInput\" type=\"month\" name=\"input\" ng-model=\"example.value\"\n          placeholder=\"yyyy-MM\" min=\"2013-01\" max=\"2013-12\" required />\n       <div role=\"alert\">\n         <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n            Required!</span>\n         <span class=\"error\" ng-show=\"myForm.input.$error.month\">\n            Not a valid month!</span>\n       </div>\n       <tt>value = {{example.value | date: \"yyyy-MM\"}}</tt><br/>\n       <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n       <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n       <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n       <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n     </form>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n      var value = element(by.binding('example.value | date: \"yyyy-MM\"'));\n      var valid = element(by.binding('myForm.input.$valid'));\n      var input = element(by.model('example.value'));\n\n      // currently protractor/webdriver does not support\n      // sending keys to all known HTML5 input controls\n      // for various browsers (https://github.com/angular/protractor/issues/562).\n      function setInput(val) {\n        // set the value of the element and force validation.\n        var scr = \"var ipt = document.getElementById('exampleInput'); \" +\n        \"ipt.value = '\" + val + \"';\" +\n        \"angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('\" + val + \"'); });\";\n        browser.executeScript(scr);\n      }\n\n      it('should initialize to model', function() {\n        expect(value.getText()).toContain('2013-10');\n        expect(valid.getText()).toContain('myForm.input.$valid = true');\n      });\n\n      it('should be invalid if empty', function() {\n        setInput('');\n        expect(value.getText()).toEqual('value =');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n\n      it('should be invalid if over max', function() {\n        setInput('2015-01');\n        expect(value.getText()).toContain('');\n        expect(valid.getText()).toContain('myForm.input.$valid = false');\n      });\n   </file>\n   </example>\n   */\n  'month': createDateInputType('month', MONTH_REGEXP,\n     createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),\n     'yyyy-MM'),\n\n  /**\n   * @ngdoc input\n   * @name input[number]\n   *\n   * @description\n   * Text input with number validation and transformation. Sets the `number` validation\n   * error if not a valid number.\n   *\n   * <div class=\"alert alert-warning\">\n   * The model must always be of type `number` otherwise Angular will throw an error.\n   * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}\n   * error docs for more information and an example of how to convert your model if necessary.\n   * </div>\n   *\n   * ## Issues with HTML5 constraint validation\n   *\n   * In browsers that follow the\n   * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),\n   * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.\n   * If a non-number is entered in the input, the browser will report the value as an empty string,\n   * which means the view / model values in `ngModel` and subsequently the scope value\n   * will also be an empty string.\n   *\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.\n   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"number-input-directive\" module=\"numberExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('numberExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.example = {\n                 value: 12\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Number:\n             <input type=\"number\" name=\"input\" ng-model=\"example.value\"\n                    min=\"0\" max=\"99\" required>\n          </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.number\">\n               Not valid number!</span>\n           </div>\n           <tt>value = {{example.value}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var value = element(by.binding('example.value'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('example.value'));\n\n          it('should initialize to model', function() {\n            expect(value.getText()).toContain('12');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if over max', function() {\n            input.clear();\n            input.sendKeys('123');\n            expect(value.getText()).toEqual('value =');\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'number': numberInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[url]\n   *\n   * @description\n   * Text input with URL validation. Sets the `url` validation error key if the content is not a\n   * valid URL.\n   *\n   * <div class=\"alert alert-warning\">\n   * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex\n   * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify\n   * the built-in validators (see the {@link guide/forms Forms guide})\n   * </div>\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"url-input-directive\" module=\"urlExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('urlExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.url = {\n                 text: 'http://google.com'\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>URL:\n             <input type=\"url\" name=\"input\" ng-model=\"url.text\" required>\n           <label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n               Required!</span>\n             <span class=\"error\" ng-show=\"myForm.input.$error.url\">\n               Not valid url!</span>\n           </div>\n           <tt>text = {{url.text}}</tt><br/>\n           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n           <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('url.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('url.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('http://google.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not url', function() {\n            input.clear();\n            input.sendKeys('box');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'url': urlInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[email]\n   *\n   * @description\n   * Text input with email validation. Sets the `email` validation error key if not a valid email\n   * address.\n   *\n   * <div class=\"alert alert-warning\">\n   * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex\n   * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can\n   * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})\n   * </div>\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} required Sets `required` validation error key if the value is not entered.\n   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n   *    `required` when you want to data-bind to the `required` attribute.\n   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n   *    minlength.\n   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of\n   *    any length.\n   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string\n   *    that contains the regular expression body that will be converted to a regular expression\n   *    as in the ngPattern directive.\n   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n   *    If the expression evaluates to a RegExp object, then this is used directly.\n   *    If the expression evaluates to a string, then it will be converted to a RegExp\n   *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n   *    `new RegExp('^abc$')`.<br />\n   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n   *    start at the index of the last search's match, thus not taking the whole input value into\n   *    account.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"email-input-directive\" module=\"emailExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('emailExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.email = {\n                 text: 'me@example.com'\n               };\n             }]);\n         </script>\n           <form name=\"myForm\" ng-controller=\"ExampleController\">\n             <label>Email:\n               <input type=\"email\" name=\"input\" ng-model=\"email.text\" required>\n             </label>\n             <div role=\"alert\">\n               <span class=\"error\" ng-show=\"myForm.input.$error.required\">\n                 Required!</span>\n               <span class=\"error\" ng-show=\"myForm.input.$error.email\">\n                 Not valid email!</span>\n             </div>\n             <tt>text = {{email.text}}</tt><br/>\n             <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>\n             <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>\n             <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n             <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n             <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>\n           </form>\n         </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var text = element(by.binding('email.text'));\n          var valid = element(by.binding('myForm.input.$valid'));\n          var input = element(by.model('email.text'));\n\n          it('should initialize to model', function() {\n            expect(text.getText()).toContain('me@example.com');\n            expect(valid.getText()).toContain('true');\n          });\n\n          it('should be invalid if empty', function() {\n            input.clear();\n            input.sendKeys('');\n            expect(text.getText()).toEqual('text =');\n            expect(valid.getText()).toContain('false');\n          });\n\n          it('should be invalid if not email', function() {\n            input.clear();\n            input.sendKeys('xxx');\n\n            expect(valid.getText()).toContain('false');\n          });\n        </file>\n      </example>\n   */\n  'email': emailInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[radio]\n   *\n   * @description\n   * HTML radio button.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string} value The value to which the `ngModel` expression should be set when selected.\n   *    Note that `value` only supports `string` values, i.e. the scope model needs to be a string,\n   *    too. Use `ngValue` if you need complex models (`number`, `object`, ...).\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio\n   *    is selected. Should be used instead of the `value` attribute if you need\n   *    a non-string `ngModel` (`boolean`, `array`, ...).\n   *\n   * @example\n      <example name=\"radio-input-directive\" module=\"radioExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('radioExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.color = {\n                 name: 'blue'\n               };\n               $scope.specialValue = {\n                 \"id\": \"12345\",\n                 \"value\": \"green\"\n               };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" value=\"red\">\n             Red\n           </label><br/>\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" ng-value=\"specialValue\">\n             Green\n           </label><br/>\n           <label>\n             <input type=\"radio\" ng-model=\"color.name\" value=\"blue\">\n             Blue\n           </label><br/>\n           <tt>color = {{color.name | json}}</tt><br/>\n          </form>\n          Note that `ng-value=\"specialValue\"` sets radio item's value to be the value of `$scope.specialValue`.\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var color = element(by.binding('color.name'));\n\n            expect(color.getText()).toContain('blue');\n\n            element.all(by.model('color.name')).get(0).click();\n\n            expect(color.getText()).toContain('red');\n          });\n        </file>\n      </example>\n   */\n  'radio': radioInputType,\n\n\n  /**\n   * @ngdoc input\n   * @name input[checkbox]\n   *\n   * @description\n   * HTML checkbox.\n   *\n   * @param {string} ngModel Assignable angular expression to data-bind to.\n   * @param {string=} name Property name of the form under which the control is published.\n   * @param {expression=} ngTrueValue The value to which the expression should be set when selected.\n   * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.\n   * @param {string=} ngChange Angular expression to be executed when input changes due to user\n   *    interaction with the input element.\n   *\n   * @example\n      <example name=\"checkbox-input-directive\" module=\"checkboxExample\">\n        <file name=\"index.html\">\n         <script>\n           angular.module('checkboxExample', [])\n             .controller('ExampleController', ['$scope', function($scope) {\n               $scope.checkboxModel = {\n                value1 : true,\n                value2 : 'YES'\n              };\n             }]);\n         </script>\n         <form name=\"myForm\" ng-controller=\"ExampleController\">\n           <label>Value1:\n             <input type=\"checkbox\" ng-model=\"checkboxModel.value1\">\n           </label><br/>\n           <label>Value2:\n             <input type=\"checkbox\" ng-model=\"checkboxModel.value2\"\n                    ng-true-value=\"'YES'\" ng-false-value=\"'NO'\">\n            </label><br/>\n           <tt>value1 = {{checkboxModel.value1}}</tt><br/>\n           <tt>value2 = {{checkboxModel.value2}}</tt><br/>\n          </form>\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          it('should change state', function() {\n            var value1 = element(by.binding('checkboxModel.value1'));\n            var value2 = element(by.binding('checkboxModel.value2'));\n\n            expect(value1.getText()).toContain('true');\n            expect(value2.getText()).toContain('YES');\n\n            element(by.model('checkboxModel.value1')).click();\n            element(by.model('checkboxModel.value2')).click();\n\n            expect(value1.getText()).toContain('false');\n            expect(value2.getText()).toContain('NO');\n          });\n        </file>\n      </example>\n   */\n  'checkbox': checkboxInputType,\n\n  'hidden': noop,\n  'button': noop,\n  'submit': noop,\n  'reset': noop,\n  'file': noop\n};\n\nfunction stringBasedInputType(ctrl) {\n  ctrl.$formatters.push(function(value) {\n    return ctrl.$isEmpty(value) ? value : value.toString();\n  });\n}\n\nfunction textInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n}\n\nfunction baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  var type = lowercase(element[0].type);\n\n  // In composition mode, users are still inputing intermediate text buffer,\n  // hold the listener until composition is done.\n  // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent\n  if (!$sniffer.android) {\n    var composing = false;\n\n    element.on('compositionstart', function() {\n      composing = true;\n    });\n\n    element.on('compositionend', function() {\n      composing = false;\n      listener();\n    });\n  }\n\n  var timeout;\n\n  var listener = function(ev) {\n    if (timeout) {\n      $browser.defer.cancel(timeout);\n      timeout = null;\n    }\n    if (composing) return;\n    var value = element.val(),\n        event = ev && ev.type;\n\n    // By default we will trim the value\n    // If the attribute ng-trim exists we will avoid trimming\n    // If input type is 'password', the value is never trimmed\n    if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {\n      value = trim(value);\n    }\n\n    // If a control is suffering from bad input (due to native validators), browsers discard its\n    // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the\n    // control's value is the same empty value twice in a row.\n    if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {\n      ctrl.$setViewValue(value, event);\n    }\n  };\n\n  // if the browser does support \"input\" event, we are fine - except on IE9 which doesn't fire the\n  // input event on backspace, delete or cut\n  if ($sniffer.hasEvent('input')) {\n    element.on('input', listener);\n  } else {\n    var deferListener = function(ev, input, origValue) {\n      if (!timeout) {\n        timeout = $browser.defer(function() {\n          timeout = null;\n          if (!input || input.value !== origValue) {\n            listener(ev);\n          }\n        });\n      }\n    };\n\n    element.on('keydown', function(event) {\n      var key = event.keyCode;\n\n      // ignore\n      //    command            modifiers                   arrows\n      if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;\n\n      deferListener(event, this, this.value);\n    });\n\n    // if user modifies input value using context menu in IE, we need \"paste\" and \"cut\" events to catch it\n    if ($sniffer.hasEvent('paste')) {\n      element.on('paste cut', deferListener);\n    }\n  }\n\n  // if user paste into input using mouse on older browser\n  // or form autocomplete on newer browser, we need \"change\" event to catch it\n  element.on('change', listener);\n\n  // Some native input types (date-family) have the ability to change validity without\n  // firing any input/change events.\n  // For these event types, when native validators are present and the browser supports the type,\n  // check for validity changes on various DOM events.\n  if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) {\n    element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {\n      if (!timeout) {\n        var validity = this[VALIDITY_STATE_PROPERTY];\n        var origBadInput = validity.badInput;\n        var origTypeMismatch = validity.typeMismatch;\n        timeout = $browser.defer(function() {\n          timeout = null;\n          if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) {\n            listener(ev);\n          }\n        });\n      }\n    });\n  }\n\n  ctrl.$render = function() {\n    // Workaround for Firefox validation #12102.\n    var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;\n    if (element.val() !== value) {\n      element.val(value);\n    }\n  };\n}\n\nfunction weekParser(isoWeek, existingDate) {\n  if (isDate(isoWeek)) {\n    return isoWeek;\n  }\n\n  if (isString(isoWeek)) {\n    WEEK_REGEXP.lastIndex = 0;\n    var parts = WEEK_REGEXP.exec(isoWeek);\n    if (parts) {\n      var year = +parts[1],\n          week = +parts[2],\n          hours = 0,\n          minutes = 0,\n          seconds = 0,\n          milliseconds = 0,\n          firstThurs = getFirstThursdayOfYear(year),\n          addDays = (week - 1) * 7;\n\n      if (existingDate) {\n        hours = existingDate.getHours();\n        minutes = existingDate.getMinutes();\n        seconds = existingDate.getSeconds();\n        milliseconds = existingDate.getMilliseconds();\n      }\n\n      return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);\n    }\n  }\n\n  return NaN;\n}\n\nfunction createDateParser(regexp, mapping) {\n  return function(iso, date) {\n    var parts, map;\n\n    if (isDate(iso)) {\n      return iso;\n    }\n\n    if (isString(iso)) {\n      // When a date is JSON'ified to wraps itself inside of an extra\n      // set of double quotes. This makes the date parsing code unable\n      // to match the date string and parse it as a date.\n      if (iso.charAt(0) == '\"' && iso.charAt(iso.length - 1) == '\"') {\n        iso = iso.substring(1, iso.length - 1);\n      }\n      if (ISO_DATE_REGEXP.test(iso)) {\n        return new Date(iso);\n      }\n      regexp.lastIndex = 0;\n      parts = regexp.exec(iso);\n\n      if (parts) {\n        parts.shift();\n        if (date) {\n          map = {\n            yyyy: date.getFullYear(),\n            MM: date.getMonth() + 1,\n            dd: date.getDate(),\n            HH: date.getHours(),\n            mm: date.getMinutes(),\n            ss: date.getSeconds(),\n            sss: date.getMilliseconds() / 1000\n          };\n        } else {\n          map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };\n        }\n\n        forEach(parts, function(part, index) {\n          if (index < mapping.length) {\n            map[mapping[index]] = +part;\n          }\n        });\n        return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);\n      }\n    }\n\n    return NaN;\n  };\n}\n\nfunction createDateInputType(type, regexp, parseDate, format) {\n  return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {\n    badInputChecker(scope, element, attr, ctrl);\n    baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n    var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;\n    var previousDate;\n\n    ctrl.$$parserName = type;\n    ctrl.$parsers.push(function(value) {\n      if (ctrl.$isEmpty(value)) return null;\n      if (regexp.test(value)) {\n        // Note: We cannot read ctrl.$modelValue, as there might be a different\n        // parser/formatter in the processing chain so that the model\n        // contains some different data format!\n        var parsedDate = parseDate(value, previousDate);\n        if (timezone) {\n          parsedDate = convertTimezoneToLocal(parsedDate, timezone);\n        }\n        return parsedDate;\n      }\n      return undefined;\n    });\n\n    ctrl.$formatters.push(function(value) {\n      if (value && !isDate(value)) {\n        throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);\n      }\n      if (isValidDate(value)) {\n        previousDate = value;\n        if (previousDate && timezone) {\n          previousDate = convertTimezoneToLocal(previousDate, timezone, true);\n        }\n        return $filter('date')(value, format, timezone);\n      } else {\n        previousDate = null;\n        return '';\n      }\n    });\n\n    if (isDefined(attr.min) || attr.ngMin) {\n      var minVal;\n      ctrl.$validators.min = function(value) {\n        return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;\n      };\n      attr.$observe('min', function(val) {\n        minVal = parseObservedDateValue(val);\n        ctrl.$validate();\n      });\n    }\n\n    if (isDefined(attr.max) || attr.ngMax) {\n      var maxVal;\n      ctrl.$validators.max = function(value) {\n        return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;\n      };\n      attr.$observe('max', function(val) {\n        maxVal = parseObservedDateValue(val);\n        ctrl.$validate();\n      });\n    }\n\n    function isValidDate(value) {\n      // Invalid Date: getTime() returns NaN\n      return value && !(value.getTime && value.getTime() !== value.getTime());\n    }\n\n    function parseObservedDateValue(val) {\n      return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;\n    }\n  };\n}\n\nfunction badInputChecker(scope, element, attr, ctrl) {\n  var node = element[0];\n  var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);\n  if (nativeValidation) {\n    ctrl.$parsers.push(function(value) {\n      var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};\n      return validity.badInput || validity.typeMismatch ? undefined : value;\n    });\n  }\n}\n\nfunction numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  badInputChecker(scope, element, attr, ctrl);\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n\n  ctrl.$$parserName = 'number';\n  ctrl.$parsers.push(function(value) {\n    if (ctrl.$isEmpty(value))      return null;\n    if (NUMBER_REGEXP.test(value)) return parseFloat(value);\n    return undefined;\n  });\n\n  ctrl.$formatters.push(function(value) {\n    if (!ctrl.$isEmpty(value)) {\n      if (!isNumber(value)) {\n        throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);\n      }\n      value = value.toString();\n    }\n    return value;\n  });\n\n  if (isDefined(attr.min) || attr.ngMin) {\n    var minVal;\n    ctrl.$validators.min = function(value) {\n      return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;\n    };\n\n    attr.$observe('min', function(val) {\n      if (isDefined(val) && !isNumber(val)) {\n        val = parseFloat(val, 10);\n      }\n      minVal = isNumber(val) && !isNaN(val) ? val : undefined;\n      // TODO(matsko): implement validateLater to reduce number of validations\n      ctrl.$validate();\n    });\n  }\n\n  if (isDefined(attr.max) || attr.ngMax) {\n    var maxVal;\n    ctrl.$validators.max = function(value) {\n      return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;\n    };\n\n    attr.$observe('max', function(val) {\n      if (isDefined(val) && !isNumber(val)) {\n        val = parseFloat(val, 10);\n      }\n      maxVal = isNumber(val) && !isNaN(val) ? val : undefined;\n      // TODO(matsko): implement validateLater to reduce number of validations\n      ctrl.$validate();\n    });\n  }\n}\n\nfunction urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  // Note: no badInputChecker here by purpose as `url` is only a validation\n  // in browsers, i.e. we can always read out input.value even if it is not valid!\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n\n  ctrl.$$parserName = 'url';\n  ctrl.$validators.url = function(modelValue, viewValue) {\n    var value = modelValue || viewValue;\n    return ctrl.$isEmpty(value) || URL_REGEXP.test(value);\n  };\n}\n\nfunction emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {\n  // Note: no badInputChecker here by purpose as `url` is only a validation\n  // in browsers, i.e. we can always read out input.value even if it is not valid!\n  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);\n  stringBasedInputType(ctrl);\n\n  ctrl.$$parserName = 'email';\n  ctrl.$validators.email = function(modelValue, viewValue) {\n    var value = modelValue || viewValue;\n    return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);\n  };\n}\n\nfunction radioInputType(scope, element, attr, ctrl) {\n  // make the name unique, if not defined\n  if (isUndefined(attr.name)) {\n    element.attr('name', nextUid());\n  }\n\n  var listener = function(ev) {\n    if (element[0].checked) {\n      ctrl.$setViewValue(attr.value, ev && ev.type);\n    }\n  };\n\n  element.on('click', listener);\n\n  ctrl.$render = function() {\n    var value = attr.value;\n    element[0].checked = (value == ctrl.$viewValue);\n  };\n\n  attr.$observe('value', ctrl.$render);\n}\n\nfunction parseConstantExpr($parse, context, name, expression, fallback) {\n  var parseFn;\n  if (isDefined(expression)) {\n    parseFn = $parse(expression);\n    if (!parseFn.constant) {\n      throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +\n                                   '`{1}`.', name, expression);\n    }\n    return parseFn(context);\n  }\n  return fallback;\n}\n\nfunction checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {\n  var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);\n  var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);\n\n  var listener = function(ev) {\n    ctrl.$setViewValue(element[0].checked, ev && ev.type);\n  };\n\n  element.on('click', listener);\n\n  ctrl.$render = function() {\n    element[0].checked = ctrl.$viewValue;\n  };\n\n  // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`\n  // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert\n  // it to a boolean.\n  ctrl.$isEmpty = function(value) {\n    return value === false;\n  };\n\n  ctrl.$formatters.push(function(value) {\n    return equals(value, trueValue);\n  });\n\n  ctrl.$parsers.push(function(value) {\n    return value ? trueValue : falseValue;\n  });\n}\n\n\n/**\n * @ngdoc directive\n * @name textarea\n * @restrict E\n *\n * @description\n * HTML textarea element control with angular data-binding. The data-binding and validation\n * properties of this element are exactly the same as those of the\n * {@link ng.directive:input input element}.\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n *    length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n *    If the expression evaluates to a RegExp object, then this is used directly.\n *    If the expression evaluates to a string, then it will be converted to a RegExp\n *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n *    `new RegExp('^abc$')`.<br />\n *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n *    start at the index of the last search's match, thus not taking the whole input value into\n *    account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n */\n\n\n/**\n * @ngdoc directive\n * @name input\n * @restrict E\n *\n * @description\n * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,\n * input state control, and validation.\n * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.\n *\n * <div class=\"alert alert-warning\">\n * **Note:** Not every feature offered is available for all input types.\n * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.\n * </div>\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {boolean=} ngRequired Sets `required` attribute if set to true\n * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than\n *    minlength.\n * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than\n *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any\n *    length.\n * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}\n *    value does not match a RegExp found by evaluating the Angular expression given in the attribute value.\n *    If the expression evaluates to a RegExp object, then this is used directly.\n *    If the expression evaluates to a string, then it will be converted to a RegExp\n *    after wrapping it in `^` and `$` characters. For instance, `\"abc\"` will be converted to\n *    `new RegExp('^abc$')`.<br />\n *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n *    start at the index of the last search's match, thus not taking the whole input value into\n *    account.\n * @param {string=} ngChange Angular expression to be executed when input changes due to user\n *    interaction with the input element.\n * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.\n *    This parameter is ignored for input[type=password] controls, which will never trim the\n *    input.\n *\n * @example\n    <example name=\"input-directive\" module=\"inputExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('inputExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.user = {name: 'guest', last: 'visitor'};\n            }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <form name=\"myForm\">\n           <label>\n              User name:\n              <input type=\"text\" name=\"userName\" ng-model=\"user.name\" required>\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.userName.$error.required\">\n              Required!</span>\n           </div>\n           <label>\n              Last name:\n              <input type=\"text\" name=\"lastName\" ng-model=\"user.last\"\n              ng-minlength=\"3\" ng-maxlength=\"10\">\n           </label>\n           <div role=\"alert\">\n             <span class=\"error\" ng-show=\"myForm.lastName.$error.minlength\">\n               Too short!</span>\n             <span class=\"error\" ng-show=\"myForm.lastName.$error.maxlength\">\n               Too long!</span>\n           </div>\n         </form>\n         <hr>\n         <tt>user = {{user}}</tt><br/>\n         <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>\n         <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>\n         <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>\n         <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>\n         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n         <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>\n         <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>\n       </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var user = element(by.exactBinding('user'));\n        var userNameValid = element(by.binding('myForm.userName.$valid'));\n        var lastNameValid = element(by.binding('myForm.lastName.$valid'));\n        var lastNameError = element(by.binding('myForm.lastName.$error'));\n        var formValid = element(by.binding('myForm.$valid'));\n        var userNameInput = element(by.model('user.name'));\n        var userLastInput = element(by.model('user.last'));\n\n        it('should initialize to model', function() {\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if empty when required', function() {\n          userNameInput.clear();\n          userNameInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"last\":\"visitor\"}');\n          expect(userNameValid.getText()).toContain('false');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be valid if empty when min length is set', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\",\"last\":\"\"}');\n          expect(lastNameValid.getText()).toContain('true');\n          expect(formValid.getText()).toContain('true');\n        });\n\n        it('should be invalid if less than required min length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('xx');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('minlength');\n          expect(formValid.getText()).toContain('false');\n        });\n\n        it('should be invalid if longer than max length', function() {\n          userLastInput.clear();\n          userLastInput.sendKeys('some ridiculously long name');\n\n          expect(user.getText()).toContain('{\"name\":\"guest\"}');\n          expect(lastNameValid.getText()).toContain('false');\n          expect(lastNameError.getText()).toContain('maxlength');\n          expect(formValid.getText()).toContain('false');\n        });\n      </file>\n    </example>\n */\nvar inputDirective = ['$browser', '$sniffer', '$filter', '$parse',\n    function($browser, $sniffer, $filter, $parse) {\n  return {\n    restrict: 'E',\n    require: ['?ngModel'],\n    link: {\n      pre: function(scope, element, attr, ctrls) {\n        if (ctrls[0]) {\n          (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,\n                                                              $browser, $filter, $parse);\n        }\n      }\n    }\n  };\n}];\n\n\n\nvar CONSTANT_VALUE_REGEXP = /^(true|false|\\d+)$/;\n/**\n * @ngdoc directive\n * @name ngValue\n *\n * @description\n * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},\n * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to\n * the bound value.\n *\n * `ngValue` is useful when dynamically generating lists of radio buttons using\n * {@link ngRepeat `ngRepeat`}, as shown below.\n *\n * Likewise, `ngValue` can be used to generate `<option>` elements for\n * the {@link select `select`} element. In that case however, only strings are supported\n * for the `value `attribute, so the resulting `ngModel` will always be a string.\n * Support for `select` models with non-string values is available via `ngOptions`.\n *\n * @element input\n * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute\n *   of the `input` element\n *\n * @example\n    <example name=\"ngValue-directive\" module=\"valueExample\">\n      <file name=\"index.html\">\n       <script>\n          angular.module('valueExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.names = ['pizza', 'unicorns', 'robots'];\n              $scope.my = { favorite: 'unicorns' };\n            }]);\n       </script>\n        <form ng-controller=\"ExampleController\">\n          <h2>Which is your favorite?</h2>\n            <label ng-repeat=\"name in names\" for=\"{{name}}\">\n              {{name}}\n              <input type=\"radio\"\n                     ng-model=\"my.favorite\"\n                     ng-value=\"name\"\n                     id=\"{{name}}\"\n                     name=\"favorite\">\n            </label>\n          <div>You chose {{my.favorite}}</div>\n        </form>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        var favorite = element(by.binding('my.favorite'));\n\n        it('should initialize to model', function() {\n          expect(favorite.getText()).toContain('unicorns');\n        });\n        it('should bind the values to the inputs', function() {\n          element.all(by.model('my.favorite')).get(0).click();\n          expect(favorite.getText()).toContain('pizza');\n        });\n      </file>\n    </example>\n */\nvar ngValueDirective = function() {\n  return {\n    restrict: 'A',\n    priority: 100,\n    compile: function(tpl, tplAttr) {\n      if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {\n        return function ngValueConstantLink(scope, elm, attr) {\n          attr.$set('value', scope.$eval(attr.ngValue));\n        };\n      } else {\n        return function ngValueLink(scope, elm, attr) {\n          scope.$watch(attr.ngValue, function valueWatchAction(value) {\n            attr.$set('value', value);\n          });\n        };\n      }\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngBind\n * @restrict AC\n *\n * @description\n * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element\n * with the value of a given expression, and to update the text content when the value of that\n * expression changes.\n *\n * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like\n * `{{ expression }}` which is similar but less verbose.\n *\n * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily\n * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an\n * element attribute, it makes the bindings invisible to the user while the page is loading.\n *\n * An alternative solution to this problem would be using the\n * {@link ng.directive:ngCloak ngCloak} directive.\n *\n *\n * @element ANY\n * @param {expression} ngBind {@link guide/expression Expression} to evaluate.\n *\n * @example\n * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.name = 'Whirled';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n         <label>Enter name: <input type=\"text\" ng-model=\"name\"></label><br>\n         Hello <span ng-bind=\"name\"></span>!\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var nameInput = element(by.model('name'));\n\n         expect(element(by.binding('name')).getText()).toBe('Whirled');\n         nameInput.clear();\n         nameInput.sendKeys('world');\n         expect(element(by.binding('name')).getText()).toBe('world');\n       });\n     </file>\n   </example>\n */\nvar ngBindDirective = ['$compile', function($compile) {\n  return {\n    restrict: 'AC',\n    compile: function ngBindCompile(templateElement) {\n      $compile.$$addBindingClass(templateElement);\n      return function ngBindLink(scope, element, attr) {\n        $compile.$$addBindingInfo(element, attr.ngBind);\n        element = element[0];\n        scope.$watch(attr.ngBind, function ngBindWatchAction(value) {\n          element.textContent = isUndefined(value) ? '' : value;\n        });\n      };\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindTemplate\n *\n * @description\n * The `ngBindTemplate` directive specifies that the element\n * text content should be replaced with the interpolation of the template\n * in the `ngBindTemplate` attribute.\n * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`\n * expressions. This directive is needed since some HTML elements\n * (such as TITLE and OPTION) cannot contain SPAN elements.\n *\n * @element ANY\n * @param {string} ngBindTemplate template of form\n *   <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.\n *\n * @example\n * Try it here: enter text in text box and watch the greeting change.\n   <example module=\"bindExample\">\n     <file name=\"index.html\">\n       <script>\n         angular.module('bindExample', [])\n           .controller('ExampleController', ['$scope', function($scope) {\n             $scope.salutation = 'Hello';\n             $scope.name = 'World';\n           }]);\n       </script>\n       <div ng-controller=\"ExampleController\">\n        <label>Salutation: <input type=\"text\" ng-model=\"salutation\"></label><br>\n        <label>Name: <input type=\"text\" ng-model=\"name\"></label><br>\n        <pre ng-bind-template=\"{{salutation}} {{name}}!\"></pre>\n       </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind', function() {\n         var salutationElem = element(by.binding('salutation'));\n         var salutationInput = element(by.model('salutation'));\n         var nameInput = element(by.model('name'));\n\n         expect(salutationElem.getText()).toBe('Hello World!');\n\n         salutationInput.clear();\n         salutationInput.sendKeys('Greetings');\n         nameInput.clear();\n         nameInput.sendKeys('user');\n\n         expect(salutationElem.getText()).toBe('Greetings user!');\n       });\n     </file>\n   </example>\n */\nvar ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {\n  return {\n    compile: function ngBindTemplateCompile(templateElement) {\n      $compile.$$addBindingClass(templateElement);\n      return function ngBindTemplateLink(scope, element, attr) {\n        var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));\n        $compile.$$addBindingInfo(element, interpolateFn.expressions);\n        element = element[0];\n        attr.$observe('ngBindTemplate', function(value) {\n          element.textContent = isUndefined(value) ? '' : value;\n        });\n      };\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngBindHtml\n *\n * @description\n * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,\n * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.\n * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link\n * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}\n * in your module's dependencies, you need to include \"angular-sanitize.js\" in your application.\n *\n * You may also bypass sanitization for values you know are safe. To do so, bind to\n * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}.  See the example\n * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.\n *\n * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you\n * will have an exception (instead of an exploit.)\n *\n * @element ANY\n * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.\n *\n * @example\n\n   <example module=\"bindHtmlExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n        <p ng-bind-html=\"myHTML\"></p>\n       </div>\n     </file>\n\n     <file name=\"script.js\">\n       angular.module('bindHtmlExample', ['ngSanitize'])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.myHTML =\n              'I am an <code>HTML</code>string with ' +\n              '<a href=\"#\">links!</a> and other <em>stuff</em>';\n         }]);\n     </file>\n\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-bind-html', function() {\n         expect(element(by.binding('myHTML')).getText()).toBe(\n             'I am an HTMLstring with links! and other stuff');\n       });\n     </file>\n   </example>\n */\nvar ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {\n  return {\n    restrict: 'A',\n    compile: function ngBindHtmlCompile(tElement, tAttrs) {\n      var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);\n      var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function getStringValue(value) {\n        return (value || '').toString();\n      });\n      $compile.$$addBindingClass(tElement);\n\n      return function ngBindHtmlLink(scope, element, attr) {\n        $compile.$$addBindingInfo(element, attr.ngBindHtml);\n\n        scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {\n          // we re-evaluate the expr because we want a TrustedValueHolderType\n          // for $sce, not a string\n          element.html($sce.getTrustedHtml(ngBindHtmlGetter(scope)) || '');\n        });\n      };\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngChange\n *\n * @description\n * Evaluate the given expression when the user changes the input.\n * The expression is evaluated immediately, unlike the JavaScript onchange event\n * which only triggers at the end of a change (usually, when the user leaves the\n * form element or presses the return key).\n *\n * The `ngChange` expression is only evaluated when a change in the input value causes\n * a new value to be committed to the model.\n *\n * It will not be evaluated:\n * * if the value returned from the `$parsers` transformation pipeline has not changed\n * * if the input has continued to be invalid since the model will stay `null`\n * * if the model is changed programmatically and not by a change to the input value\n *\n *\n * Note, this directive requires `ngModel` to be present.\n *\n * @element input\n * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change\n * in input value.\n *\n * @example\n * <example name=\"ngChange-directive\" module=\"changeExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('changeExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.counter = 0;\n *           $scope.change = function() {\n *             $scope.counter++;\n *           };\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <input type=\"checkbox\" ng-model=\"confirmed\" ng-change=\"change()\" id=\"ng-change-example1\" />\n *       <input type=\"checkbox\" ng-model=\"confirmed\" id=\"ng-change-example2\" />\n *       <label for=\"ng-change-example2\">Confirmed</label><br />\n *       <tt>debug = {{confirmed}}</tt><br/>\n *       <tt>counter = {{counter}}</tt><br/>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var counter = element(by.binding('counter'));\n *     var debug = element(by.binding('confirmed'));\n *\n *     it('should evaluate the expression if changing from view', function() {\n *       expect(counter.getText()).toContain('0');\n *\n *       element(by.id('ng-change-example1')).click();\n *\n *       expect(counter.getText()).toContain('1');\n *       expect(debug.getText()).toContain('true');\n *     });\n *\n *     it('should not evaluate the expression if changing from model', function() {\n *       element(by.id('ng-change-example2')).click();\n\n *       expect(counter.getText()).toContain('0');\n *       expect(debug.getText()).toContain('true');\n *     });\n *   </file>\n * </example>\n */\nvar ngChangeDirective = valueFn({\n  restrict: 'A',\n  require: 'ngModel',\n  link: function(scope, element, attr, ctrl) {\n    ctrl.$viewChangeListeners.push(function() {\n      scope.$eval(attr.ngChange);\n    });\n  }\n});\n\nfunction classDirective(name, selector) {\n  name = 'ngClass' + name;\n  return ['$animate', function($animate) {\n    return {\n      restrict: 'AC',\n      link: function(scope, element, attr) {\n        var oldVal;\n\n        scope.$watch(attr[name], ngClassWatchAction, true);\n\n        attr.$observe('class', function(value) {\n          ngClassWatchAction(scope.$eval(attr[name]));\n        });\n\n\n        if (name !== 'ngClass') {\n          scope.$watch('$index', function($index, old$index) {\n            // jshint bitwise: false\n            var mod = $index & 1;\n            if (mod !== (old$index & 1)) {\n              var classes = arrayClasses(scope.$eval(attr[name]));\n              mod === selector ?\n                addClasses(classes) :\n                removeClasses(classes);\n            }\n          });\n        }\n\n        function addClasses(classes) {\n          var newClasses = digestClassCounts(classes, 1);\n          attr.$addClass(newClasses);\n        }\n\n        function removeClasses(classes) {\n          var newClasses = digestClassCounts(classes, -1);\n          attr.$removeClass(newClasses);\n        }\n\n        function digestClassCounts(classes, count) {\n          // Use createMap() to prevent class assumptions involving property\n          // names in Object.prototype\n          var classCounts = element.data('$classCounts') || createMap();\n          var classesToUpdate = [];\n          forEach(classes, function(className) {\n            if (count > 0 || classCounts[className]) {\n              classCounts[className] = (classCounts[className] || 0) + count;\n              if (classCounts[className] === +(count > 0)) {\n                classesToUpdate.push(className);\n              }\n            }\n          });\n          element.data('$classCounts', classCounts);\n          return classesToUpdate.join(' ');\n        }\n\n        function updateClasses(oldClasses, newClasses) {\n          var toAdd = arrayDifference(newClasses, oldClasses);\n          var toRemove = arrayDifference(oldClasses, newClasses);\n          toAdd = digestClassCounts(toAdd, 1);\n          toRemove = digestClassCounts(toRemove, -1);\n          if (toAdd && toAdd.length) {\n            $animate.addClass(element, toAdd);\n          }\n          if (toRemove && toRemove.length) {\n            $animate.removeClass(element, toRemove);\n          }\n        }\n\n        function ngClassWatchAction(newVal) {\n          if (selector === true || scope.$index % 2 === selector) {\n            var newClasses = arrayClasses(newVal || []);\n            if (!oldVal) {\n              addClasses(newClasses);\n            } else if (!equals(newVal,oldVal)) {\n              var oldClasses = arrayClasses(oldVal);\n              updateClasses(oldClasses, newClasses);\n            }\n          }\n          oldVal = shallowCopy(newVal);\n        }\n      }\n    };\n\n    function arrayDifference(tokens1, tokens2) {\n      var values = [];\n\n      outer:\n      for (var i = 0; i < tokens1.length; i++) {\n        var token = tokens1[i];\n        for (var j = 0; j < tokens2.length; j++) {\n          if (token == tokens2[j]) continue outer;\n        }\n        values.push(token);\n      }\n      return values;\n    }\n\n    function arrayClasses(classVal) {\n      var classes = [];\n      if (isArray(classVal)) {\n        forEach(classVal, function(v) {\n          classes = classes.concat(arrayClasses(v));\n        });\n        return classes;\n      } else if (isString(classVal)) {\n        return classVal.split(' ');\n      } else if (isObject(classVal)) {\n        forEach(classVal, function(v, k) {\n          if (v) {\n            classes = classes.concat(k.split(' '));\n          }\n        });\n        return classes;\n      }\n      return classVal;\n    }\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ngClass\n * @restrict AC\n *\n * @description\n * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding\n * an expression that represents all classes to be added.\n *\n * The directive operates in three different ways, depending on which of three types the expression\n * evaluates to:\n *\n * 1. If the expression evaluates to a string, the string should be one or more space-delimited class\n * names.\n *\n * 2. If the expression evaluates to an object, then for each key-value pair of the\n * object with a truthy value the corresponding key is used as a class name.\n *\n * 3. If the expression evaluates to an array, each element of the array should either be a string as in\n * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array\n * to give you more control over what CSS classes appear. See the code below for an example of this.\n *\n *\n * The directive won't add duplicate classes if a particular class was already set.\n *\n * When the expression changes, the previously added classes are removed and only then are the\n * new classes added.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#addClass addClass}       | just before the class is applied to the element   |\n * | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |\n *\n * @element ANY\n * @param {expression} ngClass {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class\n *   names, an array, or a map of class names to boolean values. In the case of a map, the\n *   names of the properties whose values are truthy will be added as css classes to the\n *   element.\n *\n * @example Example that demonstrates basic bindings via ngClass directive.\n   <example>\n     <file name=\"index.html\">\n       <p ng-class=\"{strike: deleted, bold: important, 'has-error': error}\">Map Syntax Example</p>\n       <label>\n          <input type=\"checkbox\" ng-model=\"deleted\">\n          deleted (apply \"strike\" class)\n       </label><br>\n       <label>\n          <input type=\"checkbox\" ng-model=\"important\">\n          important (apply \"bold\" class)\n       </label><br>\n       <label>\n          <input type=\"checkbox\" ng-model=\"error\">\n          error (apply \"has-error\" class)\n       </label>\n       <hr>\n       <p ng-class=\"style\">Using String Syntax</p>\n       <input type=\"text\" ng-model=\"style\"\n              placeholder=\"Type: bold strike red\" aria-label=\"Type: bold strike red\">\n       <hr>\n       <p ng-class=\"[style1, style2, style3]\">Using Array Syntax</p>\n       <input ng-model=\"style1\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red\"><br>\n       <input ng-model=\"style2\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 2\"><br>\n       <input ng-model=\"style3\"\n              placeholder=\"Type: bold, strike or red\" aria-label=\"Type: bold, strike or red 3\"><br>\n       <hr>\n       <p ng-class=\"[style4, {orange: warning}]\">Using Array and Map Syntax</p>\n       <input ng-model=\"style4\" placeholder=\"Type: bold, strike\" aria-label=\"Type: bold, strike\"><br>\n       <label><input type=\"checkbox\" ng-model=\"warning\"> warning (apply \"orange\" class)</label>\n     </file>\n     <file name=\"style.css\">\n       .strike {\n           text-decoration: line-through;\n       }\n       .bold {\n           font-weight: bold;\n       }\n       .red {\n           color: red;\n       }\n       .has-error {\n           color: red;\n           background-color: yellow;\n       }\n       .orange {\n           color: orange;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var ps = element.all(by.css('p'));\n\n       it('should let you toggle the class', function() {\n\n         expect(ps.first().getAttribute('class')).not.toMatch(/bold/);\n         expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);\n\n         element(by.model('important')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/bold/);\n\n         element(by.model('error')).click();\n         expect(ps.first().getAttribute('class')).toMatch(/has-error/);\n       });\n\n       it('should let you toggle string example', function() {\n         expect(ps.get(1).getAttribute('class')).toBe('');\n         element(by.model('style')).clear();\n         element(by.model('style')).sendKeys('red');\n         expect(ps.get(1).getAttribute('class')).toBe('red');\n       });\n\n       it('array example should have 3 classes', function() {\n         expect(ps.get(2).getAttribute('class')).toBe('');\n         element(by.model('style1')).sendKeys('bold');\n         element(by.model('style2')).sendKeys('strike');\n         element(by.model('style3')).sendKeys('red');\n         expect(ps.get(2).getAttribute('class')).toBe('bold strike red');\n       });\n\n       it('array with map example should have 2 classes', function() {\n         expect(ps.last().getAttribute('class')).toBe('');\n         element(by.model('style4')).sendKeys('bold');\n         element(by.model('warning')).click();\n         expect(ps.last().getAttribute('class')).toBe('bold orange');\n       });\n     </file>\n   </example>\n\n   ## Animations\n\n   The example below demonstrates how to perform animations using ngClass.\n\n   <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n      <input id=\"setbtn\" type=\"button\" value=\"set\" ng-click=\"myVar='my-class'\">\n      <input id=\"clearbtn\" type=\"button\" value=\"clear\" ng-click=\"myVar=''\">\n      <br>\n      <span class=\"base-class\" ng-class=\"myVar\">Sample Text</span>\n     </file>\n     <file name=\"style.css\">\n       .base-class {\n         transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n       }\n\n       .base-class.my-class {\n         color: red;\n         font-size:3em;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class', function() {\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n\n         element(by.id('setbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).\n           toMatch(/my-class/);\n\n         element(by.id('clearbtn')).click();\n\n         expect(element(by.css('.base-class')).getAttribute('class')).not.\n           toMatch(/my-class/);\n       });\n     </file>\n   </example>\n\n\n   ## ngClass and pre-existing CSS3 Transitions/Animations\n   The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.\n   Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder\n   any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure\n   to view the step by step details of {@link $animate#addClass $animate.addClass} and\n   {@link $animate#removeClass $animate.removeClass}.\n */\nvar ngClassDirective = classDirective('', true);\n\n/**\n * @ngdoc directive\n * @name ngClassOdd\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result\n *   of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}}\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassOddDirective = classDirective('Odd', 0);\n\n/**\n * @ngdoc directive\n * @name ngClassEven\n * @restrict AC\n *\n * @description\n * The `ngClassOdd` and `ngClassEven` directives work exactly as\n * {@link ng.directive:ngClass ngClass}, except they work in\n * conjunction with `ngRepeat` and take effect only on odd (even) rows.\n *\n * This directive can be applied only within the scope of an\n * {@link ng.directive:ngRepeat ngRepeat}.\n *\n * @element ANY\n * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The\n *   result of the evaluation can be a string representing space delimited class names or an array.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <ol ng-init=\"names=['John', 'Mary', 'Cate', 'Suz']\">\n          <li ng-repeat=\"name in names\">\n           <span ng-class-odd=\"'odd'\" ng-class-even=\"'even'\">\n             {{name}} &nbsp; &nbsp; &nbsp;\n           </span>\n          </li>\n        </ol>\n     </file>\n     <file name=\"style.css\">\n       .odd {\n         color: red;\n       }\n       .even {\n         color: blue;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-class-odd and ng-class-even', function() {\n         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).\n           toMatch(/odd/);\n         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).\n           toMatch(/even/);\n       });\n     </file>\n   </example>\n */\nvar ngClassEvenDirective = classDirective('Even', 1);\n\n/**\n * @ngdoc directive\n * @name ngCloak\n * @restrict AC\n *\n * @description\n * The `ngCloak` directive is used to prevent the Angular html template from being briefly\n * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this\n * directive to avoid the undesirable flicker effect caused by the html template display.\n *\n * The directive can be applied to the `<body>` element, but the preferred usage is to apply\n * multiple `ngCloak` directives to small portions of the page to permit progressive rendering\n * of the browser view.\n *\n * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and\n * `angular.min.js`.\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```css\n * [ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {\n *   display: none !important;\n * }\n * ```\n *\n * When this css rule is loaded by the browser, all html elements (including their children) that\n * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive\n * during the compilation of the template it deletes the `ngCloak` element attribute, making\n * the compiled element visible.\n *\n * For the best result, the `angular.js` script must be loaded in the head section of the html\n * document; alternatively, the css rule above must be included in the external stylesheet of the\n * application.\n *\n * @element ANY\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <div id=\"template1\" ng-cloak>{{ 'hello' }}</div>\n        <div id=\"template2\" class=\"ng-cloak\">{{ 'world' }}</div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should remove the template directive and css class', function() {\n         expect($('#template1').getAttribute('ng-cloak')).\n           toBeNull();\n         expect($('#template2').getAttribute('ng-cloak')).\n           toBeNull();\n       });\n     </file>\n   </example>\n *\n */\nvar ngCloakDirective = ngDirective({\n  compile: function(element, attr) {\n    attr.$set('ngCloak', undefined);\n    element.removeClass('ng-cloak');\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngController\n *\n * @description\n * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular\n * supports the principles behind the Model-View-Controller design pattern.\n *\n * MVC components in angular:\n *\n * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties\n *   are accessed through bindings.\n * * View — The template (HTML with data bindings) that is rendered into the View.\n * * Controller — The `ngController` directive specifies a Controller class; the class contains business\n *   logic behind the application to decorate the scope with functions and values\n *\n * Note that you can also attach controllers to the DOM by declaring it in a route definition\n * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller\n * again using `ng-controller` in the template itself.  This will cause the controller to be attached\n * and executed twice.\n *\n * @element ANY\n * @scope\n * @priority 500\n * @param {expression} ngController Name of a constructor function registered with the current\n * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}\n * that on the current scope evaluates to a constructor function.\n *\n * The controller instance can be published into a scope property by specifying\n * `ng-controller=\"as propertyName\"`.\n *\n * If the current `$controllerProvider` is configured to use globals (via\n * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may\n * also be the name of a globally accessible constructor function (not recommended).\n *\n * @example\n * Here is a simple form for editing user contact information. Adding, removing, clearing, and\n * greeting are methods declared on the controller (see source tab). These methods can\n * easily be called from the angular markup. Any changes to the data are automatically reflected\n * in the View without the need for a manual update.\n *\n * Two different declaration styles are included below:\n *\n * * one binds methods and properties directly onto the controller using `this`:\n * `ng-controller=\"SettingsController1 as settings\"`\n * * one injects `$scope` into the controller:\n * `ng-controller=\"SettingsController2\"`\n *\n * The second option is more common in the Angular community, and is generally used in boilerplates\n * and in this guide. However, there are advantages to binding properties directly to the controller\n * and avoiding scope.\n *\n * * Using `controller as` makes it obvious which controller you are accessing in the template when\n * multiple controllers apply to an element.\n * * If you are writing your controllers as classes you have easier access to the properties and\n * methods, which will appear on the scope, from inside the controller code.\n * * Since there is always a `.` in the bindings, you don't have to worry about prototypal\n * inheritance masking primitives.\n *\n * This example demonstrates the `controller as` syntax.\n *\n * <example name=\"ngControllerAs\" module=\"controllerAsExample\">\n *   <file name=\"index.html\">\n *    <div id=\"ctrl-as-exmpl\" ng-controller=\"SettingsController1 as settings\">\n *      <label>Name: <input type=\"text\" ng-model=\"settings.name\"/></label>\n *      <button ng-click=\"settings.greet()\">greet</button><br/>\n *      Contact:\n *      <ul>\n *        <li ng-repeat=\"contact in settings.contacts\">\n *          <select ng-model=\"contact.type\" aria-label=\"Contact method\" id=\"select_{{$index}}\">\n *             <option>phone</option>\n *             <option>email</option>\n *          </select>\n *          <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n *          <button ng-click=\"settings.clearContact(contact)\">clear</button>\n *          <button ng-click=\"settings.removeContact(contact)\" aria-label=\"Remove\">X</button>\n *        </li>\n *        <li><button ng-click=\"settings.addContact()\">add</button></li>\n *     </ul>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    angular.module('controllerAsExample', [])\n *      .controller('SettingsController1', SettingsController1);\n *\n *    function SettingsController1() {\n *      this.name = \"John Smith\";\n *      this.contacts = [\n *        {type: 'phone', value: '408 555 1212'},\n *        {type: 'email', value: 'john.smith@example.org'} ];\n *    }\n *\n *    SettingsController1.prototype.greet = function() {\n *      alert(this.name);\n *    };\n *\n *    SettingsController1.prototype.addContact = function() {\n *      this.contacts.push({type: 'email', value: 'yourname@example.org'});\n *    };\n *\n *    SettingsController1.prototype.removeContact = function(contactToRemove) {\n *     var index = this.contacts.indexOf(contactToRemove);\n *      this.contacts.splice(index, 1);\n *    };\n *\n *    SettingsController1.prototype.clearContact = function(contact) {\n *      contact.type = 'phone';\n *      contact.value = '';\n *    };\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should check controller as', function() {\n *       var container = element(by.id('ctrl-as-exmpl'));\n *         expect(container.element(by.model('settings.name'))\n *           .getAttribute('value')).toBe('John Smith');\n *\n *       var firstRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(0));\n *       var secondRepeat =\n *           container.element(by.repeater('contact in settings.contacts').row(1));\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('408 555 1212');\n *\n *       expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('john.smith@example.org');\n *\n *       firstRepeat.element(by.buttonText('clear')).click();\n *\n *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *           .toBe('');\n *\n *       container.element(by.buttonText('add')).click();\n *\n *       expect(container.element(by.repeater('contact in settings.contacts').row(2))\n *           .element(by.model('contact.value'))\n *           .getAttribute('value'))\n *           .toBe('yourname@example.org');\n *     });\n *   </file>\n * </example>\n *\n * This example demonstrates the \"attach to `$scope`\" style of controller.\n *\n * <example name=\"ngController\" module=\"controllerExample\">\n *  <file name=\"index.html\">\n *   <div id=\"ctrl-exmpl\" ng-controller=\"SettingsController2\">\n *     <label>Name: <input type=\"text\" ng-model=\"name\"/></label>\n *     <button ng-click=\"greet()\">greet</button><br/>\n *     Contact:\n *     <ul>\n *       <li ng-repeat=\"contact in contacts\">\n *         <select ng-model=\"contact.type\" id=\"select_{{$index}}\">\n *            <option>phone</option>\n *            <option>email</option>\n *         </select>\n *         <input type=\"text\" ng-model=\"contact.value\" aria-labelledby=\"select_{{$index}}\" />\n *         <button ng-click=\"clearContact(contact)\">clear</button>\n *         <button ng-click=\"removeContact(contact)\">X</button>\n *       </li>\n *       <li>[ <button ng-click=\"addContact()\">add</button> ]</li>\n *    </ul>\n *   </div>\n *  </file>\n *  <file name=\"app.js\">\n *   angular.module('controllerExample', [])\n *     .controller('SettingsController2', ['$scope', SettingsController2]);\n *\n *   function SettingsController2($scope) {\n *     $scope.name = \"John Smith\";\n *     $scope.contacts = [\n *       {type:'phone', value:'408 555 1212'},\n *       {type:'email', value:'john.smith@example.org'} ];\n *\n *     $scope.greet = function() {\n *       alert($scope.name);\n *     };\n *\n *     $scope.addContact = function() {\n *       $scope.contacts.push({type:'email', value:'yourname@example.org'});\n *     };\n *\n *     $scope.removeContact = function(contactToRemove) {\n *       var index = $scope.contacts.indexOf(contactToRemove);\n *       $scope.contacts.splice(index, 1);\n *     };\n *\n *     $scope.clearContact = function(contact) {\n *       contact.type = 'phone';\n *       contact.value = '';\n *     };\n *   }\n *  </file>\n *  <file name=\"protractor.js\" type=\"protractor\">\n *    it('should check controller', function() {\n *      var container = element(by.id('ctrl-exmpl'));\n *\n *      expect(container.element(by.model('name'))\n *          .getAttribute('value')).toBe('John Smith');\n *\n *      var firstRepeat =\n *          container.element(by.repeater('contact in contacts').row(0));\n *      var secondRepeat =\n *          container.element(by.repeater('contact in contacts').row(1));\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('408 555 1212');\n *      expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('john.smith@example.org');\n *\n *      firstRepeat.element(by.buttonText('clear')).click();\n *\n *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))\n *          .toBe('');\n *\n *      container.element(by.buttonText('add')).click();\n *\n *      expect(container.element(by.repeater('contact in contacts').row(2))\n *          .element(by.model('contact.value'))\n *          .getAttribute('value'))\n *          .toBe('yourname@example.org');\n *    });\n *  </file>\n *</example>\n\n */\nvar ngControllerDirective = [function() {\n  return {\n    restrict: 'A',\n    scope: true,\n    controller: '@',\n    priority: 500\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngCsp\n *\n * @element html\n * @description\n *\n * Angular has some features that can break certain\n * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.\n *\n * If you intend to implement these rules then you must tell Angular not to use these features.\n *\n * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.\n *\n *\n * The following rules affect Angular:\n *\n * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions\n * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%\n * increase in the speed of evaluating Angular expressions.\n *\n * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular\n * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).\n * To make these directives work when a CSP rule is blocking inline styles, you must link to the\n * `angular-csp.css` in your HTML manually.\n *\n * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval\n * and automatically deactivates this feature in the {@link $parse} service. This autodetection,\n * however, triggers a CSP error to be logged in the console:\n *\n * ```\n * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of\n * script in the following Content Security Policy directive: \"default-src 'self'\". Note that\n * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.\n * ```\n *\n * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`\n * directive on an element of the HTML document that appears before the `<script>` tag that loads\n * the `angular.js` file.\n *\n * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*\n *\n * You can specify which of the CSP related Angular features should be deactivated by providing\n * a value for the `ng-csp` attribute. The options are as follows:\n *\n * * no-inline-style: this stops Angular from injecting CSS styles into the DOM\n *\n * * no-unsafe-eval: this stops Angular from optimizing $parse with unsafe eval of strings\n *\n * You can use these values in the following combinations:\n *\n *\n * * No declaration means that Angular will assume that you can do inline styles, but it will do\n * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline\n * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions\n * of Angular.\n *\n * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject\n * inline styles. E.g. `<body ng-csp=\"no-unsafe-eval\">`.\n *\n * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can\n * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp=\"no-inline-style\">`\n *\n * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject\n * styles nor use eval, which is the same as an empty: ng-csp.\n * E.g.`<body ng-csp=\"no-inline-style;no-unsafe-eval\">`\n *\n * @example\n * This example shows how to apply the `ngCsp` directive to the `html` tag.\n   ```html\n     <!doctype html>\n     <html ng-app ng-csp>\n     ...\n     ...\n     </html>\n   ```\n  * @example\n      // Note: the suffix `.csp` in the example name triggers\n      // csp mode in our http server!\n      <example name=\"example.csp\" module=\"cspExample\" ng-csp=\"true\">\n        <file name=\"index.html\">\n          <div ng-controller=\"MainController as ctrl\">\n            <div>\n              <button ng-click=\"ctrl.inc()\" id=\"inc\">Increment</button>\n              <span id=\"counter\">\n                {{ctrl.counter}}\n              </span>\n            </div>\n\n            <div>\n              <button ng-click=\"ctrl.evil()\" id=\"evil\">Evil</button>\n              <span id=\"evilError\">\n                {{ctrl.evilError}}\n              </span>\n            </div>\n          </div>\n        </file>\n        <file name=\"script.js\">\n           angular.module('cspExample', [])\n             .controller('MainController', function() {\n                this.counter = 0;\n                this.inc = function() {\n                  this.counter++;\n                };\n                this.evil = function() {\n                  // jshint evil:true\n                  try {\n                    eval('1+2');\n                  } catch (e) {\n                    this.evilError = e.message;\n                  }\n                };\n              });\n        </file>\n        <file name=\"protractor.js\" type=\"protractor\">\n          var util, webdriver;\n\n          var incBtn = element(by.id('inc'));\n          var counter = element(by.id('counter'));\n          var evilBtn = element(by.id('evil'));\n          var evilError = element(by.id('evilError'));\n\n          function getAndClearSevereErrors() {\n            return browser.manage().logs().get('browser').then(function(browserLog) {\n              return browserLog.filter(function(logEntry) {\n                return logEntry.level.value > webdriver.logging.Level.WARNING.value;\n              });\n            });\n          }\n\n          function clearErrors() {\n            getAndClearSevereErrors();\n          }\n\n          function expectNoErrors() {\n            getAndClearSevereErrors().then(function(filteredLog) {\n              expect(filteredLog.length).toEqual(0);\n              if (filteredLog.length) {\n                console.log('browser console errors: ' + util.inspect(filteredLog));\n              }\n            });\n          }\n\n          function expectError(regex) {\n            getAndClearSevereErrors().then(function(filteredLog) {\n              var found = false;\n              filteredLog.forEach(function(log) {\n                if (log.message.match(regex)) {\n                  found = true;\n                }\n              });\n              if (!found) {\n                throw new Error('expected an error that matches ' + regex);\n              }\n            });\n          }\n\n          beforeEach(function() {\n            util = require('util');\n            webdriver = require('protractor/node_modules/selenium-webdriver');\n          });\n\n          // For now, we only test on Chrome,\n          // as Safari does not load the page with Protractor's injected scripts,\n          // and Firefox webdriver always disables content security policy (#6358)\n          if (browser.params.browser !== 'chrome') {\n            return;\n          }\n\n          it('should not report errors when the page is loaded', function() {\n            // clear errors so we are not dependent on previous tests\n            clearErrors();\n            // Need to reload the page as the page is already loaded when\n            // we come here\n            browser.driver.getCurrentUrl().then(function(url) {\n              browser.get(url);\n            });\n            expectNoErrors();\n          });\n\n          it('should evaluate expressions', function() {\n            expect(counter.getText()).toEqual('0');\n            incBtn.click();\n            expect(counter.getText()).toEqual('1');\n            expectNoErrors();\n          });\n\n          it('should throw and report an error when using \"eval\"', function() {\n            evilBtn.click();\n            expect(evilError.getText()).toMatch(/Content Security Policy/);\n            expectError(/Content Security Policy/);\n          });\n        </file>\n      </example>\n  */\n\n// ngCsp is not implemented as a proper directive any more, because we need it be processed while we\n// bootstrap the system (before $parse is instantiated), for this reason we just have\n// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc\n\n/**\n * @ngdoc directive\n * @name ngClick\n *\n * @description\n * The ngClick directive allows you to specify custom behavior when\n * an element is clicked.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon\n * click. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-click=\"count = count + 1\" ng-init=\"count=0\">\n        Increment\n      </button>\n      <span>\n        count: {{count}}\n      </span>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-click', function() {\n         expect(element(by.binding('count')).getText()).toMatch('0');\n         element(by.css('button')).click();\n         expect(element(by.binding('count')).getText()).toMatch('1');\n       });\n     </file>\n   </example>\n */\n/*\n * A collection of directives that allows creation of custom event handlers that are defined as\n * angular expressions and are compiled and executed within the current scope.\n */\nvar ngEventDirectives = {};\n\n// For events that might fire synchronously during DOM manipulation\n// we need to execute their event handlers asynchronously using $evalAsync,\n// so that they are not executed in an inconsistent state.\nvar forceAsyncEvents = {\n  'blur': true,\n  'focus': true\n};\nforEach(\n  'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),\n  function(eventName) {\n    var directiveName = directiveNormalize('ng-' + eventName);\n    ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {\n      return {\n        restrict: 'A',\n        compile: function($element, attr) {\n          // We expose the powerful $event object on the scope that provides access to the Window,\n          // etc. that isn't protected by the fast paths in $parse.  We explicitly request better\n          // checks at the cost of speed since event handler expressions are not executed as\n          // frequently as regular change detection.\n          var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);\n          return function ngEventHandler(scope, element) {\n            element.on(eventName, function(event) {\n              var callback = function() {\n                fn(scope, {$event:event});\n              };\n              if (forceAsyncEvents[eventName] && $rootScope.$$phase) {\n                scope.$evalAsync(callback);\n              } else {\n                scope.$apply(callback);\n              }\n            });\n          };\n        }\n      };\n    }];\n  }\n);\n\n/**\n * @ngdoc directive\n * @name ngDblclick\n *\n * @description\n * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon\n * a dblclick. (The Event object is available as `$event`)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-dblclick=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on double click)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousedown\n *\n * @description\n * The ngMousedown directive allows you to specify custom behavior on mousedown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon\n * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousedown=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse down)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseup\n *\n * @description\n * Specify custom behavior on mouseup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon\n * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseup=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (on mouse up)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngMouseover\n *\n * @description\n * Specify custom behavior on mouseover event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon\n * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseover=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse is over)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseenter\n *\n * @description\n * Specify custom behavior on mouseenter event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon\n * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseenter=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse enters)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMouseleave\n *\n * @description\n * Specify custom behavior on mouseleave event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon\n * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mouseleave=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse leaves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngMousemove\n *\n * @description\n * Specify custom behavior on mousemove event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon\n * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <button ng-mousemove=\"count = count + 1\" ng-init=\"count=0\">\n        Increment (when mouse moves)\n      </button>\n      count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeydown\n *\n * @description\n * Specify custom behavior on keydown event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon\n * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keydown=\"count = count + 1\" ng-init=\"count=0\">\n      key down count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeyup\n *\n * @description\n * Specify custom behavior on keyup event.\n *\n * @element ANY\n * @priority 0\n * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon\n * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n       <p>Typing in the input box below updates the key count</p>\n       <input ng-keyup=\"count = count + 1\" ng-init=\"count=0\"> key up count: {{count}}\n\n       <p>Typing in the input box below updates the keycode</p>\n       <input ng-keyup=\"event=$event\">\n       <p>event keyCode: {{ event.keyCode }}</p>\n       <p>event altKey: {{ event.altKey }}</p>\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngKeypress\n *\n * @description\n * Specify custom behavior on keypress event.\n *\n * @element ANY\n * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon\n * keypress. ({@link guide/expression#-event- Event object is available as `$event`}\n * and can be interrogated for keyCode, altKey, etc.)\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-keypress=\"count = count + 1\" ng-init=\"count=0\">\n      key press count: {{count}}\n     </file>\n   </example>\n */\n\n\n/**\n * @ngdoc directive\n * @name ngSubmit\n *\n * @description\n * Enables binding angular expressions to onsubmit events.\n *\n * Additionally it prevents the default action (which for form means sending the request to the\n * server and reloading the current page), but only if the form does not contain `action`,\n * `data-action`, or `x-action` attributes.\n *\n * <div class=\"alert alert-warning\">\n * **Warning:** Be careful not to cause \"double-submission\" by using both the `ngClick` and\n * `ngSubmit` handlers together. See the\n * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}\n * for a detailed discussion of when `ngSubmit` may be triggered.\n * </div>\n *\n * @element form\n * @priority 0\n * @param {expression} ngSubmit {@link guide/expression Expression} to eval.\n * ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example module=\"submitExample\">\n     <file name=\"index.html\">\n      <script>\n        angular.module('submitExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.list = [];\n            $scope.text = 'hello';\n            $scope.submit = function() {\n              if ($scope.text) {\n                $scope.list.push(this.text);\n                $scope.text = '';\n              }\n            };\n          }]);\n      </script>\n      <form ng-submit=\"submit()\" ng-controller=\"ExampleController\">\n        Enter text and hit enter:\n        <input type=\"text\" ng-model=\"text\" name=\"text\" />\n        <input type=\"submit\" id=\"submit\" value=\"Submit\" />\n        <pre>list={{list}}</pre>\n      </form>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-submit', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n         expect(element(by.model('text')).getAttribute('value')).toBe('');\n       });\n       it('should ignore empty strings', function() {\n         expect(element(by.binding('list')).getText()).toBe('list=[]');\n         element(by.css('#submit')).click();\n         element(by.css('#submit')).click();\n         expect(element(by.binding('list')).getText()).toContain('hello');\n        });\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngFocus\n *\n * @description\n * Specify custom behavior on focus event.\n *\n * Note: As the `focus` event is executed synchronously when calling `input.focus()`\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon\n * focus. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngBlur\n *\n * @description\n * Specify custom behavior on blur event.\n *\n * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when\n * an element has lost focus.\n *\n * Note: As the `blur` event is executed synchronously also during DOM manipulations\n * (e.g. removing a focussed input),\n * AngularJS executes the expression using `scope.$evalAsync` if the event is fired\n * during an `$apply` to ensure a consistent state.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon\n * blur. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n * See {@link ng.directive:ngClick ngClick}\n */\n\n/**\n * @ngdoc directive\n * @name ngCopy\n *\n * @description\n * Specify custom behavior on copy event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon\n * copy. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-copy=\"copied=true\" ng-init=\"copied=false; value='copy me'\" ng-model=\"value\">\n      copied: {{copied}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngCut\n *\n * @description\n * Specify custom behavior on cut event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon\n * cut. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-cut=\"cut=true\" ng-init=\"cut=false; value='cut me'\" ng-model=\"value\">\n      cut: {{cut}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngPaste\n *\n * @description\n * Specify custom behavior on paste event.\n *\n * @element window, input, select, textarea, a\n * @priority 0\n * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon\n * paste. ({@link guide/expression#-event- Event object is available as `$event`})\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n      <input ng-paste=\"paste=true\" ng-init=\"paste=false\" placeholder='paste here'>\n      pasted: {{paste}}\n     </file>\n   </example>\n */\n\n/**\n * @ngdoc directive\n * @name ngIf\n * @restrict A\n * @multiElement\n *\n * @description\n * The `ngIf` directive removes or recreates a portion of the DOM tree based on an\n * {expression}. If the expression assigned to `ngIf` evaluates to a false\n * value then the element is removed from the DOM, otherwise a clone of the\n * element is reinserted into the DOM.\n *\n * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the\n * element in the DOM rather than changing its visibility via the `display` css property.  A common\n * case when this difference is significant is when using css selectors that rely on an element's\n * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.\n *\n * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope\n * is created when the element is restored.  The scope created within `ngIf` inherits from\n * its parent scope using\n * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).\n * An important implication of this is if `ngModel` is used within `ngIf` to bind to\n * a javascript primitive defined in the parent scope. In this case any modifications made to the\n * variable within the child scope will override (hide) the value in the parent scope.\n *\n * Also, `ngIf` recreates elements using their compiled state. An example of this behavior\n * is if an element's class attribute is directly modified after it's compiled, using something like\n * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element\n * the added class will be lost because the original compiled state is used to regenerate the element.\n *\n * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`\n * and `leave` effects.\n *\n * @animations\n * | Animation                        | Occurs                               |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container |\n * | {@link ng.$animate#leave leave}  | just before the `ngIf` contents are removed from the DOM |\n *\n * @element ANY\n * @scope\n * @priority 600\n * @param {expression} ngIf If the {@link guide/expression expression} is falsy then\n *     the element is removed from the DOM tree. If it is truthy a copy of the compiled\n *     element is added to the DOM tree.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <label>Click me: <input type=\"checkbox\" ng-model=\"checked\" ng-init=\"checked=true\" /></label><br/>\n      Show when checked:\n      <span ng-if=\"checked\" class=\"animate-if\">\n        This is removed when the checkbox is unchecked.\n      </span>\n    </file>\n    <file name=\"animations.css\">\n      .animate-if {\n        background:white;\n        border:1px solid black;\n        padding:10px;\n      }\n\n      .animate-if.ng-enter, .animate-if.ng-leave {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n      }\n\n      .animate-if.ng-enter,\n      .animate-if.ng-leave.ng-leave-active {\n        opacity:0;\n      }\n\n      .animate-if.ng-leave,\n      .animate-if.ng-enter.ng-enter-active {\n        opacity:1;\n      }\n    </file>\n  </example>\n */\nvar ngIfDirective = ['$animate', '$compile', function($animate, $compile) {\n  return {\n    multiElement: true,\n    transclude: 'element',\n    priority: 600,\n    terminal: true,\n    restrict: 'A',\n    $$tlb: true,\n    link: function($scope, $element, $attr, ctrl, $transclude) {\n        var block, childScope, previousElements;\n        $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {\n\n          if (value) {\n            if (!childScope) {\n              $transclude(function(clone, newScope) {\n                childScope = newScope;\n                clone[clone.length++] = $compile.$$createComment('end ngIf', $attr.ngIf);\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block = {\n                  clone: clone\n                };\n                $animate.enter(clone, $element.parent(), $element);\n              });\n            }\n          } else {\n            if (previousElements) {\n              previousElements.remove();\n              previousElements = null;\n            }\n            if (childScope) {\n              childScope.$destroy();\n              childScope = null;\n            }\n            if (block) {\n              previousElements = getBlockNodes(block.clone);\n              $animate.leave(previousElements).then(function() {\n                previousElements = null;\n              });\n              block = null;\n            }\n          }\n        });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngInclude\n * @restrict ECA\n *\n * @description\n * Fetches, compiles and includes an external HTML fragment.\n *\n * By default, the template URL is restricted to the same domain and protocol as the\n * application document. This is done by calling {@link $sce#getTrustedResourceUrl\n * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols\n * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or\n * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link\n * ng.$sce Strict Contextual Escaping}.\n *\n * In addition, the browser's\n * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)\n * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)\n * policy may further restrict whether the template is successfully loaded.\n * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`\n * access on some browsers.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | when the expression changes, on the new include |\n * | {@link ng.$animate#leave leave}  | when the expression changes, on the old include |\n *\n * The enter and leave animation occur concurrently.\n *\n * @scope\n * @priority 400\n *\n * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,\n *                 make sure you wrap it in **single** quotes, e.g. `src=\"'myPartialTemplate.html'\"`.\n * @param {string=} onload Expression to evaluate when a new partial is loaded.\n *                  <div class=\"alert alert-warning\">\n *                  **Note:** When using onload on SVG elements in IE11, the browser will try to call\n *                  a function with the name on the window element, which will usually throw a\n *                  \"function is undefined\" error. To fix this, you can instead use `data-onload` or a\n *                  different form that {@link guide/directive#normalization matches} `onload`.\n *                  </div>\n   *\n * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll\n *                  $anchorScroll} to scroll the viewport after the content is loaded.\n *\n *                  - If the attribute is not set, disable scrolling.\n *                  - If the attribute is set without value, enable scrolling.\n *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.\n *\n * @example\n  <example module=\"includeExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n     <div ng-controller=\"ExampleController\">\n       <select ng-model=\"template\" ng-options=\"t.name for t in templates\">\n        <option value=\"\">(blank)</option>\n       </select>\n       url of the template: <code>{{template.url}}</code>\n       <hr/>\n       <div class=\"slide-animate-container\">\n         <div class=\"slide-animate\" ng-include=\"template.url\"></div>\n       </div>\n     </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('includeExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.templates =\n            [ { name: 'template1.html', url: 'template1.html'},\n              { name: 'template2.html', url: 'template2.html'} ];\n          $scope.template = $scope.templates[0];\n        }]);\n     </file>\n    <file name=\"template1.html\">\n      Content of template1.html\n    </file>\n    <file name=\"template2.html\">\n      Content of template2.html\n    </file>\n    <file name=\"animations.css\">\n      .slide-animate-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .slide-animate {\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter, .slide-animate.ng-leave {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n        display:block;\n        padding:10px;\n      }\n\n      .slide-animate.ng-enter {\n        top:-50px;\n      }\n      .slide-animate.ng-enter.ng-enter-active {\n        top:0;\n      }\n\n      .slide-animate.ng-leave {\n        top:0;\n      }\n      .slide-animate.ng-leave.ng-leave-active {\n        top:50px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var templateSelect = element(by.model('template'));\n      var includeElem = element(by.css('[ng-include]'));\n\n      it('should load template1.html', function() {\n        expect(includeElem.getText()).toMatch(/Content of template1.html/);\n      });\n\n      it('should load template2.html', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          // See https://github.com/angular/protractor/issues/480\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(2).click();\n        expect(includeElem.getText()).toMatch(/Content of template2.html/);\n      });\n\n      it('should change to blank', function() {\n        if (browser.params.browser == 'firefox') {\n          // Firefox can't handle using selects\n          return;\n        }\n        templateSelect.click();\n        templateSelect.all(by.css('option')).get(0).click();\n        expect(includeElem.isPresent()).toBe(false);\n      });\n    </file>\n  </example>\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentRequested\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted every time the ngInclude content is requested.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentLoaded\n * @eventType emit on the current ngInclude scope\n * @description\n * Emitted every time the ngInclude content is reloaded.\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\n\n\n/**\n * @ngdoc event\n * @name ngInclude#$includeContentError\n * @eventType emit on the scope ngInclude was declared in\n * @description\n * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)\n *\n * @param {Object} angularEvent Synthetic event object.\n * @param {String} src URL of content to load.\n */\nvar ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',\n                  function($templateRequest,   $anchorScroll,   $animate) {\n  return {\n    restrict: 'ECA',\n    priority: 400,\n    terminal: true,\n    transclude: 'element',\n    controller: angular.noop,\n    compile: function(element, attr) {\n      var srcExp = attr.ngInclude || attr.src,\n          onloadExp = attr.onload || '',\n          autoScrollExp = attr.autoscroll;\n\n      return function(scope, $element, $attr, ctrl, $transclude) {\n        var changeCounter = 0,\n            currentScope,\n            previousElement,\n            currentElement;\n\n        var cleanupLastIncludeContent = function() {\n          if (previousElement) {\n            previousElement.remove();\n            previousElement = null;\n          }\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n          if (currentElement) {\n            $animate.leave(currentElement).then(function() {\n              previousElement = null;\n            });\n            previousElement = currentElement;\n            currentElement = null;\n          }\n        };\n\n        scope.$watch(srcExp, function ngIncludeWatchAction(src) {\n          var afterAnimation = function() {\n            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {\n              $anchorScroll();\n            }\n          };\n          var thisChangeId = ++changeCounter;\n\n          if (src) {\n            //set the 2nd param to true to ignore the template request error so that the inner\n            //contents and scope can be cleaned up.\n            $templateRequest(src, true).then(function(response) {\n              if (scope.$$destroyed) return;\n\n              if (thisChangeId !== changeCounter) return;\n              var newScope = scope.$new();\n              ctrl.template = response;\n\n              // Note: This will also link all children of ng-include that were contained in the original\n              // html. If that content contains controllers, ... they could pollute/change the scope.\n              // However, using ng-include on an element with additional content does not make sense...\n              // Note: We can't remove them in the cloneAttchFn of $transclude as that\n              // function is called before linking the content, which would apply child\n              // directives to non existing elements.\n              var clone = $transclude(newScope, function(clone) {\n                cleanupLastIncludeContent();\n                $animate.enter(clone, null, $element).then(afterAnimation);\n              });\n\n              currentScope = newScope;\n              currentElement = clone;\n\n              currentScope.$emit('$includeContentLoaded', src);\n              scope.$eval(onloadExp);\n            }, function() {\n              if (scope.$$destroyed) return;\n\n              if (thisChangeId === changeCounter) {\n                cleanupLastIncludeContent();\n                scope.$emit('$includeContentError', src);\n              }\n            });\n            scope.$emit('$includeContentRequested', src);\n          } else {\n            cleanupLastIncludeContent();\n            ctrl.template = null;\n          }\n        });\n      };\n    }\n  };\n}];\n\n// This directive is called during the $transclude call of the first `ngInclude` directive.\n// It will replace and compile the content of the element with the loaded template.\n// We need this directive so that the element content is already filled when\n// the link function of another directive on the same element as ngInclude\n// is called.\nvar ngIncludeFillContentDirective = ['$compile',\n  function($compile) {\n    return {\n      restrict: 'ECA',\n      priority: -400,\n      require: 'ngInclude',\n      link: function(scope, $element, $attr, ctrl) {\n        if (toString.call($element[0]).match(/SVG/)) {\n          // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not\n          // support innerHTML, so detect this here and try to generate the contents\n          // specially.\n          $element.empty();\n          $compile(jqLiteBuildFragment(ctrl.template, document).childNodes)(scope,\n              function namespaceAdaptedClone(clone) {\n            $element.append(clone);\n          }, {futureParentElement: $element});\n          return;\n        }\n\n        $element.html(ctrl.template);\n        $compile($element.contents())(scope);\n      }\n    };\n  }];\n\n/**\n * @ngdoc directive\n * @name ngInit\n * @restrict AC\n *\n * @description\n * The `ngInit` directive allows you to evaluate an expression in the\n * current scope.\n *\n * <div class=\"alert alert-danger\">\n * This directive can be abused to add unnecessary amounts of logic into your templates.\n * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of\n * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via\n * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}\n * rather than `ngInit` to initialize values on a scope.\n * </div>\n *\n * <div class=\"alert alert-warning\">\n * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make\n * sure you have parentheses to ensure correct operator precedence:\n * <pre class=\"prettyprint\">\n * `<div ng-init=\"test1 = ($index | toString)\"></div>`\n * </pre>\n * </div>\n *\n * @priority 450\n *\n * @element ANY\n * @param {expression} ngInit {@link guide/expression Expression} to eval.\n *\n * @example\n   <example module=\"initExample\">\n     <file name=\"index.html\">\n   <script>\n     angular.module('initExample', [])\n       .controller('ExampleController', ['$scope', function($scope) {\n         $scope.list = [['a', 'b'], ['c', 'd']];\n       }]);\n   </script>\n   <div ng-controller=\"ExampleController\">\n     <div ng-repeat=\"innerList in list\" ng-init=\"outerIndex = $index\">\n       <div ng-repeat=\"value in innerList\" ng-init=\"innerIndex = $index\">\n          <span class=\"example-init\">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>\n       </div>\n     </div>\n   </div>\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should alias index positions', function() {\n         var elements = element.all(by.css('.example-init'));\n         expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');\n         expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');\n         expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');\n         expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');\n       });\n     </file>\n   </example>\n */\nvar ngInitDirective = ngDirective({\n  priority: 450,\n  compile: function() {\n    return {\n      pre: function(scope, element, attrs) {\n        scope.$eval(attrs.ngInit);\n      }\n    };\n  }\n});\n\n/**\n * @ngdoc directive\n * @name ngList\n *\n * @description\n * Text input that converts between a delimited string and an array of strings. The default\n * delimiter is a comma followed by a space - equivalent to `ng-list=\", \"`. You can specify a custom\n * delimiter as the value of the `ngList` attribute - for example, `ng-list=\" | \"`.\n *\n * The behaviour of the directive is affected by the use of the `ngTrim` attribute.\n * * If `ngTrim` is set to `\"false\"` then whitespace around both the separator and each\n *   list item is respected. This implies that the user of the directive is responsible for\n *   dealing with whitespace but also allows you to use whitespace as a delimiter, such as a\n *   tab or newline character.\n * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected\n *   when joining the list items back together) and whitespace around each list item is stripped\n *   before it is added to the model.\n *\n * ### Example with Validation\n *\n * <example name=\"ngList-directive\" module=\"listExample\">\n *   <file name=\"app.js\">\n *      angular.module('listExample', [])\n *        .controller('ExampleController', ['$scope', function($scope) {\n *          $scope.names = ['morpheus', 'neo', 'trinity'];\n *        }]);\n *   </file>\n *   <file name=\"index.html\">\n *    <form name=\"myForm\" ng-controller=\"ExampleController\">\n *      <label>List: <input name=\"namesInput\" ng-model=\"names\" ng-list required></label>\n *      <span role=\"alert\">\n *        <span class=\"error\" ng-show=\"myForm.namesInput.$error.required\">\n *        Required!</span>\n *      </span>\n *      <br>\n *      <tt>names = {{names}}</tt><br/>\n *      <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>\n *      <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>\n *      <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>\n *      <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>\n *     </form>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     var listInput = element(by.model('names'));\n *     var names = element(by.exactBinding('names'));\n *     var valid = element(by.binding('myForm.namesInput.$valid'));\n *     var error = element(by.css('span.error'));\n *\n *     it('should initialize to model', function() {\n *       expect(names.getText()).toContain('[\"morpheus\",\"neo\",\"trinity\"]');\n *       expect(valid.getText()).toContain('true');\n *       expect(error.getCssValue('display')).toBe('none');\n *     });\n *\n *     it('should be invalid if empty', function() {\n *       listInput.clear();\n *       listInput.sendKeys('');\n *\n *       expect(names.getText()).toContain('');\n *       expect(valid.getText()).toContain('false');\n *       expect(error.getCssValue('display')).not.toBe('none');\n *     });\n *   </file>\n * </example>\n *\n * ### Example - splitting on newline\n * <example name=\"ngList-directive-newlines\">\n *   <file name=\"index.html\">\n *    <textarea ng-model=\"list\" ng-list=\"&#10;\" ng-trim=\"false\"></textarea>\n *    <pre>{{ list | json }}</pre>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it(\"should split the text by newlines\", function() {\n *       var listInput = element(by.model('list'));\n *       var output = element(by.binding('list | json'));\n *       listInput.sendKeys('abc\\ndef\\nghi');\n *       expect(output.getText()).toContain('[\\n  \"abc\",\\n  \"def\",\\n  \"ghi\"\\n]');\n *     });\n *   </file>\n * </example>\n *\n * @element input\n * @param {string=} ngList optional delimiter that should be used to split the value.\n */\nvar ngListDirective = function() {\n  return {\n    restrict: 'A',\n    priority: 100,\n    require: 'ngModel',\n    link: function(scope, element, attr, ctrl) {\n      // We want to control whitespace trimming so we use this convoluted approach\n      // to access the ngList attribute, which doesn't pre-trim the attribute\n      var ngList = element.attr(attr.$attr.ngList) || ', ';\n      var trimValues = attr.ngTrim !== 'false';\n      var separator = trimValues ? trim(ngList) : ngList;\n\n      var parse = function(viewValue) {\n        // If the viewValue is invalid (say required but empty) it will be `undefined`\n        if (isUndefined(viewValue)) return;\n\n        var list = [];\n\n        if (viewValue) {\n          forEach(viewValue.split(separator), function(value) {\n            if (value) list.push(trimValues ? trim(value) : value);\n          });\n        }\n\n        return list;\n      };\n\n      ctrl.$parsers.push(parse);\n      ctrl.$formatters.push(function(value) {\n        if (isArray(value)) {\n          return value.join(ngList);\n        }\n\n        return undefined;\n      });\n\n      // Override the standard $isEmpty because an empty array means the input is empty.\n      ctrl.$isEmpty = function(value) {\n        return !value || !value.length;\n      };\n    }\n  };\n};\n\n/* global VALID_CLASS: true,\n  INVALID_CLASS: true,\n  PRISTINE_CLASS: true,\n  DIRTY_CLASS: true,\n  UNTOUCHED_CLASS: true,\n  TOUCHED_CLASS: true,\n*/\n\nvar VALID_CLASS = 'ng-valid',\n    INVALID_CLASS = 'ng-invalid',\n    PRISTINE_CLASS = 'ng-pristine',\n    DIRTY_CLASS = 'ng-dirty',\n    UNTOUCHED_CLASS = 'ng-untouched',\n    TOUCHED_CLASS = 'ng-touched',\n    PENDING_CLASS = 'ng-pending',\n    EMPTY_CLASS = 'ng-empty',\n    NOT_EMPTY_CLASS = 'ng-not-empty';\n\nvar ngModelMinErr = minErr('ngModel');\n\n/**\n * @ngdoc type\n * @name ngModel.NgModelController\n *\n * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a\n * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue\n * is set.\n * @property {*} $modelValue The value in the model that the control is bound to.\n * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever\n       the control reads value from the DOM. The functions are called in array order, each passing\n       its return value through to the next. The last return value is forwarded to the\n       {@link ngModel.NgModelController#$validators `$validators`} collection.\n\nParsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue\n`$viewValue`}.\n\nReturning `undefined` from a parser means a parse error occurred. In that case,\nno {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`\nwill be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}\nis set to `true`. The parse error is stored in `ngModel.$error.parse`.\n\n *\n * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever\n       the model value changes. The functions are called in reverse array order, each passing the value through to the\n       next. The last return value is used as the actual DOM value.\n       Used to format / convert values for display in the control.\n * ```js\n * function formatter(value) {\n *   if (value) {\n *     return value.toUpperCase();\n *   }\n * }\n * ngModel.$formatters.push(formatter);\n * ```\n *\n * @property {Object.<string, function>} $validators A collection of validators that are applied\n *      whenever the model value changes. The key value within the object refers to the name of the\n *      validator while the function refers to the validation operation. The validation operation is\n *      provided with the model value as an argument and must return a true or false value depending\n *      on the response of that validation.\n *\n * ```js\n * ngModel.$validators.validCharacters = function(modelValue, viewValue) {\n *   var value = modelValue || viewValue;\n *   return /[0-9]+/.test(value) &&\n *          /[a-z]+/.test(value) &&\n *          /[A-Z]+/.test(value) &&\n *          /\\W+/.test(value);\n * };\n * ```\n *\n * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to\n *      perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided\n *      is expected to return a promise when it is run during the model validation process. Once the promise\n *      is delivered then the validation status will be set to true when fulfilled and false when rejected.\n *      When the asynchronous validators are triggered, each of the validators will run in parallel and the model\n *      value will only be updated once all validators have been fulfilled. As long as an asynchronous validator\n *      is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators\n *      will only run once all synchronous validators have passed.\n *\n * Please note that if $http is used then it is important that the server returns a success HTTP response code\n * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.\n *\n * ```js\n * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {\n *   var value = modelValue || viewValue;\n *\n *   // Lookup user by username\n *   return $http.get('/api/users/' + value).\n *      then(function resolved() {\n *        //username exists, this means validation fails\n *        return $q.reject('exists');\n *      }, function rejected() {\n *        //username does not exist, therefore this validation passes\n *        return true;\n *      });\n * };\n * ```\n *\n * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the\n *     view value has changed. It is called with no arguments, and its return value is ignored.\n *     This can be used in place of additional $watches against the model value.\n *\n * @property {Object} $error An object hash with all failing validator ids as keys.\n * @property {Object} $pending An object hash with all pending validator ids as keys.\n *\n * @property {boolean} $untouched True if control has not lost focus yet.\n * @property {boolean} $touched True if control has lost focus.\n * @property {boolean} $pristine True if user has not interacted with the control yet.\n * @property {boolean} $dirty True if user has already interacted with the control.\n * @property {boolean} $valid True if there is no error.\n * @property {boolean} $invalid True if at least one error on the control.\n * @property {string} $name The name attribute of the control.\n *\n * @description\n *\n * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.\n * The controller contains services for data-binding, validation, CSS updates, and value formatting\n * and parsing. It purposefully does not contain any logic which deals with DOM rendering or\n * listening to DOM events.\n * Such DOM related logic should be provided by other directives which make use of\n * `NgModelController` for data-binding to control elements.\n * Angular provides this DOM logic for most {@link input `input`} elements.\n * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example\n * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.\n *\n * @example\n * ### Custom Control Example\n * This example shows how to use `NgModelController` with a custom control to achieve\n * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)\n * collaborate together to achieve the desired result.\n *\n * `contenteditable` is an HTML5 attribute, which tells the browser to let the element\n * contents be edited in place by the user.\n *\n * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}\n * module to automatically remove \"bad\" content like inline event listener (e.g. `<span onclick=\"...\">`).\n * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks\n * that content using the `$sce` service.\n *\n * <example name=\"NgModelController\" module=\"customControl\" deps=\"angular-sanitize.js\">\n    <file name=\"style.css\">\n      [contenteditable] {\n        border: 1px solid black;\n        background-color: white;\n        min-height: 20px;\n      }\n\n      .ng-invalid {\n        border: 1px solid red;\n      }\n\n    </file>\n    <file name=\"script.js\">\n      angular.module('customControl', ['ngSanitize']).\n        directive('contenteditable', ['$sce', function($sce) {\n          return {\n            restrict: 'A', // only activate on element attribute\n            require: '?ngModel', // get a hold of NgModelController\n            link: function(scope, element, attrs, ngModel) {\n              if (!ngModel) return; // do nothing if no ng-model\n\n              // Specify how UI should be updated\n              ngModel.$render = function() {\n                element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));\n              };\n\n              // Listen for change events to enable binding\n              element.on('blur keyup change', function() {\n                scope.$evalAsync(read);\n              });\n              read(); // initialize\n\n              // Write data to the model\n              function read() {\n                var html = element.html();\n                // When we clear the content editable the browser leaves a <br> behind\n                // If strip-br attribute is provided then we strip this out\n                if ( attrs.stripBr && html == '<br>' ) {\n                  html = '';\n                }\n                ngModel.$setViewValue(html);\n              }\n            }\n          };\n        }]);\n    </file>\n    <file name=\"index.html\">\n      <form name=\"myForm\">\n       <div contenteditable\n            name=\"myWidget\" ng-model=\"userContent\"\n            strip-br=\"true\"\n            required>Change me!</div>\n        <span ng-show=\"myForm.myWidget.$error.required\">Required!</span>\n       <hr>\n       <textarea ng-model=\"userContent\" aria-label=\"Dynamic textarea\"></textarea>\n      </form>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n    it('should data-bind and become invalid', function() {\n      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {\n        // SafariDriver can't handle contenteditable\n        // and Firefox driver can't clear contenteditables very well\n        return;\n      }\n      var contentEditable = element(by.css('[contenteditable]'));\n      var content = 'Change me!';\n\n      expect(contentEditable.getText()).toEqual(content);\n\n      contentEditable.clear();\n      contentEditable.sendKeys(protractor.Key.BACK_SPACE);\n      expect(contentEditable.getText()).toEqual('');\n      expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);\n    });\n    </file>\n * </example>\n *\n *\n */\nvar NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',\n    function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {\n  this.$viewValue = Number.NaN;\n  this.$modelValue = Number.NaN;\n  this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.\n  this.$validators = {};\n  this.$asyncValidators = {};\n  this.$parsers = [];\n  this.$formatters = [];\n  this.$viewChangeListeners = [];\n  this.$untouched = true;\n  this.$touched = false;\n  this.$pristine = true;\n  this.$dirty = false;\n  this.$valid = true;\n  this.$invalid = false;\n  this.$error = {}; // keep invalid keys here\n  this.$$success = {}; // keep valid keys here\n  this.$pending = undefined; // keep pending keys here\n  this.$name = $interpolate($attr.name || '', false)($scope);\n  this.$$parentForm = nullFormCtrl;\n\n  var parsedNgModel = $parse($attr.ngModel),\n      parsedNgModelAssign = parsedNgModel.assign,\n      ngModelGet = parsedNgModel,\n      ngModelSet = parsedNgModelAssign,\n      pendingDebounce = null,\n      parserValid,\n      ctrl = this;\n\n  this.$$setOptions = function(options) {\n    ctrl.$options = options;\n    if (options && options.getterSetter) {\n      var invokeModelGetter = $parse($attr.ngModel + '()'),\n          invokeModelSetter = $parse($attr.ngModel + '($$$p)');\n\n      ngModelGet = function($scope) {\n        var modelValue = parsedNgModel($scope);\n        if (isFunction(modelValue)) {\n          modelValue = invokeModelGetter($scope);\n        }\n        return modelValue;\n      };\n      ngModelSet = function($scope, newValue) {\n        if (isFunction(parsedNgModel($scope))) {\n          invokeModelSetter($scope, {$$$p: newValue});\n        } else {\n          parsedNgModelAssign($scope, newValue);\n        }\n      };\n    } else if (!parsedNgModel.assign) {\n      throw ngModelMinErr('nonassign', \"Expression '{0}' is non-assignable. Element: {1}\",\n          $attr.ngModel, startingTag($element));\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$render\n   *\n   * @description\n   * Called when the view needs to be updated. It is expected that the user of the ng-model\n   * directive will implement this method.\n   *\n   * The `$render()` method is invoked in the following situations:\n   *\n   * * `$rollbackViewValue()` is called.  If we are rolling back the view value to the last\n   *   committed value then `$render()` is called to update the input control.\n   * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and\n   *   the `$viewValue` are different from last time.\n   *\n   * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of\n   * `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue`\n   * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be\n   * invoked if you only change a property on the objects.\n   */\n  this.$render = noop;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$isEmpty\n   *\n   * @description\n   * This is called when we need to determine if the value of an input is empty.\n   *\n   * For instance, the required directive does this to work out if the input has data or not.\n   *\n   * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.\n   *\n   * You can override this for input directives whose concept of being empty is different from the\n   * default. The `checkboxInputType` directive does this because in its case a value of `false`\n   * implies empty.\n   *\n   * @param {*} value The value of the input to check for emptiness.\n   * @returns {boolean} True if `value` is \"empty\".\n   */\n  this.$isEmpty = function(value) {\n    return isUndefined(value) || value === '' || value === null || value !== value;\n  };\n\n  this.$$updateEmptyClasses = function(value) {\n    if (ctrl.$isEmpty(value)) {\n      $animate.removeClass($element, NOT_EMPTY_CLASS);\n      $animate.addClass($element, EMPTY_CLASS);\n    } else {\n      $animate.removeClass($element, EMPTY_CLASS);\n      $animate.addClass($element, NOT_EMPTY_CLASS);\n    }\n  };\n\n\n  var currentValidationRunId = 0;\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setValidity\n   *\n   * @description\n   * Change the validity state, and notify the form.\n   *\n   * This method can be called within $parsers/$formatters or a custom validation implementation.\n   * However, in most cases it should be sufficient to use the `ngModel.$validators` and\n   * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.\n   *\n   * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned\n   *        to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`\n   *        (for unfulfilled `$asyncValidators`), so that it is available for data-binding.\n   *        The `validationErrorKey` should be in camelCase and will get converted into dash-case\n   *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`\n   *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .\n   * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),\n   *                          or skipped (null). Pending is used for unfulfilled `$asyncValidators`.\n   *                          Skipped is used by Angular when validators do not run because of parse errors and\n   *                          when `$asyncValidators` do not run because any of the `$validators` failed.\n   */\n  addSetValidityMethod({\n    ctrl: this,\n    $element: $element,\n    set: function(object, property) {\n      object[property] = true;\n    },\n    unset: function(object, property) {\n      delete object[property];\n    },\n    $animate: $animate\n  });\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setPristine\n   *\n   * @description\n   * Sets the control to its pristine state.\n   *\n   * This method can be called to remove the `ng-dirty` class and set the control to its pristine\n   * state (`ng-pristine` class). A model is considered to be pristine when the control\n   * has not been changed from when first compiled.\n   */\n  this.$setPristine = function() {\n    ctrl.$dirty = false;\n    ctrl.$pristine = true;\n    $animate.removeClass($element, DIRTY_CLASS);\n    $animate.addClass($element, PRISTINE_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setDirty\n   *\n   * @description\n   * Sets the control to its dirty state.\n   *\n   * This method can be called to remove the `ng-pristine` class and set the control to its dirty\n   * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed\n   * from when first compiled.\n   */\n  this.$setDirty = function() {\n    ctrl.$dirty = true;\n    ctrl.$pristine = false;\n    $animate.removeClass($element, PRISTINE_CLASS);\n    $animate.addClass($element, DIRTY_CLASS);\n    ctrl.$$parentForm.$setDirty();\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setUntouched\n   *\n   * @description\n   * Sets the control to its untouched state.\n   *\n   * This method can be called to remove the `ng-touched` class and set the control to its\n   * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched\n   * by default, however this function can be used to restore that state if the model has\n   * already been touched by the user.\n   */\n  this.$setUntouched = function() {\n    ctrl.$touched = false;\n    ctrl.$untouched = true;\n    $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setTouched\n   *\n   * @description\n   * Sets the control to its touched state.\n   *\n   * This method can be called to remove the `ng-untouched` class and set the control to its\n   * touched state (`ng-touched` class). A model is considered to be touched when the user has\n   * first focused the control element and then shifted focus away from the control (blur event).\n   */\n  this.$setTouched = function() {\n    ctrl.$touched = true;\n    ctrl.$untouched = false;\n    $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$rollbackViewValue\n   *\n   * @description\n   * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,\n   * which may be caused by a pending debounced event or because the input is waiting for a some\n   * future event.\n   *\n   * If you have an input that uses `ng-model-options` to set up debounced updates or updates that\n   * depend on special events such as blur, you can have a situation where there is a period when\n   * the `$viewValue` is out of sync with the ngModel's `$modelValue`.\n   *\n   * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update\n   * and reset the input to the last committed view value.\n   *\n   * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`\n   * programmatically before these debounced/future events have resolved/occurred, because Angular's\n   * dirty checking mechanism is not able to tell whether the model has actually changed or not.\n   *\n   * The `$rollbackViewValue()` method should be called before programmatically changing the model of an\n   * input which may have such events pending. This is important in order to make sure that the\n   * input field will be updated with the new model value and any pending operations are cancelled.\n   *\n   * <example name=\"ng-model-cancel-update\" module=\"cancel-update-example\">\n   *   <file name=\"app.js\">\n   *     angular.module('cancel-update-example', [])\n   *\n   *     .controller('CancelUpdateController', ['$scope', function($scope) {\n   *       $scope.model = {};\n   *\n   *       $scope.setEmpty = function(e, value, rollback) {\n   *         if (e.keyCode == 27) {\n   *           e.preventDefault();\n   *           if (rollback) {\n   *             $scope.myForm[value].$rollbackViewValue();\n   *           }\n   *           $scope.model[value] = '';\n   *         }\n   *       };\n   *     }]);\n   *   </file>\n   *   <file name=\"index.html\">\n   *     <div ng-controller=\"CancelUpdateController\">\n   *        <p>Both of these inputs are only updated if they are blurred. Hitting escape should\n   *        empty them. Follow these steps and observe the difference:</p>\n   *       <ol>\n   *         <li>Type something in the input. You will see that the model is not yet updated</li>\n   *         <li>Press the Escape key.\n   *           <ol>\n   *             <li> In the first example, nothing happens, because the model is already '', and no\n   *             update is detected. If you blur the input, the model will be set to the current view.\n   *             </li>\n   *             <li> In the second example, the pending update is cancelled, and the input is set back\n   *             to the last committed view value (''). Blurring the input does nothing.\n   *             </li>\n   *           </ol>\n   *         </li>\n   *       </ol>\n   *\n   *       <form name=\"myForm\" ng-model-options=\"{ updateOn: 'blur' }\">\n   *         <div>\n   *        <p id=\"inputDescription1\">Without $rollbackViewValue():</p>\n   *         <input name=\"value1\" aria-describedby=\"inputDescription1\" ng-model=\"model.value1\"\n   *                ng-keydown=\"setEmpty($event, 'value1')\">\n   *         value1: \"{{ model.value1 }}\"\n   *         </div>\n   *\n   *         <div>\n   *        <p id=\"inputDescription2\">With $rollbackViewValue():</p>\n   *         <input name=\"value2\" aria-describedby=\"inputDescription2\" ng-model=\"model.value2\"\n   *                ng-keydown=\"setEmpty($event, 'value2', true)\">\n   *         value2: \"{{ model.value2 }}\"\n   *         </div>\n   *       </form>\n   *     </div>\n   *   </file>\n       <file name=\"style.css\">\n          div {\n            display: table-cell;\n          }\n          div:nth-child(1) {\n            padding-right: 30px;\n          }\n\n        </file>\n   * </example>\n   */\n  this.$rollbackViewValue = function() {\n    $timeout.cancel(pendingDebounce);\n    ctrl.$viewValue = ctrl.$$lastCommittedViewValue;\n    ctrl.$render();\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$validate\n   *\n   * @description\n   * Runs each of the registered validators (first synchronous validators and then\n   * asynchronous validators).\n   * If the validity changes to invalid, the model will be set to `undefined`,\n   * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.\n   * If the validity changes to valid, it will set the model to the last available valid\n   * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.\n   */\n  this.$validate = function() {\n    // ignore $validate before model is initialized\n    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n      return;\n    }\n\n    var viewValue = ctrl.$$lastCommittedViewValue;\n    // Note: we use the $$rawModelValue as $modelValue might have been\n    // set to undefined during a view -> model update that found validation\n    // errors. We can't parse the view here, since that could change\n    // the model although neither viewValue nor the model on the scope changed\n    var modelValue = ctrl.$$rawModelValue;\n\n    var prevValid = ctrl.$valid;\n    var prevModelValue = ctrl.$modelValue;\n\n    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n\n    ctrl.$$runValidators(modelValue, viewValue, function(allValid) {\n      // If there was no change in validity, don't update the model\n      // This prevents changing an invalid modelValue to undefined\n      if (!allowInvalid && prevValid !== allValid) {\n        // Note: Don't check ctrl.$valid here, as we could have\n        // external validators (e.g. calculated on the server),\n        // that just call $setValidity and need the model value\n        // to calculate their validity.\n        ctrl.$modelValue = allValid ? modelValue : undefined;\n\n        if (ctrl.$modelValue !== prevModelValue) {\n          ctrl.$$writeModelToScope();\n        }\n      }\n    });\n\n  };\n\n  this.$$runValidators = function(modelValue, viewValue, doneCallback) {\n    currentValidationRunId++;\n    var localValidationRunId = currentValidationRunId;\n\n    // check parser error\n    if (!processParseErrors()) {\n      validationDone(false);\n      return;\n    }\n    if (!processSyncValidators()) {\n      validationDone(false);\n      return;\n    }\n    processAsyncValidators();\n\n    function processParseErrors() {\n      var errorKey = ctrl.$$parserName || 'parse';\n      if (isUndefined(parserValid)) {\n        setValidity(errorKey, null);\n      } else {\n        if (!parserValid) {\n          forEach(ctrl.$validators, function(v, name) {\n            setValidity(name, null);\n          });\n          forEach(ctrl.$asyncValidators, function(v, name) {\n            setValidity(name, null);\n          });\n        }\n        // Set the parse error last, to prevent unsetting it, should a $validators key == parserName\n        setValidity(errorKey, parserValid);\n        return parserValid;\n      }\n      return true;\n    }\n\n    function processSyncValidators() {\n      var syncValidatorsValid = true;\n      forEach(ctrl.$validators, function(validator, name) {\n        var result = validator(modelValue, viewValue);\n        syncValidatorsValid = syncValidatorsValid && result;\n        setValidity(name, result);\n      });\n      if (!syncValidatorsValid) {\n        forEach(ctrl.$asyncValidators, function(v, name) {\n          setValidity(name, null);\n        });\n        return false;\n      }\n      return true;\n    }\n\n    function processAsyncValidators() {\n      var validatorPromises = [];\n      var allValid = true;\n      forEach(ctrl.$asyncValidators, function(validator, name) {\n        var promise = validator(modelValue, viewValue);\n        if (!isPromiseLike(promise)) {\n          throw ngModelMinErr('nopromise',\n            \"Expected asynchronous validator to return a promise but got '{0}' instead.\", promise);\n        }\n        setValidity(name, undefined);\n        validatorPromises.push(promise.then(function() {\n          setValidity(name, true);\n        }, function() {\n          allValid = false;\n          setValidity(name, false);\n        }));\n      });\n      if (!validatorPromises.length) {\n        validationDone(true);\n      } else {\n        $q.all(validatorPromises).then(function() {\n          validationDone(allValid);\n        }, noop);\n      }\n    }\n\n    function setValidity(name, isValid) {\n      if (localValidationRunId === currentValidationRunId) {\n        ctrl.$setValidity(name, isValid);\n      }\n    }\n\n    function validationDone(allValid) {\n      if (localValidationRunId === currentValidationRunId) {\n\n        doneCallback(allValid);\n      }\n    }\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$commitViewValue\n   *\n   * @description\n   * Commit a pending update to the `$modelValue`.\n   *\n   * Updates may be pending by a debounced event or because the input is waiting for a some future\n   * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`\n   * usually handles calling this in response to input events.\n   */\n  this.$commitViewValue = function() {\n    var viewValue = ctrl.$viewValue;\n\n    $timeout.cancel(pendingDebounce);\n\n    // If the view value has not changed then we should just exit, except in the case where there is\n    // a native validator on the element. In this case the validation state may have changed even though\n    // the viewValue has stayed empty.\n    if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {\n      return;\n    }\n    ctrl.$$updateEmptyClasses(viewValue);\n    ctrl.$$lastCommittedViewValue = viewValue;\n\n    // change to dirty\n    if (ctrl.$pristine) {\n      this.$setDirty();\n    }\n    this.$$parseAndValidate();\n  };\n\n  this.$$parseAndValidate = function() {\n    var viewValue = ctrl.$$lastCommittedViewValue;\n    var modelValue = viewValue;\n    parserValid = isUndefined(modelValue) ? undefined : true;\n\n    if (parserValid) {\n      for (var i = 0; i < ctrl.$parsers.length; i++) {\n        modelValue = ctrl.$parsers[i](modelValue);\n        if (isUndefined(modelValue)) {\n          parserValid = false;\n          break;\n        }\n      }\n    }\n    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {\n      // ctrl.$modelValue has not been touched yet...\n      ctrl.$modelValue = ngModelGet($scope);\n    }\n    var prevModelValue = ctrl.$modelValue;\n    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;\n    ctrl.$$rawModelValue = modelValue;\n\n    if (allowInvalid) {\n      ctrl.$modelValue = modelValue;\n      writeToModelIfNeeded();\n    }\n\n    // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.\n    // This can happen if e.g. $setViewValue is called from inside a parser\n    ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {\n      if (!allowInvalid) {\n        // Note: Don't check ctrl.$valid here, as we could have\n        // external validators (e.g. calculated on the server),\n        // that just call $setValidity and need the model value\n        // to calculate their validity.\n        ctrl.$modelValue = allValid ? modelValue : undefined;\n        writeToModelIfNeeded();\n      }\n    });\n\n    function writeToModelIfNeeded() {\n      if (ctrl.$modelValue !== prevModelValue) {\n        ctrl.$$writeModelToScope();\n      }\n    }\n  };\n\n  this.$$writeModelToScope = function() {\n    ngModelSet($scope, ctrl.$modelValue);\n    forEach(ctrl.$viewChangeListeners, function(listener) {\n      try {\n        listener();\n      } catch (e) {\n        $exceptionHandler(e);\n      }\n    });\n  };\n\n  /**\n   * @ngdoc method\n   * @name ngModel.NgModelController#$setViewValue\n   *\n   * @description\n   * Update the view value.\n   *\n   * This method should be called when a control wants to change the view value; typically,\n   * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}\n   * directive calls it when the value of the input changes and {@link ng.directive:select select}\n   * calls it when an option is selected.\n   *\n   * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`\n   * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged\n   * value sent directly for processing, finally to be applied to `$modelValue` and then the\n   * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,\n   * in the `$viewChangeListeners` list, are called.\n   *\n   * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`\n   * and the `default` trigger is not listed, all those actions will remain pending until one of the\n   * `updateOn` events is triggered on the DOM element.\n   * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}\n   * directive is used with a custom debounce for this particular event.\n   * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`\n   * is specified, once the timer runs out.\n   *\n   * When used with standard inputs, the view value will always be a string (which is in some cases\n   * parsed into another type, such as a `Date` object for `input[date]`.)\n   * However, custom controls might also pass objects to this method. In this case, we should make\n   * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not\n   * perform a deep watch of objects, it only looks for a change of identity. If you only change\n   * the property of the object then ngModel will not realize that the object has changed and\n   * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should\n   * not change properties of the copy once it has been passed to `$setViewValue`.\n   * Otherwise you may cause the model value on the scope to change incorrectly.\n   *\n   * <div class=\"alert alert-info\">\n   * In any case, the value passed to the method should always reflect the current value\n   * of the control. For example, if you are calling `$setViewValue` for an input element,\n   * you should pass the input DOM value. Otherwise, the control and the scope model become\n   * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change\n   * the control's DOM value in any way. If we want to change the control's DOM value\n   * programmatically, we should update the `ngModel` scope expression. Its new value will be\n   * picked up by the model controller, which will run it through the `$formatters`, `$render` it\n   * to update the DOM, and finally call `$validate` on it.\n   * </div>\n   *\n   * @param {*} value value from the view.\n   * @param {string} trigger Event that triggered the update.\n   */\n  this.$setViewValue = function(value, trigger) {\n    ctrl.$viewValue = value;\n    if (!ctrl.$options || ctrl.$options.updateOnDefault) {\n      ctrl.$$debounceViewValueCommit(trigger);\n    }\n  };\n\n  this.$$debounceViewValueCommit = function(trigger) {\n    var debounceDelay = 0,\n        options = ctrl.$options,\n        debounce;\n\n    if (options && isDefined(options.debounce)) {\n      debounce = options.debounce;\n      if (isNumber(debounce)) {\n        debounceDelay = debounce;\n      } else if (isNumber(debounce[trigger])) {\n        debounceDelay = debounce[trigger];\n      } else if (isNumber(debounce['default'])) {\n        debounceDelay = debounce['default'];\n      }\n    }\n\n    $timeout.cancel(pendingDebounce);\n    if (debounceDelay) {\n      pendingDebounce = $timeout(function() {\n        ctrl.$commitViewValue();\n      }, debounceDelay);\n    } else if ($rootScope.$$phase) {\n      ctrl.$commitViewValue();\n    } else {\n      $scope.$apply(function() {\n        ctrl.$commitViewValue();\n      });\n    }\n  };\n\n  // model -> value\n  // Note: we cannot use a normal scope.$watch as we want to detect the following:\n  // 1. scope value is 'a'\n  // 2. user enters 'b'\n  // 3. ng-change kicks in and reverts scope value to 'a'\n  //    -> scope value did not change since the last digest as\n  //       ng-change executes in apply phase\n  // 4. view should be changed back to 'a'\n  $scope.$watch(function ngModelWatch() {\n    var modelValue = ngModelGet($scope);\n\n    // if scope model value and ngModel value are out of sync\n    // TODO(perf): why not move this to the action fn?\n    if (modelValue !== ctrl.$modelValue &&\n       // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator\n       (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)\n    ) {\n      ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;\n      parserValid = undefined;\n\n      var formatters = ctrl.$formatters,\n          idx = formatters.length;\n\n      var viewValue = modelValue;\n      while (idx--) {\n        viewValue = formatters[idx](viewValue);\n      }\n      if (ctrl.$viewValue !== viewValue) {\n        ctrl.$$updateEmptyClasses(viewValue);\n        ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;\n        ctrl.$render();\n\n        ctrl.$$runValidators(modelValue, viewValue, noop);\n      }\n    }\n\n    return modelValue;\n  });\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngModel\n *\n * @element input\n * @priority 1\n *\n * @description\n * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a\n * property on the scope using {@link ngModel.NgModelController NgModelController},\n * which is created and exposed by this directive.\n *\n * `ngModel` is responsible for:\n *\n * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`\n *   require.\n * - Providing validation behavior (i.e. required, number, email, url).\n * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).\n * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,\n *   `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.\n * - Registering the control with its parent {@link ng.directive:form form}.\n *\n * Note: `ngModel` will try to bind to the property given by evaluating the expression on the\n * current scope. If the property doesn't already exist on this scope, it will be created\n * implicitly and added to the scope.\n *\n * For best practices on using `ngModel`, see:\n *\n *  - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)\n *\n * For basic examples, how to use `ngModel`, see:\n *\n *  - {@link ng.directive:input input}\n *    - {@link input[text] text}\n *    - {@link input[checkbox] checkbox}\n *    - {@link input[radio] radio}\n *    - {@link input[number] number}\n *    - {@link input[email] email}\n *    - {@link input[url] url}\n *    - {@link input[date] date}\n *    - {@link input[datetime-local] datetime-local}\n *    - {@link input[time] time}\n *    - {@link input[month] month}\n *    - {@link input[week] week}\n *  - {@link ng.directive:select select}\n *  - {@link ng.directive:textarea textarea}\n *\n * # Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the\n * object or collection change, `ngModel` will not be notified and so the input will not be  re-rendered.\n *\n * The model must be assigned an entirely new object or collection before a re-rendering will occur.\n *\n * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression\n * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or\n * if the select is given the `multiple` attribute.\n *\n * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the\n * first level of the object (or only changing the properties of an item in the collection if it's an array) will still\n * not trigger a re-rendering of the model.\n *\n * # CSS classes\n * The following CSS classes are added and removed on the associated input/select/textarea element\n * depending on the validity of the model.\n *\n *  - `ng-valid`: the model is valid\n *  - `ng-invalid`: the model is invalid\n *  - `ng-valid-[key]`: for each valid key added by `$setValidity`\n *  - `ng-invalid-[key]`: for each invalid key added by `$setValidity`\n *  - `ng-pristine`: the control hasn't been interacted with yet\n *  - `ng-dirty`: the control has been interacted with\n *  - `ng-touched`: the control has been blurred\n *  - `ng-untouched`: the control hasn't been blurred\n *  - `ng-pending`: any `$asyncValidators` are unfulfilled\n *  - `ng-empty`: the view does not contain a value or the value is deemed \"empty\", as defined\n *     by the {@link ngModel.NgModelController#$isEmpty} method\n *  - `ng-not-empty`: the view contains a non-empty value\n *\n * Keep in mind that ngAnimate can detect each of these classes when added and removed.\n *\n * ## Animation Hooks\n *\n * Animations within models are triggered when any of the associated CSS classes are added and removed\n * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,\n * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.\n * The animations that are triggered within ngModel are similar to how they work in ngClass and\n * animations can be hooked into using CSS transitions, keyframes as well as JS animations.\n *\n * The following example shows a simple way to utilize CSS transitions to style an input element\n * that has been rendered as invalid after it has been validated:\n *\n * <pre>\n * //be sure to include ngAnimate as a module to hook into more\n * //advanced animations\n * .my-input {\n *   transition:0.5s linear all;\n *   background: white;\n * }\n * .my-input.ng-invalid {\n *   background: red;\n *   color:white;\n * }\n * </pre>\n *\n * @example\n * <example deps=\"angular-animate.js\" animations=\"true\" fixBase=\"true\" module=\"inputExample\">\n     <file name=\"index.html\">\n       <script>\n        angular.module('inputExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.val = '1';\n          }]);\n       </script>\n       <style>\n         .my-input {\n           transition:all linear 0.5s;\n           background: transparent;\n         }\n         .my-input.ng-invalid {\n           color:white;\n           background: red;\n         }\n       </style>\n       <p id=\"inputDescription\">\n        Update input to see transitions when valid/invalid.\n        Integer is a valid value.\n       </p>\n       <form name=\"testForm\" ng-controller=\"ExampleController\">\n         <input ng-model=\"val\" ng-pattern=\"/^\\d+$/\" name=\"anim\" class=\"my-input\"\n                aria-describedby=\"inputDescription\" />\n       </form>\n     </file>\n * </example>\n *\n * ## Binding to a getter/setter\n *\n * Sometimes it's helpful to bind `ngModel` to a getter/setter function.  A getter/setter is a\n * function that returns a representation of the model when called with zero arguments, and sets\n * the internal state of a model when called with an argument. It's sometimes useful to use this\n * for models that have an internal representation that's different from what the model exposes\n * to the view.\n *\n * <div class=\"alert alert-success\">\n * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more\n * frequently than other parts of your code.\n * </div>\n *\n * You use this behavior by adding `ng-model-options=\"{ getterSetter: true }\"` to an element that\n * has `ng-model` attached to it. You can also add `ng-model-options=\"{ getterSetter: true }\"` to\n * a `<form>`, which will enable this behavior for all `<input>`s within it. See\n * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.\n *\n * The following example shows how to use `ngModel` with a getter/setter:\n *\n * @example\n * <example name=\"ngModel-getter-setter\" module=\"getterSetterExample\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n         <form name=\"userForm\">\n           <label>Name:\n             <input type=\"text\" name=\"userName\"\n                    ng-model=\"user.name\"\n                    ng-model-options=\"{ getterSetter: true }\" />\n           </label>\n         </form>\n         <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n       </div>\n     </file>\n     <file name=\"app.js\">\n       angular.module('getterSetterExample', [])\n         .controller('ExampleController', ['$scope', function($scope) {\n           var _name = 'Brian';\n           $scope.user = {\n             name: function(newName) {\n              // Note that newName can be undefined for two reasons:\n              // 1. Because it is called as a getter and thus called with no arguments\n              // 2. Because the property should actually be set to undefined. This happens e.g. if the\n              //    input is invalid\n              return arguments.length ? (_name = newName) : _name;\n             }\n           };\n         }]);\n     </file>\n * </example>\n */\nvar ngModelDirective = ['$rootScope', function($rootScope) {\n  return {\n    restrict: 'A',\n    require: ['ngModel', '^?form', '^?ngModelOptions'],\n    controller: NgModelController,\n    // Prelink needs to run before any input directive\n    // so that we can set the NgModelOptions in NgModelController\n    // before anyone else uses it.\n    priority: 1,\n    compile: function ngModelCompile(element) {\n      // Setup initial state of the control\n      element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);\n\n      return {\n        pre: function ngModelPreLink(scope, element, attr, ctrls) {\n          var modelCtrl = ctrls[0],\n              formCtrl = ctrls[1] || modelCtrl.$$parentForm;\n\n          modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);\n\n          // notify others, especially parent forms\n          formCtrl.$addControl(modelCtrl);\n\n          attr.$observe('name', function(newValue) {\n            if (modelCtrl.$name !== newValue) {\n              modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);\n            }\n          });\n\n          scope.$on('$destroy', function() {\n            modelCtrl.$$parentForm.$removeControl(modelCtrl);\n          });\n        },\n        post: function ngModelPostLink(scope, element, attr, ctrls) {\n          var modelCtrl = ctrls[0];\n          if (modelCtrl.$options && modelCtrl.$options.updateOn) {\n            element.on(modelCtrl.$options.updateOn, function(ev) {\n              modelCtrl.$$debounceViewValueCommit(ev && ev.type);\n            });\n          }\n\n          element.on('blur', function() {\n            if (modelCtrl.$touched) return;\n\n            if ($rootScope.$$phase) {\n              scope.$evalAsync(modelCtrl.$setTouched);\n            } else {\n              scope.$apply(modelCtrl.$setTouched);\n            }\n          });\n        }\n      };\n    }\n  };\n}];\n\nvar DEFAULT_REGEXP = /(\\s+|^)default(\\s+|$)/;\n\n/**\n * @ngdoc directive\n * @name ngModelOptions\n *\n * @description\n * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of\n * events that will trigger a model update and/or a debouncing delay so that the actual update only\n * takes place when a timer expires; this timer will be reset after another change takes place.\n *\n * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might\n * be different from the value in the actual model. This means that if you update the model you\n * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in\n * order to make sure it is synchronized with the model and that any debounced action is canceled.\n *\n * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}\n * method is by making sure the input is placed inside a form that has a `name` attribute. This is\n * important because `form` controllers are published to the related scope under the name in their\n * `name` attribute.\n *\n * Any pending changes will take place immediately when an enclosing form is submitted via the\n * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`\n * to have access to the updated model.\n *\n * `ngModelOptions` has an effect on the element it's declared on and its descendants.\n *\n * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:\n *   - `updateOn`: string specifying which event should the input be bound to. You can set several\n *     events using an space delimited list. There is a special event called `default` that\n *     matches the default events belonging of the control.\n *   - `debounce`: integer value which contains the debounce model update value in milliseconds. A\n *     value of 0 triggers an immediate update. If an object is supplied instead, you can specify a\n *     custom value for each event. For example:\n *     `ng-model-options=\"{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }\"`\n *   - `allowInvalid`: boolean value which indicates that the model can be set with values that did\n *     not validate correctly instead of the default behavior of setting the model to undefined.\n *   - `getterSetter`: boolean value which determines whether or not to treat functions bound to\n       `ngModel` as getters/setters.\n *   - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for\n *     `<input type=\"date\">`, `<input type=\"time\">`, ... . It understands UTC/GMT and the\n *     continental US time zone abbreviations, but for general use, use a time zone offset, for\n *     example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)\n *     If not specified, the timezone of the browser will be used.\n *\n * @example\n\n  The following example shows how to override immediate updates. Changes on the inputs within the\n  form will update the model only when the control loses focus (blur event). If `escape` key is\n  pressed while the input field is focused, the value is reset to the value in the current model.\n\n  <example name=\"ngModelOptions-directive-blur\" module=\"optionsExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ updateOn: 'blur' }\"\n                   ng-keyup=\"cancel($event)\" />\n          </label><br />\n          <label>Other data:\n            <input type=\"text\" ng-model=\"user.data\" />\n          </label><br />\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n        <pre>user.data = <span ng-bind=\"user.data\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('optionsExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.user = { name: 'John', data: '' };\n\n          $scope.cancel = function(e) {\n            if (e.keyCode == 27) {\n              $scope.userForm.userName.$rollbackViewValue();\n            }\n          };\n        }]);\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var model = element(by.binding('user.name'));\n      var input = element(by.model('user.name'));\n      var other = element(by.model('user.data'));\n\n      it('should allow custom events', function() {\n        input.sendKeys(' Doe');\n        input.click();\n        expect(model.getText()).toEqual('John');\n        other.click();\n        expect(model.getText()).toEqual('John Doe');\n      });\n\n      it('should $rollbackViewValue when model changes', function() {\n        input.sendKeys(' Doe');\n        expect(input.getAttribute('value')).toEqual('John Doe');\n        input.sendKeys(protractor.Key.ESCAPE);\n        expect(input.getAttribute('value')).toEqual('John');\n        other.click();\n        expect(model.getText()).toEqual('John');\n      });\n    </file>\n  </example>\n\n  This one shows how to debounce model changes. Model will be updated only 1 sec after last change.\n  If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.\n\n  <example name=\"ngModelOptions-directive-debounce\" module=\"optionsExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ debounce: 1000 }\" />\n          </label>\n          <button ng-click=\"userForm.userName.$rollbackViewValue(); user.name=''\">Clear</button>\n          <br />\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('optionsExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.user = { name: 'Igor' };\n        }]);\n    </file>\n  </example>\n\n  This one shows how to bind to getter/setters:\n\n  <example name=\"ngModelOptions-directive-getter-setter\" module=\"getterSetterExample\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <form name=\"userForm\">\n          <label>Name:\n            <input type=\"text\" name=\"userName\"\n                   ng-model=\"user.name\"\n                   ng-model-options=\"{ getterSetter: true }\" />\n          </label>\n        </form>\n        <pre>user.name = <span ng-bind=\"user.name()\"></span></pre>\n      </div>\n    </file>\n    <file name=\"app.js\">\n      angular.module('getterSetterExample', [])\n        .controller('ExampleController', ['$scope', function($scope) {\n          var _name = 'Brian';\n          $scope.user = {\n            name: function(newName) {\n              // Note that newName can be undefined for two reasons:\n              // 1. Because it is called as a getter and thus called with no arguments\n              // 2. Because the property should actually be set to undefined. This happens e.g. if the\n              //    input is invalid\n              return arguments.length ? (_name = newName) : _name;\n            }\n          };\n        }]);\n    </file>\n  </example>\n */\nvar ngModelOptionsDirective = function() {\n  return {\n    restrict: 'A',\n    controller: ['$scope', '$attrs', function($scope, $attrs) {\n      var that = this;\n      this.$options = copy($scope.$eval($attrs.ngModelOptions));\n      // Allow adding/overriding bound events\n      if (isDefined(this.$options.updateOn)) {\n        this.$options.updateOnDefault = false;\n        // extract \"default\" pseudo-event from list of events that can trigger a model update\n        this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {\n          that.$options.updateOnDefault = true;\n          return ' ';\n        }));\n      } else {\n        this.$options.updateOnDefault = true;\n      }\n    }]\n  };\n};\n\n\n\n// helper methods\nfunction addSetValidityMethod(context) {\n  var ctrl = context.ctrl,\n      $element = context.$element,\n      classCache = {},\n      set = context.set,\n      unset = context.unset,\n      $animate = context.$animate;\n\n  classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));\n\n  ctrl.$setValidity = setValidity;\n\n  function setValidity(validationErrorKey, state, controller) {\n    if (isUndefined(state)) {\n      createAndSet('$pending', validationErrorKey, controller);\n    } else {\n      unsetAndCleanup('$pending', validationErrorKey, controller);\n    }\n    if (!isBoolean(state)) {\n      unset(ctrl.$error, validationErrorKey, controller);\n      unset(ctrl.$$success, validationErrorKey, controller);\n    } else {\n      if (state) {\n        unset(ctrl.$error, validationErrorKey, controller);\n        set(ctrl.$$success, validationErrorKey, controller);\n      } else {\n        set(ctrl.$error, validationErrorKey, controller);\n        unset(ctrl.$$success, validationErrorKey, controller);\n      }\n    }\n    if (ctrl.$pending) {\n      cachedToggleClass(PENDING_CLASS, true);\n      ctrl.$valid = ctrl.$invalid = undefined;\n      toggleValidationCss('', null);\n    } else {\n      cachedToggleClass(PENDING_CLASS, false);\n      ctrl.$valid = isObjectEmpty(ctrl.$error);\n      ctrl.$invalid = !ctrl.$valid;\n      toggleValidationCss('', ctrl.$valid);\n    }\n\n    // re-read the state as the set/unset methods could have\n    // combined state in ctrl.$error[validationError] (used for forms),\n    // where setting/unsetting only increments/decrements the value,\n    // and does not replace it.\n    var combinedState;\n    if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {\n      combinedState = undefined;\n    } else if (ctrl.$error[validationErrorKey]) {\n      combinedState = false;\n    } else if (ctrl.$$success[validationErrorKey]) {\n      combinedState = true;\n    } else {\n      combinedState = null;\n    }\n\n    toggleValidationCss(validationErrorKey, combinedState);\n    ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);\n  }\n\n  function createAndSet(name, value, controller) {\n    if (!ctrl[name]) {\n      ctrl[name] = {};\n    }\n    set(ctrl[name], value, controller);\n  }\n\n  function unsetAndCleanup(name, value, controller) {\n    if (ctrl[name]) {\n      unset(ctrl[name], value, controller);\n    }\n    if (isObjectEmpty(ctrl[name])) {\n      ctrl[name] = undefined;\n    }\n  }\n\n  function cachedToggleClass(className, switchValue) {\n    if (switchValue && !classCache[className]) {\n      $animate.addClass($element, className);\n      classCache[className] = true;\n    } else if (!switchValue && classCache[className]) {\n      $animate.removeClass($element, className);\n      classCache[className] = false;\n    }\n  }\n\n  function toggleValidationCss(validationErrorKey, isValid) {\n    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';\n\n    cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);\n    cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);\n  }\n}\n\nfunction isObjectEmpty(obj) {\n  if (obj) {\n    for (var prop in obj) {\n      if (obj.hasOwnProperty(prop)) {\n        return false;\n      }\n    }\n  }\n  return true;\n}\n\n/**\n * @ngdoc directive\n * @name ngNonBindable\n * @restrict AC\n * @priority 1000\n *\n * @description\n * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current\n * DOM element. This is useful if the element contains what appears to be Angular directives and\n * bindings but which should be ignored by Angular. This could be the case if you have a site that\n * displays snippets of code, for instance.\n *\n * @element ANY\n *\n * @example\n * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,\n * but the one wrapped in `ngNonBindable` is left alone.\n *\n * @example\n    <example>\n      <file name=\"index.html\">\n        <div>Normal: {{1 + 2}}</div>\n        <div ng-non-bindable>Ignored: {{1 + 2}}</div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n       it('should check ng-non-bindable', function() {\n         expect(element(by.binding('1 + 2')).getText()).toContain('3');\n         expect(element.all(by.css('div')).last().getText()).toMatch(/1 \\+ 2/);\n       });\n      </file>\n    </example>\n */\nvar ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });\n\n/* global jqLiteRemove */\n\nvar ngOptionsMinErr = minErr('ngOptions');\n\n/**\n * @ngdoc directive\n * @name ngOptions\n * @restrict A\n *\n * @description\n *\n * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`\n * elements for the `<select>` element using the array or object obtained by evaluating the\n * `ngOptions` comprehension expression.\n *\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a\n * similar result. However, `ngOptions` provides some benefits such as reducing memory and\n * increasing speed by not creating a new scope for each repeated instance, as well as providing\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound\n *  to a non-string value. This is because an option element can only be bound to string values at\n * present.\n *\n * When an item in the `<select>` menu is selected, the array element or object property\n * represented by the selected option will be bound to the model identified by the `ngModel`\n * directive.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * ## Complex Models (objects or collections)\n *\n * By default, `ngModel` watches the model by reference, not value. This is important to know when\n * binding the select to a model that is an object or a collection.\n *\n * One issue occurs if you want to preselect an option. For example, if you set\n * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,\n * because the objects are not identical. So by default, you should always reference the item in your collection\n * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.\n *\n * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity\n * of the item not by reference, but by the result of the `track by` expression. For example, if your\n * collection items have an id property, you would `track by item.id`.\n *\n * A different issue with objects or collections is that ngModel won't detect if an object property or\n * a collection item changes. For that reason, `ngOptions` additionally watches the model using\n * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.\n * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection\n * has not changed identity, but only a property on the object or an item in the collection changes.\n *\n * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection\n * if the model is an array). This means that changing a property deeper than the first level inside the\n * object/collection will not trigger a re-rendering.\n *\n * ## `select` **`as`**\n *\n * Using `select` **`as`** will bind the result of the `select` expression to the model, but\n * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)\n * or property name (for object data sources) of the value within the collection. If a **`track by`** expression\n * is used, the result of that expression will be set as the value of the `option` and `select` elements.\n *\n *\n * ### `select` **`as`** and **`track by`**\n *\n * <div class=\"alert alert-warning\">\n * Be careful when using `select` **`as`** and **`track by`** in the same expression.\n * </div>\n *\n * Given this array of items on the $scope:\n *\n * ```js\n * $scope.items = [{\n *   id: 1,\n *   label: 'aLabel',\n *   subItem: { name: 'aSubItem' }\n * }, {\n *   id: 2,\n *   label: 'bLabel',\n *   subItem: { name: 'bSubItem' }\n * }];\n * ```\n *\n * This will work:\n *\n * ```html\n * <select ng-options=\"item as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0];\n * ```\n *\n * but this will not work:\n *\n * ```html\n * <select ng-options=\"item.subItem as item.label for item in items track by item.id\" ng-model=\"selected\"></select>\n * ```\n * ```js\n * $scope.selected = $scope.items[0].subItem;\n * ```\n *\n * In both examples, the **`track by`** expression is applied successfully to each `item` in the\n * `items` array. Because the selected option has been set programmatically in the controller, the\n * **`track by`** expression is also applied to the `ngModel` value. In the first example, the\n * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with\n * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**\n * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value\n * is not matched against any `<option>` and the `<select>` appears as having no selected value.\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} required The control is considered valid only if value is entered.\n * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to\n *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of\n *    `required` when you want to data-bind to the `required` attribute.\n * @param {comprehension_expression=} ngOptions in one of the following forms:\n *\n *   * for array data sources:\n *     * `label` **`for`** `value` **`in`** `array`\n *     * `select` **`as`** `label` **`for`** `value` **`in`** `array`\n *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array`\n *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`\n *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`\n *     * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`\n *        (for including a filter with `track by`)\n *   * for object data sources:\n *     * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`\n *     * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`group by`** `group`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *     * `select` **`as`** `label` **`disable when`** `disable`\n *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`\n *\n * Where:\n *\n *   * `array` / `object`: an expression which evaluates to an array / object to iterate over.\n *   * `value`: local variable which will refer to each item in the `array` or each property value\n *      of `object` during iteration.\n *   * `key`: local variable which will refer to a property name in `object` during iteration.\n *   * `label`: The result of this expression will be the label for `<option>` element. The\n *     `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).\n *   * `select`: The result of this expression will be bound to the model of the parent `<select>`\n *      element. If not specified, `select` expression will default to `value`.\n *   * `group`: The result of this expression will be used to group options using the `<optgroup>`\n *      DOM element.\n *   * `disable`: The result of this expression will be used to disable the rendered `<option>`\n *      element. Return `true` to disable.\n *   * `trackexpr`: Used when working with an array of objects. The result of this expression will be\n *      used to identify the objects in the array. The `trackexpr` will most likely refer to the\n *     `value` variable (e.g. `value.propertyName`). With this the selection is preserved\n *      even when the options are recreated (e.g. reloaded from the server).\n *\n * @example\n    <example module=\"selectExample\">\n      <file name=\"index.html\">\n        <script>\n        angular.module('selectExample', [])\n          .controller('ExampleController', ['$scope', function($scope) {\n            $scope.colors = [\n              {name:'black', shade:'dark'},\n              {name:'white', shade:'light', notAnOption: true},\n              {name:'red', shade:'dark'},\n              {name:'blue', shade:'dark', notAnOption: true},\n              {name:'yellow', shade:'light', notAnOption: false}\n            ];\n            $scope.myColor = $scope.colors[2]; // red\n          }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          <ul>\n            <li ng-repeat=\"color in colors\">\n              <label>Name: <input ng-model=\"color.name\"></label>\n              <label><input type=\"checkbox\" ng-model=\"color.notAnOption\"> Disabled?</label>\n              <button ng-click=\"colors.splice($index, 1)\" aria-label=\"Remove\">X</button>\n            </li>\n            <li>\n              <button ng-click=\"colors.push({})\">add</button>\n            </li>\n          </ul>\n          <hr/>\n          <label>Color (null not allowed):\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\"></select>\n          </label><br/>\n          <label>Color (null allowed):\n          <span  class=\"nullable\">\n            <select ng-model=\"myColor\" ng-options=\"color.name for color in colors\">\n              <option value=\"\">-- choose color --</option>\n            </select>\n          </span></label><br/>\n\n          <label>Color grouped by shade:\n            <select ng-model=\"myColor\" ng-options=\"color.name group by color.shade for color in colors\">\n            </select>\n          </label><br/>\n\n          <label>Color grouped by shade, with some disabled:\n            <select ng-model=\"myColor\"\n                  ng-options=\"color.name group by color.shade disable when color.notAnOption for color in colors\">\n            </select>\n          </label><br/>\n\n\n\n          Select <button ng-click=\"myColor = { name:'not in list', shade: 'other' }\">bogus</button>.\n          <br/>\n          <hr/>\n          Currently selected: {{ {selected_color:myColor} }}\n          <div style=\"border:solid 1px black; height:20px\"\n               ng-style=\"{'background-color':myColor.name}\">\n          </div>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n         it('should check ng-options', function() {\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');\n           element.all(by.model('myColor')).first().click();\n           element.all(by.css('select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');\n           element(by.css('.nullable select[ng-model=\"myColor\"]')).click();\n           element.all(by.css('.nullable select[ng-model=\"myColor\"] option')).first().click();\n           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');\n         });\n      </file>\n    </example>\n */\n\n// jshint maxlen: false\n//                     //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999\nvar NG_OPTIONS_REGEXP = /^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+group\\s+by\\s+([\\s\\S]+?))?(?:\\s+disable\\s+when\\s+([\\s\\S]+?))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?$/;\n                        // 1: value expression (valueFn)\n                        // 2: label expression (displayFn)\n                        // 3: group by expression (groupByFn)\n                        // 4: disable when expression (disableWhenFn)\n                        // 5: array item variable name\n                        // 6: object item key variable name\n                        // 7: object item value variable name\n                        // 8: collection expression\n                        // 9: track by expression\n// jshint maxlen: 100\n\n\nvar ngOptionsDirective = ['$compile', '$parse', function($compile, $parse) {\n\n  function parseOptionsExpression(optionsExp, selectElement, scope) {\n\n    var match = optionsExp.match(NG_OPTIONS_REGEXP);\n    if (!(match)) {\n      throw ngOptionsMinErr('iexp',\n        \"Expected expression in form of \" +\n        \"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'\" +\n        \" but got '{0}'. Element: {1}\",\n        optionsExp, startingTag(selectElement));\n    }\n\n    // Extract the parts from the ngOptions expression\n\n    // The variable name for the value of the item in the collection\n    var valueName = match[5] || match[7];\n    // The variable name for the key of the item in the collection\n    var keyName = match[6];\n\n    // An expression that generates the viewValue for an option if there is a label expression\n    var selectAs = / as /.test(match[0]) && match[1];\n    // An expression that is used to track the id of each object in the options collection\n    var trackBy = match[9];\n    // An expression that generates the viewValue for an option if there is no label expression\n    var valueFn = $parse(match[2] ? match[1] : valueName);\n    var selectAsFn = selectAs && $parse(selectAs);\n    var viewValueFn = selectAsFn || valueFn;\n    var trackByFn = trackBy && $parse(trackBy);\n\n    // Get the value by which we are going to track the option\n    // if we have a trackFn then use that (passing scope and locals)\n    // otherwise just hash the given viewValue\n    var getTrackByValueFn = trackBy ?\n                              function(value, locals) { return trackByFn(scope, locals); } :\n                              function getHashOfValue(value) { return hashKey(value); };\n    var getTrackByValue = function(value, key) {\n      return getTrackByValueFn(value, getLocals(value, key));\n    };\n\n    var displayFn = $parse(match[2] || match[1]);\n    var groupByFn = $parse(match[3] || '');\n    var disableWhenFn = $parse(match[4] || '');\n    var valuesFn = $parse(match[8]);\n\n    var locals = {};\n    var getLocals = keyName ? function(value, key) {\n      locals[keyName] = key;\n      locals[valueName] = value;\n      return locals;\n    } : function(value) {\n      locals[valueName] = value;\n      return locals;\n    };\n\n\n    function Option(selectValue, viewValue, label, group, disabled) {\n      this.selectValue = selectValue;\n      this.viewValue = viewValue;\n      this.label = label;\n      this.group = group;\n      this.disabled = disabled;\n    }\n\n    function getOptionValuesKeys(optionValues) {\n      var optionValuesKeys;\n\n      if (!keyName && isArrayLike(optionValues)) {\n        optionValuesKeys = optionValues;\n      } else {\n        // if object, extract keys, in enumeration order, unsorted\n        optionValuesKeys = [];\n        for (var itemKey in optionValues) {\n          if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {\n            optionValuesKeys.push(itemKey);\n          }\n        }\n      }\n      return optionValuesKeys;\n    }\n\n    return {\n      trackBy: trackBy,\n      getTrackByValue: getTrackByValue,\n      getWatchables: $parse(valuesFn, function(optionValues) {\n        // Create a collection of things that we would like to watch (watchedArray)\n        // so that they can all be watched using a single $watchCollection\n        // that only runs the handler once if anything changes\n        var watchedArray = [];\n        optionValues = optionValues || [];\n\n        var optionValuesKeys = getOptionValuesKeys(optionValues);\n        var optionValuesLength = optionValuesKeys.length;\n        for (var index = 0; index < optionValuesLength; index++) {\n          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n          var value = optionValues[key];\n\n          var locals = getLocals(value, key);\n          var selectValue = getTrackByValueFn(value, locals);\n          watchedArray.push(selectValue);\n\n          // Only need to watch the displayFn if there is a specific label expression\n          if (match[2] || match[1]) {\n            var label = displayFn(scope, locals);\n            watchedArray.push(label);\n          }\n\n          // Only need to watch the disableWhenFn if there is a specific disable expression\n          if (match[4]) {\n            var disableWhen = disableWhenFn(scope, locals);\n            watchedArray.push(disableWhen);\n          }\n        }\n        return watchedArray;\n      }),\n\n      getOptions: function() {\n\n        var optionItems = [];\n        var selectValueMap = {};\n\n        // The option values were already computed in the `getWatchables` fn,\n        // which must have been called to trigger `getOptions`\n        var optionValues = valuesFn(scope) || [];\n        var optionValuesKeys = getOptionValuesKeys(optionValues);\n        var optionValuesLength = optionValuesKeys.length;\n\n        for (var index = 0; index < optionValuesLength; index++) {\n          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];\n          var value = optionValues[key];\n          var locals = getLocals(value, key);\n          var viewValue = viewValueFn(scope, locals);\n          var selectValue = getTrackByValueFn(viewValue, locals);\n          var label = displayFn(scope, locals);\n          var group = groupByFn(scope, locals);\n          var disabled = disableWhenFn(scope, locals);\n          var optionItem = new Option(selectValue, viewValue, label, group, disabled);\n\n          optionItems.push(optionItem);\n          selectValueMap[selectValue] = optionItem;\n        }\n\n        return {\n          items: optionItems,\n          selectValueMap: selectValueMap,\n          getOptionFromViewValue: function(value) {\n            return selectValueMap[getTrackByValue(value)];\n          },\n          getViewValueFromOption: function(option) {\n            // If the viewValue could be an object that may be mutated by the application,\n            // we need to make a copy and not return the reference to the value on the option.\n            return trackBy ? angular.copy(option.viewValue) : option.viewValue;\n          }\n        };\n      }\n    };\n  }\n\n\n  // we can't just jqLite('<option>') since jqLite is not smart enough\n  // to create it in <select> and IE barfs otherwise.\n  var optionTemplate = document.createElement('option'),\n      optGroupTemplate = document.createElement('optgroup');\n\n    function ngOptionsPostLink(scope, selectElement, attr, ctrls) {\n\n      var selectCtrl = ctrls[0];\n      var ngModelCtrl = ctrls[1];\n      var multiple = attr.multiple;\n\n      // The emptyOption allows the application developer to provide their own custom \"empty\"\n      // option when the viewValue does not match any of the option values.\n      var emptyOption;\n      for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {\n        if (children[i].value === '') {\n          emptyOption = children.eq(i);\n          break;\n        }\n      }\n\n      var providedEmptyOption = !!emptyOption;\n\n      var unknownOption = jqLite(optionTemplate.cloneNode(false));\n      unknownOption.val('?');\n\n      var options;\n      var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);\n\n\n      var renderEmptyOption = function() {\n        if (!providedEmptyOption) {\n          selectElement.prepend(emptyOption);\n        }\n        selectElement.val('');\n        emptyOption.prop('selected', true); // needed for IE\n        emptyOption.attr('selected', true);\n      };\n\n      var removeEmptyOption = function() {\n        if (!providedEmptyOption) {\n          emptyOption.remove();\n        }\n      };\n\n\n      var renderUnknownOption = function() {\n        selectElement.prepend(unknownOption);\n        selectElement.val('?');\n        unknownOption.prop('selected', true); // needed for IE\n        unknownOption.attr('selected', true);\n      };\n\n      var removeUnknownOption = function() {\n        unknownOption.remove();\n      };\n\n      // Update the controller methods for multiple selectable options\n      if (!multiple) {\n\n        selectCtrl.writeValue = function writeNgOptionsValue(value) {\n          var option = options.getOptionFromViewValue(value);\n\n          if (option && !option.disabled) {\n            // Don't update the option when it is already selected.\n            // For example, the browser will select the first option by default. In that case,\n            // most properties are set automatically - except the `selected` attribute, which we\n            // set always\n\n            if (selectElement[0].value !== option.selectValue) {\n              removeUnknownOption();\n              removeEmptyOption();\n\n              selectElement[0].value = option.selectValue;\n              option.element.selected = true;\n            }\n\n            option.element.setAttribute('selected', 'selected');\n          } else {\n            if (value === null || providedEmptyOption) {\n              removeUnknownOption();\n              renderEmptyOption();\n            } else {\n              removeEmptyOption();\n              renderUnknownOption();\n            }\n          }\n        };\n\n        selectCtrl.readValue = function readNgOptionsValue() {\n\n          var selectedOption = options.selectValueMap[selectElement.val()];\n\n          if (selectedOption && !selectedOption.disabled) {\n            removeEmptyOption();\n            removeUnknownOption();\n            return options.getViewValueFromOption(selectedOption);\n          }\n          return null;\n        };\n\n        // If we are using `track by` then we must watch the tracked value on the model\n        // since ngModel only watches for object identity change\n        if (ngOptions.trackBy) {\n          scope.$watch(\n            function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },\n            function() { ngModelCtrl.$render(); }\n          );\n        }\n\n      } else {\n\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n\n\n        selectCtrl.writeValue = function writeNgOptionsMultiple(value) {\n          options.items.forEach(function(option) {\n            option.element.selected = false;\n          });\n\n          if (value) {\n            value.forEach(function(item) {\n              var option = options.getOptionFromViewValue(item);\n              if (option && !option.disabled) option.element.selected = true;\n            });\n          }\n        };\n\n\n        selectCtrl.readValue = function readNgOptionsMultiple() {\n          var selectedValues = selectElement.val() || [],\n              selections = [];\n\n          forEach(selectedValues, function(value) {\n            var option = options.selectValueMap[value];\n            if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));\n          });\n\n          return selections;\n        };\n\n        // If we are using `track by` then we must watch these tracked values on the model\n        // since ngModel only watches for object identity change\n        if (ngOptions.trackBy) {\n\n          scope.$watchCollection(function() {\n            if (isArray(ngModelCtrl.$viewValue)) {\n              return ngModelCtrl.$viewValue.map(function(value) {\n                return ngOptions.getTrackByValue(value);\n              });\n            }\n          }, function() {\n            ngModelCtrl.$render();\n          });\n\n        }\n      }\n\n\n      if (providedEmptyOption) {\n\n        // we need to remove it before calling selectElement.empty() because otherwise IE will\n        // remove the label from the element. wtf?\n        emptyOption.remove();\n\n        // compile the element since there might be bindings in it\n        $compile(emptyOption)(scope);\n\n        // remove the class, which is added automatically because we recompile the element and it\n        // becomes the compilation root\n        emptyOption.removeClass('ng-scope');\n      } else {\n        emptyOption = jqLite(optionTemplate.cloneNode(false));\n      }\n\n      // We need to do this here to ensure that the options object is defined\n      // when we first hit it in writeNgOptionsValue\n      updateOptions();\n\n      // We will re-render the option elements if the option values or labels change\n      scope.$watchCollection(ngOptions.getWatchables, updateOptions);\n\n      // ------------------------------------------------------------------ //\n\n\n      function updateOptionElement(option, element) {\n        option.element = element;\n        element.disabled = option.disabled;\n        // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive\n        // selects in certain circumstances when multiple selects are next to each other and display\n        // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].\n        // See https://github.com/angular/angular.js/issues/11314 for more info.\n        // This is unfortunately untestable with unit / e2e tests\n        if (option.label !== element.label) {\n          element.label = option.label;\n          element.textContent = option.label;\n        }\n        if (option.value !== element.value) element.value = option.selectValue;\n      }\n\n      function addOrReuseElement(parent, current, type, templateElement) {\n        var element;\n        // Check whether we can reuse the next element\n        if (current && lowercase(current.nodeName) === type) {\n          // The next element is the right type so reuse it\n          element = current;\n        } else {\n          // The next element is not the right type so create a new one\n          element = templateElement.cloneNode(false);\n          if (!current) {\n            // There are no more elements so just append it to the select\n            parent.appendChild(element);\n          } else {\n            // The next element is not a group so insert the new one\n            parent.insertBefore(element, current);\n          }\n        }\n        return element;\n      }\n\n\n      function removeExcessElements(current) {\n        var next;\n        while (current) {\n          next = current.nextSibling;\n          jqLiteRemove(current);\n          current = next;\n        }\n      }\n\n\n      function skipEmptyAndUnknownOptions(current) {\n        var emptyOption_ = emptyOption && emptyOption[0];\n        var unknownOption_ = unknownOption && unknownOption[0];\n\n        // We cannot rely on the extracted empty option being the same as the compiled empty option,\n        // because the compiled empty option might have been replaced by a comment because\n        // it had an \"element\" transclusion directive on it (such as ngIf)\n        if (emptyOption_ || unknownOption_) {\n          while (current &&\n                (current === emptyOption_ ||\n                current === unknownOption_ ||\n                current.nodeType === NODE_TYPE_COMMENT ||\n                (nodeName_(current) === 'option' && current.value === ''))) {\n            current = current.nextSibling;\n          }\n        }\n        return current;\n      }\n\n\n      function updateOptions() {\n\n        var previousValue = options && selectCtrl.readValue();\n\n        options = ngOptions.getOptions();\n\n        var groupMap = {};\n        var currentElement = selectElement[0].firstChild;\n\n        // Ensure that the empty option is always there if it was explicitly provided\n        if (providedEmptyOption) {\n          selectElement.prepend(emptyOption);\n        }\n\n        currentElement = skipEmptyAndUnknownOptions(currentElement);\n\n        options.items.forEach(function updateOption(option) {\n          var group;\n          var groupElement;\n          var optionElement;\n\n          if (isDefined(option.group)) {\n\n            // This option is to live in a group\n            // See if we have already created this group\n            group = groupMap[option.group];\n\n            if (!group) {\n\n              // We have not already created this group\n              groupElement = addOrReuseElement(selectElement[0],\n                                               currentElement,\n                                               'optgroup',\n                                               optGroupTemplate);\n              // Move to the next element\n              currentElement = groupElement.nextSibling;\n\n              // Update the label on the group element\n              groupElement.label = option.group;\n\n              // Store it for use later\n              group = groupMap[option.group] = {\n                groupElement: groupElement,\n                currentOptionElement: groupElement.firstChild\n              };\n\n            }\n\n            // So now we have a group for this option we add the option to the group\n            optionElement = addOrReuseElement(group.groupElement,\n                                              group.currentOptionElement,\n                                              'option',\n                                              optionTemplate);\n            updateOptionElement(option, optionElement);\n            // Move to the next element\n            group.currentOptionElement = optionElement.nextSibling;\n\n          } else {\n\n            // This option is not in a group\n            optionElement = addOrReuseElement(selectElement[0],\n                                              currentElement,\n                                              'option',\n                                              optionTemplate);\n            updateOptionElement(option, optionElement);\n            // Move to the next element\n            currentElement = optionElement.nextSibling;\n          }\n        });\n\n\n        // Now remove all excess options and group\n        Object.keys(groupMap).forEach(function(key) {\n          removeExcessElements(groupMap[key].currentOptionElement);\n        });\n        removeExcessElements(currentElement);\n\n        ngModelCtrl.$render();\n\n        // Check to see if the value has changed due to the update to the options\n        if (!ngModelCtrl.$isEmpty(previousValue)) {\n          var nextValue = selectCtrl.readValue();\n          var isNotPrimitive = ngOptions.trackBy || multiple;\n          if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {\n            ngModelCtrl.$setViewValue(nextValue);\n            ngModelCtrl.$render();\n          }\n        }\n\n      }\n  }\n\n  return {\n    restrict: 'A',\n    terminal: true,\n    require: ['select', 'ngModel'],\n    link: {\n      pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {\n        // Deactivate the SelectController.register method to prevent\n        // option directives from accidentally registering themselves\n        // (and unwanted $destroy handlers etc.)\n        ctrls[0].registerOption = noop;\n      },\n      post: ngOptionsPostLink\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngPluralize\n * @restrict EA\n *\n * @description\n * `ngPluralize` is a directive that displays messages according to en-US localization rules.\n * These rules are bundled with angular.js, but can be overridden\n * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive\n * by specifying the mappings between\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * and the strings to be displayed.\n *\n * # Plural categories and explicit number rules\n * There are two\n * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)\n * in Angular's default en-US locale: \"one\" and \"other\".\n *\n * While a plural category may match many numbers (for example, in en-US locale, \"other\" can match\n * any number that is not 1), an explicit number rule can only match one number. For example, the\n * explicit number rule for \"3\" matches the number 3. There are examples of plural categories\n * and explicit number rules throughout the rest of this documentation.\n *\n * # Configuring ngPluralize\n * You configure ngPluralize by providing 2 attributes: `count` and `when`.\n * You can also provide an optional attribute, `offset`.\n *\n * The value of the `count` attribute can be either a string or an {@link guide/expression\n * Angular expression}; these are evaluated on the current scope for its bound value.\n *\n * The `when` attribute specifies the mappings between plural categories and the actual\n * string to be displayed. The value of the attribute should be a JSON object.\n *\n * The following example shows how to configure ngPluralize:\n *\n * ```html\n * <ng-pluralize count=\"personCount\"\n                 when=\"{'0': 'Nobody is viewing.',\n *                      'one': '1 person is viewing.',\n *                      'other': '{} people are viewing.'}\">\n * </ng-pluralize>\n *```\n *\n * In the example, `\"0: Nobody is viewing.\"` is an explicit number rule. If you did not\n * specify this rule, 0 would be matched to the \"other\" category and \"0 people are viewing\"\n * would be shown instead of \"Nobody is viewing\". You can specify an explicit number rule for\n * other numbers, for example 12, so that instead of showing \"12 people are viewing\", you can\n * show \"a dozen people are viewing\".\n *\n * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted\n * into pluralized strings. In the previous example, Angular will replace `{}` with\n * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder\n * for <span ng-non-bindable>{{numberExpression}}</span>.\n *\n * If no rule is defined for a category, then an empty string is displayed and a warning is generated.\n * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.\n *\n * # Configuring ngPluralize with offset\n * The `offset` attribute allows further customization of pluralized text, which can result in\n * a better user experience. For example, instead of the message \"4 people are viewing this document\",\n * you might display \"John, Kate and 2 others are viewing this document\".\n * The offset attribute allows you to offset a number by any desired value.\n * Let's take a look at an example:\n *\n * ```html\n * <ng-pluralize count=\"personCount\" offset=2\n *               when=\"{'0': 'Nobody is viewing.',\n *                      '1': '{{person1}} is viewing.',\n *                      '2': '{{person1}} and {{person2}} are viewing.',\n *                      'one': '{{person1}}, {{person2}} and one other person are viewing.',\n *                      'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n * </ng-pluralize>\n * ```\n *\n * Notice that we are still using two plural categories(one, other), but we added\n * three explicit number rules 0, 1 and 2.\n * When one person, perhaps John, views the document, \"John is viewing\" will be shown.\n * When three people view the document, no explicit number rule is found, so\n * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.\n * In this case, plural category 'one' is matched and \"John, Mary and one other person are viewing\"\n * is shown.\n *\n * Note that when you specify offsets, you must provide explicit number rules for\n * numbers from 0 up to and including the offset. If you use an offset of 3, for example,\n * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for\n * plural categories \"one\" and \"other\".\n *\n * @param {string|expression} count The variable to be bound to.\n * @param {string} when The mapping between plural category to its corresponding strings.\n * @param {number=} offset Offset to deduct from the total number.\n *\n * @example\n    <example module=\"pluralizeExample\">\n      <file name=\"index.html\">\n        <script>\n          angular.module('pluralizeExample', [])\n            .controller('ExampleController', ['$scope', function($scope) {\n              $scope.person1 = 'Igor';\n              $scope.person2 = 'Misko';\n              $scope.personCount = 1;\n            }]);\n        </script>\n        <div ng-controller=\"ExampleController\">\n          <label>Person 1:<input type=\"text\" ng-model=\"person1\" value=\"Igor\" /></label><br/>\n          <label>Person 2:<input type=\"text\" ng-model=\"person2\" value=\"Misko\" /></label><br/>\n          <label>Number of People:<input type=\"text\" ng-model=\"personCount\" value=\"1\" /></label><br/>\n\n          <!--- Example with simple pluralization rules for en locale --->\n          Without Offset:\n          <ng-pluralize count=\"personCount\"\n                        when=\"{'0': 'Nobody is viewing.',\n                               'one': '1 person is viewing.',\n                               'other': '{} people are viewing.'}\">\n          </ng-pluralize><br>\n\n          <!--- Example with offset --->\n          With Offset(2):\n          <ng-pluralize count=\"personCount\" offset=2\n                        when=\"{'0': 'Nobody is viewing.',\n                               '1': '{{person1}} is viewing.',\n                               '2': '{{person1}} and {{person2}} are viewing.',\n                               'one': '{{person1}}, {{person2}} and one other person are viewing.',\n                               'other': '{{person1}}, {{person2}} and {} other people are viewing.'}\">\n          </ng-pluralize>\n        </div>\n      </file>\n      <file name=\"protractor.js\" type=\"protractor\">\n        it('should show correct pluralized string', function() {\n          var withoutOffset = element.all(by.css('ng-pluralize')).get(0);\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var countInput = element(by.model('personCount'));\n\n          expect(withoutOffset.getText()).toEqual('1 person is viewing.');\n          expect(withOffset.getText()).toEqual('Igor is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('0');\n\n          expect(withoutOffset.getText()).toEqual('Nobody is viewing.');\n          expect(withOffset.getText()).toEqual('Nobody is viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('2');\n\n          expect(withoutOffset.getText()).toEqual('2 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('3');\n\n          expect(withoutOffset.getText()).toEqual('3 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');\n\n          countInput.clear();\n          countInput.sendKeys('4');\n\n          expect(withoutOffset.getText()).toEqual('4 people are viewing.');\n          expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');\n        });\n        it('should show data-bound names', function() {\n          var withOffset = element.all(by.css('ng-pluralize')).get(1);\n          var personCount = element(by.model('personCount'));\n          var person1 = element(by.model('person1'));\n          var person2 = element(by.model('person2'));\n          personCount.clear();\n          personCount.sendKeys('4');\n          person1.clear();\n          person1.sendKeys('Di');\n          person2.clear();\n          person2.sendKeys('Vojta');\n          expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');\n        });\n      </file>\n    </example>\n */\nvar ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {\n  var BRACE = /{}/g,\n      IS_WHEN = /^when(Minus)?(.+)$/;\n\n  return {\n    link: function(scope, element, attr) {\n      var numberExp = attr.count,\n          whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs\n          offset = attr.offset || 0,\n          whens = scope.$eval(whenExp) || {},\n          whensExpFns = {},\n          startSymbol = $interpolate.startSymbol(),\n          endSymbol = $interpolate.endSymbol(),\n          braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,\n          watchRemover = angular.noop,\n          lastCount;\n\n      forEach(attr, function(expression, attributeName) {\n        var tmpMatch = IS_WHEN.exec(attributeName);\n        if (tmpMatch) {\n          var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);\n          whens[whenKey] = element.attr(attr.$attr[attributeName]);\n        }\n      });\n      forEach(whens, function(expression, key) {\n        whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));\n\n      });\n\n      scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {\n        var count = parseFloat(newVal);\n        var countIsNaN = isNaN(count);\n\n        if (!countIsNaN && !(count in whens)) {\n          // If an explicit number rule such as 1, 2, 3... is defined, just use it.\n          // Otherwise, check it against pluralization rules in $locale service.\n          count = $locale.pluralCat(count - offset);\n        }\n\n        // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.\n        // In JS `NaN !== NaN`, so we have to explicitly check.\n        if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {\n          watchRemover();\n          var whenExpFn = whensExpFns[count];\n          if (isUndefined(whenExpFn)) {\n            if (newVal != null) {\n              $log.debug(\"ngPluralize: no rule defined for '\" + count + \"' in \" + whenExp);\n            }\n            watchRemover = noop;\n            updateElementText();\n          } else {\n            watchRemover = scope.$watch(whenExpFn, updateElementText);\n          }\n          lastCount = count;\n        }\n      });\n\n      function updateElementText(newText) {\n        element.text(newText || '');\n      }\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngRepeat\n * @multiElement\n *\n * @description\n * The `ngRepeat` directive instantiates a template once per item from a collection. Each template\n * instance gets its own scope, where the given loop variable is set to the current collection item,\n * and `$index` is set to the item index or key.\n *\n * Special properties are exposed on the local scope of each template instance, including:\n *\n * | Variable  | Type            | Details                                                                     |\n * |-----------|-----------------|-----------------------------------------------------------------------------|\n * | `$index`  | {@type number}  | iterator offset of the repeated element (0..length-1)                       |\n * | `$first`  | {@type boolean} | true if the repeated element is first in the iterator.                      |\n * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |\n * | `$last`   | {@type boolean} | true if the repeated element is last in the iterator.                       |\n * | `$even`   | {@type boolean} | true if the iterator position `$index` is even (otherwise false).           |\n * | `$odd`    | {@type boolean} | true if the iterator position `$index` is odd (otherwise false).            |\n *\n * <div class=\"alert alert-info\">\n *   Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.\n *   This may be useful when, for instance, nesting ngRepeats.\n * </div>\n *\n *\n * # Iterating over object properties\n *\n * It is possible to get `ngRepeat` to iterate over the properties of an object using the following\n * syntax:\n *\n * ```js\n * <div ng-repeat=\"(key, value) in myObj\"> ... </div>\n * ```\n *\n * However, there are a limitations compared to array iteration:\n *\n * - The JavaScript specification does not define the order of keys\n *   returned for an object, so Angular relies on the order returned by the browser\n *   when running `for key in myObj`. Browsers generally follow the strategy of providing\n *   keys in the order in which they were defined, although there are exceptions when keys are deleted\n *   and reinstated. See the\n *   [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).\n *\n * - `ngRepeat` will silently *ignore* object keys starting with `$`, because\n *   it's a prefix used by Angular for public (`$`) and private (`$$`) properties.\n *\n * - The built-in filters {@link ng.orderBy orderBy} and {@link ng.filter filter} do not work with\n *   objects, and will throw if used with one.\n *\n * If you are hitting any of these limitations, the recommended workaround is to convert your object into an array\n * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could\n * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)\n * or implement a `$watch` on the object yourself.\n *\n *\n * # Tracking and Duplicates\n *\n * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in\n * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:\n *\n * * When an item is added, a new instance of the template is added to the DOM.\n * * When an item is removed, its template instance is removed from the DOM.\n * * When items are reordered, their respective templates are reordered in the DOM.\n *\n * To minimize creation of DOM elements, `ngRepeat` uses a function\n * to \"keep track\" of all items in the collection and their corresponding DOM elements.\n * For example, if an item is added to the collection, ngRepeat will know that all other items\n * already have DOM elements, and will not re-render them.\n *\n * The default tracking function (which tracks items by their identity) does not allow\n * duplicate items in arrays. This is because when there are duplicates, it is not possible\n * to maintain a one-to-one mapping between collection items and DOM elements.\n *\n * If you do need to repeat duplicate items, you can substitute the default tracking behavior\n * with your own using the `track by` expression.\n *\n * For example, you may track items by the index of each item in the collection, using the\n * special scope property `$index`:\n * ```html\n *    <div ng-repeat=\"n in [42, 42, 43, 43] track by $index\">\n *      {{n}}\n *    </div>\n * ```\n *\n * You may also use arbitrary expressions in `track by`, including references to custom functions\n * on the scope:\n * ```html\n *    <div ng-repeat=\"n in [42, 42, 43, 43] track by myTrackingFunction(n)\">\n *      {{n}}\n *    </div>\n * ```\n *\n * <div class=\"alert alert-success\">\n * If you are working with objects that have an identifier property, you should track\n * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`\n * will not have to rebuild the DOM elements for items it has already rendered, even if the\n * JavaScript objects in the collection have been substituted for new ones. For large collections,\n * this significantly improves rendering performance. If you don't have a unique identifier,\n * `track by $index` can also provide a performance boost.\n * </div>\n * ```html\n *    <div ng-repeat=\"model in collection track by model.id\">\n *      {{model.name}}\n *    </div>\n * ```\n *\n * When no `track by` expression is provided, it is equivalent to tracking by the built-in\n * `$id` function, which tracks items by their identity:\n * ```html\n *    <div ng-repeat=\"obj in collection track by $id(obj)\">\n *      {{obj.prop}}\n *    </div>\n * ```\n *\n * <div class=\"alert alert-warning\">\n * **Note:** `track by` must always be the last expression:\n * </div>\n * ```\n * <div ng-repeat=\"model in collection | orderBy: 'id' as filtered_result track by model.id\">\n *     {{model.name}}\n * </div>\n * ```\n *\n * # Special repeat start and end points\n * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending\n * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.\n * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)\n * up to and including the ending HTML tag where **ng-repeat-end** is placed.\n *\n * The example below makes use of this feature:\n * ```html\n *   <header ng-repeat-start=\"item in items\">\n *     Header {{ item }}\n *   </header>\n *   <div class=\"body\">\n *     Body {{ item }}\n *   </div>\n *   <footer ng-repeat-end>\n *     Footer {{ item }}\n *   </footer>\n * ```\n *\n * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:\n * ```html\n *   <header>\n *     Header A\n *   </header>\n *   <div class=\"body\">\n *     Body A\n *   </div>\n *   <footer>\n *     Footer A\n *   </footer>\n *   <header>\n *     Header B\n *   </header>\n *   <div class=\"body\">\n *     Body B\n *   </div>\n *   <footer>\n *     Footer B\n *   </footer>\n * ```\n *\n * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such\n * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter} | when a new item is added to the list or when an item is revealed after a filter |\n * | {@link ng.$animate#leave leave} | when an item is removed from the list or when an item is filtered out |\n * | {@link ng.$animate#move move } | when an adjacent item is filtered out causing a reorder or when the item contents are reordered |\n *\n * See the example below for defining CSS animations with ngRepeat.\n *\n * @element ANY\n * @scope\n * @priority 1000\n * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These\n *   formats are currently supported:\n *\n *   * `variable in expression` – where variable is the user defined loop variable and `expression`\n *     is a scope expression giving the collection to enumerate.\n *\n *     For example: `album in artist.albums`.\n *\n *   * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,\n *     and `expression` is the scope expression giving the collection to enumerate.\n *\n *     For example: `(name, age) in {'adam':10, 'amalie':12}`.\n *\n *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking expression\n *     which can be used to associate the objects in the collection with the DOM elements. If no tracking expression\n *     is specified, ng-repeat associates elements by identity. It is an error to have\n *     more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are\n *     mapped to the same DOM element, which is not possible.)\n *\n *     Note that the tracking expression must come last, after any filters, and the alias expression.\n *\n *     For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements\n *     will be associated by item identity in the array.\n *\n *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique\n *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements\n *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM\n *     element in the same way in the DOM.\n *\n *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this\n *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`\n *     property is same.\n *\n *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter\n *     to items in conjunction with a tracking expression.\n *\n *   * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the\n *     intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message\n *     when a filter is active on the repeater, but the filtered result set is empty.\n *\n *     For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after\n *     the items have been processed through the filter.\n *\n *     Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end\n *     (and not as operator, inside an expression).\n *\n *     For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .\n *\n * @example\n * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed\n * results by name. New (entering) and removed (leaving) items are animated.\n  <example module=\"ngRepeat\" name=\"ngRepeat\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"repeatController\">\n        I have {{friends.length}} friends. They are:\n        <input type=\"search\" ng-model=\"q\" placeholder=\"filter friends...\" aria-label=\"filter friends\" />\n        <ul class=\"example-animate-container\">\n          <li class=\"animate-repeat\" ng-repeat=\"friend in friends | filter:q as results\">\n            [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.\n          </li>\n          <li class=\"animate-repeat\" ng-if=\"results.length == 0\">\n            <strong>No results found...</strong>\n          </li>\n        </ul>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('ngRepeat', ['ngAnimate']).controller('repeatController', function($scope) {\n        $scope.friends = [\n          {name:'John', age:25, gender:'boy'},\n          {name:'Jessie', age:30, gender:'girl'},\n          {name:'Johanna', age:28, gender:'girl'},\n          {name:'Joy', age:15, gender:'girl'},\n          {name:'Mary', age:28, gender:'girl'},\n          {name:'Peter', age:95, gender:'boy'},\n          {name:'Sebastian', age:50, gender:'boy'},\n          {name:'Erika', age:27, gender:'girl'},\n          {name:'Patrick', age:40, gender:'boy'},\n          {name:'Samantha', age:60, gender:'girl'}\n        ];\n      });\n    </file>\n    <file name=\"animations.css\">\n      .example-animate-container {\n        background:white;\n        border:1px solid black;\n        list-style:none;\n        margin:0;\n        padding:0 10px;\n      }\n\n      .animate-repeat {\n        line-height:30px;\n        list-style:none;\n        box-sizing:border-box;\n      }\n\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter,\n      .animate-repeat.ng-leave {\n        transition:all linear 0.5s;\n      }\n\n      .animate-repeat.ng-leave.ng-leave-active,\n      .animate-repeat.ng-move,\n      .animate-repeat.ng-enter {\n        opacity:0;\n        max-height:0;\n      }\n\n      .animate-repeat.ng-leave,\n      .animate-repeat.ng-move.ng-move-active,\n      .animate-repeat.ng-enter.ng-enter-active {\n        opacity:1;\n        max-height:30px;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var friends = element.all(by.repeater('friend in friends'));\n\n      it('should render initial data set', function() {\n        expect(friends.count()).toBe(10);\n        expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');\n        expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');\n        expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');\n        expect(element(by.binding('friends.length')).getText())\n            .toMatch(\"I have 10 friends. They are:\");\n      });\n\n       it('should update repeater when filter predicate changes', function() {\n         expect(friends.count()).toBe(10);\n\n         element(by.model('q')).sendKeys('ma');\n\n         expect(friends.count()).toBe(2);\n         expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');\n         expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');\n       });\n      </file>\n    </example>\n */\nvar ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $animate, $compile) {\n  var NG_REMOVED = '$$NG_REMOVED';\n  var ngRepeatMinErr = minErr('ngRepeat');\n\n  var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {\n    // TODO(perf): generate setters to shave off ~40ms or 1-1.5%\n    scope[valueIdentifier] = value;\n    if (keyIdentifier) scope[keyIdentifier] = key;\n    scope.$index = index;\n    scope.$first = (index === 0);\n    scope.$last = (index === (arrayLength - 1));\n    scope.$middle = !(scope.$first || scope.$last);\n    // jshint bitwise: false\n    scope.$odd = !(scope.$even = (index&1) === 0);\n    // jshint bitwise: true\n  };\n\n  var getBlockStart = function(block) {\n    return block.clone[0];\n  };\n\n  var getBlockEnd = function(block) {\n    return block.clone[block.clone.length - 1];\n  };\n\n\n  return {\n    restrict: 'A',\n    multiElement: true,\n    transclude: 'element',\n    priority: 1000,\n    terminal: true,\n    $$tlb: true,\n    compile: function ngRepeatCompile($element, $attr) {\n      var expression = $attr.ngRepeat;\n      var ngRepeatEndComment = $compile.$$createComment('end ngRepeat', expression);\n\n      var match = expression.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n\n      if (!match) {\n        throw ngRepeatMinErr('iexp', \"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.\",\n            expression);\n      }\n\n      var lhs = match[1];\n      var rhs = match[2];\n      var aliasAs = match[3];\n      var trackByExp = match[4];\n\n      match = lhs.match(/^(?:(\\s*[\\$\\w]+)|\\(\\s*([\\$\\w]+)\\s*,\\s*([\\$\\w]+)\\s*\\))$/);\n\n      if (!match) {\n        throw ngRepeatMinErr('iidexp', \"'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.\",\n            lhs);\n      }\n      var valueIdentifier = match[3] || match[1];\n      var keyIdentifier = match[2];\n\n      if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||\n          /^(null|undefined|this|\\$index|\\$first|\\$middle|\\$last|\\$even|\\$odd|\\$parent|\\$root|\\$id)$/.test(aliasAs))) {\n        throw ngRepeatMinErr('badident', \"alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.\",\n          aliasAs);\n      }\n\n      var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;\n      var hashFnLocals = {$id: hashKey};\n\n      if (trackByExp) {\n        trackByExpGetter = $parse(trackByExp);\n      } else {\n        trackByIdArrayFn = function(key, value) {\n          return hashKey(value);\n        };\n        trackByIdObjFn = function(key) {\n          return key;\n        };\n      }\n\n      return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {\n\n        if (trackByExpGetter) {\n          trackByIdExpFn = function(key, value, index) {\n            // assign key, value, and $index to the locals so that they can be used in hash functions\n            if (keyIdentifier) hashFnLocals[keyIdentifier] = key;\n            hashFnLocals[valueIdentifier] = value;\n            hashFnLocals.$index = index;\n            return trackByExpGetter($scope, hashFnLocals);\n          };\n        }\n\n        // Store a list of elements from previous run. This is a hash where key is the item from the\n        // iterator, and the value is objects with following properties.\n        //   - scope: bound scope\n        //   - element: previous element.\n        //   - index: position\n        //\n        // We are using no-proto object so that we don't need to guard against inherited props via\n        // hasOwnProperty.\n        var lastBlockMap = createMap();\n\n        //watch props\n        $scope.$watchCollection(rhs, function ngRepeatAction(collection) {\n          var index, length,\n              previousNode = $element[0],     // node that cloned nodes should be inserted after\n                                              // initialized to the comment node anchor\n              nextNode,\n              // Same as lastBlockMap but it has the current state. It will become the\n              // lastBlockMap on the next iteration.\n              nextBlockMap = createMap(),\n              collectionLength,\n              key, value, // key/value of iteration\n              trackById,\n              trackByIdFn,\n              collectionKeys,\n              block,       // last object information {scope, element, id}\n              nextBlockOrder,\n              elementsToRemove;\n\n          if (aliasAs) {\n            $scope[aliasAs] = collection;\n          }\n\n          if (isArrayLike(collection)) {\n            collectionKeys = collection;\n            trackByIdFn = trackByIdExpFn || trackByIdArrayFn;\n          } else {\n            trackByIdFn = trackByIdExpFn || trackByIdObjFn;\n            // if object, extract keys, in enumeration order, unsorted\n            collectionKeys = [];\n            for (var itemKey in collection) {\n              if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {\n                collectionKeys.push(itemKey);\n              }\n            }\n          }\n\n          collectionLength = collectionKeys.length;\n          nextBlockOrder = new Array(collectionLength);\n\n          // locate existing items\n          for (index = 0; index < collectionLength; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            trackById = trackByIdFn(key, value, index);\n            if (lastBlockMap[trackById]) {\n              // found previously seen block\n              block = lastBlockMap[trackById];\n              delete lastBlockMap[trackById];\n              nextBlockMap[trackById] = block;\n              nextBlockOrder[index] = block;\n            } else if (nextBlockMap[trackById]) {\n              // if collision detected. restore lastBlockMap and throw an error\n              forEach(nextBlockOrder, function(block) {\n                if (block && block.scope) lastBlockMap[block.id] = block;\n              });\n              throw ngRepeatMinErr('dupes',\n                  \"Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}\",\n                  expression, trackById, value);\n            } else {\n              // new never before seen block\n              nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};\n              nextBlockMap[trackById] = true;\n            }\n          }\n\n          // remove leftover items\n          for (var blockKey in lastBlockMap) {\n            block = lastBlockMap[blockKey];\n            elementsToRemove = getBlockNodes(block.clone);\n            $animate.leave(elementsToRemove);\n            if (elementsToRemove[0].parentNode) {\n              // if the element was not removed yet because of pending animation, mark it as deleted\n              // so that we can ignore it later\n              for (index = 0, length = elementsToRemove.length; index < length; index++) {\n                elementsToRemove[index][NG_REMOVED] = true;\n              }\n            }\n            block.scope.$destroy();\n          }\n\n          // we are not using forEach for perf reasons (trying to avoid #call)\n          for (index = 0; index < collectionLength; index++) {\n            key = (collection === collectionKeys) ? index : collectionKeys[index];\n            value = collection[key];\n            block = nextBlockOrder[index];\n\n            if (block.scope) {\n              // if we have already seen this object, then we need to reuse the\n              // associated scope/element\n\n              nextNode = previousNode;\n\n              // skip nodes that are already pending removal via leave animation\n              do {\n                nextNode = nextNode.nextSibling;\n              } while (nextNode && nextNode[NG_REMOVED]);\n\n              if (getBlockStart(block) != nextNode) {\n                // existing item which got moved\n                $animate.move(getBlockNodes(block.clone), null, previousNode);\n              }\n              previousNode = getBlockEnd(block);\n              updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n            } else {\n              // new item which we don't know about\n              $transclude(function ngRepeatTransclude(clone, scope) {\n                block.scope = scope;\n                // http://jsperf.com/clone-vs-createcomment\n                var endNode = ngRepeatEndComment.cloneNode(false);\n                clone[clone.length++] = endNode;\n\n                $animate.enter(clone, null, previousNode);\n                previousNode = endNode;\n                // Note: We only need the first/last node of the cloned nodes.\n                // However, we need to keep the reference to the jqlite wrapper as it might be changed later\n                // by a directive with templateUrl when its template arrives.\n                block.clone = clone;\n                nextBlockMap[block.id] = block;\n                updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);\n              });\n            }\n          }\n          lastBlockMap = nextBlockMap;\n        });\n      };\n    }\n  };\n}];\n\nvar NG_HIDE_CLASS = 'ng-hide';\nvar NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';\n/**\n * @ngdoc directive\n * @name ngShow\n * @multiElement\n *\n * @description\n * The `ngShow` directive shows or hides the given HTML element based on the expression\n * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding\n * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is visible) -->\n * <div ng-show=\"myValue\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is hidden) -->\n * <div ng-show=\"myValue\" class=\"ng-hide\"></div>\n * ```\n *\n * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope\n * with extra animation classes that can be added.\n *\n * ```css\n * .ng-hide:not(.ng-hide-animate) {\n *   /&#42; this is just another form of hiding an element &#42;/\n *   display: block!important;\n *   position: absolute;\n *   top: -9999px;\n *   left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngShow`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass except that\n * you must also include the !important flag to override the display property\n * so that you can perform an animation when the element is hidden during the time of the animation.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   /&#42; this is required as of 1.3x to properly\n *      apply all styling in a show/hide animation &#42;/\n *   transition: 0s linear all;\n * }\n *\n * .my-element.ng-hide-add-active,\n * .my-element.ng-hide-remove-active {\n *   /&#42; the transition is defined in the active class &#42;/\n *   transition: 1s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden |\n * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngShow` expression evaluates to a truthy value and just before contents are set to visible |\n *\n * @element ANY\n * @param {expression} ngShow If the {@link guide/expression expression} is truthy\n *     then the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngHide\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-show\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-show\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-show {\n        line-height: 20px;\n        opacity: 1;\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n\n      .animate-show.ng-hide-add, .animate-show.ng-hide-remove {\n        transition: all linear 0.5s;\n      }\n\n      .animate-show.ng-hide {\n        line-height: 0;\n        opacity: 0;\n        padding: 0 10px;\n      }\n\n      .check-element {\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngShowDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'A',\n    multiElement: true,\n    link: function(scope, element, attr) {\n      scope.$watch(attr.ngShow, function ngShowWatchAction(value) {\n        // we're adding a temporary, animation-specific class for ng-hide since this way\n        // we can control when the element is actually displayed on screen without having\n        // to have a global/greedy CSS selector that breaks when other animations are run.\n        // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845\n        $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {\n          tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n        });\n      });\n    }\n  };\n}];\n\n\n/**\n * @ngdoc directive\n * @name ngHide\n * @multiElement\n *\n * @description\n * The `ngHide` directive shows or hides the given HTML element based on the expression\n * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding\n * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined\n * in AngularJS and sets the display style to none (using an !important flag).\n * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).\n *\n * ```html\n * <!-- when $scope.myValue is truthy (element is hidden) -->\n * <div ng-hide=\"myValue\" class=\"ng-hide\"></div>\n *\n * <!-- when $scope.myValue is falsy (element is visible) -->\n * <div ng-hide=\"myValue\"></div>\n * ```\n *\n * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class\n * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed\n * from the element causing the element not to appear hidden.\n *\n * ## Why is !important used?\n *\n * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector\n * can be easily overridden by heavier selectors. For example, something as simple\n * as changing the display style on a HTML list item would make hidden elements appear visible.\n * This also becomes a bigger issue when dealing with CSS frameworks.\n *\n * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector\n * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the\n * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.\n *\n * ### Overriding `.ng-hide`\n *\n * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change\n * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`\n * class in CSS:\n *\n * ```css\n * .ng-hide {\n *   /&#42; this is just another form of hiding an element &#42;/\n *   display: block!important;\n *   position: absolute;\n *   top: -9999px;\n *   left: -9999px;\n * }\n * ```\n *\n * By default you don't need to override in CSS anything and the animations will work around the display style.\n *\n * ## A note about animations with `ngHide`\n *\n * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression\n * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`\n * CSS class is added and removed for you instead of your own CSS class.\n *\n * ```css\n * //\n * //a working example can be found at the bottom of this page\n * //\n * .my-element.ng-hide-add, .my-element.ng-hide-remove {\n *   transition: 0.5s linear all;\n * }\n *\n * .my-element.ng-hide-add { ... }\n * .my-element.ng-hide-add.ng-hide-add-active { ... }\n * .my-element.ng-hide-remove { ... }\n * .my-element.ng-hide-remove.ng-hide-remove-active { ... }\n * ```\n *\n * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display\n * property to block during animation states--ngAnimate will handle the style toggling automatically for you.\n *\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden |\n * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible |\n *\n *\n * @element ANY\n * @param {expression} ngHide If the {@link guide/expression expression} is truthy then\n *     the element is shown or hidden respectively.\n *\n * @example\n  <example module=\"ngAnimate\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      Click me: <input type=\"checkbox\" ng-model=\"checked\" aria-label=\"Toggle ngShow\"><br/>\n      <div>\n        Show:\n        <div class=\"check-element animate-hide\" ng-show=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-up\"></span> I show up when your checkbox is checked.\n        </div>\n      </div>\n      <div>\n        Hide:\n        <div class=\"check-element animate-hide\" ng-hide=\"checked\">\n          <span class=\"glyphicon glyphicon-thumbs-down\"></span> I hide when your checkbox is checked.\n        </div>\n      </div>\n    </file>\n    <file name=\"glyphicons.css\">\n      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);\n    </file>\n    <file name=\"animations.css\">\n      .animate-hide {\n        transition: all linear 0.5s;\n        line-height: 20px;\n        opacity: 1;\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n\n      .animate-hide.ng-hide {\n        line-height: 0;\n        opacity: 0;\n        padding: 0 10px;\n      }\n\n      .check-element {\n        padding: 10px;\n        border: 1px solid black;\n        background: white;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));\n      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));\n\n      it('should check ng-show / ng-hide', function() {\n        expect(thumbsUp.isDisplayed()).toBeFalsy();\n        expect(thumbsDown.isDisplayed()).toBeTruthy();\n\n        element(by.model('checked')).click();\n\n        expect(thumbsUp.isDisplayed()).toBeTruthy();\n        expect(thumbsDown.isDisplayed()).toBeFalsy();\n      });\n    </file>\n  </example>\n */\nvar ngHideDirective = ['$animate', function($animate) {\n  return {\n    restrict: 'A',\n    multiElement: true,\n    link: function(scope, element, attr) {\n      scope.$watch(attr.ngHide, function ngHideWatchAction(value) {\n        // The comment inside of the ngShowDirective explains why we add and\n        // remove a temporary class for the show/hide animation\n        $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {\n          tempClasses: NG_HIDE_IN_PROGRESS_CLASS\n        });\n      });\n    }\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name ngStyle\n * @restrict AC\n *\n * @description\n * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.\n *\n * @element ANY\n * @param {expression} ngStyle\n *\n * {@link guide/expression Expression} which evals to an\n * object whose keys are CSS style names and values are corresponding values for those CSS\n * keys.\n *\n * Since some CSS style names are not valid keys for an object, they must be quoted.\n * See the 'background-color' style in the example below.\n *\n * @example\n   <example>\n     <file name=\"index.html\">\n        <input type=\"button\" value=\"set color\" ng-click=\"myStyle={color:'red'}\">\n        <input type=\"button\" value=\"set background\" ng-click=\"myStyle={'background-color':'blue'}\">\n        <input type=\"button\" value=\"clear\" ng-click=\"myStyle={}\">\n        <br/>\n        <span ng-style=\"myStyle\">Sample Text</span>\n        <pre>myStyle={{myStyle}}</pre>\n     </file>\n     <file name=\"style.css\">\n       span {\n         color: black;\n       }\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       var colorSpan = element(by.css('span'));\n\n       it('should check ng-style', function() {\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n         element(by.css('input[value=\\'set color\\']')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');\n         element(by.css('input[value=clear]')).click();\n         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');\n       });\n     </file>\n   </example>\n */\nvar ngStyleDirective = ngDirective(function(scope, element, attr) {\n  scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {\n    if (oldStyles && (newStyles !== oldStyles)) {\n      forEach(oldStyles, function(val, style) { element.css(style, '');});\n    }\n    if (newStyles) element.css(newStyles);\n  }, true);\n});\n\n/**\n * @ngdoc directive\n * @name ngSwitch\n * @restrict EA\n *\n * @description\n * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.\n * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location\n * as specified in the template.\n *\n * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it\n * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element\n * matches the value obtained from the evaluated expression. In other words, you define a container element\n * (where you place the directive), place an expression on the **`on=\"...\"` attribute**\n * (or the **`ng-switch=\"...\"` attribute**), define any inner elements inside of the directive and place\n * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on\n * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default\n * attribute is displayed.\n *\n * <div class=\"alert alert-info\">\n * Be aware that the attribute values to match against cannot be expressions. They are interpreted\n * as literal string values to match against.\n * For example, **`ng-switch-when=\"someVal\"`** will match against the string `\"someVal\"` not against the\n * value of the expression `$scope.someVal`.\n * </div>\n\n * @animations\n * | Animation                        | Occurs                              |\n * |----------------------------------|-------------------------------------|\n * | {@link ng.$animate#enter enter}  | after the ngSwitch contents change and the matched child element is placed inside the container |\n * | {@link ng.$animate#leave leave}  | after the ngSwitch contents change and just before the former contents are removed from the DOM |\n *\n * @usage\n *\n * ```\n * <ANY ng-switch=\"expression\">\n *   <ANY ng-switch-when=\"matchValue1\">...</ANY>\n *   <ANY ng-switch-when=\"matchValue2\">...</ANY>\n *   <ANY ng-switch-default>...</ANY>\n * </ANY>\n * ```\n *\n *\n * @scope\n * @priority 1200\n * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.\n * On child elements add:\n *\n * * `ngSwitchWhen`: the case statement to match against. If match then this\n *   case will be displayed. If the same match appears multiple times, all the\n *   elements will be displayed.\n * * `ngSwitchDefault`: the default case when no other case match. If there\n *   are multiple default cases, all of them will be displayed when no other\n *   case match.\n *\n *\n * @example\n  <example module=\"switchExample\" deps=\"angular-animate.js\" animations=\"true\">\n    <file name=\"index.html\">\n      <div ng-controller=\"ExampleController\">\n        <select ng-model=\"selection\" ng-options=\"item for item in items\">\n        </select>\n        <code>selection={{selection}}</code>\n        <hr/>\n        <div class=\"animate-switch-container\"\n          ng-switch on=\"selection\">\n            <div class=\"animate-switch\" ng-switch-when=\"settings\">Settings Div</div>\n            <div class=\"animate-switch\" ng-switch-when=\"home\">Home Span</div>\n            <div class=\"animate-switch\" ng-switch-default>default</div>\n        </div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('switchExample', ['ngAnimate'])\n        .controller('ExampleController', ['$scope', function($scope) {\n          $scope.items = ['settings', 'home', 'other'];\n          $scope.selection = $scope.items[0];\n        }]);\n    </file>\n    <file name=\"animations.css\">\n      .animate-switch-container {\n        position:relative;\n        background:white;\n        border:1px solid black;\n        height:40px;\n        overflow:hidden;\n      }\n\n      .animate-switch {\n        padding:10px;\n      }\n\n      .animate-switch.ng-animate {\n        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;\n\n        position:absolute;\n        top:0;\n        left:0;\n        right:0;\n        bottom:0;\n      }\n\n      .animate-switch.ng-leave.ng-leave-active,\n      .animate-switch.ng-enter {\n        top:-50px;\n      }\n      .animate-switch.ng-leave,\n      .animate-switch.ng-enter.ng-enter-active {\n        top:0;\n      }\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      var switchElem = element(by.css('[ng-switch]'));\n      var select = element(by.model('selection'));\n\n      it('should start in settings', function() {\n        expect(switchElem.getText()).toMatch(/Settings Div/);\n      });\n      it('should change to home', function() {\n        select.all(by.css('option')).get(1).click();\n        expect(switchElem.getText()).toMatch(/Home Span/);\n      });\n      it('should select default', function() {\n        select.all(by.css('option')).get(2).click();\n        expect(switchElem.getText()).toMatch(/default/);\n      });\n    </file>\n  </example>\n */\nvar ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {\n  return {\n    require: 'ngSwitch',\n\n    // asks for $scope to fool the BC controller module\n    controller: ['$scope', function ngSwitchController() {\n     this.cases = {};\n    }],\n    link: function(scope, element, attr, ngSwitchController) {\n      var watchExpr = attr.ngSwitch || attr.on,\n          selectedTranscludes = [],\n          selectedElements = [],\n          previousLeaveAnimations = [],\n          selectedScopes = [];\n\n      var spliceFactory = function(array, index) {\n          return function() { array.splice(index, 1); };\n      };\n\n      scope.$watch(watchExpr, function ngSwitchWatchAction(value) {\n        var i, ii;\n        for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {\n          $animate.cancel(previousLeaveAnimations[i]);\n        }\n        previousLeaveAnimations.length = 0;\n\n        for (i = 0, ii = selectedScopes.length; i < ii; ++i) {\n          var selected = getBlockNodes(selectedElements[i].clone);\n          selectedScopes[i].$destroy();\n          var promise = previousLeaveAnimations[i] = $animate.leave(selected);\n          promise.then(spliceFactory(previousLeaveAnimations, i));\n        }\n\n        selectedElements.length = 0;\n        selectedScopes.length = 0;\n\n        if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {\n          forEach(selectedTranscludes, function(selectedTransclude) {\n            selectedTransclude.transclude(function(caseElement, selectedScope) {\n              selectedScopes.push(selectedScope);\n              var anchor = selectedTransclude.element;\n              caseElement[caseElement.length++] = $compile.$$createComment('end ngSwitchWhen');\n              var block = { clone: caseElement };\n\n              selectedElements.push(block);\n              $animate.enter(caseElement, anchor.parent(), anchor);\n            });\n          });\n        }\n      });\n    }\n  };\n}];\n\nvar ngSwitchWhenDirective = ngDirective({\n  transclude: 'element',\n  priority: 1200,\n  require: '^ngSwitch',\n  multiElement: true,\n  link: function(scope, element, attrs, ctrl, $transclude) {\n    ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);\n    ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });\n  }\n});\n\nvar ngSwitchDefaultDirective = ngDirective({\n  transclude: 'element',\n  priority: 1200,\n  require: '^ngSwitch',\n  multiElement: true,\n  link: function(scope, element, attr, ctrl, $transclude) {\n    ctrl.cases['?'] = (ctrl.cases['?'] || []);\n    ctrl.cases['?'].push({ transclude: $transclude, element: element });\n   }\n});\n\n/**\n * @ngdoc directive\n * @name ngTransclude\n * @restrict EAC\n *\n * @description\n * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.\n *\n * You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name\n * as the value of the `ng-transclude` or `ng-transclude-slot` attribute.\n *\n * If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing\n * content of this element will be removed before the transcluded content is inserted.\n * If the transcluded content is empty, the existing content is left intact. This lets you provide fallback content in the case\n * that no transcluded content is provided.\n *\n * @element ANY\n *\n * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided, is empty\n *                                               or its value is the same as the name of the attribute then the default slot is used.\n *\n * @example\n * ### Basic transclusion\n * This example demonstrates basic transclusion of content into a component directive.\n * <example name=\"simpleTranscludeExample\" module=\"transcludeExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('transcludeExample', [])\n *        .directive('pane', function(){\n *           return {\n *             restrict: 'E',\n *             transclude: true,\n *             scope: { title:'@' },\n *             template: '<div style=\"border: 1px solid black;\">' +\n *                         '<div style=\"background-color: gray\">{{title}}</div>' +\n *                         '<ng-transclude></ng-transclude>' +\n *                       '</div>'\n *           };\n *       })\n *       .controller('ExampleController', ['$scope', function($scope) {\n *         $scope.title = 'Lorem Ipsum';\n *         $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n *       }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <input ng-model=\"title\" aria-label=\"title\"> <br/>\n *       <textarea ng-model=\"text\" aria-label=\"text\"></textarea> <br/>\n *       <pane title=\"{{title}}\">{{text}}</pane>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *      it('should have transcluded', function() {\n *        var titleElement = element(by.model('title'));\n *        titleElement.clear();\n *        titleElement.sendKeys('TITLE');\n *        var textElement = element(by.model('text'));\n *        textElement.clear();\n *        textElement.sendKeys('TEXT');\n *        expect(element(by.binding('title')).getText()).toEqual('TITLE');\n *        expect(element(by.binding('text')).getText()).toEqual('TEXT');\n *      });\n *   </file>\n * </example>\n *\n * @example\n * ### Transclude fallback content\n * This example shows how to use `NgTransclude` with fallback content, that\n * is displayed if no transcluded content is provided.\n *\n * <example module=\"transcludeFallbackContentExample\">\n * <file name=\"index.html\">\n * <script>\n * angular.module('transcludeFallbackContentExample', [])\n * .directive('myButton', function(){\n *             return {\n *               restrict: 'E',\n *               transclude: true,\n *               scope: true,\n *               template: '<button style=\"cursor: pointer;\">' +\n *                           '<ng-transclude>' +\n *                             '<b style=\"color: red;\">Button1</b>' +\n *                           '</ng-transclude>' +\n *                         '</button>'\n *             };\n *         });\n * </script>\n * <!-- fallback button content -->\n * <my-button id=\"fallback\"></my-button>\n * <!-- modified button content -->\n * <my-button id=\"modified\">\n *   <i style=\"color: green;\">Button2</i>\n * </my-button>\n * </file>\n * <file name=\"protractor.js\" type=\"protractor\">\n * it('should have different transclude element content', function() {\n *          expect(element(by.id('fallback')).getText()).toBe('Button1');\n *          expect(element(by.id('modified')).getText()).toBe('Button2');\n *        });\n * </file>\n * </example>\n *\n * @example\n * ### Multi-slot transclusion\n * This example demonstrates using multi-slot transclusion in a component directive.\n * <example name=\"multiSlotTranscludeExample\" module=\"multiSlotTranscludeExample\">\n *   <file name=\"index.html\">\n *    <style>\n *      .title, .footer {\n *        background-color: gray\n *      }\n *    </style>\n *    <div ng-controller=\"ExampleController\">\n *      <input ng-model=\"title\" aria-label=\"title\"> <br/>\n *      <textarea ng-model=\"text\" aria-label=\"text\"></textarea> <br/>\n *      <pane>\n *        <pane-title><a ng-href=\"{{link}}\">{{title}}</a></pane-title>\n *        <pane-body><p>{{text}}</p></pane-body>\n *      </pane>\n *    </div>\n *   </file>\n *   <file name=\"app.js\">\n *    angular.module('multiSlotTranscludeExample', [])\n *     .directive('pane', function(){\n *        return {\n *          restrict: 'E',\n *          transclude: {\n *            'title': '?paneTitle',\n *            'body': 'paneBody',\n *            'footer': '?paneFooter'\n *          },\n *          template: '<div style=\"border: 1px solid black;\">' +\n *                      '<div class=\"title\" ng-transclude=\"title\">Fallback Title</div>' +\n *                      '<div ng-transclude=\"body\"></div>' +\n *                      '<div class=\"footer\" ng-transclude=\"footer\">Fallback Footer</div>' +\n *                    '</div>'\n *        };\n *    })\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.title = 'Lorem Ipsum';\n *      $scope.link = \"https://google.com\";\n *      $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';\n *    }]);\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *      it('should have transcluded the title and the body', function() {\n *        var titleElement = element(by.model('title'));\n *        titleElement.clear();\n *        titleElement.sendKeys('TITLE');\n *        var textElement = element(by.model('text'));\n *        textElement.clear();\n *        textElement.sendKeys('TEXT');\n *        expect(element(by.css('.title')).getText()).toEqual('TITLE');\n *        expect(element(by.binding('text')).getText()).toEqual('TEXT');\n *        expect(element(by.css('.footer')).getText()).toEqual('Fallback Footer');\n *      });\n *   </file>\n * </example>\n */\nvar ngTranscludeMinErr = minErr('ngTransclude');\nvar ngTranscludeDirective = ngDirective({\n  restrict: 'EAC',\n  link: function($scope, $element, $attrs, controller, $transclude) {\n\n    if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {\n      // If the attribute is of the form: `ng-transclude=\"ng-transclude\"`\n      // then treat it like the default\n      $attrs.ngTransclude = '';\n    }\n\n    function ngTranscludeCloneAttachFn(clone) {\n      if (clone.length) {\n        $element.empty();\n        $element.append(clone);\n      }\n    }\n\n    if (!$transclude) {\n      throw ngTranscludeMinErr('orphan',\n       'Illegal use of ngTransclude directive in the template! ' +\n       'No parent directive that requires a transclusion found. ' +\n       'Element: {0}',\n       startingTag($element));\n    }\n\n    // If there is no slot name defined or the slot name is not optional\n    // then transclude the slot\n    var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;\n    $transclude(ngTranscludeCloneAttachFn, null, slotName);\n  }\n});\n\n/**\n * @ngdoc directive\n * @name script\n * @restrict E\n *\n * @description\n * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the\n * template can be used by {@link ng.directive:ngInclude `ngInclude`},\n * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the\n * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be\n * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.\n *\n * @param {string} type Must be set to `'text/ng-template'`.\n * @param {string} id Cache name of the template.\n *\n * @example\n  <example>\n    <file name=\"index.html\">\n      <script type=\"text/ng-template\" id=\"/tpl.html\">\n        Content of the template.\n      </script>\n\n      <a ng-click=\"currentTpl='/tpl.html'\" id=\"tpl-link\">Load inlined template</a>\n      <div id=\"tpl-content\" ng-include src=\"currentTpl\"></div>\n    </file>\n    <file name=\"protractor.js\" type=\"protractor\">\n      it('should load template defined inside script tag', function() {\n        element(by.css('#tpl-link')).click();\n        expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);\n      });\n    </file>\n  </example>\n */\nvar scriptDirective = ['$templateCache', function($templateCache) {\n  return {\n    restrict: 'E',\n    terminal: true,\n    compile: function(element, attr) {\n      if (attr.type == 'text/ng-template') {\n        var templateUrl = attr.id,\n            text = element[0].text;\n\n        $templateCache.put(templateUrl, text);\n      }\n    }\n  };\n}];\n\nvar noopNgModelController = { $setViewValue: noop, $render: noop };\n\nfunction chromeHack(optionElement) {\n  // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459\n  // Adding an <option selected=\"selected\"> element to a <select required=\"required\"> should\n  // automatically select the new element\n  if (optionElement[0].hasAttribute('selected')) {\n    optionElement[0].selected = true;\n  }\n}\n\n/**\n * @ngdoc type\n * @name  select.SelectController\n * @description\n * The controller for the `<select>` directive. This provides support for reading\n * and writing the selected value(s) of the control and also coordinates dynamically\n * added `<option>` elements, perhaps by an `ngRepeat` directive.\n */\nvar SelectController =\n        ['$element', '$scope', function($element, $scope) {\n\n  var self = this,\n      optionsMap = new HashMap();\n\n  // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors\n  self.ngModelCtrl = noopNgModelController;\n\n  // The \"unknown\" option is one that is prepended to the list if the viewValue\n  // does not match any of the options. When it is rendered the value of the unknown\n  // option is '? XXX ?' where XXX is the hashKey of the value that is not known.\n  //\n  // We can't just jqLite('<option>') since jqLite is not smart enough\n  // to create it in <select> and IE barfs otherwise.\n  self.unknownOption = jqLite(document.createElement('option'));\n  self.renderUnknownOption = function(val) {\n    var unknownVal = '? ' + hashKey(val) + ' ?';\n    self.unknownOption.val(unknownVal);\n    $element.prepend(self.unknownOption);\n    $element.val(unknownVal);\n  };\n\n  $scope.$on('$destroy', function() {\n    // disable unknown option so that we don't do work when the whole select is being destroyed\n    self.renderUnknownOption = noop;\n  });\n\n  self.removeUnknownOption = function() {\n    if (self.unknownOption.parent()) self.unknownOption.remove();\n  };\n\n\n  // Read the value of the select control, the implementation of this changes depending\n  // upon whether the select can have multiple values and whether ngOptions is at work.\n  self.readValue = function readSingleValue() {\n    self.removeUnknownOption();\n    return $element.val();\n  };\n\n\n  // Write the value to the select control, the implementation of this changes depending\n  // upon whether the select can have multiple values and whether ngOptions is at work.\n  self.writeValue = function writeSingleValue(value) {\n    if (self.hasOption(value)) {\n      self.removeUnknownOption();\n      $element.val(value);\n      if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy\n    } else {\n      if (value == null && self.emptyOption) {\n        self.removeUnknownOption();\n        $element.val('');\n      } else {\n        self.renderUnknownOption(value);\n      }\n    }\n  };\n\n\n  // Tell the select control that an option, with the given value, has been added\n  self.addOption = function(value, element) {\n    // Skip comment nodes, as they only pollute the `optionsMap`\n    if (element[0].nodeType === NODE_TYPE_COMMENT) return;\n\n    assertNotHasOwnProperty(value, '\"option value\"');\n    if (value === '') {\n      self.emptyOption = element;\n    }\n    var count = optionsMap.get(value) || 0;\n    optionsMap.put(value, count + 1);\n    self.ngModelCtrl.$render();\n    chromeHack(element);\n  };\n\n  // Tell the select control that an option, with the given value, has been removed\n  self.removeOption = function(value) {\n    var count = optionsMap.get(value);\n    if (count) {\n      if (count === 1) {\n        optionsMap.remove(value);\n        if (value === '') {\n          self.emptyOption = undefined;\n        }\n      } else {\n        optionsMap.put(value, count - 1);\n      }\n    }\n  };\n\n  // Check whether the select control has an option matching the given value\n  self.hasOption = function(value) {\n    return !!optionsMap.get(value);\n  };\n\n\n  self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {\n\n    if (interpolateValueFn) {\n      // The value attribute is interpolated\n      var oldVal;\n      optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {\n        if (isDefined(oldVal)) {\n          self.removeOption(oldVal);\n        }\n        oldVal = newVal;\n        self.addOption(newVal, optionElement);\n      });\n    } else if (interpolateTextFn) {\n      // The text content is interpolated\n      optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {\n        optionAttrs.$set('value', newVal);\n        if (oldVal !== newVal) {\n          self.removeOption(oldVal);\n        }\n        self.addOption(newVal, optionElement);\n      });\n    } else {\n      // The value attribute is static\n      self.addOption(optionAttrs.value, optionElement);\n    }\n\n    optionElement.on('$destroy', function() {\n      self.removeOption(optionAttrs.value);\n      self.ngModelCtrl.$render();\n    });\n  };\n}];\n\n/**\n * @ngdoc directive\n * @name select\n * @restrict E\n *\n * @description\n * HTML `SELECT` element with angular data-binding.\n *\n * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding\n * between the scope and the `<select>` control (including setting default values).\n * It also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or\n * {@link ngOptions `ngOptions`} directives.\n *\n * When an item in the `<select>` menu is selected, the value of the selected option will be bound\n * to the model identified by the `ngModel` directive. With static or repeated options, this is\n * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.\n * If you want dynamic value attributes, you can use interpolation inside the value attribute.\n *\n * <div class=\"alert alert-warning\">\n * Note that the value of a `select` directive used without `ngOptions` is always a string.\n * When the model needs to be bound to a non-string value, you must either explicitly convert it\n * using a directive (see example below) or use `ngOptions` to specify the set of options.\n * This is because an option element can only be bound to string values at present.\n * </div>\n *\n * If the viewValue of `ngModel` does not match any of the options, then the control\n * will automatically add an \"unknown\" option, which it then removes when the mismatch is resolved.\n *\n * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can\n * be nested into the `<select>` element. This element will then represent the `null` or \"not selected\"\n * option. See example below for demonstration.\n *\n * <div class=\"alert alert-info\">\n * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions\n * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as\n * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the\n * comprehension expression, and additionally in reducing memory and increasing speed by not creating\n * a new scope for each repeated instance.\n * </div>\n *\n *\n * @param {string} ngModel Assignable angular expression to data-bind to.\n * @param {string=} name Property name of the form under which the control is published.\n * @param {string=} multiple Allows multiple options to be selected. The selected values will be\n *     bound to the model as an array.\n * @param {string=} required Sets `required` validation error key if the value is not entered.\n * @param {string=} ngRequired Adds required attribute and required validation constraint to\n * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required\n * when you want to data-bind to the required attribute.\n * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user\n *    interaction with the select element.\n * @param {string=} ngOptions sets the options that the select is populated with and defines what is\n * set on the model on selection. See {@link ngOptions `ngOptions`}.\n *\n * @example\n * ### Simple `select` elements with static options\n *\n * <example name=\"static-select\" module=\"staticSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"singleSelect\"> Single select: </label><br>\n *     <select name=\"singleSelect\" ng-model=\"data.singleSelect\">\n *       <option value=\"option-1\">Option 1</option>\n *       <option value=\"option-2\">Option 2</option>\n *     </select><br>\n *\n *     <label for=\"singleSelect\"> Single select with \"not selected\" option and dynamic option values: </label><br>\n *     <select name=\"singleSelect\" id=\"singleSelect\" ng-model=\"data.singleSelect\">\n *       <option value=\"\">---Please select---</option> <!-- not selected / blank option -->\n *       <option value=\"{{data.option1}}\">Option 1</option> <!-- interpolation -->\n *       <option value=\"option-2\">Option 2</option>\n *     </select><br>\n *     <button ng-click=\"forceUnknownOption()\">Force unknown option</button><br>\n *     <tt>singleSelect = {{data.singleSelect}}</tt>\n *\n *     <hr>\n *     <label for=\"multipleSelect\"> Multiple select: </label><br>\n *     <select name=\"multipleSelect\" id=\"multipleSelect\" ng-model=\"data.multipleSelect\" multiple>\n *       <option value=\"option-1\">Option 1</option>\n *       <option value=\"option-2\">Option 2</option>\n *       <option value=\"option-3\">Option 3</option>\n *     </select><br>\n *     <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>\n *   </form>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('staticSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       singleSelect: null,\n *       multipleSelect: [],\n *       option1: 'option-1',\n *      };\n *\n *      $scope.forceUnknownOption = function() {\n *        $scope.data.singleSelect = 'nonsense';\n *      };\n *   }]);\n * </file>\n *</example>\n *\n * ### Using `ngRepeat` to generate `select` options\n * <example name=\"ngrepeat-select\" module=\"ngrepeatSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"repeatSelect\"> Repeat select: </label>\n *     <select name=\"repeatSelect\" id=\"repeatSelect\" ng-model=\"data.repeatSelect\">\n *       <option ng-repeat=\"option in data.availableOptions\" value=\"{{option.id}}\">{{option.name}}</option>\n *     </select>\n *   </form>\n *   <hr>\n *   <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('ngrepeatSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       repeatSelect: null,\n *       availableOptions: [\n *         {id: '1', name: 'Option A'},\n *         {id: '2', name: 'Option B'},\n *         {id: '3', name: 'Option C'}\n *       ],\n *      };\n *   }]);\n * </file>\n *</example>\n *\n *\n * ### Using `select` with `ngOptions` and setting a default value\n * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.\n *\n * <example name=\"select-with-default-values\" module=\"defaultValueSelect\">\n * <file name=\"index.html\">\n * <div ng-controller=\"ExampleController\">\n *   <form name=\"myForm\">\n *     <label for=\"mySelect\">Make a choice:</label>\n *     <select name=\"mySelect\" id=\"mySelect\"\n *       ng-options=\"option.name for option in data.availableOptions track by option.id\"\n *       ng-model=\"data.selectedOption\"></select>\n *   </form>\n *   <hr>\n *   <tt>option = {{data.selectedOption}}</tt><br/>\n * </div>\n * </file>\n * <file name=\"app.js\">\n *  angular.module('defaultValueSelect', [])\n *    .controller('ExampleController', ['$scope', function($scope) {\n *      $scope.data = {\n *       availableOptions: [\n *         {id: '1', name: 'Option A'},\n *         {id: '2', name: 'Option B'},\n *         {id: '3', name: 'Option C'}\n *       ],\n *       selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui\n *       };\n *   }]);\n * </file>\n *</example>\n *\n *\n * ### Binding `select` to a non-string value via `ngModel` parsing / formatting\n *\n * <example name=\"select-with-non-string-options\" module=\"nonStringSelect\">\n *   <file name=\"index.html\">\n *     <select ng-model=\"model.id\" convert-to-number>\n *       <option value=\"0\">Zero</option>\n *       <option value=\"1\">One</option>\n *       <option value=\"2\">Two</option>\n *     </select>\n *     {{ model }}\n *   </file>\n *   <file name=\"app.js\">\n *     angular.module('nonStringSelect', [])\n *       .run(function($rootScope) {\n *         $rootScope.model = { id: 2 };\n *       })\n *       .directive('convertToNumber', function() {\n *         return {\n *           require: 'ngModel',\n *           link: function(scope, element, attrs, ngModel) {\n *             ngModel.$parsers.push(function(val) {\n *               return parseInt(val, 10);\n *             });\n *             ngModel.$formatters.push(function(val) {\n *               return '' + val;\n *             });\n *           }\n *         };\n *       });\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n *     it('should initialize to model', function() {\n *       var select = element(by.css('select'));\n *       expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');\n *     });\n *   </file>\n * </example>\n *\n */\nvar selectDirective = function() {\n\n  return {\n    restrict: 'E',\n    require: ['select', '?ngModel'],\n    controller: SelectController,\n    priority: 1,\n    link: {\n      pre: selectPreLink,\n      post: selectPostLink\n    }\n  };\n\n  function selectPreLink(scope, element, attr, ctrls) {\n\n      // if ngModel is not defined, we don't need to do anything\n      var ngModelCtrl = ctrls[1];\n      if (!ngModelCtrl) return;\n\n      var selectCtrl = ctrls[0];\n\n      selectCtrl.ngModelCtrl = ngModelCtrl;\n\n      // When the selected item(s) changes we delegate getting the value of the select control\n      // to the `readValue` method, which can be changed if the select can have multiple\n      // selected values or if the options are being generated by `ngOptions`\n      element.on('change', function() {\n        scope.$apply(function() {\n          ngModelCtrl.$setViewValue(selectCtrl.readValue());\n        });\n      });\n\n      // If the select allows multiple values then we need to modify how we read and write\n      // values from and to the control; also what it means for the value to be empty and\n      // we have to add an extra watch since ngModel doesn't work well with arrays - it\n      // doesn't trigger rendering if only an item in the array changes.\n      if (attr.multiple) {\n\n        // Read value now needs to check each option to see if it is selected\n        selectCtrl.readValue = function readMultipleValue() {\n          var array = [];\n          forEach(element.find('option'), function(option) {\n            if (option.selected) {\n              array.push(option.value);\n            }\n          });\n          return array;\n        };\n\n        // Write value now needs to set the selected property of each matching option\n        selectCtrl.writeValue = function writeMultipleValue(value) {\n          var items = new HashMap(value);\n          forEach(element.find('option'), function(option) {\n            option.selected = isDefined(items.get(option.value));\n          });\n        };\n\n        // we have to do it on each watch since ngModel watches reference, but\n        // we need to work of an array, so we need to see if anything was inserted/removed\n        var lastView, lastViewRef = NaN;\n        scope.$watch(function selectMultipleWatch() {\n          if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {\n            lastView = shallowCopy(ngModelCtrl.$viewValue);\n            ngModelCtrl.$render();\n          }\n          lastViewRef = ngModelCtrl.$viewValue;\n        });\n\n        // If we are a multiple select then value is now a collection\n        // so the meaning of $isEmpty changes\n        ngModelCtrl.$isEmpty = function(value) {\n          return !value || value.length === 0;\n        };\n\n      }\n    }\n\n    function selectPostLink(scope, element, attrs, ctrls) {\n      // if ngModel is not defined, we don't need to do anything\n      var ngModelCtrl = ctrls[1];\n      if (!ngModelCtrl) return;\n\n      var selectCtrl = ctrls[0];\n\n      // We delegate rendering to the `writeValue` method, which can be changed\n      // if the select can have multiple selected values or if the options are being\n      // generated by `ngOptions`.\n      // This must be done in the postLink fn to prevent $render to be called before\n      // all nodes have been linked correctly.\n      ngModelCtrl.$render = function() {\n        selectCtrl.writeValue(ngModelCtrl.$viewValue);\n      };\n    }\n};\n\n\n// The option directive is purely designed to communicate the existence (or lack of)\n// of dynamically created (and destroyed) option elements to their containing select\n// directive via its controller.\nvar optionDirective = ['$interpolate', function($interpolate) {\n  return {\n    restrict: 'E',\n    priority: 100,\n    compile: function(element, attr) {\n      if (isDefined(attr.value)) {\n        // If the value attribute is defined, check if it contains an interpolation\n        var interpolateValueFn = $interpolate(attr.value, true);\n      } else {\n        // If the value attribute is not defined then we fall back to the\n        // text content of the option element, which may be interpolated\n        var interpolateTextFn = $interpolate(element.text(), true);\n        if (!interpolateTextFn) {\n          attr.$set('value', element.text());\n        }\n      }\n\n      return function(scope, element, attr) {\n        // This is an optimization over using ^^ since we don't want to have to search\n        // all the way to the root of the DOM for every single option element\n        var selectCtrlName = '$selectController',\n            parent = element.parent(),\n            selectCtrl = parent.data(selectCtrlName) ||\n              parent.parent().data(selectCtrlName); // in case we are in optgroup\n\n        if (selectCtrl) {\n          selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);\n        }\n      };\n    }\n  };\n}];\n\nvar styleDirective = valueFn({\n  restrict: 'E',\n  terminal: false\n});\n\n/**\n * @ngdoc directive\n * @name ngRequired\n *\n * @description\n *\n * ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for {@link input `input`} and {@link select `select`} controls, but can also be\n * applied to custom controls.\n *\n * The directive sets the `required` attribute on the element if the Angular expression inside\n * `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we\n * cannot use interpolation inside `required`. See the {@link guide/interpolation interpolation guide}\n * for more info.\n *\n * The validator will set the `required` error key to true if the `required` attribute is set and\n * calling {@link ngModel.NgModelController#$isEmpty `NgModelController.$isEmpty`} with the\n * {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`} returns `true`. For example, the\n * `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing\n * custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.\n *\n * @example\n * <example name=\"ngRequiredDirective\" module=\"ngRequiredExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngRequiredExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.required = true;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"required\">Toggle required: </label>\n *         <input type=\"checkbox\" ng-model=\"required\" id=\"required\" />\n *         <br>\n *         <label for=\"input\">This input must be filled if `required` is true: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-required=\"required\" /><br>\n *         <hr>\n *         required error set? = <code>{{form.input.$error.required}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var required = element(by.binding('form.input.$error.required'));\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should set the required error', function() {\n         expect(required.getText()).toContain('true');\n\n         input.sendKeys('123');\n         expect(required.getText()).not.toContain('true');\n         expect(model.getText()).toContain('123');\n       });\n *   </file>\n * </example>\n */\nvar requiredDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n      attr.required = true; // force truthy in case we are on non input element\n\n      ctrl.$validators.required = function(modelValue, viewValue) {\n        return !attr.required || !ctrl.$isEmpty(viewValue);\n      };\n\n      attr.$observe('required', function() {\n        ctrl.$validate();\n      });\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngPattern\n *\n * @description\n *\n * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * does not match a RegExp which is obtained by evaluating the Angular expression given in the\n * `ngPattern` attribute value:\n * * If the expression evaluates to a RegExp object, then this is used directly.\n * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it\n * in `^` and `$` characters. For instance, `\"abc\"` will be converted to `new RegExp('^abc$')`.\n *\n * <div class=\"alert alert-info\">\n * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to\n * start at the index of the last search's match, thus not taking the whole input value into\n * account.\n * </div>\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `pattern` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is\n *     not available.\n *   </li>\n *   <li>\n *     The `ngPattern` attribute must be an expression, while the `pattern` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngPatternDirective\" module=\"ngPatternExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngPatternExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.regex = '\\\\d+';\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"regex\">Set a pattern (regex string): </label>\n *         <input type=\"text\" ng-model=\"regex\" id=\"regex\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current pattern: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-pattern=\"regex\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default pattern', function() {\n         input.sendKeys('aaa');\n         expect(model.getText()).not.toContain('aaa');\n\n         input.clear().then(function() {\n           input.sendKeys('123');\n           expect(model.getText()).toContain('123');\n         });\n       });\n *   </file>\n * </example>\n */\nvar patternDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var regexp, patternExp = attr.ngPattern || attr.pattern;\n      attr.$observe('pattern', function(regex) {\n        if (isString(regex) && regex.length > 0) {\n          regex = new RegExp('^' + regex + '$');\n        }\n\n        if (regex && !regex.test) {\n          throw minErr('ngPattern')('noregexp',\n            'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,\n            regex, startingTag(elm));\n        }\n\n        regexp = regex || undefined;\n        ctrl.$validate();\n      });\n\n      ctrl.$validators.pattern = function(modelValue, viewValue) {\n        // HTML5 pattern constraint validates the input value, so we validate the viewValue\n        return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);\n      };\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngMaxlength\n *\n * @description\n *\n * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is longer than the integer obtained by evaluating the Angular expression given in the\n * `ngMaxlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `maxlength` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint\n *     validation is not available.\n *   </li>\n *   <li>\n *     The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMaxlengthDirective\" module=\"ngMaxlengthExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngMaxlengthExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.maxlength = 5;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"maxlength\">Set a maxlength: </label>\n *         <input type=\"number\" ng-model=\"maxlength\" id=\"maxlength\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current maxlength: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-maxlength=\"maxlength\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default maxlength', function() {\n         input.sendKeys('abcdef');\n         expect(model.getText()).not.toContain('abcdef');\n\n         input.clear().then(function() {\n           input.sendKeys('abcde');\n           expect(model.getText()).toContain('abcde');\n         });\n       });\n *   </file>\n * </example>\n */\nvar maxlengthDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var maxlength = -1;\n      attr.$observe('maxlength', function(value) {\n        var intVal = toInt(value);\n        maxlength = isNaN(intVal) ? -1 : intVal;\n        ctrl.$validate();\n      });\n      ctrl.$validators.maxlength = function(modelValue, viewValue) {\n        return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);\n      };\n    }\n  };\n};\n\n/**\n * @ngdoc directive\n * @name ngMinlength\n *\n * @description\n *\n * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.\n * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.\n *\n * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}\n * is shorter than the integer obtained by evaluating the Angular expression given in the\n * `ngMinlength` attribute value.\n *\n * <div class=\"alert alert-info\">\n * **Note:** This directive is also added when the plain `minlength` attribute is used, with two\n * differences:\n * <ol>\n *   <li>\n *     `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint\n *     validation is not available.\n *   </li>\n *   <li>\n *     The `ngMinlength` value must be an expression, while the `minlength` value must be\n *     interpolated.\n *   </li>\n * </ol>\n * </div>\n *\n * @example\n * <example name=\"ngMinlengthDirective\" module=\"ngMinlengthExample\">\n *   <file name=\"index.html\">\n *     <script>\n *       angular.module('ngMinlengthExample', [])\n *         .controller('ExampleController', ['$scope', function($scope) {\n *           $scope.minlength = 3;\n *         }]);\n *     </script>\n *     <div ng-controller=\"ExampleController\">\n *       <form name=\"form\">\n *         <label for=\"minlength\">Set a minlength: </label>\n *         <input type=\"number\" ng-model=\"minlength\" id=\"minlength\" />\n *         <br>\n *         <label for=\"input\">This input is restricted by the current minlength: </label>\n *         <input type=\"text\" ng-model=\"model\" id=\"input\" name=\"input\" ng-minlength=\"minlength\" /><br>\n *         <hr>\n *         input valid? = <code>{{form.input.$valid}}</code><br>\n *         model = <code>{{model}}</code>\n *       </form>\n *     </div>\n *   </file>\n *   <file name=\"protractor.js\" type=\"protractor\">\n       var model = element(by.binding('model'));\n       var input = element(by.id('input'));\n\n       it('should validate the input with the default minlength', function() {\n         input.sendKeys('ab');\n         expect(model.getText()).not.toContain('ab');\n\n         input.sendKeys('abc');\n         expect(model.getText()).toContain('abc');\n       });\n *   </file>\n * </example>\n */\nvar minlengthDirective = function() {\n  return {\n    restrict: 'A',\n    require: '?ngModel',\n    link: function(scope, elm, attr, ctrl) {\n      if (!ctrl) return;\n\n      var minlength = 0;\n      attr.$observe('minlength', function(value) {\n        minlength = toInt(value) || 0;\n        ctrl.$validate();\n      });\n      ctrl.$validators.minlength = function(modelValue, viewValue) {\n        return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;\n      };\n    }\n  };\n};\n\nif (window.angular.bootstrap) {\n  //AngularJS is already loaded, so we can return here...\n  if (window.console) {\n    console.log('WARNING: Tried to load angular more than once.');\n  }\n  return;\n}\n\n//try to bind to jquery now so that one can write jqLite(document).ready()\n//but we will rebind on bootstrap again.\nbindJQuery();\n\npublishExternalAPI(angular);\n\nangular.module(\"ngLocale\", [], [\"$provide\", function($provide) {\nvar PLURAL_CATEGORY = {ZERO: \"zero\", ONE: \"one\", TWO: \"two\", FEW: \"few\", MANY: \"many\", OTHER: \"other\"};\nfunction getDecimals(n) {\n  n = n + '';\n  var i = n.indexOf('.');\n  return (i == -1) ? 0 : n.length - i - 1;\n}\n\nfunction getVF(n, opt_precision) {\n  var v = opt_precision;\n\n  if (undefined === v) {\n    v = Math.min(getDecimals(n), 3);\n  }\n\n  var base = Math.pow(10, v);\n  var f = ((n * base) | 0) % base;\n  return {v: v, f: f};\n}\n\n$provide.value(\"$locale\", {\n  \"DATETIME_FORMATS\": {\n    \"AMPMS\": [\n      \"AM\",\n      \"PM\"\n    ],\n    \"DAY\": [\n      \"Sunday\",\n      \"Monday\",\n      \"Tuesday\",\n      \"Wednesday\",\n      \"Thursday\",\n      \"Friday\",\n      \"Saturday\"\n    ],\n    \"ERANAMES\": [\n      \"Before Christ\",\n      \"Anno Domini\"\n    ],\n    \"ERAS\": [\n      \"BC\",\n      \"AD\"\n    ],\n    \"FIRSTDAYOFWEEK\": 6,\n    \"MONTH\": [\n      \"January\",\n      \"February\",\n      \"March\",\n      \"April\",\n      \"May\",\n      \"June\",\n      \"July\",\n      \"August\",\n      \"September\",\n      \"October\",\n      \"November\",\n      \"December\"\n    ],\n    \"SHORTDAY\": [\n      \"Sun\",\n      \"Mon\",\n      \"Tue\",\n      \"Wed\",\n      \"Thu\",\n      \"Fri\",\n      \"Sat\"\n    ],\n    \"SHORTMONTH\": [\n      \"Jan\",\n      \"Feb\",\n      \"Mar\",\n      \"Apr\",\n      \"May\",\n      \"Jun\",\n      \"Jul\",\n      \"Aug\",\n      \"Sep\",\n      \"Oct\",\n      \"Nov\",\n      \"Dec\"\n    ],\n    \"STANDALONEMONTH\": [\n      \"January\",\n      \"February\",\n      \"March\",\n      \"April\",\n      \"May\",\n      \"June\",\n      \"July\",\n      \"August\",\n      \"September\",\n      \"October\",\n      \"November\",\n      \"December\"\n    ],\n    \"WEEKENDRANGE\": [\n      5,\n      6\n    ],\n    \"fullDate\": \"EEEE, MMMM d, y\",\n    \"longDate\": \"MMMM d, y\",\n    \"medium\": \"MMM d, y h:mm:ss a\",\n    \"mediumDate\": \"MMM d, y\",\n    \"mediumTime\": \"h:mm:ss a\",\n    \"short\": \"M/d/yy h:mm a\",\n    \"shortDate\": \"M/d/yy\",\n    \"shortTime\": \"h:mm a\"\n  },\n  \"NUMBER_FORMATS\": {\n    \"CURRENCY_SYM\": \"$\",\n    \"DECIMAL_SEP\": \".\",\n    \"GROUP_SEP\": \",\",\n    \"PATTERNS\": [\n      {\n        \"gSize\": 3,\n        \"lgSize\": 3,\n        \"maxFrac\": 3,\n        \"minFrac\": 0,\n        \"minInt\": 1,\n        \"negPre\": \"-\",\n        \"negSuf\": \"\",\n        \"posPre\": \"\",\n        \"posSuf\": \"\"\n      },\n      {\n        \"gSize\": 3,\n        \"lgSize\": 3,\n        \"maxFrac\": 2,\n        \"minFrac\": 2,\n        \"minInt\": 1,\n        \"negPre\": \"-\\u00a4\",\n        \"negSuf\": \"\",\n        \"posPre\": \"\\u00a4\",\n        \"posSuf\": \"\"\n      }\n    ]\n  },\n  \"id\": \"en-us\",\n  \"localeID\": \"en_US\",\n  \"pluralCat\": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (i == 1 && vf.v == 0) {    return PLURAL_CATEGORY.ONE;  }  return PLURAL_CATEGORY.OTHER;}\n});\n}]);\n\n  jqLite(document).ready(function() {\n    angularInit(document, bootstrap);\n  });\n\n})(window, document);\n\n!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type=\"text/css\">@charset \"UTF-8\";[ng\\\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* jshint ignore:start */\nvar noop        = angular.noop;\nvar copy        = angular.copy;\nvar extend      = angular.extend;\nvar jqLite      = angular.element;\nvar forEach     = angular.forEach;\nvar isArray     = angular.isArray;\nvar isString    = angular.isString;\nvar isObject    = angular.isObject;\nvar isUndefined = angular.isUndefined;\nvar isDefined   = angular.isDefined;\nvar isFunction  = angular.isFunction;\nvar isElement   = angular.isElement;\n\nvar ELEMENT_NODE = 1;\nvar COMMENT_NODE = 8;\n\nvar ADD_CLASS_SUFFIX = '-add';\nvar REMOVE_CLASS_SUFFIX = '-remove';\nvar EVENT_CLASS_PREFIX = 'ng-';\nvar ACTIVE_CLASS_SUFFIX = '-active';\nvar PREPARE_CLASS_SUFFIX = '-prepare';\n\nvar NG_ANIMATE_CLASSNAME = 'ng-animate';\nvar NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren';\n\n// Detect proper transitionend/animationend event names.\nvar CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;\n\n// If unprefixed events are not supported but webkit-prefixed are, use the latter.\n// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.\n// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`\n// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.\n// Register both events in case `window.onanimationend` is not supported because of that,\n// do the same for `transitionend` as Safari is likely to exhibit similar behavior.\n// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit\n// therefore there is no reason to test anymore for other vendor prefixes:\n// http://caniuse.com/#search=transition\nif (isUndefined(window.ontransitionend) && isDefined(window.onwebkittransitionend)) {\n  CSS_PREFIX = '-webkit-';\n  TRANSITION_PROP = 'WebkitTransition';\n  TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';\n} else {\n  TRANSITION_PROP = 'transition';\n  TRANSITIONEND_EVENT = 'transitionend';\n}\n\nif (isUndefined(window.onanimationend) && isDefined(window.onwebkitanimationend)) {\n  CSS_PREFIX = '-webkit-';\n  ANIMATION_PROP = 'WebkitAnimation';\n  ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';\n} else {\n  ANIMATION_PROP = 'animation';\n  ANIMATIONEND_EVENT = 'animationend';\n}\n\nvar DURATION_KEY = 'Duration';\nvar PROPERTY_KEY = 'Property';\nvar DELAY_KEY = 'Delay';\nvar TIMING_KEY = 'TimingFunction';\nvar ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';\nvar ANIMATION_PLAYSTATE_KEY = 'PlayState';\nvar SAFE_FAST_FORWARD_DURATION_VALUE = 9999;\n\nvar ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;\nvar ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;\nvar TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;\nvar TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;\n\nvar isPromiseLike = function(p) {\n  return p && p.then ? true : false;\n};\n\nvar ngMinErr = angular.$$minErr('ng');\nfunction assertArg(arg, name, reason) {\n  if (!arg) {\n    throw ngMinErr('areq', \"Argument '{0}' is {1}\", (name || '?'), (reason || \"required\"));\n  }\n  return arg;\n}\n\nfunction mergeClasses(a,b) {\n  if (!a && !b) return '';\n  if (!a) return b;\n  if (!b) return a;\n  if (isArray(a)) a = a.join(' ');\n  if (isArray(b)) b = b.join(' ');\n  return a + ' ' + b;\n}\n\nfunction packageStyles(options) {\n  var styles = {};\n  if (options && (options.to || options.from)) {\n    styles.to = options.to;\n    styles.from = options.from;\n  }\n  return styles;\n}\n\nfunction pendClasses(classes, fix, isPrefix) {\n  var className = '';\n  classes = isArray(classes)\n      ? classes\n      : classes && isString(classes) && classes.length\n          ? classes.split(/\\s+/)\n          : [];\n  forEach(classes, function(klass, i) {\n    if (klass && klass.length > 0) {\n      className += (i > 0) ? ' ' : '';\n      className += isPrefix ? fix + klass\n                            : klass + fix;\n    }\n  });\n  return className;\n}\n\nfunction removeFromArray(arr, val) {\n  var index = arr.indexOf(val);\n  if (val >= 0) {\n    arr.splice(index, 1);\n  }\n}\n\nfunction stripCommentsFromElement(element) {\n  if (element instanceof jqLite) {\n    switch (element.length) {\n      case 0:\n        return [];\n        break;\n\n      case 1:\n        // there is no point of stripping anything if the element\n        // is the only element within the jqLite wrapper.\n        // (it's important that we retain the element instance.)\n        if (element[0].nodeType === ELEMENT_NODE) {\n          return element;\n        }\n        break;\n\n      default:\n        return jqLite(extractElementNode(element));\n        break;\n    }\n  }\n\n  if (element.nodeType === ELEMENT_NODE) {\n    return jqLite(element);\n  }\n}\n\nfunction extractElementNode(element) {\n  if (!element[0]) return element;\n  for (var i = 0; i < element.length; i++) {\n    var elm = element[i];\n    if (elm.nodeType == ELEMENT_NODE) {\n      return elm;\n    }\n  }\n}\n\nfunction $$addClass($$jqLite, element, className) {\n  forEach(element, function(elm) {\n    $$jqLite.addClass(elm, className);\n  });\n}\n\nfunction $$removeClass($$jqLite, element, className) {\n  forEach(element, function(elm) {\n    $$jqLite.removeClass(elm, className);\n  });\n}\n\nfunction applyAnimationClassesFactory($$jqLite) {\n  return function(element, options) {\n    if (options.addClass) {\n      $$addClass($$jqLite, element, options.addClass);\n      options.addClass = null;\n    }\n    if (options.removeClass) {\n      $$removeClass($$jqLite, element, options.removeClass);\n      options.removeClass = null;\n    }\n  }\n}\n\nfunction prepareAnimationOptions(options) {\n  options = options || {};\n  if (!options.$$prepared) {\n    var domOperation = options.domOperation || noop;\n    options.domOperation = function() {\n      options.$$domOperationFired = true;\n      domOperation();\n      domOperation = noop;\n    };\n    options.$$prepared = true;\n  }\n  return options;\n}\n\nfunction applyAnimationStyles(element, options) {\n  applyAnimationFromStyles(element, options);\n  applyAnimationToStyles(element, options);\n}\n\nfunction applyAnimationFromStyles(element, options) {\n  if (options.from) {\n    element.css(options.from);\n    options.from = null;\n  }\n}\n\nfunction applyAnimationToStyles(element, options) {\n  if (options.to) {\n    element.css(options.to);\n    options.to = null;\n  }\n}\n\nfunction mergeAnimationDetails(element, oldAnimation, newAnimation) {\n  var target = oldAnimation.options || {};\n  var newOptions = newAnimation.options || {};\n\n  var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || '');\n  var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || '');\n  var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove);\n\n  if (newOptions.preparationClasses) {\n    target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses);\n    delete newOptions.preparationClasses;\n  }\n\n  // noop is basically when there is no callback; otherwise something has been set\n  var realDomOperation = target.domOperation !== noop ? target.domOperation : null;\n\n  extend(target, newOptions);\n\n  // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this.\n  if (realDomOperation) {\n    target.domOperation = realDomOperation;\n  }\n\n  if (classes.addClass) {\n    target.addClass = classes.addClass;\n  } else {\n    target.addClass = null;\n  }\n\n  if (classes.removeClass) {\n    target.removeClass = classes.removeClass;\n  } else {\n    target.removeClass = null;\n  }\n\n  oldAnimation.addClass = target.addClass;\n  oldAnimation.removeClass = target.removeClass;\n\n  return target;\n}\n\nfunction resolveElementClasses(existing, toAdd, toRemove) {\n  var ADD_CLASS = 1;\n  var REMOVE_CLASS = -1;\n\n  var flags = {};\n  existing = splitClassesToLookup(existing);\n\n  toAdd = splitClassesToLookup(toAdd);\n  forEach(toAdd, function(value, key) {\n    flags[key] = ADD_CLASS;\n  });\n\n  toRemove = splitClassesToLookup(toRemove);\n  forEach(toRemove, function(value, key) {\n    flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;\n  });\n\n  var classes = {\n    addClass: '',\n    removeClass: ''\n  };\n\n  forEach(flags, function(val, klass) {\n    var prop, allow;\n    if (val === ADD_CLASS) {\n      prop = 'addClass';\n      allow = !existing[klass];\n    } else if (val === REMOVE_CLASS) {\n      prop = 'removeClass';\n      allow = existing[klass];\n    }\n    if (allow) {\n      if (classes[prop].length) {\n        classes[prop] += ' ';\n      }\n      classes[prop] += klass;\n    }\n  });\n\n  function splitClassesToLookup(classes) {\n    if (isString(classes)) {\n      classes = classes.split(' ');\n    }\n\n    var obj = {};\n    forEach(classes, function(klass) {\n      // sometimes the split leaves empty string values\n      // incase extra spaces were applied to the options\n      if (klass.length) {\n        obj[klass] = true;\n      }\n    });\n    return obj;\n  }\n\n  return classes;\n}\n\nfunction getDomNode(element) {\n  return (element instanceof angular.element) ? element[0] : element;\n}\n\nfunction applyGeneratedPreparationClasses(element, event, options) {\n  var classes = '';\n  if (event) {\n    classes = pendClasses(event, EVENT_CLASS_PREFIX, true);\n  }\n  if (options.addClass) {\n    classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX));\n  }\n  if (options.removeClass) {\n    classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX));\n  }\n  if (classes.length) {\n    options.preparationClasses = classes;\n    element.addClass(classes);\n  }\n}\n\nfunction clearGeneratedClasses(element, options) {\n  if (options.preparationClasses) {\n    element.removeClass(options.preparationClasses);\n    options.preparationClasses = null;\n  }\n  if (options.activeClasses) {\n    element.removeClass(options.activeClasses);\n    options.activeClasses = null;\n  }\n}\n\nfunction blockTransitions(node, duration) {\n  // we use a negative delay value since it performs blocking\n  // yet it doesn't kill any existing transitions running on the\n  // same element which makes this safe for class-based animations\n  var value = duration ? '-' + duration + 's' : '';\n  applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]);\n  return [TRANSITION_DELAY_PROP, value];\n}\n\nfunction blockKeyframeAnimations(node, applyBlock) {\n  var value = applyBlock ? 'paused' : '';\n  var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;\n  applyInlineStyle(node, [key, value]);\n  return [key, value];\n}\n\nfunction applyInlineStyle(node, styleTuple) {\n  var prop = styleTuple[0];\n  var value = styleTuple[1];\n  node.style[prop] = value;\n}\n\nfunction concatWithSpace(a,b) {\n  if (!a) return b;\n  if (!b) return a;\n  return a + ' ' + b;\n}\n\nvar $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {\n  var queue, cancelFn;\n\n  function scheduler(tasks) {\n    // we make a copy since RAFScheduler mutates the state\n    // of the passed in array variable and this would be difficult\n    // to track down on the outside code\n    queue = queue.concat(tasks);\n    nextTick();\n  }\n\n  queue = scheduler.queue = [];\n\n  /* waitUntilQuiet does two things:\n   * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through\n   * 2. It will delay the next wave of tasks from running until the quiet `fn` has run.\n   *\n   * The motivation here is that animation code can request more time from the scheduler\n   * before the next wave runs. This allows for certain DOM properties such as classes to\n   * be resolved in time for the next animation to run.\n   */\n  scheduler.waitUntilQuiet = function(fn) {\n    if (cancelFn) cancelFn();\n\n    cancelFn = $$rAF(function() {\n      cancelFn = null;\n      fn();\n      nextTick();\n    });\n  };\n\n  return scheduler;\n\n  function nextTick() {\n    if (!queue.length) return;\n\n    var items = queue.shift();\n    for (var i = 0; i < items.length; i++) {\n      items[i]();\n    }\n\n    if (!cancelFn) {\n      $$rAF(function() {\n        if (!cancelFn) nextTick();\n      });\n    }\n  }\n}];\n\n/**\n * @ngdoc directive\n * @name ngAnimateChildren\n * @restrict AE\n * @element ANY\n *\n * @description\n *\n * ngAnimateChildren allows you to specify that children of this element should animate even if any\n * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move`\n * (structural) animation, child elements that also have an active structural animation are not animated.\n *\n * Note that even if `ngAnimteChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation).\n *\n *\n * @param {string} ngAnimateChildren If the value is empty, `true` or `on`,\n *     then child animations are allowed. If the value is `false`, child animations are not allowed.\n *\n * @example\n * <example module=\"ngAnimateChildren\" name=\"ngAnimateChildren\" deps=\"angular-animate.js\" animations=\"true\">\n     <file name=\"index.html\">\n       <div ng-controller=\"mainController as main\">\n         <label>Show container? <input type=\"checkbox\" ng-model=\"main.enterElement\" /></label>\n         <label>Animate children? <input type=\"checkbox\" ng-model=\"main.animateChildren\" /></label>\n         <hr>\n         <div ng-animate-children=\"{{main.animateChildren}}\">\n           <div ng-if=\"main.enterElement\" class=\"container\">\n             List of items:\n             <div ng-repeat=\"item in [0, 1, 2, 3]\" class=\"item\">Item {{item}}</div>\n           </div>\n         </div>\n       </div>\n     </file>\n     <file name=\"animations.css\">\n\n      .container.ng-enter,\n      .container.ng-leave {\n        transition: all ease 1.5s;\n      }\n\n      .container.ng-enter,\n      .container.ng-leave-active {\n        opacity: 0;\n      }\n\n      .container.ng-leave,\n      .container.ng-enter-active {\n        opacity: 1;\n      }\n\n      .item {\n        background: firebrick;\n        color: #FFF;\n        margin-bottom: 10px;\n      }\n\n      .item.ng-enter,\n      .item.ng-leave {\n        transition: transform 1.5s ease;\n      }\n\n      .item.ng-enter {\n        transform: translateX(50px);\n      }\n\n      .item.ng-enter-active {\n        transform: translateX(0);\n      }\n    </file>\n    <file name=\"script.js\">\n      angular.module('ngAnimateChildren', ['ngAnimate'])\n        .controller('mainController', function() {\n          this.animateChildren = false;\n          this.enterElement = false;\n        });\n    </file>\n  </example>\n */\nvar $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {\n  return {\n    link: function(scope, element, attrs) {\n      var val = attrs.ngAnimateChildren;\n      if (angular.isString(val) && val.length === 0) { //empty attribute\n        element.data(NG_ANIMATE_CHILDREN_DATA, true);\n      } else {\n        // Interpolate and set the value, so that it is available to\n        // animations that run right after compilation\n        setData($interpolate(val)(scope));\n        attrs.$observe('ngAnimateChildren', setData);\n      }\n\n      function setData(value) {\n        value = value === 'on' || value === 'true';\n        element.data(NG_ANIMATE_CHILDREN_DATA, value);\n      }\n    }\n  };\n}];\n\nvar ANIMATE_TIMER_KEY = '$$animateCss';\n\n/**\n * @ngdoc service\n * @name $animateCss\n * @kind object\n *\n * @description\n * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes\n * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT\n * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or\n * directives to create more complex animations that can be purely driven using CSS code.\n *\n * Note that only browsers that support CSS transitions and/or keyframe animations are capable of\n * rendering animations triggered via `$animateCss` (bad news for IE9 and lower).\n *\n * ## Usage\n * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that\n * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however,\n * any automatic control over cancelling animations and/or preventing animations from being run on\n * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to\n * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger\n * the CSS animation.\n *\n * The example below shows how we can create a folding animation on an element using `ng-if`:\n *\n * ```html\n * <!-- notice the `fold-animation` CSS class -->\n * <div ng-if=\"onOff\" class=\"fold-animation\">\n *   This element will go BOOM\n * </div>\n * <button ng-click=\"onOff=true\">Fold In</button>\n * ```\n *\n * Now we create the **JavaScript animation** that will trigger the CSS transition:\n *\n * ```js\n * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element, doneFn) {\n *       var height = element[0].offsetHeight;\n *       return $animateCss(element, {\n *         from: { height:'0px' },\n *         to: { height:height + 'px' },\n *         duration: 1 // one second\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * ## More Advanced Uses\n *\n * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks\n * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code.\n *\n * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation,\n * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with\n * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order\n * to provide a working animation that will run in CSS.\n *\n * The example below showcases a more advanced version of the `.fold-animation` from the example above:\n *\n * ```js\n * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element, doneFn) {\n *       var height = element[0].offsetHeight;\n *       return $animateCss(element, {\n *         addClass: 'red large-text pulse-twice',\n *         easing: 'ease-out',\n *         from: { height:'0px' },\n *         to: { height:height + 'px' },\n *         duration: 1 // one second\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * Since we're adding/removing CSS classes then the CSS transition will also pick those up:\n *\n * ```css\n * /&#42; since a hardcoded duration value of 1 was provided in the JavaScript animation code,\n * the CSS classes below will be transitioned despite them being defined as regular CSS classes &#42;/\n * .red { background:red; }\n * .large-text { font-size:20px; }\n *\n * /&#42; we can also use a keyframe animation and $animateCss will make it work alongside the transition &#42;/\n * .pulse-twice {\n *   animation: 0.5s pulse linear 2;\n *   -webkit-animation: 0.5s pulse linear 2;\n * }\n *\n * @keyframes pulse {\n *   from { transform: scale(0.5); }\n *   to { transform: scale(1.5); }\n * }\n *\n * @-webkit-keyframes pulse {\n *   from { -webkit-transform: scale(0.5); }\n *   to { -webkit-transform: scale(1.5); }\n * }\n * ```\n *\n * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen.\n *\n * ## How the Options are handled\n *\n * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation\n * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline\n * styles using the `from` and `to` properties.\n *\n * ```js\n * var animator = $animateCss(element, {\n *   from: { background:'red' },\n *   to: { background:'blue' }\n * });\n * animator.start();\n * ```\n *\n * ```css\n * .rotating-animation {\n *   animation:0.5s rotate linear;\n *   -webkit-animation:0.5s rotate linear;\n * }\n *\n * @keyframes rotate {\n *   from { transform: rotate(0deg); }\n *   to { transform: rotate(360deg); }\n * }\n *\n * @-webkit-keyframes rotate {\n *   from { -webkit-transform: rotate(0deg); }\n *   to { -webkit-transform: rotate(360deg); }\n * }\n * ```\n *\n * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is\n * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition\n * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition\n * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied\n * and spread across the transition and keyframe animation.\n *\n * ## What is returned\n *\n * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually\n * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are\n * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties:\n *\n * ```js\n * var animator = $animateCss(element, { ... });\n * ```\n *\n * Now what do the contents of our `animator` variable look like:\n *\n * ```js\n * {\n *   // starts the animation\n *   start: Function,\n *\n *   // ends (aborts) the animation\n *   end: Function\n * }\n * ```\n *\n * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends.\n * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been\n * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties\n * and that changing them will not reconfigure the parameters of the animation.\n *\n * ### runner.done() vs runner.then()\n * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the\n * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**.\n * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()`\n * unless you really need a digest to kick off afterwards.\n *\n * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss\n * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code).\n * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works.\n *\n * @param {DOMElement} element the element that will be animated\n * @param {object} options the animation-related options that will be applied during the animation\n *\n * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied\n * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.)\n * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and\n * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted.\n * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both).\n * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`).\n * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`).\n * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation.\n * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.\n * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation.\n * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation.\n * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0`\n * is provided then the animation will be skipped entirely.\n * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is\n * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value\n * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same\n * CSS delay value.\n * * `stagger` - A numeric time value representing the delay between successively animated elements\n * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.})\n * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a\n *   `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)\n * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.)\n * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once\n *    the animation is closed. This is useful for when the styles are used purely for the sake of\n *    the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation).\n *    By default this value is set to `false`.\n *\n * @return {object} an object with start and end methods and details about the animation.\n *\n * * `start` - The method to start the animation. This will return a `Promise` when called.\n * * `end` - This method will cancel the animation and remove all applied CSS classes and styles.\n */\nvar ONE_SECOND = 1000;\nvar BASE_TEN = 10;\n\nvar ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;\nvar CLOSING_TIME_BUFFER = 1.5;\n\nvar DETECT_CSS_PROPERTIES = {\n  transitionDuration:      TRANSITION_DURATION_PROP,\n  transitionDelay:         TRANSITION_DELAY_PROP,\n  transitionProperty:      TRANSITION_PROP + PROPERTY_KEY,\n  animationDuration:       ANIMATION_DURATION_PROP,\n  animationDelay:          ANIMATION_DELAY_PROP,\n  animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY\n};\n\nvar DETECT_STAGGER_CSS_PROPERTIES = {\n  transitionDuration:      TRANSITION_DURATION_PROP,\n  transitionDelay:         TRANSITION_DELAY_PROP,\n  animationDuration:       ANIMATION_DURATION_PROP,\n  animationDelay:          ANIMATION_DELAY_PROP\n};\n\nfunction getCssKeyframeDurationStyle(duration) {\n  return [ANIMATION_DURATION_PROP, duration + 's'];\n}\n\nfunction getCssDelayStyle(delay, isKeyframeAnimation) {\n  var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP;\n  return [prop, delay + 's'];\n}\n\nfunction computeCssStyles($window, element, properties) {\n  var styles = Object.create(null);\n  var detectedStyles = $window.getComputedStyle(element) || {};\n  forEach(properties, function(formalStyleName, actualStyleName) {\n    var val = detectedStyles[formalStyleName];\n    if (val) {\n      var c = val.charAt(0);\n\n      // only numerical-based values have a negative sign or digit as the first value\n      if (c === '-' || c === '+' || c >= 0) {\n        val = parseMaxTime(val);\n      }\n\n      // by setting this to null in the event that the delay is not set or is set directly as 0\n      // then we can still allow for negative values to be used later on and not mistake this\n      // value for being greater than any other negative value.\n      if (val === 0) {\n        val = null;\n      }\n      styles[actualStyleName] = val;\n    }\n  });\n\n  return styles;\n}\n\nfunction parseMaxTime(str) {\n  var maxValue = 0;\n  var values = str.split(/\\s*,\\s*/);\n  forEach(values, function(value) {\n    // it's always safe to consider only second values and omit `ms` values since\n    // getComputedStyle will always handle the conversion for us\n    if (value.charAt(value.length - 1) == 's') {\n      value = value.substring(0, value.length - 1);\n    }\n    value = parseFloat(value) || 0;\n    maxValue = maxValue ? Math.max(value, maxValue) : value;\n  });\n  return maxValue;\n}\n\nfunction truthyTimingValue(val) {\n  return val === 0 || val != null;\n}\n\nfunction getCssTransitionDurationStyle(duration, applyOnlyDuration) {\n  var style = TRANSITION_PROP;\n  var value = duration + 's';\n  if (applyOnlyDuration) {\n    style += DURATION_KEY;\n  } else {\n    value += ' linear all';\n  }\n  return [style, value];\n}\n\nfunction createLocalCacheLookup() {\n  var cache = Object.create(null);\n  return {\n    flush: function() {\n      cache = Object.create(null);\n    },\n\n    count: function(key) {\n      var entry = cache[key];\n      return entry ? entry.total : 0;\n    },\n\n    get: function(key) {\n      var entry = cache[key];\n      return entry && entry.value;\n    },\n\n    put: function(key, value) {\n      if (!cache[key]) {\n        cache[key] = { total: 1, value: value };\n      } else {\n        cache[key].total++;\n      }\n    }\n  };\n}\n\n// we do not reassign an already present style value since\n// if we detect the style property value again we may be\n// detecting styles that were added via the `from` styles.\n// We make use of `isDefined` here since an empty string\n// or null value (which is what getPropertyValue will return\n// for a non-existing style) will still be marked as a valid\n// value for the style (a falsy value implies that the style\n// is to be removed at the end of the animation). If we had a simple\n// \"OR\" statement then it would not be enough to catch that.\nfunction registerRestorableStyles(backup, node, properties) {\n  forEach(properties, function(prop) {\n    backup[prop] = isDefined(backup[prop])\n        ? backup[prop]\n        : node.style.getPropertyValue(prop);\n  });\n}\n\nvar $AnimateCssProvider = ['$animateProvider', function($animateProvider) {\n  var gcsLookup = createLocalCacheLookup();\n  var gcsStaggerLookup = createLocalCacheLookup();\n\n  this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',\n               '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue',\n       function($window,   $$jqLite,   $$AnimateRunner,   $timeout,\n                $$forceReflow,   $sniffer,   $$rAFScheduler, $$animateQueue) {\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    var parentCounter = 0;\n    function gcsHashFn(node, extraClasses) {\n      var KEY = \"$$ngAnimateParentKey\";\n      var parentNode = node.parentNode;\n      var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter);\n      return parentID + '-' + node.getAttribute('class') + '-' + extraClasses;\n    }\n\n    function computeCachedCssStyles(node, className, cacheKey, properties) {\n      var timings = gcsLookup.get(cacheKey);\n\n      if (!timings) {\n        timings = computeCssStyles($window, node, properties);\n        if (timings.animationIterationCount === 'infinite') {\n          timings.animationIterationCount = 1;\n        }\n      }\n\n      // we keep putting this in multiple times even though the value and the cacheKey are the same\n      // because we're keeping an internal tally of how many duplicate animations are detected.\n      gcsLookup.put(cacheKey, timings);\n      return timings;\n    }\n\n    function computeCachedCssStaggerStyles(node, className, cacheKey, properties) {\n      var stagger;\n\n      // if we have one or more existing matches of matching elements\n      // containing the same parent + CSS styles (which is how cacheKey works)\n      // then staggering is possible\n      if (gcsLookup.count(cacheKey) > 0) {\n        stagger = gcsStaggerLookup.get(cacheKey);\n\n        if (!stagger) {\n          var staggerClassName = pendClasses(className, '-stagger');\n\n          $$jqLite.addClass(node, staggerClassName);\n\n          stagger = computeCssStyles($window, node, properties);\n\n          // force the conversion of a null value to zero incase not set\n          stagger.animationDuration = Math.max(stagger.animationDuration, 0);\n          stagger.transitionDuration = Math.max(stagger.transitionDuration, 0);\n\n          $$jqLite.removeClass(node, staggerClassName);\n\n          gcsStaggerLookup.put(cacheKey, stagger);\n        }\n      }\n\n      return stagger || {};\n    }\n\n    var cancelLastRAFRequest;\n    var rafWaitQueue = [];\n    function waitUntilQuiet(callback) {\n      rafWaitQueue.push(callback);\n      $$rAFScheduler.waitUntilQuiet(function() {\n        gcsLookup.flush();\n        gcsStaggerLookup.flush();\n\n        // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable.\n        // PLEASE EXAMINE THE `$$forceReflow` service to understand why.\n        var pageWidth = $$forceReflow();\n\n        // we use a for loop to ensure that if the queue is changed\n        // during this looping then it will consider new requests\n        for (var i = 0; i < rafWaitQueue.length; i++) {\n          rafWaitQueue[i](pageWidth);\n        }\n        rafWaitQueue.length = 0;\n      });\n    }\n\n    function computeTimings(node, className, cacheKey) {\n      var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES);\n      var aD = timings.animationDelay;\n      var tD = timings.transitionDelay;\n      timings.maxDelay = aD && tD\n          ? Math.max(aD, tD)\n          : (aD || tD);\n      timings.maxDuration = Math.max(\n          timings.animationDuration * timings.animationIterationCount,\n          timings.transitionDuration);\n\n      return timings;\n    }\n\n    return function init(element, initialOptions) {\n      // all of the animation functions should create\n      // a copy of the options data, however, if a\n      // parent service has already created a copy then\n      // we should stick to using that\n      var options = initialOptions || {};\n      if (!options.$$prepared) {\n        options = prepareAnimationOptions(copy(options));\n      }\n\n      var restoreStyles = {};\n      var node = getDomNode(element);\n      if (!node\n          || !node.parentNode\n          || !$$animateQueue.enabled()) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var temporaryStyles = [];\n      var classes = element.attr('class');\n      var styles = packageStyles(options);\n      var animationClosed;\n      var animationPaused;\n      var animationCompleted;\n      var runner;\n      var runnerHost;\n      var maxDelay;\n      var maxDelayTime;\n      var maxDuration;\n      var maxDurationTime;\n      var startTime;\n      var events = [];\n\n      if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var method = options.event && isArray(options.event)\n            ? options.event.join(' ')\n            : options.event;\n\n      var isStructural = method && options.structural;\n      var structuralClassName = '';\n      var addRemoveClassName = '';\n\n      if (isStructural) {\n        structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true);\n      } else if (method) {\n        structuralClassName = method;\n      }\n\n      if (options.addClass) {\n        addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX);\n      }\n\n      if (options.removeClass) {\n        if (addRemoveClassName.length) {\n          addRemoveClassName += ' ';\n        }\n        addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX);\n      }\n\n      // there may be a situation where a structural animation is combined together\n      // with CSS classes that need to resolve before the animation is computed.\n      // However this means that there is no explicit CSS code to block the animation\n      // from happening (by setting 0s none in the class name). If this is the case\n      // we need to apply the classes before the first rAF so we know to continue if\n      // there actually is a detected transition or keyframe animation\n      if (options.applyClassesEarly && addRemoveClassName.length) {\n        applyAnimationClasses(element, options);\n      }\n\n      var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim();\n      var fullClassName = classes + ' ' + preparationClasses;\n      var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);\n      var hasToStyles = styles.to && Object.keys(styles.to).length > 0;\n      var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0;\n\n      // there is no way we can trigger an animation if no styles and\n      // no classes are being applied which would then trigger a transition,\n      // unless there a is raw keyframe value that is applied to the element.\n      if (!containsKeyframeAnimation\n           && !hasToStyles\n           && !preparationClasses) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      var cacheKey, stagger;\n      if (options.stagger > 0) {\n        var staggerVal = parseFloat(options.stagger);\n        stagger = {\n          transitionDelay: staggerVal,\n          animationDelay: staggerVal,\n          transitionDuration: 0,\n          animationDuration: 0\n        };\n      } else {\n        cacheKey = gcsHashFn(node, fullClassName);\n        stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES);\n      }\n\n      if (!options.$$skipPreparationClasses) {\n        $$jqLite.addClass(element, preparationClasses);\n      }\n\n      var applyOnlyDuration;\n\n      if (options.transitionStyle) {\n        var transitionStyle = [TRANSITION_PROP, options.transitionStyle];\n        applyInlineStyle(node, transitionStyle);\n        temporaryStyles.push(transitionStyle);\n      }\n\n      if (options.duration >= 0) {\n        applyOnlyDuration = node.style[TRANSITION_PROP].length > 0;\n        var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration);\n\n        // we set the duration so that it will be picked up by getComputedStyle later\n        applyInlineStyle(node, durationStyle);\n        temporaryStyles.push(durationStyle);\n      }\n\n      if (options.keyframeStyle) {\n        var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle];\n        applyInlineStyle(node, keyframeStyle);\n        temporaryStyles.push(keyframeStyle);\n      }\n\n      var itemIndex = stagger\n          ? options.staggerIndex >= 0\n              ? options.staggerIndex\n              : gcsLookup.count(cacheKey)\n          : 0;\n\n      var isFirst = itemIndex === 0;\n\n      // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY\n      // without causing any combination of transitions to kick in. By adding a negative delay value\n      // it forces the setup class' transition to end immediately. We later then remove the negative\n      // transition delay to allow for the transition to naturally do it's thing. The beauty here is\n      // that if there is no transition defined then nothing will happen and this will also allow\n      // other transitions to be stacked on top of each other without any chopping them out.\n      if (isFirst && !options.skipBlocking) {\n        blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);\n      }\n\n      var timings = computeTimings(node, fullClassName, cacheKey);\n      var relativeDelay = timings.maxDelay;\n      maxDelay = Math.max(relativeDelay, 0);\n      maxDuration = timings.maxDuration;\n\n      var flags = {};\n      flags.hasTransitions          = timings.transitionDuration > 0;\n      flags.hasAnimations           = timings.animationDuration > 0;\n      flags.hasTransitionAll        = flags.hasTransitions && timings.transitionProperty == 'all';\n      flags.applyTransitionDuration = hasToStyles && (\n                                        (flags.hasTransitions && !flags.hasTransitionAll)\n                                         || (flags.hasAnimations && !flags.hasTransitions));\n      flags.applyAnimationDuration  = options.duration && flags.hasAnimations;\n      flags.applyTransitionDelay    = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions);\n      flags.applyAnimationDelay     = truthyTimingValue(options.delay) && flags.hasAnimations;\n      flags.recalculateTimingStyles = addRemoveClassName.length > 0;\n\n      if (flags.applyTransitionDuration || flags.applyAnimationDuration) {\n        maxDuration = options.duration ? parseFloat(options.duration) : maxDuration;\n\n        if (flags.applyTransitionDuration) {\n          flags.hasTransitions = true;\n          timings.transitionDuration = maxDuration;\n          applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0;\n          temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration));\n        }\n\n        if (flags.applyAnimationDuration) {\n          flags.hasAnimations = true;\n          timings.animationDuration = maxDuration;\n          temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration));\n        }\n      }\n\n      if (maxDuration === 0 && !flags.recalculateTimingStyles) {\n        return closeAndReturnNoopAnimator();\n      }\n\n      if (options.delay != null) {\n        var delayStyle;\n        if (typeof options.delay !== \"boolean\") {\n          delayStyle = parseFloat(options.delay);\n          // number in options.delay means we have to recalculate the delay for the closing timeout\n          maxDelay = Math.max(delayStyle, 0);\n        }\n\n        if (flags.applyTransitionDelay) {\n          temporaryStyles.push(getCssDelayStyle(delayStyle));\n        }\n\n        if (flags.applyAnimationDelay) {\n          temporaryStyles.push(getCssDelayStyle(delayStyle, true));\n        }\n      }\n\n      // we need to recalculate the delay value since we used a pre-emptive negative\n      // delay value and the delay value is required for the final event checking. This\n      // property will ensure that this will happen after the RAF phase has passed.\n      if (options.duration == null && timings.transitionDuration > 0) {\n        flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst;\n      }\n\n      maxDelayTime = maxDelay * ONE_SECOND;\n      maxDurationTime = maxDuration * ONE_SECOND;\n      if (!options.skipBlocking) {\n        flags.blockTransition = timings.transitionDuration > 0;\n        flags.blockKeyframeAnimation = timings.animationDuration > 0 &&\n                                       stagger.animationDelay > 0 &&\n                                       stagger.animationDuration === 0;\n      }\n\n      if (options.from) {\n        if (options.cleanupStyles) {\n          registerRestorableStyles(restoreStyles, node, Object.keys(options.from));\n        }\n        applyAnimationFromStyles(element, options);\n      }\n\n      if (flags.blockTransition || flags.blockKeyframeAnimation) {\n        applyBlocking(maxDuration);\n      } else if (!options.skipBlocking) {\n        blockTransitions(node, false);\n      }\n\n      // TODO(matsko): for 1.5 change this code to have an animator object for better debugging\n      return {\n        $$willAnimate: true,\n        end: endFn,\n        start: function() {\n          if (animationClosed) return;\n\n          runnerHost = {\n            end: endFn,\n            cancel: cancelFn,\n            resume: null, //this will be set during the start() phase\n            pause: null\n          };\n\n          runner = new $$AnimateRunner(runnerHost);\n\n          waitUntilQuiet(start);\n\n          // we don't have access to pause/resume the animation\n          // since it hasn't run yet. AnimateRunner will therefore\n          // set noop functions for resume and pause and they will\n          // later be overridden once the animation is triggered\n          return runner;\n        }\n      };\n\n      function endFn() {\n        close();\n      }\n\n      function cancelFn() {\n        close(true);\n      }\n\n      function close(rejected) { // jshint ignore:line\n        // if the promise has been called already then we shouldn't close\n        // the animation again\n        if (animationClosed || (animationCompleted && animationPaused)) return;\n        animationClosed = true;\n        animationPaused = false;\n\n        if (!options.$$skipPreparationClasses) {\n          $$jqLite.removeClass(element, preparationClasses);\n        }\n        $$jqLite.removeClass(element, activeClasses);\n\n        blockKeyframeAnimations(node, false);\n        blockTransitions(node, false);\n\n        forEach(temporaryStyles, function(entry) {\n          // There is only one way to remove inline style properties entirely from elements.\n          // By using `removeProperty` this works, but we need to convert camel-cased CSS\n          // styles down to hyphenated values.\n          node.style[entry[0]] = '';\n        });\n\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n\n        if (Object.keys(restoreStyles).length) {\n          forEach(restoreStyles, function(value, prop) {\n            value ? node.style.setProperty(prop, value)\n                  : node.style.removeProperty(prop);\n          });\n        }\n\n        // the reason why we have this option is to allow a synchronous closing callback\n        // that is fired as SOON as the animation ends (when the CSS is removed) or if\n        // the animation never takes off at all. A good example is a leave animation since\n        // the element must be removed just after the animation is over or else the element\n        // will appear on screen for one animation frame causing an overbearing flicker.\n        if (options.onDone) {\n          options.onDone();\n        }\n\n        if (events && events.length) {\n          // Remove the transitionend / animationend listener(s)\n          element.off(events.join(' '), onAnimationProgress);\n        }\n\n        //Cancel the fallback closing timeout and remove the timer data\n        var animationTimerData = element.data(ANIMATE_TIMER_KEY);\n        if (animationTimerData) {\n          $timeout.cancel(animationTimerData[0].timer);\n          element.removeData(ANIMATE_TIMER_KEY);\n        }\n\n        // if the preparation function fails then the promise is not setup\n        if (runner) {\n          runner.complete(!rejected);\n        }\n      }\n\n      function applyBlocking(duration) {\n        if (flags.blockTransition) {\n          blockTransitions(node, duration);\n        }\n\n        if (flags.blockKeyframeAnimation) {\n          blockKeyframeAnimations(node, !!duration);\n        }\n      }\n\n      function closeAndReturnNoopAnimator() {\n        runner = new $$AnimateRunner({\n          end: endFn,\n          cancel: cancelFn\n        });\n\n        // should flush the cache animation\n        waitUntilQuiet(noop);\n        close();\n\n        return {\n          $$willAnimate: false,\n          start: function() {\n            return runner;\n          },\n          end: endFn\n        };\n      }\n\n      function onAnimationProgress(event) {\n        event.stopPropagation();\n        var ev = event.originalEvent || event;\n\n        // we now always use `Date.now()` due to the recent changes with\n        // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info)\n        var timeStamp = ev.$manualTimeStamp || Date.now();\n\n        /* Firefox (or possibly just Gecko) likes to not round values up\n         * when a ms measurement is used for the animation */\n        var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));\n\n        /* $manualTimeStamp is a mocked timeStamp value which is set\n         * within browserTrigger(). This is only here so that tests can\n         * mock animations properly. Real events fallback to event.timeStamp,\n         * or, if they don't, then a timeStamp is automatically created for them.\n         * We're checking to see if the timeStamp surpasses the expected delay,\n         * but we're using elapsedTime instead of the timeStamp on the 2nd\n         * pre-condition since animationPauseds sometimes close off early */\n        if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {\n          // we set this flag to ensure that if the transition is paused then, when resumed,\n          // the animation will automatically close itself since transitions cannot be paused.\n          animationCompleted = true;\n          close();\n        }\n      }\n\n      function start() {\n        if (animationClosed) return;\n        if (!node.parentNode) {\n          close();\n          return;\n        }\n\n        // even though we only pause keyframe animations here the pause flag\n        // will still happen when transitions are used. Only the transition will\n        // not be paused since that is not possible. If the animation ends when\n        // paused then it will not complete until unpaused or cancelled.\n        var playPause = function(playAnimation) {\n          if (!animationCompleted) {\n            animationPaused = !playAnimation;\n            if (timings.animationDuration) {\n              var value = blockKeyframeAnimations(node, animationPaused);\n              animationPaused\n                  ? temporaryStyles.push(value)\n                  : removeFromArray(temporaryStyles, value);\n            }\n          } else if (animationPaused && playAnimation) {\n            animationPaused = false;\n            close();\n          }\n        };\n\n        // checking the stagger duration prevents an accidentally cascade of the CSS delay style\n        // being inherited from the parent. If the transition duration is zero then we can safely\n        // rely that the delay value is an intentional stagger delay style.\n        var maxStagger = itemIndex > 0\n                         && ((timings.transitionDuration && stagger.transitionDuration === 0) ||\n                            (timings.animationDuration && stagger.animationDuration === 0))\n                         && Math.max(stagger.animationDelay, stagger.transitionDelay);\n        if (maxStagger) {\n          $timeout(triggerAnimationStart,\n                   Math.floor(maxStagger * itemIndex * ONE_SECOND),\n                   false);\n        } else {\n          triggerAnimationStart();\n        }\n\n        // this will decorate the existing promise runner with pause/resume methods\n        runnerHost.resume = function() {\n          playPause(true);\n        };\n\n        runnerHost.pause = function() {\n          playPause(false);\n        };\n\n        function triggerAnimationStart() {\n          // just incase a stagger animation kicks in when the animation\n          // itself was cancelled entirely\n          if (animationClosed) return;\n\n          applyBlocking(false);\n\n          forEach(temporaryStyles, function(entry) {\n            var key = entry[0];\n            var value = entry[1];\n            node.style[key] = value;\n          });\n\n          applyAnimationClasses(element, options);\n          $$jqLite.addClass(element, activeClasses);\n\n          if (flags.recalculateTimingStyles) {\n            fullClassName = node.className + ' ' + preparationClasses;\n            cacheKey = gcsHashFn(node, fullClassName);\n\n            timings = computeTimings(node, fullClassName, cacheKey);\n            relativeDelay = timings.maxDelay;\n            maxDelay = Math.max(relativeDelay, 0);\n            maxDuration = timings.maxDuration;\n\n            if (maxDuration === 0) {\n              close();\n              return;\n            }\n\n            flags.hasTransitions = timings.transitionDuration > 0;\n            flags.hasAnimations = timings.animationDuration > 0;\n          }\n\n          if (flags.applyAnimationDelay) {\n            relativeDelay = typeof options.delay !== \"boolean\" && truthyTimingValue(options.delay)\n                  ? parseFloat(options.delay)\n                  : relativeDelay;\n\n            maxDelay = Math.max(relativeDelay, 0);\n            timings.animationDelay = relativeDelay;\n            delayStyle = getCssDelayStyle(relativeDelay, true);\n            temporaryStyles.push(delayStyle);\n            node.style[delayStyle[0]] = delayStyle[1];\n          }\n\n          maxDelayTime = maxDelay * ONE_SECOND;\n          maxDurationTime = maxDuration * ONE_SECOND;\n\n          if (options.easing) {\n            var easeProp, easeVal = options.easing;\n            if (flags.hasTransitions) {\n              easeProp = TRANSITION_PROP + TIMING_KEY;\n              temporaryStyles.push([easeProp, easeVal]);\n              node.style[easeProp] = easeVal;\n            }\n            if (flags.hasAnimations) {\n              easeProp = ANIMATION_PROP + TIMING_KEY;\n              temporaryStyles.push([easeProp, easeVal]);\n              node.style[easeProp] = easeVal;\n            }\n          }\n\n          if (timings.transitionDuration) {\n            events.push(TRANSITIONEND_EVENT);\n          }\n\n          if (timings.animationDuration) {\n            events.push(ANIMATIONEND_EVENT);\n          }\n\n          startTime = Date.now();\n          var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime;\n          var endTime = startTime + timerTime;\n\n          var animationsData = element.data(ANIMATE_TIMER_KEY) || [];\n          var setupFallbackTimer = true;\n          if (animationsData.length) {\n            var currentTimerData = animationsData[0];\n            setupFallbackTimer = endTime > currentTimerData.expectedEndTime;\n            if (setupFallbackTimer) {\n              $timeout.cancel(currentTimerData.timer);\n            } else {\n              animationsData.push(close);\n            }\n          }\n\n          if (setupFallbackTimer) {\n            var timer = $timeout(onAnimationExpired, timerTime, false);\n            animationsData[0] = {\n              timer: timer,\n              expectedEndTime: endTime\n            };\n            animationsData.push(close);\n            element.data(ANIMATE_TIMER_KEY, animationsData);\n          }\n\n          if (events.length) {\n            element.on(events.join(' '), onAnimationProgress);\n          }\n\n          if (options.to) {\n            if (options.cleanupStyles) {\n              registerRestorableStyles(restoreStyles, node, Object.keys(options.to));\n            }\n            applyAnimationToStyles(element, options);\n          }\n        }\n\n        function onAnimationExpired() {\n          var animationsData = element.data(ANIMATE_TIMER_KEY);\n\n          // this will be false in the event that the element was\n          // removed from the DOM (via a leave animation or something\n          // similar)\n          if (animationsData) {\n            for (var i = 1; i < animationsData.length; i++) {\n              animationsData[i]();\n            }\n            element.removeData(ANIMATE_TIMER_KEY);\n          }\n        }\n      }\n    };\n  }];\n}];\n\nvar $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) {\n  $$animationProvider.drivers.push('$$animateCssDriver');\n\n  var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim';\n  var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor';\n\n  var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out';\n  var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in';\n\n  function isDocumentFragment(node) {\n    return node.parentNode && node.parentNode.nodeType === 11;\n  }\n\n  this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document',\n       function($animateCss,   $rootScope,   $$AnimateRunner,   $rootElement,   $sniffer,   $$jqLite,   $document) {\n\n    // only browsers that support these properties can render animations\n    if (!$sniffer.animations && !$sniffer.transitions) return noop;\n\n    var bodyNode = $document[0].body;\n    var rootNode = getDomNode($rootElement);\n\n    var rootBodyElement = jqLite(\n      // this is to avoid using something that exists outside of the body\n      // we also special case the doc fragment case because our unit test code\n      // appends the $rootElement to the body after the app has been bootstrapped\n      isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode\n    );\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    return function initDriverFn(animationDetails) {\n      return animationDetails.from && animationDetails.to\n          ? prepareFromToAnchorAnimation(animationDetails.from,\n                                         animationDetails.to,\n                                         animationDetails.classes,\n                                         animationDetails.anchors)\n          : prepareRegularAnimation(animationDetails);\n    };\n\n    function filterCssClasses(classes) {\n      //remove all the `ng-` stuff\n      return classes.replace(/\\bng-\\S+\\b/g, '');\n    }\n\n    function getUniqueValues(a, b) {\n      if (isString(a)) a = a.split(' ');\n      if (isString(b)) b = b.split(' ');\n      return a.filter(function(val) {\n        return b.indexOf(val) === -1;\n      }).join(' ');\n    }\n\n    function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {\n      var clone = jqLite(getDomNode(outAnchor).cloneNode(true));\n      var startingClasses = filterCssClasses(getClassVal(clone));\n\n      outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);\n      inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);\n\n      clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);\n\n      rootBodyElement.append(clone);\n\n      var animatorIn, animatorOut = prepareOutAnimation();\n\n      // the user may not end up using the `out` animation and\n      // only making use of the `in` animation or vice-versa.\n      // In either case we should allow this and not assume the\n      // animation is over unless both animations are not used.\n      if (!animatorOut) {\n        animatorIn = prepareInAnimation();\n        if (!animatorIn) {\n          return end();\n        }\n      }\n\n      var startingAnimator = animatorOut || animatorIn;\n\n      return {\n        start: function() {\n          var runner;\n\n          var currentAnimation = startingAnimator.start();\n          currentAnimation.done(function() {\n            currentAnimation = null;\n            if (!animatorIn) {\n              animatorIn = prepareInAnimation();\n              if (animatorIn) {\n                currentAnimation = animatorIn.start();\n                currentAnimation.done(function() {\n                  currentAnimation = null;\n                  end();\n                  runner.complete();\n                });\n                return currentAnimation;\n              }\n            }\n            // in the event that there is no `in` animation\n            end();\n            runner.complete();\n          });\n\n          runner = new $$AnimateRunner({\n            end: endFn,\n            cancel: endFn\n          });\n\n          return runner;\n\n          function endFn() {\n            if (currentAnimation) {\n              currentAnimation.end();\n            }\n          }\n        }\n      };\n\n      function calculateAnchorStyles(anchor) {\n        var styles = {};\n\n        var coords = getDomNode(anchor).getBoundingClientRect();\n\n        // we iterate directly since safari messes up and doesn't return\n        // all the keys for the coords object when iterated\n        forEach(['width','height','top','left'], function(key) {\n          var value = coords[key];\n          switch (key) {\n            case 'top':\n              value += bodyNode.scrollTop;\n              break;\n            case 'left':\n              value += bodyNode.scrollLeft;\n              break;\n          }\n          styles[key] = Math.floor(value) + 'px';\n        });\n        return styles;\n      }\n\n      function prepareOutAnimation() {\n        var animator = $animateCss(clone, {\n          addClass: NG_OUT_ANCHOR_CLASS_NAME,\n          delay: true,\n          from: calculateAnchorStyles(outAnchor)\n        });\n\n        // read the comment within `prepareRegularAnimation` to understand\n        // why this check is necessary\n        return animator.$$willAnimate ? animator : null;\n      }\n\n      function getClassVal(element) {\n        return element.attr('class') || '';\n      }\n\n      function prepareInAnimation() {\n        var endingClasses = filterCssClasses(getClassVal(inAnchor));\n        var toAdd = getUniqueValues(endingClasses, startingClasses);\n        var toRemove = getUniqueValues(startingClasses, endingClasses);\n\n        var animator = $animateCss(clone, {\n          to: calculateAnchorStyles(inAnchor),\n          addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd,\n          removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove,\n          delay: true\n        });\n\n        // read the comment within `prepareRegularAnimation` to understand\n        // why this check is necessary\n        return animator.$$willAnimate ? animator : null;\n      }\n\n      function end() {\n        clone.remove();\n        outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);\n        inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);\n      }\n    }\n\n    function prepareFromToAnchorAnimation(from, to, classes, anchors) {\n      var fromAnimation = prepareRegularAnimation(from, noop);\n      var toAnimation = prepareRegularAnimation(to, noop);\n\n      var anchorAnimations = [];\n      forEach(anchors, function(anchor) {\n        var outElement = anchor['out'];\n        var inElement = anchor['in'];\n        var animator = prepareAnchoredAnimation(classes, outElement, inElement);\n        if (animator) {\n          anchorAnimations.push(animator);\n        }\n      });\n\n      // no point in doing anything when there are no elements to animate\n      if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return;\n\n      return {\n        start: function() {\n          var animationRunners = [];\n\n          if (fromAnimation) {\n            animationRunners.push(fromAnimation.start());\n          }\n\n          if (toAnimation) {\n            animationRunners.push(toAnimation.start());\n          }\n\n          forEach(anchorAnimations, function(animation) {\n            animationRunners.push(animation.start());\n          });\n\n          var runner = new $$AnimateRunner({\n            end: endFn,\n            cancel: endFn // CSS-driven animations cannot be cancelled, only ended\n          });\n\n          $$AnimateRunner.all(animationRunners, function(status) {\n            runner.complete(status);\n          });\n\n          return runner;\n\n          function endFn() {\n            forEach(animationRunners, function(runner) {\n              runner.end();\n            });\n          }\n        }\n      };\n    }\n\n    function prepareRegularAnimation(animationDetails) {\n      var element = animationDetails.element;\n      var options = animationDetails.options || {};\n\n      if (animationDetails.structural) {\n        options.event = animationDetails.event;\n        options.structural = true;\n        options.applyClassesEarly = true;\n\n        // we special case the leave animation since we want to ensure that\n        // the element is removed as soon as the animation is over. Otherwise\n        // a flicker might appear or the element may not be removed at all\n        if (animationDetails.event === 'leave') {\n          options.onDone = options.domOperation;\n        }\n      }\n\n      // We assign the preparationClasses as the actual animation event since\n      // the internals of $animateCss will just suffix the event token values\n      // with `-active` to trigger the animation.\n      if (options.preparationClasses) {\n        options.event = concatWithSpace(options.event, options.preparationClasses);\n      }\n\n      var animator = $animateCss(element, options);\n\n      // the driver lookup code inside of $$animation attempts to spawn a\n      // driver one by one until a driver returns a.$$willAnimate animator object.\n      // $animateCss will always return an object, however, it will pass in\n      // a flag as a hint as to whether an animation was detected or not\n      return animator.$$willAnimate ? animator : null;\n    }\n  }];\n}];\n\n// TODO(matsko): use caching here to speed things up for detection\n// TODO(matsko): add documentation\n//  by the time...\n\nvar $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {\n  this.$get = ['$injector', '$$AnimateRunner', '$$jqLite',\n       function($injector,   $$AnimateRunner,   $$jqLite) {\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n         // $animateJs(element, 'enter');\n    return function(element, event, classes, options) {\n      var animationClosed = false;\n\n      // the `classes` argument is optional and if it is not used\n      // then the classes will be resolved from the element's className\n      // property as well as options.addClass/options.removeClass.\n      if (arguments.length === 3 && isObject(classes)) {\n        options = classes;\n        classes = null;\n      }\n\n      options = prepareAnimationOptions(options);\n      if (!classes) {\n        classes = element.attr('class') || '';\n        if (options.addClass) {\n          classes += ' ' + options.addClass;\n        }\n        if (options.removeClass) {\n          classes += ' ' + options.removeClass;\n        }\n      }\n\n      var classesToAdd = options.addClass;\n      var classesToRemove = options.removeClass;\n\n      // the lookupAnimations function returns a series of animation objects that are\n      // matched up with one or more of the CSS classes. These animation objects are\n      // defined via the module.animation factory function. If nothing is detected then\n      // we don't return anything which then makes $animation query the next driver.\n      var animations = lookupAnimations(classes);\n      var before, after;\n      if (animations.length) {\n        var afterFn, beforeFn;\n        if (event == 'leave') {\n          beforeFn = 'leave';\n          afterFn = 'afterLeave'; // TODO(matsko): get rid of this\n        } else {\n          beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1);\n          afterFn = event;\n        }\n\n        if (event !== 'enter' && event !== 'move') {\n          before = packageAnimations(element, event, options, animations, beforeFn);\n        }\n        after  = packageAnimations(element, event, options, animations, afterFn);\n      }\n\n      // no matching animations\n      if (!before && !after) return;\n\n      function applyOptions() {\n        options.domOperation();\n        applyAnimationClasses(element, options);\n      }\n\n      function close() {\n        animationClosed = true;\n        applyOptions();\n        applyAnimationStyles(element, options);\n      }\n\n      var runner;\n\n      return {\n        $$willAnimate: true,\n        end: function() {\n          if (runner) {\n            runner.end();\n          } else {\n            close();\n            runner = new $$AnimateRunner();\n            runner.complete(true);\n          }\n          return runner;\n        },\n        start: function() {\n          if (runner) {\n            return runner;\n          }\n\n          runner = new $$AnimateRunner();\n          var closeActiveAnimations;\n          var chain = [];\n\n          if (before) {\n            chain.push(function(fn) {\n              closeActiveAnimations = before(fn);\n            });\n          }\n\n          if (chain.length) {\n            chain.push(function(fn) {\n              applyOptions();\n              fn(true);\n            });\n          } else {\n            applyOptions();\n          }\n\n          if (after) {\n            chain.push(function(fn) {\n              closeActiveAnimations = after(fn);\n            });\n          }\n\n          runner.setHost({\n            end: function() {\n              endAnimations();\n            },\n            cancel: function() {\n              endAnimations(true);\n            }\n          });\n\n          $$AnimateRunner.chain(chain, onComplete);\n          return runner;\n\n          function onComplete(success) {\n            close(success);\n            runner.complete(success);\n          }\n\n          function endAnimations(cancelled) {\n            if (!animationClosed) {\n              (closeActiveAnimations || noop)(cancelled);\n              onComplete(cancelled);\n            }\n          }\n        }\n      };\n\n      function executeAnimationFn(fn, element, event, options, onDone) {\n        var args;\n        switch (event) {\n          case 'animate':\n            args = [element, options.from, options.to, onDone];\n            break;\n\n          case 'setClass':\n            args = [element, classesToAdd, classesToRemove, onDone];\n            break;\n\n          case 'addClass':\n            args = [element, classesToAdd, onDone];\n            break;\n\n          case 'removeClass':\n            args = [element, classesToRemove, onDone];\n            break;\n\n          default:\n            args = [element, onDone];\n            break;\n        }\n\n        args.push(options);\n\n        var value = fn.apply(fn, args);\n        if (value) {\n          if (isFunction(value.start)) {\n            value = value.start();\n          }\n\n          if (value instanceof $$AnimateRunner) {\n            value.done(onDone);\n          } else if (isFunction(value)) {\n            // optional onEnd / onCancel callback\n            return value;\n          }\n        }\n\n        return noop;\n      }\n\n      function groupEventedAnimations(element, event, options, animations, fnName) {\n        var operations = [];\n        forEach(animations, function(ani) {\n          var animation = ani[fnName];\n          if (!animation) return;\n\n          // note that all of these animations will run in parallel\n          operations.push(function() {\n            var runner;\n            var endProgressCb;\n\n            var resolved = false;\n            var onAnimationComplete = function(rejected) {\n              if (!resolved) {\n                resolved = true;\n                (endProgressCb || noop)(rejected);\n                runner.complete(!rejected);\n              }\n            };\n\n            runner = new $$AnimateRunner({\n              end: function() {\n                onAnimationComplete();\n              },\n              cancel: function() {\n                onAnimationComplete(true);\n              }\n            });\n\n            endProgressCb = executeAnimationFn(animation, element, event, options, function(result) {\n              var cancelled = result === false;\n              onAnimationComplete(cancelled);\n            });\n\n            return runner;\n          });\n        });\n\n        return operations;\n      }\n\n      function packageAnimations(element, event, options, animations, fnName) {\n        var operations = groupEventedAnimations(element, event, options, animations, fnName);\n        if (operations.length === 0) {\n          var a,b;\n          if (fnName === 'beforeSetClass') {\n            a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass');\n            b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass');\n          } else if (fnName === 'setClass') {\n            a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass');\n            b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass');\n          }\n\n          if (a) {\n            operations = operations.concat(a);\n          }\n          if (b) {\n            operations = operations.concat(b);\n          }\n        }\n\n        if (operations.length === 0) return;\n\n        // TODO(matsko): add documentation\n        return function startAnimation(callback) {\n          var runners = [];\n          if (operations.length) {\n            forEach(operations, function(animateFn) {\n              runners.push(animateFn());\n            });\n          }\n\n          runners.length ? $$AnimateRunner.all(runners, callback) : callback();\n\n          return function endFn(reject) {\n            forEach(runners, function(runner) {\n              reject ? runner.cancel() : runner.end();\n            });\n          };\n        };\n      }\n    };\n\n    function lookupAnimations(classes) {\n      classes = isArray(classes) ? classes : classes.split(' ');\n      var matches = [], flagMap = {};\n      for (var i=0; i < classes.length; i++) {\n        var klass = classes[i],\n            animationFactory = $animateProvider.$$registeredAnimations[klass];\n        if (animationFactory && !flagMap[klass]) {\n          matches.push($injector.get(animationFactory));\n          flagMap[klass] = true;\n        }\n      }\n      return matches;\n    }\n  }];\n}];\n\nvar $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) {\n  $$animationProvider.drivers.push('$$animateJsDriver');\n  this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {\n    return function initDriverFn(animationDetails) {\n      if (animationDetails.from && animationDetails.to) {\n        var fromAnimation = prepareAnimation(animationDetails.from);\n        var toAnimation = prepareAnimation(animationDetails.to);\n        if (!fromAnimation && !toAnimation) return;\n\n        return {\n          start: function() {\n            var animationRunners = [];\n\n            if (fromAnimation) {\n              animationRunners.push(fromAnimation.start());\n            }\n\n            if (toAnimation) {\n              animationRunners.push(toAnimation.start());\n            }\n\n            $$AnimateRunner.all(animationRunners, done);\n\n            var runner = new $$AnimateRunner({\n              end: endFnFactory(),\n              cancel: endFnFactory()\n            });\n\n            return runner;\n\n            function endFnFactory() {\n              return function() {\n                forEach(animationRunners, function(runner) {\n                  // at this point we cannot cancel animations for groups just yet. 1.5+\n                  runner.end();\n                });\n              };\n            }\n\n            function done(status) {\n              runner.complete(status);\n            }\n          }\n        };\n      } else {\n        return prepareAnimation(animationDetails);\n      }\n    };\n\n    function prepareAnimation(animationDetails) {\n      // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations\n      var element = animationDetails.element;\n      var event = animationDetails.event;\n      var options = animationDetails.options;\n      var classes = animationDetails.classes;\n      return $$animateJs(element, event, classes, options);\n    }\n  }];\n}];\n\nvar NG_ANIMATE_ATTR_NAME = 'data-ng-animate';\nvar NG_ANIMATE_PIN_DATA = '$ngAnimatePin';\nvar $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {\n  var PRE_DIGEST_STATE = 1;\n  var RUNNING_STATE = 2;\n  var ONE_SPACE = ' ';\n\n  var rules = this.rules = {\n    skip: [],\n    cancel: [],\n    join: []\n  };\n\n  function makeTruthyCssClassMap(classString) {\n    if (!classString) {\n      return null;\n    }\n\n    var keys = classString.split(ONE_SPACE);\n    var map = Object.create(null);\n\n    forEach(keys, function(key) {\n      map[key] = true;\n    });\n    return map;\n  }\n\n  function hasMatchingClasses(newClassString, currentClassString) {\n    if (newClassString && currentClassString) {\n      var currentClassMap = makeTruthyCssClassMap(currentClassString);\n      return newClassString.split(ONE_SPACE).some(function(className) {\n        return currentClassMap[className];\n      });\n    }\n  }\n\n  function isAllowed(ruleType, element, currentAnimation, previousAnimation) {\n    return rules[ruleType].some(function(fn) {\n      return fn(element, currentAnimation, previousAnimation);\n    });\n  }\n\n  function hasAnimationClasses(animation, and) {\n    var a = (animation.addClass || '').length > 0;\n    var b = (animation.removeClass || '').length > 0;\n    return and ? a && b : a || b;\n  }\n\n  rules.join.push(function(element, newAnimation, currentAnimation) {\n    // if the new animation is class-based then we can just tack that on\n    return !newAnimation.structural && hasAnimationClasses(newAnimation);\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // there is no need to animate anything if no classes are being added and\n    // there is no structural animation that will be triggered\n    return !newAnimation.structural && !hasAnimationClasses(newAnimation);\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // why should we trigger a new structural animation if the element will\n    // be removed from the DOM anyway?\n    return currentAnimation.event == 'leave' && newAnimation.structural;\n  });\n\n  rules.skip.push(function(element, newAnimation, currentAnimation) {\n    // if there is an ongoing current animation then don't even bother running the class-based animation\n    return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // there can never be two structural animations running at the same time\n    return currentAnimation.structural && newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // if the previous animation is already running, but the new animation will\n    // be triggered, but the new animation is structural\n    return currentAnimation.state === RUNNING_STATE && newAnimation.structural;\n  });\n\n  rules.cancel.push(function(element, newAnimation, currentAnimation) {\n    // cancel the animation if classes added / removed in both animation cancel each other out,\n    // but only if the current animation isn't structural\n\n    if (currentAnimation.structural) return false;\n\n    var nA = newAnimation.addClass;\n    var nR = newAnimation.removeClass;\n    var cA = currentAnimation.addClass;\n    var cR = currentAnimation.removeClass;\n\n    // early detection to save the global CPU shortage :)\n    if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) {\n      return false;\n    }\n\n    return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA);\n  });\n\n  this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',\n               '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow',\n       function($$rAF,   $rootScope,   $rootElement,   $document,   $$HashMap,\n                $$animation,   $$AnimateRunner,   $templateRequest,   $$jqLite,   $$forceReflow) {\n\n    var activeAnimationsLookup = new $$HashMap();\n    var disabledElementsLookup = new $$HashMap();\n    var animationsEnabled = null;\n\n    function postDigestTaskFactory() {\n      var postDigestCalled = false;\n      return function(fn) {\n        // we only issue a call to postDigest before\n        // it has first passed. This prevents any callbacks\n        // from not firing once the animation has completed\n        // since it will be out of the digest cycle.\n        if (postDigestCalled) {\n          fn();\n        } else {\n          $rootScope.$$postDigest(function() {\n            postDigestCalled = true;\n            fn();\n          });\n        }\n      };\n    }\n\n    // Wait until all directive and route-related templates are downloaded and\n    // compiled. The $templateRequest.totalPendingRequests variable keeps track of\n    // all of the remote templates being currently downloaded. If there are no\n    // templates currently downloading then the watcher will still fire anyway.\n    var deregisterWatch = $rootScope.$watch(\n      function() { return $templateRequest.totalPendingRequests === 0; },\n      function(isEmpty) {\n        if (!isEmpty) return;\n        deregisterWatch();\n\n        // Now that all templates have been downloaded, $animate will wait until\n        // the post digest queue is empty before enabling animations. By having two\n        // calls to $postDigest calls we can ensure that the flag is enabled at the\n        // very end of the post digest queue. Since all of the animations in $animate\n        // use $postDigest, it's important that the code below executes at the end.\n        // This basically means that the page is fully downloaded and compiled before\n        // any animations are triggered.\n        $rootScope.$$postDigest(function() {\n          $rootScope.$$postDigest(function() {\n            // we check for null directly in the event that the application already called\n            // .enabled() with whatever arguments that it provided it with\n            if (animationsEnabled === null) {\n              animationsEnabled = true;\n            }\n          });\n        });\n      }\n    );\n\n    var callbackRegistry = {};\n\n    // remember that the classNameFilter is set during the provider/config\n    // stage therefore we can optimize here and setup a helper function\n    var classNameFilter = $animateProvider.classNameFilter();\n    var isAnimatableClassName = !classNameFilter\n              ? function() { return true; }\n              : function(className) {\n                return classNameFilter.test(className);\n              };\n\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    function normalizeAnimationDetails(element, animation) {\n      return mergeAnimationDetails(element, animation, {});\n    }\n\n    // IE9-11 has no method \"contains\" in SVG element and in Node.prototype. Bug #10259.\n    var contains = Node.prototype.contains || function(arg) {\n      // jshint bitwise: false\n      return this === arg || !!(this.compareDocumentPosition(arg) & 16);\n      // jshint bitwise: true\n    };\n\n    function findCallbacks(parent, element, event) {\n      var targetNode = getDomNode(element);\n      var targetParentNode = getDomNode(parent);\n\n      var matches = [];\n      var entries = callbackRegistry[event];\n      if (entries) {\n        forEach(entries, function(entry) {\n          if (contains.call(entry.node, targetNode)) {\n            matches.push(entry.callback);\n          } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) {\n            matches.push(entry.callback);\n          }\n        });\n      }\n\n      return matches;\n    }\n\n    var $animate = {\n      on: function(event, container, callback) {\n        var node = extractElementNode(container);\n        callbackRegistry[event] = callbackRegistry[event] || [];\n        callbackRegistry[event].push({\n          node: node,\n          callback: callback\n        });\n\n        // Remove the callback when the element is removed from the DOM\n        jqLite(container).on('$destroy', function() {\n          $animate.off(event, container, callback);\n        });\n      },\n\n      off: function(event, container, callback) {\n        var entries = callbackRegistry[event];\n        if (!entries) return;\n\n        callbackRegistry[event] = arguments.length === 1\n            ? null\n            : filterFromRegistry(entries, container, callback);\n\n        function filterFromRegistry(list, matchContainer, matchCallback) {\n          var containerNode = extractElementNode(matchContainer);\n          return list.filter(function(entry) {\n            var isMatch = entry.node === containerNode &&\n                            (!matchCallback || entry.callback === matchCallback);\n            return !isMatch;\n          });\n        }\n      },\n\n      pin: function(element, parentElement) {\n        assertArg(isElement(element), 'element', 'not an element');\n        assertArg(isElement(parentElement), 'parentElement', 'not an element');\n        element.data(NG_ANIMATE_PIN_DATA, parentElement);\n      },\n\n      push: function(element, event, options, domOperation) {\n        options = options || {};\n        options.domOperation = domOperation;\n        return queueAnimation(element, event, options);\n      },\n\n      // this method has four signatures:\n      //  () - global getter\n      //  (bool) - global setter\n      //  (element) - element getter\n      //  (element, bool) - element setter<F37>\n      enabled: function(element, bool) {\n        var argCount = arguments.length;\n\n        if (argCount === 0) {\n          // () - Global getter\n          bool = !!animationsEnabled;\n        } else {\n          var hasElement = isElement(element);\n\n          if (!hasElement) {\n            // (bool) - Global setter\n            bool = animationsEnabled = !!element;\n          } else {\n            var node = getDomNode(element);\n            var recordExists = disabledElementsLookup.get(node);\n\n            if (argCount === 1) {\n              // (element) - Element getter\n              bool = !recordExists;\n            } else {\n              // (element, bool) - Element setter\n              disabledElementsLookup.put(node, !bool);\n            }\n          }\n        }\n\n        return bool;\n      }\n    };\n\n    return $animate;\n\n    function queueAnimation(element, event, initialOptions) {\n      // we always make a copy of the options since\n      // there should never be any side effects on\n      // the input data when running `$animateCss`.\n      var options = copy(initialOptions);\n\n      var node, parent;\n      element = stripCommentsFromElement(element);\n      if (element) {\n        node = getDomNode(element);\n        parent = element.parent();\n      }\n\n      options = prepareAnimationOptions(options);\n\n      // we create a fake runner with a working promise.\n      // These methods will become available after the digest has passed\n      var runner = new $$AnimateRunner();\n\n      // this is used to trigger callbacks in postDigest mode\n      var runInNextPostDigestOrNow = postDigestTaskFactory();\n\n      if (isArray(options.addClass)) {\n        options.addClass = options.addClass.join(' ');\n      }\n\n      if (options.addClass && !isString(options.addClass)) {\n        options.addClass = null;\n      }\n\n      if (isArray(options.removeClass)) {\n        options.removeClass = options.removeClass.join(' ');\n      }\n\n      if (options.removeClass && !isString(options.removeClass)) {\n        options.removeClass = null;\n      }\n\n      if (options.from && !isObject(options.from)) {\n        options.from = null;\n      }\n\n      if (options.to && !isObject(options.to)) {\n        options.to = null;\n      }\n\n      // there are situations where a directive issues an animation for\n      // a jqLite wrapper that contains only comment nodes... If this\n      // happens then there is no way we can perform an animation\n      if (!node) {\n        close();\n        return runner;\n      }\n\n      var className = [node.className, options.addClass, options.removeClass].join(' ');\n      if (!isAnimatableClassName(className)) {\n        close();\n        return runner;\n      }\n\n      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;\n\n      // this is a hard disable of all animations for the application or on\n      // the element itself, therefore  there is no need to continue further\n      // past this point if not enabled\n      // Animations are also disabled if the document is currently hidden (page is not visible\n      // to the user), because browsers slow down or do not flush calls to requestAnimationFrame\n      var skipAnimations = !animationsEnabled || $document[0].hidden || disabledElementsLookup.get(node);\n      var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {};\n      var hasExistingAnimation = !!existingAnimation.state;\n\n      // there is no point in traversing the same collection of parent ancestors if a followup\n      // animation will be run on the same element that already did all that checking work\n      if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) {\n        skipAnimations = !areAnimationsAllowed(element, parent, event);\n      }\n\n      if (skipAnimations) {\n        close();\n        return runner;\n      }\n\n      if (isStructural) {\n        closeChildAnimations(element);\n      }\n\n      var newAnimation = {\n        structural: isStructural,\n        element: element,\n        event: event,\n        addClass: options.addClass,\n        removeClass: options.removeClass,\n        close: close,\n        options: options,\n        runner: runner\n      };\n\n      if (hasExistingAnimation) {\n        var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation);\n        if (skipAnimationFlag) {\n          if (existingAnimation.state === RUNNING_STATE) {\n            close();\n            return runner;\n          } else {\n            mergeAnimationDetails(element, existingAnimation, newAnimation);\n            return existingAnimation.runner;\n          }\n        }\n        var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation);\n        if (cancelAnimationFlag) {\n          if (existingAnimation.state === RUNNING_STATE) {\n            // this will end the animation right away and it is safe\n            // to do so since the animation is already running and the\n            // runner callback code will run in async\n            existingAnimation.runner.end();\n          } else if (existingAnimation.structural) {\n            // this means that the animation is queued into a digest, but\n            // hasn't started yet. Therefore it is safe to run the close\n            // method which will call the runner methods in async.\n            existingAnimation.close();\n          } else {\n            // this will merge the new animation options into existing animation options\n            mergeAnimationDetails(element, existingAnimation, newAnimation);\n\n            return existingAnimation.runner;\n          }\n        } else {\n          // a joined animation means that this animation will take over the existing one\n          // so an example would involve a leave animation taking over an enter. Then when\n          // the postDigest kicks in the enter will be ignored.\n          var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation);\n          if (joinAnimationFlag) {\n            if (existingAnimation.state === RUNNING_STATE) {\n              normalizeAnimationDetails(element, newAnimation);\n            } else {\n              applyGeneratedPreparationClasses(element, isStructural ? event : null, options);\n\n              event = newAnimation.event = existingAnimation.event;\n              options = mergeAnimationDetails(element, existingAnimation, newAnimation);\n\n              //we return the same runner since only the option values of this animation will\n              //be fed into the `existingAnimation`.\n              return existingAnimation.runner;\n            }\n          }\n        }\n      } else {\n        // normalization in this case means that it removes redundant CSS classes that\n        // already exist (addClass) or do not exist (removeClass) on the element\n        normalizeAnimationDetails(element, newAnimation);\n      }\n\n      // when the options are merged and cleaned up we may end up not having to do\n      // an animation at all, therefore we should check this before issuing a post\n      // digest callback. Structural animations will always run no matter what.\n      var isValidAnimation = newAnimation.structural;\n      if (!isValidAnimation) {\n        // animate (from/to) can be quickly checked first, otherwise we check if any classes are present\n        isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0)\n                            || hasAnimationClasses(newAnimation);\n      }\n\n      if (!isValidAnimation) {\n        close();\n        clearElementAnimationState(element);\n        return runner;\n      }\n\n      // the counter keeps track of cancelled animations\n      var counter = (existingAnimation.counter || 0) + 1;\n      newAnimation.counter = counter;\n\n      markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation);\n\n      $rootScope.$$postDigest(function() {\n        var animationDetails = activeAnimationsLookup.get(node);\n        var animationCancelled = !animationDetails;\n        animationDetails = animationDetails || {};\n\n        // if addClass/removeClass is called before something like enter then the\n        // registered parent element may not be present. The code below will ensure\n        // that a final value for parent element is obtained\n        var parentElement = element.parent() || [];\n\n        // animate/structural/class-based animations all have requirements. Otherwise there\n        // is no point in performing an animation. The parent node must also be set.\n        var isValidAnimation = parentElement.length > 0\n                                && (animationDetails.event === 'animate'\n                                    || animationDetails.structural\n                                    || hasAnimationClasses(animationDetails));\n\n        // this means that the previous animation was cancelled\n        // even if the follow-up animation is the same event\n        if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) {\n          // if another animation did not take over then we need\n          // to make sure that the domOperation and options are\n          // handled accordingly\n          if (animationCancelled) {\n            applyAnimationClasses(element, options);\n            applyAnimationStyles(element, options);\n          }\n\n          // if the event changed from something like enter to leave then we do\n          // it, otherwise if it's the same then the end result will be the same too\n          if (animationCancelled || (isStructural && animationDetails.event !== event)) {\n            options.domOperation();\n            runner.end();\n          }\n\n          // in the event that the element animation was not cancelled or a follow-up animation\n          // isn't allowed to animate from here then we need to clear the state of the element\n          // so that any future animations won't read the expired animation data.\n          if (!isValidAnimation) {\n            clearElementAnimationState(element);\n          }\n\n          return;\n        }\n\n        // this combined multiple class to addClass / removeClass into a setClass event\n        // so long as a structural event did not take over the animation\n        event = !animationDetails.structural && hasAnimationClasses(animationDetails, true)\n            ? 'setClass'\n            : animationDetails.event;\n\n        markElementAnimationState(element, RUNNING_STATE);\n        var realRunner = $$animation(element, event, animationDetails.options);\n\n        realRunner.done(function(status) {\n          close(!status);\n          var animationDetails = activeAnimationsLookup.get(node);\n          if (animationDetails && animationDetails.counter === counter) {\n            clearElementAnimationState(getDomNode(element));\n          }\n          notifyProgress(runner, event, 'close', {});\n        });\n\n        // this will update the runner's flow-control events based on\n        // the `realRunner` object.\n        runner.setHost(realRunner);\n        notifyProgress(runner, event, 'start', {});\n      });\n\n      return runner;\n\n      function notifyProgress(runner, event, phase, data) {\n        runInNextPostDigestOrNow(function() {\n          var callbacks = findCallbacks(parent, element, event);\n          if (callbacks.length) {\n            // do not optimize this call here to RAF because\n            // we don't know how heavy the callback code here will\n            // be and if this code is buffered then this can\n            // lead to a performance regression.\n            $$rAF(function() {\n              forEach(callbacks, function(callback) {\n                callback(element, phase, data);\n              });\n            });\n          }\n        });\n        runner.progress(event, phase, data);\n      }\n\n      function close(reject) { // jshint ignore:line\n        clearGeneratedClasses(element, options);\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n        options.domOperation();\n        runner.complete(!reject);\n      }\n    }\n\n    function closeChildAnimations(element) {\n      var node = getDomNode(element);\n      var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']');\n      forEach(children, function(child) {\n        var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));\n        var animationDetails = activeAnimationsLookup.get(child);\n        if (animationDetails) {\n          switch (state) {\n            case RUNNING_STATE:\n              animationDetails.runner.end();\n              /* falls through */\n            case PRE_DIGEST_STATE:\n              activeAnimationsLookup.remove(child);\n              break;\n          }\n        }\n      });\n    }\n\n    function clearElementAnimationState(element) {\n      var node = getDomNode(element);\n      node.removeAttribute(NG_ANIMATE_ATTR_NAME);\n      activeAnimationsLookup.remove(node);\n    }\n\n    function isMatchingElement(nodeOrElmA, nodeOrElmB) {\n      return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB);\n    }\n\n    /**\n     * This fn returns false if any of the following is true:\n     * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed\n     * b) a parent element has an ongoing structural animation, and animateChildren is false\n     * c) the element is not a child of the body\n     * d) the element is not a child of the $rootElement\n     */\n    function areAnimationsAllowed(element, parentElement, event) {\n      var bodyElement = jqLite($document[0].body);\n      var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML';\n      var rootElementDetected = isMatchingElement(element, $rootElement);\n      var parentAnimationDetected = false;\n      var animateChildren;\n      var elementDisabled = disabledElementsLookup.get(getDomNode(element));\n\n      var parentHost = jqLite.data(element[0], NG_ANIMATE_PIN_DATA);\n      if (parentHost) {\n        parentElement = parentHost;\n      }\n\n      parentElement = getDomNode(parentElement);\n\n      while (parentElement) {\n        if (!rootElementDetected) {\n          // angular doesn't want to attempt to animate elements outside of the application\n          // therefore we need to ensure that the rootElement is an ancestor of the current element\n          rootElementDetected = isMatchingElement(parentElement, $rootElement);\n        }\n\n        if (parentElement.nodeType !== ELEMENT_NODE) {\n          // no point in inspecting the #document element\n          break;\n        }\n\n        var details = activeAnimationsLookup.get(parentElement) || {};\n        // either an enter, leave or move animation will commence\n        // therefore we can't allow any animations to take place\n        // but if a parent animation is class-based then that's ok\n        if (!parentAnimationDetected) {\n          var parentElementDisabled = disabledElementsLookup.get(parentElement);\n\n          if (parentElementDisabled === true && elementDisabled !== false) {\n            // disable animations if the user hasn't explicitly enabled animations on the\n            // current element\n            elementDisabled = true;\n            // element is disabled via parent element, no need to check anything else\n            break;\n          } else if (parentElementDisabled === false) {\n            elementDisabled = false;\n          }\n          parentAnimationDetected = details.structural;\n        }\n\n        if (isUndefined(animateChildren) || animateChildren === true) {\n          var value = jqLite.data(parentElement, NG_ANIMATE_CHILDREN_DATA);\n          if (isDefined(value)) {\n            animateChildren = value;\n          }\n        }\n\n        // there is no need to continue traversing at this point\n        if (parentAnimationDetected && animateChildren === false) break;\n\n        if (!bodyElementDetected) {\n          // we also need to ensure that the element is or will be a part of the body element\n          // otherwise it is pointless to even issue an animation to be rendered\n          bodyElementDetected = isMatchingElement(parentElement, bodyElement);\n        }\n\n        if (bodyElementDetected && rootElementDetected) {\n          // If both body and root have been found, any other checks are pointless,\n          // as no animation data should live outside the application\n          break;\n        }\n\n        if (!rootElementDetected) {\n          // If no rootElement is detected, check if the parentElement is pinned to another element\n          parentHost = jqLite.data(parentElement, NG_ANIMATE_PIN_DATA);\n          if (parentHost) {\n            // The pin target element becomes the next parent element\n            parentElement = getDomNode(parentHost);\n            continue;\n          }\n        }\n\n        parentElement = parentElement.parentNode;\n      }\n\n      var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true;\n      return allowAnimation && rootElementDetected && bodyElementDetected;\n    }\n\n    function markElementAnimationState(element, state, details) {\n      details = details || {};\n      details.state = state;\n\n      var node = getDomNode(element);\n      node.setAttribute(NG_ANIMATE_ATTR_NAME, state);\n\n      var oldValue = activeAnimationsLookup.get(node);\n      var newValue = oldValue\n          ? extend(oldValue, details)\n          : details;\n      activeAnimationsLookup.put(node, newValue);\n    }\n  }];\n}];\n\nvar $$AnimationProvider = ['$animateProvider', function($animateProvider) {\n  var NG_ANIMATE_REF_ATTR = 'ng-animate-ref';\n\n  var drivers = this.drivers = [];\n\n  var RUNNER_STORAGE_KEY = '$$animationRunner';\n\n  function setRunner(element, runner) {\n    element.data(RUNNER_STORAGE_KEY, runner);\n  }\n\n  function removeRunner(element) {\n    element.removeData(RUNNER_STORAGE_KEY);\n  }\n\n  function getRunner(element) {\n    return element.data(RUNNER_STORAGE_KEY);\n  }\n\n  this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$HashMap', '$$rAFScheduler',\n       function($$jqLite,   $rootScope,   $injector,   $$AnimateRunner,   $$HashMap,   $$rAFScheduler) {\n\n    var animationQueue = [];\n    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);\n\n    function sortAnimations(animations) {\n      var tree = { children: [] };\n      var i, lookup = new $$HashMap();\n\n      // this is done first beforehand so that the hashmap\n      // is filled with a list of the elements that will be animated\n      for (i = 0; i < animations.length; i++) {\n        var animation = animations[i];\n        lookup.put(animation.domNode, animations[i] = {\n          domNode: animation.domNode,\n          fn: animation.fn,\n          children: []\n        });\n      }\n\n      for (i = 0; i < animations.length; i++) {\n        processNode(animations[i]);\n      }\n\n      return flatten(tree);\n\n      function processNode(entry) {\n        if (entry.processed) return entry;\n        entry.processed = true;\n\n        var elementNode = entry.domNode;\n        var parentNode = elementNode.parentNode;\n        lookup.put(elementNode, entry);\n\n        var parentEntry;\n        while (parentNode) {\n          parentEntry = lookup.get(parentNode);\n          if (parentEntry) {\n            if (!parentEntry.processed) {\n              parentEntry = processNode(parentEntry);\n            }\n            break;\n          }\n          parentNode = parentNode.parentNode;\n        }\n\n        (parentEntry || tree).children.push(entry);\n        return entry;\n      }\n\n      function flatten(tree) {\n        var result = [];\n        var queue = [];\n        var i;\n\n        for (i = 0; i < tree.children.length; i++) {\n          queue.push(tree.children[i]);\n        }\n\n        var remainingLevelEntries = queue.length;\n        var nextLevelEntries = 0;\n        var row = [];\n\n        for (i = 0; i < queue.length; i++) {\n          var entry = queue[i];\n          if (remainingLevelEntries <= 0) {\n            remainingLevelEntries = nextLevelEntries;\n            nextLevelEntries = 0;\n            result.push(row);\n            row = [];\n          }\n          row.push(entry.fn);\n          entry.children.forEach(function(childEntry) {\n            nextLevelEntries++;\n            queue.push(childEntry);\n          });\n          remainingLevelEntries--;\n        }\n\n        if (row.length) {\n          result.push(row);\n        }\n\n        return result;\n      }\n    }\n\n    // TODO(matsko): document the signature in a better way\n    return function(element, event, options) {\n      options = prepareAnimationOptions(options);\n      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;\n\n      // there is no animation at the current moment, however\n      // these runner methods will get later updated with the\n      // methods leading into the driver's end/cancel methods\n      // for now they just stop the animation from starting\n      var runner = new $$AnimateRunner({\n        end: function() { close(); },\n        cancel: function() { close(true); }\n      });\n\n      if (!drivers.length) {\n        close();\n        return runner;\n      }\n\n      setRunner(element, runner);\n\n      var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass));\n      var tempClasses = options.tempClasses;\n      if (tempClasses) {\n        classes += ' ' + tempClasses;\n        options.tempClasses = null;\n      }\n\n      var prepareClassName;\n      if (isStructural) {\n        prepareClassName = 'ng-' + event + PREPARE_CLASS_SUFFIX;\n        $$jqLite.addClass(element, prepareClassName);\n      }\n\n      animationQueue.push({\n        // this data is used by the postDigest code and passed into\n        // the driver step function\n        element: element,\n        classes: classes,\n        event: event,\n        structural: isStructural,\n        options: options,\n        beforeStart: beforeStart,\n        close: close\n      });\n\n      element.on('$destroy', handleDestroyedElement);\n\n      // we only want there to be one function called within the post digest\n      // block. This way we can group animations for all the animations that\n      // were apart of the same postDigest flush call.\n      if (animationQueue.length > 1) return runner;\n\n      $rootScope.$$postDigest(function() {\n        var animations = [];\n        forEach(animationQueue, function(entry) {\n          // the element was destroyed early on which removed the runner\n          // form its storage. This means we can't animate this element\n          // at all and it already has been closed due to destruction.\n          if (getRunner(entry.element)) {\n            animations.push(entry);\n          } else {\n            entry.close();\n          }\n        });\n\n        // now any future animations will be in another postDigest\n        animationQueue.length = 0;\n\n        var groupedAnimations = groupAnimations(animations);\n        var toBeSortedAnimations = [];\n\n        forEach(groupedAnimations, function(animationEntry) {\n          toBeSortedAnimations.push({\n            domNode: getDomNode(animationEntry.from ? animationEntry.from.element : animationEntry.element),\n            fn: function triggerAnimationStart() {\n              // it's important that we apply the `ng-animate` CSS class and the\n              // temporary classes before we do any driver invoking since these\n              // CSS classes may be required for proper CSS detection.\n              animationEntry.beforeStart();\n\n              var startAnimationFn, closeFn = animationEntry.close;\n\n              // in the event that the element was removed before the digest runs or\n              // during the RAF sequencing then we should not trigger the animation.\n              var targetElement = animationEntry.anchors\n                  ? (animationEntry.from.element || animationEntry.to.element)\n                  : animationEntry.element;\n\n              if (getRunner(targetElement)) {\n                var operation = invokeFirstDriver(animationEntry);\n                if (operation) {\n                  startAnimationFn = operation.start;\n                }\n              }\n\n              if (!startAnimationFn) {\n                closeFn();\n              } else {\n                var animationRunner = startAnimationFn();\n                animationRunner.done(function(status) {\n                  closeFn(!status);\n                });\n                updateAnimationRunners(animationEntry, animationRunner);\n              }\n            }\n          });\n        });\n\n        // we need to sort each of the animations in order of parent to child\n        // relationships. This ensures that the child classes are applied at the\n        // right time.\n        $$rAFScheduler(sortAnimations(toBeSortedAnimations));\n      });\n\n      return runner;\n\n      // TODO(matsko): change to reference nodes\n      function getAnchorNodes(node) {\n        var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']';\n        var items = node.hasAttribute(NG_ANIMATE_REF_ATTR)\n              ? [node]\n              : node.querySelectorAll(SELECTOR);\n        var anchors = [];\n        forEach(items, function(node) {\n          var attr = node.getAttribute(NG_ANIMATE_REF_ATTR);\n          if (attr && attr.length) {\n            anchors.push(node);\n          }\n        });\n        return anchors;\n      }\n\n      function groupAnimations(animations) {\n        var preparedAnimations = [];\n        var refLookup = {};\n        forEach(animations, function(animation, index) {\n          var element = animation.element;\n          var node = getDomNode(element);\n          var event = animation.event;\n          var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;\n          var anchorNodes = animation.structural ? getAnchorNodes(node) : [];\n\n          if (anchorNodes.length) {\n            var direction = enterOrMove ? 'to' : 'from';\n\n            forEach(anchorNodes, function(anchor) {\n              var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);\n              refLookup[key] = refLookup[key] || {};\n              refLookup[key][direction] = {\n                animationID: index,\n                element: jqLite(anchor)\n              };\n            });\n          } else {\n            preparedAnimations.push(animation);\n          }\n        });\n\n        var usedIndicesLookup = {};\n        var anchorGroups = {};\n        forEach(refLookup, function(operations, key) {\n          var from = operations.from;\n          var to = operations.to;\n\n          if (!from || !to) {\n            // only one of these is set therefore we can't have an\n            // anchor animation since all three pieces are required\n            var index = from ? from.animationID : to.animationID;\n            var indexKey = index.toString();\n            if (!usedIndicesLookup[indexKey]) {\n              usedIndicesLookup[indexKey] = true;\n              preparedAnimations.push(animations[index]);\n            }\n            return;\n          }\n\n          var fromAnimation = animations[from.animationID];\n          var toAnimation = animations[to.animationID];\n          var lookupKey = from.animationID.toString();\n          if (!anchorGroups[lookupKey]) {\n            var group = anchorGroups[lookupKey] = {\n              structural: true,\n              beforeStart: function() {\n                fromAnimation.beforeStart();\n                toAnimation.beforeStart();\n              },\n              close: function() {\n                fromAnimation.close();\n                toAnimation.close();\n              },\n              classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes),\n              from: fromAnimation,\n              to: toAnimation,\n              anchors: [] // TODO(matsko): change to reference nodes\n            };\n\n            // the anchor animations require that the from and to elements both have at least\n            // one shared CSS class which effectively marries the two elements together to use\n            // the same animation driver and to properly sequence the anchor animation.\n            if (group.classes.length) {\n              preparedAnimations.push(group);\n            } else {\n              preparedAnimations.push(fromAnimation);\n              preparedAnimations.push(toAnimation);\n            }\n          }\n\n          anchorGroups[lookupKey].anchors.push({\n            'out': from.element, 'in': to.element\n          });\n        });\n\n        return preparedAnimations;\n      }\n\n      function cssClassesIntersection(a,b) {\n        a = a.split(' ');\n        b = b.split(' ');\n        var matches = [];\n\n        for (var i = 0; i < a.length; i++) {\n          var aa = a[i];\n          if (aa.substring(0,3) === 'ng-') continue;\n\n          for (var j = 0; j < b.length; j++) {\n            if (aa === b[j]) {\n              matches.push(aa);\n              break;\n            }\n          }\n        }\n\n        return matches.join(' ');\n      }\n\n      function invokeFirstDriver(animationDetails) {\n        // we loop in reverse order since the more general drivers (like CSS and JS)\n        // may attempt more elements, but custom drivers are more particular\n        for (var i = drivers.length - 1; i >= 0; i--) {\n          var driverName = drivers[i];\n          if (!$injector.has(driverName)) continue; // TODO(matsko): remove this check\n\n          var factory = $injector.get(driverName);\n          var driver = factory(animationDetails);\n          if (driver) {\n            return driver;\n          }\n        }\n      }\n\n      function beforeStart() {\n        element.addClass(NG_ANIMATE_CLASSNAME);\n        if (tempClasses) {\n          $$jqLite.addClass(element, tempClasses);\n        }\n        if (prepareClassName) {\n          $$jqLite.removeClass(element, prepareClassName);\n          prepareClassName = null;\n        }\n      }\n\n      function updateAnimationRunners(animation, newRunner) {\n        if (animation.from && animation.to) {\n          update(animation.from.element);\n          update(animation.to.element);\n        } else {\n          update(animation.element);\n        }\n\n        function update(element) {\n          getRunner(element).setHost(newRunner);\n        }\n      }\n\n      function handleDestroyedElement() {\n        var runner = getRunner(element);\n        if (runner && (event !== 'leave' || !options.$$domOperationFired)) {\n          runner.end();\n        }\n      }\n\n      function close(rejected) { // jshint ignore:line\n        element.off('$destroy', handleDestroyedElement);\n        removeRunner(element);\n\n        applyAnimationClasses(element, options);\n        applyAnimationStyles(element, options);\n        options.domOperation();\n\n        if (tempClasses) {\n          $$jqLite.removeClass(element, tempClasses);\n        }\n\n        element.removeClass(NG_ANIMATE_CLASSNAME);\n        runner.complete(!rejected);\n      }\n    };\n  }];\n}];\n\n/**\n * @ngdoc directive\n * @name ngAnimateSwap\n * @restrict A\n * @scope\n *\n * @description\n *\n * ngAnimateSwap is a animation-oriented directive that allows for the container to\n * be removed and entered in whenever the associated expression changes. A\n * common usecase for this directive is a rotating banner or slider component which\n * contains one image being present at a time. When the active image changes\n * then the old image will perform a `leave` animation and the new element\n * will be inserted via an `enter` animation.\n *\n * @animations\n * | Animation                        | Occurs                               |\n * |----------------------------------|--------------------------------------|\n * | {@link ng.$animate#enter enter}  | when the new element is inserted to the DOM  |\n * | {@link ng.$animate#leave leave}  | when the old element is removed from the DOM |\n *\n * @example\n * <example name=\"ngAnimateSwap-directive\" module=\"ngAnimateSwapExample\"\n *          deps=\"angular-animate.js\"\n *          animations=\"true\" fixBase=\"true\">\n *   <file name=\"index.html\">\n *     <div class=\"container\" ng-controller=\"AppCtrl\">\n *       <div ng-animate-swap=\"number\" class=\"cell swap-animation\" ng-class=\"colorClass(number)\">\n *         {{ number }}\n *       </div>\n *     </div>\n *   </file>\n *   <file name=\"script.js\">\n *     angular.module('ngAnimateSwapExample', ['ngAnimate'])\n *       .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {\n *         $scope.number = 0;\n *         $interval(function() {\n *           $scope.number++;\n *         }, 1000);\n *\n *         var colors = ['red','blue','green','yellow','orange'];\n *         $scope.colorClass = function(number) {\n *           return colors[number % colors.length];\n *         };\n *       }]);\n *   </file>\n *  <file name=\"animations.css\">\n *  .container {\n *    height:250px;\n *    width:250px;\n *    position:relative;\n *    overflow:hidden;\n *    border:2px solid black;\n *  }\n *  .container .cell {\n *    font-size:150px;\n *    text-align:center;\n *    line-height:250px;\n *    position:absolute;\n *    top:0;\n *    left:0;\n *    right:0;\n *    border-bottom:2px solid black;\n *  }\n *  .swap-animation.ng-enter, .swap-animation.ng-leave {\n *    transition:0.5s linear all;\n *  }\n *  .swap-animation.ng-enter {\n *    top:-250px;\n *  }\n *  .swap-animation.ng-enter-active {\n *    top:0px;\n *  }\n *  .swap-animation.ng-leave {\n *    top:0px;\n *  }\n *  .swap-animation.ng-leave-active {\n *    top:250px;\n *  }\n *  .red { background:red; }\n *  .green { background:green; }\n *  .blue { background:blue; }\n *  .yellow { background:yellow; }\n *  .orange { background:orange; }\n *  </file>\n * </example>\n */\nvar ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $rootScope) {\n  return {\n    restrict: 'A',\n    transclude: 'element',\n    terminal: true,\n    priority: 600, // we use 600 here to ensure that the directive is caught before others\n    link: function(scope, $element, attrs, ctrl, $transclude) {\n      var previousElement, previousScope;\n      scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) {\n        if (previousElement) {\n          $animate.leave(previousElement);\n        }\n        if (previousScope) {\n          previousScope.$destroy();\n          previousScope = null;\n        }\n        if (value || value === 0) {\n          previousScope = scope.$new();\n          $transclude(previousScope, function(element) {\n            previousElement = element;\n            $animate.enter(element, null, $element);\n          });\n        }\n      });\n    }\n  };\n}];\n\n/* global angularAnimateModule: true,\n\n   ngAnimateSwapDirective,\n   $$AnimateAsyncRunFactory,\n   $$rAFSchedulerFactory,\n   $$AnimateChildrenDirective,\n   $$AnimateQueueProvider,\n   $$AnimationProvider,\n   $AnimateCssProvider,\n   $$AnimateCssDriverProvider,\n   $$AnimateJsProvider,\n   $$AnimateJsDriverProvider,\n*/\n\n/**\n * @ngdoc module\n * @name ngAnimate\n * @description\n *\n * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via\n * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an Angular app.\n *\n * <div doc-module-components=\"ngAnimate\"></div>\n *\n * # Usage\n * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based\n * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For\n * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within\n * the HTML element that the animation will be triggered on.\n *\n * ## Directive Support\n * The following directives are \"animation aware\":\n *\n * | Directive                                                                                                | Supported Animations                                                     |\n * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n * | {@link ng.directive:ngRepeat#animations ngRepeat}                                                        | enter, leave and move                                                    |\n * | {@link ngRoute.directive:ngView#animations ngView}                                                       | enter and leave                                                          |\n * | {@link ng.directive:ngInclude#animations ngInclude}                                                      | enter and leave                                                          |\n * | {@link ng.directive:ngSwitch#animations ngSwitch}                                                        | enter and leave                                                          |\n * | {@link ng.directive:ngIf#animations ngIf}                                                                | enter and leave                                                          |\n * | {@link ng.directive:ngClass#animations ngClass}                                                          | add and remove (the CSS class(es) present)                               |\n * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide}            | add and remove (the ng-hide class value)                                 |\n * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel}    | add and remove (dirty, pristine, valid, invalid & all other validations) |\n * | {@link module:ngMessages#animations ngMessages}                                                          | add and remove (ng-active & ng-inactive)                                 |\n * | {@link module:ngMessages#animations ngMessage}                                                           | enter and leave                                                          |\n *\n * (More information can be found by visiting each the documentation associated with each directive.)\n *\n * ## CSS-based Animations\n *\n * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML\n * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation.\n *\n * The example below shows how an `enter` animation can be made possible on an element using `ng-if`:\n *\n * ```html\n * <div ng-if=\"bool\" class=\"fade\">\n *    Fade me in out\n * </div>\n * <button ng-click=\"bool=true\">Fade In!</button>\n * <button ng-click=\"bool=false\">Fade Out!</button>\n * ```\n *\n * Notice the CSS class **fade**? We can now create the CSS transition code that references this class:\n *\n * ```css\n * /&#42; The starting CSS styles for the enter animation &#42;/\n * .fade.ng-enter {\n *   transition:0.5s linear all;\n *   opacity:0;\n * }\n *\n * /&#42; The finishing CSS styles for the enter animation &#42;/\n * .fade.ng-enter.ng-enter-active {\n *   opacity:1;\n * }\n * ```\n *\n * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two\n * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition\n * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards.\n *\n * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions:\n *\n * ```css\n * /&#42; now the element will fade out before it is removed from the DOM &#42;/\n * .fade.ng-leave {\n *   transition:0.5s linear all;\n *   opacity:1;\n * }\n * .fade.ng-leave.ng-leave-active {\n *   opacity:0;\n * }\n * ```\n *\n * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class:\n *\n * ```css\n * /&#42; there is no need to define anything inside of the destination\n * CSS class since the keyframe will take charge of the animation &#42;/\n * .fade.ng-leave {\n *   animation: my_fade_animation 0.5s linear;\n *   -webkit-animation: my_fade_animation 0.5s linear;\n * }\n *\n * @keyframes my_fade_animation {\n *   from { opacity:1; }\n *   to { opacity:0; }\n * }\n *\n * @-webkit-keyframes my_fade_animation {\n *   from { opacity:1; }\n *   to { opacity:0; }\n * }\n * ```\n *\n * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element.\n *\n * ### CSS Class-based Animations\n *\n * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different\n * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added\n * and removed.\n *\n * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class:\n *\n * ```html\n * <div ng-show=\"bool\" class=\"fade\">\n *   Show and hide me\n * </div>\n * <button ng-click=\"bool=true\">Toggle</button>\n *\n * <style>\n * .fade.ng-hide {\n *   transition:0.5s linear all;\n *   opacity:0;\n * }\n * </style>\n * ```\n *\n * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since\n * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest.\n *\n * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation\n * with CSS styles.\n *\n * ```html\n * <div ng-class=\"{on:onOff}\" class=\"highlight\">\n *   Highlight this box\n * </div>\n * <button ng-click=\"onOff=!onOff\">Toggle</button>\n *\n * <style>\n * .highlight {\n *   transition:0.5s linear all;\n * }\n * .highlight.on-add {\n *   background:white;\n * }\n * .highlight.on {\n *   background:yellow;\n * }\n * .highlight.on-remove {\n *   background:black;\n * }\n * </style>\n * ```\n *\n * We can also make use of CSS keyframes by placing them within the CSS classes.\n *\n *\n * ### CSS Staggering Animations\n * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a\n * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be\n * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for\n * the animation. The style property expected within the stagger class can either be a **transition-delay** or an\n * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).\n *\n * ```css\n * .my-animation.ng-enter {\n *   /&#42; standard transition code &#42;/\n *   transition: 1s linear all;\n *   opacity:0;\n * }\n * .my-animation.ng-enter-stagger {\n *   /&#42; this will have a 100ms delay between each successive leave animation &#42;/\n *   transition-delay: 0.1s;\n *\n *   /&#42; As of 1.4.4, this must always be set: it signals ngAnimate\n *     to not accidentally inherit a delay property from another CSS class &#42;/\n *   transition-duration: 0s;\n * }\n * .my-animation.ng-enter.ng-enter-active {\n *   /&#42; standard transition styles &#42;/\n *   opacity:1;\n * }\n * ```\n *\n * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations\n * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this\n * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation\n * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired.\n *\n * The following code will issue the **ng-leave-stagger** event on the element provided:\n *\n * ```js\n * var kids = parent.children();\n *\n * $animate.leave(kids[0]); //stagger index=0\n * $animate.leave(kids[1]); //stagger index=1\n * $animate.leave(kids[2]); //stagger index=2\n * $animate.leave(kids[3]); //stagger index=3\n * $animate.leave(kids[4]); //stagger index=4\n *\n * window.requestAnimationFrame(function() {\n *   //stagger has reset itself\n *   $animate.leave(kids[5]); //stagger index=0\n *   $animate.leave(kids[6]); //stagger index=1\n *\n *   $scope.$digest();\n * });\n * ```\n *\n * Stagger animations are currently only supported within CSS-defined animations.\n *\n * ### The `ng-animate` CSS class\n *\n * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation.\n * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations).\n *\n * Therefore, animations can be applied to an element using this temporary class directly via CSS.\n *\n * ```css\n * .zipper.ng-animate {\n *   transition:0.5s linear all;\n * }\n * .zipper.ng-enter {\n *   opacity:0;\n * }\n * .zipper.ng-enter.ng-enter-active {\n *   opacity:1;\n * }\n * .zipper.ng-leave {\n *   opacity:1;\n * }\n * .zipper.ng-leave.ng-leave-active {\n *   opacity:0;\n * }\n * ```\n *\n * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove\n * the CSS class once an animation has completed.)\n *\n *\n * ### The `ng-[event]-prepare` class\n *\n * This is a special class that can be used to prevent unwanted flickering / flash of content before\n * the actual animation starts. The class is added as soon as an animation is initialized, but removed\n * before the actual animation starts (after waiting for a $digest).\n * It is also only added for *structural* animations (`enter`, `move`, and `leave`).\n *\n * In practice, flickering can appear when nesting elements with structural animations such as `ngIf`\n * into elements that have class-based animations such as `ngClass`.\n *\n * ```html\n * <div ng-class=\"{red: myProp}\">\n *   <div ng-class=\"{blue: myProp}\">\n *     <div class=\"message\" ng-if=\"myProp\"></div>\n *   </div>\n * </div>\n * ```\n *\n * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating.\n * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:\n *\n * ```css\n * .message.ng-enter-prepare {\n *   opacity: 0;\n * }\n *\n * ```\n *\n * ## JavaScript-based Animations\n *\n * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared\n * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the\n * `module.animation()` module function we can register the animation.\n *\n * Let's see an example of a enter/leave animation using `ngRepeat`:\n *\n * ```html\n * <div ng-repeat=\"item in items\" class=\"slide\">\n *   {{ item }}\n * </div>\n * ```\n *\n * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`:\n *\n * ```js\n * myModule.animation('.slide', [function() {\n *   return {\n *     // make note that other events (like addClass/removeClass)\n *     // have different function input parameters\n *     enter: function(element, doneFn) {\n *       jQuery(element).fadeIn(1000, doneFn);\n *\n *       // remember to call doneFn so that angular\n *       // knows that the animation has concluded\n *     },\n *\n *     move: function(element, doneFn) {\n *       jQuery(element).fadeIn(1000, doneFn);\n *     },\n *\n *     leave: function(element, doneFn) {\n *       jQuery(element).fadeOut(1000, doneFn);\n *     }\n *   }\n * }]);\n * ```\n *\n * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as\n * greensock.js and velocity.js.\n *\n * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define\n * our animations inside of the same registered animation, however, the function input arguments are a bit different:\n *\n * ```html\n * <div ng-class=\"color\" class=\"colorful\">\n *   this box is moody\n * </div>\n * <button ng-click=\"color='red'\">Change to red</button>\n * <button ng-click=\"color='blue'\">Change to blue</button>\n * <button ng-click=\"color='green'\">Change to green</button>\n * ```\n *\n * ```js\n * myModule.animation('.colorful', [function() {\n *   return {\n *     addClass: function(element, className, doneFn) {\n *       // do some cool animation and call the doneFn\n *     },\n *     removeClass: function(element, className, doneFn) {\n *       // do some cool animation and call the doneFn\n *     },\n *     setClass: function(element, addedClass, removedClass, doneFn) {\n *       // do some cool animation and call the doneFn\n *     }\n *   }\n * }]);\n * ```\n *\n * ## CSS + JS Animations Together\n *\n * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular,\n * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking\n * charge of the animation**:\n *\n * ```html\n * <div ng-if=\"bool\" class=\"slide\">\n *   Slide in and out\n * </div>\n * ```\n *\n * ```js\n * myModule.animation('.slide', [function() {\n *   return {\n *     enter: function(element, doneFn) {\n *       jQuery(element).slideIn(1000, doneFn);\n *     }\n *   }\n * }]);\n * ```\n *\n * ```css\n * .slide.ng-enter {\n *   transition:0.5s linear all;\n *   transform:translateY(-100px);\n * }\n * .slide.ng-enter.ng-enter-active {\n *   transform:translateY(0);\n * }\n * ```\n *\n * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the\n * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from\n * our own JS-based animation code:\n *\n * ```js\n * myModule.animation('.slide', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element) {\n*        // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`.\n *       return $animateCss(element, {\n *         event: 'enter',\n *         structural: true\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework.\n *\n * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or\n * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that\n * data into `$animateCss` directly:\n *\n * ```js\n * myModule.animation('.slide', ['$animateCss', function($animateCss) {\n *   return {\n *     enter: function(element) {\n *       return $animateCss(element, {\n *         event: 'enter',\n *         structural: true,\n *         addClass: 'maroon-setting',\n *         from: { height:0 },\n *         to: { height: 200 }\n *       });\n *     }\n *   }\n * }]);\n * ```\n *\n * Now we can fill in the rest via our transition CSS code:\n *\n * ```css\n * /&#42; the transition tells ngAnimate to make the animation happen &#42;/\n * .slide.ng-enter { transition:0.5s linear all; }\n *\n * /&#42; this extra CSS class will be absorbed into the transition\n * since the $animateCss code is adding the class &#42;/\n * .maroon-setting { background:red; }\n * ```\n *\n * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over.\n *\n * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}.\n *\n * ## Animation Anchoring (via `ng-animate-ref`)\n *\n * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between\n * structural areas of an application (like views) by pairing up elements using an attribute\n * called `ng-animate-ref`.\n *\n * Let's say for example we have two views that are managed by `ng-view` and we want to show\n * that there is a relationship between two components situated in within these views. By using the\n * `ng-animate-ref` attribute we can identify that the two components are paired together and we\n * can then attach an animation, which is triggered when the view changes.\n *\n * Say for example we have the following template code:\n *\n * ```html\n * <!-- index.html -->\n * <div ng-view class=\"view-animation\">\n * </div>\n *\n * <!-- home.html -->\n * <a href=\"#/banner-page\">\n *   <img src=\"./banner.jpg\" class=\"banner\" ng-animate-ref=\"banner\">\n * </a>\n *\n * <!-- banner-page.html -->\n * <img src=\"./banner.jpg\" class=\"banner\" ng-animate-ref=\"banner\">\n * ```\n *\n * Now, when the view changes (once the link is clicked), ngAnimate will examine the\n * HTML contents to see if there is a match reference between any components in the view\n * that is leaving and the view that is entering. It will scan both the view which is being\n * removed (leave) and inserted (enter) to see if there are any paired DOM elements that\n * contain a matching ref value.\n *\n * The two images match since they share the same ref value. ngAnimate will now create a\n * transport element (which is a clone of the first image element) and it will then attempt\n * to animate to the position of the second image element in the next view. For the animation to\n * work a special CSS class called `ng-anchor` will be added to the transported element.\n *\n * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then\n * ngAnimate will handle the entire transition for us as well as the addition and removal of\n * any changes of CSS classes between the elements:\n *\n * ```css\n * .banner.ng-anchor {\n *   /&#42; this animation will last for 1 second since there are\n *          two phases to the animation (an `in` and an `out` phase) &#42;/\n *   transition:0.5s linear all;\n * }\n * ```\n *\n * We also **must** include animations for the views that are being entered and removed\n * (otherwise anchoring wouldn't be possible since the new view would be inserted right away).\n *\n * ```css\n * .view-animation.ng-enter, .view-animation.ng-leave {\n *   transition:0.5s linear all;\n *   position:fixed;\n *   left:0;\n *   top:0;\n *   width:100%;\n * }\n * .view-animation.ng-enter {\n *   transform:translateX(100%);\n * }\n * .view-animation.ng-leave,\n * .view-animation.ng-enter.ng-enter-active {\n *   transform:translateX(0%);\n * }\n * .view-animation.ng-leave.ng-leave-active {\n *   transform:translateX(-100%);\n * }\n * ```\n *\n * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur:\n * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away\n * from its origin. Once that animation is over then the `in` stage occurs which animates the\n * element to its destination. The reason why there are two animations is to give enough time\n * for the enter animation on the new element to be ready.\n *\n * The example above sets up a transition for both the in and out phases, but we can also target the out or\n * in phases directly via `ng-anchor-out` and `ng-anchor-in`.\n *\n * ```css\n * .banner.ng-anchor-out {\n *   transition: 0.5s linear all;\n *\n *   /&#42; the scale will be applied during the out animation,\n *          but will be animated away when the in animation runs &#42;/\n *   transform: scale(1.2);\n * }\n *\n * .banner.ng-anchor-in {\n *   transition: 1s linear all;\n * }\n * ```\n *\n *\n *\n *\n * ### Anchoring Demo\n *\n  <example module=\"anchoringExample\"\n           name=\"anchoringExample\"\n           id=\"anchoringExample\"\n           deps=\"angular-animate.js;angular-route.js\"\n           animations=\"true\">\n    <file name=\"index.html\">\n      <a href=\"#/\">Home</a>\n      <hr />\n      <div class=\"view-container\">\n        <div ng-view class=\"view\"></div>\n      </div>\n    </file>\n    <file name=\"script.js\">\n      angular.module('anchoringExample', ['ngAnimate', 'ngRoute'])\n        .config(['$routeProvider', function($routeProvider) {\n          $routeProvider.when('/', {\n            templateUrl: 'home.html',\n            controller: 'HomeController as home'\n          });\n          $routeProvider.when('/profile/:id', {\n            templateUrl: 'profile.html',\n            controller: 'ProfileController as profile'\n          });\n        }])\n        .run(['$rootScope', function($rootScope) {\n          $rootScope.records = [\n            { id:1, title: \"Miss Beulah Roob\" },\n            { id:2, title: \"Trent Morissette\" },\n            { id:3, title: \"Miss Ava Pouros\" },\n            { id:4, title: \"Rod Pouros\" },\n            { id:5, title: \"Abdul Rice\" },\n            { id:6, title: \"Laurie Rutherford Sr.\" },\n            { id:7, title: \"Nakia McLaughlin\" },\n            { id:8, title: \"Jordon Blanda DVM\" },\n            { id:9, title: \"Rhoda Hand\" },\n            { id:10, title: \"Alexandrea Sauer\" }\n          ];\n        }])\n        .controller('HomeController', [function() {\n          //empty\n        }])\n        .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) {\n          var index = parseInt($routeParams.id, 10);\n          var record = $rootScope.records[index - 1];\n\n          this.title = record.title;\n          this.id = record.id;\n        }]);\n    </file>\n    <file name=\"home.html\">\n      <h2>Welcome to the home page</h1>\n      <p>Please click on an element</p>\n      <a class=\"record\"\n         ng-href=\"#/profile/{{ record.id }}\"\n         ng-animate-ref=\"{{ record.id }}\"\n         ng-repeat=\"record in records\">\n        {{ record.title }}\n      </a>\n    </file>\n    <file name=\"profile.html\">\n      <div class=\"profile record\" ng-animate-ref=\"{{ profile.id }}\">\n        {{ profile.title }}\n      </div>\n    </file>\n    <file name=\"animations.css\">\n      .record {\n        display:block;\n        font-size:20px;\n      }\n      .profile {\n        background:black;\n        color:white;\n        font-size:100px;\n      }\n      .view-container {\n        position:relative;\n      }\n      .view-container > .view.ng-animate {\n        position:absolute;\n        top:0;\n        left:0;\n        width:100%;\n        min-height:500px;\n      }\n      .view.ng-enter, .view.ng-leave,\n      .record.ng-anchor {\n        transition:0.5s linear all;\n      }\n      .view.ng-enter {\n        transform:translateX(100%);\n      }\n      .view.ng-enter.ng-enter-active, .view.ng-leave {\n        transform:translateX(0%);\n      }\n      .view.ng-leave.ng-leave-active {\n        transform:translateX(-100%);\n      }\n      .record.ng-anchor-out {\n        background:red;\n      }\n    </file>\n  </example>\n *\n * ### How is the element transported?\n *\n * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting\n * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element\n * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The\n * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match\n * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied\n * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class\n * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element\n * will become visible since the shim class will be removed.\n *\n * ### How is the morphing handled?\n *\n * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out\n * what CSS classes differ between the starting element and the destination element. These different CSS classes\n * will be added/removed on the anchor element and a transition will be applied (the transition that is provided\n * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will\n * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that\n * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since\n * the cloned element is placed inside of root element which is likely close to the body element).\n *\n * Note that if the root element is on the `<html>` element then the cloned node will be placed inside of body.\n *\n *\n * ## Using $animate in your directive code\n *\n * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application?\n * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's\n * imagine we have a greeting box that shows and hides itself when the data changes\n *\n * ```html\n * <greeting-box active=\"onOrOff\">Hi there</greeting-box>\n * ```\n *\n * ```js\n * ngModule.directive('greetingBox', ['$animate', function($animate) {\n *   return function(scope, element, attrs) {\n *     attrs.$observe('active', function(value) {\n *       value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');\n *     });\n *   });\n * }]);\n * ```\n *\n * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element\n * in our HTML code then we can trigger a CSS or JS animation to happen.\n *\n * ```css\n * /&#42; normally we would create a CSS class to reference on the element &#42;/\n * greeting-box.on { transition:0.5s linear all; background:green; color:white; }\n * ```\n *\n * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's\n * possible be sure to visit the {@link ng.$animate $animate service API page}.\n *\n *\n * ## Callbacks and Promises\n *\n * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger\n * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has\n * ended by chaining onto the returned promise that animation method returns.\n *\n * ```js\n * // somewhere within the depths of the directive\n * $animate.enter(element, parent).then(function() {\n *   //the animation has completed\n * });\n * ```\n *\n * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case\n * anymore.)\n *\n * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering\n * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view\n * routing controller to hook into that:\n *\n * ```js\n * ngModule.controller('HomePageController', ['$animate', function($animate) {\n *   $animate.on('enter', ngViewElement, function(element) {\n *     // the animation for this route has completed\n *   }]);\n * }])\n * ```\n *\n * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.)\n */\n\n/**\n * @ngdoc service\n * @name $animate\n * @kind object\n *\n * @description\n * The ngAnimate `$animate` service documentation is the same for the core `$animate` service.\n *\n * Click here {@link ng.$animate to learn more about animations with `$animate`}.\n */\nangular.module('ngAnimate', [])\n  .directive('ngAnimateSwap', ngAnimateSwapDirective)\n\n  .directive('ngAnimateChildren', $$AnimateChildrenDirective)\n  .factory('$$rAFScheduler', $$rAFSchedulerFactory)\n\n  .provider('$$animateQueue', $$AnimateQueueProvider)\n  .provider('$$animation', $$AnimationProvider)\n\n  .provider('$animateCss', $AnimateCssProvider)\n  .provider('$$animateCssDriver', $$AnimateCssDriverProvider)\n\n  .provider('$$animateJs', $$AnimateJsProvider)\n  .provider('$$animateJsDriver', $$AnimateJsDriverProvider);\n\n\n})(window, window.angular);\n\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * @license AngularJS v1.5.3\n * (c) 2010-2016 Google, Inc. http://angularjs.org\n * License: MIT\n */\n(function(window, angular, undefined) {'use strict';\n\n/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n *     Any commits to this file should be reviewed with security in mind.  *\n *   Changes to this file can potentially create security vulnerabilities. *\n *          An approval from 2 Core members with history of modifying      *\n *                         this file is required.                          *\n *                                                                         *\n *  Does the change somehow allow for arbitrary javascript to be executed? *\n *    Or allows for someone to change the prototype of built-in objects?   *\n *     Or gives undesired access to variables likes document or window?    *\n * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */\n\nvar $sanitizeMinErr = angular.$$minErr('$sanitize');\n\n/**\n * @ngdoc module\n * @name ngSanitize\n * @description\n *\n * # ngSanitize\n *\n * The `ngSanitize` module provides functionality to sanitize HTML.\n *\n *\n * <div doc-module-components=\"ngSanitize\"></div>\n *\n * See {@link ngSanitize.$sanitize `$sanitize`} for usage.\n */\n\n/**\n * @ngdoc service\n * @name $sanitize\n * @kind function\n *\n * @description\n *   Sanitizes an html string by stripping all potentially dangerous tokens.\n *\n *   The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are\n *   then serialized back to properly escaped html string. This means that no unsafe input can make\n *   it into the returned string.\n *\n *   The whitelist for URL sanitization of attribute values is configured using the functions\n *   `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider\n *   `$compileProvider`}.\n *\n *   The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.\n *\n * @param {string} html HTML input.\n * @returns {string} Sanitized HTML.\n *\n * @example\n   <example module=\"sanitizeExample\" deps=\"angular-sanitize.js\">\n   <file name=\"index.html\">\n     <script>\n         angular.module('sanitizeExample', ['ngSanitize'])\n           .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {\n             $scope.snippet =\n               '<p style=\"color:blue\">an html\\n' +\n               '<em onmouseover=\"this.textContent=\\'PWN3D!\\'\">click here</em>\\n' +\n               'snippet</p>';\n             $scope.deliberatelyTrustDangerousSnippet = function() {\n               return $sce.trustAsHtml($scope.snippet);\n             };\n           }]);\n     </script>\n     <div ng-controller=\"ExampleController\">\n        Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <td>Directive</td>\n           <td>How</td>\n           <td>Source</td>\n           <td>Rendered</td>\n         </tr>\n         <tr id=\"bind-html-with-sanitize\">\n           <td>ng-bind-html</td>\n           <td>Automatically uses $sanitize</td>\n           <td><pre>&lt;div ng-bind-html=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind-html=\"snippet\"></div></td>\n         </tr>\n         <tr id=\"bind-html-with-trust\">\n           <td>ng-bind-html</td>\n           <td>Bypass $sanitize by explicitly trusting the dangerous value</td>\n           <td>\n           <pre>&lt;div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"&gt;\n&lt;/div&gt;</pre>\n           </td>\n           <td><div ng-bind-html=\"deliberatelyTrustDangerousSnippet()\"></div></td>\n         </tr>\n         <tr id=\"bind-default\">\n           <td>ng-bind</td>\n           <td>Automatically escapes</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br/>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n       </div>\n   </file>\n   <file name=\"protractor.js\" type=\"protractor\">\n     it('should sanitize the html snippet by default', function() {\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('<p>an html\\n<em>click here</em>\\nsnippet</p>');\n     });\n\n     it('should inline raw snippet if bound to a trusted value', function() {\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).\n         toBe(\"<p style=\\\"color:blue\\\">an html\\n\" +\n              \"<em onmouseover=\\\"this.textContent='PWN3D!'\\\">click here</em>\\n\" +\n              \"snippet</p>\");\n     });\n\n     it('should escape snippet without any filter', function() {\n       expect(element(by.css('#bind-default div')).getInnerHtml()).\n         toBe(\"&lt;p style=\\\"color:blue\\\"&gt;an html\\n\" +\n              \"&lt;em onmouseover=\\\"this.textContent='PWN3D!'\\\"&gt;click here&lt;/em&gt;\\n\" +\n              \"snippet&lt;/p&gt;\");\n     });\n\n     it('should update', function() {\n       element(by.model('snippet')).clear();\n       element(by.model('snippet')).sendKeys('new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).\n         toBe('new <b>text</b>');\n       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(\n         'new <b onclick=\"alert(1)\">text</b>');\n       expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(\n         \"new &lt;b onclick=\\\"alert(1)\\\"&gt;text&lt;/b&gt;\");\n     });\n   </file>\n   </example>\n */\n\n\n/**\n * @ngdoc provider\n * @name $sanitizeProvider\n *\n * @description\n * Creates and configures {@link $sanitize} instance.\n */\nfunction $SanitizeProvider() {\n  var svgEnabled = false;\n\n  this.$get = ['$$sanitizeUri', function($$sanitizeUri) {\n    if (svgEnabled) {\n      angular.extend(validElements, svgElements);\n    }\n    return function(html) {\n      var buf = [];\n      htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {\n        return !/^unsafe:/.test($$sanitizeUri(uri, isImage));\n      }));\n      return buf.join('');\n    };\n  }];\n\n\n  /**\n   * @ngdoc method\n   * @name $sanitizeProvider#enableSvg\n   * @kind function\n   *\n   * @description\n   * Enables a subset of svg to be supported by the sanitizer.\n   *\n   * <div class=\"alert alert-warning\">\n   *   <p>By enabling this setting without taking other precautions, you might expose your\n   *   application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned\n   *   outside of the containing element and be rendered over other elements on the page (e.g. a login\n   *   link). Such behavior can then result in phishing incidents.</p>\n   *\n   *   <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg\n   *   tags within the sanitized content:</p>\n   *\n   *   <br>\n   *\n   *   <pre><code>\n   *   .rootOfTheIncludedContent svg {\n   *     overflow: hidden !important;\n   *   }\n   *   </code></pre>\n   * </div>\n   *\n   * @param {boolean=} regexp New regexp to whitelist urls with.\n   * @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called\n   *    without an argument or self for chaining otherwise.\n   */\n  this.enableSvg = function(enableSvg) {\n    if (angular.isDefined(enableSvg)) {\n      svgEnabled = enableSvg;\n      return this;\n    } else {\n      return svgEnabled;\n    }\n  };\n}\n\nfunction sanitizeText(chars) {\n  var buf = [];\n  var writer = htmlSanitizeWriter(buf, angular.noop);\n  writer.chars(chars);\n  return buf.join('');\n}\n\n\n// Regular Expressions for parsing tags and attributes\nvar SURROGATE_PAIR_REGEXP = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/g,\n  // Match everything outside of normal chars and \" (quote character)\n  NON_ALPHANUMERIC_REGEXP = /([^\\#-~ |!])/g;\n\n\n// Good source of info about elements and attributes\n// http://dev.w3.org/html5/spec/Overview.html#semantics\n// http://simon.html5.org/html-elements\n\n// Safe Void Elements - HTML5\n// http://dev.w3.org/html5/spec/Overview.html#void-elements\nvar voidElements = toMap(\"area,br,col,hr,img,wbr\");\n\n// Elements that you can, intentionally, leave open (and which close themselves)\n// http://dev.w3.org/html5/spec/Overview.html#optional-tags\nvar optionalEndTagBlockElements = toMap(\"colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr\"),\n    optionalEndTagInlineElements = toMap(\"rp,rt\"),\n    optionalEndTagElements = angular.extend({},\n                                            optionalEndTagInlineElements,\n                                            optionalEndTagBlockElements);\n\n// Safe Block Elements - HTML5\nvar blockElements = angular.extend({}, optionalEndTagBlockElements, toMap(\"address,article,\" +\n        \"aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,\" +\n        \"h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul\"));\n\n// Inline Elements - HTML5\nvar inlineElements = angular.extend({}, optionalEndTagInlineElements, toMap(\"a,abbr,acronym,b,\" +\n        \"bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,\" +\n        \"samp,small,span,strike,strong,sub,sup,time,tt,u,var\"));\n\n// SVG Elements\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements\n// Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.\n// They can potentially allow for arbitrary javascript to be executed. See #11290\nvar svgElements = toMap(\"circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,\" +\n        \"hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,\" +\n        \"radialGradient,rect,stop,svg,switch,text,title,tspan\");\n\n// Blocked Elements (will be stripped)\nvar blockedElements = toMap(\"script,style\");\n\nvar validElements = angular.extend({},\n                                   voidElements,\n                                   blockElements,\n                                   inlineElements,\n                                   optionalEndTagElements);\n\n//Attributes that have href and hence need to be sanitized\nvar uriAttrs = toMap(\"background,cite,href,longdesc,src,xlink:href\");\n\nvar htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +\n    'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +\n    'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +\n    'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +\n    'valign,value,vspace,width');\n\n// SVG attributes (without \"id\" and \"name\" attributes)\n// https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes\nvar svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +\n    'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +\n    'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +\n    'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +\n    'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +\n    'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +\n    'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +\n    'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +\n    'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +\n    'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +\n    'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +\n    'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +\n    'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +\n    'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +\n    'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);\n\nvar validAttrs = angular.extend({},\n                                uriAttrs,\n                                svgAttrs,\n                                htmlAttrs);\n\nfunction toMap(str, lowercaseKeys) {\n  var obj = {}, items = str.split(','), i;\n  for (i = 0; i < items.length; i++) {\n    obj[lowercaseKeys ? angular.lowercase(items[i]) : items[i]] = true;\n  }\n  return obj;\n}\n\nvar inertBodyElement;\n(function(window) {\n  var doc;\n  if (window.document && window.document.implementation) {\n    doc = window.document.implementation.createHTMLDocument(\"inert\");\n  } else {\n    throw $sanitizeMinErr('noinert', \"Can't create an inert html document\");\n  }\n  var docElement = doc.documentElement || doc.getDocumentElement();\n  var bodyElements = docElement.getElementsByTagName('body');\n\n  // usually there should be only one body element in the document, but IE doesn't have any, so we need to create one\n  if (bodyElements.length === 1) {\n    inertBodyElement = bodyElements[0];\n  } else {\n    var html = doc.createElement('html');\n    inertBodyElement = doc.createElement('body');\n    html.appendChild(inertBodyElement);\n    doc.appendChild(html);\n  }\n})(window);\n\n/**\n * @example\n * htmlParser(htmlString, {\n *     start: function(tag, attrs) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * });\n *\n * @param {string} html string\n * @param {object} handler\n */\nfunction htmlParser(html, handler) {\n  if (html === null || html === undefined) {\n    html = '';\n  } else if (typeof html !== 'string') {\n    html = '' + html;\n  }\n  inertBodyElement.innerHTML = html;\n\n  //mXSS protection\n  var mXSSAttempts = 5;\n  do {\n    if (mXSSAttempts === 0) {\n      throw $sanitizeMinErr('uinput', \"Failed to sanitize html because the input is unstable\");\n    }\n    mXSSAttempts--;\n\n    // strip custom-namespaced attributes on IE<=11\n    if (document.documentMode <= 11) {\n      stripCustomNsAttrs(inertBodyElement);\n    }\n    html = inertBodyElement.innerHTML; //trigger mXSS\n    inertBodyElement.innerHTML = html;\n  } while (html !== inertBodyElement.innerHTML);\n\n  var node = inertBodyElement.firstChild;\n  while (node) {\n    switch (node.nodeType) {\n      case 1: // ELEMENT_NODE\n        handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));\n        break;\n      case 3: // TEXT NODE\n        handler.chars(node.textContent);\n        break;\n    }\n\n    var nextNode;\n    if (!(nextNode = node.firstChild)) {\n      if (node.nodeType == 1) {\n        handler.end(node.nodeName.toLowerCase());\n      }\n      nextNode = node.nextSibling;\n      if (!nextNode) {\n        while (nextNode == null) {\n          node = node.parentNode;\n          if (node === inertBodyElement) break;\n          nextNode = node.nextSibling;\n          if (node.nodeType == 1) {\n            handler.end(node.nodeName.toLowerCase());\n          }\n        }\n      }\n    }\n    node = nextNode;\n  }\n\n  while (node = inertBodyElement.firstChild) {\n    inertBodyElement.removeChild(node);\n  }\n}\n\nfunction attrToMap(attrs) {\n  var map = {};\n  for (var i = 0, ii = attrs.length; i < ii; i++) {\n    var attr = attrs[i];\n    map[attr.name] = attr.value;\n  }\n  return map;\n}\n\n\n/**\n * Escapes all potentially dangerous characters, so that the\n * resulting string can be safely inserted into attribute or\n * element text.\n * @param value\n * @returns {string} escaped text\n */\nfunction encodeEntities(value) {\n  return value.\n    replace(/&/g, '&amp;').\n    replace(SURROGATE_PAIR_REGEXP, function(value) {\n      var hi = value.charCodeAt(0);\n      var low = value.charCodeAt(1);\n      return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';\n    }).\n    replace(NON_ALPHANUMERIC_REGEXP, function(value) {\n      return '&#' + value.charCodeAt(0) + ';';\n    }).\n    replace(/</g, '&lt;').\n    replace(/>/g, '&gt;');\n}\n\n/**\n * create an HTML/XML writer which writes to buffer\n * @param {Array} buf use buf.join('') to get out sanitized html string\n * @returns {object} in the form of {\n *     start: function(tag, attrs) {},\n *     end: function(tag) {},\n *     chars: function(text) {},\n *     comment: function(text) {}\n * }\n */\nfunction htmlSanitizeWriter(buf, uriValidator) {\n  var ignoreCurrentElement = false;\n  var out = angular.bind(buf, buf.push);\n  return {\n    start: function(tag, attrs) {\n      tag = angular.lowercase(tag);\n      if (!ignoreCurrentElement && blockedElements[tag]) {\n        ignoreCurrentElement = tag;\n      }\n      if (!ignoreCurrentElement && validElements[tag] === true) {\n        out('<');\n        out(tag);\n        angular.forEach(attrs, function(value, key) {\n          var lkey=angular.lowercase(key);\n          var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');\n          if (validAttrs[lkey] === true &&\n            (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {\n            out(' ');\n            out(key);\n            out('=\"');\n            out(encodeEntities(value));\n            out('\"');\n          }\n        });\n        out('>');\n      }\n    },\n    end: function(tag) {\n      tag = angular.lowercase(tag);\n      if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {\n        out('</');\n        out(tag);\n        out('>');\n      }\n      if (tag == ignoreCurrentElement) {\n        ignoreCurrentElement = false;\n      }\n    },\n    chars: function(chars) {\n      if (!ignoreCurrentElement) {\n        out(encodeEntities(chars));\n      }\n    }\n  };\n}\n\n\n/**\n * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare\n * ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want\n * to allow any of these custom attributes. This method strips them all.\n *\n * @param node Root element to process\n */\nfunction stripCustomNsAttrs(node) {\n  if (node.nodeType === Node.ELEMENT_NODE) {\n    var attrs = node.attributes;\n    for (var i = 0, l = attrs.length; i < l; i++) {\n      var attrNode = attrs[i];\n      var attrName = attrNode.name.toLowerCase();\n      if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {\n        node.removeAttributeNode(attrNode);\n        i--;\n        l--;\n      }\n    }\n  }\n\n  var nextNode = node.firstChild;\n  if (nextNode) {\n    stripCustomNsAttrs(nextNode);\n  }\n\n  nextNode = node.nextSibling;\n  if (nextNode) {\n    stripCustomNsAttrs(nextNode);\n  }\n}\n\n\n\n// define ngSanitize module and register $sanitize service\nangular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);\n\n/* global sanitizeText: false */\n\n/**\n * @ngdoc filter\n * @name linky\n * @kind function\n *\n * @description\n * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and\n * plain email address links.\n *\n * Requires the {@link ngSanitize `ngSanitize`} module to be installed.\n *\n * @param {string} text Input text.\n * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.\n * @param {object|function(url)} [attributes] Add custom attributes to the link element.\n *\n *    Can be one of:\n *\n *    - `object`: A map of attributes\n *    - `function`: Takes the url as a parameter and returns a map of attributes\n *\n *    If the map of attributes contains a value for `target`, it overrides the value of\n *    the target parameter.\n *\n *\n * @returns {string} Html-linkified and {@link $sanitize sanitized} text.\n *\n * @usage\n   <span ng-bind-html=\"linky_expression | linky\"></span>\n *\n * @example\n   <example module=\"linkyExample\" deps=\"angular-sanitize.js\">\n     <file name=\"index.html\">\n       <div ng-controller=\"ExampleController\">\n       Snippet: <textarea ng-model=\"snippet\" cols=\"60\" rows=\"3\"></textarea>\n       <table>\n         <tr>\n           <th>Filter</th>\n           <th>Source</th>\n           <th>Rendered</th>\n         </tr>\n         <tr id=\"linky-filter\">\n           <td>linky filter</td>\n           <td>\n             <pre>&lt;div ng-bind-html=\"snippet | linky\"&gt;<br>&lt;/div&gt;</pre>\n           </td>\n           <td>\n             <div ng-bind-html=\"snippet | linky\"></div>\n           </td>\n         </tr>\n         <tr id=\"linky-target\">\n          <td>linky target</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithSingleURL | linky:'_blank'\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithSingleURL | linky:'_blank'\"></div>\n          </td>\n         </tr>\n         <tr id=\"linky-custom-attributes\">\n          <td>linky custom attributes</td>\n          <td>\n            <pre>&lt;div ng-bind-html=\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\"&gt;<br>&lt;/div&gt;</pre>\n          </td>\n          <td>\n            <div ng-bind-html=\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\"></div>\n          </td>\n         </tr>\n         <tr id=\"escaped-html\">\n           <td>no filter</td>\n           <td><pre>&lt;div ng-bind=\"snippet\"&gt;<br>&lt;/div&gt;</pre></td>\n           <td><div ng-bind=\"snippet\"></div></td>\n         </tr>\n       </table>\n     </file>\n     <file name=\"script.js\">\n       angular.module('linkyExample', ['ngSanitize'])\n         .controller('ExampleController', ['$scope', function($scope) {\n           $scope.snippet =\n             'Pretty text with some links:\\n'+\n             'http://angularjs.org/,\\n'+\n             'mailto:us@somewhere.org,\\n'+\n             'another@somewhere.org,\\n'+\n             'and one more: ftp://127.0.0.1/.';\n           $scope.snippetWithSingleURL = 'http://angularjs.org/';\n         }]);\n     </file>\n     <file name=\"protractor.js\" type=\"protractor\">\n       it('should linkify the snippet with urls', function() {\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);\n       });\n\n       it('should not linkify snippet without the linky filter', function() {\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).\n             toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +\n                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');\n         expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);\n       });\n\n       it('should update', function() {\n         element(by.model('snippet')).clear();\n         element(by.model('snippet')).sendKeys('new http://link.');\n         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).\n             toBe('new http://link.');\n         expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);\n         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())\n             .toBe('new http://link.');\n       });\n\n       it('should work with the target property', function() {\n        expect(element(by.id('linky-target')).\n            element(by.binding(\"snippetWithSingleURL | linky:'_blank'\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');\n       });\n\n       it('should optionally add custom attributes', function() {\n        expect(element(by.id('linky-custom-attributes')).\n            element(by.binding(\"snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}\")).getText()).\n            toBe('http://angularjs.org/');\n        expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');\n       });\n     </file>\n   </example>\n */\nangular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {\n  var LINKY_URL_REGEXP =\n        /((ftp|https?):\\/\\/|(www\\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\\S*[^\\s.;,(){}<>\"\\u201d\\u2019]/i,\n      MAILTO_REGEXP = /^mailto:/i;\n\n  var linkyMinErr = angular.$$minErr('linky');\n  var isString = angular.isString;\n\n  return function(text, target, attributes) {\n    if (text == null || text === '') return text;\n    if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);\n\n    var match;\n    var raw = text;\n    var html = [];\n    var url;\n    var i;\n    while ((match = raw.match(LINKY_URL_REGEXP))) {\n      // We can not end in these as they are sometimes found at the end of the sentence\n      url = match[0];\n      // if we did not match ftp/http/www/mailto then assume mailto\n      if (!match[2] && !match[4]) {\n        url = (match[3] ? 'http://' : 'mailto:') + url;\n      }\n      i = match.index;\n      addText(raw.substr(0, i));\n      addLink(url, match[0].replace(MAILTO_REGEXP, ''));\n      raw = raw.substring(i + match[0].length);\n    }\n    addText(raw);\n    return $sanitize(html.join(''));\n\n    function addText(text) {\n      if (!text) {\n        return;\n      }\n      html.push(sanitizeText(text));\n    }\n\n    function addLink(url, text) {\n      var key;\n      html.push('<a ');\n      if (angular.isFunction(attributes)) {\n        attributes = attributes(url);\n      }\n      if (angular.isObject(attributes)) {\n        for (key in attributes) {\n          html.push(key + '=\"' + attributes[key] + '\" ');\n        }\n      } else {\n        attributes = {};\n      }\n      if (angular.isDefined(target) && !('target' in attributes)) {\n        html.push('target=\"',\n                  target,\n                  '\" ');\n      }\n      html.push('href=\"',\n                url.replace(/\"/g, '&quot;'),\n                '\">');\n      addText(text);\n      html.push('</a>');\n    }\n  };\n}]);\n\n\n})(window, window.angular);\n\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/**\n * State-based routing for AngularJS\n * @version v0.2.13\n * @link http://angular-ui.github.com/\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n\n/* commonjs package manager support (eg componentjs) */\nif (typeof module !== \"undefined\" && typeof exports !== \"undefined\" && module.exports === exports){\n  module.exports = 'ui.router';\n}\n\n(function (window, angular, undefined) {\n/*jshint globalstrict:true*/\n/*global angular:false*/\n'use strict';\n\nvar isDefined = angular.isDefined,\n    isFunction = angular.isFunction,\n    isString = angular.isString,\n    isObject = angular.isObject,\n    isArray = angular.isArray,\n    forEach = angular.forEach,\n    extend = angular.extend,\n    copy = angular.copy;\n\nfunction inherit(parent, extra) {\n  return extend(new (extend(function() {}, { prototype: parent }))(), extra);\n}\n\nfunction merge(dst) {\n  forEach(arguments, function(obj) {\n    if (obj !== dst) {\n      forEach(obj, function(value, key) {\n        if (!dst.hasOwnProperty(key)) dst[key] = value;\n      });\n    }\n  });\n  return dst;\n}\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nfunction ancestors(first, second) {\n  var path = [];\n\n  for (var n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * IE8-safe wrapper for `Object.keys()`.\n *\n * @param {Object} object A JavaScript object.\n * @return {Array} Returns the keys of the object as an array.\n */\nfunction objectKeys(object) {\n  if (Object.keys) {\n    return Object.keys(object);\n  }\n  var result = [];\n\n  angular.forEach(object, function(val, key) {\n    result.push(key);\n  });\n  return result;\n}\n\n/**\n * IE8-safe wrapper for `Array.prototype.indexOf()`.\n *\n * @param {Array} array A JavaScript array.\n * @param {*} value A value to search the array for.\n * @return {Number} Returns the array index value of `value`, or `-1` if not present.\n */\nfunction indexOf(array, value) {\n  if (Array.prototype.indexOf) {\n    return array.indexOf(value, Number(arguments[2]) || 0);\n  }\n  var len = array.length >>> 0, from = Number(arguments[2]) || 0;\n  from = (from < 0) ? Math.ceil(from) : Math.floor(from);\n\n  if (from < 0) from += len;\n\n  for (; from < len; from++) {\n    if (from in array && array[from] === value) return from;\n  }\n  return -1;\n}\n\n/**\n * Merges a set of parameters with all parameters inherited between the common parents of the\n * current state and a given destination state.\n *\n * @param {Object} currentParams The value of the current state parameters ($stateParams).\n * @param {Object} newParams The set of parameters which will be composited with inherited params.\n * @param {Object} $current Internal definition of object representing the current state.\n * @param {Object} $to Internal definition of object representing state to transition to.\n */\nfunction inheritParams(currentParams, newParams, $current, $to) {\n  var parents = ancestors($current, $to), parentParams, inherited = {}, inheritList = [];\n\n  for (var i in parents) {\n    if (!parents[i].params) continue;\n    parentParams = objectKeys(parents[i].params);\n    if (!parentParams.length) continue;\n\n    for (var j in parentParams) {\n      if (indexOf(inheritList, parentParams[j]) >= 0) continue;\n      inheritList.push(parentParams[j]);\n      inherited[parentParams[j]] = currentParams[parentParams[j]];\n    }\n  }\n  return extend({}, inherited, newParams);\n}\n\n/**\n * Performs a non-strict comparison of the subset of two objects, defined by a list of keys.\n *\n * @param {Object} a The first object.\n * @param {Object} b The second object.\n * @param {Array} keys The list of keys within each object to compare. If the list is empty or not specified,\n *                     it defaults to the list of keys in `a`.\n * @return {Boolean} Returns `true` if the keys match, otherwise `false`.\n */\nfunction equalForKeys(a, b, keys) {\n  if (!keys) {\n    keys = [];\n    for (var n in a) keys.push(n); // Used instead of Object.keys() for IE8 compatibility\n  }\n\n  for (var i=0; i<keys.length; i++) {\n    var k = keys[i];\n    if (a[k] != b[k]) return false; // Not '===', values aren't necessarily normalized\n  }\n  return true;\n}\n\n/**\n * Returns the subset of an object, based on a list of keys.\n *\n * @param {Array} keys\n * @param {Object} values\n * @return {Boolean} Returns a subset of `values`.\n */\nfunction filterByKeys(keys, values) {\n  var filtered = {};\n\n  forEach(keys, function (name) {\n    filtered[name] = values[name];\n  });\n  return filtered;\n}\n\n// like _.indexBy\n// when you know that your index values will be unique, or you want last-one-in to win\nfunction indexBy(array, propName) {\n  var result = {};\n  forEach(array, function(item) {\n    result[item[propName]] = item;\n  });\n  return result;\n}\n\n// extracted from underscore.js\n// Return a copy of the object only containing the whitelisted properties.\nfunction pick(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  forEach(keys, function(key) {\n    if (key in obj) copy[key] = obj[key];\n  });\n  return copy;\n}\n\n// extracted from underscore.js\n// Return a copy of the object omitting the blacklisted properties.\nfunction omit(obj) {\n  var copy = {};\n  var keys = Array.prototype.concat.apply(Array.prototype, Array.prototype.slice.call(arguments, 1));\n  for (var key in obj) {\n    if (indexOf(keys, key) == -1) copy[key] = obj[key];\n  }\n  return copy;\n}\n\nfunction pluck(collection, key) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = isFunction(key) ? key(val) : val[key];\n  });\n  return result;\n}\n\nfunction filter(collection, callback) {\n  var array = isArray(collection);\n  var result = array ? [] : {};\n  forEach(collection, function(val, i) {\n    if (callback(val, i)) {\n      result[array ? result.length : i] = val;\n    }\n  });\n  return result;\n}\n\nfunction map(collection, callback) {\n  var result = isArray(collection) ? [] : {};\n\n  forEach(collection, function(val, i) {\n    result[i] = callback(val, i);\n  });\n  return result;\n}\n\n/**\n * @ngdoc overview\n * @name ui.router.util\n *\n * @description\n * # ui.router.util sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n *\n */\nangular.module('ui.router.util', ['ng']);\n\n/**\n * @ngdoc overview\n * @name ui.router.router\n * \n * @requires ui.router.util\n *\n * @description\n * # ui.router.router sub-module\n *\n * This module is a dependency of other sub-modules. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n */\nangular.module('ui.router.router', ['ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router.state\n * \n * @requires ui.router.router\n * @requires ui.router.util\n *\n * @description\n * # ui.router.state sub-module\n *\n * This module is a dependency of the main ui.router module. Do not include this module as a dependency\n * in your angular app (use {@link ui.router} module instead).\n * \n */\nangular.module('ui.router.state', ['ui.router.router', 'ui.router.util']);\n\n/**\n * @ngdoc overview\n * @name ui.router\n *\n * @requires ui.router.state\n *\n * @description\n * # ui.router\n * \n * ## The main module for ui.router \n * There are several sub-modules included with the ui.router module, however only this module is needed\n * as a dependency within your angular app. The other modules are for organization purposes. \n *\n * The modules are:\n * * ui.router - the main \"umbrella\" module\n * * ui.router.router - \n * \n * *You'll need to include **only** this module as the dependency within your angular app.*\n * \n * <pre>\n * <!doctype html>\n * <html ng-app=\"myApp\">\n * <head>\n *   <script src=\"js/angular.js\"></script>\n *   <!-- Include the ui-router script -->\n *   <script src=\"js/angular-ui-router.min.js\"></script>\n *   <script>\n *     // ...and add 'ui.router' as a dependency\n *     var myApp = angular.module('myApp', ['ui.router']);\n *   </script>\n * </head>\n * <body>\n * </body>\n * </html>\n * </pre>\n */\nangular.module('ui.router', ['ui.router.state']);\n\nangular.module('ui.router.compat', ['ui.router']);\n\n/**\n * @ngdoc object\n * @name ui.router.util.$resolve\n *\n * @requires $q\n * @requires $injector\n *\n * @description\n * Manages resolution of (acyclic) graphs of promises.\n */\n$Resolve.$inject = ['$q', '$injector'];\nfunction $Resolve(  $q,    $injector) {\n  \n  var VISIT_IN_PROGRESS = 1,\n      VISIT_DONE = 2,\n      NOTHING = {},\n      NO_DEPENDENCIES = [],\n      NO_LOCALS = NOTHING,\n      NO_PARENT = extend($q.when(NOTHING), { $$promises: NOTHING, $$values: NOTHING });\n  \n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#study\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Studies a set of invocables that are likely to be used multiple times.\n   * <pre>\n   * $resolve.study(invocables)(locals, parent, self)\n   * </pre>\n   * is equivalent to\n   * <pre>\n   * $resolve.resolve(invocables, locals, parent, self)\n   * </pre>\n   * but the former is more efficient (in fact `resolve` just calls `study` \n   * internally).\n   *\n   * @param {object} invocables Invocable objects\n   * @return {function} a function to pass in locals, parent and self\n   */\n  this.study = function (invocables) {\n    if (!isObject(invocables)) throw new Error(\"'invocables' must be an object\");\n    var invocableKeys = objectKeys(invocables || {});\n    \n    // Perform a topological sort of invocables to build an ordered plan\n    var plan = [], cycle = [], visited = {};\n    function visit(value, key) {\n      if (visited[key] === VISIT_DONE) return;\n      \n      cycle.push(key);\n      if (visited[key] === VISIT_IN_PROGRESS) {\n        cycle.splice(0, indexOf(cycle, key));\n        throw new Error(\"Cyclic dependency: \" + cycle.join(\" -> \"));\n      }\n      visited[key] = VISIT_IN_PROGRESS;\n      \n      if (isString(value)) {\n        plan.push(key, [ function() { return $injector.get(value); }], NO_DEPENDENCIES);\n      } else {\n        var params = $injector.annotate(value);\n        forEach(params, function (param) {\n          if (param !== key && invocables.hasOwnProperty(param)) visit(invocables[param], param);\n        });\n        plan.push(key, value, params);\n      }\n      \n      cycle.pop();\n      visited[key] = VISIT_DONE;\n    }\n    forEach(invocables, visit);\n    invocables = cycle = visited = null; // plan is all that's required\n    \n    function isResolve(value) {\n      return isObject(value) && value.then && value.$$promises;\n    }\n    \n    return function (locals, parent, self) {\n      if (isResolve(locals) && self === undefined) {\n        self = parent; parent = locals; locals = null;\n      }\n      if (!locals) locals = NO_LOCALS;\n      else if (!isObject(locals)) {\n        throw new Error(\"'locals' must be an object\");\n      }       \n      if (!parent) parent = NO_PARENT;\n      else if (!isResolve(parent)) {\n        throw new Error(\"'parent' must be a promise returned by $resolve.resolve()\");\n      }\n      \n      // To complete the overall resolution, we have to wait for the parent\n      // promise and for the promise for each invokable in our plan.\n      var resolution = $q.defer(),\n          result = resolution.promise,\n          promises = result.$$promises = {},\n          values = extend({}, locals),\n          wait = 1 + plan.length/3,\n          merged = false;\n          \n      function done() {\n        // Merge parent values we haven't got yet and publish our own $$values\n        if (!--wait) {\n          if (!merged) merge(values, parent.$$values); \n          result.$$values = values;\n          result.$$promises = result.$$promises || true; // keep for isResolve()\n          delete result.$$inheritedValues;\n          resolution.resolve(values);\n        }\n      }\n      \n      function fail(reason) {\n        result.$$failure = reason;\n        resolution.reject(reason);\n      }\n\n      // Short-circuit if parent has already failed\n      if (isDefined(parent.$$failure)) {\n        fail(parent.$$failure);\n        return result;\n      }\n      \n      if (parent.$$inheritedValues) {\n        merge(values, omit(parent.$$inheritedValues, invocableKeys));\n      }\n\n      // Merge parent values if the parent has already resolved, or merge\n      // parent promises and wait if the parent resolve is still in progress.\n      extend(promises, parent.$$promises);\n      if (parent.$$values) {\n        merged = merge(values, omit(parent.$$values, invocableKeys));\n        result.$$inheritedValues = omit(parent.$$values, invocableKeys);\n        done();\n      } else {\n        if (parent.$$inheritedValues) {\n          result.$$inheritedValues = omit(parent.$$inheritedValues, invocableKeys);\n        }        \n        parent.then(done, fail);\n      }\n      \n      // Process each invocable in the plan, but ignore any where a local of the same name exists.\n      for (var i=0, ii=plan.length; i<ii; i+=3) {\n        if (locals.hasOwnProperty(plan[i])) done();\n        else invoke(plan[i], plan[i+1], plan[i+2]);\n      }\n      \n      function invoke(key, invocable, params) {\n        // Create a deferred for this invocation. Failures will propagate to the resolution as well.\n        var invocation = $q.defer(), waitParams = 0;\n        function onfailure(reason) {\n          invocation.reject(reason);\n          fail(reason);\n        }\n        // Wait for any parameter that we have a promise for (either from parent or from this\n        // resolve; in that case study() will have made sure it's ordered before us in the plan).\n        forEach(params, function (dep) {\n          if (promises.hasOwnProperty(dep) && !locals.hasOwnProperty(dep)) {\n            waitParams++;\n            promises[dep].then(function (result) {\n              values[dep] = result;\n              if (!(--waitParams)) proceed();\n            }, onfailure);\n          }\n        });\n        if (!waitParams) proceed();\n        function proceed() {\n          if (isDefined(result.$$failure)) return;\n          try {\n            invocation.resolve($injector.invoke(invocable, self, values));\n            invocation.promise.then(function (result) {\n              values[key] = result;\n              done();\n            }, onfailure);\n          } catch (e) {\n            onfailure(e);\n          }\n        }\n        // Publish promise synchronously; invocations further down in the plan may depend on it.\n        promises[key] = invocation.promise;\n      }\n      \n      return result;\n    };\n  };\n  \n  /**\n   * @ngdoc function\n   * @name ui.router.util.$resolve#resolve\n   * @methodOf ui.router.util.$resolve\n   *\n   * @description\n   * Resolves a set of invocables. An invocable is a function to be invoked via \n   * `$injector.invoke()`, and can have an arbitrary number of dependencies. \n   * An invocable can either return a value directly,\n   * or a `$q` promise. If a promise is returned it will be resolved and the \n   * resulting value will be used instead. Dependencies of invocables are resolved \n   * (in this order of precedence)\n   *\n   * - from the specified `locals`\n   * - from another invocable that is part of this `$resolve` call\n   * - from an invocable that is inherited from a `parent` call to `$resolve` \n   *   (or recursively\n   * - from any ancestor `$resolve` of that parent).\n   *\n   * The return value of `$resolve` is a promise for an object that contains \n   * (in this order of precedence)\n   *\n   * - any `locals` (if specified)\n   * - the resolved return values of all injectables\n   * - any values inherited from a `parent` call to `$resolve` (if specified)\n   *\n   * The promise will resolve after the `parent` promise (if any) and all promises \n   * returned by injectables have been resolved. If any invocable \n   * (or `$injector.invoke`) throws an exception, or if a promise returned by an \n   * invocable is rejected, the `$resolve` promise is immediately rejected with the \n   * same error. A rejection of a `parent` promise (if specified) will likewise be \n   * propagated immediately. Once the `$resolve` promise has been rejected, no \n   * further invocables will be called.\n   * \n   * Cyclic dependencies between invocables are not permitted and will caues `$resolve`\n   * to throw an error. As a special case, an injectable can depend on a parameter \n   * with the same name as the injectable, which will be fulfilled from the `parent` \n   * injectable of the same name. This allows inherited values to be decorated. \n   * Note that in this case any other injectable in the same `$resolve` with the same\n   * dependency would see the decorated value, not the inherited value.\n   *\n   * Note that missing dependencies -- unlike cyclic dependencies -- will cause an \n   * (asynchronous) rejection of the `$resolve` promise rather than a (synchronous) \n   * exception.\n   *\n   * Invocables are invoked eagerly as soon as all dependencies are available. \n   * This is true even for dependencies inherited from a `parent` call to `$resolve`.\n   *\n   * As a special case, an invocable can be a string, in which case it is taken to \n   * be a service name to be passed to `$injector.get()`. This is supported primarily \n   * for backwards-compatibility with the `resolve` property of `$routeProvider` \n   * routes.\n   *\n   * @param {object} invocables functions to invoke or \n   * `$injector` services to fetch.\n   * @param {object} locals  values to make available to the injectables\n   * @param {object} parent  a promise returned by another call to `$resolve`.\n   * @param {object} self  the `this` for the invoked methods\n   * @return {object} Promise for an object that contains the resolved return value\n   * of all invocables, as well as any inherited and local values.\n   */\n  this.resolve = function (invocables, locals, parent, self) {\n    return this.study(invocables)(locals, parent, self);\n  };\n}\n\nangular.module('ui.router.util').service('$resolve', $Resolve);\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$templateFactory\n *\n * @requires $http\n * @requires $templateCache\n * @requires $injector\n *\n * @description\n * Service. Manages loading of templates.\n */\n$TemplateFactory.$inject = ['$http', '$templateCache', '$injector'];\nfunction $TemplateFactory(  $http,   $templateCache,   $injector) {\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromConfig\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a configuration object. \n   *\n   * @param {object} config Configuration object for which to load a template. \n   * The following properties are search in the specified order, and the first one \n   * that is defined is used to create the template:\n   *\n   * @param {string|object} config.template html string template or function to \n   * load via {@link ui.router.util.$templateFactory#fromString fromString}.\n   * @param {string|object} config.templateUrl url to load or a function returning \n   * the url to load via {@link ui.router.util.$templateFactory#fromUrl fromUrl}.\n   * @param {Function} config.templateProvider function to invoke via \n   * {@link ui.router.util.$templateFactory#fromProvider fromProvider}.\n   * @param {object} params  Parameters to pass to the template function.\n   * @param {object} locals Locals to pass to `invoke` if the template is loaded \n   * via a `templateProvider`. Defaults to `{ params: params }`.\n   *\n   * @return {string|object}  The template html as a string, or a promise for \n   * that string,or `null` if no template is configured.\n   */\n  this.fromConfig = function (config, params, locals) {\n    return (\n      isDefined(config.template) ? this.fromString(config.template, params) :\n      isDefined(config.templateUrl) ? this.fromUrl(config.templateUrl, params) :\n      isDefined(config.templateProvider) ? this.fromProvider(config.templateProvider, params, locals) :\n      null\n    );\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromString\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param {string|object} template html template as a string or function that \n   * returns an html template as a string.\n   * @param {object} params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that \n   * string.\n   */\n  this.fromString = function (template, params) {\n    return isFunction(template) ? template(params) : template;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromUrl\n   * @methodOf ui.router.util.$templateFactory\n   * \n   * @description\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function \n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromUrl = function (url, params) {\n    if (isFunction(url)) url = url(params);\n    if (url == null) return null;\n    else return $http\n        .get(url, { cache: $templateCache, headers: { Accept: 'text/html' }})\n        .then(function(response) { return response.data; });\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$templateFactory#fromProvider\n   * @methodOf ui.router.util.$templateFactory\n   *\n   * @description\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param {Function} provider Function to invoke via `$injector.invoke`\n   * @param {Object} params Parameters for the template.\n   * @param {Object} locals Locals to pass to `invoke`. Defaults to \n   * `{ params: params }`.\n   * @return {string|Promise.<string>} The template html as a string, or a promise \n   * for that string.\n   */\n  this.fromProvider = function (provider, params, locals) {\n    return $injector.invoke(provider, null, locals || { params: params });\n  };\n}\n\nangular.module('ui.router.util').service('$templateFactory', $TemplateFactory);\n\nvar $$UMFP; // reference to $UrlMatcherFactoryProvider\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:UrlMatcher\n *\n * @description\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL. A URL pattern consists of a path pattern, optionally followed by '?' and a list\n * of search parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by {@link ui.router.util.type:UrlMatcher#methods_exec exec}.\n * \n * Path parameter placeholders can be specified using simple colon/catch-all syntax or curly brace\n * syntax, which optionally allows a regular expression for the parameter to be specified:\n *\n * * `':'` name - colon placeholder\n * * `'*'` name - catch-all placeholder\n * * `'{' name '}'` - curly placeholder\n * * `'{' name ':' regexp|type '}'` - curly placeholder with regexp or type name. Should the\n *   regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters). For colon \n * placeholders or curly placeholders without an explicit regexp, a path parameter matches any\n * number of characters other than '/'. For catch-all placeholders the path parameter matches\n * any number of characters.\n * \n * Examples:\n * \n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n *   in the built-in  `date` Type matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n * @param {string} pattern  The pattern to compile into a matcher.\n * @param {Object} config  A configuration object hash:\n * @param {Object=} parentMatcher Used to concatenate the pattern/config onto\n *   an existing UrlMatcher\n *\n * * `caseInsensitive` - `true` if URL matching should be case insensitive, otherwise `false`, the default value (for backward compatibility) is `false`.\n * * `strict` - `false` if matching against a URL with a trailing slash should be treated as equivalent to a URL without a trailing slash, the default value is `true`.\n *\n * @property {string} prefix  A static prefix of this pattern. The matcher guarantees that any\n *   URL matching this matcher (i.e. any string for which {@link ui.router.util.type:UrlMatcher#methods_exec exec()} returns\n *   non-null) will start with this prefix.\n *\n * @property {string} source  The pattern that was passed into the constructor\n *\n * @property {string} sourcePath  The path portion of the source property\n *\n * @property {string} sourceSearch  The search portion of the source property\n *\n * @property {string} regex  The constructed regex that will be used to match against the url when \n *   it is time to determine which url will match.\n *\n * @returns {Object}  New `UrlMatcher` object\n */\nfunction UrlMatcher(pattern, config, parentMatcher) {\n  config = extend({ params: {} }, isObject(config) ? config : {});\n\n  // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n  //   '*' name\n  //   ':' name\n  //   '{' name '}'\n  //   '{' name ':' regexp '}'\n  // The regular expression is somewhat complicated due to the need to allow curly braces\n  // inside the regular expression. The placeholder regexp breaks down as follows:\n  //    ([:*])([\\w\\[\\]]+)              - classic placeholder ($1 / $2) (search version has - for snake-case)\n  //    \\{([\\w\\[\\]]+)(?:\\:( ... ))?\\}  - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n  //    (?: ... | ... | ... )+         - the regexp consists of any number of atoms, an atom being either\n  //    [^{}\\\\]+                       - anything other than curly braces or backslash\n  //    \\\\.                            - a backslash escape\n  //    \\{(?:[^{}\\\\]+|\\\\.)*\\}          - a matched set of curly braces containing other atoms\n  var placeholder       = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      searchPlaceholder = /([:]?)([\\w\\[\\]-]+)|\\{([\\w\\[\\]-]+)(?:\\:((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g,\n      compiled = '^', last = 0, m,\n      segments = this.segments = [],\n      parentParams = parentMatcher ? parentMatcher.params : {},\n      params = this.params = parentMatcher ? parentMatcher.params.$$new() : new $$UMFP.ParamSet(),\n      paramNames = [];\n\n  function addParameter(id, type, config, location) {\n    paramNames.push(id);\n    if (parentParams[id]) return parentParams[id];\n    if (!/^\\w+(-+\\w+)*(?:\\[\\])?$/.test(id)) throw new Error(\"Invalid parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    if (params[id]) throw new Error(\"Duplicate parameter name '\" + id + \"' in pattern '\" + pattern + \"'\");\n    params[id] = new $$UMFP.Param(id, type, config, location);\n    return params[id];\n  }\n\n  function quoteRegExp(string, pattern, squash) {\n    var surroundPattern = ['',''], result = string.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, \"\\\\$&\");\n    if (!pattern) return result;\n    switch(squash) {\n      case false: surroundPattern = ['(', ')'];   break;\n      case true:  surroundPattern = ['?(', ')?']; break;\n      default:    surroundPattern = ['(' + squash + \"|\", ')?'];  break;\n    }\n    return result + surroundPattern[0] + pattern + surroundPattern[1];\n  }\n\n  this.source = pattern;\n\n  // Split into static segments separated by path parameter placeholders.\n  // The number of segments is always 1 more than the number of parameters.\n  function matchDetails(m, isSearch) {\n    var id, regexp, segment, type, cfg, arrayMode;\n    id          = m[2] || m[3]; // IE[78] returns '' for unmatched groups instead of null\n    cfg         = config.params[id];\n    segment     = pattern.substring(last, m.index);\n    regexp      = isSearch ? m[4] : m[4] || (m[1] == '*' ? '.*' : null);\n    type        = $$UMFP.type(regexp || \"string\") || inherit($$UMFP.type(\"string\"), { pattern: new RegExp(regexp) });\n    return {\n      id: id, regexp: regexp, segment: segment, type: type, cfg: cfg\n    };\n  }\n\n  var p, param, segment;\n  while ((m = placeholder.exec(pattern))) {\n    p = matchDetails(m, false);\n    if (p.segment.indexOf('?') >= 0) break; // we're into the search part\n\n    param = addParameter(p.id, p.type, p.cfg, \"path\");\n    compiled += quoteRegExp(p.segment, param.type.pattern.source, param.squash);\n    segments.push(p.segment);\n    last = placeholder.lastIndex;\n  }\n  segment = pattern.substring(last);\n\n  // Find any search parameter names and remove them from the last segment\n  var i = segment.indexOf('?');\n\n  if (i >= 0) {\n    var search = this.sourceSearch = segment.substring(i);\n    segment = segment.substring(0, i);\n    this.sourcePath = pattern.substring(0, last + i);\n\n    if (search.length > 0) {\n      last = 0;\n      while ((m = searchPlaceholder.exec(search))) {\n        p = matchDetails(m, true);\n        param = addParameter(p.id, p.type, p.cfg, \"search\");\n        last = placeholder.lastIndex;\n        // check if ?&\n      }\n    }\n  } else {\n    this.sourcePath = pattern;\n    this.sourceSearch = '';\n  }\n\n  compiled += quoteRegExp(segment) + (config.strict === false ? '\\/?' : '') + '$';\n  segments.push(segment);\n\n  this.regexp = new RegExp(compiled, config.caseInsensitive ? 'i' : undefined);\n  this.prefix = segments[0];\n  this.$$paramNames = paramNames;\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#concat\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns a new matcher for a pattern constructed by appending the path part and adding the\n * search parameters of the specified pattern to this pattern. The current pattern is not\n * modified. This can be understood as creating a pattern for URLs that are relative to (or\n * suffixes of) the current pattern.\n *\n * @example\n * The following two matchers are equivalent:\n * <pre>\n * new UrlMatcher('/user/{id}?q').concat('/details?date');\n * new UrlMatcher('/user/{id}/details?q&date');\n * </pre>\n *\n * @param {string} pattern  The pattern to append.\n * @param {Object} config  An object hash of the configuration for the matcher.\n * @returns {UrlMatcher}  A matcher for the concatenated pattern.\n */\nUrlMatcher.prototype.concat = function (pattern, config) {\n  // Because order of search parameters is irrelevant, we can add our own search\n  // parameters to the end of the new pattern. Parse the new pattern by itself\n  // and then join the bits together, but it's much easier to do this on a string level.\n  var defaultConfig = {\n    caseInsensitive: $$UMFP.caseInsensitive(),\n    strict: $$UMFP.strictMode(),\n    squash: $$UMFP.defaultSquashPolicy()\n  };\n  return new UrlMatcher(this.sourcePath + pattern + this.sourceSearch, extend(defaultConfig, config), this);\n};\n\nUrlMatcher.prototype.toString = function () {\n  return this.source;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#exec\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Tests the specified path against this matcher, and returns an object containing the captured\n * parameter values, or null if the path does not match. The returned object contains the values\n * of any search parameters that are mentioned in the pattern, but their value may be null if\n * they are not present in `searchParams`. This means that search parameters are always treated\n * as optional.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n *   x: '1', q: 'hello'\n * });\n * // returns { id: 'bob', q: 'hello', r: null }\n * </pre>\n *\n * @param {string} path  The URL path to match, e.g. `$location.path()`.\n * @param {Object} searchParams  URL search parameters, e.g. `$location.search()`.\n * @returns {Object}  The captured parameter values.\n */\nUrlMatcher.prototype.exec = function (path, searchParams) {\n  var m = this.regexp.exec(path);\n  if (!m) return null;\n  searchParams = searchParams || {};\n\n  var paramNames = this.parameters(), nTotal = paramNames.length,\n    nPath = this.segments.length - 1,\n    values = {}, i, j, cfg, paramName;\n\n  if (nPath !== m.length - 1) throw new Error(\"Unbalanced capture group in route '\" + this.source + \"'\");\n\n  function decodePathArray(string) {\n    function reverseString(str) { return str.split(\"\").reverse().join(\"\"); }\n    function unquoteDashes(str) { return str.replace(/\\\\-/, \"-\"); }\n\n    var split = reverseString(string).split(/-(?!\\\\)/);\n    var allReversed = map(split, reverseString);\n    return map(allReversed, unquoteDashes).reverse();\n  }\n\n  for (i = 0; i < nPath; i++) {\n    paramName = paramNames[i];\n    var param = this.params[paramName];\n    var paramVal = m[i+1];\n    // if the param value matches a pre-replace pair, replace the value before decoding.\n    for (j = 0; j < param.replace; j++) {\n      if (param.replace[j].from === paramVal) paramVal = param.replace[j].to;\n    }\n    if (paramVal && param.array === true) paramVal = decodePathArray(paramVal);\n    values[paramName] = param.value(paramVal);\n  }\n  for (/**/; i < nTotal; i++) {\n    paramName = paramNames[i];\n    values[paramName] = this.params[paramName].value(searchParams[paramName]);\n  }\n\n  return values;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#parameters\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Returns the names of all path and search parameters of this pattern in an unspecified order.\n * \n * @returns {Array.<string>}  An array of parameter names. Must be treated as read-only. If the\n *    pattern has no parameters, an empty array is returned.\n */\nUrlMatcher.prototype.parameters = function (param) {\n  if (!isDefined(param)) return this.$$paramNames;\n  return this.params[param] || null;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#validate\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Checks an object hash of parameters to validate their correctness according to the parameter\n * types of this `UrlMatcher`.\n *\n * @param {Object} params The object hash of parameters to validate.\n * @returns {boolean} Returns `true` if `params` validates, otherwise `false`.\n */\nUrlMatcher.prototype.validates = function (params) {\n  return this.params.$$validates(params);\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:UrlMatcher#format\n * @methodOf ui.router.util.type:UrlMatcher\n *\n * @description\n * Creates a URL that matches this pattern by substituting the specified values\n * for the path and search parameters. Null values for path parameters are\n * treated as empty strings.\n *\n * @example\n * <pre>\n * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n * // returns '/user/bob?q=yes'\n * </pre>\n *\n * @param {Object} values  the values to substitute for the parameters in this pattern.\n * @returns {string}  the formatted URL (path and optionally search part).\n */\nUrlMatcher.prototype.format = function (values) {\n  values = values || {};\n  var segments = this.segments, params = this.parameters(), paramset = this.params;\n  if (!this.validates(values)) return null;\n\n  var i, search = false, nPath = segments.length - 1, nTotal = params.length, result = segments[0];\n\n  function encodeDashes(str) { // Replace dashes with encoded \"\\-\"\n    return encodeURIComponent(str).replace(/-/g, function(c) { return '%5C%' + c.charCodeAt(0).toString(16).toUpperCase(); });\n  }\n\n  for (i = 0; i < nTotal; i++) {\n    var isPathParam = i < nPath;\n    var name = params[i], param = paramset[name], value = param.value(values[name]);\n    var isDefaultValue = param.isOptional && param.type.equals(param.value(), value);\n    var squash = isDefaultValue ? param.squash : false;\n    var encoded = param.type.encode(value);\n\n    if (isPathParam) {\n      var nextSegment = segments[i + 1];\n      if (squash === false) {\n        if (encoded != null) {\n          if (isArray(encoded)) {\n            result += map(encoded, encodeDashes).join(\"-\");\n          } else {\n            result += encodeURIComponent(encoded);\n          }\n        }\n        result += nextSegment;\n      } else if (squash === true) {\n        var capture = result.match(/\\/$/) ? /\\/?(.*)/ : /(.*)/;\n        result += nextSegment.match(capture)[1];\n      } else if (isString(squash)) {\n        result += squash + nextSegment;\n      }\n    } else {\n      if (encoded == null || (isDefaultValue && squash !== false)) continue;\n      if (!isArray(encoded)) encoded = [ encoded ];\n      encoded = map(encoded, encodeURIComponent).join('&' + name + '=');\n      result += (search ? '&' : '?') + (name + '=' + encoded);\n      search = true;\n    }\n  }\n\n  return result;\n};\n\n/**\n * @ngdoc object\n * @name ui.router.util.type:Type\n *\n * @description\n * Implements an interface to define custom parameter types that can be decoded from and encoded to\n * string parameters matched in a URL. Used by {@link ui.router.util.type:UrlMatcher `UrlMatcher`}\n * objects when matching or formatting URLs, or comparing or validating parameter values.\n *\n * See {@link ui.router.util.$urlMatcherFactory#methods_type `$urlMatcherFactory#type()`} for more\n * information on registering custom types.\n *\n * @param {Object} config  A configuration object which contains the custom type definition.  The object's\n *        properties will override the default methods and/or pattern in `Type`'s public interface.\n * @example\n * <pre>\n * {\n *   decode: function(val) { return parseInt(val, 10); },\n *   encode: function(val) { return val && val.toString(); },\n *   equals: function(a, b) { return this.is(a) && a === b; },\n *   is: function(val) { return angular.isNumber(val) isFinite(val) && val % 1 === 0; },\n *   pattern: /\\d+/\n * }\n * </pre>\n *\n * @property {RegExp} pattern The regular expression pattern used to match values of this type when\n *           coming from a substring of a URL.\n *\n * @returns {Object}  Returns a new `Type` object.\n */\nfunction Type(config) {\n  extend(this, config);\n}\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#is\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Detects whether a value is of a particular type. Accepts a native (decoded) value\n * and determines whether it matches the current `Type` object.\n *\n * @param {*} val  The value to check.\n * @param {string} key  Optional. If the type check is happening in the context of a specific\n *        {@link ui.router.util.type:UrlMatcher `UrlMatcher`} object, this is the name of the\n *        parameter in which `val` is stored. Can be used for meta-programming of `Type` objects.\n * @returns {Boolean}  Returns `true` if the value matches the type, otherwise `false`.\n */\nType.prototype.is = function(val, key) {\n  return true;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#encode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Encodes a custom/native type value to a string that can be embedded in a URL. Note that the\n * return value does *not* need to be URL-safe (i.e. passed through `encodeURIComponent()`), it\n * only needs to be a representation of `val` that has been coerced to a string.\n *\n * @param {*} val  The value to encode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {string}  Returns a string representation of `val` that can be encoded in a URL.\n */\nType.prototype.encode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#decode\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Converts a parameter value (from URL string or transition param) to a custom/native value.\n *\n * @param {string} val  The URL parameter value to decode.\n * @param {string} key  The name of the parameter in which `val` is stored. Can be used for\n *        meta-programming of `Type` objects.\n * @returns {*}  Returns a custom representation of the URL parameter value.\n */\nType.prototype.decode = function(val, key) {\n  return val;\n};\n\n/**\n * @ngdoc function\n * @name ui.router.util.type:Type#equals\n * @methodOf ui.router.util.type:Type\n *\n * @description\n * Determines whether two decoded values are equivalent.\n *\n * @param {*} a  A value to compare against.\n * @param {*} b  A value to compare against.\n * @returns {Boolean}  Returns `true` if the values are equivalent/equal, otherwise `false`.\n */\nType.prototype.equals = function(a, b) {\n  return a == b;\n};\n\nType.prototype.$subPattern = function() {\n  var sub = this.pattern.toString();\n  return sub.substr(1, sub.length - 2);\n};\n\nType.prototype.pattern = /.*/;\n\nType.prototype.toString = function() { return \"{Type:\" + this.name + \"}\"; };\n\n/*\n * Wraps an existing custom Type as an array of Type, depending on 'mode'.\n * e.g.:\n * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n * - url: \"/path?queryParam=1&queryParam=2\n * - $stateParams.queryParam will be [1, 2]\n * if `mode` is \"auto\", then\n * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n */\nType.prototype.$asArray = function(mode, isSearch) {\n  if (!mode) return this;\n  if (mode === \"auto\" && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n  return new ArrayType(this, mode);\n\n  function ArrayType(type, mode) {\n    function bindTo(type, callbackName) {\n      return function() {\n        return type[callbackName].apply(type, arguments);\n      };\n    }\n\n    // Wrap non-array value as array\n    function arrayWrap(val) { return isArray(val) ? val : (isDefined(val) ? [ val ] : []); }\n    // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n    function arrayUnwrap(val) {\n      switch(val.length) {\n        case 0: return undefined;\n        case 1: return mode === \"auto\" ? val[0] : val;\n        default: return val;\n      }\n    }\n    function falsey(val) { return !val; }\n\n    // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n    function arrayHandler(callback, allTruthyMode) {\n      return function handleArray(val) {\n        val = arrayWrap(val);\n        var result = map(val, callback);\n        if (allTruthyMode === true)\n          return filter(result, falsey).length === 0;\n        return arrayUnwrap(result);\n      };\n    }\n\n    // Wraps type (.equals) functions to operate on each value of an array\n    function arrayEqualsHandler(callback) {\n      return function handleArray(val1, val2) {\n        var left = arrayWrap(val1), right = arrayWrap(val2);\n        if (left.length !== right.length) return false;\n        for (var i = 0; i < left.length; i++) {\n          if (!callback(left[i], right[i])) return false;\n        }\n        return true;\n      };\n    }\n\n    this.encode = arrayHandler(bindTo(type, 'encode'));\n    this.decode = arrayHandler(bindTo(type, 'decode'));\n    this.is     = arrayHandler(bindTo(type, 'is'), true);\n    this.equals = arrayEqualsHandler(bindTo(type, 'equals'));\n    this.pattern = type.pattern;\n    this.$arrayMode = mode;\n  }\n};\n\n\n\n/**\n * @ngdoc object\n * @name ui.router.util.$urlMatcherFactory\n *\n * @description\n * Factory for {@link ui.router.util.type:UrlMatcher `UrlMatcher`} instances. The factory\n * is also available to providers under the name `$urlMatcherFactoryProvider`.\n */\nfunction $UrlMatcherFactory() {\n  $$UMFP = this;\n\n  var isCaseInsensitive = false, isStrictMode = true, defaultSquashPolicy = false;\n\n  function valToString(val) { return val != null ? val.toString().replace(/\\//g, \"%2F\") : val; }\n  function valFromString(val) { return val != null ? val.toString().replace(/%2F/g, \"/\") : val; }\n//  TODO: in 1.0, make string .is() return false if value is undefined by default.\n//  function regexpMatches(val) { /*jshint validthis:true */ return isDefined(val) && this.pattern.test(val); }\n  function regexpMatches(val) { /*jshint validthis:true */ return this.pattern.test(val); }\n\n  var $types = {}, enqueue = true, typeQueue = [], injector, defaultTypes = {\n    string: {\n      encode: valToString,\n      decode: valFromString,\n      is: regexpMatches,\n      pattern: /[^/]*/\n    },\n    int: {\n      encode: valToString,\n      decode: function(val) { return parseInt(val, 10); },\n      is: function(val) { return isDefined(val) && this.decode(val.toString()) === val; },\n      pattern: /\\d+/\n    },\n    bool: {\n      encode: function(val) { return val ? 1 : 0; },\n      decode: function(val) { return parseInt(val, 10) !== 0; },\n      is: function(val) { return val === true || val === false; },\n      pattern: /0|1/\n    },\n    date: {\n      encode: function (val) {\n        if (!this.is(val))\n          return undefined;\n        return [ val.getFullYear(),\n          ('0' + (val.getMonth() + 1)).slice(-2),\n          ('0' + val.getDate()).slice(-2)\n        ].join(\"-\");\n      },\n      decode: function (val) {\n        if (this.is(val)) return val;\n        var match = this.capture.exec(val);\n        return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n      },\n      is: function(val) { return val instanceof Date && !isNaN(val.valueOf()); },\n      equals: function (a, b) { return this.is(a) && this.is(b) && a.toISOString() === b.toISOString(); },\n      pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n      capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/\n    },\n    json: {\n      encode: angular.toJson,\n      decode: angular.fromJson,\n      is: angular.isObject,\n      equals: angular.equals,\n      pattern: /[^/]*/\n    },\n    any: { // does not encode/decode\n      encode: angular.identity,\n      decode: angular.identity,\n      is: angular.identity,\n      equals: angular.equals,\n      pattern: /.*/\n    }\n  };\n\n  function getDefaultConfig() {\n    return {\n      strict: isStrictMode,\n      caseInsensitive: isCaseInsensitive\n    };\n  }\n\n  function isInjectable(value) {\n    return (isFunction(value) || (isArray(value) && isFunction(value[value.length - 1])));\n  }\n\n  /**\n   * [Internal] Get the default value of a parameter, which may be an injectable function.\n   */\n  $UrlMatcherFactory.$$getDefaultValue = function(config) {\n    if (!isInjectable(config.value)) return config.value;\n    if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n    return injector.invoke(config.value);\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#caseInsensitive\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URL matching should be case sensitive (the default behavior), or not.\n   *\n   * @param {boolean} value `false` to match URL in a case sensitive manner; otherwise `true`;\n   * @returns {boolean} the current value of caseInsensitive\n   */\n  this.caseInsensitive = function(value) {\n    if (isDefined(value))\n      isCaseInsensitive = value;\n    return isCaseInsensitive;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#strictMode\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Defines whether URLs should match trailing slashes, or not (the default behavior).\n   *\n   * @param {boolean=} value `false` to match trailing slashes in URLs, otherwise `true`.\n   * @returns {boolean} the current value of strictMode\n   */\n  this.strictMode = function(value) {\n    if (isDefined(value))\n      isStrictMode = value;\n    return isStrictMode;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#defaultSquashPolicy\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Sets the default behavior when generating or matching URLs with default parameter values.\n   *\n   * @param {string} value A string that defines the default parameter URL squashing behavior.\n   *    `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL\n   *    `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the\n   *             parameter is surrounded by slashes, squash (remove) one slash from the URL\n   *    any other string, e.g. \"~\": When generating an href with a default parameter value, squash (remove)\n   *             the parameter value from the URL and replace it with this string.\n   */\n  this.defaultSquashPolicy = function(value) {\n    if (!isDefined(value)) return defaultSquashPolicy;\n    if (value !== true && value !== false && !isString(value))\n      throw new Error(\"Invalid squash policy: \" + value + \". Valid policies: false, true, arbitrary-string\");\n    defaultSquashPolicy = value;\n    return value;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#compile\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Creates a {@link ui.router.util.type:UrlMatcher `UrlMatcher`} for the specified pattern.\n   *\n   * @param {string} pattern  The URL pattern.\n   * @param {Object} config  The config object hash.\n   * @returns {UrlMatcher}  The UrlMatcher.\n   */\n  this.compile = function (pattern, config) {\n    return new UrlMatcher(pattern, extend(getDefaultConfig(), config));\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#isMatcher\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Returns true if the specified object is a `UrlMatcher`, or false otherwise.\n   *\n   * @param {Object} object  The object to perform the type check against.\n   * @returns {Boolean}  Returns `true` if the object matches the `UrlMatcher` interface, by\n   *          implementing all the same methods.\n   */\n  this.isMatcher = function (o) {\n    if (!isObject(o)) return false;\n    var result = true;\n\n    forEach(UrlMatcher.prototype, function(val, name) {\n      if (isFunction(val)) {\n        result = result && (isDefined(o[name]) && isFunction(o[name]));\n      }\n    });\n    return result;\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.util.$urlMatcherFactory#type\n   * @methodOf ui.router.util.$urlMatcherFactory\n   *\n   * @description\n   * Registers a custom {@link ui.router.util.type:Type `Type`} object that can be used to\n   * generate URLs with typed parameters.\n   *\n   * @param {string} name  The type name.\n   * @param {Object|Function} definition   The type definition. See\n   *        {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   * @param {Object|Function} definitionFn (optional) A function that is injected before the app\n   *        runtime starts.  The result of this function is merged into the existing `definition`.\n   *        See {@link ui.router.util.type:Type `Type`} for information on the values accepted.\n   *\n   * @returns {Object}  Returns `$urlMatcherFactoryProvider`.\n   *\n   * @example\n   * This is a simple example of a custom type that encodes and decodes items from an\n   * array, using the array index as the URL-encoded value:\n   *\n   * <pre>\n   * var list = ['John', 'Paul', 'George', 'Ringo'];\n   *\n   * $urlMatcherFactoryProvider.type('listItem', {\n   *   encode: function(item) {\n   *     // Represent the list item in the URL using its corresponding index\n   *     return list.indexOf(item);\n   *   },\n   *   decode: function(item) {\n   *     // Look up the list item by index\n   *     return list[parseInt(item, 10)];\n   *   },\n   *   is: function(item) {\n   *     // Ensure the item is valid by checking to see that it appears\n   *     // in the list\n   *     return list.indexOf(item) > -1;\n   *   }\n   * });\n   *\n   * $stateProvider.state('list', {\n   *   url: \"/list/{item:listItem}\",\n   *   controller: function($scope, $stateParams) {\n   *     console.log($stateParams.item);\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * // Changes URL to '/list/3', logs \"Ringo\" to the console\n   * $state.go('list', { item: \"Ringo\" });\n   * </pre>\n   *\n   * This is a more complex example of a type that relies on dependency injection to\n   * interact with services, and uses the parameter name from the URL to infer how to\n   * handle encoding and decoding parameter values:\n   *\n   * <pre>\n   * // Defines a custom type that gets a value from a service,\n   * // where each service gets different types of values from\n   * // a backend API:\n   * $urlMatcherFactoryProvider.type('dbObject', {}, function(Users, Posts) {\n   *\n   *   // Matches up services to URL parameter names\n   *   var services = {\n   *     user: Users,\n   *     post: Posts\n   *   };\n   *\n   *   return {\n   *     encode: function(object) {\n   *       // Represent the object in the URL using its unique ID\n   *       return object.id;\n   *     },\n   *     decode: function(value, key) {\n   *       // Look up the object by ID, using the parameter\n   *       // name (key) to call the correct service\n   *       return services[key].findById(value);\n   *     },\n   *     is: function(object, key) {\n   *       // Check that object is a valid dbObject\n   *       return angular.isObject(object) && object.id && services[key];\n   *     }\n   *     equals: function(a, b) {\n   *       // Check the equality of decoded objects by comparing\n   *       // their unique IDs\n   *       return a.id === b.id;\n   *     }\n   *   };\n   * });\n   *\n   * // In a config() block, you can then attach URLs with\n   * // type-annotated parameters:\n   * $stateProvider.state('users', {\n   *   url: \"/users\",\n   *   // ...\n   * }).state('users.item', {\n   *   url: \"/{user:dbObject}\",\n   *   controller: function($scope, $stateParams) {\n   *     // $stateParams.user will now be an object returned from\n   *     // the Users service\n   *   },\n   *   // ...\n   * });\n   * </pre>\n   */\n  this.type = function (name, definition, definitionFn) {\n    if (!isDefined(definition)) return $types[name];\n    if ($types.hasOwnProperty(name)) throw new Error(\"A type named '\" + name + \"' has already been defined.\");\n\n    $types[name] = new Type(extend({ name: name }, definition));\n    if (definitionFn) {\n      typeQueue.push({ name: name, def: definitionFn });\n      if (!enqueue) flushTypeQueue();\n    }\n    return this;\n  };\n\n  // `flushTypeQueue()` waits until `$urlMatcherFactory` is injected before invoking the queued `definitionFn`s\n  function flushTypeQueue() {\n    while(typeQueue.length) {\n      var type = typeQueue.shift();\n      if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n      angular.extend($types[type.name], injector.invoke(type.def));\n    }\n  }\n\n  // Register default types. Store them in the prototype of $types.\n  forEach(defaultTypes, function(type, name) { $types[name] = new Type(extend({name: name}, type)); });\n  $types = inherit($types, {});\n\n  /* No need to document $get, since it returns this */\n  this.$get = ['$injector', function ($injector) {\n    injector = $injector;\n    enqueue = false;\n    flushTypeQueue();\n\n    forEach(defaultTypes, function(type, name) {\n      if (!$types[name]) $types[name] = new Type(type);\n    });\n    return this;\n  }];\n\n  this.Param = function Param(id, type, config, location) {\n    var self = this;\n    config = unwrapShorthand(config);\n    type = getType(config, type, location);\n    var arrayMode = getArrayMode();\n    type = arrayMode ? type.$asArray(arrayMode, location === \"search\") : type;\n    if (type.name === \"string\" && !arrayMode && location === \"path\" && config.value === undefined)\n      config.value = \"\"; // for 0.2.x; in 0.3.0+ do not automatically default to \"\"\n    var isOptional = config.value !== undefined;\n    var squash = getSquashPolicy(config, isOptional);\n    var replace = getReplace(config, arrayMode, isOptional, squash);\n\n    function unwrapShorthand(config) {\n      var keys = isObject(config) ? objectKeys(config) : [];\n      var isShorthand = indexOf(keys, \"value\") === -1 && indexOf(keys, \"type\") === -1 &&\n                        indexOf(keys, \"squash\") === -1 && indexOf(keys, \"array\") === -1;\n      if (isShorthand) config = { value: config };\n      config.$$fn = isInjectable(config.value) ? config.value : function () { return config.value; };\n      return config;\n    }\n\n    function getType(config, urlType, location) {\n      if (config.type && urlType) throw new Error(\"Param '\"+id+\"' has two type configurations.\");\n      if (urlType) return urlType;\n      if (!config.type) return (location === \"config\" ? $types.any : $types.string);\n      return config.type instanceof Type ? config.type : new Type(config.type);\n    }\n\n    // array config: param name (param[]) overrides default settings.  explicit config overrides param name.\n    function getArrayMode() {\n      var arrayDefaults = { array: (location === \"search\" ? \"auto\" : false) };\n      var arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n      return extend(arrayDefaults, arrayParamNomenclature, config).array;\n    }\n\n    /**\n     * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n     */\n    function getSquashPolicy(config, isOptional) {\n      var squash = config.squash;\n      if (!isOptional || squash === false) return false;\n      if (!isDefined(squash) || squash == null) return defaultSquashPolicy;\n      if (squash === true || isString(squash)) return squash;\n      throw new Error(\"Invalid squash policy: '\" + squash + \"'. Valid policies: false, true, or arbitrary string\");\n    }\n\n    function getReplace(config, arrayMode, isOptional, squash) {\n      var replace, configuredKeys, defaultPolicy = [\n        { from: \"\",   to: (isOptional || arrayMode ? undefined : \"\") },\n        { from: null, to: (isOptional || arrayMode ? undefined : \"\") }\n      ];\n      replace = isArray(config.replace) ? config.replace : [];\n      if (isString(squash))\n        replace.push({ from: squash, to: undefined });\n      configuredKeys = map(replace, function(item) { return item.from; } );\n      return filter(defaultPolicy, function(item) { return indexOf(configuredKeys, item.from) === -1; }).concat(replace);\n    }\n\n    /**\n     * [Internal] Get the default value of a parameter, which may be an injectable function.\n     */\n    function $$getDefaultValue() {\n      if (!injector) throw new Error(\"Injectable functions cannot be called at configuration time\");\n      return injector.invoke(config.$$fn);\n    }\n\n    /**\n     * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n     * default value, which may be the result of an injectable function.\n     */\n    function $value(value) {\n      function hasReplaceVal(val) { return function(obj) { return obj.from === val; }; }\n      function $replace(value) {\n        var replacement = map(filter(self.replace, hasReplaceVal(value)), function(obj) { return obj.to; });\n        return replacement.length ? replacement[0] : value;\n      }\n      value = $replace(value);\n      return isDefined(value) ? self.type.decode(value) : $$getDefaultValue();\n    }\n\n    function toString() { return \"{Param:\" + id + \" \" + type + \" squash: '\" + squash + \"' optional: \" + isOptional + \"}\"; }\n\n    extend(this, {\n      id: id,\n      type: type,\n      location: location,\n      array: arrayMode,\n      squash: squash,\n      replace: replace,\n      isOptional: isOptional,\n      value: $value,\n      dynamic: undefined,\n      config: config,\n      toString: toString\n    });\n  };\n\n  function ParamSet(params) {\n    extend(this, params || {});\n  }\n\n  ParamSet.prototype = {\n    $$new: function() {\n      return inherit(this, extend(new ParamSet(), { $$parent: this}));\n    },\n    $$keys: function () {\n      var keys = [], chain = [], parent = this,\n        ignore = objectKeys(ParamSet.prototype);\n      while (parent) { chain.push(parent); parent = parent.$$parent; }\n      chain.reverse();\n      forEach(chain, function(paramset) {\n        forEach(objectKeys(paramset), function(key) {\n            if (indexOf(keys, key) === -1 && indexOf(ignore, key) === -1) keys.push(key);\n        });\n      });\n      return keys;\n    },\n    $$values: function(paramValues) {\n      var values = {}, self = this;\n      forEach(self.$$keys(), function(key) {\n        values[key] = self[key].value(paramValues && paramValues[key]);\n      });\n      return values;\n    },\n    $$equals: function(paramValues1, paramValues2) {\n      var equal = true, self = this;\n      forEach(self.$$keys(), function(key) {\n        var left = paramValues1 && paramValues1[key], right = paramValues2 && paramValues2[key];\n        if (!self[key].type.equals(left, right)) equal = false;\n      });\n      return equal;\n    },\n    $$validates: function $$validate(paramValues) {\n      var result = true, isOptional, val, param, self = this;\n\n      forEach(this.$$keys(), function(key) {\n        param = self[key];\n        val = paramValues[key];\n        isOptional = !val && param.isOptional;\n        result = result && (isOptional || !!param.type.is(val));\n      });\n      return result;\n    },\n    $$parent: undefined\n  };\n\n  this.ParamSet = ParamSet;\n}\n\n// Register as a provider so it's available to other providers\nangular.module('ui.router.util').provider('$urlMatcherFactory', $UrlMatcherFactory);\nangular.module('ui.router.util').run(['$urlMatcherFactory', function($urlMatcherFactory) { }]);\n\n/**\n * @ngdoc object\n * @name ui.router.router.$urlRouterProvider\n *\n * @requires ui.router.util.$urlMatcherFactoryProvider\n * @requires $locationProvider\n *\n * @description\n * `$urlRouterProvider` has the responsibility of watching `$location`. \n * When `$location` changes it runs through a list of rules one by one until a \n * match is found. `$urlRouterProvider` is used behind the scenes anytime you specify \n * a url in a state configuration. All urls are compiled into a UrlMatcher object.\n *\n * There are several methods on `$urlRouterProvider` that make it useful to use directly\n * in your module config.\n */\n$UrlRouterProvider.$inject = ['$locationProvider', '$urlMatcherFactoryProvider'];\nfunction $UrlRouterProvider(   $locationProvider,   $urlMatcherFactory) {\n  var rules = [], otherwise = null, interceptDeferred = false, listener;\n\n  // Returns a string that is a prefix of all strings matching the RegExp\n  function regExpPrefix(re) {\n    var prefix = /^\\^((?:\\\\[^a-zA-Z0-9]|[^\\\\\\[\\]\\^$*+?.()|{}]+)*)/.exec(re.source);\n    return (prefix != null) ? prefix[1].replace(/\\\\(.)/g, \"$1\") : '';\n  }\n\n  // Interpolates matched values into a String.replace()-style pattern\n  function interpolate(pattern, match) {\n    return pattern.replace(/\\$(\\$|\\d{1,2})/, function (m, what) {\n      return match[what === '$' ? 0 : Number(what)];\n    });\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#rule\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines rules that are used by `$urlRouterProvider` to find matches for\n   * specific URLs.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {object} rule Handler function that takes `$injector` and `$location`\n   * services as arguments. You can use them to return a valid path as a string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.rule = function (rule) {\n    if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    rules.push(rule);\n    return this;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouterProvider#otherwise\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Defines a path that is used when an invalid route is requested.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     return '/a/valid/url';\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} rule The url path you want to redirect to or a function \n   * rule that returns the url path. The function version is passed two params: \n   * `$injector` and `$location` services, and must return a url string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  this.otherwise = function (rule) {\n    if (isString(rule)) {\n      var redirect = rule;\n      rule = function () { return redirect; };\n    }\n    else if (!isFunction(rule)) throw new Error(\"'rule' must be a function\");\n    otherwise = rule;\n    return this;\n  };\n\n\n  function handleIfMatch($injector, handler, match) {\n    if (!match) return false;\n    var result = $injector.invoke(handler, handler, { $match: match });\n    return isDefined(result) ? result : true;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#when\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Registers a handler for a given url matching. if handle is a string, it is\n   * treated as a redirect, and is interpolated according to the syntax of match\n   * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n   *\n   * If the handler is a function, it is injectable. It gets invoked if `$location`\n   * matches. You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * </pre>\n   *\n   * @param {string|object} what The incoming path that you want to redirect.\n   * @param {string|object} handler The path you want to redirect your user to.\n   */\n  this.when = function (what, handler) {\n    var redirect, handlerIsString = isString(handler);\n    if (isString(what)) what = $urlMatcherFactory.compile(what);\n\n    if (!handlerIsString && !isFunction(handler) && !isArray(handler))\n      throw new Error(\"invalid 'handler' in when()\");\n\n    var strategies = {\n      matcher: function (what, handler) {\n        if (handlerIsString) {\n          redirect = $urlMatcherFactory.compile(handler);\n          handler = ['$match', function ($match) { return redirect.format($match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path(), $location.search()));\n        }, {\n          prefix: isString(what.prefix) ? what.prefix : ''\n        });\n      },\n      regex: function (what, handler) {\n        if (what.global || what.sticky) throw new Error(\"when() RegExp must not be global or sticky\");\n\n        if (handlerIsString) {\n          redirect = handler;\n          handler = ['$match', function ($match) { return interpolate(redirect, $match); }];\n        }\n        return extend(function ($injector, $location) {\n          return handleIfMatch($injector, handler, what.exec($location.path()));\n        }, {\n          prefix: regExpPrefix(what)\n        });\n      }\n    };\n\n    var check = { matcher: $urlMatcherFactory.isMatcher(what), regex: what instanceof RegExp };\n\n    for (var n in check) {\n      if (check[n]) return this.rule(strategies[n](what, handler));\n    }\n\n    throw new Error(\"invalid 'what' in when()\");\n  };\n\n  /**\n   * @ngdoc function\n   * @name ui.router.router.$urlRouterProvider#deferIntercept\n   * @methodOf ui.router.router.$urlRouterProvider\n   *\n   * @description\n   * Disables (or enables) deferring location change interception.\n   *\n   * If you wish to customize the behavior of syncing the URL (for example, if you wish to\n   * defer a transition but maintain the current URL), call this method at configuration time.\n   * Then, at run time, call `$urlRouter.listen()` after you have configured your own\n   * `$locationChangeSuccess` event handler.\n   *\n   * @example\n   * <pre>\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *\n   *   // Prevent $urlRouter from automatically intercepting URL changes;\n   *   // this allows you to configure custom behavior in between\n   *   // location changes and route synchronization:\n   *   $urlRouterProvider.deferIntercept();\n   *\n   * }).run(function ($rootScope, $urlRouter, UserService) {\n   *\n   *   $rootScope.$on('$locationChangeSuccess', function(e) {\n   *     // UserService is an example service for managing user state\n   *     if (UserService.isLoggedIn()) return;\n   *\n   *     // Prevent $urlRouter's default handler from firing\n   *     e.preventDefault();\n   *\n   *     UserService.handleLogin().then(function() {\n   *       // Once the user has logged in, sync the current URL\n   *       // to the router:\n   *       $urlRouter.sync();\n   *     });\n   *   });\n   *\n   *   // Configures $urlRouter's listener *after* your custom listener\n   *   $urlRouter.listen();\n   * });\n   * </pre>\n   *\n   * @param {boolean} defer Indicates whether to defer location change interception. Passing\n            no parameter is equivalent to `true`.\n   */\n  this.deferIntercept = function (defer) {\n    if (defer === undefined) defer = true;\n    interceptDeferred = defer;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.router.$urlRouter\n   *\n   * @requires $location\n   * @requires $rootScope\n   * @requires $injector\n   * @requires $browser\n   *\n   * @description\n   *\n   */\n  this.$get = $get;\n  $get.$inject = ['$location', '$rootScope', '$injector', '$browser'];\n  function $get(   $location,   $rootScope,   $injector,   $browser) {\n\n    var baseHref = $browser.baseHref(), location = $location.url(), lastPushedUrl;\n\n    function appendBasePath(url, isHtml5, absolute) {\n      if (baseHref === '/') return url;\n      if (isHtml5) return baseHref.slice(0, -1) + url;\n      if (absolute) return baseHref.slice(1) + url;\n      return url;\n    }\n\n    // TODO: Optimize groups of rules with non-empty prefix into some sort of decision tree\n    function update(evt) {\n      if (evt && evt.defaultPrevented) return;\n      var ignoreUpdate = lastPushedUrl && $location.url() === lastPushedUrl;\n      lastPushedUrl = undefined;\n      if (ignoreUpdate) return true;\n\n      function check(rule) {\n        var handled = rule($injector, $location);\n\n        if (!handled) return false;\n        if (isString(handled)) $location.replace().url(handled);\n        return true;\n      }\n      var n = rules.length, i;\n\n      for (i = 0; i < n; i++) {\n        if (check(rules[i])) return;\n      }\n      // always check otherwise last to allow dynamic updates to the set of rules\n      if (otherwise) check(otherwise);\n    }\n\n    function listen() {\n      listener = listener || $rootScope.$on('$locationChangeSuccess', update);\n      return listener;\n    }\n\n    if (!interceptDeferred) listen();\n\n    return {\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#sync\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * Triggers an update; the same update that happens when the address bar url changes, aka `$locationChangeSuccess`.\n       * This method is useful when you need to use `preventDefault()` on the `$locationChangeSuccess` event,\n       * perform some custom logic (route protection, auth, config, redirection, etc) and then finally proceed\n       * with the transition by calling `$urlRouter.sync()`.\n       *\n       * @example\n       * <pre>\n       * angular.module('app', ['ui.router'])\n       *   .run(function($rootScope, $urlRouter) {\n       *     $rootScope.$on('$locationChangeSuccess', function(evt) {\n       *       // Halt state change from even starting\n       *       evt.preventDefault();\n       *       // Perform custom logic\n       *       var meetsRequirement = ...\n       *       // Continue with the update and state transition if logic allows\n       *       if (meetsRequirement) $urlRouter.sync();\n       *     });\n       * });\n       * </pre>\n       */\n      sync: function() {\n        update();\n      },\n\n      listen: function() {\n        return listen();\n      },\n\n      update: function(read) {\n        if (read) {\n          location = $location.url();\n          return;\n        }\n        if ($location.url() === location) return;\n\n        $location.url(location);\n        $location.replace();\n      },\n\n      push: function(urlMatcher, params, options) {\n        $location.url(urlMatcher.format(params || {}));\n        lastPushedUrl = options && options.$$avoidResync ? $location.url() : undefined;\n        if (options && options.replace) $location.replace();\n      },\n\n      /**\n       * @ngdoc function\n       * @name ui.router.router.$urlRouter#href\n       * @methodOf ui.router.router.$urlRouter\n       *\n       * @description\n       * A URL generation method that returns the compiled URL for a given\n       * {@link ui.router.util.type:UrlMatcher `UrlMatcher`}, populated with the provided parameters.\n       *\n       * @example\n       * <pre>\n       * $bob = $urlRouter.href(new UrlMatcher(\"/about/:person\"), {\n       *   person: \"bob\"\n       * });\n       * // $bob == \"/about/bob\";\n       * </pre>\n       *\n       * @param {UrlMatcher} urlMatcher The `UrlMatcher` object which is used as the template of the URL to generate.\n       * @param {object=} params An object of parameter values to fill the matcher's required parameters.\n       * @param {object=} options Options object. The options are:\n       *\n       * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n       *\n       * @returns {string} Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n       */\n      href: function(urlMatcher, params, options) {\n        if (!urlMatcher.validates(params)) return null;\n\n        var isHtml5 = $locationProvider.html5Mode();\n        if (angular.isObject(isHtml5)) {\n          isHtml5 = isHtml5.enabled;\n        }\n        \n        var url = urlMatcher.format(params);\n        options = options || {};\n\n        if (!isHtml5 && url !== null) {\n          url = \"#\" + $locationProvider.hashPrefix() + url;\n        }\n        url = appendBasePath(url, isHtml5, options.absolute);\n\n        if (!options.absolute || !url) {\n          return url;\n        }\n\n        var slash = (!isHtml5 && url ? '/' : ''), port = $location.port();\n        port = (port === 80 || port === 443 ? '' : ':' + port);\n\n        return [$location.protocol(), '://', $location.host(), port, slash, url].join('');\n      }\n    };\n  }\n}\n\nangular.module('ui.router.router').provider('$urlRouter', $UrlRouterProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$stateProvider\n *\n * @requires ui.router.router.$urlRouterProvider\n * @requires ui.router.util.$urlMatcherFactoryProvider\n *\n * @description\n * The new `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\n$StateProvider.$inject = ['$urlRouterProvider', '$urlMatcherFactoryProvider'];\nfunction $StateProvider(   $urlRouterProvider,   $urlMatcherFactory) {\n\n  var root, states = {}, $state, queue = {}, abstractKey = 'abstract';\n\n  // Builds state properties from definition passed to registerState()\n  var stateBuilder = {\n\n    // Derive parent state from a hierarchical name only if 'parent' is not explicitly defined.\n    // state.children = [];\n    // if (parent) parent.children.push(state);\n    parent: function(state) {\n      if (isDefined(state.parent) && state.parent) return findState(state.parent);\n      // regex matches any valid composite state name\n      // would match \"contact.list\" but not \"contacts\"\n      var compositeName = /^(.+)\\.[^.]+$/.exec(state.name);\n      return compositeName ? findState(compositeName[1]) : root;\n    },\n\n    // inherit 'data' from parent and override by own values (if any)\n    data: function(state) {\n      if (state.parent && state.parent.data) {\n        state.data = state.self.data = extend({}, state.parent.data, state.data);\n      }\n      return state.data;\n    },\n\n    // Build a URLMatcher if necessary, either via a relative or absolute URL\n    url: function(state) {\n      var url = state.url, config = { params: state.params || {} };\n\n      if (isString(url)) {\n        if (url.charAt(0) == '^') return $urlMatcherFactory.compile(url.substring(1), config);\n        return (state.parent.navigable || root).url.concat(url, config);\n      }\n\n      if (!url || $urlMatcherFactory.isMatcher(url)) return url;\n      throw new Error(\"Invalid url '\" + url + \"' in state '\" + state + \"'\");\n    },\n\n    // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n    navigable: function(state) {\n      return state.url ? state : (state.parent ? state.parent.navigable : null);\n    },\n\n    // Own parameters for this state. state.url.params is already built at this point. Create and add non-url params\n    ownParams: function(state) {\n      var params = state.url && state.url.params || new $$UMFP.ParamSet();\n      forEach(state.params || {}, function(config, id) {\n        if (!params[id]) params[id] = new $$UMFP.Param(id, null, config, \"config\");\n      });\n      return params;\n    },\n\n    // Derive parameters for this state and ensure they're a super-set of parent's parameters\n    params: function(state) {\n      return state.parent && state.parent.params ? extend(state.parent.params.$$new(), state.ownParams) : new $$UMFP.ParamSet();\n    },\n\n    // If there is no explicit multi-view configuration, make one up so we don't have\n    // to handle both cases in the view directive later. Note that having an explicit\n    // 'views' property will mean the default unnamed view properties are ignored. This\n    // is also a good time to resolve view names to absolute names, so everything is a\n    // straight lookup at link time.\n    views: function(state) {\n      var views = {};\n\n      forEach(isDefined(state.views) ? state.views : { '': state }, function (view, name) {\n        if (name.indexOf('@') < 0) name += '@' + state.parent.name;\n        views[name] = view;\n      });\n      return views;\n    },\n\n    // Keep a full path from the root down to this state as this is needed for state activation.\n    path: function(state) {\n      return state.parent ? state.parent.path.concat(state) : []; // exclude root from path\n    },\n\n    // Speed up $state.contains() as it's used a lot\n    includes: function(state) {\n      var includes = state.parent ? extend({}, state.parent.includes) : {};\n      includes[state.name] = true;\n      return includes;\n    },\n\n    $delegates: {}\n  };\n\n  function isRelative(stateName) {\n    return stateName.indexOf(\".\") === 0 || stateName.indexOf(\"^\") === 0;\n  }\n\n  function findState(stateOrName, base) {\n    if (!stateOrName) return undefined;\n\n    var isStr = isString(stateOrName),\n        name  = isStr ? stateOrName : stateOrName.name,\n        path  = isRelative(name);\n\n    if (path) {\n      if (!base) throw new Error(\"No reference point given for path '\"  + name + \"'\");\n      base = findState(base);\n      \n      var rel = name.split(\".\"), i = 0, pathLength = rel.length, current = base;\n\n      for (; i < pathLength; i++) {\n        if (rel[i] === \"\" && i === 0) {\n          current = base;\n          continue;\n        }\n        if (rel[i] === \"^\") {\n          if (!current.parent) throw new Error(\"Path '\" + name + \"' not valid for state '\" + base.name + \"'\");\n          current = current.parent;\n          continue;\n        }\n        break;\n      }\n      rel = rel.slice(i).join(\".\");\n      name = current.name + (current.name && rel ? \".\" : \"\") + rel;\n    }\n    var state = states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    }\n    return undefined;\n  }\n\n  function queueState(parentName, state) {\n    if (!queue[parentName]) {\n      queue[parentName] = [];\n    }\n    queue[parentName].push(state);\n  }\n\n  function flushQueuedChildren(parentName) {\n    var queued = queue[parentName] || [];\n    while(queued.length) {\n      registerState(queued.shift());\n    }\n  }\n\n  function registerState(state) {\n    // Wrap a new object around the state so we can store our private details easily.\n    state = inherit(state, {\n      self: state,\n      resolve: state.resolve || {},\n      toString: function() { return this.name; }\n    });\n\n    var name = state.name;\n    if (!isString(name) || name.indexOf('@') >= 0) throw new Error(\"State must have a valid name\");\n    if (states.hasOwnProperty(name)) throw new Error(\"State '\" + name + \"'' is already defined\");\n\n    // Get parent name\n    var parentName = (name.indexOf('.') !== -1) ? name.substring(0, name.lastIndexOf('.'))\n        : (isString(state.parent)) ? state.parent\n        : (isObject(state.parent) && isString(state.parent.name)) ? state.parent.name\n        : '';\n\n    // If parent is not registered yet, add state to queue and register later\n    if (parentName && !states[parentName]) {\n      return queueState(parentName, state.self);\n    }\n\n    for (var key in stateBuilder) {\n      if (isFunction(stateBuilder[key])) state[key] = stateBuilder[key](state, stateBuilder.$delegates[key]);\n    }\n    states[name] = state;\n\n    // Register the state in the global state list and with $urlRouter if necessary.\n    if (!state[abstractKey] && state.url) {\n      $urlRouterProvider.when(state.url, ['$match', '$stateParams', function ($match, $stateParams) {\n        if ($state.$current.navigable != state || !equalForKeys($match, $stateParams)) {\n          $state.transitionTo(state, $match, { inherit: true, location: false });\n        }\n      }]);\n    }\n\n    // Register any queued children\n    flushQueuedChildren(name);\n\n    return state;\n  }\n\n  // Checks text to see if it looks like a glob.\n  function isGlob (text) {\n    return text.indexOf('*') > -1;\n  }\n\n  // Returns true if glob matches current $state name.\n  function doesStateMatchGlob (glob) {\n    var globSegments = glob.split('.'),\n        segments = $state.$current.name.split('.');\n\n    //match greedy starts\n    if (globSegments[0] === '**') {\n       segments = segments.slice(indexOf(segments, globSegments[1]));\n       segments.unshift('**');\n    }\n    //match greedy ends\n    if (globSegments[globSegments.length - 1] === '**') {\n       segments.splice(indexOf(segments, globSegments[globSegments.length - 2]) + 1, Number.MAX_VALUE);\n       segments.push('**');\n    }\n\n    if (globSegments.length != segments.length) {\n      return false;\n    }\n\n    //match single stars\n    for (var i = 0, l = globSegments.length; i < l; i++) {\n      if (globSegments[i] === '*') {\n        segments[i] = '*';\n      }\n    }\n\n    return segments.join('') === globSegments.join('');\n  }\n\n\n  // Implicit root state that is always active\n  root = registerState({\n    name: '',\n    url: '^',\n    views: null,\n    'abstract': true\n  });\n  root.navigable = null;\n\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#decorator\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Allows you to extend (carefully) or override (at your own peril) the \n   * `stateBuilder` object used internally by `$stateProvider`. This can be used \n   * to add custom functionality to ui-router, for example inferring templateUrl \n   * based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new \n   * properties within the state's internal definition. There is currently no clear \n   * use-case for this beyond accessing internal states (i.e. $state.$current), \n   * however, expect this to become increasingly relevant as we introduce additional \n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of \n   * execution of the builder functions in non-deterministic. Builder functions \n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n   *   or `null`.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is \n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to \n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view \n   *   name (i.e. \"viewName@stateName\") and each value is the config object \n   *   (template, controller) for the view. Even when you don't use the views object \n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template \n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state, \n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state. \n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that \n   *   would pass a `$state.includes()` test.\n   *\n   * @example\n   * <pre>\n   * // Override the internal 'views' builder with a function that takes the state\n   * // definition, and a reference to the internal function being overridden:\n   * $stateProvider.decorator('views', function (state, parent) {\n   *   var result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(views, function (config, name) {\n   *     var autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   *\n   * // ...\n   *\n   * $state.go('home');\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * </pre>\n   *\n   * @param {string} name The name of the builder function to decorate. \n   * @param {object} func A function that is responsible for decorating the original \n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  this.decorator = decorator;\n  function decorator(name, func) {\n    /*jshint validthis: true */\n    if (isString(name) && !isDefined(func)) {\n      return stateBuilder[name];\n    }\n    if (!isFunction(func) || !isString(name)) {\n      return this;\n    }\n    if (stateBuilder[name] && !stateBuilder.$delegates[name]) {\n      stateBuilder.$delegates[name] = stateBuilder[name];\n    }\n    stateBuilder[name] = func;\n    return this;\n  }\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$stateProvider#state\n   * @methodOf ui.router.state.$stateProvider\n   *\n   * @description\n   * Registers a state configuration under a given state name. The stateConfig object\n   * has the following acceptable properties.\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} stateConfig State configuration object.\n   * @param {string|function=} stateConfig.template\n   * <a id='template'></a>\n   *   html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property \n   *   takes precedence over templateUrl.\n   *   \n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <pre>template:\n   *   \"<h1>inline template definition</h1>\" +\n   *   \"<div ui-view></div>\"</pre>\n   * <pre>template: function(params) {\n   *       return \"<h1>generated template</h1>\"; }</pre>\n   * </div>\n   *\n   * @param {string|function=} stateConfig.templateUrl\n   * <a id='templateUrl'></a>\n   *\n   *   path or function that returns a path to an html\n   *   template that should be used by uiView.\n   *   \n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by \n   *     applying the current state\n   *\n   * <pre>templateUrl: \"home.html\"</pre>\n   * <pre>templateUrl: function(params) {\n   *     return myTemplates[params.pageId]; }</pre>\n   *\n   * @param {function=} stateConfig.templateProvider\n   * <a id='templateProvider'></a>\n   *    Provider function that returns HTML content string.\n   * <pre> templateProvider:\n   *       function(MyTemplateService, params) {\n   *         return MyTemplateService.getTemplate(params.pageId);\n   *       }</pre>\n   *\n   * @param {string|function=} stateConfig.controller\n   * <a id='controller'></a>\n   *\n   *  Controller fn that should be associated with newly\n   *   related scope or the name of a registered controller if passed as a string.\n   *   Optionally, the ControllerAs may be declared here.\n   * <pre>controller: \"MyRegisteredController\"</pre>\n   * <pre>controller:\n   *     \"MyRegisteredController as fooCtrl\"}</pre>\n   * <pre>controller: function($scope, MyService) {\n   *     $scope.data = MyService.getData(); }</pre>\n   *\n   * @param {function=} stateConfig.controllerProvider\n   * <a id='controllerProvider'></a>\n   *\n   * Injectable provider function that returns the actual controller or string.\n   * <pre>controllerProvider:\n   *   function(MyResolveData) {\n   *     if (MyResolveData.foo)\n   *       return \"FooCtrl\"\n   *     else if (MyResolveData.bar)\n   *       return \"BarCtrl\";\n   *     else return function($scope) {\n   *       $scope.baz = \"Qux\";\n   *     }\n   *   }</pre>\n   *\n   * @param {string=} stateConfig.controllerAs\n   * <a id='controllerAs'></a>\n   * \n   * A controller alias name. If present the controller will be\n   *   published to scope under the controllerAs name.\n   * <pre>controllerAs: \"myCtrl\"</pre>\n   *\n   * @param {object=} stateConfig.resolve\n   * <a id='resolve'></a>\n   *\n   * An optional map&lt;string, function&gt; of dependencies which\n   *   should be injected into the controller. If any of these dependencies are promises, \n   *   the router will wait for them all to be resolved before the controller is instantiated.\n   *   If all the promises are resolved successfully, the $stateChangeSuccess event is fired\n   *   and the values of the resolved promises are injected into any controllers that reference them.\n   *   If any  of the promises are rejected the $stateChangeError event is fired.\n   *\n   *   The map object is:\n   *   \n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function, \n   *     it is injected and return value it treated as dependency. If result is a promise, it is \n   *     resolved before its value is injected into controller.\n   *\n   * <pre>resolve: {\n   *     myResolve1:\n   *       function($http, $stateParams) {\n   *         return $http.get(\"/api/foos/\"+stateParams.fooID);\n   *       }\n   *     }</pre>\n   *\n   * @param {string=} stateConfig.url\n   * <a id='url'></a>\n   *\n   *   A url fragment with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any \n   *   parameters that were passed.\n   *\n   * examples:\n   * <pre>url: \"/home\"\n   * url: \"/users/:userid\"\n   * url: \"/books/{bookid:[a-zA-Z_-]}\"\n   * url: \"/books/{categoryid:int}\"\n   * url: \"/books/{publishername:string}/{categoryid:int}\"\n   * url: \"/messages?before&after\"\n   * url: \"/messages?{before:date}&{after:date}\"</pre>\n   * url: \"/messages/:mailboxid?{before:date}&{after:date}\"\n   *\n   * @param {object=} stateConfig.views\n   * <a id='views'></a>\n   * an optional map&lt;string, object&gt; which defined multiple views, or targets views\n   * manually/explicitly.\n   *\n   * Examples:\n   *\n   * Targets three named `ui-view`s in the parent state's template\n   * <pre>views: {\n   *     header: {\n   *       controller: \"headerCtrl\",\n   *       templateUrl: \"header.html\"\n   *     }, body: {\n   *       controller: \"bodyCtrl\",\n   *       templateUrl: \"body.html\"\n   *     }, footer: {\n   *       controller: \"footCtrl\",\n   *       templateUrl: \"footer.html\"\n   *     }\n   *   }</pre>\n   *\n   * Targets named `ui-view=\"header\"` from grandparent state 'top''s template, and named `ui-view=\"body\" from parent state's template.\n   * <pre>views: {\n   *     'header@top': {\n   *       controller: \"msgHeaderCtrl\",\n   *       templateUrl: \"msgHeader.html\"\n   *     }, 'body': {\n   *       controller: \"messagesCtrl\",\n   *       templateUrl: \"messages.html\"\n   *     }\n   *   }</pre>\n   *\n   * @param {boolean=} [stateConfig.abstract=false]\n   * <a id='abstract'></a>\n   * An abstract state will never be directly activated,\n   *   but can provide inherited properties to its common children states.\n   * <pre>abstract: true</pre>\n   *\n   * @param {function=} stateConfig.onEnter\n   * <a id='onEnter'></a>\n   *\n   * Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onEnter: function(MyService, $stateParams) {\n   *     MyService.foo($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {function=} stateConfig.onExit\n   * <a id='onExit'></a>\n   *\n   * Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to explictly annotate this function,\n   * because it won't be automatically annotated by your build tools.\n   *\n   * <pre>onExit: function(MyService, $stateParams) {\n   *     MyService.cleanup($stateParams.myParam);\n   * }</pre>\n   *\n   * @param {boolean=} [stateConfig.reloadOnSearch=true]\n   * <a id='reloadOnSearch'></a>\n   *\n   * If `false`, will not retrigger the same state\n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()). \n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   * <pre>reloadOnSearch: false</pre>\n   *\n   * @param {object=} stateConfig.data\n   * <a id='data'></a>\n   *\n   * Arbitrary data object, useful for custom configuration.  The parent state's `data` is\n   *   prototypally inherited.  In other words, adding a data property to a state adds it to\n   *   the entire subtree via prototypal inheritance.\n   *\n   * <pre>data: {\n   *     requiredRole: 'foo'\n   * } </pre>\n   *\n   * @param {object=} stateConfig.params\n   * <a id='params'></a>\n   *\n   * A map which optionally configures parameters declared in the `url`, or\n   *   defines additional non-url parameters.  For each parameter being\n   *   configured, add a configuration object keyed to the name of the parameter.\n   *\n   *   Each parameter configuration object may contain the following properties:\n   *\n   *   - ** value ** - {object|function=}: specifies the default value for this\n   *     parameter.  This implicitly sets this parameter as optional.\n   *\n   *     When UI-Router routes to a state and no value is\n   *     specified for this parameter in the URL or transition, the\n   *     default value will be used instead.  If `value` is a function,\n   *     it will be injected and invoked, and the return value used.\n   *\n   *     *Note*: `undefined` is treated as \"no default value\" while `null`\n   *     is treated as \"the default value is `null`\".\n   *\n   *     *Shorthand*: If you only need to configure the default value of the\n   *     parameter, you may use a shorthand syntax.   In the **`params`**\n   *     map, instead mapping the param name to a full parameter configuration\n   *     object, simply set map it to the default parameter value, e.g.:\n   *\n   * <pre>// define a parameter's default value\n   * params: {\n   *     param1: { value: \"defaultValue\" }\n   * }\n   * // shorthand default values\n   * params: {\n   *     param1: \"defaultValue\",\n   *     param2: \"param2Default\"\n   * }</pre>\n   *\n   *   - ** array ** - {boolean=}: *(default: false)* If true, the param value will be\n   *     treated as an array of values.  If you specified a Type, the value will be\n   *     treated as an array of the specified Type.  Note: query parameter values\n   *     default to a special `\"auto\"` mode.\n   *\n   *     For query parameters in `\"auto\"` mode, if multiple  values for a single parameter\n   *     are present in the URL (e.g.: `/foo?bar=1&bar=2&bar=3`) then the values\n   *     are mapped to an array (e.g.: `{ foo: [ '1', '2', '3' ] }`).  However, if\n   *     only one value is present (e.g.: `/foo?bar=1`) then the value is treated as single\n   *     value (e.g.: `{ foo: '1' }`).\n   *\n   * <pre>params: {\n   *     param1: { array: true }\n   * }</pre>\n   *\n   *   - ** squash ** - {bool|string=}: `squash` configures how a default parameter value is represented in the URL when\n   *     the current parameter value is the same as the default value. If `squash` is not set, it uses the\n   *     configured default squash policy.\n   *     (See {@link ui.router.util.$urlMatcherFactory#methods_defaultSquashPolicy `defaultSquashPolicy()`})\n   *\n   *   There are three squash settings:\n   *\n   *     - false: The parameter's default value is not squashed.  It is encoded and included in the URL\n   *     - true: The parameter's default value is omitted from the URL.  If the parameter is preceeded and followed\n   *       by slashes in the state's `url` declaration, then one of those slashes are omitted.\n   *       This can allow for cleaner looking URLs.\n   *     - `\"<arbitrary string>\"`: The parameter's default value is replaced with an arbitrary placeholder of  your choice.\n   *\n   * <pre>params: {\n   *     param1: {\n   *       value: \"defaultId\",\n   *       squash: true\n   * } }\n   * // squash \"defaultValue\" to \"~\"\n   * params: {\n   *     param1: {\n   *       value: \"defaultValue\",\n   *       squash: \"~\"\n   * } }\n   * </pre>\n   *\n   *\n   * @example\n   * <pre>\n   * // Some state name examples\n   *\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the\n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * </pre>\n   *\n   */\n  this.state = state;\n  function state(name, definition) {\n    /*jshint validthis: true */\n    if (isObject(name)) definition = name;\n    else definition.name = name;\n    registerState(definition);\n    return this;\n  }\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$state\n   *\n   * @requires $rootScope\n   * @requires $q\n   * @requires ui.router.state.$view\n   * @requires $injector\n   * @requires ui.router.util.$resolve\n   * @requires ui.router.state.$stateParams\n   * @requires ui.router.router.$urlRouter\n   *\n   * @property {object} params A param object, e.g. {sectionId: section.id)}, that \n   * you'd like to test against the current active state.\n   * @property {object} current A reference to the state's config object. However \n   * you passed it in. Useful for accessing custom data.\n   * @property {object} transition Currently pending transition. A promise that'll \n   * resolve or reject.\n   *\n   * @description\n   * `$state` service is responsible for representing states as well as transitioning\n   * between them. It also provides interfaces to ask for current state or even states\n   * you're coming from.\n   */\n  this.$get = $get;\n  $get.$inject = ['$rootScope', '$q', '$view', '$injector', '$resolve', '$stateParams', '$urlRouter', '$location', '$urlMatcherFactory'];\n  function $get(   $rootScope,   $q,   $view,   $injector,   $resolve,   $stateParams,   $urlRouter,   $location,   $urlMatcherFactory) {\n\n    var TransitionSuperseded = $q.reject(new Error('transition superseded'));\n    var TransitionPrevented = $q.reject(new Error('transition prevented'));\n    var TransitionAborted = $q.reject(new Error('transition aborted'));\n    var TransitionFailed = $q.reject(new Error('transition failed'));\n\n    // Handles the case where a state which is the target of a transition is not found, and the user\n    // can optionally retry or defer the transition\n    function handleRedirect(redirect, state, params, options) {\n      /**\n       * @ngdoc event\n       * @name ui.router.state.$state#$stateNotFound\n       * @eventOf ui.router.state.$state\n       * @eventType broadcast on root scope\n       * @description\n       * Fired when a requested state **cannot be found** using the provided state name during transition.\n       * The event is broadcast allowing any handlers a single chance to deal with the error (usually by\n       * lazy-loading the unfound state). A special `unfoundState` object is passed to the listener handler,\n       * you can see its three properties in the example. You can use `event.preventDefault()` to abort the\n       * transition and the promise returned from `go` will be rejected with a `'transition aborted'` value.\n       *\n       * @param {Object} event Event object.\n       * @param {Object} unfoundState Unfound State information. Contains: `to, toParams, options` properties.\n       * @param {State} fromState Current state object.\n       * @param {Object} fromParams Current state params.\n       *\n       * @example\n       *\n       * <pre>\n       * // somewhere, assume lazy.state has not been defined\n       * $state.go(\"lazy.state\", {a:1, b:2}, {inherit:false});\n       *\n       * // somewhere else\n       * $scope.$on('$stateNotFound',\n       * function(event, unfoundState, fromState, fromParams){\n       *     console.log(unfoundState.to); // \"lazy.state\"\n       *     console.log(unfoundState.toParams); // {a:1, b:2}\n       *     console.log(unfoundState.options); // {inherit:false} + default options\n       * })\n       * </pre>\n       */\n      var evt = $rootScope.$broadcast('$stateNotFound', redirect, state, params);\n\n      if (evt.defaultPrevented) {\n        $urlRouter.update();\n        return TransitionAborted;\n      }\n\n      if (!evt.retry) {\n        return null;\n      }\n\n      // Allow the handler to return a promise to defer state lookup retry\n      if (options.$retry) {\n        $urlRouter.update();\n        return TransitionFailed;\n      }\n      var retryTransition = $state.transition = $q.when(evt.retry);\n\n      retryTransition.then(function() {\n        if (retryTransition !== $state.transition) return TransitionSuperseded;\n        redirect.options.$retry = true;\n        return $state.transitionTo(redirect.to, redirect.toParams, redirect.options);\n      }, function() {\n        return TransitionAborted;\n      });\n      $urlRouter.update();\n\n      return retryTransition;\n    }\n\n    root.locals = { resolve: null, globals: { $stateParams: {} } };\n\n    $state = {\n      params: {},\n      current: root.self,\n      $current: root,\n      transition: null\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#reload\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method that force reloads the current state. All resolves are re-resolved, events are not re-fired, \n     * and controllers reinstantiated (bug with controllers reinstantiating right now, fixing soon).\n     *\n     * @example\n     * <pre>\n     * var app angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.reload = function(){\n     *     $state.reload();\n     *   }\n     * });\n     * </pre>\n     *\n     * `reload()` is just an alias for:\n     * <pre>\n     * $state.transitionTo($state.current, $stateParams, { \n     *   reload: true, inherit: false, notify: true\n     * });\n     * </pre>\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.reload = function reload() {\n      return $state.transitionTo($state.current, $stateParams, { reload: true, inherit: false, notify: true });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#go\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Convenience method for transitioning to a new state. `$state.go` calls \n     * `$state.transitionTo` internally but automatically sets options to \n     * `{ location: true, inherit: true, relative: $state.$current, notify: true }`. \n     * This allows you to easily use an absolute or relative to path and specify \n     * only the parameters you'd like to update (while letting unspecified parameters \n     * inherit from the currently active ancestor states).\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.go('contact.detail');\n     *   };\n     * });\n     * </pre>\n     * <img src='../ngdoc_assets/StateGoExamples.png'/>\n     *\n     * @param {string} to Absolute state name or relative state path. Some examples:\n     *\n     * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n     * - `$state.go('^')` - will go to a parent state\n     * - `$state.go('^.sibling')` - will go to a sibling state\n     * - `$state.go('.child.grandchild')` - will go to grandchild state\n     *\n     * @param {object=} params A map of the parameters that will be sent to the state, \n     * will populate $stateParams. Any parameters that are not specified will be inherited from currently \n     * defined parameters. This allows, for example, going to a sibling state that shares parameters\n     * specified in a parent state. Parameter inheritance only works between common ancestor states, I.e.\n     * transitioning to a sibling will get you the parameters for all parents, transitioning to a child\n     * will get you all current parameters, etc.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition.\n     *\n     * Possible success values:\n     *\n     * - $state.current\n     *\n     * <br/>Possible rejection values:\n     *\n     * - 'transition superseded' - when a newer transition has been started after this one\n     * - 'transition prevented' - when `event.preventDefault()` has been called in a `$stateChangeStart` listener\n     * - 'transition aborted' - when `event.preventDefault()` has been called in a `$stateNotFound` listener or\n     *   when a `$stateNotFound` `event.retry` promise errors.\n     * - 'transition failed' - when a state has been unsuccessfully found after 2 tries.\n     * - *resolve error* - when an error has occurred with a `resolve`\n     *\n     */\n    $state.go = function go(to, params, options) {\n      return $state.transitionTo(to, params, extend({ inherit: true, relative: $state.$current }, options));\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#transitionTo\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Low-level method for transitioning to a new state. {@link ui.router.state.$state#methods_go $state.go}\n     * uses `transitionTo` internally. `$state.go` is recommended in most situations.\n     *\n     * @example\n     * <pre>\n     * var app = angular.module('app', ['ui.router']);\n     *\n     * app.controller('ctrl', function ($scope, $state) {\n     *   $scope.changeState = function () {\n     *     $state.transitionTo('contact.detail');\n     *   };\n     * });\n     * </pre>\n     *\n     * @param {string} to State name.\n     * @param {object=} toParams A map of the parameters that will be sent to the state,\n     * will populate $stateParams.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`location`** - {boolean=true|string=} - If `true` will update the url in the location bar, if `false`\n     *    will not. If string, must be `\"replace\"`, which will update url and also replace last history record.\n     * - **`inherit`** - {boolean=false}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`notify`** - {boolean=true}, If `true` will broadcast $stateChangeStart and $stateChangeSuccess events.\n     * - **`reload`** (v0.2.5) - {boolean=false}, If `true` will force transition even if the state or params \n     *    have not changed, aka a reload of the same state. It differs from reloadOnSearch because you'd\n     *    use this when you want to force a reload when *everything* is the same, including search params.\n     *\n     * @returns {promise} A promise representing the state of the new transition. See\n     * {@link ui.router.state.$state#methods_go $state.go}.\n     */\n    $state.transitionTo = function transitionTo(to, toParams, options) {\n      toParams = toParams || {};\n      options = extend({\n        location: true, inherit: false, relative: null, notify: true, reload: false, $retry: false\n      }, options || {});\n\n      var from = $state.$current, fromParams = $state.params, fromPath = from.path;\n      var evt, toState = findState(to, options.relative);\n\n      if (!isDefined(toState)) {\n        var redirect = { to: to, toParams: toParams, options: options };\n        var redirectResult = handleRedirect(redirect, from.self, fromParams, options);\n\n        if (redirectResult) {\n          return redirectResult;\n        }\n\n        // Always retry once if the $stateNotFound was not prevented\n        // (handles either redirect changed or state lazy-definition)\n        to = redirect.to;\n        toParams = redirect.toParams;\n        options = redirect.options;\n        toState = findState(to, options.relative);\n\n        if (!isDefined(toState)) {\n          if (!options.relative) throw new Error(\"No such state '\" + to + \"'\");\n          throw new Error(\"Could not resolve '\" + to + \"' from state '\" + options.relative + \"'\");\n        }\n      }\n      if (toState[abstractKey]) throw new Error(\"Cannot transition to abstract state '\" + to + \"'\");\n      if (options.inherit) toParams = inheritParams($stateParams, toParams || {}, $state.$current, toState);\n      if (!toState.params.$$validates(toParams)) return TransitionFailed;\n\n      toParams = toState.params.$$values(toParams);\n      to = toState;\n\n      var toPath = to.path;\n\n      // Starting from the root of the path, keep all levels that haven't changed\n      var keep = 0, state = toPath[keep], locals = root.locals, toLocals = [];\n\n      if (!options.reload) {\n        while (state && state === fromPath[keep] && state.ownParams.$$equals(toParams, fromParams)) {\n          locals = toLocals[keep] = state.locals;\n          keep++;\n          state = toPath[keep];\n        }\n      }\n\n      // If we're going to the same state and all locals are kept, we've got nothing to do.\n      // But clear 'transition', as we still want to cancel any other pending transitions.\n      // TODO: We may not want to bump 'transition' if we're called from a location change\n      // that we've initiated ourselves, because we might accidentally abort a legitimate\n      // transition initiated from code?\n      if (shouldTriggerReload(to, from, locals, options)) {\n        if (to.self.reloadOnSearch !== false) $urlRouter.update();\n        $state.transition = null;\n        return $q.when($state.current);\n      }\n\n      // Filter parameters before we pass them to event handlers etc.\n      toParams = filterByKeys(to.params.$$keys(), toParams || {});\n\n      // Broadcast start event and cancel the transition if requested\n      if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeStart\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when the state transition **begins**. You can use `event.preventDefault()`\n         * to prevent the transition from happening and then the transition promise will be\n         * rejected with a `'transition prevented'` value.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         *\n         * @example\n         *\n         * <pre>\n         * $rootScope.$on('$stateChangeStart',\n         * function(event, toState, toParams, fromState, fromParams){\n         *     event.preventDefault();\n         *     // transitionTo() promise will be rejected with\n         *     // a 'transition prevented' error\n         * })\n         * </pre>\n         */\n        if ($rootScope.$broadcast('$stateChangeStart', to.self, toParams, from.self, fromParams).defaultPrevented) {\n          $urlRouter.update();\n          return TransitionPrevented;\n        }\n      }\n\n      // Resolve locals for the remaining states, but don't update any global state just\n      // yet -- if anything fails to resolve the current state needs to remain untouched.\n      // We also set up an inheritance chain for the locals here. This allows the view directive\n      // to quickly look up the correct definition for each view in the current state. Even\n      // though we create the locals object itself outside resolveState(), it is initially\n      // empty and gets filled asynchronously. We need to keep track of the promise for the\n      // (fully resolved) current locals, and pass this down the chain.\n      var resolved = $q.when(locals);\n\n      for (var l = keep; l < toPath.length; l++, state = toPath[l]) {\n        locals = toLocals[l] = inherit(locals);\n        resolved = resolveState(state, toParams, state === to, resolved, locals, options);\n      }\n\n      // Once everything is resolved, we are ready to perform the actual transition\n      // and return a promise for the new state. We also keep track of what the\n      // current promise is, so that we can detect overlapping transitions and\n      // keep only the outcome of the last transition.\n      var transition = $state.transition = resolved.then(function () {\n        var l, entering, exiting;\n\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Exit 'from' states not kept\n        for (l = fromPath.length - 1; l >= keep; l--) {\n          exiting = fromPath[l];\n          if (exiting.self.onExit) {\n            $injector.invoke(exiting.self.onExit, exiting.self, exiting.locals.globals);\n          }\n          exiting.locals = null;\n        }\n\n        // Enter 'to' states not kept\n        for (l = keep; l < toPath.length; l++) {\n          entering = toPath[l];\n          entering.locals = toLocals[l];\n          if (entering.self.onEnter) {\n            $injector.invoke(entering.self.onEnter, entering.self, entering.locals.globals);\n          }\n        }\n\n        // Run it again, to catch any transitions in callbacks\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        // Update globals in $state\n        $state.$current = to;\n        $state.current = to.self;\n        $state.params = toParams;\n        copy($state.params, $stateParams);\n        $state.transition = null;\n\n        if (options.location && to.navigable) {\n          $urlRouter.push(to.navigable.url, to.navigable.locals.globals.$stateParams, {\n            $$avoidResync: true, replace: options.location === 'replace'\n          });\n        }\n\n        if (options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeSuccess\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired once the state transition is **complete**.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         */\n          $rootScope.$broadcast('$stateChangeSuccess', to.self, toParams, from.self, fromParams);\n        }\n        $urlRouter.update(true);\n\n        return $state.current;\n      }, function (error) {\n        if ($state.transition !== transition) return TransitionSuperseded;\n\n        $state.transition = null;\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$stateChangeError\n         * @eventOf ui.router.state.$state\n         * @eventType broadcast on root scope\n         * @description\n         * Fired when an **error occurs** during transition. It's important to note that if you\n         * have any errors in your resolve functions (javascript errors, non-existent services, etc)\n         * they will not throw traditionally. You must listen for this $stateChangeError event to\n         * catch **ALL** errors.\n         *\n         * @param {Object} event Event object.\n         * @param {State} toState The state being transitioned to.\n         * @param {Object} toParams The params supplied to the `toState`.\n         * @param {State} fromState The current state, pre-transition.\n         * @param {Object} fromParams The params supplied to the `fromState`.\n         * @param {Error} error The resolve error object.\n         */\n        evt = $rootScope.$broadcast('$stateChangeError', to.self, toParams, from.self, fromParams, error);\n\n        if (!evt.defaultPrevented) {\n            $urlRouter.update();\n        }\n\n        return $q.reject(error);\n      });\n\n      return transition;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#is\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Similar to {@link ui.router.state.$state#methods_includes $state.includes},\n     * but only checks for the full state name. If params is supplied then it will be\n     * tested for strict equality against the current active params object, so all params\n     * must match with none missing and no extras.\n     *\n     * @example\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // absolute name\n     * $state.is('contact.details.item'); // returns true\n     * $state.is(contactDetailItemStateObject); // returns true\n     *\n     * // relative name (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.is('.item')}\">Item</div>\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name (absolute or relative) or state object you'd like to check.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`, that you'd like\n     * to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object} -  If `stateOrName` is a relative state name and `options.relative` is set, .is will\n     * test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it is the state.\n     */\n    $state.is = function is(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) { return undefined; }\n      if ($state.$current !== state) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams) : true;\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#includes\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A method to determine if the current active state is equal to or is the child of the\n     * state stateName. If any params are passed then they will be tested for a match as well.\n     * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n     *\n     * @example\n     * Partial and relative names\n     * <pre>\n     * $state.$current.name = 'contacts.details.item';\n     *\n     * // Using partial names\n     * $state.includes(\"contacts\"); // returns true\n     * $state.includes(\"contacts.details\"); // returns true\n     * $state.includes(\"contacts.details.item\"); // returns true\n     * $state.includes(\"contacts.list\"); // returns false\n     * $state.includes(\"about\"); // returns false\n     *\n     * // Using relative names (. and ^), typically from a template\n     * // E.g. from the 'contacts.details' template\n     * <div ng-class=\"{highlighted: $state.includes('.item')}\">Item</div>\n     * </pre>\n     *\n     * Basic globbing patterns\n     * <pre>\n     * $state.$current.name = 'contacts.details.item.url';\n     *\n     * $state.includes(\"*.details.*.*\"); // returns true\n     * $state.includes(\"*.details.**\"); // returns true\n     * $state.includes(\"**.item.**\"); // returns true\n     * $state.includes(\"*.details.item.url\"); // returns true\n     * $state.includes(\"*.details.*.url\"); // returns true\n     * $state.includes(\"*.details.*\"); // returns false\n     * $state.includes(\"item.**\"); // returns false\n     * </pre>\n     *\n     * @param {string} stateOrName A partial name, relative name, or glob pattern\n     * to be searched for within the current state name.\n     * @param {object=} params A param object, e.g. `{sectionId: section.id}`,\n     * that you'd like to test against the current active state.\n     * @param {object=} options An options object.  The options are:\n     *\n     * - **`relative`** - {string|object=} -  If `stateOrName` is a relative state reference and `options.relative` is set,\n     * .includes will test relative to `options.relative` state (or name).\n     *\n     * @returns {boolean} Returns true if it does include the state\n     */\n    $state.includes = function includes(stateOrName, params, options) {\n      options = extend({ relative: $state.$current }, options || {});\n      if (isString(stateOrName) && isGlob(stateOrName)) {\n        if (!doesStateMatchGlob(stateOrName)) {\n          return false;\n        }\n        stateOrName = $state.$current.name;\n      }\n\n      var state = findState(stateOrName, options.relative);\n      if (!isDefined(state)) { return undefined; }\n      if (!isDefined($state.$current.includes[state.name])) { return false; }\n      return params ? equalForKeys(state.params.$$values(params), $stateParams, objectKeys(params)) : true;\n    };\n\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#href\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * A url generation method that returns the compiled url for the given state populated with the given params.\n     *\n     * @example\n     * <pre>\n     * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n     * </pre>\n     *\n     * @param {string|object} stateOrName The state name or state object you'd like to generate a url from.\n     * @param {object=} params An object of parameter values to fill the state's required parameters.\n     * @param {object=} options Options object. The options are:\n     *\n     * - **`lossy`** - {boolean=true} -  If true, and if there is no url associated with the state provided in the\n     *    first parameter, then the constructed href url will be built from the first navigable ancestor (aka\n     *    ancestor with a valid url).\n     * - **`inherit`** - {boolean=true}, If `true` will inherit url parameters from current url.\n     * - **`relative`** - {object=$state.$current}, When transitioning with relative path (e.g '^'), \n     *    defines which state to be relative from.\n     * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n     * \n     * @returns {string} compiled state url\n     */\n    $state.href = function href(stateOrName, params, options) {\n      options = extend({\n        lossy:    true,\n        inherit:  true,\n        absolute: false,\n        relative: $state.$current\n      }, options || {});\n\n      var state = findState(stateOrName, options.relative);\n\n      if (!isDefined(state)) return null;\n      if (options.inherit) params = inheritParams($stateParams, params || {}, $state.$current, state);\n      \n      var nav = (state && options.lossy) ? state.navigable : state;\n\n      if (!nav || nav.url === undefined || nav.url === null) {\n        return null;\n      }\n      return $urlRouter.href(nav.url, filterByKeys(state.params.$$keys(), params || {}), {\n        absolute: options.absolute\n      });\n    };\n\n    /**\n     * @ngdoc function\n     * @name ui.router.state.$state#get\n     * @methodOf ui.router.state.$state\n     *\n     * @description\n     * Returns the state configuration object for any specific state or all states.\n     *\n     * @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for\n     * the requested state. If not provided, returns an array of ALL state configs.\n     * @param {string|object=} context When stateOrName is a relative state reference, the state will be retrieved relative to context.\n     * @returns {Object|Array} State configuration object or array of all objects.\n     */\n    $state.get = function (stateOrName, context) {\n      if (arguments.length === 0) return map(objectKeys(states), function(name) { return states[name].self; });\n      var state = findState(stateOrName, context || $state.$current);\n      return (state && state.self) ? state.self : null;\n    };\n\n    function resolveState(state, params, paramsAreFiltered, inherited, dst, options) {\n      // Make a restricted $stateParams with only the parameters that apply to this state if\n      // necessary. In addition to being available to the controller and onEnter/onExit callbacks,\n      // we also need $stateParams to be available for any $injector calls we make during the\n      // dependency resolution process.\n      var $stateParams = (paramsAreFiltered) ? params : filterByKeys(state.params.$$keys(), params);\n      var locals = { $stateParams: $stateParams };\n\n      // Resolve 'global' dependencies for the state, i.e. those not specific to a view.\n      // We're also including $stateParams in this; that way the parameters are restricted\n      // to the set that should be visible to the state, and are independent of when we update\n      // the global $state and $stateParams values.\n      dst.resolve = $resolve.resolve(state.resolve, locals, dst.resolve, state);\n      var promises = [dst.resolve.then(function (globals) {\n        dst.globals = globals;\n      })];\n      if (inherited) promises.push(inherited);\n\n      // Resolve template and dependencies for all views.\n      forEach(state.views, function (view, name) {\n        var injectables = (view.resolve && view.resolve !== state.resolve ? view.resolve : {});\n        injectables.$template = [ function () {\n          return $view.load(name, { view: view, locals: locals, params: $stateParams, notify: options.notify }) || '';\n        }];\n\n        promises.push($resolve.resolve(injectables, locals, dst.resolve, state).then(function (result) {\n          // References to the controller (only instantiated at link time)\n          if (isFunction(view.controllerProvider) || isArray(view.controllerProvider)) {\n            var injectLocals = angular.extend({}, injectables, locals);\n            result.$$controller = $injector.invoke(view.controllerProvider, null, injectLocals);\n          } else {\n            result.$$controller = view.controller;\n          }\n          // Provide access to the state itself for internal use\n          result.$$state = state;\n          result.$$controllerAs = view.controllerAs;\n          dst[name] = result;\n        }));\n      });\n\n      // Wait for all the promises and then return the activation object\n      return $q.all(promises).then(function (values) {\n        return dst;\n      });\n    }\n\n    return $state;\n  }\n\n  function shouldTriggerReload(to, from, locals, options) {\n    if (to === from && ((locals === from.locals && !options.reload) || (to.self.reloadOnSearch === false))) {\n      return true;\n    }\n  }\n}\n\nangular.module('ui.router.state')\n  .value('$stateParams', {})\n  .provider('$state', $StateProvider);\n\n\n$ViewProvider.$inject = [];\nfunction $ViewProvider() {\n\n  this.$get = $get;\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$view\n   *\n   * @requires ui.router.util.$templateFactory\n   * @requires $rootScope\n   *\n   * @description\n   *\n   */\n  $get.$inject = ['$rootScope', '$templateFactory'];\n  function $get(   $rootScope,   $templateFactory) {\n    return {\n      // $view.load('full.viewName', { template: ..., controller: ..., resolve: ..., async: false, params: ... })\n      /**\n       * @ngdoc function\n       * @name ui.router.state.$view#load\n       * @methodOf ui.router.state.$view\n       *\n       * @description\n       *\n       * @param {string} name name\n       * @param {object} options option object.\n       */\n      load: function load(name, options) {\n        var result, defaults = {\n          template: null, controller: null, view: null, locals: null, notify: true, async: true, params: {}\n        };\n        options = extend(defaults, options);\n\n        if (options.view) {\n          result = $templateFactory.fromConfig(options.view, options.params, options.locals);\n        }\n        if (result && options.notify) {\n        /**\n         * @ngdoc event\n         * @name ui.router.state.$state#$viewContentLoading\n         * @eventOf ui.router.state.$view\n         * @eventType broadcast on root scope\n         * @description\n         *\n         * Fired once the view **begins loading**, *before* the DOM is rendered.\n         *\n         * @param {Object} event Event object.\n         * @param {Object} viewConfig The view config properties (template, controller, etc).\n         *\n         * @example\n         *\n         * <pre>\n         * $scope.$on('$viewContentLoading',\n         * function(event, viewConfig){\n         *     // Access to all the view config properties.\n         *     // and one special property 'targetView'\n         *     // viewConfig.targetView\n         * });\n         * </pre>\n         */\n          $rootScope.$broadcast('$viewContentLoading', options);\n        }\n        return result;\n      }\n    };\n  }\n}\n\nangular.module('ui.router.state').provider('$view', $ViewProvider);\n\n/**\n * @ngdoc object\n * @name ui.router.state.$uiViewScrollProvider\n *\n * @description\n * Provider that returns the {@link ui.router.state.$uiViewScroll} service function.\n */\nfunction $ViewScrollProvider() {\n\n  var useAnchorScroll = false;\n\n  /**\n   * @ngdoc function\n   * @name ui.router.state.$uiViewScrollProvider#useAnchorScroll\n   * @methodOf ui.router.state.$uiViewScrollProvider\n   *\n   * @description\n   * Reverts back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll) service for\n   * scrolling based on the url anchor.\n   */\n  this.useAnchorScroll = function () {\n    useAnchorScroll = true;\n  };\n\n  /**\n   * @ngdoc object\n   * @name ui.router.state.$uiViewScroll\n   *\n   * @requires $anchorScroll\n   * @requires $timeout\n   *\n   * @description\n   * When called with a jqLite element, it scrolls the element into view (after a\n   * `$timeout` so the DOM has time to refresh).\n   *\n   * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n   * this can be enabled by calling {@link ui.router.state.$uiViewScrollProvider#methods_useAnchorScroll `$uiViewScrollProvider.useAnchorScroll()`}.\n   */\n  this.$get = ['$anchorScroll', '$timeout', function ($anchorScroll, $timeout) {\n    if (useAnchorScroll) {\n      return $anchorScroll;\n    }\n\n    return function ($element) {\n      $timeout(function () {\n        $element[0].scrollIntoView();\n      }, 0, false);\n    };\n  }];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', $ViewScrollProvider);\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-view\n *\n * @requires ui.router.state.$state\n * @requires $compile\n * @requires $controller\n * @requires $injector\n * @requires ui.router.state.$uiViewScroll\n * @requires $document\n *\n * @restrict ECA\n *\n * @description\n * The ui-view directive tells $state where to place your templates.\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states.\n *\n * @param {string=} autoscroll It allows you to set the scroll behavior of the browser window\n * when a view is populated. By default, $anchorScroll is overridden by ui-router's custom scroll\n * service, {@link ui.router.state.$uiViewScroll}. This custom service let's you\n * scroll ui-view elements into view when they are populated during a state activation.\n *\n * *Note: To revert back to old [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n * functionality, call `$uiViewScrollProvider.useAnchorScroll()`.*\n *\n * @param {string=} onload Expression to evaluate whenever the view updates.\n * \n * @example\n * A view can be unnamed or named. \n * <pre>\n * <!-- Unnamed -->\n * <div ui-view></div> \n * \n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n * </pre>\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a \n * single view and it is unnamed then you can populate it like so:\n * <pre>\n * <div ui-view></div> \n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * </pre>\n * \n * The above is a convenient shortcut equivalent to specifying your view explicitly with the {@link ui.router.state.$stateProvider#views `views`}\n * config property, by name, in this case an empty name:\n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * But typically you'll only use the views property if you name your view or have more than one view \n * in the same template. There's not really a compelling reason to name a view if its the only one, \n * but you could if you wanted, like so:\n * <pre>\n * <div ui-view=\"main\"></div>\n * </pre> \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }    \n * })\n * </pre>\n * \n * Really though, you'll use views to set up multiple views:\n * <pre>\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div> \n * <div ui-view=\"data\"></div> \n * </pre>\n * \n * <pre>\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }    \n * })\n * </pre>\n *\n * Examples for `autoscroll`:\n *\n * <pre>\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * </pre>\n */\n$ViewDirective.$inject = ['$state', '$injector', '$uiViewScroll', '$interpolate'];\nfunction $ViewDirective(   $state,   $injector,   $uiViewScroll,   $interpolate) {\n\n  function getService() {\n    return ($injector.has) ? function(service) {\n      return $injector.has(service) ? $injector.get(service) : null;\n    } : function(service) {\n      try {\n        return $injector.get(service);\n      } catch (e) {\n        return null;\n      }\n    };\n  }\n\n  var service = getService(),\n      $animator = service('$animator'),\n      $animate = service('$animate');\n\n  // Returns a set of DOM manipulation functions based on which Angular version\n  // it should use\n  function getRenderer(attrs, scope) {\n    var statics = function() {\n      return {\n        enter: function (element, target, cb) { target.after(element); cb(); },\n        leave: function (element, cb) { element.remove(); cb(); }\n      };\n    };\n\n    if ($animate) {\n      return {\n        enter: function(element, target, cb) {\n          var promise = $animate.enter(element, null, target, cb);\n          if (promise && promise.then) promise.then(cb);\n        },\n        leave: function(element, cb) {\n          var promise = $animate.leave(element, cb);\n          if (promise && promise.then) promise.then(cb);\n        }\n      };\n    }\n\n    if ($animator) {\n      var animate = $animator && $animator(scope, attrs);\n\n      return {\n        enter: function(element, target, cb) {animate.enter(element, null, target); cb(); },\n        leave: function(element, cb) { animate.leave(element); cb(); }\n      };\n    }\n\n    return statics();\n  }\n\n  var directive = {\n    restrict: 'ECA',\n    terminal: true,\n    priority: 400,\n    transclude: 'element',\n    compile: function (tElement, tAttrs, $transclude) {\n      return function (scope, $element, attrs) {\n        var previousEl, currentEl, currentScope, latestLocals,\n            onloadExp     = attrs.onload || '',\n            autoScrollExp = attrs.autoscroll,\n            renderer      = getRenderer(attrs, scope);\n\n        scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        updateView(true);\n\n        function cleanupLastView() {\n          if (previousEl) {\n            previousEl.remove();\n            previousEl = null;\n          }\n\n          if (currentScope) {\n            currentScope.$destroy();\n            currentScope = null;\n          }\n\n          if (currentEl) {\n            renderer.leave(currentEl, function() {\n              previousEl = null;\n            });\n\n            previousEl = currentEl;\n            currentEl = null;\n          }\n        }\n\n        function updateView(firstTime) {\n          var newScope,\n              name            = getUiViewName(scope, attrs, $element, $interpolate),\n              previousLocals  = name && $state.$current && $state.$current.locals[name];\n\n          if (!firstTime && previousLocals === latestLocals) return; // nothing to do\n          newScope = scope.$new();\n          latestLocals = $state.$current.locals[name];\n\n          var clone = $transclude(newScope, function(clone) {\n            renderer.enter(clone, $element, function onUiViewEnter() {\n              if(currentScope) {\n                currentScope.$emit('$viewContentAnimationEnded');\n              }\n\n              if (angular.isDefined(autoScrollExp) && !autoScrollExp || scope.$eval(autoScrollExp)) {\n                $uiViewScroll(clone);\n              }\n            });\n            cleanupLastView();\n          });\n\n          currentEl = clone;\n          currentScope = newScope;\n          /**\n           * @ngdoc event\n           * @name ui.router.state.directive:ui-view#$viewContentLoaded\n           * @eventOf ui.router.state.directive:ui-view\n           * @eventType emits on ui-view directive scope\n           * @description           *\n           * Fired once the view is **loaded**, *after* the DOM is rendered.\n           *\n           * @param {Object} event Event object.\n           */\n          currentScope.$emit('$viewContentLoaded');\n          currentScope.$eval(onloadExp);\n        }\n      };\n    }\n  };\n\n  return directive;\n}\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$state', '$interpolate'];\nfunction $ViewDirectiveFill (  $compile,   $controller,   $state,   $interpolate) {\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function (tElement) {\n      var initial = tElement.html();\n      return function (scope, $element, attrs) {\n        var current = $state.$current,\n            name = getUiViewName(scope, attrs, $element, $interpolate),\n            locals  = current && current.locals[name];\n\n        if (! locals) {\n          return;\n        }\n\n        $element.data('$uiView', { name: name, state: locals.$$state });\n        $element.html(locals.$template ? locals.$template : initial);\n\n        var link = $compile($element.contents());\n\n        if (locals.$$controller) {\n          locals.$scope = scope;\n          var controller = $controller(locals.$$controller, locals);\n          if (locals.$$controllerAs) {\n            scope[locals.$$controllerAs] = controller;\n          }\n          $element.data('$ngControllerController', controller);\n          $element.children().data('$ngControllerController', controller);\n        }\n\n        link(scope);\n      };\n    }\n  };\n}\n\n/**\n * Shared ui-view code for both directives:\n * Given scope, element, and its attributes, return the view's name\n */\nfunction getUiViewName(scope, attrs, element, $interpolate) {\n  var name = $interpolate(attrs.uiView || attrs.name || '')(scope);\n  var inherited = element.inheritedData('$uiView');\n  return name.indexOf('@') >= 0 ?  name :  (name + '@' + (inherited ? inherited.state.name : ''));\n}\n\nangular.module('ui.router.state').directive('uiView', $ViewDirective);\nangular.module('ui.router.state').directive('uiView', $ViewDirectiveFill);\n\nfunction parseStateRef(ref, current) {\n  var preparsed = ref.match(/^\\s*({[^}]*})\\s*$/), parsed;\n  if (preparsed) ref = current + '(' + preparsed[1] + ')';\n  parsed = ref.replace(/\\n/g, \" \").match(/^([^(]+?)\\s*(\\((.*)\\))?$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1], paramExpr: parsed[3] || null };\n}\n\nfunction stateContext(el) {\n  var stateData = el.parent().inheritedData('$uiView');\n\n  if (stateData && stateData.state && stateData.state.name) {\n    return stateData.state;\n  }\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref\n *\n * @requires ui.router.state.$state\n * @requires $timeout\n *\n * @restrict A\n *\n * @description\n * A directive that binds a link (`<a>` tag) to a state. If the state has an associated \n * URL, the directive will automatically generate & update the `href` attribute via \n * the {@link ui.router.state.$state#methods_href $state.href()} method. Clicking \n * the link will trigger a state transition with optional parameters. \n *\n * Also middle-clicking, right-clicking, and ctrl-clicking on the link will be \n * handled natively by the browser.\n *\n * You can also use relative state paths within ui-sref, just like the relative \n * paths passed to `$state.go()`. You just need to be aware that the path is relative\n * to the state that the link lives in, in other words the state that loaded the \n * template containing the link.\n *\n * You can specify options to pass to {@link ui.router.state.$state#go $state.go()}\n * using the `ui-sref-opts` attribute. Options are restricted to `location`, `inherit`,\n * and `reload`.\n *\n * @example\n * Here's an example of how you'd use ui-sref and how it would compile. If you have the \n * following template:\n * <pre>\n * <a ui-sref=\"home\">Home</a> | <a ui-sref=\"about\">About</a> | <a ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * </pre>\n * \n * Then the compiled html would be (assuming Html5Mode is off and current state is contacts):\n * <pre>\n * <a href=\"#/home\" ui-sref=\"home\">Home</a> | <a href=\"#/about\" ui-sref=\"about\">About</a> | <a href=\"#/contacts?page=2\" ui-sref=\"{page: 2}\">Next page</a>\n * \n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * </pre>\n *\n * @param {string} ui-sref 'stateName' can be any valid absolute or relative state\n * @param {Object} ui-sref-opts options to pass to {@link ui.router.state.$state#go $state.go()}\n */\n$StateRefDirective.$inject = ['$state', '$timeout'];\nfunction $StateRefDirective($state, $timeout) {\n  var allowedOptions = ['location', 'inherit', 'reload'];\n\n  return {\n    restrict: 'A',\n    require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n    link: function(scope, element, attrs, uiSrefActive) {\n      var ref = parseStateRef(attrs.uiSref, $state.current.name);\n      var params = null, url = null, base = stateContext(element) || $state.$current;\n      var newHref = null, isAnchor = element.prop(\"tagName\") === \"A\";\n      var isForm = element[0].nodeName === \"FORM\";\n      var attr = isForm ? \"action\" : \"href\", nav = true;\n\n      var options = { relative: base, inherit: true };\n      var optionsOverride = scope.$eval(attrs.uiSrefOpts) || {};\n\n      angular.forEach(allowedOptions, function(option) {\n        if (option in optionsOverride) {\n          options[option] = optionsOverride[option];\n        }\n      });\n\n      var update = function(newVal) {\n        if (newVal) params = angular.copy(newVal);\n        if (!nav) return;\n\n        newHref = $state.href(ref.state, params, options);\n\n        var activeDirective = uiSrefActive[1] || uiSrefActive[0];\n        if (activeDirective) {\n          activeDirective.$$setStateInfo(ref.state, params);\n        }\n        if (newHref === null) {\n          nav = false;\n          return false;\n        }\n        attrs.$set(attr, newHref);\n      };\n\n      if (ref.paramExpr) {\n        scope.$watch(ref.paramExpr, function(newVal, oldVal) {\n          if (newVal !== params) update(newVal);\n        }, true);\n        params = angular.copy(scope.$eval(ref.paramExpr));\n      }\n      update();\n\n      if (isForm) return;\n\n      element.bind(\"click\", function(e) {\n        var button = e.which || e.button;\n        if ( !(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || element.attr('target')) ) {\n          // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n          var transition = $timeout(function() {\n            $state.go(ref.state, params, options);\n          });\n          e.preventDefault();\n\n          // if the state has no URL, ignore one preventDefault from the <a> directive.\n          var ignorePreventDefaultCount = isAnchor && !newHref ? 1: 0;\n          e.preventDefault = function() {\n            if (ignorePreventDefaultCount-- <= 0)\n              $timeout.cancel(transition);\n          };\n        }\n      });\n    }\n  };\n}\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * A directive working alongside ui-sref to add classes to an element when the\n * related ui-sref directive's state is active, and removing them when it is inactive.\n * The primary use-case is to simplify the special appearance of navigation menus\n * relying on `ui-sref`, by having the \"active\" state's menu button appear different,\n * distinguishing it from the inactive menu items.\n *\n * ui-sref-active can live on the same element as ui-sref or on a parent element. The first\n * ui-sref-active found at the same level or above the ui-sref will be used.\n *\n * Will activate when the ui-sref's target state or any child state is active. If you\n * need to activate only when the ui-sref target state is active and *not* any of\n * it's children, then you will use\n * {@link ui.router.state.directive:ui-sref-active-eq ui-sref-active-eq}\n *\n * @example\n * Given the following template:\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n *\n * When the app state is \"app.user\" (or any children states), and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n * <pre>\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * </pre>\n *\n * The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * Multiple classes may be specified in a space-separated format:\n * <pre>\n * <ul>\n *   <li ui-sref-active='class1 class2 class3'>\n *     <a ui-sref=\"app.user\">link</a>\n *   </li>\n * </ul>\n * </pre>\n */\n\n/**\n * @ngdoc directive\n * @name ui.router.state.directive:ui-sref-active-eq\n *\n * @requires ui.router.state.$state\n * @requires ui.router.state.$stateParams\n * @requires $interpolate\n *\n * @restrict A\n *\n * @description\n * The same as {@link ui.router.state.directive:ui-sref-active ui-sref-active} but will only activate\n * when the exact target state used in the `ui-sref` is active; no child states.\n *\n */\n$StateRefActiveDirective.$inject = ['$state', '$stateParams', '$interpolate'];\nfunction $StateRefActiveDirective($state, $stateParams, $interpolate) {\n  return  {\n    restrict: \"A\",\n    controller: ['$scope', '$element', '$attrs', function ($scope, $element, $attrs) {\n      var state, params, activeClass;\n\n      // There probably isn't much point in $observing this\n      // uiSrefActive and uiSrefActiveEq share the same directive object with some\n      // slight difference in logic routing\n      activeClass = $interpolate($attrs.uiSrefActiveEq || $attrs.uiSrefActive || '', false)($scope);\n\n      // Allow uiSref to communicate with uiSrefActive[Equals]\n      this.$$setStateInfo = function (newState, newParams) {\n        state = $state.get(newState, stateContext($element));\n        params = newParams;\n        update();\n      };\n\n      $scope.$on('$stateChangeSuccess', update);\n\n      // Update route state\n      function update() {\n        if (isMatch()) {\n          $element.addClass(activeClass);\n        } else {\n          $element.removeClass(activeClass);\n        }\n      }\n\n      function isMatch() {\n        if (typeof $attrs.uiSrefActiveEq !== 'undefined') {\n          return state && $state.is(state.name, params);\n        } else {\n          return state && $state.includes(state.name, params);\n        }\n      }\n    }]\n  };\n}\n\nangular.module('ui.router.state')\n  .directive('uiSref', $StateRefDirective)\n  .directive('uiSrefActive', $StateRefActiveDirective)\n  .directive('uiSrefActiveEq', $StateRefActiveDirective);\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:isState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_is $state.is(\"stateName\")}.\n */\n$IsStateFilter.$inject = ['$state'];\nfunction $IsStateFilter($state) {\n  var isFilter = function (state) {\n    return $state.is(state);\n  };\n  isFilter.$stateful = true;\n  return isFilter;\n}\n\n/**\n * @ngdoc filter\n * @name ui.router.state.filter:includedByState\n *\n * @requires ui.router.state.$state\n *\n * @description\n * Translates to {@link ui.router.state.$state#methods_includes $state.includes('fullOrPartialStateName')}.\n */\n$IncludedByStateFilter.$inject = ['$state'];\nfunction $IncludedByStateFilter($state) {\n  var includesFilter = function (state) {\n    return $state.includes(state);\n  };\n  includesFilter.$stateful = true;\n  return  includesFilter;\n}\n\nangular.module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n})(window, window.angular);\n/*!\n * ionic.bundle.js is a concatenation of:\n * ionic.js, angular.js, angular-animate.js,\n * angular-sanitize.js, angular-ui-router.js,\n * and ionic-angular.js\n */\n\n/*!\n * Copyright 2015 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.3.1\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n/* eslint no-unused-vars:0 */\nvar IonicModule = angular.module('ionic', ['ngAnimate', 'ngSanitize', 'ui.router', 'ngIOS9UIWebViewPatch']),\n  extend = angular.extend,\n  forEach = angular.forEach,\n  isDefined = angular.isDefined,\n  isNumber = angular.isNumber,\n  isString = angular.isString,\n  jqLite = angular.element,\n  noop = angular.noop;\n\n/**\n * @ngdoc service\n * @name $ionicActionSheet\n * @module ionic\n * @description\n * The Action Sheet is a slide-up pane that lets the user choose from a set of options.\n * Dangerous options are highlighted in red and made obvious.\n *\n * There are easy ways to cancel out of the action sheet, such as tapping the backdrop or even\n * hitting escape on the keyboard for desktop testing.\n *\n * ![Action Sheet](http://ionicframework.com.s3.amazonaws.com/docs/controllers/actionSheet.gif)\n *\n * @usage\n * To trigger an Action Sheet in your code, use the $ionicActionSheet service in your angular controllers:\n *\n * ```js\n * angular.module('mySuperApp', ['ionic'])\n * .controller(function($scope, $ionicActionSheet, $timeout) {\n *\n *  // Triggered on a button click, or some other target\n *  $scope.show = function() {\n *\n *    // Show the action sheet\n *    var hideSheet = $ionicActionSheet.show({\n *      buttons: [\n *        { text: '<b>Share</b> This' },\n *        { text: 'Move' }\n *      ],\n *      destructiveText: 'Delete',\n *      titleText: 'Modify your album',\n *      cancelText: 'Cancel',\n *      cancel: function() {\n          // add cancel code..\n        },\n *      buttonClicked: function(index) {\n *        return true;\n *      }\n *    });\n *\n *    // For example's sake, hide the sheet after two seconds\n *    $timeout(function() {\n *      hideSheet();\n *    }, 2000);\n *\n *  };\n * });\n * ```\n *\n */\nIonicModule\n.factory('$ionicActionSheet', [\n  '$rootScope',\n  '$compile',\n  '$animate',\n  '$timeout',\n  '$ionicTemplateLoader',\n  '$ionicPlatform',\n  '$ionicBody',\n  'IONIC_BACK_PRIORITY',\nfunction($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicPlatform, $ionicBody, IONIC_BACK_PRIORITY) {\n\n  return {\n    show: actionSheet\n  };\n\n  /**\n   * @ngdoc method\n   * @name $ionicActionSheet#show\n   * @description\n   * Load and return a new action sheet.\n   *\n   * A new isolated scope will be created for the\n   * action sheet and the new element will be appended into the body.\n   *\n   * @param {object} options The options for this ActionSheet. Properties:\n   *\n   *  - `[Object]` `buttons` Which buttons to show.  Each button is an object with a `text` field.\n   *  - `{string}` `titleText` The title to show on the action sheet.\n   *  - `{string=}` `cancelText` the text for a 'cancel' button on the action sheet.\n   *  - `{string=}` `destructiveText` The text for a 'danger' on the action sheet.\n   *  - `{function=}` `cancel` Called if the cancel button is pressed, the backdrop is tapped or\n   *     the hardware back button is pressed.\n   *  - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,\n   *     with the index of the button that was clicked and the button object. Return true to close\n   *     the action sheet, or false to keep it opened.\n   *  - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked.\n   *     Return true to close the action sheet, or false to keep it opened.\n   *  -  `{boolean=}` `cancelOnStateChange` Whether to cancel the actionSheet when navigating\n   *     to a new state.  Default true.\n   *  - `{string}` `cssClass` The custom CSS class name.\n   *\n   * @returns {function} `hideSheet` A function which, when called, hides & cancels the action sheet.\n   */\n  function actionSheet(opts) {\n    var scope = $rootScope.$new(true);\n\n    extend(scope, {\n      cancel: noop,\n      destructiveButtonClicked: noop,\n      buttonClicked: noop,\n      $deregisterBackButton: noop,\n      buttons: [],\n      cancelOnStateChange: true\n    }, opts || {});\n\n    function textForIcon(text) {\n      if (text && /icon/.test(text)) {\n        scope.$actionSheetHasIcon = true;\n      }\n    }\n\n    for (var x = 0; x < scope.buttons.length; x++) {\n      textForIcon(scope.buttons[x].text);\n    }\n    textForIcon(scope.cancelText);\n    textForIcon(scope.destructiveText);\n\n    // Compile the template\n    var element = scope.element = $compile('<ion-action-sheet ng-class=\"cssClass\" buttons=\"buttons\"></ion-action-sheet>')(scope);\n\n    // Grab the sheet element for animation\n    var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper'));\n\n    var stateChangeListenDone = scope.cancelOnStateChange ?\n      $rootScope.$on('$stateChangeSuccess', function() { scope.cancel(); }) :\n      noop;\n\n    // removes the actionSheet from the screen\n    scope.removeSheet = function(done) {\n      if (scope.removed) return;\n\n      scope.removed = true;\n      sheetEl.removeClass('action-sheet-up');\n      $timeout(function() {\n        // wait to remove this due to a 300ms delay native\n        // click which would trigging whatever was underneath this\n        $ionicBody.removeClass('action-sheet-open');\n      }, 400);\n      scope.$deregisterBackButton();\n      stateChangeListenDone();\n\n      $animate.removeClass(element, 'active').then(function() {\n        scope.$destroy();\n        element.remove();\n        // scope.cancel.$scope is defined near the bottom\n        scope.cancel.$scope = sheetEl = null;\n        (done || noop)(opts.buttons);\n      });\n    };\n\n    scope.showSheet = function(done) {\n      if (scope.removed) return;\n\n      $ionicBody.append(element)\n                .addClass('action-sheet-open');\n\n      $animate.addClass(element, 'active').then(function() {\n        if (scope.removed) return;\n        (done || noop)();\n      });\n      $timeout(function() {\n        if (scope.removed) return;\n        sheetEl.addClass('action-sheet-up');\n      }, 20, false);\n    };\n\n    // registerBackButtonAction returns a callback to deregister the action\n    scope.$deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n      function() {\n        $timeout(scope.cancel);\n      },\n      IONIC_BACK_PRIORITY.actionSheet\n    );\n\n    // called when the user presses the cancel button\n    scope.cancel = function() {\n      // after the animation is out, call the cancel callback\n      scope.removeSheet(opts.cancel);\n    };\n\n    scope.buttonClicked = function(index) {\n      // Check if the button click event returned true, which means\n      // we can close the action sheet\n      if (opts.buttonClicked(index, opts.buttons[index]) === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.destructiveButtonClicked = function() {\n      // Check if the destructive button click event returned true, which means\n      // we can close the action sheet\n      if (opts.destructiveButtonClicked() === true) {\n        scope.removeSheet();\n      }\n    };\n\n    scope.showSheet();\n\n    // Expose the scope on $ionicActionSheet's return value for the sake\n    // of testing it.\n    scope.cancel.$scope = scope;\n\n    return scope.cancel;\n  }\n}]);\n\n\njqLite.prototype.addClass = function(cssClasses) {\n  var x, y, cssClass, el, splitClasses, existingClasses;\n  if (cssClasses && cssClasses != 'ng-scope' && cssClasses != 'ng-isolate-scope') {\n    for (x = 0; x < this.length; x++) {\n      el = this[x];\n      if (el.setAttribute) {\n\n        if (cssClasses.indexOf(' ') < 0 && el.classList.add) {\n          el.classList.add(cssClasses);\n        } else {\n          existingClasses = (' ' + (el.getAttribute('class') || '') + ' ')\n            .replace(/[\\n\\t]/g, \" \");\n          splitClasses = cssClasses.split(' ');\n\n          for (y = 0; y < splitClasses.length; y++) {\n            cssClass = splitClasses[y].trim();\n            if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {\n              existingClasses += cssClass + ' ';\n            }\n          }\n          el.setAttribute('class', existingClasses.trim());\n        }\n      }\n    }\n  }\n  return this;\n};\n\njqLite.prototype.removeClass = function(cssClasses) {\n  var x, y, splitClasses, cssClass, el;\n  if (cssClasses) {\n    for (x = 0; x < this.length; x++) {\n      el = this[x];\n      if (el.getAttribute) {\n        if (cssClasses.indexOf(' ') < 0 && el.classList.remove) {\n          el.classList.remove(cssClasses);\n        } else {\n          splitClasses = cssClasses.split(' ');\n\n          for (y = 0; y < splitClasses.length; y++) {\n            cssClass = splitClasses[y];\n            el.setAttribute('class', (\n                (\" \" + (el.getAttribute('class') || '') + \" \")\n                .replace(/[\\n\\t]/g, \" \")\n                .replace(\" \" + cssClass.trim() + \" \", \" \")).trim()\n            );\n          }\n        }\n      }\n    }\n  }\n  return this;\n};\n\n/**\n * @ngdoc service\n * @name $ionicBackdrop\n * @module ionic\n * @description\n * Shows and hides a backdrop over the UI.  Appears behind popups, loading,\n * and other overlays.\n *\n * Often, multiple UI components require a backdrop, but only one backdrop is\n * ever needed in the DOM at a time.\n *\n * Therefore, each component that requires the backdrop to be shown calls\n * `$ionicBackdrop.retain()` when it wants the backdrop, then `$ionicBackdrop.release()`\n * when it is done with the backdrop.\n *\n * For each time `retain` is called, the backdrop will be shown until `release` is called.\n *\n * For example, if `retain` is called three times, the backdrop will be shown until `release`\n * is called three times.\n *\n * **Notes:**\n * - The backdrop service will broadcast 'backdrop.shown' and 'backdrop.hidden' events from the root scope,\n * this is useful for alerting native components not in html.\n *\n * @usage\n *\n * ```js\n * function MyController($scope, $ionicBackdrop, $timeout, $rootScope) {\n *   //Show a backdrop for one second\n *   $scope.action = function() {\n *     $ionicBackdrop.retain();\n *     $timeout(function() {\n *       $ionicBackdrop.release();\n *     }, 1000);\n *   };\n *\n *   // Execute action on backdrop disappearing\n *   $scope.$on('backdrop.hidden', function() {\n *     // Execute action\n *   });\n *\n *   // Execute action on backdrop appearing\n *   $scope.$on('backdrop.shown', function() {\n *     // Execute action\n *   });\n *\n * }\n * ```\n */\nIonicModule\n.factory('$ionicBackdrop', [\n  '$document', '$timeout', '$$rAF', '$rootScope',\nfunction($document, $timeout, $$rAF, $rootScope) {\n\n  var el = jqLite('<div class=\"backdrop\">');\n  var backdropHolds = 0;\n\n  $document[0].body.appendChild(el[0]);\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#retain\n     * @description Retains the backdrop.\n     */\n    retain: retain,\n    /**\n     * @ngdoc method\n     * @name $ionicBackdrop#release\n     * @description\n     * Releases the backdrop.\n     */\n    release: release,\n\n    getElement: getElement,\n\n    // exposed for testing\n    _element: el\n  };\n\n  function retain() {\n    backdropHolds++;\n    if (backdropHolds === 1) {\n      el.addClass('visible');\n      $rootScope.$broadcast('backdrop.shown');\n      $$rAF(function() {\n        // If we're still at >0 backdropHolds after async...\n        if (backdropHolds >= 1) el.addClass('active');\n      });\n    }\n  }\n  function release() {\n    if (backdropHolds === 1) {\n      el.removeClass('active');\n      $rootScope.$broadcast('backdrop.hidden');\n      $timeout(function() {\n        // If we're still at 0 backdropHolds after async...\n        if (backdropHolds === 0) el.removeClass('visible');\n      }, 400, false);\n    }\n    backdropHolds = Math.max(0, backdropHolds - 1);\n  }\n\n  function getElement() {\n    return el;\n  }\n\n}]);\n\n/**\n * @private\n */\nIonicModule\n.factory('$ionicBind', ['$parse', '$interpolate', function($parse, $interpolate) {\n  var LOCAL_REGEXP = /^\\s*([@=&])(\\??)\\s*(\\w*)\\s*$/;\n  return function(scope, attrs, bindDefinition) {\n    forEach(bindDefinition || {}, function(definition, scopeName) {\n      //Adapted from angular.js $compile\n      var match = definition.match(LOCAL_REGEXP) || [],\n        attrName = match[3] || scopeName,\n        mode = match[1], // @, =, or &\n        parentGet,\n        unwatch;\n\n      switch (mode) {\n        case '@':\n          if (!attrs[attrName]) {\n            return;\n          }\n          attrs.$observe(attrName, function(value) {\n            scope[scopeName] = value;\n          });\n          // we trigger an interpolation to ensure\n          // the value is there for use immediately\n          if (attrs[attrName]) {\n            scope[scopeName] = $interpolate(attrs[attrName])(scope);\n          }\n          break;\n\n        case '=':\n          if (!attrs[attrName]) {\n            return;\n          }\n          unwatch = scope.$watch(attrs[attrName], function(value) {\n            scope[scopeName] = value;\n          });\n          //Destroy parent scope watcher when this scope is destroyed\n          scope.$on('$destroy', unwatch);\n          break;\n\n        case '&':\n          /* jshint -W044 */\n          if (attrs[attrName] && attrs[attrName].match(RegExp(scopeName + '\\(.*?\\)'))) {\n            throw new Error('& expression binding \"' + scopeName + '\" looks like it will recursively call \"' +\n                          attrs[attrName] + '\" and cause a stack overflow! Please choose a different scopeName.');\n          }\n          parentGet = $parse(attrs[attrName]);\n          scope[scopeName] = function(locals) {\n            return parentGet(scope, locals);\n          };\n          break;\n      }\n    });\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicBody\n * @module ionic\n * @description An angular utility service to easily and efficiently\n * add and remove CSS classes from the document's body element.\n */\nIonicModule\n.factory('$ionicBody', ['$document', function($document) {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicBody#addClass\n     * @description Add a class to the document's body element.\n     * @param {string} class Each argument will be added to the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    addClass: function() {\n      for (var x = 0; x < arguments.length; x++) {\n        $document[0].body.classList.add(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#removeClass\n     * @description Remove a class from the document's body element.\n     * @param {string} class Each argument will be removed from the body element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    removeClass: function() {\n      for (var x = 0; x < arguments.length; x++) {\n        $document[0].body.classList.remove(arguments[x]);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#enableClass\n     * @description Similar to the `add` method, except the first parameter accepts a boolean\n     * value determining if the class should be added or removed. Rather than writing user code,\n     * such as \"if true then add the class, else then remove the class\", this method can be\n     * given a true or false value which reduces redundant code.\n     * @param {boolean} shouldEnableClass A true/false value if the class should be added or removed.\n     * @param {string} class Each remaining argument would be added or removed depending on\n     * the first argument.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    enableClass: function(shouldEnableClass) {\n      var args = Array.prototype.slice.call(arguments).slice(1);\n      if (shouldEnableClass) {\n        this.addClass.apply(this, args);\n      } else {\n        this.removeClass.apply(this, args);\n      }\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#append\n     * @description Append a child to the document's body.\n     * @param {element} element The element to be appended to the body. The passed in element\n     * can be either a jqLite element, or a DOM element.\n     * @returns {$ionicBody} The $ionicBody service so methods can be chained.\n     */\n    append: function(ele) {\n      $document[0].body.appendChild(ele.length ? ele[0] : ele);\n      return this;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicBody#get\n     * @description Get the document's body element.\n     * @returns {element} Returns the document's body element.\n     */\n    get: function() {\n      return $document[0].body;\n    }\n  };\n}]);\n\nIonicModule\n.factory('$ionicClickBlock', [\n  '$document',\n  '$ionicBody',\n  '$timeout',\nfunction($document, $ionicBody, $timeout) {\n  var CSS_HIDE = 'click-block-hide';\n  var cbEle, fallbackTimer, pendingShow;\n\n  function preventClick(ev) {\n    ev.preventDefault();\n    ev.stopPropagation();\n  }\n\n  function addClickBlock() {\n    if (pendingShow) {\n      if (cbEle) {\n        cbEle.classList.remove(CSS_HIDE);\n      } else {\n        cbEle = $document[0].createElement('div');\n        cbEle.className = 'click-block';\n        $ionicBody.append(cbEle);\n        cbEle.addEventListener('touchstart', preventClick);\n        cbEle.addEventListener('mousedown', preventClick);\n      }\n      pendingShow = false;\n    }\n  }\n\n  function removeClickBlock() {\n    cbEle && cbEle.classList.add(CSS_HIDE);\n  }\n\n  return {\n    show: function(autoExpire) {\n      pendingShow = true;\n      $timeout.cancel(fallbackTimer);\n      fallbackTimer = $timeout(this.hide, autoExpire || 310, false);\n      addClickBlock();\n    },\n    hide: function() {\n      pendingShow = false;\n      $timeout.cancel(fallbackTimer);\n      removeClickBlock();\n    }\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicGesture\n * @module ionic\n * @description An angular service exposing ionic\n * {@link ionic.utility:ionic.EventController}'s gestures.\n */\nIonicModule\n.factory('$ionicGesture', [function() {\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#on\n     * @description Add an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#onGesture}.\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {element} $element The angular element to listen for the event on.\n     * @param {object} options object.\n     * @returns {ionic.Gesture} The gesture object (use this to remove the gesture later on).\n     */\n    on: function(eventType, cb, $element, options) {\n      return window.ionic.onGesture(eventType, cb, $element[0], options);\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicGesture#off\n     * @description Remove an event listener for a gesture on an element. See {@link ionic.utility:ionic.EventController#offGesture}.\n     * @param {ionic.Gesture} gesture The gesture that should be removed.\n     * @param {string} eventType The gesture event to remove the listener for.\n     * @param {function(e)} callback The listener to remove.\n     */\n    off: function(gesture, eventType, cb) {\n      return window.ionic.offGesture(gesture, eventType, cb);\n    }\n  };\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicHistory\n * @module ionic\n * @description\n * $ionicHistory keeps track of views as the user navigates through an app. Similar to the way a\n * browser behaves, an Ionic app is able to keep track of the previous view, the current view, and\n * the forward view (if there is one).  However, a typical web browser only keeps track of one\n * history stack in a linear fashion.\n *\n * Unlike a traditional browser environment, apps and webapps have parallel independent histories,\n * such as with tabs. Should a user navigate few pages deep on one tab, and then switch to a new\n * tab and back, the back button relates not to the previous tab, but to the previous pages\n * visited within _that_ tab.\n *\n * `$ionicHistory` facilitates this parallel history architecture.\n */\n\nIonicModule\n.factory('$ionicHistory', [\n  '$rootScope',\n  '$state',\n  '$location',\n  '$window',\n  '$timeout',\n  '$ionicViewSwitcher',\n  '$ionicNavViewDelegate',\nfunction($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $ionicNavViewDelegate) {\n\n  // history actions while navigating views\n  var ACTION_INITIAL_VIEW = 'initialView';\n  var ACTION_NEW_VIEW = 'newView';\n  var ACTION_MOVE_BACK = 'moveBack';\n  var ACTION_MOVE_FORWARD = 'moveForward';\n\n  // direction of navigation\n  var DIRECTION_BACK = 'back';\n  var DIRECTION_FORWARD = 'forward';\n  var DIRECTION_ENTER = 'enter';\n  var DIRECTION_EXIT = 'exit';\n  var DIRECTION_SWAP = 'swap';\n  var DIRECTION_NONE = 'none';\n\n  var stateChangeCounter = 0;\n  var lastStateId, nextViewOptions, deregisterStateChangeListener, nextViewExpireTimer, forcedNav;\n\n  var viewHistory = {\n    histories: { root: { historyId: 'root', parentHistoryId: null, stack: [], cursor: -1 } },\n    views: {},\n    backView: null,\n    forwardView: null,\n    currentView: null\n  };\n\n  var View = function() {};\n  View.prototype.initialize = function(data) {\n    if (data) {\n      for (var name in data) this[name] = data[name];\n      return this;\n    }\n    return null;\n  };\n  View.prototype.go = function() {\n\n    if (this.stateName) {\n      return $state.go(this.stateName, this.stateParams);\n    }\n\n    if (this.url && this.url !== $location.url()) {\n\n      if (viewHistory.backView === this) {\n        return $window.history.go(-1);\n      } else if (viewHistory.forwardView === this) {\n        return $window.history.go(1);\n      }\n\n      $location.url(this.url);\n    }\n\n    return null;\n  };\n  View.prototype.destroy = function() {\n    if (this.scope) {\n      this.scope.$destroy && this.scope.$destroy();\n      this.scope = null;\n    }\n  };\n\n\n  function getViewById(viewId) {\n    return (viewId ? viewHistory.views[ viewId ] : null);\n  }\n\n  function getBackView(view) {\n    return (view ? getViewById(view.backViewId) : null);\n  }\n\n  function getForwardView(view) {\n    return (view ? getViewById(view.forwardViewId) : null);\n  }\n\n  function getHistoryById(historyId) {\n    return (historyId ? viewHistory.histories[ historyId ] : null);\n  }\n\n  function getHistory(scope) {\n    var histObj = getParentHistoryObj(scope);\n\n    if (!viewHistory.histories[ histObj.historyId ]) {\n      // this history object exists in parent scope, but doesn't\n      // exist in the history data yet\n      viewHistory.histories[ histObj.historyId ] = {\n        historyId: histObj.historyId,\n        parentHistoryId: getParentHistoryObj(histObj.scope.$parent).historyId,\n        stack: [],\n        cursor: -1\n      };\n    }\n    return getHistoryById(histObj.historyId);\n  }\n\n  function getParentHistoryObj(scope) {\n    var parentScope = scope;\n    while (parentScope) {\n      if (parentScope.hasOwnProperty('$historyId')) {\n        // this parent scope has a historyId\n        return { historyId: parentScope.$historyId, scope: parentScope };\n      }\n      // nothing found keep climbing up\n      parentScope = parentScope.$parent;\n    }\n    // no history for the parent, use the root\n    return { historyId: 'root', scope: $rootScope };\n  }\n\n  function setNavViews(viewId) {\n    viewHistory.currentView = getViewById(viewId);\n    viewHistory.backView = getBackView(viewHistory.currentView);\n    viewHistory.forwardView = getForwardView(viewHistory.currentView);\n  }\n\n  function getCurrentStateId() {\n    var id;\n    if ($state && $state.current && $state.current.name) {\n      id = $state.current.name;\n      if ($state.params) {\n        for (var key in $state.params) {\n          if ($state.params.hasOwnProperty(key) && $state.params[key]) {\n            id += \"_\" + key + \"=\" + $state.params[key];\n          }\n        }\n      }\n      return id;\n    }\n    // if something goes wrong make sure its got a unique stateId\n    return ionic.Utils.nextUid();\n  }\n\n  function getCurrentStateParams() {\n    var rtn;\n    if ($state && $state.params) {\n      for (var key in $state.params) {\n        if ($state.params.hasOwnProperty(key)) {\n          rtn = rtn || {};\n          rtn[key] = $state.params[key];\n        }\n      }\n    }\n    return rtn;\n  }\n\n\n  return {\n\n    register: function(parentScope, viewLocals) {\n\n      var currentStateId = getCurrentStateId(),\n          hist = getHistory(parentScope),\n          currentView = viewHistory.currentView,\n          backView = viewHistory.backView,\n          forwardView = viewHistory.forwardView,\n          viewId = null,\n          action = null,\n          direction = DIRECTION_NONE,\n          historyId = hist.historyId,\n          url = $location.url(),\n          tmp, x, ele;\n\n      if (lastStateId !== currentStateId) {\n        lastStateId = currentStateId;\n        stateChangeCounter++;\n      }\n\n      if (forcedNav) {\n        // we've previously set exactly what to do\n        viewId = forcedNav.viewId;\n        action = forcedNav.action;\n        direction = forcedNav.direction;\n        forcedNav = null;\n\n      } else if (backView && backView.stateId === currentStateId) {\n        // they went back one, set the old current view as a forward view\n        viewId = backView.viewId;\n        historyId = backView.historyId;\n        action = ACTION_MOVE_BACK;\n        if (backView.historyId === currentView.historyId) {\n          // went back in the same history\n          direction = DIRECTION_BACK;\n\n        } else if (currentView) {\n          direction = DIRECTION_EXIT;\n\n          tmp = getHistoryById(backView.historyId);\n          if (tmp && tmp.parentHistoryId === currentView.historyId) {\n            direction = DIRECTION_ENTER;\n\n          } else {\n            tmp = getHistoryById(currentView.historyId);\n            if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {\n              direction = DIRECTION_SWAP;\n            }\n          }\n        }\n\n      } else if (forwardView && forwardView.stateId === currentStateId) {\n        // they went to the forward one, set the forward view to no longer a forward view\n        viewId = forwardView.viewId;\n        historyId = forwardView.historyId;\n        action = ACTION_MOVE_FORWARD;\n        if (forwardView.historyId === currentView.historyId) {\n          direction = DIRECTION_FORWARD;\n\n        } else if (currentView) {\n          direction = DIRECTION_EXIT;\n\n          if (currentView.historyId === hist.parentHistoryId) {\n            direction = DIRECTION_ENTER;\n\n          } else {\n            tmp = getHistoryById(currentView.historyId);\n            if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {\n              direction = DIRECTION_SWAP;\n            }\n          }\n        }\n\n        tmp = getParentHistoryObj(parentScope);\n        if (forwardView.historyId && tmp.scope) {\n          // if a history has already been created by the forward view then make sure it stays the same\n          tmp.scope.$historyId = forwardView.historyId;\n          historyId = forwardView.historyId;\n        }\n\n      } else if (currentView && currentView.historyId !== historyId &&\n                hist.cursor > -1 && hist.stack.length > 0 && hist.cursor < hist.stack.length &&\n                hist.stack[hist.cursor].stateId === currentStateId) {\n        // they just changed to a different history and the history already has views in it\n        var switchToView = hist.stack[hist.cursor];\n        viewId = switchToView.viewId;\n        historyId = switchToView.historyId;\n        action = ACTION_MOVE_BACK;\n        direction = DIRECTION_SWAP;\n\n        tmp = getHistoryById(currentView.historyId);\n        if (tmp && tmp.parentHistoryId === historyId) {\n          direction = DIRECTION_EXIT;\n\n        } else {\n          tmp = getHistoryById(historyId);\n          if (tmp && tmp.parentHistoryId === currentView.historyId) {\n            direction = DIRECTION_ENTER;\n          }\n        }\n\n        // if switching to a different history, and the history of the view we're switching\n        // to has an existing back view from a different history than itself, then\n        // it's back view would be better represented using the current view as its back view\n        tmp = getViewById(switchToView.backViewId);\n        if (tmp && switchToView.historyId !== tmp.historyId) {\n          // the new view is being removed from it's old position in the history and being placed at the top,\n          // so we need to update any views that reference it as a backview, otherwise there will be infinitely loops\n          var viewIds = Object.keys(viewHistory.views);\n          viewIds.forEach(function(viewId) {\n            var view = viewHistory.views[viewId];\n            if ( view.backViewId === switchToView.viewId ) {\n              view.backViewId = null;\n            }\n          });\n\n          hist.stack[hist.cursor].backViewId = currentView.viewId;\n        }\n\n      } else {\n\n        // create an element from the viewLocals template\n        ele = $ionicViewSwitcher.createViewEle(viewLocals);\n        if (this.isAbstractEle(ele, viewLocals)) {\n          return {\n            action: 'abstractView',\n            direction: DIRECTION_NONE,\n            ele: ele\n          };\n        }\n\n        // set a new unique viewId\n        viewId = ionic.Utils.nextUid();\n\n        if (currentView) {\n          // set the forward view if there is a current view (ie: if its not the first view)\n          currentView.forwardViewId = viewId;\n\n          action = ACTION_NEW_VIEW;\n\n          // check if there is a new forward view within the same history\n          if (forwardView && currentView.stateId !== forwardView.stateId &&\n             currentView.historyId === forwardView.historyId) {\n            // they navigated to a new view but the stack already has a forward view\n            // since its a new view remove any forwards that existed\n            tmp = getHistoryById(forwardView.historyId);\n            if (tmp) {\n              // the forward has a history\n              for (x = tmp.stack.length - 1; x >= forwardView.index; x--) {\n                // starting from the end destroy all forwards in this history from this point\n                var stackItem = tmp.stack[x];\n                stackItem && stackItem.destroy && stackItem.destroy();\n                tmp.stack.splice(x);\n              }\n              historyId = forwardView.historyId;\n            }\n          }\n\n          // its only moving forward if its in the same history\n          if (hist.historyId === currentView.historyId) {\n            direction = DIRECTION_FORWARD;\n\n          } else if (currentView.historyId !== hist.historyId) {\n            // DB: this is a new view in a different tab\n            direction = DIRECTION_ENTER;\n\n            tmp = getHistoryById(currentView.historyId);\n            if (tmp && tmp.parentHistoryId === hist.parentHistoryId) {\n              direction = DIRECTION_SWAP;\n\n            } else {\n              tmp = getHistoryById(tmp.parentHistoryId);\n              if (tmp && tmp.historyId === hist.historyId) {\n                direction = DIRECTION_EXIT;\n              }\n            }\n          }\n\n        } else {\n          // there's no current view, so this must be the initial view\n          action = ACTION_INITIAL_VIEW;\n        }\n\n        if (stateChangeCounter < 2) {\n          // views that were spun up on the first load should not animate\n          direction = DIRECTION_NONE;\n        }\n\n        // add the new view\n        viewHistory.views[viewId] = this.createView({\n          viewId: viewId,\n          index: hist.stack.length,\n          historyId: hist.historyId,\n          backViewId: (currentView && currentView.viewId ? currentView.viewId : null),\n          forwardViewId: null,\n          stateId: currentStateId,\n          stateName: this.currentStateName(),\n          stateParams: getCurrentStateParams(),\n          url: url,\n          canSwipeBack: canSwipeBack(ele, viewLocals)\n        });\n\n        // add the new view to this history's stack\n        hist.stack.push(viewHistory.views[viewId]);\n      }\n\n      deregisterStateChangeListener && deregisterStateChangeListener();\n      $timeout.cancel(nextViewExpireTimer);\n      if (nextViewOptions) {\n        if (nextViewOptions.disableAnimate) direction = DIRECTION_NONE;\n        if (nextViewOptions.disableBack) viewHistory.views[viewId].backViewId = null;\n        if (nextViewOptions.historyRoot) {\n          for (x = 0; x < hist.stack.length; x++) {\n            if (hist.stack[x].viewId === viewId) {\n              hist.stack[x].index = 0;\n              hist.stack[x].backViewId = hist.stack[x].forwardViewId = null;\n            } else {\n              delete viewHistory.views[hist.stack[x].viewId];\n            }\n          }\n          hist.stack = [viewHistory.views[viewId]];\n        }\n        nextViewOptions = null;\n      }\n\n      setNavViews(viewId);\n\n      if (viewHistory.backView && historyId == viewHistory.backView.historyId && currentStateId == viewHistory.backView.stateId && url == viewHistory.backView.url) {\n        for (x = 0; x < hist.stack.length; x++) {\n          if (hist.stack[x].viewId == viewId) {\n            action = 'dupNav';\n            direction = DIRECTION_NONE;\n            if (x > 0) {\n              hist.stack[x - 1].forwardViewId = null;\n            }\n            viewHistory.forwardView = null;\n            viewHistory.currentView.index = viewHistory.backView.index;\n            viewHistory.currentView.backViewId = viewHistory.backView.backViewId;\n            viewHistory.backView = getBackView(viewHistory.backView);\n            hist.stack.splice(x, 1);\n            break;\n          }\n        }\n      }\n\n      hist.cursor = viewHistory.currentView.index;\n\n      return {\n        viewId: viewId,\n        action: action,\n        direction: direction,\n        historyId: historyId,\n        enableBack: this.enabledBack(viewHistory.currentView),\n        isHistoryRoot: (viewHistory.currentView.index === 0),\n        ele: ele\n      };\n    },\n\n    registerHistory: function(scope) {\n      scope.$historyId = ionic.Utils.nextUid();\n    },\n\n    createView: function(data) {\n      var newView = new View();\n      return newView.initialize(data);\n    },\n\n    getViewById: getViewById,\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#viewHistory\n     * @description The app's view history data, such as all the views and histories, along\n     * with how they are ordered and linked together within the navigation stack.\n     * @returns {object} Returns an object containing the apps view history data.\n     */\n    viewHistory: function() {\n      return viewHistory;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentView\n     * @description The app's current view.\n     * @returns {object} Returns the current view.\n     */\n    currentView: function(view) {\n      if (arguments.length) {\n        viewHistory.currentView = view;\n      }\n      return viewHistory.currentView;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentHistoryId\n     * @description The ID of the history stack which is the parent container of the current view.\n     * @returns {string} Returns the current history ID.\n     */\n    currentHistoryId: function() {\n      return viewHistory.currentView ? viewHistory.currentView.historyId : null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentTitle\n     * @description Gets and sets the current view's title.\n     * @param {string=} val The title to update the current view with.\n     * @returns {string} Returns the current view's title.\n     */\n    currentTitle: function(val) {\n      if (viewHistory.currentView) {\n        if (arguments.length) {\n          viewHistory.currentView.title = val;\n        }\n        return viewHistory.currentView.title;\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#backView\n     * @description Returns the view that was before the current view in the history stack.\n     * If the user navigated from View A to View B, then View A would be the back view, and\n     * View B would be the current view.\n     * @returns {object} Returns the back view.\n     */\n    backView: function(view) {\n      if (arguments.length) {\n        viewHistory.backView = view;\n      }\n      return viewHistory.backView;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#backTitle\n     * @description Gets the back view's title.\n     * @returns {string} Returns the back view's title.\n     */\n    backTitle: function(view) {\n      var backView = (view && getViewById(view.backViewId)) || viewHistory.backView;\n      return backView && backView.title;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#forwardView\n     * @description Returns the view that was in front of the current view in the history stack.\n     * A forward view would exist if the user navigated from View A to View B, then\n     * navigated back to View A. At this point then View B would be the forward view, and View\n     * A would be the current view.\n     * @returns {object} Returns the forward view.\n     */\n    forwardView: function(view) {\n      if (arguments.length) {\n        viewHistory.forwardView = view;\n      }\n      return viewHistory.forwardView;\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#currentStateName\n     * @description Returns the current state name.\n     * @returns {string}\n     */\n    currentStateName: function() {\n      return ($state && $state.current ? $state.current.name : null);\n    },\n\n    isCurrentStateNavView: function(navView) {\n      return !!($state && $state.current && $state.current.views && $state.current.views[navView]);\n    },\n\n    goToHistoryRoot: function(historyId) {\n      if (historyId) {\n        var hist = getHistoryById(historyId);\n        if (hist && hist.stack.length) {\n          if (viewHistory.currentView && viewHistory.currentView.viewId === hist.stack[0].viewId) {\n            return;\n          }\n          forcedNav = {\n            viewId: hist.stack[0].viewId,\n            action: ACTION_MOVE_BACK,\n            direction: DIRECTION_BACK\n          };\n          hist.stack[0].go();\n        }\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#goBack\n     * @param {number=} backCount Optional negative integer setting how many views to go\n     * back. By default it'll go back one view by using the value `-1`. To go back two\n     * views you would use `-2`. If the number goes farther back than the number of views\n     * in the current history's stack then it'll go to the first view in the current history's\n     * stack. If the number is zero or greater then it'll do nothing. It also does not\n     * cross history stacks, meaning it can only go as far back as the current history.\n     * @description Navigates the app to the back view, if a back view exists.\n     */\n    goBack: function(backCount) {\n      if (isDefined(backCount) && backCount !== -1) {\n        if (backCount > -1) return;\n\n        var currentHistory = viewHistory.histories[this.currentHistoryId()];\n        var newCursor = currentHistory.cursor + backCount + 1;\n        if (newCursor < 1) {\n          newCursor = 1;\n        }\n\n        currentHistory.cursor = newCursor;\n        setNavViews(currentHistory.stack[newCursor].viewId);\n\n        var cursor = newCursor - 1;\n        var clearStateIds = [];\n        var fwdView = getViewById(currentHistory.stack[cursor].forwardViewId);\n        while (fwdView) {\n          clearStateIds.push(fwdView.stateId || fwdView.viewId);\n          cursor++;\n          if (cursor >= currentHistory.stack.length) break;\n          fwdView = getViewById(currentHistory.stack[cursor].forwardViewId);\n        }\n\n        var self = this;\n        if (clearStateIds.length) {\n          $timeout(function() {\n            self.clearCache(clearStateIds);\n          }, 300);\n        }\n      }\n\n      viewHistory.backView && viewHistory.backView.go();\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#removeBackView\n     * @description Remove the previous view from the history completely, including the\n     * cached element and scope (if they exist).\n     */\n    removeBackView: function() {\n      var self = this;\n      var currentHistory = viewHistory.histories[this.currentHistoryId()];\n      var currentCursor = currentHistory.cursor;\n\n      var currentView = currentHistory.stack[currentCursor];\n      var backView = currentHistory.stack[currentCursor - 1];\n      var replacementView = currentHistory.stack[currentCursor - 2];\n\n      // fail if we dont have enough views in the history\n      if (!backView || !replacementView) {\n        return;\n      }\n\n      // remove the old backView and the cached element/scope\n      currentHistory.stack.splice(currentCursor - 1, 1);\n      self.clearCache([backView.viewId]);\n      // make the replacementView and currentView point to each other (bypass the old backView)\n      currentView.backViewId = replacementView.viewId;\n      currentView.index = currentView.index - 1;\n      replacementView.forwardViewId = currentView.viewId;\n      // update the cursor and set new backView\n      viewHistory.backView = replacementView;\n      currentHistory.currentCursor += -1;\n    },\n\n    enabledBack: function(view) {\n      var backView = getBackView(view);\n      return !!(backView && backView.historyId === view.historyId);\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#clearHistory\n     * @description Clears out the app's entire history, except for the current view.\n     */\n    clearHistory: function() {\n      var\n      histories = viewHistory.histories,\n      currentView = viewHistory.currentView;\n\n      if (histories) {\n        for (var historyId in histories) {\n\n          if (histories[historyId].stack) {\n            histories[historyId].stack = [];\n            histories[historyId].cursor = -1;\n          }\n\n          if (currentView && currentView.historyId === historyId) {\n            currentView.backViewId = currentView.forwardViewId = null;\n            histories[historyId].stack.push(currentView);\n          } else if (histories[historyId].destroy) {\n            histories[historyId].destroy();\n          }\n\n        }\n      }\n\n      for (var viewId in viewHistory.views) {\n        if (viewId !== currentView.viewId) {\n          delete viewHistory.views[viewId];\n        }\n      }\n\n      if (currentView) {\n        setNavViews(currentView.viewId);\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#clearCache\n\t * @return promise\n     * @description Removes all cached views within every {@link ionic.directive:ionNavView}.\n     * This both removes the view element from the DOM, and destroy it's scope.\n     */\n    clearCache: function(stateIds) {\n      return $timeout(function() {\n        $ionicNavViewDelegate._instances.forEach(function(instance) {\n          instance.clearCache(stateIds);\n        });\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicHistory#nextViewOptions\n     * @description Sets options for the next view. This method can be useful to override\n     * certain view/transition defaults right before a view transition happens. For example,\n     * the {@link ionic.directive:menuClose} directive uses this method internally to ensure\n     * an animated view transition does not happen when a side menu is open, and also sets\n     * the next view as the root of its history stack. After the transition these options\n     * are set back to null.\n     *\n     * Available options:\n     *\n     * * `disableAnimate`: Do not animate the next transition.\n     * * `disableBack`: The next view should forget its back view, and set it to null.\n     * * `historyRoot`: The next view should become the root view in its history stack.\n     *\n     * ```js\n     * $ionicHistory.nextViewOptions({\n     *   disableAnimate: true,\n     *   disableBack: true\n     * });\n     * ```\n     */\n    nextViewOptions: function(opts) {\n      deregisterStateChangeListener && deregisterStateChangeListener();\n      if (arguments.length) {\n        $timeout.cancel(nextViewExpireTimer);\n        if (opts === null) {\n          nextViewOptions = opts;\n        } else {\n          nextViewOptions = nextViewOptions || {};\n          extend(nextViewOptions, opts);\n          if (nextViewOptions.expire) {\n              deregisterStateChangeListener = $rootScope.$on('$stateChangeSuccess', function() {\n                nextViewExpireTimer = $timeout(function() {\n                  nextViewOptions = null;\n                  }, nextViewOptions.expire);\n              });\n          }\n        }\n      }\n      return nextViewOptions;\n    },\n\n    isAbstractEle: function(ele, viewLocals) {\n      if (viewLocals && viewLocals.$$state && viewLocals.$$state.self['abstract']) {\n        return true;\n      }\n      return !!(ele && (isAbstractTag(ele) || isAbstractTag(ele.children())));\n    },\n\n    isActiveScope: function(scope) {\n      if (!scope) return false;\n\n      var climbScope = scope;\n      var currentHistoryId = this.currentHistoryId();\n      var foundHistoryId;\n\n      while (climbScope) {\n        if (climbScope.$$disconnected) {\n          return false;\n        }\n\n        if (!foundHistoryId && climbScope.hasOwnProperty('$historyId')) {\n          foundHistoryId = true;\n        }\n\n        if (currentHistoryId) {\n          if (climbScope.hasOwnProperty('$historyId') && currentHistoryId == climbScope.$historyId) {\n            return true;\n          }\n          if (climbScope.hasOwnProperty('$activeHistoryId')) {\n            if (currentHistoryId == climbScope.$activeHistoryId) {\n              if (climbScope.hasOwnProperty('$historyId')) {\n                return true;\n              }\n              if (!foundHistoryId) {\n                return true;\n              }\n            }\n          }\n        }\n\n        if (foundHistoryId && climbScope.hasOwnProperty('$activeHistoryId')) {\n          foundHistoryId = false;\n        }\n\n        climbScope = climbScope.$parent;\n      }\n\n      return currentHistoryId ? currentHistoryId == 'root' : true;\n    }\n\n  };\n\n  function isAbstractTag(ele) {\n    return ele && ele.length && /ion-side-menus|ion-tabs/i.test(ele[0].tagName);\n  }\n\n  function canSwipeBack(ele, viewLocals) {\n    if (viewLocals && viewLocals.$$state && viewLocals.$$state.self.canSwipeBack === false) {\n      return false;\n    }\n    if (ele && ele.attr('can-swipe-back') === 'false') {\n      return false;\n    }\n    var eleChild = ele.find('ion-view');\n    if (eleChild && eleChild.attr('can-swipe-back') === 'false') {\n      return false;\n    }\n    return true;\n  }\n\n}])\n\n.run([\n  '$rootScope',\n  '$state',\n  '$location',\n  '$document',\n  '$ionicPlatform',\n  '$ionicHistory',\n  'IONIC_BACK_PRIORITY',\nfunction($rootScope, $state, $location, $document, $ionicPlatform, $ionicHistory, IONIC_BACK_PRIORITY) {\n\n  // always reset the keyboard state when change stage\n  $rootScope.$on('$ionicView.beforeEnter', function() {\n    ionic.keyboard && ionic.keyboard.hide && ionic.keyboard.hide();\n  });\n\n  $rootScope.$on('$ionicHistory.change', function(e, data) {\n    if (!data) return null;\n\n    var viewHistory = $ionicHistory.viewHistory();\n\n    var hist = (data.historyId ? viewHistory.histories[ data.historyId ] : null);\n    if (hist && hist.cursor > -1 && hist.cursor < hist.stack.length) {\n      // the history they're going to already exists\n      // go to it's last view in its stack\n      var view = hist.stack[ hist.cursor ];\n      return view.go(data);\n    }\n\n    // this history does not have a URL, but it does have a uiSref\n    // figure out its URL from the uiSref\n    if (!data.url && data.uiSref) {\n      data.url = $state.href(data.uiSref);\n    }\n\n    if (data.url) {\n      // don't let it start with a #, messes with $location.url()\n      if (data.url.indexOf('#') === 0) {\n        data.url = data.url.replace('#', '');\n      }\n      if (data.url !== $location.url()) {\n        // we've got a good URL, ready GO!\n        $location.url(data.url);\n      }\n    }\n  });\n\n  $rootScope.$ionicGoBack = function(backCount) {\n    $ionicHistory.goBack(backCount);\n  };\n\n  // Set the document title when a new view is shown\n  $rootScope.$on('$ionicView.afterEnter', function(ev, data) {\n    if (data && data.title) {\n      $document[0].title = data.title;\n    }\n  });\n\n  // Triggered when devices with a hardware back button (Android) is clicked by the user\n  // This is a Cordova/Phonegap platform specifc method\n  function onHardwareBackButton(e) {\n    var backView = $ionicHistory.backView();\n    if (backView) {\n      // there is a back view, go to it\n      backView.go();\n    } else {\n      // there is no back view, so close the app instead\n      ionic.Platform.exitApp();\n    }\n    e.preventDefault();\n    return false;\n  }\n  $ionicPlatform.registerBackButtonAction(\n    onHardwareBackButton,\n    IONIC_BACK_PRIORITY.view\n  );\n\n}]);\n\n/**\n * @ngdoc provider\n * @name $ionicConfigProvider\n * @module ionic\n * @description\n * Ionic automatically takes platform configurations into account to adjust things like what\n * transition style to use and whether tab icons should show on the top or bottom. For example,\n * iOS will move forward by transitioning the entering view from right to center and the leaving\n * view from center to left. However, Android will transition with the entering view going from\n * bottom to center, covering the previous view, which remains stationary. It should be noted\n * that when a platform is not iOS or Android, then it'll default to iOS. So if you are\n * developing on a desktop browser, it's going to take on iOS default configs.\n *\n * These configs can be changed using the `$ionicConfigProvider` during the configuration phase\n * of your app. Additionally, `$ionicConfig` can also set and get config values during the run\n * phase and within the app itself.\n *\n * By default, all base config variables are set to `'platform'`, which means it'll take on the\n * default config of the platform on which it's running. Config variables can be set at this\n * level so all platforms follow the same setting, rather than its platform config.\n * The following code would set the same config variable for all platforms:\n *\n * ```js\n * $ionicConfigProvider.views.maxCache(10);\n * ```\n *\n * Additionally, each platform can have it's own config within the `$ionicConfigProvider.platform`\n * property. The config below would only apply to Android devices.\n *\n * ```js\n * $ionicConfigProvider.platform.android.views.maxCache(5);\n * ```\n *\n * @usage\n * ```js\n * var myApp = angular.module('reallyCoolApp', ['ionic']);\n *\n * myApp.config(function($ionicConfigProvider) {\n *   $ionicConfigProvider.views.maxCache(5);\n *\n *   // note that you can also chain configs\n *   $ionicConfigProvider.backButton.text('Go Back').icon('ion-chevron-left');\n * });\n * ```\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#views.transition\n * @description Animation style when transitioning between views. Default `platform`.\n *\n * @param {string} transition Which style of view transitioning to use.\n *\n * * `platform`: Dynamically choose the correct transition style depending on the platform\n * the app is running from. If the platform is not `ios` or `android` then it will default\n * to `ios`.\n * * `ios`: iOS style transition.\n * * `android`: Android style transition.\n * * `none`: Do not perform animated transitions.\n *\n * @returns {string} value\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#views.maxCache\n * @description  Maximum number of view elements to cache in the DOM. When the max number is\n * exceeded, the view with the longest time period since it was accessed is removed. Views that\n * stay in the DOM cache the view's scope, current state, and scroll position. The scope is\n * disconnected from the `$watch` cycle when it is cached and reconnected when it enters again.\n * When the maximum cache is `0`, the leaving view's element will be removed from the DOM after\n * each view transition, and the next time the same view is shown, it will have to re-compile,\n * attach to the DOM, and link the element again. This disables caching, in effect.\n * @param {number} maxNumber Maximum number of views to retain. Default `10`.\n * @returns {number} How many views Ionic will hold onto until the a view is removed.\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#views.forwardCache\n * @description  By default, when navigating, views that were recently visited are cached, and\n * the same instance data and DOM elements are referenced when navigating back. However, when\n * navigating back in the history, the \"forward\" views are removed from the cache. If you\n * navigate forward to the same view again, it'll create a new DOM element and controller\n * instance. Basically, any forward views are reset each time. Set this config to `true` to have\n * forward views cached and not reset on each load.\n * @param {boolean} value\n * @returns {boolean}\n */\n\n /**\n  * @ngdoc method\n  * @name $ionicConfigProvider#views.swipeBackEnabled\n  * @description  By default on iOS devices, swipe to go back functionality is enabled by default.\n  * This method can be used to disable it globally, or on a per-view basis.\n  * Note: This functionality is only supported on iOS.\n  * @param {boolean} value\n  * @returns {boolean}\n  */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#scrolling.jsScrolling\n * @description  Whether to use JS or Native scrolling. Defaults to native scrolling. Setting this to\n * `true` has the same effect as setting each `ion-content` to have `overflow-scroll='false'`.\n * @param {boolean} value Defaults to `false` as of Ionic 1.2\n * @returns {boolean}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#backButton.icon\n * @description Back button icon.\n * @param {string} value\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#backButton.text\n * @description Back button text.\n * @param {string} value Defaults to `Back`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#backButton.previousTitleText\n * @description If the previous title text should become the back button text. This\n * is the default for iOS.\n * @param {boolean} value\n * @returns {boolean}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#form.checkbox\n * @description Checkbox style. Android defaults to `square` and iOS defaults to `circle`.\n * @param {string} value\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#form.toggle\n * @description Toggle item style. Android defaults to `small` and iOS defaults to `large`.\n * @param {string} value\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#spinner.icon\n * @description Default spinner icon to use.\n * @param {string} value Can be: `android`, `ios`, `ios-small`, `bubbles`, `circles`, `crescent`,\n * `dots`, `lines`, `ripple`, or `spiral`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#tabs.style\n * @description Tab style. Android defaults to `striped` and iOS defaults to `standard`.\n * @param {string} value Available values include `striped` and `standard`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#tabs.position\n * @description Tab position. Android defaults to `top` and iOS defaults to `bottom`.\n * @param {string} value Available values include `top` and `bottom`.\n * @returns {string}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#templates.maxPrefetch\n * @description Sets the maximum number of templates to prefetch from the templateUrls defined in\n * $stateProvider.state. If set to `0`, the user will have to wait\n * for a template to be fetched the first time when navigating to a new page. Default `30`.\n * @param {integer} value Max number of template to prefetch from the templateUrls defined in\n * `$stateProvider.state()`.\n * @returns {integer}\n */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#navBar.alignTitle\n * @description Which side of the navBar to align the title. Default `center`.\n *\n * @param {string} value side of the navBar to align the title.\n *\n * * `platform`: Dynamically choose the correct title style depending on the platform\n * the app is running from. If the platform is `ios`, it will default to `center`.\n * If the platform is `android`, it will default to `left`. If the platform is not\n * `ios` or `android`, it will default to `center`.\n *\n * * `left`: Left align the title in the navBar\n * * `center`: Center align the title in the navBar\n * * `right`: Right align the title in the navBar.\n *\n * @returns {string} value\n */\n\n/**\n  * @ngdoc method\n  * @name $ionicConfigProvider#navBar.positionPrimaryButtons\n  * @description Which side of the navBar to align the primary navBar buttons. Default `left`.\n  *\n  * @param {string} value side of the navBar to align the primary navBar buttons.\n  *\n  * * `platform`: Dynamically choose the correct title style depending on the platform\n  * the app is running from. If the platform is `ios`, it will default to `left`.\n  * If the platform is `android`, it will default to `right`. If the platform is not\n  * `ios` or `android`, it will default to `left`.\n  *\n  * * `left`: Left align the primary navBar buttons in the navBar\n  * * `right`: Right align the primary navBar buttons in the navBar.\n  *\n  * @returns {string} value\n  */\n\n/**\n * @ngdoc method\n * @name $ionicConfigProvider#navBar.positionSecondaryButtons\n * @description Which side of the navBar to align the secondary navBar buttons. Default `right`.\n *\n * @param {string} value side of the navBar to align the secondary navBar buttons.\n *\n * * `platform`: Dynamically choose the correct title style depending on the platform\n * the app is running from. If the platform is `ios`, it will default to `right`.\n * If the platform is `android`, it will default to `right`. If the platform is not\n * `ios` or `android`, it will default to `right`.\n *\n * * `left`: Left align the secondary navBar buttons in the navBar\n * * `right`: Right align the secondary navBar buttons in the navBar.\n *\n * @returns {string} value\n */\n\nIonicModule\n.provider('$ionicConfig', function() {\n\n  var provider = this;\n  provider.platform = {};\n  var PLATFORM = 'platform';\n\n  var configProperties = {\n    views: {\n      maxCache: PLATFORM,\n      forwardCache: PLATFORM,\n      transition: PLATFORM,\n      swipeBackEnabled: PLATFORM,\n      swipeBackHitWidth: PLATFORM\n    },\n    navBar: {\n      alignTitle: PLATFORM,\n      positionPrimaryButtons: PLATFORM,\n      positionSecondaryButtons: PLATFORM,\n      transition: PLATFORM\n    },\n    backButton: {\n      icon: PLATFORM,\n      text: PLATFORM,\n      previousTitleText: PLATFORM\n    },\n    form: {\n      checkbox: PLATFORM,\n      toggle: PLATFORM\n    },\n    scrolling: {\n      jsScrolling: PLATFORM\n    },\n    spinner: {\n      icon: PLATFORM\n    },\n    tabs: {\n      style: PLATFORM,\n      position: PLATFORM\n    },\n    templates: {\n      maxPrefetch: PLATFORM\n    },\n    platform: {}\n  };\n  createConfig(configProperties, provider, '');\n\n\n\n  // Default\n  // -------------------------\n  setPlatformConfig('default', {\n\n    views: {\n      maxCache: 10,\n      forwardCache: false,\n      transition: 'ios',\n      swipeBackEnabled: true,\n      swipeBackHitWidth: 45\n    },\n\n    navBar: {\n      alignTitle: 'center',\n      positionPrimaryButtons: 'left',\n      positionSecondaryButtons: 'right',\n      transition: 'view'\n    },\n\n    backButton: {\n      icon: 'ion-ios-arrow-back',\n      text: 'Back',\n      previousTitleText: true\n    },\n\n    form: {\n      checkbox: 'circle',\n      toggle: 'large'\n    },\n\n    scrolling: {\n      jsScrolling: true\n    },\n\n    spinner: {\n      icon: 'ios'\n    },\n\n    tabs: {\n      style: 'standard',\n      position: 'bottom'\n    },\n\n    templates: {\n      maxPrefetch: 30\n    }\n\n  });\n\n\n\n  // iOS (it is the default already)\n  // -------------------------\n  setPlatformConfig('ios', {});\n\n\n\n  // Android\n  // -------------------------\n  setPlatformConfig('android', {\n\n    views: {\n      transition: 'android',\n      swipeBackEnabled: false\n    },\n\n    navBar: {\n      alignTitle: 'left',\n      positionPrimaryButtons: 'right',\n      positionSecondaryButtons: 'right'\n    },\n\n    backButton: {\n      icon: 'ion-android-arrow-back',\n      text: false,\n      previousTitleText: false\n    },\n\n    form: {\n      checkbox: 'square',\n      toggle: 'small'\n    },\n\n    spinner: {\n      icon: 'android'\n    },\n\n    tabs: {\n      style: 'striped',\n      position: 'top'\n    },\n\n    scrolling: {\n      jsScrolling: false\n    }\n  });\n\n  // Windows Phone\n  // -------------------------\n  setPlatformConfig('windowsphone', {\n    //scrolling: {\n    //  jsScrolling: false\n    //}\n    spinner: {\n      icon: 'android'\n    }\n  });\n\n\n  provider.transitions = {\n    views: {},\n    navBar: {}\n  };\n\n\n  // iOS Transitions\n  // -----------------------\n  provider.transitions.views.ios = function(enteringEle, leavingEle, direction, shouldAnimate) {\n\n    function setStyles(ele, opacity, x, boxShadowOpacity) {\n      var css = {};\n      css[ionic.CSS.TRANSITION_DURATION] = d.shouldAnimate ? '' : 0;\n      css.opacity = opacity;\n      if (boxShadowOpacity > -1) {\n        css.boxShadow = '0 0 10px rgba(0,0,0,' + (d.shouldAnimate ? boxShadowOpacity * 0.45 : 0.3) + ')';\n      }\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + x + '%,0,0)';\n      ionic.DomUtil.cachedStyles(ele, css);\n    }\n\n    var d = {\n      run: function(step) {\n        if (direction == 'forward') {\n          setStyles(enteringEle, 1, (1 - step) * 99, 1 - step); // starting at 98% prevents a flicker\n          setStyles(leavingEle, (1 - 0.1 * step), step * -33, -1);\n\n        } else if (direction == 'back') {\n          setStyles(enteringEle, (1 - 0.1 * (1 - step)), (1 - step) * -33, -1);\n          setStyles(leavingEle, 1, step * 100, 1 - step);\n\n        } else {\n          // swap, enter, exit\n          setStyles(enteringEle, 1, 0, -1);\n          setStyles(leavingEle, 0, 0, -1);\n        }\n      },\n      shouldAnimate: shouldAnimate && (direction == 'forward' || direction == 'back')\n    };\n\n    return d;\n  };\n\n  provider.transitions.navBar.ios = function(enteringHeaderBar, leavingHeaderBar, direction, shouldAnimate) {\n\n    function setStyles(ctrl, opacity, titleX, backTextX) {\n      var css = {};\n      css[ionic.CSS.TRANSITION_DURATION] = d.shouldAnimate ? '' : '0ms';\n      css.opacity = opacity === 1 ? '' : opacity;\n\n      ctrl.setCss('buttons-left', css);\n      ctrl.setCss('buttons-right', css);\n      ctrl.setCss('back-button', css);\n\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + backTextX + 'px,0,0)';\n      ctrl.setCss('back-text', css);\n\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + titleX + 'px,0,0)';\n      ctrl.setCss('title', css);\n    }\n\n    function enter(ctrlA, ctrlB, step) {\n      if (!ctrlA || !ctrlB) return;\n      var titleX = (ctrlA.titleTextX() + ctrlA.titleWidth()) * (1 - step);\n      var backTextX = (ctrlB && (ctrlB.titleTextX() - ctrlA.backButtonTextLeft()) * (1 - step)) || 0;\n      setStyles(ctrlA, step, titleX, backTextX);\n    }\n\n    function leave(ctrlA, ctrlB, step) {\n      if (!ctrlA || !ctrlB) return;\n      var titleX = (-(ctrlA.titleTextX() - ctrlB.backButtonTextLeft()) - (ctrlA.titleLeftRight())) * step;\n      setStyles(ctrlA, 1 - step, titleX, 0);\n    }\n\n    var d = {\n      run: function(step) {\n        var enteringHeaderCtrl = enteringHeaderBar.controller();\n        var leavingHeaderCtrl = leavingHeaderBar && leavingHeaderBar.controller();\n        if (d.direction == 'back') {\n          leave(enteringHeaderCtrl, leavingHeaderCtrl, 1 - step);\n          enter(leavingHeaderCtrl, enteringHeaderCtrl, 1 - step);\n        } else {\n          enter(enteringHeaderCtrl, leavingHeaderCtrl, step);\n          leave(leavingHeaderCtrl, enteringHeaderCtrl, step);\n        }\n      },\n      direction: direction,\n      shouldAnimate: shouldAnimate && (direction == 'forward' || direction == 'back')\n    };\n\n    return d;\n  };\n\n\n  // Android Transitions\n  // -----------------------\n\n  provider.transitions.views.android = function(enteringEle, leavingEle, direction, shouldAnimate) {\n    shouldAnimate = shouldAnimate && (direction == 'forward' || direction == 'back');\n\n    function setStyles(ele, x, opacity) {\n      var css = {};\n      css[ionic.CSS.TRANSITION_DURATION] = d.shouldAnimate ? '' : 0;\n      css[ionic.CSS.TRANSFORM] = 'translate3d(' + x + '%,0,0)';\n      css.opacity = opacity;\n      ionic.DomUtil.cachedStyles(ele, css);\n    }\n\n    var d = {\n      run: function(step) {\n        if (direction == 'forward') {\n          setStyles(enteringEle, (1 - step) * 99, 1); // starting at 98% prevents a flicker\n          setStyles(leavingEle, step * -100, 1);\n\n        } else if (direction == 'back') {\n          setStyles(enteringEle, (1 - step) * -100, 1);\n          setStyles(leavingEle, step * 100, 1);\n\n        } else {\n          // swap, enter, exit\n          setStyles(enteringEle, 0, 1);\n          setStyles(leavingEle, 0, 0);\n        }\n      },\n      shouldAnimate: shouldAnimate\n    };\n\n    return d;\n  };\n\n  provider.transitions.navBar.android = function(enteringHeaderBar, leavingHeaderBar, direction, shouldAnimate) {\n\n    function setStyles(ctrl, opacity) {\n      if (!ctrl) return;\n      var css = {};\n      css.opacity = opacity === 1 ? '' : opacity;\n\n      ctrl.setCss('buttons-left', css);\n      ctrl.setCss('buttons-right', css);\n      ctrl.setCss('back-button', css);\n      ctrl.setCss('back-text', css);\n      ctrl.setCss('title', css);\n    }\n\n    return {\n      run: function(step) {\n        setStyles(enteringHeaderBar.controller(), step);\n        setStyles(leavingHeaderBar && leavingHeaderBar.controller(), 1 - step);\n      },\n      shouldAnimate: shouldAnimate && (direction == 'forward' || direction == 'back')\n    };\n  };\n\n\n  // No Transition\n  // -----------------------\n\n  provider.transitions.views.none = function(enteringEle, leavingEle) {\n    return {\n      run: function(step) {\n        provider.transitions.views.android(enteringEle, leavingEle, false, false).run(step);\n      },\n      shouldAnimate: false\n    };\n  };\n\n  provider.transitions.navBar.none = function(enteringHeaderBar, leavingHeaderBar) {\n    return {\n      run: function(step) {\n        provider.transitions.navBar.ios(enteringHeaderBar, leavingHeaderBar, false, false).run(step);\n        provider.transitions.navBar.android(enteringHeaderBar, leavingHeaderBar, false, false).run(step);\n      },\n      shouldAnimate: false\n    };\n  };\n\n\n  // private: used to set platform configs\n  function setPlatformConfig(platformName, platformConfigs) {\n    configProperties.platform[platformName] = platformConfigs;\n    provider.platform[platformName] = {};\n\n    addConfig(configProperties, configProperties.platform[platformName]);\n\n    createConfig(configProperties.platform[platformName], provider.platform[platformName], '');\n  }\n\n\n  // private: used to recursively add new platform configs\n  function addConfig(configObj, platformObj) {\n    for (var n in configObj) {\n      if (n != PLATFORM && configObj.hasOwnProperty(n)) {\n        if (angular.isObject(configObj[n])) {\n          if (!isDefined(platformObj[n])) {\n            platformObj[n] = {};\n          }\n          addConfig(configObj[n], platformObj[n]);\n\n        } else if (!isDefined(platformObj[n])) {\n          platformObj[n] = null;\n        }\n      }\n    }\n  }\n\n\n  // private: create methods for each config to get/set\n  function createConfig(configObj, providerObj, platformPath) {\n    forEach(configObj, function(value, namespace) {\n\n      if (angular.isObject(configObj[namespace])) {\n        // recursively drill down the config object so we can create a method for each one\n        providerObj[namespace] = {};\n        createConfig(configObj[namespace], providerObj[namespace], platformPath + '.' + namespace);\n\n      } else {\n        // create a method for the provider/config methods that will be exposed\n        providerObj[namespace] = function(newValue) {\n          if (arguments.length) {\n            configObj[namespace] = newValue;\n            return providerObj;\n          }\n          if (configObj[namespace] == PLATFORM) {\n            // if the config is set to 'platform', then get this config's platform value\n            var platformConfig = stringObj(configProperties.platform, ionic.Platform.platform() + platformPath + '.' + namespace);\n            if (platformConfig || platformConfig === false) {\n              return platformConfig;\n            }\n            // didnt find a specific platform config, now try the default\n            return stringObj(configProperties.platform, 'default' + platformPath + '.' + namespace);\n          }\n          return configObj[namespace];\n        };\n      }\n\n    });\n  }\n\n  function stringObj(obj, str) {\n    str = str.split(\".\");\n    for (var i = 0; i < str.length; i++) {\n      if (obj && isDefined(obj[str[i]])) {\n        obj = obj[str[i]];\n      } else {\n        return null;\n      }\n    }\n    return obj;\n  }\n\n  provider.setPlatformConfig = setPlatformConfig;\n\n\n  // private: Service definition for internal Ionic use\n  /**\n   * @ngdoc service\n   * @name $ionicConfig\n   * @module ionic\n   * @private\n   */\n  provider.$get = function() {\n    return provider;\n  };\n})\n// Fix for URLs in Cordova apps on Windows Phone\n// http://blogs.msdn.com/b/msdn_answers/archive/2015/02/10/\n// running-cordova-apps-on-windows-and-windows-phone-8-1-using-ionic-angularjs-and-other-frameworks.aspx\n.config(['$compileProvider', function($compileProvider) {\n  $compileProvider.aHrefSanitizationWhitelist(/^\\s*(https?|sms|tel|geo|ftp|mailto|file|ghttps?|ms-appx-web|ms-appx|x-wmapp0):/);\n  $compileProvider.imgSrcSanitizationWhitelist(/^\\s*(https?|ftp|file|content|blob|ms-appx|ms-appx-web|x-wmapp0):|data:image\\//);\n}]);\n\n\nvar LOADING_TPL =\n  '<div class=\"loading-container\">' +\n    '<div class=\"loading\">' +\n    '</div>' +\n  '</div>';\n\n/**\n * @ngdoc service\n * @name $ionicLoading\n * @module ionic\n * @description\n * An overlay that can be used to indicate activity while blocking user\n * interaction.\n *\n * @usage\n * ```js\n * angular.module('LoadingApp', ['ionic'])\n * .controller('LoadingCtrl', function($scope, $ionicLoading) {\n *   $scope.show = function() {\n *     $ionicLoading.show({\n *       template: 'Loading...'\n *     }).then(function(){\n *        console.log(\"The loading indicator is now displayed\");\n *     });\n *   };\n *   $scope.hide = function(){\n *     $ionicLoading.hide().then(function(){\n *        console.log(\"The loading indicator is now hidden\");\n *     });\n *   };\n * });\n * ```\n */\n/**\n * @ngdoc object\n * @name $ionicLoadingConfig\n * @module ionic\n * @description\n * Set the default options to be passed to the {@link ionic.service:$ionicLoading} service.\n *\n * @usage\n * ```js\n * var app = angular.module('myApp', ['ionic'])\n * app.constant('$ionicLoadingConfig', {\n *   template: 'Default Loading Template...'\n * });\n * app.controller('AppCtrl', function($scope, $ionicLoading) {\n *   $scope.showLoading = function() {\n *     //options default to values in $ionicLoadingConfig\n *     $ionicLoading.show().then(function(){\n *        console.log(\"The loading indicator is now displayed\");\n *     });\n *   };\n * });\n * ```\n */\nIonicModule\n.constant('$ionicLoadingConfig', {\n  template: '<ion-spinner></ion-spinner>'\n})\n.factory('$ionicLoading', [\n  '$ionicLoadingConfig',\n  '$ionicBody',\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$timeout',\n  '$q',\n  '$log',\n  '$compile',\n  '$ionicPlatform',\n  '$rootScope',\n  'IONIC_BACK_PRIORITY',\nfunction($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop, $timeout, $q, $log, $compile, $ionicPlatform, $rootScope, IONIC_BACK_PRIORITY) {\n\n  var loaderInstance;\n  //default values\n  var deregisterBackAction = noop;\n  var deregisterStateListener1 = noop;\n  var deregisterStateListener2 = noop;\n  var loadingShowDelay = $q.when();\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#show\n     * @description Shows a loading indicator. If the indicator is already shown,\n     * it will set the options given and keep the indicator shown.\n     * @returns {promise} A promise which is resolved when the loading indicator is presented.\n     * @param {object} opts The options for the loading indicator. Available properties:\n     *  - `{string=}` `template` The html content of the indicator.\n     *  - `{string=}` `templateUrl` The url of an html template to load as the content of the indicator.\n     *  - `{object=}` `scope` The scope to be a child of. Default: creates a child of $rootScope.\n     *  - `{boolean=}` `noBackdrop` Whether to hide the backdrop. By default it will be shown.\n     *  - `{boolean=}` `hideOnStateChange` Whether to hide the loading spinner when navigating\n     *    to a new state. Default false.\n     *  - `{number=}` `delay` How many milliseconds to delay showing the indicator. By default there is no delay.\n     *  - `{number=}` `duration` How many milliseconds to wait until automatically\n     *  hiding the indicator. By default, the indicator will be shown until `.hide()` is called.\n     */\n    show: showLoader,\n    /**\n     * @ngdoc method\n     * @name $ionicLoading#hide\n     * @description Hides the loading indicator, if shown.\n     * @returns {promise} A promise which is resolved when the loading indicator is hidden.\n     */\n    hide: hideLoader,\n    /**\n     * @private for testing\n     */\n    _getLoader: getLoader\n  };\n\n  function getLoader() {\n    if (!loaderInstance) {\n      loaderInstance = $ionicTemplateLoader.compile({\n        template: LOADING_TPL,\n        appendTo: $ionicBody.get()\n      })\n      .then(function(self) {\n        self.show = function(options) {\n          var templatePromise = options.templateUrl ?\n            $ionicTemplateLoader.load(options.templateUrl) :\n            //options.content: deprecated\n            $q.when(options.template || options.content || '');\n\n          self.scope = options.scope || self.scope;\n\n          if (!self.isShown) {\n            //options.showBackdrop: deprecated\n            self.hasBackdrop = !options.noBackdrop && options.showBackdrop !== false;\n            if (self.hasBackdrop) {\n              $ionicBackdrop.retain();\n              $ionicBackdrop.getElement().addClass('backdrop-loading');\n            }\n          }\n\n          if (options.duration) {\n            $timeout.cancel(self.durationTimeout);\n            self.durationTimeout = $timeout(\n              angular.bind(self, self.hide),\n              +options.duration\n            );\n          }\n\n          deregisterBackAction();\n          //Disable hardware back button while loading\n          deregisterBackAction = $ionicPlatform.registerBackButtonAction(\n            noop,\n            IONIC_BACK_PRIORITY.loading\n          );\n\n          templatePromise.then(function(html) {\n            if (html) {\n              var loading = self.element.children();\n              loading.html(html);\n              $compile(loading.contents())(self.scope);\n            }\n\n            //Don't show until template changes\n            if (self.isShown) {\n              self.element.addClass('visible');\n              ionic.requestAnimationFrame(function() {\n                if (self.isShown) {\n                  self.element.addClass('active');\n                  $ionicBody.addClass('loading-active');\n                }\n              });\n            }\n          });\n\n          self.isShown = true;\n        };\n        self.hide = function() {\n\n          deregisterBackAction();\n          if (self.isShown) {\n            if (self.hasBackdrop) {\n              $ionicBackdrop.release();\n              $ionicBackdrop.getElement().removeClass('backdrop-loading');\n            }\n            self.element.removeClass('active');\n            $ionicBody.removeClass('loading-active');\n            self.element.removeClass('visible');\n            ionic.requestAnimationFrame(function() {\n              !self.isShown && self.element.removeClass('visible');\n            });\n          }\n          $timeout.cancel(self.durationTimeout);\n          self.isShown = false;\n          var loading = self.element.children();\n          loading.html(\"\");\n        };\n\n        return self;\n      });\n    }\n    return loaderInstance;\n  }\n\n  function showLoader(options) {\n    options = extend({}, $ionicLoadingConfig || {}, options || {});\n    // use a default delay of 100 to avoid some issues reported on github\n    // https://github.com/driftyco/ionic/issues/3717\n    var delay = options.delay || options.showDelay || 0;\n\n    deregisterStateListener1();\n    deregisterStateListener2();\n    if (options.hideOnStateChange) {\n      deregisterStateListener1 = $rootScope.$on('$stateChangeSuccess', hideLoader);\n      deregisterStateListener2 = $rootScope.$on('$stateChangeError', hideLoader);\n    }\n\n    //If loading.show() was called previously, cancel it and show with our new options\n    $timeout.cancel(loadingShowDelay);\n    loadingShowDelay = $timeout(noop, delay);\n    return loadingShowDelay.then(getLoader).then(function(loader) {\n      return loader.show(options);\n    });\n  }\n\n  function hideLoader() {\n    deregisterStateListener1();\n    deregisterStateListener2();\n    $timeout.cancel(loadingShowDelay);\n    return getLoader().then(function(loader) {\n      return loader.hide();\n    });\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicModal\n * @module ionic\n * @codepen gblny\n * @description\n *\n * Related: {@link ionic.controller:ionicModal ionicModal controller}.\n *\n * The Modal is a content pane that can go over the user's main view\n * temporarily.  Usually used for making a choice or editing an item.\n *\n * Put the content of the modal inside of an `<ion-modal-view>` element.\n *\n * **Notes:**\n * - A modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n * scope, passing in itself as an event argument. Both the modal.removed and modal.hidden events are\n * called when the modal is removed.\n *\n * - This example assumes your modal is in your main index file or another template file. If it is in its own\n * template file, remove the script tags and call it by file name.\n *\n * @usage\n * ```html\n * <script id=\"my-modal.html\" type=\"text/ng-template\">\n *   <ion-modal-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Modal title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-modal-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicModal) {\n *   $ionicModal.fromTemplateUrl('my-modal.html', {\n *     scope: $scope,\n *     animation: 'slide-in-up'\n *   }).then(function(modal) {\n *     $scope.modal = modal;\n *   });\n *   $scope.openModal = function() {\n *     $scope.modal.show();\n *   };\n *   $scope.closeModal = function() {\n *     $scope.modal.hide();\n *   };\n *   // Cleanup the modal when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.modal.remove();\n *   });\n *   // Execute action on hide modal\n *   $scope.$on('modal.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove modal\n *   $scope.$on('modal.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\nIonicModule\n.factory('$ionicModal', [\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$timeout',\n  '$ionicPlatform',\n  '$ionicTemplateLoader',\n  '$$q',\n  '$log',\n  '$ionicClickBlock',\n  '$window',\n  'IONIC_BACK_PRIORITY',\nfunction($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTemplateLoader, $$q, $log, $ionicClickBlock, $window, IONIC_BACK_PRIORITY) {\n\n  /**\n   * @ngdoc controller\n   * @name ionicModal\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicModal} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each modal\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a modal will broadcast 'modal.shown', 'modal.hidden', and 'modal.removed' events from its originating\n   * scope, passing in itself as an event argument. Note: both modal.removed and modal.hidden are\n   * called when the modal is removed.\n   */\n  var ModalView = ionic.views.Modal.inherit({\n    /**\n     * @ngdoc method\n     * @name ionicModal#initialize\n     * @description Creates a new modal controller instance.\n     * @param {object} options An options object with the following properties:\n     *  - `{object=}` `scope` The scope to be a child of.\n     *    Default: creates a child of $rootScope.\n     *  - `{string=}` `animation` The animation to show & hide with.\n     *    Default: 'slide-in-up'\n     *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n     *    the modal when shown. Will only show the keyboard on iOS, to force the keyboard to show\n     *    on Android, please use the [Ionic keyboard plugin](https://github.com/driftyco/ionic-plugin-keyboard#keyboardshow).\n     *    Default: false.\n     *  - `{boolean=}` `backdropClickToClose` Whether to close the modal on clicking the backdrop.\n     *    Default: true.\n     *  - `{boolean=}` `hardwareBackButtonClose` Whether the modal can be closed using the hardware\n     *    back button on Android and similar devices.  Default: true.\n     */\n    initialize: function(opts) {\n      ionic.views.Modal.prototype.initialize.call(this, opts);\n      this.animation = opts.animation || 'slide-in-up';\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#show\n     * @description Show this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating in.\n     */\n    show: function(target) {\n      var self = this;\n\n      if (self.scope.$$destroyed) {\n        $log.error('Cannot call ' + self.viewType + '.show() after remove(). Please create a new ' + self.viewType + ' instance.');\n        return $$q.when();\n      }\n\n      // on iOS, clicks will sometimes bleed through/ghost click on underlying\n      // elements\n      $ionicClickBlock.show(600);\n      stack.add(self);\n\n      var modalEl = jqLite(self.modalEl);\n\n      self.el.classList.remove('hide');\n      $timeout(function() {\n        if (!self._isShown) return;\n        $ionicBody.addClass(self.viewType + '-open');\n      }, 400, false);\n\n      if (!self.el.parentElement) {\n        modalEl.addClass(self.animation);\n        $ionicBody.append(self.el);\n      }\n\n      // if modal was closed while the keyboard was up, reset scroll view on\n      // next show since we can only resize it once it's visible\n      var scrollCtrl = modalEl.data('$$ionicScrollController');\n      scrollCtrl && scrollCtrl.resize();\n\n      if (target && self.positionView) {\n        self.positionView(target, modalEl);\n        // set up a listener for in case the window size changes\n\n        self._onWindowResize = function() {\n          if (self._isShown) self.positionView(target, modalEl);\n        };\n        ionic.on('resize', self._onWindowResize, window);\n      }\n\n      modalEl.addClass('ng-enter active')\n             .removeClass('ng-leave ng-leave-active');\n\n      self._isShown = true;\n      self._deregisterBackButton = $ionicPlatform.registerBackButtonAction(\n        self.hardwareBackButtonClose ? angular.bind(self, self.hide) : noop,\n        IONIC_BACK_PRIORITY.modal\n      );\n\n      ionic.views.Modal.prototype.show.call(self);\n\n      $timeout(function() {\n        if (!self._isShown) return;\n        modalEl.addClass('ng-enter-active');\n        ionic.trigger('resize');\n        self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.shown', self);\n        self.el.classList.add('active');\n        self.scope.$broadcast('$ionicHeader.align');\n        self.scope.$broadcast('$ionicFooter.align');\n        self.scope.$broadcast('$ionic.modalPresented');\n      }, 20);\n\n      return $timeout(function() {\n        if (!self._isShown) return;\n        self.$el.on('touchmove', function(e) {\n          //Don't allow scrolling while open by dragging on backdrop\n          var isInScroll = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'scroll');\n          if (!isInScroll) {\n            e.preventDefault();\n          }\n        });\n        //After animating in, allow hide on backdrop click\n        self.$el.on('click', function(e) {\n          if (self.backdropClickToClose && e.target === self.el && stack.isHighest(self)) {\n            self.hide();\n          }\n        });\n      }, 400);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#hide\n     * @description Hide this modal instance.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    hide: function() {\n      var self = this;\n      var modalEl = jqLite(self.modalEl);\n\n      // on iOS, clicks will sometimes bleed through/ghost click on underlying\n      // elements\n      $ionicClickBlock.show(600);\n      stack.remove(self);\n\n      self.el.classList.remove('active');\n      modalEl.addClass('ng-leave');\n\n      $timeout(function() {\n        if (self._isShown) return;\n        modalEl.addClass('ng-leave-active')\n               .removeClass('ng-enter ng-enter-active active');\n\n        self.scope.$broadcast('$ionic.modalRemoved');\n      }, 20, false);\n\n      self.$el.off('click');\n      self._isShown = false;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.hidden', self);\n      self._deregisterBackButton && self._deregisterBackButton();\n\n      ionic.views.Modal.prototype.hide.call(self);\n\n      // clean up event listeners\n      if (self.positionView) {\n        ionic.off('resize', self._onWindowResize, window);\n      }\n\n      return $timeout(function() {\n        $ionicBody.removeClass(self.viewType + '-open');\n        self.el.classList.add('hide');\n      }, self.hideDelay || 320);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#remove\n     * @description Remove this modal instance from the DOM and clean up.\n     * @returns {promise} A promise which is resolved when the modal is finished animating out.\n     */\n    remove: function() {\n      var self = this,\n          deferred, promise;\n      self.scope.$parent && self.scope.$parent.$broadcast(self.viewType + '.removed', self);\n\n      // Only hide modal, when it is actually shown!\n      // The hide function shows a click-block-div for a split second, because on iOS,\n      // clicks will sometimes bleed through/ghost click on underlying elements.\n      // However, this will make the app unresponsive for short amount of time.\n      // We don't want that, if the modal window is already hidden.\n      if (self._isShown) {\n        promise = self.hide();\n      } else {\n        deferred = $$q.defer();\n        deferred.resolve();\n        promise = deferred.promise;\n      }\n\n      return promise.then(function() {\n        self.scope.$destroy();\n        self.$el.remove();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionicModal#isShown\n     * @returns boolean Whether this modal is currently shown.\n     */\n    isShown: function() {\n      return !!this._isShown;\n    }\n  });\n\n  var createModal = function(templateString, options) {\n    // Create a new scope for the modal\n    var scope = options.scope && options.scope.$new() || $rootScope.$new(true);\n\n    options.viewType = options.viewType || 'modal';\n\n    extend(scope, {\n      $hasHeader: false,\n      $hasSubheader: false,\n      $hasFooter: false,\n      $hasSubfooter: false,\n      $hasTabs: false,\n      $hasTabsTop: false\n    });\n\n    // Compile the template\n    var element = $compile('<ion-' + options.viewType + '>' + templateString + '</ion-' + options.viewType + '>')(scope);\n\n    options.$el = element;\n    options.el = element[0];\n    options.modalEl = options.el.querySelector('.' + options.viewType);\n    var modal = new ModalView(options);\n\n    modal.scope = scope;\n\n    // If this wasn't a defined scope, we can assign the viewType to the isolated scope\n    // we created\n    if (!options.scope) {\n      scope[ options.viewType ] = modal;\n    }\n\n    return modal;\n  };\n\n  var modalStack = [];\n  var stack = {\n    add: function(modal) {\n      modalStack.push(modal);\n    },\n    remove: function(modal) {\n      var index = modalStack.indexOf(modal);\n      if (index > -1 && index < modalStack.length) {\n        modalStack.splice(index, 1);\n      }\n    },\n    isHighest: function(modal) {\n      var index = modalStack.indexOf(modal);\n      return (index > -1 && index === modalStack.length - 1);\n    }\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplate\n     * @param {string} templateString The template string to use as the modal's\n     * content.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicModal}\n     * controller.\n     */\n    fromTemplate: function(templateString, options) {\n      var modal = createModal(templateString, options || {});\n      return modal;\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicModal#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed {@link ionic.controller:ionicModal#initialize ionicModal#initialize} method.\n     * options object.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicModal} controller.\n     */\n    fromTemplateUrl: function(url, options, _) {\n      var cb;\n      //Deprecated: allow a callback as second parameter. Now we return a promise.\n      if (angular.isFunction(options)) {\n        cb = options;\n        options = _;\n      }\n      return $ionicTemplateLoader.load(url).then(function(templateString) {\n        var modal = createModal(templateString, options || {});\n        cb && cb(modal);\n        return modal;\n      });\n    },\n\n    stack: stack\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicNavBarDelegate\n * @module ionic\n * @description\n * Delegate for controlling the {@link ionic.directive:ionNavBar} directive.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-nav-bar>\n *     <button ng-click=\"setNavTitle('banana')\">\n *       Set title to banana!\n *     </button>\n *   </ion-nav-bar>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicNavBarDelegate) {\n *   $scope.setNavTitle = function(title) {\n *     $ionicNavBarDelegate.title(title);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicNavBarDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#align\n   * @description Aligns the title with the buttons in a given direction.\n   * @param {string=} direction The direction to the align the title text towards.\n   * Available: 'left', 'right', 'center'. Default: 'center'.\n   */\n  'align',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBackButton\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBackButton} is shown\n   * (if it exists and there is a previous view that can be navigated to).\n   * @param {boolean=} show Whether to show the back button.\n   * @returns {boolean} Whether the back button is shown.\n   */\n  'showBackButton',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#showBar\n   * @description\n   * Set/get whether the {@link ionic.directive:ionNavBar} is shown.\n   * @param {boolean} show Whether to show the bar.\n   * @returns {boolean} Whether the bar is shown.\n   */\n  'showBar',\n  /**\n   * @ngdoc method\n   * @name $ionicNavBarDelegate#title\n   * @description\n   * Set the title for the {@link ionic.directive:ionNavBar}.\n   * @param {string} title The new title to show.\n   */\n  'title',\n\n  // DEPRECATED, as of v1.0.0-beta14 -------\n  'changeTitle',\n  'setTitle',\n  'getTitle',\n  'back',\n  'getPreviousTitle'\n  // END DEPRECATED -------\n]));\n\n\nIonicModule\n.service('$ionicNavViewDelegate', ionic.DelegateService([\n  'clearCache'\n]));\n\n\n\n/**\n * @ngdoc service\n * @name $ionicPlatform\n * @module ionic\n * @description\n * An angular abstraction of {@link ionic.utility:ionic.Platform}.\n *\n * Used to detect the current platform, as well as do things like override the\n * Android back button in PhoneGap/Cordova.\n */\nIonicModule\n.constant('IONIC_BACK_PRIORITY', {\n  view: 100,\n  sideMenu: 150,\n  modal: 200,\n  actionSheet: 300,\n  popup: 400,\n  loading: 500\n})\n.provider('$ionicPlatform', function() {\n  return {\n    $get: ['$q', '$ionicScrollDelegate', function($q, $ionicScrollDelegate) {\n      var self = {\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#onHardwareBackButton\n         * @description\n         * Some platforms have a hardware back button, so this is one way to\n         * bind to it.\n         * @param {function} callback the callback to trigger when this event occurs\n         */\n        onHardwareBackButton: function(cb) {\n          ionic.Platform.ready(function() {\n            document.addEventListener('backbutton', cb, false);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#offHardwareBackButton\n         * @description\n         * Remove an event listener for the backbutton.\n         * @param {function} callback The listener function that was\n         * originally bound.\n         */\n        offHardwareBackButton: function(fn) {\n          ionic.Platform.ready(function() {\n            document.removeEventListener('backbutton', fn);\n          });\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#registerBackButtonAction\n         * @description\n         * Register a hardware back button action. Only one action will execute\n         * when the back button is clicked, so this method decides which of\n         * the registered back button actions has the highest priority.\n         *\n         * For example, if an actionsheet is showing, the back button should\n         * close the actionsheet, but it should not also go back a page view\n         * or close a modal which may be open.\n         *\n         * The priorities for the existing back button hooks are as follows:\n         *   Return to previous view = 100\n         *   Close side menu = 150\n         *   Dismiss modal = 200\n         *   Close action sheet = 300\n         *   Dismiss popup = 400\n         *   Dismiss loading overlay = 500\n         *\n         * Your back button action will override each of the above actions\n         * whose priority is less than the priority you provide. For example,\n         * an action assigned a priority of 101 will override the 'return to\n         * previous view' action, but not any of the other actions.\n         *\n         * @param {function} callback Called when the back button is pressed,\n         * if this listener is the highest priority.\n         * @param {number} priority Only the highest priority will execute.\n         * @param {*=} actionId The id to assign this action. Default: a\n         * random unique id.\n         * @returns {function} A function that, when called, will deregister\n         * this backButtonAction.\n         */\n        $backButtonActions: {},\n        registerBackButtonAction: function(fn, priority, actionId) {\n\n          if (!self._hasBackButtonHandler) {\n            // add a back button listener if one hasn't been setup yet\n            self.$backButtonActions = {};\n            self.onHardwareBackButton(self.hardwareBackButtonClick);\n            self._hasBackButtonHandler = true;\n          }\n\n          var action = {\n            id: (actionId ? actionId : ionic.Utils.nextUid()),\n            priority: (priority ? priority : 0),\n            fn: fn\n          };\n          self.$backButtonActions[action.id] = action;\n\n          // return a function to de-register this back button action\n          return function() {\n            delete self.$backButtonActions[action.id];\n          };\n        },\n\n        /**\n         * @private\n         */\n        hardwareBackButtonClick: function(e) {\n          // loop through all the registered back button actions\n          // and only run the last one of the highest priority\n          var priorityAction, actionId;\n          for (actionId in self.$backButtonActions) {\n            if (!priorityAction || self.$backButtonActions[actionId].priority >= priorityAction.priority) {\n              priorityAction = self.$backButtonActions[actionId];\n            }\n          }\n          if (priorityAction) {\n            priorityAction.fn(e);\n            return priorityAction;\n          }\n        },\n\n        is: function(type) {\n          return ionic.Platform.is(type);\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#on\n         * @description\n         * Add Cordova event listeners, such as `pause`, `resume`, `volumedownbutton`, `batterylow`,\n         * `offline`, etc. More information about available event types can be found in\n         * [Cordova's event documentation](https://cordova.apache.org/docs/en/edge/cordova_events_events.md.html#Events).\n         * @param {string} type Cordova [event type](https://cordova.apache.org/docs/en/edge/cordova_events_events.md.html#Events).\n         * @param {function} callback Called when the Cordova event is fired.\n         * @returns {function} Returns a deregistration function to remove the event listener.\n         */\n        on: function(type, cb) {\n          ionic.Platform.ready(function() {\n            document.addEventListener(type, cb, false);\n          });\n          return function() {\n            ionic.Platform.ready(function() {\n              document.removeEventListener(type, cb);\n            });\n          };\n        },\n\n        /**\n         * @ngdoc method\n         * @name $ionicPlatform#ready\n         * @description\n         * Trigger a callback once the device is ready,\n         * or immediately if the device is already ready.\n         * @param {function=} callback The function to call.\n         * @returns {promise} A promise which is resolved when the device is ready.\n         */\n        ready: function(cb) {\n          var q = $q.defer();\n\n          ionic.Platform.ready(function() {\n\n            window.addEventListener('statusTap', function() {\n              $ionicScrollDelegate.scrollTop(true);\n            });\n\n            q.resolve();\n            cb && cb();\n          });\n\n          return q.promise;\n        }\n      };\n\n      return self;\n    }]\n  };\n\n});\n\n/**\n * @ngdoc service\n * @name $ionicPopover\n * @module ionic\n * @description\n *\n * Related: {@link ionic.controller:ionicPopover ionicPopover controller}.\n *\n * The Popover is a view that floats above an app’s content. Popovers provide an\n * easy way to present or gather information from the user and are\n * commonly used in the following situations:\n *\n * - Show more info about the current view\n * - Select a commonly used tool or configuration\n * - Present a list of actions to perform inside one of your views\n *\n * Put the content of the popover inside of an `<ion-popover-view>` element.\n *\n * @usage\n * ```html\n * <p>\n *   <button ng-click=\"openPopover($event)\">Open Popover</button>\n * </p>\n *\n * <script id=\"my-popover.html\" type=\"text/ng-template\">\n *   <ion-popover-view>\n *     <ion-header-bar>\n *       <h1 class=\"title\">My Popover Title</h1>\n *     </ion-header-bar>\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-popover-view>\n * </script>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $ionicPopover) {\n *\n *   // .fromTemplate() method\n *   var template = '<ion-popover-view><ion-header-bar> <h1 class=\"title\">My Popover Title</h1> </ion-header-bar> <ion-content> Hello! </ion-content></ion-popover-view>';\n *\n *   $scope.popover = $ionicPopover.fromTemplate(template, {\n *     scope: $scope\n *   });\n *\n *   // .fromTemplateUrl() method\n *   $ionicPopover.fromTemplateUrl('my-popover.html', {\n *     scope: $scope\n *   }).then(function(popover) {\n *     $scope.popover = popover;\n *   });\n *\n *\n *   $scope.openPopover = function($event) {\n *     $scope.popover.show($event);\n *   };\n *   $scope.closePopover = function() {\n *     $scope.popover.hide();\n *   };\n *   //Cleanup the popover when we're done with it!\n *   $scope.$on('$destroy', function() {\n *     $scope.popover.remove();\n *   });\n *   // Execute action on hide popover\n *   $scope.$on('popover.hidden', function() {\n *     // Execute action\n *   });\n *   // Execute action on remove popover\n *   $scope.$on('popover.removed', function() {\n *     // Execute action\n *   });\n * });\n * ```\n */\n\n\nIonicModule\n.factory('$ionicPopover', ['$ionicModal', '$ionicPosition', '$document', '$window',\nfunction($ionicModal, $ionicPosition, $document, $window) {\n\n  var POPOVER_BODY_PADDING = 6;\n\n  var POPOVER_OPTIONS = {\n    viewType: 'popover',\n    hideDelay: 1,\n    animation: 'none',\n    positionView: positionView\n  };\n\n  function positionView(target, popoverEle) {\n    var targetEle = jqLite(target.target || target);\n    var buttonOffset = $ionicPosition.offset(targetEle);\n    var popoverWidth = popoverEle.prop('offsetWidth');\n    var popoverHeight = popoverEle.prop('offsetHeight');\n    // Use innerWidth and innerHeight, because clientWidth and clientHeight\n    // doesn't work consistently for body on all platforms\n    var bodyWidth = $window.innerWidth;\n    var bodyHeight = $window.innerHeight;\n\n    var popoverCSS = {\n      left: buttonOffset.left + buttonOffset.width / 2 - popoverWidth / 2\n    };\n    var arrowEle = jqLite(popoverEle[0].querySelector('.popover-arrow'));\n\n    if (popoverCSS.left < POPOVER_BODY_PADDING) {\n      popoverCSS.left = POPOVER_BODY_PADDING;\n    } else if (popoverCSS.left + popoverWidth + POPOVER_BODY_PADDING > bodyWidth) {\n      popoverCSS.left = bodyWidth - popoverWidth - POPOVER_BODY_PADDING;\n    }\n\n    // If the popover when popped down stretches past bottom of screen,\n    // make it pop up if there's room above\n    if (buttonOffset.top + buttonOffset.height + popoverHeight > bodyHeight &&\n        buttonOffset.top - popoverHeight > 0) {\n      popoverCSS.top = buttonOffset.top - popoverHeight;\n      popoverEle.addClass('popover-bottom');\n    } else {\n      popoverCSS.top = buttonOffset.top + buttonOffset.height;\n      popoverEle.removeClass('popover-bottom');\n    }\n\n    arrowEle.css({\n      left: buttonOffset.left + buttonOffset.width / 2 -\n        arrowEle.prop('offsetWidth') / 2 - popoverCSS.left + 'px'\n    });\n\n    popoverEle.css({\n      top: popoverCSS.top + 'px',\n      left: popoverCSS.left + 'px',\n      marginLeft: '0',\n      opacity: '1'\n    });\n\n  }\n\n  /**\n   * @ngdoc controller\n   * @name ionicPopover\n   * @module ionic\n   * @description\n   * Instantiated by the {@link ionic.service:$ionicPopover} service.\n   *\n   * Be sure to call [remove()](#remove) when you are done with each popover\n   * to clean it up and avoid memory leaks.\n   *\n   * Note: a popover will broadcast 'popover.shown', 'popover.hidden', and 'popover.removed' events from its originating\n   * scope, passing in itself as an event argument. Both the popover.removed and popover.hidden events are\n   * called when the popover is removed.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#initialize\n   * @description Creates a new popover controller instance.\n   * @param {object} options An options object with the following properties:\n   *  - `{object=}` `scope` The scope to be a child of.\n   *    Default: creates a child of $rootScope.\n   *  - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of\n   *    the popover when shown.  Default: false.\n   *  - `{boolean=}` `backdropClickToClose` Whether to close the popover on clicking the backdrop.\n   *    Default: true.\n   *  - `{boolean=}` `hardwareBackButtonClose` Whether the popover can be closed using the hardware\n   *    back button on Android and similar devices.  Default: true.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#show\n   * @description Show this popover instance.\n   * @param {$event} $event The $event or target element which the popover should align\n   * itself next to.\n   * @returns {promise} A promise which is resolved when the popover is finished animating in.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#hide\n   * @description Hide this popover instance.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#remove\n   * @description Remove this popover instance from the DOM and clean up.\n   * @returns {promise} A promise which is resolved when the popover is finished animating out.\n   */\n\n  /**\n   * @ngdoc method\n   * @name ionicPopover#isShown\n   * @returns boolean Whether this popover is currently shown.\n   */\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplate\n     * @param {string} templateString The template string to use as the popovers's\n     * content.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {object} An instance of an {@link ionic.controller:ionicPopover}\n     * controller (ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplate: function(templateString, options) {\n      return $ionicModal.fromTemplate(templateString, ionic.Utils.extend({}, POPOVER_OPTIONS, options));\n    },\n    /**\n     * @ngdoc method\n     * @name $ionicPopover#fromTemplateUrl\n     * @param {string} templateUrl The url to load the template from.\n     * @param {object} options Options to be passed to the initialize method.\n     * @returns {promise} A promise that will be resolved with an instance of\n     * an {@link ionic.controller:ionicPopover} controller (ionicPopover is built on top of $ionicPopover).\n     */\n    fromTemplateUrl: function(url, options) {\n      return $ionicModal.fromTemplateUrl(url, ionic.Utils.extend({}, POPOVER_OPTIONS, options));\n    }\n  };\n\n}]);\n\n\nvar POPUP_TPL =\n  '<div class=\"popup-container\" ng-class=\"cssClass\">' +\n    '<div class=\"popup\">' +\n      '<div class=\"popup-head\">' +\n        '<h3 class=\"popup-title\" ng-bind-html=\"title\"></h3>' +\n        '<h5 class=\"popup-sub-title\" ng-bind-html=\"subTitle\" ng-if=\"subTitle\"></h5>' +\n      '</div>' +\n      '<div class=\"popup-body\">' +\n      '</div>' +\n      '<div class=\"popup-buttons\" ng-show=\"buttons.length\">' +\n        '<button ng-repeat=\"button in buttons\" ng-click=\"$buttonTapped(button, $event)\" class=\"button\" ng-class=\"button.type || \\'button-default\\'\" ng-bind-html=\"button.text\"></button>' +\n      '</div>' +\n    '</div>' +\n  '</div>';\n\n/**\n * @ngdoc service\n * @name $ionicPopup\n * @module ionic\n * @restrict E\n * @codepen zkmhJ\n * @description\n *\n * The Ionic Popup service allows programmatically creating and showing popup\n * windows that require the user to respond in order to continue.\n *\n * The popup system has support for more flexible versions of the built in `alert()`, `prompt()`,\n * and `confirm()` functions that users are used to, in addition to allowing popups with completely\n * custom content and look.\n *\n * An input can be given an `autofocus` attribute so it automatically receives focus when\n * the popup first shows. However, depending on certain use-cases this can cause issues with\n * the tap/click system, which is why Ionic prefers using the `autofocus` attribute as\n * an opt-in feature and not the default.\n *\n * @usage\n * A few basic examples, see below for details about all of the options available.\n *\n * ```js\n *angular.module('mySuperApp', ['ionic'])\n *.controller('PopupCtrl',function($scope, $ionicPopup, $timeout) {\n *\n * // Triggered on a button click, or some other target\n * $scope.showPopup = function() {\n *   $scope.data = {};\n *\n *   // An elaborate, custom popup\n *   var myPopup = $ionicPopup.show({\n *     template: '<input type=\"password\" ng-model=\"data.wifi\">',\n *     title: 'Enter Wi-Fi Password',\n *     subTitle: 'Please use normal things',\n *     scope: $scope,\n *     buttons: [\n *       { text: 'Cancel' },\n *       {\n *         text: '<b>Save</b>',\n *         type: 'button-positive',\n *         onTap: function(e) {\n *           if (!$scope.data.wifi) {\n *             //don't allow the user to close unless he enters wifi password\n *             e.preventDefault();\n *           } else {\n *             return $scope.data.wifi;\n *           }\n *         }\n *       }\n *     ]\n *   });\n *\n *   myPopup.then(function(res) {\n *     console.log('Tapped!', res);\n *   });\n *\n *   $timeout(function() {\n *      myPopup.close(); //close the popup after 3 seconds for some reason\n *   }, 3000);\n *  };\n *\n *  // A confirm dialog\n *  $scope.showConfirm = function() {\n *    var confirmPopup = $ionicPopup.confirm({\n *      title: 'Consume Ice Cream',\n *      template: 'Are you sure you want to eat this ice cream?'\n *    });\n *\n *    confirmPopup.then(function(res) {\n *      if(res) {\n *        console.log('You are sure');\n *      } else {\n *        console.log('You are not sure');\n *      }\n *    });\n *  };\n *\n *  // An alert dialog\n *  $scope.showAlert = function() {\n *    var alertPopup = $ionicPopup.alert({\n *      title: 'Don\\'t eat that!',\n *      template: 'It might taste good'\n *    });\n *\n *    alertPopup.then(function(res) {\n *      console.log('Thank you for not eating my delicious ice cream cone');\n *    });\n *  };\n *});\n *```\n */\n\nIonicModule\n.factory('$ionicPopup', [\n  '$ionicTemplateLoader',\n  '$ionicBackdrop',\n  '$q',\n  '$timeout',\n  '$rootScope',\n  '$ionicBody',\n  '$compile',\n  '$ionicPlatform',\n  '$ionicModal',\n  'IONIC_BACK_PRIORITY',\nfunction($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicBody, $compile, $ionicPlatform, $ionicModal, IONIC_BACK_PRIORITY) {\n  //TODO allow this to be configured\n  var config = {\n    stackPushDelay: 75\n  };\n  var popupStack = [];\n\n  var $ionicPopup = {\n    /**\n     * @ngdoc method\n     * @description\n     * Show a complex popup. This is the master show function for all popups.\n     *\n     * A complex popup has a `buttons` array, with each button having a `text` and `type`\n     * field, in addition to an `onTap` function.  The `onTap` function, called when\n     * the corresponding button on the popup is tapped, will by default close the popup\n     * and resolve the popup promise with its return value.  If you wish to prevent the\n     * default and keep the popup open on button tap, call `event.preventDefault()` on the\n     * passed in tap event.  Details below.\n     *\n     * @name $ionicPopup#show\n     * @param {object} options The options for the new popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   scope: null, // Scope (optional). A scope to link to the popup content.\n     *   buttons: [{ // Array[Object] (optional). Buttons to place in the popup footer.\n     *     text: 'Cancel',\n     *     type: 'button-default',\n     *     onTap: function(e) {\n     *       // e.preventDefault() will stop the popup from closing when tapped.\n     *       e.preventDefault();\n     *     }\n     *   }, {\n     *     text: 'OK',\n     *     type: 'button-positive',\n     *     onTap: function(e) {\n     *       // Returning a value will cause the promise to resolve with the given value.\n     *       return scope.data.response;\n     *     }\n     *   }]\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has an additional\n     * `close` function, which can be used to programmatically close the popup.\n     */\n    show: showPopup,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#alert\n     * @description Show a simple alert popup with a message and one button that the user can\n     * tap to close the popup.\n     *\n     * @param {object} options The options for showing the alert, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    alert: showAlert,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#confirm\n     * @description\n     * Show a simple confirm popup with a Cancel and OK button.\n     *\n     * Resolves the promise with true if the user presses the OK button, and false if the\n     * user presses the Cancel button.\n     *\n     * @param {object} options The options for showing the confirm popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup   body.\n     *   cancelText: '', // String (default: 'Cancel'). The text of the Cancel button.\n     *   cancelType: '', // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: '', // String (default: 'OK'). The text of the OK button.\n     *   okType: '', // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    confirm: showConfirm,\n\n    /**\n     * @ngdoc method\n     * @name $ionicPopup#prompt\n     * @description Show a simple prompt popup, which has an input, OK button, and Cancel button.\n     * Resolves the promise with the value of the input if the user presses OK, and with undefined\n     * if the user presses Cancel.\n     *\n     * ```javascript\n     *  $ionicPopup.prompt({\n     *    title: 'Password Check',\n     *    template: 'Enter your secret password',\n     *    inputType: 'password',\n     *    inputPlaceholder: 'Your password'\n     *  }).then(function(res) {\n     *    console.log('Your password is', res);\n     *  });\n     * ```\n     * @param {object} options The options for showing the prompt popup, of the form:\n     *\n     * ```\n     * {\n     *   title: '', // String. The title of the popup.\n     *   cssClass: '', // String, The custom CSS class name\n     *   subTitle: '', // String (optional). The sub-title of the popup.\n     *   template: '', // String (optional). The html template to place in the popup body.\n     *   templateUrl: '', // String (optional). The URL of an html template to place in the popup body.\n     *   inputType: // String (default: 'text'). The type of input to use\n     *   defaultText: // String (default: ''). The initial value placed into the input.\n     *   maxLength: // Integer (default: null). Specify a maxlength attribute for the input.\n     *   inputPlaceholder: // String (default: ''). A placeholder to use for the input.\n     *   cancelText: // String (default: 'Cancel'. The text of the Cancel button.\n     *   cancelType: // String (default: 'button-default'). The type of the Cancel button.\n     *   okText: // String (default: 'OK'). The text of the OK button.\n     *   okType: // String (default: 'button-positive'). The type of the OK button.\n     * }\n     * ```\n     *\n     * @returns {object} A promise which is resolved when the popup is closed. Has one additional\n     * function `close`, which can be called with any value to programmatically close the popup\n     * with the given value.\n     */\n    prompt: showPrompt,\n    /**\n     * @private for testing\n     */\n    _createPopup: createPopup,\n    _popupStack: popupStack\n  };\n\n  return $ionicPopup;\n\n  function createPopup(options) {\n    options = extend({\n      scope: null,\n      title: '',\n      buttons: []\n    }, options || {});\n\n    var self = {};\n    self.scope = (options.scope || $rootScope).$new();\n    self.element = jqLite(POPUP_TPL);\n    self.responseDeferred = $q.defer();\n\n    $ionicBody.get().appendChild(self.element[0]);\n    $compile(self.element)(self.scope);\n\n    extend(self.scope, {\n      title: options.title,\n      buttons: options.buttons,\n      subTitle: options.subTitle,\n      cssClass: options.cssClass,\n      $buttonTapped: function(button, event) {\n        var result = (button.onTap || noop).apply(self, [event]);\n        event = event.originalEvent || event; //jquery events\n\n        if (!event.defaultPrevented) {\n          self.responseDeferred.resolve(result);\n        }\n      }\n    });\n\n    $q.when(\n      options.templateUrl ?\n      $ionicTemplateLoader.load(options.templateUrl) :\n        (options.template || options.content || '')\n    ).then(function(template) {\n      var popupBody = jqLite(self.element[0].querySelector('.popup-body'));\n      if (template) {\n        popupBody.html(template);\n        $compile(popupBody.contents())(self.scope);\n      } else {\n        popupBody.remove();\n      }\n    });\n\n    self.show = function() {\n      if (self.isShown || self.removed) return;\n\n      $ionicModal.stack.add(self);\n      self.isShown = true;\n      ionic.requestAnimationFrame(function() {\n        //if hidden while waiting for raf, don't show\n        if (!self.isShown) return;\n\n        self.element.removeClass('popup-hidden');\n        self.element.addClass('popup-showing active');\n        focusInput(self.element);\n      });\n    };\n\n    self.hide = function(callback) {\n      callback = callback || noop;\n      if (!self.isShown) return callback();\n\n      $ionicModal.stack.remove(self);\n      self.isShown = false;\n      self.element.removeClass('active');\n      self.element.addClass('popup-hidden');\n      $timeout(callback, 250, false);\n    };\n\n    self.remove = function() {\n      if (self.removed) return;\n\n      self.hide(function() {\n        self.element.remove();\n        self.scope.$destroy();\n      });\n\n      self.removed = true;\n    };\n\n    return self;\n  }\n\n  function onHardwareBackButton() {\n    var last = popupStack[popupStack.length - 1];\n    last && last.responseDeferred.resolve();\n  }\n\n  function showPopup(options) {\n    var popup = $ionicPopup._createPopup(options);\n    var showDelay = 0;\n\n    if (popupStack.length > 0) {\n      showDelay = config.stackPushDelay;\n      $timeout(popupStack[popupStack.length - 1].hide, showDelay, false);\n    } else {\n      //Add popup-open & backdrop if this is first popup\n      $ionicBody.addClass('popup-open');\n      $ionicBackdrop.retain();\n      //only show the backdrop on the first popup\n      $ionicPopup._backButtonActionDone = $ionicPlatform.registerBackButtonAction(\n        onHardwareBackButton,\n        IONIC_BACK_PRIORITY.popup\n      );\n    }\n\n    // Expose a 'close' method on the returned promise\n    popup.responseDeferred.promise.close = function popupClose(result) {\n      if (!popup.removed) popup.responseDeferred.resolve(result);\n    };\n    //DEPRECATED: notify the promise with an object with a close method\n    popup.responseDeferred.notify({ close: popup.responseDeferred.close });\n\n    doShow();\n\n    return popup.responseDeferred.promise;\n\n    function doShow() {\n      popupStack.push(popup);\n      $timeout(popup.show, showDelay, false);\n\n      popup.responseDeferred.promise.then(function(result) {\n        var index = popupStack.indexOf(popup);\n        if (index !== -1) {\n          popupStack.splice(index, 1);\n        }\n\n        popup.remove();\n\n        if (popupStack.length > 0) {\n          popupStack[popupStack.length - 1].show();\n        } else {\n          $ionicBackdrop.release();\n          //Remove popup-open & backdrop if this is last popup\n          $timeout(function() {\n            // wait to remove this due to a 300ms delay native\n            // click which would trigging whatever was underneath this\n            if (!popupStack.length) {\n              $ionicBody.removeClass('popup-open');\n            }\n          }, 400, false);\n          ($ionicPopup._backButtonActionDone || noop)();\n        }\n\n\n        return result;\n      });\n\n    }\n\n  }\n\n  function focusInput(element) {\n    var focusOn = element[0].querySelector('[autofocus]');\n    if (focusOn) {\n      focusOn.focus();\n    }\n  }\n\n  function showAlert(opts) {\n    return showPopup(extend({\n      buttons: [{\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function() {\n          return true;\n        }\n      }]\n    }, opts || {}));\n  }\n\n  function showConfirm(opts) {\n    return showPopup(extend({\n      buttons: [{\n        text: opts.cancelText || 'Cancel',\n        type: opts.cancelType || 'button-default',\n        onTap: function() { return false; }\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function() { return true; }\n      }]\n    }, opts || {}));\n  }\n\n  function showPrompt(opts) {\n    var scope = $rootScope.$new(true);\n    scope.data = {};\n    scope.data.fieldtype = opts.inputType ? opts.inputType : 'text';\n    scope.data.response = opts.defaultText ? opts.defaultText : '';\n    scope.data.placeholder = opts.inputPlaceholder ? opts.inputPlaceholder : '';\n    scope.data.maxlength = opts.maxLength ? parseInt(opts.maxLength) : '';\n    var text = '';\n    if (opts.template && /<[a-z][\\s\\S]*>/i.test(opts.template) === false) {\n      text = '<span>' + opts.template + '</span>';\n      delete opts.template;\n    }\n    return showPopup(extend({\n      template: text + '<input ng-model=\"data.response\" '\n        + 'type=\"{{ data.fieldtype }}\"'\n        + 'maxlength=\"{{ data.maxlength }}\"'\n        + 'placeholder=\"{{ data.placeholder }}\"'\n        + '>',\n      scope: scope,\n      buttons: [{\n        text: opts.cancelText || 'Cancel',\n        type: opts.cancelType || 'button-default',\n        onTap: function() {}\n      }, {\n        text: opts.okText || 'OK',\n        type: opts.okType || 'button-positive',\n        onTap: function() {\n          return scope.data.response || '';\n        }\n      }]\n    }, opts || {}));\n  }\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicPosition\n * @module ionic\n * @description\n * A set of utility methods that can be use to retrieve position of DOM elements.\n * It is meant to be used where we need to absolute-position DOM elements in\n * relation to other, existing elements (this is the case for tooltips, popovers, etc.).\n *\n * Adapted from [AngularUI Bootstrap](https://github.com/angular-ui/bootstrap/blob/master/src/position/position.js),\n * ([license](https://github.com/angular-ui/bootstrap/blob/master/LICENSE))\n */\nIonicModule\n.factory('$ionicPosition', ['$document', '$window', function($document, $window) {\n\n  function getStyle(el, cssprop) {\n    if (el.currentStyle) { //IE\n      return el.currentStyle[cssprop];\n    } else if ($window.getComputedStyle) {\n      return $window.getComputedStyle(el)[cssprop];\n    }\n    // finally try and get inline style\n    return el.style[cssprop];\n  }\n\n  /**\n   * Checks if a given element is statically positioned\n   * @param element - raw DOM element\n   */\n  function isStaticPositioned(element) {\n    return (getStyle(element, 'position') || 'static') === 'static';\n  }\n\n  /**\n   * returns the closest, non-statically positioned parentOffset of a given element\n   * @param element\n   */\n  var parentOffsetEl = function(element) {\n    var docDomEl = $document[0];\n    var offsetParent = element.offsetParent || docDomEl;\n    while (offsetParent && offsetParent !== docDomEl && isStaticPositioned(offsetParent)) {\n      offsetParent = offsetParent.offsetParent;\n    }\n    return offsetParent || docDomEl;\n  };\n\n  return {\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#position\n     * @description Get the current coordinates of the element, relative to the offset parent.\n     * Read-only equivalent of [jQuery's position function](http://api.jquery.com/position/).\n     * @param {element} element The element to get the position of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    position: function(element) {\n      var elBCR = this.offset(element);\n      var offsetParentBCR = { top: 0, left: 0 };\n      var offsetParentEl = parentOffsetEl(element[0]);\n      if (offsetParentEl != $document[0]) {\n        offsetParentBCR = this.offset(jqLite(offsetParentEl));\n        offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop;\n        offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft;\n      }\n\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: elBCR.top - offsetParentBCR.top,\n        left: elBCR.left - offsetParentBCR.left\n      };\n    },\n\n    /**\n     * @ngdoc method\n     * @name $ionicPosition#offset\n     * @description Get the current coordinates of the element, relative to the document.\n     * Read-only equivalent of [jQuery's offset function](http://api.jquery.com/offset/).\n     * @param {element} element The element to get the offset of.\n     * @returns {object} Returns an object containing the properties top, left, width and height.\n     */\n    offset: function(element) {\n      var boundingClientRect = element[0].getBoundingClientRect();\n      return {\n        width: boundingClientRect.width || element.prop('offsetWidth'),\n        height: boundingClientRect.height || element.prop('offsetHeight'),\n        top: boundingClientRect.top + ($window.pageYOffset || $document[0].documentElement.scrollTop),\n        left: boundingClientRect.left + ($window.pageXOffset || $document[0].documentElement.scrollLeft)\n      };\n    }\n\n  };\n}]);\n\n\n/**\n * @ngdoc service\n * @name $ionicScrollDelegate\n * @module ionic\n * @description\n * Delegate for controlling scrollViews (created by\n * {@link ionic.directive:ionContent} and\n * {@link ionic.directive:ionScroll} directives).\n *\n * Methods called directly on the $ionicScrollDelegate service will control all scroll\n * views.  Use the {@link ionic.service:$ionicScrollDelegate#$getByHandle $getByHandle}\n * method to control specific scrollViews.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content>\n *     <button ng-click=\"scrollTop()\">Scroll to Top!</button>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollTop = function() {\n *     $ionicScrollDelegate.scrollTop();\n *   };\n * }\n * ```\n *\n * Example of advanced usage, with two scroll areas using `delegate-handle`\n * for fine control.\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-content delegate-handle=\"mainScroll\">\n *     <button ng-click=\"scrollMainToTop()\">\n *       Scroll content to top!\n *     </button>\n *     <ion-scroll delegate-handle=\"small\" style=\"height: 100px;\">\n *       <button ng-click=\"scrollSmallToTop()\">\n *         Scroll small area to top!\n *       </button>\n *     </ion-scroll>\n *   </ion-content>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicScrollDelegate) {\n *   $scope.scrollMainToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('mainScroll').scrollTop();\n *   };\n *   $scope.scrollSmallToTop = function() {\n *     $ionicScrollDelegate.$getByHandle('small').scrollTop();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicScrollDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#resize\n   * @description Tell the scrollView to recalculate the size of its container.\n   */\n  'resize',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTop\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTop',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBottom\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBottom',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollTo\n   * @param {number} left The x-value to scroll to.\n   * @param {number} top The y-value to scroll to.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#scrollBy\n   * @param {number} left The x-offset to scroll by.\n   * @param {number} top The y-offset to scroll by.\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'scrollBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomTo\n   * @param {number} level Level to zoom to.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomTo',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#zoomBy\n   * @param {number} factor The factor to zoom by.\n   * @param {boolean=} animate Whether to animate the zoom.\n   * @param {number=} originLeft Zoom in at given left coordinate.\n   * @param {number=} originTop Zoom in at given top coordinate.\n   */\n  'zoomBy',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollPosition\n   * @returns {object} The scroll position of this view, with the following properties:\n   *  - `{number}` `left` The distance the user has scrolled from the left (starts at 0).\n   *  - `{number}` `top` The distance the user has scrolled from the top (starts at 0).\n   *  - `{number}` `zoom` The current zoom level.\n   */\n  'getScrollPosition',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#anchorScroll\n   * @description Tell the scrollView to scroll to the element with an id\n   * matching window.location.hash.\n   *\n   * If no matching element is found, it will scroll to top.\n   *\n   * @param {boolean=} shouldAnimate Whether the scroll should animate.\n   */\n  'anchorScroll',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#freezeScroll\n   * @description Does not allow this scroll view to scroll either x or y.\n   * @param {boolean=} shouldFreeze Should this scroll view be prevented from scrolling or not.\n   * @returns {boolean} If the scroll view is being prevented from scrolling or not.\n   */\n  'freezeScroll',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#freezeAllScrolls\n   * @description Does not allow any of the app's scroll views to scroll either x or y.\n   * @param {boolean=} shouldFreeze Should all app scrolls be prevented from scrolling or not.\n   */\n  'freezeAllScrolls',\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#getScrollView\n   * @returns {object} The scrollView associated with this delegate.\n   */\n  'getScrollView'\n  /**\n   * @ngdoc method\n   * @name $ionicScrollDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * scrollViews with `delegate-handle` matching the given handle.\n   *\n   * Example: `$ionicScrollDelegate.$getByHandle('my-handle').scrollTop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSideMenuDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionSideMenus} directive.\n *\n * Methods called directly on the $ionicSideMenuDelegate service will control all side\n * menus.  Use the {@link ionic.service:$ionicSideMenuDelegate#$getByHandle $getByHandle}\n * method to control specific ionSideMenus instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MainCtrl\">\n *   <ion-side-menus>\n *     <ion-side-menu-content>\n *       Content!\n *       <button ng-click=\"toggleLeftSideMenu()\">\n *         Toggle Left Side Menu\n *       </button>\n *     </ion-side-menu-content>\n *     <ion-side-menu side=\"left\">\n *       Left Menu!\n *     <ion-side-menu>\n *   </ion-side-menus>\n * </body>\n * ```\n * ```js\n * function MainCtrl($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeftSideMenu = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n */\nIonicModule\n.service('$ionicSideMenuDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleLeft\n   * @description Toggle the left side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#toggleRight\n   * @description Toggle the right side menu (if it exists).\n   * @param {boolean=} isOpen Whether to open or close the menu.\n   * Default: Toggles the menu.\n   */\n  'toggleRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#getOpenRatio\n   * @description Gets the ratio of open amount over menu width. For example, a\n   * menu of width 100 that is opened by 50 pixels is 50% opened, and would return\n   * a ratio of 0.5.\n   *\n   * @returns {float} 0 if nothing is open, between 0 and 1 if left menu is\n   * opened/opening, and between 0 and -1 if right menu is opened/opening.\n   */\n  'getOpenRatio',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpen\n   * @returns {boolean} Whether either the left or right menu is currently opened.\n   */\n  'isOpen',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenLeft\n   * @returns {boolean} Whether the left menu is currently opened.\n   */\n  'isOpenLeft',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#isOpenRight\n   * @returns {boolean} Whether the right menu is currently opened.\n   */\n  'isOpenRight',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#canDragContent\n   * @param {boolean=} canDrag Set whether the content can or cannot be dragged to open\n   * side menus.\n   * @returns {boolean} Whether the content can be dragged to open side menus.\n   */\n  'canDragContent',\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#edgeDragThreshold\n   * @param {boolean|number=} value Set whether the content drag can only start if it is below a certain threshold distance from the edge of the screen. Accepts three different values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n   * @returns {boolean} Whether the drag can start only from within the edge of screen threshold.\n   */\n  'edgeDragThreshold'\n  /**\n   * @ngdoc method\n   * @name $ionicSideMenuDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSideMenus} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSideMenuDelegate.$getByHandle('my-handle').toggleLeft();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicSlideBoxDelegate\n * @module ionic\n * @description\n * Delegate that controls the {@link ionic.directive:ionSlideBox} directive.\n *\n * Methods called directly on the $ionicSlideBoxDelegate service will control all slide boxes.  Use the {@link ionic.service:$ionicSlideBoxDelegate#$getByHandle $getByHandle}\n * method to control specific slide box instances.\n *\n * @usage\n *\n * ```html\n * <ion-view>\n *   <ion-slide-box>\n *     <ion-slide>\n *       <div class=\"box blue\">\n *         <button ng-click=\"nextSlide()\">Next slide!</button>\n *       </div>\n *     </ion-slide>\n *     <ion-slide>\n *       <div class=\"box red\">\n *         Slide 2!\n *       </div>\n *     </ion-slide>\n *   </ion-slide-box>\n * </ion-view>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicSlideBoxDelegate) {\n *   $scope.nextSlide = function() {\n *     $ionicSlideBoxDelegate.next();\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicSlideBoxDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#update\n   * @description\n   * Update the slidebox (for example if using Angular with ng-repeat,\n   * resize it for the elements inside).\n   */\n  'update',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slide\n   * @param {number} to The index to slide to.\n   * @param {number=} speed The number of milliseconds the change should take.\n   */\n  'slide',\n  'select',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#enableSlide\n   * @param {boolean=} shouldEnable Whether to enable sliding the slidebox.\n   * @returns {boolean} Whether sliding is enabled.\n   */\n  'enableSlide',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#previous\n   * @param {number=} speed The number of milliseconds the change should take.\n   * @description Go to the previous slide. Wraps around if at the beginning.\n   */\n  'previous',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#next\n   * @param {number=} speed The number of milliseconds the change should take.\n   * @description Go to the next slide. Wraps around if at the end.\n   */\n  'next',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#stop\n   * @description Stop sliding. The slideBox will not move again until\n   * explicitly told to do so.\n   */\n  'stop',\n  'autoPlay',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#start\n   * @description Start sliding again if the slideBox was stopped.\n   */\n  'start',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#currentIndex\n   * @returns number The index of the current slide.\n   */\n  'currentIndex',\n  'selected',\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#slidesCount\n   * @returns number The number of slides there are currently.\n   */\n  'slidesCount',\n  'count',\n  'loop'\n  /**\n   * @ngdoc method\n   * @name $ionicSlideBoxDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionSlideBox} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicSlideBoxDelegate.$getByHandle('my-handle').stop();`\n   */\n]));\n\n\n/**\n * @ngdoc service\n * @name $ionicTabsDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionTabs} directive.\n *\n * Methods called directly on the $ionicTabsDelegate service will control all ionTabs\n * directives. Use the {@link ionic.service:$ionicTabsDelegate#$getByHandle $getByHandle}\n * method to control specific ionTabs instances.\n *\n * @usage\n *\n * ```html\n * <body ng-controller=\"MyCtrl\">\n *   <ion-tabs>\n *\n *     <ion-tab title=\"Tab 1\">\n *       Hello tab 1!\n *       <button ng-click=\"selectTabWithIndex(1)\">Select tab 2!</button>\n *     </ion-tab>\n *     <ion-tab title=\"Tab 2\">Hello tab 2!</ion-tab>\n *\n *   </ion-tabs>\n * </body>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicTabsDelegate) {\n *   $scope.selectTabWithIndex = function(index) {\n *     $ionicTabsDelegate.select(index);\n *   }\n * }\n * ```\n */\nIonicModule\n.service('$ionicTabsDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#select\n   * @description Select the tab matching the given index.\n   *\n   * @param {number} index Index of the tab to select.\n   */\n  'select',\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#selectedIndex\n   * @returns `number` The index of the selected tab, or -1.\n   */\n  'selectedIndex',\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#showBar\n   * @description\n   * Set/get whether the {@link ionic.directive:ionTabs} is shown\n   * @param {boolean} show Whether to show the bar.\n   * @returns {boolean} Whether the bar is shown.\n   */\n  'showBar'\n  /**\n   * @ngdoc method\n   * @name $ionicTabsDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionTabs} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicTabsDelegate.$getByHandle('my-handle').select(0);`\n   */\n]));\n\n// closure to keep things neat\n(function() {\n  var templatesToCache = [];\n\n/**\n * @ngdoc service\n * @name $ionicTemplateCache\n * @module ionic\n * @description A service that preemptively caches template files to eliminate transition flicker and boost performance.\n * @usage\n * State templates are cached automatically, but you can optionally cache other templates.\n *\n * ```js\n * $ionicTemplateCache('myNgIncludeTemplate.html');\n * ```\n *\n * Optionally disable all preemptive caching with the `$ionicConfigProvider` or individual states by setting `prefetchTemplate`\n * in the `$state` definition\n *\n * ```js\n *   angular.module('myApp', ['ionic'])\n *   .config(function($stateProvider, $ionicConfigProvider) {\n *\n *     // disable preemptive template caching globally\n *     $ionicConfigProvider.templates.prefetch(false);\n *\n *     // disable individual states\n *     $stateProvider\n *       .state('tabs', {\n *         url: \"/tab\",\n *         abstract: true,\n *         prefetchTemplate: false,\n *         templateUrl: \"tabs-templates/tabs.html\"\n *       })\n *       .state('tabs.home', {\n *         url: \"/home\",\n *         views: {\n *           'home-tab': {\n *             prefetchTemplate: false,\n *             templateUrl: \"tabs-templates/home.html\",\n *             controller: 'HomeTabCtrl'\n *           }\n *         }\n *       });\n *   });\n * ```\n */\nIonicModule\n.factory('$ionicTemplateCache', [\n'$http',\n'$templateCache',\n'$timeout',\nfunction($http, $templateCache, $timeout) {\n  var toCache = templatesToCache,\n      hasRun;\n\n  function $ionicTemplateCache(templates) {\n    if (typeof templates === 'undefined') {\n      return run();\n    }\n    if (isString(templates)) {\n      templates = [templates];\n    }\n    forEach(templates, function(template) {\n      toCache.push(template);\n    });\n    if (hasRun) {\n      run();\n    }\n  }\n\n  // run through methods - internal method\n  function run() {\n    var template;\n    $ionicTemplateCache._runCount++;\n\n    hasRun = true;\n    // ignore if race condition already zeroed out array\n    if (toCache.length === 0) return;\n\n    var i = 0;\n    while (i < 4 && (template = toCache.pop())) {\n      // note that inline templates are ignored by this request\n      if (isString(template)) $http.get(template, { cache: $templateCache });\n      i++;\n    }\n    // only preload 3 templates a second\n    if (toCache.length) {\n      $timeout(run, 1000);\n    }\n  }\n\n  // exposing for testing\n  $ionicTemplateCache._runCount = 0;\n  // default method\n  return $ionicTemplateCache;\n}])\n\n// Intercepts the $stateprovider.state() command to look for templateUrls that can be cached\n.config([\n'$stateProvider',\n'$ionicConfigProvider',\nfunction($stateProvider, $ionicConfigProvider) {\n  var stateProviderState = $stateProvider.state;\n  $stateProvider.state = function(stateName, definition) {\n    // don't even bother if it's disabled. note, another config may run after this, so it's not a catch-all\n    if (typeof definition === 'object') {\n      var enabled = definition.prefetchTemplate !== false && templatesToCache.length < $ionicConfigProvider.templates.maxPrefetch();\n      if (enabled && isString(definition.templateUrl)) templatesToCache.push(definition.templateUrl);\n      if (angular.isObject(definition.views)) {\n        for (var key in definition.views) {\n          enabled = definition.views[key].prefetchTemplate !== false && templatesToCache.length < $ionicConfigProvider.templates.maxPrefetch();\n          if (enabled && isString(definition.views[key].templateUrl)) templatesToCache.push(definition.views[key].templateUrl);\n        }\n      }\n    }\n    return stateProviderState.call($stateProvider, stateName, definition);\n  };\n}])\n\n// process the templateUrls collected by the $stateProvider, adding them to the cache\n.run(['$ionicTemplateCache', function($ionicTemplateCache) {\n  $ionicTemplateCache();\n}]);\n\n})();\n\nIonicModule\n.factory('$ionicTemplateLoader', [\n  '$compile',\n  '$controller',\n  '$http',\n  '$q',\n  '$rootScope',\n  '$templateCache',\nfunction($compile, $controller, $http, $q, $rootScope, $templateCache) {\n\n  return {\n    load: fetchTemplate,\n    compile: loadAndCompile\n  };\n\n  function fetchTemplate(url) {\n    return $http.get(url, {cache: $templateCache})\n    .then(function(response) {\n      return response.data && response.data.trim();\n    });\n  }\n\n  function loadAndCompile(options) {\n    options = extend({\n      template: '',\n      templateUrl: '',\n      scope: null,\n      controller: null,\n      locals: {},\n      appendTo: null\n    }, options || {});\n\n    var templatePromise = options.templateUrl ?\n      this.load(options.templateUrl) :\n      $q.when(options.template);\n\n    return templatePromise.then(function(template) {\n      var controller;\n      var scope = options.scope || $rootScope.$new();\n\n      //Incase template doesn't have just one root element, do this\n      var element = jqLite('<div>').html(template).contents();\n\n      if (options.controller) {\n        controller = $controller(\n          options.controller,\n          extend(options.locals, {\n            $scope: scope\n          })\n        );\n        element.children().data('$ngControllerController', controller);\n      }\n      if (options.appendTo) {\n        jqLite(options.appendTo).append(element);\n      }\n\n      $compile(element)(scope);\n\n      return {\n        element: element,\n        scope: scope\n      };\n    });\n  }\n\n}]);\n\n/**\n * @private\n * DEPRECATED, as of v1.0.0-beta14 -------\n */\nIonicModule\n.factory('$ionicViewService', ['$ionicHistory', '$log', function($ionicHistory, $log) {\n\n  function warn(oldMethod, newMethod) {\n    $log.warn('$ionicViewService' + oldMethod + ' is deprecated, please use $ionicHistory' + newMethod + ' instead: http://ionicframework.com/docs/nightly/api/service/$ionicHistory/');\n  }\n\n  warn('', '');\n\n  var methodsMap = {\n    getCurrentView: 'currentView',\n    getBackView: 'backView',\n    getForwardView: 'forwardView',\n    getCurrentStateName: 'currentStateName',\n    nextViewOptions: 'nextViewOptions',\n    clearHistory: 'clearHistory'\n  };\n\n  forEach(methodsMap, function(newMethod, oldMethod) {\n    methodsMap[oldMethod] = function() {\n      warn('.' + oldMethod, '.' + newMethod);\n      return $ionicHistory[newMethod].apply(this, arguments);\n    };\n  });\n\n  return methodsMap;\n\n}]);\n\n/**\n * @private\n * TODO document\n */\n\nIonicModule.factory('$ionicViewSwitcher', [\n  '$timeout',\n  '$document',\n  '$q',\n  '$ionicClickBlock',\n  '$ionicConfig',\n  '$ionicNavBarDelegate',\nfunction($timeout, $document, $q, $ionicClickBlock, $ionicConfig, $ionicNavBarDelegate) {\n\n  var TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';\n  var DATA_NO_CACHE = '$noCache';\n  var DATA_DESTROY_ELE = '$destroyEle';\n  var DATA_ELE_IDENTIFIER = '$eleId';\n  var DATA_VIEW_ACCESSED = '$accessed';\n  var DATA_FALLBACK_TIMER = '$fallbackTimer';\n  var DATA_VIEW = '$viewData';\n  var NAV_VIEW_ATTR = 'nav-view';\n  var VIEW_STATUS_ACTIVE = 'active';\n  var VIEW_STATUS_CACHED = 'cached';\n  var VIEW_STATUS_STAGED = 'stage';\n\n  var transitionCounter = 0;\n  var nextTransition, nextDirection;\n  ionic.transition = ionic.transition || {};\n  ionic.transition.isActive = false;\n  var isActiveTimer;\n  var cachedAttr = ionic.DomUtil.cachedAttr;\n  var transitionPromises = [];\n  var defaultTimeout = 1100;\n\n  var ionicViewSwitcher = {\n\n    create: function(navViewCtrl, viewLocals, enteringView, leavingView, renderStart, renderEnd) {\n      // get a reference to an entering/leaving element if they exist\n      // loop through to see if the view is already in the navViewElement\n      var enteringEle, leavingEle;\n      var transitionId = ++transitionCounter;\n      var alreadyInDom;\n\n      var switcher = {\n\n        init: function(registerData, callback) {\n          ionicViewSwitcher.isTransitioning(true);\n\n          switcher.loadViewElements(registerData);\n\n          switcher.render(registerData, function() {\n            callback && callback();\n          });\n        },\n\n        loadViewElements: function(registerData) {\n          var x, l, viewEle;\n          var viewElements = navViewCtrl.getViewElements();\n          var enteringEleIdentifier = getViewElementIdentifier(viewLocals, enteringView);\n          var navViewActiveEleId = navViewCtrl.activeEleId();\n\n          for (x = 0, l = viewElements.length; x < l; x++) {\n            viewEle = viewElements.eq(x);\n\n            if (viewEle.data(DATA_ELE_IDENTIFIER) === enteringEleIdentifier) {\n              // we found an existing element in the DOM that should be entering the view\n              if (viewEle.data(DATA_NO_CACHE)) {\n                // the existing element should not be cached, don't use it\n                viewEle.data(DATA_ELE_IDENTIFIER, enteringEleIdentifier + ionic.Utils.nextUid());\n                viewEle.data(DATA_DESTROY_ELE, true);\n\n              } else {\n                enteringEle = viewEle;\n              }\n\n            } else if (isDefined(navViewActiveEleId) && viewEle.data(DATA_ELE_IDENTIFIER) === navViewActiveEleId) {\n              leavingEle = viewEle;\n            }\n\n            if (enteringEle && leavingEle) break;\n          }\n\n          alreadyInDom = !!enteringEle;\n\n          if (!alreadyInDom) {\n            // still no existing element to use\n            // create it using existing template/scope/locals\n            enteringEle = registerData.ele || ionicViewSwitcher.createViewEle(viewLocals);\n\n            // existing elements in the DOM are looked up by their state name and state id\n            enteringEle.data(DATA_ELE_IDENTIFIER, enteringEleIdentifier);\n          }\n\n          if (renderEnd) {\n            navViewCtrl.activeEleId(enteringEleIdentifier);\n          }\n\n          registerData.ele = null;\n        },\n\n        render: function(registerData, callback) {\n          if (alreadyInDom) {\n            // it was already found in the DOM, just reconnect the scope\n            ionic.Utils.reconnectScope(enteringEle.scope());\n\n          } else {\n            // the entering element is not already in the DOM\n            // set that the entering element should be \"staged\" and its\n            // styles of where this element will go before it hits the DOM\n            navViewAttr(enteringEle, VIEW_STATUS_STAGED);\n\n            var enteringData = getTransitionData(viewLocals, enteringEle, registerData.direction, enteringView);\n            var transitionFn = $ionicConfig.transitions.views[enteringData.transition] || $ionicConfig.transitions.views.none;\n            transitionFn(enteringEle, null, enteringData.direction, true).run(0);\n\n            enteringEle.data(DATA_VIEW, {\n              viewId: enteringData.viewId,\n              historyId: enteringData.historyId,\n              stateName: enteringData.stateName,\n              stateParams: enteringData.stateParams\n            });\n\n            // if the current state has cache:false\n            // or the element has cache-view=\"false\" attribute\n            if (viewState(viewLocals).cache === false || viewState(viewLocals).cache === 'false' ||\n                enteringEle.attr('cache-view') == 'false' || $ionicConfig.views.maxCache() === 0) {\n              enteringEle.data(DATA_NO_CACHE, true);\n            }\n\n            // append the entering element to the DOM, create a new scope and run link\n            var viewScope = navViewCtrl.appendViewElement(enteringEle, viewLocals);\n\n            delete enteringData.direction;\n            delete enteringData.transition;\n            viewScope.$emit('$ionicView.loaded', enteringData);\n          }\n\n          // update that this view was just accessed\n          enteringEle.data(DATA_VIEW_ACCESSED, Date.now());\n\n          callback && callback();\n        },\n\n        transition: function(direction, enableBack, allowAnimate) {\n          var deferred;\n          var enteringData = getTransitionData(viewLocals, enteringEle, direction, enteringView);\n          var leavingData = extend(extend({}, enteringData), getViewData(leavingView));\n          enteringData.transitionId = leavingData.transitionId = transitionId;\n          enteringData.fromCache = !!alreadyInDom;\n          enteringData.enableBack = !!enableBack;\n          enteringData.renderStart = renderStart;\n          enteringData.renderEnd = renderEnd;\n\n          cachedAttr(enteringEle.parent(), 'nav-view-transition', enteringData.transition);\n          cachedAttr(enteringEle.parent(), 'nav-view-direction', enteringData.direction);\n\n          // cancel any previous transition complete fallbacks\n          $timeout.cancel(enteringEle.data(DATA_FALLBACK_TIMER));\n\n          // get the transition ready and see if it'll animate\n          var transitionFn = $ionicConfig.transitions.views[enteringData.transition] || $ionicConfig.transitions.views.none;\n          var viewTransition = transitionFn(enteringEle, leavingEle, enteringData.direction,\n                                            enteringData.shouldAnimate && allowAnimate && renderEnd);\n\n          if (viewTransition.shouldAnimate) {\n            // attach transitionend events (and fallback timer)\n            enteringEle.on(TRANSITIONEND_EVENT, completeOnTransitionEnd);\n            enteringEle.data(DATA_FALLBACK_TIMER, $timeout(transitionComplete, defaultTimeout));\n            $ionicClickBlock.show(defaultTimeout);\n          }\n\n          if (renderStart) {\n            // notify the views \"before\" the transition starts\n            switcher.emit('before', enteringData, leavingData);\n\n            // stage entering element, opacity 0, no transition duration\n            navViewAttr(enteringEle, VIEW_STATUS_STAGED);\n\n            // render the elements in the correct location for their starting point\n            viewTransition.run(0);\n          }\n\n          if (renderEnd) {\n            // create a promise so we can keep track of when all transitions finish\n            // only required if this transition should complete\n            deferred = $q.defer();\n            transitionPromises.push(deferred.promise);\n          }\n\n          if (renderStart && renderEnd) {\n            // CSS \"auto\" transitioned, not manually transitioned\n            // wait a frame so the styles apply before auto transitioning\n            $timeout(function() {\n              ionic.requestAnimationFrame(onReflow);\n            });\n          } else if (!renderEnd) {\n            // just the start of a manual transition\n            // but it will not render the end of the transition\n            navViewAttr(enteringEle, 'entering');\n            navViewAttr(leavingEle, 'leaving');\n\n            // return the transition run method so each step can be ran manually\n            return {\n              run: viewTransition.run,\n              cancel: function(shouldAnimate) {\n                if (shouldAnimate) {\n                  enteringEle.on(TRANSITIONEND_EVENT, cancelOnTransitionEnd);\n                  enteringEle.data(DATA_FALLBACK_TIMER, $timeout(cancelTransition, defaultTimeout));\n                  $ionicClickBlock.show(defaultTimeout);\n                } else {\n                  cancelTransition();\n                }\n                viewTransition.shouldAnimate = shouldAnimate;\n                viewTransition.run(0);\n                viewTransition = null;\n              }\n            };\n\n          } else if (renderEnd) {\n            // just the end of a manual transition\n            // happens after the manual transition has completed\n            // and a full history change has happened\n            onReflow();\n          }\n\n\n          function onReflow() {\n            // remove that we're staging the entering element so it can auto transition\n            navViewAttr(enteringEle, viewTransition.shouldAnimate ? 'entering' : VIEW_STATUS_ACTIVE);\n            navViewAttr(leavingEle, viewTransition.shouldAnimate ? 'leaving' : VIEW_STATUS_CACHED);\n\n            // start the auto transition and let the CSS take over\n            viewTransition.run(1);\n\n            // trigger auto transitions on the associated nav bars\n            $ionicNavBarDelegate._instances.forEach(function(instance) {\n              instance.triggerTransitionStart(transitionId);\n            });\n\n            if (!viewTransition.shouldAnimate) {\n              // no animated auto transition\n              transitionComplete();\n            }\n          }\n\n          // Make sure that transitionend events bubbling up from children won't fire\n          // transitionComplete. Will only go forward if ev.target == the element listening.\n          function completeOnTransitionEnd(ev) {\n            if (ev.target !== this) return;\n            transitionComplete();\n          }\n          function transitionComplete() {\n            if (transitionComplete.x) return;\n            transitionComplete.x = true;\n\n            enteringEle.off(TRANSITIONEND_EVENT, completeOnTransitionEnd);\n            $timeout.cancel(enteringEle.data(DATA_FALLBACK_TIMER));\n            leavingEle && $timeout.cancel(leavingEle.data(DATA_FALLBACK_TIMER));\n\n            // resolve that this one transition (there could be many w/ nested views)\n            deferred && deferred.resolve(navViewCtrl);\n\n            // the most recent transition added has completed and all the active\n            // transition promises should be added to the services array of promises\n            if (transitionId === transitionCounter) {\n              $q.all(transitionPromises).then(ionicViewSwitcher.transitionEnd);\n\n              // emit that the views have finished transitioning\n              // each parent nav-view will update which views are active and cached\n              switcher.emit('after', enteringData, leavingData);\n              switcher.cleanup(enteringData);\n            }\n\n            // tell the nav bars that the transition has ended\n            $ionicNavBarDelegate._instances.forEach(function(instance) {\n              instance.triggerTransitionEnd();\n            });\n\n\n            // remove any references that could cause memory issues\n            nextTransition = nextDirection = enteringView = leavingView = enteringEle = leavingEle = null;\n          }\n\n          // Make sure that transitionend events bubbling up from children won't fire\n          // transitionComplete. Will only go forward if ev.target == the element listening.\n          function cancelOnTransitionEnd(ev) {\n            if (ev.target !== this) return;\n            cancelTransition();\n          }\n          function cancelTransition() {\n            navViewAttr(enteringEle, VIEW_STATUS_CACHED);\n            navViewAttr(leavingEle, VIEW_STATUS_ACTIVE);\n            enteringEle.off(TRANSITIONEND_EVENT, cancelOnTransitionEnd);\n            $timeout.cancel(enteringEle.data(DATA_FALLBACK_TIMER));\n            ionicViewSwitcher.transitionEnd([navViewCtrl]);\n          }\n\n        },\n\n      emit: function(step, enteringData, leavingData) {\n          var enteringScope = getScopeForElement(enteringEle, enteringData);\n          var leavingScope = getScopeForElement(leavingEle, leavingData);\n\n          var prefixesAreEqual;\n\n          if ( !enteringData.viewId || enteringData.abstractView ) {\n            // it's an abstract view, so treat it accordingly\n\n            // we only get access to the leaving scope once in the transition,\n            // so dispatch all events right away if it exists\n            if ( leavingScope ) {\n              leavingScope.$emit('$ionicView.beforeLeave', leavingData);\n              leavingScope.$emit('$ionicView.leave', leavingData);\n              leavingScope.$emit('$ionicView.afterLeave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.beforeLeave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.leave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.afterLeave', leavingData);\n            }\n          }\n          else {\n            // it's a regular view, so do the normal process\n            if (step == 'after') {\n              if (enteringScope) {\n                enteringScope.$emit('$ionicView.enter', enteringData);\n                enteringScope.$broadcast('$ionicParentView.enter', enteringData);\n              }\n\n              if (leavingScope) {\n                leavingScope.$emit('$ionicView.leave', leavingData);\n                leavingScope.$broadcast('$ionicParentView.leave', leavingData);\n              }\n              else if (enteringScope && leavingData && leavingData.viewId && enteringData.stateName !== leavingData.stateName) {\n                // we only want to dispatch this when we are doing a single-tier\n                // state change such as changing a tab, so compare the state\n                // for the same state-prefix but different suffix\n                prefixesAreEqual = compareStatePrefixes(enteringData.stateName, leavingData.stateName);\n                if ( prefixesAreEqual ) {\n                  enteringScope.$emit('$ionicNavView.leave', leavingData);\n                }\n              }\n            }\n\n            if (enteringScope) {\n              enteringScope.$emit('$ionicView.' + step + 'Enter', enteringData);\n              enteringScope.$broadcast('$ionicParentView.' + step + 'Enter', enteringData);\n            }\n\n            if (leavingScope) {\n              leavingScope.$emit('$ionicView.' + step + 'Leave', leavingData);\n              leavingScope.$broadcast('$ionicParentView.' + step + 'Leave', leavingData);\n\n            } else if (enteringScope && leavingData && leavingData.viewId && enteringData.stateName !== leavingData.stateName) {\n              // we only want to dispatch this when we are doing a single-tier\n              // state change such as changing a tab, so compare the state\n              // for the same state-prefix but different suffix\n              prefixesAreEqual = compareStatePrefixes(enteringData.stateName, leavingData.stateName);\n              if ( prefixesAreEqual ) {\n                enteringScope.$emit('$ionicNavView.' + step + 'Leave', leavingData);\n              }\n            }\n          }\n        },\n\n        cleanup: function(transData) {\n          // check if any views should be removed\n          if (leavingEle && transData.direction == 'back' && !$ionicConfig.views.forwardCache()) {\n            // if they just navigated back we can destroy the forward view\n            // do not remove forward views if cacheForwardViews config is true\n            destroyViewEle(leavingEle);\n          }\n\n          var viewElements = navViewCtrl.getViewElements();\n          var viewElementsLength = viewElements.length;\n          var x, viewElement;\n          var removeOldestAccess = (viewElementsLength - 1) > $ionicConfig.views.maxCache();\n          var removableEle;\n          var oldestAccess = Date.now();\n\n          for (x = 0; x < viewElementsLength; x++) {\n            viewElement = viewElements.eq(x);\n\n            if (removeOldestAccess && viewElement.data(DATA_VIEW_ACCESSED) < oldestAccess) {\n              // remember what was the oldest element to be accessed so it can be destroyed\n              oldestAccess = viewElement.data(DATA_VIEW_ACCESSED);\n              removableEle = viewElements.eq(x);\n\n            } else if (viewElement.data(DATA_DESTROY_ELE) && navViewAttr(viewElement) != VIEW_STATUS_ACTIVE) {\n              destroyViewEle(viewElement);\n            }\n          }\n\n          destroyViewEle(removableEle);\n\n          if (enteringEle.data(DATA_NO_CACHE)) {\n            enteringEle.data(DATA_DESTROY_ELE, true);\n          }\n        },\n\n        enteringEle: function() { return enteringEle; },\n        leavingEle: function() { return leavingEle; }\n\n      };\n\n      return switcher;\n    },\n\n    transitionEnd: function(navViewCtrls) {\n      forEach(navViewCtrls, function(navViewCtrl) {\n        navViewCtrl.transitionEnd();\n      });\n\n      ionicViewSwitcher.isTransitioning(false);\n      $ionicClickBlock.hide();\n      transitionPromises = [];\n    },\n\n    nextTransition: function(val) {\n      nextTransition = val;\n    },\n\n    nextDirection: function(val) {\n      nextDirection = val;\n    },\n\n    isTransitioning: function(val) {\n      if (arguments.length) {\n        ionic.transition.isActive = !!val;\n        $timeout.cancel(isActiveTimer);\n        if (val) {\n          isActiveTimer = $timeout(function() {\n            ionicViewSwitcher.isTransitioning(false);\n          }, 999);\n        }\n      }\n      return ionic.transition.isActive;\n    },\n\n    createViewEle: function(viewLocals) {\n      var containerEle = $document[0].createElement('div');\n      if (viewLocals && viewLocals.$template) {\n        containerEle.innerHTML = viewLocals.$template;\n        if (containerEle.children.length === 1) {\n          containerEle.children[0].classList.add('pane');\n          if ( viewLocals.$$state && viewLocals.$$state.self && viewLocals.$$state.self['abstract'] ) {\n            angular.element(containerEle.children[0]).attr(\"abstract\", \"true\");\n          }\n          else {\n            if ( viewLocals.$$state && viewLocals.$$state.self ) {\n              angular.element(containerEle.children[0]).attr(\"state\", viewLocals.$$state.self.name);\n            }\n\n          }\n          return jqLite(containerEle.children[0]);\n        }\n      }\n      containerEle.className = \"pane\";\n      return jqLite(containerEle);\n    },\n\n    viewEleIsActive: function(viewEle, isActiveAttr) {\n      navViewAttr(viewEle, isActiveAttr ? VIEW_STATUS_ACTIVE : VIEW_STATUS_CACHED);\n    },\n\n    getTransitionData: getTransitionData,\n    navViewAttr: navViewAttr,\n    destroyViewEle: destroyViewEle\n\n  };\n\n  return ionicViewSwitcher;\n\n\n  function getViewElementIdentifier(locals, view) {\n    if (viewState(locals)['abstract']) return viewState(locals).name;\n    if (view) return view.stateId || view.viewId;\n    return ionic.Utils.nextUid();\n  }\n\n  function viewState(locals) {\n    return locals && locals.$$state && locals.$$state.self || {};\n  }\n\n  function getTransitionData(viewLocals, enteringEle, direction, view) {\n    // Priority\n    // 1) attribute directive on the button/link to this view\n    // 2) entering element's attribute\n    // 3) entering view's $state config property\n    // 4) view registration data\n    // 5) global config\n    // 6) fallback value\n\n    var state = viewState(viewLocals);\n    var viewTransition = nextTransition || cachedAttr(enteringEle, 'view-transition') || state.viewTransition || $ionicConfig.views.transition() || 'ios';\n    var navBarTransition = $ionicConfig.navBar.transition();\n    direction = nextDirection || cachedAttr(enteringEle, 'view-direction') || state.viewDirection || direction || 'none';\n\n    return extend(getViewData(view), {\n      transition: viewTransition,\n      navBarTransition: navBarTransition === 'view' ? viewTransition : navBarTransition,\n      direction: direction,\n      shouldAnimate: (viewTransition !== 'none' && direction !== 'none')\n    });\n  }\n\n  function getViewData(view) {\n    view = view || {};\n    return {\n      viewId: view.viewId,\n      historyId: view.historyId,\n      stateId: view.stateId,\n      stateName: view.stateName,\n      stateParams: view.stateParams\n    };\n  }\n\n  function navViewAttr(ele, value) {\n    if (arguments.length > 1) {\n      cachedAttr(ele, NAV_VIEW_ATTR, value);\n    } else {\n      return cachedAttr(ele, NAV_VIEW_ATTR);\n    }\n  }\n\n  function destroyViewEle(ele) {\n    // we found an element that should be removed\n    // destroy its scope, then remove the element\n    if (ele && ele.length) {\n      var viewScope = ele.scope();\n      if (viewScope) {\n        viewScope.$emit('$ionicView.unloaded', ele.data(DATA_VIEW));\n        viewScope.$destroy();\n      }\n      ele.remove();\n    }\n  }\n\n  function compareStatePrefixes(enteringStateName, exitingStateName) {\n    var enteringStateSuffixIndex = enteringStateName.lastIndexOf('.');\n    var exitingStateSuffixIndex = exitingStateName.lastIndexOf('.');\n\n    // if either of the prefixes are empty, just return false\n    if ( enteringStateSuffixIndex < 0 || exitingStateSuffixIndex < 0 ) {\n      return false;\n    }\n\n    var enteringPrefix = enteringStateName.substring(0, enteringStateSuffixIndex);\n    var exitingPrefix = exitingStateName.substring(0, exitingStateSuffixIndex);\n\n    return enteringPrefix === exitingPrefix;\n  }\n\n  function getScopeForElement(element, stateData) {\n    if ( !element ) {\n      return null;\n    }\n    // check if it's abstract\n    var attributeValue = angular.element(element).attr(\"abstract\");\n    var stateValue = angular.element(element).attr(\"state\");\n\n    if ( attributeValue !== \"true\" ) {\n      // it's not an abstract view, so make sure the element\n      // matches the state.  Due to abstract view weirdness,\n      // sometimes it doesn't. If it doesn't, don't dispatch events\n      // so leave the scope undefined\n      if ( stateValue === stateData.stateName ) {\n        return angular.element(element).scope();\n      }\n      return null;\n    }\n    else {\n      // it is an abstract element, so look for element with the \"state\" attributeValue\n      // set to the name of the stateData state\n      var elements = aggregateNavViewChildren(element);\n      for ( var i = 0; i < elements.length; i++ ) {\n          var state = angular.element(elements[i]).attr(\"state\");\n          if ( state === stateData.stateName ) {\n            stateData.abstractView = true;\n            return angular.element(elements[i]).scope();\n          }\n      }\n      // we didn't find a match, so return null\n      return null;\n    }\n  }\n\n  function aggregateNavViewChildren(element) {\n    var aggregate = [];\n    var navViews = angular.element(element).find(\"ion-nav-view\");\n    for ( var i = 0; i < navViews.length; i++ ) {\n      var children = angular.element(navViews[i]).children();\n      var childrenAggregated = [];\n      for ( var j = 0; j < children.length; j++ ) {\n        childrenAggregated = childrenAggregated.concat(children[j]);\n      }\n      aggregate = aggregate.concat(childrenAggregated);\n    }\n    return aggregate;\n  }\n\n}]);\n\n/**\n * ==================  angular-ios9-uiwebview.patch.js v1.1.1 ==================\n *\n * This patch works around iOS9 UIWebView regression that causes infinite digest\n * errors in Angular.\n *\n * The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular\n * have the workaround baked in.\n *\n * To apply this patch load/bundle this file with your application and add a\n * dependency on the \"ngIOS9UIWebViewPatch\" module to your main app module.\n *\n * For example:\n *\n * ```\n * angular.module('myApp', ['ngRoute'])`\n * ```\n *\n * becomes\n *\n * ```\n * angular.module('myApp', ['ngRoute', 'ngIOS9UIWebViewPatch'])\n * ```\n *\n *\n * More info:\n * - https://openradar.appspot.com/22186109\n * - https://github.com/angular/angular.js/issues/12241\n * - https://github.com/driftyco/ionic/issues/4082\n *\n *\n * @license AngularJS\n * (c) 2010-2015 Google, Inc. http://angularjs.org\n * License: MIT\n */\n\nangular.module('ngIOS9UIWebViewPatch', ['ng']).config(['$provide', function($provide) {\n  'use strict';\n\n  $provide.decorator('$browser', ['$delegate', '$window', function($delegate, $window) {\n\n    if (isIOS9UIWebView($window.navigator.userAgent)) {\n      return applyIOS9Shim($delegate);\n    }\n\n    return $delegate;\n\n    function isIOS9UIWebView(userAgent) {\n      return /(iPhone|iPad|iPod).* OS 9_\\d/.test(userAgent) && !/Version\\/9\\./.test(userAgent);\n    }\n\n    function applyIOS9Shim(browser) {\n      var pendingLocationUrl = null;\n      var originalUrlFn = browser.url;\n\n      browser.url = function() {\n        if (arguments.length) {\n          pendingLocationUrl = arguments[0];\n          return originalUrlFn.apply(browser, arguments);\n        }\n\n        return pendingLocationUrl || originalUrlFn.apply(browser, arguments);\n      };\n\n      window.addEventListener('popstate', clearPendingLocationUrl, false);\n      window.addEventListener('hashchange', clearPendingLocationUrl, false);\n\n      function clearPendingLocationUrl() {\n        pendingLocationUrl = null;\n      }\n\n      return browser;\n    }\n  }]);\n}]);\n\n/**\n * @private\n * Parts of Ionic requires that $scope data is attached to the element.\n * We do not want to disable adding $scope data to the $element when\n * $compileProvider.debugInfoEnabled(false) is used.\n */\nIonicModule.config(['$provide', function($provide) {\n  $provide.decorator('$compile', ['$delegate', function($compile) {\n     $compile.$$addScopeInfo = function $$addScopeInfo($element, scope, isolated, noTemplate) {\n       var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';\n       $element.data(dataName, scope);\n     };\n     return $compile;\n  }]);\n}]);\n\n/**\n * @private\n */\nIonicModule.config([\n  '$provide',\nfunction($provide) {\n  function $LocationDecorator($location, $timeout) {\n\n    $location.__hash = $location.hash;\n    //Fix: when window.location.hash is set, the scrollable area\n    //found nearest to body's scrollTop is set to scroll to an element\n    //with that ID.\n    $location.hash = function(value) {\n      if (isDefined(value) && value.length > 0) {\n        $timeout(function() {\n          var scroll = document.querySelector('.scroll-content');\n          if (scroll) {\n            scroll.scrollTop = 0;\n          }\n        }, 0, false);\n      }\n      return $location.__hash(value);\n    };\n\n    return $location;\n  }\n\n  $provide.decorator('$location', ['$delegate', '$timeout', $LocationDecorator]);\n}]);\n\nIonicModule\n\n.controller('$ionicHeaderBar', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$q',\n  '$ionicConfig',\n  '$ionicHistory',\nfunction($scope, $element, $attrs, $q, $ionicConfig, $ionicHistory) {\n  var TITLE = 'title';\n  var BACK_TEXT = 'back-text';\n  var BACK_BUTTON = 'back-button';\n  var DEFAULT_TITLE = 'default-title';\n  var PREVIOUS_TITLE = 'previous-title';\n  var HIDE = 'hide';\n\n  var self = this;\n  var titleText = '';\n  var previousTitleText = '';\n  var titleLeft = 0;\n  var titleRight = 0;\n  var titleCss = '';\n  var isBackEnabled = false;\n  var isBackShown = true;\n  var isNavBackShown = true;\n  var isBackElementShown = false;\n  var titleTextWidth = 0;\n\n\n  self.beforeEnter = function(viewData) {\n    $scope.$broadcast('$ionicView.beforeEnter', viewData);\n  };\n\n\n  self.title = function(newTitleText) {\n    if (arguments.length && newTitleText !== titleText) {\n      getEle(TITLE).innerHTML = newTitleText;\n      titleText = newTitleText;\n      titleTextWidth = 0;\n    }\n    return titleText;\n  };\n\n\n  self.enableBack = function(shouldEnable, disableReset) {\n    // whether or not the back button show be visible, according\n    // to the navigation and history\n    if (arguments.length) {\n      isBackEnabled = shouldEnable;\n      if (!disableReset) self.updateBackButton();\n    }\n    return isBackEnabled;\n  };\n\n\n  self.showBack = function(shouldShow, disableReset) {\n    // different from enableBack() because this will always have the back\n    // visually hidden if false, even if the history says it should show\n    if (arguments.length) {\n      isBackShown = shouldShow;\n      if (!disableReset) self.updateBackButton();\n    }\n    return isBackShown;\n  };\n\n\n  self.showNavBack = function(shouldShow) {\n    // different from showBack() because this is for the entire nav bar's\n    // setting for all of it's child headers. For internal use.\n    isNavBackShown = shouldShow;\n    self.updateBackButton();\n  };\n\n\n  self.updateBackButton = function() {\n    var ele;\n    if ((isBackShown && isNavBackShown && isBackEnabled) !== isBackElementShown) {\n      isBackElementShown = isBackShown && isNavBackShown && isBackEnabled;\n      ele = getEle(BACK_BUTTON);\n      ele && ele.classList[ isBackElementShown ? 'remove' : 'add' ](HIDE);\n    }\n\n    if (isBackEnabled) {\n      ele = ele || getEle(BACK_BUTTON);\n      if (ele) {\n        if (self.backButtonIcon !== $ionicConfig.backButton.icon()) {\n          ele = getEle(BACK_BUTTON + ' .icon');\n          if (ele) {\n            self.backButtonIcon = $ionicConfig.backButton.icon();\n            ele.className = 'icon ' + self.backButtonIcon;\n          }\n        }\n\n        if (self.backButtonText !== $ionicConfig.backButton.text()) {\n          ele = getEle(BACK_BUTTON + ' .back-text');\n          if (ele) {\n            ele.textContent = self.backButtonText = $ionicConfig.backButton.text();\n          }\n        }\n      }\n    }\n  };\n\n\n  self.titleTextWidth = function() {\n    var element = getEle(TITLE);\n    if ( element ) {\n      // If the element has a nav-bar-title, use that instead\n      // to calculate the width of the title\n      var children = angular.element(element).children();\n      for ( var i = 0; i < children.length; i++ ) {\n        if ( angular.element(children[i]).hasClass('nav-bar-title') ) {\n          element = children[i];\n          break;\n        }\n      }\n    }\n    var bounds = ionic.DomUtil.getTextBounds(element);\n    titleTextWidth = Math.min(bounds && bounds.width || 30);\n    return titleTextWidth;\n  };\n\n\n  self.titleWidth = function() {\n    var titleWidth = self.titleTextWidth();\n    var offsetWidth = getEle(TITLE).offsetWidth;\n    if (offsetWidth < titleWidth) {\n      titleWidth = offsetWidth + (titleLeft - titleRight - 5);\n    }\n    return titleWidth;\n  };\n\n\n  self.titleTextX = function() {\n    return ($element[0].offsetWidth / 2) - (self.titleWidth() / 2);\n  };\n\n\n  self.titleLeftRight = function() {\n    return titleLeft - titleRight;\n  };\n\n\n  self.backButtonTextLeft = function() {\n    var offsetLeft = 0;\n    var ele = getEle(BACK_TEXT);\n    while (ele) {\n      offsetLeft += ele.offsetLeft;\n      ele = ele.parentElement;\n    }\n    return offsetLeft;\n  };\n\n\n  self.resetBackButton = function(viewData) {\n    if ($ionicConfig.backButton.previousTitleText()) {\n      var previousTitleEle = getEle(PREVIOUS_TITLE);\n      if (previousTitleEle) {\n        previousTitleEle.classList.remove(HIDE);\n\n        var view = (viewData && $ionicHistory.getViewById(viewData.viewId));\n        var newPreviousTitleText = $ionicHistory.backTitle(view);\n\n        if (newPreviousTitleText !== previousTitleText) {\n          previousTitleText = previousTitleEle.innerHTML = newPreviousTitleText;\n        }\n      }\n      var defaultTitleEle = getEle(DEFAULT_TITLE);\n      if (defaultTitleEle) {\n        defaultTitleEle.classList.remove(HIDE);\n      }\n    }\n  };\n\n\n  self.align = function(textAlign) {\n    var titleEle = getEle(TITLE);\n\n    textAlign = textAlign || $attrs.alignTitle || $ionicConfig.navBar.alignTitle();\n\n    var widths = self.calcWidths(textAlign, false);\n\n    if (isBackShown && previousTitleText && $ionicConfig.backButton.previousTitleText()) {\n      var previousTitleWidths = self.calcWidths(textAlign, true);\n\n      var availableTitleWidth = $element[0].offsetWidth - previousTitleWidths.titleLeft - previousTitleWidths.titleRight;\n\n      if (self.titleTextWidth() <= availableTitleWidth) {\n        widths = previousTitleWidths;\n      }\n    }\n\n    return self.updatePositions(titleEle, widths.titleLeft, widths.titleRight, widths.buttonsLeft, widths.buttonsRight, widths.css, widths.showPrevTitle);\n  };\n\n\n  self.calcWidths = function(textAlign, isPreviousTitle) {\n    var titleEle = getEle(TITLE);\n    var backBtnEle = getEle(BACK_BUTTON);\n    var x, y, z, b, c, d, childSize, bounds;\n    var childNodes = $element[0].childNodes;\n    var buttonsLeft = 0;\n    var buttonsRight = 0;\n    var isCountRightOfTitle;\n    var updateTitleLeft = 0;\n    var updateTitleRight = 0;\n    var updateCss = '';\n    var backButtonWidth = 0;\n\n    // Compute how wide the left children are\n    // Skip all titles (there may still be two titles, one leaving the dom)\n    // Once we encounter a titleEle, realize we are now counting the right-buttons, not left\n    for (x = 0; x < childNodes.length; x++) {\n      c = childNodes[x];\n\n      childSize = 0;\n      if (c.nodeType == 1) {\n        // element node\n        if (c === titleEle) {\n          isCountRightOfTitle = true;\n          continue;\n        }\n\n        if (c.classList.contains(HIDE)) {\n          continue;\n        }\n\n        if (isBackShown && c === backBtnEle) {\n\n          for (y = 0; y < c.childNodes.length; y++) {\n            b = c.childNodes[y];\n\n            if (b.nodeType == 1) {\n\n              if (b.classList.contains(BACK_TEXT)) {\n                for (z = 0; z < b.children.length; z++) {\n                  d = b.children[z];\n\n                  if (isPreviousTitle) {\n                    if (d.classList.contains(DEFAULT_TITLE)) continue;\n                    backButtonWidth += d.offsetWidth;\n                  } else {\n                    if (d.classList.contains(PREVIOUS_TITLE)) continue;\n                    backButtonWidth += d.offsetWidth;\n                  }\n                }\n\n              } else {\n                backButtonWidth += b.offsetWidth;\n              }\n\n            } else if (b.nodeType == 3 && b.nodeValue.trim()) {\n              bounds = ionic.DomUtil.getTextBounds(b);\n              backButtonWidth += bounds && bounds.width || 0;\n            }\n\n          }\n          childSize = backButtonWidth || c.offsetWidth;\n\n        } else {\n          // not the title, not the back button, not a hidden element\n          childSize = c.offsetWidth;\n        }\n\n      } else if (c.nodeType == 3 && c.nodeValue.trim()) {\n        // text node\n        bounds = ionic.DomUtil.getTextBounds(c);\n        childSize = bounds && bounds.width || 0;\n      }\n\n      if (isCountRightOfTitle) {\n        buttonsRight += childSize;\n      } else {\n        buttonsLeft += childSize;\n      }\n    }\n\n    // Size and align the header titleEle based on the sizes of the left and\n    // right children, and the desired alignment mode\n    if (textAlign == 'left') {\n      updateCss = 'title-left';\n      if (buttonsLeft) {\n        updateTitleLeft = buttonsLeft + 15;\n      }\n      if (buttonsRight) {\n        updateTitleRight = buttonsRight + 15;\n      }\n\n    } else if (textAlign == 'right') {\n      updateCss = 'title-right';\n      if (buttonsLeft) {\n        updateTitleLeft = buttonsLeft + 15;\n      }\n      if (buttonsRight) {\n        updateTitleRight = buttonsRight + 15;\n      }\n\n    } else {\n      // center the default\n      var margin = Math.max(buttonsLeft, buttonsRight) + 10;\n      if (margin > 10) {\n        updateTitleLeft = updateTitleRight = margin;\n      }\n    }\n\n    return {\n      backButtonWidth: backButtonWidth,\n      buttonsLeft: buttonsLeft,\n      buttonsRight: buttonsRight,\n      titleLeft: updateTitleLeft,\n      titleRight: updateTitleRight,\n      showPrevTitle: isPreviousTitle,\n      css: updateCss\n    };\n  };\n\n\n  self.updatePositions = function(titleEle, updateTitleLeft, updateTitleRight, buttonsLeft, buttonsRight, updateCss, showPreviousTitle) {\n    var deferred = $q.defer();\n\n    // only make DOM updates when there are actual changes\n    if (titleEle) {\n      if (updateTitleLeft !== titleLeft) {\n        titleEle.style.left = updateTitleLeft ? updateTitleLeft + 'px' : '';\n        titleLeft = updateTitleLeft;\n      }\n      if (updateTitleRight !== titleRight) {\n        titleEle.style.right = updateTitleRight ? updateTitleRight + 'px' : '';\n        titleRight = updateTitleRight;\n      }\n\n      if (updateCss !== titleCss) {\n        updateCss && titleEle.classList.add(updateCss);\n        titleCss && titleEle.classList.remove(titleCss);\n        titleCss = updateCss;\n      }\n    }\n\n    if ($ionicConfig.backButton.previousTitleText()) {\n      var prevTitle = getEle(PREVIOUS_TITLE);\n      var defaultTitle = getEle(DEFAULT_TITLE);\n\n      prevTitle && prevTitle.classList[ showPreviousTitle ? 'remove' : 'add'](HIDE);\n      defaultTitle && defaultTitle.classList[ showPreviousTitle ? 'add' : 'remove'](HIDE);\n    }\n\n    ionic.requestAnimationFrame(function() {\n      if (titleEle && titleEle.offsetWidth + 10 < titleEle.scrollWidth) {\n        var minRight = buttonsRight + 5;\n        var testRight = $element[0].offsetWidth - titleLeft - self.titleTextWidth() - 20;\n        updateTitleRight = testRight < minRight ? minRight : testRight;\n        if (updateTitleRight !== titleRight) {\n          titleEle.style.right = updateTitleRight + 'px';\n          titleRight = updateTitleRight;\n        }\n      }\n      deferred.resolve();\n    });\n\n    return deferred.promise;\n  };\n\n\n  self.setCss = function(elementClassname, css) {\n    ionic.DomUtil.cachedStyles(getEle(elementClassname), css);\n  };\n\n\n  var eleCache = {};\n  function getEle(className) {\n    if (!eleCache[className]) {\n      eleCache[className] = $element[0].querySelector('.' + className);\n    }\n    return eleCache[className];\n  }\n\n\n  $scope.$on('$destroy', function() {\n    for (var n in eleCache) eleCache[n] = null;\n  });\n\n}]);\n\nIonicModule\n.controller('$ionInfiniteScroll', [\n  '$scope',\n  '$attrs',\n  '$element',\n  '$timeout',\nfunction($scope, $attrs, $element, $timeout) {\n  var self = this;\n  self.isLoading = false;\n\n  $scope.icon = function() {\n    return isDefined($attrs.icon) ? $attrs.icon : 'ion-load-d';\n  };\n\n  $scope.spinner = function() {\n    return isDefined($attrs.spinner) ? $attrs.spinner : '';\n  };\n\n  $scope.$on('scroll.infiniteScrollComplete', function() {\n    finishInfiniteScroll();\n  });\n\n  $scope.$on('$destroy', function() {\n    if (self.scrollCtrl && self.scrollCtrl.$element) self.scrollCtrl.$element.off('scroll', self.checkBounds);\n    if (self.scrollEl && self.scrollEl.removeEventListener) {\n      self.scrollEl.removeEventListener('scroll', self.checkBounds);\n    }\n  });\n\n  // debounce checking infinite scroll events\n  self.checkBounds = ionic.Utils.throttle(checkInfiniteBounds, 300);\n\n  function onInfinite() {\n    ionic.requestAnimationFrame(function() {\n      $element[0].classList.add('active');\n    });\n    self.isLoading = true;\n    $scope.$parent && $scope.$parent.$apply($attrs.onInfinite || '');\n  }\n\n  function finishInfiniteScroll() {\n    ionic.requestAnimationFrame(function() {\n      $element[0].classList.remove('active');\n    });\n    $timeout(function() {\n      if (self.jsScrolling) self.scrollView.resize();\n      // only check bounds again immediately if the page isn't cached (scroll el has height)\n      if ((self.jsScrolling && self.scrollView.__container && self.scrollView.__container.offsetHeight > 0) ||\n      !self.jsScrolling) {\n        self.checkBounds();\n      }\n    }, 30, false);\n    self.isLoading = false;\n  }\n\n  // check if we've scrolled far enough to trigger an infinite scroll\n  function checkInfiniteBounds() {\n    if (self.isLoading) return;\n    var maxScroll = {};\n\n    if (self.jsScrolling) {\n      maxScroll = self.getJSMaxScroll();\n      var scrollValues = self.scrollView.getValues();\n      if ((maxScroll.left !== -1 && scrollValues.left >= maxScroll.left) ||\n        (maxScroll.top !== -1 && scrollValues.top >= maxScroll.top)) {\n        onInfinite();\n      }\n    } else {\n      maxScroll = self.getNativeMaxScroll();\n      if ((\n        maxScroll.left !== -1 &&\n        self.scrollEl.scrollLeft >= maxScroll.left - self.scrollEl.clientWidth\n        ) || (\n        maxScroll.top !== -1 &&\n        self.scrollEl.scrollTop >= maxScroll.top - self.scrollEl.clientHeight\n        )) {\n        onInfinite();\n      }\n    }\n  }\n\n  // determine the threshold at which we should fire an infinite scroll\n  // note: this gets processed every scroll event, can it be cached?\n  self.getJSMaxScroll = function() {\n    var maxValues = self.scrollView.getScrollMax();\n    return {\n      left: self.scrollView.options.scrollingX ?\n        calculateMaxValue(maxValues.left) :\n        -1,\n      top: self.scrollView.options.scrollingY ?\n        calculateMaxValue(maxValues.top) :\n        -1\n    };\n  };\n\n  self.getNativeMaxScroll = function() {\n    var maxValues = {\n      left: self.scrollEl.scrollWidth,\n      top: self.scrollEl.scrollHeight\n    };\n    var computedStyle = window.getComputedStyle(self.scrollEl) || {};\n    return {\n      left: maxValues.left &&\n        (computedStyle.overflowX === 'scroll' ||\n        computedStyle.overflowX === 'auto' ||\n        self.scrollEl.style['overflow-x'] === 'scroll') ?\n        calculateMaxValue(maxValues.left) : -1,\n      top: maxValues.top &&\n        (computedStyle.overflowY === 'scroll' ||\n        computedStyle.overflowY === 'auto' ||\n        self.scrollEl.style['overflow-y'] === 'scroll' ) ?\n        calculateMaxValue(maxValues.top) : -1\n    };\n  };\n\n  // determine pixel refresh distance based on % or value\n  function calculateMaxValue(maximum) {\n    var distance = ($attrs.distance || '2.5%').trim();\n    var isPercent = distance.indexOf('%') !== -1;\n    return isPercent ?\n    maximum * (1 - parseFloat(distance) / 100) :\n    maximum - parseFloat(distance);\n  }\n\n  //for testing\n  self.__finishInfiniteScroll = finishInfiniteScroll;\n\n}]);\n\n/**\n * @ngdoc service\n * @name $ionicListDelegate\n * @module ionic\n *\n * @description\n * Delegate for controlling the {@link ionic.directive:ionList} directive.\n *\n * Methods called directly on the $ionicListDelegate service will control all lists.\n * Use the {@link ionic.service:$ionicListDelegate#$getByHandle $getByHandle}\n * method to control specific ionList instances.\n *\n * @usage\n * ```html\n * {% raw %}\n * <ion-content ng-controller=\"MyCtrl\">\n *   <button class=\"button\" ng-click=\"showDeleteButtons()\"></button>\n *   <ion-list>\n *     <ion-item ng-repeat=\"i in items\">\n *       Hello, {{i}}!\n *       <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n *     </ion-item>\n *   </ion-list>\n * </ion-content>\n * {% endraw %}\n * ```\n\n * ```js\n * function MyCtrl($scope, $ionicListDelegate) {\n *   $scope.showDeleteButtons = function() {\n *     $ionicListDelegate.showDelete(true);\n *   };\n * }\n * ```\n */\nIonicModule.service('$ionicListDelegate', ionic.DelegateService([\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showReorder\n   * @param {boolean=} showReorder Set whether or not this list is showing its reorder buttons.\n   * @returns {boolean} Whether the reorder buttons are shown.\n   */\n  'showReorder',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#showDelete\n   * @param {boolean=} showDelete Set whether or not this list is showing its delete buttons.\n   * @returns {boolean} Whether the delete buttons are shown.\n   */\n  'showDelete',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#canSwipeItems\n   * @param {boolean=} canSwipeItems Set whether or not this list is able to swipe to show\n   * option buttons.\n   * @returns {boolean} Whether the list is able to swipe to show option buttons.\n   */\n  'canSwipeItems',\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#closeOptionButtons\n   * @description Closes any option buttons on the list that are swiped open.\n   */\n  'closeOptionButtons'\n  /**\n   * @ngdoc method\n   * @name $ionicListDelegate#$getByHandle\n   * @param {string} handle\n   * @returns `delegateInstance` A delegate instance that controls only the\n   * {@link ionic.directive:ionList} directives with `delegate-handle` matching\n   * the given handle.\n   *\n   * Example: `$ionicListDelegate.$getByHandle('my-handle').showReorder(true);`\n   */\n]))\n\n.controller('$ionicList', [\n  '$scope',\n  '$attrs',\n  '$ionicListDelegate',\n  '$ionicHistory',\nfunction($scope, $attrs, $ionicListDelegate, $ionicHistory) {\n  var self = this;\n  var isSwipeable = true;\n  var isReorderShown = false;\n  var isDeleteShown = false;\n\n  var deregisterInstance = $ionicListDelegate._registerInstance(\n    self, $attrs.delegateHandle, function() {\n      return $ionicHistory.isActiveScope($scope);\n    }\n  );\n  $scope.$on('$destroy', deregisterInstance);\n\n  self.showReorder = function(show) {\n    if (arguments.length) {\n      isReorderShown = !!show;\n    }\n    return isReorderShown;\n  };\n\n  self.showDelete = function(show) {\n    if (arguments.length) {\n      isDeleteShown = !!show;\n    }\n    return isDeleteShown;\n  };\n\n  self.canSwipeItems = function(can) {\n    if (arguments.length) {\n      isSwipeable = !!can;\n    }\n    return isSwipeable;\n  };\n\n  self.closeOptionButtons = function() {\n    self.listView && self.listView.clearDragEffects();\n  };\n}]);\n\nIonicModule\n\n.controller('$ionicNavBar', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$compile',\n  '$timeout',\n  '$ionicNavBarDelegate',\n  '$ionicConfig',\n  '$ionicHistory',\nfunction($scope, $element, $attrs, $compile, $timeout, $ionicNavBarDelegate, $ionicConfig, $ionicHistory) {\n\n  var CSS_HIDE = 'hide';\n  var DATA_NAV_BAR_CTRL = '$ionNavBarController';\n  var PRIMARY_BUTTONS = 'primaryButtons';\n  var SECONDARY_BUTTONS = 'secondaryButtons';\n  var BACK_BUTTON = 'backButton';\n  var ITEM_TYPES = 'primaryButtons secondaryButtons leftButtons rightButtons title'.split(' ');\n\n  var self = this;\n  var headerBars = [];\n  var navElementHtml = {};\n  var isVisible = true;\n  var queuedTransitionStart, queuedTransitionEnd, latestTransitionId;\n\n  $element.parent().data(DATA_NAV_BAR_CTRL, self);\n\n  var delegateHandle = $attrs.delegateHandle || 'navBar' + ionic.Utils.nextUid();\n\n  var deregisterInstance = $ionicNavBarDelegate._registerInstance(self, delegateHandle);\n\n\n  self.init = function() {\n    $element.addClass('nav-bar-container');\n    ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', $ionicConfig.views.transition());\n\n    // create two nav bar blocks which will trade out which one is shown\n    self.createHeaderBar(false);\n    self.createHeaderBar(true);\n\n    $scope.$emit('ionNavBar.init', delegateHandle);\n  };\n\n\n  self.createHeaderBar = function(isActive) {\n    var containerEle = jqLite('<div class=\"nav-bar-block\">');\n    ionic.DomUtil.cachedAttr(containerEle, 'nav-bar', isActive ? 'active' : 'cached');\n\n    var alignTitle = $attrs.alignTitle || $ionicConfig.navBar.alignTitle();\n    var headerBarEle = jqLite('<ion-header-bar>').addClass($attrs['class']).attr('align-title', alignTitle);\n    if (isDefined($attrs.noTapScroll)) headerBarEle.attr('no-tap-scroll', $attrs.noTapScroll);\n    var titleEle = jqLite('<div class=\"title title-' + alignTitle + '\">');\n    var navEle = {};\n    var lastViewItemEle = {};\n    var leftButtonsEle, rightButtonsEle;\n\n    navEle[BACK_BUTTON] = createNavElement(BACK_BUTTON);\n    navEle[BACK_BUTTON] && headerBarEle.append(navEle[BACK_BUTTON]);\n\n    // append title in the header, this is the rock to where buttons append\n    headerBarEle.append(titleEle);\n\n    forEach(ITEM_TYPES, function(itemType) {\n      // create default button elements\n      navEle[itemType] = createNavElement(itemType);\n      // append and position buttons\n      positionItem(navEle[itemType], itemType);\n    });\n\n    // add header-item to the root children\n    for (var x = 0; x < headerBarEle[0].children.length; x++) {\n      headerBarEle[0].children[x].classList.add('header-item');\n    }\n\n    // compile header and append to the DOM\n    containerEle.append(headerBarEle);\n    $element.append($compile(containerEle)($scope.$new()));\n\n    var headerBarCtrl = headerBarEle.data('$ionHeaderBarController');\n    headerBarCtrl.backButtonIcon = $ionicConfig.backButton.icon();\n    headerBarCtrl.backButtonText = $ionicConfig.backButton.text();\n\n    var headerBarInstance = {\n      isActive: isActive,\n      title: function(newTitleText) {\n        headerBarCtrl.title(newTitleText);\n      },\n      setItem: function(navBarItemEle, itemType) {\n        // first make sure any exiting nav bar item has been removed\n        headerBarInstance.removeItem(itemType);\n\n        if (navBarItemEle) {\n          if (itemType === 'title') {\n            // clear out the text based title\n            headerBarInstance.title(\"\");\n          }\n\n          // there's a custom nav bar item\n          positionItem(navBarItemEle, itemType);\n\n          if (navEle[itemType]) {\n            // make sure the default on this itemType is hidden\n            navEle[itemType].addClass(CSS_HIDE);\n          }\n          lastViewItemEle[itemType] = navBarItemEle;\n\n        } else if (navEle[itemType]) {\n          // there's a default button for this side and no view button\n          navEle[itemType].removeClass(CSS_HIDE);\n        }\n      },\n      removeItem: function(itemType) {\n        if (lastViewItemEle[itemType]) {\n          lastViewItemEle[itemType].scope().$destroy();\n          lastViewItemEle[itemType].remove();\n          lastViewItemEle[itemType] = null;\n        }\n      },\n      containerEle: function() {\n        return containerEle;\n      },\n      headerBarEle: function() {\n        return headerBarEle;\n      },\n      afterLeave: function() {\n        forEach(ITEM_TYPES, function(itemType) {\n          headerBarInstance.removeItem(itemType);\n        });\n        headerBarCtrl.resetBackButton();\n      },\n      controller: function() {\n        return headerBarCtrl;\n      },\n      destroy: function() {\n        forEach(ITEM_TYPES, function(itemType) {\n          headerBarInstance.removeItem(itemType);\n        });\n        containerEle.scope().$destroy();\n        for (var n in navEle) {\n          if (navEle[n]) {\n            navEle[n].removeData();\n            navEle[n] = null;\n          }\n        }\n        leftButtonsEle && leftButtonsEle.removeData();\n        rightButtonsEle && rightButtonsEle.removeData();\n        titleEle.removeData();\n        headerBarEle.removeData();\n        containerEle.remove();\n        containerEle = headerBarEle = titleEle = leftButtonsEle = rightButtonsEle = null;\n      }\n    };\n\n    function positionItem(ele, itemType) {\n      if (!ele) return;\n\n      if (itemType === 'title') {\n        // title element\n        titleEle.append(ele);\n\n      } else if (itemType == 'rightButtons' ||\n                (itemType == SECONDARY_BUTTONS && $ionicConfig.navBar.positionSecondaryButtons() != 'left') ||\n                (itemType == PRIMARY_BUTTONS && $ionicConfig.navBar.positionPrimaryButtons() == 'right')) {\n        // right side\n        if (!rightButtonsEle) {\n          rightButtonsEle = jqLite('<div class=\"buttons buttons-right\">');\n          headerBarEle.append(rightButtonsEle);\n        }\n        if (itemType == SECONDARY_BUTTONS) {\n          rightButtonsEle.append(ele);\n        } else {\n          rightButtonsEle.prepend(ele);\n        }\n\n      } else {\n        // left side\n        if (!leftButtonsEle) {\n          leftButtonsEle = jqLite('<div class=\"buttons buttons-left\">');\n          if (navEle[BACK_BUTTON]) {\n            navEle[BACK_BUTTON].after(leftButtonsEle);\n          } else {\n            headerBarEle.prepend(leftButtonsEle);\n          }\n        }\n        if (itemType == SECONDARY_BUTTONS) {\n          leftButtonsEle.append(ele);\n        } else {\n          leftButtonsEle.prepend(ele);\n        }\n      }\n\n    }\n\n    headerBars.push(headerBarInstance);\n\n    return headerBarInstance;\n  };\n\n\n  self.navElement = function(type, html) {\n    if (isDefined(html)) {\n      navElementHtml[type] = html;\n    }\n    return navElementHtml[type];\n  };\n\n\n  self.update = function(viewData) {\n    var showNavBar = !viewData.hasHeaderBar && viewData.showNavBar;\n    viewData.transition = $ionicConfig.views.transition();\n\n    if (!showNavBar) {\n      viewData.direction = 'none';\n    }\n\n    self.enable(showNavBar);\n    var enteringHeaderBar = self.isInitialized ? getOffScreenHeaderBar() : getOnScreenHeaderBar();\n    var leavingHeaderBar = self.isInitialized ? getOnScreenHeaderBar() : null;\n    var enteringHeaderCtrl = enteringHeaderBar.controller();\n\n    // update if the entering header should show the back button or not\n    enteringHeaderCtrl.enableBack(viewData.enableBack, true);\n    enteringHeaderCtrl.showBack(viewData.showBack, true);\n    enteringHeaderCtrl.updateBackButton();\n\n    // update the entering header bar's title\n    self.title(viewData.title, enteringHeaderBar);\n\n    self.showBar(showNavBar);\n\n    // update the nav bar items, depending if the view has their own or not\n    if (viewData.navBarItems) {\n      forEach(ITEM_TYPES, function(itemType) {\n        enteringHeaderBar.setItem(viewData.navBarItems[itemType], itemType);\n      });\n    }\n\n    // begin transition of entering and leaving header bars\n    self.transition(enteringHeaderBar, leavingHeaderBar, viewData);\n\n    self.isInitialized = true;\n    navSwipeAttr('');\n  };\n\n\n  self.transition = function(enteringHeaderBar, leavingHeaderBar, viewData) {\n    var enteringHeaderBarCtrl = enteringHeaderBar.controller();\n    var transitionFn = $ionicConfig.transitions.navBar[viewData.navBarTransition] || $ionicConfig.transitions.navBar.none;\n    var transitionId = viewData.transitionId;\n\n    enteringHeaderBarCtrl.beforeEnter(viewData);\n\n    var navBarTransition = transitionFn(enteringHeaderBar, leavingHeaderBar, viewData.direction, viewData.shouldAnimate && self.isInitialized);\n\n    ionic.DomUtil.cachedAttr($element, 'nav-bar-transition', viewData.navBarTransition);\n    ionic.DomUtil.cachedAttr($element, 'nav-bar-direction', viewData.direction);\n\n    if (navBarTransition.shouldAnimate && viewData.renderEnd) {\n      navBarAttr(enteringHeaderBar, 'stage');\n    } else {\n      navBarAttr(enteringHeaderBar, 'entering');\n      navBarAttr(leavingHeaderBar, 'leaving');\n    }\n\n    enteringHeaderBarCtrl.resetBackButton(viewData);\n\n    navBarTransition.run(0);\n\n    self.activeTransition = {\n      run: function(step) {\n        navBarTransition.shouldAnimate = false;\n        navBarTransition.direction = 'back';\n        navBarTransition.run(step);\n      },\n      cancel: function(shouldAnimate, speed, cancelData) {\n        navSwipeAttr(speed);\n        navBarAttr(leavingHeaderBar, 'active');\n        navBarAttr(enteringHeaderBar, 'cached');\n        navBarTransition.shouldAnimate = shouldAnimate;\n        navBarTransition.run(0);\n        self.activeTransition = navBarTransition = null;\n\n        var runApply;\n        if (cancelData.showBar !== self.showBar()) {\n          self.showBar(cancelData.showBar);\n        }\n        if (cancelData.showBackButton !== self.showBackButton()) {\n          self.showBackButton(cancelData.showBackButton);\n        }\n        if (runApply) {\n          $scope.$apply();\n        }\n      },\n      complete: function(shouldAnimate, speed) {\n        navSwipeAttr(speed);\n        navBarTransition.shouldAnimate = shouldAnimate;\n        navBarTransition.run(1);\n        queuedTransitionEnd = transitionEnd;\n      }\n    };\n\n    $timeout(enteringHeaderBarCtrl.align, 16);\n\n    queuedTransitionStart = function() {\n      if (latestTransitionId !== transitionId) return;\n\n      navBarAttr(enteringHeaderBar, 'entering');\n      navBarAttr(leavingHeaderBar, 'leaving');\n\n      navBarTransition.run(1);\n\n      queuedTransitionEnd = function() {\n        if (latestTransitionId == transitionId || !navBarTransition.shouldAnimate) {\n          transitionEnd();\n        }\n      };\n\n      queuedTransitionStart = null;\n    };\n\n    function transitionEnd() {\n      for (var x = 0; x < headerBars.length; x++) {\n        headerBars[x].isActive = false;\n      }\n      enteringHeaderBar.isActive = true;\n\n      navBarAttr(enteringHeaderBar, 'active');\n      navBarAttr(leavingHeaderBar, 'cached');\n\n      self.activeTransition = navBarTransition = queuedTransitionEnd = null;\n    }\n\n    queuedTransitionStart();\n  };\n\n\n  self.triggerTransitionStart = function(triggerTransitionId) {\n    latestTransitionId = triggerTransitionId;\n    queuedTransitionStart && queuedTransitionStart();\n  };\n\n\n  self.triggerTransitionEnd = function() {\n    queuedTransitionEnd && queuedTransitionEnd();\n  };\n\n\n  self.showBar = function(shouldShow) {\n    if (arguments.length) {\n      self.visibleBar(shouldShow);\n      $scope.$parent.$hasHeader = !!shouldShow;\n    }\n    return !!$scope.$parent.$hasHeader;\n  };\n\n\n  self.visibleBar = function(shouldShow) {\n    if (shouldShow && !isVisible) {\n      $element.removeClass(CSS_HIDE);\n      self.align();\n    } else if (!shouldShow && isVisible) {\n      $element.addClass(CSS_HIDE);\n    }\n    isVisible = shouldShow;\n  };\n\n\n  self.enable = function(val) {\n    // set primary to show first\n    self.visibleBar(val);\n\n    // set non primary to hide second\n    for (var x = 0; x < $ionicNavBarDelegate._instances.length; x++) {\n      if ($ionicNavBarDelegate._instances[x] !== self) $ionicNavBarDelegate._instances[x].visibleBar(false);\n    }\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavBar#showBackButton\n   * @description Show/hide the nav bar back button when there is a\n   * back view. If the back button is not possible, for example, the\n   * first view in the stack, then this will not force the back button\n   * to show.\n   */\n  self.showBackButton = function(shouldShow) {\n    if (arguments.length) {\n      for (var x = 0; x < headerBars.length; x++) {\n        headerBars[x].controller().showNavBack(!!shouldShow);\n      }\n      $scope.$isBackButtonShown = !!shouldShow;\n    }\n    return $scope.$isBackButtonShown;\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavBar#showActiveBackButton\n   * @description Show/hide only the active header bar's back button.\n   */\n  self.showActiveBackButton = function(shouldShow) {\n    var headerBar = getOnScreenHeaderBar();\n    if (headerBar) {\n      if (arguments.length) {\n        return headerBar.controller().showBack(shouldShow);\n      }\n      return headerBar.controller().showBack();\n    }\n  };\n\n\n  self.title = function(newTitleText, headerBar) {\n    if (isDefined(newTitleText)) {\n      newTitleText = newTitleText || '';\n      headerBar = headerBar || getOnScreenHeaderBar();\n      headerBar && headerBar.title(newTitleText);\n      $scope.$title = newTitleText;\n      $ionicHistory.currentTitle(newTitleText);\n    }\n    return $scope.$title;\n  };\n\n\n  self.align = function(val, headerBar) {\n    headerBar = headerBar || getOnScreenHeaderBar();\n    headerBar && headerBar.controller().align(val);\n  };\n\n\n  self.hasTabsTop = function(isTabsTop) {\n    $element[isTabsTop ? 'addClass' : 'removeClass']('nav-bar-tabs-top');\n  };\n\n  self.hasBarSubheader = function(isBarSubheader) {\n    $element[isBarSubheader ? 'addClass' : 'removeClass']('nav-bar-has-subheader');\n  };\n\n  // DEPRECATED, as of v1.0.0-beta14 -------\n  self.changeTitle = function(val) {\n    deprecatedWarning('changeTitle(val)', 'title(val)');\n    self.title(val);\n  };\n  self.setTitle = function(val) {\n    deprecatedWarning('setTitle(val)', 'title(val)');\n    self.title(val);\n  };\n  self.getTitle = function() {\n    deprecatedWarning('getTitle()', 'title()');\n    return self.title();\n  };\n  self.back = function() {\n    deprecatedWarning('back()', '$ionicHistory.goBack()');\n    $ionicHistory.goBack();\n  };\n  self.getPreviousTitle = function() {\n    deprecatedWarning('getPreviousTitle()', '$ionicHistory.backTitle()');\n    $ionicHistory.goBack();\n  };\n  function deprecatedWarning(oldMethod, newMethod) {\n    var warn = console.warn || console.log;\n    warn && warn.call(console, 'navBarController.' + oldMethod + ' is deprecated, please use ' + newMethod + ' instead');\n  }\n  // END DEPRECATED -------\n\n\n  function createNavElement(type) {\n    if (navElementHtml[type]) {\n      return jqLite(navElementHtml[type]);\n    }\n  }\n\n\n  function getOnScreenHeaderBar() {\n    for (var x = 0; x < headerBars.length; x++) {\n      if (headerBars[x].isActive) return headerBars[x];\n    }\n  }\n\n\n  function getOffScreenHeaderBar() {\n    for (var x = 0; x < headerBars.length; x++) {\n      if (!headerBars[x].isActive) return headerBars[x];\n    }\n  }\n\n\n  function navBarAttr(ctrl, val) {\n    ctrl && ionic.DomUtil.cachedAttr(ctrl.containerEle(), 'nav-bar', val);\n  }\n\n  function navSwipeAttr(val) {\n    ionic.DomUtil.cachedAttr($element, 'nav-swipe', val);\n  }\n\n\n  $scope.$on('$destroy', function() {\n    $scope.$parent.$hasHeader = false;\n    $element.parent().removeData(DATA_NAV_BAR_CTRL);\n    for (var x = 0; x < headerBars.length; x++) {\n      headerBars[x].destroy();\n    }\n    $element.remove();\n    $element = headerBars = null;\n    deregisterInstance();\n  });\n\n}]);\n\nIonicModule\n.controller('$ionicNavView', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$compile',\n  '$controller',\n  '$ionicNavBarDelegate',\n  '$ionicNavViewDelegate',\n  '$ionicHistory',\n  '$ionicViewSwitcher',\n  '$ionicConfig',\n  '$ionicScrollDelegate',\n  '$ionicSideMenuDelegate',\nfunction($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate, $ionicNavViewDelegate, $ionicHistory, $ionicViewSwitcher, $ionicConfig, $ionicScrollDelegate, $ionicSideMenuDelegate) {\n\n  var DATA_ELE_IDENTIFIER = '$eleId';\n  var DATA_DESTROY_ELE = '$destroyEle';\n  var DATA_NO_CACHE = '$noCache';\n  var VIEW_STATUS_ACTIVE = 'active';\n  var VIEW_STATUS_CACHED = 'cached';\n\n  var self = this;\n  var direction;\n  var isPrimary = false;\n  var navBarDelegate;\n  var activeEleId;\n  var navViewAttr = $ionicViewSwitcher.navViewAttr;\n  var disableRenderStartViewId, disableAnimation;\n\n  self.scope = $scope;\n  self.element = $element;\n\n  self.init = function() {\n    var navViewName = $attrs.name || '';\n\n    // Find the details of the parent view directive (if any) and use it\n    // to derive our own qualified view name, then hang our own details\n    // off the DOM so child directives can find it.\n    var parent = $element.parent().inheritedData('$uiView');\n    var parentViewName = ((parent && parent.state) ? parent.state.name : '');\n    if (navViewName.indexOf('@') < 0) navViewName = navViewName + '@' + parentViewName;\n\n    var viewData = { name: navViewName, state: null };\n    $element.data('$uiView', viewData);\n\n    var deregisterInstance = $ionicNavViewDelegate._registerInstance(self, $attrs.delegateHandle);\n    $scope.$on('$destroy', function() {\n      deregisterInstance();\n\n      // ensure no scrolls have been left frozen\n      if (self.isSwipeFreeze) {\n        $ionicScrollDelegate.freezeAllScrolls(false);\n      }\n    });\n\n    $scope.$on('$ionicHistory.deselect', self.cacheCleanup);\n    $scope.$on('$ionicTabs.top', onTabsTop);\n    $scope.$on('$ionicSubheader', onBarSubheader);\n\n    $scope.$on('$ionicTabs.beforeLeave', onTabsLeave);\n    $scope.$on('$ionicTabs.afterLeave', onTabsLeave);\n    $scope.$on('$ionicTabs.leave', onTabsLeave);\n\n    ionic.Platform.ready(function() {\n      if ( ionic.Platform.isWebView() && ionic.Platform.isIOS() ) {\n          self.initSwipeBack();\n      }\n    });\n\n    return viewData;\n  };\n\n\n  self.register = function(viewLocals) {\n    var leavingView = extend({}, $ionicHistory.currentView());\n\n    // register that a view is coming in and get info on how it should transition\n    var registerData = $ionicHistory.register($scope, viewLocals);\n\n    // update which direction\n    self.update(registerData);\n\n    // begin rendering and transitioning\n    var enteringView = $ionicHistory.getViewById(registerData.viewId) || {};\n\n    var renderStart = (disableRenderStartViewId !== registerData.viewId);\n    self.render(registerData, viewLocals, enteringView, leavingView, renderStart, true);\n  };\n\n\n  self.update = function(registerData) {\n    // always reset that this is the primary navView\n    isPrimary = true;\n\n    // remember what direction this navView should use\n    // this may get updated later by a child navView\n    direction = registerData.direction;\n\n    var parentNavViewCtrl = $element.parent().inheritedData('$ionNavViewController');\n    if (parentNavViewCtrl) {\n      // this navView is nested inside another one\n      // update the parent to use this direction and not\n      // the other it originally was set to\n\n      // inform the parent navView that it is not the primary navView\n      parentNavViewCtrl.isPrimary(false);\n\n      if (direction === 'enter' || direction === 'exit') {\n        // they're entering/exiting a history\n        // find parent navViewController\n        parentNavViewCtrl.direction(direction);\n\n        if (direction === 'enter') {\n          // reset the direction so this navView doesn't animate\n          // because it's parent will\n          direction = 'none';\n        }\n      }\n    }\n  };\n\n\n  self.render = function(registerData, viewLocals, enteringView, leavingView, renderStart, renderEnd) {\n    // register the view and figure out where it lives in the various\n    // histories and nav stacks, along with how views should enter/leave\n    var switcher = $ionicViewSwitcher.create(self, viewLocals, enteringView, leavingView, renderStart, renderEnd);\n\n    // init the rendering of views for this navView directive\n    switcher.init(registerData, function() {\n      // the view is now compiled, in the dom and linked, now lets transition the views.\n      // this uses a callback incase THIS nav-view has a nested nav-view, and after the NESTED\n      // nav-view links, the NESTED nav-view would update which direction THIS nav-view should use\n\n      // kick off the transition of views\n      switcher.transition(self.direction(), registerData.enableBack, !disableAnimation);\n\n      // reset private vars for next time\n      disableRenderStartViewId = disableAnimation = null;\n    });\n\n  };\n\n\n  self.beforeEnter = function(transitionData) {\n    if (isPrimary) {\n      // only update this nav-view's nav-bar if this is the primary nav-view\n      navBarDelegate = transitionData.navBarDelegate;\n      var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n      associatedNavBarCtrl && associatedNavBarCtrl.update(transitionData);\n      navSwipeAttr('');\n    }\n  };\n\n\n  self.activeEleId = function(eleId) {\n    if (arguments.length) {\n      activeEleId = eleId;\n    }\n    return activeEleId;\n  };\n\n\n  self.transitionEnd = function() {\n    var viewElements = $element.children();\n    var x, l, viewElement;\n\n    for (x = 0, l = viewElements.length; x < l; x++) {\n      viewElement = viewElements.eq(x);\n\n      if (viewElement.data(DATA_ELE_IDENTIFIER) === activeEleId) {\n        // this is the active element\n        navViewAttr(viewElement, VIEW_STATUS_ACTIVE);\n\n      } else if (navViewAttr(viewElement) === 'leaving' || navViewAttr(viewElement) === VIEW_STATUS_ACTIVE || navViewAttr(viewElement) === VIEW_STATUS_CACHED) {\n        // this is a leaving element or was the former active element, or is an cached element\n        if (viewElement.data(DATA_DESTROY_ELE) || viewElement.data(DATA_NO_CACHE)) {\n          // this element shouldn't stay cached\n          $ionicViewSwitcher.destroyViewEle(viewElement);\n\n        } else {\n          // keep in the DOM, mark as cached\n          navViewAttr(viewElement, VIEW_STATUS_CACHED);\n\n          // disconnect the leaving scope\n          ionic.Utils.disconnectScope(viewElement.scope());\n        }\n      }\n    }\n\n    navSwipeAttr('');\n\n    // ensure no scrolls have been left frozen\n    if (self.isSwipeFreeze) {\n      $ionicScrollDelegate.freezeAllScrolls(false);\n    }\n  };\n\n\n  function onTabsLeave(ev, data) {\n    var viewElements = $element.children();\n    var viewElement, viewScope;\n\n    for (var x = 0, l = viewElements.length; x < l; x++) {\n      viewElement = viewElements.eq(x);\n      if (navViewAttr(viewElement) == VIEW_STATUS_ACTIVE) {\n        viewScope = viewElement.scope();\n        viewScope && viewScope.$emit(ev.name.replace('Tabs', 'View'), data);\n        viewScope && viewScope.$broadcast(ev.name.replace('Tabs', 'ParentView'), data);\n        break;\n      }\n    }\n  }\n\n\n  self.cacheCleanup = function() {\n    var viewElements = $element.children();\n    for (var x = 0, l = viewElements.length; x < l; x++) {\n      if (viewElements.eq(x).data(DATA_DESTROY_ELE)) {\n        $ionicViewSwitcher.destroyViewEle(viewElements.eq(x));\n      }\n    }\n  };\n\n\n  self.clearCache = function(stateIds) {\n    var viewElements = $element.children();\n    var viewElement, viewScope, x, l, y, eleIdentifier;\n\n    for (x = 0, l = viewElements.length; x < l; x++) {\n      viewElement = viewElements.eq(x);\n\n      if (stateIds) {\n        eleIdentifier = viewElement.data(DATA_ELE_IDENTIFIER);\n\n        for (y = 0; y < stateIds.length; y++) {\n          if (eleIdentifier === stateIds[y]) {\n            $ionicViewSwitcher.destroyViewEle(viewElement);\n          }\n        }\n        continue;\n      }\n\n      if (navViewAttr(viewElement) == VIEW_STATUS_CACHED) {\n        $ionicViewSwitcher.destroyViewEle(viewElement);\n\n      } else if (navViewAttr(viewElement) == VIEW_STATUS_ACTIVE) {\n        viewScope = viewElement.scope();\n        viewScope && viewScope.$broadcast('$ionicView.clearCache');\n      }\n\n    }\n  };\n\n\n  self.getViewElements = function() {\n    return $element.children();\n  };\n\n\n  self.appendViewElement = function(viewEle, viewLocals) {\n    // compile the entering element and get the link function\n    var linkFn = $compile(viewEle);\n\n    $element.append(viewEle);\n\n    var viewScope = $scope.$new();\n\n    if (viewLocals && viewLocals.$$controller) {\n      viewLocals.$scope = viewScope;\n      var controller = $controller(viewLocals.$$controller, viewLocals);\n      if (viewLocals.$$controllerAs) {\n        viewScope[viewLocals.$$controllerAs] = controller;\n      }\n      $element.children().data('$ngControllerController', controller);\n    }\n\n    linkFn(viewScope);\n\n    return viewScope;\n  };\n\n\n  self.title = function(val) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.title(val);\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavView#enableBackButton\n   * @description Enable/disable if the back button can be shown or not. For\n   * example, the very first view in the navigation stack would not have a\n   * back view, so the back button would be disabled.\n   */\n  self.enableBackButton = function(shouldEnable) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.enableBackButton(shouldEnable);\n  };\n\n\n  /**\n   * @ngdoc method\n   * @name $ionicNavView#showBackButton\n   * @description Show/hide the nav bar active back button. If the back button\n   * is not possible this will not force the back button to show. The\n   * `enableBackButton()` method handles if a back button is even possible or not.\n   */\n  self.showBackButton = function(shouldShow) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    if (associatedNavBarCtrl) {\n      if (arguments.length) {\n        return associatedNavBarCtrl.showActiveBackButton(shouldShow);\n      }\n      return associatedNavBarCtrl.showActiveBackButton();\n    }\n    return true;\n  };\n\n\n  self.showBar = function(val) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    if (associatedNavBarCtrl) {\n      if (arguments.length) {\n        return associatedNavBarCtrl.showBar(val);\n      }\n      return associatedNavBarCtrl.showBar();\n    }\n    return true;\n  };\n\n\n  self.isPrimary = function(val) {\n    if (arguments.length) {\n      isPrimary = val;\n    }\n    return isPrimary;\n  };\n\n\n  self.direction = function(val) {\n    if (arguments.length) {\n      direction = val;\n    }\n    return direction;\n  };\n\n\n  self.initSwipeBack = function() {\n    var swipeBackHitWidth = $ionicConfig.views.swipeBackHitWidth();\n    var viewTransition, associatedNavBarCtrl, backView;\n    var deregDragStart, deregDrag, deregRelease;\n    var windowWidth, startDragX, dragPoints;\n    var cancelData = {};\n\n    function onDragStart(ev) {\n      if (!isPrimary || !$ionicConfig.views.swipeBackEnabled() || $ionicSideMenuDelegate.isOpenRight() ) return;\n\n\n      startDragX = getDragX(ev);\n      if (startDragX > swipeBackHitWidth) return;\n\n      backView = $ionicHistory.backView();\n\n      var currentView = $ionicHistory.currentView();\n\n      if (!backView || backView.historyId !== currentView.historyId || currentView.canSwipeBack === false) return;\n\n      if (!windowWidth) windowWidth = window.innerWidth;\n\n      self.isSwipeFreeze = $ionicScrollDelegate.freezeAllScrolls(true);\n\n      var registerData = {\n        direction: 'back'\n      };\n\n      dragPoints = [];\n\n      cancelData = {\n        showBar: self.showBar(),\n        showBackButton: self.showBackButton()\n      };\n\n      var switcher = $ionicViewSwitcher.create(self, registerData, backView, currentView, true, false);\n      switcher.loadViewElements(registerData);\n      switcher.render(registerData);\n\n      viewTransition = switcher.transition('back', $ionicHistory.enabledBack(backView), true);\n\n      associatedNavBarCtrl = getAssociatedNavBarCtrl();\n\n      deregDrag = ionic.onGesture('drag', onDrag, $element[0]);\n      deregRelease = ionic.onGesture('release', onRelease, $element[0]);\n    }\n\n    function onDrag(ev) {\n      if (isPrimary && viewTransition) {\n        var dragX = getDragX(ev);\n\n        dragPoints.push({\n          t: Date.now(),\n          x: dragX\n        });\n\n        if (dragX >= windowWidth - 15) {\n          onRelease(ev);\n\n        } else {\n          var step = Math.min(Math.max(getSwipeCompletion(dragX), 0), 1);\n          viewTransition.run(step);\n          associatedNavBarCtrl && associatedNavBarCtrl.activeTransition && associatedNavBarCtrl.activeTransition.run(step);\n        }\n\n      }\n    }\n\n    function onRelease(ev) {\n      if (isPrimary && viewTransition && dragPoints && dragPoints.length > 1) {\n\n        var now = Date.now();\n        var releaseX = getDragX(ev);\n        var startDrag = dragPoints[dragPoints.length - 1];\n\n        for (var x = dragPoints.length - 2; x >= 0; x--) {\n          if (now - startDrag.t > 200) {\n            break;\n          }\n          startDrag = dragPoints[x];\n        }\n\n        var isSwipingRight = (releaseX >= dragPoints[dragPoints.length - 2].x);\n        var releaseSwipeCompletion = getSwipeCompletion(releaseX);\n        var velocity = Math.abs(startDrag.x - releaseX) / (now - startDrag.t);\n\n        // private variables because ui-router has no way to pass custom data using $state.go\n        disableRenderStartViewId = backView.viewId;\n        disableAnimation = (releaseSwipeCompletion < 0.03 || releaseSwipeCompletion > 0.97);\n\n        if (isSwipingRight && (releaseSwipeCompletion > 0.5 || velocity > 0.1)) {\n          // complete view transition on release\n          var speed = (velocity > 0.5 || velocity < 0.05 || releaseX > windowWidth - 45) ? 'fast' : 'slow';\n          navSwipeAttr(disableAnimation ? '' : speed);\n          backView.go();\n          associatedNavBarCtrl && associatedNavBarCtrl.activeTransition && associatedNavBarCtrl.activeTransition.complete(!disableAnimation, speed);\n\n        } else {\n          // cancel view transition on release\n          navSwipeAttr(disableAnimation ? '' : 'fast');\n          disableRenderStartViewId = null;\n          viewTransition.cancel(!disableAnimation);\n          associatedNavBarCtrl && associatedNavBarCtrl.activeTransition && associatedNavBarCtrl.activeTransition.cancel(!disableAnimation, 'fast', cancelData);\n          disableAnimation = null;\n        }\n\n      }\n\n      ionic.offGesture(deregDrag, 'drag', onDrag);\n      ionic.offGesture(deregRelease, 'release', onRelease);\n\n      windowWidth = viewTransition = dragPoints = null;\n\n      self.isSwipeFreeze = $ionicScrollDelegate.freezeAllScrolls(false);\n    }\n\n    function getDragX(ev) {\n      return ionic.tap.pointerCoord(ev.gesture.srcEvent).x;\n    }\n\n    function getSwipeCompletion(dragX) {\n      return (dragX - startDragX) / windowWidth;\n    }\n\n    deregDragStart = ionic.onGesture('dragstart', onDragStart, $element[0]);\n\n    $scope.$on('$destroy', function() {\n      ionic.offGesture(deregDragStart, 'dragstart', onDragStart);\n      ionic.offGesture(deregDrag, 'drag', onDrag);\n      ionic.offGesture(deregRelease, 'release', onRelease);\n      self.element = viewTransition = associatedNavBarCtrl = null;\n    });\n  };\n\n\n  function navSwipeAttr(val) {\n    ionic.DomUtil.cachedAttr($element, 'nav-swipe', val);\n  }\n\n\n  function onTabsTop(ev, isTabsTop) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.hasTabsTop(isTabsTop);\n  }\n\n  function onBarSubheader(ev, isBarSubheader) {\n    var associatedNavBarCtrl = getAssociatedNavBarCtrl();\n    associatedNavBarCtrl && associatedNavBarCtrl.hasBarSubheader(isBarSubheader);\n  }\n\n  function getAssociatedNavBarCtrl() {\n    if (navBarDelegate) {\n      for (var x = 0; x < $ionicNavBarDelegate._instances.length; x++) {\n        if ($ionicNavBarDelegate._instances[x].$$delegateHandle == navBarDelegate) {\n          return $ionicNavBarDelegate._instances[x];\n        }\n      }\n    }\n    return $element.inheritedData('$ionNavBarController');\n  }\n\n}]);\n\nIonicModule\n.controller('$ionicRefresher', [\n  '$scope',\n  '$attrs',\n  '$element',\n  '$ionicBind',\n  '$timeout',\n  function($scope, $attrs, $element, $ionicBind, $timeout) {\n    var self = this,\n        isDragging = false,\n        isOverscrolling = false,\n        dragOffset = 0,\n        lastOverscroll = 0,\n        ptrThreshold = 60,\n        activated = false,\n        scrollTime = 500,\n        startY = null,\n        deltaY = null,\n        canOverscroll = true,\n        scrollParent,\n        scrollChild;\n\n    if (!isDefined($attrs.pullingIcon)) {\n      $attrs.$set('pullingIcon', 'ion-android-arrow-down');\n    }\n\n    $scope.showSpinner = !isDefined($attrs.refreshingIcon) && $attrs.spinner != 'none';\n\n    $scope.showIcon = isDefined($attrs.refreshingIcon);\n\n    $ionicBind($scope, $attrs, {\n      pullingIcon: '@',\n      pullingText: '@',\n      refreshingIcon: '@',\n      refreshingText: '@',\n      spinner: '@',\n      disablePullingRotation: '@',\n      $onRefresh: '&onRefresh',\n      $onPulling: '&onPulling'\n    });\n\n    function handleMousedown(e) {\n      e.touches = e.touches || [{\n        screenX: e.screenX,\n        screenY: e.screenY\n      }];\n      // Mouse needs this\n      startY = Math.floor(e.touches[0].screenY);\n    }\n\n    function handleTouchstart(e) {\n      e.touches = e.touches || [{\n        screenX: e.screenX,\n        screenY: e.screenY\n      }];\n\n      startY = e.touches[0].screenY;\n    }\n\n    function handleTouchend() {\n      // reset Y\n      startY = null;\n      // if this wasn't an overscroll, get out immediately\n      if (!canOverscroll && !isDragging) {\n        return;\n      }\n      // the user has overscrolled but went back to native scrolling\n      if (!isDragging) {\n        dragOffset = 0;\n        isOverscrolling = false;\n        setScrollLock(false);\n      } else {\n        isDragging = false;\n        dragOffset = 0;\n\n        // the user has scroll far enough to trigger a refresh\n        if (lastOverscroll > ptrThreshold) {\n          start();\n          scrollTo(ptrThreshold, scrollTime);\n\n        // the user has overscrolled but not far enough to trigger a refresh\n        } else {\n          scrollTo(0, scrollTime, deactivate);\n          isOverscrolling = false;\n        }\n      }\n    }\n\n    function handleTouchmove(e) {\n      e.touches = e.touches || [{\n        screenX: e.screenX,\n        screenY: e.screenY\n      }];\n\n      // Force mouse events to have had a down event first\n      if (!startY && e.type == 'mousemove') {\n        return;\n      }\n\n      // if multitouch or regular scroll event, get out immediately\n      if (!canOverscroll || e.touches.length > 1) {\n        return;\n      }\n      //if this is a new drag, keep track of where we start\n      if (startY === null) {\n        startY = e.touches[0].screenY;\n      }\n\n      deltaY = e.touches[0].screenY - startY;\n\n      // how far have we dragged so far?\n      // kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch\n      // Only do this if we're not on crosswalk\n      if (ionic.Platform.isAndroid() && ionic.Platform.version() === 4.4 && !ionic.Platform.isCrosswalk() && scrollParent.scrollTop === 0 && deltaY > 0) {\n        isDragging = true;\n        e.preventDefault();\n      }\n\n\n      // if we've dragged up and back down in to native scroll territory\n      if (deltaY - dragOffset <= 0 || scrollParent.scrollTop !== 0) {\n\n        if (isOverscrolling) {\n          isOverscrolling = false;\n          setScrollLock(false);\n        }\n\n        if (isDragging) {\n          nativescroll(scrollParent, deltaY - dragOffset * -1);\n        }\n\n        // if we're not at overscroll 0 yet, 0 out\n        if (lastOverscroll !== 0) {\n          overscroll(0);\n        }\n        return;\n\n      } else if (deltaY > 0 && scrollParent.scrollTop === 0 && !isOverscrolling) {\n        // starting overscroll, but drag started below scrollTop 0, so we need to offset the position\n        dragOffset = deltaY;\n      }\n\n      // prevent native scroll events while overscrolling\n      e.preventDefault();\n\n      // if not overscrolling yet, initiate overscrolling\n      if (!isOverscrolling) {\n        isOverscrolling = true;\n        setScrollLock(true);\n      }\n\n      isDragging = true;\n      // overscroll according to the user's drag so far\n      overscroll((deltaY - dragOffset) / 3);\n\n      // update the icon accordingly\n      if (!activated && lastOverscroll > ptrThreshold) {\n        activated = true;\n        ionic.requestAnimationFrame(activate);\n\n      } else if (activated && lastOverscroll < ptrThreshold) {\n        activated = false;\n        ionic.requestAnimationFrame(deactivate);\n      }\n    }\n\n    function handleScroll(e) {\n      // canOverscrol is used to greatly simplify the drag handler during normal scrolling\n      canOverscroll = (e.target.scrollTop === 0) || isDragging;\n    }\n\n    function overscroll(val) {\n      scrollChild.style[ionic.CSS.TRANSFORM] = 'translate3d(0px, ' + val + 'px, 0px)';\n      lastOverscroll = val;\n    }\n\n    function nativescroll(target, newScrollTop) {\n      // creates a scroll event that bubbles, can be cancelled, and with its view\n      // and detail property initialized to window and 1, respectively\n      target.scrollTop = newScrollTop;\n      var e = document.createEvent(\"UIEvents\");\n      e.initUIEvent(\"scroll\", true, true, window, 1);\n      target.dispatchEvent(e);\n    }\n\n    function setScrollLock(enabled) {\n      // set the scrollbar to be position:fixed in preparation to overscroll\n      // or remove it so the app can be natively scrolled\n      if (enabled) {\n        ionic.requestAnimationFrame(function() {\n          scrollChild.classList.add('overscroll');\n          show();\n        });\n\n      } else {\n        ionic.requestAnimationFrame(function() {\n          scrollChild.classList.remove('overscroll');\n          hide();\n          deactivate();\n        });\n      }\n    }\n\n    $scope.$on('scroll.refreshComplete', function() {\n      // prevent the complete from firing before the scroll has started\n      $timeout(function() {\n\n        ionic.requestAnimationFrame(tail);\n\n        // scroll back to home during tail animation\n        scrollTo(0, scrollTime, deactivate);\n\n        // return to native scrolling after tail animation has time to finish\n        $timeout(function() {\n\n          if (isOverscrolling) {\n            isOverscrolling = false;\n            setScrollLock(false);\n          }\n\n        }, scrollTime);\n\n      }, scrollTime);\n    });\n\n    function scrollTo(Y, duration, callback) {\n      // scroll animation loop w/ easing\n      // credit https://gist.github.com/dezinezync/5487119\n      var start = Date.now(),\n          from = lastOverscroll;\n\n      if (from === Y) {\n        callback();\n        return; /* Prevent scrolling to the Y point if already there */\n      }\n\n      // decelerating to zero velocity\n      function easeOutCubic(t) {\n        return (--t) * t * t + 1;\n      }\n\n      // scroll loop\n      function scroll() {\n        var currentTime = Date.now(),\n          time = Math.min(1, ((currentTime - start) / duration)),\n          // where .5 would be 50% of time on a linear scale easedT gives a\n          // fraction based on the easing method\n          easedT = easeOutCubic(time);\n\n        overscroll(Math.floor((easedT * (Y - from)) + from));\n\n        if (time < 1) {\n          ionic.requestAnimationFrame(scroll);\n\n        } else {\n\n          if (Y < 5 && Y > -5) {\n            isOverscrolling = false;\n            setScrollLock(false);\n          }\n\n          callback && callback();\n        }\n      }\n\n      // start scroll loop\n      ionic.requestAnimationFrame(scroll);\n    }\n\n\n    var touchStartEvent, touchMoveEvent, touchEndEvent;\n    if (window.navigator.pointerEnabled) {\n      touchStartEvent = 'pointerdown';\n      touchMoveEvent = 'pointermove';\n      touchEndEvent = 'pointerup';\n    } else if (window.navigator.msPointerEnabled) {\n      touchStartEvent = 'MSPointerDown';\n      touchMoveEvent = 'MSPointerMove';\n      touchEndEvent = 'MSPointerUp';\n    } else {\n      touchStartEvent = 'touchstart';\n      touchMoveEvent = 'touchmove';\n      touchEndEvent = 'touchend';\n    }\n\n    self.init = function() {\n      scrollParent = $element.parent().parent()[0];\n      scrollChild = $element.parent()[0];\n\n      if (!scrollParent || !scrollParent.classList.contains('ionic-scroll') ||\n        !scrollChild || !scrollChild.classList.contains('scroll')) {\n        throw new Error('Refresher must be immediate child of ion-content or ion-scroll');\n      }\n\n\n      ionic.on(touchStartEvent, handleTouchstart, scrollChild);\n      ionic.on(touchMoveEvent, handleTouchmove, scrollChild);\n      ionic.on(touchEndEvent, handleTouchend, scrollChild);\n      ionic.on('mousedown', handleMousedown, scrollChild);\n      ionic.on('mousemove', handleTouchmove, scrollChild);\n      ionic.on('mouseup', handleTouchend, scrollChild);\n      ionic.on('scroll', handleScroll, scrollParent);\n\n      // cleanup when done\n      $scope.$on('$destroy', destroy);\n    };\n\n    function destroy() {\n      if ( scrollChild ) {\n        ionic.off(touchStartEvent, handleTouchstart, scrollChild);\n        ionic.off(touchMoveEvent, handleTouchmove, scrollChild);\n        ionic.off(touchEndEvent, handleTouchend, scrollChild);\n        ionic.off('mousedown', handleMousedown, scrollChild);\n        ionic.off('mousemove', handleTouchmove, scrollChild);\n        ionic.off('mouseup', handleTouchend, scrollChild);\n      }\n      if ( scrollParent ) {\n        ionic.off('scroll', handleScroll, scrollParent);\n      }\n      scrollParent = null;\n      scrollChild = null;\n    }\n\n    // DOM manipulation and broadcast methods shared by JS and Native Scrolling\n    // getter used by JS Scrolling\n    self.getRefresherDomMethods = function() {\n      return {\n        activate: activate,\n        deactivate: deactivate,\n        start: start,\n        show: show,\n        hide: hide,\n        tail: tail\n      };\n    };\n\n    function activate() {\n      $element[0].classList.add('active');\n      $scope.$onPulling();\n    }\n\n    function deactivate() {\n      // give tail 150ms to finish\n      $timeout(function() {\n        // deactivateCallback\n        $element.removeClass('active refreshing refreshing-tail');\n        if (activated) activated = false;\n      }, 150);\n    }\n\n    function start() {\n      // startCallback\n      $element[0].classList.add('refreshing');\n      var q = $scope.$onRefresh();\n\n      if (q && q.then) {\n        q['finally'](function() {\n          $scope.$broadcast('scroll.refreshComplete');\n        });\n      }\n    }\n\n    function show() {\n      // showCallback\n      $element[0].classList.remove('invisible');\n    }\n\n    function hide() {\n      // showCallback\n      $element[0].classList.add('invisible');\n    }\n\n    function tail() {\n      // tailCallback\n      $element[0].classList.add('refreshing-tail');\n    }\n\n    // for testing\n    self.__handleTouchmove = handleTouchmove;\n    self.__getScrollChild = function() { return scrollChild; };\n    self.__getScrollParent = function() { return scrollParent; };\n  }\n]);\n\n/**\n * @private\n */\nIonicModule\n\n.controller('$ionicScroll', [\n  '$scope',\n  'scrollViewOptions',\n  '$timeout',\n  '$window',\n  '$location',\n  '$document',\n  '$ionicScrollDelegate',\n  '$ionicHistory',\nfunction($scope,\n         scrollViewOptions,\n         $timeout,\n         $window,\n         $location,\n         $document,\n         $ionicScrollDelegate,\n         $ionicHistory) {\n\n  var self = this;\n  // for testing\n  self.__timeout = $timeout;\n\n  self._scrollViewOptions = scrollViewOptions; //for testing\n  self.isNative = function() {\n    return !!scrollViewOptions.nativeScrolling;\n  };\n\n  var element = self.element = scrollViewOptions.el;\n  var $element = self.$element = jqLite(element);\n  var scrollView;\n  if (self.isNative()) {\n    scrollView = self.scrollView = new ionic.views.ScrollNative(scrollViewOptions);\n  } else {\n    scrollView = self.scrollView = new ionic.views.Scroll(scrollViewOptions);\n  }\n\n\n  //Attach self to element as a controller so other directives can require this controller\n  //through `require: '$ionicScroll'\n  //Also attach to parent so that sibling elements can require this\n  ($element.parent().length ? $element.parent() : $element)\n    .data('$$ionicScrollController', self);\n\n  var deregisterInstance = $ionicScrollDelegate._registerInstance(\n    self, scrollViewOptions.delegateHandle, function() {\n      return $ionicHistory.isActiveScope($scope);\n    }\n  );\n\n  if (!isDefined(scrollViewOptions.bouncing)) {\n    ionic.Platform.ready(function() {\n      if (scrollView && scrollView.options) {\n        scrollView.options.bouncing = true;\n        if (ionic.Platform.isAndroid()) {\n          // No bouncing by default on Android\n          scrollView.options.bouncing = false;\n          // Faster scroll decel\n          scrollView.options.deceleration = 0.95;\n        }\n      }\n    });\n  }\n\n  var resize = angular.bind(scrollView, scrollView.resize);\n  angular.element($window).on('resize', resize);\n\n  var scrollFunc = function(e) {\n    var detail = (e.originalEvent || e).detail || {};\n    $scope.$onScroll && $scope.$onScroll({\n      event: e,\n      scrollTop: detail.scrollTop || 0,\n      scrollLeft: detail.scrollLeft || 0\n    });\n  };\n\n  $element.on('scroll', scrollFunc);\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    scrollView && scrollView.__cleanup && scrollView.__cleanup();\n    angular.element($window).off('resize', resize);\n    if ( $element ) {\n      $element.off('scroll', scrollFunc);\n    }\n    if ( self._scrollViewOptions ) {\n      self._scrollViewOptions.el = null;\n    }\n    if ( scrollViewOptions ) {\n        scrollViewOptions.el = null;\n    }\n\n    scrollView = self.scrollView = scrollViewOptions = self._scrollViewOptions = element = self.$element = $element = null;\n  });\n\n  $timeout(function() {\n    scrollView && scrollView.run && scrollView.run();\n  });\n\n  self.getScrollView = function() {\n    return scrollView;\n  };\n\n  self.getScrollPosition = function() {\n    return scrollView.getValues();\n  };\n\n  self.resize = function() {\n    return $timeout(resize, 0, false).then(function() {\n      $element && $element.triggerHandler('scroll-resize');\n    });\n  };\n\n  self.scrollTop = function(shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.scrollTo(0, 0, !!shouldAnimate);\n    });\n  };\n\n  self.scrollBottom = function(shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      var max = scrollView.getScrollMax();\n      scrollView.scrollTo(max.left, max.top, !!shouldAnimate);\n    });\n  };\n\n  self.scrollTo = function(left, top, shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.scrollTo(left, top, !!shouldAnimate);\n    });\n  };\n\n  self.zoomTo = function(zoom, shouldAnimate, originLeft, originTop) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.zoomTo(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  self.zoomBy = function(zoom, shouldAnimate, originLeft, originTop) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.zoomBy(zoom, !!shouldAnimate, originLeft, originTop);\n    });\n  };\n\n  self.scrollBy = function(left, top, shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      scrollView.scrollBy(left, top, !!shouldAnimate);\n    });\n  };\n\n  self.anchorScroll = function(shouldAnimate) {\n    self.resize().then(function() {\n      if (!scrollView) {\n        return;\n      }\n      var hash = $location.hash();\n      var elm = hash && $document[0].getElementById(hash);\n      if (!(hash && elm)) {\n        scrollView.scrollTo(0, 0, !!shouldAnimate);\n        return;\n      }\n      var curElm = elm;\n      var scrollLeft = 0, scrollTop = 0;\n      do {\n        if (curElm !== null) scrollLeft += curElm.offsetLeft;\n        if (curElm !== null) scrollTop += curElm.offsetTop;\n        curElm = curElm.offsetParent;\n      } while (curElm.attributes != self.element.attributes && curElm.offsetParent);\n      scrollView.scrollTo(scrollLeft, scrollTop, !!shouldAnimate);\n    });\n  };\n\n  self.freezeScroll = scrollView.freeze;\n  self.freezeScrollShut = scrollView.freezeShut;\n\n  self.freezeAllScrolls = function(shouldFreeze) {\n    for (var i = 0; i < $ionicScrollDelegate._instances.length; i++) {\n      $ionicScrollDelegate._instances[i].freezeScroll(shouldFreeze);\n    }\n  };\n\n\n  /**\n   * @private\n   */\n  self._setRefresher = function(refresherScope, refresherElement, refresherMethods) {\n    self.refresher = refresherElement;\n    var refresherHeight = self.refresher.clientHeight || 60;\n    scrollView.activatePullToRefresh(\n      refresherHeight,\n      refresherMethods\n    );\n  };\n\n}]);\n\nIonicModule\n.controller('$ionicSideMenus', [\n  '$scope',\n  '$attrs',\n  '$ionicSideMenuDelegate',\n  '$ionicPlatform',\n  '$ionicBody',\n  '$ionicHistory',\n  '$ionicScrollDelegate',\n  'IONIC_BACK_PRIORITY',\n  '$rootScope',\nfunction($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $ionicHistory, $ionicScrollDelegate, IONIC_BACK_PRIORITY, $rootScope) {\n  var self = this;\n  var rightShowing, leftShowing, isDragging;\n  var startX, lastX, offsetX, isAsideExposed;\n  var enableMenuWithBackViews = true;\n\n  self.$scope = $scope;\n\n  self.initialize = function(options) {\n    self.left = options.left;\n    self.right = options.right;\n    self.setContent(options.content);\n    self.dragThresholdX = options.dragThresholdX || 10;\n    $ionicHistory.registerHistory(self.$scope);\n  };\n\n  /**\n   * Set the content view controller if not passed in the constructor options.\n   *\n   * @param {object} content\n   */\n  self.setContent = function(content) {\n    if (content) {\n      self.content = content;\n\n      self.content.onDrag = function(e) {\n        self._handleDrag(e);\n      };\n\n      self.content.endDrag = function(e) {\n        self._endDrag(e);\n      };\n    }\n  };\n\n  self.isOpenLeft = function() {\n    return self.getOpenAmount() > 0;\n  };\n\n  self.isOpenRight = function() {\n    return self.getOpenAmount() < 0;\n  };\n\n  /**\n   * Toggle the left menu to open 100%\n   */\n  self.toggleLeft = function(shouldOpen) {\n    if (isAsideExposed || !self.left.isEnabled) return;\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount <= 0;\n    }\n    self.content.enableAnimation();\n    if (!shouldOpen) {\n      self.openPercentage(0);\n      $rootScope.$emit('$ionicSideMenuClose', 'left');\n    } else {\n      self.openPercentage(100);\n      $rootScope.$emit('$ionicSideMenuOpen', 'left');\n    }\n  };\n\n  /**\n   * Toggle the right menu to open 100%\n   */\n  self.toggleRight = function(shouldOpen) {\n    if (isAsideExposed || !self.right.isEnabled) return;\n    var openAmount = self.getOpenAmount();\n    if (arguments.length === 0) {\n      shouldOpen = openAmount >= 0;\n    }\n    self.content.enableAnimation();\n    if (!shouldOpen) {\n      self.openPercentage(0);\n      $rootScope.$emit('$ionicSideMenuClose', 'right');\n    } else {\n      self.openPercentage(-100);\n      $rootScope.$emit('$ionicSideMenuOpen', 'right');\n    }\n  };\n\n  self.toggle = function(side) {\n    if (side == 'right') {\n      self.toggleRight();\n    } else {\n      self.toggleLeft();\n    }\n  };\n\n  /**\n   * Close all menus.\n   */\n  self.close = function() {\n    self.openPercentage(0);\n    $rootScope.$emit('$ionicSideMenuClose', 'left');\n    $rootScope.$emit('$ionicSideMenuClose', 'right');\n  };\n\n  /**\n   * @return {float} The amount the side menu is open, either positive or negative for left (positive), or right (negative)\n   */\n  self.getOpenAmount = function() {\n    return self.content && self.content.getTranslateX() || 0;\n  };\n\n  /**\n   * @return {float} The ratio of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50% or a ratio of 0.5. Value is negative\n   * for right menu.\n   */\n  self.getOpenRatio = function() {\n    var amount = self.getOpenAmount();\n    if (amount >= 0) {\n      return amount / self.left.width;\n    }\n    return amount / self.right.width;\n  };\n\n  self.isOpen = function() {\n    return self.getOpenAmount() !== 0;\n  };\n\n  /**\n   * @return {float} The percentage of open amount over menu width. For example, a\n   * menu of width 100 open 50 pixels would be open 50%. Value is negative\n   * for right menu.\n   */\n  self.getOpenPercentage = function() {\n    return self.getOpenRatio() * 100;\n  };\n\n  /**\n   * Open the menu with a given percentage amount.\n   * @param {float} percentage The percentage (positive or negative for left/right) to open the menu.\n   */\n  self.openPercentage = function(percentage) {\n    var p = percentage / 100;\n\n    if (self.left && percentage >= 0) {\n      self.openAmount(self.left.width * p);\n    } else if (self.right && percentage < 0) {\n      self.openAmount(self.right.width * p);\n    }\n\n    // add the CSS class \"menu-open\" if the percentage does not\n    // equal 0, otherwise remove the class from the body element\n    $ionicBody.enableClass((percentage !== 0), 'menu-open');\n\n    self.content.setCanScroll(percentage == 0);\n  };\n\n  /*\n  function freezeAllScrolls(shouldFreeze) {\n    if (shouldFreeze && !self.isScrollFreeze) {\n      $ionicScrollDelegate.freezeAllScrolls(shouldFreeze);\n\n    } else if (!shouldFreeze && self.isScrollFreeze) {\n      $ionicScrollDelegate.freezeAllScrolls(false);\n    }\n    self.isScrollFreeze = shouldFreeze;\n  }\n  */\n\n  /**\n   * Open the menu the given pixel amount.\n   * @param {float} amount the pixel amount to open the menu. Positive value for left menu,\n   * negative value for right menu (only one menu will be visible at a time).\n   */\n  self.openAmount = function(amount) {\n    var maxLeft = self.left && self.left.width || 0;\n    var maxRight = self.right && self.right.width || 0;\n\n    // Check if we can move to that side, depending if the left/right panel is enabled\n    if (!(self.left && self.left.isEnabled) && amount > 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if (!(self.right && self.right.isEnabled) && amount < 0) {\n      self.content.setTranslateX(0);\n      return;\n    }\n\n    if (leftShowing && amount > maxLeft) {\n      self.content.setTranslateX(maxLeft);\n      return;\n    }\n\n    if (rightShowing && amount < -maxRight) {\n      self.content.setTranslateX(-maxRight);\n      return;\n    }\n\n    self.content.setTranslateX(amount);\n\n    if (amount >= 0) {\n      leftShowing = true;\n      rightShowing = false;\n\n      if (amount > 0) {\n        // Push the z-index of the right menu down\n        self.right && self.right.pushDown && self.right.pushDown();\n        // Bring the z-index of the left menu up\n        self.left && self.left.bringUp && self.left.bringUp();\n      }\n    } else {\n      rightShowing = true;\n      leftShowing = false;\n\n      // Bring the z-index of the right menu up\n      self.right && self.right.bringUp && self.right.bringUp();\n      // Push the z-index of the left menu down\n      self.left && self.left.pushDown && self.left.pushDown();\n    }\n  };\n\n  /**\n   * Given an event object, find the final resting position of this side\n   * menu. For example, if the user \"throws\" the content to the right and\n   * releases the touch, the left menu should snap open (animated, of course).\n   *\n   * @param {Event} e the gesture event to use for snapping\n   */\n  self.snapToRest = function(e) {\n    // We want to animate at the end of this\n    self.content.enableAnimation();\n    isDragging = false;\n\n    // Check how much the panel is open after the drag, and\n    // what the drag velocity is\n    var ratio = self.getOpenRatio();\n\n    if (ratio === 0) {\n      // Just to be safe\n      self.openPercentage(0);\n      return;\n    }\n\n    var velocityThreshold = 0.3;\n    var velocityX = e.gesture.velocityX;\n    var direction = e.gesture.direction;\n\n    // Going right, less than half, too slow (snap back)\n    if (ratio > 0 && ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going left, more than half, too slow (snap back)\n    else if (ratio > 0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(100);\n    }\n\n    // Going left, less than half, too slow (snap back)\n    else if (ratio < 0 && ratio > -0.5 && direction == 'left' && velocityX < velocityThreshold) {\n      self.openPercentage(0);\n    }\n\n    // Going right, more than half, too slow (snap back)\n    else if (ratio < 0.5 && direction == 'right' && velocityX < velocityThreshold) {\n      self.openPercentage(-100);\n    }\n\n    // Going right, more than half, or quickly (snap open)\n    else if (direction == 'right' && ratio >= 0 && (ratio >= 0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(100);\n    }\n\n    // Going left, more than half, or quickly (span open)\n    else if (direction == 'left' && ratio <= 0 && (ratio <= -0.5 || velocityX > velocityThreshold)) {\n      self.openPercentage(-100);\n    }\n\n    // Snap back for safety\n    else {\n      self.openPercentage(0);\n    }\n  };\n\n  self.enableMenuWithBackViews = function(val) {\n    if (arguments.length) {\n      enableMenuWithBackViews = !!val;\n    }\n    return enableMenuWithBackViews;\n  };\n\n  self.isAsideExposed = function() {\n    return !!isAsideExposed;\n  };\n\n  self.exposeAside = function(shouldExposeAside) {\n    if (!(self.left && self.left.isEnabled) && !(self.right && self.right.isEnabled)) return;\n    self.close();\n\n    isAsideExposed = shouldExposeAside;\n    if ((self.left && self.left.isEnabled) && (self.right && self.right.isEnabled)) {\n      self.content.setMarginLeftAndRight(isAsideExposed ? self.left.width : 0, isAsideExposed ? self.right.width : 0);\n    } else if (self.left && self.left.isEnabled) {\n      // set the left marget width if it should be exposed\n      // otherwise set false so there's no left margin\n      self.content.setMarginLeft(isAsideExposed ? self.left.width : 0);\n    } else if (self.right && self.right.isEnabled) {\n      self.content.setMarginRight(isAsideExposed ? self.right.width : 0);\n    }\n    self.$scope.$emit('$ionicExposeAside', isAsideExposed);\n  };\n\n  self.activeAsideResizing = function(isResizing) {\n    $ionicBody.enableClass(isResizing, 'aside-resizing');\n  };\n\n  // End a drag with the given event\n  self._endDrag = function(e) {\n    if (isAsideExposed) return;\n\n    if (isDragging) {\n      self.snapToRest(e);\n    }\n    startX = null;\n    lastX = null;\n    offsetX = null;\n  };\n\n  // Handle a drag event\n  self._handleDrag = function(e) {\n    if (isAsideExposed || !$scope.dragContent) return;\n\n    // If we don't have start coords, grab and store them\n    if (!startX) {\n      startX = e.gesture.touches[0].pageX;\n      lastX = startX;\n    } else {\n      // Grab the current tap coords\n      lastX = e.gesture.touches[0].pageX;\n    }\n\n    // Calculate difference from the tap points\n    if (!isDragging && Math.abs(lastX - startX) > self.dragThresholdX) {\n      // if the difference is greater than threshold, start dragging using the current\n      // point as the starting point\n      startX = lastX;\n\n      isDragging = true;\n      // Initialize dragging\n      self.content.disableAnimation();\n      offsetX = self.getOpenAmount();\n    }\n\n    if (isDragging) {\n      self.openAmount(offsetX + (lastX - startX));\n      //self.content.setCanScroll(false);\n    }\n  };\n\n  self.canDragContent = function(canDrag) {\n    if (arguments.length) {\n      $scope.dragContent = !!canDrag;\n    }\n    return $scope.dragContent;\n  };\n\n  self.edgeThreshold = 25;\n  self.edgeThresholdEnabled = false;\n  self.edgeDragThreshold = function(value) {\n    if (arguments.length) {\n      if (isNumber(value) && value > 0) {\n        self.edgeThreshold = value;\n        self.edgeThresholdEnabled = true;\n      } else {\n        self.edgeThresholdEnabled = !!value;\n      }\n    }\n    return self.edgeThresholdEnabled;\n  };\n\n  self.isDraggableTarget = function(e) {\n    //Only restrict edge when sidemenu is closed and restriction is enabled\n    var shouldOnlyAllowEdgeDrag = self.edgeThresholdEnabled && !self.isOpen();\n    var startX = e.gesture.startEvent && e.gesture.startEvent.center &&\n      e.gesture.startEvent.center.pageX;\n\n    var dragIsWithinBounds = !shouldOnlyAllowEdgeDrag ||\n      startX <= self.edgeThreshold ||\n      startX >= self.content.element.offsetWidth - self.edgeThreshold;\n\n    var backView = $ionicHistory.backView();\n    var menuEnabled = enableMenuWithBackViews ? true : !backView;\n    if (!menuEnabled) {\n      var currentView = $ionicHistory.currentView() || {};\n      return (dragIsWithinBounds && (backView.historyId !== currentView.historyId));\n    }\n\n    return ($scope.dragContent || self.isOpen()) &&\n      dragIsWithinBounds &&\n      !e.gesture.srcEvent.defaultPrevented &&\n      menuEnabled &&\n      !e.target.tagName.match(/input|textarea|select|object|embed/i) &&\n      !e.target.isContentEditable &&\n      !(e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll') == 'true');\n  };\n\n  $scope.sideMenuContentTranslateX = 0;\n\n  var deregisterBackButtonAction = noop;\n  var closeSideMenu = angular.bind(self, self.close);\n\n  $scope.$watch(function() {\n    return self.getOpenAmount() !== 0;\n  }, function(isOpen) {\n    deregisterBackButtonAction();\n    if (isOpen) {\n      deregisterBackButtonAction = $ionicPlatform.registerBackButtonAction(\n        closeSideMenu,\n        IONIC_BACK_PRIORITY.sideMenu\n      );\n    }\n  });\n\n  var deregisterInstance = $ionicSideMenuDelegate._registerInstance(\n    self, $attrs.delegateHandle, function() {\n      return $ionicHistory.isActiveScope($scope);\n    }\n  );\n\n  $scope.$on('$destroy', function() {\n    deregisterInstance();\n    deregisterBackButtonAction();\n    self.$scope = null;\n    if (self.content) {\n      self.content.setCanScroll(true);\n      self.content.element = null;\n      self.content = null;\n    }\n  });\n\n  self.initialize({\n    left: {\n      width: 275\n    },\n    right: {\n      width: 275\n    }\n  });\n\n}]);\n\n(function(ionic) {\n\n  var TRANSLATE32 = 'translate(32,32)';\n  var STROKE_OPACITY = 'stroke-opacity';\n  var ROUND = 'round';\n  var INDEFINITE = 'indefinite';\n  var DURATION = '750ms';\n  var NONE = 'none';\n  var SHORTCUTS = {\n    a: 'animate',\n    an: 'attributeName',\n    at: 'animateTransform',\n    c: 'circle',\n    da: 'stroke-dasharray',\n    os: 'stroke-dashoffset',\n    f: 'fill',\n    lc: 'stroke-linecap',\n    rc: 'repeatCount',\n    sw: 'stroke-width',\n    t: 'transform',\n    v: 'values'\n  };\n\n  var SPIN_ANIMATION = {\n    v: '0,32,32;360,32,32',\n    an: 'transform',\n    type: 'rotate',\n    rc: INDEFINITE,\n    dur: DURATION\n  };\n\n  function createSvgElement(tagName, data, parent, spinnerName) {\n    var ele = document.createElement(SHORTCUTS[tagName] || tagName);\n    var k, x, y;\n\n    for (k in data) {\n\n      if (angular.isArray(data[k])) {\n        for (x = 0; x < data[k].length; x++) {\n          if (data[k][x].fn) {\n            for (y = 0; y < data[k][x].t; y++) {\n              createSvgElement(k, data[k][x].fn(y, spinnerName), ele, spinnerName);\n            }\n          } else {\n            createSvgElement(k, data[k][x], ele, spinnerName);\n          }\n        }\n\n      } else {\n        setSvgAttribute(ele, k, data[k]);\n      }\n    }\n\n    parent.appendChild(ele);\n  }\n\n  function setSvgAttribute(ele, k, v) {\n    ele.setAttribute(SHORTCUTS[k] || k, v);\n  }\n\n  function animationValues(strValues, i) {\n    var values = strValues.split(';');\n    var back = values.slice(i);\n    var front = values.slice(0, values.length - back.length);\n    values = back.concat(front).reverse();\n    return values.join(';') + ';' + values[0];\n  }\n\n  var IOS_SPINNER = {\n    sw: 4,\n    lc: ROUND,\n    line: [{\n      fn: function(i, spinnerName) {\n        return {\n          y1: spinnerName == 'ios' ? 17 : 12,\n          y2: spinnerName == 'ios' ? 29 : 20,\n          t: TRANSLATE32 + ' rotate(' + (30 * i + (i < 6 ? 180 : -180)) + ')',\n          a: [{\n            fn: function() {\n              return {\n                an: STROKE_OPACITY,\n                dur: DURATION,\n                v: animationValues('0;.1;.15;.25;.35;.45;.55;.65;.7;.85;1', i),\n                rc: INDEFINITE\n              };\n            },\n            t: 1\n          }]\n        };\n      },\n      t: 12\n    }]\n  };\n\n  var spinners = {\n\n    android: {\n      c: [{\n        sw: 6,\n        da: 128,\n        os: 82,\n        r: 26,\n        cx: 32,\n        cy: 32,\n        f: NONE\n      }]\n    },\n\n    ios: IOS_SPINNER,\n\n    'ios-small': IOS_SPINNER,\n\n    bubbles: {\n      sw: 0,\n      c: [{\n        fn: function(i) {\n          return {\n            cx: 24 * Math.cos(2 * Math.PI * i / 8),\n            cy: 24 * Math.sin(2 * Math.PI * i / 8),\n            t: TRANSLATE32,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'r',\n                  dur: DURATION,\n                  v: animationValues('1;2;3;4;5;6;7;8', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 8\n      }]\n    },\n\n    circles: {\n\n      c: [{\n        fn: function(i) {\n          return {\n            r: 5,\n            cx: 24 * Math.cos(2 * Math.PI * i / 8),\n            cy: 24 * Math.sin(2 * Math.PI * i / 8),\n            t: TRANSLATE32,\n            sw: 0,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'fill-opacity',\n                  dur: DURATION,\n                  v: animationValues('.3;.3;.3;.4;.7;.85;.9;1', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 8\n      }]\n    },\n\n    crescent: {\n      c: [{\n        sw: 4,\n        da: 128,\n        os: 82,\n        r: 26,\n        cx: 32,\n        cy: 32,\n        f: NONE,\n        at: [SPIN_ANIMATION]\n      }]\n    },\n\n    dots: {\n\n      c: [{\n        fn: function(i) {\n          return {\n            cx: 16 + (16 * i),\n            cy: 32,\n            sw: 0,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'fill-opacity',\n                  dur: DURATION,\n                  v: animationValues('.5;.6;.8;1;.8;.6;.5', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: 'r',\n                  dur: DURATION,\n                  v: animationValues('4;5;6;5;4;3;3', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 3\n      }]\n    },\n\n    lines: {\n      sw: 7,\n      lc: ROUND,\n      line: [{\n        fn: function(i) {\n          return {\n            x1: 10 + (i * 14),\n            x2: 10 + (i * 14),\n            a: [{\n              fn: function() {\n                return {\n                  an: 'y1',\n                  dur: DURATION,\n                  v: animationValues('16;18;28;18;16', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: 'y2',\n                  dur: DURATION,\n                  v: animationValues('48;44;36;46;48', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: STROKE_OPACITY,\n                  dur: DURATION,\n                  v: animationValues('1;.8;.5;.4;1', i),\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 4\n      }]\n    },\n\n    ripple: {\n      f: NONE,\n      'fill-rule': 'evenodd',\n      sw: 3,\n      circle: [{\n        fn: function(i) {\n          return {\n            cx: 32,\n            cy: 32,\n            a: [{\n              fn: function() {\n                return {\n                  an: 'r',\n                  begin: (i * -1) + 's',\n                  dur: '2s',\n                  v: '0;24',\n                  keyTimes: '0;1',\n                  keySplines: '0.1,0.2,0.3,1',\n                  calcMode: 'spline',\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }, {\n              fn: function() {\n                return {\n                  an: STROKE_OPACITY,\n                  begin: (i * -1) + 's',\n                  dur: '2s',\n                  v: '.2;1;.2;0',\n                  rc: INDEFINITE\n                };\n              },\n              t: 1\n            }]\n          };\n        },\n        t: 2\n      }]\n    },\n\n    spiral: {\n      defs: [{\n        linearGradient: [{\n          id: 'sGD',\n          gradientUnits: 'userSpaceOnUse',\n          x1: 55, y1: 46, x2: 2, y2: 46,\n          stop: [{\n            offset: 0.1,\n            class: 'stop1'\n          }, {\n            offset: 1,\n            class: 'stop2'\n          }]\n        }]\n      }],\n      g: [{\n        sw: 4,\n        lc: ROUND,\n        f: NONE,\n        path: [{\n          stroke: 'url(#sGD)',\n          d: 'M4,32 c0,15,12,28,28,28c8,0,16-4,21-9'\n        }, {\n          d: 'M60,32 C60,16,47.464,4,32,4S4,16,4,32'\n        }],\n        at: [SPIN_ANIMATION]\n      }]\n    }\n\n  };\n\n  var animations = {\n\n    android: function(ele) {\n      // Note that this is called as a function, not a constructor.\n      var self = {};\n\n      this.stop = false;\n\n      var rIndex = 0;\n      var rotateCircle = 0;\n      var startTime;\n      var svgEle = ele.querySelector('g');\n      var circleEle = ele.querySelector('circle');\n\n      function run() {\n        if (self.stop) return;\n\n        var v = easeInOutCubic(Date.now() - startTime, 650);\n        var scaleX = 1;\n        var translateX = 0;\n        var dasharray = (188 - (58 * v));\n        var dashoffset = (182 - (182 * v));\n\n        if (rIndex % 2) {\n          scaleX = -1;\n          translateX = -64;\n          dasharray = (128 - (-58 * v));\n          dashoffset = (182 * v);\n        }\n\n        var rotateLine = [0, -101, -90, -11, -180, 79, -270, -191][rIndex];\n\n        setSvgAttribute(circleEle, 'da', Math.max(Math.min(dasharray, 188), 128));\n        setSvgAttribute(circleEle, 'os', Math.max(Math.min(dashoffset, 182), 0));\n        setSvgAttribute(circleEle, 't', 'scale(' + scaleX + ',1) translate(' + translateX + ',0) rotate(' + rotateLine + ',32,32)');\n\n        rotateCircle += 4.1;\n        if (rotateCircle > 359) rotateCircle = 0;\n        setSvgAttribute(svgEle, 't', 'rotate(' + rotateCircle + ',32,32)');\n\n        if (v >= 1) {\n          rIndex++;\n          if (rIndex > 7) rIndex = 0;\n          startTime = Date.now();\n        }\n\n        ionic.requestAnimationFrame(run);\n      }\n\n      return function() {\n        startTime = Date.now();\n        run();\n        return self;\n      };\n\n    }\n\n  };\n\n  function easeInOutCubic(t, c) {\n    t /= c / 2;\n    if (t < 1) return 1 / 2 * t * t * t;\n    t -= 2;\n    return 1 / 2 * (t * t * t + 2);\n  }\n\n\n  IonicModule\n  .controller('$ionicSpinner', [\n    '$element',\n    '$attrs',\n    '$ionicConfig',\n  function($element, $attrs, $ionicConfig) {\n    var spinnerName, anim;\n\n    this.init = function() {\n      spinnerName = $attrs.icon || $ionicConfig.spinner.icon();\n\n      var container = document.createElement('div');\n      createSvgElement('svg', {\n        viewBox: '0 0 64 64',\n        g: [spinners[spinnerName]]\n      }, container, spinnerName);\n\n      // Specifically for animations to work,\n      // Android 4.3 and below requires the element to be\n      // added as an html string, rather than dynmically\n      // building up the svg element and appending it.\n      $element.html(container.innerHTML);\n\n      this.start();\n\n      return spinnerName;\n    };\n\n    this.start = function() {\n      animations[spinnerName] && (anim = animations[spinnerName]($element[0])());\n    };\n\n    this.stop = function() {\n      animations[spinnerName] && (anim.stop = true);\n    };\n\n  }]);\n\n})(ionic);\n\nIonicModule\n.controller('$ionicTab', [\n  '$scope',\n  '$ionicHistory',\n  '$attrs',\n  '$location',\n  '$state',\nfunction($scope, $ionicHistory, $attrs, $location, $state) {\n  this.$scope = $scope;\n\n  //All of these exposed for testing\n  this.hrefMatchesState = function() {\n    return $attrs.href && $location.path().indexOf(\n      $attrs.href.replace(/^#/, '').replace(/\\/$/, '')\n    ) === 0;\n  };\n  this.srefMatchesState = function() {\n    return $attrs.uiSref && $state.includes($attrs.uiSref.split('(')[0]);\n  };\n  this.navNameMatchesState = function() {\n    return this.navViewName && $ionicHistory.isCurrentStateNavView(this.navViewName);\n  };\n\n  this.tabMatchesState = function() {\n    return this.hrefMatchesState() || this.srefMatchesState() || this.navNameMatchesState();\n  };\n}]);\n\nIonicModule\n.controller('$ionicTabs', [\n  '$scope',\n  '$element',\n  '$ionicHistory',\nfunction($scope, $element, $ionicHistory) {\n  var self = this;\n  var selectedTab = null;\n  var previousSelectedTab = null;\n  var selectedTabIndex;\n  var isVisible = true;\n  self.tabs = [];\n\n  self.selectedIndex = function() {\n    return self.tabs.indexOf(selectedTab);\n  };\n  self.selectedTab = function() {\n    return selectedTab;\n  };\n  self.previousSelectedTab = function() {\n    return previousSelectedTab;\n  };\n\n  self.add = function(tab) {\n    $ionicHistory.registerHistory(tab);\n    self.tabs.push(tab);\n  };\n\n  self.remove = function(tab) {\n    var tabIndex = self.tabs.indexOf(tab);\n    if (tabIndex === -1) {\n      return;\n    }\n    //Use a field like '$tabSelected' so developers won't accidentally set it in controllers etc\n    if (tab.$tabSelected) {\n      self.deselect(tab);\n      //Try to select a new tab if we're removing a tab\n      if (self.tabs.length === 1) {\n        //Do nothing if there are no other tabs to select\n      } else {\n        //Select previous tab if it's the last tab, else select next tab\n        var newTabIndex = tabIndex === self.tabs.length - 1 ? tabIndex - 1 : tabIndex + 1;\n        self.select(self.tabs[newTabIndex]);\n      }\n    }\n    self.tabs.splice(tabIndex, 1);\n  };\n\n  self.deselect = function(tab) {\n    if (tab.$tabSelected) {\n      previousSelectedTab = selectedTab;\n      selectedTab = selectedTabIndex = null;\n      tab.$tabSelected = false;\n      (tab.onDeselect || noop)();\n      tab.$broadcast && tab.$broadcast('$ionicHistory.deselect');\n    }\n  };\n\n  self.select = function(tab, shouldEmitEvent) {\n    var tabIndex;\n    if (isNumber(tab)) {\n      tabIndex = tab;\n      if (tabIndex >= self.tabs.length) return;\n      tab = self.tabs[tabIndex];\n    } else {\n      tabIndex = self.tabs.indexOf(tab);\n    }\n\n    if (arguments.length === 1) {\n      shouldEmitEvent = !!(tab.navViewName || tab.uiSref);\n    }\n\n    if (selectedTab && selectedTab.$historyId == tab.$historyId) {\n      if (shouldEmitEvent) {\n        $ionicHistory.goToHistoryRoot(tab.$historyId);\n      }\n\n    } else if (selectedTabIndex !== tabIndex) {\n      forEach(self.tabs, function(tab) {\n        self.deselect(tab);\n      });\n\n      selectedTab = tab;\n      selectedTabIndex = tabIndex;\n\n      if (self.$scope && self.$scope.$parent) {\n        self.$scope.$parent.$activeHistoryId = tab.$historyId;\n      }\n\n      //Use a funny name like $tabSelected so the developer doesn't overwrite the var in a child scope\n      tab.$tabSelected = true;\n      (tab.onSelect || noop)();\n\n      if (shouldEmitEvent) {\n        $scope.$emit('$ionicHistory.change', {\n          type: 'tab',\n          tabIndex: tabIndex,\n          historyId: tab.$historyId,\n          navViewName: tab.navViewName,\n          hasNavView: !!tab.navViewName,\n          title: tab.title,\n          url: tab.href,\n          uiSref: tab.uiSref\n        });\n      }\n\n      $scope.$broadcast(\"tabSelected\", { selectedTab: tab, selectedTabIndex: tabIndex});\n    }\n  };\n\n  self.hasActiveScope = function() {\n    for (var x = 0; x < self.tabs.length; x++) {\n      if ($ionicHistory.isActiveScope(self.tabs[x])) {\n        return true;\n      }\n    }\n    return false;\n  };\n\n  self.showBar = function(show) {\n    if (arguments.length) {\n      if (show) {\n        $element.removeClass('tabs-item-hide');\n      } else {\n        $element.addClass('tabs-item-hide');\n      }\n      isVisible = !!show;\n    }\n    return isVisible;\n  };\n}]);\n\nIonicModule\n.controller('$ionicView', [\n  '$scope',\n  '$element',\n  '$attrs',\n  '$compile',\n  '$rootScope',\nfunction($scope, $element, $attrs, $compile, $rootScope) {\n  var self = this;\n  var navElementHtml = {};\n  var navViewCtrl;\n  var navBarDelegateHandle;\n  var hasViewHeaderBar;\n  var deregisters = [];\n  var viewTitle;\n\n  var deregIonNavBarInit = $scope.$on('ionNavBar.init', function(ev, delegateHandle) {\n    // this view has its own ion-nav-bar, remember the navBarDelegateHandle for this view\n    ev.stopPropagation();\n    navBarDelegateHandle = delegateHandle;\n  });\n\n\n  self.init = function() {\n    deregIonNavBarInit();\n\n    var modalCtrl = $element.inheritedData('$ionModalController');\n    navViewCtrl = $element.inheritedData('$ionNavViewController');\n\n    // don't bother if inside a modal or there's no parent navView\n    if (!navViewCtrl || modalCtrl) return;\n\n    // add listeners for when this view changes\n    $scope.$on('$ionicView.beforeEnter', self.beforeEnter);\n    $scope.$on('$ionicView.afterEnter', afterEnter);\n    $scope.$on('$ionicView.beforeLeave', deregisterFns);\n  };\n\n  self.beforeEnter = function(ev, transData) {\n    // this event was emitted, starting at intial ion-view, then bubbles up\n    // only the first ion-view should do something with it, parent ion-views should ignore\n    if (transData && !transData.viewNotified) {\n      transData.viewNotified = true;\n\n      if (!$rootScope.$$phase) $scope.$digest();\n      viewTitle = isDefined($attrs.viewTitle) ? $attrs.viewTitle : $attrs.title;\n\n      var navBarItems = {};\n      for (var n in navElementHtml) {\n        navBarItems[n] = generateNavBarItem(navElementHtml[n]);\n      }\n\n      navViewCtrl.beforeEnter(extend(transData, {\n        title: viewTitle,\n        showBack: !attrTrue('hideBackButton'),\n        navBarItems: navBarItems,\n        navBarDelegate: navBarDelegateHandle || null,\n        showNavBar: !attrTrue('hideNavBar'),\n        hasHeaderBar: !!hasViewHeaderBar\n      }));\n\n      // make sure any existing observers are cleaned up\n      deregisterFns();\n    }\n  };\n\n\n  function afterEnter() {\n    // only listen for title updates after it has entered\n    // but also deregister the observe before it leaves\n    var viewTitleAttr = isDefined($attrs.viewTitle) && 'viewTitle' || isDefined($attrs.title) && 'title';\n    if (viewTitleAttr) {\n      titleUpdate($attrs[viewTitleAttr]);\n      deregisters.push($attrs.$observe(viewTitleAttr, titleUpdate));\n    }\n\n    if (isDefined($attrs.hideBackButton)) {\n      deregisters.push($scope.$watch($attrs.hideBackButton, function(val) {\n        navViewCtrl.showBackButton(!val);\n      }));\n    }\n\n    if (isDefined($attrs.hideNavBar)) {\n      deregisters.push($scope.$watch($attrs.hideNavBar, function(val) {\n        navViewCtrl.showBar(!val);\n      }));\n    }\n  }\n\n\n  function titleUpdate(newTitle) {\n    if (isDefined(newTitle) && newTitle !== viewTitle) {\n      viewTitle = newTitle;\n      navViewCtrl.title(viewTitle);\n    }\n  }\n\n\n  function deregisterFns() {\n    // remove all existing $attrs.$observe's\n    for (var x = 0; x < deregisters.length; x++) {\n      deregisters[x]();\n    }\n    deregisters = [];\n  }\n\n\n  function generateNavBarItem(html) {\n    if (html) {\n      // every time a view enters we need to recreate its view buttons if they exist\n      return $compile(html)($scope.$new());\n    }\n  }\n\n\n  function attrTrue(key) {\n    return !!$scope.$eval($attrs[key]);\n  }\n\n\n  self.navElement = function(type, html) {\n    navElementHtml[type] = html;\n  };\n\n}]);\n\n/*\n * We don't document the ionActionSheet directive, we instead document\n * the $ionicActionSheet service\n */\nIonicModule\n.directive('ionActionSheet', ['$document', function($document) {\n  return {\n    restrict: 'E',\n    scope: true,\n    replace: true,\n    link: function($scope, $element) {\n\n      var keyUp = function(e) {\n        if (e.which == 27) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n\n      var backdropClick = function(e) {\n        if (e.target == $element[0]) {\n          $scope.cancel();\n          $scope.$apply();\n        }\n      };\n      $scope.$on('$destroy', function() {\n        $element.remove();\n        $document.unbind('keyup', keyUp);\n      });\n\n      $document.bind('keyup', keyUp);\n      $element.bind('click', backdropClick);\n    },\n    template: '<div class=\"action-sheet-backdrop\">' +\n                '<div class=\"action-sheet-wrapper\">' +\n                  '<div class=\"action-sheet\" ng-class=\"{\\'action-sheet-has-icons\\': $actionSheetHasIcon}\">' +\n                    '<div class=\"action-sheet-group action-sheet-options\">' +\n                      '<div class=\"action-sheet-title\" ng-if=\"titleText\" ng-bind-html=\"titleText\"></div>' +\n                      '<button class=\"button action-sheet-option\" ng-click=\"buttonClicked($index)\" ng-class=\"b.className\" ng-repeat=\"b in buttons\" ng-bind-html=\"b.text\"></button>' +\n                      '<button class=\"button destructive action-sheet-destructive\" ng-if=\"destructiveText\" ng-click=\"destructiveButtonClicked()\" ng-bind-html=\"destructiveText\"></button>' +\n                    '</div>' +\n                    '<div class=\"action-sheet-group action-sheet-cancel\" ng-if=\"cancelText\">' +\n                      '<button class=\"button\" ng-click=\"cancel()\" ng-bind-html=\"cancelText\"></button>' +\n                    '</div>' +\n                  '</div>' +\n                '</div>' +\n              '</div>'\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionCheckbox\n * @module ionic\n * @restrict E\n * @codepen hqcju\n * @description\n * The checkbox is no different than the HTML checkbox input, except it's styled differently.\n *\n * The checkbox behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]).\n *\n * @usage\n * ```html\n * <ion-checkbox ng-model=\"isChecked\">Checkbox Label</ion-checkbox>\n * ```\n */\n\nIonicModule\n.directive('ionCheckbox', ['$ionicConfig', function($ionicConfig) {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-checkbox\">' +\n        '<div class=\"checkbox checkbox-input-hidden disable-pointer-events\">' +\n          '<input type=\"checkbox\">' +\n          '<i class=\"checkbox-icon\"></i>' +\n        '</div>' +\n        '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n      '</label>',\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange,\n        'ng-required': attr.ngRequired,\n        'required': attr.required\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n      var checkboxWrapper = element[0].querySelector('.checkbox');\n      checkboxWrapper.classList.add('checkbox-' + $ionicConfig.form.checkbox());\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @restrict A\n * @name collectionRepeat\n * @module ionic\n * @codepen 7ec1ec58f2489ab8f359fa1a0fe89c15\n * @description\n * `collection-repeat` allows an app to show huge lists of items much more performantly than\n * `ng-repeat`.\n *\n * It renders into the DOM only as many items as are currently visible.\n *\n * This means that on a phone screen that can fit eight items, only the eight items matching\n * the current scroll position will be rendered.\n *\n * **The Basics**:\n *\n * - The data given to collection-repeat must be an array.\n * - If the `item-height` and `item-width` attributes are not supplied, it will be assumed that\n *   every item in the list has the same dimensions as the first item.\n * - Don't use angular one-time binding (`::`) with collection-repeat. The scope of each item is\n *   assigned new data and re-digested as you scroll. Bindings need to update, and one-time bindings\n *   won't.\n *\n * **Performance Tips**:\n *\n * - The iOS webview has a performance bottleneck when switching out `<img src>` attributes.\n *   To increase performance of images on iOS, cache your images in advance and,\n *   if possible, lower the number of unique images. We're working on [a solution](https://github.com/driftyco/ionic/issues/3194).\n *\n * @usage\n * #### Basic Item List ([codepen](http://codepen.io/ionic/pen/0c2c35a34a8b18ad4d793fef0b081693))\n * ```html\n * <ion-content>\n *   <ion-item collection-repeat=\"item in items\">\n *     {% raw %}{{item}}{% endraw %}\n *   </ion-item>\n * </ion-content>\n * ```\n *\n * #### Grid of Images ([codepen](http://codepen.io/ionic/pen/5515d4efd9d66f780e96787387f41664))\n * ```html\n * <ion-content>\n *   <img collection-repeat=\"photo in photos\"\n *     item-width=\"33%\"\n *     item-height=\"200px\"\n *     ng-src=\"{% raw %}{{photo.url}}{% endraw %}\">\n * </ion-content>\n * ```\n *\n * #### Horizontal Scroller, Dynamic Item Width ([codepen](http://codepen.io/ionic/pen/67cc56b349124a349acb57a0740e030e))\n * ```html\n * <ion-content>\n *   <h2>Available Kittens:</h2>\n *   <ion-scroll direction=\"x\" class=\"available-scroller\">\n *     <div class=\"photo\" collection-repeat=\"photo in main.photos\"\n *        item-height=\"250\" item-width=\"photo.width + 30\">\n *        <img ng-src=\"{% raw %}{{photo.src}}{% endraw %}\">\n *     </div>\n *   </ion-scroll>\n * </ion-content>\n * ```\n *\n * @param {expression} collection-repeat The expression indicating how to enumerate a collection,\n *   of the format  `variable in expression` – where variable is the user defined loop variable\n *   and `expression` is a scope expression giving the collection to enumerate.\n *   For example: `album in artist.albums` or `album in artist.albums | orderBy:'name'`.\n * @param {expression=} item-width The width of the repeated element. The expression must return\n *   a number (pixels) or a percentage. Defaults to the width of the first item in the list.\n *   (previously named collection-item-width)\n * @param {expression=} item-height The height of the repeated element. The expression must return\n *   a number (pixels) or a percentage. Defaults to the height of the first item in the list.\n *   (previously named collection-item-height)\n * @param {number=} item-render-buffer The number of items to load before and after the visible\n *   items in the list. Default 3. Tip: set this higher if you have lots of images to preload, but\n *   don't set it too high or you'll see performance loss.\n * @param {boolean=} force-refresh-images Force images to refresh as you scroll. This fixes a problem\n *   where, when an element is interchanged as scrolling, its image will still have the old src\n *   while the new src loads. Setting this to true comes with a small performance loss.\n */\n\nIonicModule\n.directive('collectionRepeat', CollectionRepeatDirective)\n.factory('$ionicCollectionManager', RepeatManagerFactory);\n\nvar ONE_PX_TRANSPARENT_IMG_SRC = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7';\nvar WIDTH_HEIGHT_REGEX = /height:.*?px;\\s*width:.*?px/;\nvar DEFAULT_RENDER_BUFFER = 3;\n\nCollectionRepeatDirective.$inject = ['$ionicCollectionManager', '$parse', '$window', '$$rAF', '$rootScope', '$timeout'];\nfunction CollectionRepeatDirective($ionicCollectionManager, $parse, $window, $$rAF, $rootScope, $timeout) {\n  return {\n    restrict: 'A',\n    priority: 1000,\n    transclude: 'element',\n    $$tlb: true,\n    require: '^^$ionicScroll',\n    link: postLink\n  };\n\n  function postLink(scope, element, attr, scrollCtrl, transclude) {\n    var scrollView = scrollCtrl.scrollView;\n    var node = element[0];\n    var containerNode = angular.element('<div class=\"collection-repeat-container\">')[0];\n    node.parentNode.replaceChild(containerNode, node);\n\n    if (scrollView.options.scrollingX && scrollView.options.scrollingY) {\n      throw new Error(\"collection-repeat expected a parent x or y scrollView, not \" +\n                      \"an xy scrollView.\");\n    }\n\n    var repeatExpr = attr.collectionRepeat;\n    var match = repeatExpr.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);\n    if (!match) {\n      throw new Error(\"collection-repeat expected expression in form of '_item_ in \" +\n                      \"_collection_[ track by _id_]' but got '\" + attr.collectionRepeat + \"'.\");\n    }\n    var keyExpr = match[1];\n    var listExpr = match[2];\n    var listGetter = $parse(listExpr);\n    var heightData = {};\n    var widthData = {};\n    var computedStyleDimensions = {};\n    var data = [];\n    var repeatManager;\n\n    // attr.collectionBufferSize is deprecated\n    var renderBufferExpr = attr.itemRenderBuffer || attr.collectionBufferSize;\n    var renderBuffer = angular.isDefined(renderBufferExpr) ?\n      parseInt(renderBufferExpr) :\n      DEFAULT_RENDER_BUFFER;\n\n    // attr.collectionItemHeight is deprecated\n    var heightExpr = attr.itemHeight || attr.collectionItemHeight;\n    // attr.collectionItemWidth is deprecated\n    var widthExpr = attr.itemWidth || attr.collectionItemWidth;\n\n    var afterItemsContainer = initAfterItemsContainer();\n\n    var changeValidator = makeChangeValidator();\n    initDimensions();\n\n    // Dimensions are refreshed on resize or data change.\n    scrollCtrl.$element.on('scroll-resize', refreshDimensions);\n\n    angular.element($window).on('resize', onResize);\n    var unlistenToExposeAside = $rootScope.$on('$ionicExposeAside', ionic.animationFrameThrottle(function() {\n      scrollCtrl.scrollView.resize();\n      onResize();\n    }));\n    $timeout(refreshDimensions, 0, false);\n\n    function onResize() {\n      if (changeValidator.resizeRequiresRefresh(scrollView.__clientWidth, scrollView.__clientHeight)) {\n        refreshDimensions();\n      }\n    }\n\n    scope.$watchCollection(listGetter, function(newValue) {\n      data = newValue || (newValue = []);\n      if (!angular.isArray(newValue)) {\n        throw new Error(\"collection-repeat expected an array for '\" + listExpr + \"', \" +\n          \"but got a \" + typeof value);\n      }\n      // Wait for this digest to end before refreshing everything.\n      scope.$$postDigest(function() {\n        getRepeatManager().setData(data);\n        if (changeValidator.dataChangeRequiresRefresh(data)) refreshDimensions();\n      });\n    });\n\n    scope.$on('$destroy', function() {\n      angular.element($window).off('resize', onResize);\n      unlistenToExposeAside();\n      scrollCtrl.$element && scrollCtrl.$element.off('scroll-resize', refreshDimensions);\n\n      computedStyleNode && computedStyleNode.parentNode &&\n        computedStyleNode.parentNode.removeChild(computedStyleNode);\n      computedStyleScope && computedStyleScope.$destroy();\n      computedStyleScope = computedStyleNode = null;\n\n      repeatManager && repeatManager.destroy();\n      repeatManager = null;\n    });\n\n    function makeChangeValidator() {\n      var self;\n      return (self = {\n        dataLength: 0,\n        width: 0,\n        height: 0,\n        // A resize triggers a refresh only if we have data, the scrollView has size,\n        // and the size has changed.\n        resizeRequiresRefresh: function(newWidth, newHeight) {\n          var requiresRefresh = self.dataLength && newWidth && newHeight &&\n            (newWidth !== self.width || newHeight !== self.height);\n\n          self.width = newWidth;\n          self.height = newHeight;\n\n          return !!requiresRefresh;\n        },\n        // A change in data only triggers a refresh if the data has length, or if the data's\n        // length is less than before.\n        dataChangeRequiresRefresh: function(newData) {\n          var requiresRefresh = newData.length > 0 || newData.length < self.dataLength;\n\n          self.dataLength = newData.length;\n\n          return !!requiresRefresh;\n        }\n      });\n    }\n\n    function getRepeatManager() {\n      return repeatManager || (repeatManager = new $ionicCollectionManager({\n        afterItemsNode: afterItemsContainer[0],\n        containerNode: containerNode,\n        heightData: heightData,\n        widthData: widthData,\n        forceRefreshImages: !!(isDefined(attr.forceRefreshImages) && attr.forceRefreshImages !== 'false'),\n        keyExpression: keyExpr,\n        renderBuffer: renderBuffer,\n        scope: scope,\n        scrollView: scrollCtrl.scrollView,\n        transclude: transclude\n      }));\n    }\n\n    function initAfterItemsContainer() {\n      var container = angular.element(\n        scrollView.__content.querySelector('.collection-repeat-after-container')\n      );\n      // Put everything in the view after the repeater into a container.\n      if (!container.length) {\n        var elementIsAfterRepeater = false;\n        var afterNodes = [].filter.call(scrollView.__content.childNodes, function(node) {\n          if (ionic.DomUtil.contains(node, containerNode)) {\n            elementIsAfterRepeater = true;\n            return false;\n          }\n          return elementIsAfterRepeater;\n        });\n        container = angular.element('<span class=\"collection-repeat-after-container\">');\n        if (scrollView.options.scrollingX) {\n          container.addClass('horizontal');\n        }\n        container.append(afterNodes);\n        scrollView.__content.appendChild(container[0]);\n      }\n      return container;\n    }\n\n    function initDimensions() {\n      //Height and width have four 'modes':\n      //1) Computed Mode\n      //  - Nothing is supplied, so we getComputedStyle() on one element in the list and use\n      //    that width and height value for the width and height of every item. This is re-computed\n      //    every resize.\n      //2) Constant Mode, Static Integer\n      //  - The user provides a constant number for width or height, in pixels. We parse it,\n      //    store it on the `value` field, and it never changes\n      //3) Constant Mode, Percent\n      //  - The user provides a percent string for width or height. The getter for percent is\n      //    stored on the `getValue()` field, and is re-evaluated once every resize. The result\n      //    is stored on the `value` field.\n      //4) Dynamic Mode\n      //  - The user provides a dynamic expression for the width or height.  This is re-evaluated\n      //    for every item, stored on the `.getValue()` field.\n      if (heightExpr) {\n        parseDimensionAttr(heightExpr, heightData);\n      } else {\n        heightData.computed = true;\n      }\n      if (widthExpr) {\n        parseDimensionAttr(widthExpr, widthData);\n      } else {\n        widthData.computed = true;\n      }\n    }\n\n    function refreshDimensions() {\n      var hasData = data.length > 0;\n\n      if (hasData && (heightData.computed || widthData.computed)) {\n        computeStyleDimensions();\n      }\n\n      if (hasData && heightData.computed) {\n        heightData.value = computedStyleDimensions.height;\n        if (!heightData.value) {\n          throw new Error('collection-repeat tried to compute the height of repeated elements \"' +\n            repeatExpr + '\", but was unable to. Please provide the \"item-height\" attribute. ' +\n            'http://ionicframework.com/docs/api/directive/collectionRepeat/');\n        }\n      } else if (!heightData.dynamic && heightData.getValue) {\n        // If it's a constant with a getter (eg percent), we just refresh .value after resize\n        heightData.value = heightData.getValue();\n      }\n\n      if (hasData && widthData.computed) {\n        widthData.value = computedStyleDimensions.width;\n        if (!widthData.value) {\n          throw new Error('collection-repeat tried to compute the width of repeated elements \"' +\n            repeatExpr + '\", but was unable to. Please provide the \"item-width\" attribute. ' +\n            'http://ionicframework.com/docs/api/directive/collectionRepeat/');\n        }\n      } else if (!widthData.dynamic && widthData.getValue) {\n        // If it's a constant with a getter (eg percent), we just refresh .value after resize\n        widthData.value = widthData.getValue();\n      }\n      // Dynamic dimensions aren't updated on resize. Since they're already dynamic anyway,\n      // .getValue() will be used.\n\n      getRepeatManager().refreshLayout();\n    }\n\n    function parseDimensionAttr(attrValue, dimensionData) {\n      if (!attrValue) return;\n\n      var parsedValue;\n      // Try to just parse the plain attr value\n      try {\n        parsedValue = $parse(attrValue);\n      } catch (e) {\n        // If the parse fails and the value has `px` or `%` in it, surround the attr in\n        // quotes, to attempt to let the user provide a simple `attr=\"100%\"` or `attr=\"100px\"`\n        if (attrValue.trim().match(/\\d+(px|%)$/)) {\n          attrValue = '\"' + attrValue + '\"';\n        }\n        parsedValue = $parse(attrValue);\n      }\n\n      var constantAttrValue = attrValue.replace(/(\\'|\\\"|px|%)/g, '').trim();\n      var isConstant = constantAttrValue.length && !/([a-zA-Z]|\\$|:|\\?)/.test(constantAttrValue);\n      dimensionData.attrValue = attrValue;\n\n      // If it's a constant, it's either a percent or just a constant pixel number.\n      if (isConstant) {\n        // For percents, store the percent getter on .getValue()\n        if (attrValue.indexOf('%') > -1) {\n          var decimalValue = parseFloat(parsedValue()) / 100;\n          dimensionData.getValue = dimensionData === heightData ?\n            function() { return Math.floor(decimalValue * scrollView.__clientHeight); } :\n            function() { return Math.floor(decimalValue * scrollView.__clientWidth); };\n        } else {\n          // For static constants, just store the static constant.\n          dimensionData.value = parseInt(parsedValue());\n        }\n\n      } else {\n        dimensionData.dynamic = true;\n        dimensionData.getValue = dimensionData === heightData ?\n          function heightGetter(scope, locals) {\n            var result = parsedValue(scope, locals);\n            if (result.charAt && result.charAt(result.length - 1) === '%') {\n              return Math.floor(parseFloat(result) / 100 * scrollView.__clientHeight);\n            }\n            return parseInt(result);\n          } :\n          function widthGetter(scope, locals) {\n            var result = parsedValue(scope, locals);\n            if (result.charAt && result.charAt(result.length - 1) === '%') {\n              return Math.floor(parseFloat(result) / 100 * scrollView.__clientWidth);\n            }\n            return parseInt(result);\n          };\n      }\n    }\n\n    var computedStyleNode;\n    var computedStyleScope;\n    function computeStyleDimensions() {\n      if (!computedStyleNode) {\n        transclude(computedStyleScope = scope.$new(), function(clone) {\n          clone[0].removeAttribute('collection-repeat'); // remove absolute position styling\n          computedStyleNode = clone[0];\n        });\n      }\n\n      computedStyleScope[keyExpr] = (listGetter(scope) || [])[0];\n      if (!$rootScope.$$phase) computedStyleScope.$digest();\n      containerNode.appendChild(computedStyleNode);\n\n      var style = $window.getComputedStyle(computedStyleNode);\n      computedStyleDimensions.width = parseInt(style.width);\n      computedStyleDimensions.height = parseInt(style.height);\n\n      containerNode.removeChild(computedStyleNode);\n    }\n\n  }\n\n}\n\nRepeatManagerFactory.$inject = ['$rootScope', '$window', '$$rAF'];\nfunction RepeatManagerFactory($rootScope, $window, $$rAF) {\n  var EMPTY_DIMENSION = { primaryPos: 0, secondaryPos: 0, primarySize: 0, secondarySize: 0, rowPrimarySize: 0 };\n\n  return function RepeatController(options) {\n    var afterItemsNode = options.afterItemsNode;\n    var containerNode = options.containerNode;\n    var forceRefreshImages = options.forceRefreshImages;\n    var heightData = options.heightData;\n    var widthData = options.widthData;\n    var keyExpression = options.keyExpression;\n    var renderBuffer = options.renderBuffer;\n    var scope = options.scope;\n    var scrollView = options.scrollView;\n    var transclude = options.transclude;\n\n    var data = [];\n\n    var getterLocals = {};\n    var heightFn = heightData.getValue || function() { return heightData.value; };\n    var heightGetter = function(index, value) {\n      getterLocals[keyExpression] = value;\n      getterLocals.$index = index;\n      return heightFn(scope, getterLocals);\n    };\n\n    var widthFn = widthData.getValue || function() { return widthData.value; };\n    var widthGetter = function(index, value) {\n      getterLocals[keyExpression] = value;\n      getterLocals.$index = index;\n      return widthFn(scope, getterLocals);\n    };\n\n    var isVertical = !!scrollView.options.scrollingY;\n\n    // We say it's a grid view if we're either dynamic or not 100% width\n    var isGridView = isVertical ?\n      (widthData.dynamic || widthData.value !== scrollView.__clientWidth) :\n      (heightData.dynamic || heightData.value !== scrollView.__clientHeight);\n\n    var isStaticView = !heightData.dynamic && !widthData.dynamic;\n\n    var PRIMARY = 'PRIMARY';\n    var SECONDARY = 'SECONDARY';\n    var TRANSLATE_TEMPLATE_STR = isVertical ?\n      'translate3d(SECONDARYpx,PRIMARYpx,0)' :\n      'translate3d(PRIMARYpx,SECONDARYpx,0)';\n    var WIDTH_HEIGHT_TEMPLATE_STR = isVertical ?\n      'height: PRIMARYpx; width: SECONDARYpx;' :\n      'height: SECONDARYpx; width: PRIMARYpx;';\n\n    var estimatedHeight;\n    var estimatedWidth;\n\n    var repeaterBeforeSize = 0;\n    var repeaterAfterSize = 0;\n\n    var renderStartIndex = -1;\n    var renderEndIndex = -1;\n    var renderAfterBoundary = -1;\n    var renderBeforeBoundary = -1;\n\n    var itemsPool = [];\n    var itemsLeaving = [];\n    var itemsEntering = [];\n    var itemsShownMap = {};\n    var nextItemId = 0;\n\n    var scrollViewSetDimensions = isVertical ?\n      function() { scrollView.setDimensions(null, null, null, view.getContentSize(), true); } :\n      function() { scrollView.setDimensions(null, null, view.getContentSize(), null, true); };\n\n    // view is a mix of list/grid methods + static/dynamic methods.\n    // See bottom for implementations. Available methods:\n    //\n    // getEstimatedPrimaryPos(i), getEstimatedSecondaryPos(i), getEstimatedIndex(scrollTop),\n    // calculateDimensions(toIndex), getDimensions(index),\n    // updateRenderRange(scrollTop, scrollValueEnd), onRefreshLayout(), onRefreshData()\n    var view = isVertical ? new VerticalViewType() : new HorizontalViewType();\n    (isGridView ? GridViewType : ListViewType).call(view);\n    (isStaticView ? StaticViewType : DynamicViewType).call(view);\n\n    var contentSizeStr = isVertical ? 'getContentHeight' : 'getContentWidth';\n    var originalGetContentSize = scrollView.options[contentSizeStr];\n    scrollView.options[contentSizeStr] = angular.bind(view, view.getContentSize);\n\n    scrollView.__$callback = scrollView.__callback;\n    scrollView.__callback = function(transformLeft, transformTop, zoom, wasResize) {\n      var scrollValue = view.getScrollValue();\n      if (renderStartIndex === -1 ||\n          scrollValue + view.scrollPrimarySize > renderAfterBoundary ||\n          scrollValue < renderBeforeBoundary) {\n        render();\n      }\n      scrollView.__$callback(transformLeft, transformTop, zoom, wasResize);\n    };\n\n    var isLayoutReady = false;\n    var isDataReady = false;\n    this.refreshLayout = function() {\n      if (data.length) {\n        estimatedHeight = heightGetter(0, data[0]);\n        estimatedWidth = widthGetter(0, data[0]);\n      } else {\n        // If we don't have any data in our array, just guess.\n        estimatedHeight = 100;\n        estimatedWidth = 100;\n      }\n\n      // Get the size of every element AFTER the repeater. We have to get the margin before and\n      // after the first/last element to fix a browser bug with getComputedStyle() not counting\n      // the first/last child's margins into height.\n      var style = getComputedStyle(afterItemsNode) || {};\n      var firstStyle = afterItemsNode.firstElementChild && getComputedStyle(afterItemsNode.firstElementChild) || {};\n      var lastStyle = afterItemsNode.lastElementChild && getComputedStyle(afterItemsNode.lastElementChild) || {};\n      repeaterAfterSize = (parseInt(style[isVertical ? 'height' : 'width']) || 0) +\n        (firstStyle && parseInt(firstStyle[isVertical ? 'marginTop' : 'marginLeft']) || 0) +\n        (lastStyle && parseInt(lastStyle[isVertical ? 'marginBottom' : 'marginRight']) || 0);\n\n      // Get the offsetTop of the repeater.\n      repeaterBeforeSize = 0;\n      var current = containerNode;\n      do {\n        repeaterBeforeSize += current[isVertical ? 'offsetTop' : 'offsetLeft'];\n      } while ( ionic.DomUtil.contains(scrollView.__content, current = current.offsetParent) );\n\n      var containerPrevNode = containerNode.previousElementSibling;\n      var beforeStyle = containerPrevNode ? $window.getComputedStyle(containerPrevNode) : {};\n      var beforeMargin = parseInt(beforeStyle[isVertical ? 'marginBottom' : 'marginRight'] || 0);\n\n      // Because we position the collection container with position: relative, it doesn't take\n      // into account where to position itself relative to the previous element's marginBottom.\n      // To compensate, we translate the container up by the previous element's margin.\n      containerNode.style[ionic.CSS.TRANSFORM] = TRANSLATE_TEMPLATE_STR\n        .replace(PRIMARY, -beforeMargin)\n        .replace(SECONDARY, 0);\n      repeaterBeforeSize -= beforeMargin;\n\n      if (!scrollView.__clientHeight || !scrollView.__clientWidth) {\n        scrollView.__clientWidth = scrollView.__container.clientWidth;\n        scrollView.__clientHeight = scrollView.__container.clientHeight;\n      }\n\n      (view.onRefreshLayout || angular.noop)();\n      view.refreshDirection();\n      scrollViewSetDimensions();\n\n      // Create the pool of items for reuse, setting the size to (estimatedItemsOnScreen) * 2,\n      // plus the size of the renderBuffer.\n      if (!isLayoutReady) {\n        var poolSize = Math.max(20, renderBuffer * 3);\n        for (var i = 0; i < poolSize; i++) {\n          itemsPool.push(new RepeatItem());\n        }\n      }\n\n      isLayoutReady = true;\n      if (isLayoutReady && isDataReady) {\n        // If the resize or latest data change caused the scrollValue to\n        // now be out of bounds, resize the scrollView.\n        if (scrollView.__scrollLeft > scrollView.__maxScrollLeft ||\n            scrollView.__scrollTop > scrollView.__maxScrollTop) {\n          scrollView.resize();\n        }\n        forceRerender(true);\n      }\n    };\n\n    this.setData = function(newData) {\n      data = newData;\n      (view.onRefreshData || angular.noop)();\n      isDataReady = true;\n    };\n\n    this.destroy = function() {\n      render.destroyed = true;\n\n      itemsPool.forEach(function(item) {\n        item.scope.$destroy();\n        item.scope = item.element = item.node = item.images = null;\n      });\n      itemsPool.length = itemsEntering.length = itemsLeaving.length = 0;\n      itemsShownMap = {};\n\n      //Restore the scrollView's normal behavior and resize it to normal size.\n      scrollView.options[contentSizeStr] = originalGetContentSize;\n      scrollView.__callback = scrollView.__$callback;\n      scrollView.resize();\n\n      (view.onDestroy || angular.noop)();\n    };\n\n    function forceRerender() {\n      return render(true);\n    }\n    function render(forceRerender) {\n      if (render.destroyed) return;\n      var i;\n      var ii;\n      var item;\n      var dim;\n      var scope;\n      var scrollValue = view.getScrollValue();\n      var scrollValueEnd = scrollValue + view.scrollPrimarySize;\n\n      view.updateRenderRange(scrollValue, scrollValueEnd);\n\n      renderStartIndex = Math.max(0, renderStartIndex - renderBuffer);\n      renderEndIndex = Math.min(data.length - 1, renderEndIndex + renderBuffer);\n\n      for (i in itemsShownMap) {\n        if (i < renderStartIndex || i > renderEndIndex) {\n          item = itemsShownMap[i];\n          delete itemsShownMap[i];\n          itemsLeaving.push(item);\n          item.isShown = false;\n        }\n      }\n\n      // Render indicies that aren't shown yet\n      //\n      // NOTE(ajoslin): this may sound crazy, but calling any other functions during this render\n      // loop will often push the render time over the edge from less than one frame to over\n      // one frame, causing visible jank.\n      // DON'T call any other functions inside this loop unless it's vital.\n      for (i = renderStartIndex; i <= renderEndIndex; i++) {\n        // We only go forward with render if the index is in data, the item isn't already shown,\n        // or forceRerender is on.\n        if (i >= data.length || (itemsShownMap[i] && !forceRerender)) continue;\n\n        item = itemsShownMap[i] || (itemsShownMap[i] = itemsLeaving.length ? itemsLeaving.pop() :\n                                    itemsPool.length ? itemsPool.shift() :\n                                    new RepeatItem());\n        itemsEntering.push(item);\n        item.isShown = true;\n\n        scope = item.scope;\n        scope.$index = i;\n        scope[keyExpression] = data[i];\n        scope.$first = (i === 0);\n        scope.$last = (i === (data.length - 1));\n        scope.$middle = !(scope.$first || scope.$last);\n        scope.$odd = !(scope.$even = (i & 1) === 0);\n\n        if (scope.$$disconnected) ionic.Utils.reconnectScope(item.scope);\n\n        dim = view.getDimensions(i);\n        if (item.secondaryPos !== dim.secondaryPos || item.primaryPos !== dim.primaryPos) {\n          item.node.style[ionic.CSS.TRANSFORM] = TRANSLATE_TEMPLATE_STR\n            .replace(PRIMARY, (item.primaryPos = dim.primaryPos))\n            .replace(SECONDARY, (item.secondaryPos = dim.secondaryPos));\n        }\n        if (item.secondarySize !== dim.secondarySize || item.primarySize !== dim.primarySize) {\n          item.node.style.cssText = item.node.style.cssText\n            .replace(WIDTH_HEIGHT_REGEX, WIDTH_HEIGHT_TEMPLATE_STR\n              //TODO fix item.primarySize + 1 hack\n              .replace(PRIMARY, (item.primarySize = dim.primarySize) + 1)\n              .replace(SECONDARY, (item.secondarySize = dim.secondarySize))\n            );\n        }\n\n      }\n\n      // If we reach the end of the list, render the afterItemsNode - this contains all the\n      // elements the developer placed after the collection-repeat\n      if (renderEndIndex === data.length - 1) {\n        dim = view.getDimensions(data.length - 1) || EMPTY_DIMENSION;\n        afterItemsNode.style[ionic.CSS.TRANSFORM] = TRANSLATE_TEMPLATE_STR\n          .replace(PRIMARY, dim.primaryPos + dim.primarySize)\n          .replace(SECONDARY, 0);\n      }\n\n      while (itemsLeaving.length) {\n        item = itemsLeaving.pop();\n        item.scope.$broadcast('$collectionRepeatLeave');\n        ionic.Utils.disconnectScope(item.scope);\n        itemsPool.push(item);\n        item.node.style[ionic.CSS.TRANSFORM] = 'translate3d(-9999px,-9999px,0)';\n        item.primaryPos = item.secondaryPos = null;\n      }\n\n      if (forceRefreshImages) {\n        for (i = 0, ii = itemsEntering.length; i < ii && (item = itemsEntering[i]); i++) {\n          if (!item.images) continue;\n          for (var j = 0, jj = item.images.length, img; j < jj && (img = item.images[j]); j++) {\n            var src = img.src;\n            img.src = ONE_PX_TRANSPARENT_IMG_SRC;\n            img.src = src;\n          }\n        }\n      }\n      if (forceRerender) {\n        var rootScopePhase = $rootScope.$$phase;\n        while (itemsEntering.length) {\n          item = itemsEntering.pop();\n          if (!rootScopePhase) item.scope.$digest();\n        }\n      } else {\n        digestEnteringItems();\n      }\n    }\n\n    function digestEnteringItems() {\n      var item;\n      if (digestEnteringItems.running) return;\n      digestEnteringItems.running = true;\n\n      $$rAF(function process() {\n        var rootScopePhase = $rootScope.$$phase;\n        while (itemsEntering.length) {\n          item = itemsEntering.pop();\n          if (item.isShown) {\n            if (!rootScopePhase) item.scope.$digest();\n          }\n        }\n        digestEnteringItems.running = false;\n      });\n    }\n\n    function RepeatItem() {\n      var self = this;\n      this.scope = scope.$new();\n      this.id = 'item' + (nextItemId++);\n      transclude(this.scope, function(clone) {\n        self.element = clone;\n        self.element.data('$$collectionRepeatItem', self);\n        // TODO destroy\n        self.node = clone[0];\n        // Batch style setting to lower repaints\n        self.node.style[ionic.CSS.TRANSFORM] = 'translate3d(-9999px,-9999px,0)';\n        self.node.style.cssText += ' height: 0px; width: 0px;';\n        ionic.Utils.disconnectScope(self.scope);\n        containerNode.appendChild(self.node);\n        self.images = clone[0].getElementsByTagName('img');\n      });\n    }\n\n    function VerticalViewType() {\n      this.getItemPrimarySize = heightGetter;\n      this.getItemSecondarySize = widthGetter;\n\n      this.getScrollValue = function() {\n        return Math.max(0, Math.min(scrollView.__scrollTop - repeaterBeforeSize,\n          scrollView.__maxScrollTop - repeaterBeforeSize - repeaterAfterSize));\n      };\n\n      this.refreshDirection = function() {\n        this.scrollPrimarySize = scrollView.__clientHeight;\n        this.scrollSecondarySize = scrollView.__clientWidth;\n\n        this.estimatedPrimarySize = estimatedHeight;\n        this.estimatedSecondarySize = estimatedWidth;\n        this.estimatedItemsAcross = isGridView &&\n          Math.floor(scrollView.__clientWidth / estimatedWidth) ||\n          1;\n      };\n    }\n    function HorizontalViewType() {\n      this.getItemPrimarySize = widthGetter;\n      this.getItemSecondarySize = heightGetter;\n\n      this.getScrollValue = function() {\n        return Math.max(0, Math.min(scrollView.__scrollLeft - repeaterBeforeSize,\n          scrollView.__maxScrollLeft - repeaterBeforeSize - repeaterAfterSize));\n      };\n\n      this.refreshDirection = function() {\n        this.scrollPrimarySize = scrollView.__clientWidth;\n        this.scrollSecondarySize = scrollView.__clientHeight;\n\n        this.estimatedPrimarySize = estimatedWidth;\n        this.estimatedSecondarySize = estimatedHeight;\n        this.estimatedItemsAcross = isGridView &&\n          Math.floor(scrollView.__clientHeight / estimatedHeight) ||\n          1;\n      };\n    }\n\n    function GridViewType() {\n      this.getEstimatedSecondaryPos = function(index) {\n        return (index % this.estimatedItemsAcross) * this.estimatedSecondarySize;\n      };\n      this.getEstimatedPrimaryPos = function(index) {\n        return Math.floor(index / this.estimatedItemsAcross) * this.estimatedPrimarySize;\n      };\n      this.getEstimatedIndex = function(scrollValue) {\n        return Math.floor(scrollValue / this.estimatedPrimarySize) *\n          this.estimatedItemsAcross;\n      };\n    }\n\n    function ListViewType() {\n      this.getEstimatedSecondaryPos = function() {\n        return 0;\n      };\n      this.getEstimatedPrimaryPos = function(index) {\n        return index * this.estimatedPrimarySize;\n      };\n      this.getEstimatedIndex = function(scrollValue) {\n        return Math.floor((scrollValue) / this.estimatedPrimarySize);\n      };\n    }\n\n    function StaticViewType() {\n      this.getContentSize = function() {\n        return this.getEstimatedPrimaryPos(data.length - 1) + this.estimatedPrimarySize +\n          repeaterBeforeSize + repeaterAfterSize;\n      };\n      // static view always returns the same object for getDimensions, to avoid memory allocation\n      // while scrolling. This could be dangerous if this was a public function, but it's not.\n      // Only we use it.\n      var dim = {};\n      this.getDimensions = function(index) {\n        dim.primaryPos = this.getEstimatedPrimaryPos(index);\n        dim.secondaryPos = this.getEstimatedSecondaryPos(index);\n        dim.primarySize = this.estimatedPrimarySize;\n        dim.secondarySize = this.estimatedSecondarySize;\n        return dim;\n      };\n      this.updateRenderRange = function(scrollValue, scrollValueEnd) {\n        renderStartIndex = Math.max(0, this.getEstimatedIndex(scrollValue));\n\n        // Make sure the renderEndIndex takes into account all the items on the row\n        renderEndIndex = Math.min(data.length - 1,\n          this.getEstimatedIndex(scrollValueEnd) + this.estimatedItemsAcross - 1);\n\n        renderBeforeBoundary = Math.max(0,\n          this.getEstimatedPrimaryPos(renderStartIndex));\n        renderAfterBoundary = this.getEstimatedPrimaryPos(renderEndIndex) +\n          this.estimatedPrimarySize;\n      };\n    }\n\n    function DynamicViewType() {\n      var self = this;\n      var debouncedScrollViewSetDimensions = ionic.debounce(scrollViewSetDimensions, 25, true);\n      var calculateDimensions = isGridView ? calculateDimensionsGrid : calculateDimensionsList;\n      var dimensionsIndex;\n      var dimensions = [];\n\n\n      // Get the dimensions at index. {width, height, left, top}.\n      // We start with no dimensions calculated, then any time dimensions are asked for at an\n      // index we calculate dimensions up to there.\n      function calculateDimensionsList(toIndex) {\n        var i, prevDimension, dim;\n        for (i = Math.max(0, dimensionsIndex); i <= toIndex && (dim = dimensions[i]); i++) {\n          prevDimension = dimensions[i - 1] || EMPTY_DIMENSION;\n          dim.primarySize = self.getItemPrimarySize(i, data[i]);\n          dim.secondarySize = self.scrollSecondarySize;\n          dim.primaryPos = prevDimension.primaryPos + prevDimension.primarySize;\n          dim.secondaryPos = 0;\n        }\n      }\n      function calculateDimensionsGrid(toIndex) {\n        var i, prevDimension, dim;\n        for (i = Math.max(dimensionsIndex, 0); i <= toIndex && (dim = dimensions[i]); i++) {\n          prevDimension = dimensions[i - 1] || EMPTY_DIMENSION;\n          dim.secondarySize = Math.min(\n            self.getItemSecondarySize(i, data[i]),\n            self.scrollSecondarySize\n          );\n          dim.secondaryPos = prevDimension.secondaryPos + prevDimension.secondarySize;\n\n          if (i === 0 || dim.secondaryPos + dim.secondarySize > self.scrollSecondarySize) {\n            dim.secondaryPos = 0;\n            dim.primarySize = self.getItemPrimarySize(i, data[i]);\n            dim.primaryPos = prevDimension.primaryPos + prevDimension.rowPrimarySize;\n\n            dim.rowStartIndex = i;\n            dim.rowPrimarySize = dim.primarySize;\n          } else {\n            dim.primarySize = self.getItemPrimarySize(i, data[i]);\n            dim.primaryPos = prevDimension.primaryPos;\n            dim.rowStartIndex = prevDimension.rowStartIndex;\n\n            dimensions[dim.rowStartIndex].rowPrimarySize = dim.rowPrimarySize = Math.max(\n              dimensions[dim.rowStartIndex].rowPrimarySize,\n              dim.primarySize\n            );\n            dim.rowPrimarySize = Math.max(dim.primarySize, dim.rowPrimarySize);\n          }\n        }\n      }\n\n      this.getContentSize = function() {\n        var dim = dimensions[dimensionsIndex] || EMPTY_DIMENSION;\n        return ((dim.primaryPos + dim.primarySize) || 0) +\n          this.getEstimatedPrimaryPos(data.length - dimensionsIndex - 1) +\n          repeaterBeforeSize + repeaterAfterSize;\n      };\n      this.onDestroy = function() {\n        dimensions.length = 0;\n      };\n\n      this.onRefreshData = function() {\n        var i;\n        var ii;\n        // Make sure dimensions has as many items as data.length.\n        // This is to be sure we don't have to allocate objects while scrolling.\n        for (i = dimensions.length, ii = data.length; i < ii; i++) {\n          dimensions.push({});\n        }\n        dimensionsIndex = -1;\n      };\n      this.onRefreshLayout = function() {\n        dimensionsIndex = -1;\n      };\n      this.getDimensions = function(index) {\n        index = Math.min(index, data.length - 1);\n\n        if (dimensionsIndex < index) {\n          // Once we start asking for dimensions near the end of the list, go ahead and calculate\n          // everything. This is to make sure when the user gets to the end of the list, the\n          // scroll height of the list is 100% accurate (not estimated anymore).\n          if (index > data.length * 0.9) {\n            calculateDimensions(data.length - 1);\n            dimensionsIndex = data.length - 1;\n            scrollViewSetDimensions();\n          } else {\n            calculateDimensions(index);\n            dimensionsIndex = index;\n            debouncedScrollViewSetDimensions();\n          }\n\n        }\n        return dimensions[index];\n      };\n\n      var oldRenderStartIndex = -1;\n      var oldScrollValue = -1;\n      this.updateRenderRange = function(scrollValue, scrollValueEnd) {\n        var i;\n        var len;\n        var dim;\n\n        // Calculate more dimensions than we estimate we'll need, to be sure.\n        this.getDimensions( this.getEstimatedIndex(scrollValueEnd) * 2 );\n\n        // -- Calculate renderStartIndex\n        // base case: start at 0\n        if (oldRenderStartIndex === -1 || scrollValue === 0) {\n          i = 0;\n        // scrolling down\n        } else if (scrollValue >= oldScrollValue) {\n          for (i = oldRenderStartIndex, len = data.length; i < len; i++) {\n            if ((dim = this.getDimensions(i)) && dim.primaryPos + dim.rowPrimarySize >= scrollValue) {\n              break;\n            }\n          }\n        // scrolling up\n        } else {\n          for (i = oldRenderStartIndex; i >= 0; i--) {\n            if ((dim = this.getDimensions(i)) && dim.primaryPos <= scrollValue) {\n              // when grid view, make sure the render starts at the beginning of a row.\n              i = isGridView ? dim.rowStartIndex : i;\n              break;\n            }\n          }\n        }\n\n        renderStartIndex = Math.min(Math.max(0, i), data.length - 1);\n        renderBeforeBoundary = renderStartIndex !== -1 ? this.getDimensions(renderStartIndex).primaryPos : -1;\n\n        // -- Calculate renderEndIndex\n        var lastRowDim;\n        for (i = renderStartIndex + 1, len = data.length; i < len; i++) {\n          if ((dim = this.getDimensions(i)) && dim.primaryPos + dim.rowPrimarySize > scrollValueEnd) {\n\n            // Go all the way to the end of the row if we're in a grid\n            if (isGridView) {\n              lastRowDim = dim;\n              while (i < len - 1 &&\n                    (dim = this.getDimensions(i + 1)).primaryPos === lastRowDim.primaryPos) {\n                i++;\n              }\n            }\n            break;\n          }\n        }\n\n        renderEndIndex = Math.min(i, data.length - 1);\n        renderAfterBoundary = renderEndIndex !== -1 ?\n          ((dim = this.getDimensions(renderEndIndex)).primaryPos + (dim.rowPrimarySize || dim.primarySize)) :\n          -1;\n\n        oldScrollValue = scrollValue;\n        oldRenderStartIndex = renderStartIndex;\n      };\n    }\n\n\n  };\n\n}\n\n/**\n * @ngdoc directive\n * @name ionContent\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @restrict E\n *\n * @description\n * The ionContent directive provides an easy to use content area that can be configured\n * to use Ionic's custom Scroll View, or the built in overflow scrolling of the browser.\n *\n * While we recommend using the custom Scroll features in Ionic in most cases, sometimes\n * (for performance reasons) only the browser's native overflow scrolling will suffice,\n * and so we've made it easy to toggle between the Ionic scroll implementation and\n * overflow scrolling.\n *\n * You can implement pull-to-refresh with the {@link ionic.directive:ionRefresher}\n * directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}\n * directive.\n *\n * If there is any dynamic content inside the ion-content, be sure to call `.resize()` with {@link ionic.service:$ionicScrollDelegate}\n * after the content has been added.\n *\n * Be aware that this directive gets its own child scope. If you do not understand why this\n * is important, you can read [https://docs.angularjs.org/guide/scope](https://docs.angularjs.org/guide/scope).\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} padding Whether to add padding to the content.\n * Defaults to true on iOS, false on Android.\n * @param {boolean=} scroll Whether to allow scrolling of content.  Defaults to true.\n * @param {boolean=} overflow-scroll Whether to use overflow-scrolling instead of\n * Ionic scroll. See {@link ionic.provider:$ionicConfigProvider} to set this as the global default.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {string=} start-x Initial horizontal scroll position. Default 0.\n * @param {string=} start-y Initial vertical scroll position. Default 0.\n * @param {expression=} on-scroll Expression to evaluate when the content is scrolled.\n * @param {expression=} on-scroll-complete Expression to evaluate when a scroll action completes. Has access to 'scrollLeft' and 'scrollTop' locals.\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n * @param {number=} scroll-event-interval Number of milliseconds between each firing of the 'on-scroll' expression. Default 10.\n */\nIonicModule\n.directive('ionContent', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\n  '$ionicConfig',\nfunction($timeout, $controller, $ionicBind, $ionicConfig) {\n  return {\n    restrict: 'E',\n    require: '^?ionNavView',\n    scope: true,\n    priority: 800,\n    compile: function(element, attr) {\n      var innerElement;\n      var scrollCtrl;\n\n      element.addClass('scroll-content ionic-scroll');\n\n      if (attr.scroll != 'false') {\n        //We cannot use normal transclude here because it breaks element.data()\n        //inheritance on compile\n        innerElement = jqLite('<div class=\"scroll\"></div>');\n        innerElement.append(element.contents());\n        element.append(innerElement);\n      } else {\n        element.addClass('scroll-content-false');\n      }\n\n      var nativeScrolling = attr.overflowScroll !== \"false\" && (attr.overflowScroll === \"true\" || !$ionicConfig.scrolling.jsScrolling());\n\n      // collection-repeat requires JS scrolling\n      if (nativeScrolling) {\n        nativeScrolling = !element[0].querySelector('[collection-repeat]');\n      }\n      return { pre: prelink };\n      function prelink($scope, $element, $attr) {\n        var parentScope = $scope.$parent;\n        $scope.$watch(function() {\n          return (parentScope.$hasHeader ? ' has-header' : '') +\n            (parentScope.$hasSubheader ? ' has-subheader' : '') +\n            (parentScope.$hasFooter ? ' has-footer' : '') +\n            (parentScope.$hasSubfooter ? ' has-subfooter' : '') +\n            (parentScope.$hasTabs ? ' has-tabs' : '') +\n            (parentScope.$hasTabsTop ? ' has-tabs-top' : '');\n        }, function(className, oldClassName) {\n          $element.removeClass(oldClassName);\n          $element.addClass(className);\n        });\n\n        //Only this ionContent should use these variables from parent scopes\n        $scope.$hasHeader = $scope.$hasSubheader =\n          $scope.$hasFooter = $scope.$hasSubfooter =\n          $scope.$hasTabs = $scope.$hasTabsTop =\n          false;\n        $ionicBind($scope, $attr, {\n          $onScroll: '&onScroll',\n          $onScrollComplete: '&onScrollComplete',\n          hasBouncing: '@',\n          padding: '@',\n          direction: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          startX: '@',\n          startY: '@',\n          scrollEventInterval: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n              (innerElement || $element).toggleClass('padding', !!newVal);\n          });\n        }\n\n        if ($attr.scroll === \"false\") {\n          //do nothing\n        } else {\n          var scrollViewOptions = {};\n\n          // determined in compile phase above\n          if (nativeScrolling) {\n            // use native scrolling\n            $element.addClass('overflow-scroll');\n\n            scrollViewOptions = {\n              el: $element[0],\n              delegateHandle: attr.delegateHandle,\n              startX: $scope.$eval($scope.startX) || 0,\n              startY: $scope.$eval($scope.startY) || 0,\n              nativeScrolling: true\n            };\n\n          } else {\n            // Use JS scrolling\n            scrollViewOptions = {\n              el: $element[0],\n              delegateHandle: attr.delegateHandle,\n              locking: (attr.locking || 'true') === 'true',\n              bouncing: $scope.$eval($scope.hasBouncing),\n              startX: $scope.$eval($scope.startX) || 0,\n              startY: $scope.$eval($scope.startY) || 0,\n              scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n              scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n              scrollingX: $scope.direction.indexOf('x') >= 0,\n              scrollingY: $scope.direction.indexOf('y') >= 0,\n              scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 10,\n              scrollingComplete: onScrollComplete\n            };\n          }\n\n          // init scroll controller with appropriate options\n          scrollCtrl = $controller('$ionicScroll', {\n            $scope: $scope,\n            scrollViewOptions: scrollViewOptions\n          });\n\n          $scope.scrollCtrl = scrollCtrl;\n\n          $scope.$on('$destroy', function() {\n            if (scrollViewOptions) {\n              scrollViewOptions.scrollingComplete = noop;\n              delete scrollViewOptions.el;\n            }\n            innerElement = null;\n            $element = null;\n            attr.$$element = null;\n          });\n        }\n\n        function onScrollComplete() {\n          $scope.$onScrollComplete({\n            scrollTop: scrollCtrl.scrollView.__scrollTop,\n            scrollLeft: scrollCtrl.scrollView.__scrollLeft\n          });\n        }\n\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name exposeAsideWhen\n * @module ionic\n * @restrict A\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * It is common for a tablet application to hide a menu when in portrait mode, but to show the\n * same menu on the left side when the tablet is in landscape mode. The `exposeAsideWhen` attribute\n * directive can be used to accomplish a similar interface.\n *\n * By default, side menus are hidden underneath its side menu content, and can be opened by either\n * swiping the content left or right, or toggling a button to show the side menu. However, by adding the\n * `exposeAsideWhen` attribute directive to an {@link ionic.directive:ionSideMenu} element directive,\n * a side menu can be given instructions on \"when\" the menu should be exposed (always viewable). For\n * example, the `expose-aside-when=\"large\"` attribute will keep the side menu hidden when the viewport's\n * width is less than `768px`, but when the viewport's width is `768px` or greater, the menu will then\n * always be shown and can no longer be opened or closed like it could when it was hidden for smaller\n * viewports.\n *\n * Using `large` as the attribute's value is a shortcut value to `(min-width:768px)` since it is\n * the most common use-case. However, for added flexibility, any valid media query could be added\n * as the value, such as `(min-width:600px)` or even multiple queries such as\n * `(min-width:750px) and (max-width:1200px)`.\n * @usage\n * ```html\n * <ion-side-menus>\n *   <!-- Center content -->\n *   <ion-side-menu-content>\n *   </ion-side-menu-content>\n *\n *   <!-- Left menu -->\n *   <ion-side-menu expose-aside-when=\"large\">\n *   </ion-side-menu>\n * </ion-side-menus>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n */\n\nIonicModule.directive('exposeAsideWhen', ['$window', function($window) {\n  return {\n    restrict: 'A',\n    require: '^ionSideMenus',\n    link: function($scope, $element, $attr, sideMenuCtrl) {\n\n      var prevInnerWidth = $window.innerWidth;\n      var prevInnerHeight = $window.innerHeight;\n\n      ionic.on('resize', function() {\n        if (prevInnerWidth === $window.innerWidth && prevInnerHeight === $window.innerHeight) {\n          return;\n        }\n        prevInnerWidth = $window.innerWidth;\n        prevInnerHeight = $window.innerHeight;\n        onResize();\n      }, $window);\n\n      function checkAsideExpose() {\n        var mq = $attr.exposeAsideWhen == 'large' ? '(min-width:768px)' : $attr.exposeAsideWhen;\n        sideMenuCtrl.exposeAside($window.matchMedia(mq).matches);\n        sideMenuCtrl.activeAsideResizing(false);\n      }\n\n      function onResize() {\n        sideMenuCtrl.activeAsideResizing(true);\n        debouncedCheck();\n      }\n\n      var debouncedCheck = ionic.debounce(function() {\n        $scope.$apply(checkAsideExpose);\n      }, 300, false);\n\n      $scope.$evalAsync(checkAsideExpose);\n    }\n  };\n}]);\n\nvar GESTURE_DIRECTIVES = 'onHold onTap onDoubleTap onTouch onRelease onDragStart onDrag onDragEnd onDragUp onDragRight onDragDown onDragLeft onSwipe onSwipeUp onSwipeRight onSwipeDown onSwipeLeft'.split(' ');\n\nGESTURE_DIRECTIVES.forEach(function(name) {\n  IonicModule.directive(name, gestureDirective(name));\n});\n\n\n/**\n * @ngdoc directive\n * @name onHold\n * @module ionic\n * @restrict A\n *\n * @description\n * Touch stays at the same location for 500ms. Similar to long touch events available for AngularJS and jQuery.\n *\n * @usage\n * ```html\n * <button on-hold=\"onHold()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTap\n * @module ionic\n * @restrict A\n *\n * @description\n * Quick touch at a location. If the duration of the touch goes\n * longer than 250ms it is no longer a tap gesture.\n *\n * @usage\n * ```html\n * <button on-tap=\"onTap()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDoubleTap\n * @module ionic\n * @restrict A\n *\n * @description\n * Double tap touch at a location.\n *\n * @usage\n * ```html\n * <button on-double-tap=\"onDoubleTap()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onTouch\n * @module ionic\n * @restrict A\n *\n * @description\n * Called immediately when the user first begins a touch. This\n * gesture does not wait for a touchend/mouseup.\n *\n * @usage\n * ```html\n * <button on-touch=\"onTouch()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onRelease\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the user ends a touch.\n *\n * @usage\n * ```html\n * <button on-release=\"onRelease()\" class=\"button\">Test</button>\n * ```\n */\n\n/**\n * @ngdoc directive\n * @name onDragStart\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a drag gesture has started.\n *\n * @usage\n * ```html\n * <button on-drag-start=\"onDragStart()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDrag\n * @module ionic\n * @restrict A\n *\n * @description\n * Move with one touch around on the page. Blocking the scrolling when\n * moving left and right is a good practice. When all the drag events are\n * blocking you disable scrolling on that area.\n *\n * @usage\n * ```html\n * <button on-drag=\"onDrag()\" class=\"button\">Test</button>\n * ```\n */\n\n/**\n * @ngdoc directive\n * @name onDragEnd\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a drag gesture has ended.\n *\n * @usage\n * ```html\n * <button on-drag-end=\"onDragEnd()\" class=\"button\">Test</button>\n * ```\n */\n\n/**\n * @ngdoc directive\n * @name onDragUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged up.\n *\n * @usage\n * ```html\n * <button on-drag-up=\"onDragUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the right.\n *\n * @usage\n * ```html\n * <button on-drag-right=\"onDragRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged down.\n *\n * @usage\n * ```html\n * <button on-drag-down=\"onDragDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onDragLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when the element is dragged to the left.\n *\n * @usage\n * ```html\n * <button on-drag-left=\"onDragLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipe\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity in any direction.\n *\n * @usage\n * ```html\n * <button on-swipe=\"onSwipe()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeUp\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving up.\n *\n * @usage\n * ```html\n * <button on-swipe-up=\"onSwipeUp()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeRight\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the right.\n *\n * @usage\n * ```html\n * <button on-swipe-right=\"onSwipeRight()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeDown\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving down.\n *\n * @usage\n * ```html\n * <button on-swipe-down=\"onSwipeDown()\" class=\"button\">Test</button>\n * ```\n */\n\n\n/**\n * @ngdoc directive\n * @name onSwipeLeft\n * @module ionic\n * @restrict A\n *\n * @description\n * Called when a moving touch has a high velocity moving to the left.\n *\n * @usage\n * ```html\n * <button on-swipe-left=\"onSwipeLeft()\" class=\"button\">Test</button>\n * ```\n */\n\n\nfunction gestureDirective(directiveName) {\n  return ['$ionicGesture', '$parse', function($ionicGesture, $parse) {\n    var eventType = directiveName.substr(2).toLowerCase();\n\n    return function(scope, element, attr) {\n      var fn = $parse( attr[directiveName] );\n\n      var listener = function(ev) {\n        scope.$apply(function() {\n          fn(scope, {\n            $event: ev\n          });\n        });\n      };\n\n      var gesture = $ionicGesture.on(eventType, listener, element);\n\n      scope.$on('$destroy', function() {\n        $ionicGesture.off(gesture, eventType, listener);\n      });\n    };\n  }];\n}\n\n\nIonicModule\n//.directive('ionHeaderBar', tapScrollToTopDirective())\n\n/**\n * @ngdoc directive\n * @name ionHeaderBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed header bar above some content.\n *\n * Can also be a subheader (lower down) if the 'bar-subheader' class is applied.\n * See [the header CSS docs](/docs/components/#subheader).\n *\n * @param {string=} align-title How to align the title. By default the title\n * will be aligned the same as how the platform aligns its titles (iOS centers\n * titles, Android aligns them left).\n * Available: 'left', 'right', or 'center'.  Defaults to the same as the platform.\n * @param {boolean=} no-tap-scroll By default, the header bar will scroll the\n * content to the top when tapped.  Set no-tap-scroll to true to disable this\n * behavior.\n * Available: true or false.  Defaults to false.\n *\n * @usage\n * ```html\n * <ion-header-bar align-title=\"left\" class=\"bar-positive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\" ng-click=\"doSomething()\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-header-bar>\n * <ion-content class=\"has-header\">\n *   Some content!\n * </ion-content>\n * ```\n */\n.directive('ionHeaderBar', headerFooterBarDirective(true))\n\n/**\n * @ngdoc directive\n * @name ionFooterBar\n * @module ionic\n * @restrict E\n *\n * @description\n * Adds a fixed footer bar below some content.\n *\n * Can also be a subfooter (higher up) if the 'bar-subfooter' class is applied.\n * See [the footer CSS docs](/docs/components/#footer).\n *\n * Note: If you use ionFooterBar in combination with ng-if, the surrounding content\n * will not align correctly.  This will be fixed soon.\n *\n * @param {string=} align-title Where to align the title.\n * Available: 'left', 'right', or 'center'.  Defaults to 'center'.\n *\n * @usage\n * ```html\n * <ion-content class=\"has-footer\">\n *   Some content!\n * </ion-content>\n * <ion-footer-bar align-title=\"left\" class=\"bar-assertive\">\n *   <div class=\"buttons\">\n *     <button class=\"button\">Left Button</button>\n *   </div>\n *   <h1 class=\"title\">Title!</h1>\n *   <div class=\"buttons\" ng-click=\"doSomething()\">\n *     <button class=\"button\">Right Button</button>\n *   </div>\n * </ion-footer-bar>\n * ```\n */\n.directive('ionFooterBar', headerFooterBarDirective(false));\n\nfunction tapScrollToTopDirective() { //eslint-disable-line no-unused-vars\n  return ['$ionicScrollDelegate', function($ionicScrollDelegate) {\n    return {\n      restrict: 'E',\n      link: function($scope, $element, $attr) {\n        if ($attr.noTapScroll == 'true') {\n          return;\n        }\n        ionic.on('tap', onTap, $element[0]);\n        $scope.$on('$destroy', function() {\n          ionic.off('tap', onTap, $element[0]);\n        });\n\n        function onTap(e) {\n          var depth = 3;\n          var current = e.target;\n          //Don't scroll to top in certain cases\n          while (depth-- && current) {\n            if (current.classList.contains('button') ||\n                current.tagName.match(/input|textarea|select/i) ||\n                current.isContentEditable) {\n              return;\n            }\n            current = current.parentNode;\n          }\n          var touch = e.gesture && e.gesture.touches[0] || e.detail.touches[0];\n          var bounds = $element[0].getBoundingClientRect();\n          if (ionic.DomUtil.rectContains(\n            touch.pageX, touch.pageY,\n            bounds.left, bounds.top - 20,\n            bounds.left + bounds.width, bounds.top + bounds.height\n          )) {\n            $ionicScrollDelegate.scrollTop(true);\n          }\n        }\n      }\n    };\n  }];\n}\n\nfunction headerFooterBarDirective(isHeader) {\n  return ['$document', '$timeout', function($document, $timeout) {\n    return {\n      restrict: 'E',\n      controller: '$ionicHeaderBar',\n      compile: function(tElement) {\n        tElement.addClass(isHeader ? 'bar bar-header' : 'bar bar-footer');\n        // top style tabs? if so, remove bottom border for seamless display\n        $timeout(function() {\n          if (isHeader && $document[0].getElementsByClassName('tabs-top').length) tElement.addClass('has-tabs-top');\n        });\n\n        return { pre: prelink };\n        function prelink($scope, $element, $attr, ctrl) {\n          if (isHeader) {\n            $scope.$watch(function() { return $element[0].className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubheader = value.indexOf('bar-subheader') !== -1;\n              $scope.$hasHeader = isShown && !isSubheader;\n              $scope.$hasSubheader = isShown && isSubheader;\n              $scope.$emit('$ionicSubheader', $scope.$hasSubheader);\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasHeader;\n              delete $scope.$hasSubheader;\n            });\n            ctrl.align();\n            $scope.$on('$ionicHeader.align', function() {\n              ionic.requestAnimationFrame(function() {\n                ctrl.align();\n              });\n            });\n\n          } else {\n            $scope.$watch(function() { return $element[0].className; }, function(value) {\n              var isShown = value.indexOf('ng-hide') === -1;\n              var isSubfooter = value.indexOf('bar-subfooter') !== -1;\n              $scope.$hasFooter = isShown && !isSubfooter;\n              $scope.$hasSubfooter = isShown && isSubfooter;\n            });\n            $scope.$on('$destroy', function() {\n              delete $scope.$hasFooter;\n              delete $scope.$hasSubfooter;\n            });\n            $scope.$watch('$hasTabs', function(val) {\n              $element.toggleClass('has-tabs', !!val);\n            });\n            ctrl.align();\n            $scope.$on('$ionicFooter.align', function() {\n              ionic.requestAnimationFrame(function() {\n                ctrl.align();\n              });\n            });\n          }\n        }\n      }\n    };\n  }];\n}\n\n/**\n * @ngdoc directive\n * @name ionInfiniteScroll\n * @module ionic\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @restrict E\n *\n * @description\n * The ionInfiniteScroll directive allows you to call a function whenever\n * the user gets to the bottom of the page or near the bottom of the page.\n *\n * The expression you pass in for `on-infinite` is called when the user scrolls\n * greater than `distance` away from the bottom of the content.  Once `on-infinite`\n * is done loading new data, it should broadcast the `scroll.infiniteScrollComplete`\n * event from your controller (see below example).\n *\n * @param {expression} on-infinite What to call when the scroller reaches the\n * bottom.\n * @param {string=} distance The distance from the bottom that the scroll must\n * reach to trigger the on-infinite expression. Default: 1%.\n * @param {string=} spinner The {@link ionic.directive:ionSpinner} to show while loading. The SVG\n * {@link ionic.directive:ionSpinner} is now the default, replacing rotating font icons.\n * @param {string=} icon The icon to show while loading. Default: 'ion-load-d'.  This is depreicated\n * in favor of the SVG {@link ionic.directive:ionSpinner}.\n * @param {boolean=} immediate-check Whether to check the infinite scroll bounds immediately on load.\n *\n * @usage\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-list>\n *   ....\n *   ....\n *   </ion-list>\n *\n *   <ion-infinite-scroll\n *     on-infinite=\"loadMore()\"\n *     distance=\"1%\">\n *   </ion-infinite-scroll>\n * </ion-content>\n * ```\n * ```js\n * function MyController($scope, $http) {\n *   $scope.items = [];\n *   $scope.loadMore = function() {\n *     $http.get('/more-items').success(function(items) {\n *       useItems(items);\n *       $scope.$broadcast('scroll.infiniteScrollComplete');\n *     });\n *   };\n *\n *   $scope.$on('$stateChangeSuccess', function() {\n *     $scope.loadMore();\n *   });\n * }\n * ```\n *\n * An easy to way to stop infinite scroll once there is no more data to load\n * is to use angular's `ng-if` directive:\n *\n * ```html\n * <ion-infinite-scroll\n *   ng-if=\"moreDataCanBeLoaded()\"\n *   icon=\"ion-loading-c\"\n *   on-infinite=\"loadMoreData()\">\n * </ion-infinite-scroll>\n * ```\n */\nIonicModule\n.directive('ionInfiniteScroll', ['$timeout', function($timeout) {\n  return {\n    restrict: 'E',\n    require: ['?^$ionicScroll', 'ionInfiniteScroll'],\n    template: function($element, $attrs) {\n      if ($attrs.icon) return '<i class=\"icon {{icon()}} icon-refreshing {{scrollingType}}\"></i>';\n      return '<ion-spinner icon=\"{{spinner()}}\"></ion-spinner>';\n    },\n    scope: true,\n    controller: '$ionInfiniteScroll',\n    link: function($scope, $element, $attrs, ctrls) {\n      var infiniteScrollCtrl = ctrls[1];\n      var scrollCtrl = infiniteScrollCtrl.scrollCtrl = ctrls[0];\n      var jsScrolling = infiniteScrollCtrl.jsScrolling = !scrollCtrl.isNative();\n\n      // if this view is not beneath a scrollCtrl, it can't be injected, proceed w/ native scrolling\n      if (jsScrolling) {\n        infiniteScrollCtrl.scrollView = scrollCtrl.scrollView;\n        $scope.scrollingType = 'js-scrolling';\n        //bind to JS scroll events\n        scrollCtrl.$element.on('scroll', infiniteScrollCtrl.checkBounds);\n      } else {\n        // grabbing the scrollable element, to determine dimensions, and current scroll pos\n        var scrollEl = ionic.DomUtil.getParentOrSelfWithClass($element[0].parentNode, 'overflow-scroll');\n        infiniteScrollCtrl.scrollEl = scrollEl;\n        // if there's no scroll controller, and no overflow scroll div, infinite scroll wont work\n        if (!scrollEl) {\n          throw 'Infinite scroll must be used inside a scrollable div';\n        }\n        //bind to native scroll events\n        infiniteScrollCtrl.scrollEl.addEventListener('scroll', infiniteScrollCtrl.checkBounds);\n      }\n\n      // Optionally check bounds on start after scrollView is fully rendered\n      var doImmediateCheck = isDefined($attrs.immediateCheck) ? $scope.$eval($attrs.immediateCheck) : true;\n      if (doImmediateCheck) {\n        $timeout(function() { infiniteScrollCtrl.checkBounds(); });\n      }\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionInput\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n* Creates a text input group that can easily be focused\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-input>\n*     <input type=\"text\" placeholder=\"First Name\">\n*   </ion-input>\n*\n*   <ion-input>\n*     <ion-label>Username</ion-label>\n*     <input type=\"text\">\n*   </ion-input>\n* </ion-list>\n* ```\n*/\n\nvar labelIds = -1;\n\nIonicModule\n.directive('ionInput', [function() {\n  return {\n    restrict: 'E',\n    controller: ['$scope', '$element', function($scope, $element) {\n      this.$scope = $scope;\n      this.$element = $element;\n\n      this.setInputAriaLabeledBy = function(id) {\n        var inputs = $element[0].querySelectorAll('input,textarea');\n        inputs.length && inputs[0].setAttribute('aria-labelledby', id);\n      };\n\n      this.focus = function() {\n        var inputs = $element[0].querySelectorAll('input,textarea');\n        inputs.length && inputs[0].focus();\n      };\n    }]\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionLabel\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n*\n* New in Ionic 1.2. It is strongly recommended that you use `<ion-label>` in place\n* of any `<label>` elements for maximum cross-browser support and performance.\n*\n* Creates a label for a form input.\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-input>\n*     <ion-label>Username</ion-label>\n*     <input type=\"text\">\n*   </ion-input>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionLabel', [function() {\n  return {\n    restrict: 'E',\n    require: '?^ionInput',\n    compile: function() {\n\n      return function link($scope, $element, $attrs, ionInputCtrl) {\n        var element = $element[0];\n\n        $element.addClass('input-label');\n\n        $element.attr('aria-label', $element.text());\n        var id = element.id || '_label-' + ++labelIds;\n\n        if (!element.id) {\n          $element.attr('id', id);\n        }\n\n        if (ionInputCtrl) {\n\n          ionInputCtrl.setInputAriaLabeledBy(id);\n\n          $element.on('click', function() {\n            ionInputCtrl.focus();\n          });\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * Input label adds accessibility to <span class=\"input-label\">.\n */\nIonicModule\n.directive('inputLabel', [function() {\n  return {\n    restrict: 'C',\n    require: '?^ionInput',\n    compile: function() {\n\n      return function link($scope, $element, $attrs, ionInputCtrl) {\n        var element = $element[0];\n\n        $element.attr('aria-label', $element.text());\n        var id = element.id || '_label-' + ++labelIds;\n\n        if (!element.id) {\n          $element.attr('id', id);\n        }\n\n        if (ionInputCtrl) {\n          ionInputCtrl.setInputAriaLabeledBy(id);\n        }\n\n      };\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionItem\n* @parent ionic.directive:ionList\n* @module ionic\n* @restrict E\n* Creates a list-item that can easily be swiped,\n* deleted, reordered, edited, and more.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* Can be assigned any item class name. See the\n* [list CSS documentation](/docs/components/#list).\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>Hello!</ion-item>\n*   <ion-item href=\"#/detail\">\n*     Link to detail page\n*   </ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule\n.directive('ionItem', ['$$rAF', function($$rAF) {\n  return {\n    restrict: 'E',\n    controller: ['$scope', '$element', function($scope, $element) {\n      this.$scope = $scope;\n      this.$element = $element;\n    }],\n    scope: true,\n    compile: function($element, $attrs) {\n      var isAnchor = isDefined($attrs.href) ||\n                     isDefined($attrs.ngHref) ||\n                     isDefined($attrs.uiSref);\n      var isComplexItem = isAnchor ||\n        //Lame way of testing, but we have to know at compile what to do with the element\n        /ion-(delete|option|reorder)-button/i.test($element.html());\n\n      if (isComplexItem) {\n        var innerElement = jqLite(isAnchor ? '<a></a>' : '<div></div>');\n        innerElement.addClass('item-content');\n\n        if (isDefined($attrs.href) || isDefined($attrs.ngHref)) {\n          innerElement.attr('ng-href', '{{$href()}}');\n          if (isDefined($attrs.target)) {\n            innerElement.attr('target', '{{$target()}}');\n          }\n        }\n\n        innerElement.append($element.contents());\n\n        $element.addClass('item item-complex')\n                .append(innerElement);\n      } else {\n        $element.addClass('item');\n      }\n\n      return function link($scope, $element, $attrs) {\n        $scope.$href = function() {\n          return $attrs.href || $attrs.ngHref;\n        };\n        $scope.$target = function() {\n          return $attrs.target;\n        };\n\n        var content = $element[0].querySelector('.item-content');\n        if (content) {\n          $scope.$on('$collectionRepeatLeave', function() {\n            if (content && content.$$ionicOptionsOpen) {\n              content.style[ionic.CSS.TRANSFORM] = '';\n              content.style[ionic.CSS.TRANSITION] = 'none';\n              $$rAF(function() {\n                content.style[ionic.CSS.TRANSITION] = '';\n              });\n              content.$$ionicOptionsOpen = false;\n            }\n          });\n        }\n      };\n\n    }\n  };\n}]);\n\nvar ITEM_TPL_DELETE_BUTTON =\n  '<div class=\"item-left-edit item-delete enable-pointer-events\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionDeleteButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a delete button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-delete` evaluates to true or\n* `$ionicListDelegate.showDelete(true)` is called.\n*\n* Takes any ionicon as a class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list show-delete=\"shouldShowDelete\">\n*   <ion-item>\n*     <ion-delete-button class=\"ion-minus-circled\"></ion-delete-button>\n*     Hello, list item!\n*   </ion-item>\n* </ion-list>\n* <ion-toggle ng-model=\"shouldShowDelete\">\n*   Show Delete?\n* </ion-toggle>\n* ```\n*/\nIonicModule\n.directive('ionDeleteButton', function() {\n\n  function stopPropagation(ev) {\n    ev.stopPropagation();\n  }\n\n  return {\n    restrict: 'E',\n    require: ['^^ionItem', '^?ionList'],\n    //Run before anything else, so we can move it before other directives process\n    //its location (eg ngIf relies on the location of the directive in the dom)\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      //Add the classes we need during the compile phase, so that they stay\n      //even if something else like ngIf removes the element and re-addss it\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var container = jqLite(ITEM_TPL_DELETE_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-left-editable');\n\n        //Don't bubble click up to main .item\n        $element.on('click', stopPropagation);\n\n        init();\n        $scope.$on('$ionic.reconnectScope', init);\n        function init() {\n          listCtrl = listCtrl || $element.controller('ionList');\n          if (listCtrl && listCtrl.showDelete()) {\n            container.addClass('visible active');\n          }\n        }\n      };\n    }\n  };\n});\n\n\nIonicModule\n.directive('itemFloatingLabel', function() {\n  return {\n    restrict: 'C',\n    link: function(scope, element) {\n      var el = element[0];\n      var input = el.querySelector('input, textarea');\n      var inputLabel = el.querySelector('.input-label');\n\n      if (!input || !inputLabel) return;\n\n      var onInput = function() {\n        if (input.value) {\n          inputLabel.classList.add('has-input');\n        } else {\n          inputLabel.classList.remove('has-input');\n        }\n      };\n\n      input.addEventListener('input', onInput);\n\n      var ngModelCtrl = jqLite(input).controller('ngModel');\n      if (ngModelCtrl) {\n        ngModelCtrl.$render = function() {\n          input.value = ngModelCtrl.$viewValue || '';\n          onInput();\n        };\n      }\n\n      scope.$on('$destroy', function() {\n        input.removeEventListener('input', onInput);\n      });\n    }\n  };\n});\n\nvar ITEM_TPL_OPTION_BUTTONS =\n  '<div class=\"item-options invisible\">' +\n  '</div>';\n/**\n* @ngdoc directive\n* @name ionOptionButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* @description\n* Creates an option button inside a list item, that is visible when the item is swiped\n* to the left by the user.  Swiped open option buttons can be hidden with\n* {@link ionic.service:$ionicListDelegate#closeOptionButtons $ionicListDelegate.closeOptionButtons}.\n*\n* Can be assigned any button class.\n*\n* See {@link ionic.directive:ionList} for a complete example & explanation.\n*\n* @usage\n*\n* ```html\n* <ion-list>\n*   <ion-item>\n*     I love kittens!\n*     <ion-option-button class=\"button-positive\">Share</ion-option-button>\n*     <ion-option-button class=\"button-assertive\">Edit</ion-option-button>\n*   </ion-item>\n* </ion-list>\n* ```\n*/\nIonicModule.directive('ionOptionButton', [function() {\n  function stopPropagation(e) {\n    e.stopPropagation();\n  }\n  return {\n    restrict: 'E',\n    require: '^ionItem',\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button', true);\n      return function($scope, $element, $attr, itemCtrl) {\n        if (!itemCtrl.optionsContainer) {\n          itemCtrl.optionsContainer = jqLite(ITEM_TPL_OPTION_BUTTONS);\n          itemCtrl.$element.append(itemCtrl.optionsContainer);\n        }\n        itemCtrl.optionsContainer.append($element);\n\n        itemCtrl.$element.addClass('item-right-editable');\n\n        //Don't bubble click up to main .item\n        $element.on('click', stopPropagation);\n      };\n    }\n  };\n}]);\n\nvar ITEM_TPL_REORDER_BUTTON =\n  '<div data-prevent-scroll=\"true\" class=\"item-right-edit item-reorder enable-pointer-events\">' +\n  '</div>';\n\n/**\n* @ngdoc directive\n* @name ionReorderButton\n* @parent ionic.directive:ionItem\n* @module ionic\n* @restrict E\n* Creates a reorder button inside a list item, that is visible when the\n* {@link ionic.directive:ionList ionList parent's} `show-reorder` evaluates to true or\n* `$ionicListDelegate.showReorder(true)` is called.\n*\n* Can be dragged to reorder items in the list. Takes any ionicon class.\n*\n* Note: Reordering works best when used with `ng-repeat`.  Be sure that all `ion-item` children of an `ion-list` are part of the same `ng-repeat` expression.\n*\n* When an item reorder is complete, the expression given in the `on-reorder` attribute is called. The `on-reorder` expression is given two locals that can be used: `$fromIndex` and `$toIndex`.  See below for an example.\n*\n* Look at {@link ionic.directive:ionList} for more examples.\n*\n* @usage\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\" show-reorder=\"true\">\n*   <ion-item ng-repeat=\"item in items\">\n*     Item {{item}}\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"moveItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*   </ion-item>\n* </ion-list>\n* ```\n* ```js\n* function MyCtrl($scope) {\n*   $scope.items = [1, 2, 3, 4];\n*   $scope.moveItem = function(item, fromIndex, toIndex) {\n*     //Move the item in the array\n*     $scope.items.splice(fromIndex, 1);\n*     $scope.items.splice(toIndex, 0, item);\n*   };\n* }\n* ```\n*\n* @param {expression=} on-reorder Expression to call when an item is reordered.\n* Parameters given: $fromIndex, $toIndex.\n*/\nIonicModule\n.directive('ionReorderButton', ['$parse', function($parse) {\n  return {\n    restrict: 'E',\n    require: ['^ionItem', '^?ionList'],\n    priority: Number.MAX_VALUE,\n    compile: function($element, $attr) {\n      $attr.$set('class', ($attr['class'] || '') + ' button icon button-icon', true);\n      $element[0].setAttribute('data-prevent-scroll', true);\n      return function($scope, $element, $attr, ctrls) {\n        var itemCtrl = ctrls[0];\n        var listCtrl = ctrls[1];\n        var onReorderFn = $parse($attr.onReorder);\n\n        $scope.$onReorder = function(oldIndex, newIndex) {\n          onReorderFn($scope, {\n            $fromIndex: oldIndex,\n            $toIndex: newIndex\n          });\n        };\n\n        // prevent clicks from bubbling up to the item\n        if (!$attr.ngClick && !$attr.onClick && !$attr.onclick) {\n          $element[0].onclick = function(e) {\n            e.stopPropagation();\n            return false;\n          };\n        }\n\n        var container = jqLite(ITEM_TPL_REORDER_BUTTON);\n        container.append($element);\n        itemCtrl.$element.append(container).addClass('item-right-editable');\n\n        if (listCtrl && listCtrl.showReorder()) {\n          container.addClass('visible active');\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name keyboardAttach\n * @module ionic\n * @restrict A\n *\n * @description\n * keyboard-attach is an attribute directive which will cause an element to float above\n * the keyboard when the keyboard shows. Currently only supports the\n * [ion-footer-bar]({{ page.versionHref }}/api/directive/ionFooterBar/) directive.\n *\n * ### Notes\n * - This directive requires the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard).\n * - On Android not in fullscreen mode, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"false\" />` or no preference in your `config.xml` file,\n *   this directive is unnecessary since it is the default behavior.\n * - On iOS, if there is an input in your footer, you will need to set\n *   `cordova.plugins.Keyboard.disableScroll(true)`.\n *\n * @usage\n *\n * ```html\n *  <ion-footer-bar align-title=\"left\" keyboard-attach class=\"bar-assertive\">\n *    <h1 class=\"title\">Title!</h1>\n *  </ion-footer-bar>\n * ```\n */\n\nIonicModule\n.directive('keyboardAttach', function() {\n  return function(scope, element) {\n    ionic.on('native.keyboardshow', onShow, window);\n    ionic.on('native.keyboardhide', onHide, window);\n\n    //deprecated\n    ionic.on('native.showkeyboard', onShow, window);\n    ionic.on('native.hidekeyboard', onHide, window);\n\n\n    var scrollCtrl;\n\n    function onShow(e) {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      //for testing\n      var keyboardHeight = e.keyboardHeight || (e.detail && e.detail.keyboardHeight);\n      element.css('bottom', keyboardHeight + \"px\");\n      scrollCtrl = element.controller('$ionicScroll');\n      if (scrollCtrl) {\n        scrollCtrl.scrollView.__container.style.bottom = keyboardHeight + keyboardAttachGetClientHeight(element[0]) + \"px\";\n      }\n    }\n\n    function onHide() {\n      if (ionic.Platform.isAndroid() && !ionic.Platform.isFullScreen) {\n        return;\n      }\n\n      element.css('bottom', '');\n      if (scrollCtrl) {\n        scrollCtrl.scrollView.__container.style.bottom = '';\n      }\n    }\n\n    scope.$on('$destroy', function() {\n      ionic.off('native.keyboardshow', onShow, window);\n      ionic.off('native.keyboardhide', onHide, window);\n\n      //deprecated\n      ionic.off('native.showkeyboard', onShow, window);\n      ionic.off('native.hidekeyboard', onHide, window);\n    });\n  };\n});\n\nfunction keyboardAttachGetClientHeight(element) {\n  return element.clientHeight;\n}\n\n/**\n* @ngdoc directive\n* @name ionList\n* @module ionic\n* @delegate ionic.service:$ionicListDelegate\n* @codepen JsHjf\n* @restrict E\n* @description\n* The List is a widely used interface element in almost any mobile app, and can include\n* content ranging from basic text all the way to buttons, toggles, icons, and thumbnails.\n*\n* Both the list, which contains items, and the list items themselves can be any HTML\n* element. The containing element requires the `list` class and each list item requires\n* the `item` class.\n*\n* However, using the ionList and ionItem directives make it easy to support various\n* interaction modes such as swipe to edit, drag to reorder, and removing items.\n*\n* Related: {@link ionic.directive:ionItem}, {@link ionic.directive:ionOptionButton}\n* {@link ionic.directive:ionReorderButton}, {@link ionic.directive:ionDeleteButton}, [`list CSS documentation`](/docs/components/#list).\n*\n* @usage\n*\n* Basic Usage:\n*\n* ```html\n* <ion-list>\n*   <ion-item ng-repeat=\"item in items\">\n*     {% raw %}Hello, {{item}}!{% endraw %}\n*   </ion-item>\n* </ion-list>\n* ```\n*\n* Advanced Usage: Thumbnails, Delete buttons, Reordering, Swiping\n*\n* ```html\n* <ion-list ng-controller=\"MyCtrl\"\n*           show-delete=\"shouldShowDelete\"\n*           show-reorder=\"shouldShowReorder\"\n*           can-swipe=\"listCanSwipe\">\n*   <ion-item ng-repeat=\"item in items\"\n*             class=\"item-thumbnail-left\">\n*\n*     {% raw %}<img ng-src=\"{{item.img}}\">\n*     <h2>{{item.title}}</h2>\n*     <p>{{item.description}}</p>{% endraw %}\n*     <ion-option-button class=\"button-positive\"\n*                        ng-click=\"share(item)\">\n*       Share\n*     </ion-option-button>\n*     <ion-option-button class=\"button-info\"\n*                        ng-click=\"edit(item)\">\n*       Edit\n*     </ion-option-button>\n*     <ion-delete-button class=\"ion-minus-circled\"\n*                        ng-click=\"items.splice($index, 1)\">\n*     </ion-delete-button>\n*     <ion-reorder-button class=\"ion-navicon\"\n*                         on-reorder=\"reorderItem(item, $fromIndex, $toIndex)\">\n*     </ion-reorder-button>\n*\n*   </ion-item>\n* </ion-list>\n* ```\n*\n*```javascript\n* app.controller('MyCtrl', function($scope) {\n*  $scope.shouldShowDelete = false;\n*  $scope.shouldShowReorder = false;\n*  $scope.listCanSwipe = true\n* });\n*```\n*\n* @param {string=} delegate-handle The handle used to identify this list with\n* {@link ionic.service:$ionicListDelegate}.\n* @param type {string=} The type of list to use (list-inset or card)\n* @param show-delete {boolean=} Whether the delete buttons for the items in the list are\n* currently shown or hidden.\n* @param show-reorder {boolean=} Whether the reorder buttons for the items in the list are\n* currently shown or hidden.\n* @param can-swipe {boolean=} Whether the items in the list are allowed to be swiped to reveal\n* option buttons. Default: true.\n*/\nIonicModule\n.directive('ionList', [\n  '$timeout',\nfunction($timeout) {\n  return {\n    restrict: 'E',\n    require: ['ionList', '^?$ionicScroll'],\n    controller: '$ionicList',\n    compile: function($element, $attr) {\n      var listEl = jqLite('<div class=\"list\">')\n        .append($element.contents())\n        .addClass($attr.type);\n\n      $element.append(listEl);\n\n      return function($scope, $element, $attrs, ctrls) {\n        var listCtrl = ctrls[0];\n        var scrollCtrl = ctrls[1];\n\n        // Wait for child elements to render...\n        $timeout(init);\n\n        function init() {\n          var listView = listCtrl.listView = new ionic.views.ListView({\n            el: $element[0],\n            listEl: $element.children()[0],\n            scrollEl: scrollCtrl && scrollCtrl.element,\n            scrollView: scrollCtrl && scrollCtrl.scrollView,\n            onReorder: function(el, oldIndex, newIndex) {\n              var itemScope = jqLite(el).scope();\n              if (itemScope && itemScope.$onReorder) {\n                // Make sure onReorder is called in apply cycle,\n                // but also make sure it has no conflicts by doing\n                // $evalAsync\n                $timeout(function() {\n                  itemScope.$onReorder(oldIndex, newIndex);\n                });\n              }\n            },\n            canSwipe: function() {\n              return listCtrl.canSwipeItems();\n            }\n          });\n\n          $scope.$on('$destroy', function() {\n            if (listView) {\n              listView.deregister && listView.deregister();\n              listView = null;\n            }\n          });\n\n          if (isDefined($attr.canSwipe)) {\n            $scope.$watch('!!(' + $attr.canSwipe + ')', function(value) {\n              listCtrl.canSwipeItems(value);\n            });\n          }\n          if (isDefined($attr.showDelete)) {\n            $scope.$watch('!!(' + $attr.showDelete + ')', function(value) {\n              listCtrl.showDelete(value);\n            });\n          }\n          if (isDefined($attr.showReorder)) {\n            $scope.$watch('!!(' + $attr.showReorder + ')', function(value) {\n              listCtrl.showReorder(value);\n            });\n          }\n\n          $scope.$watch(function() {\n            return listCtrl.showDelete();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-left-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var deleteButton = jqLite($element[0].getElementsByClassName('item-delete'));\n            setButtonShown(deleteButton, listCtrl.showDelete);\n          });\n\n          $scope.$watch(function() {\n            return listCtrl.showReorder();\n          }, function(isShown, wasShown) {\n            //Only use isShown=false if it was already shown\n            if (!isShown && !wasShown) { return; }\n\n            if (isShown) listCtrl.closeOptionButtons();\n            listCtrl.canSwipeItems(!isShown);\n\n            $element.children().toggleClass('list-right-editing', isShown);\n            $element.toggleClass('disable-pointer-events', isShown);\n\n            var reorderButton = jqLite($element[0].getElementsByClassName('item-reorder'));\n            setButtonShown(reorderButton, listCtrl.showReorder);\n          });\n\n          function setButtonShown(el, shown) {\n            shown() && el.addClass('visible') || el.removeClass('active');\n            ionic.requestAnimationFrame(function() {\n              shown() && el.addClass('active') || el.removeClass('visible');\n            });\n          }\n        }\n\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuClose\n * @module ionic\n * @restrict AC\n *\n * @description\n * `menu-close` is an attribute directive that closes a currently opened side menu.\n * Note that by default, navigation transitions will not animate between views when\n * the menu is open. Additionally, this directive will reset the entering view's\n * history stack, making the new page the root of the history stack. This is done\n * to replicate the user experience seen in most side menu implementations, which is\n * to not show the back button at the root of the stack and show only the\n * menu button. We recommend that you also use the `enable-menu-with-back-views=\"false\"`\n * {@link ionic.directive:ionSideMenus} attribute when using the menuClose directive.\n *\n * @usage\n * Below is an example of a link within a side menu. Tapping this link would\n * automatically close the currently opened menu.\n *\n * ```html\n * <a menu-close href=\"#/home\" class=\"item\">Home</a>\n * ```\n *\n * Note that if your destination state uses a resolve and that resolve asynchronously\n * takes longer than a standard transition (300ms), you'll need to set the\n * `nextViewOptions` manually as your resolve completes.\n *\n * ```js\n * $ionicHistory.nextViewOptions({\n *  historyRoot: true,\n *  disableAnimate: true,\n *  expire: 300\n * });\n * ```\n */\nIonicModule\n.directive('menuClose', ['$ionicHistory', '$timeout', function($ionicHistory, $timeout) {\n  return {\n    restrict: 'AC',\n    link: function($scope, $element) {\n      $element.bind('click', function() {\n        var sideMenuCtrl = $element.inheritedData('$ionSideMenusController');\n        if (sideMenuCtrl) {\n          $ionicHistory.nextViewOptions({\n            historyRoot: true,\n            disableAnimate: true,\n            expire: 300\n          });\n          // if no transition in 300ms, reset nextViewOptions\n          // the expire should take care of it, but will be cancelled in some\n          // cases. This directive is an exception to the rules of history.js\n          $timeout( function() {\n            $ionicHistory.nextViewOptions({\n              historyRoot: false,\n              disableAnimate: false\n            });\n          }, 300);\n          sideMenuCtrl.close();\n        }\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name menuToggle\n * @module ionic\n * @restrict AC\n *\n * @description\n * Toggle a side menu on the given side.\n *\n * @usage\n * Below is an example of a link within a nav bar. Tapping this button\n * would open the given side menu, and tapping it again would close it.\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-buttons side=\"left\">\n *    <!-- Toggle left side menu -->\n *    <button menu-toggle=\"left\" class=\"button button-icon icon ion-navicon\"></button>\n *   </ion-nav-buttons>\n *   <ion-nav-buttons side=\"right\">\n *    <!-- Toggle right side menu -->\n *    <button menu-toggle=\"right\" class=\"button button-icon icon ion-navicon\"></button>\n *   </ion-nav-buttons>\n * </ion-nav-bar>\n * ```\n *\n * ### Button Hidden On Child Views\n * By default, the menu toggle button will only appear on a root\n * level side-menu page. Navigating in to child views will hide the menu-\n * toggle button. They can be made visible on child pages by setting the\n * enable-menu-with-back-views attribute of the {@link ionic.directive:ionSideMenus}\n * directive to true.\n *\n * ```html\n * <ion-side-menus enable-menu-with-back-views=\"true\">\n * ```\n */\nIonicModule\n.directive('menuToggle', function() {\n  return {\n    restrict: 'AC',\n    link: function($scope, $element, $attr) {\n      $scope.$on('$ionicView.beforeEnter', function(ev, viewData) {\n        if (viewData.enableBack) {\n          var sideMenuCtrl = $element.inheritedData('$ionSideMenusController');\n          if (!sideMenuCtrl.enableMenuWithBackViews()) {\n            $element.addClass('hide');\n          }\n        } else {\n          $element.removeClass('hide');\n        }\n      });\n\n      $element.bind('click', function() {\n        var sideMenuCtrl = $element.inheritedData('$ionSideMenusController');\n        sideMenuCtrl && sideMenuCtrl.toggle($attr.menuToggle);\n      });\n    }\n  };\n});\n\n/*\n * We don't document the ionModal directive, we instead document\n * the $ionicModal service\n */\nIonicModule\n.directive('ionModal', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function() {}],\n    template: '<div class=\"modal-backdrop\">' +\n                '<div class=\"modal-backdrop-bg\"></div>' +\n                '<div class=\"modal-wrapper\" ng-transclude></div>' +\n              '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionModalView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.addClass('modal');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionNavBackButton\n * @module ionic\n * @restrict E\n * @parent ionNavBar\n * @description\n * Creates a back button inside an {@link ionic.directive:ionNavBar}.\n *\n * The back button will appear when the user is able to go back in the current navigation stack. By\n * default, the markup of the back button is automatically built using platform-appropriate defaults\n * (iOS back button icon on iOS and Android icon on Android).\n *\n * Additionally, the button is automatically set to `$ionicGoBack()` on click/tap. By default, the\n * app will navigate back one view when the back button is clicked.  More advanced behavior is also\n * possible, as outlined below.\n *\n * @usage\n *\n * Recommended markup for default settings:\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-back-button>\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n *\n * With custom inner markup, and automatically adds a default click action:\n *\n * ```html\n * <ion-nav-bar>\n *   <ion-nav-back-button class=\"button-clear\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n *\n * With custom inner markup and custom click action, using {@link ionic.service:$ionicHistory}:\n *\n * ```html\n * <ion-nav-bar ng-controller=\"MyCtrl\">\n *   <ion-nav-back-button class=\"button-clear\"\n *     ng-click=\"myGoBack()\">\n *     <i class=\"ion-arrow-left-c\"></i> Back\n *   </ion-nav-back-button>\n * </ion-nav-bar>\n * ```\n * ```js\n * function MyCtrl($scope, $ionicHistory) {\n *   $scope.myGoBack = function() {\n *     $ionicHistory.goBack();\n *   };\n * }\n * ```\n */\nIonicModule\n.directive('ionNavBackButton', ['$ionicConfig', '$document', function($ionicConfig, $document) {\n  return {\n    restrict: 'E',\n    require: '^ionNavBar',\n    compile: function(tElement, tAttrs) {\n\n      // clone the back button, but as a <div>\n      var buttonEle = $document[0].createElement('button');\n      for (var n in tAttrs.$attr) {\n        buttonEle.setAttribute(tAttrs.$attr[n], tAttrs[n]);\n      }\n\n      if (!tAttrs.ngClick) {\n        buttonEle.setAttribute('ng-click', '$ionicGoBack()');\n      }\n\n      buttonEle.className = 'button back-button hide buttons ' + (tElement.attr('class') || '');\n      buttonEle.innerHTML = tElement.html() || '';\n\n      var childNode;\n      var hasIcon = hasIconClass(tElement[0]);\n      var hasInnerText;\n      var hasButtonText;\n      var hasPreviousTitle;\n\n      for (var x = 0; x < tElement[0].childNodes.length; x++) {\n        childNode = tElement[0].childNodes[x];\n        if (childNode.nodeType === 1) {\n          if (hasIconClass(childNode)) {\n            hasIcon = true;\n          } else if (childNode.classList.contains('default-title')) {\n            hasButtonText = true;\n          } else if (childNode.classList.contains('previous-title')) {\n            hasPreviousTitle = true;\n          }\n        } else if (!hasInnerText && childNode.nodeType === 3) {\n          hasInnerText = !!childNode.nodeValue.trim();\n        }\n      }\n\n      function hasIconClass(ele) {\n        return /ion-|icon/.test(ele.className);\n      }\n\n      var defaultIcon = $ionicConfig.backButton.icon();\n      if (!hasIcon && defaultIcon && defaultIcon !== 'none') {\n        buttonEle.innerHTML = '<i class=\"icon ' + defaultIcon + '\"></i> ' + buttonEle.innerHTML;\n        buttonEle.className += ' button-clear';\n      }\n\n      if (!hasInnerText) {\n        var buttonTextEle = $document[0].createElement('span');\n        buttonTextEle.className = 'back-text';\n\n        if (!hasButtonText && $ionicConfig.backButton.text()) {\n          buttonTextEle.innerHTML += '<span class=\"default-title\">' + $ionicConfig.backButton.text() + '</span>';\n        }\n        if (!hasPreviousTitle && $ionicConfig.backButton.previousTitleText()) {\n          buttonTextEle.innerHTML += '<span class=\"previous-title\"></span>';\n        }\n        buttonEle.appendChild(buttonTextEle);\n\n      }\n\n      tElement.attr('class', 'hide');\n      tElement.empty();\n\n      return {\n        pre: function($scope, $element, $attr, navBarCtrl) {\n          // only register the plain HTML, the navBarCtrl takes care of scope/compile/link\n          navBarCtrl.navElement('backButton', buttonEle.outerHTML);\n          buttonEle = null;\n        }\n      };\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionNavBar\n * @module ionic\n * @delegate ionic.service:$ionicNavBarDelegate\n * @restrict E\n *\n * @description\n * If we have an {@link ionic.directive:ionNavView} directive, we can also create an\n * `<ion-nav-bar>`, which will create a topbar that updates as the application state changes.\n *\n * We can add a back button by putting an {@link ionic.directive:ionNavBackButton} inside.\n *\n * We can add buttons depending on the currently visible view using\n * {@link ionic.directive:ionNavButtons}.\n *\n * Note that the ion-nav-bar element will only work correctly if your content has an\n * ionView around it.\n *\n * @usage\n *\n * ```html\n * <body ng-app=\"starter\">\n *   <!-- The nav bar that will be updated as we navigate -->\n *   <ion-nav-bar class=\"bar-positive\">\n *   </ion-nav-bar>\n *\n *   <!-- where the initial view template will be rendered -->\n *   <ion-nav-view>\n *     <ion-view>\n *       <ion-content>Hello!</ion-content>\n *     </ion-view>\n *   </ion-nav-view>\n * </body>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this navBar\n * with {@link ionic.service:$ionicNavBarDelegate}.\n * @param align-title {string=} Where to align the title of the navbar.\n * Available: 'left', 'right', 'center'. Defaults to 'center'.\n * @param {boolean=} no-tap-scroll By default, the navbar will scroll the content\n * to the top when tapped.  Set no-tap-scroll to true to disable this behavior.\n *\n * </table><br/>\n */\nIonicModule\n.directive('ionNavBar', function() {\n  return {\n    restrict: 'E',\n    controller: '$ionicNavBar',\n    scope: true,\n    link: function($scope, $element, $attr, ctrl) {\n      ctrl.init();\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionNavButtons\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * Use nav buttons to set the buttons on your {@link ionic.directive:ionNavBar}\n * from within an {@link ionic.directive:ionView}. This gives each\n * view template the ability to specify which buttons should show in the nav bar,\n * overriding any default buttons already placed in the nav bar.\n *\n * Any buttons you declare will be positioned on the navbar's corresponding side. Primary\n * buttons generally map to the left side of the header, and secondary buttons are\n * generally on the right side. However, their exact locations are platform-specific.\n * For example, in iOS, the primary buttons are on the far left of the header, and\n * secondary buttons are on the far right, with the header title centered between them.\n * For Android, however, both groups of buttons are on the far right of the header,\n * with the header title aligned left.\n *\n * We recommend always using `primary` and `secondary`, so the buttons correctly map\n * to the side familiar to users of each platform. However, in cases where buttons should\n * always be on an exact side, both `left` and `right` sides are still available. For\n * example, a toggle button for a left side menu should be on the left side; in this case,\n * we'd recommend using `side=\"left\"`, so it's always on the left, no matter the platform.\n *\n * ***Note*** that `ion-nav-buttons` must be immediate descendants of the `ion-view` or\n * `ion-nav-bar` element (basically, don't wrap it in another div).\n *\n * @usage\n * ```html\n * <ion-nav-bar>\n * </ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view>\n *     <ion-nav-buttons side=\"primary\">\n *       <button class=\"button\" ng-click=\"doSomething()\">\n *         I'm a button on the primary of the navbar!\n *       </button>\n *     </ion-nav-buttons>\n *     <ion-content>\n *       Some super content here!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * @param {string} side The side to place the buttons in the\n * {@link ionic.directive:ionNavBar}. Available sides: `primary`, `secondary`, `left`, and `right`.\n */\nIonicModule\n.directive('ionNavButtons', ['$document', function($document) {\n  return {\n    require: '^ionNavBar',\n    restrict: 'E',\n    compile: function(tElement, tAttrs) {\n      var side = 'left';\n\n      if (/^primary|secondary|right$/i.test(tAttrs.side || '')) {\n        side = tAttrs.side.toLowerCase();\n      }\n\n      var spanEle = $document[0].createElement('span');\n      spanEle.className = side + '-buttons';\n      spanEle.innerHTML = tElement.html();\n\n      var navElementType = side + 'Buttons';\n\n      tElement.attr('class', 'hide');\n      tElement.empty();\n\n      return {\n        pre: function($scope, $element, $attrs, navBarCtrl) {\n          // only register the plain HTML, the navBarCtrl takes care of scope/compile/link\n\n          var parentViewCtrl = $element.parent().data('$ionViewController');\n          if (parentViewCtrl) {\n            // if the parent is an ion-view, then these are ion-nav-buttons for JUST this ion-view\n            parentViewCtrl.navElement(navElementType, spanEle.outerHTML);\n\n          } else {\n            // these are buttons for all views that do not have their own ion-nav-buttons\n            navBarCtrl.navElement(navElementType, spanEle.outerHTML);\n          }\n\n          spanEle = null;\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name navDirection\n * @module ionic\n * @restrict A\n *\n * @description\n * The direction which the nav view transition should animate. Available options\n * are: `forward`, `back`, `enter`, `exit`, `swap`.\n *\n * @usage\n *\n * ```html\n * <a nav-direction=\"forward\" href=\"#/home\">Home</a>\n * ```\n */\nIonicModule\n.directive('navDirection', ['$ionicViewSwitcher', function($ionicViewSwitcher) {\n  return {\n    restrict: 'A',\n    priority: 1000,\n    link: function($scope, $element, $attr) {\n      $element.bind('click', function() {\n        $ionicViewSwitcher.nextDirection($attr.navDirection);\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionNavTitle\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n *\n * The nav title directive replaces an {@link ionic.directive:ionNavBar} title text with\n * custom HTML from within an {@link ionic.directive:ionView} template. This gives each\n * view the ability to specify its own custom title element, such as an image or any HTML,\n * rather than being text-only. Alternatively, text-only titles can be updated using the\n * `view-title` {@link ionic.directive:ionView} attribute.\n *\n * Note that `ion-nav-title` must be an immediate descendant of the `ion-view` or\n * `ion-nav-bar` element (basically don't wrap it in another div).\n *\n * @usage\n * ```html\n * <ion-nav-bar>\n * </ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view>\n *     <ion-nav-title>\n *       <img src=\"logo.svg\">\n *     </ion-nav-title>\n *     <ion-content>\n *       Some super content here!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n */\nIonicModule\n.directive('ionNavTitle', ['$document', function($document) {\n  return {\n    require: '^ionNavBar',\n    restrict: 'E',\n    compile: function(tElement, tAttrs) {\n      var navElementType = 'title';\n      var spanEle = $document[0].createElement('span');\n      for (var n in tAttrs.$attr) {\n        spanEle.setAttribute(tAttrs.$attr[n], tAttrs[n]);\n      }\n      spanEle.classList.add('nav-bar-title');\n      spanEle.innerHTML = tElement.html();\n\n      tElement.attr('class', 'hide');\n      tElement.empty();\n\n      return {\n        pre: function($scope, $element, $attrs, navBarCtrl) {\n          // only register the plain HTML, the navBarCtrl takes care of scope/compile/link\n\n          var parentViewCtrl = $element.parent().data('$ionViewController');\n          if (parentViewCtrl) {\n            // if the parent is an ion-view, then these are ion-nav-buttons for JUST this ion-view\n            parentViewCtrl.navElement(navElementType, spanEle.outerHTML);\n\n          } else {\n            // these are buttons for all views that do not have their own ion-nav-buttons\n            navBarCtrl.navElement(navElementType, spanEle.outerHTML);\n          }\n\n          spanEle = null;\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name navTransition\n * @module ionic\n * @restrict A\n *\n * @description\n * The transition type which the nav view transition should use when it animates.\n * Current, options are `ios`, `android`, and `none`. More options coming soon.\n *\n * @usage\n *\n * ```html\n * <a nav-transition=\"none\" href=\"#/home\">Home</a>\n * ```\n */\nIonicModule\n.directive('navTransition', ['$ionicViewSwitcher', function($ionicViewSwitcher) {\n  return {\n    restrict: 'A',\n    priority: 1000,\n    link: function($scope, $element, $attr) {\n      $element.bind('click', function() {\n        $ionicViewSwitcher.nextTransition($attr.navTransition);\n      });\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionNavView\n * @module ionic\n * @restrict E\n * @codepen odqCz\n *\n * @description\n * As a user navigates throughout your app, Ionic is able to keep track of their\n * navigation history. By knowing their history, transitions between views\n * correctly enter and exit using the platform's transition style. An additional\n * benefit to Ionic's navigation system is its ability to manage multiple\n * histories. For example, each tab can have it's own navigation history stack.\n *\n * Ionic uses the AngularUI Router module so app interfaces can be organized\n * into various \"states\". Like Angular's core $route service, URLs can be used\n * to control the views. However, the AngularUI Router provides a more powerful\n * state manager in that states are bound to named, nested, and parallel views,\n * allowing more than one template to be rendered on the same page.\n * Additionally, each state is not required to be bound to a URL, and data can\n * be pushed to each state which allows much flexibility.\n *\n * The ionNavView directive is used to render templates in your application. Each template\n * is part of a state. States are usually mapped to a url, and are defined programatically\n * using angular-ui-router (see [their docs](https://github.com/angular-ui/ui-router/wiki),\n * and remember to replace ui-view with ion-nav-view in examples).\n *\n * @usage\n * In this example, we will create a navigation view that contains our different states for the app.\n *\n * To do this, in our markup we use ionNavView top level directive. To display a header bar we use\n * the {@link ionic.directive:ionNavBar} directive that updates as we navigate through the\n * navigation stack.\n *\n * Next, we need to setup our states that will be rendered.\n *\n * ```js\n * var app = angular.module('myApp', ['ionic']);\n * app.config(function($stateProvider) {\n *   $stateProvider\n *   .state('index', {\n *     url: '/',\n *     templateUrl: 'home.html'\n *   })\n *   .state('music', {\n *     url: '/music',\n *     templateUrl: 'music.html'\n *   });\n * });\n * ```\n * Then on app start, $stateProvider will look at the url, see if it matches the index state,\n * and then try to load home.html into the `<ion-nav-view>`.\n *\n * Pages are loaded by the URLs given. One simple way to create templates in Angular is to put\n * them directly into your HTML file and use the `<script type=\"text/ng-template\">` syntax.\n * So here is one way to put home.html into our app:\n *\n * ```html\n * <script id=\"home\" type=\"text/ng-template\">\n *   <!-- The title of the ion-view will be shown on the navbar -->\n *   <ion-view view-title=\"Home\">\n *     <ion-content ng-controller=\"HomeCtrl\">\n *       <!-- The content of the page -->\n *       <a href=\"#/music\">Go to music page!</a>\n *     </ion-content>\n *   </ion-view>\n * </script>\n * ```\n *\n * This is good to do because the template will be cached for very fast loading, instead of\n * having to fetch them from the network.\n *\n * ## Caching\n *\n * By default, views are cached to improve performance. When a view is navigated away from, its\n * element is left in the DOM, and its scope is disconnected from the `$watch` cycle. When\n * navigating to a view that is already cached, its scope is then reconnected, and the existing\n * element that was left in the DOM becomes the active view. This also allows for the scroll\n * position of previous views to be maintained.\n *\n * Caching can be disabled and enabled in multiple ways. By default, Ionic will cache a maximum of\n * 10 views, and not only can this be configured, but apps can also explicitly state which views\n * should and should not be cached.\n *\n * Note that because we are caching these views, *we aren’t destroying scopes*. Instead, scopes\n * are being disconnected from the watch cycle. Because scopes are not being destroyed and\n * recreated, controllers are not loading again on a subsequent viewing. If the app/controller\n * needs to know when a view has entered or has left, then view events emitted from the\n * {@link ionic.directive:ionView} scope, such as `$ionicView.enter`, may be useful.\n *\n * By default, when navigating back in the history, the \"forward\" views are removed from the cache.\n * If you navigate forward to the same view again, it'll create a new DOM element and controller\n * instance. Basically, any forward views are reset each time. This can be configured using the\n * {@link ionic.provider:$ionicConfigProvider}:\n *\n * ```js\n * $ionicConfigProvider.views.forwardCache(true);\n * ```\n *\n * #### Disable cache globally\n *\n * The {@link ionic.provider:$ionicConfigProvider} can be used to set the maximum allowable views\n * which can be cached, but this can also be use to disable all caching by setting it to 0.\n *\n * ```js\n * $ionicConfigProvider.views.maxCache(0);\n * ```\n *\n * #### Disable cache within state provider\n *\n * ```js\n * $stateProvider.state('myState', {\n *    cache: false,\n *    url : '/myUrl',\n *    templateUrl : 'my-template.html'\n * })\n * ```\n *\n * #### Disable cache with an attribute\n *\n * ```html\n * <ion-view cache-view=\"false\" view-title=\"My Title!\">\n *   ...\n * </ion-view>\n * ```\n *\n *\n * ## AngularUI Router\n *\n * Please visit [AngularUI Router's docs](https://github.com/angular-ui/ui-router/wiki) for\n * more info. Below is a great video by the AngularUI Router team that may help to explain\n * how it all works:\n *\n * <iframe width=\"560\" height=\"315\" src=\"//www.youtube.com/embed/dqJRoh8MnBo\"\n * frameborder=\"0\" allowfullscreen></iframe>\n *\n * Note: We do not recommend using [resolve](https://github.com/angular-ui/ui-router/wiki#resolve)\n * of AngularUI Router. The recommended approach is to execute any logic needed before beginning the state transition.\n *\n * @param {string=} name A view name. The name should be unique amongst the other views in the\n * same state. You can have views of the same name that live in different states. For more\n * information, see ui-router's\n * [ui-view documentation](http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.directive:ui-view).\n */\nIonicModule\n.directive('ionNavView', [\n  '$state',\n  '$ionicConfig',\nfunction($state, $ionicConfig) {\n  // IONIC's fork of Angular UI Router, v0.2.10\n  // the navView handles registering views in the history and how to transition between them\n  return {\n    restrict: 'E',\n    terminal: true,\n    priority: 2000,\n    transclude: true,\n    controller: '$ionicNavView',\n    compile: function(tElement, tAttrs, transclude) {\n\n      // a nav view element is a container for numerous views\n      tElement.addClass('view-container');\n      ionic.DomUtil.cachedAttr(tElement, 'nav-view-transition', $ionicConfig.views.transition());\n\n      return function($scope, $element, $attr, navViewCtrl) {\n        var latestLocals;\n\n        // Put in the compiled initial view\n        transclude($scope, function(clone) {\n          $element.append(clone);\n        });\n\n        var viewData = navViewCtrl.init();\n\n        // listen for $stateChangeSuccess\n        $scope.$on('$stateChangeSuccess', function() {\n          updateView(false);\n        });\n        $scope.$on('$viewContentLoading', function() {\n          updateView(false);\n        });\n\n        // initial load, ready go\n        updateView(true);\n\n\n        function updateView(firstTime) {\n          // get the current local according to the $state\n          var viewLocals = $state.$current && $state.$current.locals[viewData.name];\n\n          // do not update THIS nav-view if its is not the container for the given state\n          // if the viewLocals are the same as THIS latestLocals, then nothing to do\n          if (!viewLocals || (!firstTime && viewLocals === latestLocals)) return;\n\n          // update the latestLocals\n          latestLocals = viewLocals;\n          viewData.state = viewLocals.$$state;\n\n          // register, update and transition to the new view\n          navViewCtrl.register(viewLocals);\n        }\n\n      };\n    }\n  };\n}]);\n\nIonicModule\n\n.config(['$provide', function($provide) {\n  $provide.decorator('ngClickDirective', ['$delegate', function($delegate) {\n    // drop the default ngClick directive\n    $delegate.shift();\n    return $delegate;\n  }]);\n}])\n\n/**\n * @private\n */\n.factory('$ionicNgClick', ['$parse', function($parse) {\n  return function(scope, element, clickExpr) {\n    var clickHandler = angular.isFunction(clickExpr) ?\n      clickExpr :\n      $parse(clickExpr);\n\n    element.on('click', function(event) {\n      scope.$apply(function() {\n        clickHandler(scope, {$event: (event)});\n      });\n    });\n\n    // Hack for iOS Safari's benefit. It goes searching for onclick handlers and is liable to click\n    // something else nearby.\n    element.onclick = noop;\n  };\n}])\n\n.directive('ngClick', ['$ionicNgClick', function($ionicNgClick) {\n  return function(scope, element, attr) {\n    $ionicNgClick(scope, element, attr.ngClick);\n  };\n}])\n\n.directive('ionStopEvent', function() {\n  return {\n    restrict: 'A',\n    link: function(scope, element, attr) {\n      element.bind(attr.ionStopEvent, eventStopPropagation);\n    }\n  };\n});\nfunction eventStopPropagation(e) {\n  e.stopPropagation();\n}\n\n\n/**\n * @ngdoc directive\n * @name ionPane\n * @module ionic\n * @restrict E\n *\n * @description A simple container that fits content, with no side effects.  Adds the 'pane' class to the element.\n */\nIonicModule\n.directive('ionPane', function() {\n  return {\n    restrict: 'E',\n    link: function(scope, element) {\n      element.addClass('pane');\n    }\n  };\n});\n\n/*\n * We don't document the ionPopover directive, we instead document\n * the $ionicPopover service\n */\nIonicModule\n.directive('ionPopover', [function() {\n  return {\n    restrict: 'E',\n    transclude: true,\n    replace: true,\n    controller: [function() {}],\n    template: '<div class=\"popover-backdrop\">' +\n                '<div class=\"popover-wrapper\" ng-transclude></div>' +\n              '</div>'\n  };\n}]);\n\nIonicModule\n.directive('ionPopoverView', function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.append(jqLite('<div class=\"popover-arrow\">'));\n      element.addClass('popover');\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionRadio\n * @module ionic\n * @restrict E\n * @codepen saoBG\n * @description\n * The radio directive is no different than the HTML radio input, except it's styled differently.\n *\n * Radio behaves like [AngularJS radio](http://docs.angularjs.org/api/ng/input/input[radio]).\n *\n * @usage\n * ```html\n * <ion-radio ng-model=\"choice\" ng-value=\"'A'\">Choose A</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'B'\">Choose B</ion-radio>\n * <ion-radio ng-model=\"choice\" ng-value=\"'C'\">Choose C</ion-radio>\n * ```\n *\n * @param {string=} name The name of the radio input.\n * @param {expression=} value The value of the radio input.\n * @param {boolean=} disabled The state of the radio input.\n * @param {string=} icon The icon to use when the radio input is selected.\n * @param {expression=} ng-value Angular equivalent of the value attribute.\n * @param {expression=} ng-model The angular model for the radio input.\n * @param {boolean=} ng-disabled Angular equivalent of the disabled attribute.\n * @param {expression=} ng-change Triggers given expression when radio input's model changes\n */\nIonicModule\n.directive('ionRadio', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<label class=\"item item-radio\">' +\n        '<input type=\"radio\" name=\"radio-group\">' +\n        '<div class=\"radio-content\">' +\n          '<div class=\"item-content disable-pointer-events\" ng-transclude></div>' +\n          '<i class=\"radio-icon disable-pointer-events icon ion-checkmark\"></i>' +\n        '</div>' +\n      '</label>',\n\n    compile: function(element, attr) {\n      if (attr.icon) {\n        var iconElm = element.find('i');\n        iconElm.removeClass('ion-checkmark').addClass(attr.icon);\n      }\n\n      var input = element.find('input');\n      forEach({\n          'name': attr.name,\n          'value': attr.value,\n          'disabled': attr.disabled,\n          'ng-value': attr.ngValue,\n          'ng-model': attr.ngModel,\n          'ng-disabled': attr.ngDisabled,\n          'ng-change': attr.ngChange,\n          'ng-required': attr.ngRequired,\n          'required': attr.required\n      }, function(value, name) {\n        if (isDefined(value)) {\n            input.attr(name, value);\n          }\n      });\n\n      return function(scope, element, attr) {\n        scope.getValue = function() {\n          return scope.ngValue || attr.value;\n        };\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionRefresher\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionContent, ionic.directive:ionScroll\n * @description\n * Allows you to add pull-to-refresh to a scrollView.\n *\n * Place it as the first child of your {@link ionic.directive:ionContent} or\n * {@link ionic.directive:ionScroll} element.\n *\n * When refreshing is complete, $broadcast the 'scroll.refreshComplete' event\n * from your controller.\n *\n * @usage\n *\n * ```html\n * <ion-content ng-controller=\"MyController\">\n *   <ion-refresher\n *     pulling-text=\"Pull to refresh...\"\n *     on-refresh=\"doRefresh()\">\n *   </ion-refresher>\n *   <ion-list>\n *     <ion-item ng-repeat=\"item in items\"></ion-item>\n *   </ion-list>\n * </ion-content>\n * ```\n * ```js\n * angular.module('testApp', ['ionic'])\n * .controller('MyController', function($scope, $http) {\n *   $scope.items = [1,2,3];\n *   $scope.doRefresh = function() {\n *     $http.get('/new-items')\n *      .success(function(newItems) {\n *        $scope.items = newItems;\n *      })\n *      .finally(function() {\n *        // Stop the ion-refresher from spinning\n *        $scope.$broadcast('scroll.refreshComplete');\n *      });\n *   };\n * });\n * ```\n *\n * @param {expression=} on-refresh Called when the user pulls down enough and lets go\n * of the refresher.\n * @param {expression=} on-pulling Called when the user starts to pull down\n * on the refresher.\n * @param {string=} pulling-text The text to display while the user is pulling down.\n * @param {string=} pulling-icon The icon to display while the user is pulling down.\n * Default: 'ion-android-arrow-down'.\n * @param {string=} spinner The {@link ionic.directive:ionSpinner} icon to display\n * after user lets go of the refresher. The SVG {@link ionic.directive:ionSpinner}\n * is now the default, replacing rotating font icons. Set to `none` to disable both the\n * spinner and the icon.\n * @param {string=} refreshing-icon The font icon to display after user lets go of the\n * refresher. This is deprecated in favor of the SVG {@link ionic.directive:ionSpinner}.\n * @param {boolean=} disable-pulling-rotation Disables the rotation animation of the pulling\n * icon when it reaches its activated threshold. To be used with a custom `pulling-icon`.\n *\n */\nIonicModule\n.directive('ionRefresher', [function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: ['?^$ionicScroll', 'ionRefresher'],\n    controller: '$ionicRefresher',\n    template:\n    '<div class=\"scroll-refresher invisible\" collection-repeat-ignore>' +\n      '<div class=\"ionic-refresher-content\" ' +\n      'ng-class=\"{\\'ionic-refresher-with-text\\': pullingText || refreshingText}\">' +\n        '<div class=\"icon-pulling\" ng-class=\"{\\'pulling-rotation-disabled\\':disablePullingRotation}\">' +\n          '<i class=\"icon {{pullingIcon}}\"></i>' +\n        '</div>' +\n        '<div class=\"text-pulling\" ng-bind-html=\"pullingText\"></div>' +\n        '<div class=\"icon-refreshing\">' +\n          '<ion-spinner ng-if=\"showSpinner\" icon=\"{{spinner}}\"></ion-spinner>' +\n          '<i ng-if=\"showIcon\" class=\"icon {{refreshingIcon}}\"></i>' +\n        '</div>' +\n        '<div class=\"text-refreshing\" ng-bind-html=\"refreshingText\"></div>' +\n      '</div>' +\n    '</div>',\n    link: function($scope, $element, $attrs, ctrls) {\n\n      // JS Scrolling uses the scroll controller\n      var scrollCtrl = ctrls[0],\n          refresherCtrl = ctrls[1];\n      if (!scrollCtrl || scrollCtrl.isNative()) {\n        // Kick off native scrolling\n        refresherCtrl.init();\n      } else {\n        $element[0].classList.add('js-scrolling');\n        scrollCtrl._setRefresher(\n          $scope,\n          $element[0],\n          refresherCtrl.getRefresherDomMethods()\n        );\n\n        $scope.$on('scroll.refreshComplete', function() {\n          $scope.$evalAsync(function() {\n            scrollCtrl.scrollView.finishPullToRefresh();\n          });\n        });\n      }\n\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionScroll\n * @module ionic\n * @delegate ionic.service:$ionicScrollDelegate\n * @codepen mwFuh\n * @restrict E\n *\n * @description\n * Creates a scrollable container for all content inside.\n *\n * @usage\n *\n * Basic usage:\n *\n * ```html\n * <ion-scroll zooming=\"true\" direction=\"xy\" style=\"width: 500px; height: 500px\">\n *   <div style=\"width: 5000px; height: 5000px; background: url('https://upload.wikimedia.org/wikipedia/commons/a/ad/Europe_geological_map-en.jpg') repeat\"></div>\n *  </ion-scroll>\n * ```\n *\n * Note that it's important to set the height of the scroll box as well as the height of the inner\n * content to enable scrolling. This makes it possible to have full control over scrollable areas.\n *\n * If you'd just like to have a center content scrolling area, use {@link ionic.directive:ionContent} instead.\n *\n * @param {string=} delegate-handle The handle used to identify this scrollView\n * with {@link ionic.service:$ionicScrollDelegate}.\n * @param {string=} direction Which way to scroll. 'x' or 'y' or 'xy'. Default 'y'.\n * @param {boolean=} locking Whether to lock scrolling in one direction at a time. Useful to set to false when zoomed in or scrolling in two directions. Default true.\n * @param {boolean=} paging Whether to scroll with paging.\n * @param {expression=} on-refresh Called on pull-to-refresh, triggered by an {@link ionic.directive:ionRefresher}.\n * @param {expression=} on-scroll Called whenever the user scrolls.\n * @param {boolean=} scrollbar-x Whether to show the horizontal scrollbar. Default true.\n * @param {boolean=} scrollbar-y Whether to show the vertical scrollbar. Default true.\n * @param {boolean=} zooming Whether to support pinch-to-zoom\n * @param {integer=} min-zoom The smallest zoom amount allowed (default is 0.5)\n * @param {integer=} max-zoom The largest zoom amount allowed (default is 3)\n * @param {boolean=} has-bouncing Whether to allow scrolling to bounce past the edges\n * of the content.  Defaults to true on iOS, false on Android.\n */\nIonicModule\n.directive('ionScroll', [\n  '$timeout',\n  '$controller',\n  '$ionicBind',\n  '$ionicConfig',\nfunction($timeout, $controller, $ionicBind, $ionicConfig) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: function() {},\n    compile: function(element, attr) {\n      element.addClass('scroll-view ionic-scroll');\n\n      //We cannot transclude here because it breaks element.data() inheritance on compile\n      var innerElement = jqLite('<div class=\"scroll\"></div>');\n      innerElement.append(element.contents());\n      element.append(innerElement);\n\n      var nativeScrolling = attr.overflowScroll !== \"false\" && (attr.overflowScroll === \"true\" || !$ionicConfig.scrolling.jsScrolling());\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr) {\n        $ionicBind($scope, $attr, {\n          direction: '@',\n          paging: '@',\n          $onScroll: '&onScroll',\n          scroll: '@',\n          scrollbarX: '@',\n          scrollbarY: '@',\n          zooming: '@',\n          minZoom: '@',\n          maxZoom: '@'\n        });\n        $scope.direction = $scope.direction || 'y';\n\n        if (isDefined($attr.padding)) {\n          $scope.$watch($attr.padding, function(newVal) {\n            innerElement.toggleClass('padding', !!newVal);\n          });\n        }\n        if ($scope.$eval($scope.paging) === true) {\n          innerElement.addClass('scroll-paging');\n        }\n\n        if (!$scope.direction) { $scope.direction = 'y'; }\n        var isPaging = $scope.$eval($scope.paging) === true;\n\n        if (nativeScrolling) {\n          $element.addClass('overflow-scroll');\n        }\n\n        $element.addClass('scroll-' + $scope.direction);\n\n        var scrollViewOptions = {\n          el: $element[0],\n          delegateHandle: $attr.delegateHandle,\n          locking: ($attr.locking || 'true') === 'true',\n          bouncing: $scope.$eval($attr.hasBouncing),\n          paging: isPaging,\n          scrollbarX: $scope.$eval($scope.scrollbarX) !== false,\n          scrollbarY: $scope.$eval($scope.scrollbarY) !== false,\n          scrollingX: $scope.direction.indexOf('x') >= 0,\n          scrollingY: $scope.direction.indexOf('y') >= 0,\n          zooming: $scope.$eval($scope.zooming) === true,\n          maxZoom: $scope.$eval($scope.maxZoom) || 3,\n          minZoom: $scope.$eval($scope.minZoom) || 0.5,\n          preventDefault: true,\n          nativeScrolling: nativeScrolling\n        };\n\n        if (isPaging) {\n          scrollViewOptions.speedMultiplier = 0.8;\n          scrollViewOptions.bouncing = false;\n        }\n\n        $controller('$ionicScroll', {\n          $scope: $scope,\n          scrollViewOptions: scrollViewOptions\n        });\n      }\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionSideMenu\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for a side menu, sibling to an {@link ionic.directive:ionSideMenuContent} directive.\n *\n * @usage\n * ```html\n * <ion-side-menu\n *   side=\"left\"\n *   width=\"myWidthValue + 20\"\n *   is-enabled=\"shouldLeftSideMenuBeEnabled()\">\n * </ion-side-menu>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {string} side Which side the side menu is currently on.  Allowed values: 'left' or 'right'.\n * @param {boolean=} is-enabled Whether this side menu is enabled.\n * @param {number=} width How many pixels wide the side menu should be.  Defaults to 275.\n */\nIonicModule\n.directive('ionSideMenu', function() {\n  return {\n    restrict: 'E',\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      angular.isUndefined(attr.isEnabled) && attr.$set('isEnabled', 'true');\n      angular.isUndefined(attr.width) && attr.$set('width', '275');\n\n      element.addClass('menu menu-' + attr.side);\n\n      return function($scope, $element, $attr, sideMenuCtrl) {\n        $scope.side = $attr.side || 'left';\n\n        var sideMenu = sideMenuCtrl[$scope.side] = new ionic.views.SideMenu({\n          width: attr.width,\n          el: $element[0],\n          isEnabled: true\n        });\n\n        $scope.$watch($attr.width, function(val) {\n          var numberVal = +val;\n          if (numberVal && numberVal == val) {\n            sideMenu.setWidth(+val);\n          }\n        });\n        $scope.$watch($attr.isEnabled, function(val) {\n          sideMenu.setIsEnabled(!!val);\n        });\n      };\n    }\n  };\n});\n\n\n/**\n * @ngdoc directive\n * @name ionSideMenuContent\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionSideMenus\n *\n * @description\n * A container for the main visible content, sibling to one or more\n * {@link ionic.directive:ionSideMenu} directives.\n *\n * @usage\n * ```html\n * <ion-side-menu-content\n *   edge-drag-threshold=\"true\"\n *   drag-content=\"true\">\n * </ion-side-menu-content>\n * ```\n * For a complete side menu example, see the\n * {@link ionic.directive:ionSideMenus} documentation.\n *\n * @param {boolean=} drag-content Whether the content can be dragged. Default true.\n * @param {boolean|number=} edge-drag-threshold Whether the content drag can only start if it is below a certain threshold distance from the edge of the screen.  Default false. Accepts three types of values:\n   *  - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.\n   *  - If true is given, the default number of pixels (25) is used as the maximum allowed distance.\n   *  - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.\n *\n */\nIonicModule\n.directive('ionSideMenuContent', [\n  '$timeout',\n  '$ionicGesture',\n  '$window',\nfunction($timeout, $ionicGesture, $window) {\n\n  return {\n    restrict: 'EA', //DEPRECATED 'A'\n    require: '^ionSideMenus',\n    scope: true,\n    compile: function(element, attr) {\n      element.addClass('menu-content pane');\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attr, sideMenuCtrl) {\n        var startCoord = null;\n        var primaryScrollAxis = null;\n\n        if (isDefined(attr.dragContent)) {\n          $scope.$watch(attr.dragContent, function(value) {\n            sideMenuCtrl.canDragContent(value);\n          });\n        } else {\n          sideMenuCtrl.canDragContent(true);\n        }\n\n        if (isDefined(attr.edgeDragThreshold)) {\n          $scope.$watch(attr.edgeDragThreshold, function(value) {\n            sideMenuCtrl.edgeDragThreshold(value);\n          });\n        }\n\n        // Listen for taps on the content to close the menu\n        function onContentTap(gestureEvt) {\n          if (sideMenuCtrl.getOpenAmount() !== 0) {\n            sideMenuCtrl.close();\n            gestureEvt.gesture.srcEvent.preventDefault();\n            startCoord = null;\n            primaryScrollAxis = null;\n          } else if (!startCoord) {\n            startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n          }\n        }\n\n        function onDragX(e) {\n          if (!sideMenuCtrl.isDraggableTarget(e)) return;\n\n          if (getPrimaryScrollAxis(e) == 'x') {\n            sideMenuCtrl._handleDrag(e);\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragY(e) {\n          if (getPrimaryScrollAxis(e) == 'x') {\n            e.gesture.srcEvent.preventDefault();\n          }\n        }\n\n        function onDragRelease(e) {\n          sideMenuCtrl._endDrag(e);\n          startCoord = null;\n          primaryScrollAxis = null;\n        }\n\n        function getPrimaryScrollAxis(gestureEvt) {\n          // gets whether the user is primarily scrolling on the X or Y\n          // If a majority of the drag has been on the Y since the start of\n          // the drag, but the X has moved a little bit, it's still a Y drag\n\n          if (primaryScrollAxis) {\n            // we already figured out which way they're scrolling\n            return primaryScrollAxis;\n          }\n\n          if (gestureEvt && gestureEvt.gesture) {\n\n            if (!startCoord) {\n              // get the starting point\n              startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n            } else {\n              // we already have a starting point, figure out which direction they're going\n              var endCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);\n\n              var xDistance = Math.abs(endCoord.x - startCoord.x);\n              var yDistance = Math.abs(endCoord.y - startCoord.y);\n\n              var scrollAxis = (xDistance < yDistance ? 'y' : 'x');\n\n              if (Math.max(xDistance, yDistance) > 30) {\n                // ok, we pretty much know which way they're going\n                // let's lock it in\n                primaryScrollAxis = scrollAxis;\n              }\n\n              return scrollAxis;\n            }\n          }\n          return 'y';\n        }\n\n        var content = {\n          element: element[0],\n          onDrag: function() {},\n          endDrag: function() {},\n          setCanScroll: function(canScroll) {\n            var c = $element[0].querySelector('.scroll');\n\n            if (!c) {\n              return;\n            }\n\n            var content = angular.element(c.parentElement);\n            if (!content) {\n              return;\n            }\n\n            // freeze our scroll container if we have one\n            var scrollScope = content.scope();\n            scrollScope.scrollCtrl && scrollScope.scrollCtrl.freezeScrollShut(!canScroll);\n          },\n          getTranslateX: function() {\n            return $scope.sideMenuContentTranslateX || 0;\n          },\n          setTranslateX: ionic.animationFrameThrottle(function(amount) {\n            var xTransform = content.offsetX + amount;\n            $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + xTransform + 'px,0,0)';\n            $timeout(function() {\n              $scope.sideMenuContentTranslateX = amount;\n            });\n          }),\n          setMarginLeft: ionic.animationFrameThrottle(function(amount) {\n            if (amount) {\n              amount = parseInt(amount, 10);\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amount + 'px,0,0)';\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amount;\n            } else {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n          }),\n          setMarginRight: ionic.animationFrameThrottle(function(amount) {\n            if (amount) {\n              amount = parseInt(amount, 10);\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amount;\n            } else {\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n            // reset incase left gets grabby\n            $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n          }),\n          setMarginLeftAndRight: ionic.animationFrameThrottle(function(amountLeft, amountRight) {\n            amountLeft = amountLeft && parseInt(amountLeft, 10) || 0;\n            amountRight = amountRight && parseInt(amountRight, 10) || 0;\n\n            var amount = amountLeft + amountRight;\n\n            if (amount > 0) {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amountLeft + 'px,0,0)';\n              $element[0].style.width = ($window.innerWidth - amount) + 'px';\n              content.offsetX = amountLeft;\n            } else {\n              $element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n              $element[0].style.width = '';\n              content.offsetX = 0;\n            }\n            // reset incase left gets grabby\n            //$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';\n          }),\n          enableAnimation: function() {\n            $scope.animationEnabled = true;\n            $element[0].classList.add('menu-animated');\n          },\n          disableAnimation: function() {\n            $scope.animationEnabled = false;\n            $element[0].classList.remove('menu-animated');\n          },\n          offsetX: 0\n        };\n\n        sideMenuCtrl.setContent(content);\n\n        // add gesture handlers\n        var gestureOpts = { stop_browser_behavior: false };\n        gestureOpts.prevent_default_directions = ['left', 'right'];\n        var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element, gestureOpts);\n        var dragRightGesture = $ionicGesture.on('dragright', onDragX, $element, gestureOpts);\n        var dragLeftGesture = $ionicGesture.on('dragleft', onDragX, $element, gestureOpts);\n        var dragUpGesture = $ionicGesture.on('dragup', onDragY, $element, gestureOpts);\n        var dragDownGesture = $ionicGesture.on('dragdown', onDragY, $element, gestureOpts);\n        var releaseGesture = $ionicGesture.on('release', onDragRelease, $element, gestureOpts);\n\n        // Cleanup\n        $scope.$on('$destroy', function() {\n          if (content) {\n            content.element = null;\n            content = null;\n          }\n          $ionicGesture.off(dragLeftGesture, 'dragleft', onDragX);\n          $ionicGesture.off(dragRightGesture, 'dragright', onDragX);\n          $ionicGesture.off(dragUpGesture, 'dragup', onDragY);\n          $ionicGesture.off(dragDownGesture, 'dragdown', onDragY);\n          $ionicGesture.off(releaseGesture, 'release', onDragRelease);\n          $ionicGesture.off(contentTapGesture, 'tap', onContentTap);\n        });\n      }\n    }\n  };\n}]);\n\nIonicModule\n\n/**\n * @ngdoc directive\n * @name ionSideMenus\n * @module ionic\n * @delegate ionic.service:$ionicSideMenuDelegate\n * @restrict E\n *\n * @description\n * A container element for side menu(s) and the main content. Allows the left and/or right side menu\n * to be toggled by dragging the main content area side to side.\n *\n * To automatically close an opened menu, you can add the {@link ionic.directive:menuClose} attribute\n * directive. The `menu-close` attribute is usually added to links and buttons within\n * `ion-side-menu-content`, so that when the element is clicked, the opened side menu will\n * automatically close.\n *\n * \"Burger Icon\" toggles can be added to the header with the {@link ionic.directive:menuToggle}\n * attribute directive. Clicking the toggle will open and close the side menu like the `menu-close`\n * directive. The side menu will automatically hide on child pages, but can be overridden with the\n * enable-menu-with-back-views attribute mentioned below.\n *\n * By default, side menus are hidden underneath their side menu content and can be opened by swiping\n * the content left or right or by toggling a button to show the side menu. Additionally, by adding the\n * {@link ionic.directive:exposeAsideWhen} attribute directive to an\n * {@link ionic.directive:ionSideMenu} element directive, a side menu can be given instructions about\n * \"when\" the menu should be exposed (always viewable).\n *\n * ![Side Menu](http://ionicframework.com.s3.amazonaws.com/docs/controllers/sidemenu.gif)\n *\n * For more information on side menus, check out:\n *\n * - {@link ionic.directive:ionSideMenuContent}\n * - {@link ionic.directive:ionSideMenu}\n * - {@link ionic.directive:menuToggle}\n * - {@link ionic.directive:menuClose}\n * - {@link ionic.directive:exposeAsideWhen}\n *\n * @usage\n * To use side menus, add an `<ion-side-menus>` parent element. This will encompass all pages that have a\n * side menu, and have at least 2 child elements: 1 `<ion-side-menu-content>` for the center content,\n * and one or more `<ion-side-menu>` directives for each side menu(left/right) that you wish to place.\n *\n * ```html\n * <ion-side-menus>\n *   <!-- Left menu -->\n *   <ion-side-menu side=\"left\">\n *   </ion-side-menu>\n *\n *   <ion-side-menu-content>\n *   <!-- Main content, usually <ion-nav-view> -->\n *   </ion-side-menu-content>\n *\n *   <!-- Right menu -->\n *   <ion-side-menu side=\"right\">\n *   </ion-side-menu>\n *\n * </ion-side-menus>\n * ```\n * ```js\n * function ContentController($scope, $ionicSideMenuDelegate) {\n *   $scope.toggleLeft = function() {\n *     $ionicSideMenuDelegate.toggleLeft();\n *   };\n * }\n * ```\n *\n * @param {bool=} enable-menu-with-back-views Determines whether the side menu is enabled when the\n * back button is showing. When set to `false`, any {@link ionic.directive:menuToggle} will be hidden,\n * and the user cannot swipe to open the menu. When going back to the root page of the side menu (the\n * page without a back button visible), then any menuToggle buttons will show again, and menus will be\n * enabled again.\n * @param {string=} delegate-handle The handle used to identify this side menu\n * with {@link ionic.service:$ionicSideMenuDelegate}.\n *\n */\n.directive('ionSideMenus', ['$ionicBody', function($ionicBody) {\n  return {\n    restrict: 'ECA',\n    controller: '$ionicSideMenus',\n    compile: function(element, attr) {\n      attr.$set('class', (attr['class'] || '') + ' view');\n\n      return { pre: prelink };\n      function prelink($scope, $element, $attrs, ctrl) {\n\n        ctrl.enableMenuWithBackViews($scope.$eval($attrs.enableMenuWithBackViews));\n\n        $scope.$on('$ionicExposeAside', function(evt, isAsideExposed) {\n          if (!$scope.$exposeAside) $scope.$exposeAside = {};\n          $scope.$exposeAside.active = isAsideExposed;\n          $ionicBody.enableClass(isAsideExposed, 'aside-open');\n        });\n\n        $scope.$on('$ionicView.beforeEnter', function(ev, d) {\n          if (d.historyId) {\n            $scope.$activeHistoryId = d.historyId;\n          }\n        });\n\n        $scope.$on('$destroy', function() {\n          $ionicBody.removeClass('menu-open', 'aside-open');\n        });\n\n      }\n    }\n  };\n}]);\n\n\n/**\n * @ngdoc directive\n * @name ionSlideBox\n * @module ionic\n * @codepen AjgEB\n * @deprecated will be removed in the next Ionic release in favor of the new ion-slides component.\n * Don't depend on the internal behavior of this widget.\n * @delegate ionic.service:$ionicSlideBoxDelegate\n * @restrict E\n * @description\n * The Slide Box is a multi-page container where each page can be swiped or dragged between:\n *\n *\n * @usage\n * ```html\n * <ion-slide-box on-slide-changed=\"slideHasChanged($index)\">\n *   <ion-slide>\n *     <div class=\"box blue\"><h1>BLUE</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box yellow\"><h1>YELLOW</h1></div>\n *   </ion-slide>\n *   <ion-slide>\n *     <div class=\"box pink\"><h1>PINK</h1></div>\n *   </ion-slide>\n * </ion-slide-box>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify this slideBox\n * with {@link ionic.service:$ionicSlideBoxDelegate}.\n * @param {boolean=} does-continue Whether the slide box should loop.\n * @param {boolean=} auto-play Whether the slide box should automatically slide. Default true if does-continue is true.\n * @param {number=} slide-interval How many milliseconds to wait to change slides (if does-continue is true). Defaults to 4000.\n * @param {boolean=} show-pager Whether a pager should be shown for this slide box. Accepts expressions via `show-pager=\"{{shouldShow()}}\"`. Defaults to true.\n * @param {expression=} pager-click Expression to call when a pager is clicked (if show-pager is true). Is passed the 'index' variable.\n * @param {expression=} on-slide-changed Expression called whenever the slide is changed.  Is passed an '$index' variable.\n * @param {expression=} active-slide Model to bind the current slide index to.\n */\nIonicModule\n.directive('ionSlideBox', [\n  '$animate',\n  '$timeout',\n  '$compile',\n  '$ionicSlideBoxDelegate',\n  '$ionicHistory',\n  '$ionicScrollDelegate',\nfunction($animate, $timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $ionicScrollDelegate) {\n  return {\n    restrict: 'E',\n    replace: true,\n    transclude: true,\n    scope: {\n      autoPlay: '=',\n      doesContinue: '@',\n      slideInterval: '@',\n      showPager: '@',\n      pagerClick: '&',\n      disableScroll: '@',\n      onSlideChanged: '&',\n      activeSlide: '=?',\n      bounce: '@'\n    },\n    controller: ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {\n      var _this = this;\n\n      var continuous = $scope.$eval($scope.doesContinue) === true;\n      var bouncing = ($scope.$eval($scope.bounce) !== false); //Default to true\n      var shouldAutoPlay = isDefined($attrs.autoPlay) ? !!$scope.autoPlay : false;\n      var slideInterval = shouldAutoPlay ? $scope.$eval($scope.slideInterval) || 4000 : 0;\n\n      var slider = new ionic.views.Slider({\n        el: $element[0],\n        auto: slideInterval,\n        continuous: continuous,\n        startSlide: $scope.activeSlide,\n        bouncing: bouncing,\n        slidesChanged: function() {\n          $scope.currentSlide = slider.currentIndex();\n\n          // Try to trigger a digest\n          $timeout(function() {});\n        },\n        callback: function(slideIndex) {\n          $scope.currentSlide = slideIndex;\n          $scope.onSlideChanged({ index: $scope.currentSlide, $index: $scope.currentSlide});\n          $scope.$parent.$broadcast('slideBox.slideChanged', slideIndex);\n          $scope.activeSlide = slideIndex;\n          // Try to trigger a digest\n          $timeout(function() {});\n        },\n        onDrag: function() {\n          freezeAllScrolls(true);\n        },\n        onDragEnd: function() {\n          freezeAllScrolls(false);\n        }\n      });\n\n      function freezeAllScrolls(shouldFreeze) {\n        if (shouldFreeze && !_this.isScrollFreeze) {\n          $ionicScrollDelegate.freezeAllScrolls(shouldFreeze);\n\n        } else if (!shouldFreeze && _this.isScrollFreeze) {\n          $ionicScrollDelegate.freezeAllScrolls(false);\n        }\n        _this.isScrollFreeze = shouldFreeze;\n      }\n\n      slider.enableSlide($scope.$eval($attrs.disableScroll) !== true);\n\n      $scope.$watch('activeSlide', function(nv) {\n        if (isDefined(nv)) {\n          slider.slide(nv);\n        }\n      });\n\n      $scope.$on('slideBox.nextSlide', function() {\n        slider.next();\n      });\n\n      $scope.$on('slideBox.prevSlide', function() {\n        slider.prev();\n      });\n\n      $scope.$on('slideBox.setSlide', function(e, index) {\n        slider.slide(index);\n      });\n\n      //Exposed for testing\n      this.__slider = slider;\n\n      var deregisterInstance = $ionicSlideBoxDelegate._registerInstance(\n        slider, $attrs.delegateHandle, function() {\n          return $ionicHistory.isActiveScope($scope);\n        }\n      );\n      $scope.$on('$destroy', function() {\n        deregisterInstance();\n        slider.kill();\n      });\n\n      this.slidesCount = function() {\n        return slider.slidesCount();\n      };\n\n      this.onPagerClick = function(index) {\n        $scope.pagerClick({index: index});\n      };\n\n      $timeout(function() {\n        slider.load();\n      });\n    }],\n    template: '<div class=\"slider\">' +\n      '<div class=\"slider-slides\" ng-transclude>' +\n      '</div>' +\n    '</div>',\n\n    link: function($scope, $element, $attr) {\n      // Disable ngAnimate for slidebox and its children\n      $animate.enabled($element, false);\n\n      // if showPager is undefined, show the pager\n      if (!isDefined($attr.showPager)) {\n        $scope.showPager = true;\n        getPager().toggleClass('hide', !true);\n      }\n\n      $attr.$observe('showPager', function(show) {\n        if (show === undefined) return;\n        show = $scope.$eval(show);\n        getPager().toggleClass('hide', !show);\n      });\n\n      var pager;\n      function getPager() {\n        if (!pager) {\n          var childScope = $scope.$new();\n          pager = jqLite('<ion-pager></ion-pager>');\n          $element.append(pager);\n          pager = $compile(pager)(childScope);\n        }\n        return pager;\n      }\n    }\n  };\n}])\n.directive('ionSlide', function() {\n  return {\n    restrict: 'E',\n    require: '?^ionSlideBox',\n    compile: function(element) {\n      element.addClass('slider-slide');\n    }\n  };\n})\n\n.directive('ionPager', function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '^ionSlideBox',\n    template: '<div class=\"slider-pager\"><span class=\"slider-pager-page\" ng-repeat=\"slide in numSlides() track by $index\" ng-class=\"{active: $index == currentSlide}\" ng-click=\"pagerClick($index)\"><i class=\"icon ion-record\"></i></span></div>',\n    link: function($scope, $element, $attr, slideBox) {\n      var selectPage = function(index) {\n        var children = $element[0].children;\n        var length = children.length;\n        for (var i = 0; i < length; i++) {\n          if (i == index) {\n            children[i].classList.add('active');\n          } else {\n            children[i].classList.remove('active');\n          }\n        }\n      };\n\n      $scope.pagerClick = function(index) {\n        slideBox.onPagerClick(index);\n      };\n\n      $scope.numSlides = function() {\n        return new Array(slideBox.slidesCount());\n      };\n\n      $scope.$watch('currentSlide', function(v) {\n        selectPage(v);\n      });\n    }\n  };\n\n});\n\n\n/**\n * @ngdoc directive\n * @name ionSlides\n * @module ionic\n * @delegate ionic.service:$ionicSlideBoxDelegate\n * @restrict E\n * @description\n * The Slides component is a powerful multi-page container where each page can be swiped or dragged between.\n *\n * Note: this is a new version of the Ionic Slide Box based on the [Swiper](http://www.idangero.us/swiper/#.Vmc1J-ODFBc) widget from\n * [idangerous](http://www.idangero.us/).\n *\n * ![SlideBox](http://ionicframework.com.s3.amazonaws.com/docs/controllers/slideBox.gif)\n *\n * @usage\n * ```html\n * <ion-content scroll=\"false\">\n *   <ion-slides  options=\"options\" slider=\"data.slider\">\n *     <ion-slide-page>\n *       <div class=\"box blue\"><h1>BLUE</h1></div>\n *     </ion-slide-page>\n *     <ion-slide-page>\n *       <div class=\"box yellow\"><h1>YELLOW</h1></div>\n *     </ion-slide-page>\n *     <ion-slide-page>\n *       <div class=\"box pink\"><h1>PINK</h1></div>\n *     </ion-slide-page>\n *   </ion-slides>\n * </ion-content>\n * ```\n *\n * ```js\n * $scope.options = {\n *   loop: false,\n *   effect: 'fade',\n *   speed: 500,\n * }\n *\n * $scope.$on(\"$ionicSlides.sliderInitialized\", function(event, data){\n *   // data.slider is the instance of Swiper\n *   $scope.slider = data.slider;\n * });\n *\n * $scope.$on(\"$ionicSlides.slideChangeStart\", function(event, data){\n *   console.log('Slide change is beginning');\n * });\n *\n * $scope.$on(\"$ionicSlides.slideChangeEnd\", function(event, data){\n *   // note: the indexes are 0-based\n *   $scope.activeIndex = data.activeIndex;\n *   $scope.previousIndex = data.previousIndex;\n * });\n *\n * ```\n *\n * ## Slide Events\n *\n * The slides component dispatches events when the active slide changes\n *\n * <table class=\"table\">\n *   <tr>\n *     <td><code>$ionicSlides.slideChangeStart</code></td>\n *     <td>This event is emitted when a slide change begins</td>\n *   </tr>\n *   <tr>\n *     <td><code>$ionicSlides.slideChangeEnd</code></td>\n *     <td>This event is emitted when a slide change completes</td>\n *   </tr>\n *   <tr>\n *     <td><code>$ionicSlides.sliderInitialized</code></td>\n *     <td>This event is emitted when the slider is initialized. It provides access to an instance of the slider.</td>\n *   </tr>\n * </table>\n *\n *\n * ## Updating Slides Dynamically\n * When applying data to the slider at runtime, typically everything will work as expected.\n *\n * In the event that the slides are looped, use the `updateLoop` method on the slider to ensure the slides update correctly.\n *\n * ```\n * $scope.$on(\"$ionicSlides.sliderInitialized\", function(event, data){\n *   // grab an instance of the slider\n *   $scope.slider = data.slider;\n * });\n *\n * function dataChangeHandler(){\n *   // call this function when data changes, such as an HTTP request, etc\n *   if ( $scope.slider ){\n *     $scope.slider.updateLoop();\n *   }\n * }\n * ```\n *\n */\nIonicModule\n.directive('ionSlides', [\n  '$animate',\n  '$timeout',\n  '$compile',\nfunction($animate, $timeout, $compile) {\n  return {\n    restrict: 'E',\n    transclude: true,\n    scope: {\n      options: '=',\n      slider: '='\n    },\n    template: '<div class=\"swiper-container\">' +\n      '<div class=\"swiper-wrapper\" ng-transclude>' +\n      '</div>' +\n        '<div ng-hide=\"!showPager\" class=\"swiper-pagination\"></div>' +\n      '</div>',\n    controller: ['$scope', '$element', function($scope, $element) {\n      var _this = this;\n\n      this.update = function() {\n        $timeout(function() {\n          if (!_this.__slider) {\n            return;\n          }\n\n          _this.__slider.update();\n          if (_this._options.loop) {\n            _this.__slider.createLoop();\n          }\n\n          var slidesLength = _this.__slider.slides.length;\n\n          // Don't allow pager to show with > 10 slides\n          if (slidesLength > 10) {\n            $scope.showPager = false;\n          }\n\n          // When slide index is greater than total then slide to last index\n          if (_this.__slider.activeIndex > slidesLength - 1) {\n            _this.__slider.slideTo(slidesLength - 1);\n          }\n        });\n      };\n\n      this.rapidUpdate = ionic.debounce(function() {\n        _this.update();\n      }, 50);\n\n      this.getSlider = function() {\n        return _this.__slider;\n      };\n\n      var options = $scope.options || {};\n\n      var newOptions = angular.extend({\n        pagination: $element.children().children()[1],\n        paginationClickable: true,\n        lazyLoading: true,\n        preloadImages: false\n      }, options);\n\n      this._options = newOptions;\n\n      $timeout(function() {\n        var slider = new ionic.views.Swiper($element.children()[0], newOptions, $scope, $compile);\n\n        $scope.$emit(\"$ionicSlides.sliderInitialized\", { slider: slider });\n\n        _this.__slider = slider;\n        $scope.slider = _this.__slider;\n\n        $scope.$on('$destroy', function() {\n          slider.destroy();\n          _this.__slider = null;\n        });\n      });\n\n      $timeout(function() {\n        // if it's a loop, render the slides again just incase\n        _this.rapidUpdate();\n      }, 200);\n\n    }],\n\n    link: function($scope) {\n      $scope.showPager = true;\n      // Disable ngAnimate for slidebox and its children\n      //$animate.enabled(false, $element);\n    }\n  };\n}])\n.directive('ionSlidePage', [function() {\n  return {\n    restrict: 'E',\n    require: '?^ionSlides',\n    transclude: true,\n    replace: true,\n    template: '<div class=\"swiper-slide\" ng-transclude></div>',\n    link: function($scope, $element, $attr, ionSlidesCtrl) {\n      ionSlidesCtrl.rapidUpdate();\n\n      $scope.$on('$destroy', function() {\n        ionSlidesCtrl.rapidUpdate();\n      });\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionSpinner\n* @module ionic\n* @restrict E\n *\n * @description\n * The `ionSpinner` directive provides a variety of animated spinners.\n * Spinners enables you to give your users feedback that the app is\n * processing/thinking/waiting/chillin' out, or whatever you'd like it to indicate.\n * By default, the {@link ionic.directive:ionRefresher} feature uses this spinner, rather\n * than rotating font icons (previously included in [ionicons](http://ionicons.com/)).\n * While font icons are great for simple or stationary graphics, they're not suited to\n * provide great animations, which is why Ionic uses SVG instead.\n *\n * Ionic offers ten spinners out of the box, and by default, it will use the appropriate spinner\n * for the platform on which it's running. Under the hood, the `ionSpinner` directive dynamically\n * builds the required SVG element, which allows Ionic to provide all ten of the animated SVGs\n * within 3KB.\n *\n * <style>\n * .spinner-table {\n *   max-width: 280px;\n * }\n * .spinner-table tbody > tr > th, .spinner-table tbody > tr > td {\n *   vertical-align: middle;\n *   width: 42px;\n *   height: 42px;\n * }\n * .spinner {\n *   stroke: #444;\n *   fill: #444; }\n *   .spinner svg {\n *     width: 28px;\n *     height: 28px; }\n *   .spinner.spinner-inverse {\n *     stroke: #fff;\n *     fill: #fff; }\n *\n * .spinner-android {\n *   stroke: #4b8bf4; }\n *\n * .spinner-ios, .spinner-ios-small {\n *   stroke: #69717d; }\n *\n * .spinner-spiral .stop1 {\n *   stop-color: #fff;\n *   stop-opacity: 0; }\n * .spinner-spiral.spinner-inverse .stop1 {\n *   stop-color: #000; }\n * .spinner-spiral.spinner-inverse .stop2 {\n *   stop-color: #fff; }\n * </style>\n *\n * <script src=\"http://code.ionicframework.com/nightly/js/ionic.bundle.min.js\"></script>\n * <table class=\"table spinner-table\" ng-app=\"ionic\">\n *  <tr>\n *    <th>\n *      <code>android</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"android\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>ios</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"ios\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>ios-small</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"ios-small\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>bubbles</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"bubbles\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>circles</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"circles\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>crescent</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"crescent\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>dots</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"dots\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>lines</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"lines\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>ripple</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"ripple\"></ion-spinner>\n *    </td>\n *  </tr>\n *  <tr>\n *    <th>\n *      <code>spiral</code>\n *    </th>\n *    <td>\n *      <ion-spinner icon=\"spiral\"></ion-spinner>\n *    </td>\n *  </tr>\n * </table>\n *\n * Each spinner uses SVG with SMIL animations, however, the Android spinner also uses JavaScript\n * so it also works on Android 4.0-4.3. Additionally, each spinner can be styled with CSS,\n * and scaled to any size.\n *\n *\n * @usage\n * The following code would use the default spinner for the platform it's running from. If it's neither\n * iOS or Android, it'll default to use `ios`.\n *\n * ```html\n * <ion-spinner></ion-spinner>\n * ```\n *\n * By setting the `icon` attribute, you can specify which spinner to use, no matter what\n * the platform is.\n *\n * ```html\n * <ion-spinner icon=\"spiral\"></ion-spinner>\n * ```\n *\n * ## Spinner Colors\n * Like with most of Ionic's other components, spinners can also be styled using\n * Ionic's standard color naming convention. For example:\n *\n * ```html\n * <ion-spinner class=\"spinner-energized\"></ion-spinner>\n * ```\n *\n *\n * ## Styling SVG with CSS\n * One cool thing about SVG is its ability to be styled with CSS! Some of the properties\n * have different names, for example, SVG uses the term `stroke` instead of `border`, and\n * `fill` instead of `background-color`.\n *\n * ```css\n * .spinner svg {\n *   width: 28px;\n *   height: 28px;\n *   stroke: #444;\n *   fill: #444;\n * }\n * ```\n *\n*/\nIonicModule\n.directive('ionSpinner', function() {\n  return {\n    restrict: 'E',\n    controller: '$ionicSpinner',\n    link: function($scope, $element, $attrs, ctrl) {\n      var spinnerName = ctrl.init();\n      $element.addClass('spinner spinner-' + spinnerName);\n\n      $element.on('$destroy', function onDestroy() {\n        ctrl.stop();\n      });\n    }\n  };\n});\n\n/**\n * @ngdoc directive\n * @name ionTab\n * @module ionic\n * @restrict E\n * @parent ionic.directive:ionTabs\n *\n * @description\n * Contains a tab's content.  The content only exists while the given tab is selected.\n *\n * Each ionTab has its own view history.\n *\n * @usage\n * ```html\n * <ion-tab\n *   title=\"Tab!\"\n *   icon=\"my-icon\"\n *   href=\"#/tab/tab-link\"\n *   on-select=\"onTabSelected()\"\n *   on-deselect=\"onTabDeselected()\">\n * </ion-tab>\n * ```\n * For a complete, working tab bar example, see the {@link ionic.directive:ionTabs} documentation.\n *\n * @param {string} title The title of the tab.\n * @param {string=} href The link that this tab will navigate to when tapped.\n * @param {string=} icon The icon of the tab. If given, this will become the default for icon-on and icon-off.\n * @param {string=} icon-on The icon of the tab while it is selected.\n * @param {string=} icon-off The icon of the tab while it is not selected.\n * @param {expression=} badge The badge to put on this tab (usually a number).\n * @param {expression=} badge-style The style of badge to put on this tab (eg: badge-positive).\n * @param {expression=} on-select Called when this tab is selected.\n * @param {expression=} on-deselect Called when this tab is deselected.\n * @param {expression=} ng-click By default, the tab will be selected on click. If ngClick is set, it will not.  You can explicitly switch tabs using {@link ionic.service:$ionicTabsDelegate#select $ionicTabsDelegate.select()}.\n * @param {expression=} hidden Whether the tab is to be hidden or not.\n * @param {expression=} disabled Whether the tab is to be disabled or not.\n */\nIonicModule\n.directive('ionTab', [\n  '$compile',\n  '$ionicConfig',\n  '$ionicBind',\n  '$ionicViewSwitcher',\nfunction($compile, $ionicConfig, $ionicBind, $ionicViewSwitcher) {\n\n  //Returns ' key=\"value\"' if value exists\n  function attrStr(k, v) {\n    return isDefined(v) ? ' ' + k + '=\"' + v + '\"' : '';\n  }\n  return {\n    restrict: 'E',\n    require: ['^ionTabs', 'ionTab'],\n    controller: '$ionicTab',\n    scope: true,\n    compile: function(element, attr) {\n\n      //We create the tabNavTemplate in the compile phase so that the\n      //attributes we pass down won't be interpolated yet - we want\n      //to pass down the 'raw' versions of the attributes\n      var tabNavTemplate = '<ion-tab-nav' +\n        attrStr('ng-click', attr.ngClick) +\n        attrStr('title', attr.title) +\n        attrStr('icon', attr.icon) +\n        attrStr('icon-on', attr.iconOn) +\n        attrStr('icon-off', attr.iconOff) +\n        attrStr('badge', attr.badge) +\n        attrStr('badge-style', attr.badgeStyle) +\n        attrStr('hidden', attr.hidden) +\n        attrStr('disabled', attr.disabled) +\n        attrStr('class', attr['class']) +\n        '></ion-tab-nav>';\n\n      //Remove the contents of the element so we can compile them later, if tab is selected\n      var tabContentEle = document.createElement('div');\n      for (var x = 0; x < element[0].children.length; x++) {\n        tabContentEle.appendChild(element[0].children[x].cloneNode(true));\n      }\n      var childElementCount = tabContentEle.childElementCount;\n      element.empty();\n\n      var navViewName, isNavView;\n      if (childElementCount) {\n        if (tabContentEle.children[0].tagName === 'ION-NAV-VIEW') {\n          // get the name if it's a nav-view\n          navViewName = tabContentEle.children[0].getAttribute('name');\n          tabContentEle.children[0].classList.add('view-container');\n          isNavView = true;\n        }\n        if (childElementCount === 1) {\n          // make the 1 child element the primary tab content container\n          tabContentEle = tabContentEle.children[0];\n        }\n        if (!isNavView) tabContentEle.classList.add('pane');\n        tabContentEle.classList.add('tab-content');\n      }\n\n      return function link($scope, $element, $attr, ctrls) {\n        var childScope;\n        var childElement;\n        var tabsCtrl = ctrls[0];\n        var tabCtrl = ctrls[1];\n        var isTabContentAttached = false;\n        $scope.$tabSelected = false;\n\n        $ionicBind($scope, $attr, {\n          onSelect: '&',\n          onDeselect: '&',\n          title: '@',\n          uiSref: '@',\n          href: '@'\n        });\n\n        tabsCtrl.add($scope);\n        $scope.$on('$destroy', function() {\n          if (!$scope.$tabsDestroy) {\n            // if the containing ionTabs directive is being destroyed\n            // then don't bother going through the controllers remove\n            // method, since remove will reset the active tab as each tab\n            // is being destroyed, causing unnecessary view loads and transitions\n            tabsCtrl.remove($scope);\n          }\n          tabNavElement.isolateScope().$destroy();\n          tabNavElement.remove();\n          tabNavElement = tabContentEle = childElement = null;\n        });\n\n        //Remove title attribute so browser-tooltip does not apear\n        $element[0].removeAttribute('title');\n\n        if (navViewName) {\n          tabCtrl.navViewName = $scope.navViewName = navViewName;\n        }\n        $scope.$on('$stateChangeSuccess', selectIfMatchesState);\n        selectIfMatchesState();\n        function selectIfMatchesState() {\n          if (tabCtrl.tabMatchesState()) {\n            tabsCtrl.select($scope, false);\n          }\n        }\n\n        var tabNavElement = jqLite(tabNavTemplate);\n        tabNavElement.data('$ionTabsController', tabsCtrl);\n        tabNavElement.data('$ionTabController', tabCtrl);\n        tabsCtrl.$tabsElement.append($compile(tabNavElement)($scope));\n\n\n        function tabSelected(isSelected) {\n          if (isSelected && childElementCount) {\n            // this tab is being selected\n\n            // check if the tab is already in the DOM\n            // only do this if the tab has child elements\n            if (!isTabContentAttached) {\n              // tab should be selected and is NOT in the DOM\n              // create a new scope and append it\n              childScope = $scope.$new();\n              childElement = jqLite(tabContentEle);\n              $ionicViewSwitcher.viewEleIsActive(childElement, true);\n              tabsCtrl.$element.append(childElement);\n              $compile(childElement)(childScope);\n              isTabContentAttached = true;\n            }\n\n            // remove the hide class so the tabs content shows up\n            $ionicViewSwitcher.viewEleIsActive(childElement, true);\n\n          } else if (isTabContentAttached && childElement) {\n            // this tab should NOT be selected, and it is already in the DOM\n\n            if ($ionicConfig.views.maxCache() > 0) {\n              // keep the tabs in the DOM, only css hide it\n              $ionicViewSwitcher.viewEleIsActive(childElement, false);\n\n            } else {\n              // do not keep tabs in the DOM\n              destroyTab();\n            }\n\n          }\n        }\n\n        function destroyTab() {\n          childScope && childScope.$destroy();\n          isTabContentAttached && childElement && childElement.remove();\n          tabContentEle.innerHTML = '';\n          isTabContentAttached = childScope = childElement = null;\n        }\n\n        $scope.$watch('$tabSelected', tabSelected);\n\n        $scope.$on('$ionicView.afterEnter', function() {\n          $ionicViewSwitcher.viewEleIsActive(childElement, $scope.$tabSelected);\n        });\n\n        $scope.$on('$ionicView.clearCache', function() {\n          if (!$scope.$tabSelected) {\n            destroyTab();\n          }\n        });\n\n      };\n    }\n  };\n}]);\n\nIonicModule\n.directive('ionTabNav', [function() {\n  return {\n    restrict: 'E',\n    replace: true,\n    require: ['^ionTabs', '^ionTab'],\n    template:\n    '<a ng-class=\"{\\'has-badge\\':badge, \\'tab-hidden\\':isHidden(), \\'tab-item-active\\': isTabActive()}\" ' +\n      ' ng-disabled=\"disabled()\" class=\"tab-item\">' +\n      '<span class=\"badge {{badgeStyle}}\" ng-if=\"badge\">{{badge}}</span>' +\n      '<i class=\"icon {{getIcon()}}\" ng-if=\"getIcon()\"></i>' +\n      '<span class=\"tab-title\" ng-bind-html=\"title\"></span>' +\n    '</a>',\n    scope: {\n      title: '@',\n      icon: '@',\n      iconOn: '@',\n      iconOff: '@',\n      badge: '=',\n      hidden: '@',\n      disabled: '&',\n      badgeStyle: '@',\n      'class': '@'\n    },\n    link: function($scope, $element, $attrs, ctrls) {\n      var tabsCtrl = ctrls[0],\n        tabCtrl = ctrls[1];\n\n      //Remove title attribute so browser-tooltip does not apear\n      $element[0].removeAttribute('title');\n\n      $scope.selectTab = function(e) {\n        e.preventDefault();\n        tabsCtrl.select(tabCtrl.$scope, true);\n      };\n      if (!$attrs.ngClick) {\n        $element.on('click', function(event) {\n          $scope.$apply(function() {\n            $scope.selectTab(event);\n          });\n        });\n      }\n\n      $scope.isHidden = function() {\n        if ($attrs.hidden === 'true' || $attrs.hidden === true) return true;\n        return false;\n      };\n\n      $scope.getIconOn = function() {\n        return $scope.iconOn || $scope.icon;\n      };\n      $scope.getIconOff = function() {\n        return $scope.iconOff || $scope.icon;\n      };\n\n      $scope.isTabActive = function() {\n        return tabsCtrl.selectedTab() === tabCtrl.$scope;\n      };\n\n      $scope.getIcon = function() {\n        if ( tabsCtrl.selectedTab() === tabCtrl.$scope ) {\n          // active\n          return $scope.iconOn || $scope.icon;\n        }\n        else {\n          // inactive\n          return $scope.iconOff || $scope.icon;\n        }\n      };\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionTabs\n * @module ionic\n * @delegate ionic.service:$ionicTabsDelegate\n * @restrict E\n * @codepen odqCz\n *\n * @description\n * Powers a multi-tabbed interface with a Tab Bar and a set of \"pages\" that can be tabbed\n * through.\n *\n * Assign any [tabs class](/docs/components#tabs) to the element to define\n * its look and feel.\n *\n * For iOS, tabs will appear at the bottom of the screen. For Android, tabs will be at the top\n * of the screen, below the nav-bar. This follows each OS's design specification, but can be\n * configured with the {@link ionic.provider:$ionicConfigProvider}.\n *\n * See the {@link ionic.directive:ionTab} directive's documentation for more details on\n * individual tabs.\n *\n * Note: do not place ion-tabs inside of an ion-content element; it has been known to cause a\n * certain CSS bug.\n *\n * @usage\n * ```html\n * <ion-tabs class=\"tabs-positive tabs-icon-top\">\n *\n *   <ion-tab title=\"Home\" icon-on=\"ion-ios-filing\" icon-off=\"ion-ios-filing-outline\">\n *     <!-- Tab 1 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"About\" icon-on=\"ion-ios-clock\" icon-off=\"ion-ios-clock-outline\">\n *     <!-- Tab 2 content -->\n *   </ion-tab>\n *\n *   <ion-tab title=\"Settings\" icon-on=\"ion-ios-gear\" icon-off=\"ion-ios-gear-outline\">\n *     <!-- Tab 3 content -->\n *   </ion-tab>\n *\n * </ion-tabs>\n * ```\n *\n * @param {string=} delegate-handle The handle used to identify these tabs\n * with {@link ionic.service:$ionicTabsDelegate}.\n */\n\nIonicModule\n.directive('ionTabs', [\n  '$ionicTabsDelegate',\n  '$ionicConfig',\nfunction($ionicTabsDelegate, $ionicConfig) {\n  return {\n    restrict: 'E',\n    scope: true,\n    controller: '$ionicTabs',\n    compile: function(tElement) {\n      //We cannot use regular transclude here because it breaks element.data()\n      //inheritance on compile\n      var innerElement = jqLite('<div class=\"tab-nav tabs\">');\n      innerElement.append(tElement.contents());\n\n      tElement.append(innerElement)\n              .addClass('tabs-' + $ionicConfig.tabs.position() + ' tabs-' + $ionicConfig.tabs.style());\n\n      return { pre: prelink, post: postLink };\n      function prelink($scope, $element, $attr, tabsCtrl) {\n        var deregisterInstance = $ionicTabsDelegate._registerInstance(\n          tabsCtrl, $attr.delegateHandle, tabsCtrl.hasActiveScope\n        );\n\n        tabsCtrl.$scope = $scope;\n        tabsCtrl.$element = $element;\n        tabsCtrl.$tabsElement = jqLite($element[0].querySelector('.tabs'));\n\n        $scope.$watch(function() { return $element[0].className; }, function(value) {\n          var isTabsTop = value.indexOf('tabs-top') !== -1;\n          var isHidden = value.indexOf('tabs-item-hide') !== -1;\n          $scope.$hasTabs = !isTabsTop && !isHidden;\n          $scope.$hasTabsTop = isTabsTop && !isHidden;\n          $scope.$emit('$ionicTabs.top', $scope.$hasTabsTop);\n        });\n\n        function emitLifecycleEvent(ev, data) {\n          ev.stopPropagation();\n          var previousSelectedTab = tabsCtrl.previousSelectedTab();\n          if (previousSelectedTab) {\n            previousSelectedTab.$broadcast(ev.name.replace('NavView', 'Tabs'), data);\n          }\n        }\n\n        $scope.$on('$ionicNavView.beforeLeave', emitLifecycleEvent);\n        $scope.$on('$ionicNavView.afterLeave', emitLifecycleEvent);\n        $scope.$on('$ionicNavView.leave', emitLifecycleEvent);\n\n        $scope.$on('$destroy', function() {\n          // variable to inform child tabs that they're all being blown away\n          // used so that while destorying an individual tab, each one\n          // doesn't select the next tab as the active one, which causes unnecessary\n          // loading of tab views when each will eventually all go away anyway\n          $scope.$tabsDestroy = true;\n          deregisterInstance();\n          tabsCtrl.$tabsElement = tabsCtrl.$element = tabsCtrl.$scope = innerElement = null;\n          delete $scope.$hasTabs;\n          delete $scope.$hasTabsTop;\n        });\n      }\n\n      function postLink($scope, $element, $attr, tabsCtrl) {\n        if (!tabsCtrl.selectedTab()) {\n          // all the tabs have been added\n          // but one hasn't been selected yet\n          tabsCtrl.select(0);\n        }\n      }\n    }\n  };\n}]);\n\n/**\n* @ngdoc directive\n* @name ionTitle\n* @module ionic\n* @restrict E\n*\n* Used for titles in header and nav bars. New in 1.2\n*\n* Identical to <div class=\"title\"> but with future compatibility for Ionic 2\n*\n* @usage\n*\n* ```html\n* <ion-nav-bar>\n*   <ion-title>Hello</ion-title>\n* <ion-nav-bar>\n* ```\n*/\nIonicModule\n.directive('ionTitle', [function() {\n  return {\n    restrict: 'E',\n    compile: function(element) {\n      element.addClass('title');\n    }\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionToggle\n * @module ionic\n * @codepen tfAzj\n * @restrict E\n *\n * @description\n * A toggle is an animated switch which binds a given model to a boolean.\n *\n * Allows dragging of the switch's nub.\n *\n * The toggle behaves like any [AngularJS checkbox](http://docs.angularjs.org/api/ng/input/input[checkbox]) otherwise.\n *\n * @param toggle-class {string=} Sets the CSS class on the inner `label.toggle` element created by the directive.\n *\n * @usage\n * Below is an example of a toggle directive which is wired up to the `airplaneMode` model\n * and has the `toggle-calm` CSS class assigned to the inner element.\n *\n * ```html\n * <ion-toggle ng-model=\"airplaneMode\" toggle-class=\"toggle-calm\">Airplane Mode</ion-toggle>\n * ```\n */\nIonicModule\n.directive('ionToggle', [\n  '$timeout',\n  '$ionicConfig',\nfunction($timeout, $ionicConfig) {\n\n  return {\n    restrict: 'E',\n    replace: true,\n    require: '?ngModel',\n    transclude: true,\n    template:\n      '<div class=\"item item-toggle\">' +\n        '<div ng-transclude></div>' +\n        '<label class=\"toggle\">' +\n          '<input type=\"checkbox\">' +\n          '<div class=\"track\">' +\n            '<div class=\"handle\"></div>' +\n          '</div>' +\n        '</label>' +\n      '</div>',\n\n    compile: function(element, attr) {\n      var input = element.find('input');\n      forEach({\n        'name': attr.name,\n        'ng-value': attr.ngValue,\n        'ng-model': attr.ngModel,\n        'ng-checked': attr.ngChecked,\n        'ng-disabled': attr.ngDisabled,\n        'ng-true-value': attr.ngTrueValue,\n        'ng-false-value': attr.ngFalseValue,\n        'ng-change': attr.ngChange,\n        'ng-required': attr.ngRequired,\n        'required': attr.required\n      }, function(value, name) {\n        if (isDefined(value)) {\n          input.attr(name, value);\n        }\n      });\n\n      if (attr.toggleClass) {\n        element[0].getElementsByTagName('label')[0].classList.add(attr.toggleClass);\n      }\n\n      element.addClass('toggle-' + $ionicConfig.form.toggle());\n\n      return function($scope, $element) {\n        var el = $element[0].getElementsByTagName('label')[0];\n        var checkbox = el.children[0];\n        var track = el.children[1];\n        var handle = track.children[0];\n\n        var ngModelController = jqLite(checkbox).controller('ngModel');\n\n        $scope.toggle = new ionic.views.Toggle({\n          el: el,\n          track: track,\n          checkbox: checkbox,\n          handle: handle,\n          onChange: function() {\n            if (ngModelController) {\n              ngModelController.$setViewValue(checkbox.checked);\n              $scope.$apply();\n            }\n          }\n        });\n\n        $scope.$on('$destroy', function() {\n          $scope.toggle.destroy();\n        });\n      };\n    }\n\n  };\n}]);\n\n/**\n * @ngdoc directive\n * @name ionView\n * @module ionic\n * @restrict E\n * @parent ionNavView\n *\n * @description\n * A container for view content and any navigational and header bar information. When a view\n * enters and exits its parent {@link ionic.directive:ionNavView}, the view also emits view\n * information, such as its title, whether the back button should be displayed or not, whether the\n * corresponding {@link ionic.directive:ionNavBar} should be displayed or not, which transition the view\n * should use to animate, and which direction to animate.\n *\n * *Views are cached to improve performance.* When a view is navigated away from, its element is\n * left in the DOM, and its scope is disconnected from the `$watch` cycle. When navigating to a\n * view that is already cached, its scope is reconnected, and the existing element, which was\n * left in the DOM, becomes active again. This can be disabled, or the maximum number of cached\n * views changed in {@link ionic.provider:$ionicConfigProvider}, in the view's `$state` configuration, or\n * as an attribute on the view itself (see below).\n *\n * @usage\n * Below is an example where our page will load with a {@link ionic.directive:ionNavBar} containing\n * \"My Page\" as the title.\n *\n * ```html\n * <ion-nav-bar></ion-nav-bar>\n * <ion-nav-view>\n *   <ion-view view-title=\"My Page\">\n *     <ion-content>\n *       Hello!\n *     </ion-content>\n *   </ion-view>\n * </ion-nav-view>\n * ```\n *\n * ## View LifeCycle and Events\n *\n * Views can be cached, which means ***controllers normally only load once***, which may\n * affect your controller logic. To know when a view has entered or left, events\n * have been added that are emitted from the view's scope. These events also\n * contain data about the view, such as the title and whether the back button should\n * show. Also contained is transition data, such as the transition type and\n * direction that will be or was used.\n *\n * Life cycle events are emitted upwards from the transitioning view's scope. In some cases, it is\n * desirable for a child/nested view to be notified of the event.\n * For this use case, `$ionicParentView` life cycle events are broadcast downwards.\n *\n * <table class=\"table\">\n *  <tr>\n *   <td><code>$ionicView.loaded</code></td>\n *   <td>The view has loaded. This event only happens once per\n * view being created and added to the DOM. If a view leaves but is cached,\n * then this event will not fire again on a subsequent viewing. The loaded event\n * is good place to put your setup code for the view; however, it is not the\n * recommended event to listen to when a view becomes active.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.enter</code></td>\n *   <td>The view has fully entered and is now the active view.\n * This event will fire, whether it was the first load or a cached view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.leave</code></td>\n *   <td>The view has finished leaving and is no longer the\n * active view. This event will fire, whether it is cached or destroyed.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.beforeEnter</code></td>\n *   <td>The view is about to enter and become the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.beforeLeave</code></td>\n *   <td>The view is about to leave and no longer be the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.afterEnter</code></td>\n *   <td>The view has fully entered and is now the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.afterLeave</code></td>\n *   <td>The view has finished leaving and is no longer the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicView.unloaded</code></td>\n *   <td>The view's controller has been destroyed and its element has been\n * removed from the DOM.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.enter</code></td>\n *   <td>The parent view has fully entered and is now the active view.\n * This event will fire, whether it was the first load or a cached view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.leave</code></td>\n *   <td>The parent view has finished leaving and is no longer the\n * active view. This event will fire, whether it is cached or destroyed.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.beforeEnter</code></td>\n *   <td>The parent view is about to enter and become the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.beforeLeave</code></td>\n *   <td>The parent view is about to leave and no longer be the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.afterEnter</code></td>\n *   <td>The parent view has fully entered and is now the active view.</td>\n *  </tr>\n *  <tr>\n *   <td><code>$ionicParentView.afterLeave</code></td>\n *   <td>The parent view has finished leaving and is no longer the active view.</td>\n *  </tr>\n * </table>\n *\n * ## LifeCycle Event Usage\n *\n * Below is an example of how to listen to life cycle events and\n * access state parameter data\n *\n * ```js\n * $scope.$on(\"$ionicView.beforeEnter\", function(event, data){\n *    // handle event\n *    console.log(\"State Params: \", data.stateParams);\n * });\n *\n * $scope.$on(\"$ionicView.enter\", function(event, data){\n *    // handle event\n *    console.log(\"State Params: \", data.stateParams);\n * });\n *\n * $scope.$on(\"$ionicView.afterEnter\", function(event, data){\n *    // handle event\n *    console.log(\"State Params: \", data.stateParams);\n * });\n * ```\n *\n * ## Caching\n *\n * Caching can be disabled and enabled in multiple ways. By default, Ionic will\n * cache a maximum of 10 views. You can optionally choose to disable caching at\n * either an individual view basis, or by global configuration. Please see the\n * _Caching_ section in {@link ionic.directive:ionNavView} for more info.\n *\n * @param {string=} view-title A text-only title to display on the parent {@link ionic.directive:ionNavBar}.\n * For an HTML title, such as an image, see {@link ionic.directive:ionNavTitle} instead.\n * @param {boolean=} cache-view If this view should be allowed to be cached or not.\n * Please see the _Caching_ section in {@link ionic.directive:ionNavView} for\n * more info. Default `true`\n * @param {boolean=} can-swipe-back If this view should be allowed to use the swipe to go back gesture or not.\n * This does not enable the swipe to go back feature if it is not available for the platform it's running\n * from, or there isn't a previous view. Default `true`\n * @param {boolean=} hide-back-button Whether to hide the back button on the parent\n * {@link ionic.directive:ionNavBar} by default.\n * @param {boolean=} hide-nav-bar Whether to hide the parent\n * {@link ionic.directive:ionNavBar} by default.\n */\nIonicModule\n.directive('ionView', function() {\n  return {\n    restrict: 'EA',\n    priority: 1000,\n    controller: '$ionicView',\n    compile: function(tElement) {\n      tElement.addClass('pane');\n      tElement[0].removeAttribute('title');\n      return function link($scope, $element, $attrs, viewCtrl) {\n        viewCtrl.init();\n      };\n    }\n  };\n});\n\n})();"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/js/ionic.js",
    "content": "/*!\n * Copyright 2015 Drifty Co.\n * http://drifty.com/\n *\n * Ionic, v1.3.1\n * A powerful HTML5 mobile app framework.\n * http://ionicframework.com/\n *\n * By @maxlynch, @benjsperry, @adamdbradley <3\n *\n * Licensed under the MIT license. Please see LICENSE for more information.\n *\n */\n\n(function() {\n\n// Create global ionic obj and its namespaces\n// build processes may have already created an ionic obj\nwindow.ionic = window.ionic || {};\nwindow.ionic.views = {};\nwindow.ionic.version = '1.3.1';\n\n(function (ionic) {\n\n  ionic.DelegateService = function(methodNames) {\n\n    if (methodNames.indexOf('$getByHandle') > -1) {\n      throw new Error(\"Method '$getByHandle' is implicitly added to each delegate service. Do not list it as a method.\");\n    }\n\n    function trueFn() { return true; }\n\n    return ['$log', function($log) {\n\n      /*\n       * Creates a new object that will have all the methodNames given,\n       * and call them on the given the controller instance matching given\n       * handle.\n       * The reason we don't just let $getByHandle return the controller instance\n       * itself is that the controller instance might not exist yet.\n       *\n       * We want people to be able to do\n       * `var instance = $ionicScrollDelegate.$getByHandle('foo')` on controller\n       * instantiation, but on controller instantiation a child directive\n       * may not have been compiled yet!\n       *\n       * So this is our way of solving this problem: we create an object\n       * that will only try to fetch the controller with given handle\n       * once the methods are actually called.\n       */\n      function DelegateInstance(instances, handle) {\n        this._instances = instances;\n        this.handle = handle;\n      }\n      methodNames.forEach(function(methodName) {\n        DelegateInstance.prototype[methodName] = instanceMethodCaller(methodName);\n      });\n\n\n      /**\n       * The delegate service (eg $ionicNavBarDelegate) is just an instance\n       * with a non-defined handle, a couple extra methods for registering\n       * and narrowing down to a specific handle.\n       */\n      function DelegateService() {\n        this._instances = [];\n      }\n      DelegateService.prototype = DelegateInstance.prototype;\n      DelegateService.prototype._registerInstance = function(instance, handle, filterFn) {\n        var instances = this._instances;\n        instance.$$delegateHandle = handle;\n        instance.$$filterFn = filterFn || trueFn;\n        instances.push(instance);\n\n        return function deregister() {\n          var index = instances.indexOf(instance);\n          if (index !== -1) {\n            instances.splice(index, 1);\n          }\n        };\n      };\n      DelegateService.prototype.$getByHandle = function(handle) {\n        return new DelegateInstance(this._instances, handle);\n      };\n\n      return new DelegateService();\n\n      function instanceMethodCaller(methodName) {\n        return function caller() {\n          var handle = this.handle;\n          var args = arguments;\n          var foundInstancesCount = 0;\n          var returnValue;\n\n          this._instances.forEach(function(instance) {\n            if ((!handle || handle == instance.$$delegateHandle) && instance.$$filterFn(instance)) {\n              foundInstancesCount++;\n              var ret = instance[methodName].apply(instance, args);\n              //Only return the value from the first call\n              if (foundInstancesCount === 1) {\n                returnValue = ret;\n              }\n            }\n          });\n\n          if (!foundInstancesCount && handle) {\n            return $log.warn(\n              'Delegate for handle \"' + handle + '\" could not find a ' +\n              'corresponding element with delegate-handle=\"' + handle + '\"! ' +\n              methodName + '() was not called!\\n' +\n              'Possible cause: If you are calling ' + methodName + '() immediately, and ' +\n              'your element with delegate-handle=\"' + handle + '\" is a child of your ' +\n              'controller, then your element may not be compiled yet. Put a $timeout ' +\n              'around your call to ' + methodName + '() and try again.'\n            );\n          }\n          return returnValue;\n        };\n      }\n\n    }];\n  };\n\n})(window.ionic);\n\n(function(window, document, ionic) {\n\n  var readyCallbacks = [];\n  var isDomReady = document.readyState === 'complete' || document.readyState === 'interactive';\n\n  function domReady() {\n    isDomReady = true;\n    for (var x = 0; x < readyCallbacks.length; x++) {\n      ionic.requestAnimationFrame(readyCallbacks[x]);\n    }\n    readyCallbacks = [];\n    document.removeEventListener('DOMContentLoaded', domReady);\n  }\n  if (!isDomReady) {\n    document.addEventListener('DOMContentLoaded', domReady);\n  }\n\n\n  // From the man himself, Mr. Paul Irish.\n  // The requestAnimationFrame polyfill\n  // Put it on window just to preserve its context\n  // without having to use .call\n  window._rAF = (function() {\n    return window.requestAnimationFrame ||\n           window.webkitRequestAnimationFrame ||\n           window.mozRequestAnimationFrame ||\n           function(callback) {\n             window.setTimeout(callback, 16);\n           };\n  })();\n\n  var cancelAnimationFrame = window.cancelAnimationFrame ||\n    window.webkitCancelAnimationFrame ||\n    window.mozCancelAnimationFrame ||\n    window.webkitCancelRequestAnimationFrame;\n\n  /**\n  * @ngdoc utility\n  * @name ionic.DomUtil\n  * @module ionic\n  */\n  ionic.DomUtil = {\n    //Call with proper context\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#requestAnimationFrame\n     * @alias ionic.requestAnimationFrame\n     * @description Calls [requestAnimationFrame](https://developer.mozilla.org/en-US/docs/Web/API/window.requestAnimationFrame), or a polyfill if not available.\n     * @param {function} callback The function to call when the next frame\n     * happens.\n     */\n    requestAnimationFrame: function(cb) {\n      return window._rAF(cb);\n    },\n\n    cancelAnimationFrame: function(requestId) {\n      cancelAnimationFrame(requestId);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#animationFrameThrottle\n     * @alias ionic.animationFrameThrottle\n     * @description\n     * When given a callback, if that callback is called 100 times between\n     * animation frames, adding Throttle will make it only run the last of\n     * the 100 calls.\n     *\n     * @param {function} callback a function which will be throttled to\n     * requestAnimationFrame\n     * @returns {function} A function which will then call the passed in callback.\n     * The passed in callback will receive the context the returned function is\n     * called with.\n     */\n    animationFrameThrottle: function(cb) {\n      var args, isQueued, context;\n      return function() {\n        args = arguments;\n        context = this;\n        if (!isQueued) {\n          isQueued = true;\n          ionic.requestAnimationFrame(function() {\n            cb.apply(context, args);\n            isQueued = false;\n          });\n        }\n      };\n    },\n\n    contains: function(parentNode, otherNode) {\n      var current = otherNode;\n      while (current) {\n        if (current === parentNode) return true;\n        current = current.parentNode;\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getPositionInParent\n     * @description\n     * Find an element's scroll offset within its container.\n     * @param {DOMElement} element The element to find the offset of.\n     * @returns {object} A position object with the following properties:\n     *   - `{number}` `left` The left offset of the element.\n     *   - `{number}` `top` The top offset of the element.\n     */\n    getPositionInParent: function(el) {\n      return {\n        left: el.offsetLeft,\n        top: el.offsetTop\n      };\n    },\n\n    getOffsetTop: function(el) {\n      var curtop = 0;\n      if (el.offsetParent) {\n        do {\n          curtop += el.offsetTop;\n          el = el.offsetParent;\n        } while (el)\n        return curtop;\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#ready\n     * @description\n     * Call a function when the DOM is ready, or if it is already ready\n     * call the function immediately.\n     * @param {function} callback The function to be called.\n     */\n    ready: function(cb) {\n      if (isDomReady) {\n        ionic.requestAnimationFrame(cb);\n      } else {\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getTextBounds\n     * @description\n     * Get a rect representing the bounds of the given textNode.\n     * @param {DOMElement} textNode The textNode to find the bounds of.\n     * @returns {object} An object representing the bounds of the node. Properties:\n     *   - `{number}` `left` The left position of the textNode.\n     *   - `{number}` `right` The right position of the textNode.\n     *   - `{number}` `top` The top position of the textNode.\n     *   - `{number}` `bottom` The bottom position of the textNode.\n     *   - `{number}` `width` The width of the textNode.\n     *   - `{number}` `height` The height of the textNode.\n     */\n    getTextBounds: function(textNode) {\n      if (document.createRange) {\n        var range = document.createRange();\n        range.selectNodeContents(textNode);\n        if (range.getBoundingClientRect) {\n          var rect = range.getBoundingClientRect();\n          if (rect) {\n            var sx = window.scrollX;\n            var sy = window.scrollY;\n\n            return {\n              top: rect.top + sy,\n              left: rect.left + sx,\n              right: rect.left + sx + rect.width,\n              bottom: rect.top + sy + rect.height,\n              width: rect.width,\n              height: rect.height\n            };\n          }\n        }\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getChildIndex\n     * @description\n     * Get the first index of a child node within the given element of the\n     * specified type.\n     * @param {DOMElement} element The element to find the index of.\n     * @param {string} type The nodeName to match children of element against.\n     * @returns {number} The index, or -1, of a child with nodeName matching type.\n     */\n    getChildIndex: function(element, type) {\n      if (type) {\n        var ch = element.parentNode.children;\n        var c;\n        for (var i = 0, k = 0, j = ch.length; i < j; i++) {\n          c = ch[i];\n          if (c.nodeName && c.nodeName.toLowerCase() == type) {\n            if (c == element) {\n              return k;\n            }\n            k++;\n          }\n        }\n      }\n      return Array.prototype.slice.call(element.parentNode.children).indexOf(element);\n    },\n\n    /**\n     * @private\n     */\n    swapNodes: function(src, dest) {\n      dest.parentNode.insertBefore(src, dest);\n    },\n\n    elementIsDescendant: function(el, parent, stopAt) {\n      var current = el;\n      do {\n        if (current === parent) return true;\n        current = current.parentNode;\n      } while (current && current !== stopAt);\n      return false;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent of element matching the\n     * className, or null.\n     */\n    getParentWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while (e.parentNode && depth--) {\n        if (e.parentNode.classList && e.parentNode.classList.contains(className)) {\n          return e.parentNode;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#getParentOrSelfWithClass\n     * @param {DOMElement} element\n     * @param {string} className\n     * @returns {DOMElement} The closest parent or self matching the\n     * className, or null.\n     */\n    getParentOrSelfWithClass: function(e, className, depth) {\n      depth = depth || 10;\n      while (e && depth--) {\n        if (e.classList && e.classList.contains(className)) {\n          return e;\n        }\n        e = e.parentNode;\n      }\n      return null;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#rectContains\n     * @param {number} x\n     * @param {number} y\n     * @param {number} x1\n     * @param {number} y1\n     * @param {number} x2\n     * @param {number} y2\n     * @returns {boolean} Whether {x,y} fits within the rectangle defined by\n     * {x1,y1,x2,y2}.\n     */\n    rectContains: function(x, y, x1, y1, x2, y2) {\n      if (x < x1 || x > x2) return false;\n      if (y < y1 || y > y2) return false;\n      return true;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.DomUtil#blurAll\n     * @description\n     * Blurs any currently focused input element\n     * @returns {DOMElement} The element blurred or null\n     */\n    blurAll: function() {\n      if (document.activeElement && document.activeElement != document.body) {\n        document.activeElement.blur();\n        return document.activeElement;\n      }\n      return null;\n    },\n\n    cachedAttr: function(ele, key, value) {\n      ele = ele && ele.length && ele[0] || ele;\n      if (ele && ele.setAttribute) {\n        var dataKey = '$attr-' + key;\n        if (arguments.length > 2) {\n          if (ele[dataKey] !== value) {\n            ele.setAttribute(key, value);\n            ele[dataKey] = value;\n          }\n        } else if (typeof ele[dataKey] == 'undefined') {\n          ele[dataKey] = ele.getAttribute(key);\n        }\n        return ele[dataKey];\n      }\n    },\n\n    cachedStyles: function(ele, styles) {\n      ele = ele && ele.length && ele[0] || ele;\n      if (ele && ele.style) {\n        for (var prop in styles) {\n          if (ele['$style-' + prop] !== styles[prop]) {\n            ele.style[prop] = ele['$style-' + prop] = styles[prop];\n          }\n        }\n      }\n    }\n\n  };\n\n  //Shortcuts\n  ionic.requestAnimationFrame = ionic.DomUtil.requestAnimationFrame;\n  ionic.cancelAnimationFrame = ionic.DomUtil.cancelAnimationFrame;\n  ionic.animationFrameThrottle = ionic.DomUtil.animationFrameThrottle;\n\n})(window, document, ionic);\n\n/**\n * ion-events.js\n *\n * Author: Max Lynch <max@drifty.com>\n *\n * Framework events handles various mobile browser events, and\n * detects special events like tap/swipe/etc. and emits them\n * as custom events that can be used in an app.\n *\n * Portions lovingly adapted from github.com/maker/ratchet and github.com/alexgibson/tap.js - thanks guys!\n */\n\n(function(ionic) {\n\n  // Custom event polyfill\n  ionic.CustomEvent = (function() {\n    if( typeof window.CustomEvent === 'function' ) return CustomEvent;\n\n    var customEvent = function(event, params) {\n      var evt;\n      params = params || {\n        bubbles: false,\n        cancelable: false,\n        detail: undefined\n      };\n      try {\n        evt = document.createEvent(\"CustomEvent\");\n        evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n      } catch (error) {\n        // fallback for browsers that don't support createEvent('CustomEvent')\n        evt = document.createEvent(\"Event\");\n        for (var param in params) {\n          evt[param] = params[param];\n        }\n        evt.initEvent(event, params.bubbles, params.cancelable);\n      }\n      return evt;\n    };\n    customEvent.prototype = window.Event.prototype;\n    return customEvent;\n  })();\n\n\n  /**\n   * @ngdoc utility\n   * @name ionic.EventController\n   * @module ionic\n   */\n  ionic.EventController = {\n    VIRTUALIZED_EVENTS: ['tap', 'swipe', 'swiperight', 'swipeleft', 'drag', 'hold', 'release'],\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#trigger\n     * @alias ionic.trigger\n     * @param {string} eventType The event to trigger.\n     * @param {object} data The data for the event. Hint: pass in\n     * `{target: targetElement}`\n     * @param {boolean=} bubbles Whether the event should bubble up the DOM.\n     * @param {boolean=} cancelable Whether the event should be cancelable.\n     */\n    // Trigger a new event\n    trigger: function(eventType, data, bubbles, cancelable) {\n      var event = new ionic.CustomEvent(eventType, {\n        detail: data,\n        bubbles: !!bubbles,\n        cancelable: !!cancelable\n      });\n\n      // Make sure to trigger the event on the given target, or dispatch it from\n      // the window if we don't have an event target\n      data && data.target && data.target.dispatchEvent && data.target.dispatchEvent(event) || window.dispatchEvent(event);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#on\n     * @alias ionic.on\n     * @description Listen to an event on an element.\n     * @param {string} type The event to listen for.\n     * @param {function} callback The listener to be called.\n     * @param {DOMElement} element The element to listen for the event on.\n     */\n    on: function(type, callback, element) {\n      var e = element || window;\n\n      // Bind a gesture if it's a virtual event\n      for(var i = 0, j = this.VIRTUALIZED_EVENTS.length; i < j; i++) {\n        if(type == this.VIRTUALIZED_EVENTS[i]) {\n          var gesture = new ionic.Gesture(element);\n          gesture.on(type, callback);\n          return gesture;\n        }\n      }\n\n      // Otherwise bind a normal event\n      e.addEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#off\n     * @alias ionic.off\n     * @description Remove an event listener.\n     * @param {string} type\n     * @param {function} callback\n     * @param {DOMElement} element\n     */\n    off: function(type, callback, element) {\n      element.removeEventListener(type, callback);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#onGesture\n     * @alias ionic.onGesture\n     * @description Add an event listener for a gesture on an element.\n     *\n     * Available eventTypes (from [hammer.js](http://eightmedia.github.io/hammer.js/)):\n     *\n     * `hold`, `tap`, `doubletap`, `drag`, `dragstart`, `dragend`, `dragup`, `dragdown`, <br/>\n     * `dragleft`, `dragright`, `swipe`, `swipeup`, `swipedown`, `swipeleft`, `swiperight`, <br/>\n     * `transform`, `transformstart`, `transformend`, `rotate`, `pinch`, `pinchin`, `pinchout`, <br/>\n     * `touch`, `release`\n     *\n     * @param {string} eventType The gesture event to listen for.\n     * @param {function(e)} callback The function to call when the gesture\n     * happens.\n     * @param {DOMElement} element The angular element to listen for the event on.\n     * @param {object} options object.\n     * @returns {ionic.Gesture} The gesture object (use this to remove the gesture later on).\n     */\n    onGesture: function(type, callback, element, options) {\n      var gesture = new ionic.Gesture(element, options);\n      gesture.on(type, callback);\n      return gesture;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.EventController#offGesture\n     * @alias ionic.offGesture\n     * @description Remove an event listener for a gesture created on an element.\n     * @param {ionic.Gesture} gesture The gesture that should be removed.\n     * @param {string} eventType The gesture event to remove the listener for.\n     * @param {function(e)} callback The listener to remove.\n\n     */\n    offGesture: function(gesture, type, callback) {\n      gesture && gesture.off(type, callback);\n    },\n\n    handlePopState: function() {}\n  };\n\n\n  // Map some convenient top-level functions for event handling\n  ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); };\n  ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); };\n  ionic.trigger = ionic.EventController.trigger;//function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); };\n  ionic.onGesture = function() { return ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); };\n  ionic.offGesture = function() { return ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); };\n\n})(window.ionic);\n\n/* eslint camelcase:0 */\n/**\n  * Simple gesture controllers with some common gestures that emit\n  * gesture events.\n  *\n  * Ported from github.com/EightMedia/hammer.js Gestures - thanks!\n  */\n(function(ionic) {\n\n  /**\n   * ionic.Gestures\n   * use this to create instances\n   * @param   {HTMLElement}   element\n   * @param   {Object}        options\n   * @returns {ionic.Gestures.Instance}\n   * @constructor\n   */\n  ionic.Gesture = function(element, options) {\n    return new ionic.Gestures.Instance(element, options || {});\n  };\n\n  ionic.Gestures = {};\n\n  // default settings\n  ionic.Gestures.defaults = {\n    // add css to the element to prevent the browser from doing\n    // its native behavior. this doesnt prevent the scrolling,\n    // but cancels the contextmenu, tap highlighting etc\n    // set to false to disable this\n    stop_browser_behavior: 'disable-user-behavior'\n  };\n\n  // detect touchevents\n  ionic.Gestures.HAS_POINTEREVENTS = window.navigator.pointerEnabled || window.navigator.msPointerEnabled;\n  ionic.Gestures.HAS_TOUCHEVENTS = ('ontouchstart' in window);\n\n  // dont use mouseevents on mobile devices\n  ionic.Gestures.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;\n  ionic.Gestures.NO_MOUSEEVENTS = ionic.Gestures.HAS_TOUCHEVENTS && window.navigator.userAgent.match(ionic.Gestures.MOBILE_REGEX);\n\n  // eventtypes per touchevent (start, move, end)\n  // are filled by ionic.Gestures.event.determineEventTypes on setup\n  ionic.Gestures.EVENT_TYPES = {};\n\n  // direction defines\n  ionic.Gestures.DIRECTION_DOWN = 'down';\n  ionic.Gestures.DIRECTION_LEFT = 'left';\n  ionic.Gestures.DIRECTION_UP = 'up';\n  ionic.Gestures.DIRECTION_RIGHT = 'right';\n\n  // pointer type\n  ionic.Gestures.POINTER_MOUSE = 'mouse';\n  ionic.Gestures.POINTER_TOUCH = 'touch';\n  ionic.Gestures.POINTER_PEN = 'pen';\n\n  // touch event defines\n  ionic.Gestures.EVENT_START = 'start';\n  ionic.Gestures.EVENT_MOVE = 'move';\n  ionic.Gestures.EVENT_END = 'end';\n\n  // hammer document where the base events are added at\n  ionic.Gestures.DOCUMENT = window.document;\n\n  // plugins namespace\n  ionic.Gestures.plugins = {};\n\n  // if the window events are set...\n  ionic.Gestures.READY = false;\n\n  /**\n   * setup events to detect gestures on the document\n   */\n  function setup() {\n    if(ionic.Gestures.READY) {\n      return;\n    }\n\n    // find what eventtypes we add listeners to\n    ionic.Gestures.event.determineEventTypes();\n\n    // Register all gestures inside ionic.Gestures.gestures\n    for(var name in ionic.Gestures.gestures) {\n      if(ionic.Gestures.gestures.hasOwnProperty(name)) {\n        ionic.Gestures.detection.register(ionic.Gestures.gestures[name]);\n      }\n    }\n\n    // Add touch events on the document\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_MOVE, ionic.Gestures.detection.detect);\n    ionic.Gestures.event.onTouch(ionic.Gestures.DOCUMENT, ionic.Gestures.EVENT_END, ionic.Gestures.detection.detect);\n\n    // ionic.Gestures is ready...!\n    ionic.Gestures.READY = true;\n  }\n\n  /**\n   * create new hammer instance\n   * all methods should return the instance itself, so it is chainable.\n   * @param   {HTMLElement}       element\n   * @param   {Object}            [options={}]\n   * @returns {ionic.Gestures.Instance}\n   * @name Gesture.Instance\n   * @constructor\n   */\n  ionic.Gestures.Instance = function(element, options) {\n    var self = this;\n\n    // A null element was passed into the instance, which means\n    // whatever lookup was done to find this element failed to find it\n    // so we can't listen for events on it.\n    if(element === null) {\n      void 0;\n      return this;\n    }\n\n    // setup ionic.GesturesJS window events and register all gestures\n    // this also sets up the default options\n    setup();\n\n    this.element = element;\n\n    // start/stop detection option\n    this.enabled = true;\n\n    // merge options\n    this.options = ionic.Gestures.utils.extend(\n        ionic.Gestures.utils.extend({}, ionic.Gestures.defaults),\n        options || {});\n\n    // add some css to the element to prevent the browser from doing its native behavoir\n    if(this.options.stop_browser_behavior) {\n      ionic.Gestures.utils.stopDefaultBrowserBehavior(this.element, this.options.stop_browser_behavior);\n    }\n\n    // start detection on touchstart\n    ionic.Gestures.event.onTouch(element, ionic.Gestures.EVENT_START, function(ev) {\n      if(self.enabled) {\n        ionic.Gestures.detection.startDetect(self, ev);\n      }\n    });\n\n    // return instance\n    return this;\n  };\n\n\n  ionic.Gestures.Instance.prototype = {\n    /**\n     * bind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    on: function onEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t = 0; t < gestures.length; t++) {\n        this.element.addEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * unbind events to the instance\n     * @param   {String}      gesture\n     * @param   {Function}    handler\n     * @returns {ionic.Gestures.Instance}\n     */\n    off: function offEvent(gesture, handler){\n      var gestures = gesture.split(' ');\n      for(var t = 0; t < gestures.length; t++) {\n        this.element.removeEventListener(gestures[t], handler, false);\n      }\n      return this;\n    },\n\n\n    /**\n     * trigger gesture event\n     * @param   {String}      gesture\n     * @param   {Object}      eventData\n     * @returns {ionic.Gestures.Instance}\n     */\n    trigger: function triggerEvent(gesture, eventData){\n      // create DOM event\n      var event = ionic.Gestures.DOCUMENT.createEvent('Event');\n      event.initEvent(gesture, true, true);\n      event.gesture = eventData;\n\n      // trigger on the target if it is in the instance element,\n      // this is for event delegation tricks\n      var element = this.element;\n      if(ionic.Gestures.utils.hasParent(eventData.target, element)) {\n        element = eventData.target;\n      }\n\n      element.dispatchEvent(event);\n      return this;\n    },\n\n\n    /**\n     * enable of disable hammer.js detection\n     * @param   {Boolean}   state\n     * @returns {ionic.Gestures.Instance}\n     */\n    enable: function enable(state) {\n      this.enabled = state;\n      return this;\n    }\n  };\n\n  /**\n   * this holds the last move event,\n   * used to fix empty touchend issue\n   * see the onTouch event for an explanation\n   * type {Object}\n   */\n  var last_move_event = null;\n\n\n  /**\n   * when the mouse is hold down, this is true\n   * type {Boolean}\n   */\n  var enable_detect = false;\n\n\n  /**\n   * when touch events have been fired, this is true\n   * type {Boolean}\n   */\n  var touch_triggered = false;\n\n\n  ionic.Gestures.event = {\n    /**\n     * simple addEventListener\n     * @param   {HTMLElement}   element\n     * @param   {String}        type\n     * @param   {Function}      handler\n     */\n    bindDom: function(element, type, handler) {\n      var types = type.split(' ');\n      for(var t = 0; t < types.length; t++) {\n        element.addEventListener(types[t], handler, false);\n      }\n    },\n\n\n    /**\n     * touch events with mouse fallback\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Function}      handler\n     */\n    onTouch: function onTouch(element, eventType, handler) {\n      var self = this;\n\n      this.bindDom(element, ionic.Gestures.EVENT_TYPES[eventType], function bindDomOnTouch(ev) {\n        var sourceEventType = ev.type.toLowerCase();\n\n        // onmouseup, but when touchend has been fired we do nothing.\n        // this is for touchdevices which also fire a mouseup on touchend\n        if(sourceEventType.match(/mouse/) && touch_triggered) {\n          return;\n        }\n\n        // mousebutton must be down or a touch event\n        else if( sourceEventType.match(/touch/) ||   // touch events are always on screen\n          sourceEventType.match(/pointerdown/) || // pointerevents touch\n          (sourceEventType.match(/mouse/) && ev.which === 1)   // mouse is pressed\n          ){\n            enable_detect = true;\n          }\n\n        // mouse isn't pressed\n        else if(sourceEventType.match(/mouse/) && ev.which !== 1) {\n          enable_detect = false;\n        }\n\n\n        // we are in a touch event, set the touch triggered bool to true,\n        // this for the conflicts that may occur on ios and android\n        if(sourceEventType.match(/touch|pointer/)) {\n          touch_triggered = true;\n        }\n\n        // count the total touches on the screen\n        var count_touches = 0;\n\n        // when touch has been triggered in this detection session\n        // and we are now handling a mouse event, we stop that to prevent conflicts\n        if(enable_detect) {\n          // update pointerevent\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType != ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n          // touch\n          else if(sourceEventType.match(/touch/)) {\n            count_touches = ev.touches.length;\n          }\n          // mouse\n          else if(!touch_triggered) {\n            count_touches = sourceEventType.match(/up/) ? 0 : 1;\n          }\n\n          // if we are in a end event, but when we remove one touch and\n          // we still have enough, set eventType to move\n          if(count_touches > 0 && eventType == ionic.Gestures.EVENT_END) {\n            eventType = ionic.Gestures.EVENT_MOVE;\n          }\n          // no touches, force the end event\n          else if(!count_touches) {\n            eventType = ionic.Gestures.EVENT_END;\n          }\n\n          // store the last move event\n          if(count_touches || last_move_event === null) {\n            last_move_event = ev;\n          }\n\n          // trigger the handler\n          handler.call(ionic.Gestures.detection, self.collectEventData(element, eventType, self.getTouchList(last_move_event, eventType), ev));\n\n          // remove pointerevent from list\n          if(ionic.Gestures.HAS_POINTEREVENTS && eventType == ionic.Gestures.EVENT_END) {\n            count_touches = ionic.Gestures.PointerEvent.updatePointer(eventType, ev);\n          }\n        }\n\n        //debug(sourceEventType +\" \"+ eventType);\n\n        // on the end we reset everything\n        if(!count_touches) {\n          last_move_event = null;\n          enable_detect = false;\n          touch_triggered = false;\n          ionic.Gestures.PointerEvent.reset();\n        }\n      });\n    },\n\n\n    /**\n     * we have different events for each device/browser\n     * determine what we need and set them in the ionic.Gestures.EVENT_TYPES constant\n     */\n    determineEventTypes: function determineEventTypes() {\n      // determine the eventtype we want to set\n      var types;\n\n      // pointerEvents magic\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        types = ionic.Gestures.PointerEvent.getEvents();\n      }\n      // on Android, iOS, blackberry, windows mobile we dont want any mouseevents\n      else if(ionic.Gestures.NO_MOUSEEVENTS) {\n        types = [\n          'touchstart',\n          'touchmove',\n          'touchend touchcancel'];\n      }\n      // for non pointer events browsers and mixed browsers,\n      // like chrome on windows8 touch laptop\n      else {\n        types = [\n          'touchstart mousedown',\n          'touchmove mousemove',\n          'touchend touchcancel mouseup'];\n      }\n\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_START] = types[0];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_MOVE] = types[1];\n      ionic.Gestures.EVENT_TYPES[ionic.Gestures.EVENT_END] = types[2];\n    },\n\n\n    /**\n     * create touchlist depending on the event\n     * @param   {Object}    ev\n     * @param   {String}    eventType   used by the fakemultitouch plugin\n     */\n    getTouchList: function getTouchList(ev/*, eventType*/) {\n      // get the fake pointerEvent touchlist\n      if(ionic.Gestures.HAS_POINTEREVENTS) {\n        return ionic.Gestures.PointerEvent.getTouchList();\n      }\n      // get the touchlist\n      else if(ev.touches) {\n        return ev.touches;\n      }\n      // make fake touchlist from mouse position\n      else {\n        ev.identifier = 1;\n        return [ev];\n      }\n    },\n\n\n    /**\n     * collect event data for ionic.Gestures js\n     * @param   {HTMLElement}   element\n     * @param   {String}        eventType        like ionic.Gestures.EVENT_MOVE\n     * @param   {Object}        eventData\n     */\n    collectEventData: function collectEventData(element, eventType, touches, ev) {\n\n      // find out pointerType\n      var pointerType = ionic.Gestures.POINTER_TOUCH;\n      if(ev.type.match(/mouse/) || ionic.Gestures.PointerEvent.matchType(ionic.Gestures.POINTER_MOUSE, ev)) {\n        pointerType = ionic.Gestures.POINTER_MOUSE;\n      }\n\n      return {\n        center: ionic.Gestures.utils.getCenter(touches),\n        timeStamp: new Date().getTime(),\n        target: ev.target,\n        touches: touches,\n        eventType: eventType,\n        pointerType: pointerType,\n        srcEvent: ev,\n\n        /**\n         * prevent the browser default actions\n         * mostly used to disable scrolling of the browser\n         */\n        preventDefault: function() {\n          if(this.srcEvent.preventManipulation) {\n            this.srcEvent.preventManipulation();\n          }\n\n          if(this.srcEvent.preventDefault) {\n            // this.srcEvent.preventDefault();\n          }\n        },\n\n        /**\n         * stop bubbling the event up to its parents\n         */\n        stopPropagation: function() {\n          this.srcEvent.stopPropagation();\n        },\n\n        /**\n         * immediately stop gesture detection\n         * might be useful after a swipe was detected\n         * @return {*}\n         */\n        stopDetect: function() {\n          return ionic.Gestures.detection.stopDetect();\n        }\n      };\n    }\n  };\n\n  ionic.Gestures.PointerEvent = {\n    /**\n     * holds all pointers\n     * type {Object}\n     */\n    pointers: {},\n\n    /**\n     * get a list of pointers\n     * @returns {Array}     touchlist\n     */\n    getTouchList: function() {\n      var self = this;\n      var touchlist = [];\n\n      // we can use forEach since pointerEvents only is in IE10\n      Object.keys(self.pointers).sort().forEach(function(id) {\n        touchlist.push(self.pointers[id]);\n      });\n      return touchlist;\n    },\n\n    /**\n     * update the position of a pointer\n     * @param   {String}   type             ionic.Gestures.EVENT_END\n     * @param   {Object}   pointerEvent\n     */\n    updatePointer: function(type, pointerEvent) {\n      if(type == ionic.Gestures.EVENT_END) {\n        this.pointers = {};\n      }\n      else {\n        pointerEvent.identifier = pointerEvent.pointerId;\n        this.pointers[pointerEvent.pointerId] = pointerEvent;\n      }\n\n      return Object.keys(this.pointers).length;\n    },\n\n    /**\n     * check if ev matches pointertype\n     * @param   {String}        pointerType     ionic.Gestures.POINTER_MOUSE\n     * @param   {PointerEvent}  ev\n     */\n    matchType: function(pointerType, ev) {\n      if(!ev.pointerType) {\n        return false;\n      }\n\n      var types = {};\n      types[ionic.Gestures.POINTER_MOUSE] = (ev.pointerType == ev.MSPOINTER_TYPE_MOUSE || ev.pointerType == ionic.Gestures.POINTER_MOUSE);\n      types[ionic.Gestures.POINTER_TOUCH] = (ev.pointerType == ev.MSPOINTER_TYPE_TOUCH || ev.pointerType == ionic.Gestures.POINTER_TOUCH);\n      types[ionic.Gestures.POINTER_PEN] = (ev.pointerType == ev.MSPOINTER_TYPE_PEN || ev.pointerType == ionic.Gestures.POINTER_PEN);\n      return types[pointerType];\n    },\n\n\n    /**\n     * get events\n     */\n    getEvents: function() {\n      return [\n        'pointerdown MSPointerDown',\n      'pointermove MSPointerMove',\n      'pointerup pointercancel MSPointerUp MSPointerCancel'\n        ];\n    },\n\n    /**\n     * reset the list\n     */\n    reset: function() {\n      this.pointers = {};\n    }\n  };\n\n\n  ionic.Gestures.utils = {\n    /**\n     * extend method,\n     * also used for cloning when dest is an empty object\n     * @param   {Object}    dest\n     * @param   {Object}    src\n     * @param\t{Boolean}\tmerge\t\tdo a merge\n     * @returns {Object}    dest\n     */\n    extend: function extend(dest, src, merge) {\n      for (var key in src) {\n        if(dest[key] !== undefined && merge) {\n          continue;\n        }\n        dest[key] = src[key];\n      }\n      return dest;\n    },\n\n\n    /**\n     * find if a node is in the given parent\n     * used for event delegation tricks\n     * @param   {HTMLElement}   node\n     * @param   {HTMLElement}   parent\n     * @returns {boolean}       has_parent\n     */\n    hasParent: function(node, parent) {\n      while(node){\n        if(node == parent) {\n          return true;\n        }\n        node = node.parentNode;\n      }\n      return false;\n    },\n\n\n    /**\n     * get the center of all the touches\n     * @param   {Array}     touches\n     * @returns {Object}    center\n     */\n    getCenter: function getCenter(touches) {\n      var valuesX = [], valuesY = [];\n\n      for(var t = 0, len = touches.length; t < len; t++) {\n        valuesX.push(touches[t].pageX);\n        valuesY.push(touches[t].pageY);\n      }\n\n      return {\n        pageX: ((Math.min.apply(Math, valuesX) + Math.max.apply(Math, valuesX)) / 2),\n          pageY: ((Math.min.apply(Math, valuesY) + Math.max.apply(Math, valuesY)) / 2)\n      };\n    },\n\n\n    /**\n     * calculate the velocity between two points\n     * @param   {Number}    delta_time\n     * @param   {Number}    delta_x\n     * @param   {Number}    delta_y\n     * @returns {Object}    velocity\n     */\n    getVelocity: function getVelocity(delta_time, delta_x, delta_y) {\n      return {\n        x: Math.abs(delta_x / delta_time) || 0,\n        y: Math.abs(delta_y / delta_time) || 0\n      };\n    },\n\n\n    /**\n     * calculate the angle between two coordinates\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    angle\n     */\n    getAngle: function getAngle(touch1, touch2) {\n      var y = touch2.pageY - touch1.pageY,\n      x = touch2.pageX - touch1.pageX;\n      return Math.atan2(y, x) * 180 / Math.PI;\n    },\n\n\n    /**\n     * angle to direction define\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {String}    direction constant, like ionic.Gestures.DIRECTION_LEFT\n     */\n    getDirection: function getDirection(touch1, touch2) {\n      var x = Math.abs(touch1.pageX - touch2.pageX),\n      y = Math.abs(touch1.pageY - touch2.pageY);\n\n      if(x >= y) {\n        return touch1.pageX - touch2.pageX > 0 ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n      }\n      else {\n        return touch1.pageY - touch2.pageY > 0 ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n      }\n    },\n\n\n    /**\n     * calculate the distance between two touches\n     * @param   {Touch}     touch1\n     * @param   {Touch}     touch2\n     * @returns {Number}    distance\n     */\n    getDistance: function getDistance(touch1, touch2) {\n      var x = touch2.pageX - touch1.pageX,\n      y = touch2.pageY - touch1.pageY;\n      return Math.sqrt((x * x) + (y * y));\n    },\n\n\n    /**\n     * calculate the scale factor between two touchLists (fingers)\n     * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    scale\n     */\n    getScale: function getScale(start, end) {\n      // need two fingers...\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getDistance(end[0], end[1]) /\n          this.getDistance(start[0], start[1]);\n      }\n      return 1;\n    },\n\n\n    /**\n     * calculate the rotation degrees between two touchLists (fingers)\n     * @param   {Array}     start\n     * @param   {Array}     end\n     * @returns {Number}    rotation\n     */\n    getRotation: function getRotation(start, end) {\n      // need two fingers\n      if(start.length >= 2 && end.length >= 2) {\n        return this.getAngle(end[1], end[0]) -\n          this.getAngle(start[1], start[0]);\n      }\n      return 0;\n    },\n\n\n    /**\n     * boolean if the direction is vertical\n     * @param    {String}    direction\n     * @returns  {Boolean}   is_vertical\n     */\n    isVertical: function isVertical(direction) {\n      return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);\n    },\n\n\n    /**\n     * stop browser default behavior with css class\n     * @param   {HtmlElement}   element\n     * @param   {Object}        css_class\n     */\n    stopDefaultBrowserBehavior: function stopDefaultBrowserBehavior(element, css_class) {\n      // changed from making many style changes to just adding a preset classname\n      // less DOM manipulations, less code, and easier to control in the CSS side of things\n      // hammer.js doesn't come with CSS, but ionic does, which is why we prefer this method\n      if(element && element.classList) {\n        element.classList.add(css_class);\n        element.onselectstart = function() {\n          return false;\n        };\n      }\n    }\n  };\n\n\n  ionic.Gestures.detection = {\n    // contains all registred ionic.Gestures.gestures in the correct order\n    gestures: [],\n\n    // data of the current ionic.Gestures.gesture detection session\n    current: null,\n\n    // the previous ionic.Gestures.gesture session data\n    // is a full clone of the previous gesture.current object\n    previous: null,\n\n    // when this becomes true, no gestures are fired\n    stopped: false,\n\n\n    /**\n     * start ionic.Gestures.gesture detection\n     * @param   {ionic.Gestures.Instance}   inst\n     * @param   {Object}            eventData\n     */\n    startDetect: function startDetect(inst, eventData) {\n      // already busy with a ionic.Gestures.gesture detection on an element\n      if(this.current) {\n        return;\n      }\n\n      this.stopped = false;\n\n      this.current = {\n        inst: inst, // reference to ionic.GesturesInstance we're working for\n        startEvent: ionic.Gestures.utils.extend({}, eventData), // start eventData for distances, timing etc\n        lastEvent: false, // last eventData\n        name: '' // current gesture we're in/detected, can be 'tap', 'hold' etc\n      };\n\n      this.detect(eventData);\n    },\n\n\n    /**\n     * ionic.Gestures.gesture detection\n     * @param   {Object}    eventData\n     */\n    detect: function detect(eventData) {\n      if(!this.current || this.stopped) {\n        return null;\n      }\n\n      // extend event data with calculations about scale, distance etc\n      eventData = this.extendEventData(eventData);\n\n      // instance options\n      var inst_options = this.current.inst.options;\n\n      // call ionic.Gestures.gesture handlers\n      for(var g = 0, len = this.gestures.length; g < len; g++) {\n        var gesture = this.gestures[g];\n\n        // only when the instance options have enabled this gesture\n        if(!this.stopped && inst_options[gesture.name] !== false) {\n          // if a handler returns false, we stop with the detection\n          if(gesture.handler.call(gesture, eventData, this.current.inst) === false) {\n            this.stopDetect();\n            break;\n          }\n        }\n      }\n\n      // store as previous event event\n      if(this.current) {\n        this.current.lastEvent = eventData;\n      }\n\n      // endevent, but not the last touch, so dont stop\n      if(eventData.eventType == ionic.Gestures.EVENT_END && !eventData.touches.length - 1) {\n        this.stopDetect();\n      }\n\n      return eventData;\n    },\n\n\n    /**\n     * clear the ionic.Gestures.gesture vars\n     * this is called on endDetect, but can also be used when a final ionic.Gestures.gesture has been detected\n     * to stop other ionic.Gestures.gestures from being fired\n     */\n    stopDetect: function stopDetect() {\n      // clone current data to the store as the previous gesture\n      // used for the double tap gesture, since this is an other gesture detect session\n      this.previous = ionic.Gestures.utils.extend({}, this.current);\n\n      // reset the current\n      this.current = null;\n\n      // stopped!\n      this.stopped = true;\n    },\n\n\n    /**\n     * extend eventData for ionic.Gestures.gestures\n     * @param   {Object}   ev\n     * @returns {Object}   ev\n     */\n    extendEventData: function extendEventData(ev) {\n      var startEv = this.current.startEvent;\n\n      // if the touches change, set the new touches over the startEvent touches\n      // this because touchevents don't have all the touches on touchstart, or the\n      // user must place his fingers at the EXACT same time on the screen, which is not realistic\n      // but, sometimes it happens that both fingers are touching at the EXACT same time\n      if(startEv && (ev.touches.length != startEv.touches.length || ev.touches === startEv.touches)) {\n        // extend 1 level deep to get the touchlist with the touch objects\n        startEv.touches = [];\n        for(var i = 0, len = ev.touches.length; i < len; i++) {\n          startEv.touches.push(ionic.Gestures.utils.extend({}, ev.touches[i]));\n        }\n      }\n\n      var delta_time = ev.timeStamp - startEv.timeStamp,\n          delta_x = ev.center.pageX - startEv.center.pageX,\n          delta_y = ev.center.pageY - startEv.center.pageY,\n          velocity = ionic.Gestures.utils.getVelocity(delta_time, delta_x, delta_y);\n\n      ionic.Gestures.utils.extend(ev, {\n        deltaTime: delta_time,\n        deltaX: delta_x,\n        deltaY: delta_y,\n\n        velocityX: velocity.x,\n        velocityY: velocity.y,\n\n        distance: ionic.Gestures.utils.getDistance(startEv.center, ev.center),\n        angle: ionic.Gestures.utils.getAngle(startEv.center, ev.center),\n        direction: ionic.Gestures.utils.getDirection(startEv.center, ev.center),\n\n        scale: ionic.Gestures.utils.getScale(startEv.touches, ev.touches),\n        rotation: ionic.Gestures.utils.getRotation(startEv.touches, ev.touches),\n\n        startEvent: startEv\n      });\n\n      return ev;\n    },\n\n\n    /**\n     * register new gesture\n     * @param   {Object}    gesture object, see gestures.js for documentation\n     * @returns {Array}     gestures\n     */\n    register: function register(gesture) {\n      // add an enable gesture options if there is no given\n      var options = gesture.defaults || {};\n      if(options[gesture.name] === undefined) {\n        options[gesture.name] = true;\n      }\n\n      // extend ionic.Gestures default options with the ionic.Gestures.gesture options\n      ionic.Gestures.utils.extend(ionic.Gestures.defaults, options, true);\n\n      // set its index\n      gesture.index = gesture.index || 1000;\n\n      // add ionic.Gestures.gesture to the list\n      this.gestures.push(gesture);\n\n      // sort the list by index\n      this.gestures.sort(function(a, b) {\n        if (a.index < b.index) {\n          return -1;\n        }\n        if (a.index > b.index) {\n          return 1;\n        }\n        return 0;\n      });\n\n      return this.gestures;\n    }\n  };\n\n\n  ionic.Gestures.gestures = ionic.Gestures.gestures || {};\n\n  /**\n   * Custom gestures\n   * ==============================\n   *\n   * Gesture object\n   * --------------------\n   * The object structure of a gesture:\n   *\n   * { name: 'mygesture',\n   *   index: 1337,\n   *   defaults: {\n   *     mygesture_option: true\n   *   }\n   *   handler: function(type, ev, inst) {\n   *     // trigger gesture event\n   *     inst.trigger(this.name, ev);\n   *   }\n   * }\n\n   * @param   {String}    name\n   * this should be the name of the gesture, lowercase\n   * it is also being used to disable/enable the gesture per instance config.\n   *\n   * @param   {Number}    [index=1000]\n   * the index of the gesture, where it is going to be in the stack of gestures detection\n   * like when you build an gesture that depends on the drag gesture, it is a good\n   * idea to place it after the index of the drag gesture.\n   *\n   * @param   {Object}    [defaults={}]\n   * the default settings of the gesture. these are added to the instance settings,\n   * and can be overruled per instance. you can also add the name of the gesture,\n   * but this is also added by default (and set to true).\n   *\n   * @param   {Function}  handler\n   * this handles the gesture detection of your custom gesture and receives the\n   * following arguments:\n   *\n   *      @param  {Object}    eventData\n   *      event data containing the following properties:\n   *          timeStamp   {Number}        time the event occurred\n   *          target      {HTMLElement}   target element\n   *          touches     {Array}         touches (fingers, pointers, mouse) on the screen\n   *          pointerType {String}        kind of pointer that was used. matches ionic.Gestures.POINTER_MOUSE|TOUCH\n   *          center      {Object}        center position of the touches. contains pageX and pageY\n   *          deltaTime   {Number}        the total time of the touches in the screen\n   *          deltaX      {Number}        the delta on x axis we haved moved\n   *          deltaY      {Number}        the delta on y axis we haved moved\n   *          velocityX   {Number}        the velocity on the x\n   *          velocityY   {Number}        the velocity on y\n   *          angle       {Number}        the angle we are moving\n   *          direction   {String}        the direction we are moving. matches ionic.Gestures.DIRECTION_UP|DOWN|LEFT|RIGHT\n   *          distance    {Number}        the distance we haved moved\n   *          scale       {Number}        scaling of the touches, needs 2 touches\n   *          rotation    {Number}        rotation of the touches, needs 2 touches *\n   *          eventType   {String}        matches ionic.Gestures.EVENT_START|MOVE|END\n   *          srcEvent    {Object}        the source event, like TouchStart or MouseDown *\n   *          startEvent  {Object}        contains the same properties as above,\n   *                                      but from the first touch. this is used to calculate\n   *                                      distances, deltaTime, scaling etc\n   *\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we are doing the detection for. you can get the options from\n   *      the inst.options object and trigger the gesture event by calling inst.trigger\n   *\n   *\n   * Handle gestures\n   * --------------------\n   * inside the handler you can get/set ionic.Gestures.detectionic.current. This is the current\n   * detection sessionic. It has the following properties\n   *      @param  {String}    name\n   *      contains the name of the gesture we have detected. it has not a real function,\n   *      only to check in other gestures if something is detected.\n   *      like in the drag gesture we set it to 'drag' and in the swipe gesture we can\n   *      check if the current gesture is 'drag' by accessing ionic.Gestures.detectionic.current.name\n   *\n   *      readonly\n   *      @param  {ionic.Gestures.Instance}    inst\n   *      the instance we do the detection for\n   *\n   *      readonly\n   *      @param  {Object}    startEvent\n   *      contains the properties of the first gesture detection in this sessionic.\n   *      Used for calculations about timing, distance, etc.\n   *\n   *      readonly\n   *      @param  {Object}    lastEvent\n   *      contains all the properties of the last gesture detect in this sessionic.\n   *\n   * after the gesture detection session has been completed (user has released the screen)\n   * the ionic.Gestures.detectionic.current object is copied into ionic.Gestures.detectionic.previous,\n   * this is usefull for gestures like doubletap, where you need to know if the\n   * previous gesture was a tap\n   *\n   * options that have been set by the instance can be received by calling inst.options\n   *\n   * You can trigger a gesture event by calling inst.trigger(\"mygesture\", event).\n   * The first param is the name of your gesture, the second the event argument\n   *\n   *\n   * Register gestures\n   * --------------------\n   * When an gesture is added to the ionic.Gestures.gestures object, it is auto registered\n   * at the setup of the first ionic.Gestures instance. You can also call ionic.Gestures.detectionic.register\n   * manually and pass your gesture object as a param\n   *\n   */\n\n  /**\n   * Hold\n   * Touch stays at the same place for x time\n   * events  hold\n   */\n  ionic.Gestures.gestures.Hold = {\n    name: 'hold',\n    index: 10,\n    defaults: {\n      hold_timeout: 500,\n      hold_threshold: 9\n    },\n    timer: null,\n    handler: function holdGesture(ev, inst) {\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          // clear any running timers\n          clearTimeout(this.timer);\n\n          // set the gesture so we can check in the timeout if it still is\n          ionic.Gestures.detection.current.name = this.name;\n\n          // set timer and if after the timeout it still is hold,\n          // we trigger the hold event\n          this.timer = setTimeout(function() {\n            if(ionic.Gestures.detection.current.name == 'hold') {\n              ionic.tap.cancelClick();\n              inst.trigger('hold', ev);\n            }\n          }, inst.options.hold_timeout);\n          break;\n\n          // when you move or end we clear the timer\n        case ionic.Gestures.EVENT_MOVE:\n          if(ev.distance > inst.options.hold_threshold) {\n            clearTimeout(this.timer);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          clearTimeout(this.timer);\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Tap/DoubleTap\n   * Quick touch at a place or double at the same place\n   * events  tap, doubletap\n   */\n  ionic.Gestures.gestures.Tap = {\n    name: 'tap',\n    index: 100,\n    defaults: {\n      tap_max_touchtime: 250,\n      tap_max_distance: 10,\n      tap_always: true,\n      doubletap_distance: 20,\n      doubletap_interval: 300\n    },\n    handler: function tapGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END && ev.srcEvent.type != 'touchcancel') {\n        // previous gesture, for the double tap since these are two different gesture detections\n        var prev = ionic.Gestures.detection.previous,\n        did_doubletap = false;\n\n        // when the touchtime is higher then the max touch time\n        // or when the moving distance is too much\n        if(ev.deltaTime > inst.options.tap_max_touchtime ||\n            ev.distance > inst.options.tap_max_distance) {\n              return;\n            }\n\n        // check if double tap\n        if(prev && prev.name == 'tap' &&\n            (ev.timeStamp - prev.lastEvent.timeStamp) < inst.options.doubletap_interval &&\n            ev.distance < inst.options.doubletap_distance) {\n              inst.trigger('doubletap', ev);\n              did_doubletap = true;\n            }\n\n        // do a single tap\n        if(!did_doubletap || inst.options.tap_always) {\n          ionic.Gestures.detection.current.name = 'tap';\n          inst.trigger('tap', ev);\n        }\n      }\n    }\n  };\n\n\n  /**\n   * Swipe\n   * triggers swipe events when the end velocity is above the threshold\n   * events  swipe, swipeleft, swiperight, swipeup, swipedown\n   */\n  ionic.Gestures.gestures.Swipe = {\n    name: 'swipe',\n    index: 40,\n    defaults: {\n      // set 0 for unlimited, but this can conflict with transform\n      swipe_max_touches: 1,\n      swipe_velocity: 0.4\n    },\n    handler: function swipeGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END) {\n        // max touches\n        if(inst.options.swipe_max_touches > 0 &&\n            ev.touches.length > inst.options.swipe_max_touches) {\n              return;\n            }\n\n        // when the distance we moved is too small we skip this gesture\n        // or we can be already in dragging\n        if(ev.velocityX > inst.options.swipe_velocity ||\n            ev.velocityY > inst.options.swipe_velocity) {\n              // trigger swipe events\n              inst.trigger(this.name, ev);\n              inst.trigger(this.name + ev.direction, ev);\n            }\n      }\n    }\n  };\n\n\n  /**\n   * Drag\n   * Move with x fingers (default 1) around on the page. Blocking the scrolling when\n   * moving left and right is a good practice. When all the drag events are blocking\n   * you disable scrolling on that area.\n   * events  drag, drapleft, dragright, dragup, dragdown\n   */\n  ionic.Gestures.gestures.Drag = {\n    name: 'drag',\n    index: 50,\n    defaults: {\n      drag_min_distance: 10,\n      // Set correct_for_drag_min_distance to true to make the starting point of the drag\n      // be calculated from where the drag was triggered, not from where the touch started.\n      // Useful to avoid a jerk-starting drag, which can make fine-adjustments\n      // through dragging difficult, and be visually unappealing.\n      correct_for_drag_min_distance: true,\n      // set 0 for unlimited, but this can conflict with transform\n      drag_max_touches: 1,\n      // prevent default browser behavior when dragging occurs\n      // be careful with it, it makes the element a blocking element\n      // when you are using the drag gesture, it is a good practice to set this true\n      drag_block_horizontal: true,\n      drag_block_vertical: true,\n      // drag_lock_to_axis keeps the drag gesture on the axis that it started on,\n      // It disallows vertical directions if the initial direction was horizontal, and vice versa.\n      drag_lock_to_axis: false,\n      // drag lock only kicks in when distance > drag_lock_min_distance\n      // This way, locking occurs only when the distance has become large enough to reliably determine the direction\n      drag_lock_min_distance: 25,\n      // prevent default if the gesture is going the given direction\n      prevent_default_directions: []\n    },\n    triggered: false,\n    handler: function dragGesture(ev, inst) {\n      if (ev.srcEvent.type == 'touchstart' || ev.srcEvent.type == 'touchend') {\n        this.preventedFirstMove = false;\n\n      } else if (!this.preventedFirstMove && ev.srcEvent.type == 'touchmove') {\n        // Prevent gestures that are not intended for this event handler from firing subsequent times\n        if (inst.options.prevent_default_directions.length > 0\n            && inst.options.prevent_default_directions.indexOf(ev.direction) != -1) {\n          ev.srcEvent.preventDefault();\n        }\n        this.preventedFirstMove = true;\n      }\n\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name + 'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // max touches\n      if(inst.options.drag_max_touches > 0 &&\n          ev.touches.length > inst.options.drag_max_touches) {\n            return;\n          }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(ev.distance < inst.options.drag_min_distance &&\n              ionic.Gestures.detection.current.name != this.name) {\n                return;\n              }\n\n          // we are dragging!\n          if(ionic.Gestures.detection.current.name != this.name) {\n            ionic.Gestures.detection.current.name = this.name;\n            if (inst.options.correct_for_drag_min_distance) {\n              // When a drag is triggered, set the event center to drag_min_distance pixels from the original event center.\n              // Without this correction, the dragged distance would jumpstart at drag_min_distance pixels instead of at 0.\n              // It might be useful to save the original start point somewhere\n              var factor = Math.abs(inst.options.drag_min_distance / ev.distance);\n              ionic.Gestures.detection.current.startEvent.center.pageX += ev.deltaX * factor;\n              ionic.Gestures.detection.current.startEvent.center.pageY += ev.deltaY * factor;\n\n              // recalculate event data using new start point\n              ev = ionic.Gestures.detection.extendEventData(ev);\n            }\n          }\n\n          // lock drag to axis?\n          if(ionic.Gestures.detection.current.lastEvent.drag_locked_to_axis || (inst.options.drag_lock_to_axis && inst.options.drag_lock_min_distance <= ev.distance)) {\n            ev.drag_locked_to_axis = true;\n          }\n          var last_direction = ionic.Gestures.detection.current.lastEvent.direction;\n          if(ev.drag_locked_to_axis && last_direction !== ev.direction) {\n            // keep direction on the axis that the drag gesture started on\n            if(ionic.Gestures.utils.isVertical(last_direction)) {\n              ev.direction = (ev.deltaY < 0) ? ionic.Gestures.DIRECTION_UP : ionic.Gestures.DIRECTION_DOWN;\n            }\n            else {\n              ev.direction = (ev.deltaX < 0) ? ionic.Gestures.DIRECTION_LEFT : ionic.Gestures.DIRECTION_RIGHT;\n            }\n          }\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name + 'start', ev);\n            this.triggered = true;\n          }\n\n          // trigger normal event\n          inst.trigger(this.name, ev);\n\n          // direction event, like dragdown\n          inst.trigger(this.name + ev.direction, ev);\n\n          // block the browser events\n          if( (inst.options.drag_block_vertical && ionic.Gestures.utils.isVertical(ev.direction)) ||\n              (inst.options.drag_block_horizontal && !ionic.Gestures.utils.isVertical(ev.direction))) {\n                ev.preventDefault();\n              }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name + 'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Transform\n   * User want to scale or rotate with 2 fingers\n   * events  transform, pinch, pinchin, pinchout, rotate\n   */\n  ionic.Gestures.gestures.Transform = {\n    name: 'transform',\n    index: 45,\n    defaults: {\n      // factor, no scale is 1, zoomin is to 0 and zoomout until higher then 1\n      transform_min_scale: 0.01,\n      // rotation in degrees\n      transform_min_rotation: 1,\n      // prevent default browser behavior when two touches are on the screen\n      // but it makes the element a blocking element\n      // when you are using the transform gesture, it is a good practice to set this true\n      transform_always_block: false\n    },\n    triggered: false,\n    handler: function transformGesture(ev, inst) {\n      // current gesture isnt drag, but dragged is true\n      // this means an other gesture is busy. now call dragend\n      if(ionic.Gestures.detection.current.name != this.name && this.triggered) {\n        inst.trigger(this.name + 'end', ev);\n        this.triggered = false;\n        return;\n      }\n\n      // atleast multitouch\n      if(ev.touches.length < 2) {\n        return;\n      }\n\n      // prevent default when two fingers are on the screen\n      if(inst.options.transform_always_block) {\n        ev.preventDefault();\n      }\n\n      switch(ev.eventType) {\n        case ionic.Gestures.EVENT_START:\n          this.triggered = false;\n          break;\n\n        case ionic.Gestures.EVENT_MOVE:\n          var scale_threshold = Math.abs(1 - ev.scale);\n          var rotation_threshold = Math.abs(ev.rotation);\n\n          // when the distance we moved is too small we skip this gesture\n          // or we can be already in dragging\n          if(scale_threshold < inst.options.transform_min_scale &&\n              rotation_threshold < inst.options.transform_min_rotation) {\n                return;\n              }\n\n          // we are transforming!\n          ionic.Gestures.detection.current.name = this.name;\n\n          // first time, trigger dragstart event\n          if(!this.triggered) {\n            inst.trigger(this.name + 'start', ev);\n            this.triggered = true;\n          }\n\n          inst.trigger(this.name, ev); // basic transform event\n\n          // trigger rotate event\n          if(rotation_threshold > inst.options.transform_min_rotation) {\n            inst.trigger('rotate', ev);\n          }\n\n          // trigger pinch event\n          if(scale_threshold > inst.options.transform_min_scale) {\n            inst.trigger('pinch', ev);\n            inst.trigger('pinch' + ((ev.scale < 1) ? 'in' : 'out'), ev);\n          }\n          break;\n\n        case ionic.Gestures.EVENT_END:\n          // trigger dragend\n          if(this.triggered) {\n            inst.trigger(this.name + 'end', ev);\n          }\n\n          this.triggered = false;\n          break;\n      }\n    }\n  };\n\n\n  /**\n   * Touch\n   * Called as first, tells the user has touched the screen\n   * events  touch\n   */\n  ionic.Gestures.gestures.Touch = {\n    name: 'touch',\n    index: -Infinity,\n    defaults: {\n      // call preventDefault at touchstart, and makes the element blocking by\n      // disabling the scrolling of the page, but it improves gestures like\n      // transforming and dragging.\n      // be careful with using this, it can be very annoying for users to be stuck\n      // on the page\n      prevent_default: false,\n\n      // disable mouse events, so only touch (or pen!) input triggers events\n      prevent_mouseevents: false\n    },\n    handler: function touchGesture(ev, inst) {\n      if(inst.options.prevent_mouseevents && ev.pointerType == ionic.Gestures.POINTER_MOUSE) {\n        ev.stopDetect();\n        return;\n      }\n\n      if(inst.options.prevent_default) {\n        ev.preventDefault();\n      }\n\n      if(ev.eventType == ionic.Gestures.EVENT_START) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n\n\n  /**\n   * Release\n   * Called as last, tells the user has released the screen\n   * events  release\n   */\n  ionic.Gestures.gestures.Release = {\n    name: 'release',\n    index: Infinity,\n    handler: function releaseGesture(ev, inst) {\n      if(ev.eventType == ionic.Gestures.EVENT_END) {\n        inst.trigger(this.name, ev);\n      }\n    }\n  };\n})(window.ionic);\n\n(function(window, document, ionic) {\n\n  function getParameterByName(name) {\n    name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n    var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\"),\n    results = regex.exec(location.search);\n    return results === null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n  }\n\n  var IOS = 'ios';\n  var ANDROID = 'android';\n  var WINDOWS_PHONE = 'windowsphone';\n  var EDGE = 'edge';\n  var CROSSWALK = 'crosswalk';\n  var requestAnimationFrame = ionic.requestAnimationFrame;\n\n  /**\n   * @ngdoc utility\n   * @name ionic.Platform\n   * @module ionic\n   * @description\n   * A set of utility methods that can be used to retrieve the device ready state and\n   * various other information such as what kind of platform the app is currently installed on.\n   *\n   * @usage\n   * ```js\n   * angular.module('PlatformApp', ['ionic'])\n   * .controller('PlatformCtrl', function($scope) {\n   *\n   *   ionic.Platform.ready(function(){\n   *     // will execute when device is ready, or immediately if the device is already ready.\n   *   });\n   *\n   *   var deviceInformation = ionic.Platform.device();\n   *\n   *   var isWebView = ionic.Platform.isWebView();\n   *   var isIPad = ionic.Platform.isIPad();\n   *   var isIOS = ionic.Platform.isIOS();\n   *   var isAndroid = ionic.Platform.isAndroid();\n   *   var isWindowsPhone = ionic.Platform.isWindowsPhone();\n   *\n   *   var currentPlatform = ionic.Platform.platform();\n   *   var currentPlatformVersion = ionic.Platform.version();\n   *\n   *   ionic.Platform.exitApp(); // stops the app\n   * });\n   * ```\n   */\n  var self = ionic.Platform = {\n\n    // Put navigator on platform so it can be mocked and set\n    // the browser does not allow window.navigator to be set\n    navigator: window.navigator,\n\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isReady\n     * @returns {boolean} Whether the device is ready.\n     */\n    isReady: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#isFullScreen\n     * @returns {boolean} Whether the device is fullscreen.\n     */\n    isFullScreen: false,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#platforms\n     * @returns {Array(string)} An array of all platforms found.\n     */\n    platforms: null,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#grade\n     * @returns {string} What grade the current platform is.\n     */\n    grade: null,\n    /**\n     * @ngdoc property\n     * @name ionic.Platform#ua\n     * @returns {string} What User Agent is.\n     */\n    ua: navigator.userAgent,\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#ready\n     * @description\n     * Trigger a callback once the device is ready, or immediately\n     * if the device is already ready. This method can be run from\n     * anywhere and does not need to be wrapped by any additonal methods.\n     * When the app is within a WebView (Cordova), it'll fire\n     * the callback once the device is ready. If the app is within\n     * a web browser, it'll fire the callback after `window.load`.\n     * Please remember that Cordova features (Camera, FileSystem, etc) still\n     * will not work in a web browser.\n     * @param {function} callback The function to call.\n     */\n    ready: function(cb) {\n      // run through tasks to complete now that the device is ready\n      if (self.isReady) {\n        cb();\n      } else {\n        // the platform isn't ready yet, add it to this array\n        // which will be called once the platform is ready\n        readyCallbacks.push(cb);\n      }\n    },\n\n    /**\n     * @private\n     */\n    detect: function() {\n      self._checkPlatforms();\n\n      requestAnimationFrame(function() {\n        // only add to the body class if we got platform info\n        for (var i = 0; i < self.platforms.length; i++) {\n          document.body.classList.add('platform-' + self.platforms[i]);\n        }\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#setGrade\n     * @description Set the grade of the device: 'a', 'b', or 'c'. 'a' is the best\n     * (most css features enabled), 'c' is the worst.  By default, sets the grade\n     * depending on the current device.\n     * @param {string} grade The new grade to set.\n     */\n    setGrade: function(grade) {\n      var oldGrade = self.grade;\n      self.grade = grade;\n      requestAnimationFrame(function() {\n        if (oldGrade) {\n          document.body.classList.remove('grade-' + oldGrade);\n        }\n        document.body.classList.add('grade-' + grade);\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#device\n     * @description Return the current device (given by cordova).\n     * @returns {object} The device object.\n     */\n    device: function() {\n      return window.device || {};\n    },\n\n    _checkPlatforms: function() {\n      self.platforms = [];\n      var grade = 'a';\n\n      if (self.isWebView()) {\n        self.platforms.push('webview');\n        if (!(!window.cordova && !window.PhoneGap && !window.phonegap)) {\n          self.platforms.push('cordova');\n        } else if (typeof window.forge === 'object') {\n          self.platforms.push('trigger');\n        }\n      } else {\n        self.platforms.push('browser');\n      }\n      if (self.isIPad()) self.platforms.push('ipad');\n\n      var platform = self.platform();\n      if (platform) {\n        self.platforms.push(platform);\n\n        var version = self.version();\n        if (version) {\n          var v = version.toString();\n          if (v.indexOf('.') > 0) {\n            v = v.replace('.', '_');\n          } else {\n            v += '_0';\n          }\n          self.platforms.push(platform + v.split('_')[0]);\n          self.platforms.push(platform + v);\n\n          if (self.isAndroid() && version < 4.4) {\n            grade = (version < 4 ? 'c' : 'b');\n          } else if (self.isWindowsPhone()) {\n            grade = 'b';\n          }\n        }\n      }\n\n      self.setGrade(grade);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWebView\n     * @returns {boolean} Check if we are running within a WebView (such as Cordova).\n     */\n    isWebView: function() {\n      return !(!window.cordova && !window.PhoneGap && !window.phonegap && window.forge !== 'object');\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIPad\n     * @returns {boolean} Whether we are running on iPad.\n     */\n    isIPad: function() {\n      if (/iPad/i.test(self.navigator.platform)) {\n        return true;\n      }\n      return /iPad/i.test(self.ua);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isIOS\n     * @returns {boolean} Whether we are running on iOS.\n     */\n    isIOS: function() {\n      return self.is(IOS);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isAndroid\n     * @returns {boolean} Whether we are running on Android.\n     */\n    isAndroid: function() {\n      return self.is(ANDROID);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isWindowsPhone\n     * @returns {boolean} Whether we are running on Windows Phone.\n     */\n    isWindowsPhone: function() {\n      return self.is(WINDOWS_PHONE);\n    },\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#isEdge\n     * @returns {boolean} Whether we are running on MS Edge/Windows 10 (inc. Phone)\n     */\n    isEdge: function() {\n      return self.is(EDGE);\n    },\n\n    isCrosswalk: function() {\n      return self.is(CROSSWALK);\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#platform\n     * @returns {string} The name of the current platform.\n     */\n    platform: function() {\n      // singleton to get the platform name\n      if (platformName === null) self.setPlatform(self.device().platform);\n      return platformName;\n    },\n\n    /**\n     * @private\n     */\n    setPlatform: function(n) {\n      if (typeof n != 'undefined' && n !== null && n.length) {\n        platformName = n.toLowerCase();\n      } else if (getParameterByName('ionicplatform')) {\n        platformName = getParameterByName('ionicplatform');\n      } else if (self.ua.indexOf('Edge') > -1) {\n        platformName = EDGE;\n      } else if (self.ua.indexOf('Windows Phone') > -1) {\n        platformName = WINDOWS_PHONE;\n      } else if (self.ua.indexOf('Android') > 0) {\n        platformName = ANDROID;\n      } else if (/iPhone|iPad|iPod/.test(self.ua)) {\n        platformName = IOS;\n      } else {\n        platformName = self.navigator.platform && navigator.platform.toLowerCase().split(' ')[0] || '';\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#version\n     * @returns {number} The version of the current device platform.\n     */\n    version: function() {\n      // singleton to get the platform version\n      if (platformVersion === null) self.setVersion(self.device().version);\n      return platformVersion;\n    },\n\n    /**\n     * @private\n     */\n    setVersion: function(v) {\n      if (typeof v != 'undefined' && v !== null) {\n        v = v.split('.');\n        v = parseFloat(v[0] + '.' + (v.length > 1 ? v[1] : 0));\n        if (!isNaN(v)) {\n          platformVersion = v;\n          return;\n        }\n      }\n\n      platformVersion = 0;\n\n      // fallback to user-agent checking\n      var pName = self.platform();\n      var versionMatch = {\n        'android': /Android (\\d+).(\\d+)?/,\n        'ios': /OS (\\d+)_(\\d+)?/,\n        'windowsphone': /Windows Phone (\\d+).(\\d+)?/\n      };\n      if (versionMatch[pName]) {\n        v = self.ua.match(versionMatch[pName]);\n        if (v && v.length > 2) {\n          platformVersion = parseFloat(v[1] + '.' + v[2]);\n        }\n      }\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#is\n     * @param {string} Platform name.\n     * @returns {boolean} Whether the platform name provided is detected.\n     */\n    is: function(type) {\n      type = type.toLowerCase();\n      // check if it has an array of platforms\n      if (self.platforms) {\n        for (var x = 0; x < self.platforms.length; x++) {\n          if (self.platforms[x] === type) return true;\n        }\n      }\n      // exact match\n      var pName = self.platform();\n      if (pName) {\n        return pName === type.toLowerCase();\n      }\n\n      // A quick hack for to check userAgent\n      return self.ua.toLowerCase().indexOf(type) >= 0;\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#exitApp\n     * @description Exit the app.\n     */\n    exitApp: function() {\n      self.ready(function() {\n        navigator.app && navigator.app.exitApp && navigator.app.exitApp();\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#showStatusBar\n     * @description Shows or hides the device status bar (in Cordova). Requires `cordova plugin add org.apache.cordova.statusbar`\n     * @param {boolean} shouldShow Whether or not to show the status bar.\n     */\n    showStatusBar: function(val) {\n      // Only useful when run within cordova\n      self._showStatusBar = val;\n      self.ready(function() {\n        // run this only when or if the platform (cordova) is ready\n        requestAnimationFrame(function() {\n          if (self._showStatusBar) {\n            // they do not want it to be full screen\n            window.StatusBar && window.StatusBar.show();\n            document.body.classList.remove('status-bar-hide');\n          } else {\n            // it should be full screen\n            window.StatusBar && window.StatusBar.hide();\n            document.body.classList.add('status-bar-hide');\n          }\n        });\n      });\n    },\n\n    /**\n     * @ngdoc method\n     * @name ionic.Platform#fullScreen\n     * @description\n     * Sets whether the app is fullscreen or not (in Cordova).\n     * @param {boolean=} showFullScreen Whether or not to set the app to fullscreen. Defaults to true. Requires `cordova plugin add org.apache.cordova.statusbar`\n     * @param {boolean=} showStatusBar Whether or not to show the device's status bar. Defaults to false.\n     */\n    fullScreen: function(showFullScreen, showStatusBar) {\n      // showFullScreen: default is true if no param provided\n      self.isFullScreen = (showFullScreen !== false);\n\n      // add/remove the fullscreen classname to the body\n      ionic.DomUtil.ready(function() {\n        // run this only when or if the DOM is ready\n        requestAnimationFrame(function() {\n          if (self.isFullScreen) {\n            document.body.classList.add('fullscreen');\n          } else {\n            document.body.classList.remove('fullscreen');\n          }\n        });\n        // showStatusBar: default is false if no param provided\n        self.showStatusBar((showStatusBar === true));\n      });\n    }\n\n  };\n\n  var platformName = null, // just the name, like iOS or Android\n  platformVersion = null, // a float of the major and minor, like 7.1\n  readyCallbacks = [],\n  windowLoadListenderAttached,\n  platformReadyTimer = 2000; // How long to wait for platform ready before emitting a warning\n\n  verifyPlatformReady();\n\n  // Warn the user if deviceready did not fire in a reasonable amount of time, and how to fix it.\n  function verifyPlatformReady() {\n    setTimeout(function() {\n      if(!self.isReady && self.isWebView()) {\n        void 0;\n      }\n    }, platformReadyTimer);\n  }\n\n  // setup listeners to know when the device is ready to go\n  function onWindowLoad() {\n    if (self.isWebView()) {\n      // the window and scripts are fully loaded, and a cordova/phonegap\n      // object exists then let's listen for the deviceready\n      document.addEventListener(\"deviceready\", onPlatformReady, false);\n    } else {\n      // the window and scripts are fully loaded, but the window object doesn't have the\n      // cordova/phonegap object, so its just a browser, not a webview wrapped w/ cordova\n      onPlatformReady();\n    }\n    if (windowLoadListenderAttached) {\n      window.removeEventListener(\"load\", onWindowLoad, false);\n    }\n  }\n  if (document.readyState === 'complete') {\n    onWindowLoad();\n  } else {\n    windowLoadListenderAttached = true;\n    window.addEventListener(\"load\", onWindowLoad, false);\n  }\n\n  function onPlatformReady() {\n    // the device is all set to go, init our own stuff then fire off our event\n    self.isReady = true;\n    self.detect();\n    for (var x = 0; x < readyCallbacks.length; x++) {\n      // fire off all the callbacks that were added before the platform was ready\n      readyCallbacks[x]();\n    }\n    readyCallbacks = [];\n    ionic.trigger('platformready', { target: document });\n\n    requestAnimationFrame(function() {\n      document.body.classList.add('platform-ready');\n    });\n  }\n\n})(window, document, ionic);\n\n(function(document, ionic) {\n  'use strict';\n\n  // Ionic CSS polyfills\n  ionic.CSS = {};\n  ionic.CSS.TRANSITION = [];\n  ionic.CSS.TRANSFORM = [];\n\n  ionic.EVENTS = {};\n\n  (function() {\n\n    // transform\n    var i, keys = ['webkitTransform', 'transform', '-webkit-transform', 'webkit-transform',\n                   '-moz-transform', 'moz-transform', 'MozTransform', 'mozTransform', 'msTransform'];\n\n    for (i = 0; i < keys.length; i++) {\n      if (document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSFORM = keys[i];\n        break;\n      }\n    }\n\n    // transition\n    keys = ['webkitTransition', 'mozTransition', 'msTransition', 'transition'];\n    for (i = 0; i < keys.length; i++) {\n      if (document.documentElement.style[keys[i]] !== undefined) {\n        ionic.CSS.TRANSITION = keys[i];\n        break;\n      }\n    }\n\n    // Fallback in case the keys don't exist at all\n    ionic.CSS.TRANSITION = ionic.CSS.TRANSITION || 'transition';\n\n    // The only prefix we care about is webkit for transitions.\n    var isWebkit = ionic.CSS.TRANSITION.indexOf('webkit') > -1;\n\n    // transition duration\n    ionic.CSS.TRANSITION_DURATION = (isWebkit ? '-webkit-' : '') + 'transition-duration';\n\n    // To be sure transitionend works everywhere, include *both* the webkit and non-webkit events\n    ionic.CSS.TRANSITIONEND = (isWebkit ? 'webkitTransitionEnd ' : '') + 'transitionend';\n  })();\n\n  (function() {\n      var touchStartEvent = 'touchstart';\n      var touchMoveEvent = 'touchmove';\n      var touchEndEvent = 'touchend';\n      var touchCancelEvent = 'touchcancel';\n\n      if (window.navigator.pointerEnabled) {\n        touchStartEvent = 'pointerdown';\n        touchMoveEvent = 'pointermove';\n        touchEndEvent = 'pointerup';\n        touchCancelEvent = 'pointercancel';\n      } else if (window.navigator.msPointerEnabled) {\n        touchStartEvent = 'MSPointerDown';\n        touchMoveEvent = 'MSPointerMove';\n        touchEndEvent = 'MSPointerUp';\n        touchCancelEvent = 'MSPointerCancel';\n      }\n\n      ionic.EVENTS.touchstart = touchStartEvent;\n      ionic.EVENTS.touchmove = touchMoveEvent;\n      ionic.EVENTS.touchend = touchEndEvent;\n      ionic.EVENTS.touchcancel = touchCancelEvent;\n  })();\n\n  // classList polyfill for them older Androids\n  // https://gist.github.com/devongovett/1381839\n  if (!(\"classList\" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') {\n    Object.defineProperty(HTMLElement.prototype, 'classList', {\n      get: function() {\n        var self = this;\n        function update(fn) {\n          return function() {\n            var x, classes = self.className.split(/\\s+/);\n\n            for (x = 0; x < arguments.length; x++) {\n              fn(classes, classes.indexOf(arguments[x]), arguments[x]);\n            }\n\n            self.className = classes.join(\" \");\n          };\n        }\n\n        return {\n          add: update(function(classes, index, value) {\n            ~index || classes.push(value);\n          }),\n\n          remove: update(function(classes, index) {\n            ~index && classes.splice(index, 1);\n          }),\n\n          toggle: update(function(classes, index, value) {\n            ~index ? classes.splice(index, 1) : classes.push(value);\n          }),\n\n          contains: function(value) {\n            return !!~self.className.split(/\\s+/).indexOf(value);\n          },\n\n          item: function(i) {\n            return self.className.split(/\\s+/)[i] || null;\n          }\n        };\n\n      }\n    });\n  }\n\n})(document, ionic);\n\n\n/**\n * @ngdoc page\n * @name tap\n * @module ionic\n * @description\n * On touch devices such as a phone or tablet, some browsers implement a 300ms delay between\n * the time the user stops touching the display and the moment the browser executes the\n * click. This delay was initially introduced so the browser can know whether the user wants to\n * double-tap to zoom in on the webpage.  Basically, the browser waits roughly 300ms to see if\n * the user is double-tapping, or just tapping on the display once.\n *\n * Out of the box, Ionic automatically removes the 300ms delay in order to make Ionic apps\n * feel more \"native\" like. Resultingly, other solutions such as\n * [fastclick](https://github.com/ftlabs/fastclick) and Angular's\n * [ngTouch](https://docs.angularjs.org/api/ngTouch) should not be included, to avoid conflicts.\n *\n * Some browsers already remove the delay with certain settings, such as the CSS property\n * `touch-events: none` or with specific meta tag viewport values. However, each of these\n * browsers still handle clicks differently, such as when to fire off or cancel the event\n * (like scrolling when the target is a button, or holding a button down).\n * For browsers that already remove the 300ms delay, consider Ionic's tap system as a way to\n * normalize how clicks are handled across the various devices so there's an expected response\n * no matter what the device, platform or version. Additionally, Ionic will prevent\n * ghostclicks which even browsers that remove the delay still experience.\n *\n * In some cases, third-party libraries may also be working with touch events which can interfere\n * with the tap system. For example, mapping libraries like Google or Leaflet Maps often implement\n * a touch detection system which conflicts with Ionic's tap system.\n *\n * ### Disabling the tap system\n *\n * To disable the tap for an element and all of its children elements,\n * add the attribute `data-tap-disabled=\"true\"`.\n *\n * ```html\n * <div data-tap-disabled=\"true\">\n *     <div id=\"google-map\"></div>\n * </div>\n * ```\n *\n * ### Additional Notes:\n *\n * - Ionic tap  works with Ionic's JavaScript scrolling\n * - Elements can come and go from the DOM and Ionic tap doesn't keep adding and removing\n *   listeners\n * - No \"tap delay\" after the first \"tap\" (you can tap as fast as you want, they all click)\n * - Minimal events listeners, only being added to document\n * - Correct focus in/out on each input type (select, textearea, range) on each platform/device\n * - Shows and hides virtual keyboard correctly for each platform/device\n * - Works with labels surrounding inputs\n * - Does not fire off a click if the user moves the pointer too far\n * - Adds and removes an 'activated' css class\n * - Multiple [unit tests](https://github.com/driftyco/ionic/blob/master/test/unit/utils/tap.unit.js) for each scenario\n *\n */\n/*\n\n IONIC TAP\n ---------------\n - Both touch and mouse events are added to the document.body on DOM ready\n - If a touch event happens, it does not use mouse event listeners\n - On touchend, if the distance between start and end was small, trigger a click\n - In the triggered click event, add a 'isIonicTap' property\n - The triggered click receives the same x,y coordinates as as the end event\n - On document.body click listener (with useCapture=true), only allow clicks with 'isIonicTap'\n - Triggering clicks with mouse events work the same as touch, except with mousedown/mouseup\n - Tapping inputs is disabled during scrolling\n*/\n\nvar tapDoc; // the element which the listeners are on (document.body)\nvar tapActiveEle; // the element which is active (probably has focus)\nvar tapEnabledTouchEvents;\nvar tapMouseResetTimer;\nvar tapPointerMoved;\nvar tapPointerStart;\nvar tapTouchFocusedInput;\nvar tapLastTouchTarget;\nvar tapTouchMoveListener = 'touchmove';\n\n// how much the coordinates can be off between start/end, but still a click\nvar TAP_RELEASE_TOLERANCE = 12; // default tolerance\nvar TAP_RELEASE_BUTTON_TOLERANCE = 50; // button elements should have a larger tolerance\n\nvar tapEventListeners = {\n  'click': tapClickGateKeeper,\n\n  'mousedown': tapMouseDown,\n  'mouseup': tapMouseUp,\n  'mousemove': tapMouseMove,\n\n  'touchstart': tapTouchStart,\n  'touchend': tapTouchEnd,\n  'touchcancel': tapTouchCancel,\n  'touchmove': tapTouchMove,\n\n  'pointerdown': tapTouchStart,\n  'pointerup': tapTouchEnd,\n  'pointercancel': tapTouchCancel,\n  'pointermove': tapTouchMove,\n\n  'MSPointerDown': tapTouchStart,\n  'MSPointerUp': tapTouchEnd,\n  'MSPointerCancel': tapTouchCancel,\n  'MSPointerMove': tapTouchMove,\n\n  'focusin': tapFocusIn,\n  'focusout': tapFocusOut\n};\n\nionic.tap = {\n\n  register: function(ele) {\n    tapDoc = ele;\n\n    tapEventListener('click', true, true);\n    tapEventListener('mouseup');\n    tapEventListener('mousedown');\n\n    if (window.navigator.pointerEnabled) {\n      tapEventListener('pointerdown');\n      tapEventListener('pointerup');\n      tapEventListener('pointercancel');\n      tapTouchMoveListener = 'pointermove';\n\n    } else if (window.navigator.msPointerEnabled) {\n      tapEventListener('MSPointerDown');\n      tapEventListener('MSPointerUp');\n      tapEventListener('MSPointerCancel');\n      tapTouchMoveListener = 'MSPointerMove';\n\n    } else {\n      tapEventListener('touchstart');\n      tapEventListener('touchend');\n      tapEventListener('touchcancel');\n    }\n\n    tapEventListener('focusin');\n    tapEventListener('focusout');\n\n    return function() {\n      for (var type in tapEventListeners) {\n        tapEventListener(type, false);\n      }\n      tapDoc = null;\n      tapActiveEle = null;\n      tapEnabledTouchEvents = false;\n      tapPointerMoved = false;\n      tapPointerStart = null;\n    };\n  },\n\n  ignoreScrollStart: function(e) {\n    return (e.defaultPrevented) ||  // defaultPrevented has been assigned by another component handling the event\n           (/^(file|range)$/i).test(e.target.type) ||\n           (e.target.dataset ? e.target.dataset.preventScroll : e.target.getAttribute('data-prevent-scroll')) == 'true' || // manually set within an elements attributes\n           (!!(/^(object|embed)$/i).test(e.target.tagName)) ||  // flash/movie/object touches should not try to scroll\n           ionic.tap.isElementTapDisabled(e.target); // check if this element, or an ancestor, has `data-tap-disabled` attribute\n  },\n\n  isTextInput: function(ele) {\n    return !!ele &&\n           (ele.tagName == 'TEXTAREA' ||\n            ele.contentEditable === 'true' ||\n            (ele.tagName == 'INPUT' && !(/^(radio|checkbox|range|file|submit|reset|color|image|button)$/i).test(ele.type)));\n  },\n\n  isDateInput: function(ele) {\n    return !!ele &&\n            (ele.tagName == 'INPUT' && (/^(date|time|datetime-local|month|week)$/i).test(ele.type));\n  },\n\n  isVideo: function(ele) {\n    return !!ele &&\n            (ele.tagName == 'VIDEO');\n  },\n\n  isKeyboardElement: function(ele) {\n    if ( !ionic.Platform.isIOS() || ionic.Platform.isIPad() ) {\n      return ionic.tap.isTextInput(ele) && !ionic.tap.isDateInput(ele);\n    } else {\n      return ionic.tap.isTextInput(ele) || ( !!ele && ele.tagName == \"SELECT\");\n    }\n  },\n\n  isLabelWithTextInput: function(ele) {\n    var container = tapContainingElement(ele, false);\n\n    return !!container &&\n           ionic.tap.isTextInput(tapTargetElement(container));\n  },\n\n  containsOrIsTextInput: function(ele) {\n    return ionic.tap.isTextInput(ele) || ionic.tap.isLabelWithTextInput(ele);\n  },\n\n  cloneFocusedInput: function(container) {\n    if (ionic.tap.hasCheckedClone) return;\n    ionic.tap.hasCheckedClone = true;\n\n    ionic.requestAnimationFrame(function() {\n      var focusInput = container.querySelector(':focus');\n      if (ionic.tap.isTextInput(focusInput) && !ionic.tap.isDateInput(focusInput)) {\n        var clonedInput = focusInput.cloneNode(true);\n\n        clonedInput.value = focusInput.value;\n        clonedInput.classList.add('cloned-text-input');\n        clonedInput.readOnly = true;\n        if (focusInput.isContentEditable) {\n          clonedInput.contentEditable = focusInput.contentEditable;\n          clonedInput.innerHTML = focusInput.innerHTML;\n        }\n        focusInput.parentElement.insertBefore(clonedInput, focusInput);\n        focusInput.classList.add('previous-input-focus');\n\n        clonedInput.scrollTop = focusInput.scrollTop;\n      }\n    });\n  },\n\n  hasCheckedClone: false,\n\n  removeClonedInputs: function(container) {\n    ionic.tap.hasCheckedClone = false;\n\n    ionic.requestAnimationFrame(function() {\n      var clonedInputs = container.querySelectorAll('.cloned-text-input');\n      var previousInputFocus = container.querySelectorAll('.previous-input-focus');\n      var x;\n\n      for (x = 0; x < clonedInputs.length; x++) {\n        clonedInputs[x].parentElement.removeChild(clonedInputs[x]);\n      }\n\n      for (x = 0; x < previousInputFocus.length; x++) {\n        previousInputFocus[x].classList.remove('previous-input-focus');\n        previousInputFocus[x].style.top = '';\n        if ( ionic.keyboard.isOpen && !ionic.keyboard.isClosing ) previousInputFocus[x].focus();\n      }\n    });\n  },\n\n  requiresNativeClick: function(ele) {\n    if (ionic.Platform.isWindowsPhone() && (ele.tagName == 'A' || ele.tagName == 'BUTTON' || ele.hasAttribute('ng-click') || (ele.tagName == 'INPUT' && (ele.type == 'button' || ele.type == 'submit')))) {\n      return true; //Windows Phone edge case, prevent ng-click (and similar) events from firing twice on this platform\n    }\n    if (!ele || ele.disabled || (/^(file|range)$/i).test(ele.type) || (/^(object|video)$/i).test(ele.tagName) || ionic.tap.isLabelContainingFileInput(ele)) {\n      return true;\n    }\n    return ionic.tap.isElementTapDisabled(ele);\n  },\n\n  isLabelContainingFileInput: function(ele) {\n    var lbl = tapContainingElement(ele);\n    if (lbl.tagName !== 'LABEL') return false;\n    var fileInput = lbl.querySelector('input[type=file]');\n    if (fileInput && fileInput.disabled === false) return true;\n    return false;\n  },\n\n  isElementTapDisabled: function(ele) {\n    if (ele && ele.nodeType === 1) {\n      var element = ele;\n      while (element) {\n        if (element.getAttribute && element.getAttribute('data-tap-disabled') == 'true') {\n          return true;\n        }\n        element = element.parentElement;\n      }\n    }\n    return false;\n  },\n\n  setTolerance: function(releaseTolerance, releaseButtonTolerance) {\n    TAP_RELEASE_TOLERANCE = releaseTolerance;\n    TAP_RELEASE_BUTTON_TOLERANCE = releaseButtonTolerance;\n  },\n\n  cancelClick: function() {\n    // used to cancel any simulated clicks which may happen on a touchend/mouseup\n    // gestures uses this method within its tap and hold events\n    tapPointerMoved = true;\n  },\n\n  pointerCoord: function(event) {\n    // This method can get coordinates for both a mouse click\n    // or a touch depending on the given event\n    var c = { x: 0, y: 0 };\n    if (event) {\n      var touches = event.touches && event.touches.length ? event.touches : [event];\n      var e = (event.changedTouches && event.changedTouches[0]) || touches[0];\n      if (e) {\n        c.x = e.clientX || e.pageX || 0;\n        c.y = e.clientY || e.pageY || 0;\n      }\n    }\n    return c;\n  }\n\n};\n\nfunction tapEventListener(type, enable, useCapture) {\n  if (enable !== false) {\n    tapDoc.addEventListener(type, tapEventListeners[type], useCapture);\n  } else {\n    tapDoc.removeEventListener(type, tapEventListeners[type]);\n  }\n}\n\nfunction tapClick(e) {\n  // simulate a normal click by running the element's click method then focus on it\n  var container = tapContainingElement(e.target);\n  var ele = tapTargetElement(container);\n\n  if (ionic.tap.requiresNativeClick(ele) || tapPointerMoved) return false;\n\n  var c = ionic.tap.pointerCoord(e);\n\n  //console.log('tapClick', e.type, ele.tagName, '('+c.x+','+c.y+')');\n  triggerMouseEvent('click', ele, c.x, c.y);\n\n  // if it's an input, focus in on the target, otherwise blur\n  tapHandleFocus(ele);\n}\n\nfunction triggerMouseEvent(type, ele, x, y) {\n  // using initMouseEvent instead of MouseEvent for our Android friends\n  var clickEvent = document.createEvent(\"MouseEvents\");\n  clickEvent.initMouseEvent(type, true, true, window, 1, 0, 0, x, y, false, false, false, false, 0, null);\n  clickEvent.isIonicTap = true;\n  ele.dispatchEvent(clickEvent);\n}\n\nfunction tapClickGateKeeper(e) {\n  //console.log('click ' + Date.now() + ' isIonicTap: ' + (e.isIonicTap ? true : false));\n  if (e.target.type == 'submit' && e.detail === 0) {\n    // do not prevent click if it came from an \"Enter\" or \"Go\" keypress submit\n    return null;\n  }\n\n  // do not allow through any click events that were not created by ionic.tap\n  if ((ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target)) ||\n      (!e.isIonicTap && !ionic.tap.requiresNativeClick(e.target))) {\n    //console.log('clickPrevent', e.target.tagName);\n    e.stopPropagation();\n\n    if (!ionic.tap.isLabelWithTextInput(e.target)) {\n      // labels clicks from native should not preventDefault othersize keyboard will not show on input focus\n      e.preventDefault();\n    }\n    return false;\n  }\n}\n\n// MOUSE\nfunction tapMouseDown(e) {\n  //console.log('mousedown ' + Date.now());\n  if (e.isIonicTap || tapIgnoreEvent(e)) return null;\n\n  if (tapEnabledTouchEvents) {\n    //console.log('mousedown', 'stop event');\n    e.stopPropagation();\n\n    if (!ionic.Platform.isEdge() && (!ionic.tap.isTextInput(e.target) || tapLastTouchTarget !== e.target) &&\n      !isSelectOrOption(e.target.tagName) && !ionic.tap.isVideo(e.target)) {\n      // If you preventDefault on a text input then you cannot move its text caret/cursor.\n      // Allow through only the text input default. However, without preventDefault on an\n      // input the 300ms delay can change focus on inputs after the keyboard shows up.\n      // The focusin event handles the chance of focus changing after the keyboard shows.\n      // Windows Phone - if you preventDefault on a video element then you cannot operate\n      // its native controls.\n      e.preventDefault();\n    }\n\n    return false;\n  }\n\n  tapPointerMoved = false;\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener('mousemove');\n  ionic.activator.start(e);\n}\n\nfunction tapMouseUp(e) {\n  //console.log(\"mouseup \" + Date.now());\n  if (tapEnabledTouchEvents) {\n    e.stopPropagation();\n    e.preventDefault();\n    return false;\n  }\n\n  if (tapIgnoreEvent(e) || isSelectOrOption(e.target.tagName)) return false;\n\n  if (!tapHasPointerMoved(e)) {\n    tapClick(e);\n  }\n  tapEventListener('mousemove', false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapMouseMove(e) {\n  if (tapHasPointerMoved(e)) {\n    tapEventListener('mousemove', false);\n    ionic.activator.end();\n    tapPointerMoved = true;\n    return false;\n  }\n}\n\n\n// TOUCH\nfunction tapTouchStart(e) {\n  //console.log(\"touchstart \" + Date.now());\n  if (tapIgnoreEvent(e)) return;\n\n  tapPointerMoved = false;\n\n  tapEnableTouchEvents();\n  tapPointerStart = ionic.tap.pointerCoord(e);\n\n  tapEventListener(tapTouchMoveListener);\n  ionic.activator.start(e);\n\n  if (ionic.Platform.isIOS() && ionic.tap.isLabelWithTextInput(e.target)) {\n    // if the tapped element is a label, which has a child input\n    // then preventDefault so iOS doesn't ugly auto scroll to the input\n    // but do not prevent default on Android or else you cannot move the text caret\n    // and do not prevent default on Android or else no virtual keyboard shows up\n\n    var textInput = tapTargetElement(tapContainingElement(e.target));\n    if (textInput !== tapActiveEle) {\n      // don't preventDefault on an already focused input or else iOS's text caret isn't usable\n      //console.log('Would prevent default here');\n      e.preventDefault();\n    }\n  }\n}\n\nfunction tapTouchEnd(e) {\n  //console.log('touchend ' + Date.now());\n  if (tapIgnoreEvent(e)) return;\n\n  tapEnableTouchEvents();\n  if (!tapHasPointerMoved(e)) {\n    tapClick(e);\n\n    if (isSelectOrOption(e.target.tagName)) {\n      e.preventDefault();\n    }\n  }\n\n  tapLastTouchTarget = e.target;\n  tapTouchCancel();\n}\n\nfunction tapTouchMove(e) {\n  if (tapHasPointerMoved(e)) {\n    tapPointerMoved = true;\n    tapEventListener(tapTouchMoveListener, false);\n    ionic.activator.end();\n    return false;\n  }\n}\n\nfunction tapTouchCancel() {\n  tapEventListener(tapTouchMoveListener, false);\n  ionic.activator.end();\n  tapPointerMoved = false;\n}\n\nfunction tapEnableTouchEvents() {\n  tapEnabledTouchEvents = true;\n  clearTimeout(tapMouseResetTimer);\n  tapMouseResetTimer = setTimeout(function() {\n    tapEnabledTouchEvents = false;\n  }, 600);\n}\n\nfunction tapIgnoreEvent(e) {\n  if (e.isTapHandled) return true;\n  e.isTapHandled = true;\n\n  if(ionic.tap.isElementTapDisabled(e.target)) {\n    return true;\n  }\n\n  if (ionic.scroll.isScrolling && ionic.tap.containsOrIsTextInput(e.target)) {\n    e.preventDefault();\n    return true;\n  }\n}\n\nfunction tapHandleFocus(ele) {\n  tapTouchFocusedInput = null;\n\n  var triggerFocusIn = false;\n\n  if (ele.tagName == 'SELECT') {\n    // trick to force Android options to show up\n    triggerMouseEvent('mousedown', ele, 0, 0);\n    ele.focus && ele.focus();\n    triggerFocusIn = true;\n\n  } else if (tapActiveElement() === ele) {\n    // already is the active element and has focus\n    triggerFocusIn = true;\n\n  } else if ((/^(input|textarea|ion-label)$/i).test(ele.tagName) || ele.isContentEditable) {\n    triggerFocusIn = true;\n    ele.focus && ele.focus();\n    ele.value = ele.value;\n    if (tapEnabledTouchEvents) {\n      tapTouchFocusedInput = ele;\n    }\n\n  } else {\n    tapFocusOutActive();\n  }\n\n  if (triggerFocusIn) {\n    tapActiveElement(ele);\n    ionic.trigger('ionic.focusin', {\n      target: ele\n    }, true);\n  }\n}\n\nfunction tapFocusOutActive() {\n  var ele = tapActiveElement();\n  if (ele && ((/^(input|textarea|select)$/i).test(ele.tagName) || ele.isContentEditable)) {\n    //console.log('tapFocusOutActive', ele.tagName);\n    ele.blur();\n  }\n  tapActiveElement(null);\n}\n\nfunction tapFocusIn(e) {\n  //console.log('focusin ' + Date.now());\n  // Because a text input doesn't preventDefault (so the caret still works) there's a chance\n  // that its mousedown event 300ms later will change the focus to another element after\n  // the keyboard shows up.\n\n  if (tapEnabledTouchEvents &&\n      ionic.tap.isTextInput(tapActiveElement()) &&\n      ionic.tap.isTextInput(tapTouchFocusedInput) &&\n      tapTouchFocusedInput !== e.target) {\n\n    // 1) The pointer is from touch events\n    // 2) There is an active element which is a text input\n    // 3) A text input was just set to be focused on by a touch event\n    // 4) A new focus has been set, however the target isn't the one the touch event wanted\n    //console.log('focusin', 'tapTouchFocusedInput');\n    tapTouchFocusedInput.focus();\n    tapTouchFocusedInput = null;\n  }\n  ionic.scroll.isScrolling = false;\n}\n\nfunction tapFocusOut() {\n  //console.log(\"focusout\");\n  tapActiveElement(null);\n}\n\nfunction tapActiveElement(ele) {\n  if (arguments.length) {\n    tapActiveEle = ele;\n  }\n  return tapActiveEle || document.activeElement;\n}\n\nfunction tapHasPointerMoved(endEvent) {\n  if (!endEvent || endEvent.target.nodeType !== 1 || !tapPointerStart || (tapPointerStart.x === 0 && tapPointerStart.y === 0)) {\n    return false;\n  }\n  var endCoordinates = ionic.tap.pointerCoord(endEvent);\n\n  var hasClassList = !!(endEvent.target.classList && endEvent.target.classList.contains &&\n    typeof endEvent.target.classList.contains === 'function');\n  var releaseTolerance = hasClassList && endEvent.target.classList.contains('button') ?\n    TAP_RELEASE_BUTTON_TOLERANCE :\n    TAP_RELEASE_TOLERANCE;\n\n  return Math.abs(tapPointerStart.x - endCoordinates.x) > releaseTolerance ||\n         Math.abs(tapPointerStart.y - endCoordinates.y) > releaseTolerance;\n}\n\nfunction tapContainingElement(ele, allowSelf) {\n  var climbEle = ele;\n  for (var x = 0; x < 6; x++) {\n    if (!climbEle) break;\n    if (climbEle.tagName === 'LABEL') return climbEle;\n    climbEle = climbEle.parentElement;\n  }\n  if (allowSelf !== false) return ele;\n}\n\nfunction tapTargetElement(ele) {\n  if (ele && ele.tagName === 'LABEL') {\n    if (ele.control) return ele.control;\n\n    // older devices do not support the \"control\" property\n    if (ele.querySelector) {\n      var control = ele.querySelector('input,textarea,select');\n      if (control) return control;\n    }\n  }\n  return ele;\n}\n\nfunction isSelectOrOption(tagName){\n  return (/^(select|option)$/i).test(tagName);\n}\n\nionic.DomUtil.ready(function() {\n  var ng = typeof angular !== 'undefined' ? angular : null;\n  //do nothing for e2e tests\n  if (!ng || (ng && !ng.scenario)) {\n    ionic.tap.register(document);\n  }\n});\n\n(function(document, ionic) {\n  'use strict';\n\n  var queueElements = {};   // elements that should get an active state in XX milliseconds\n  var activeElements = {};  // elements that are currently active\n  var keyId = 0;            // a counter for unique keys for the above ojects\n  var ACTIVATED_CLASS = 'activated';\n\n  ionic.activator = {\n\n    start: function(e) {\n      var hitX = ionic.tap.pointerCoord(e).x;\n      if (hitX > 0 && hitX < 30) {\n        return;\n      }\n\n      // when an element is touched/clicked, it climbs up a few\n      // parents to see if it is an .item or .button element\n      ionic.requestAnimationFrame(function() {\n        if ((ionic.scroll && ionic.scroll.isScrolling) || ionic.tap.requiresNativeClick(e.target)) return;\n        var ele = e.target;\n        var eleToActivate;\n\n        for (var x = 0; x < 6; x++) {\n          if (!ele || ele.nodeType !== 1) break;\n          if (eleToActivate && ele.classList && ele.classList.contains('item')) {\n            eleToActivate = ele;\n            break;\n          }\n          if (ele.tagName == 'A' || ele.tagName == 'BUTTON' || ele.hasAttribute('ng-click')) {\n            eleToActivate = ele;\n            break;\n          }\n          if (ele.classList && ele.classList.contains('button')) {\n            eleToActivate = ele;\n            break;\n          }\n          // no sense climbing past these\n          if (ele.tagName == 'ION-CONTENT' || (ele.classList && ele.classList.contains('pane')) || ele.tagName == 'BODY') {\n            break;\n          }\n          ele = ele.parentElement;\n        }\n\n        if (eleToActivate) {\n          // queue that this element should be set to active\n          queueElements[keyId] = eleToActivate;\n\n          // on the next frame, set the queued elements to active\n          ionic.requestAnimationFrame(activateElements);\n\n          keyId = (keyId > 29 ? 0 : keyId + 1);\n        }\n\n      });\n    },\n\n    end: function() {\n      // clear out any active/queued elements after XX milliseconds\n      setTimeout(clear, 200);\n    }\n\n  };\n\n  function clear() {\n    // clear out any elements that are queued to be set to active\n    queueElements = {};\n\n    // in the next frame, remove the active class from all active elements\n    ionic.requestAnimationFrame(deactivateElements);\n  }\n\n  function activateElements() {\n    // activate all elements in the queue\n    for (var key in queueElements) {\n      if (queueElements[key]) {\n        queueElements[key].classList.add(ACTIVATED_CLASS);\n        activeElements[key] = queueElements[key];\n      }\n    }\n    queueElements = {};\n  }\n\n  function deactivateElements() {\n    if (ionic.transition && ionic.transition.isActive) {\n      setTimeout(deactivateElements, 400);\n      return;\n    }\n\n    for (var key in activeElements) {\n      if (activeElements[key]) {\n        activeElements[key].classList.remove(ACTIVATED_CLASS);\n        delete activeElements[key];\n      }\n    }\n  }\n\n})(document, ionic);\n\n(function(ionic) {\n  /* for nextUid function below */\n  var nextId = 0;\n\n  /**\n   * Various utilities used throughout Ionic\n   *\n   * Some of these are adopted from underscore.js and backbone.js, both also MIT licensed.\n   */\n  ionic.Utils = {\n\n    arrayMove: function(arr, oldIndex, newIndex) {\n      if (newIndex >= arr.length) {\n        var k = newIndex - arr.length;\n        while ((k--) + 1) {\n          arr.push(undefined);\n        }\n      }\n      arr.splice(newIndex, 0, arr.splice(oldIndex, 1)[0]);\n      return arr;\n    },\n\n    /**\n     * Return a function that will be called with the given context\n     */\n    proxy: function(func, context) {\n      var args = Array.prototype.slice.call(arguments, 2);\n      return function() {\n        return func.apply(context, args.concat(Array.prototype.slice.call(arguments)));\n      };\n    },\n\n    /**\n     * Only call a function once in the given interval.\n     *\n     * @param func {Function} the function to call\n     * @param wait {int} how long to wait before/after to allow function calls\n     * @param immediate {boolean} whether to call immediately or after the wait interval\n     */\n     debounce: function(func, wait, immediate) {\n      var timeout, args, context, timestamp, result;\n      return function() {\n        context = this;\n        args = arguments;\n        timestamp = new Date();\n        var later = function() {\n          var last = (new Date()) - timestamp;\n          if (last < wait) {\n            timeout = setTimeout(later, wait - last);\n          } else {\n            timeout = null;\n            if (!immediate) result = func.apply(context, args);\n          }\n        };\n        var callNow = immediate && !timeout;\n        if (!timeout) {\n          timeout = setTimeout(later, wait);\n        }\n        if (callNow) result = func.apply(context, args);\n        return result;\n      };\n    },\n\n    /**\n     * Throttle the given fun, only allowing it to be\n     * called at most every `wait` ms.\n     */\n    throttle: function(func, wait, options) {\n      var context, args, result;\n      var timeout = null;\n      var previous = 0;\n      options || (options = {});\n      var later = function() {\n        previous = options.leading === false ? 0 : Date.now();\n        timeout = null;\n        result = func.apply(context, args);\n      };\n      return function() {\n        var now = Date.now();\n        if (!previous && options.leading === false) previous = now;\n        var remaining = wait - (now - previous);\n        context = this;\n        args = arguments;\n        if (remaining <= 0) {\n          clearTimeout(timeout);\n          timeout = null;\n          previous = now;\n          result = func.apply(context, args);\n        } else if (!timeout && options.trailing !== false) {\n          timeout = setTimeout(later, remaining);\n        }\n        return result;\n      };\n    },\n     // Borrowed from Backbone.js's extend\n     // Helper function to correctly set up the prototype chain, for subclasses.\n     // Similar to `goog.inherits`, but uses a hash of prototype properties and\n     // class properties to be extended.\n    inherit: function(protoProps, staticProps) {\n      var parent = this;\n      var child;\n\n      // The constructor function for the new subclass is either defined by you\n      // (the \"constructor\" property in your `extend` definition), or defaulted\n      // by us to simply call the parent's constructor.\n      if (protoProps && protoProps.hasOwnProperty('constructor')) {\n        child = protoProps.constructor;\n      } else {\n        child = function() { return parent.apply(this, arguments); };\n      }\n\n      // Add static properties to the constructor function, if supplied.\n      ionic.extend(child, parent, staticProps);\n\n      // Set the prototype chain to inherit from `parent`, without calling\n      // `parent`'s constructor function.\n      var Surrogate = function() { this.constructor = child; };\n      Surrogate.prototype = parent.prototype;\n      child.prototype = new Surrogate();\n\n      // Add prototype properties (instance properties) to the subclass,\n      // if supplied.\n      if (protoProps) ionic.extend(child.prototype, protoProps);\n\n      // Set a convenience property in case the parent's prototype is needed\n      // later.\n      child.__super__ = parent.prototype;\n\n      return child;\n    },\n\n    // Extend adapted from Underscore.js\n    extend: function(obj) {\n       var args = Array.prototype.slice.call(arguments, 1);\n       for (var i = 0; i < args.length; i++) {\n         var source = args[i];\n         if (source) {\n           for (var prop in source) {\n             obj[prop] = source[prop];\n           }\n         }\n       }\n       return obj;\n    },\n\n    nextUid: function() {\n      return 'ion' + (nextId++);\n    },\n\n    disconnectScope: function disconnectScope(scope) {\n      if (!scope) return;\n\n      if (scope.$root === scope) {\n        return; // we can't disconnect the root node;\n      }\n      var parent = scope.$parent;\n      scope.$$disconnected = true;\n      scope.$broadcast('$ionic.disconnectScope', scope);\n\n      // See Scope.$destroy\n      if (parent.$$childHead === scope) {\n        parent.$$childHead = scope.$$nextSibling;\n      }\n      if (parent.$$childTail === scope) {\n        parent.$$childTail = scope.$$prevSibling;\n      }\n      if (scope.$$prevSibling) {\n        scope.$$prevSibling.$$nextSibling = scope.$$nextSibling;\n      }\n      if (scope.$$nextSibling) {\n        scope.$$nextSibling.$$prevSibling = scope.$$prevSibling;\n      }\n      scope.$$nextSibling = scope.$$prevSibling = null;\n    },\n\n    reconnectScope: function reconnectScope(scope) {\n      if (!scope) return;\n\n      if (scope.$root === scope) {\n        return; // we can't disconnect the root node;\n      }\n      if (!scope.$$disconnected) {\n        return;\n      }\n      var parent = scope.$parent;\n      scope.$$disconnected = false;\n      scope.$broadcast('$ionic.reconnectScope', scope);\n      // See Scope.$new for this logic...\n      scope.$$prevSibling = parent.$$childTail;\n      if (parent.$$childHead) {\n        parent.$$childTail.$$nextSibling = scope;\n        parent.$$childTail = scope;\n      } else {\n        parent.$$childHead = parent.$$childTail = scope;\n      }\n    },\n\n    isScopeDisconnected: function(scope) {\n      var climbScope = scope;\n      while (climbScope) {\n        if (climbScope.$$disconnected) return true;\n        climbScope = climbScope.$parent;\n      }\n      return false;\n    }\n  };\n\n  // Bind a few of the most useful functions to the ionic scope\n  ionic.inherit = ionic.Utils.inherit;\n  ionic.extend = ionic.Utils.extend;\n  ionic.throttle = ionic.Utils.throttle;\n  ionic.proxy = ionic.Utils.proxy;\n  ionic.debounce = ionic.Utils.debounce;\n\n})(window.ionic);\n\n/**\n * @ngdoc page\n * @name keyboard\n * @module ionic\n * @description\n * On both Android and iOS, Ionic will attempt to prevent the keyboard from\n * obscuring inputs and focusable elements when it appears by scrolling them\n * into view.  In order for this to work, any focusable elements must be within\n * a [Scroll View](http://ionicframework.com/docs/api/directive/ionScroll/)\n * or a directive such as [Content](http://ionicframework.com/docs/api/directive/ionContent/)\n * that has a Scroll View.\n *\n * It will also attempt to prevent the native overflow scrolling on focus,\n * which can cause layout issues such as pushing headers up and out of view.\n *\n * The keyboard fixes work best in conjunction with the\n * [Ionic Keyboard Plugin](https://github.com/driftyco/ionic-plugins-keyboard),\n * although it will perform reasonably well without.  However, if you are using\n * Cordova there is no reason not to use the plugin.\n *\n * ### Hide when keyboard shows\n *\n * To hide an element when the keyboard is open, add the class `hide-on-keyboard-open`.\n *\n * ```html\n * <div class=\"hide-on-keyboard-open\">\n *   <div id=\"google-map\"></div>\n * </div>\n * ```\n *\n * Note: For performance reasons, elements will not be hidden for 400ms after the start of the `native.keyboardshow` event\n * from the Ionic Keyboard plugin. If you would like them to disappear immediately, you could do something\n * like:\n *\n * ```js\n *   window.addEventListener('native.keyboardshow', function(){\n *     document.body.classList.add('keyboard-open');\n *   });\n * ```\n * This adds the same `keyboard-open` class that is normally added by Ionic 400ms after the keyboard\n * opens. However, bear in mind that adding this class to the body immediately may cause jank in any\n * animations on Android that occur when the keyboard opens (for example, scrolling any obscured inputs into view).\n *\n * ----------\n *\n * ### Plugin Usage\n * Information on using the plugin can be found at\n * [https://github.com/driftyco/ionic-plugins-keyboard](https://github.com/driftyco/ionic-plugins-keyboard).\n *\n * ----------\n *\n * ### Android Notes\n * - If your app is running in fullscreen, i.e. you have\n *   `<preference name=\"Fullscreen\" value=\"true\" />` in your `config.xml` file\n *   you will need to set `ionic.Platform.isFullScreen = true` manually.\n *\n * - You can configure the behavior of the web view when the keyboard shows by setting\n *   [android:windowSoftInputMode](http://developer.android.com/reference/android/R.attr.html#windowSoftInputMode)\n *   to either `adjustPan`, `adjustResize` or `adjustNothing` in your app's\n *   activity in `AndroidManifest.xml`. `adjustResize` is the recommended setting\n *   for Ionic, but if for some reason you do use `adjustPan` you will need to\n *   set `ionic.Platform.isFullScreen = true`.\n *\n *   ```xml\n *   <activity android:windowSoftInputMode=\"adjustResize\">\n *\n *   ```\n *\n * ### iOS Notes\n * - If the content of your app (including the header) is being pushed up and\n *   out of view on input focus, try setting `cordova.plugins.Keyboard.disableScroll(true)`.\n *   This does **not** disable scrolling in the Ionic scroll view, rather it\n *   disables the native overflow scrolling that happens automatically as a\n *   result of focusing on inputs below the keyboard.\n *\n */\n\n/**\n * The current viewport height.\n */\nvar keyboardCurrentViewportHeight = 0;\n\n/**\n * The viewport height when in portrait orientation.\n */\nvar keyboardPortraitViewportHeight = 0;\n\n/**\n * The viewport height when in landscape orientation.\n */\nvar keyboardLandscapeViewportHeight = 0;\n\n/**\n * The currently focused input.\n */\nvar keyboardActiveElement;\n\n/**\n * The previously focused input used to reset keyboard after focusing on a\n * new non-keyboard element\n */\nvar lastKeyboardActiveElement;\n\n/**\n * The scroll view containing the currently focused input.\n */\nvar scrollView;\n\n/**\n * Timer for the setInterval that polls window.innerHeight to determine whether\n * the layout has updated for the keyboard showing/hiding.\n */\nvar waitForResizeTimer;\n\n/**\n * Sometimes when switching inputs or orientations, focusout will fire before\n * focusin, so this timer is for the small setTimeout to determine if we should\n * really focusout/hide the keyboard.\n */\nvar keyboardFocusOutTimer;\n\n/**\n * on Android, orientationchange will fire before the keyboard plugin notifies\n * the browser that the keyboard will show/is showing, so this flag indicates\n * to nativeShow that there was an orientationChange and we should update\n * the viewport height with an accurate keyboard height value\n */\nvar wasOrientationChange = false;\n\n/**\n * CSS class added to the body indicating the keyboard is open.\n */\nvar KEYBOARD_OPEN_CSS = 'keyboard-open';\n\n/**\n * CSS class that indicates a scroll container.\n */\nvar SCROLL_CONTAINER_CSS = 'scroll-content';\n\n/**\n * Debounced keyboardFocusIn function\n */\nvar debouncedKeyboardFocusIn = ionic.debounce(keyboardFocusIn, 200, true);\n\n/**\n * Debounced keyboardNativeShow function\n */\nvar debouncedKeyboardNativeShow = ionic.debounce(keyboardNativeShow, 100, true);\n\n/**\n * Ionic keyboard namespace.\n * @namespace keyboard\n */\nionic.keyboard = {\n\n  /**\n   * Whether the keyboard is open or not.\n   */\n  isOpen: false,\n\n  /**\n   * Whether the keyboard is closing or not.\n   */\n  isClosing: false,\n\n  /**\n   * Whether the keyboard is opening or not.\n   */\n  isOpening: false,\n\n  /**\n   * The height of the keyboard in pixels, as reported by the keyboard plugin.\n   * If the plugin is not available, calculated as the difference in\n   * window.innerHeight after the keyboard has shown.\n   */\n  height: 0,\n\n  /**\n   * Whether the device is in landscape orientation or not.\n   */\n  isLandscape: false,\n\n  /**\n   * Whether the keyboard event listeners have been added or not\n   */\n  isInitialized: false,\n\n  /**\n   * Hide the keyboard, if it is open.\n   */\n  hide: function() {\n    if (keyboardHasPlugin()) {\n      cordova.plugins.Keyboard.close();\n    }\n    keyboardActiveElement && keyboardActiveElement.blur();\n  },\n\n  /**\n   * An alias for cordova.plugins.Keyboard.show(). If the keyboard plugin\n   * is installed, show the keyboard.\n   */\n  show: function() {\n    if (keyboardHasPlugin()) {\n      cordova.plugins.Keyboard.show();\n    }\n  },\n\n  /**\n   * Remove all keyboard related event listeners, effectively disabling Ionic's\n   * keyboard adjustments.\n   */\n  disable: function() {\n    if (keyboardHasPlugin()) {\n      window.removeEventListener('native.keyboardshow', debouncedKeyboardNativeShow );\n      window.removeEventListener('native.keyboardhide', keyboardFocusOut);\n    } else {\n      document.body.removeEventListener('focusout', keyboardFocusOut);\n    }\n\n    document.body.removeEventListener('ionic.focusin', debouncedKeyboardFocusIn);\n    document.body.removeEventListener('focusin', debouncedKeyboardFocusIn);\n\n    window.removeEventListener('orientationchange', keyboardOrientationChange);\n\n    if ( window.navigator.msPointerEnabled ) {\n      document.removeEventListener(\"MSPointerDown\", keyboardInit);\n    } else {\n      document.removeEventListener('touchstart', keyboardInit);\n    }\n    ionic.keyboard.isInitialized = false;\n  },\n\n  /**\n   * Alias for keyboardInit, initialize all keyboard related event listeners.\n   */\n  enable: function() {\n    keyboardInit();\n  }\n};\n\n// Initialize the viewport height (after ionic.keyboard.height has been\n// defined).\nkeyboardCurrentViewportHeight = getViewportHeight();\n\n\n                             /* Event handlers */\n/* ------------------------------------------------------------------------- */\n\n/**\n * Event handler for first touch event, initializes all event listeners\n * for keyboard related events. Also aliased by ionic.keyboard.enable.\n */\nfunction keyboardInit() {\n\n  if (ionic.keyboard.isInitialized) return;\n\n  if (keyboardHasPlugin()) {\n    window.addEventListener('native.keyboardshow', debouncedKeyboardNativeShow);\n    window.addEventListener('native.keyboardhide', keyboardFocusOut);\n  } else {\n    document.body.addEventListener('focusout', keyboardFocusOut);\n  }\n\n  document.body.addEventListener('ionic.focusin', debouncedKeyboardFocusIn);\n  document.body.addEventListener('focusin', debouncedKeyboardFocusIn);\n\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerDown\", keyboardInit);\n  } else {\n    document.removeEventListener('touchstart', keyboardInit);\n  }\n\n  ionic.keyboard.isInitialized = true;\n}\n\n/**\n * Event handler for 'native.keyboardshow' event, sets keyboard.height to the\n * reported height and keyboard.isOpening to true. Then calls\n * keyboardWaitForResize with keyboardShow or keyboardUpdateViewportHeight as\n * the callback depending on whether the event was triggered by a focusin or\n * an orientationchange.\n */\nfunction keyboardNativeShow(e) {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardNativeShow fired at: \" + Date.now());\n  //console.log(\"keyboardNativeshow window.innerHeight: \" + window.innerHeight);\n\n  if (!ionic.keyboard.isOpen || ionic.keyboard.isClosing) {\n    ionic.keyboard.isOpening = true;\n    ionic.keyboard.isClosing = false;\n  }\n\n  ionic.keyboard.height = e.keyboardHeight;\n  //console.log('nativeshow keyboard height:' + e.keyboardHeight);\n\n  if (wasOrientationChange) {\n    keyboardWaitForResize(keyboardUpdateViewportHeight, true);\n  } else {\n    keyboardWaitForResize(keyboardShow, true);\n  }\n}\n\n/**\n * Event handler for 'focusin' and 'ionic.focusin' events. Initializes\n * keyboard state (keyboardActiveElement and keyboard.isOpening) for the\n * appropriate adjustments once the window has resized.  If not using the\n * keyboard plugin, calls keyboardWaitForResize with keyboardShow as the\n * callback or keyboardShow right away if the keyboard is already open.  If\n * using the keyboard plugin does nothing and lets keyboardNativeShow handle\n * adjustments with a more accurate keyboard height.\n */\nfunction keyboardFocusIn(e) {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardFocusIn from: \" + e.type + \" at: \" + Date.now());\n\n  if (!e.target ||\n      e.target.readOnly ||\n      !ionic.tap.isKeyboardElement(e.target) ||\n      !(scrollView = ionic.DomUtil.getParentWithClass(e.target, SCROLL_CONTAINER_CSS))) {\n    if (keyboardActiveElement) {\n        lastKeyboardActiveElement = keyboardActiveElement;\n    }\n    keyboardActiveElement = null;\n    return;\n  }\n\n  keyboardActiveElement = e.target;\n\n  // if using JS scrolling, undo the effects of native overflow scroll so the\n  // scroll view is positioned correctly\n  if (!scrollView.classList.contains(\"overflow-scroll\")) {\n    document.body.scrollTop = 0;\n    scrollView.scrollTop = 0;\n    ionic.requestAnimationFrame(function(){\n      document.body.scrollTop = 0;\n      scrollView.scrollTop = 0;\n    });\n\n    // any showing part of the document that isn't within the scroll the user\n    // could touchmove and cause some ugly changes to the app, so disable\n    // any touchmove events while the keyboard is open using e.preventDefault()\n    if (window.navigator.msPointerEnabled) {\n      document.addEventListener(\"MSPointerMove\", keyboardPreventDefault, false);\n    } else {\n      document.addEventListener('touchmove', keyboardPreventDefault, false);\n    }\n  }\n\n  if (!ionic.keyboard.isOpen || ionic.keyboard.isClosing) {\n    ionic.keyboard.isOpening = true;\n    ionic.keyboard.isClosing = false;\n  }\n\n  // attempt to prevent browser from natively scrolling input into view while\n  // we are trying to do the same (while we are scrolling) if the user taps the\n  // keyboard\n  document.addEventListener('keydown', keyboardOnKeyDown, false);\n\n\n\n  // if we aren't using the plugin and the keyboard isn't open yet, wait for the\n  // window to resize so we can get an accurate estimate of the keyboard size,\n  // otherwise we do nothing and let nativeShow call keyboardShow once we have\n  // an exact keyboard height\n  // if the keyboard is already open, go ahead and scroll the input into view\n  // if necessary\n  if (!ionic.keyboard.isOpen && !keyboardHasPlugin()) {\n    keyboardWaitForResize(keyboardShow, true);\n\n  } else if (ionic.keyboard.isOpen) {\n    keyboardShow();\n  }\n}\n\n/**\n * Event handler for 'focusout' events. Sets keyboard.isClosing to true and\n * calls keyboardWaitForResize with keyboardHide as the callback after a small\n * timeout.\n */\nfunction keyboardFocusOut() {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardFocusOut fired at: \" + Date.now());\n  //console.log(\"keyboardFocusOut event type: \" + e.type);\n\n  if (ionic.keyboard.isOpen || ionic.keyboard.isOpening) {\n    ionic.keyboard.isClosing = true;\n    ionic.keyboard.isOpening = false;\n  }\n\n  // Call keyboardHide with a slight delay because sometimes on focus or\n  // orientation change focusin is called immediately after, so we give it time\n  // to cancel keyboardHide\n  keyboardFocusOutTimer = setTimeout(function() {\n    ionic.requestAnimationFrame(function() {\n      // focusOut during or right after an orientationchange, so we didn't get\n      // a chance to update the viewport height yet, do it and keyboardHide\n      //console.log(\"focusOut, wasOrientationChange: \" + wasOrientationChange);\n      if (wasOrientationChange) {\n        keyboardWaitForResize(function(){\n          keyboardUpdateViewportHeight();\n          keyboardHide();\n        }, false);\n      } else {\n        keyboardWaitForResize(keyboardHide, false);\n      }\n    });\n  }, 50);\n}\n\n/**\n * Event handler for 'orientationchange' events. If using the keyboard plugin\n * and the keyboard is open on Android, sets wasOrientationChange to true so\n * nativeShow can update the viewport height with an accurate keyboard height.\n * If the keyboard isn't open or keyboard plugin isn't being used,\n * waits for the window to resize before updating the viewport height.\n *\n * On iOS, where orientationchange fires after the keyboard has already shown,\n * updates the viewport immediately, regardless of if the keyboard is already\n * open.\n */\nfunction keyboardOrientationChange() {\n  //console.log(\"orientationchange fired at: \" + Date.now());\n  //console.log(\"orientation was: \" + (ionic.keyboard.isLandscape ? \"landscape\" : \"portrait\"));\n\n  // toggle orientation\n  ionic.keyboard.isLandscape = !ionic.keyboard.isLandscape;\n  // //console.log(\"now orientation is: \" + (ionic.keyboard.isLandscape ? \"landscape\" : \"portrait\"));\n\n  // no need to wait for resizing on iOS, and orientationchange always fires\n  // after the keyboard has opened, so it doesn't matter if it's open or not\n  if (ionic.Platform.isIOS()) {\n    keyboardUpdateViewportHeight();\n  }\n\n  // On Android, if the keyboard isn't open or we aren't using the keyboard\n  // plugin, update the viewport height once everything has resized. If the\n  // keyboard is open and we are using the keyboard plugin do nothing and let\n  // nativeShow handle it using an accurate keyboard height.\n  if ( ionic.Platform.isAndroid()) {\n    if (!ionic.keyboard.isOpen || !keyboardHasPlugin()) {\n      keyboardWaitForResize(keyboardUpdateViewportHeight, false);\n    } else {\n      wasOrientationChange = true;\n    }\n  }\n}\n\n/**\n * Event handler for 'keydown' event. Tries to prevent browser from natively\n * scrolling an input into view when a user taps the keyboard while we are\n * scrolling the input into view ourselves with JS.\n */\nfunction keyboardOnKeyDown(e) {\n  if (ionic.scroll.isScrolling) {\n    keyboardPreventDefault(e);\n  }\n}\n\n/**\n * Event for 'touchmove' or 'MSPointerMove'. Prevents native scrolling on\n * elements outside the scroll view while the keyboard is open.\n */\nfunction keyboardPreventDefault(e) {\n  if (e.target.tagName !== 'TEXTAREA') {\n    e.preventDefault();\n  }\n}\n\n                              /* Private API */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Polls window.innerHeight until it has updated to an expected value (or\n * sufficient time has passed) before calling the specified callback function.\n * Only necessary for non-fullscreen Android which sometimes reports multiple\n * window.innerHeight values during interim layouts while it is resizing.\n *\n * On iOS, the window.innerHeight will already be updated, but we use the 50ms\n * delay as essentially a timeout so that scroll view adjustments happen after\n * the keyboard has shown so there isn't a white flash from us resizing too\n * quickly.\n *\n * @param {Function} callback the function to call once the window has resized\n * @param {boolean} isOpening whether the resize is from the keyboard opening\n * or not\n */\nfunction keyboardWaitForResize(callback, isOpening) {\n  clearInterval(waitForResizeTimer);\n  var count = 0;\n  var maxCount;\n  var initialHeight = getViewportHeight();\n  var viewportHeight = initialHeight;\n\n  //console.log(\"waitForResize initial viewport height: \" + viewportHeight);\n  //var start = Date.now();\n  //console.log(\"start: \" + start);\n\n  // want to fail relatively quickly on modern android devices, since it's much\n  // more likely we just have a bad keyboard height\n  if (ionic.Platform.isAndroid() && ionic.Platform.version() < 4.4) {\n    maxCount = 30;\n  } else if (ionic.Platform.isAndroid()) {\n    maxCount = 10;\n  } else {\n    maxCount = 1;\n  }\n\n  // poll timer\n  waitForResizeTimer = setInterval(function(){\n    viewportHeight = getViewportHeight();\n\n    // height hasn't updated yet, try again in 50ms\n    // if not using plugin, wait for maxCount to ensure we have waited long enough\n    // to get an accurate keyboard height\n    if (++count < maxCount &&\n        ((!isPortraitViewportHeight(viewportHeight) &&\n         !isLandscapeViewportHeight(viewportHeight)) ||\n         !ionic.keyboard.height)) {\n      return;\n    }\n\n    // infer the keyboard height from the resize if not using the keyboard plugin\n    if (!keyboardHasPlugin()) {\n      ionic.keyboard.height = Math.abs(initialHeight - window.innerHeight);\n    }\n\n    // set to true if we were waiting for the keyboard to open\n    ionic.keyboard.isOpen = isOpening;\n\n    clearInterval(waitForResizeTimer);\n    //var end = Date.now();\n    //console.log(\"waitForResize count: \" + count);\n    //console.log(\"end: \" + end);\n    //console.log(\"difference: \" + ( end - start ) + \"ms\");\n\n    //console.log(\"callback: \" + callback.name);\n    callback();\n\n  }, 50);\n\n  return maxCount; //for tests\n}\n\n/**\n * On keyboard close sets keyboard state to closed, resets the scroll view,\n * removes CSS from body indicating keyboard was open, removes any event\n * listeners for when the keyboard is open and on Android blurs the active\n * element (which in some cases will still have focus even if the keyboard\n * is closed and can cause it to reappear on subsequent taps).\n */\nfunction keyboardHide() {\n  clearTimeout(keyboardFocusOutTimer);\n  //console.log(\"keyboardHide\");\n\n  ionic.keyboard.isOpen = false;\n  ionic.keyboard.isClosing = false;\n\n  if (keyboardActiveElement || lastKeyboardActiveElement) {\n    ionic.trigger('resetScrollView', {\n      target: keyboardActiveElement || lastKeyboardActiveElement\n    }, true);\n  }\n\n  ionic.requestAnimationFrame(function(){\n    document.body.classList.remove(KEYBOARD_OPEN_CSS);\n  });\n\n  // the keyboard is gone now, remove the touchmove that disables native scroll\n  if (window.navigator.msPointerEnabled) {\n    document.removeEventListener(\"MSPointerMove\", keyboardPreventDefault);\n  } else {\n    document.removeEventListener('touchmove', keyboardPreventDefault);\n  }\n  document.removeEventListener('keydown', keyboardOnKeyDown);\n\n  if (ionic.Platform.isAndroid()) {\n    // on android closing the keyboard with the back/dismiss button won't remove\n    // focus and keyboard can re-appear on subsequent taps (like scrolling)\n    if (keyboardHasPlugin()) cordova.plugins.Keyboard.close();\n    keyboardActiveElement && keyboardActiveElement.blur();\n  }\n\n  keyboardActiveElement = null;\n  lastKeyboardActiveElement = null;\n}\n\n/**\n * On keyboard open sets keyboard state to open, adds CSS to the body\n * indicating the keyboard is open and tells the scroll view to resize and\n * the currently focused input into view if necessary.\n */\nfunction keyboardShow() {\n\n  ionic.keyboard.isOpen = true;\n  ionic.keyboard.isOpening = false;\n\n  var details = {\n    keyboardHeight: keyboardGetHeight(),\n    viewportHeight: keyboardCurrentViewportHeight\n  };\n\n  if (keyboardActiveElement) {\n    details.target = keyboardActiveElement;\n\n    var elementBounds = keyboardActiveElement.getBoundingClientRect();\n\n    details.elementTop = Math.round(elementBounds.top);\n    details.elementBottom = Math.round(elementBounds.bottom);\n\n    details.windowHeight = details.viewportHeight - details.keyboardHeight;\n    //console.log(\"keyboardShow viewportHeight: \" + details.viewportHeight +\n    //\", windowHeight: \" + details.windowHeight +\n    //\", keyboardHeight: \" + details.keyboardHeight);\n\n    // figure out if the element is under the keyboard\n    details.isElementUnderKeyboard = (details.elementBottom > details.windowHeight);\n    //console.log(\"isUnderKeyboard: \" + details.isElementUnderKeyboard);\n    //console.log(\"elementBottom: \" + details.elementBottom);\n\n    // send event so the scroll view adjusts\n    ionic.trigger('scrollChildIntoView', details, true);\n  }\n\n  setTimeout(function(){\n    document.body.classList.add(KEYBOARD_OPEN_CSS);\n  }, 400);\n\n  return details; //for testing\n}\n\n/* eslint no-unused-vars:0 */\nfunction keyboardGetHeight() {\n  // check if we already have a keyboard height from the plugin or resize calculations\n  if (ionic.keyboard.height) {\n    return ionic.keyboard.height;\n  }\n\n  if (ionic.Platform.isAndroid()) {\n    // should be using the plugin, no way to know how big the keyboard is, so guess\n    if ( ionic.Platform.isFullScreen ) {\n      return 275;\n    }\n    // otherwise just calculate it\n    var contentHeight = window.innerHeight;\n    if (contentHeight < keyboardCurrentViewportHeight) {\n      return keyboardCurrentViewportHeight - contentHeight;\n    } else {\n      return 0;\n    }\n  }\n\n  // fallback for when it's the webview without the plugin\n  // or for just the standard web browser\n  // TODO: have these be based on device\n  if (ionic.Platform.isIOS()) {\n    if (ionic.keyboard.isLandscape) {\n      return 206;\n    }\n\n    if (!ionic.Platform.isWebView()) {\n      return 216;\n    }\n\n    return 260;\n  }\n\n  // safe guess\n  return 275;\n}\n\nfunction isPortraitViewportHeight(viewportHeight) {\n  return !!(!ionic.keyboard.isLandscape &&\n         keyboardPortraitViewportHeight &&\n         (Math.abs(keyboardPortraitViewportHeight - viewportHeight) < 2));\n}\n\nfunction isLandscapeViewportHeight(viewportHeight) {\n  return !!(ionic.keyboard.isLandscape &&\n         keyboardLandscapeViewportHeight &&\n         (Math.abs(keyboardLandscapeViewportHeight - viewportHeight) < 2));\n}\n\nfunction keyboardUpdateViewportHeight() {\n  wasOrientationChange = false;\n  keyboardCurrentViewportHeight = getViewportHeight();\n\n  if (ionic.keyboard.isLandscape && !keyboardLandscapeViewportHeight) {\n    //console.log(\"saved landscape: \" + keyboardCurrentViewportHeight);\n    keyboardLandscapeViewportHeight = keyboardCurrentViewportHeight;\n\n  } else if (!ionic.keyboard.isLandscape && !keyboardPortraitViewportHeight) {\n    //console.log(\"saved portrait: \" + keyboardCurrentViewportHeight);\n    keyboardPortraitViewportHeight = keyboardCurrentViewportHeight;\n  }\n\n  if (keyboardActiveElement) {\n    ionic.trigger('resetScrollView', {\n      target: keyboardActiveElement\n    }, true);\n  }\n\n  if (ionic.keyboard.isOpen && ionic.tap.isTextInput(keyboardActiveElement)) {\n    keyboardShow();\n  }\n}\n\nfunction keyboardInitViewportHeight() {\n  var viewportHeight = getViewportHeight();\n  //console.log(\"Keyboard init VP: \" + viewportHeight + \" \" + window.innerWidth);\n  // can't just use window.innerHeight in case the keyboard is opened immediately\n  if ((viewportHeight / window.innerWidth) < 1) {\n    ionic.keyboard.isLandscape = true;\n  }\n  //console.log(\"ionic.keyboard.isLandscape is: \" + ionic.keyboard.isLandscape);\n\n  // initialize or update the current viewport height values\n  keyboardCurrentViewportHeight = viewportHeight;\n  if (ionic.keyboard.isLandscape && !keyboardLandscapeViewportHeight) {\n    keyboardLandscapeViewportHeight = keyboardCurrentViewportHeight;\n  } else if (!ionic.keyboard.isLandscape && !keyboardPortraitViewportHeight) {\n    keyboardPortraitViewportHeight = keyboardCurrentViewportHeight;\n  }\n}\n\nfunction getViewportHeight() {\n  var windowHeight = window.innerHeight;\n  //console.log('window.innerHeight is: ' + windowHeight);\n  //console.log('kb height is: ' + ionic.keyboard.height);\n  //console.log('kb isOpen: ' + ionic.keyboard.isOpen);\n\n  //TODO: add iPad undocked/split kb once kb plugin supports it\n  // the keyboard overlays the window on Android fullscreen\n  if (!(ionic.Platform.isAndroid() && ionic.Platform.isFullScreen) &&\n      (ionic.keyboard.isOpen || ionic.keyboard.isOpening) &&\n      !ionic.keyboard.isClosing) {\n\n     return windowHeight + keyboardGetHeight();\n  }\n  return windowHeight;\n}\n\nfunction keyboardHasPlugin() {\n  return !!(window.cordova && cordova.plugins && cordova.plugins.Keyboard);\n}\n\nionic.Platform.ready(function() {\n  keyboardInitViewportHeight();\n\n  window.addEventListener('orientationchange', keyboardOrientationChange);\n\n  // if orientation changes while app is in background, update on resuming\n  /*\n  if ( ionic.Platform.isWebView() ) {\n    document.addEventListener('resume', keyboardInitViewportHeight);\n\n    if (ionic.Platform.isAndroid()) {\n      //TODO: onbackpressed to detect keyboard close without focusout or plugin\n    }\n  }\n  */\n\n  // if orientation changes while app is in background, update on resuming\n/*  if ( ionic.Platform.isWebView() ) {\n    document.addEventListener('pause', function() {\n      window.removeEventListener('orientationchange', keyboardOrientationChange);\n    })\n    document.addEventListener('resume', function() {\n      keyboardInitViewportHeight();\n      window.addEventListener('orientationchange', keyboardOrientationChange)\n    });\n  }*/\n\n  // Android sometimes reports bad innerHeight on window.load\n  // try it again in a lil bit to play it safe\n  setTimeout(keyboardInitViewportHeight, 999);\n\n  // only initialize the adjustments for the virtual keyboard\n  // if a touchstart event happens\n  if (window.navigator.msPointerEnabled) {\n    document.addEventListener(\"MSPointerDown\", keyboardInit, false);\n  } else {\n    document.addEventListener('touchstart', keyboardInit, false);\n  }\n});\n\n\n\nvar viewportTag;\nvar viewportProperties = {};\n\nionic.viewport = {\n  orientation: function() {\n    // 0 = Portrait\n    // 90 = Landscape\n    // not using window.orientation because each device has a different implementation\n    return (window.innerWidth > window.innerHeight ? 90 : 0);\n  }\n};\n\nfunction viewportLoadTag() {\n  var x;\n\n  for (x = 0; x < document.head.children.length; x++) {\n    if (document.head.children[x].name == 'viewport') {\n      viewportTag = document.head.children[x];\n      break;\n    }\n  }\n\n  if (viewportTag) {\n    var props = viewportTag.content.toLowerCase().replace(/\\s+/g, '').split(',');\n    var keyValue;\n    for (x = 0; x < props.length; x++) {\n      if (props[x]) {\n        keyValue = props[x].split('=');\n        viewportProperties[ keyValue[0] ] = (keyValue.length > 1 ? keyValue[1] : '_');\n      }\n    }\n    viewportUpdate();\n  }\n}\n\nfunction viewportUpdate() {\n  // unit tests in viewport.unit.js\n\n  var initWidth = viewportProperties.width;\n  var initHeight = viewportProperties.height;\n  var p = ionic.Platform;\n  var version = p.version();\n  var DEVICE_WIDTH = 'device-width';\n  var DEVICE_HEIGHT = 'device-height';\n  var orientation = ionic.viewport.orientation();\n\n  // Most times we're removing the height and adding the width\n  // So this is the default to start with, then modify per platform/version/oreintation\n  delete viewportProperties.height;\n  viewportProperties.width = DEVICE_WIDTH;\n\n  if (p.isIPad()) {\n    // iPad\n\n    if (version > 7) {\n      // iPad >= 7.1\n      // https://issues.apache.org/jira/browse/CB-4323\n      delete viewportProperties.width;\n\n    } else {\n      // iPad <= 7.0\n\n      if (p.isWebView()) {\n        // iPad <= 7.0 WebView\n\n        if (orientation == 90) {\n          // iPad <= 7.0 WebView Landscape\n          viewportProperties.height = '0';\n\n        } else if (version == 7) {\n          // iPad <= 7.0 WebView Portait\n          viewportProperties.height = DEVICE_HEIGHT;\n        }\n      } else {\n        // iPad <= 6.1 Browser\n        if (version < 7) {\n          viewportProperties.height = '0';\n        }\n      }\n    }\n\n  } else if (p.isIOS()) {\n    // iPhone\n\n    if (p.isWebView()) {\n      // iPhone WebView\n\n      if (version > 7) {\n        // iPhone >= 7.1 WebView\n        delete viewportProperties.width;\n\n      } else if (version < 7) {\n        // iPhone <= 6.1 WebView\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if (initHeight) viewportProperties.height = '0';\n\n      } else if (version == 7) {\n        //iPhone == 7.0 WebView\n        viewportProperties.height = DEVICE_HEIGHT;\n      }\n\n    } else {\n      // iPhone Browser\n\n      if (version < 7) {\n        // iPhone <= 6.1 Browser\n        // if height was set it needs to get removed with this hack for <= 6.1\n        if (initHeight) viewportProperties.height = '0';\n      }\n    }\n\n  }\n\n  // only update the viewport tag if there was a change\n  if (initWidth !== viewportProperties.width || initHeight !== viewportProperties.height) {\n    viewportTagUpdate();\n  }\n}\n\nfunction viewportTagUpdate() {\n  var key, props = [];\n  for (key in viewportProperties) {\n    if (viewportProperties[key]) {\n      props.push(key + (viewportProperties[key] == '_' ? '' : '=' + viewportProperties[key]));\n    }\n  }\n\n  viewportTag.content = props.join(', ');\n}\n\nionic.Platform.ready(function() {\n  viewportLoadTag();\n\n  window.addEventListener(\"orientationchange\", function() {\n    setTimeout(viewportUpdate, 1000);\n  }, false);\n});\n\n(function(ionic) {\n'use strict';\n  ionic.views.View = function() {\n    this.initialize.apply(this, arguments);\n  };\n\n  ionic.views.View.inherit = ionic.inherit;\n\n  ionic.extend(ionic.views.View.prototype, {\n    initialize: function() {}\n  });\n\n})(window.ionic);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\n/* jshint eqnull: true */\n\n/**\n * Generic animation class with support for dropped frames both optional easing and duration.\n *\n * Optional duration is useful when the lifetime is defined by another condition than time\n * e.g. speed of an animating object, etc.\n *\n * Dropped frame logic allows to keep using the same updater logic independent from the actual\n * rendering. This eases a lot of cases where it might be pretty complex to break down a state\n * based on the pure time difference.\n */\nvar zyngaCore = { effect: {} };\n(function(global) {\n  var time = Date.now || function() {\n    return +new Date();\n  };\n  var desiredFrames = 60;\n  var millisecondsPerSecond = 1000;\n  var running = {};\n  var counter = 1;\n\n  zyngaCore.effect.Animate = {\n\n    /**\n     * A requestAnimationFrame wrapper / polyfill.\n     *\n     * @param callback {Function} The callback to be invoked before the next repaint.\n     * @param root {HTMLElement} The root element for the repaint\n     */\n    requestAnimationFrame: (function() {\n\n      // Check for request animation Frame support\n      var requestFrame = global.requestAnimationFrame || global.webkitRequestAnimationFrame || global.mozRequestAnimationFrame || global.oRequestAnimationFrame;\n      var isNative = !!requestFrame;\n\n      if (requestFrame && !/requestAnimationFrame\\(\\)\\s*\\{\\s*\\[native code\\]\\s*\\}/i.test(requestFrame.toString())) {\n        isNative = false;\n      }\n\n      if (isNative) {\n        return function(callback, root) {\n          requestFrame(callback, root);\n        };\n      }\n\n      var TARGET_FPS = 60;\n      var requests = {};\n      var requestCount = 0;\n      var rafHandle = 1;\n      var intervalHandle = null;\n      var lastActive = +new Date();\n\n      return function(callback) {\n        var callbackHandle = rafHandle++;\n\n        // Store callback\n        requests[callbackHandle] = callback;\n        requestCount++;\n\n        // Create timeout at first request\n        if (intervalHandle === null) {\n\n          intervalHandle = setInterval(function() {\n\n            var time = +new Date();\n            var currentRequests = requests;\n\n            // Reset data structure before executing callbacks\n            requests = {};\n            requestCount = 0;\n\n            for(var key in currentRequests) {\n              if (currentRequests.hasOwnProperty(key)) {\n                currentRequests[key](time);\n                lastActive = time;\n              }\n            }\n\n            // Disable the timeout when nothing happens for a certain\n            // period of time\n            if (time - lastActive > 2500) {\n              clearInterval(intervalHandle);\n              intervalHandle = null;\n            }\n\n          }, 1000 / TARGET_FPS);\n        }\n\n        return callbackHandle;\n      };\n\n    })(),\n\n\n    /**\n     * Stops the given animation.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation was stopped (aka, was running before)\n     */\n    stop: function(id) {\n      var cleared = running[id] != null;\n      if (cleared) {\n        running[id] = null;\n      }\n\n      return cleared;\n    },\n\n\n    /**\n     * Whether the given animation is still running.\n     *\n     * @param id {Integer} Unique animation ID\n     * @return {Boolean} Whether the animation is still running\n     */\n    isRunning: function(id) {\n      return running[id] != null;\n    },\n\n\n    /**\n     * Start the animation.\n     *\n     * @param stepCallback {Function} Pointer to function which is executed on every step.\n     *   Signature of the method should be `function(percent, now, virtual) { return continueWithAnimation; }`\n     * @param verifyCallback {Function} Executed before every animation step.\n     *   Signature of the method should be `function() { return continueWithAnimation; }`\n     * @param completedCallback {Function}\n     *   Signature of the method should be `function(droppedFrames, finishedAnimation) {}`\n     * @param duration {Integer} Milliseconds to run the animation\n     * @param easingMethod {Function} Pointer to easing function\n     *   Signature of the method should be `function(percent) { return modifiedValue; }`\n     * @param root {Element} Render root, when available. Used for internal\n     *   usage of requestAnimationFrame.\n     * @return {Integer} Identifier of animation. Can be used to stop it any time.\n     */\n    start: function(stepCallback, verifyCallback, completedCallback, duration, easingMethod, root) {\n\n      var start = time();\n      var lastFrame = start;\n      var percent = 0;\n      var dropCounter = 0;\n      var id = counter++;\n\n      if (!root) {\n        root = document.body;\n      }\n\n      // Compacting running db automatically every few new animations\n      if (id % 20 === 0) {\n        var newRunning = {};\n        for (var usedId in running) {\n          newRunning[usedId] = true;\n        }\n        running = newRunning;\n      }\n\n      // This is the internal step method which is called every few milliseconds\n      var step = function(virtual) {\n\n        // Normalize virtual value\n        var render = virtual !== true;\n\n        // Get current time\n        var now = time();\n\n        // Verification is executed before next animation step\n        if (!running[id] || (verifyCallback && !verifyCallback(id))) {\n\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, false);\n          return;\n\n        }\n\n        // For the current rendering to apply let's update omitted steps in memory.\n        // This is important to bring internal state variables up-to-date with progress in time.\n        if (render) {\n\n          var droppedFrames = Math.round((now - lastFrame) / (millisecondsPerSecond / desiredFrames)) - 1;\n          for (var j = 0; j < Math.min(droppedFrames, 4); j++) {\n            step(true);\n            dropCounter++;\n          }\n\n        }\n\n        // Compute percent value\n        if (duration) {\n          percent = (now - start) / duration;\n          if (percent > 1) {\n            percent = 1;\n          }\n        }\n\n        // Execute step callback, then...\n        var value = easingMethod ? easingMethod(percent) : percent;\n        if ((stepCallback(value, now, render) === false || percent === 1) && render) {\n          running[id] = null;\n          completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration == null);\n        } else if (render) {\n          lastFrame = now;\n          zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n        }\n      };\n\n      // Mark as running\n      running[id] = true;\n\n      // Init first step\n      zyngaCore.effect.Animate.requestAnimationFrame(step, root);\n\n      // Return unique animation ID\n      return id;\n    }\n  };\n})(window);\n\n/*\n * Scroller\n * http://github.com/zynga/scroller\n *\n * Copyright 2011, Zynga Inc.\n * Licensed under the MIT License.\n * https://raw.github.com/zynga/scroller/master/MIT-LICENSE.txt\n *\n * Based on the work of: Unify Project (unify-project.org)\n * http://unify-project.org\n * Copyright 2011, Deutsche Telekom AG\n * License: MIT + Apache (V2)\n */\n\n(function(ionic) {\n  var NOOP = function(){};\n\n  // Easing Equations (c) 2003 Robert Penner, all rights reserved.\n  // Open source under the BSD License.\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeOutCubic = function(pos) {\n    return (Math.pow((pos - 1), 3) + 1);\n  };\n\n  /**\n   * @param pos {Number} position between 0 (start of effect) and 1 (end of effect)\n  **/\n  var easeInOutCubic = function(pos) {\n    if ((pos /= 0.5) < 1) {\n      return 0.5 * Math.pow(pos, 3);\n    }\n\n    return 0.5 * (Math.pow((pos - 2), 3) + 2);\n  };\n\n\n/**\n * ionic.views.Scroll\n * A powerful scroll view with support for bouncing, pull to refresh, and paging.\n * @param   {Object}        options options for the scroll view\n * @class A scroll view system\n * @memberof ionic.views\n */\nionic.views.Scroll = ionic.views.View.inherit({\n  initialize: function(options) {\n    var self = this;\n\n    self.__container = options.el;\n    self.__content = options.el.firstElementChild;\n\n    //Remove any scrollTop attached to these elements; they are virtual scroll now\n    //This also stops on-load-scroll-to-window.location.hash that the browser does\n    setTimeout(function() {\n      if (self.__container && self.__content) {\n        self.__container.scrollTop = 0;\n        self.__content.scrollTop = 0;\n      }\n    });\n\n    self.options = {\n\n      /** Disable scrolling on x-axis by default */\n      scrollingX: false,\n      scrollbarX: true,\n\n      /** Enable scrolling on y-axis */\n      scrollingY: true,\n      scrollbarY: true,\n\n      startX: 0,\n      startY: 0,\n\n      /** The amount to dampen mousewheel events */\n      wheelDampen: 6,\n\n      /** The minimum size the scrollbars scale to while scrolling */\n      minScrollbarSizeX: 5,\n      minScrollbarSizeY: 5,\n\n      /** Scrollbar fading after scrolling */\n      scrollbarsFade: true,\n      scrollbarFadeDelay: 300,\n      /** The initial fade delay when the pane is resized or initialized */\n      scrollbarResizeFadeDelay: 1000,\n\n      /** Enable animations for deceleration, snap back, zooming and scrolling */\n      animating: true,\n\n      /** duration for animations triggered by scrollTo/zoomTo */\n      animationDuration: 250,\n\n      /** The velocity required to make the scroll view \"slide\" after touchend */\n      decelVelocityThreshold: 4,\n\n      /** The velocity required to make the scroll view \"slide\" after touchend when using paging */\n      decelVelocityThresholdPaging: 4,\n\n      /** Enable bouncing (content can be slowly moved outside and jumps back after releasing) */\n      bouncing: true,\n\n      /** Enable locking to the main axis if user moves only slightly on one of them at start */\n      locking: true,\n\n      /** Enable pagination mode (switching between full page content panes) */\n      paging: false,\n\n      /** Enable snapping of content to a configured pixel grid */\n      snapping: false,\n\n      /** Enable zooming of content via API, fingers and mouse wheel */\n      zooming: false,\n\n      /** Minimum zoom level */\n      minZoom: 0.5,\n\n      /** Maximum zoom level */\n      maxZoom: 3,\n\n      /** Multiply or decrease scrolling speed **/\n      speedMultiplier: 1,\n\n      deceleration: 0.97,\n\n      /** Whether to prevent default on a scroll operation to capture drag events **/\n      preventDefault: false,\n\n      /** Callback that is fired on the later of touch end or deceleration end,\n        provided that another scrolling action has not begun. Used to know\n        when to fade out a scrollbar. */\n      scrollingComplete: NOOP,\n\n      /** This configures the amount of change applied to deceleration when reaching boundaries  **/\n      penetrationDeceleration: 0.03,\n\n      /** This configures the amount of change applied to acceleration when reaching boundaries  **/\n      penetrationAcceleration: 0.08,\n\n      // The ms interval for triggering scroll events\n      scrollEventInterval: 10,\n\n      freeze: false,\n\n      getContentWidth: function() {\n        return Math.max(self.__content.scrollWidth, self.__content.offsetWidth);\n      },\n      getContentHeight: function() {\n        return Math.max(self.__content.scrollHeight, self.__content.offsetHeight + (self.__content.offsetTop * 2));\n      }\n    };\n\n    for (var key in options) {\n      self.options[key] = options[key];\n    }\n\n    self.hintResize = ionic.debounce(function() {\n      self.resize();\n    }, 1000, true);\n\n    self.onScroll = function() {\n\n      if (!ionic.scroll.isScrolling) {\n        setTimeout(self.setScrollStart, 50);\n      } else {\n        clearTimeout(self.scrollTimer);\n        self.scrollTimer = setTimeout(self.setScrollStop, 80);\n      }\n\n    };\n\n    self.freeze = function(shouldFreeze) {\n      if (arguments.length) {\n        self.options.freeze = shouldFreeze;\n      }\n      return self.options.freeze;\n    };\n\n    // We can just use the standard freeze pop in our mouth\n    self.freezeShut = self.freeze;\n\n    self.setScrollStart = function() {\n      ionic.scroll.isScrolling = Math.abs(ionic.scroll.lastTop - self.__scrollTop) > 1;\n      clearTimeout(self.scrollTimer);\n      self.scrollTimer = setTimeout(self.setScrollStop, 80);\n    };\n\n    self.setScrollStop = function() {\n      ionic.scroll.isScrolling = false;\n      ionic.scroll.lastTop = self.__scrollTop;\n    };\n\n    self.triggerScrollEvent = ionic.throttle(function() {\n      self.onScroll();\n      ionic.trigger('scroll', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    }, self.options.scrollEventInterval);\n\n    self.triggerScrollEndEvent = function() {\n      ionic.trigger('scrollend', {\n        scrollTop: self.__scrollTop,\n        scrollLeft: self.__scrollLeft,\n        target: self.__container\n      });\n    };\n\n    self.__scrollLeft = self.options.startX;\n    self.__scrollTop = self.options.startY;\n\n    // Get the render update function, initialize event handlers,\n    // and calculate the size of the scroll container\n    self.__callback = self.getRenderFn();\n    self.__initEventHandlers();\n    self.__createScrollbars();\n\n  },\n\n  run: function() {\n    this.resize();\n\n    // Fade them out\n    this.__fadeScrollbars('out', this.options.scrollbarResizeFadeDelay);\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: STATUS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Whether only a single finger is used in touch handling */\n  __isSingleTouch: false,\n\n  /** Whether a touch event sequence is in progress */\n  __isTracking: false,\n\n  /** Whether a deceleration animation went to completion. */\n  __didDecelerationComplete: false,\n\n  /**\n   * Whether a gesture zoom/rotate event is in progress. Activates when\n   * a gesturestart event happens. This has higher priority than dragging.\n   */\n  __isGesturing: false,\n\n  /**\n   * Whether the user has moved by such a distance that we have enabled\n   * dragging mode. Hint: It's only enabled after some pixels of movement to\n   * not interrupt with clicks etc.\n   */\n  __isDragging: false,\n\n  /**\n   * Not touching and dragging anymore, and smoothly animating the\n   * touch sequence using deceleration.\n   */\n  __isDecelerating: false,\n\n  /**\n   * Smoothly animating the currently configured change\n   */\n  __isAnimating: false,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DIMENSIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Available outer left position (from document perspective) */\n  __clientLeft: 0,\n\n  /** Available outer top position (from document perspective) */\n  __clientTop: 0,\n\n  /** Available outer width */\n  __clientWidth: 0,\n\n  /** Available outer height */\n  __clientHeight: 0,\n\n  /** Outer width of content */\n  __contentWidth: 0,\n\n  /** Outer height of content */\n  __contentHeight: 0,\n\n  /** Snapping width for content */\n  __snapWidth: 100,\n\n  /** Snapping height for content */\n  __snapHeight: 100,\n\n  /** Height to assign to refresh area */\n  __refreshHeight: null,\n\n  /** Whether the refresh process is enabled when the event is released now */\n  __refreshActive: false,\n\n  /** Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release */\n  __refreshActivate: null,\n\n  /** Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled */\n  __refreshDeactivate: null,\n\n  /** Callback to execute to start the actual refresh. Call {@link #refreshFinish} when done */\n  __refreshStart: null,\n\n  /** Zoom level */\n  __zoomLevel: 1,\n\n  /** Scroll position on x-axis */\n  __scrollLeft: 0,\n\n  /** Scroll position on y-axis */\n  __scrollTop: 0,\n\n  /** Maximum allowed scroll position on x-axis */\n  __maxScrollLeft: 0,\n\n  /** Maximum allowed scroll position on y-axis */\n  __maxScrollTop: 0,\n\n  /* Scheduled left position (final position when animating) */\n  __scheduledLeft: 0,\n\n  /* Scheduled top position (final position when animating) */\n  __scheduledTop: 0,\n\n  /* Scheduled zoom level (final scale when animating) */\n  __scheduledZoom: 0,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: LAST POSITIONS\n  ---------------------------------------------------------------------------\n  */\n\n  /** Left position of finger at start */\n  __lastTouchLeft: null,\n\n  /** Top position of finger at start */\n  __lastTouchTop: null,\n\n  /** Timestamp of last move of finger. Used to limit tracking range for deceleration speed. */\n  __lastTouchMove: null,\n\n  /** List of positions, uses three indexes for each state: left, top, timestamp */\n  __positions: null,\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    INTERNAL FIELDS :: DECELERATION SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /** Minimum left scroll position during deceleration */\n  __minDecelerationScrollLeft: null,\n\n  /** Minimum top scroll position during deceleration */\n  __minDecelerationScrollTop: null,\n\n  /** Maximum left scroll position during deceleration */\n  __maxDecelerationScrollLeft: null,\n\n  /** Maximum top scroll position during deceleration */\n  __maxDecelerationScrollTop: null,\n\n  /** Current factor to modify horizontal scroll position with on every step */\n  __decelerationVelocityX: null,\n\n  /** Current factor to modify vertical scroll position with on every step */\n  __decelerationVelocityY: null,\n\n\n  /** the browser-specific property to use for transforms */\n  __transformProperty: null,\n  __perspectiveProperty: null,\n\n  /** scrollbar indicators */\n  __indicatorX: null,\n  __indicatorY: null,\n\n  /** Timeout for scrollbar fading */\n  __scrollbarFadeTimeout: null,\n\n  /** whether we've tried to wait for size already */\n  __didWaitForSize: null,\n  __sizerTimeout: null,\n\n  __initEventHandlers: function() {\n    var self = this;\n\n    // Event Handler\n    var container = self.__container;\n\n    // save height when scroll view is shrunk so we don't need to reflow\n    var scrollViewOffsetHeight;\n\n    /**\n     * Shrink the scroll view when the keyboard is up if necessary and if the\n     * focused input is below the bottom of the shrunk scroll view, scroll it\n     * into view.\n     */\n    self.scrollChildIntoView = function(e) {\n      //console.log(\"scrollChildIntoView at: \" + Date.now());\n\n      // D\n      var scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n      // D - A\n      scrollViewOffsetHeight = container.offsetHeight;\n      var alreadyShrunk = self.isShrunkForKeyboard;\n\n      var isModal = container.parentNode.classList.contains('modal');\n      // 680px is when the media query for 60% modal width kicks in\n      var isInsetModal = isModal && window.innerWidth >= 680;\n\n     /*\n      *  _______\n      * |---A---| <- top of scroll view\n      * |       |\n      * |---B---| <- keyboard\n      * |   C   | <- input\n      * |---D---| <- initial bottom of scroll view\n      * |___E___| <- bottom of viewport\n      *\n      *  All commented calculations relative to the top of the viewport (ie E\n      *  is the viewport height, not 0)\n      */\n      if (!alreadyShrunk) {\n        // shrink scrollview so we can actually scroll if the input is hidden\n        // if it isn't shrink so we can scroll to inputs under the keyboard\n        // inset modals won't shrink on Android on their own when the keyboard appears\n        if ( ionic.Platform.isIOS() || ionic.Platform.isFullScreen || isInsetModal ) {\n          // if there are things below the scroll view account for them and\n          // subtract them from the keyboard height when resizing\n          // E - D                         E                         D\n          var scrollBottomOffsetToBottom = e.detail.viewportHeight - scrollBottomOffsetToTop;\n\n          // 0 or D - B if D > B           E - B                     E - D\n          var keyboardOffset = Math.max(0, e.detail.keyboardHeight - scrollBottomOffsetToBottom);\n\n          ionic.requestAnimationFrame(function(){\n            // D - A or B - A if D > B       D - A             max(0, D - B)\n            scrollViewOffsetHeight = scrollViewOffsetHeight - keyboardOffset;\n            container.style.height = scrollViewOffsetHeight + \"px\";\n            container.style.overflow = \"visible\";\n\n            //update scroll view\n            self.resize();\n          });\n        }\n\n        self.isShrunkForKeyboard = true;\n      }\n\n      /*\n       *  _______\n       * |---A---| <- top of scroll view\n       * |   *   | <- where we want to scroll to\n       * |--B-D--| <- keyboard, bottom of scroll view\n       * |   C   | <- input\n       * |       |\n       * |___E___| <- bottom of viewport\n       *\n       *  All commented calculations relative to the top of the viewport (ie E\n       *  is the viewport height, not 0)\n       */\n      // if the element is positioned under the keyboard scroll it into view\n      if (e.detail.isElementUnderKeyboard) {\n\n        ionic.requestAnimationFrame(function(){\n          container.scrollTop = 0;\n          // update D if we shrunk\n          if (self.isShrunkForKeyboard && !alreadyShrunk) {\n            scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n          }\n\n          // middle of the scrollview, this is where we want to scroll to\n          // (D - A) / 2\n          var scrollMidpointOffset = scrollViewOffsetHeight * 0.5;\n          //console.log(\"container.offsetHeight: \" + scrollViewOffsetHeight);\n\n          // middle of the input we want to scroll into view\n          // C\n          var inputMidpoint = ((e.detail.elementBottom + e.detail.elementTop) / 2);\n\n          // distance from middle of input to the bottom of the scroll view\n          // C - D                                C               D\n          var inputMidpointOffsetToScrollBottom = inputMidpoint - scrollBottomOffsetToTop;\n\n          //C - D + (D - A)/2          C - D                     (D - A)/ 2\n          var scrollTop = inputMidpointOffsetToScrollBottom + scrollMidpointOffset;\n\n          if ( scrollTop > 0) {\n            if (ionic.Platform.isIOS()) ionic.tap.cloneFocusedInput(container, self);\n            self.scrollBy(0, scrollTop, true);\n            self.onScroll();\n          }\n        });\n      }\n\n      // Only the first scrollView parent of the element that broadcasted this event\n      // (the active element that needs to be shown) should receive this event\n      e.stopPropagation();\n    };\n\n    self.resetScrollView = function() {\n      //return scrollview to original height once keyboard has hidden\n      if ( self.isShrunkForKeyboard ) {\n        self.isShrunkForKeyboard = false;\n        container.style.height = \"\";\n        container.style.overflow = \"\";\n      }\n      self.resize();\n    };\n\n    //Broadcasted when keyboard is shown on some platforms.\n    //See js/utils/keyboard.js\n    container.addEventListener('scrollChildIntoView', self.scrollChildIntoView);\n\n    // Listen on document because container may not have had the last\n    // keyboardActiveElement, for example after closing a modal with a focused\n    // input and returning to a previously resized scroll view in an ion-content.\n    // Since we can only resize scroll views that are currently visible, just resize\n    // the current scroll view when the keyboard is closed.\n    document.addEventListener('resetScrollView', self.resetScrollView);\n\n    function getEventTouches(e) {\n      return e.touches && e.touches.length ? e.touches : [{\n        pageX: e.pageX,\n        pageY: e.pageY\n      }];\n    }\n\n    self.touchStart = function(e) {\n      self.startCoordinates = ionic.tap.pointerCoord(e);\n\n      if ( ionic.tap.ignoreScrollStart(e) ) {\n        return;\n      }\n\n      self.__isDown = true;\n\n      if ( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) {\n        // do not start if the target is a text input\n        // if there is a touchmove on this input, then we can start the scroll\n        self.__hasStarted = false;\n        return;\n      }\n\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n      self.__hasStarted = true;\n      self.doTouchStart(getEventTouches(e), e.timeStamp);\n      e.preventDefault();\n    };\n\n    self.touchMove = function(e) {\n      if (self.options.freeze || !self.__isDown ||\n        (!self.__isDown && e.defaultPrevented) ||\n        (e.target.tagName === 'TEXTAREA' && e.target.parentElement.querySelector(':focus')) ) {\n        return;\n      }\n\n      if ( !self.__hasStarted && ( ionic.tap.containsOrIsTextInput(e.target) || e.target.tagName === 'SELECT' ) ) {\n        // the target is a text input and scroll has started\n        // since the text input doesn't start on touchStart, do it here\n        self.__hasStarted = true;\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n        e.preventDefault();\n        return;\n      }\n\n      if (self.startCoordinates) {\n        // we have start coordinates, so get this touch move's current coordinates\n        var currentCoordinates = ionic.tap.pointerCoord(e);\n\n        if ( self.__isSelectable &&\n            ionic.tap.isTextInput(e.target) &&\n            Math.abs(self.startCoordinates.x - currentCoordinates.x) > 20 ) {\n          // user slid the text input's caret on its x axis, disable any future y scrolling\n          self.__enableScrollY = false;\n          self.__isSelectable = true;\n        }\n\n        if ( self.__enableScrollY && Math.abs(self.startCoordinates.y - currentCoordinates.y) > 10 ) {\n          // user scrolled the entire view on the y axis\n          // disabled being able to select text on an input\n          // hide the input which has focus, and show a cloned one that doesn't have focus\n          self.__isSelectable = false;\n          ionic.tap.cloneFocusedInput(container, self);\n        }\n      }\n\n      self.doTouchMove(getEventTouches(e), e.timeStamp, e.scale);\n      self.__isDown = true;\n    };\n\n    self.touchMoveBubble = function(e) {\n      if(self.__isDown && self.options.preventDefault) {\n        e.preventDefault();\n      }\n    };\n\n    self.touchEnd = function(e) {\n      if (!self.__isDown) return;\n\n      self.doTouchEnd(e, e.timeStamp);\n      self.__isDown = false;\n      self.__hasStarted = false;\n      self.__isSelectable = true;\n      self.__enableScrollY = true;\n\n      if ( !self.__isDragging && !self.__isDecelerating && !self.__isAnimating ) {\n        ionic.tap.removeClonedInputs(container, self);\n      }\n    };\n\n    self.mouseWheel = ionic.animationFrameThrottle(function(e) {\n      var scrollParent = ionic.DomUtil.getParentOrSelfWithClass(e.target, 'ionic-scroll');\n      if (!self.options.freeze && scrollParent === self.__container) {\n\n        self.hintResize();\n        self.scrollBy(\n          (e.wheelDeltaX || e.deltaX || 0) / self.options.wheelDampen,\n          (-e.wheelDeltaY || e.deltaY || 0) / self.options.wheelDampen\n        );\n\n        self.__fadeScrollbars('in');\n        clearTimeout(self.__wheelHideBarTimeout);\n        self.__wheelHideBarTimeout = setTimeout(function() {\n          self.__fadeScrollbars('out');\n        }, 100);\n      }\n    });\n\n    if ('ontouchstart' in window) {\n      // Touch Events\n      container.addEventListener(\"touchstart\", self.touchStart, false);\n      if(self.options.preventDefault) container.addEventListener(\"touchmove\", self.touchMoveBubble, false);\n      document.addEventListener(\"touchmove\", self.touchMove, false);\n      document.addEventListener(\"touchend\", self.touchEnd, false);\n      document.addEventListener(\"touchcancel\", self.touchEnd, false);\n      document.addEventListener(\"wheel\", self.mouseWheel, false);\n\n    } else if (window.navigator.pointerEnabled) {\n      // Pointer Events\n      container.addEventListener(\"pointerdown\", self.touchStart, false);\n      if(self.options.preventDefault) container.addEventListener(\"pointermove\", self.touchMoveBubble, false);\n      document.addEventListener(\"pointermove\", self.touchMove, false);\n      document.addEventListener(\"pointerup\", self.touchEnd, false);\n      document.addEventListener(\"pointercancel\", self.touchEnd, false);\n      document.addEventListener(\"wheel\", self.mouseWheel, false);\n\n    } else if (window.navigator.msPointerEnabled) {\n      // IE10, WP8 (Pointer Events)\n      container.addEventListener(\"MSPointerDown\", self.touchStart, false);\n      if(self.options.preventDefault) container.addEventListener(\"MSPointerMove\", self.touchMoveBubble, false);\n      document.addEventListener(\"MSPointerMove\", self.touchMove, false);\n      document.addEventListener(\"MSPointerUp\", self.touchEnd, false);\n      document.addEventListener(\"MSPointerCancel\", self.touchEnd, false);\n      document.addEventListener(\"wheel\", self.mouseWheel, false);\n\n    } else {\n      // Mouse Events\n      var mousedown = false;\n\n      self.mouseDown = function(e) {\n        if ( ionic.tap.ignoreScrollStart(e) || e.target.tagName === 'SELECT' ) {\n          return;\n        }\n        self.doTouchStart(getEventTouches(e), e.timeStamp);\n\n        if ( !ionic.tap.isTextInput(e.target) ) {\n          e.preventDefault();\n        }\n        mousedown = true;\n      };\n\n      self.mouseMove = function(e) {\n        if (self.options.freeze || !mousedown || (!mousedown && e.defaultPrevented)) {\n          return;\n        }\n\n        self.doTouchMove(getEventTouches(e), e.timeStamp);\n\n        mousedown = true;\n      };\n\n      self.mouseMoveBubble = function(e) {\n        if (mousedown && self.options.preventDefault) {\n          e.preventDefault();\n        }\n      };\n\n      self.mouseUp = function(e) {\n        if (!mousedown) {\n          return;\n        }\n\n        self.doTouchEnd(e, e.timeStamp);\n\n        mousedown = false;\n      };\n\n      container.addEventListener(\"mousedown\", self.mouseDown, false);\n      if(self.options.preventDefault) container.addEventListener(\"mousemove\", self.mouseMoveBubble, false);\n      document.addEventListener(\"mousemove\", self.mouseMove, false);\n      document.addEventListener(\"mouseup\", self.mouseUp, false);\n      document.addEventListener('mousewheel', self.mouseWheel, false);\n      document.addEventListener('wheel', self.mouseWheel, false);\n    }\n  },\n\n  __cleanup: function() {\n    var self = this;\n    var container = self.__container;\n\n    container.removeEventListener('touchstart', self.touchStart);\n    container.removeEventListener('touchmove', self.touchMoveBubble);\n    document.removeEventListener('touchmove', self.touchMove);\n    document.removeEventListener('touchend', self.touchEnd);\n    document.removeEventListener('touchcancel', self.touchEnd);\n\n    container.removeEventListener(\"pointerdown\", self.touchStart);\n    container.removeEventListener(\"pointermove\", self.touchMoveBubble);\n    document.removeEventListener(\"pointermove\", self.touchMove);\n    document.removeEventListener(\"pointerup\", self.touchEnd);\n    document.removeEventListener(\"pointercancel\", self.touchEnd);\n\n    container.removeEventListener(\"MSPointerDown\", self.touchStart);\n    container.removeEventListener(\"MSPointerMove\", self.touchMoveBubble);\n    document.removeEventListener(\"MSPointerMove\", self.touchMove);\n    document.removeEventListener(\"MSPointerUp\", self.touchEnd);\n    document.removeEventListener(\"MSPointerCancel\", self.touchEnd);\n\n    container.removeEventListener(\"mousedown\", self.mouseDown);\n    container.removeEventListener(\"mousemove\", self.mouseMoveBubble);\n    document.removeEventListener(\"mousemove\", self.mouseMove);\n    document.removeEventListener(\"mouseup\", self.mouseUp);\n    document.removeEventListener('mousewheel', self.mouseWheel);\n    document.removeEventListener('wheel', self.mouseWheel);\n\n    container.removeEventListener('scrollChildIntoView', self.scrollChildIntoView);\n    document.removeEventListener('resetScrollView', self.resetScrollView);\n\n    ionic.tap.removeClonedInputs(container, self);\n\n    delete self.__container;\n    delete self.__content;\n    delete self.__indicatorX;\n    delete self.__indicatorY;\n    delete self.options.el;\n\n    self.__callback = self.scrollChildIntoView = self.resetScrollView = NOOP;\n\n    self.mouseMove = self.mouseDown = self.mouseUp = self.mouseWheel =\n      self.touchStart = self.touchMove = self.touchEnd = self.touchCancel = NOOP;\n\n    self.resize = self.scrollTo = self.zoomTo =\n      self.__scrollingComplete = NOOP;\n    container = null;\n  },\n\n  /** Create a scroll bar div with the given direction **/\n  __createScrollbar: function(direction) {\n    var bar = document.createElement('div'),\n      indicator = document.createElement('div');\n\n    indicator.className = 'scroll-bar-indicator scroll-bar-fade-out';\n\n    if (direction == 'h') {\n      bar.className = 'scroll-bar scroll-bar-h';\n    } else {\n      bar.className = 'scroll-bar scroll-bar-v';\n    }\n\n    bar.appendChild(indicator);\n    return bar;\n  },\n\n  __createScrollbars: function() {\n    var self = this;\n    var indicatorX, indicatorY;\n\n    if (self.options.scrollingX) {\n      indicatorX = {\n        el: self.__createScrollbar('h'),\n        sizeRatio: 1\n      };\n      indicatorX.indicator = indicatorX.el.children[0];\n\n      if (self.options.scrollbarX) {\n        self.__container.appendChild(indicatorX.el);\n      }\n      self.__indicatorX = indicatorX;\n    }\n\n    if (self.options.scrollingY) {\n      indicatorY = {\n        el: self.__createScrollbar('v'),\n        sizeRatio: 1\n      };\n      indicatorY.indicator = indicatorY.el.children[0];\n\n      if (self.options.scrollbarY) {\n        self.__container.appendChild(indicatorY.el);\n      }\n      self.__indicatorY = indicatorY;\n    }\n  },\n\n  __resizeScrollbars: function() {\n    var self = this;\n\n    // Update horiz bar\n    if (self.__indicatorX) {\n      var width = Math.max(Math.round(self.__clientWidth * self.__clientWidth / (self.__contentWidth)), 20);\n      if (width > self.__contentWidth) {\n        width = 0;\n      }\n      if (width !== self.__indicatorX.size) {\n        ionic.requestAnimationFrame(function(){\n          self.__indicatorX.indicator.style.width = width + 'px';\n        });\n      }\n      self.__indicatorX.size = width;\n      self.__indicatorX.minScale = self.options.minScrollbarSizeX / width;\n      self.__indicatorX.maxPos = self.__clientWidth - width;\n      self.__indicatorX.sizeRatio = self.__maxScrollLeft ? self.__indicatorX.maxPos / self.__maxScrollLeft : 1;\n    }\n\n    // Update vert bar\n    if (self.__indicatorY) {\n      var height = Math.max(Math.round(self.__clientHeight * self.__clientHeight / (self.__contentHeight)), 20);\n      if (height > self.__contentHeight) {\n        height = 0;\n      }\n      if (height !== self.__indicatorY.size) {\n        ionic.requestAnimationFrame(function(){\n          self.__indicatorY && (self.__indicatorY.indicator.style.height = height + 'px');\n        });\n      }\n      self.__indicatorY.size = height;\n      self.__indicatorY.minScale = self.options.minScrollbarSizeY / height;\n      self.__indicatorY.maxPos = self.__clientHeight - height;\n      self.__indicatorY.sizeRatio = self.__maxScrollTop ? self.__indicatorY.maxPos / self.__maxScrollTop : 1;\n    }\n  },\n\n  /**\n   * Move and scale the scrollbars as the page scrolls.\n   */\n  __repositionScrollbars: function() {\n    var self = this,\n        heightScale, widthScale,\n        widthDiff, heightDiff,\n        x, y,\n        xstop = 0, ystop = 0;\n\n    if (self.__indicatorX) {\n      // Handle the X scrollbar\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if (self.__indicatorY) xstop = 10;\n\n      x = Math.round(self.__indicatorX.sizeRatio * self.__scrollLeft) || 0;\n\n      // The the difference between the last content X position, and our overscrolled one\n      widthDiff = self.__scrollLeft - (self.__maxScrollLeft - xstop);\n\n      if (self.__scrollLeft < 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - Math.abs(self.__scrollLeft)) / self.__indicatorX.size);\n\n        // Stay at left\n        x = 0;\n\n        // Make sure scale is transformed from the left/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'left center';\n      } else if (widthDiff > 0) {\n\n        widthScale = Math.max(self.__indicatorX.minScale,\n            (self.__indicatorX.size - widthDiff) / self.__indicatorX.size);\n\n        // Stay at the furthest x for the scrollable viewport\n        x = self.__indicatorX.maxPos - xstop;\n\n        // Make sure scale is transformed from the right/center origin point\n        self.__indicatorX.indicator.style[self.__transformOriginProperty] = 'right center';\n\n      } else {\n\n        // Normal motion\n        x = Math.min(self.__maxScrollLeft, Math.max(0, x));\n        widthScale = 1;\n\n      }\n\n      var translate3dX = 'translate3d(' + x + 'px, 0, 0) scaleX(' + widthScale + ')';\n      if (self.__indicatorX.transformProp !== translate3dX) {\n        self.__indicatorX.indicator.style[self.__transformProperty] = translate3dX;\n        self.__indicatorX.transformProp = translate3dX;\n      }\n    }\n\n    if (self.__indicatorY) {\n\n      y = Math.round(self.__indicatorY.sizeRatio * self.__scrollTop) || 0;\n\n      // Don't go all the way to the right if we have a vertical scrollbar as well\n      if (self.__indicatorX) ystop = 10;\n\n      heightDiff = self.__scrollTop - (self.__maxScrollTop - ystop);\n\n      if (self.__scrollTop < 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - Math.abs(self.__scrollTop)) / self.__indicatorY.size);\n\n        // Stay at top\n        y = 0;\n\n        // Make sure scale is transformed from the center/top origin point\n        if (self.__indicatorY.originProp !== 'center top') {\n          self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center top';\n          self.__indicatorY.originProp = 'center top';\n        }\n\n      } else if (heightDiff > 0) {\n\n        heightScale = Math.max(self.__indicatorY.minScale, (self.__indicatorY.size - heightDiff) / self.__indicatorY.size);\n\n        // Stay at bottom of scrollable viewport\n        y = self.__indicatorY.maxPos - ystop;\n\n        // Make sure scale is transformed from the center/bottom origin point\n        if (self.__indicatorY.originProp !== 'center bottom') {\n          self.__indicatorY.indicator.style[self.__transformOriginProperty] = 'center bottom';\n          self.__indicatorY.originProp = 'center bottom';\n        }\n\n      } else {\n\n        // Normal motion\n        y = Math.min(self.__maxScrollTop, Math.max(0, y));\n        heightScale = 1;\n\n      }\n\n      var translate3dY = 'translate3d(0,' + y + 'px, 0) scaleY(' + heightScale + ')';\n      if (self.__indicatorY.transformProp !== translate3dY) {\n        self.__indicatorY.indicator.style[self.__transformProperty] = translate3dY;\n        self.__indicatorY.transformProp = translate3dY;\n      }\n    }\n  },\n\n  __fadeScrollbars: function(direction, delay) {\n    var self = this;\n\n    if (!self.options.scrollbarsFade) {\n      return;\n    }\n\n    var className = 'scroll-bar-fade-out';\n\n    if (self.options.scrollbarsFade === true) {\n      clearTimeout(self.__scrollbarFadeTimeout);\n\n      if (direction == 'in') {\n        if (self.__indicatorX) { self.__indicatorX.indicator.classList.remove(className); }\n        if (self.__indicatorY) { self.__indicatorY.indicator.classList.remove(className); }\n      } else {\n        self.__scrollbarFadeTimeout = setTimeout(function() {\n          if (self.__indicatorX) { self.__indicatorX.indicator.classList.add(className); }\n          if (self.__indicatorY) { self.__indicatorY.indicator.classList.add(className); }\n        }, delay || self.options.scrollbarFadeDelay);\n      }\n    }\n  },\n\n  __scrollingComplete: function() {\n    this.options.scrollingComplete();\n    ionic.tap.removeClonedInputs(this.__container, this);\n    this.__fadeScrollbars('out');\n  },\n\n  resize: function(continueScrolling) {\n    var self = this;\n    if (!self.__container || !self.options) return;\n\n    // Update Scroller dimensions for changed content\n    // Add padding to bottom of content\n    self.setDimensions(\n      self.__container.clientWidth,\n      self.__container.clientHeight,\n      self.options.getContentWidth(),\n      self.options.getContentHeight(),\n      continueScrolling\n    );\n  },\n  /*\n  ---------------------------------------------------------------------------\n    PUBLIC API\n  ---------------------------------------------------------------------------\n  */\n\n  getRenderFn: function() {\n    var self = this;\n\n    var content = self.__content;\n\n    var docStyle = document.documentElement.style;\n\n    var engine;\n    if ('MozAppearance' in docStyle) {\n      engine = 'gecko';\n    } else if ('WebkitAppearance' in docStyle) {\n      engine = 'webkit';\n    } else if (typeof navigator.cpuClass === 'string') {\n      engine = 'trident';\n    }\n\n    var vendorPrefix = {\n      trident: 'ms',\n      gecko: 'Moz',\n      webkit: 'Webkit',\n      presto: 'O'\n    }[engine];\n\n    var helperElem = document.createElement(\"div\");\n    var undef;\n\n    var perspectiveProperty = vendorPrefix + \"Perspective\";\n    var transformProperty = vendorPrefix + \"Transform\";\n    var transformOriginProperty = vendorPrefix + 'TransformOrigin';\n\n    self.__perspectiveProperty = transformProperty;\n    self.__transformProperty = transformProperty;\n    self.__transformOriginProperty = transformOriginProperty;\n\n    if (helperElem.style[perspectiveProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        var translate3d = 'translate3d(' + (-left) + 'px,' + (-top) + 'px,0) scale(' + zoom + ')';\n        if (translate3d !== self.contentTransform) {\n          content.style[transformProperty] = translate3d;\n          self.contentTransform = translate3d;\n        }\n        self.__repositionScrollbars();\n        if (!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else if (helperElem.style[transformProperty] !== undef) {\n\n      return function(left, top, zoom, wasResize) {\n        content.style[transformProperty] = 'translate(' + (-left) + 'px,' + (-top) + 'px) scale(' + zoom + ')';\n        self.__repositionScrollbars();\n        if (!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    } else {\n\n      return function(left, top, zoom, wasResize) {\n        content.style.marginLeft = left ? (-left / zoom) + 'px' : '';\n        content.style.marginTop = top ? (-top / zoom) + 'px' : '';\n        content.style.zoom = zoom || '';\n        self.__repositionScrollbars();\n        if (!wasResize) {\n          self.triggerScrollEvent();\n        }\n      };\n\n    }\n  },\n\n\n  /**\n   * Configures the dimensions of the client (outer) and content (inner) elements.\n   * Requires the available space for the outer element and the outer size of the inner element.\n   * All values which are falsy (null or zero etc.) are ignored and the old value is kept.\n   *\n   * @param clientWidth {Integer} Inner width of outer element\n   * @param clientHeight {Integer} Inner height of outer element\n   * @param contentWidth {Integer} Outer width of inner element\n   * @param contentHeight {Integer} Outer height of inner element\n   */\n  setDimensions: function(clientWidth, clientHeight, contentWidth, contentHeight, continueScrolling) {\n    var self = this;\n\n    if (!clientWidth && !clientHeight && !contentWidth && !contentHeight) {\n      // this scrollview isn't rendered, don't bother\n      return;\n    }\n\n    // Only update values which are defined\n    if (clientWidth === +clientWidth) {\n      self.__clientWidth = clientWidth;\n    }\n\n    if (clientHeight === +clientHeight) {\n      self.__clientHeight = clientHeight;\n    }\n\n    if (contentWidth === +contentWidth) {\n      self.__contentWidth = contentWidth;\n    }\n\n    if (contentHeight === +contentHeight) {\n      self.__contentHeight = contentHeight;\n    }\n\n    // Refresh maximums\n    self.__computeScrollMax();\n    self.__resizeScrollbars();\n\n    // Refresh scroll position\n    if (!continueScrolling) {\n      self.scrollTo(self.__scrollLeft, self.__scrollTop, true, null, true);\n    }\n\n  },\n\n\n  /**\n   * Sets the client coordinates in relation to the document.\n   *\n   * @param left {Integer} Left position of outer element\n   * @param top {Integer} Top position of outer element\n   */\n  setPosition: function(left, top) {\n    this.__clientLeft = left || 0;\n    this.__clientTop = top || 0;\n  },\n\n\n  /**\n   * Configures the snapping (when snapping is active)\n   *\n   * @param width {Integer} Snapping width\n   * @param height {Integer} Snapping height\n   */\n  setSnapSize: function(width, height) {\n    this.__snapWidth = width;\n    this.__snapHeight = height;\n  },\n\n\n  /**\n   * Activates pull-to-refresh. A special zone on the top of the list to start a list refresh whenever\n   * the user event is released during visibility of this zone. This was introduced by some apps on iOS like\n   * the official Twitter client.\n   *\n   * @param height {Integer} Height of pull-to-refresh zone on top of rendered list\n   * @param activateCallback {Function} Callback to execute on activation. This is for signalling the user about a refresh is about to happen when he release.\n   * @param deactivateCallback {Function} Callback to execute on deactivation. This is for signalling the user about the refresh being cancelled.\n   * @param startCallback {Function} Callback to execute to start the real async refresh action. Call {@link #finishPullToRefresh} after finish of refresh.\n   * @param showCallback {Function} Callback to execute when the refresher should be shown. This is for showing the refresher during a negative scrollTop.\n   * @param hideCallback {Function} Callback to execute when the refresher should be hidden. This is for hiding the refresher when it's behind the nav bar.\n   * @param tailCallback {Function} Callback to execute just before the refresher returns to it's original state. This is for zooming out the refresher.\n   * @param pullProgressCallback Callback to state the progress while pulling to refresh\n   */\n  activatePullToRefresh: function(height, refresherMethods) {\n    var self = this;\n\n    self.__refreshHeight = height;\n    self.__refreshActivate = function() { ionic.requestAnimationFrame(refresherMethods.activate); };\n    self.__refreshDeactivate = function() { ionic.requestAnimationFrame(refresherMethods.deactivate); };\n    self.__refreshStart = function() { ionic.requestAnimationFrame(refresherMethods.start); };\n    self.__refreshShow = function() { ionic.requestAnimationFrame(refresherMethods.show); };\n    self.__refreshHide = function() { ionic.requestAnimationFrame(refresherMethods.hide); };\n    self.__refreshTail = function() { ionic.requestAnimationFrame(refresherMethods.tail); };\n    self.__refreshTailTime = 100;\n    self.__minSpinTime = 600;\n  },\n\n\n  /**\n   * Starts pull-to-refresh manually.\n   */\n  triggerPullToRefresh: function() {\n    // Use publish instead of scrollTo to allow scrolling to out of boundary position\n    // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n    this.__publish(this.__scrollLeft, -this.__refreshHeight, this.__zoomLevel, true);\n\n    var d = new Date();\n    this.refreshStartTime = d.getTime();\n\n    if (this.__refreshStart) {\n      this.__refreshStart();\n    }\n  },\n\n\n  /**\n   * Signalizes that pull-to-refresh is finished.\n   */\n  finishPullToRefresh: function() {\n    var self = this;\n    // delay to make sure the spinner has a chance to spin for a split second before it's dismissed\n    var d = new Date();\n    var delay = 0;\n    if (self.refreshStartTime + self.__minSpinTime > d.getTime()) {\n      delay = self.refreshStartTime + self.__minSpinTime - d.getTime();\n    }\n    setTimeout(function() {\n      if (self.__refreshTail) {\n        self.__refreshTail();\n      }\n      setTimeout(function() {\n        self.__refreshActive = false;\n        if (self.__refreshDeactivate) {\n          self.__refreshDeactivate();\n        }\n        if (self.__refreshHide) {\n          self.__refreshHide();\n        }\n\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, true);\n      }, self.__refreshTailTime);\n    }, delay);\n  },\n\n\n  /**\n   * Returns the scroll position and zooming values\n   *\n   * @return {Map} `left` and `top` scroll position and `zoom` level\n   */\n  getValues: function() {\n    return {\n      left: this.__scrollLeft,\n      top: this.__scrollTop,\n      zoom: this.__zoomLevel\n    };\n  },\n\n\n  /**\n   * Returns the maximum scroll values\n   *\n   * @return {Map} `left` and `top` maximum scroll values\n   */\n  getScrollMax: function() {\n    return {\n      left: this.__maxScrollLeft,\n      top: this.__maxScrollTop\n    };\n  },\n\n\n  /**\n   * Zooms to the given level. Supports optional animation. Zooms\n   * the center when no coordinates are given.\n   *\n   * @param level {Number} Level to zoom to\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomTo: function(level, animate, originLeft, originTop) {\n    var self = this;\n\n    if (!self.options.zooming) {\n      throw new Error(\"Zooming is not enabled!\");\n    }\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    var oldLevel = self.__zoomLevel;\n\n    // Normalize input origin to center of viewport if not defined\n    if (originLeft == null) {\n      originLeft = self.__clientWidth / 2;\n    }\n\n    if (originTop == null) {\n      originTop = self.__clientHeight / 2;\n    }\n\n    // Limit level according to configuration\n    level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n    // Recompute maximum values while temporary tweaking maximum scroll ranges\n    self.__computeScrollMax(level);\n\n    // Recompute left and top coordinates based on new zoom level\n    var left = ((originLeft + self.__scrollLeft) * level / oldLevel) - originLeft;\n    var top = ((originTop + self.__scrollTop) * level / oldLevel) - originTop;\n\n    // Limit x-axis\n    if (left > self.__maxScrollLeft) {\n      left = self.__maxScrollLeft;\n    } else if (left < 0) {\n      left = 0;\n    }\n\n    // Limit y-axis\n    if (top > self.__maxScrollTop) {\n      top = self.__maxScrollTop;\n    } else if (top < 0) {\n      top = 0;\n    }\n\n    // Push values out\n    self.__publish(left, top, level, animate);\n\n  },\n\n\n  /**\n   * Zooms the content by the given factor.\n   *\n   * @param factor {Number} Zoom by given factor\n   * @param animate {Boolean} Whether to use animation\n   * @param originLeft {Number} Zoom in at given left coordinate\n   * @param originTop {Number} Zoom in at given top coordinate\n   */\n  zoomBy: function(factor, animate, originLeft, originTop) {\n    this.zoomTo(this.__zoomLevel * factor, animate, originLeft, originTop);\n  },\n\n\n  /**\n   * Scrolls to the given position. Respect limitations and snapping automatically.\n   *\n   * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n   * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n   * @param animate {Boolean} Whether the scrolling should happen using an animation\n   * @param zoom {Number} Zoom level to go to\n   */\n  scrollTo: function(left, top, animate, zoom, wasResize) {\n    var self = this;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n    }\n\n    // Correct coordinates based on new zoom level\n    if (zoom != null && zoom !== self.__zoomLevel) {\n\n      if (!self.options.zooming) {\n        throw new Error(\"Zooming is not enabled!\");\n      }\n\n      left *= zoom;\n      top *= zoom;\n\n      // Recompute maximum values while temporary tweaking maximum scroll ranges\n      self.__computeScrollMax(zoom);\n\n    } else {\n\n      // Keep zoom when not defined\n      zoom = self.__zoomLevel;\n\n    }\n\n    if (!self.options.scrollingX) {\n\n      left = self.__scrollLeft;\n\n    } else {\n\n      if (self.options.paging) {\n        left = Math.round(left / self.__clientWidth) * self.__clientWidth;\n      } else if (self.options.snapping) {\n        left = Math.round(left / self.__snapWidth) * self.__snapWidth;\n      }\n\n    }\n\n    if (!self.options.scrollingY) {\n\n      top = self.__scrollTop;\n\n    } else {\n\n      if (self.options.paging) {\n        top = Math.round(top / self.__clientHeight) * self.__clientHeight;\n      } else if (self.options.snapping) {\n        top = Math.round(top / self.__snapHeight) * self.__snapHeight;\n      }\n\n    }\n\n    // Limit for allowed ranges\n    left = Math.max(Math.min(self.__maxScrollLeft, left), 0);\n    top = Math.max(Math.min(self.__maxScrollTop, top), 0);\n\n    // Don't animate when no change detected, still call publish to make sure\n    // that rendered position is really in-sync with internal data\n    if (left === self.__scrollLeft && top === self.__scrollTop) {\n      animate = false;\n    }\n\n    // Publish new values\n    self.__publish(left, top, zoom, animate, wasResize);\n\n  },\n\n\n  /**\n   * Scroll by the given offset\n   *\n   * @param left {Number} Scroll x-axis by given offset\n   * @param top {Number} Scroll y-axis by given offset\n   * @param animate {Boolean} Whether to animate the given change\n   */\n  scrollBy: function(left, top, animate) {\n    var self = this;\n\n    var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft;\n    var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop;\n\n    self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate);\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    EVENT CALLBACKS\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Mouse wheel handler for zooming support\n   */\n  doMouseZoom: function(wheelDelta, timeStamp, pageX, pageY) {\n    var change = wheelDelta > 0 ? 0.97 : 1.03;\n    return this.zoomTo(this.__zoomLevel * change, false, pageX - this.__clientLeft, pageY - this.__clientTop);\n  },\n\n  /**\n   * Touch start handler for scrolling support\n   */\n  doTouchStart: function(touches, timeStamp) {\n    var self = this;\n\n    // remember if the deceleration was just stopped\n    self.__decStopped = !!(self.__isDecelerating || self.__isAnimating);\n\n    self.hintResize();\n\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    // Reset interruptedAnimation flag\n    self.__interruptedAnimation = true;\n\n    // Stop deceleration\n    if (self.__isDecelerating) {\n      zyngaCore.effect.Animate.stop(self.__isDecelerating);\n      self.__isDecelerating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Stop animation\n    if (self.__isAnimating) {\n      zyngaCore.effect.Animate.stop(self.__isAnimating);\n      self.__isAnimating = false;\n      self.__interruptedAnimation = true;\n    }\n\n    // Use center point when dealing with two fingers\n    var currentTouchLeft, currentTouchTop;\n    var isSingleTouch = touches.length === 1;\n    if (isSingleTouch) {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    } else {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n    }\n\n    // Store initial positions\n    self.__initialTouchLeft = currentTouchLeft;\n    self.__initialTouchTop = currentTouchTop;\n\n    // Store initial touchList for scale calculation\n    self.__initialTouches = touches;\n\n    // Store current zoom level\n    self.__zoomLevelStart = self.__zoomLevel;\n\n    // Store initial touch positions\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n\n    // Store initial move time stamp\n    self.__lastTouchMove = timeStamp;\n\n    // Reset initial scale\n    self.__lastScale = 1;\n\n    // Reset locking flags\n    self.__enableScrollX = !isSingleTouch && self.options.scrollingX;\n    self.__enableScrollY = !isSingleTouch && self.options.scrollingY;\n\n    // Reset tracking flag\n    self.__isTracking = true;\n\n    // Reset deceleration complete flag\n    self.__didDecelerationComplete = false;\n\n    // Dragging starts directly with two fingers, otherwise lazy with an offset\n    self.__isDragging = !isSingleTouch;\n\n    // Some features are disabled in multi touch scenarios\n    self.__isSingleTouch = isSingleTouch;\n\n    // Clearing data structure\n    self.__positions = [];\n\n  },\n\n\n  /**\n   * Touch move handler for scrolling support\n   */\n  doTouchMove: function(touches, timeStamp, scale) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (event might be outside of element)\n    if (!self.__isTracking) {\n      return;\n    }\n\n    var currentTouchLeft, currentTouchTop;\n\n    // Compute move based around of center of fingers\n    if (touches.length === 2) {\n      currentTouchLeft = Math.abs(touches[0].pageX + touches[1].pageX) / 2;\n      currentTouchTop = Math.abs(touches[0].pageY + touches[1].pageY) / 2;\n\n      // Calculate scale when not present and only when touches are used\n      if (!scale && self.options.zooming) {\n        scale = self.__getScale(self.__initialTouches, touches);\n      }\n    } else {\n      currentTouchLeft = touches[0].pageX;\n      currentTouchTop = touches[0].pageY;\n    }\n\n    var positions = self.__positions;\n\n    // Are we already is dragging mode?\n    if (self.__isDragging) {\n        self.__decStopped = false;\n\n      // Compute move distance\n      var moveX = currentTouchLeft - self.__lastTouchLeft;\n      var moveY = currentTouchTop - self.__lastTouchTop;\n\n      // Read previous scroll position and zooming\n      var scrollLeft = self.__scrollLeft;\n      var scrollTop = self.__scrollTop;\n      var level = self.__zoomLevel;\n\n      // Work with scaling\n      if (scale != null && self.options.zooming) {\n\n        var oldLevel = level;\n\n        // Recompute level based on previous scale and new scale\n        level = level / self.__lastScale * scale;\n\n        // Limit level according to configuration\n        level = Math.max(Math.min(level, self.options.maxZoom), self.options.minZoom);\n\n        // Only do further compution when change happened\n        if (oldLevel !== level) {\n\n          // Compute relative event position to container\n          var currentTouchLeftRel = currentTouchLeft - self.__clientLeft;\n          var currentTouchTopRel = currentTouchTop - self.__clientTop;\n\n          // Recompute left and top coordinates based on new zoom level\n          scrollLeft = ((currentTouchLeftRel + scrollLeft) * level / oldLevel) - currentTouchLeftRel;\n          scrollTop = ((currentTouchTopRel + scrollTop) * level / oldLevel) - currentTouchTopRel;\n\n          // Recompute max scroll values\n          self.__computeScrollMax(level);\n\n        }\n      }\n\n      if (self.__enableScrollX) {\n\n        scrollLeft -= moveX * self.options.speedMultiplier;\n        var maxScrollLeft = self.__maxScrollLeft;\n\n        if (scrollLeft > maxScrollLeft || scrollLeft < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing) {\n\n            scrollLeft += (moveX / 2 * self.options.speedMultiplier);\n\n          } else if (scrollLeft > maxScrollLeft) {\n\n            scrollLeft = maxScrollLeft;\n\n          } else {\n\n            scrollLeft = 0;\n\n          }\n        }\n      }\n\n      // Compute new vertical scroll position\n      if (self.__enableScrollY) {\n\n        scrollTop -= moveY * self.options.speedMultiplier;\n        var maxScrollTop = self.__maxScrollTop;\n\n        if (scrollTop > maxScrollTop || scrollTop < 0) {\n\n          // Slow down on the edges\n          if (self.options.bouncing || (self.__refreshHeight && scrollTop < 0)) {\n\n            scrollTop += (moveY / 2 * self.options.speedMultiplier);\n\n            // Support pull-to-refresh (only when only y is scrollable)\n            if (!self.__enableScrollX && self.__refreshHeight != null) {\n\n              // hide the refresher when it's behind the header bar in case of header transparency\n              if (scrollTop < 0) {\n                self.__refreshHidden = false;\n                self.__refreshShow();\n              } else {\n                self.__refreshHide();\n                self.__refreshHidden = true;\n              }\n\n              if (!self.__refreshActive && scrollTop <= -self.__refreshHeight) {\n\n                self.__refreshActive = true;\n                if (self.__refreshActivate) {\n                  self.__refreshActivate();\n                }\n\n              } else if (self.__refreshActive && scrollTop > -self.__refreshHeight) {\n\n                self.__refreshActive = false;\n                if (self.__refreshDeactivate) {\n                  self.__refreshDeactivate();\n                }\n\n              }\n            }\n\n          } else if (scrollTop > maxScrollTop) {\n\n            scrollTop = maxScrollTop;\n\n          } else {\n\n            scrollTop = 0;\n\n          }\n        } else if (self.__refreshHeight && !self.__refreshHidden) {\n          // if a positive scroll value and the refresher is still not hidden, hide it\n          self.__refreshHide();\n          self.__refreshHidden = true;\n        }\n      }\n\n      // Keep list from growing infinitely (holding min 10, max 20 measure points)\n      if (positions.length > 60) {\n        positions.splice(0, 30);\n      }\n\n      // Track scroll movement for decleration\n      positions.push(scrollLeft, scrollTop, timeStamp);\n\n      // Sync scroll position\n      self.__publish(scrollLeft, scrollTop, level);\n\n    // Otherwise figure out whether we are switching into dragging mode now.\n    } else {\n\n      var minimumTrackingForScroll = self.options.locking ? 3 : 0;\n      var minimumTrackingForDrag = 5;\n\n      var distanceX = Math.abs(currentTouchLeft - self.__initialTouchLeft);\n      var distanceY = Math.abs(currentTouchTop - self.__initialTouchTop);\n\n      self.__enableScrollX = self.options.scrollingX && distanceX >= minimumTrackingForScroll;\n      self.__enableScrollY = self.options.scrollingY && distanceY >= minimumTrackingForScroll;\n\n      positions.push(self.__scrollLeft, self.__scrollTop, timeStamp);\n\n      self.__isDragging = (self.__enableScrollX || self.__enableScrollY) && (distanceX >= minimumTrackingForDrag || distanceY >= minimumTrackingForDrag);\n      if (self.__isDragging) {\n        self.__interruptedAnimation = false;\n        self.__fadeScrollbars('in');\n      }\n\n    }\n\n    // Update last touch positions and time stamp for next event\n    self.__lastTouchLeft = currentTouchLeft;\n    self.__lastTouchTop = currentTouchTop;\n    self.__lastTouchMove = timeStamp;\n    self.__lastScale = scale;\n\n  },\n\n\n  /**\n   * Touch end handler for scrolling support\n   */\n  doTouchEnd: function(e, timeStamp) {\n    if (timeStamp instanceof Date) {\n      timeStamp = timeStamp.valueOf();\n    }\n    if (typeof timeStamp !== \"number\") {\n      timeStamp = Date.now();\n    }\n\n    var self = this;\n\n    // Ignore event when tracking is not enabled (no touchstart event on element)\n    // This is required as this listener ('touchmove') sits on the document and not on the element itself.\n    if (!self.__isTracking) {\n      return;\n    }\n\n    // Not touching anymore (when two finger hit the screen there are two touch end events)\n    self.__isTracking = false;\n\n    // Be sure to reset the dragging flag now. Here we also detect whether\n    // the finger has moved fast enough to switch into a deceleration animation.\n    if (self.__isDragging) {\n\n      // Reset dragging flag\n      self.__isDragging = false;\n\n      // Start deceleration\n      // Verify that the last move detected was in some relevant time frame\n      if (self.__isSingleTouch && self.options.animating && (timeStamp - self.__lastTouchMove) <= 100) {\n\n        // Then figure out what the scroll position was about 100ms ago\n        var positions = self.__positions;\n        var endPos = positions.length - 1;\n        var startPos = endPos;\n\n        // Move pointer to position measured 100ms ago\n        for (var i = endPos; i > 0 && positions[i] > (self.__lastTouchMove - 100); i -= 3) {\n          startPos = i;\n        }\n\n        // If start and stop position is identical in a 100ms timeframe,\n        // we cannot compute any useful deceleration.\n        if (startPos !== endPos) {\n\n          // Compute relative movement between these two points\n          var timeOffset = positions[endPos] - positions[startPos];\n          var movedLeft = self.__scrollLeft - positions[startPos - 2];\n          var movedTop = self.__scrollTop - positions[startPos - 1];\n\n          // Based on 50ms compute the movement to apply for each render step\n          self.__decelerationVelocityX = movedLeft / timeOffset * (1000 / 60);\n          self.__decelerationVelocityY = movedTop / timeOffset * (1000 / 60);\n\n          // How much velocity is required to start the deceleration\n          var minVelocityToStartDeceleration = self.options.paging || self.options.snapping ? self.options.decelVelocityThresholdPaging : self.options.decelVelocityThreshold;\n\n          // Verify that we have enough velocity to start deceleration\n          if (Math.abs(self.__decelerationVelocityX) > minVelocityToStartDeceleration || Math.abs(self.__decelerationVelocityY) > minVelocityToStartDeceleration) {\n\n            // Deactivate pull-to-refresh when decelerating\n            if (!self.__refreshActive) {\n              self.__startDeceleration(timeStamp);\n            }\n          }\n        } else {\n          self.__scrollingComplete();\n        }\n      } else if ((timeStamp - self.__lastTouchMove) > 100) {\n        self.__scrollingComplete();\n      }\n\n    } else if (self.__decStopped) {\n      // the deceleration was stopped\n      // user flicked the scroll fast, and stop dragging, then did a touchstart to stop the srolling\n      // tell the touchend event code to do nothing, we don't want to actually send a click\n      e.isTapHandled = true;\n      self.__decStopped = false;\n    }\n\n    // If this was a slower move it is per default non decelerated, but this\n    // still means that we want snap back to the bounds which is done here.\n    // This is placed outside the condition above to improve edge case stability\n    // e.g. touchend fired without enabled dragging. This should normally do not\n    // have modified the scroll positions or even showed the scrollbars though.\n    if (!self.__isDecelerating) {\n\n      if (self.__refreshActive && self.__refreshStart) {\n\n        // Use publish instead of scrollTo to allow scrolling to out of boundary position\n        // We don't need to normalize scrollLeft, zoomLevel, etc. here because we only y-scrolling when pull-to-refresh is enabled\n        self.__publish(self.__scrollLeft, -self.__refreshHeight, self.__zoomLevel, true);\n\n        var d = new Date();\n        self.refreshStartTime = d.getTime();\n\n        if (self.__refreshStart) {\n          self.__refreshStart();\n        }\n        // for iOS-ey style scrolling\n        if (!ionic.Platform.isAndroid())self.__startDeceleration();\n      } else {\n\n        if (self.__interruptedAnimation || self.__isDragging) {\n          self.__scrollingComplete();\n        }\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, true, self.__zoomLevel);\n\n        // Directly signalize deactivation (nothing todo on refresh?)\n        if (self.__refreshActive) {\n\n          self.__refreshActive = false;\n          if (self.__refreshDeactivate) {\n            self.__refreshDeactivate();\n          }\n\n        }\n      }\n    }\n\n    // Fully cleanup list\n    self.__positions.length = 0;\n\n  },\n\n\n\n  /*\n  ---------------------------------------------------------------------------\n    PRIVATE API\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Applies the scroll position to the content element\n   *\n   * @param left {Number} Left scroll position\n   * @param top {Number} Top scroll position\n   * @param animate {Boolean} Whether animation should be used to move to the new coordinates\n   */\n  __publish: function(left, top, zoom, animate, wasResize) {\n\n    var self = this;\n\n    // Remember whether we had an animation, then we try to continue based on the current \"drive\" of the animation\n    var wasAnimating = self.__isAnimating;\n    if (wasAnimating) {\n      zyngaCore.effect.Animate.stop(wasAnimating);\n      self.__isAnimating = false;\n    }\n\n    if (animate && self.options.animating) {\n\n      // Keep scheduled positions for scrollBy/zoomBy functionality\n      self.__scheduledLeft = left;\n      self.__scheduledTop = top;\n      self.__scheduledZoom = zoom;\n\n      var oldLeft = self.__scrollLeft;\n      var oldTop = self.__scrollTop;\n      var oldZoom = self.__zoomLevel;\n\n      var diffLeft = left - oldLeft;\n      var diffTop = top - oldTop;\n      var diffZoom = zoom - oldZoom;\n\n      var step = function(percent, now, render) {\n\n        if (render) {\n\n          self.__scrollLeft = oldLeft + (diffLeft * percent);\n          self.__scrollTop = oldTop + (diffTop * percent);\n          self.__zoomLevel = oldZoom + (diffZoom * percent);\n\n          // Push values out\n          if (self.__callback) {\n            self.__callback(self.__scrollLeft, self.__scrollTop, self.__zoomLevel, wasResize);\n          }\n\n        }\n      };\n\n      var verify = function(id) {\n        return self.__isAnimating === id;\n      };\n\n      var completed = function(renderedFramesPerSecond, animationId, wasFinished) {\n        if (animationId === self.__isAnimating) {\n          self.__isAnimating = false;\n        }\n        if (self.__didDecelerationComplete || wasFinished) {\n          self.__scrollingComplete();\n        }\n\n        if (self.options.zooming) {\n          self.__computeScrollMax();\n        }\n      };\n\n      // When continuing based on previous animation we choose an ease-out animation instead of ease-in-out\n      self.__isAnimating = zyngaCore.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic);\n\n    } else {\n\n      self.__scheduledLeft = self.__scrollLeft = left;\n      self.__scheduledTop = self.__scrollTop = top;\n      self.__scheduledZoom = self.__zoomLevel = zoom;\n\n      // Push values out\n      if (self.__callback) {\n        self.__callback(left, top, zoom, wasResize);\n      }\n\n      // Fix max scroll ranges\n      if (self.options.zooming) {\n        self.__computeScrollMax();\n      }\n    }\n  },\n\n\n  /**\n   * Recomputes scroll minimum values based on client dimensions and content dimensions.\n   */\n  __computeScrollMax: function(zoomLevel) {\n    var self = this;\n\n    if (zoomLevel == null) {\n      zoomLevel = self.__zoomLevel;\n    }\n\n    self.__maxScrollLeft = Math.max((self.__contentWidth * zoomLevel) - self.__clientWidth, 0);\n    self.__maxScrollTop = Math.max((self.__contentHeight * zoomLevel) - self.__clientHeight, 0);\n\n    if (!self.__didWaitForSize && !self.__maxScrollLeft && !self.__maxScrollTop) {\n      self.__didWaitForSize = true;\n      self.__waitForSize();\n    }\n  },\n\n\n  /**\n   * If the scroll view isn't sized correctly on start, wait until we have at least some size\n   */\n  __waitForSize: function() {\n    var self = this;\n\n    clearTimeout(self.__sizerTimeout);\n\n    var sizer = function() {\n      self.resize(true);\n    };\n\n    sizer();\n    self.__sizerTimeout = setTimeout(sizer, 500);\n  },\n\n  /*\n  ---------------------------------------------------------------------------\n    ANIMATION (DECELERATION) SUPPORT\n  ---------------------------------------------------------------------------\n  */\n\n  /**\n   * Called when a touch sequence end and the speed of the finger was high enough\n   * to switch into deceleration mode.\n   */\n  __startDeceleration: function() {\n    var self = this;\n\n    if (self.options.paging) {\n\n      var scrollLeft = Math.max(Math.min(self.__scrollLeft, self.__maxScrollLeft), 0);\n      var scrollTop = Math.max(Math.min(self.__scrollTop, self.__maxScrollTop), 0);\n      var clientWidth = self.__clientWidth;\n      var clientHeight = self.__clientHeight;\n\n      // We limit deceleration not to the min/max values of the allowed range, but to the size of the visible client area.\n      // Each page should have exactly the size of the client area.\n      self.__minDecelerationScrollLeft = Math.floor(scrollLeft / clientWidth) * clientWidth;\n      self.__minDecelerationScrollTop = Math.floor(scrollTop / clientHeight) * clientHeight;\n      self.__maxDecelerationScrollLeft = Math.ceil(scrollLeft / clientWidth) * clientWidth;\n      self.__maxDecelerationScrollTop = Math.ceil(scrollTop / clientHeight) * clientHeight;\n\n    } else {\n\n      self.__minDecelerationScrollLeft = 0;\n      self.__minDecelerationScrollTop = 0;\n      self.__maxDecelerationScrollLeft = self.__maxScrollLeft;\n      self.__maxDecelerationScrollTop = self.__maxScrollTop;\n      if (self.__refreshActive) self.__minDecelerationScrollTop = self.__refreshHeight * -1;\n    }\n\n    // Wrap class method\n    var step = function(percent, now, render) {\n      self.__stepThroughDeceleration(render);\n    };\n\n    // How much velocity is required to keep the deceleration running\n    self.__minVelocityToKeepDecelerating = self.options.snapping ? 4 : 0.1;\n\n    // Detect whether it's still worth to continue animating steps\n    // If we are already slow enough to not being user perceivable anymore, we stop the whole process here.\n    var verify = function() {\n      var shouldContinue = Math.abs(self.__decelerationVelocityX) >= self.__minVelocityToKeepDecelerating ||\n        Math.abs(self.__decelerationVelocityY) >= self.__minVelocityToKeepDecelerating;\n      if (!shouldContinue) {\n        self.__didDecelerationComplete = true;\n\n        //Make sure the scroll values are within the boundaries after a bounce,\n        //not below 0 or above maximum\n        if (self.options.bouncing && !self.__refreshActive) {\n          self.scrollTo(\n            Math.min( Math.max(self.__scrollLeft, 0), self.__maxScrollLeft ),\n            Math.min( Math.max(self.__scrollTop, 0), self.__maxScrollTop ),\n            self.__refreshActive\n          );\n        }\n      }\n      return shouldContinue;\n    };\n\n    var completed = function() {\n      self.__isDecelerating = false;\n      if (self.__didDecelerationComplete) {\n        self.__scrollingComplete();\n      }\n\n      // Animate to grid when snapping is active, otherwise just fix out-of-boundary positions\n      if (self.options.paging) {\n        self.scrollTo(self.__scrollLeft, self.__scrollTop, self.options.snapping);\n      }\n    };\n\n    // Start animation and switch on flag\n    self.__isDecelerating = zyngaCore.effect.Animate.start(step, verify, completed);\n\n  },\n\n\n  /**\n   * Called on every step of the animation\n   *\n   * @param inMemory {Boolean} Whether to not render the current step, but keep it in memory only. Used internally only!\n   */\n  __stepThroughDeceleration: function(render) {\n    var self = this;\n\n\n    //\n    // COMPUTE NEXT SCROLL POSITION\n    //\n\n    // Add deceleration to scroll position\n    var scrollLeft = self.__scrollLeft + self.__decelerationVelocityX;// * self.options.deceleration);\n    var scrollTop = self.__scrollTop + self.__decelerationVelocityY;// * self.options.deceleration);\n\n\n    //\n    // HARD LIMIT SCROLL POSITION FOR NON BOUNCING MODE\n    //\n\n    if (!self.options.bouncing) {\n\n      var scrollLeftFixed = Math.max(Math.min(self.__maxDecelerationScrollLeft, scrollLeft), self.__minDecelerationScrollLeft);\n      if (scrollLeftFixed !== scrollLeft) {\n        scrollLeft = scrollLeftFixed;\n        self.__decelerationVelocityX = 0;\n      }\n\n      var scrollTopFixed = Math.max(Math.min(self.__maxDecelerationScrollTop, scrollTop), self.__minDecelerationScrollTop);\n      if (scrollTopFixed !== scrollTop) {\n        scrollTop = scrollTopFixed;\n        self.__decelerationVelocityY = 0;\n      }\n\n    }\n\n\n    //\n    // UPDATE SCROLL POSITION\n    //\n\n    if (render) {\n\n      self.__publish(scrollLeft, scrollTop, self.__zoomLevel);\n\n    } else {\n\n      self.__scrollLeft = scrollLeft;\n      self.__scrollTop = scrollTop;\n\n    }\n\n\n    //\n    // SLOW DOWN\n    //\n\n    // Slow down velocity on every iteration\n    if (!self.options.paging) {\n\n      // This is the factor applied to every iteration of the animation\n      // to slow down the process. This should emulate natural behavior where\n      // objects slow down when the initiator of the movement is removed\n      var frictionFactor = self.options.deceleration;\n\n      self.__decelerationVelocityX *= frictionFactor;\n      self.__decelerationVelocityY *= frictionFactor;\n\n    }\n\n\n    //\n    // BOUNCING SUPPORT\n    //\n\n    if (self.options.bouncing) {\n\n      var scrollOutsideX = 0;\n      var scrollOutsideY = 0;\n\n      // This configures the amount of change applied to deceleration/acceleration when reaching boundaries\n      var penetrationDeceleration = self.options.penetrationDeceleration;\n      var penetrationAcceleration = self.options.penetrationAcceleration;\n\n      // Check limits\n      if (scrollLeft < self.__minDecelerationScrollLeft) {\n        scrollOutsideX = self.__minDecelerationScrollLeft - scrollLeft;\n      } else if (scrollLeft > self.__maxDecelerationScrollLeft) {\n        scrollOutsideX = self.__maxDecelerationScrollLeft - scrollLeft;\n      }\n\n      if (scrollTop < self.__minDecelerationScrollTop) {\n        scrollOutsideY = self.__minDecelerationScrollTop - scrollTop;\n      } else if (scrollTop > self.__maxDecelerationScrollTop) {\n        scrollOutsideY = self.__maxDecelerationScrollTop - scrollTop;\n      }\n\n      // Slow down until slow enough, then flip back to snap position\n      if (scrollOutsideX !== 0) {\n        var isHeadingOutwardsX = scrollOutsideX * self.__decelerationVelocityX <= self.__minDecelerationScrollLeft;\n        if (isHeadingOutwardsX) {\n          self.__decelerationVelocityX += scrollOutsideX * penetrationDeceleration;\n        }\n        var isStoppedX = Math.abs(self.__decelerationVelocityX) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsX || isStoppedX) {\n          self.__decelerationVelocityX = scrollOutsideX * penetrationAcceleration;\n        }\n      }\n\n      if (scrollOutsideY !== 0) {\n        var isHeadingOutwardsY = scrollOutsideY * self.__decelerationVelocityY <= self.__minDecelerationScrollTop;\n        if (isHeadingOutwardsY) {\n          self.__decelerationVelocityY += scrollOutsideY * penetrationDeceleration;\n        }\n        var isStoppedY = Math.abs(self.__decelerationVelocityY) <= self.__minVelocityToKeepDecelerating;\n        //If we're not heading outwards, or if the above statement got us below minDeceleration, go back towards bounds\n        if (!isHeadingOutwardsY || isStoppedY) {\n          self.__decelerationVelocityY = scrollOutsideY * penetrationAcceleration;\n        }\n      }\n    }\n  },\n\n\n  /**\n   * calculate the distance between two touches\n   * @param   {Touch}     touch1\n   * @param   {Touch}     touch2\n   * @returns {Number}    distance\n   */\n  __getDistance: function getDistance(touch1, touch2) {\n    var x = touch2.pageX - touch1.pageX,\n    y = touch2.pageY - touch1.pageY;\n    return Math.sqrt((x * x) + (y * y));\n  },\n\n\n  /**\n   * calculate the scale factor between two touchLists (fingers)\n   * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n   * @param   {Array}     start\n   * @param   {Array}     end\n   * @returns {Number}    scale\n   */\n  __getScale: function getScale(start, end) {\n    // need two fingers...\n    if (start.length >= 2 && end.length >= 2) {\n      return this.__getDistance(end[0], end[1]) /\n        this.__getDistance(start[0], start[1]);\n    }\n    return 1;\n  }\n});\n\nionic.scroll = {\n  isScrolling: false,\n  lastTop: 0\n};\n\n})(ionic);\n\n(function(ionic) {\n  var NOOP = function() {};\n  var deprecated = function(name) {\n    void 0;\n  };\n  ionic.views.ScrollNative = ionic.views.View.inherit({\n\n    initialize: function(options) {\n      var self = this;\n      self.__container = self.el = options.el;\n      self.__content = options.el.firstElementChild;\n      // Whether scrolling is frozen or not\n      self.__frozen = false;\n      self.isNative = true;\n\n      self.__scrollTop = self.el.scrollTop;\n      self.__scrollLeft = self.el.scrollLeft;\n      self.__clientHeight = self.__content.clientHeight;\n      self.__clientWidth = self.__content.clientWidth;\n      self.__maxScrollTop = Math.max((self.__contentHeight) - self.__clientHeight, 0);\n      self.__maxScrollLeft = Math.max((self.__contentWidth) - self.__clientWidth, 0);\n\n      if(options.startY >= 0 || options.startX >= 0) {\n        ionic.requestAnimationFrame(function() {\n          self.el.scrollTop = options.startY || 0;\n          self.el.scrollLeft = options.startX || 0;\n\n          self.__scrollTop = self.el.scrollTop;\n          self.__scrollLeft = self.el.scrollLeft;\n        });\n      }\n\n      self.options = {\n\n        freeze: false,\n\n        getContentWidth: function() {\n          return Math.max(self.__content.scrollWidth, self.__content.offsetWidth);\n        },\n\n        getContentHeight: function() {\n          return Math.max(self.__content.scrollHeight, self.__content.offsetHeight + (self.__content.offsetTop * 2));\n        }\n\n      };\n\n      for (var key in options) {\n        self.options[key] = options[key];\n      }\n\n      /**\n       * Sets isScrolling to true, and automatically deactivates if not called again in 80ms.\n       */\n      self.onScroll = function() {\n        if (!ionic.scroll.isScrolling) {\n          ionic.scroll.isScrolling = true;\n        }\n\n        clearTimeout(self.scrollTimer);\n        self.scrollTimer = setTimeout(function() {\n          ionic.scroll.isScrolling = false;\n        }, 80);\n      };\n\n      self.freeze = function(shouldFreeze) {\n        self.__frozen = shouldFreeze;\n      };\n      // A more powerful freeze pop that dominates all other freeze pops\n      self.freezeShut = function(shouldFreezeShut) {\n        self.__frozenShut = shouldFreezeShut;\n      };\n\n      self.__initEventHandlers();\n    },\n\n    /**  Methods not used in native scrolling */\n    __callback: function() { deprecated('__callback'); },\n    zoomTo: function() { deprecated('zoomTo'); },\n    zoomBy: function() { deprecated('zoomBy'); },\n    activatePullToRefresh: function() { deprecated('activatePullToRefresh'); },\n\n    /**\n     * Returns the scroll position and zooming values\n     *\n     * @return {Map} `left` and `top` scroll position and `zoom` level\n     */\n    resize: function(continueScrolling) {\n      var self = this;\n      if (!self.__container || !self.options) return;\n\n      // Update Scroller dimensions for changed content\n      // Add padding to bottom of content\n      self.setDimensions(\n        self.__container.clientWidth,\n        self.__container.clientHeight,\n        self.options.getContentWidth(),\n        self.options.getContentHeight(),\n        continueScrolling\n      );\n    },\n\n    /**\n     * Initialize the scrollview\n     * In native scrolling, this only means we need to gather size information\n     */\n    run: function() {\n      this.resize();\n    },\n\n    /**\n     * Returns the scroll position and zooming values\n     *\n     * @return {Map} `left` and `top` scroll position and `zoom` level\n     */\n    getValues: function() {\n      var self = this;\n      self.update();\n      return {\n        left: self.__scrollLeft,\n        top: self.__scrollTop,\n        zoom: 1\n      };\n    },\n\n    /**\n     * Updates the __scrollLeft and __scrollTop values to el's current value\n     */\n    update: function() {\n      var self = this;\n      self.__scrollLeft = self.el.scrollLeft;\n      self.__scrollTop = self.el.scrollTop;\n    },\n\n    /**\n     * Configures the dimensions of the client (outer) and content (inner) elements.\n     * Requires the available space for the outer element and the outer size of the inner element.\n     * All values which are falsy (null or zero etc.) are ignored and the old value is kept.\n     *\n     * @param clientWidth {Integer} Inner width of outer element\n     * @param clientHeight {Integer} Inner height of outer element\n     * @param contentWidth {Integer} Outer width of inner element\n     * @param contentHeight {Integer} Outer height of inner element\n     */\n    setDimensions: function(clientWidth, clientHeight, contentWidth, contentHeight) {\n      var self = this;\n\n      if (!clientWidth && !clientHeight && !contentWidth && !contentHeight) {\n        // this scrollview isn't rendered, don't bother\n        return;\n      }\n\n      // Only update values which are defined\n      if (clientWidth === +clientWidth) {\n        self.__clientWidth = clientWidth;\n      }\n\n      if (clientHeight === +clientHeight) {\n        self.__clientHeight = clientHeight;\n      }\n\n      if (contentWidth === +contentWidth) {\n        self.__contentWidth = contentWidth;\n      }\n\n      if (contentHeight === +contentHeight) {\n        self.__contentHeight = contentHeight;\n      }\n\n      // Refresh maximums\n      self.__computeScrollMax();\n    },\n\n    /**\n     * Returns the maximum scroll values\n     *\n     * @return {Map} `left` and `top` maximum scroll values\n     */\n    getScrollMax: function() {\n      return {\n        left: this.__maxScrollLeft,\n        top: this.__maxScrollTop\n      };\n    },\n\n    /**\n     * Scrolls by the given amount in px.\n     *\n     * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n     * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n     * @param animate {Boolean} Whether the scrolling should happen using an animation\n     */\n\n    scrollBy: function(left, top, animate) {\n      var self = this;\n\n      // update scroll vars before refferencing them\n      self.update();\n\n      var startLeft = self.__isAnimating ? self.__scheduledLeft : self.__scrollLeft;\n      var startTop = self.__isAnimating ? self.__scheduledTop : self.__scrollTop;\n\n      self.scrollTo(startLeft + (left || 0), startTop + (top || 0), animate);\n    },\n\n    /**\n     * Scrolls to the given position in px.\n     *\n     * @param left {Number} Horizontal scroll position, keeps current if value is <code>null</code>\n     * @param top {Number} Vertical scroll position, keeps current if value is <code>null</code>\n     * @param animate {Boolean} Whether the scrolling should happen using an animation\n     */\n    scrollTo: function(left, top, animate) {\n      var self = this;\n      if (!animate) {\n        self.el.scrollTop = top;\n        self.el.scrollLeft = left;\n        self.resize();\n        return;\n      }\n\n      var oldOverflowX = self.el.style.overflowX;\n      var oldOverflowY = self.el.style.overflowY;\n\n      clearTimeout(self.__scrollToCleanupTimeout);\n      self.__scrollToCleanupTimeout = setTimeout(function() {\n        self.el.style.overflowX = oldOverflowX;\n        self.el.style.overflowY = oldOverflowY;\n      }, 500);\n\n      self.el.style.overflowY = 'hidden';\n      self.el.style.overflowX = 'hidden';\n\n      animateScroll(top, left);\n\n      function animateScroll(Y, X) {\n        // scroll animation loop w/ easing\n        // credit https://gist.github.com/dezinezync/5487119\n        var start = Date.now(),\n          duration = 250, //milliseconds\n          fromY = self.el.scrollTop,\n          fromX = self.el.scrollLeft;\n\n        if (fromY === Y && fromX === X) {\n          self.el.style.overflowX = oldOverflowX;\n          self.el.style.overflowY = oldOverflowY;\n          self.resize();\n          return; /* Prevent scrolling to the Y point if already there */\n        }\n\n        // decelerating to zero velocity\n        function easeOutCubic(t) {\n          return (--t) * t * t + 1;\n        }\n\n        // scroll loop\n        function animateScrollStep() {\n          var currentTime = Date.now(),\n            time = Math.min(1, ((currentTime - start) / duration)),\n          // where .5 would be 50% of time on a linear scale easedT gives a\n          // fraction based on the easing method\n            easedT = easeOutCubic(time);\n\n          if (fromY != Y) {\n            self.el.scrollTop = parseInt((easedT * (Y - fromY)) + fromY, 10);\n          }\n          if (fromX != X) {\n            self.el.scrollLeft = parseInt((easedT * (X - fromX)) + fromX, 10);\n          }\n\n          if (time < 1) {\n            ionic.requestAnimationFrame(animateScrollStep);\n\n          } else {\n            // done\n            ionic.tap.removeClonedInputs(self.__container, self);\n            self.el.style.overflowX = oldOverflowX;\n            self.el.style.overflowY = oldOverflowY;\n            self.resize();\n          }\n        }\n\n        // start scroll loop\n        ionic.requestAnimationFrame(animateScrollStep);\n      }\n    },\n\n\n\n    /*\n     ---------------------------------------------------------------------------\n     PRIVATE API\n     ---------------------------------------------------------------------------\n     */\n\n    /**\n     * If the scroll view isn't sized correctly on start, wait until we have at least some size\n     */\n    __waitForSize: function() {\n      var self = this;\n\n      clearTimeout(self.__sizerTimeout);\n\n      var sizer = function() {\n        self.resize(true);\n      };\n\n      sizer();\n      self.__sizerTimeout = setTimeout(sizer, 500);\n    },\n\n\n    /**\n     * Recomputes scroll minimum values based on client dimensions and content dimensions.\n     */\n    __computeScrollMax: function() {\n      var self = this;\n\n      self.__maxScrollLeft = Math.max((self.__contentWidth) - self.__clientWidth, 0);\n      self.__maxScrollTop = Math.max((self.__contentHeight) - self.__clientHeight, 0);\n\n      if (!self.__didWaitForSize && !self.__maxScrollLeft && !self.__maxScrollTop) {\n        self.__didWaitForSize = true;\n        self.__waitForSize();\n      }\n    },\n\n    __initEventHandlers: function() {\n      var self = this;\n\n      // Event Handler\n      var container = self.__container;\n      // save height when scroll view is shrunk so we don't need to reflow\n      var scrollViewOffsetHeight;\n\n      var lastKeyboardHeight;\n\n      /**\n       * Shrink the scroll view when the keyboard is up if necessary and if the\n       * focused input is below the bottom of the shrunk scroll view, scroll it\n       * into view.\n       */\n      self.scrollChildIntoView = function(e) {\n        var rect = container.getBoundingClientRect();\n        if(!self.__originalContainerHeight) {\n          self.__originalContainerHeight = rect.height;\n        }\n\n        // D\n        //var scrollBottomOffsetToTop = rect.bottom;\n        // D - A\n        scrollViewOffsetHeight = self.__originalContainerHeight;\n        //console.log('Scroll view offset height', scrollViewOffsetHeight);\n        //console.dir(container);\n        var alreadyShrunk = self.isShrunkForKeyboard;\n\n        var isModal = container.parentNode.classList.contains('modal');\n        var isPopover = container.parentNode.classList.contains('popover');\n        // 680px is when the media query for 60% modal width kicks in\n        var isInsetModal = isModal && window.innerWidth >= 680;\n\n       /*\n        *  _______\n        * |---A---| <- top of scroll view\n        * |       |\n        * |---B---| <- keyboard\n        * |   C   | <- input\n        * |---D---| <- initial bottom of scroll view\n        * |___E___| <- bottom of viewport\n        *\n        *  All commented calculations relative to the top of the viewport (ie E\n        *  is the viewport height, not 0)\n        */\n\n\n        var changedKeyboardHeight = lastKeyboardHeight && (lastKeyboardHeight !== e.detail.keyboardHeight);\n\n        if (!alreadyShrunk || changedKeyboardHeight) {\n          // shrink scrollview so we can actually scroll if the input is hidden\n          // if it isn't shrink so we can scroll to inputs under the keyboard\n          // inset modals won't shrink on Android on their own when the keyboard appears\n          if ( !isPopover && (ionic.Platform.isIOS() || ionic.Platform.isFullScreen || isInsetModal) ) {\n            // if there are things below the scroll view account for them and\n            // subtract them from the keyboard height when resizing\n            // E - D                         E                         D\n            //var scrollBottomOffsetToBottom = e.detail.viewportHeight - scrollBottomOffsetToTop;\n\n            // 0 or D - B if D > B           E - B                     E - D\n            //var keyboardOffset = e.detail.keyboardHeight - scrollBottomOffsetToBottom;\n\n            ionic.requestAnimationFrame(function(){\n              // D - A or B - A if D > B       D - A             max(0, D - B)\n              scrollViewOffsetHeight = Math.max(0, Math.min(self.__originalContainerHeight, self.__originalContainerHeight - (e.detail.keyboardHeight - 43)));//keyboardOffset >= 0 ? scrollViewOffsetHeight - keyboardOffset : scrollViewOffsetHeight + keyboardOffset;\n\n              //console.log('Old container height', self.__originalContainerHeight, 'New container height', scrollViewOffsetHeight, 'Keyboard height', e.detail.keyboardHeight);\n\n              container.style.height = scrollViewOffsetHeight + \"px\";\n\n              /*\n              if (ionic.Platform.isIOS()) {\n                // Force redraw to avoid disappearing content\n                var disp = container.style.display;\n                container.style.display = 'none';\n                var trick = container.offsetHeight;\n                container.style.display = disp;\n              }\n              */\n              container.classList.add('keyboard-up');\n              //update scroll view\n              self.resize();\n            });\n          }\n\n          self.isShrunkForKeyboard = true;\n        }\n\n        lastKeyboardHeight = e.detail.keyboardHeight;\n\n        /*\n         *  _______\n         * |---A---| <- top of scroll view\n         * |   *   | <- where we want to scroll to\n         * |--B-D--| <- keyboard, bottom of scroll view\n         * |   C   | <- input\n         * |       |\n         * |___E___| <- bottom of viewport\n         *\n         *  All commented calculations relative to the top of the viewport (ie E\n         *  is the viewport height, not 0)\n         */\n        // if the element is positioned under the keyboard scroll it into view\n        if (e.detail.isElementUnderKeyboard) {\n\n          ionic.requestAnimationFrame(function(){\n            var pos = ionic.DomUtil.getOffsetTop(e.detail.target);\n            setTimeout(function() {\n              if (ionic.Platform.isIOS()) {\n                ionic.tap.cloneFocusedInput(container, self);\n              }\n              // Scroll the input into view, with a 100px buffer\n              self.scrollTo(0, pos - (rect.top + 100), true);\n              self.onScroll();\n            }, 32);\n\n            /*\n            // update D if we shrunk\n            if (self.isShrunkForKeyboard && !alreadyShrunk) {\n              scrollBottomOffsetToTop = container.getBoundingClientRect().bottom;\n              console.log('Scroll bottom', scrollBottomOffsetToTop);\n            }\n\n            // middle of the scrollview, this is where we want to scroll to\n            // (D - A) / 2\n            var scrollMidpointOffset = scrollViewOffsetHeight * 0.5;\n            console.log('Midpoint', scrollMidpointOffset);\n            //console.log(\"container.offsetHeight: \" + scrollViewOffsetHeight);\n\n            // middle of the input we want to scroll into view\n            // C\n            var inputMidpoint = ((e.detail.elementBottom + e.detail.elementTop) / 2);\n            console.log('Input midpoint');\n\n            // distance from middle of input to the bottom of the scroll view\n            // C - D                                C               D\n            var inputMidpointOffsetToScrollBottom = inputMidpoint - scrollBottomOffsetToTop;\n            console.log('Input midpoint offset', inputMidpointOffsetToScrollBottom);\n\n            //C - D + (D - A)/2          C - D                     (D - A)/ 2\n            var scrollTop = inputMidpointOffsetToScrollBottom + scrollMidpointOffset;\n            console.log('Scroll top', scrollTop);\n\n            if ( scrollTop > 0) {\n              if (ionic.Platform.isIOS()) {\n                //just shrank scroll view, give it some breathing room before scrolling\n                setTimeout(function(){\n                  ionic.tap.cloneFocusedInput(container, self);\n                  self.scrollBy(0, scrollTop, true);\n                  self.onScroll();\n                }, 32);\n              } else {\n                self.scrollBy(0, scrollTop, true);\n                self.onScroll();\n              }\n            }\n            */\n          });\n        }\n\n        // Only the first scrollView parent of the element that broadcasted this event\n        // (the active element that needs to be shown) should receive this event\n        e.stopPropagation();\n      };\n\n      self.resetScrollView = function() {\n        //return scrollview to original height once keyboard has hidden\n        if (self.isShrunkForKeyboard) {\n          self.isShrunkForKeyboard = false;\n          container.style.height = \"\";\n\n          /*\n          if (ionic.Platform.isIOS()) {\n            // Force redraw to avoid disappearing content\n            var disp = container.style.display;\n            container.style.display = 'none';\n            var trick = container.offsetHeight;\n            container.style.display = disp;\n          }\n          */\n\n          self.__originalContainerHeight = container.getBoundingClientRect().height;\n\n          if (ionic.Platform.isIOS()) {\n            ionic.requestAnimationFrame(function() {\n              container.classList.remove('keyboard-up');\n            });\n          }\n\n        }\n        self.resize();\n      };\n\n      self.handleTouchMove = function(e) {\n        if (self.__frozenShut) {\n          e.preventDefault();\n          e.stopPropagation();\n          return false;\n\n        } else if ( self.__frozen ){\n          e.preventDefault();\n          // let it propagate so other events such as drag events can happen,\n          // but don't let it actually scroll\n          return false;\n        }\n        return true;\n      };\n\n      container.addEventListener('scroll', self.onScroll);\n\n      //Broadcasted when keyboard is shown on some platforms.\n      //See js/utils/keyboard.js\n      container.addEventListener('scrollChildIntoView', self.scrollChildIntoView);\n\n      container.addEventListener(ionic.EVENTS.touchstart, self.handleTouchMove);\n      container.addEventListener(ionic.EVENTS.touchmove, self.handleTouchMove);\n\n      // Listen on document because container may not have had the last\n      // keyboardActiveElement, for example after closing a modal with a focused\n      // input and returning to a previously resized scroll view in an ion-content.\n      // Since we can only resize scroll views that are currently visible, just resize\n      // the current scroll view when the keyboard is closed.\n      document.addEventListener('resetScrollView', self.resetScrollView);\n    },\n\n    __cleanup: function() {\n      var self = this;\n      var container = self.__container;\n\n      container.removeEventListener('resetScrollView', self.resetScrollView);\n      container.removeEventListener('scroll', self.onScroll);\n\n      container.removeEventListener('scrollChildIntoView', self.scrollChildIntoView);\n      container.removeEventListener('resetScrollView', self.resetScrollView);\n\n      container.removeEventListener(ionic.EVENTS.touchstart, self.handleTouchMove);\n      container.removeEventListener(ionic.EVENTS.touchmove, self.handleTouchMove);\n\n      ionic.tap.removeClonedInputs(container, self);\n\n      delete self.__container;\n      delete self.__content;\n      delete self.__indicatorX;\n      delete self.__indicatorY;\n      delete self.options.el;\n\n      self.resize = self.scrollTo = self.onScroll = self.resetScrollView = NOOP;\n      self.scrollChildIntoView = NOOP;\n      container = null;\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  var ITEM_CLASS = 'item';\n  var ITEM_CONTENT_CLASS = 'item-content';\n  var ITEM_SLIDING_CLASS = 'item-sliding';\n  var ITEM_OPTIONS_CLASS = 'item-options';\n  var ITEM_PLACEHOLDER_CLASS = 'item-placeholder';\n  var ITEM_REORDERING_CLASS = 'item-reordering';\n  var ITEM_REORDER_BTN_CLASS = 'item-reorder';\n\n  var DragOp = function() {};\n  DragOp.prototype = {\n    start: function(){},\n    drag: function(){},\n    end: function(){},\n    isSameItem: function() {\n      return false;\n    }\n  };\n\n  var SlideDrag = function(opts) {\n    this.dragThresholdX = opts.dragThresholdX || 10;\n    this.el = opts.el;\n    this.item = opts.item;\n    this.canSwipe = opts.canSwipe;\n  };\n\n  SlideDrag.prototype = new DragOp();\n\n  SlideDrag.prototype.start = function(e) {\n    var content, buttons, offsetX, buttonsWidth;\n\n    if (!this.canSwipe()) {\n      return;\n    }\n\n    if (e.target.classList.contains(ITEM_CONTENT_CLASS)) {\n      content = e.target;\n    } else if (e.target.classList.contains(ITEM_CLASS)) {\n      content = e.target.querySelector('.' + ITEM_CONTENT_CLASS);\n    } else {\n      content = ionic.DomUtil.getParentWithClass(e.target, ITEM_CONTENT_CLASS);\n    }\n\n    // If we don't have a content area as one of our children (or ourselves), skip\n    if (!content) {\n      return;\n    }\n\n    // Make sure we aren't animating as we slide\n    content.classList.remove(ITEM_SLIDING_CLASS);\n\n    // Grab the starting X point for the item (for example, so we can tell whether it is open or closed to start)\n    offsetX = parseFloat(content.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]) || 0;\n\n    // Grab the buttons\n    buttons = content.parentNode.querySelector('.' + ITEM_OPTIONS_CLASS);\n    if (!buttons) {\n      return;\n    }\n    buttons.classList.remove('invisible');\n\n    buttonsWidth = buttons.offsetWidth;\n\n    this._currentDrag = {\n      buttons: buttons,\n      buttonsWidth: buttonsWidth,\n      content: content,\n      startOffsetX: offsetX\n    };\n  };\n\n  /**\n   * Check if this is the same item that was previously dragged.\n   */\n  SlideDrag.prototype.isSameItem = function(op) {\n    if (op._lastDrag && this._currentDrag) {\n      return this._currentDrag.content == op._lastDrag.content;\n    }\n    return false;\n  };\n\n  SlideDrag.prototype.clean = function(isInstant) {\n    var lastDrag = this._lastDrag;\n\n    if (!lastDrag || !lastDrag.content) return;\n\n    lastDrag.content.style[ionic.CSS.TRANSITION] = '';\n    lastDrag.content.style[ionic.CSS.TRANSFORM] = '';\n    if (isInstant) {\n      lastDrag.content.style[ionic.CSS.TRANSITION] = 'none';\n      makeInvisible();\n      ionic.requestAnimationFrame(function() {\n        lastDrag.content.style[ionic.CSS.TRANSITION] = '';\n      });\n    } else {\n      ionic.requestAnimationFrame(function() {\n        setTimeout(makeInvisible, 250);\n      });\n    }\n    function makeInvisible() {\n      lastDrag.buttons && lastDrag.buttons.classList.add('invisible');\n    }\n  };\n\n  SlideDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    var buttonsWidth;\n\n    // We really aren't dragging\n    if (!this._currentDrag) {\n      return;\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if (!this._isDragging &&\n        ((Math.abs(e.gesture.deltaX) > this.dragThresholdX) ||\n        (Math.abs(this._currentDrag.startOffsetX) > 0))) {\n      this._isDragging = true;\n    }\n\n    if (this._isDragging) {\n      buttonsWidth = this._currentDrag.buttonsWidth;\n\n      // Grab the new X point, capping it at zero\n      var newX = Math.min(0, this._currentDrag.startOffsetX + e.gesture.deltaX);\n\n      // If the new X position is past the buttons, we need to slow down the drag (rubber band style)\n      if (newX < -buttonsWidth) {\n        // Calculate the new X position, capped at the top of the buttons\n        newX = Math.min(-buttonsWidth, -buttonsWidth + (((e.gesture.deltaX + buttonsWidth) * 0.4)));\n      }\n\n      this._currentDrag.content.$$ionicOptionsOpen = newX !== 0;\n\n      this._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + newX + 'px, 0, 0)';\n      this._currentDrag.content.style[ionic.CSS.TRANSITION] = 'none';\n    }\n  });\n\n  SlideDrag.prototype.end = function(e, doneCallback) {\n    var self = this;\n\n    // There is no drag, just end immediately\n    if (!self._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    // If we are currently dragging, we want to snap back into place\n    // The final resting point X will be the width of the exposed buttons\n    var restingPoint = -self._currentDrag.buttonsWidth;\n\n    // Check if the drag didn't clear the buttons mid-point\n    // and we aren't moving fast enough to swipe open\n    if (e.gesture.deltaX > -(self._currentDrag.buttonsWidth / 2)) {\n\n      // If we are going left but too slow, or going right, go back to resting\n      if (e.gesture.direction == \"left\" && Math.abs(e.gesture.velocityX) < 0.3) {\n        restingPoint = 0;\n\n      } else if (e.gesture.direction == \"right\") {\n        restingPoint = 0;\n      }\n\n    }\n\n    ionic.requestAnimationFrame(function() {\n      if (restingPoint === 0) {\n        self._currentDrag.content.style[ionic.CSS.TRANSFORM] = '';\n        var buttons = self._currentDrag.buttons;\n        setTimeout(function() {\n          buttons && buttons.classList.add('invisible');\n        }, 250);\n      } else {\n        self._currentDrag.content.style[ionic.CSS.TRANSFORM] = 'translate3d(' + restingPoint + 'px,0,0)';\n      }\n      self._currentDrag.content.style[ionic.CSS.TRANSITION] = '';\n\n\n      // Kill the current drag\n      if (!self._lastDrag) {\n        self._lastDrag = {};\n      }\n      ionic.extend(self._lastDrag, self._currentDrag);\n      if (self._currentDrag) {\n        self._currentDrag.buttons = null;\n        self._currentDrag.content = null;\n      }\n      self._currentDrag = null;\n\n      // We are done, notify caller\n      doneCallback && doneCallback();\n    });\n  };\n\n  var ReorderDrag = function(opts) {\n    var self = this;\n\n    self.dragThresholdY = opts.dragThresholdY || 0;\n    self.onReorder = opts.onReorder;\n    self.listEl = opts.listEl;\n    self.el = self.item = opts.el;\n    self.scrollEl = opts.scrollEl;\n    self.scrollView = opts.scrollView;\n    // Get the True Top of the list el http://www.quirksmode.org/js/findpos.html\n    self.listElTrueTop = 0;\n    if (self.listEl.offsetParent) {\n      var obj = self.listEl;\n      do {\n        self.listElTrueTop += obj.offsetTop;\n        obj = obj.offsetParent;\n      } while (obj);\n    }\n  };\n\n  ReorderDrag.prototype = new DragOp();\n\n  ReorderDrag.prototype._moveElement = function(e) {\n    var y = e.gesture.center.pageY +\n      this.scrollView.getValues().top -\n      (this._currentDrag.elementHeight / 2) -\n      this.listElTrueTop;\n    this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(0, ' + y + 'px, 0)';\n  };\n\n  ReorderDrag.prototype.deregister = function() {\n    this.listEl = this.el = this.scrollEl = this.scrollView = null;\n  };\n\n  ReorderDrag.prototype.start = function(e) {\n\n    var startIndex = ionic.DomUtil.getChildIndex(this.el, this.el.nodeName.toLowerCase());\n    var elementHeight = this.el.scrollHeight;\n    var placeholder = this.el.cloneNode(true);\n\n    placeholder.classList.add(ITEM_PLACEHOLDER_CLASS);\n\n    this.el.parentNode.insertBefore(placeholder, this.el);\n    this.el.classList.add(ITEM_REORDERING_CLASS);\n\n    this._currentDrag = {\n      elementHeight: elementHeight,\n      startIndex: startIndex,\n      placeholder: placeholder,\n      scrollHeight: scroll,\n      list: placeholder.parentNode\n    };\n\n    this._moveElement(e);\n  };\n\n  ReorderDrag.prototype.drag = ionic.animationFrameThrottle(function(e) {\n    // We really aren't dragging\n    var self = this;\n    if (!this._currentDrag) {\n      return;\n    }\n\n    var scrollY = 0;\n    var pageY = e.gesture.center.pageY;\n    var offset = this.listElTrueTop;\n\n    //If we have a scrollView, check scroll boundaries for dragged element and scroll if necessary\n    if (this.scrollView) {\n\n      var container = this.scrollView.__container;\n      scrollY = this.scrollView.getValues().top;\n\n      var containerTop = container.offsetTop;\n      var pixelsPastTop = containerTop - pageY + this._currentDrag.elementHeight / 2;\n      var pixelsPastBottom = pageY + this._currentDrag.elementHeight / 2 - containerTop - container.offsetHeight;\n\n      if (e.gesture.deltaY < 0 && pixelsPastTop > 0 && scrollY > 0) {\n        this.scrollView.scrollBy(null, -pixelsPastTop);\n        //Trigger another drag so the scrolling keeps going\n        ionic.requestAnimationFrame(function() {\n          self.drag(e);\n        });\n      }\n      if (e.gesture.deltaY > 0 && pixelsPastBottom > 0) {\n        if (scrollY < this.scrollView.getScrollMax().top) {\n          this.scrollView.scrollBy(null, pixelsPastBottom);\n          //Trigger another drag so the scrolling keeps going\n          ionic.requestAnimationFrame(function() {\n            self.drag(e);\n          });\n        }\n      }\n    }\n\n    // Check if we should start dragging. Check if we've dragged past the threshold,\n    // or we are starting from the open state.\n    if (!this._isDragging && Math.abs(e.gesture.deltaY) > this.dragThresholdY) {\n      this._isDragging = true;\n    }\n\n    if (this._isDragging) {\n      this._moveElement(e);\n\n      this._currentDrag.currentY = scrollY + pageY - offset;\n\n      // this._reorderItems();\n    }\n  });\n\n  // When an item is dragged, we need to reorder any items for sorting purposes\n  ReorderDrag.prototype._getReorderIndex = function() {\n    var self = this;\n\n    var siblings = Array.prototype.slice.call(self._currentDrag.placeholder.parentNode.children)\n      .filter(function(el) {\n        return el.nodeName === self.el.nodeName && el !== self.el;\n      });\n\n    var dragOffsetTop = self._currentDrag.currentY;\n    var el;\n    for (var i = 0, len = siblings.length; i < len; i++) {\n      el = siblings[i];\n      if (i === len - 1) {\n        if (dragOffsetTop > el.offsetTop) {\n          return i;\n        }\n      } else if (i === 0) {\n        if (dragOffsetTop < el.offsetTop + el.offsetHeight) {\n          return i;\n        }\n      } else if (dragOffsetTop > el.offsetTop - el.offsetHeight / 2 &&\n                 dragOffsetTop < el.offsetTop + el.offsetHeight) {\n        return i;\n      }\n    }\n    return self._currentDrag.startIndex;\n  };\n\n  ReorderDrag.prototype.end = function(e, doneCallback) {\n    if (!this._currentDrag) {\n      doneCallback && doneCallback();\n      return;\n    }\n\n    var placeholder = this._currentDrag.placeholder;\n    var finalIndex = this._getReorderIndex();\n\n    // Reposition the element\n    this.el.classList.remove(ITEM_REORDERING_CLASS);\n    this.el.style[ionic.CSS.TRANSFORM] = '';\n\n    placeholder.parentNode.insertBefore(this.el, placeholder);\n    placeholder.parentNode.removeChild(placeholder);\n\n    this.onReorder && this.onReorder(this.el, this._currentDrag.startIndex, finalIndex);\n\n    this._currentDrag = {\n      placeholder: null,\n      content: null\n    };\n    this._currentDrag = null;\n    doneCallback && doneCallback();\n  };\n\n\n\n  /**\n   * The ListView handles a list of items. It will process drag animations, edit mode,\n   * and other operations that are common on mobile lists or table views.\n   */\n  ionic.views.ListView = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var self = this;\n\n      opts = ionic.extend({\n        onReorder: function() {},\n        virtualRemoveThreshold: -200,\n        virtualAddThreshold: 200,\n        canSwipe: function() {\n          return true;\n        }\n      }, opts);\n\n      ionic.extend(self, opts);\n\n      if (!self.itemHeight && self.listEl) {\n        self.itemHeight = self.listEl.children[0] && parseInt(self.listEl.children[0].style.height, 10);\n      }\n\n      self.onRefresh = opts.onRefresh || function() {};\n      self.onRefreshOpening = opts.onRefreshOpening || function() {};\n      self.onRefreshHolding = opts.onRefreshHolding || function() {};\n\n      var gestureOpts = {};\n      // don't prevent native scrolling\n      if (ionic.DomUtil.getParentOrSelfWithClass(self.el, 'overflow-scroll')) {\n        gestureOpts.prevent_default_directions = ['left', 'right'];\n      }\n\n      window.ionic.onGesture('release', function(e) {\n        self._handleEndDrag(e);\n      }, self.el, gestureOpts);\n\n      window.ionic.onGesture('drag', function(e) {\n        self._handleDrag(e);\n      }, self.el, gestureOpts);\n      // Start the drag states\n      self._initDrag();\n    },\n\n    /**\n     * Be sure to cleanup references.\n     */\n    deregister: function() {\n      this.el = this.listEl = this.scrollEl = this.scrollView = null;\n\n      // ensure no scrolls have been left frozen\n      if (this.isScrollFreeze) {\n        self.scrollView.freeze(false);\n      }\n    },\n\n    /**\n     * Called to tell the list to stop refreshing. This is useful\n     * if you are refreshing the list and are done with refreshing.\n     */\n    stopRefreshing: function() {\n      var refresher = this.el.querySelector('.list-refresher');\n      refresher.style.height = '0';\n    },\n\n    /**\n     * If we scrolled and have virtual mode enabled, compute the window\n     * of active elements in order to figure out the viewport to render.\n     */\n    didScroll: function(e) {\n      var self = this;\n\n      if (self.isVirtual) {\n        var itemHeight = self.itemHeight;\n\n        // Grab the total height of the list\n        var scrollHeight = e.target.scrollHeight;\n\n        // Get the viewport height\n        var viewportHeight = self.el.parentNode.offsetHeight;\n\n        // High water is the pixel position of the first element to include (everything before\n        // that will be removed)\n        var highWater = Math.max(0, e.scrollTop + self.virtualRemoveThreshold);\n\n        // Low water is the pixel position of the last element to include (everything after\n        // that will be removed)\n        var lowWater = Math.min(scrollHeight, Math.abs(e.scrollTop) + viewportHeight + self.virtualAddThreshold);\n\n        // Get the first and last elements in the list based on how many can fit\n        // between the pixel range of lowWater and highWater\n        var first = parseInt(Math.abs(highWater / itemHeight), 10);\n        var last = parseInt(Math.abs(lowWater / itemHeight), 10);\n\n        // Get the items we need to remove\n        self._virtualItemsToRemove = Array.prototype.slice.call(self.listEl.children, 0, first);\n\n        self.renderViewport && self.renderViewport(highWater, lowWater, first, last);\n      }\n    },\n\n    didStopScrolling: function() {\n      if (this.isVirtual) {\n        for (var i = 0; i < this._virtualItemsToRemove.length; i++) {\n          //el.parentNode.removeChild(el);\n          this.didHideItem && this.didHideItem(i);\n        }\n        // Once scrolling stops, check if we need to remove old items\n\n      }\n    },\n\n    /**\n     * Clear any active drag effects on the list.\n     */\n    clearDragEffects: function(isInstant) {\n      if (this._lastDragOp) {\n        this._lastDragOp.clean && this._lastDragOp.clean(isInstant);\n        this._lastDragOp.deregister && this._lastDragOp.deregister();\n        this._lastDragOp = null;\n      }\n    },\n\n    _initDrag: function() {\n      // Store the last one\n      if (this._lastDragOp) {\n        this._lastDragOp.deregister && this._lastDragOp.deregister();\n      }\n      this._lastDragOp = this._dragOp;\n\n      this._dragOp = null;\n    },\n\n    // Return the list item from the given target\n    _getItem: function(target) {\n      while (target) {\n        if (target.classList && target.classList.contains(ITEM_CLASS)) {\n          return target;\n        }\n        target = target.parentNode;\n      }\n      return null;\n    },\n\n\n    _startDrag: function(e) {\n      var self = this;\n\n      self._isDragging = false;\n\n      var lastDragOp = self._lastDragOp;\n      var item;\n\n      // If we have an open SlideDrag and we're scrolling the list. Clear it.\n      if (self._didDragUpOrDown && lastDragOp instanceof SlideDrag) {\n          lastDragOp.clean && lastDragOp.clean();\n      }\n\n      // Check if this is a reorder drag\n      if (ionic.DomUtil.getParentOrSelfWithClass(e.target, ITEM_REORDER_BTN_CLASS) && (e.gesture.direction == 'up' || e.gesture.direction == 'down')) {\n        item = self._getItem(e.target);\n\n        if (item) {\n          self._dragOp = new ReorderDrag({\n            listEl: self.el,\n            el: item,\n            scrollEl: self.scrollEl,\n            scrollView: self.scrollView,\n            onReorder: function(el, start, end) {\n              self.onReorder && self.onReorder(el, start, end);\n            }\n          });\n          self._dragOp.start(e);\n          e.preventDefault();\n        }\n      }\n\n      // Or check if this is a swipe to the side drag\n      else if (!self._didDragUpOrDown && (e.gesture.direction == 'left' || e.gesture.direction == 'right') && Math.abs(e.gesture.deltaX) > 5) {\n\n        // Make sure this is an item with buttons\n        item = self._getItem(e.target);\n        if (item && item.querySelector('.item-options')) {\n          self._dragOp = new SlideDrag({\n            el: self.el,\n            item: item,\n            canSwipe: self.canSwipe\n          });\n          self._dragOp.start(e);\n          e.preventDefault();\n          self.isScrollFreeze = self.scrollView.freeze(true);\n        }\n      }\n\n      // If we had a last drag operation and this is a new one on a different item, clean that last one\n      if (lastDragOp && self._dragOp && !self._dragOp.isSameItem(lastDragOp) && e.defaultPrevented) {\n        lastDragOp.clean && lastDragOp.clean();\n      }\n    },\n\n\n    _handleEndDrag: function(e) {\n      var self = this;\n\n      if (self.scrollView) {\n        self.isScrollFreeze = self.scrollView.freeze(false);\n      }\n\n      self._didDragUpOrDown = false;\n\n      if (!self._dragOp) {\n        return;\n      }\n\n      self._dragOp.end(e, function() {\n        self._initDrag();\n      });\n    },\n\n    /**\n     * Process the drag event to move the item to the left or right.\n     */\n    _handleDrag: function(e) {\n      var self = this;\n\n      if (Math.abs(e.gesture.deltaY) > 5) {\n        self._didDragUpOrDown = true;\n      }\n\n      // If we get a drag event, make sure we aren't in another drag, then check if we should\n      // start one\n      if (!self.isDragging && !self._dragOp) {\n        self._startDrag(e);\n      }\n\n      // No drag still, pass it up\n      if (!self._dragOp) {\n        return;\n      }\n\n      e.gesture.srcEvent.preventDefault();\n      self._dragOp.drag(e);\n    }\n\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Modal = ionic.views.View.inherit({\n    initialize: function(opts) {\n      opts = ionic.extend({\n        focusFirstInput: false,\n        unfocusOnHide: true,\n        focusFirstDelay: 600,\n        backdropClickToClose: true,\n        hardwareBackButtonClose: true,\n      }, opts);\n\n      ionic.extend(this, opts);\n\n      this.el = opts.el;\n    },\n    show: function() {\n      var self = this;\n\n      if(self.focusFirstInput) {\n        // Let any animations run first\n        window.setTimeout(function() {\n          var input = self.el.querySelector('input, textarea');\n          input && input.focus && input.focus();\n        }, self.focusFirstDelay);\n      }\n    },\n    hide: function() {\n      // Unfocus all elements\n      if(this.unfocusOnHide) {\n        var inputs = this.el.querySelectorAll('input, textarea');\n        // Let any animations run first\n        window.setTimeout(function() {\n          for(var i = 0; i < inputs.length; i++) {\n            inputs[i].blur && inputs[i].blur();\n          }\n        });\n      }\n    }\n  });\n\n})(ionic);\n\n(function(ionic) {\n'use strict';\n\n  /**\n   * The side menu view handles one of the side menu's in a Side Menu Controller\n   * configuration.\n   * It takes a DOM reference to that side menu element.\n   */\n  ionic.views.SideMenu = ionic.views.View.inherit({\n    initialize: function(opts) {\n      this.el = opts.el;\n      this.isEnabled = (typeof opts.isEnabled === 'undefined') ? true : opts.isEnabled;\n      this.setWidth(opts.width);\n    },\n    getFullWidth: function() {\n      return this.width;\n    },\n    setWidth: function(width) {\n      this.width = width;\n      this.el.style.width = width + 'px';\n    },\n    setIsEnabled: function(isEnabled) {\n      this.isEnabled = isEnabled;\n    },\n    bringUp: function() {\n      if(this.el.style.zIndex !== '0') {\n        this.el.style.zIndex = '0';\n      }\n    },\n    pushDown: function() {\n      if(this.el.style.zIndex !== '-1') {\n        this.el.style.zIndex = '-1';\n      }\n    }\n  });\n\n  ionic.views.SideMenuContent = ionic.views.View.inherit({\n    initialize: function(opts) {\n      ionic.extend(this, {\n        animationClass: 'menu-animated',\n        onDrag: function() {},\n        onEndDrag: function() {}\n      }, opts);\n\n      ionic.onGesture('drag', ionic.proxy(this._onDrag, this), this.el);\n      ionic.onGesture('release', ionic.proxy(this._onEndDrag, this), this.el);\n    },\n    _onDrag: function(e) {\n      this.onDrag && this.onDrag(e);\n    },\n    _onEndDrag: function(e) {\n      this.onEndDrag && this.onEndDrag(e);\n    },\n    disableAnimation: function() {\n      this.el.classList.remove(this.animationClass);\n    },\n    enableAnimation: function() {\n      this.el.classList.add(this.animationClass);\n    },\n    getTranslateX: function() {\n      return parseFloat(this.el.style[ionic.CSS.TRANSFORM].replace('translate3d(', '').split(',')[0]);\n    },\n    setTranslateX: ionic.animationFrameThrottle(function(x) {\n      this.el.style[ionic.CSS.TRANSFORM] = 'translate3d(' + x + 'px, 0, 0)';\n    })\n  });\n\n})(ionic);\n\n/*\n * Adapted from Swipe.js 2.0\n *\n * Brad Birdsall\n * Copyright 2013, MIT License\n *\n*/\n\n(function(ionic) {\n'use strict';\n\nionic.views.Slider = ionic.views.View.inherit({\n  initialize: function (options) {\n    var slider = this;\n\n    var touchStartEvent, touchMoveEvent, touchEndEvent;\n    if (window.navigator.pointerEnabled) {\n      touchStartEvent = 'pointerdown';\n      touchMoveEvent = 'pointermove';\n      touchEndEvent = 'pointerup';\n    } else if (window.navigator.msPointerEnabled) {\n      touchStartEvent = 'MSPointerDown';\n      touchMoveEvent = 'MSPointerMove';\n      touchEndEvent = 'MSPointerUp';\n    } else {\n      touchStartEvent = 'touchstart';\n      touchMoveEvent = 'touchmove';\n      touchEndEvent = 'touchend';\n    }\n\n    var mouseStartEvent = 'mousedown';\n    var mouseMoveEvent = 'mousemove';\n    var mouseEndEvent = 'mouseup';\n\n    // utilities\n    var noop = function() {}; // simple no operation function\n    var offloadFn = function(fn) { setTimeout(fn || noop, 0); }; // offload a functions execution\n\n    // check browser capabilities\n    var browser = {\n      addEventListener: !!window.addEventListener,\n      transitions: (function(temp) {\n        var props = ['transitionProperty', 'WebkitTransition', 'MozTransition', 'OTransition', 'msTransition'];\n        for ( var i in props ) if (temp.style[ props[i] ] !== undefined) return true;\n        return false;\n      })(document.createElement('swipe'))\n    };\n\n\n    var container = options.el;\n\n    // quit if no root element\n    if (!container) return;\n    var element = container.children[0];\n    var slides, slidePos, width, length;\n    options = options || {};\n    var index = parseInt(options.startSlide, 10) || 0;\n    var speed = options.speed || 300;\n    options.continuous = options.continuous !== undefined ? options.continuous : true;\n\n    function setup() {\n\n      // do not setup if the container has no width\n      if (!container.offsetWidth) {\n        return;\n      }\n\n      // cache slides\n      slides = element.children;\n      length = slides.length;\n\n      // set continuous to false if only one slide\n      if (slides.length < 2) options.continuous = false;\n\n      //special case if two slides\n      if (browser.transitions && options.continuous && slides.length < 3) {\n        element.appendChild(slides[0].cloneNode(true));\n        element.appendChild(element.children[1].cloneNode(true));\n        slides = element.children;\n      }\n\n      // create an array to store current positions of each slide\n      slidePos = new Array(slides.length);\n\n      // determine width of each slide\n      width = container.offsetWidth || container.getBoundingClientRect().width;\n\n      element.style.width = (slides.length * width) + 'px';\n\n      // stack elements\n      var pos = slides.length;\n      while(pos--) {\n\n        var slide = slides[pos];\n\n        slide.style.width = width + 'px';\n        slide.setAttribute('data-index', pos);\n\n        if (browser.transitions) {\n          slide.style.left = (pos * -width) + 'px';\n          move(pos, index > pos ? -width : (index < pos ? width : 0), 0);\n        }\n\n      }\n\n      // reposition elements before and after index\n      if (options.continuous && browser.transitions) {\n        move(circle(index - 1), -width, 0);\n        move(circle(index + 1), width, 0);\n      }\n\n      if (!browser.transitions) element.style.left = (index * -width) + 'px';\n\n      container.style.visibility = 'visible';\n\n      options.slidesChanged && options.slidesChanged();\n    }\n\n    function prev(slideSpeed) {\n\n      if (options.continuous) slide(index - 1, slideSpeed);\n      else if (index) slide(index - 1, slideSpeed);\n\n    }\n\n    function next(slideSpeed) {\n\n      if (options.continuous) slide(index + 1, slideSpeed);\n      else if (index < slides.length - 1) slide(index + 1, slideSpeed);\n\n    }\n\n    function circle(index) {\n\n      // a simple positive modulo using slides.length\n      return (slides.length + (index % slides.length)) % slides.length;\n\n    }\n\n    function slide(to, slideSpeed) {\n\n      // do nothing if already on requested slide\n      if (index == to) return;\n\n      if (!slides) {\n        index = to;\n        return;\n      }\n\n      if (browser.transitions) {\n\n        var direction = Math.abs(index - to) / (index - to); // 1: backward, -1: forward\n\n        // get the actual position of the slide\n        if (options.continuous) {\n          var naturalDirection = direction;\n          direction = -slidePos[circle(to)] / width;\n\n          // if going forward but to < index, use to = slides.length + to\n          // if going backward but to > index, use to = -slides.length + to\n          if (direction !== naturalDirection) to = -direction * slides.length + to;\n\n        }\n\n        var diff = Math.abs(index - to) - 1;\n\n        // move all the slides between index and to in the right direction\n        while (diff--) move( circle((to > index ? to : index) - diff - 1), width * direction, 0);\n\n        to = circle(to);\n\n        move(index, width * direction, slideSpeed || speed);\n        move(to, 0, slideSpeed || speed);\n\n        if (options.continuous) move(circle(to - direction), -(width * direction), 0); // we need to get the next in place\n\n      } else {\n\n        to = circle(to);\n        animate(index * -width, to * -width, slideSpeed || speed);\n        //no fallback for a circular continuous if the browser does not accept transitions\n      }\n\n      index = to;\n      offloadFn(options.callback && options.callback(index, slides[index]));\n    }\n\n    function move(index, dist, speed) {\n\n      translate(index, dist, speed);\n      slidePos[index] = dist;\n\n    }\n\n    function translate(index, dist, speed) {\n\n      var slide = slides[index];\n      var style = slide && slide.style;\n\n      if (!style) return;\n\n      style.webkitTransitionDuration =\n      style.MozTransitionDuration =\n      style.msTransitionDuration =\n      style.OTransitionDuration =\n      style.transitionDuration = speed + 'ms';\n\n      style.webkitTransform = 'translate(' + dist + 'px,0)' + 'translateZ(0)';\n      style.msTransform =\n      style.MozTransform =\n      style.OTransform = 'translateX(' + dist + 'px)';\n\n    }\n\n    function animate(from, to, speed) {\n\n      // if not an animation, just reposition\n      if (!speed) {\n\n        element.style.left = to + 'px';\n        return;\n\n      }\n\n      var start = +new Date();\n\n      var timer = setInterval(function() {\n\n        var timeElap = +new Date() - start;\n\n        if (timeElap > speed) {\n\n          element.style.left = to + 'px';\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n          clearInterval(timer);\n          return;\n\n        }\n\n        element.style.left = (( (to - from) * (Math.floor((timeElap / speed) * 100) / 100) ) + from) + 'px';\n\n      }, 4);\n\n    }\n\n    // setup auto slideshow\n    var delay = options.auto || 0;\n    var interval;\n\n    function begin() {\n\n      interval = setTimeout(next, delay);\n\n    }\n\n    function stop() {\n\n      delay = options.auto || 0;\n      clearTimeout(interval);\n\n    }\n\n\n    // setup initial vars\n    var start = {};\n    var delta = {};\n    var isScrolling;\n\n    // setup event capturing\n    var events = {\n\n      handleEvent: function(event) {\n        if(!event.touches && event.pageX && event.pageY) {\n          event.touches = [{\n            pageX: event.pageX,\n            pageY: event.pageY\n          }];\n        }\n\n        switch (event.type) {\n          case touchStartEvent: this.start(event); break;\n          case mouseStartEvent: this.start(event); break;\n          case touchMoveEvent: this.touchmove(event); break;\n          case mouseMoveEvent: this.touchmove(event); break;\n          case touchEndEvent: offloadFn(this.end(event)); break;\n          case mouseEndEvent: offloadFn(this.end(event)); break;\n          case 'webkitTransitionEnd':\n          case 'msTransitionEnd':\n          case 'oTransitionEnd':\n          case 'otransitionend':\n          case 'transitionend': offloadFn(this.transitionEnd(event)); break;\n          case 'resize': offloadFn(setup); break;\n        }\n\n        if (options.stopPropagation) event.stopPropagation();\n\n      },\n      start: function(event) {\n\n        // prevent to start if there is no valid event\n        if (!event.touches) {\n          return;\n        }\n\n        var touches = event.touches[0];\n\n        // measure start values\n        start = {\n\n          // get initial touch coords\n          x: touches.pageX,\n          y: touches.pageY,\n\n          // store time to determine touch duration\n          time: +new Date()\n\n        };\n\n        // used for testing first move event\n        isScrolling = undefined;\n\n        // reset delta and end measurements\n        delta = {};\n\n        // attach touchmove and touchend listeners\n        element.addEventListener(touchMoveEvent, this, false);\n        element.addEventListener(mouseMoveEvent, this, false);\n\n        element.addEventListener(touchEndEvent, this, false);\n        element.addEventListener(mouseEndEvent, this, false);\n\n        document.addEventListener(touchEndEvent, this, false);\n        document.addEventListener(mouseEndEvent, this, false);\n      },\n      touchmove: function(event) {\n\n        // ensure there is a valid event\n        // ensure swiping with one touch and not pinching\n        // ensure sliding is enabled\n        if (!event.touches ||\n            event.touches.length > 1 ||\n            event.scale && event.scale !== 1 ||\n            slider.slideIsDisabled) {\n          return;\n        }\n\n        if (options.disableScroll) event.preventDefault();\n\n        var touches = event.touches[0];\n\n        // measure change in x and y\n        delta = {\n          x: touches.pageX - start.x,\n          y: touches.pageY - start.y\n        };\n\n        // determine if scrolling test has run - one time test\n        if ( typeof isScrolling == 'undefined') {\n          isScrolling = !!( isScrolling || Math.abs(delta.x) < Math.abs(delta.y) );\n        }\n\n        // if user is not trying to scroll vertically\n        if (!isScrolling) {\n\n          // prevent native scrolling\n          event.preventDefault();\n\n          // stop slideshow\n          stop();\n\n          // increase resistance if first or last slide\n          if (options.continuous) { // we don't add resistance at the end\n\n            translate(circle(index - 1), delta.x + slidePos[circle(index - 1)], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(circle(index + 1), delta.x + slidePos[circle(index + 1)], 0);\n\n          } else {\n            // If the slider bounces, do the bounce!\n            if(options.bouncing) {\n              delta.x =\n               delta.x /\n                 ( (!index && delta.x > 0 ||         // if first slide and sliding left\n                   index == slides.length - 1 &&     // or if last slide and sliding right\n                   delta.x < 0                       // and if sliding at all\n                 ) ?\n                 ( Math.abs(delta.x) / width + 1 )      // determine resistance level\n                 : 1 );                                 // no resistance if false\n             } else {\n               if(width * index - delta.x < 0) {               //We are trying scroll past left boundary\n                 delta.x = Math.min(delta.x, width * index);  //Set delta.x so we don't go past left screen\n               }\n               if(Math.abs(delta.x) > width * (slides.length - index - 1)){         //We are trying to scroll past right bondary\n                 delta.x = Math.max( -width * (slides.length - index - 1), delta.x);  //Set delta.x so we don't go past right screen\n               }\n             }\n\n            // translate 1:1\n            translate(index - 1, delta.x + slidePos[index - 1], 0);\n            translate(index, delta.x + slidePos[index], 0);\n            translate(index + 1, delta.x + slidePos[index + 1], 0);\n          }\n\n          options.onDrag && options.onDrag();\n        }\n\n      },\n      end: function() {\n\n        // measure duration\n        var duration = +new Date() - start.time;\n\n        // determine if slide attempt triggers next/prev slide\n        var isValidSlide =\n              Number(duration) < 250 &&         // if slide duration is less than 250ms\n              Math.abs(delta.x) > 20 ||         // and if slide amt is greater than 20px\n              Math.abs(delta.x) > width / 2;      // or if slide amt is greater than half the width\n\n        // determine if slide attempt is past start and end\n        var isPastBounds = (!index && delta.x > 0) ||      // if first slide and slide amt is greater than 0\n              (index == slides.length - 1 && delta.x < 0); // or if last slide and slide amt is less than 0\n\n        if (options.continuous) isPastBounds = false;\n\n        // determine direction of swipe (true:right, false:left)\n        var direction = delta.x < 0;\n\n        // if not scrolling vertically\n        if (!isScrolling) {\n\n          if (isValidSlide && !isPastBounds) {\n\n            if (direction) {\n\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index - 1), -width, 0);\n                move(circle(index + 2), width, 0);\n\n              } else {\n                move(index - 1, -width, 0);\n              }\n\n              move(index, slidePos[index] - width, speed);\n              move(circle(index + 1), slidePos[circle(index + 1)] - width, speed);\n              index = circle(index + 1);\n\n            } else {\n              if (options.continuous) { // we need to get the next in this direction in place\n\n                move(circle(index + 1), width, 0);\n                move(circle(index - 2), -width, 0);\n\n              } else {\n                move(index + 1, width, 0);\n              }\n\n              move(index, slidePos[index] + width, speed);\n              move(circle(index - 1), slidePos[circle(index - 1)] + width, speed);\n              index = circle(index - 1);\n\n            }\n\n            options.callback && options.callback(index, slides[index]);\n\n          } else {\n\n            if (options.continuous) {\n\n              move(circle(index - 1), -width, speed);\n              move(index, 0, speed);\n              move(circle(index + 1), width, speed);\n\n            } else {\n\n              move(index - 1, -width, speed);\n              move(index, 0, speed);\n              move(index + 1, width, speed);\n            }\n\n          }\n\n        }\n\n        // kill touchmove and touchend event listeners until touchstart called again\n        element.removeEventListener(touchMoveEvent, events, false);\n        element.removeEventListener(mouseMoveEvent, events, false);\n\n        element.removeEventListener(touchEndEvent, events, false);\n        element.removeEventListener(mouseEndEvent, events, false);\n\n        document.removeEventListener(touchEndEvent, events, false);\n        document.removeEventListener(mouseEndEvent, events, false);\n\n        options.onDragEnd && options.onDragEnd();\n      },\n      transitionEnd: function(event) {\n\n        if (parseInt(event.target.getAttribute('data-index'), 10) == index) {\n\n          if (delay) begin();\n\n          options.transitionEnd && options.transitionEnd.call(event, index, slides[index]);\n\n        }\n\n      }\n\n    };\n\n    // Public API\n    this.update = function() {\n      setTimeout(setup);\n    };\n    this.setup = function() {\n      setup();\n    };\n\n    this.loop = function(value) {\n      if (arguments.length) options.continuous = !!value;\n      return options.continuous;\n    };\n\n    this.enableSlide = function(shouldEnable) {\n      if (arguments.length) {\n        this.slideIsDisabled = !shouldEnable;\n      }\n      return !this.slideIsDisabled;\n    };\n\n    this.slide = this.select = function(to, speed) {\n      // cancel slideshow\n      stop();\n\n      slide(to, speed);\n    };\n\n    this.prev = this.previous = function() {\n      // cancel slideshow\n      stop();\n\n      prev();\n    };\n\n    this.next = function() {\n      // cancel slideshow\n      stop();\n\n      next();\n    };\n\n    this.stop = function() {\n      // cancel slideshow\n      stop();\n    };\n\n    this.start = function() {\n      begin();\n    };\n\n    this.autoPlay = function(newDelay) {\n      if (!delay || delay < 0) {\n        stop();\n      } else {\n        delay = newDelay;\n        begin();\n      }\n    };\n\n    this.currentIndex = this.selected = function() {\n      // return current index position\n      return index;\n    };\n\n    this.slidesCount = this.count = function() {\n      // return total number of slides\n      return length;\n    };\n\n    this.kill = function() {\n      // cancel slideshow\n      stop();\n\n      // reset element\n      element.style.width = '';\n      element.style.left = '';\n\n      // reset slides so no refs are held on to\n      slides && (slides = []);\n\n      // removed event listeners\n      if (browser.addEventListener) {\n\n        // remove current event listeners\n        element.removeEventListener(touchStartEvent, events, false);\n        element.removeEventListener(mouseStartEvent, events, false);\n        element.removeEventListener('webkitTransitionEnd', events, false);\n        element.removeEventListener('msTransitionEnd', events, false);\n        element.removeEventListener('oTransitionEnd', events, false);\n        element.removeEventListener('otransitionend', events, false);\n        element.removeEventListener('transitionend', events, false);\n        window.removeEventListener('resize', events, false);\n\n      }\n      else {\n\n        window.onresize = null;\n\n      }\n    };\n\n    this.load = function() {\n      // trigger setup\n      setup();\n\n      // start auto slideshow if applicable\n      if (delay) begin();\n\n\n      // add event listeners\n      if (browser.addEventListener) {\n\n        // set touchstart event on element\n        element.addEventListener(touchStartEvent, events, false);\n        element.addEventListener(mouseStartEvent, events, false);\n\n        if (browser.transitions) {\n          element.addEventListener('webkitTransitionEnd', events, false);\n          element.addEventListener('msTransitionEnd', events, false);\n          element.addEventListener('oTransitionEnd', events, false);\n          element.addEventListener('otransitionend', events, false);\n          element.addEventListener('transitionend', events, false);\n        }\n\n        // set resize event on window\n        window.addEventListener('resize', events, false);\n\n      } else {\n\n        window.onresize = function () { setup(); }; // to play nice with old IE\n\n      }\n    };\n\n  }\n});\n\n})(ionic);\n\n/*eslint space-after-keywords: 0*/\n\n/**\n * Swiper 3.2.7\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n *\n * http://www.idangero.us/swiper/\n *\n * Copyright 2015, Vladimir Kharlampidi\n * The iDangero.us\n * http://www.idangero.us/\n *\n * Licensed under MIT\n *\n * Released on: December 7, 2015\n */\n(function () {\n    'use strict';\n    var $;\n    /*===========================\n    Swiper\n    ===========================*/\n    var Swiper = function (container, params, _scope, $compile) {\n\n        if (!(this instanceof Swiper)) return new Swiper(container, params);\n\n        var defaults = {\n            direction: 'horizontal',\n            touchEventsTarget: 'container',\n            initialSlide: 0,\n            speed: 300,\n            // autoplay\n            autoplay: false,\n            autoplayDisableOnInteraction: true,\n            // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).\n            iOSEdgeSwipeDetection: false,\n            iOSEdgeSwipeThreshold: 20,\n            // Free mode\n            freeMode: false,\n            freeModeMomentum: true,\n            freeModeMomentumRatio: 1,\n            freeModeMomentumBounce: true,\n            freeModeMomentumBounceRatio: 1,\n            freeModeSticky: false,\n            freeModeMinimumVelocity: 0.02,\n            // Autoheight\n            autoHeight: false,\n            // Set wrapper width\n            setWrapperSize: false,\n            // Virtual Translate\n            virtualTranslate: false,\n            // Effects\n            effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow'\n            coverflow: {\n                rotate: 50,\n                stretch: 0,\n                depth: 100,\n                modifier: 1,\n                slideShadows : true\n            },\n            cube: {\n                slideShadows: true,\n                shadow: true,\n                shadowOffset: 20,\n                shadowScale: 0.94\n            },\n            fade: {\n                crossFade: false\n            },\n            // Parallax\n            parallax: false,\n            // Scrollbar\n            scrollbar: null,\n            scrollbarHide: true,\n            scrollbarDraggable: false,\n            scrollbarSnapOnRelease: false,\n            // Keyboard Mousewheel\n            keyboardControl: false,\n            mousewheelControl: false,\n            mousewheelReleaseOnEdges: false,\n            mousewheelInvert: false,\n            mousewheelForceToAxis: false,\n            mousewheelSensitivity: 1,\n            // Hash Navigation\n            hashnav: false,\n            // Breakpoints\n            breakpoints: undefined,\n            // Slides grid\n            spaceBetween: 0,\n            slidesPerView: 1,\n            slidesPerColumn: 1,\n            slidesPerColumnFill: 'column',\n            slidesPerGroup: 1,\n            centeredSlides: false,\n            slidesOffsetBefore: 0, // in px\n            slidesOffsetAfter: 0, // in px\n            // Round length\n            roundLengths: false,\n            // Touches\n            touchRatio: 1,\n            touchAngle: 45,\n            simulateTouch: true,\n            shortSwipes: true,\n            longSwipes: true,\n            longSwipesRatio: 0.5,\n            longSwipesMs: 300,\n            followFinger: true,\n            onlyExternal: false,\n            threshold: 0,\n            touchMoveStopPropagation: true,\n            // Pagination\n            pagination: null,\n            paginationElement: 'span',\n            paginationClickable: false,\n            paginationHide: false,\n            paginationBulletRender: null,\n            // Resistance\n            resistance: true,\n            resistanceRatio: 0.85,\n            // Next/prev buttons\n            nextButton: null,\n            prevButton: null,\n            // Progress\n            watchSlidesProgress: false,\n            watchSlidesVisibility: false,\n            // Cursor\n            grabCursor: false,\n            // Clicks\n            preventClicks: true,\n            preventClicksPropagation: true,\n            slideToClickedSlide: false,\n            // Lazy Loading\n            lazyLoading: false,\n            lazyLoadingInPrevNext: false,\n            lazyLoadingOnTransitionStart: false,\n            // Images\n            preloadImages: true,\n            updateOnImagesReady: true,\n            // loop\n            loop: false,\n            loopAdditionalSlides: 0,\n            loopedSlides: null,\n            // Control\n            control: undefined,\n            controlInverse: false,\n            controlBy: 'slide', //or 'container'\n            // Swiping/no swiping\n            allowSwipeToPrev: true,\n            allowSwipeToNext: true,\n            swipeHandler: null, //'.swipe-handler',\n            noSwiping: true,\n            noSwipingClass: 'swiper-no-swiping',\n            // NS\n            slideClass: 'swiper-slide',\n            slideActiveClass: 'swiper-slide-active',\n            slideVisibleClass: 'swiper-slide-visible',\n            slideDuplicateClass: 'swiper-slide-duplicate',\n            slideNextClass: 'swiper-slide-next',\n            slidePrevClass: 'swiper-slide-prev',\n            wrapperClass: 'swiper-wrapper',\n            bulletClass: 'swiper-pagination-bullet',\n            bulletActiveClass: 'swiper-pagination-bullet-active',\n            buttonDisabledClass: 'swiper-button-disabled',\n            paginationHiddenClass: 'swiper-pagination-hidden',\n            // Observer\n            observer: false,\n            observeParents: false,\n            // Accessibility\n            a11y: false,\n            prevSlideMessage: 'Previous slide',\n            nextSlideMessage: 'Next slide',\n            firstSlideMessage: 'This is the first slide',\n            lastSlideMessage: 'This is the last slide',\n            paginationBulletMessage: 'Go to slide {{index}}',\n            // Callbacks\n            runCallbacksOnInit: true\n            /*\n            Callbacks:\n            onInit: function (swiper)\n            onDestroy: function (swiper)\n            onClick: function (swiper, e)\n            onTap: function (swiper, e)\n            onDoubleTap: function (swiper, e)\n            onSliderMove: function (swiper, e)\n            onSlideChangeStart: function (swiper)\n            onSlideChangeEnd: function (swiper)\n            onTransitionStart: function (swiper)\n            onTransitionEnd: function (swiper)\n            onImagesReady: function (swiper)\n            onProgress: function (swiper, progress)\n            onTouchStart: function (swiper, e)\n            onTouchMove: function (swiper, e)\n            onTouchMoveOpposite: function (swiper, e)\n            onTouchEnd: function (swiper, e)\n            onReachBeginning: function (swiper)\n            onReachEnd: function (swiper)\n            onSetTransition: function (swiper, duration)\n            onSetTranslate: function (swiper, translate)\n            onAutoplayStart: function (swiper)\n            onAutoplayStop: function (swiper),\n            onLazyImageLoad: function (swiper, slide, image)\n            onLazyImageReady: function (swiper, slide, image)\n            */\n\n        };\n        var initialVirtualTranslate = params && params.virtualTranslate;\n\n        params = params || {};\n        var originalParams = {};\n        for (var param in params) {\n            if (typeof params[param] === 'object' && !(params[param].nodeType || params[param] === window || params[param] === document || (typeof Dom7 !== 'undefined' && params[param] instanceof Dom7) || (typeof jQuery !== 'undefined' && params[param] instanceof jQuery))) {\n                originalParams[param] = {};\n                for (var deepParam in params[param]) {\n                    originalParams[param][deepParam] = params[param][deepParam];\n                }\n            }\n            else {\n                originalParams[param] = params[param];\n            }\n        }\n        for (var def in defaults) {\n            if (typeof params[def] === 'undefined') {\n                params[def] = defaults[def];\n            }\n            else if (typeof params[def] === 'object') {\n                for (var deepDef in defaults[def]) {\n                    if (typeof params[def][deepDef] === 'undefined') {\n                        params[def][deepDef] = defaults[def][deepDef];\n                    }\n                }\n            }\n        }\n\n        // Swiper\n        var s = this;\n\n        // Params\n        s.params = params;\n        s.originalParams = originalParams;\n\n        // Classname\n        s.classNames = [];\n        /*=========================\n          Dom Library and plugins\n          ===========================*/\n        if (typeof $ !== 'undefined' && typeof Dom7 !== 'undefined'){\n            $ = Dom7;\n        }\n        if (typeof $ === 'undefined') {\n            if (typeof Dom7 === 'undefined') {\n                $ = window.Dom7 || window.Zepto || window.jQuery;\n            }\n            else {\n                $ = Dom7;\n            }\n            if (!$) return;\n        }\n        // Export it to Swiper instance\n        s.$ = $;\n\n        /*=========================\n          Breakpoints\n          ===========================*/\n        s.currentBreakpoint = undefined;\n        s.getActiveBreakpoint = function () {\n            //Get breakpoint for window width\n            if (!s.params.breakpoints) return false;\n            var breakpoint = false;\n            var points = [], point;\n            for ( point in s.params.breakpoints ) {\n                if (s.params.breakpoints.hasOwnProperty(point)) {\n                    points.push(point);\n                }\n            }\n            points.sort(function (a, b) {\n                return parseInt(a, 10) > parseInt(b, 10);\n            });\n            for (var i = 0; i < points.length; i++) {\n                point = points[i];\n                if (point >= window.innerWidth && !breakpoint) {\n                    breakpoint = point;\n                }\n            }\n            return breakpoint || 'max';\n        };\n        s.setBreakpoint = function () {\n            //Set breakpoint for window width and update parameters\n            var breakpoint = s.getActiveBreakpoint();\n            if (breakpoint && s.currentBreakpoint !== breakpoint) {\n                var breakPointsParams = breakpoint in s.params.breakpoints ? s.params.breakpoints[breakpoint] : s.originalParams;\n                for ( var param in breakPointsParams ) {\n                    s.params[param] = breakPointsParams[param];\n                }\n                s.currentBreakpoint = breakpoint;\n            }\n        };\n        // Set breakpoint on load\n        if (s.params.breakpoints) {\n            s.setBreakpoint();\n        }\n\n        /*=========================\n          Preparation - Define Container, Wrapper and Pagination\n          ===========================*/\n        s.container = $(container);\n        if (s.container.length === 0) return;\n        if (s.container.length > 1) {\n            s.container.each(function () {\n                new Swiper(this, params);\n            });\n            return;\n        }\n\n        // Save instance in container HTML Element and in data\n        s.container[0].swiper = s;\n        s.container.data('swiper', s);\n\n        s.classNames.push('swiper-container-' + s.params.direction);\n\n        if (s.params.freeMode) {\n            s.classNames.push('swiper-container-free-mode');\n        }\n        if (!s.support.flexbox) {\n            s.classNames.push('swiper-container-no-flexbox');\n            s.params.slidesPerColumn = 1;\n        }\n        if (s.params.autoHeight) {\n            s.classNames.push('swiper-container-autoheight');\n        }\n        // Enable slides progress when required\n        if (s.params.parallax || s.params.watchSlidesVisibility) {\n            s.params.watchSlidesProgress = true;\n        }\n        // Coverflow / 3D\n        if (['cube', 'coverflow'].indexOf(s.params.effect) >= 0) {\n            if (s.support.transforms3d) {\n                s.params.watchSlidesProgress = true;\n                s.classNames.push('swiper-container-3d');\n            }\n            else {\n                s.params.effect = 'slide';\n            }\n        }\n        if (s.params.effect !== 'slide') {\n            s.classNames.push('swiper-container-' + s.params.effect);\n        }\n        if (s.params.effect === 'cube') {\n            s.params.resistanceRatio = 0;\n            s.params.slidesPerView = 1;\n            s.params.slidesPerColumn = 1;\n            s.params.slidesPerGroup = 1;\n            s.params.centeredSlides = false;\n            s.params.spaceBetween = 0;\n            s.params.virtualTranslate = true;\n            s.params.setWrapperSize = false;\n        }\n        if (s.params.effect === 'fade') {\n            s.params.slidesPerView = 1;\n            s.params.slidesPerColumn = 1;\n            s.params.slidesPerGroup = 1;\n            s.params.watchSlidesProgress = true;\n            s.params.spaceBetween = 0;\n            if (typeof initialVirtualTranslate === 'undefined') {\n                s.params.virtualTranslate = true;\n            }\n        }\n\n        // Grab Cursor\n        if (s.params.grabCursor && s.support.touch) {\n            s.params.grabCursor = false;\n        }\n\n        // Wrapper\n        s.wrapper = s.container.children('.' + s.params.wrapperClass);\n\n        // Pagination\n        if (s.params.pagination) {\n            s.paginationContainer = $(s.params.pagination);\n            if (s.params.paginationClickable) {\n                s.paginationContainer.addClass('swiper-pagination-clickable');\n            }\n        }\n\n        // Is Horizontal\n        function isH() {\n            return s.params.direction === 'horizontal';\n        }\n\n        // RTL\n        s.rtl = isH() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');\n        if (s.rtl) {\n            s.classNames.push('swiper-container-rtl');\n        }\n\n        // Wrong RTL support\n        if (s.rtl) {\n            s.wrongRTL = s.wrapper.css('display') === '-webkit-box';\n        }\n\n        // Columns\n        if (s.params.slidesPerColumn > 1) {\n            s.classNames.push('swiper-container-multirow');\n        }\n\n        // Check for Android\n        if (s.device.android) {\n            s.classNames.push('swiper-container-android');\n        }\n\n        // Add classes\n        s.container.addClass(s.classNames.join(' '));\n\n        // Translate\n        s.translate = 0;\n\n        // Progress\n        s.progress = 0;\n\n        // Velocity\n        s.velocity = 0;\n\n        /*=========================\n          Locks, unlocks\n          ===========================*/\n        s.lockSwipeToNext = function () {\n            s.params.allowSwipeToNext = false;\n        };\n        s.lockSwipeToPrev = function () {\n            s.params.allowSwipeToPrev = false;\n        };\n        s.lockSwipes = function () {\n            s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;\n        };\n        s.unlockSwipeToNext = function () {\n            s.params.allowSwipeToNext = true;\n        };\n        s.unlockSwipeToPrev = function () {\n            s.params.allowSwipeToPrev = true;\n        };\n        s.unlockSwipes = function () {\n            s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;\n        };\n\n        /*=========================\n          Round helper\n          ===========================*/\n        function round(a) {\n            return Math.floor(a);\n        }\n        /*=========================\n          Set grab cursor\n          ===========================*/\n        if (s.params.grabCursor) {\n            s.container[0].style.cursor = 'move';\n            s.container[0].style.cursor = '-webkit-grab';\n            s.container[0].style.cursor = '-moz-grab';\n            s.container[0].style.cursor = 'grab';\n        }\n        /*=========================\n          Update on Images Ready\n          ===========================*/\n        s.imagesToLoad = [];\n        s.imagesLoaded = 0;\n\n        s.loadImage = function (imgElement, src, srcset, checkForComplete, callback) {\n            var image;\n            function onReady () {\n                if (callback) callback();\n            }\n            if (!imgElement.complete || !checkForComplete) {\n                if (src) {\n                    image = new window.Image();\n                    image.onload = onReady;\n                    image.onerror = onReady;\n                    if (srcset) {\n                        image.srcset = srcset;\n                    }\n                    if (src) {\n                        image.src = src;\n                    }\n                } else {\n                    onReady();\n                }\n\n            } else {//image already loaded...\n                onReady();\n            }\n        };\n        s.preloadImages = function () {\n            s.imagesToLoad = s.container.find('img');\n            function _onReady() {\n                if (typeof s === 'undefined' || s === null) return;\n                if (s.imagesLoaded !== undefined) s.imagesLoaded++;\n                if (s.imagesLoaded === s.imagesToLoad.length) {\n                    if (s.params.updateOnImagesReady) s.update();\n                    s.emit('onImagesReady', s);\n                }\n            }\n            for (var i = 0; i < s.imagesToLoad.length; i++) {\n                s.loadImage(s.imagesToLoad[i], (s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src')), (s.imagesToLoad[i].srcset || s.imagesToLoad[i].getAttribute('srcset')), true, _onReady);\n            }\n        };\n\n        /*=========================\n          Autoplay\n          ===========================*/\n        s.autoplayTimeoutId = undefined;\n        s.autoplaying = false;\n        s.autoplayPaused = false;\n        function autoplay() {\n            s.autoplayTimeoutId = setTimeout(function () {\n                if (s.params.loop) {\n                    s.fixLoop();\n                    s._slideNext();\n                }\n                else {\n                    if (!s.isEnd) {\n                        s._slideNext();\n                    }\n                    else {\n                        if (!params.autoplayStopOnLast) {\n                            s._slideTo(0);\n                        }\n                        else {\n                            s.stopAutoplay();\n                        }\n                    }\n                }\n            }, s.params.autoplay);\n        }\n        s.startAutoplay = function () {\n            if (typeof s.autoplayTimeoutId !== 'undefined') return false;\n            if (!s.params.autoplay) return false;\n            if (s.autoplaying) return false;\n            s.autoplaying = true;\n            s.emit('onAutoplayStart', s);\n            autoplay();\n        };\n        s.stopAutoplay = function (internal) {\n            if (!s.autoplayTimeoutId) return;\n            if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);\n            s.autoplaying = false;\n            s.autoplayTimeoutId = undefined;\n            s.emit('onAutoplayStop', s);\n        };\n        s.pauseAutoplay = function (speed) {\n            if (s.autoplayPaused) return;\n            if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);\n            s.autoplayPaused = true;\n            if (speed === 0) {\n                s.autoplayPaused = false;\n                autoplay();\n            }\n            else {\n                s.wrapper.transitionEnd(function () {\n                    if (!s) return;\n                    s.autoplayPaused = false;\n                    if (!s.autoplaying) {\n                        s.stopAutoplay();\n                    }\n                    else {\n                        autoplay();\n                    }\n                });\n            }\n        };\n        /*=========================\n          Min/Max Translate\n          ===========================*/\n        s.minTranslate = function () {\n            return (-s.snapGrid[0]);\n        };\n        s.maxTranslate = function () {\n            return (-s.snapGrid[s.snapGrid.length - 1]);\n        };\n        /*=========================\n          Slider/slides sizes\n          ===========================*/\n        s.updateAutoHeight = function () {\n            // Update Height\n            var newHeight = s.slides.eq(s.activeIndex)[0].offsetHeight;\n            if (newHeight) s.wrapper.css('height', s.slides.eq(s.activeIndex)[0].offsetHeight + 'px');\n        };\n        s.updateContainerSize = function () {\n            var width, height;\n            if (typeof s.params.width !== 'undefined') {\n                width = s.params.width;\n            }\n            else {\n                width = s.container[0].clientWidth;\n            }\n            if (typeof s.params.height !== 'undefined') {\n                height = s.params.height;\n            }\n            else {\n                height = s.container[0].clientHeight;\n            }\n            if (width === 0 && isH() || height === 0 && !isH()) {\n                return;\n            }\n\n            //Subtract paddings\n            width = width - parseInt(s.container.css('padding-left'), 10) - parseInt(s.container.css('padding-right'), 10);\n            height = height - parseInt(s.container.css('padding-top'), 10) - parseInt(s.container.css('padding-bottom'), 10);\n\n            // Store values\n            s.width = width;\n            s.height = height;\n            s.size = isH() ? s.width : s.height;\n        };\n\n        s.updateSlidesSize = function () {\n            s.slides = s.wrapper.children('.' + s.params.slideClass);\n            s.snapGrid = [];\n            s.slidesGrid = [];\n            s.slidesSizesGrid = [];\n\n            var spaceBetween = s.params.spaceBetween,\n                slidePosition = -s.params.slidesOffsetBefore,\n                i,\n                prevSlideSize = 0,\n                index = 0;\n            if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {\n                spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;\n            }\n\n            s.virtualSize = -spaceBetween;\n            // reset margins\n            if (s.rtl) s.slides.css({marginLeft: '', marginTop: ''});\n            else s.slides.css({marginRight: '', marginBottom: ''});\n\n            var slidesNumberEvenToRows;\n            if (s.params.slidesPerColumn > 1) {\n                if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {\n                    slidesNumberEvenToRows = s.slides.length;\n                }\n                else {\n                    slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;\n                }\n                if (s.params.slidesPerView !== 'auto' && s.params.slidesPerColumnFill === 'row') {\n                    slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.params.slidesPerView * s.params.slidesPerColumn);\n                }\n            }\n\n            // Calc slides\n            var slideSize;\n            var slidesPerColumn = s.params.slidesPerColumn;\n            var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;\n            var numFullColumns = slidesPerRow - (s.params.slidesPerColumn * slidesPerRow - s.slides.length);\n            for (i = 0; i < s.slides.length; i++) {\n                slideSize = 0;\n                var slide = s.slides.eq(i);\n                if (s.params.slidesPerColumn > 1) {\n                    // Set slides order\n                    var newSlideOrderIndex;\n                    var column, row;\n                    if (s.params.slidesPerColumnFill === 'column') {\n                        column = Math.floor(i / slidesPerColumn);\n                        row = i - column * slidesPerColumn;\n                        if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn-1)) {\n                            if (++row >= slidesPerColumn) {\n                                row = 0;\n                                column++;\n                            }\n                        }\n                        newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;\n                        slide\n                            .css({\n                                '-webkit-box-ordinal-group': newSlideOrderIndex,\n                                '-moz-box-ordinal-group': newSlideOrderIndex,\n                                '-ms-flex-order': newSlideOrderIndex,\n                                '-webkit-order': newSlideOrderIndex,\n                                'order': newSlideOrderIndex\n                            });\n                    }\n                    else {\n                        row = Math.floor(i / slidesPerRow);\n                        column = i - row * slidesPerRow;\n                    }\n                    slide\n                        .css({\n                            'margin-top': (row !== 0 && s.params.spaceBetween) && (s.params.spaceBetween + 'px')\n                        })\n                        .attr('data-swiper-column', column)\n                        .attr('data-swiper-row', row);\n\n                }\n                if (slide.css('display') === 'none') continue;\n                if (s.params.slidesPerView === 'auto') {\n                    slideSize = isH() ? slide.outerWidth(true) : slide.outerHeight(true);\n                    if (s.params.roundLengths) slideSize = round(slideSize);\n                }\n                else {\n                    slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;\n                    if (s.params.roundLengths) slideSize = round(slideSize);\n\n                    if (isH()) {\n                        s.slides[i].style.width = slideSize + 'px';\n                    }\n                    else {\n                        s.slides[i].style.height = slideSize + 'px';\n                    }\n                }\n                s.slides[i].swiperSlideSize = slideSize;\n                s.slidesSizesGrid.push(slideSize);\n\n\n                if (s.params.centeredSlides) {\n                    slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;\n                    if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;\n                    if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;\n                    if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);\n                    s.slidesGrid.push(slidePosition);\n                }\n                else {\n                    if ((index) % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);\n                    s.slidesGrid.push(slidePosition);\n                    slidePosition = slidePosition + slideSize + spaceBetween;\n                }\n\n                s.virtualSize += slideSize + spaceBetween;\n\n                prevSlideSize = slideSize;\n\n                index ++;\n            }\n            s.virtualSize = Math.max(s.virtualSize, s.size) + s.params.slidesOffsetAfter;\n            var newSlidesGrid;\n\n            if (\n                s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {\n                s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n            }\n            if (!s.support.flexbox || s.params.setWrapperSize) {\n                if (isH()) s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n                else s.wrapper.css({height: s.virtualSize + s.params.spaceBetween + 'px'});\n            }\n\n            if (s.params.slidesPerColumn > 1) {\n                s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;\n                s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;\n                s.wrapper.css({width: s.virtualSize + s.params.spaceBetween + 'px'});\n                if (s.params.centeredSlides) {\n                    newSlidesGrid = [];\n                    for (i = 0; i < s.snapGrid.length; i++) {\n                        if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);\n                    }\n                    s.snapGrid = newSlidesGrid;\n                }\n            }\n\n            // Remove last grid elements depending on width\n            if (!s.params.centeredSlides) {\n                newSlidesGrid = [];\n                for (i = 0; i < s.snapGrid.length; i++) {\n                    if (s.snapGrid[i] <= s.virtualSize - s.size) {\n                        newSlidesGrid.push(s.snapGrid[i]);\n                    }\n                }\n                s.snapGrid = newSlidesGrid;\n                if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {\n                    s.snapGrid.push(s.virtualSize - s.size);\n                }\n            }\n            if (s.snapGrid.length === 0) s.snapGrid = [0];\n\n            if (s.params.spaceBetween !== 0) {\n                if (isH()) {\n                    if (s.rtl) s.slides.css({marginLeft: spaceBetween + 'px'});\n                    else s.slides.css({marginRight: spaceBetween + 'px'});\n                }\n                else s.slides.css({marginBottom: spaceBetween + 'px'});\n            }\n            if (s.params.watchSlidesProgress) {\n                s.updateSlidesOffset();\n            }\n        };\n        s.updateSlidesOffset = function () {\n            for (var i = 0; i < s.slides.length; i++) {\n                s.slides[i].swiperSlideOffset = isH() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;\n            }\n        };\n\n        /*=========================\n          Slider/slides progress\n          ===========================*/\n        s.updateSlidesProgress = function (translate) {\n            if (typeof translate === 'undefined') {\n                translate = s.translate || 0;\n            }\n            if (s.slides.length === 0) return;\n            if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();\n\n            var offsetCenter = -translate;\n            if (s.rtl) offsetCenter = translate;\n\n            // Visible Slides\n            s.slides.removeClass(s.params.slideVisibleClass);\n            for (var i = 0; i < s.slides.length; i++) {\n                var slide = s.slides[i];\n                var slideProgress = (offsetCenter - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.params.spaceBetween);\n                if (s.params.watchSlidesVisibility) {\n                    var slideBefore = -(offsetCenter - slide.swiperSlideOffset);\n                    var slideAfter = slideBefore + s.slidesSizesGrid[i];\n                    var isVisible =\n                        (slideBefore >= 0 && slideBefore < s.size) ||\n                        (slideAfter > 0 && slideAfter <= s.size) ||\n                        (slideBefore <= 0 && slideAfter >= s.size);\n                    if (isVisible) {\n                        s.slides.eq(i).addClass(s.params.slideVisibleClass);\n                    }\n                }\n                slide.progress = s.rtl ? -slideProgress : slideProgress;\n            }\n        };\n        s.updateProgress = function (translate) {\n            if (typeof translate === 'undefined') {\n                translate = s.translate || 0;\n            }\n            var translatesDiff = s.maxTranslate() - s.minTranslate();\n            var wasBeginning = s.isBeginning;\n            var wasEnd = s.isEnd;\n            if (translatesDiff === 0) {\n                s.progress = 0;\n                s.isBeginning = s.isEnd = true;\n            }\n            else {\n                s.progress = (translate - s.minTranslate()) / (translatesDiff);\n                s.isBeginning = s.progress <= 0;\n                s.isEnd = s.progress >= 1;\n            }\n            if (s.isBeginning && !wasBeginning) s.emit('onReachBeginning', s);\n            if (s.isEnd && !wasEnd) s.emit('onReachEnd', s);\n\n            if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);\n            s.emit('onProgress', s, s.progress);\n        };\n        s.updateActiveIndex = function () {\n            var translate = s.rtl ? s.translate : -s.translate;\n            var newActiveIndex, i, snapIndex;\n            for (i = 0; i < s.slidesGrid.length; i ++) {\n                if (typeof s.slidesGrid[i + 1] !== 'undefined') {\n                    if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {\n                        newActiveIndex = i;\n                    }\n                    else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {\n                        newActiveIndex = i + 1;\n                    }\n                }\n                else {\n                    if (translate >= s.slidesGrid[i]) {\n                        newActiveIndex = i;\n                    }\n                }\n            }\n            // Normalize slideIndex\n            if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;\n            // for (i = 0; i < s.slidesGrid.length; i++) {\n                // if (- translate >= s.slidesGrid[i]) {\n                    // newActiveIndex = i;\n                // }\n            // }\n            snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);\n            if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;\n\n            if (newActiveIndex === s.activeIndex) {\n                return;\n            }\n            s.snapIndex = snapIndex;\n            s.previousIndex = s.activeIndex;\n            s.activeIndex = newActiveIndex;\n            s.updateClasses();\n        };\n\n        /*=========================\n          Classes\n          ===========================*/\n        s.updateClasses = function () {\n            s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass);\n            var activeSlide = s.slides.eq(s.activeIndex);\n            // Active classes\n            activeSlide.addClass(s.params.slideActiveClass);\n            activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);\n            activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);\n\n            // Pagination\n            if (s.bullets && s.bullets.length > 0) {\n                s.bullets.removeClass(s.params.bulletActiveClass);\n                var bulletIndex;\n                if (s.params.loop) {\n                    bulletIndex = Math.ceil(s.activeIndex - s.loopedSlides)/s.params.slidesPerGroup;\n                    if (bulletIndex > s.slides.length - 1 - s.loopedSlides * 2) {\n                        bulletIndex = bulletIndex - (s.slides.length - s.loopedSlides * 2);\n                    }\n                    if (bulletIndex > s.bullets.length - 1) bulletIndex = bulletIndex - s.bullets.length;\n                }\n                else {\n                    if (typeof s.snapIndex !== 'undefined') {\n                        bulletIndex = s.snapIndex;\n                    }\n                    else {\n                        bulletIndex = s.activeIndex || 0;\n                    }\n                }\n                if (s.paginationContainer.length > 1) {\n                    s.bullets.each(function () {\n                        if ($(this).index() === bulletIndex) $(this).addClass(s.params.bulletActiveClass);\n                    });\n                }\n                else {\n                    s.bullets.eq(bulletIndex).addClass(s.params.bulletActiveClass);\n                }\n            }\n\n            // Next/active buttons\n            if (!s.params.loop) {\n                if (s.params.prevButton) {\n                    if (s.isBeginning) {\n                        $(s.params.prevButton).addClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));\n                    }\n                    else {\n                        $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));\n                    }\n                }\n                if (s.params.nextButton) {\n                    if (s.isEnd) {\n                        $(s.params.nextButton).addClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));\n                    }\n                    else {\n                        $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);\n                        if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));\n                    }\n                }\n            }\n        };\n\n        /*=========================\n          Pagination\n          ===========================*/\n        s.updatePagination = function () {\n            if (!s.params.pagination) return;\n            if (s.paginationContainer && s.paginationContainer.length > 0) {\n                var bulletsHTML = '';\n                var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;\n                for (var i = 0; i < numberOfBullets; i++) {\n                    if (s.params.paginationBulletRender) {\n                        bulletsHTML += s.params.paginationBulletRender(i, s.params.bulletClass);\n                    }\n                    else {\n                        bulletsHTML += '<' + s.params.paginationElement+' class=\"' + s.params.bulletClass + '\"></' + s.params.paginationElement + '>';\n                    }\n                }\n                s.paginationContainer.html(bulletsHTML);\n                s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);\n                if (s.params.paginationClickable && s.params.a11y && s.a11y) {\n                    s.a11y.initPagination();\n                }\n            }\n        };\n        /*=========================\n          Common update method\n          ===========================*/\n        s.update = function (updateTranslate) {\n            s.updateContainerSize();\n            s.updateSlidesSize();\n            s.updateProgress();\n            s.updatePagination();\n            s.updateClasses();\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.set();\n            }\n            function forceSetTranslate() {\n                newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());\n                s.setWrapperTranslate(newTranslate);\n                s.updateActiveIndex();\n                s.updateClasses();\n            }\n            if (updateTranslate) {\n                var translated, newTranslate;\n                if (s.controller && s.controller.spline) {\n                    s.controller.spline = undefined;\n                }\n                if (s.params.freeMode) {\n                    forceSetTranslate();\n                    if (s.params.autoHeight) {\n                        s.updateAutoHeight();\n                    }\n                }\n                else {\n                    if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {\n                        translated = s.slideTo(s.slides.length - 1, 0, false, true);\n                    }\n                    else {\n                        translated = s.slideTo(s.activeIndex, 0, false, true);\n                    }\n                    if (!translated) {\n                        forceSetTranslate();\n                    }\n                }\n            }\n            else if (s.params.autoHeight) {\n                s.updateAutoHeight();\n            }\n        };\n\n        /*=========================\n          Resize Handler\n          ===========================*/\n        s.onResize = function (forceUpdatePagination) {\n            //Breakpoints\n            if (s.params.breakpoints) {\n                s.setBreakpoint();\n            }\n\n            // Disable locks on resize\n            var allowSwipeToPrev = s.params.allowSwipeToPrev;\n            var allowSwipeToNext = s.params.allowSwipeToNext;\n            s.params.allowSwipeToPrev = s.params.allowSwipeToNext = true;\n\n            s.updateContainerSize();\n            s.updateSlidesSize();\n            if (s.params.slidesPerView === 'auto' || s.params.freeMode || forceUpdatePagination) s.updatePagination();\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.set();\n            }\n            if (s.controller && s.controller.spline) {\n                s.controller.spline = undefined;\n            }\n            if (s.params.freeMode) {\n                var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());\n                s.setWrapperTranslate(newTranslate);\n                s.updateActiveIndex();\n                s.updateClasses();\n\n                if (s.params.autoHeight) {\n                    s.updateAutoHeight();\n                }\n            }\n            else {\n                s.updateClasses();\n                if ((s.params.slidesPerView === 'auto' || s.params.slidesPerView > 1) && s.isEnd && !s.params.centeredSlides) {\n                    s.slideTo(s.slides.length - 1, 0, false, true);\n                }\n                else {\n                    s.slideTo(s.activeIndex, 0, false, true);\n                }\n            }\n            // Return locks after resize\n            s.params.allowSwipeToPrev = allowSwipeToPrev;\n            s.params.allowSwipeToNext = allowSwipeToNext;\n        };\n\n        /*=========================\n          Events\n          ===========================*/\n\n        //Define Touch Events\n        var desktopEvents = ['mousedown', 'mousemove', 'mouseup'];\n        if (window.navigator.pointerEnabled) desktopEvents = ['pointerdown', 'pointermove', 'pointerup'];\n        else if (window.navigator.msPointerEnabled) desktopEvents = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp'];\n        s.touchEvents = {\n            start : s.support.touch || !s.params.simulateTouch  ? 'touchstart' : desktopEvents[0],\n            move : s.support.touch || !s.params.simulateTouch ? 'touchmove' : desktopEvents[1],\n            end : s.support.touch || !s.params.simulateTouch ? 'touchend' : desktopEvents[2]\n        };\n\n\n        // WP8 Touch Events Fix\n        if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {\n            (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);\n        }\n\n        // Attach/detach events\n        s.initEvents = function (detach) {\n            var actionDom = detach ? 'off' : 'on';\n            var action = detach ? 'removeEventListener' : 'addEventListener';\n            var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0];\n            var target = s.support.touch ? touchEventsTarget : document;\n\n            var moveCapture = s.params.nested ? true : false;\n\n            //Touch Events\n            if (s.browser.ie) {\n                touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);\n                target[action](s.touchEvents.move, s.onTouchMove, moveCapture);\n                target[action](s.touchEvents.end, s.onTouchEnd, false);\n            }\n            else {\n                if (s.support.touch) {\n                    touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);\n                    touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);\n                    touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, false);\n                }\n                if (params.simulateTouch && !s.device.ios && !s.device.android) {\n                    touchEventsTarget[action]('mousedown', s.onTouchStart, false);\n                    document[action]('mousemove', s.onTouchMove, moveCapture);\n                    document[action]('mouseup', s.onTouchEnd, false);\n                }\n            }\n            window[action]('resize', s.onResize);\n\n            // Next, Prev, Index\n            if (s.params.nextButton) {\n                $(s.params.nextButton)[actionDom]('click', s.onClickNext);\n                if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);\n            }\n            if (s.params.prevButton) {\n                $(s.params.prevButton)[actionDom]('click', s.onClickPrev);\n                if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);\n            }\n            if (s.params.pagination && s.params.paginationClickable) {\n                $(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);\n                if (s.params.a11y && s.a11y) $(s.paginationContainer)[actionDom]('keydown', '.' + s.params.bulletClass, s.a11y.onEnterKey);\n            }\n\n            // Prevent Links Clicks\n            if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);\n        };\n        s.attachEvents = function (detach) {\n            s.initEvents();\n        };\n        s.detachEvents = function () {\n            s.initEvents(true);\n        };\n\n        /*=========================\n          Handle Clicks\n          ===========================*/\n        // Prevent Clicks\n        s.allowClick = true;\n        s.preventClicks = function (e) {\n            if (!s.allowClick) {\n                if (s.params.preventClicks) e.preventDefault();\n                if (s.params.preventClicksPropagation && s.animating) {\n                    e.stopPropagation();\n                    e.stopImmediatePropagation();\n                }\n            }\n        };\n        // Clicks\n        s.onClickNext = function (e) {\n            e.preventDefault();\n            if (s.isEnd && !s.params.loop) return;\n            s.slideNext();\n        };\n        s.onClickPrev = function (e) {\n            e.preventDefault();\n            if (s.isBeginning && !s.params.loop) return;\n            s.slidePrev();\n        };\n        s.onClickIndex = function (e) {\n            e.preventDefault();\n            var index = $(this).index() * s.params.slidesPerGroup;\n            if (s.params.loop) index = index + s.loopedSlides;\n            s.slideTo(index);\n        };\n\n        /*=========================\n          Handle Touches\n          ===========================*/\n        function findElementInEvent(e, selector) {\n            var el = $(e.target);\n            if (!el.is(selector)) {\n                if (typeof selector === 'string') {\n                    el = el.parents(selector);\n                }\n                else if (selector.nodeType) {\n                    var found;\n                    el.parents().each(function (index, _el) {\n                        if (_el === selector) found = selector;\n                    });\n                    if (!found) return undefined;\n                    else return selector;\n                }\n            }\n            if (el.length === 0) {\n                return undefined;\n            }\n            return el[0];\n        }\n        s.updateClickedSlide = function (e) {\n            var slide = findElementInEvent(e, '.' + s.params.slideClass);\n            var slideFound = false;\n            if (slide) {\n                for (var i = 0; i < s.slides.length; i++) {\n                    if (s.slides[i] === slide) slideFound = true;\n                }\n            }\n\n            if (slide && slideFound) {\n                s.clickedSlide = slide;\n                s.clickedIndex = $(slide).index();\n            }\n            else {\n                s.clickedSlide = undefined;\n                s.clickedIndex = undefined;\n                return;\n            }\n            if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {\n                var slideToIndex = s.clickedIndex,\n                    realIndex,\n                    duplicatedSlides;\n                if (s.params.loop) {\n                    if (s.animating) return;\n                    realIndex = $(s.clickedSlide).attr('data-swiper-slide-index');\n                    if (s.params.centeredSlides) {\n                        if ((slideToIndex < s.loopedSlides - s.params.slidesPerView/2) || (slideToIndex > s.slides.length - s.loopedSlides + s.params.slidesPerView/2)) {\n                            s.fixLoop();\n                            slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index=\"' + realIndex + '\"]:not(.swiper-slide-duplicate)').eq(0).index();\n                            setTimeout(function () {\n                                s.slideTo(slideToIndex);\n                            }, 0);\n                        }\n                        else {\n                            s.slideTo(slideToIndex);\n                        }\n                    }\n                    else {\n                        if (slideToIndex > s.slides.length - s.params.slidesPerView) {\n                            s.fixLoop();\n                            slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index=\"' + realIndex + '\"]:not(.swiper-slide-duplicate)').eq(0).index();\n                            setTimeout(function () {\n                                s.slideTo(slideToIndex);\n                            }, 0);\n                        }\n                        else {\n                            s.slideTo(slideToIndex);\n                        }\n                    }\n                }\n                else {\n                    s.slideTo(slideToIndex);\n                }\n            }\n        };\n\n        var isTouched,\n            isMoved,\n            allowTouchCallbacks,\n            touchStartTime,\n            isScrolling,\n            currentTranslate,\n            startTranslate,\n            allowThresholdMove,\n            // Form elements to match\n            formElements = 'input, select, textarea, button',\n            // Last click time\n            lastClickTime = Date.now(), clickTimeout,\n            //Velocities\n            velocities = [],\n            allowMomentumBounce;\n\n        // Animating Flag\n        s.animating = false;\n\n        // Touches information\n        s.touches = {\n            startX: 0,\n            startY: 0,\n            currentX: 0,\n            currentY: 0,\n            diff: 0\n        };\n\n        // Touch handlers\n        var isTouchEvent, startMoving;\n        s.onTouchStart = function (e) {\n            if (e.originalEvent) e = e.originalEvent;\n            isTouchEvent = e.type === 'touchstart';\n            if (!isTouchEvent && 'which' in e && e.which === 3) return;\n            if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {\n                s.allowClick = true;\n                return;\n            }\n            if (s.params.swipeHandler) {\n                if (!findElementInEvent(e, s.params.swipeHandler)) return;\n            }\n\n            var startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;\n            var startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;\n\n            // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore\n            if(s.device.ios && s.params.iOSEdgeSwipeDetection && startX <= s.params.iOSEdgeSwipeThreshold) {\n                return;\n            }\n\n            isTouched = true;\n            isMoved = false;\n            allowTouchCallbacks = true;\n            isScrolling = undefined;\n            startMoving = undefined;\n            s.touches.startX = startX;\n            s.touches.startY = startY;\n            touchStartTime = Date.now();\n            s.allowClick = true;\n            s.updateContainerSize();\n            s.swipeDirection = undefined;\n            if (s.params.threshold > 0) allowThresholdMove = false;\n            if (e.type !== 'touchstart') {\n                var preventDefault = true;\n                if ($(e.target).is(formElements)) preventDefault = false;\n                if (document.activeElement && $(document.activeElement).is(formElements)) {\n                    document.activeElement.blur();\n                }\n                if (preventDefault) {\n                    e.preventDefault();\n                }\n            }\n            s.emit('onTouchStart', s, e);\n        };\n\n        s.onTouchMove = function (e) {\n            if (e.originalEvent) e = e.originalEvent;\n            if (isTouchEvent && e.type === 'mousemove') return;\n            if (e.preventedByNestedSwiper) return;\n            if (s.params.onlyExternal) {\n                // isMoved = true;\n                s.allowClick = false;\n                if (isTouched) {\n                    s.touches.startX = s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n                    s.touches.startY = s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n                    touchStartTime = Date.now();\n                }\n                return;\n            }\n            if (isTouchEvent && document.activeElement) {\n                if (e.target === document.activeElement && $(e.target).is(formElements)) {\n                    isMoved = true;\n                    s.allowClick = false;\n                    return;\n                }\n            }\n            if (allowTouchCallbacks) {\n                s.emit('onTouchMove', s, e);\n            }\n            if (e.targetTouches && e.targetTouches.length > 1) return;\n\n            s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;\n            s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;\n\n            if (typeof isScrolling === 'undefined') {\n                var touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;\n                isScrolling = isH() ? touchAngle > s.params.touchAngle : (90 - touchAngle > s.params.touchAngle);\n            }\n            if (isScrolling) {\n                s.emit('onTouchMoveOpposite', s, e);\n            }\n            if (typeof startMoving === 'undefined' && s.browser.ieTouch) {\n                if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {\n                    startMoving = true;\n                }\n            }\n            if (!isTouched) return;\n            if (isScrolling)  {\n                isTouched = false;\n                return;\n            }\n            if (!startMoving && s.browser.ieTouch) {\n                return;\n            }\n            s.allowClick = false;\n            s.emit('onSliderMove', s, e);\n            e.preventDefault();\n            if (s.params.touchMoveStopPropagation && !s.params.nested) {\n                e.stopPropagation();\n            }\n\n            if (!isMoved) {\n                if (params.loop) {\n                    s.fixLoop();\n                }\n                startTranslate = s.getWrapperTranslate();\n                s.setWrapperTransition(0);\n                if (s.animating) {\n                    s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');\n                }\n                if (s.params.autoplay && s.autoplaying) {\n                    if (s.params.autoplayDisableOnInteraction) {\n                        s.stopAutoplay();\n                    }\n                    else {\n                        s.pauseAutoplay();\n                    }\n                }\n                allowMomentumBounce = false;\n                //Grab Cursor\n                if (s.params.grabCursor) {\n                    s.container[0].style.cursor = 'move';\n                    s.container[0].style.cursor = '-webkit-grabbing';\n                    s.container[0].style.cursor = '-moz-grabbin';\n                    s.container[0].style.cursor = 'grabbing';\n                }\n            }\n            isMoved = true;\n\n            var diff = s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;\n\n            diff = diff * s.params.touchRatio;\n            if (s.rtl) diff = -diff;\n\n            s.swipeDirection = diff > 0 ? 'prev' : 'next';\n            currentTranslate = diff + startTranslate;\n\n            var disableParentSwiper = true;\n            if ((diff > 0 && currentTranslate > s.minTranslate())) {\n                disableParentSwiper = false;\n                if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);\n            }\n            else if (diff < 0 && currentTranslate < s.maxTranslate()) {\n                disableParentSwiper = false;\n                if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);\n            }\n\n            if (disableParentSwiper) {\n                e.preventedByNestedSwiper = true;\n            }\n\n            // Directions locks\n            if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {\n                currentTranslate = startTranslate;\n            }\n            if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {\n                currentTranslate = startTranslate;\n            }\n\n            if (!s.params.followFinger) return;\n\n            // Threshold\n            if (s.params.threshold > 0) {\n                if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {\n                    if (!allowThresholdMove) {\n                        allowThresholdMove = true;\n                        s.touches.startX = s.touches.currentX;\n                        s.touches.startY = s.touches.currentY;\n                        currentTranslate = startTranslate;\n                        s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;\n                        return;\n                    }\n                }\n                else {\n                    currentTranslate = startTranslate;\n                    return;\n                }\n            }\n            // Update active index in free mode\n            if (s.params.freeMode || s.params.watchSlidesProgress) {\n                s.updateActiveIndex();\n            }\n            if (s.params.freeMode) {\n                //Velocity\n                if (velocities.length === 0) {\n                    velocities.push({\n                        position: s.touches[isH() ? 'startX' : 'startY'],\n                        time: touchStartTime\n                    });\n                }\n                velocities.push({\n                    position: s.touches[isH() ? 'currentX' : 'currentY'],\n                    time: (new window.Date()).getTime()\n                });\n            }\n            // Update progress\n            s.updateProgress(currentTranslate);\n            // Update translate\n            s.setWrapperTranslate(currentTranslate);\n        };\n        s.onTouchEnd = function (e) {\n            if (e.originalEvent) e = e.originalEvent;\n            if (allowTouchCallbacks) {\n                s.emit('onTouchEnd', s, e);\n            }\n            allowTouchCallbacks = false;\n            if (!isTouched) return;\n            //Return Grab Cursor\n            if (s.params.grabCursor && isMoved && isTouched) {\n                s.container[0].style.cursor = 'move';\n                s.container[0].style.cursor = '-webkit-grab';\n                s.container[0].style.cursor = '-moz-grab';\n                s.container[0].style.cursor = 'grab';\n            }\n\n            // Time diff\n            var touchEndTime = Date.now();\n            var timeDiff = touchEndTime - touchStartTime;\n\n            // Tap, doubleTap, Click\n            if (s.allowClick) {\n                s.updateClickedSlide(e);\n                s.emit('onTap', s, e);\n                if (timeDiff < 300 && (touchEndTime - lastClickTime) > 300) {\n                    if (clickTimeout) clearTimeout(clickTimeout);\n                    clickTimeout = setTimeout(function () {\n                        if (!s) return;\n                        if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {\n                            s.paginationContainer.toggleClass(s.params.paginationHiddenClass);\n                        }\n                        s.emit('onClick', s, e);\n                    }, 300);\n\n                }\n                if (timeDiff < 300 && (touchEndTime - lastClickTime) < 300) {\n                    if (clickTimeout) clearTimeout(clickTimeout);\n                    s.emit('onDoubleTap', s, e);\n                }\n            }\n\n            lastClickTime = Date.now();\n            setTimeout(function () {\n                if (s) s.allowClick = true;\n            }, 0);\n\n            if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {\n                isTouched = isMoved = false;\n                return;\n            }\n            isTouched = isMoved = false;\n\n            var currentPos;\n            if (s.params.followFinger) {\n                currentPos = s.rtl ? s.translate : -s.translate;\n            }\n            else {\n                currentPos = -currentTranslate;\n            }\n            if (s.params.freeMode) {\n                if (currentPos < -s.minTranslate()) {\n                    s.slideTo(s.activeIndex);\n                    return;\n                }\n                else if (currentPos > -s.maxTranslate()) {\n                    if (s.slides.length < s.snapGrid.length) {\n                        s.slideTo(s.snapGrid.length - 1);\n                    }\n                    else {\n                        s.slideTo(s.slides.length - 1);\n                    }\n                    return;\n                }\n\n                if (s.params.freeModeMomentum) {\n                    if (velocities.length > 1) {\n                        var lastMoveEvent = velocities.pop(), velocityEvent = velocities.pop();\n\n                        var distance = lastMoveEvent.position - velocityEvent.position;\n                        var time = lastMoveEvent.time - velocityEvent.time;\n                        s.velocity = distance / time;\n                        s.velocity = s.velocity / 2;\n                        if (Math.abs(s.velocity) < s.params.freeModeMinimumVelocity) {\n                            s.velocity = 0;\n                        }\n                        // this implies that the user stopped moving a finger then released.\n                        // There would be no events with distance zero, so the last event is stale.\n                        if (time > 150 || (new window.Date().getTime() - lastMoveEvent.time) > 300) {\n                            s.velocity = 0;\n                        }\n                    } else {\n                        s.velocity = 0;\n                    }\n\n                    velocities.length = 0;\n                    var momentumDuration = 1000 * s.params.freeModeMomentumRatio;\n                    var momentumDistance = s.velocity * momentumDuration;\n\n                    var newPosition = s.translate + momentumDistance;\n                    if (s.rtl) newPosition = - newPosition;\n                    var doBounce = false;\n                    var afterBouncePosition;\n                    var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;\n                    if (newPosition < s.maxTranslate()) {\n                        if (s.params.freeModeMomentumBounce) {\n                            if (newPosition + s.maxTranslate() < -bounceAmount) {\n                                newPosition = s.maxTranslate() - bounceAmount;\n                            }\n                            afterBouncePosition = s.maxTranslate();\n                            doBounce = true;\n                            allowMomentumBounce = true;\n                        }\n                        else {\n                            newPosition = s.maxTranslate();\n                        }\n                    }\n                    else if (newPosition > s.minTranslate()) {\n                        if (s.params.freeModeMomentumBounce) {\n                            if (newPosition - s.minTranslate() > bounceAmount) {\n                                newPosition = s.minTranslate() + bounceAmount;\n                            }\n                            afterBouncePosition = s.minTranslate();\n                            doBounce = true;\n                            allowMomentumBounce = true;\n                        }\n                        else {\n                            newPosition = s.minTranslate();\n                        }\n                    }\n                    else if (s.params.freeModeSticky) {\n                        var j = 0,\n                            nextSlide;\n                        for (j = 0; j < s.snapGrid.length; j += 1) {\n                            if (s.snapGrid[j] > -newPosition) {\n                                nextSlide = j;\n                                break;\n                            }\n\n                        }\n                        if (Math.abs(s.snapGrid[nextSlide] - newPosition) < Math.abs(s.snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {\n                            newPosition = s.snapGrid[nextSlide];\n                        } else {\n                            newPosition = s.snapGrid[nextSlide - 1];\n                        }\n                        if (!s.rtl) newPosition = - newPosition;\n                    }\n                    //Fix duration\n                    if (s.velocity !== 0) {\n                        if (s.rtl) {\n                            momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);\n                        }\n                        else {\n                            momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);\n                        }\n                    }\n                    else if (s.params.freeModeSticky) {\n                        s.slideReset();\n                        return;\n                    }\n\n                    if (s.params.freeModeMomentumBounce && doBounce) {\n                        s.updateProgress(afterBouncePosition);\n                        s.setWrapperTransition(momentumDuration);\n                        s.setWrapperTranslate(newPosition);\n                        s.onTransitionStart();\n                        s.animating = true;\n                        s.wrapper.transitionEnd(function () {\n                            if (!s || !allowMomentumBounce) return;\n                            s.emit('onMomentumBounce', s);\n\n                            s.setWrapperTransition(s.params.speed);\n                            s.setWrapperTranslate(afterBouncePosition);\n                            s.wrapper.transitionEnd(function () {\n                                if (!s) return;\n                                s.onTransitionEnd();\n                            });\n                        });\n                    } else if (s.velocity) {\n                        s.updateProgress(newPosition);\n                        s.setWrapperTransition(momentumDuration);\n                        s.setWrapperTranslate(newPosition);\n                        s.onTransitionStart();\n                        if (!s.animating) {\n                            s.animating = true;\n                            s.wrapper.transitionEnd(function () {\n                                if (!s) return;\n                                s.onTransitionEnd();\n                            });\n                        }\n\n                    } else {\n                        s.updateProgress(newPosition);\n                    }\n\n                    s.updateActiveIndex();\n                }\n                if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {\n                    s.updateProgress();\n                    s.updateActiveIndex();\n                }\n                return;\n            }\n\n            // Find current slide\n            var i, stopIndex = 0, groupSize = s.slidesSizesGrid[0];\n            for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {\n                if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {\n                    if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {\n                        stopIndex = i;\n                        groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];\n                    }\n                }\n                else {\n                    if (currentPos >= s.slidesGrid[i]) {\n                        stopIndex = i;\n                        groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];\n                    }\n                }\n            }\n\n            // Find current slide size\n            var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;\n\n            if (timeDiff > s.params.longSwipesMs) {\n                // Long touches\n                if (!s.params.longSwipes) {\n                    s.slideTo(s.activeIndex);\n                    return;\n                }\n                if (s.swipeDirection === 'next') {\n                    if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);\n                    else s.slideTo(stopIndex);\n\n                }\n                if (s.swipeDirection === 'prev') {\n                    if (ratio > (1 - s.params.longSwipesRatio)) s.slideTo(stopIndex + s.params.slidesPerGroup);\n                    else s.slideTo(stopIndex);\n                }\n            }\n            else {\n                // Short swipes\n                if (!s.params.shortSwipes) {\n                    s.slideTo(s.activeIndex);\n                    return;\n                }\n                if (s.swipeDirection === 'next') {\n                    s.slideTo(stopIndex + s.params.slidesPerGroup);\n\n                }\n                if (s.swipeDirection === 'prev') {\n                    s.slideTo(stopIndex);\n                }\n            }\n        };\n        /*=========================\n          Transitions\n          ===========================*/\n        s._slideTo = function (slideIndex, speed) {\n            return s.slideTo(slideIndex, speed, true, true);\n        };\n        s.slideTo = function (slideIndex, speed, runCallbacks, internal) {\n            if (typeof runCallbacks === 'undefined') runCallbacks = true;\n            if (typeof slideIndex === 'undefined') slideIndex = 0;\n            if (slideIndex < 0) slideIndex = 0;\n            s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);\n            if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;\n\n            var translate = - s.snapGrid[s.snapIndex];\n            // Stop autoplay\n            if (s.params.autoplay && s.autoplaying) {\n                if (internal || !s.params.autoplayDisableOnInteraction) {\n                    s.pauseAutoplay(speed);\n                }\n                else {\n                    s.stopAutoplay();\n                }\n            }\n            // Update progress\n            s.updateProgress(translate);\n\n            // Normalize slideIndex\n            for (var i = 0; i < s.slidesGrid.length; i++) {\n                if (- Math.floor(translate * 100) >= Math.floor(s.slidesGrid[i] * 100)) {\n                    slideIndex = i;\n                }\n            }\n\n            // Directions locks\n            if (!s.params.allowSwipeToNext && translate < s.translate && translate < s.minTranslate()) {\n                return false;\n            }\n            if (!s.params.allowSwipeToPrev && translate > s.translate && translate > s.maxTranslate()) {\n                if ((s.activeIndex || 0) !== slideIndex ) return false;\n            }\n\n            // Update Index\n            if (typeof speed === 'undefined') speed = s.params.speed;\n            s.previousIndex = s.activeIndex || 0;\n            s.activeIndex = slideIndex;\n\n            if ((s.rtl && -translate === s.translate) || (!s.rtl && translate === s.translate)) {\n                // Update Height\n                if (s.params.autoHeight) {\n                    s.updateAutoHeight();\n                }\n                s.updateClasses();\n                if (s.params.effect !== 'slide') {\n                    s.setWrapperTranslate(translate);\n                }\n                return false;\n            }\n            s.updateClasses();\n            s.onTransitionStart(runCallbacks);\n\n            if (speed === 0) {\n                s.setWrapperTranslate(translate);\n                s.setWrapperTransition(0);\n                s.onTransitionEnd(runCallbacks);\n            }\n            else {\n                s.setWrapperTranslate(translate);\n                s.setWrapperTransition(speed);\n                if (!s.animating) {\n                    s.animating = true;\n                    s.wrapper.transitionEnd(function () {\n                        if (!s) return;\n                        s.onTransitionEnd(runCallbacks);\n                    });\n                }\n\n            }\n\n            return true;\n        };\n\n        s.onTransitionStart = function (runCallbacks) {\n            if (typeof runCallbacks === 'undefined') runCallbacks = true;\n            if (s.params.autoHeight) {\n                s.updateAutoHeight();\n            }\n            if (s.lazy) s.lazy.onTransitionStart();\n            if (runCallbacks) {\n                s.emit('onTransitionStart', s);\n                if (s.activeIndex !== s.previousIndex) {\n                    s.emit('onSlideChangeStart', s);\n                    _scope.$emit(\"$ionicSlides.slideChangeStart\", {\n                      slider: s,\n                      activeIndex: s.getSlideDataIndex(s.activeIndex),\n                      previousIndex: s.getSlideDataIndex(s.previousIndex)\n                    });\n                    if (s.activeIndex > s.previousIndex) {\n                        s.emit('onSlideNextStart', s);\n                    }\n                    else {\n                        s.emit('onSlidePrevStart', s);\n                    }\n                }\n\n            }\n        };\n        s.onTransitionEnd = function (runCallbacks) {\n            s.animating = false;\n            s.setWrapperTransition(0);\n            if (typeof runCallbacks === 'undefined') runCallbacks = true;\n            if (s.lazy) s.lazy.onTransitionEnd();\n            if (runCallbacks) {\n                s.emit('onTransitionEnd', s);\n                if (s.activeIndex !== s.previousIndex) {\n                    s.emit('onSlideChangeEnd', s);\n                    _scope.$emit(\"$ionicSlides.slideChangeEnd\", {\n                      slider: s,\n                      activeIndex: s.getSlideDataIndex(s.activeIndex),\n                      previousIndex: s.getSlideDataIndex(s.previousIndex)\n                    });\n                    if (s.activeIndex > s.previousIndex) {\n                        s.emit('onSlideNextEnd', s);\n                    }\n                    else {\n                        s.emit('onSlidePrevEnd', s);\n                    }\n                }\n            }\n            if (s.params.hashnav && s.hashnav) {\n                s.hashnav.setHash();\n            }\n\n        };\n        s.slideNext = function (runCallbacks, speed, internal) {\n            if (s.params.loop) {\n                if (s.animating) return false;\n                s.fixLoop();\n                var clientLeft = s.container[0].clientLeft;\n                return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);\n            }\n            else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);\n        };\n        s._slideNext = function (speed) {\n            return s.slideNext(true, speed, true);\n        };\n        s.slidePrev = function (runCallbacks, speed, internal) {\n            if (s.params.loop) {\n                if (s.animating) return false;\n                s.fixLoop();\n                var clientLeft = s.container[0].clientLeft;\n                return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);\n            }\n            else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);\n        };\n        s._slidePrev = function (speed) {\n            return s.slidePrev(true, speed, true);\n        };\n        s.slideReset = function (runCallbacks, speed, internal) {\n            return s.slideTo(s.activeIndex, speed, runCallbacks);\n        };\n\n        /*=========================\n          Translate/transition helpers\n          ===========================*/\n        s.setWrapperTransition = function (duration, byController) {\n            s.wrapper.transition(duration);\n            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n                s.effects[s.params.effect].setTransition(duration);\n            }\n            if (s.params.parallax && s.parallax) {\n                s.parallax.setTransition(duration);\n            }\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.setTransition(duration);\n            }\n            if (s.params.control && s.controller) {\n                s.controller.setTransition(duration, byController);\n            }\n            s.emit('onSetTransition', s, duration);\n        };\n        s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {\n            var x = 0, y = 0, z = 0;\n            if (isH()) {\n                x = s.rtl ? -translate : translate;\n            }\n            else {\n                y = translate;\n            }\n\n            if (s.params.roundLengths) {\n                x = round(x);\n                y = round(y);\n            }\n\n            if (!s.params.virtualTranslate) {\n                if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');\n                else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');\n            }\n\n            s.translate = isH() ? x : y;\n\n            // Check if we need to update progress\n            var progress;\n            var translatesDiff = s.maxTranslate() - s.minTranslate();\n            if (translatesDiff === 0) {\n                progress = 0;\n            }\n            else {\n                progress = (translate - s.minTranslate()) / (translatesDiff);\n            }\n            if (progress !== s.progress) {\n                s.updateProgress(translate);\n            }\n\n            if (updateActiveIndex) s.updateActiveIndex();\n            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n                s.effects[s.params.effect].setTranslate(s.translate);\n            }\n            if (s.params.parallax && s.parallax) {\n                s.parallax.setTranslate(s.translate);\n            }\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.setTranslate(s.translate);\n            }\n            if (s.params.control && s.controller) {\n                s.controller.setTranslate(s.translate, byController);\n            }\n            s.emit('onSetTranslate', s, s.translate);\n        };\n\n        s.getTranslate = function (el, axis) {\n            var matrix, curTransform, curStyle, transformMatrix;\n\n            // automatic axis detection\n            if (typeof axis === 'undefined') {\n                axis = 'x';\n            }\n\n            if (s.params.virtualTranslate) {\n                return s.rtl ? -s.translate : s.translate;\n            }\n\n            curStyle = window.getComputedStyle(el, null);\n            if (window.WebKitCSSMatrix) {\n                curTransform = curStyle.transform || curStyle.webkitTransform;\n                if (curTransform.split(',').length > 6) {\n                    curTransform = curTransform.split(', ').map(function(a){\n                        return a.replace(',','.');\n                    }).join(', ');\n                }\n                // Some old versions of Webkit choke when 'none' is passed; pass\n                // empty string instead in this case\n                transformMatrix = new window.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);\n            }\n            else {\n                transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform  || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');\n                matrix = transformMatrix.toString().split(',');\n            }\n\n            if (axis === 'x') {\n                //Latest Chrome and webkits Fix\n                if (window.WebKitCSSMatrix)\n                    curTransform = transformMatrix.m41;\n                //Crazy IE10 Matrix\n                else if (matrix.length === 16)\n                    curTransform = parseFloat(matrix[12]);\n                //Normal Browsers\n                else\n                    curTransform = parseFloat(matrix[4]);\n            }\n            if (axis === 'y') {\n                //Latest Chrome and webkits Fix\n                if (window.WebKitCSSMatrix)\n                    curTransform = transformMatrix.m42;\n                //Crazy IE10 Matrix\n                else if (matrix.length === 16)\n                    curTransform = parseFloat(matrix[13]);\n                //Normal Browsers\n                else\n                    curTransform = parseFloat(matrix[5]);\n            }\n            if (s.rtl && curTransform) curTransform = -curTransform;\n            return curTransform || 0;\n        };\n        s.getWrapperTranslate = function (axis) {\n            if (typeof axis === 'undefined') {\n                axis = isH() ? 'x' : 'y';\n            }\n            return s.getTranslate(s.wrapper[0], axis);\n        };\n\n        /*=========================\n          Observer\n          ===========================*/\n        s.observers = [];\n        function initObserver(target, options) {\n            options = options || {};\n            // create an observer instance\n            var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;\n            var observer = new ObserverFunc(function (mutations) {\n                mutations.forEach(function (mutation) {\n                    s.onResize(true);\n                    s.emit('onObserverUpdate', s, mutation);\n                });\n            });\n\n            observer.observe(target, {\n                attributes: typeof options.attributes === 'undefined' ? true : options.attributes,\n                childList: typeof options.childList === 'undefined' ? true : options.childList,\n                characterData: typeof options.characterData === 'undefined' ? true : options.characterData\n            });\n\n            s.observers.push(observer);\n        }\n        s.initObservers = function () {\n            if (s.params.observeParents) {\n                var containerParents = s.container.parents();\n                for (var i = 0; i < containerParents.length; i++) {\n                    initObserver(containerParents[i]);\n                }\n            }\n\n            // Observe container\n            initObserver(s.container[0], {childList: false});\n\n            // Observe wrapper\n            initObserver(s.wrapper[0], {attributes: false});\n        };\n        s.disconnectObservers = function () {\n            for (var i = 0; i < s.observers.length; i++) {\n                s.observers[i].disconnect();\n            }\n            s.observers = [];\n        };\n\n        s.updateLoop = function(){\n          var currentSlide = s.slides.eq(s.activeIndex);\n          if ( angular.element(currentSlide).hasClass(s.params.slideDuplicateClass) ){\n            // we're on a duplicate, so slide to the non-duplicate\n            var swiperSlideIndex = angular.element(currentSlide).attr(\"data-swiper-slide-index\");\n            var slides = s.wrapper.children('.' + s.params.slideClass);\n            for ( var i = 0; i < slides.length; i++ ){\n              if ( !angular.element(slides[i]).hasClass(s.params.slideDuplicateClass) && angular.element(slides[i]).attr(\"data-swiper-slide-index\") === swiperSlideIndex ){\n                s.slideTo(i, 0, false, true);\n                break;\n              }\n            }\n            // if we needed to switch slides, we did that.  So, now call the createLoop function internally\n            setTimeout(function(){\n              s.createLoop();\n            }, 50);\n          }\n        }\n\n        s.getSlideDataIndex = function(slideIndex){\n          // this is an Ionic custom function\n          // Swiper loops utilize duplicate DOM elements for slides when in a loop\n          // which means that we cannot rely on the actual slide index for our events\n          // because index 0 does not necessarily point to index 0\n          // and index n+1 does not necessarily point to the expected piece of data\n          // therefore, rather than using the actual slide index we should\n          // use the data index that swiper includes as an attribute on the dom elements\n          // because this is what will be meaningful to the consumer of our events\n          var slide = s.slides.eq(slideIndex);\n          var attributeIndex = angular.element(slide).attr(\"data-swiper-slide-index\");\n          return parseInt(attributeIndex);\n        }\n\n        /*=========================\n          Loop\n          ===========================*/\n        // Create looped slides\n        s.createLoop = function () {\n          //console.log(\"Slider create loop method\");\n            //var toRemove = s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass);\n            //angular.element(toRemove).remove();\n            s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();\n\n            var slides = s.wrapper.children('.' + s.params.slideClass);\n\n            if(s.params.slidesPerView === 'auto' && !s.params.loopedSlides) s.params.loopedSlides = slides.length;\n\n            s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);\n            s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;\n            if (s.loopedSlides > slides.length) {\n                s.loopedSlides = slides.length;\n            }\n\n            var prependSlides = [], appendSlides = [], i, scope, newNode;\n            slides.each(function (index, el) {\n                var slide = $(this);\n                if (index < s.loopedSlides) appendSlides.push(el);\n                if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);\n                slide.attr('data-swiper-slide-index', index);\n            });\n            for (i = 0; i < appendSlides.length; i++) {\n\n              newNode = angular.element(appendSlides[i]).clone().addClass(s.params.slideDuplicateClass);\n              newNode.removeAttr('ng-transclude');\n              newNode.removeAttr('ng-repeat');\n              scope = angular.element(appendSlides[i]).scope();\n              newNode = $compile(newNode)(scope);\n              angular.element(s.wrapper).append(newNode);\n              //s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));\n            }\n            for (i = prependSlides.length - 1; i >= 0; i--) {\n              //s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));\n\n              newNode = angular.element(prependSlides[i]).clone().addClass(s.params.slideDuplicateClass);\n              newNode.removeAttr('ng-transclude');\n              newNode.removeAttr('ng-repeat');\n\n              scope = angular.element(prependSlides[i]).scope();\n              newNode = $compile(newNode)(scope);\n              angular.element(s.wrapper).prepend(newNode);\n            }\n        };\n        s.destroyLoop = function () {\n            s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();\n            s.slides.removeAttr('data-swiper-slide-index');\n        };\n        s.fixLoop = function () {\n            var newIndex;\n            //Fix For Negative Oversliding\n            if (s.activeIndex < s.loopedSlides) {\n                newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;\n                newIndex = newIndex + s.loopedSlides;\n                s.slideTo(newIndex, 0, false, true);\n            }\n            //Fix For Positive Oversliding\n            else if ((s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2) || (s.activeIndex > s.slides.length - s.params.slidesPerView * 2)) {\n                newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;\n                newIndex = newIndex + s.loopedSlides;\n                s.slideTo(newIndex, 0, false, true);\n            }\n        };\n        /*=========================\n          Append/Prepend/Remove Slides\n          ===========================*/\n        s.appendSlide = function (slides) {\n            if (s.params.loop) {\n                s.destroyLoop();\n            }\n            if (typeof slides === 'object' && slides.length) {\n                for (var i = 0; i < slides.length; i++) {\n                    if (slides[i]) s.wrapper.append(slides[i]);\n                }\n            }\n            else {\n                s.wrapper.append(slides);\n            }\n            if (s.params.loop) {\n                s.createLoop();\n            }\n            if (!(s.params.observer && s.support.observer)) {\n                s.update(true);\n            }\n        };\n        s.prependSlide = function (slides) {\n            if (s.params.loop) {\n                s.destroyLoop();\n            }\n            var newActiveIndex = s.activeIndex + 1;\n            if (typeof slides === 'object' && slides.length) {\n                for (var i = 0; i < slides.length; i++) {\n                    if (slides[i]) s.wrapper.prepend(slides[i]);\n                }\n                newActiveIndex = s.activeIndex + slides.length;\n            }\n            else {\n                s.wrapper.prepend(slides);\n            }\n            if (s.params.loop) {\n                s.createLoop();\n            }\n            if (!(s.params.observer && s.support.observer)) {\n                s.update(true);\n            }\n            s.slideTo(newActiveIndex, 0, false);\n        };\n        s.removeSlide = function (slidesIndexes) {\n            if (s.params.loop) {\n                s.destroyLoop();\n                s.slides = s.wrapper.children('.' + s.params.slideClass);\n            }\n            var newActiveIndex = s.activeIndex,\n                indexToRemove;\n            if (typeof slidesIndexes === 'object' && slidesIndexes.length) {\n                for (var i = 0; i < slidesIndexes.length; i++) {\n                    indexToRemove = slidesIndexes[i];\n                    if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();\n                    if (indexToRemove < newActiveIndex) newActiveIndex--;\n                }\n                newActiveIndex = Math.max(newActiveIndex, 0);\n            }\n            else {\n                indexToRemove = slidesIndexes;\n                if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();\n                if (indexToRemove < newActiveIndex) newActiveIndex--;\n                newActiveIndex = Math.max(newActiveIndex, 0);\n            }\n\n            if (s.params.loop) {\n                s.createLoop();\n            }\n\n            if (!(s.params.observer && s.support.observer)) {\n                s.update(true);\n            }\n            if (s.params.loop) {\n                s.slideTo(newActiveIndex + s.loopedSlides, 0, false);\n            }\n            else {\n                s.slideTo(newActiveIndex, 0, false);\n            }\n\n        };\n        s.removeAllSlides = function () {\n            var slidesIndexes = [];\n            for (var i = 0; i < s.slides.length; i++) {\n                slidesIndexes.push(i);\n            }\n            s.removeSlide(slidesIndexes);\n        };\n\n\n        /*=========================\n          Effects\n          ===========================*/\n        s.effects = {\n            fade: {\n                setTranslate: function () {\n                    for (var i = 0; i < s.slides.length; i++) {\n                        var slide = s.slides.eq(i);\n                        var offset = slide[0].swiperSlideOffset;\n                        var tx = -offset;\n                        if (!s.params.virtualTranslate) tx = tx - s.translate;\n                        var ty = 0;\n                        if (!isH()) {\n                            ty = tx;\n                            tx = 0;\n                        }\n                        var slideOpacity = s.params.fade.crossFade ?\n                                Math.max(1 - Math.abs(slide[0].progress), 0) :\n                                1 + Math.min(Math.max(slide[0].progress, -1), 0);\n                        slide\n                            .css({\n                                opacity: slideOpacity\n                            })\n                            .transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');\n\n                    }\n\n                },\n                setTransition: function (duration) {\n                    s.slides.transition(duration);\n                    if (s.params.virtualTranslate && duration !== 0) {\n                        var eventTriggered = false;\n                        s.slides.transitionEnd(function () {\n                            if (eventTriggered) return;\n                            if (!s) return;\n                            eventTriggered = true;\n                            s.animating = false;\n                            var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];\n                            for (var i = 0; i < triggerEvents.length; i++) {\n                                s.wrapper.trigger(triggerEvents[i]);\n                            }\n                        });\n                    }\n                }\n            },\n            cube: {\n                setTranslate: function () {\n                    var wrapperRotate = 0, cubeShadow;\n                    if (s.params.cube.shadow) {\n                        if (isH()) {\n                            cubeShadow = s.wrapper.find('.swiper-cube-shadow');\n                            if (cubeShadow.length === 0) {\n                                cubeShadow = $('<div class=\"swiper-cube-shadow\"></div>');\n                                s.wrapper.append(cubeShadow);\n                            }\n                            cubeShadow.css({height: s.width + 'px'});\n                        }\n                        else {\n                            cubeShadow = s.container.find('.swiper-cube-shadow');\n                            if (cubeShadow.length === 0) {\n                                cubeShadow = $('<div class=\"swiper-cube-shadow\"></div>');\n                                s.container.append(cubeShadow);\n                            }\n                        }\n                    }\n                    for (var i = 0; i < s.slides.length; i++) {\n                        var slide = s.slides.eq(i);\n                        var slideAngle = i * 90;\n                        var round = Math.floor(slideAngle / 360);\n                        if (s.rtl) {\n                            slideAngle = -slideAngle;\n                            round = Math.floor(-slideAngle / 360);\n                        }\n                        var progress = Math.max(Math.min(slide[0].progress, 1), -1);\n                        var tx = 0, ty = 0, tz = 0;\n                        if (i % 4 === 0) {\n                            tx = - round * 4 * s.size;\n                            tz = 0;\n                        }\n                        else if ((i - 1) % 4 === 0) {\n                            tx = 0;\n                            tz = - round * 4 * s.size;\n                        }\n                        else if ((i - 2) % 4 === 0) {\n                            tx = s.size + round * 4 * s.size;\n                            tz = s.size;\n                        }\n                        else if ((i - 3) % 4 === 0) {\n                            tx = - s.size;\n                            tz = 3 * s.size + s.size * 4 * round;\n                        }\n                        if (s.rtl) {\n                            tx = -tx;\n                        }\n\n                        if (!isH()) {\n                            ty = tx;\n                            tx = 0;\n                        }\n\n                        var transform = 'rotateX(' + (isH() ? 0 : -slideAngle) + 'deg) rotateY(' + (isH() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';\n                        if (progress <= 1 && progress > -1) {\n                            wrapperRotate = i * 90 + progress * 90;\n                            if (s.rtl) wrapperRotate = -i * 90 - progress * 90;\n                        }\n                        slide.transform(transform);\n                        if (s.params.cube.slideShadows) {\n                            //Set shadows\n                            var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');\n                            var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');\n                            if (shadowBefore.length === 0) {\n                                shadowBefore = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '\"></div>');\n                                slide.append(shadowBefore);\n                            }\n                            if (shadowAfter.length === 0) {\n                                shadowAfter = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '\"></div>');\n                                slide.append(shadowAfter);\n                            }\n                            var shadowOpacity = slide[0].progress;\n                            if (shadowBefore.length) shadowBefore[0].style.opacity = -slide[0].progress;\n                            if (shadowAfter.length) shadowAfter[0].style.opacity = slide[0].progress;\n                        }\n                    }\n                    s.wrapper.css({\n                        '-webkit-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n                        '-moz-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n                        '-ms-transform-origin': '50% 50% -' + (s.size / 2) + 'px',\n                        'transform-origin': '50% 50% -' + (s.size / 2) + 'px'\n                    });\n\n                    if (s.params.cube.shadow) {\n                        if (isH()) {\n                            cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + (-s.width / 2) + 'px) rotateX(90deg) rotateZ(0deg) scale(' + (s.params.cube.shadowScale) + ')');\n                        }\n                        else {\n                            var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;\n                            var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);\n                            var scale1 = s.params.cube.shadowScale,\n                                scale2 = s.params.cube.shadowScale / multiplier,\n                                offset = s.params.cube.shadowOffset;\n                            cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + (-s.height / 2 / scale2) + 'px) rotateX(-90deg)');\n                        }\n                    }\n                    var zFactor = (s.isSafari || s.isUiWebView) ? (-s.size / 2) : 0;\n                    s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (isH() ? 0 : wrapperRotate) + 'deg) rotateY(' + (isH() ? -wrapperRotate : 0) + 'deg)');\n                },\n                setTransition: function (duration) {\n                    s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);\n                    if (s.params.cube.shadow && !isH()) {\n                        s.container.find('.swiper-cube-shadow').transition(duration);\n                    }\n                }\n            },\n            coverflow: {\n                setTranslate: function () {\n                    var transform = s.translate;\n                    var center = isH() ? -transform + s.width / 2 : -transform + s.height / 2;\n                    var rotate = isH() ? s.params.coverflow.rotate: -s.params.coverflow.rotate;\n                    var translate = s.params.coverflow.depth;\n                    //Each slide offset from center\n                    for (var i = 0, length = s.slides.length; i < length; i++) {\n                        var slide = s.slides.eq(i);\n                        var slideSize = s.slidesSizesGrid[i];\n                        var slideOffset = slide[0].swiperSlideOffset;\n                        var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;\n\n                        var rotateY = isH() ? rotate * offsetMultiplier : 0;\n                        var rotateX = isH() ? 0 : rotate * offsetMultiplier;\n                        // var rotateZ = 0\n                        var translateZ = -translate * Math.abs(offsetMultiplier);\n\n                        var translateY = isH() ? 0 : s.params.coverflow.stretch * (offsetMultiplier);\n                        var translateX = isH() ? s.params.coverflow.stretch * (offsetMultiplier) : 0;\n\n                        //Fix for ultra small values\n                        if (Math.abs(translateX) < 0.001) translateX = 0;\n                        if (Math.abs(translateY) < 0.001) translateY = 0;\n                        if (Math.abs(translateZ) < 0.001) translateZ = 0;\n                        if (Math.abs(rotateY) < 0.001) rotateY = 0;\n                        if (Math.abs(rotateX) < 0.001) rotateX = 0;\n\n                        var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px)  rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';\n\n                        slide.transform(slideTransform);\n                        slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;\n                        if (s.params.coverflow.slideShadows) {\n                            //Set shadows\n                            var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');\n                            var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');\n                            if (shadowBefore.length === 0) {\n                                shadowBefore = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '\"></div>');\n                                slide.append(shadowBefore);\n                            }\n                            if (shadowAfter.length === 0) {\n                                shadowAfter = $('<div class=\"swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '\"></div>');\n                                slide.append(shadowAfter);\n                            }\n                            if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;\n                            if (shadowAfter.length) shadowAfter[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0;\n                        }\n                    }\n\n                    //Set correct perspective for IE10\n                    if (s.browser.ie) {\n                        var ws = s.wrapper[0].style;\n                        ws.perspectiveOrigin = center + 'px 50%';\n                    }\n                },\n                setTransition: function (duration) {\n                    s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);\n                }\n            }\n        };\n\n        /*=========================\n          Images Lazy Loading\n          ===========================*/\n        s.lazy = {\n            initialImageLoaded: false,\n            loadImageInSlide: function (index, loadInDuplicate) {\n                if (typeof index === 'undefined') return;\n                if (typeof loadInDuplicate === 'undefined') loadInDuplicate = true;\n                if (s.slides.length === 0) return;\n\n                var slide = s.slides.eq(index);\n                var img = slide.find('.swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)');\n                if (slide.hasClass('swiper-lazy') && !slide.hasClass('swiper-lazy-loaded') && !slide.hasClass('swiper-lazy-loading')) {\n                    img = img.add(slide[0]);\n                }\n                if (img.length === 0) return;\n\n                img.each(function () {\n                    var _img = $(this);\n                    _img.addClass('swiper-lazy-loading');\n                    var background = _img.attr('data-background');\n                    var src = _img.attr('data-src'),\n                        srcset = _img.attr('data-srcset');\n                    s.loadImage(_img[0], (src || background), srcset, false, function () {\n                        if (background) {\n                            _img.css('background-image', 'url(' + background + ')');\n                            _img.removeAttr('data-background');\n                        }\n                        else {\n                            if (srcset) {\n                                _img.attr('srcset', srcset);\n                                _img.removeAttr('data-srcset');\n                            }\n                            if (src) {\n                                _img.attr('src', src);\n                                _img.removeAttr('data-src');\n                            }\n\n                        }\n\n                        _img.addClass('swiper-lazy-loaded').removeClass('swiper-lazy-loading');\n                        slide.find('.swiper-lazy-preloader, .preloader').remove();\n                        if (s.params.loop && loadInDuplicate) {\n                            var slideOriginalIndex = slide.attr('data-swiper-slide-index');\n                            if (slide.hasClass(s.params.slideDuplicateClass)) {\n                                var originalSlide = s.wrapper.children('[data-swiper-slide-index=\"' + slideOriginalIndex + '\"]:not(.' + s.params.slideDuplicateClass + ')');\n                                s.lazy.loadImageInSlide(originalSlide.index(), false);\n                            }\n                            else {\n                                var duplicatedSlide = s.wrapper.children('.' + s.params.slideDuplicateClass + '[data-swiper-slide-index=\"' + slideOriginalIndex + '\"]');\n                                s.lazy.loadImageInSlide(duplicatedSlide.index(), false);\n                            }\n                        }\n                        s.emit('onLazyImageReady', s, slide[0], _img[0]);\n                    });\n\n                    s.emit('onLazyImageLoad', s, slide[0], _img[0]);\n                });\n\n            },\n            load: function () {\n                var i;\n                if (s.params.watchSlidesVisibility) {\n                    s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {\n                        s.lazy.loadImageInSlide($(this).index());\n                    });\n                }\n                else {\n                    if (s.params.slidesPerView > 1) {\n                        for (i = s.activeIndex; i < s.activeIndex + s.params.slidesPerView ; i++) {\n                            if (s.slides[i]) s.lazy.loadImageInSlide(i);\n                        }\n                    }\n                    else {\n                        s.lazy.loadImageInSlide(s.activeIndex);\n                    }\n                }\n                if (s.params.lazyLoadingInPrevNext) {\n                    if (s.params.slidesPerView > 1) {\n                        // Next Slides\n                        for (i = s.activeIndex + s.params.slidesPerView; i < s.activeIndex + s.params.slidesPerView + s.params.slidesPerView; i++) {\n                            if (s.slides[i]) s.lazy.loadImageInSlide(i);\n                        }\n                        // Prev Slides\n                        for (i = s.activeIndex - s.params.slidesPerView; i < s.activeIndex ; i++) {\n                            if (s.slides[i]) s.lazy.loadImageInSlide(i);\n                        }\n                    }\n                    else {\n                        var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);\n                        if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());\n\n                        var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);\n                        if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());\n                    }\n                }\n            },\n            onTransitionStart: function () {\n                if (s.params.lazyLoading) {\n                    if (s.params.lazyLoadingOnTransitionStart || (!s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded)) {\n                        s.lazy.load();\n                    }\n                }\n            },\n            onTransitionEnd: function () {\n                if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {\n                    s.lazy.load();\n                }\n            }\n        };\n\n\n        /*=========================\n          Scrollbar\n          ===========================*/\n        s.scrollbar = {\n            isTouched: false,\n            setDragPosition: function (e) {\n                var sb = s.scrollbar;\n                var x = 0, y = 0;\n                var translate;\n                var pointerPosition = isH() ?\n                    ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageX : e.pageX || e.clientX) :\n                    ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].pageY : e.pageY || e.clientY) ;\n                var position = (pointerPosition) - sb.track.offset()[isH() ? 'left' : 'top'] - sb.dragSize / 2;\n                var positionMin = -s.minTranslate() * sb.moveDivider;\n                var positionMax = -s.maxTranslate() * sb.moveDivider;\n                if (position < positionMin) {\n                    position = positionMin;\n                }\n                else if (position > positionMax) {\n                    position = positionMax;\n                }\n                position = -position / sb.moveDivider;\n                s.updateProgress(position);\n                s.setWrapperTranslate(position, true);\n            },\n            dragStart: function (e) {\n                var sb = s.scrollbar;\n                sb.isTouched = true;\n                e.preventDefault();\n                e.stopPropagation();\n\n                sb.setDragPosition(e);\n                clearTimeout(sb.dragTimeout);\n\n                sb.track.transition(0);\n                if (s.params.scrollbarHide) {\n                    sb.track.css('opacity', 1);\n                }\n                s.wrapper.transition(100);\n                sb.drag.transition(100);\n                s.emit('onScrollbarDragStart', s);\n            },\n            dragMove: function (e) {\n                var sb = s.scrollbar;\n                if (!sb.isTouched) return;\n                if (e.preventDefault) e.preventDefault();\n                else e.returnValue = false;\n                sb.setDragPosition(e);\n                s.wrapper.transition(0);\n                sb.track.transition(0);\n                sb.drag.transition(0);\n                s.emit('onScrollbarDragMove', s);\n            },\n            dragEnd: function (e) {\n                var sb = s.scrollbar;\n                if (!sb.isTouched) return;\n                sb.isTouched = false;\n                if (s.params.scrollbarHide) {\n                    clearTimeout(sb.dragTimeout);\n                    sb.dragTimeout = setTimeout(function () {\n                        sb.track.css('opacity', 0);\n                        sb.track.transition(400);\n                    }, 1000);\n\n                }\n                s.emit('onScrollbarDragEnd', s);\n                if (s.params.scrollbarSnapOnRelease) {\n                    s.slideReset();\n                }\n            },\n            enableDraggable: function () {\n                var sb = s.scrollbar;\n                var target = s.support.touch ? sb.track : document;\n                $(sb.track).on(s.touchEvents.start, sb.dragStart);\n                $(target).on(s.touchEvents.move, sb.dragMove);\n                $(target).on(s.touchEvents.end, sb.dragEnd);\n            },\n            disableDraggable: function () {\n                var sb = s.scrollbar;\n                var target = s.support.touch ? sb.track : document;\n                $(sb.track).off(s.touchEvents.start, sb.dragStart);\n                $(target).off(s.touchEvents.move, sb.dragMove);\n                $(target).off(s.touchEvents.end, sb.dragEnd);\n            },\n            set: function () {\n                if (!s.params.scrollbar) return;\n                var sb = s.scrollbar;\n                sb.track = $(s.params.scrollbar);\n                sb.drag = sb.track.find('.swiper-scrollbar-drag');\n                if (sb.drag.length === 0) {\n                    sb.drag = $('<div class=\"swiper-scrollbar-drag\"></div>');\n                    sb.track.append(sb.drag);\n                }\n                sb.drag[0].style.width = '';\n                sb.drag[0].style.height = '';\n                sb.trackSize = isH() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;\n\n                sb.divider = s.size / s.virtualSize;\n                sb.moveDivider = sb.divider * (sb.trackSize / s.size);\n                sb.dragSize = sb.trackSize * sb.divider;\n\n                if (isH()) {\n                    sb.drag[0].style.width = sb.dragSize + 'px';\n                }\n                else {\n                    sb.drag[0].style.height = sb.dragSize + 'px';\n                }\n\n                if (sb.divider >= 1) {\n                    sb.track[0].style.display = 'none';\n                }\n                else {\n                    sb.track[0].style.display = '';\n                }\n                if (s.params.scrollbarHide) {\n                    sb.track[0].style.opacity = 0;\n                }\n            },\n            setTranslate: function () {\n                if (!s.params.scrollbar) return;\n                var diff;\n                var sb = s.scrollbar;\n                var translate = s.translate || 0;\n                var newPos;\n\n                var newSize = sb.dragSize;\n                newPos = (sb.trackSize - sb.dragSize) * s.progress;\n                if (s.rtl && isH()) {\n                    newPos = -newPos;\n                    if (newPos > 0) {\n                        newSize = sb.dragSize - newPos;\n                        newPos = 0;\n                    }\n                    else if (-newPos + sb.dragSize > sb.trackSize) {\n                        newSize = sb.trackSize + newPos;\n                    }\n                }\n                else {\n                    if (newPos < 0) {\n                        newSize = sb.dragSize + newPos;\n                        newPos = 0;\n                    }\n                    else if (newPos + sb.dragSize > sb.trackSize) {\n                        newSize = sb.trackSize - newPos;\n                    }\n                }\n                if (isH()) {\n                    if (s.support.transforms3d) {\n                        sb.drag.transform('translate3d(' + (newPos) + 'px, 0, 0)');\n                    }\n                    else {\n                        sb.drag.transform('translateX(' + (newPos) + 'px)');\n                    }\n                    sb.drag[0].style.width = newSize + 'px';\n                }\n                else {\n                    if (s.support.transforms3d) {\n                        sb.drag.transform('translate3d(0px, ' + (newPos) + 'px, 0)');\n                    }\n                    else {\n                        sb.drag.transform('translateY(' + (newPos) + 'px)');\n                    }\n                    sb.drag[0].style.height = newSize + 'px';\n                }\n                if (s.params.scrollbarHide) {\n                    clearTimeout(sb.timeout);\n                    sb.track[0].style.opacity = 1;\n                    sb.timeout = setTimeout(function () {\n                        sb.track[0].style.opacity = 0;\n                        sb.track.transition(400);\n                    }, 1000);\n                }\n            },\n            setTransition: function (duration) {\n                if (!s.params.scrollbar) return;\n                s.scrollbar.drag.transition(duration);\n            }\n        };\n\n        /*=========================\n          Controller\n          ===========================*/\n        s.controller = {\n            LinearSpline: function (x, y) {\n                this.x = x;\n                this.y = y;\n                this.lastIndex = x.length - 1;\n                // Given an x value (x2), return the expected y2 value:\n                // (x1,y1) is the known point before given value,\n                // (x3,y3) is the known point after given value.\n                var i1, i3;\n                var l = this.x.length;\n\n                this.interpolate = function (x2) {\n                    if (!x2) return 0;\n\n                    // Get the indexes of x1 and x3 (the array indexes before and after given x2):\n                    i3 = binarySearch(this.x, x2);\n                    i1 = i3 - 1;\n\n                    // We have our indexes i1 & i3, so we can calculate already:\n                    // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1\n                    return ((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1]) + this.y[i1];\n                };\n\n                var binarySearch = (function() {\n                    var maxIndex, minIndex, guess;\n                    return function(array, val) {\n                        minIndex = -1;\n                        maxIndex = array.length;\n                        while (maxIndex - minIndex > 1)\n                            if (array[guess = maxIndex + minIndex >> 1] <= val) {\n                                minIndex = guess;\n                            } else {\n                                maxIndex = guess;\n                            }\n                        return maxIndex;\n                    };\n                })();\n            },\n            //xxx: for now i will just save one spline function to to\n            getInterpolateFunction: function(c){\n                if(!s.controller.spline) s.controller.spline = s.params.loop ?\n                    new s.controller.LinearSpline(s.slidesGrid, c.slidesGrid) :\n                    new s.controller.LinearSpline(s.snapGrid, c.snapGrid);\n            },\n            setTranslate: function (translate, byController) {\n               var controlled = s.params.control;\n               var multiplier, controlledTranslate;\n               function setControlledTranslate(c) {\n                    // this will create an Interpolate function based on the snapGrids\n                    // x is the Grid of the scrolled scroller and y will be the controlled scroller\n                    // it makes sense to create this only once and recall it for the interpolation\n                    // the function does a lot of value caching for performance\n                    translate = c.rtl && c.params.direction === 'horizontal' ? -s.translate : s.translate;\n                    if (s.params.controlBy === 'slide') {\n                        s.controller.getInterpolateFunction(c);\n                        // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid\n                        // but it did not work out\n                        controlledTranslate = -s.controller.spline.interpolate(-translate);\n                    }\n\n                    if(!controlledTranslate || s.params.controlBy === 'container'){\n                        multiplier = (c.maxTranslate() - c.minTranslate()) / (s.maxTranslate() - s.minTranslate());\n                        controlledTranslate = (translate - s.minTranslate()) * multiplier + c.minTranslate();\n                    }\n\n                    if (s.params.controlInverse) {\n                        controlledTranslate = c.maxTranslate() - controlledTranslate;\n                    }\n                    c.updateProgress(controlledTranslate);\n                    c.setWrapperTranslate(controlledTranslate, false, s);\n                    c.updateActiveIndex();\n               }\n               if (s.isArray(controlled)) {\n                   for (var i = 0; i < controlled.length; i++) {\n                       if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n                           setControlledTranslate(controlled[i]);\n                       }\n                   }\n               }\n               else if (controlled instanceof Swiper && byController !== controlled) {\n\n                   setControlledTranslate(controlled);\n               }\n            },\n            setTransition: function (duration, byController) {\n                var controlled = s.params.control;\n                var i;\n                function setControlledTransition(c) {\n                    c.setWrapperTransition(duration, s);\n                    if (duration !== 0) {\n                        c.onTransitionStart();\n                        c.wrapper.transitionEnd(function(){\n                            if (!controlled) return;\n                            if (c.params.loop && s.params.controlBy === 'slide') {\n                                c.fixLoop();\n                            }\n                            c.onTransitionEnd();\n\n                        });\n                    }\n                }\n                if (s.isArray(controlled)) {\n                    for (i = 0; i < controlled.length; i++) {\n                        if (controlled[i] !== byController && controlled[i] instanceof Swiper) {\n                            setControlledTransition(controlled[i]);\n                        }\n                    }\n                }\n                else if (controlled instanceof Swiper && byController !== controlled) {\n                    setControlledTransition(controlled);\n                }\n            }\n        };\n\n        /*=========================\n          Hash Navigation\n          ===========================*/\n        s.hashnav = {\n            init: function () {\n                if (!s.params.hashnav) return;\n                s.hashnav.initialized = true;\n                var hash = document.location.hash.replace('#', '');\n                if (!hash) return;\n                var speed = 0;\n                for (var i = 0, length = s.slides.length; i < length; i++) {\n                    var slide = s.slides.eq(i);\n                    var slideHash = slide.attr('data-hash');\n                    if (slideHash === hash && !slide.hasClass(s.params.slideDuplicateClass)) {\n                        var index = slide.index();\n                        s.slideTo(index, speed, s.params.runCallbacksOnInit, true);\n                    }\n                }\n            },\n            setHash: function () {\n                if (!s.hashnav.initialized || !s.params.hashnav) return;\n                document.location.hash = s.slides.eq(s.activeIndex).attr('data-hash') || '';\n            }\n        };\n\n        /*=========================\n          Keyboard Control\n          ===========================*/\n        function handleKeyboard(e) {\n            if (e.originalEvent) e = e.originalEvent; //jquery fix\n            var kc = e.keyCode || e.charCode;\n            // Directions locks\n            if (!s.params.allowSwipeToNext && (isH() && kc === 39 || !isH() && kc === 40)) {\n                return false;\n            }\n            if (!s.params.allowSwipeToPrev && (isH() && kc === 37 || !isH() && kc === 38)) {\n                return false;\n            }\n            if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {\n                return;\n            }\n            if (document.activeElement && document.activeElement.nodeName && (document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea')) {\n                return;\n            }\n            if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {\n                var inView = false;\n                //Check that swiper should be inside of visible area of window\n                if (s.container.parents('.swiper-slide').length > 0 && s.container.parents('.swiper-slide-active').length === 0) {\n                    return;\n                }\n                var windowScroll = {\n                    left: window.pageXOffset,\n                    top: window.pageYOffset\n                };\n                var windowWidth = window.innerWidth;\n                var windowHeight = window.innerHeight;\n                var swiperOffset = s.container.offset();\n                if (s.rtl) swiperOffset.left = swiperOffset.left - s.container[0].scrollLeft;\n                var swiperCoord = [\n                    [swiperOffset.left, swiperOffset.top],\n                    [swiperOffset.left + s.width, swiperOffset.top],\n                    [swiperOffset.left, swiperOffset.top + s.height],\n                    [swiperOffset.left + s.width, swiperOffset.top + s.height]\n                ];\n                for (var i = 0; i < swiperCoord.length; i++) {\n                    var point = swiperCoord[i];\n                    if (\n                        point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth &&\n                        point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight\n                    ) {\n                        inView = true;\n                    }\n\n                }\n                if (!inView) return;\n            }\n            if (isH()) {\n                if (kc === 37 || kc === 39) {\n                    if (e.preventDefault) e.preventDefault();\n                    else e.returnValue = false;\n                }\n                if ((kc === 39 && !s.rtl) || (kc === 37 && s.rtl)) s.slideNext();\n                if ((kc === 37 && !s.rtl) || (kc === 39 && s.rtl)) s.slidePrev();\n            }\n            else {\n                if (kc === 38 || kc === 40) {\n                    if (e.preventDefault) e.preventDefault();\n                    else e.returnValue = false;\n                }\n                if (kc === 40) s.slideNext();\n                if (kc === 38) s.slidePrev();\n            }\n        }\n        s.disableKeyboardControl = function () {\n            s.params.keyboardControl = false;\n            $(document).off('keydown', handleKeyboard);\n        };\n        s.enableKeyboardControl = function () {\n            s.params.keyboardControl = true;\n            $(document).on('keydown', handleKeyboard);\n        };\n\n\n        /*=========================\n          Mousewheel Control\n          ===========================*/\n        s.mousewheel = {\n            event: false,\n            lastScrollTime: (new window.Date()).getTime()\n        };\n        if (s.params.mousewheelControl) {\n            try {\n                new window.WheelEvent('wheel');\n                s.mousewheel.event = 'wheel';\n            } catch (e) {}\n\n            if (!s.mousewheel.event && document.onmousewheel !== undefined) {\n                s.mousewheel.event = 'mousewheel';\n            }\n            if (!s.mousewheel.event) {\n                s.mousewheel.event = 'DOMMouseScroll';\n            }\n        }\n        function handleMousewheel(e) {\n            if (e.originalEvent) e = e.originalEvent; //jquery fix\n            var we = s.mousewheel.event;\n            var delta = 0;\n            var rtlFactor = s.rtl ? -1 : 1;\n            //Opera & IE\n            if (e.detail) delta = -e.detail;\n            //WebKits\n            else if (we === 'mousewheel') {\n                if (s.params.mousewheelForceToAxis) {\n                    if (isH()) {\n                        if (Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY)) delta = e.wheelDeltaX * rtlFactor;\n                        else return;\n                    }\n                    else {\n                        if (Math.abs(e.wheelDeltaY) > Math.abs(e.wheelDeltaX)) delta = e.wheelDeltaY;\n                        else return;\n                    }\n                }\n                else {\n                    delta = Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY) ? - e.wheelDeltaX * rtlFactor : - e.wheelDeltaY;\n                }\n            }\n            //Old FireFox\n            else if (we === 'DOMMouseScroll') delta = -e.detail;\n            //New FireFox\n            else if (we === 'wheel') {\n                if (s.params.mousewheelForceToAxis) {\n                    if (isH()) {\n                        if (Math.abs(e.deltaX) > Math.abs(e.deltaY)) delta = -e.deltaX * rtlFactor;\n                        else return;\n                    }\n                    else {\n                        if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) delta = -e.deltaY;\n                        else return;\n                    }\n                }\n                else {\n                    delta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? - e.deltaX * rtlFactor : - e.deltaY;\n                }\n            }\n            if (delta === 0) return;\n\n            if (s.params.mousewheelInvert) delta = -delta;\n\n            if (!s.params.freeMode) {\n                if ((new window.Date()).getTime() - s.mousewheel.lastScrollTime > 60) {\n                    if (delta < 0) {\n                        if ((!s.isEnd || s.params.loop) && !s.animating) s.slideNext();\n                        else if (s.params.mousewheelReleaseOnEdges) return true;\n                    }\n                    else {\n                        if ((!s.isBeginning || s.params.loop) && !s.animating) s.slidePrev();\n                        else if (s.params.mousewheelReleaseOnEdges) return true;\n                    }\n                }\n                s.mousewheel.lastScrollTime = (new window.Date()).getTime();\n\n            }\n            else {\n                //Freemode or scrollContainer:\n                var position = s.getWrapperTranslate() + delta * s.params.mousewheelSensitivity;\n                var wasBeginning = s.isBeginning,\n                    wasEnd = s.isEnd;\n\n                if (position >= s.minTranslate()) position = s.minTranslate();\n                if (position <= s.maxTranslate()) position = s.maxTranslate();\n\n                s.setWrapperTransition(0);\n                s.setWrapperTranslate(position);\n                s.updateProgress();\n                s.updateActiveIndex();\n\n                if (!wasBeginning && s.isBeginning || !wasEnd && s.isEnd) {\n                    s.updateClasses();\n                }\n\n                if (s.params.freeModeSticky) {\n                    clearTimeout(s.mousewheel.timeout);\n                    s.mousewheel.timeout = setTimeout(function () {\n                        s.slideReset();\n                    }, 300);\n                }\n\n                // Return page scroll on edge positions\n                if (position === 0 || position === s.maxTranslate()) return;\n            }\n            if (s.params.autoplay) s.stopAutoplay();\n\n            if (e.preventDefault) e.preventDefault();\n            else e.returnValue = false;\n            return false;\n        }\n        s.disableMousewheelControl = function () {\n            if (!s.mousewheel.event) return false;\n            s.container.off(s.mousewheel.event, handleMousewheel);\n            return true;\n        };\n\n        s.enableMousewheelControl = function () {\n            if (!s.mousewheel.event) return false;\n            s.container.on(s.mousewheel.event, handleMousewheel);\n            return true;\n        };\n\n\n        /*=========================\n          Parallax\n          ===========================*/\n        function setParallaxTransform(el, progress) {\n            el = $(el);\n            var p, pX, pY;\n            var rtlFactor = s.rtl ? -1 : 1;\n\n            p = el.attr('data-swiper-parallax') || '0';\n            pX = el.attr('data-swiper-parallax-x');\n            pY = el.attr('data-swiper-parallax-y');\n            if (pX || pY) {\n                pX = pX || '0';\n                pY = pY || '0';\n            }\n            else {\n                if (isH()) {\n                    pX = p;\n                    pY = '0';\n                }\n                else {\n                    pY = p;\n                    pX = '0';\n                }\n            }\n\n            if ((pX).indexOf('%') >= 0) {\n                pX = parseInt(pX, 10) * progress * rtlFactor + '%';\n            }\n            else {\n                pX = pX * progress * rtlFactor + 'px' ;\n            }\n            if ((pY).indexOf('%') >= 0) {\n                pY = parseInt(pY, 10) * progress + '%';\n            }\n            else {\n                pY = pY * progress + 'px' ;\n            }\n\n            el.transform('translate3d(' + pX + ', ' + pY + ',0px)');\n        }\n        s.parallax = {\n            setTranslate: function () {\n                s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){\n                    setParallaxTransform(this, s.progress);\n\n                });\n                s.slides.each(function () {\n                    var slide = $(this);\n                    slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {\n                        var progress = Math.min(Math.max(slide[0].progress, -1), 1);\n                        setParallaxTransform(this, progress);\n                    });\n                });\n            },\n            setTransition: function (duration) {\n                if (typeof duration === 'undefined') duration = s.params.speed;\n                s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function(){\n                    var el = $(this);\n                    var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;\n                    if (duration === 0) parallaxDuration = 0;\n                    el.transition(parallaxDuration);\n                });\n            }\n        };\n\n\n        /*=========================\n          Plugins API. Collect all and init all plugins\n          ===========================*/\n        s._plugins = [];\n        for (var plugin in s.plugins) {\n            var p = s.plugins[plugin](s, s.params[plugin]);\n            if (p) s._plugins.push(p);\n        }\n        // Method to call all plugins event/method\n        s.callPlugins = function (eventName) {\n            for (var i = 0; i < s._plugins.length; i++) {\n                if (eventName in s._plugins[i]) {\n                    s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n                }\n            }\n        };\n\n        /*=========================\n          Events/Callbacks/Plugins Emitter\n          ===========================*/\n        function normalizeEventName (eventName) {\n            if (eventName.indexOf('on') !== 0) {\n                if (eventName[0] !== eventName[0].toUpperCase()) {\n                    eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);\n                }\n                else {\n                    eventName = 'on' + eventName;\n                }\n            }\n            return eventName;\n        }\n        s.emitterEventListeners = {\n\n        };\n        s.emit = function (eventName) {\n            // Trigger callbacks\n            if (s.params[eventName]) {\n                s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n            }\n            var i;\n            // Trigger events\n            if (s.emitterEventListeners[eventName]) {\n                for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {\n                    s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n                }\n            }\n            // Trigger plugins\n            if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);\n        };\n        s.on = function (eventName, handler) {\n            eventName = normalizeEventName(eventName);\n            if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];\n            s.emitterEventListeners[eventName].push(handler);\n            return s;\n        };\n        s.off = function (eventName, handler) {\n            var i;\n            eventName = normalizeEventName(eventName);\n            if (typeof handler === 'undefined') {\n                // Remove all handlers for such event\n                s.emitterEventListeners[eventName] = [];\n                return s;\n            }\n            if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;\n            for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {\n                if(s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);\n            }\n            return s;\n        };\n        s.once = function (eventName, handler) {\n            eventName = normalizeEventName(eventName);\n            var _handler = function () {\n                handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);\n                s.off(eventName, _handler);\n            };\n            s.on(eventName, _handler);\n            return s;\n        };\n\n        // Accessibility tools\n        s.a11y = {\n            makeFocusable: function ($el) {\n                $el.attr('tabIndex', '0');\n                return $el;\n            },\n            addRole: function ($el, role) {\n                $el.attr('role', role);\n                return $el;\n            },\n\n            addLabel: function ($el, label) {\n                $el.attr('aria-label', label);\n                return $el;\n            },\n\n            disable: function ($el) {\n                $el.attr('aria-disabled', true);\n                return $el;\n            },\n\n            enable: function ($el) {\n                $el.attr('aria-disabled', false);\n                return $el;\n            },\n\n            onEnterKey: function (event) {\n                if (event.keyCode !== 13) return;\n                if ($(event.target).is(s.params.nextButton)) {\n                    s.onClickNext(event);\n                    if (s.isEnd) {\n                        s.a11y.notify(s.params.lastSlideMessage);\n                    }\n                    else {\n                        s.a11y.notify(s.params.nextSlideMessage);\n                    }\n                }\n                else if ($(event.target).is(s.params.prevButton)) {\n                    s.onClickPrev(event);\n                    if (s.isBeginning) {\n                        s.a11y.notify(s.params.firstSlideMessage);\n                    }\n                    else {\n                        s.a11y.notify(s.params.prevSlideMessage);\n                    }\n                }\n                if ($(event.target).is('.' + s.params.bulletClass)) {\n                    $(event.target)[0].click();\n                }\n            },\n\n            liveRegion: $('<span class=\"swiper-notification\" aria-live=\"assertive\" aria-atomic=\"true\"></span>'),\n\n            notify: function (message) {\n                var notification = s.a11y.liveRegion;\n                if (notification.length === 0) return;\n                notification.html('');\n                notification.html(message);\n            },\n            init: function () {\n                // Setup accessibility\n                if (s.params.nextButton) {\n                    var nextButton = $(s.params.nextButton);\n                    s.a11y.makeFocusable(nextButton);\n                    s.a11y.addRole(nextButton, 'button');\n                    s.a11y.addLabel(nextButton, s.params.nextSlideMessage);\n                }\n                if (s.params.prevButton) {\n                    var prevButton = $(s.params.prevButton);\n                    s.a11y.makeFocusable(prevButton);\n                    s.a11y.addRole(prevButton, 'button');\n                    s.a11y.addLabel(prevButton, s.params.prevSlideMessage);\n                }\n\n                $(s.container).append(s.a11y.liveRegion);\n            },\n            initPagination: function () {\n                if (s.params.pagination && s.params.paginationClickable && s.bullets && s.bullets.length) {\n                    s.bullets.each(function () {\n                        var bullet = $(this);\n                        s.a11y.makeFocusable(bullet);\n                        s.a11y.addRole(bullet, 'button');\n                        s.a11y.addLabel(bullet, s.params.paginationBulletMessage.replace(/{{index}}/, bullet.index() + 1));\n                    });\n                }\n            },\n            destroy: function () {\n                if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();\n            }\n        };\n\n\n        /*=========================\n          Init/Destroy\n          ===========================*/\n        s.init = function () {\n            if (s.params.loop) s.createLoop();\n            s.updateContainerSize();\n            s.updateSlidesSize();\n            s.updatePagination();\n            if (s.params.scrollbar && s.scrollbar) {\n                s.scrollbar.set();\n                if (s.params.scrollbarDraggable) {\n                    s.scrollbar.enableDraggable();\n                }\n            }\n            if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {\n                if (!s.params.loop) s.updateProgress();\n                s.effects[s.params.effect].setTranslate();\n            }\n            if (s.params.loop) {\n                s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);\n            }\n            else {\n                s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);\n                if (s.params.initialSlide === 0) {\n                    if (s.parallax && s.params.parallax) s.parallax.setTranslate();\n                    if (s.lazy && s.params.lazyLoading) {\n                        s.lazy.load();\n                        s.lazy.initialImageLoaded = true;\n                    }\n                }\n            }\n            s.attachEvents();\n            if (s.params.observer && s.support.observer) {\n                s.initObservers();\n            }\n            if (s.params.preloadImages && !s.params.lazyLoading) {\n                s.preloadImages();\n            }\n            if (s.params.autoplay) {\n                s.startAutoplay();\n            }\n            if (s.params.keyboardControl) {\n                if (s.enableKeyboardControl) s.enableKeyboardControl();\n            }\n            if (s.params.mousewheelControl) {\n                if (s.enableMousewheelControl) s.enableMousewheelControl();\n            }\n            if (s.params.hashnav) {\n                if (s.hashnav) s.hashnav.init();\n            }\n            if (s.params.a11y && s.a11y) s.a11y.init();\n            s.emit('onInit', s);\n        };\n\n        // Cleanup dynamic styles\n        s.cleanupStyles = function () {\n            // Container\n            s.container.removeClass(s.classNames.join(' ')).removeAttr('style');\n\n            // Wrapper\n            s.wrapper.removeAttr('style');\n\n            // Slides\n            if (s.slides && s.slides.length) {\n                s.slides\n                    .removeClass([\n                      s.params.slideVisibleClass,\n                      s.params.slideActiveClass,\n                      s.params.slideNextClass,\n                      s.params.slidePrevClass\n                    ].join(' '))\n                    .removeAttr('style')\n                    .removeAttr('data-swiper-column')\n                    .removeAttr('data-swiper-row');\n            }\n\n            // Pagination/Bullets\n            if (s.paginationContainer && s.paginationContainer.length) {\n                s.paginationContainer.removeClass(s.params.paginationHiddenClass);\n            }\n            if (s.bullets && s.bullets.length) {\n                s.bullets.removeClass(s.params.bulletActiveClass);\n            }\n\n            // Buttons\n            if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);\n            if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);\n\n            // Scrollbar\n            if (s.params.scrollbar && s.scrollbar) {\n                if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');\n                if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');\n            }\n        };\n\n        // Destroy\n        s.destroy = function (deleteInstance, cleanupStyles) {\n            // Detach evebts\n            s.detachEvents();\n            // Stop autoplay\n            s.stopAutoplay();\n            // Disable draggable\n            if (s.params.scrollbar && s.scrollbar) {\n                if (s.params.scrollbarDraggable) {\n                    s.scrollbar.disableDraggable();\n                }\n            }\n            // Destroy loop\n            if (s.params.loop) {\n                s.destroyLoop();\n            }\n            // Cleanup styles\n            if (cleanupStyles) {\n                s.cleanupStyles();\n            }\n            // Disconnect observer\n            s.disconnectObservers();\n            // Disable keyboard/mousewheel\n            if (s.params.keyboardControl) {\n                if (s.disableKeyboardControl) s.disableKeyboardControl();\n            }\n            if (s.params.mousewheelControl) {\n                if (s.disableMousewheelControl) s.disableMousewheelControl();\n            }\n            // Disable a11y\n            if (s.params.a11y && s.a11y) s.a11y.destroy();\n            // Destroy callback\n            s.emit('onDestroy');\n            // Delete instance\n            if (deleteInstance !== false) s = null;\n        };\n\n        s.init();\n\n\n\n        // Return swiper instance\n        return s;\n    };\n\n\n    /*==================================================\n        Prototype\n    ====================================================*/\n    Swiper.prototype = {\n        isSafari: (function () {\n            var ua = navigator.userAgent.toLowerCase();\n            return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0);\n        })(),\n        isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),\n        isArray: function (arr) {\n            return Object.prototype.toString.apply(arr) === '[object Array]';\n        },\n        /*==================================================\n        Browser\n        ====================================================*/\n        browser: {\n            ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,\n            ieTouch: (window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1) || (window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1)\n        },\n        /*==================================================\n        Devices\n        ====================================================*/\n        device: (function () {\n            var ua = navigator.userAgent;\n            var android = ua.match(/(Android);?[\\s\\/]+([\\d.]+)?/);\n            var ipad = ua.match(/(iPad).*OS\\s([\\d_]+)/);\n            var ipod = ua.match(/(iPod)(.*OS\\s([\\d_]+))?/);\n            var iphone = !ipad && ua.match(/(iPhone\\sOS)\\s([\\d_]+)/);\n            return {\n                ios: ipad || iphone || ipod,\n                android: android\n            };\n        })(),\n        /*==================================================\n        Feature Detection\n        ====================================================*/\n        support: {\n            touch : (window.Modernizr && Modernizr.touch === true) || (function () {\n                return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch);\n            })(),\n\n            transforms3d : (window.Modernizr && Modernizr.csstransforms3d === true) || (function () {\n                var div = document.createElement('div').style;\n                return ('webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div);\n            })(),\n\n            flexbox: (function () {\n                var div = document.createElement('div').style;\n                var styles = ('alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient').split(' ');\n                for (var i = 0; i < styles.length; i++) {\n                    if (styles[i] in div) return true;\n                }\n            })(),\n\n            observer: (function () {\n                return ('MutationObserver' in window || 'WebkitMutationObserver' in window);\n            })()\n        },\n        /*==================================================\n        Plugins\n        ====================================================*/\n        plugins: {}\n    };\n\n\n    /*===========================\n    Dom7 Library\n    ===========================*/\n    var Dom7 = (function () {\n        var Dom7 = function (arr) {\n            var _this = this, i = 0;\n            // Create array-like object\n            for (i = 0; i < arr.length; i++) {\n                _this[i] = arr[i];\n            }\n            _this.length = arr.length;\n            // Return collection with methods\n            return this;\n        };\n        var $ = function (selector, context) {\n            var arr = [], i = 0;\n            if (selector && !context) {\n                if (selector instanceof Dom7) {\n                    return selector;\n                }\n            }\n            if (selector) {\n                // String\n                if (typeof selector === 'string') {\n                    var els, tempParent, html = selector.trim();\n                    if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) {\n                        var toCreate = 'div';\n                        if (html.indexOf('<li') === 0) toCreate = 'ul';\n                        if (html.indexOf('<tr') === 0) toCreate = 'tbody';\n                        if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr';\n                        if (html.indexOf('<tbody') === 0) toCreate = 'table';\n                        if (html.indexOf('<option') === 0) toCreate = 'select';\n                        tempParent = document.createElement(toCreate);\n                        tempParent.innerHTML = selector;\n                        for (i = 0; i < tempParent.childNodes.length; i++) {\n                            arr.push(tempParent.childNodes[i]);\n                        }\n                    }\n                    else {\n                        if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) {\n                            // Pure ID selector\n                            els = [document.getElementById(selector.split('#')[1])];\n                        }\n                        else {\n                            // Other selectors\n                            els = (context || document).querySelectorAll(selector);\n                        }\n                        for (i = 0; i < els.length; i++) {\n                            if (els[i]) arr.push(els[i]);\n                        }\n                    }\n                }\n                // Node/element\n                else if (selector.nodeType || selector === window || selector === document) {\n                    arr.push(selector);\n                }\n                //Array of elements or instance of Dom\n                else if (selector.length > 0 && selector[0].nodeType) {\n                    for (i = 0; i < selector.length; i++) {\n                        arr.push(selector[i]);\n                    }\n                }\n            }\n            return new Dom7(arr);\n        };\n        Dom7.prototype = {\n            // Classes and attriutes\n            addClass: function (className) {\n                if (typeof className === 'undefined') {\n                    return this;\n                }\n                var classes = className.split(' ');\n                for (var i = 0; i < classes.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        this[j].classList.add(classes[i]);\n                    }\n                }\n                return this;\n            },\n            removeClass: function (className) {\n                var classes = className.split(' ');\n                for (var i = 0; i < classes.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        this[j].classList.remove(classes[i]);\n                    }\n                }\n                return this;\n            },\n            hasClass: function (className) {\n                if (!this[0]) return false;\n                else return this[0].classList.contains(className);\n            },\n            toggleClass: function (className) {\n                var classes = className.split(' ');\n                for (var i = 0; i < classes.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        this[j].classList.toggle(classes[i]);\n                    }\n                }\n                return this;\n            },\n            attr: function (attrs, value) {\n                if (arguments.length === 1 && typeof attrs === 'string') {\n                    // Get attr\n                    if (this[0]) return this[0].getAttribute(attrs);\n                    else return undefined;\n                }\n                else {\n                    // Set attrs\n                    for (var i = 0; i < this.length; i++) {\n                        if (arguments.length === 2) {\n                            // String\n                            this[i].setAttribute(attrs, value);\n                        }\n                        else {\n                            // Object\n                            for (var attrName in attrs) {\n                                this[i][attrName] = attrs[attrName];\n                                this[i].setAttribute(attrName, attrs[attrName]);\n                            }\n                        }\n                    }\n                    return this;\n                }\n            },\n            removeAttr: function (attr) {\n                for (var i = 0; i < this.length; i++) {\n                    this[i].removeAttribute(attr);\n                }\n                return this;\n            },\n            data: function (key, value) {\n                if (typeof value === 'undefined') {\n                    // Get value\n                    if (this[0]) {\n                        var dataKey = this[0].getAttribute('data-' + key);\n                        if (dataKey) return dataKey;\n                        else if (this[0].dom7ElementDataStorage && (key in this[0].dom7ElementDataStorage)) return this[0].dom7ElementDataStorage[key];\n                        else return undefined;\n                    }\n                    else return undefined;\n                }\n                else {\n                    // Set value\n                    for (var i = 0; i < this.length; i++) {\n                        var el = this[i];\n                        if (!el.dom7ElementDataStorage) el.dom7ElementDataStorage = {};\n                        el.dom7ElementDataStorage[key] = value;\n                    }\n                    return this;\n                }\n            },\n            // Transforms\n            transform : function (transform) {\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;\n                }\n                return this;\n            },\n            transition: function (duration) {\n                if (typeof duration !== 'string') {\n                    duration = duration + 'ms';\n                }\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;\n                }\n                return this;\n            },\n            //Events\n            on: function (eventName, targetSelector, listener, capture) {\n                function handleLiveEvent(e) {\n                    var target = e.target;\n                    if ($(target).is(targetSelector)) listener.call(target, e);\n                    else {\n                        var parents = $(target).parents();\n                        for (var k = 0; k < parents.length; k++) {\n                            if ($(parents[k]).is(targetSelector)) listener.call(parents[k], e);\n                        }\n                    }\n                }\n                var events = eventName.split(' ');\n                var i, j;\n                for (i = 0; i < this.length; i++) {\n                    if (typeof targetSelector === 'function' || targetSelector === false) {\n                        // Usual events\n                        if (typeof targetSelector === 'function') {\n                            listener = arguments[1];\n                            capture = arguments[2] || false;\n                        }\n                        for (j = 0; j < events.length; j++) {\n                            this[i].addEventListener(events[j], listener, capture);\n                        }\n                    }\n                    else {\n                        //Live events\n                        for (j = 0; j < events.length; j++) {\n                            if (!this[i].dom7LiveListeners) this[i].dom7LiveListeners = [];\n                            this[i].dom7LiveListeners.push({listener: listener, liveListener: handleLiveEvent});\n                            this[i].addEventListener(events[j], handleLiveEvent, capture);\n                        }\n                    }\n                }\n\n                return this;\n            },\n            off: function (eventName, targetSelector, listener, capture) {\n                var events = eventName.split(' ');\n                for (var i = 0; i < events.length; i++) {\n                    for (var j = 0; j < this.length; j++) {\n                        if (typeof targetSelector === 'function' || targetSelector === false) {\n                            // Usual events\n                            if (typeof targetSelector === 'function') {\n                                listener = arguments[1];\n                                capture = arguments[2] || false;\n                            }\n                            this[j].removeEventListener(events[i], listener, capture);\n                        }\n                        else {\n                            // Live event\n                            if (this[j].dom7LiveListeners) {\n                                for (var k = 0; k < this[j].dom7LiveListeners.length; k++) {\n                                    if (this[j].dom7LiveListeners[k].listener === listener) {\n                                        this[j].removeEventListener(events[i], this[j].dom7LiveListeners[k].liveListener, capture);\n                                    }\n                                }\n                            }\n                        }\n                    }\n                }\n                return this;\n            },\n            once: function (eventName, targetSelector, listener, capture) {\n                var dom = this;\n                if (typeof targetSelector === 'function') {\n                    targetSelector = false;\n                    listener = arguments[1];\n                    capture = arguments[2];\n                }\n                function proxy(e) {\n                    listener(e);\n                    dom.off(eventName, targetSelector, proxy, capture);\n                }\n                dom.on(eventName, targetSelector, proxy, capture);\n            },\n            trigger: function (eventName, eventData) {\n                for (var i = 0; i < this.length; i++) {\n                    var evt;\n                    try {\n                        evt = new window.CustomEvent(eventName, {detail: eventData, bubbles: true, cancelable: true});\n                    }\n                    catch (e) {\n                        evt = document.createEvent('Event');\n                        evt.initEvent(eventName, true, true);\n                        evt.detail = eventData;\n                    }\n                    this[i].dispatchEvent(evt);\n                }\n                return this;\n            },\n            transitionEnd: function (callback) {\n                var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],\n                    i, j, dom = this;\n                function fireCallBack(e) {\n                    /*jshint validthis:true */\n                    if (e.target !== this) return;\n                    callback.call(this, e);\n                    for (i = 0; i < events.length; i++) {\n                        dom.off(events[i], fireCallBack);\n                    }\n                }\n                if (callback) {\n                    for (i = 0; i < events.length; i++) {\n                        dom.on(events[i], fireCallBack);\n                    }\n                }\n                return this;\n            },\n            // Sizing/Styles\n            width: function () {\n                if (this[0] === window) {\n                    return window.innerWidth;\n                }\n                else {\n                    if (this.length > 0) {\n                        return parseFloat(this.css('width'));\n                    }\n                    else {\n                        return null;\n                    }\n                }\n            },\n            outerWidth: function (includeMargins) {\n                if (this.length > 0) {\n                    if (includeMargins)\n                        return this[0].offsetWidth + parseFloat(this.css('margin-right')) + parseFloat(this.css('margin-left'));\n                    else\n                        return this[0].offsetWidth;\n                }\n                else return null;\n            },\n            height: function () {\n                if (this[0] === window) {\n                    return window.innerHeight;\n                }\n                else {\n                    if (this.length > 0) {\n                        return parseFloat(this.css('height'));\n                    }\n                    else {\n                        return null;\n                    }\n                }\n            },\n            outerHeight: function (includeMargins) {\n                if (this.length > 0) {\n                    if (includeMargins)\n                        return this[0].offsetHeight + parseFloat(this.css('margin-top')) + parseFloat(this.css('margin-bottom'));\n                    else\n                        return this[0].offsetHeight;\n                }\n                else return null;\n            },\n            offset: function () {\n                if (this.length > 0) {\n                    var el = this[0];\n                    var box = el.getBoundingClientRect();\n                    var body = document.body;\n                    var clientTop  = el.clientTop  || body.clientTop  || 0;\n                    var clientLeft = el.clientLeft || body.clientLeft || 0;\n                    var scrollTop  = window.pageYOffset || el.scrollTop;\n                    var scrollLeft = window.pageXOffset || el.scrollLeft;\n                    return {\n                        top: box.top  + scrollTop  - clientTop,\n                        left: box.left + scrollLeft - clientLeft\n                    };\n                }\n                else {\n                    return null;\n                }\n            },\n            css: function (props, value) {\n                var i;\n                if (arguments.length === 1) {\n                    if (typeof props === 'string') {\n                        if (this[0]) return window.getComputedStyle(this[0], null).getPropertyValue(props);\n                    }\n                    else {\n                        for (i = 0; i < this.length; i++) {\n                            for (var prop in props) {\n                                this[i].style[prop] = props[prop];\n                            }\n                        }\n                        return this;\n                    }\n                }\n                if (arguments.length === 2 && typeof props === 'string') {\n                    for (i = 0; i < this.length; i++) {\n                        this[i].style[props] = value;\n                    }\n                    return this;\n                }\n                return this;\n            },\n\n            //Dom manipulation\n            each: function (callback) {\n                for (var i = 0; i < this.length; i++) {\n                    callback.call(this[i], i, this[i]);\n                }\n                return this;\n            },\n            html: function (html) {\n                if (typeof html === 'undefined') {\n                    return this[0] ? this[0].innerHTML : undefined;\n                }\n                else {\n                    for (var i = 0; i < this.length; i++) {\n                        this[i].innerHTML = html;\n                    }\n                    return this;\n                }\n            },\n            is: function (selector) {\n                if (!this[0]) return false;\n                var compareWith, i;\n                if (typeof selector === 'string') {\n                    var el = this[0];\n                    if (el === document) return selector === document;\n                    if (el === window) return selector === window;\n\n                    if (el.matches) return el.matches(selector);\n                    else if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector);\n                    else if (el.mozMatchesSelector) return el.mozMatchesSelector(selector);\n                    else if (el.msMatchesSelector) return el.msMatchesSelector(selector);\n                    else {\n                        compareWith = $(selector);\n                        for (i = 0; i < compareWith.length; i++) {\n                            if (compareWith[i] === this[0]) return true;\n                        }\n                        return false;\n                    }\n                }\n                else if (selector === document) return this[0] === document;\n                else if (selector === window) return this[0] === window;\n                else {\n                    if (selector.nodeType || selector instanceof Dom7) {\n                        compareWith = selector.nodeType ? [selector] : selector;\n                        for (i = 0; i < compareWith.length; i++) {\n                            if (compareWith[i] === this[0]) return true;\n                        }\n                        return false;\n                    }\n                    return false;\n                }\n\n            },\n            index: function () {\n                if (this[0]) {\n                    var child = this[0];\n                    var i = 0;\n                    while ((child = child.previousSibling) !== null) {\n                        if (child.nodeType === 1) i++;\n                    }\n                    return i;\n                }\n                else return undefined;\n            },\n            eq: function (index) {\n                if (typeof index === 'undefined') return this;\n                var length = this.length;\n                var returnIndex;\n                if (index > length - 1) {\n                    return new Dom7([]);\n                }\n                if (index < 0) {\n                    returnIndex = length + index;\n                    if (returnIndex < 0) return new Dom7([]);\n                    else return new Dom7([this[returnIndex]]);\n                }\n                return new Dom7([this[index]]);\n            },\n            append: function (newChild) {\n                var i, j;\n                for (i = 0; i < this.length; i++) {\n                    if (typeof newChild === 'string') {\n                        var tempDiv = document.createElement('div');\n                        tempDiv.innerHTML = newChild;\n                        while (tempDiv.firstChild) {\n                            this[i].appendChild(tempDiv.firstChild);\n                        }\n                    }\n                    else if (newChild instanceof Dom7) {\n                        for (j = 0; j < newChild.length; j++) {\n                            this[i].appendChild(newChild[j]);\n                        }\n                    }\n                    else {\n                        this[i].appendChild(newChild);\n                    }\n                }\n                return this;\n            },\n            prepend: function (newChild) {\n                var i, j;\n                for (i = 0; i < this.length; i++) {\n                    if (typeof newChild === 'string') {\n                        var tempDiv = document.createElement('div');\n                        tempDiv.innerHTML = newChild;\n                        for (j = tempDiv.childNodes.length - 1; j >= 0; j--) {\n                            this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]);\n                        }\n                        // this[i].insertAdjacentHTML('afterbegin', newChild);\n                    }\n                    else if (newChild instanceof Dom7) {\n                        for (j = 0; j < newChild.length; j++) {\n                            this[i].insertBefore(newChild[j], this[i].childNodes[0]);\n                        }\n                    }\n                    else {\n                        this[i].insertBefore(newChild, this[i].childNodes[0]);\n                    }\n                }\n                return this;\n            },\n            insertBefore: function (selector) {\n                var before = $(selector);\n                for (var i = 0; i < this.length; i++) {\n                    if (before.length === 1) {\n                        before[0].parentNode.insertBefore(this[i], before[0]);\n                    }\n                    else if (before.length > 1) {\n                        for (var j = 0; j < before.length; j++) {\n                            before[j].parentNode.insertBefore(this[i].cloneNode(true), before[j]);\n                        }\n                    }\n                }\n            },\n            insertAfter: function (selector) {\n                var after = $(selector);\n                for (var i = 0; i < this.length; i++) {\n                    if (after.length === 1) {\n                        after[0].parentNode.insertBefore(this[i], after[0].nextSibling);\n                    }\n                    else if (after.length > 1) {\n                        for (var j = 0; j < after.length; j++) {\n                            after[j].parentNode.insertBefore(this[i].cloneNode(true), after[j].nextSibling);\n                        }\n                    }\n                }\n            },\n            next: function (selector) {\n                if (this.length > 0) {\n                    if (selector) {\n                        if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return new Dom7([this[0].nextElementSibling]);\n                        else return new Dom7([]);\n                    }\n                    else {\n                        if (this[0].nextElementSibling) return new Dom7([this[0].nextElementSibling]);\n                        else return new Dom7([]);\n                    }\n                }\n                else return new Dom7([]);\n            },\n            nextAll: function (selector) {\n                var nextEls = [];\n                var el = this[0];\n                if (!el) return new Dom7([]);\n                while (el.nextElementSibling) {\n                    var next = el.nextElementSibling;\n                    if (selector) {\n                        if($(next).is(selector)) nextEls.push(next);\n                    }\n                    else nextEls.push(next);\n                    el = next;\n                }\n                return new Dom7(nextEls);\n            },\n            prev: function (selector) {\n                if (this.length > 0) {\n                    if (selector) {\n                        if (this[0].previousElementSibling && $(this[0].previousElementSibling).is(selector)) return new Dom7([this[0].previousElementSibling]);\n                        else return new Dom7([]);\n                    }\n                    else {\n                        if (this[0].previousElementSibling) return new Dom7([this[0].previousElementSibling]);\n                        else return new Dom7([]);\n                    }\n                }\n                else return new Dom7([]);\n            },\n            prevAll: function (selector) {\n                var prevEls = [];\n                var el = this[0];\n                if (!el) return new Dom7([]);\n                while (el.previousElementSibling) {\n                    var prev = el.previousElementSibling;\n                    if (selector) {\n                        if($(prev).is(selector)) prevEls.push(prev);\n                    }\n                    else prevEls.push(prev);\n                    el = prev;\n                }\n                return new Dom7(prevEls);\n            },\n            parent: function (selector) {\n                var parents = [];\n                for (var i = 0; i < this.length; i++) {\n                    if (selector) {\n                        if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode);\n                    }\n                    else {\n                        parents.push(this[i].parentNode);\n                    }\n                }\n                return $($.unique(parents));\n            },\n            parents: function (selector) {\n                var parents = [];\n                for (var i = 0; i < this.length; i++) {\n                    var parent = this[i].parentNode;\n                    while (parent) {\n                        if (selector) {\n                            if ($(parent).is(selector)) parents.push(parent);\n                        }\n                        else {\n                            parents.push(parent);\n                        }\n                        parent = parent.parentNode;\n                    }\n                }\n                return $($.unique(parents));\n            },\n            find : function (selector) {\n                var foundElements = [];\n                for (var i = 0; i < this.length; i++) {\n                    var found = this[i].querySelectorAll(selector);\n                    for (var j = 0; j < found.length; j++) {\n                        foundElements.push(found[j]);\n                    }\n                }\n                return new Dom7(foundElements);\n            },\n            children: function (selector) {\n                var children = [];\n                for (var i = 0; i < this.length; i++) {\n                    var childNodes = this[i].childNodes;\n\n                    for (var j = 0; j < childNodes.length; j++) {\n                        if (!selector) {\n                            if (childNodes[j].nodeType === 1) children.push(childNodes[j]);\n                        }\n                        else {\n                            if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) children.push(childNodes[j]);\n                        }\n                    }\n                }\n                return new Dom7($.unique(children));\n            },\n            remove: function () {\n                for (var i = 0; i < this.length; i++) {\n                    if (this[i].parentNode) this[i].parentNode.removeChild(this[i]);\n                }\n                return this;\n            },\n            add: function () {\n                var dom = this;\n                var i, j;\n                for (i = 0; i < arguments.length; i++) {\n                    var toAdd = $(arguments[i]);\n                    for (j = 0; j < toAdd.length; j++) {\n                        dom[dom.length] = toAdd[j];\n                        dom.length++;\n                    }\n                }\n                return dom;\n            }\n        };\n        $.fn = Dom7.prototype;\n        $.unique = function (arr) {\n            var unique = [];\n            for (var i = 0; i < arr.length; i++) {\n                if (unique.indexOf(arr[i]) === -1) unique.push(arr[i]);\n            }\n            return unique;\n        };\n\n        return $;\n    })();\n\n\n    /*===========================\n     Get Dom libraries\n     ===========================*/\n    var swiperDomPlugins = ['jQuery', 'Zepto', 'Dom7'];\n    for (var i = 0; i < swiperDomPlugins.length; i++) {\n    \tif (window[swiperDomPlugins[i]]) {\n    \t\taddLibraryPlugin(window[swiperDomPlugins[i]]);\n    \t}\n    }\n    // Required DOM Plugins\n    var domLib;\n    if (typeof Dom7 === 'undefined') {\n    \tdomLib = window.Dom7 || window.Zepto || window.jQuery;\n    }\n    else {\n    \tdomLib = Dom7;\n    }\n\n    /*===========================\n    Add .swiper plugin from Dom libraries\n    ===========================*/\n    function addLibraryPlugin(lib) {\n        lib.fn.swiper = function (params) {\n            var firstInstance;\n            lib(this).each(function () {\n                var s = new Swiper(this, params);\n                if (!firstInstance) firstInstance = s;\n            });\n            return firstInstance;\n        };\n    }\n\n    if (domLib) {\n        if (!('transitionEnd' in domLib.fn)) {\n            domLib.fn.transitionEnd = function (callback) {\n                var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],\n                    i, j, dom = this;\n                function fireCallBack(e) {\n                    /*jshint validthis:true */\n                    if (e.target !== this) return;\n                    callback.call(this, e);\n                    for (i = 0; i < events.length; i++) {\n                        dom.off(events[i], fireCallBack);\n                    }\n                }\n                if (callback) {\n                    for (i = 0; i < events.length; i++) {\n                        dom.on(events[i], fireCallBack);\n                    }\n                }\n                return this;\n            };\n        }\n        if (!('transform' in domLib.fn)) {\n            domLib.fn.transform = function (transform) {\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.MozTransform = elStyle.OTransform = elStyle.transform = transform;\n                }\n                return this;\n            };\n        }\n        if (!('transition' in domLib.fn)) {\n            domLib.fn.transition = function (duration) {\n                if (typeof duration !== 'string') {\n                    duration = duration + 'ms';\n                }\n                for (var i = 0; i < this.length; i++) {\n                    var elStyle = this[i].style;\n                    elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.MozTransitionDuration = elStyle.OTransitionDuration = elStyle.transitionDuration = duration;\n                }\n                return this;\n            };\n        }\n    }\n\n    ionic.views.Swiper = Swiper;\n})();\n\n(function(ionic) {\n'use strict';\n\n  ionic.views.Toggle = ionic.views.View.inherit({\n    initialize: function(opts) {\n      var self = this;\n\n      this.el = opts.el;\n      this.checkbox = opts.checkbox;\n      this.track = opts.track;\n      this.handle = opts.handle;\n      this.openPercent = -1;\n      this.onChange = opts.onChange || function() {};\n\n      this.triggerThreshold = opts.triggerThreshold || 20;\n\n      this.dragStartHandler = function(e) {\n        self.dragStart(e);\n      };\n      this.dragHandler = function(e) {\n        self.drag(e);\n      };\n      this.holdHandler = function(e) {\n        self.hold(e);\n      };\n      this.releaseHandler = function(e) {\n        self.release(e);\n      };\n\n      this.dragStartGesture = ionic.onGesture('dragstart', this.dragStartHandler, this.el);\n      this.dragGesture = ionic.onGesture('drag', this.dragHandler, this.el);\n      this.dragHoldGesture = ionic.onGesture('hold', this.holdHandler, this.el);\n      this.dragReleaseGesture = ionic.onGesture('release', this.releaseHandler, this.el);\n    },\n\n    destroy: function() {\n      ionic.offGesture(this.dragStartGesture, 'dragstart', this.dragStartGesture);\n      ionic.offGesture(this.dragGesture, 'drag', this.dragGesture);\n      ionic.offGesture(this.dragHoldGesture, 'hold', this.holdHandler);\n      ionic.offGesture(this.dragReleaseGesture, 'release', this.releaseHandler);\n    },\n\n    tap: function() {\n      if(this.el.getAttribute('disabled') !== 'disabled') {\n        this.val( !this.checkbox.checked );\n      }\n    },\n\n    dragStart: function(e) {\n      if(this.checkbox.disabled) return;\n\n      this._dragInfo = {\n        width: this.el.offsetWidth,\n        left: this.el.offsetLeft,\n        right: this.el.offsetLeft + this.el.offsetWidth,\n        triggerX: this.el.offsetWidth / 2,\n        initialState: this.checkbox.checked\n      };\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      // Trigger hold styles\n      this.hold(e);\n    },\n\n    drag: function(e) {\n      var self = this;\n      if(!this._dragInfo) { return; }\n\n      // Stop any parent dragging\n      e.gesture.srcEvent.preventDefault();\n\n      ionic.requestAnimationFrame(function () {\n        if (!self._dragInfo) { return; }\n\n        var px = e.gesture.touches[0].pageX - self._dragInfo.left;\n        var mx = self._dragInfo.width - self.triggerThreshold;\n\n        // The initial state was on, so \"tend towards\" on\n        if(self._dragInfo.initialState) {\n          if(px < self.triggerThreshold) {\n            self.setOpenPercent(0);\n          } else if(px > self._dragInfo.triggerX) {\n            self.setOpenPercent(100);\n          }\n        } else {\n          // The initial state was off, so \"tend towards\" off\n          if(px < self._dragInfo.triggerX) {\n            self.setOpenPercent(0);\n          } else if(px > mx) {\n            self.setOpenPercent(100);\n          }\n        }\n      });\n    },\n\n    endDrag: function() {\n      this._dragInfo = null;\n    },\n\n    hold: function() {\n      this.el.classList.add('dragging');\n    },\n    release: function(e) {\n      this.el.classList.remove('dragging');\n      this.endDrag(e);\n    },\n\n\n    setOpenPercent: function(openPercent) {\n      // only make a change if the new open percent has changed\n      if(this.openPercent < 0 || (openPercent < (this.openPercent - 3) || openPercent > (this.openPercent + 3) ) ) {\n        this.openPercent = openPercent;\n\n        if(openPercent === 0) {\n          this.val(false);\n        } else if(openPercent === 100) {\n          this.val(true);\n        } else {\n          var openPixel = Math.round( (openPercent / 100) * this.track.offsetWidth - (this.handle.offsetWidth) );\n          openPixel = (openPixel < 1 ? 0 : openPixel);\n          this.handle.style[ionic.CSS.TRANSFORM] = 'translate3d(' + openPixel + 'px,0,0)';\n        }\n      }\n    },\n\n    val: function(value) {\n      if(value === true || value === false) {\n        if(this.handle.style[ionic.CSS.TRANSFORM] !== \"\") {\n          this.handle.style[ionic.CSS.TRANSFORM] = \"\";\n        }\n        this.checkbox.checked = value;\n        this.openPercent = (value ? 100 : 0);\n        this.onChange && this.onChange();\n      }\n      return this.checkbox.checked;\n    }\n\n  });\n\n})(ionic);\n\n})();"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_action-sheet.scss",
    "content": "/**\n * Action Sheets\n * --------------------------------------------------\n */\n\n.action-sheet-backdrop {\n  @include transition(background-color 150ms ease-in-out);\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-action-sheet;\n  width: 100%;\n  height: 100%;\n  background-color: rgba(0,0,0,0);\n\n  &.active {\n    background-color: rgba(0,0,0,0.4);\n  }\n}\n\n.action-sheet-wrapper {\n  @include translate3d(0, 100%, 0);\n  @include transition(all cubic-bezier(.36, .66, .04, 1) 500ms);\n  position: absolute;\n  bottom: 0;\n  left: 0;\n  right: 0;\n  width: 100%;\n  max-width: 500px;\n  margin: auto;\n}\n\n.action-sheet-up {\n  @include translate3d(0, 0, 0);\n}\n\n.action-sheet {\n  margin-left: $sheet-margin;\n  margin-right: $sheet-margin;\n  width: auto;\n  z-index: $z-index-action-sheet;\n  overflow: hidden;\n\n  .button {\n    display: block;\n    padding: 1px;\n    width: 100%;\n    border-radius: 0;\n    border-color: $sheet-options-border-color;\n    background-color: transparent;\n\n    color: $sheet-options-text-color;\n    font-size: 21px;\n\n    &:hover {\n      color: $sheet-options-text-color;\n    }\n    &.destructive {\n      color: #ff3b30;\n      &:hover {\n        color: #ff3b30;\n      }\n    }\n  }\n\n  .button.active, .button.activated {\n    box-shadow: none;\n    border-color: $sheet-options-border-color;\n    color: $sheet-options-text-color;\n    background: $sheet-options-bg-active-color;\n  }\n}\n\n.action-sheet-has-icons .icon {\n  position: absolute;\n  left: 16px;\n}\n\n.action-sheet-title {\n  padding: $sheet-margin * 2;\n  color: #8f8f8f;\n  text-align: center;\n  font-size: 13px;\n}\n\n.action-sheet-group {\n  margin-bottom: $sheet-margin;\n  border-radius: $sheet-border-radius;\n  background-color: #fff;\n  overflow: hidden;\n\n  .button {\n    border-width: 1px 0px 0px 0px;\n  }\n  .button:first-child:last-child {\n    border-width: 0;\n  }\n}\n\n.action-sheet-options {\n  background: $sheet-options-bg-color;\n}\n\n.action-sheet-cancel {\n  .button {\n    font-weight: 500;\n  }\n}\n\n.action-sheet-open {\n  pointer-events: none;\n\n  &.modal-open .modal {\n    pointer-events: none;\n  }\n\n  .action-sheet-backdrop {\n    pointer-events: auto;\n  }\n}\n\n\n.platform-android {\n\n  .action-sheet-backdrop.active {\n    background-color: rgba(0,0,0,0.2);\n  }\n\n  .action-sheet {\n    margin: 0;\n\n    .action-sheet-title,\n    .button {\n      text-align: left;\n      border-color: transparent;\n      font-size: 16px;\n      color: inherit;\n    }\n\n    .action-sheet-title {\n      font-size: 14px;\n      padding: 16px;\n      color: #666;\n    }\n\n    .button.active,\n    .button.activated {\n      background: #e8e8e8;\n    }\n  }\n\n  .action-sheet-group {\n    margin: 0;\n    border-radius: 0;\n    background-color: #fafafa;\n  }\n\n  .action-sheet-cancel {\n    display: none;\n  }\n\n  .action-sheet-has-icons {\n\n    .button {\n      padding-left: 56px;\n    }\n\n  }\n\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_animations.scss",
    "content": "\n// Slide up from the bottom, used for modals\n// -------------------------------\n\n.slide-in-up {\n  @include translate3d(0, 100%, 0);\n}\n.slide-in-up.ng-enter,\n.slide-in-up > .ng-enter {\n  @include transition(all cubic-bezier(.1, .7, .1, 1) 400ms);\n}\n.slide-in-up.ng-enter-active,\n.slide-in-up > .ng-enter-active {\n  @include translate3d(0, 0, 0);\n}\n\n.slide-in-up.ng-leave,\n.slide-in-up > .ng-leave {\n  @include transition(all ease-in-out 250ms);\n}\n\n\n// Scale Out\n// Scale from hero (1 in this case) to zero\n// -------------------------------\n\n@-webkit-keyframes scaleOut {\n  from { -webkit-transform: scale(1); opacity: 1; }\n  to { -webkit-transform: scale(0.8); opacity: 0; }\n}\n@keyframes scaleOut {\n  from { transform: scale(1); opacity: 1; }\n  to { transform: scale(0.8); opacity: 0; }\n}\n\n\n// Super Scale In\n// Scale from super (1.x) to duper (1 in this case)\n// -------------------------------\n\n@-webkit-keyframes superScaleIn {\n  from { -webkit-transform: scale(1.2); opacity: 0; }\n  to { -webkit-transform: scale(1); opacity: 1 }\n}\n@keyframes superScaleIn {\n  from { transform: scale(1.2); opacity: 0; }\n  to { transform: scale(1); opacity: 1; }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_backdrop.scss",
    "content": "\n.backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-backdrop;\n\n  width: 100%;\n  height: 100%;\n\n  background-color: $loading-backdrop-bg-color;\n\n  visibility: hidden;\n  opacity: 0;\n\n  &.visible {\n    visibility: visible;\n  }\n  &.active {\n    opacity: 1;\n  }\n\n  @include transition($loading-backdrop-fadein-duration opacity linear);\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_badge.scss",
    "content": "\n/**\n * Badges\n * --------------------------------------------------\n */\n\n.badge {\n  @include badge-style($badge-default-bg, $badge-default-text);\n  z-index: $z-index-badge;\n  display: inline-block;\n  padding: 3px 8px;\n  min-width: 10px;\n  border-radius: $badge-border-radius;\n  vertical-align: baseline;\n  text-align: center;\n  white-space: nowrap;\n  font-weight: $badge-font-weight;\n  font-size: $badge-font-size;\n  line-height: $badge-line-height;\n\n  &:empty {\n    display: none;\n  }\n}\n\n//Be sure to override specificity of rule that 'badge color matches tab color by default'\n.tabs .tab-item .badge,\n.badge {\n  &.badge-light {\n    @include badge-style($badge-light-bg, $badge-light-text);\n  }\n  &.badge-stable {\n    @include badge-style($badge-stable-bg, $badge-stable-text);\n  }\n  &.badge-positive {\n    @include badge-style($badge-positive-bg, $badge-positive-text);\n  }\n  &.badge-calm {\n    @include badge-style($badge-calm-bg, $badge-calm-text);\n  }\n  &.badge-assertive {\n    @include badge-style($badge-assertive-bg, $badge-assertive-text);\n  }\n  &.badge-balanced {\n    @include badge-style($badge-balanced-bg, $badge-balanced-text);\n  }\n  &.badge-energized {\n    @include badge-style($badge-energized-bg, $badge-energized-text);\n  }\n  &.badge-royal {\n    @include badge-style($badge-royal-bg, $badge-royal-text);\n  }\n  &.badge-dark {\n    @include badge-style($badge-dark-bg, $badge-dark-text);\n  }\n}\n\n// Quick fix for labels/badges in buttons\n.button .badge {\n  position: relative;\n  top: -1px;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_bar.scss",
    "content": "\n/**\n * Bar (Headers and Footers)\n * --------------------------------------------------\n */\n\n.bar {\n  @include display-flex();\n  @include translate3d(0,0,0);\n  @include user-select(none);\n  position: absolute;\n  right: 0;\n  left: 0;\n  z-index: $z-index-bar;\n\n  @include box-sizing(border-box);\n  padding: $bar-padding-portrait;\n\n  width: 100%;\n  height: $bar-height;\n  border-width: 0;\n  border-style: solid;\n  border-top: 1px solid transparent;\n  border-bottom: 1px solid $bar-default-border;\n\n  background-color: $bar-default-bg;\n\n  /* border-width: 1px will actually create 2 device pixels on retina */\n  /* this nifty trick sets an actual 1px border on hi-res displays */\n  background-size: 0;\n  @media (min--moz-device-pixel-ratio: 1.5),\n         (-webkit-min-device-pixel-ratio: 1.5),\n         (min-device-pixel-ratio: 1.5),\n         (min-resolution: 144dpi),\n         (min-resolution: 1.5dppx) {\n    border: none;\n    background-image: linear-gradient(0deg, $bar-default-border, $bar-default-border 50%, transparent 50%);\n    background-position: bottom;\n    background-size: 100% 1px;\n    background-repeat: no-repeat;\n  }\n\n  &.bar-clear {\n    border: none;\n    background: none;\n    color: #fff;\n\n    .button {\n      color: #fff;\n    }\n    .title {\n      color: #fff;\n    }\n  }\n\n  &.item-input-inset {\n    .item-input-wrapper {\n      margin-top: -1px;\n\n      input {\n        padding-left: 8px;\n        width: 94%;\n        height: 28px;\n        background: transparent;\n      }\n    }\n  }\n\n  &.bar-light {\n    @include bar-style($bar-light-bg, $bar-light-border, $bar-light-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-light-border, $bar-light-border 50%, transparent 50%);\n    }\n  }\n  &.bar-stable {\n    @include bar-style($bar-stable-bg, $bar-stable-border, $bar-stable-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-stable-border, $bar-stable-border 50%, transparent 50%);\n    }\n  }\n  &.bar-positive {\n    @include bar-style($bar-positive-bg, $bar-positive-border, $bar-positive-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-positive-border, $bar-positive-border 50%, transparent 50%);\n    }\n  }\n  &.bar-calm {\n    @include bar-style($bar-calm-bg, $bar-calm-border, $bar-calm-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-calm-border, $bar-calm-border 50%, transparent 50%);\n    }\n  }\n  &.bar-assertive {\n    @include bar-style($bar-assertive-bg, $bar-assertive-border, $bar-assertive-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-assertive-border, $bar-assertive-border 50%, transparent 50%);\n    }\n  }\n  &.bar-balanced {\n    @include bar-style($bar-balanced-bg, $bar-balanced-border, $bar-balanced-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-balanced-border, $bar-balanced-border 50%, transparent 50%);\n    }\n  }\n  &.bar-energized {\n    @include bar-style($bar-energized-bg, $bar-energized-border, $bar-energized-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-energized-border, $bar-energized-border 50%, transparent 50%);\n    }\n  }\n  &.bar-royal {\n    @include bar-style($bar-royal-bg, $bar-royal-border, $bar-royal-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-royal-border, $bar-royal-border 50%, transparent 50%);\n    }\n  }\n  &.bar-dark {\n    @include bar-style($bar-dark-bg, $bar-dark-border, $bar-dark-text);\n    &.bar-footer{\n      background-image: linear-gradient(180deg, $bar-dark-border, $bar-dark-border 50%, transparent 50%);\n    }\n  }\n\n  // Title inside of a bar is centered\n  .title {\n    display: block;\n    position: absolute;\n\n    top: 0;\n    right: 0;\n    left: 0;\n    z-index: $z-index-bar-title;\n    overflow: hidden;\n\n    margin: 0 10px;\n\n    min-width: 30px;\n    height: $bar-height - 1;\n\n    text-align: center;\n\n    // Go into ellipsis if too small\n    text-overflow: ellipsis;\n    white-space: nowrap;\n\n    font-size: $bar-title-font-size;\n    font-weight: $headings-font-weight;\n\n    line-height: $bar-height;\n\n    &.title-left {\n      text-align: left;\n    }\n    &.title-right {\n      text-align: right;\n    }\n  }\n\n  .title a {\n    color: inherit;\n  }\n\n  .button, button {\n    z-index: $z-index-bar-button;\n    padding: 0 $button-bar-button-padding;\n    min-width: initial;\n    min-height: $button-bar-button-height - 1;\n    font-weight: 400;\n    font-size: $button-bar-button-font-size;\n    line-height: $button-bar-button-height;\n\n    &.button-icon:before,\n    .icon:before,\n    &.icon:before,\n    &.icon-left:before,\n    &.icon-right:before {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-size: $button-bar-button-icon-size;\n      line-height: $button-bar-button-height;\n    }\n\n    &.button-icon {\n      font-size: $bar-title-font-size;\n      .icon:before,\n      &:before,\n      &.icon-left:before,\n      &.icon-right:before {\n        vertical-align: top;\n        font-size: $button-large-icon-size;\n        line-height: $button-bar-button-height;\n      }\n    }\n    &.button-clear {\n      padding-right: 2px;\n      padding-left: 2px;\n      font-weight: 300;\n      font-size: $bar-title-font-size;\n\n      .icon:before,\n      &.icon:before,\n      &.icon-left:before,\n      &.icon-right:before {\n        font-size: $button-large-icon-size;\n        line-height: $button-bar-button-height;\n      }\n    }\n\n    &.back-button {\n      display: block;\n      margin-right: 5px;\n      padding: 0;\n      white-space: nowrap;\n      font-weight: 400;\n    }\n\n    &.back-button.active,\n    &.back-button.activated {\n      opacity: 0.2;\n    }\n  }\n\n  .button-bar > .button,\n  .buttons > .button {\n    min-height: $button-bar-button-height - 1;\n    line-height: $button-bar-button-height;\n  }\n\n  .button-bar + .button,\n  .button + .button-bar {\n    margin-left: 5px;\n  }\n\n  // Android 4.4 messes with the display property\n  .buttons,\n  .buttons.primary-buttons,\n  .buttons.secondary-buttons {\n    display: inherit;\n  }\n  .buttons span {\n    display: inline-block;\n  }\n  .buttons-left span {\n    margin-right: 5px;\n    display: inherit;\n  }\n  .buttons-right span {\n    margin-left: 5px;\n    display: inherit;\n  }\n\n  // Place the last button in a bar on the right of the bar\n  .title + .button:last-child,\n  > .button + .button:last-child,\n  > .button.pull-right,\n  .buttons.pull-right,\n  .title + .buttons {\n    position: absolute;\n    top: 5px;\n    right: 5px;\n    bottom: 5px;\n  }\n\n}\n\n.platform-android {\n\n  .nav-bar-has-subheader .bar {\n    background-image: none;\n  }\n\n  .bar {\n\n    .back-button .icon:before {\n      font-size: 24px;\n    }\n\n    .title {\n      font-size: 19px;\n      line-height: $bar-height;\n    }\n  }\n\n}\n\n// Default styles for buttons inside of styled bars\n.bar-light {\n  .button {\n    @include button-style($bar-light-bg, $bar-light-border, $bar-light-active-bg, $bar-light-active-border, $bar-light-text);\n    @include button-clear($bar-light-text, $bar-title-font-size);\n  }\n}\n.bar-stable {\n  .button {\n    @include button-style($bar-stable-bg, $bar-stable-border, $bar-stable-active-bg, $bar-stable-active-border, $bar-stable-text);\n    @include button-clear($bar-stable-text, $bar-title-font-size);\n  }\n}\n.bar-positive {\n  .button {\n    @include button-style($bar-positive-bg, $bar-positive-border, $bar-positive-active-bg, $bar-positive-active-border, $bar-positive-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-calm {\n  .button {\n    @include button-style($bar-calm-bg, $bar-calm-border, $bar-calm-active-bg, $bar-calm-active-border, $bar-calm-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-assertive {\n  .button {\n    @include button-style($bar-assertive-bg, $bar-assertive-border, $bar-assertive-active-bg, $bar-assertive-active-border, $bar-assertive-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-balanced {\n  .button {\n    @include button-style($bar-balanced-bg, $bar-balanced-border, $bar-balanced-active-bg, $bar-balanced-active-border, $bar-balanced-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-energized {\n  .button {\n    @include button-style($bar-energized-bg, $bar-energized-border, $bar-energized-active-bg, $bar-energized-active-border, $bar-energized-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-royal {\n  .button {\n    @include button-style($bar-royal-bg, $bar-royal-border, $bar-royal-active-bg, $bar-royal-active-border, $bar-royal-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n.bar-dark {\n  .button {\n    @include button-style($bar-dark-bg, $bar-dark-border, $bar-dark-active-bg, $bar-dark-active-border, $bar-dark-text);\n    @include button-clear(#fff, $bar-title-font-size);\n  }\n}\n\n// Header at top\n.bar-header {\n  top: 0;\n  border-top-width: 0;\n  border-bottom-width: 1px;\n  &.has-tabs-top{\n    border-bottom-width: 0px;\n    background-image: none;\n  }\n}\n.tabs-top .bar-header{\n  border-bottom-width: 0px;\n  background-image: none;\n}\n\n// Footer at bottom\n.bar-footer {\n  bottom: 0;\n  border-top-width: 1px;\n  border-bottom-width: 0;\n  background-position: top;\n\n  height: $bar-footer-height;\n\n  &.item-input-inset {\n    position: absolute;\n  }\n\n  .title {\n    height: $bar-footer-height - 1;\n    line-height: $bar-footer-height;\n  }\n}\n\n// Don't render padding if the bar is just for tabs\n.bar-tabs {\n  padding: 0;\n}\n\n.bar-subheader {\n  top: $bar-height;\n\n  height: $bar-subheader-height;\n\n  .title {\n    height: $bar-subheader-height - 1;\n    line-height: $bar-subheader-height;\n  }\n}\n.bar-subfooter {\n  bottom: $bar-footer-height;\n\n  height: $bar-subfooter-height;\n\n  .title {\n    height: $bar-subfooter-height - 1;\n    line-height: $bar-subfooter-height;\n  }\n}\n\n.nav-bar-block {\n  position: absolute;\n  top: 0;\n  right: 0;\n  left: 0;\n  z-index: $z-index-bar;\n}\n\n.bar .back-button.hide,\n.bar .buttons .hide {\n  display: none;\n}\n\n.nav-bar-tabs-top .bar {\n  background-image: none;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_button-bar.scss",
    "content": "\n/**\n * Button Bar\n * --------------------------------------------------\n */\n\n.button-bar {\n  @include display-flex();\n  @include flex(1);\n  width: 100%;\n\n  &.button-bar-inline {\n    display: block;\n    width: auto;\n\n    @include clearfix();\n\n    > .button {\n      width: auto;\n      display: inline-block;\n      float: left;\n    }\n  }\n\n  &.bar-light > .button {\n    border-color: $button-light-border;\n  }\n  &.bar-stable > .button {\n    border-color: $button-stable-border;\n  }\n  &.bar-positive > .button {\n    border-color: $button-positive-border;\n  }\n  &.bar-calm > .button {\n    border-color: $button-calm-border;\n  }\n  &.bar-assertive > .button {\n    border-color: $button-assertive-border;\n  }\n  &.bar-balanced > .button {\n    border-color: $button-balanced-border;\n  }\n  &.bar-energized > .button {\n    border-color: $button-energized-border;\n  }\n  &.bar-royal > .button {\n    border-color: $button-royal-border;\n  }\n  &.bar-dark > .button {\n    border-color: $button-dark-border;\n  }\n}\n\n.button-bar > .button {\n  @include flex(1);\n  display: block;\n\n  overflow: hidden;\n\n  padding: 0 16px;\n\n  width: 0;\n\n  border-width: 1px 0px 1px 1px;\n  border-radius: 0;\n  text-align: center;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n\n  &:before,\n  .icon:before {\n    line-height: 44px;\n  }\n\n  &:first-child {\n    border-radius: $button-border-radius 0px 0px $button-border-radius;\n  }\n  &:last-child {\n    border-right-width: 1px;\n    border-radius: 0px $button-border-radius $button-border-radius 0px;\n  }\n  &:only-child {\n    border-radius: $button-border-radius;\n  }\n}\n\n.button-bar > .button-small {\n  &:before,\n  .icon:before {\n    line-height: 28px;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_button.scss",
    "content": "\n/**\n * Buttons\n * --------------------------------------------------\n */\n\n.button {\n  // set the color defaults\n  @include button-style($button-default-bg, $button-default-border, $button-default-active-bg, $button-default-active-border, $button-default-text);\n\n  position: relative;\n  display: inline-block;\n  margin: 0;\n  padding: 0 $button-padding;\n\n  min-width: ($button-padding * 3) + $button-font-size;\n  min-height: $button-height + 5px;\n\n  border-width: $button-border-width;\n  border-style: solid;\n  border-radius: $button-border-radius;\n\n  vertical-align: top;\n  text-align: center;\n\n  text-overflow: ellipsis;\n  font-size: $button-font-size;\n  line-height: $button-height - $button-border-width + 1px;\n\n  cursor: pointer;\n\n  &:after {\n    // used to create a larger button \"hit\" area\n    position: absolute;\n    top: -6px;\n    right: -6px;\n    bottom: -6px;\n    left: -6px;\n    content: ' ';\n  }\n\n  .icon {\n    vertical-align: top;\n    pointer-events: none;\n  }\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    display: inline-block;\n    padding: 0 0 $button-border-width 0;\n    vertical-align: inherit;\n    font-size: $button-icon-size;\n    line-height: $button-height - $button-border-width;\n    pointer-events: none;\n  }\n  &.icon-left:before {\n    float: left;\n    padding-right: .2em;\n    padding-left: 0;\n  }\n  &.icon-right:before {\n    float: right;\n    padding-right: 0;\n    padding-left: .2em;\n  }\n\n  &.button-block, &.button-full {\n    margin-top: $button-block-margin;\n    margin-bottom: $button-block-margin;\n  }\n\n  &.button-light {\n    @include button-style($button-light-bg, $button-default-border, $button-light-active-bg, $button-default-active-border, $button-light-text);\n    @include button-clear($button-light-border);\n    @include button-outline($button-light-border);\n  }\n\n  &.button-stable {\n    @include button-style($button-stable-bg, $button-default-border, $button-stable-active-bg, $button-default-active-border, $button-stable-text);\n    @include button-clear($button-stable-border);\n    @include button-outline($button-stable-border);\n  }\n\n  &.button-positive {\n    @include button-style($button-positive-bg, $button-default-border, $button-positive-active-bg, $button-default-active-border, $button-positive-text);\n    @include button-clear($button-positive-bg);\n    @include button-outline($button-positive-bg);\n  }\n\n  &.button-calm {\n    @include button-style($button-calm-bg, $button-default-border, $button-calm-active-bg, $button-default-active-border, $button-calm-text);\n    @include button-clear($button-calm-bg);\n    @include button-outline($button-calm-bg);\n  }\n\n  &.button-assertive {\n    @include button-style($button-assertive-bg, $button-default-border, $button-assertive-active-bg, $button-default-active-border, $button-assertive-text);\n    @include button-clear($button-assertive-bg);\n    @include button-outline($button-assertive-bg);\n  }\n\n  &.button-balanced {\n    @include button-style($button-balanced-bg, $button-default-border, $button-balanced-active-bg, $button-default-active-border, $button-balanced-text);\n    @include button-clear($button-balanced-bg);\n    @include button-outline($button-balanced-bg);\n  }\n\n  &.button-energized {\n    @include button-style($button-energized-bg, $button-default-border, $button-energized-active-bg, $button-default-active-border, $button-energized-text);\n    @include button-clear($button-energized-bg);\n    @include button-outline($button-energized-bg);\n  }\n\n  &.button-royal {\n    @include button-style($button-royal-bg, $button-default-border, $button-royal-active-bg, $button-default-active-border, $button-royal-text);\n    @include button-clear($button-royal-bg);\n    @include button-outline($button-royal-bg);\n  }\n\n  &.button-dark {\n    @include button-style($button-dark-bg, $button-default-border, $button-dark-active-bg, $button-default-active-border, $button-dark-text);\n    @include button-clear($button-dark-bg);\n    @include button-outline($button-dark-bg);\n  }\n}\n\n.button-small {\n  padding: 2px $button-small-padding 1px;\n  min-width: $button-small-height;\n  min-height: $button-small-height + 2;\n  font-size: $button-small-font-size;\n  line-height: $button-small-height - $button-border-width - 1;\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    font-size: $button-small-icon-size;\n    line-height: $button-small-icon-size + 3;\n    margin-top: 3px;\n  }\n}\n\n.button-large {\n  padding: 0 $button-large-padding;\n  min-width: ($button-large-padding * 3) + $button-large-font-size;\n  min-height: $button-large-height + 5;\n  font-size: $button-large-font-size;\n  line-height: $button-large-height - $button-border-width;\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    padding-bottom: ($button-border-width * 2);\n    font-size: $button-large-icon-size;\n    line-height: $button-large-height - ($button-border-width * 2) - 1;\n  }\n}\n\n.button-icon {\n  @include transition(opacity .1s);\n  padding: 0 6px;\n  min-width: initial;\n  border-color: transparent;\n  background: none;\n\n  &.button.active,\n  &.button.activated {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    opacity: 0.3;\n  }\n\n  .icon:before,\n  &.icon:before {\n    font-size: $button-large-icon-size;\n  }\n}\n\n.button-clear {\n  @include button-clear($button-default-border);\n  @include transition(opacity .1s);\n  padding: 0 $button-clear-padding;\n  max-height: $button-height;\n  border-color: transparent;\n  background: none;\n  box-shadow: none;\n\n  &.active,\n  &.activated {\n    opacity: 0.3;\n  }\n}\n\n.button-outline {\n  @include button-outline($button-default-border);\n  @include transition(opacity .1s);\n  background: none;\n  box-shadow: none;\n}\n\n.padding > .button.button-block:first-child {\n  margin-top: 0;\n}\n\n.button-block {\n  display: block;\n  clear: both;\n\n  &:after {\n    clear: both;\n  }\n}\n\n.button-full,\n.button-full > .button {\n  display: block;\n  margin-right: 0;\n  margin-left: 0;\n  border-right-width: 0;\n  border-left-width: 0;\n  border-radius: 0;\n}\n\nbutton.button-block,\nbutton.button-full,\n.button-full > button.button,\ninput.button.button-block  {\n  width: 100%;\n}\n\na.button {\n  text-decoration: none;\n\n  .icon:before,\n  &.icon:before,\n  &.icon-left:before,\n  &.icon-right:before {\n    margin-top: 2px;\n  }\n}\n\n.button.disabled,\n.button[disabled] {\n  opacity: .4;\n  cursor: default !important;\n  pointer-events: none;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_checkbox.scss",
    "content": "\n/**\n * Checkbox\n * --------------------------------------------------\n */\n\n.checkbox {\n  // set the color defaults\n  @include checkbox-style($checkbox-off-border-default, $checkbox-on-bg-default, $checkbox-on-border-default);\n\n  position: relative;\n  display: inline-block;\n  padding: ($checkbox-height / 4) ($checkbox-width / 4);\n  cursor: pointer;\n}\n.checkbox-light  {\n  @include checkbox-style($checkbox-off-border-light, $checkbox-on-bg-light, $checkbox-off-border-light);\n}\n.checkbox-stable  {\n  @include checkbox-style($checkbox-off-border-stable, $checkbox-on-bg-stable, $checkbox-off-border-stable);\n}\n.checkbox-positive  {\n  @include checkbox-style($checkbox-off-border-positive, $checkbox-on-bg-positive, $checkbox-off-border-positive);\n}\n.checkbox-calm  {\n  @include checkbox-style($checkbox-off-border-calm, $checkbox-on-bg-calm, $checkbox-off-border-calm);\n}\n.checkbox-assertive  {\n  @include checkbox-style($checkbox-off-border-assertive, $checkbox-on-bg-assertive, $checkbox-off-border-assertive);\n}\n.checkbox-balanced  {\n  @include checkbox-style($checkbox-off-border-balanced, $checkbox-on-bg-balanced, $checkbox-off-border-balanced);\n}\n.checkbox-energized{\n  @include checkbox-style($checkbox-off-border-energized, $checkbox-on-bg-energized, $checkbox-off-border-energized);\n}\n.checkbox-royal  {\n  @include checkbox-style($checkbox-off-border-royal, $checkbox-on-bg-royal, $checkbox-off-border-royal);\n}\n.checkbox-dark  {\n  @include checkbox-style($checkbox-off-border-dark, $checkbox-on-bg-dark, $checkbox-off-border-dark);\n}\n\n.checkbox input:disabled:before,\n.checkbox input:disabled + .checkbox-icon:before {\n  border-color: $checkbox-off-border-light;\n}\n\n.checkbox input:disabled:checked:before,\n.checkbox input:disabled:checked + .checkbox-icon:before {\n  background: $checkbox-on-bg-light;\n}\n\n\n.checkbox.checkbox-input-hidden input {\n  display: none !important;\n}\n\n.checkbox input,\n.checkbox-icon {\n  position: relative;\n  width: $checkbox-width;\n  height: $checkbox-height;\n  display: block;\n  border: 0;\n  background: transparent;\n  cursor: pointer;\n  -webkit-appearance: none;\n\n  &:before {\n    // what the checkbox looks like when its not checked\n    display: table;\n    width: 100%;\n    height: 100%;\n    border-width: $checkbox-border-width;\n    border-style: solid;\n    border-radius: $checkbox-border-radius;\n    background: $checkbox-off-bg-color;\n    content: ' ';\n    @include transition(background-color 20ms ease-in-out);\n  }\n}\n\n.checkbox input:checked:before,\ninput:checked + .checkbox-icon:before {\n  border-width: $checkbox-border-width + 1;\n}\n\n// the checkmark within the box\n.checkbox input:after,\n.checkbox-icon:after {\n  @include transition(opacity .05s ease-in-out);\n  @include rotate(-45deg);\n  position: absolute;\n  top: 33%;\n  left: 25%;\n  display: table;\n  width: ($checkbox-width / 2);\n  height: ($checkbox-width / 4) - 1;\n  border: $checkbox-check-width solid $checkbox-check-color;\n  border-top: 0;\n  border-right: 0;\n  content: ' ';\n  opacity: 0;\n}\n\n.platform-android .checkbox-platform input:before,\n.platform-android .checkbox-platform .checkbox-icon:before,\n.checkbox-square input:before,\n.checkbox-square .checkbox-icon:before {\n  border-radius: 2px;\n  width: 72%;\n  height: 72%;\n  margin-top: 14%;\n  margin-left: 14%;\n  border-width: 2px;\n}\n\n.platform-android .checkbox-platform input:after,\n.platform-android .checkbox-platform .checkbox-icon:after,\n.checkbox-square input:after,\n.checkbox-square .checkbox-icon:after {\n  border-width: 2px;\n  top: 19%;\n  left: 25%;\n  width: ($checkbox-width / 2) - 1;\n  height: 7px;\n}\n\n.platform-android .item-checkbox-right .checkbox-square .checkbox-icon::after {\n  top: 31%;\n}\n\n.grade-c .checkbox input:after,\n.grade-c .checkbox-icon:after {\n  @include rotate(0);\n  top: 3px;\n  left: 4px;\n  border: none;\n  color: $checkbox-check-color;\n  content: '\\2713';\n  font-weight: bold;\n  font-size: 20px;\n}\n\n// what the checkmark looks like when its checked\n.checkbox input:checked:after,\ninput:checked + .checkbox-icon:after {\n  opacity: 1;\n}\n\n// make sure item content have enough padding on left to fit the checkbox\n.item-checkbox {\n  padding-left: ($item-padding * 2) + $checkbox-width;\n\n  &.active {\n    box-shadow: none;\n  }\n}\n\n// position the checkbox to the left within an item\n.item-checkbox .checkbox {\n  position: absolute;\n  top: 50%;\n  right: $item-padding / 2;\n  left: $item-padding / 2;\n  z-index: $z-index-item-checkbox;\n  margin-top: (($checkbox-height + ($checkbox-height / 2)) / 2) * -1;\n}\n\n\n.item-checkbox.item-checkbox-right {\n  padding-right: ($item-padding * 2) + $checkbox-width;\n  padding-left: $item-padding;\n}\n\n.item-checkbox-right .checkbox input,\n.item-checkbox-right .checkbox-icon {\n  float: right;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_form.scss",
    "content": "/**\n * Forms\n * --------------------------------------------------\n */\n\n// Make all forms have space below them\nform {\n  margin: 0 0 $line-height-base;\n}\n\n// Groups of fields with labels on top (legends)\nlegend {\n  display: block;\n  margin-bottom: $line-height-base;\n  padding: 0;\n  width: 100%;\n  border: $input-border-width solid $input-border;\n  color: $dark;\n  font-size: $font-size-base * 1.5;\n  line-height: $line-height-base * 2;\n\n  small {\n    color: $stable;\n    font-size: $line-height-base * .75;\n  }\n}\n\n// Set font for forms\nlabel,\ninput,\nbutton,\nselect,\ntextarea {\n  @include font-shorthand($font-size-base, normal, $line-height-base); // Set size, weight, line-height here\n}\ninput,\nbutton,\nselect,\ntextarea {\n  font-family: $font-family-base; // And only set font-family here for those that need it (note the missing label element)\n}\n\n\n// Input List\n// -------------------------------\n\n.item-input {\n  @include display-flex();\n  @include align-items(center);\n  position: relative;\n  overflow: hidden;\n  padding: 6px 0 5px 16px;\n\n  input {\n    @include border-radius(0);\n    @include flex(1, 220px);\n    @include appearance(none);\n    margin: 0;\n    padding-right: 24px;\n    background-color: transparent;\n  }\n\n  .button .icon {\n    @include flex(0, 0, 24px);\n    position: static;\n    display: inline-block;\n    height: auto;\n    text-align: center;\n    font-size: 16px;\n  }\n\n  .button-bar {\n    @include border-radius(0);\n    @include flex(1, 0, 220px);\n    @include appearance(none);\n  }\n\n  .icon {\n    min-width: 14px;\n  }\n}\n// prevent flex-shrink on WP\n.platform-windowsphone .item-input input{\n  flex-shrink: 1;\n}\n\n.item-input-inset {\n  @include display-flex();\n  @include align-items(center);\n  position: relative;\n  overflow: hidden;\n  padding: ($item-padding / 3) * 2;\n}\n\n.item-input-wrapper {\n  @include display-flex();\n  @include flex(1, 0);\n  @include align-items(center);\n  @include border-radius(4px);\n  padding-right: 8px;\n  padding-left: 8px;\n  background: #eee;\n}\n\n.item-input-inset .item-input-wrapper input {\n  padding-left: 4px;\n  height: 29px;\n  background: transparent;\n  line-height: 18px;\n}\n\n.item-input-wrapper ~ .button {\n  margin-left: ($item-padding / 3) * 2;\n}\n\n.input-label {\n  display: table;\n  padding: 7px 10px 7px 0px;\n  max-width: 200px;\n  width: 35%;\n  color: $input-label-color;\n  font-size: 16px;\n}\n\n.placeholder-icon {\n  color: #aaa;\n  &:first-child {\n    padding-right: 6px;\n  }\n  &:last-child {\n    padding-left: 6px;\n  }\n}\n\n.item-stacked-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none;\n\n  .input-label, .icon {\n    display: inline-block;\n    padding: 4px 0 0 0px;\n    vertical-align: middle;\n  }\n}\n\n.item-stacked-label input,\n.item-stacked-label textarea {\n  @include border-radius(2px);\n  padding: 4px 8px 3px 0;\n  border: none;\n  background-color: $input-bg;\n}\n.item-stacked-label input {\n  overflow: hidden;\n  height: $line-height-computed + $font-size-base + 12px;\n}\n\n.item-select.item-stacked-label select {\n  position: relative;\n  padding: 0px;\n  max-width: 90%;\n  direction:ltr;\n  white-space: pre-wrap;\n  margin: -3px;\n}\n\n.item-floating-label {\n  display: block;\n  background-color: transparent;\n  box-shadow: none;\n\n  .input-label {\n    position: relative;\n    padding: 5px 0 0 0;\n    opacity: 0;\n    top: 10px;\n    @include transition(opacity .15s ease-in, top .2s linear);\n\n    &.has-input {\n      opacity: 1;\n      top: 0;\n      @include transition(opacity .15s ease-in, top .2s linear);\n    }\n  }\n}\n\n\n// Form Controls\n// -------------------------------\n\n// Shared size and type resets\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  display: block;\n  padding-top: 2px;\n  padding-left: 0;\n  height: $line-height-computed + $font-size-base;\n  color: $input-color;\n  vertical-align: middle;\n  font-size: $font-size-base;\n  line-height: $font-size-base + 2;\n}\n\n.platform-ios,\n.platform-android {\n  input[type=\"datetime-local\"],\n  input[type=\"date\"],\n  input[type=\"month\"],\n  input[type=\"time\"],\n  input[type=\"week\"] {\n    padding-top: 8px;\n  }\n}\n\n.item-input {\n  input,\n  textarea {\n    width: 100%;\n  }\n}\n\ntextarea {\n  padding-left: 0;\n  @include placeholder($input-color-placeholder, -3px);\n}\n\n// Reset height since textareas have rows\ntextarea {\n  height: auto;\n}\n\n// Everything else\ntextarea,\ninput[type=\"text\"],\ninput[type=\"password\"],\ninput[type=\"datetime\"],\ninput[type=\"datetime-local\"],\ninput[type=\"date\"],\ninput[type=\"month\"],\ninput[type=\"time\"],\ninput[type=\"week\"],\ninput[type=\"number\"],\ninput[type=\"email\"],\ninput[type=\"url\"],\ninput[type=\"search\"],\ninput[type=\"tel\"],\ninput[type=\"color\"] {\n  border: 0;\n}\n\n// Position radios and checkboxes better\ninput[type=\"radio\"],\ninput[type=\"checkbox\"] {\n  margin: 0;\n  line-height: normal;\n}\n\n// Reset width of input images, buttons, radios, checkboxes\n.item-input {\n  input[type=\"file\"],\n  input[type=\"image\"],\n  input[type=\"submit\"],\n  input[type=\"reset\"],\n  input[type=\"button\"],\n  input[type=\"radio\"],\n  input[type=\"checkbox\"] {\n    width: auto; // Override of generic input selector\n  }\n}\n\n// Set the height of file to match text inputs\ninput[type=\"file\"] {\n  line-height: $input-height-base;\n}\n\n// Text input classes to hide text caret during scroll\n.previous-input-focus,\n.cloned-text-input + input,\n.cloned-text-input + textarea {\n  position: absolute !important;\n  left: -9999px;\n  width: 200px;\n}\n\n\n// Placeholder\n// -------------------------------\ninput,\ntextarea {\n  @include placeholder();\n}\n\n\n// DISABLED STATE\n// -------------------------------\n\n// Disabled and read-only inputs\ninput[disabled],\nselect[disabled],\ntextarea[disabled],\ninput[readonly]:not(.cloned-text-input),\ntextarea[readonly]:not(.cloned-text-input),\nselect[readonly] {\n  background-color: $input-bg-disabled;\n  cursor: not-allowed;\n}\n// Explicitly reset the colors here\ninput[type=\"radio\"][disabled],\ninput[type=\"checkbox\"][disabled],\ninput[type=\"radio\"][readonly],\ninput[type=\"checkbox\"][readonly] {\n  background-color: transparent;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_grid.scss",
    "content": "/**\n * Grid\n * --------------------------------------------------\n * Using flexbox for the grid, inspired by Philip Walton:\n * http://philipwalton.github.io/solved-by-flexbox/demos/grids/\n * By default each .col within a .row will evenly take up\n * available width, and the height of each .col with take\n * up the height of the tallest .col in the same .row.\n */\n\n.row {\n  @include display-flex();\n  padding: ($grid-padding-width / 2);\n  width: 100%;\n}\n\n.row-wrap {\n  @include flex-wrap(wrap);\n}\n\n.row-no-padding {\n  padding: 0;\n\n  > .col {\n    padding: 0;\n  }\n}\n\n.row + .row {\n  margin-top: ($grid-padding-width / 2) * -1;\n  padding-top: 0;\n}\n\n.col {\n  @include flex(1);\n  display: block;\n  padding: ($grid-padding-width / 2);\n  width: 100%;\n}\n\n\n/* Vertically Align Columns */\n/* .row-* vertically aligns every .col in the .row */\n.row-top {\n  @include align-items(flex-start);\n}\n.row-bottom {\n  @include align-items(flex-end);\n}\n.row-center {\n  @include align-items(center);\n}\n.row-stretch {\n  @include align-items(stretch);\n}\n.row-baseline {\n  @include align-items(baseline);\n}\n\n/* .col-* vertically aligns an individual .col */\n.col-top {\n  @include align-self(flex-start);\n}\n.col-bottom {\n  @include align-self(flex-end);\n}\n.col-center {\n  @include align-self(center);\n}\n\n/* Column Offsets */\n.col-offset-10 {\n  margin-left: 10%;\n}\n.col-offset-20 {\n  margin-left: 20%;\n}\n.col-offset-25 {\n  margin-left: 25%;\n}\n.col-offset-33, .col-offset-34 {\n  margin-left: 33.3333%;\n}\n.col-offset-50 {\n  margin-left: 50%;\n}\n.col-offset-66, .col-offset-67 {\n  margin-left: 66.6666%;\n}\n.col-offset-75 {\n  margin-left: 75%;\n}\n.col-offset-80 {\n  margin-left: 80%;\n}\n.col-offset-90 {\n  margin-left: 90%;\n}\n\n\n/* Explicit Column Percent Sizes */\n/* By default each grid column will evenly distribute */\n/* across the grid. However, you can specify individual */\n/* columns to take up a certain size of the available area */\n.col-10 {\n  @include flex(0, 0, 10%);\n  max-width: 10%;\n}\n.col-20 {\n  @include flex(0, 0, 20%);\n  max-width: 20%;\n}\n.col-25 {\n  @include flex(0, 0, 25%);\n  max-width: 25%;\n}\n.col-33, .col-34 {\n  @include flex(0, 0, 33.3333%);\n  max-width: 33.3333%;\n}\n.col-40 {\n  @include flex(0, 0, 40%);\n  max-width: 40%;\n}\n.col-50 {\n  @include flex(0, 0, 50%);\n  max-width: 50%;\n}\n.col-60 {\n  @include flex(0, 0, 60%);\n  max-width: 60%;\n}\n.col-66, .col-67 {\n  @include flex(0, 0, 66.6666%);\n  max-width: 66.6666%;\n}\n.col-75 {\n  @include flex(0, 0, 75%);\n  max-width: 75%;\n}\n.col-80 {\n  @include flex(0, 0, 80%);\n  max-width: 80%;\n}\n.col-90 {\n  @include flex(0, 0, 90%);\n  max-width: 90%;\n}\n\n\n/* Responsive Grid Classes */\n/* Adding a class of responsive-X to a row */\n/* will trigger the flex-direction to */\n/* change to column and add some margin */\n/* to any columns in the row for clearity */\n\n@include responsive-grid-break('.responsive-sm', $grid-responsive-sm-break);\n@include responsive-grid-break('.responsive-md', $grid-responsive-md-break);\n@include responsive-grid-break('.responsive-lg', $grid-responsive-lg-break);\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_items.scss",
    "content": "/**\n * Items\n * --------------------------------------------------\n */\n\n.item {\n  @include item-style($item-default-bg, $item-default-border, $item-default-text);\n\n  position: relative;\n  z-index: $z-index-item; // Make sure the borders and stuff don't get hidden by children\n  display: block;\n\n  margin: $item-border-width * -1;\n  padding: $item-padding;\n\n  border-width: $item-border-width;\n  border-style: solid;\n  font-size: $item-font-size;\n\n  h2 {\n    margin: 0 0 2px 0;\n    font-size: 16px;\n    font-weight: normal;\n  }\n  h3 {\n    margin: 0 0 4px 0;\n    font-size: 14px;\n  }\n  h4 {\n    margin: 0 0 4px 0;\n    font-size: 12px;\n  }\n  h5, h6 {\n    margin: 0 0 3px 0;\n    font-size: 10px;\n  }\n  p {\n    color: #666;\n    font-size: 14px;\n    margin-bottom: 2px;\n  }\n\n  h1:last-child,\n  h2:last-child,\n  h3:last-child,\n  h4:last-child,\n  h5:last-child,\n  h6:last-child,\n  p:last-child {\n    margin-bottom: 0;\n  }\n\n  // Align badges within items\n  .badge {\n    @include display-flex();\n    position: absolute;\n    top: $item-padding;\n    right: ($item-padding * 2);\n  }\n  &.item-button-right .badge {\n    right: ($item-padding * 2) + 35;\n  }\n  &.item-divider .badge {\n    top: ceil($item-padding / 2);\n  }\n  .badge + .badge {\n    margin-right: 5px;\n  }\n\n  // Different themes for items\n  &.item-light {\n    @include item-style($item-light-bg, $item-light-border, $item-light-text);\n  }\n  &.item-stable {\n    @include item-style($item-stable-bg, $item-stable-border, $item-stable-text);\n  }\n  &.item-positive {\n    @include item-style($item-positive-bg, $item-positive-border, $item-positive-text);\n  }\n  &.item-calm {\n    @include item-style($item-calm-bg, $item-calm-border, $item-calm-text);\n  }\n  &.item-assertive {\n    @include item-style($item-assertive-bg, $item-assertive-border, $item-assertive-text);\n  }\n  &.item-balanced {\n    @include item-style($item-balanced-bg, $item-balanced-border, $item-balanced-text);\n  }\n  &.item-energized {\n    @include item-style($item-energized-bg, $item-energized-border, $item-energized-text);\n  }\n  &.item-royal {\n    @include item-style($item-royal-bg, $item-royal-border, $item-royal-text);\n  }\n  &.item-dark {\n    @include item-style($item-dark-bg, $item-dark-border, $item-dark-text);\n  }\n\n  &[ng-click]:hover {\n    cursor: pointer;\n  }\n\n}\n\n.list-borderless .item,\n.item-borderless {\n  border-width: 0;\n}\n\n// Link and Button Active States\n.item.active,\n.item.activated,\n.item-complex.active .item-content,\n.item-complex.activated .item-content,\n.item .item-content.active,\n.item .item-content.activated {\n  @include item-active-style($item-default-active-bg, $item-default-active-border);\n\n  // Different active themes for <a> and <button> items\n  &.item-light {\n    @include item-active-style($item-light-active-bg, $item-light-active-border);\n  }\n  &.item-stable {\n    @include item-active-style($item-stable-active-bg, $item-stable-active-border);\n  }\n  &.item-positive {\n    @include item-active-style($item-positive-active-bg, $item-positive-active-border);\n  }\n  &.item-calm {\n    @include item-active-style($item-calm-active-bg, $item-calm-active-border);\n  }\n  &.item-assertive {\n    @include item-active-style($item-assertive-active-bg, $item-assertive-active-border);\n  }\n  &.item-balanced {\n    @include item-active-style($item-balanced-active-bg, $item-balanced-active-border);\n  }\n  &.item-energized {\n    @include item-active-style($item-energized-active-bg, $item-energized-active-border);\n  }\n  &.item-royal {\n    @include item-active-style($item-royal-active-bg, $item-royal-active-border);\n  }\n  &.item-dark {\n    @include item-active-style($item-dark-active-bg, $item-dark-active-border);\n  }\n}\n\n// Handle text overflow\n.item,\n.item h1,\n.item h2,\n.item h3,\n.item h4,\n.item h5,\n.item h6,\n.item p,\n.item-content,\n.item-content h1,\n.item-content h2,\n.item-content h3,\n.item-content h4,\n.item-content h5,\n.item-content h6,\n.item-content p {\n  overflow: hidden;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n}\n\n// Linked list items\na.item {\n  color: inherit;\n  text-decoration: none;\n\n  &:hover,\n  &:focus {\n    text-decoration: none;\n  }\n}\n\n\n/**\n * Complex Items\n * --------------------------------------------------\n * Adding .item-complex allows the .item to be slidable and\n * have options underneath the button, but also requires an\n * additional .item-content element inside .item.\n * Basically .item-complex removes any default settings which\n * .item added, so that .item-content looks them as just .item.\n */\n\n.item-complex,\na.item.item-complex,\nbutton.item.item-complex {\n  padding: 0;\n}\n.item-complex .item-content,\n.item-radio .item-content {\n  position: relative;\n  z-index: $z-index-item;\n  padding: $item-padding (ceil( ($item-padding * 3) + ($item-padding / 3) ) - 5) $item-padding $item-padding;\n  border: none;\n  background-color: $item-default-bg;\n}\n\na.item-content {\n  display: block;\n  color: inherit;\n  text-decoration: none;\n}\n\n.item-text-wrap .item,\n.item-text-wrap .item-content,\n.item-text-wrap,\n.item-text-wrap h1,\n.item-text-wrap h2,\n.item-text-wrap h3,\n.item-text-wrap h4,\n.item-text-wrap h5,\n.item-text-wrap h6,\n.item-text-wrap p,\n.item-complex.item-text-wrap .item-content,\n.item-body h1,\n.item-body h2,\n.item-body h3,\n.item-body h4,\n.item-body h5,\n.item-body h6,\n.item-body p {\n  overflow: visible;\n  white-space: normal;\n}\n.item-complex.item-text-wrap,\n.item-complex.item-text-wrap h1,\n.item-complex.item-text-wrap h2,\n.item-complex.item-text-wrap h3,\n.item-complex.item-text-wrap h4,\n.item-complex.item-text-wrap h5,\n.item-complex.item-text-wrap h6,\n.item-complex.item-text-wrap p {\n  overflow: visible;\n  white-space: normal;\n}\n\n// Link and Button Active States\n\n.item-complex{\n  // Stylized items\n  &.item-light > .item-content{\n    @include item-style($item-light-bg, $item-light-border, $item-light-text);\n    &.active, &:active {\n      @include item-active-style($item-light-active-bg, $item-light-active-border);\n    }\n  }\n  &.item-stable > .item-content{\n    @include item-style($item-stable-bg, $item-stable-border, $item-stable-text);\n    &.active, &:active {\n      @include item-active-style($item-stable-active-bg, $item-stable-active-border);\n    }\n  }\n  &.item-positive > .item-content{\n    @include item-style($item-positive-bg, $item-positive-border, $item-positive-text);\n    &.active, &:active {\n      @include item-active-style($item-positive-active-bg, $item-positive-active-border);\n    }\n  }\n  &.item-calm > .item-content{\n    @include item-style($item-calm-bg, $item-calm-border, $item-calm-text);\n    &.active, &:active {\n      @include item-active-style($item-calm-active-bg, $item-calm-active-border);\n    }\n  }\n  &.item-assertive > .item-content{\n    @include item-style($item-assertive-bg, $item-assertive-border, $item-assertive-text);\n    &.active, &:active {\n      @include item-active-style($item-assertive-active-bg, $item-assertive-active-border);\n    }\n  }\n  &.item-balanced > .item-content{\n    @include item-style($item-balanced-bg, $item-balanced-border, $item-balanced-text);\n    &.active, &:active {\n      @include item-active-style($item-balanced-active-bg, $item-balanced-active-border);\n    }\n  }\n  &.item-energized > .item-content{\n    @include item-style($item-energized-bg, $item-energized-border, $item-energized-text);\n    &.active, &:active {\n      @include item-active-style($item-energized-active-bg, $item-energized-active-border);\n    }\n  }\n  &.item-royal > .item-content{\n    @include item-style($item-royal-bg, $item-royal-border, $item-royal-text);\n    &.active, &:active {\n      @include item-active-style($item-royal-active-bg, $item-royal-active-border);\n    }\n  }\n  &.item-dark > .item-content{\n    @include item-style($item-dark-bg, $item-dark-border, $item-dark-text);\n    &.active, &:active {\n      @include item-active-style($item-dark-active-bg, $item-dark-active-border);\n    }\n  }\n}\n\n\n/**\n * Item Icons\n * --------------------------------------------------\n */\n\n.item-icon-left .icon,\n.item-icon-right .icon {\n  @include display-flex();\n  @include align-items(center);\n  position: absolute;\n  top: 0;\n  height: 100%;\n  font-size: $item-icon-font-size;\n\n  &:before {\n    display: block;\n    width: $item-icon-font-size;\n    text-align: center;\n  }\n}\n\n.item .fill-icon {\n  min-width: $item-icon-fill-font-size + 2;\n  min-height: $item-icon-fill-font-size + 2;\n  font-size: $item-icon-fill-font-size;\n}\n\n.item-icon-left {\n  padding-left: ceil( ($item-padding * 3) + ($item-padding / 3) );\n\n  .icon {\n    left: ceil( ($item-padding / 3) * 2);\n  }\n}\n.item-complex.item-icon-left {\n  padding-left: 0;\n\n  .item-content {\n    padding-left: ceil( ($item-padding * 3) + ($item-padding / 3) );\n  }\n}\n\n.item-icon-right {\n  padding-right: ceil( ($item-padding * 3) + ($item-padding / 3) );\n\n  .icon {\n    right: ceil( ($item-padding / 3) * 2);\n  }\n}\n.item-complex.item-icon-right {\n  padding-right: 0;\n\n  .item-content {\n    padding-right: ceil( ($item-padding * 3) + ($item-padding / 3) );\n  }\n}\n\n.item-icon-left.item-icon-right .icon:first-child {\n  right: auto;\n}\n.item-icon-left.item-icon-right .icon:last-child,\n.item-icon-left .item-delete .icon {\n  left: auto;\n}\n\n.item-icon-left .icon-accessory,\n.item-icon-right .icon-accessory {\n  color: $item-icon-accessory-color;\n  font-size: $item-icon-accessory-font-size;\n}\n.item-icon-left .icon-accessory {\n  left: floor($item-padding / 5);\n}\n.item-icon-right .icon-accessory {\n  right: floor($item-padding / 5);\n}\n\n\n/**\n * Item Button\n * --------------------------------------------------\n * An item button is a child button inside an .item (not the entire .item)\n */\n\n.item-button-left {\n  padding-left: ceil($item-padding * 4.5);\n}\n\n.item-button-left > .button,\n.item-button-left .item-content > .button {\n  @include display-flex();\n  @include align-items(center);\n  position: absolute;\n  top: ceil($item-padding / 2);\n  left: ceil( ($item-padding / 3) * 2);\n  min-width: $item-icon-font-size + ($button-border-width * 2);\n  min-height: $item-icon-font-size + ($button-border-width * 2);\n  font-size: $item-button-font-size;\n  line-height: $item-button-line-height;\n\n  .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: $item-icon-font-size - 1;\n  }\n\n  > .button {\n    margin: 0px 2px;\n    min-height: $item-icon-font-size + ($button-border-width * 2);\n    font-size: $item-button-font-size;\n    line-height: $item-button-line-height;\n  }\n}\n\n.item-button-right,\na.item.item-button-right,\nbutton.item.item-button-right {\n  padding-right: $item-padding * 5;\n}\n\n.item-button-right > .button,\n.item-button-right .item-content > .button,\n.item-button-right > .buttons,\n.item-button-right .item-content > .buttons {\n  @include display-flex();\n  @include align-items(center);\n  position: absolute;\n  top: ceil($item-padding / 2);\n  right: $item-padding;\n  min-width: $item-icon-font-size + ($button-border-width * 2);\n  min-height: $item-icon-font-size + ($button-border-width * 2);\n  font-size: $item-button-font-size;\n  line-height: $item-button-line-height;\n\n  .icon:before {\n    position: relative;\n    left: auto;\n    width: auto;\n    line-height: $item-icon-font-size - 1;\n  }\n\n  > .button {\n    margin: 0px 2px;\n    min-width: $item-icon-font-size + ($button-border-width * 2);\n    min-height: $item-icon-font-size + ($button-border-width * 2);\n    font-size: $item-button-font-size;\n    line-height: $item-button-line-height;\n  }\n}\n\n.item-button-left.item-button-right{\n   .button{\n     &:first-child {\n      right: auto;\n    }\n     &:last-child {\n      left: auto;\n    }\n   }\n}\n\n// Item Avatar\n// -------------------------------\n\n.item-avatar,\n.item-avatar .item-content,\n.item-avatar-left,\n.item-avatar-left .item-content {\n  padding-left: $item-avatar-width + ($item-padding * 2);\n  min-height: $item-avatar-width + ($item-padding * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-padding;\n    left: $item-padding;\n    max-width: $item-avatar-width;\n    max-height: $item-avatar-height;\n    width: 100%;\n    height: 100%;\n    border-radius: $item-avatar-border-radius;\n  }\n}\n\n.item-avatar-right,\n.item-avatar-right .item-content {\n  padding-right: $item-avatar-width + ($item-padding * 2);\n  min-height: $item-avatar-width + ($item-padding * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-padding;\n    right: $item-padding;\n    max-width: $item-avatar-width;\n    max-height: $item-avatar-height;\n    width: 100%;\n    height: 100%;\n    border-radius: $item-avatar-border-radius;\n  }\n}\n\n\n// Item Thumbnails\n// -------------------------------\n\n.item-thumbnail-left,\n.item-thumbnail-left .item-content {\n  padding-top: $item-padding / 2;\n  padding-left: $item-thumbnail-width + $item-thumbnail-margin + $item-padding;\n  min-height: $item-thumbnail-height + ($item-thumbnail-margin * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-thumbnail-margin;\n    left: $item-thumbnail-margin;\n    max-width: $item-thumbnail-width;\n    max-height: $item-thumbnail-height;\n    width: 100%;\n    height: 100%;\n  }\n}\n.item-avatar.item-complex,\n.item-avatar-left.item-complex,\n.item-thumbnail-left.item-complex {\n  padding-top: 0;\n  padding-left: 0;\n}\n\n.item-thumbnail-right,\n.item-thumbnail-right .item-content {\n  padding-top: $item-padding / 2;\n  padding-right: $item-thumbnail-width + $item-thumbnail-margin + $item-padding;\n  min-height: $item-thumbnail-height + ($item-thumbnail-margin * 2);\n\n  > img:first-child,\n  .item-image {\n    position: absolute;\n    top: $item-thumbnail-margin;\n    right: $item-thumbnail-margin;\n    max-width: $item-thumbnail-width;\n    max-height: $item-thumbnail-height;\n    width: 100%;\n    height: 100%;\n  }\n}\n.item-avatar-right.item-complex,\n.item-thumbnail-right.item-complex {\n  padding-top: 0;\n  padding-right: 0;\n}\n\n\n// Item Image\n// -------------------------------\n\n.item-image {\n  padding: 0;\n  text-align: center;\n\n  img:first-child, .list-img {\n    width: 100%;\n    vertical-align: middle;\n  }\n}\n\n\n// Item Body\n// -------------------------------\n\n.item-body {\n  overflow: auto;\n  padding: $item-padding;\n  text-overflow: inherit;\n  white-space: normal;\n\n  h1, h2, h3, h4, h5, h6, p {\n    margin-top: $item-padding;\n    margin-bottom: $item-padding;\n  }\n}\n\n\n// Item Divider\n// -------------------------------\n\n.item-divider {\n  padding-top: ceil($item-padding / 2);\n  padding-bottom: ceil($item-padding / 2);\n  min-height: 30px;\n  background-color: $item-divider-bg;\n  color: $item-divider-color;\n  font-weight: 500;\n}\n\n.platform-ios .item-divider-platform,\n.item-divider-ios {\n  padding-top: 26px;\n  text-transform: uppercase;\n  font-weight: 300;\n  font-size: 13px;\n  background-color: #efeff4;\n  color: #555;\n}\n\n.platform-android .item-divider-platform,\n.item-divider-android {\n  font-weight: 300;\n  font-size: 13px;\n}\n\n\n// Item Note\n// -------------------------------\n\n.item-note {\n  float: right;\n  color: #aaa;\n  font-size: 14px;\n}\n\n\n// Item Editing\n// -------------------------------\n\n.item-left-editable .item-content,\n.item-right-editable .item-content {\n  // setup standard transition settings\n  @include transition-duration( $item-edit-transition-duration );\n  @include transition-timing-function( $item-edit-transition-function );\n  -webkit-transition-property: -webkit-transform;\n     -moz-transition-property: -moz-transform;\n          transition-property: transform;\n}\n\n.list-left-editing .item-left-editable .item-content,\n.item-left-editing.item-left-editable .item-content {\n  // actively editing the left side of the item\n  @include translate3d($item-left-edit-open-width, 0, 0);\n}\n\n.item-remove-animate {\n  &.ng-leave {\n    @include transition-duration( $item-remove-transition-duration );\n  }\n  &.ng-leave .item-content,\n  &.ng-leave:last-of-type {\n    @include transition-duration( $item-remove-transition-duration );\n    @include transition-timing-function( $item-remove-transition-function );\n    @include transition-property( all );\n  }\n\n  &.ng-leave.ng-leave-active .item-content {\n    opacity:0;\n    -webkit-transform: translate3d(-100%, 0, 0) !important;\n    transform: translate3d(-100%, 0, 0) !important;\n  }\n  &.ng-leave.ng-leave-active:last-of-type {\n    opacity: 0;\n  }\n\n  &.ng-leave.ng-leave-active ~ ion-item:not(.ng-leave) {\n    -webkit-transform: translate3d(0, unquote('-webkit-calc(-100% + 1px)'), 0);\n    transform: translate3d(0, calc(-100% + 1px), 0);\n    @include transition-duration( $item-remove-transition-duration );\n    @include transition-timing-function( $item-remove-descendents-transition-function );\n    @include transition-property( all );\n  }\n}\n\n\n\n// Item Left Edit Button\n// -------------------------------\n\n.item-left-edit {\n  @include transition(all $item-edit-transition-function $item-edit-transition-duration / 2);\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: $z-index-item-edit;\n  width: $item-left-edit-open-width;\n  height: 100%;\n  line-height: 100%;\n\n  .button {\n    height: 100%;\n\n    &.icon {\n      @include display-flex();\n      @include align-items(center);\n      position: absolute;\n      top: 0;\n      height: 100%;\n    }\n  }\n\n  display: none;\n  opacity: 0;\n  @include translate3d( ($item-left-edit-left - $item-left-edit-open-width) / 2, 0, 0);\n  &.visible {\n    display: block;\n    &.active {\n      opacity: 1;\n      @include translate3d($item-left-edit-left, 0, 0);\n    }\n  }\n}\n.list-left-editing .item-left-edit {\n  @include transition-delay($item-edit-transition-duration / 2);\n}\n\n// Item Delete (Left side edit button)\n// -------------------------------\n\n.item-delete .button.icon {\n  color: $item-delete-icon-color;\n  font-size: $item-delete-icon-size;\n\n  &:hover {\n    opacity: .7;\n  }\n}\n\n\n// Item Right Edit Button\n// -------------------------------\n\n.item-right-edit {\n  @include transition(all $item-edit-transition-function $item-edit-transition-duration);\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: $z-index-item-reorder;\n  width: $item-right-edit-open-width *  1.5;\n  height: 100%;\n  background: inherit;\n  padding-left: 20px;\n\n  .button {\n    min-width: $item-right-edit-open-width;\n    height: 100%;\n\n    &.icon {\n      @include display-flex();\n      @include align-items(center);\n      position: absolute;\n      top: 0;\n      height: 100%;\n      font-size: $item-reorder-icon-size;\n    }\n  }\n\n  display: block;\n  opacity: 0;\n  @include translate3d($item-right-edit-open-width *  1.5, 0, 0);\n  &.visible {\n    display: block;\n    &.active {\n      opacity: 1;\n      @include translate3d(0, 0, 0);\n    }\n  }\n}\n\n\n// Item Reordering (Right side edit button)\n// -------------------------------\n\n.item-reorder .button.icon {\n  color: $item-reorder-icon-color;\n  font-size: $item-reorder-icon-size;\n}\n\n.item-reordering {\n  // item is actively being reordered\n  position: absolute;\n  left: 0;\n  top: 0;\n  z-index: $z-index-item-reordering;\n  width: 100%;\n  box-shadow: 0px 0px 10px 0px #aaa;\n\n  .item-reorder {\n    z-index: $z-index-item-reordering;\n  }\n}\n\n.item-placeholder {\n  // placeholder for the item that's being reordered\n  opacity: 0.7;\n}\n\n\n/**\n * The hidden right-side buttons that can be exposed under a list item\n * with dragging.\n */\n.item-options {\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: $z-index-item-options;\n  height: 100%;\n\n  .button {\n    height: 100%;\n    border: none;\n    border-radius: 0;\n    @include display-inline-flex();\n    @include align-items(center);\n\n    &:before{\n      margin: 0 auto;\n    }\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_list.scss",
    "content": "\n/**\n * Lists\n * --------------------------------------------------\n */\n\n.list {\n  position: relative;\n  padding-top: $item-border-width;\n  padding-bottom: $item-border-width;\n  padding-left: 0; // reset padding because ul and ol\n  margin-bottom: 20px;\n}\n.list:last-child {\n  margin-bottom: 0px;\n  &.card{\n    margin-bottom:40px;\n  }\n}\n\n\n/**\n * List Header\n * --------------------------------------------------\n */\n\n.list-header {\n  margin-top: $list-header-margin-top;\n  padding: $list-header-padding;\n  background-color: $list-header-bg;\n  color: $list-header-color;\n  font-weight: bold;\n}\n\n// when its a card make sure it doesn't duplicate top and bottom borders\n.card.list .list-item {\n  padding-right: 1px;\n  padding-left: 1px;\n}\n\n\n/**\n * Cards and Inset Lists\n * --------------------------------------------------\n * A card and list-inset are close to the same thing, except a card as a box shadow.\n */\n\n.card,\n.list-inset {\n  overflow: hidden;\n  margin: ($content-padding * 2) $content-padding;\n  border-radius: $card-border-radius;\n  background-color: $card-body-bg;\n}\n\n.card {\n  padding-top: $item-border-width;\n  padding-bottom: $item-border-width;\n  box-shadow: $card-box-shadow;\n\n  .item {\n    border-left: 0;\n    border-right: 0;\n  }\n  .item:first-child {\n    border-top: 0;\n  }\n  .item:last-child {\n    border-bottom: 0;\n  }\n}\n\n.padding {\n  .card, .list-inset {\n    margin-left: 0;\n    margin-right: 0;\n  }\n}\n\n.card .item,\n.list-inset .item,\n.padding > .list .item\n{\n  &:first-child {\n    border-top-left-radius: $card-border-radius;\n    border-top-right-radius: $card-border-radius;\n\n    .item-content {\n      border-top-left-radius: $card-border-radius;\n      border-top-right-radius: $card-border-radius;\n    }\n  }\n  &:last-child {\n    border-bottom-right-radius: $card-border-radius;\n    border-bottom-left-radius: $card-border-radius;\n\n    .item-content {\n      border-bottom-right-radius: $card-border-radius;\n      border-bottom-left-radius: $card-border-radius;\n    }\n  }\n}\n\n.card .item:last-child,\n.list-inset .item:last-child {\n  margin-bottom: $item-border-width * -1;\n}\n\n.card .item,\n.list-inset .item,\n.padding > .list .item,\n.padding-horizontal > .list .item {\n  margin-right: 0;\n  margin-left: 0;\n\n  &.item-input input {\n    padding-right: 44px;\n  }\n}\n.padding-left > .list .item {\n  margin-left: 0;\n}\n.padding-right > .list .item {\n  margin-right: 0;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_loading.scss",
    "content": "\n/**\n * Loading\n * --------------------------------------------------\n */\n\n.loading-container {\n  position: absolute;\n  left: 0;\n  top: 0;\n  right: 0;\n  bottom: 0;\n\n  z-index: $z-index-loading;\n\n  @include display-flex();\n  @include justify-content(center);\n  @include align-items(center);\n\n  @include transition(0.2s opacity linear);\n  visibility: hidden;\n  opacity: 0;\n\n  &:not(.visible) .icon,\n  &:not(.visible) .spinner{\n    display: none;\n  }\n  &.visible {\n    visibility: visible;\n  }\n  &.active {\n    opacity: 1;\n  }\n\n  .loading {\n    padding: $loading-padding;\n\n    border-radius: $loading-border-radius;\n    background-color: $loading-bg-color;\n\n    color: $loading-text-color;\n\n    text-align: center;\n    text-overflow: ellipsis;\n    font-size: $loading-font-size;\n\n    h1, h2, h3, h4, h5, h6 {\n      color: $loading-text-color;\n    }\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_menu.scss",
    "content": "\n/**\n * Menus\n * --------------------------------------------------\n * Side panel structure\n */\n\n.menu {\n  position: absolute;\n  top: 0;\n  bottom: 0;\n  z-index: $z-index-menu;\n  overflow: hidden;\n\n  min-height: 100%;\n  max-height: 100%;\n  width: $menu-width;\n\n  background-color: $menu-bg;\n\n  .scroll-content {\n    z-index: $z-index-menu-scroll-content;\n  }\n\n  .bar-header {\n    z-index: $z-index-menu-bar-header;\n  }\n}\n\n.menu-content {\n  @include transform(none);\n  box-shadow: $menu-side-shadow;\n}\n\n.menu-open .menu-content .pane,\n.menu-open .menu-content .scroll-content {\n  pointer-events: none;\n}\n.menu-open .menu-content .scroll-content .scroll {\n  pointer-events: none;\n}\n.menu-open .menu-content .scroll-content:not(.overflow-scroll) {\n  overflow: hidden;\n}\n\n.grade-b .menu-content,\n.grade-c .menu-content {\n  @include box-sizing(content-box);\n  right: -1px;\n  left: -1px;\n  border-right: 1px solid #ccc;\n  border-left: 1px solid #ccc;\n  box-shadow: none;\n}\n\n.menu-left {\n  left: 0;\n}\n\n.menu-right {\n  right: 0;\n}\n\n.aside-open.aside-resizing .menu-right {\n  display: none;\n}\n\n.menu-animated {\n  @include transition-transform($menu-animation-speed ease);\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_mixins.scss",
    "content": "\n// Button Mixins\n// --------------------------------------------------\n\n@mixin button-style($bg-color, $border-color, $active-bg-color, $active-border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  color: $color;\n\n  // Give desktop users something to play with\n  &:hover {\n    color: $color;\n    text-decoration: none;\n  }\n  &.active,\n  &.activated {\n    @if $active-border-color != \"\"{\n      border-color: $active-border-color;\n    }\n    background-color: $active-bg-color;\n    //box-shadow: inset 0 1px 4px rgba(0,0,0,0.1);\n  }\n}\n\n@mixin button-clear($color, $font-size:\"\") {\n  &.button-clear {\n    border-color: transparent;\n    background: none;\n    box-shadow: none;\n    color: $color;\n\n    @if $font-size != \"\" {\n      font-size: $font-size;\n    }\n  }\n  &.button-icon {\n    border-color: transparent;\n    background: none;\n  }\n}\n\n@mixin button-outline($color, $text-color:\"\") {\n  &.button-outline {\n    border-color: $color;\n    background: transparent;\n    @if $text-color == \"\" {\n      $text-color: $color;\n    }\n    color: $text-color;\n    &.active,\n    &.activated {\n      background-color: $color;\n      box-shadow: none;\n      color: #fff;\n    }\n  }\n}\n\n\n// Bar Mixins\n// --------------------------------------------------\n\n@mixin bar-style($bg-color, $border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  background-image: linear-gradient(0deg, $border-color, $border-color 50%, transparent 50%);\n  color: $color;\n\n  .title {\n    color: $color;\n  }\n}\n\n\n// Tab Mixins\n// --------------------------------------------------\n\n@mixin tab-style($bg-color, $border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  background-image: linear-gradient(0deg, $border-color, $border-color 50%, transparent 50%);\n  color: $color;\n}\n\n@mixin tab-badge-style($bg-color, $color) {\n  .tab-item .badge {\n    background-color: $bg-color;\n    color: $color;\n  }\n}\n\n\n// Item Mixins\n// --------------------------------------------------\n\n@mixin item-style($bg-color, $border-color, $color) {\n  border-color: $border-color;\n  background-color: $bg-color;\n  color: $color;\n}\n\n@mixin item-active-style($active-bg-color, $active-border-color) {\n  border-color: $active-border-color;\n  background-color: $active-bg-color;\n  &.item-complex > .item-content {\n    border-color: $active-border-color;\n    background-color: $active-bg-color;\n  }\n}\n\n\n// Badge Mixins\n// --------------------------------------------------\n\n@mixin badge-style($bg-color, $color) {\n  background-color: $bg-color;\n  color: $color;\n}\n\n\n// Range Mixins\n// --------------------------------------------------\n\n@mixin range-style($track-bg-color) {\n  &::-webkit-slider-thumb:before {\n    background: $track-bg-color;\n  }\n  &::-ms-fill-lower{\n    background: $track-bg-color;\n  }\n}\n\n\n// Checkbox Mixins\n// --------------------------------------------------\n\n@mixin checkbox-style($off-border-color, $on-bg-color, $on-border-color) {\n  & input:before,\n  & .checkbox-icon:before {\n    border-color: $off-border-color;\n  }\n\n  // what the background looks like when its checked\n  & input:checked:before,\n  & input:checked + .checkbox-icon:before {\n    background: $on-bg-color;\n    border-color: $on-border-color;\n  }\n}\n\n\n// Toggle Mixins\n// --------------------------------------------------\n\n@mixin toggle-style($on-border-color, $on-bg-color) {\n  // the track when the toggle is \"on\"\n  & input:checked + .track {\n    border-color: $on-border-color;\n    background-color: $on-bg-color;\n  }\n}\n@mixin toggle-small-style($on-bg-color) {\n  // the track when the toggle is \"on\"\n  & input:checked + .track {\n    background-color: rgba($on-bg-color, .5);\n  }\n  & input:checked + .track .handle {\n    background-color: $on-bg-color;\n  }\n}\n\n\n// Clearfix\n// --------------------------------------------------\n\n@mixin clearfix {\n  *zoom: 1;\n  &:before,\n  &:after {\n    display: table;\n    content: \"\";\n    line-height: 0;\n  }\n  &:after {\n    clear: both;\n  }\n}\n\n\n// Placeholder text\n// --------------------------------------------------\n\n@mixin placeholder($color: $input-color-placeholder, $text-indent: 0) {\n  &::-moz-placeholder { // Firefox 19+\n    color: $color;\n  }\n  &:-ms-input-placeholder {\n    color: $color;\n  }\n  &::-webkit-input-placeholder {\n    color: $color;\n    // Safari placeholder margin issue\n    text-indent: $text-indent;\n  }\n}\n\n\n// Text Mixins\n// --------------------------------------------------\n\n@mixin text-size-adjust($value: none) {\n  -webkit-text-size-adjust: $value;\n     -moz-text-size-adjust: $value;\n          text-size-adjust: $value;\n}\n@mixin tap-highlight-transparent() {\n  -webkit-tap-highlight-color: rgba(0,0,0,0);\n  -webkit-tap-highlight-color: transparent; // For some Androids\n}\n@mixin touch-callout($value: none) {\n  -webkit-touch-callout: $value;\n}\n\n\n// Font Mixins\n// --------------------------------------------------\n\n@mixin font-family-serif() {\n  font-family: $serif-font-family;\n}\n@mixin font-family-sans-serif() {\n  font-family: $sans-font-family;\n}\n@mixin font-family-monospace() {\n  font-family: $mono-font-family;\n}\n@mixin font-shorthand($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  font-weight: $weight;\n  font-size: $size;\n  line-height: $line-height;\n}\n@mixin font-serif($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  @include font-family-serif();\n  @include font-shorthand($size, $weight, $line-height);\n}\n@mixin font-sans-serif($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  @include font-family-sans-serif();\n  @include font-shorthand($size, $weight, $line-height);\n}\n@mixin font-monospace($size: $base-font-size, $weight: normal, $line-height: $base-line-height) {\n  @include font-family-monospace();\n  @include font-shorthand($size, $weight, $line-height);\n}\n@mixin font-smoothing($font-smoothing) {\n  -webkit-font-smoothing: $font-smoothing;\n          font-smoothing: $font-smoothing;\n}\n\n\n// Appearance\n// --------------------------------------------------\n\n@mixin appearance($val) {\n  -webkit-appearance: $val;\n     -moz-appearance: $val;\n          appearance: $val;\n}\n\n\n// Border Radius Mixins\n// --------------------------------------------------\n\n@mixin border-radius($radius) {\n  -webkit-border-radius: $radius;\n          border-radius: $radius;\n}\n\n// Single Corner Border Radius\n@mixin border-top-left-radius($radius) {\n  -webkit-border-top-left-radius: $radius;\n          border-top-left-radius: $radius;\n}\n@mixin border-top-right-radius($radius) {\n  -webkit-border-top-right-radius: $radius;\n          border-top-right-radius: $radius;\n}\n@mixin border-bottom-right-radius($radius) {\n  -webkit-border-bottom-right-radius: $radius;\n          border-bottom-right-radius: $radius;\n}\n@mixin border-bottom-left-radius($radius) {\n  -webkit-border-bottom-left-radius: $radius;\n          border-bottom-left-radius: $radius;\n}\n\n// Single Side Border Radius\n@mixin border-top-radius($radius) {\n  @include border-top-right-radius($radius);\n  @include border-top-left-radius($radius);\n}\n@mixin border-right-radius($radius) {\n  @include border-top-right-radius($radius);\n  @include border-bottom-right-radius($radius);\n}\n@mixin border-bottom-radius($radius) {\n  @include border-bottom-right-radius($radius);\n  @include border-bottom-left-radius($radius);\n}\n@mixin border-left-radius($radius) {\n  @include border-top-left-radius($radius);\n  @include border-bottom-left-radius($radius);\n}\n\n\n// Box shadows\n// --------------------------------------------------\n\n@mixin box-shadow($shadow...) {\n  -webkit-box-shadow: $shadow;\n          box-shadow: $shadow;\n}\n\n\n// Transition Mixins\n// --------------------------------------------------\n\n@mixin transition($transition...) {\n  -webkit-transition: $transition;\n          transition: $transition;\n}\n@mixin transition-delay($transition-delay) {\n  -webkit-transition-delay: $transition-delay;\n          transition-delay: $transition-delay;\n}\n@mixin transition-duration($transition-duration) {\n  -webkit-transition-duration: $transition-duration;\n          transition-duration: $transition-duration;\n}\n@mixin transition-timing-function($transition-timing) {\n   -webkit-transition-timing-function: $transition-timing;\n           transition-timing-function: $transition-timing;\n }\n @mixin transition-property($property) {\n  -webkit-transition-property: $property;\n          transition-property: $property;\n}\n@mixin transition-transform($properties...) {\n  // special case cuz of transform vendor prefixes\n  -webkit-transition: -webkit-transform $properties;\n          transition: transform $properties;\n}\n\n\n// Animation Mixins\n// --------------------------------------------------\n\n@mixin animation($animation) {\n -webkit-animation: $animation;\n         animation: $animation;\n}\n@mixin animation-duration($duration) {\n -webkit-animation-duration: $duration;\n         animation-duration: $duration;\n}\n@mixin animation-direction($direction) {\n -webkit-animation-direction: $direction;\n         animation-direction: $direction;\n}\n@mixin animation-timing-function($animation-timing) {\n -webkit-animation-timing-function: $animation-timing;\n         animation-timing-function: $animation-timing;\n}\n@mixin animation-fill-mode($fill-mode) {\n -webkit-animation-fill-mode: $fill-mode;\n         animation-fill-mode: $fill-mode;\n}\n@mixin animation-name($name...) {\n -webkit-animation-name: $name;\n         animation-name: $name;\n}\n@mixin animation-iteration-count($count) {\n -webkit-animation-iteration-count: $count;\n         animation-iteration-count: $count;\n}\n\n\n// Transformation Mixins\n// --------------------------------------------------\n\n@mixin rotate($degrees) {\n  @include transform( rotate($degrees) );\n}\n@mixin scale($ratio) {\n  @include transform( scale($ratio) );\n}\n@mixin translate($x, $y) {\n  @include transform( translate($x, $y) );\n}\n@mixin skew($x, $y) {\n  @include transform( skew($x, $y) );\n  -webkit-backface-visibility: hidden;\n}\n@mixin translate3d($x, $y, $z) {\n  @include transform( translate3d($x, $y, $z) );\n}\n@mixin translateZ($z) {\n  @include transform( translateZ($z) );\n}\n@mixin transform($val) {\n  -webkit-transform: $val;\n          transform: $val;\n}\n\n@mixin transform-origin($left, $top) {\n  -webkit-transform-origin: $left $top;\n          transform-origin: $left $top;\n}\n\n\n// Backface visibility\n// --------------------------------------------------\n// Prevent browsers from flickering when using CSS 3D transforms.\n// Default value is `visible`, but can be changed to `hidden\n\n@mixin backface-visibility($visibility){\n  -webkit-backface-visibility: $visibility;\n          backface-visibility: $visibility;\n}\n\n\n// Background clipping\n// --------------------------------------------------\n\n@mixin background-clip($clip) {\n  -webkit-background-clip: $clip;\n          background-clip: $clip;\n}\n\n\n// Background sizing\n// --------------------------------------------------\n\n@mixin background-size($size) {\n  -webkit-background-size: $size;\n          background-size: $size;\n}\n\n\n// Box sizing\n// --------------------------------------------------\n\n@mixin box-sizing($boxmodel) {\n  -webkit-box-sizing: $boxmodel;\n     -moz-box-sizing: $boxmodel;\n          box-sizing: $boxmodel;\n}\n\n\n// User select\n// --------------------------------------------------\n\n@mixin user-select($select) {\n  -webkit-user-select: $select;\n     -moz-user-select: $select;\n      -ms-user-select: $select;\n          user-select: $select;\n}\n\n\n// Content Columns\n// --------------------------------------------------\n\n@mixin content-columns($columnCount, $columnGap: $grid-gutter-width) {\n  -webkit-column-count: $columnCount;\n     -moz-column-count: $columnCount;\n          column-count: $columnCount;\n  -webkit-column-gap: $columnGap;\n     -moz-column-gap: $columnGap;\n          column-gap: $columnGap;\n}\n\n\n// Flexbox Mixins\n// --------------------------------------------------\n// http://philipwalton.github.io/solved-by-flexbox/\n// https://github.com/philipwalton/solved-by-flexbox\n\n@mixin display-flex {\n  display: -webkit-box;\n  display: -webkit-flex;\n  display: -moz-box;\n  display: -moz-flex;\n  display: -ms-flexbox;\n  display: flex;\n}\n\n@mixin display-inline-flex {\n  display: -webkit-inline-box;\n  display: -webkit-inline-flex;\n  display: -moz-inline-flex;\n  display: -ms-inline-flexbox;\n  display: inline-flex;\n}\n\n@mixin flex-direction($value: row) {\n  @if $value == row-reverse {\n    -webkit-box-direction: reverse;\n    -webkit-box-orient: horizontal;\n  } @else if $value == column {\n    -webkit-box-direction: normal;\n    -webkit-box-orient: vertical;\n  } @else if $value == column-reverse {\n    -webkit-box-direction: reverse;\n    -webkit-box-orient: vertical;\n  } @else {\n    -webkit-box-direction: normal;\n    -webkit-box-orient: horizontal;\n  }\n  -webkit-flex-direction: $value;\n  -moz-flex-direction: $value;\n  -ms-flex-direction: $value;\n  flex-direction: $value;\n}\n\n@mixin flex-wrap($value: nowrap) {\n  // No Webkit Box fallback.\n  -webkit-flex-wrap: $value;\n  -moz-flex-wrap: $value;\n  @if $value == nowrap {\n      -ms-flex-wrap: none;\n  } @else {\n      -ms-flex-wrap: $value;\n  }\n  flex-wrap: $value;\n}\n\n@mixin flex($fg: 1, $fs: null, $fb: null) {\n  -webkit-box-flex: $fg;\n  -webkit-flex: $fg $fs $fb;\n  -moz-box-flex: $fg;\n  -moz-flex: $fg $fs $fb;\n  -ms-flex: $fg $fs $fb;\n  flex: $fg $fs $fb;\n}\n\n@mixin flex-flow($values: (row nowrap)) {\n  // No Webkit Box fallback.\n  -webkit-flex-flow: $values;\n  -moz-flex-flow: $values;\n  -ms-flex-flow: $values;\n  flex-flow: $values;\n}\n\n@mixin align-items($value: stretch) {\n  @if $value == flex-start {\n    -webkit-box-align: start;\n    -ms-flex-align: start;\n  } @else if $value == flex-end {\n    -webkit-box-align: end;\n    -ms-flex-align: end;\n  } @else {\n    -webkit-box-align: $value;\n    -ms-flex-align: $value;\n  }\n  -webkit-align-items: $value;\n  -moz-align-items: $value;\n  align-items: $value;\n}\n\n@mixin align-self($value: auto) {\n  -webkit-align-self: $value;\n  -moz-align-self: $value;\n  @if $value == flex-start {\n    -ms-flex-item-align: start;\n  } @else if $value == flex-end {\n    -ms-flex-item-align: end;\n  } @else {\n    -ms-flex-item-align: $value;\n  }\n  align-self: $value;\n}\n\n@mixin align-content($value: stretch) {\n  -webkit-align-content: $value;\n  -moz-align-content: $value;\n  @if $value == flex-start {\n    -ms-flex-line-pack: start;\n  } @else if $value == flex-end {\n    -ms-flex-line-pack: end;\n  } @else {\n    -ms-flex-line-pack: $value;\n  }\n  align-content: $value;\n}\n\n@mixin justify-content($value: stretch) {\n  @if $value == flex-start {\n    -webkit-box-pack: start;\n    -ms-flex-pack: start;\n  } @else if $value == flex-end {\n    -webkit-box-pack: end;\n    -ms-flex-pack: end;\n  } @else if $value == space-between {\n    -webkit-box-pack: justify;\n    -ms-flex-pack: justify;\n  } @else {\n    -webkit-box-pack: $value;\n    -ms-flex-pack: $value;\n  }\n  -webkit-justify-content: $value;\n  -moz-justify-content: $value;\n  justify-content: $value;\n}\n\n@mixin flex-order($n) {\n  -webkit-order: $n;\n  -ms-flex-order: $n;\n  order: $n;\n  -webkit-box-ordinal-group: $n;\n}\n\n@mixin responsive-grid-break($selector, $max-width) {\n  @media (max-width: $max-width) {\n    #{$selector} {\n      -webkit-box-direction: normal;\n      -moz-box-direction: normal;\n      -webkit-box-orient: vertical;\n      -moz-box-orient: vertical;\n      -webkit-flex-direction: column;\n      -ms-flex-direction: column;\n      flex-direction: column;\n\n      .col, .col-10, .col-20, .col-25, .col-33, .col-34, .col-50, .col-66, .col-67, .col-75, .col-80, .col-90 {\n        @include flex(1);\n        margin-bottom: ($grid-padding-width * 3) / 2;\n        margin-left: 0;\n        max-width: 100%;\n        width: 100%;\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_modal.scss",
    "content": "\n/**\n * Modals\n * --------------------------------------------------\n * Modals are independent windows that slide in from off-screen.\n */\n\n.modal-backdrop,\n.modal-backdrop-bg {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-modal;\n  width: 100%;\n  height: 100%;\n}\n\n.modal-backdrop-bg {\n  pointer-events: none;\n}\n\n.modal {\n  display: block;\n  position: absolute;\n  top: 0;\n  z-index: $z-index-modal;\n  overflow: hidden;\n  min-height: 100%;\n  width: 100%;\n  background-color: $modal-bg-color;\n}\n\n@media (min-width: $modal-inset-mode-break-point) {\n  // inset mode is when the modal doesn't fill the entire\n  // display but instead is centered within a large display\n  .modal {\n    top: $modal-inset-mode-top;\n    right: $modal-inset-mode-right;\n    bottom: $modal-inset-mode-bottom;\n    left: $modal-inset-mode-left;\n    min-height: $modal-inset-mode-min-height;\n    width: (100% - $modal-inset-mode-left - $modal-inset-mode-right);\n  }\n\n  .modal.ng-leave-active {\n    bottom: 0;\n  }\n\n  // remove ios header padding from inset header\n  .platform-ios.platform-cordova .modal-wrapper .modal {\n    .bar-header:not(.bar-subheader) {\n      height: $bar-height;\n      > * {\n        margin-top: 0;\n      }\n    }\n    .tabs-top > .tabs,\n    .tabs.tabs-top {\n      top: $bar-height;\n    }\n    .has-header,\n    .bar-subheader {\n      top: $bar-height;\n    }\n    .has-subheader {\n      top: $bar-height + $bar-subheader-height;\n    }\n    .has-header.has-tabs-top {\n      top: $bar-height + $tabs-height;\n    }\n    .has-header.has-subheader.has-tabs-top {\n      top: $bar-height + $bar-subheader-height + $tabs-height;\n    }\n  }\n\n  .modal-backdrop-bg {\n    @include transition(opacity 300ms ease-in-out);\n    background-color: $modal-backdrop-bg-active;\n    opacity: 0;\n  }\n\n  .active .modal-backdrop-bg {\n    opacity: 0.5;\n  }\n}\n\n// disable clicks on all but the modal\n.modal-open {\n  pointer-events: none;\n\n  .modal,\n  .modal-backdrop {\n    pointer-events: auto;\n  }\n  // prevent clicks on modal when loading overlay is active though\n  &.loading-active {\n    .modal,\n    .modal-backdrop {\n      pointer-events: none;\n    }\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_platform.scss",
    "content": "\n/**\n * Platform\n * --------------------------------------------------\n * Platform specific tweaks\n */\n\n.platform-ios.platform-cordova {\n  // iOS has a status bar which sits on top of the header.\n  // Bump down everything to make room for it. However, if\n  // if its in Cordova, and set to fullscreen, then disregard the bump.\n  &:not(.fullscreen) {\n    .bar-header:not(.bar-subheader) {\n      height: $bar-height + $ios-statusbar-height;\n\n      &.item-input-inset .item-input-wrapper {\n        margin-top: 19px !important;\n      }\n\n      > * {\n        margin-top: $ios-statusbar-height;\n      }\n    }\n    .tabs-top > .tabs,\n    .tabs.tabs-top {\n      top: $bar-height + $ios-statusbar-height;\n    }\n\n    .has-header,\n    .bar-subheader {\n      top: $bar-height + $ios-statusbar-height;\n    }\n    .has-subheader {\n      top: $bar-height + $bar-subheader-height + $ios-statusbar-height;\n    }\n    .has-header.has-tabs-top {\n      top: $bar-height + $tabs-height + $ios-statusbar-height;\n    }\n    .has-header.has-subheader.has-tabs-top {\n      top: $bar-height + $bar-subheader-height + $tabs-height + $ios-statusbar-height;\n    }\n  }\n  .popover{\n    .bar-header:not(.bar-subheader) {\n      height: $bar-height;\n      &.item-input-inset .item-input-wrapper {\n        margin-top: -1px;\n      }\n      > * {\n        margin-top: 0;\n      }\n    }\n    .has-header,\n    .bar-subheader {\n      top: $bar-height;\n    }\n    .has-subheader {\n      top: $bar-height + $bar-subheader-height;\n    }\n  }\n  &.status-bar-hide {\n    // Cordova doesn't adjust the body height correctly, this makes up for it\n    margin-bottom: 20px;\n  }\n}\n\n@media (orientation:landscape) {\n  .platform-ios.platform-browser.platform-ipad {\n    position: fixed; // required for iPad 7 Safari\n  }\n}\n\n.platform-c:not(.enable-transitions) * {\n  // disable transitions on grade-c devices (Android 2)\n  -webkit-transition: none !important;\n  transition: none !important;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_popover.scss",
    "content": "\n/**\n * Popovers\n * --------------------------------------------------\n * Popovers are independent views which float over content\n */\n\n.popover-backdrop {\n  position: fixed;\n  top: 0;\n  left: 0;\n  z-index: $z-index-popover;\n  width: 100%;\n  height: 100%;\n  background-color: $popover-backdrop-bg-inactive;\n\n  &.active {\n    background-color: $popover-backdrop-bg-active;\n  }\n}\n\n.popover {\n  position: absolute;\n  top: 25%;\n  left: 50%;\n  z-index: $z-index-popover;\n  display: block;\n  margin-top: 12px;\n  margin-left: -$popover-width / 2;\n  height: $popover-height;\n  width: $popover-width;\n  background-color: $popover-bg-color;\n  box-shadow: $popover-box-shadow;\n  opacity: 0;\n\n  .item:first-child {\n    border-top: 0;\n  }\n\n  .item:last-child {\n    border-bottom: 0;\n  }\n\n  &.popover-bottom {\n    margin-top: -12px;\n  }\n}\n\n\n// Set popover border-radius\n.popover,\n.popover .bar-header {\n  border-radius: $popover-border-radius;\n}\n.popover .scroll-content {\n  z-index: 1;\n  margin: 2px 0;\n}\n.popover .bar-header {\n  border-bottom-right-radius: 0;\n  border-bottom-left-radius: 0;\n}\n.popover .has-header {\n  border-top-right-radius: 0;\n  border-top-left-radius: 0;\n}\n.popover-arrow {\n  display: none;\n}\n\n\n// iOS Popover\n.platform-ios {\n\n  .popover {\n    box-shadow: $popover-box-shadow-ios;\n    border-radius: $popover-border-radius-ios;\n  }\n  .popover .bar-header {\n    @include border-top-radius($popover-border-radius-ios);\n  }\n  .popover .scroll-content {\n    margin: 8px 0;\n    border-radius: $popover-border-radius-ios;\n  }\n  .popover .scroll-content.has-header {\n    margin-top: 0;\n  }\n  .popover-arrow {\n    position: absolute;\n    display: block;\n    top: -17px;\n    width: 30px;\n    height: 19px;\n    overflow: hidden;\n\n    &:after {\n      position: absolute;\n      top: 12px;\n      left: 5px;\n      width: 20px;\n      height: 20px;\n      background-color: $popover-bg-color;\n      border-radius: 3px;\n      content: '';\n      @include rotate(-45deg);\n    }\n  }\n  .popover-bottom .popover-arrow {\n    top: auto;\n    bottom: -10px;\n    &:after {\n      top: -6px;\n    }\n  }\n}\n\n\n// Android Popover\n.platform-android {\n\n  .popover {\n    margin-top: -32px;\n    background-color: $popover-bg-color-android;\n    box-shadow: $popover-box-shadow-android;\n\n    .item {\n      border-color: $popover-bg-color-android;\n      background-color: $popover-bg-color-android;\n      color: #4d4d4d;\n    }\n    &.popover-bottom {\n      margin-top: 32px;\n    }\n  }\n\n  .popover-backdrop,\n  .popover-backdrop.active {\n    background-color: transparent;\n  }\n}\n\n\n// disable clicks on all but the popover\n.popover-open {\n  pointer-events: none;\n\n  .popover,\n  .popover-backdrop {\n    pointer-events: auto;\n  }\n  // prevent clicks on popover when loading overlay is active though\n  &.loading-active {\n    .popover,\n    .popover-backdrop {\n      pointer-events: none;\n    }\n  }\n}\n\n\n// wider popover on larger viewports\n@media (min-width: $popover-large-break-point) {\n  .popover {\n    width: $popover-large-width;\n    margin-left: -$popover-large-width / 2;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_popup.scss",
    "content": "\n/**\n * Popups\n * --------------------------------------------------\n */\n\n.popup-container {\n  position: absolute;\n  top: 0;\n  left: 0;\n  bottom: 0;\n  right: 0;\n  background: rgba(0,0,0,0);\n\n  @include display-flex();\n  @include justify-content(center);\n  @include align-items(center);\n\n  z-index: $z-index-popup;\n\n  // Start hidden\n  visibility: hidden;\n  &.popup-showing {\n    visibility: visible;\n  }\n\n  &.popup-hidden .popup {\n    @include animation-name(scaleOut);\n    @include animation-duration($popup-leave-animation-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n\n  &.active .popup {\n    @include animation-name(superScaleIn);\n    @include animation-duration($popup-enter-animation-duration);\n    @include animation-timing-function(ease-in-out);\n    @include animation-fill-mode(both);\n  }\n\n  .popup {\n    width: $popup-width;\n    max-width: 100%;\n    max-height: 90%;\n\n    border-radius: $popup-border-radius;\n    background-color: $popup-background-color;\n\n    @include display-flex();\n    @include flex-direction(column);\n  }\n\n  input,\n  textarea {\n    width: 100%;\n  }\n}\n\n.popup-head {\n  padding: 15px 10px;\n  border-bottom: 1px solid #eee;\n  text-align: center;\n}\n.popup-title {\n  margin: 0;\n  padding: 0;\n  font-size: 15px;\n}\n.popup-sub-title {\n  margin: 5px 0 0 0;\n  padding: 0;\n  font-weight: normal;\n  font-size: 11px;\n}\n.popup-body {\n  padding: 10px;\n  overflow: auto;\n}\n\n.popup-buttons {\n  @include display-flex();\n  @include flex-direction(row);\n  padding: 10px;\n  min-height: $popup-button-min-height + 20;\n\n  .button {\n    @include flex(1);\n    display: block;\n    min-height: $popup-button-min-height;\n    border-radius: $popup-button-border-radius;\n    line-height: $popup-button-line-height;\n\n    margin-right: 5px;\n    &:last-child {\n      margin-right: 0px;\n    }\n  }\n}\n\n.popup-open {\n  pointer-events: none;\n\n  &.modal-open .modal {\n    pointer-events: none;\n  }\n\n  .popup-backdrop, .popup {\n    pointer-events: auto;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_progress.scss",
    "content": "\n/**\n * Progress\n * --------------------------------------------------\n */\n\nprogress {\n  display: block;\n  margin: $progress-margin;\n  width: $progress-width;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_radio.scss",
    "content": "\n/**\n * Radio Button Inputs\n * --------------------------------------------------\n */\n\n.item-radio {\n  padding: 0;\n\n  &:hover {\n    cursor: pointer;\n  }\n}\n\n.item-radio .item-content {\n  /* give some room to the right for the checkmark icon */\n  padding-right: $item-padding * 4;\n}\n\n.item-radio .radio-icon {\n  /* checkmark icon will be hidden by default */\n  position: absolute;\n  top: 0;\n  right: 0;\n  z-index: $z-index-item-radio;\n  visibility: hidden;\n  padding: $item-padding - 2;\n  height: 100%;\n  font-size: 24px;\n}\n\n.item-radio input {\n  /* hide any radio button inputs elements (the ugly circles) */\n  position: absolute;\n  left: -9999px;\n\n  &:checked + .radio-content .item-content {\n    /* style the item content when its checked */\n    background: #f7f7f7;\n  }\n\n  &:checked + .radio-content .radio-icon {\n    /* show the checkmark icon when its checked */\n    visibility: visible;\n  }\n}\n\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_range.scss",
    "content": "\n/**\n * Range\n * --------------------------------------------------\n */\n\n .range input{\n  display: inline-block;\n  overflow: hidden;\n  margin-top: 5px;\n  margin-bottom: 5px;\n  padding-right: 2px;\n  padding-left: 1px;\n  width: auto;\n  height: $range-slider-height + 15;\n  outline: none;\n  background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, $range-default-track-bg), color-stop(100%, $range-default-track-bg));\n  background: linear-gradient(to right, $range-default-track-bg 0%, $range-default-track-bg 100%);\n  background-position: center;\n  background-size: 99% $range-track-height;\n  background-repeat: no-repeat;\n  -webkit-appearance: none;\n\n  &::-moz-focus-outer {\n    /* hide the focus outline in Firefox */\n    border: 0;\n  }\n\n  &::-webkit-slider-thumb {\n    position: relative;\n    width: $range-slider-width;\n    height: $range-slider-height;\n    border-radius: $range-slider-border-radius;\n    background-color: $toggle-handle-off-bg-color;\n    box-shadow: $range-slider-box-shadow;\n    cursor: pointer;\n    -webkit-appearance: none;\n    border: 0;\n  }\n\n  &::-webkit-slider-thumb:before{\n    /* what creates the colorful line on the left side of the slider */\n    position: absolute;\n    top: ($range-slider-height / 2) - ($range-track-height / 2);\n    left: -2001px;\n    width: 2000px;\n    height: $range-track-height;\n    background: $dark;\n    content: ' ';\n  }\n\n  &::-webkit-slider-thumb:after {\n    /* create a larger (but hidden) hit area */\n    position: absolute;\n    top: -15px;\n    left: -15px;\n    padding: 30px;\n    content: ' ';\n    //background: red;\n    //opacity: .5;\n  }\n   &::-ms-fill-lower{\n     height: $range-track-height;\n     background:$dark;\n   }\n  /*\n   &::-ms-track{\n     background: transparent;\n     border-color: transparent;\n     border-width: 11px 0 16px;\n     color:transparent;\n     margin-top:20px;\n   }\n   &::-ms-thumb {\n     width: $range-slider-width;\n     height: $range-slider-height;\n     border-radius: $range-slider-border-radius;\n     background-color: $toggle-handle-off-bg-color;\n     border-color:$toggle-handle-off-bg-color;\n     box-shadow: $range-slider-box-shadow;\n     margin-left:1px;\n     margin-right:1px;\n     outline:none;\n   }\n   &::-ms-fill-upper {\n     height: $range-track-height;\n     background:$range-default-track-bg;\n   }\n   */\n}\n\n.range {\n  @include display-flex();\n  @include align-items(center);\n  padding: 2px 11px;\n\n  &.range-light {\n    input { @include range-style($range-light-track-bg); }\n  }\n  &.range-stable {\n    input { @include range-style($range-stable-track-bg); }\n  }\n  &.range-positive {\n    input { @include range-style($range-positive-track-bg); }\n  }\n  &.range-calm {\n    input { @include range-style($range-calm-track-bg); }\n  }\n  &.range-balanced {\n    input { @include range-style($range-balanced-track-bg); }\n  }\n  &.range-assertive {\n    input { @include range-style($range-assertive-track-bg); }\n  }\n  &.range-energized {\n    input { @include range-style($range-energized-track-bg); }\n  }\n  &.range-royal {\n    input { @include range-style($range-royal-track-bg); }\n  }\n  &.range-dark {\n    input { @include range-style($range-dark-track-bg); }\n  }\n}\n\n.range .icon {\n  @include flex(0);\n  display: block;\n  min-width: $range-icon-size;\n  text-align: center;\n  font-size: $range-icon-size;\n}\n\n.range input {\n  @include flex(1);\n  display: block;\n  margin-right: 10px;\n  margin-left: 10px;\n}\n\n.range-label {\n  @include flex(0, 0, auto);\n  display: block;\n  white-space: nowrap;\n}\n\n.range-label:first-child {\n  padding-left: 5px;\n}\n.range input + .range-label {\n  padding-right: 5px;\n  padding-left: 0;\n}\n\n// WP range height must be auto\n.platform-windowsphone{\n  .range input{\n    height:auto;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_refresher.scss",
    "content": "\n// Scroll refresher (for pull to refresh)\n.scroll-refresher {\n  position: absolute;\n  top: -60px;\n  right: 0;\n  left: 0;\n  overflow: hidden;\n  margin: auto;\n  height: 60px;\n  .ionic-refresher-content {\n    position: absolute;\n    bottom: 15px;\n    left: 0;\n    width: 100%;\n    color: $scroll-refresh-icon-color;\n    text-align: center;\n\n    font-size: 30px;\n\n    .text-refreshing,\n    .text-pulling {\n      font-size: 16px;\n      line-height: 16px;\n    }\n    &.ionic-refresher-with-text {\n      bottom: 10px;\n    }\n  }\n\n  .icon-refreshing,\n  .icon-pulling {\n    width: 100%;\n    -webkit-backface-visibility: hidden;\n    backface-visibility: hidden;\n    -webkit-transform-style: preserve-3d;\n    transform-style: preserve-3d;\n  }\n  .icon-pulling {\n    @include animation-name(refresh-spin-back);\n    @include animation-duration(200ms);\n    @include animation-timing-function(linear);\n    @include animation-fill-mode(none);\n    -webkit-transform: translate3d(0,0,0) rotate(0deg);\n    transform: translate3d(0,0,0) rotate(0deg);\n  }\n  .icon-refreshing,\n  .text-refreshing {\n    display: none;\n  }\n  .icon-refreshing {\n    @include animation-duration(1.5s);\n  }\n\n  &.active {\n    .icon-pulling:not(.pulling-rotation-disabled) {\n      @include animation-name(refresh-spin);\n      -webkit-transform: translate3d(0,0,0) rotate(-180deg);\n      transform: translate3d(0,0,0) rotate(-180deg);\n    }\n    &.refreshing {\n      @include transition(-webkit-transform .2s);\n      @include transition(transform .2s);\n      -webkit-transform: scale(1,1);\n      transform: scale(1,1);\n\n      .icon-pulling,\n      .text-pulling {\n        display: none;\n      }\n      .icon-refreshing,\n      .text-refreshing {\n        display: block;\n      }\n      &.refreshing-tail {\n        -webkit-transform: scale(0,0);\n        transform: scale(0,0);\n      }\n    }\n  }\n}\n.overflow-scroll > .scroll{\n  &.overscroll{\n    position:fixed;\n    right: 0;\n    left: 0;\n  }\n  -webkit-overflow-scrolling:touch;\n  width:100%;\n}\n\n.overflow-scroll.padding > .scroll.overscroll{\n    padding: 10px;\n}\n@-webkit-keyframes refresh-spin {\n  0%   { -webkit-transform: translate3d(0,0,0) rotate(0); }\n  100% { -webkit-transform: translate3d(0,0,0) rotate(180deg); }\n}\n\n@keyframes refresh-spin {\n  0%   { transform: translate3d(0,0,0) rotate(0); }\n  100% { transform: translate3d(0,0,0) rotate(180deg); }\n}\n\n@-webkit-keyframes refresh-spin-back {\n  0%   { -webkit-transform: translate3d(0,0,0) rotate(180deg); }\n  100% { -webkit-transform: translate3d(0,0,0) rotate(0); }\n}\n\n@keyframes refresh-spin-back {\n  0%   { transform: translate3d(0,0,0) rotate(180deg); }\n  100% { transform: translate3d(0,0,0) rotate(0); }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_reset.scss",
    "content": "\n/**\n * Resets\n * --------------------------------------------------\n * Adapted from normalize.css and some reset.css. We don't care even one\n * bit about old IE, so we don't need any hacks for that in here.\n *\n * There are probably other things we could remove here, as well.\n *\n * normalize.css v2.1.2 | MIT License | git.io/normalize\n\n * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/)\n * http://cssreset.com\n */\n\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, i, u, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed, fieldset,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  vertical-align: baseline;\n  font: inherit;\n  font-size: 100%;\n}\n\nol, ul {\n  list-style: none;\n}\nblockquote, q {\n  quotes: none;\n}\nblockquote:before, blockquote:after,\nq:before, q:after {\n  content: '';\n  content: none;\n}\n\n/**\n * Prevent modern browsers from displaying `audio` without controls.\n * Remove excess height in iOS 5 devices.\n */\n\naudio:not([controls]) {\n  display: none;\n  height: 0;\n}\n\n/**\n * Hide the `template` element in IE, Safari, and Firefox < 22.\n */\n\n[hidden],\ntemplate {\n  display: none;\n}\n\nscript {\n  display: none !important;\n}\n\n/* ==========================================================================\n   Base\n   ========================================================================== */\n\n/**\n * 1. Set default font family to sans-serif.\n * 2. Prevent iOS text size adjust after orientation change, without disabling\n *  user zoom.\n */\n\nhtml {\n  @include user-select(none);\n  font-family: sans-serif; /* 1 */\n  -webkit-text-size-adjust: 100%;\n  -ms-text-size-adjust: 100%; /* 2 */\n  -webkit-text-size-adjust: 100%; /* 2 */\n}\n\n/**\n * Remove default margin.\n */\n\nbody {\n  margin: 0;\n  line-height: 1;\n}\n\n\n/**\n * Remove default outlines.\n */\na,\nbutton,\n:focus,\na:focus,\nbutton:focus,\na:active,\na:hover {\n  outline: 0;\n}\n\n/* *\n * Remove tap highlight color\n */\n\na {\n  -webkit-user-drag: none;\n  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n  -webkit-tap-highlight-color: transparent;\n\n  &[href]:hover {\n    cursor: pointer;\n  }\n}\n\n/* ==========================================================================\n   Typography\n   ========================================================================== */\n\n\n/**\n * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.\n */\n\nb,\nstrong {\n  font-weight: bold;\n}\n\n/**\n * Address styling not present in Safari 5 and Chrome.\n */\n\ndfn {\n  font-style: italic;\n}\n\n/**\n * Address differences between Firefox and other browsers.\n */\n\nhr {\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  height: 0;\n}\n\n\n/**\n * Correct font family set oddly in Safari 5 and Chrome.\n */\n\ncode,\nkbd,\npre,\nsamp {\n  font-size: 1em;\n  font-family: monospace, serif;\n}\n\n/**\n * Improve readability of pre-formatted text in all browsers.\n */\n\npre {\n  white-space: pre-wrap;\n}\n\n/**\n * Set consistent quote types.\n */\n\nq {\n  quotes: \"\\201C\" \"\\201D\" \"\\2018\" \"\\2019\";\n}\n\n/**\n * Address inconsistent and variable font size in all browsers.\n */\n\nsmall {\n  font-size: 80%;\n}\n\n/**\n * Prevent `sub` and `sup` affecting `line-height` in all browsers.\n */\n\nsub,\nsup {\n  position: relative;\n  vertical-align: baseline;\n  font-size: 75%;\n  line-height: 0;\n}\n\nsup {\n  top: -0.5em;\n}\n\nsub {\n  bottom: -0.25em;\n}\n\n/**\n * Define consistent border, margin, and padding.\n */\n\nfieldset {\n  margin: 0 2px;\n  padding: 0.35em 0.625em 0.75em;\n  border: 1px solid #c0c0c0;\n}\n\n/**\n * 1. Correct `color` not being inherited in IE 8/9.\n * 2. Remove padding so people aren't caught out if they zero out fieldsets.\n */\n\nlegend {\n  padding: 0; /* 2 */\n  border: 0; /* 1 */\n}\n\n/**\n * 1. Correct font family not being inherited in all browsers.\n * 2. Correct font size not being inherited in all browsers.\n * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.\n * 4. Remove any default :focus styles\n * 5. Make sure webkit font smoothing is being inherited\n * 6. Remove default gradient in Android Firefox / FirefoxOS\n */\n\nbutton,\ninput,\nselect,\ntextarea {\n  margin: 0; /* 3 */\n  font-size: 100%; /* 2 */\n  font-family: inherit; /* 1 */\n  outline-offset: 0; /* 4 */\n  outline-style: none; /* 4 */\n  outline-width: 0; /* 4 */\n  -webkit-font-smoothing: inherit; /* 5 */\n  background-image: none; /* 6 */\n}\n\n/**\n * Address Firefox 4+ setting `line-height` on `input` using `importnt` in\n * the UA stylesheet.\n */\n\nbutton,\ninput {\n  line-height: normal;\n}\n\n/**\n * Address inconsistent `text-transform` inheritance for `button` and `select`.\n * All other form control elements do not inherit `text-transform` values.\n * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.\n * Correct `select` style inheritance in Firefox 4+ and Opera.\n */\n\nbutton,\nselect {\n  text-transform: none;\n}\n\n/**\n * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`\n *  and `video` controls.\n * 2. Correct inability to style clickable `input` types in iOS.\n * 3. Improve usability and consistency of cursor style between image-type\n *  `input` and others.\n */\n\nbutton,\nhtml input[type=\"button\"], /* 1 */\ninput[type=\"reset\"],\ninput[type=\"submit\"] {\n  cursor: pointer; /* 3 */\n  -webkit-appearance: button; /* 2 */\n}\n\n/**\n * Re-set default cursor for disabled elements.\n */\n\nbutton[disabled],\nhtml input[disabled] {\n  cursor: default;\n}\n\n/**\n * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.\n * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome\n *  (include `-moz` to future-proof).\n */\n\ninput[type=\"search\"] {\n  -webkit-box-sizing: content-box; /* 2 */\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n  -webkit-appearance: textfield; /* 1 */\n}\n\n/**\n * Remove inner padding and search cancel button in Safari 5 and Chrome\n * on OS X.\n */\n\ninput[type=\"search\"]::-webkit-search-cancel-button,\ninput[type=\"search\"]::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\n/**\n * Remove inner padding and border in Firefox 4+.\n */\n\nbutton::-moz-focus-inner,\ninput::-moz-focus-inner {\n  padding: 0;\n  border: 0;\n}\n\n/**\n * 1. Remove default vertical scrollbar in IE 8/9.\n * 2. Improve readability and alignment in all browsers.\n */\n\ntextarea {\n  overflow: auto; /* 1 */\n  vertical-align: top; /* 2 */\n}\n\n\nimg {\n  -webkit-user-drag: none;\n}\n\n/* ==========================================================================\n   Tables\n   ========================================================================== */\n\n/**\n * Remove most spacing between table cells.\n */\n\ntable {\n  border-spacing: 0;\n  border-collapse: collapse;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_scaffolding.scss",
    "content": "\n/**\n * Scaffolding\n * --------------------------------------------------\n */\n\n*,\n*:before,\n*:after {\n  @include box-sizing(border-box);\n}\n\nhtml {\n  overflow: hidden;\n  -ms-touch-action: pan-y;\n  touch-action: pan-y;\n}\n\nbody,\n.ionic-body {\n  @include touch-callout(none);\n  @include font-smoothing(antialiased);\n  @include text-size-adjust(none);\n  @include tap-highlight-transparent();\n  @include user-select(none);\n\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n\n  margin: 0;\n  padding: 0;\n\n  color: $base-color;\n  word-wrap: break-word;\n  font-size: $font-size-base;\n  font-family: -apple-system;\n  font-family: $font-family-base;\n  line-height: $line-height-computed;\n  text-rendering: optimizeLegibility;\n  -webkit-backface-visibility: hidden;\n  -webkit-user-drag: none;\n  -ms-content-zooming: none;\n}\n\nbody.grade-b,\nbody.grade-c {\n  // disable optimizeLegibility for low end devices\n  text-rendering: auto;\n}\n\n.content {\n  // used for content areas not using the content directive\n  position: relative;\n}\n\n.scroll-content {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  overflow: hidden;\n\n  // Hide the top border if any\n  margin-top: -1px;\n\n  // Prevents any distortion of lines\n  padding-top: 1px;\n  margin-bottom: -1px;\n\n  width: auto;\n  height: auto;\n}\n\n.menu .scroll-content.scroll-content-false{\n  z-index: $z-index-scroll-content-false;\n}\n\n.scroll-view {\n  position: relative;\n  display: block;\n  overflow: hidden;\n\n  &.overflow-scroll {\n    position: relative;\n  }\n\n  &.scroll-x { overflow-x: scroll; overflow-y: hidden; }\n  &.scroll-y { overflow-x: hidden; overflow-y: scroll; }\n  &.scroll-xy { overflow-x: scroll; overflow-y: scroll; }\n\n  // Hide the top border if any\n  margin-top: -1px;\n}\n\n/**\n * Scroll is the scroll view component available for complex and custom\n * scroll view functionality.\n */\n.scroll {\n  @include user-select(none);\n  @include touch-callout(none);\n  @include text-size-adjust(none);\n  @include transform-origin(left, top);\n}\n/**\n * Set ms-viewport to prevent MS \"page squish\" and allow fluid scrolling\n * https://msdn.microsoft.com/en-us/library/ie/hh869615(v=vs.85).aspx\n */\n@-ms-viewport { width: device-width; }\n\n// Scroll bar styles\n.scroll-bar {\n  position: absolute;\n  z-index: $z-index-scroll-bar;\n}\n// hide the scroll-bar during animations\n.ng-animate .scroll-bar {\n  visibility: hidden;\n}\n.scroll-bar-h {\n  right: 2px;\n  bottom: 3px;\n  left: 2px;\n  height: 3px;\n\n  .scroll-bar-indicator {\n    height: 100%;\n  }\n}\n\n.scroll-bar-v {\n  top: 2px;\n  right: 3px;\n  bottom: 2px;\n  width: 3px;\n\n  .scroll-bar-indicator {\n    width: 100%;\n  }\n}\n.scroll-bar-indicator {\n  position: absolute;\n  border-radius: 4px;\n  background: rgba(0,0,0,0.3);\n  opacity: 1;\n  @include transition(opacity .3s linear);\n\n  &.scroll-bar-fade-out {\n    opacity: 0;\n  }\n}\n.platform-android .scroll-bar-indicator {\n  // android doesn't have rounded ends on scrollbar\n  border-radius: 0;\n}\n.grade-b .scroll-bar-indicator,\n.grade-c .scroll-bar-indicator {\n  // disable rgba background and border radius for low end devices\n  background: #aaa;\n\n  &.scroll-bar-fade-out {\n    @include transition(none);\n  }\n}\n\nion-infinite-scroll {\n  height: 60px;\n  width: 100%;\n  display: block;\n\n  @include display-flex();\n  @include flex-direction(row);\n  @include justify-content(center);\n  @include align-items(center);\n\n  .icon {\n    color: #666666;\n    font-size: 30px;\n    color: $scroll-refresh-icon-color;\n  }\n  &:not(.active){\n    .spinner,\n    .icon:before{\n      display:none;\n    }\n  }\n}\n\n.overflow-scroll {\n  overflow-x: hidden;\n  overflow-y: scroll;\n  -webkit-overflow-scrolling: touch;\n\n  // Make sure the scrollbar doesn't take up layout space on edge\n  -ms-overflow-style: -ms-autohiding-scrollbar;\n\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  position: absolute;\n\n  &.pane {\n    overflow-x: hidden;\n    overflow-y: scroll;\n  }\n\n  .scroll {\n    position: static;\n    height: 100%;\n    -webkit-transform: translate3d(0, 0, 0);   // fix iOS bug where relative children of scroller disapear while scrolling.  see: http://stackoverflow.com/questions/9807620/ipad-safari-scrolling-causes-html-elements-to-disappear-and-reappear-with-a-dela\n  }\n}\n\n\n// Pad top/bottom of content so it doesn't hide behind .bar-title and .bar-tab.\n// Note: For these to work, content must come after both bars in the markup\n/* If you change these, change platform.scss as well */\n.has-header {\n  top: $bar-height;\n}\n// Force no header\n.no-header {\n  top: 0;\n}\n\n.has-subheader {\n  top: $bar-height + $bar-subheader-height;\n}\n.has-tabs-top {\n  top: $bar-height + $tabs-height;\n}\n.has-header.has-subheader.has-tabs-top {\n  top: $bar-height + $bar-subheader-height + $tabs-height;\n}\n\n.has-footer {\n  bottom: $bar-footer-height;\n}\n.has-subfooter {\n  bottom: $bar-footer-height + $bar-subfooter-height;\n}\n\n.has-tabs,\n.bar-footer.has-tabs {\n  bottom: $tabs-height;\n  &.pane{\n    bottom: $tabs-height;\n    height:auto;\n  }\n}\n\n.bar-subfooter.has-tabs {\n  bottom: $tabs-height + $bar-footer-height;\n}\n\n.has-footer.has-tabs {\n  bottom: $tabs-height + $bar-footer-height;\n}\n\n// A full screen section with a solid background\n.pane {\n  @include translate3d(0,0,0);\n  @include transition-duration(0);\n  z-index: $z-index-pane;\n}\n.view {\n  z-index: $z-index-view;\n}\n.pane,\n.view {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  width: 100%;\n  height: 100%;\n  background-color: $base-background-color;\n  overflow: hidden;\n}\n.view-container {\n  position: absolute;\n  display: block;\n  width: 100%;\n  height: 100%;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_select.scss",
    "content": "\n/**\n * Select\n * --------------------------------------------------\n */\n\n.item-select {\n  position: relative;\n\n  select {\n    @include appearance(none);\n    position: absolute;\n    top: 0;\n    bottom: 0;\n    right: 0;\n    padding: 0 ($item-padding * 3) 0 $item-padding;\n    max-width: 65%;\n\n    border: none;\n    background: $item-default-bg;\n    color: #333;\n\n    // hack to hide default dropdown arrow in FF\n    text-indent: .01px;\n    text-overflow: '';\n\n    white-space: nowrap;\n    font-size: $font-size-base;\n\n    cursor: pointer;\n    direction: rtl; // right align the select text\n  }\n\n  select::-ms-expand {\n    // hide default dropdown arrow in IE\n    display: none;\n  }\n\n  option {\n    direction: ltr;\n  }\n\n  &:after {\n    position: absolute;\n    top: 50%;\n    right: $item-padding;\n    margin-top: -3px;\n    width: 0;\n    height: 0;\n    border-top: 5px solid;\n    border-right: 5px solid rgba(0, 0, 0, 0);\n    border-left: 5px solid rgba(0, 0, 0, 0);\n    color: #999;\n    content: \"\";\n    pointer-events: none;\n  }\n  &.item-light {\n    select{\n      background:$item-light-bg;\n      color:$item-light-text;\n    }\n  }\n  &.item-stable {\n    select{\n      background:$item-stable-bg;\n      color:$item-stable-text;\n    }\n    &:after, .input-label{\n      color:darken($item-stable-border,30%);\n    }\n  }\n  &.item-positive {\n    select{\n      background:$item-positive-bg;\n      color:$item-positive-text;\n    }\n    &:after, .input-label{\n      color:$item-positive-text;\n    }\n  }\n  &.item-calm {\n    select{\n      background:$item-calm-bg;\n      color:$item-calm-text;\n    }\n    &:after, .input-label{\n      color:$item-calm-text;\n    }\n  }\n  &.item-assertive {\n    select{\n      background:$item-assertive-bg;\n      color:$item-assertive-text;\n    }\n    &:after, .input-label{\n      color:$item-assertive-text;\n    }\n  }\n  &.item-balanced {\n    select{\n      background:$item-balanced-bg;\n      color:$item-balanced-text;\n    }\n    &:after, .input-label{\n      color:$item-balanced-text;\n    }\n  }\n  &.item-energized  {\n    select{\n      background:$item-energized-bg;\n      color:$item-energized-text;\n    }\n    &:after, .input-label{\n      color:$item-energized-text;\n    }\n  }\n  &.item-royal {\n    select{\n      background:$item-royal-bg;\n      color:$item-royal-text;\n    }\n    &:after, .input-label{\n      color:$item-royal-text;\n    }\n  }\n  &.item-dark  {\n    select{\n      background:$item-dark-bg;\n      color:$item-dark-text;\n    }\n    &:after, .input-label{\n      color:$item-dark-text;\n    }\n  }\n}\n\nselect {\n  &[multiple],\n  &[size] {\n    height: auto;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_slide-box.scss",
    "content": "\n/**\n * Slide Box\n * --------------------------------------------------\n */\n\n.slider {\n  position: relative;\n  visibility: hidden;\n  // Make sure items don't scroll over ever\n  overflow: hidden;\n}\n\n.slider-slides {\n  position: relative;\n  height: 100%;\n}\n\n.slider-slide {\n  position: relative;\n  display: block;\n  float: left;\n  width: 100%;\n  height: 100%;\n  vertical-align: top;\n}\n\n.slider-slide-image {\n  > img {\n    width: 100%;\n  }\n}\n\n.slider-pager {\n  position: absolute;\n  bottom: 20px;\n  z-index: $z-index-slider-pager;\n  width: 100%;\n  height: 15px;\n  text-align: center;\n\n  .slider-pager-page {\n    display: inline-block;\n    margin: 0px 3px;\n    width: 15px;\n    color: #000;\n    text-decoration: none;\n\n    opacity: 0.3;\n\n    &.active {\n      @include transition(opacity 0.4s ease-in);\n      opacity: 1;\n    }\n  }\n}\n\n//Disable animate service animations\n.slider-slide,\n.slider-pager-page {\n  &.ng-enter,\n  &.ng-leave,\n  &.ng-animate {\n    -webkit-transition: none !important;\n    transition: none !important;\n  }\n  &.ng-animate {\n    -webkit-animation: none 0s;\n    animation: none 0s;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_slides.scss",
    "content": "/**\n * Swiper 3.2.7\n * Most modern mobile touch slider and framework with hardware accelerated transitions\n *\n * http://www.idangero.us/swiper/\n *\n * Copyright 2015, Vladimir Kharlampidi\n * The iDangero.us\n * http://www.idangero.us/\n *\n * Licensed under MIT\n *\n * Released on: December 7, 2015\n */\n.swiper-container {\n  margin: 0 auto;\n  position: relative;\n  overflow: hidden;\n  /* Fix of Webkit flickering */\n  z-index: 1;\n}\n.swiper-container-no-flexbox .swiper-slide {\n  float: left;\n}\n.swiper-container-vertical > .swiper-wrapper {\n  -webkit-box-orient: vertical;\n  -moz-box-orient: vertical;\n  -ms-flex-direction: column;\n  -webkit-flex-direction: column;\n  flex-direction: column;\n}\n.swiper-wrapper {\n  position: relative;\n  width: 100%;\n  height: 100%;\n  z-index: 1;\n  display: -webkit-box;\n  display: -moz-box;\n  display: -ms-flexbox;\n  display: -webkit-flex;\n  display: flex;\n  -webkit-transition-property: -webkit-transform;\n  -moz-transition-property: -moz-transform;\n  -o-transition-property: -o-transform;\n  -ms-transition-property: -ms-transform;\n  transition-property: transform;\n  -webkit-box-sizing: content-box;\n  -moz-box-sizing: content-box;\n  box-sizing: content-box;\n}\n.swiper-container-android .swiper-slide,\n.swiper-wrapper {\n  -webkit-transform: translate3d(0px, 0, 0);\n  -moz-transform: translate3d(0px, 0, 0);\n  -o-transform: translate(0px, 0px);\n  -ms-transform: translate3d(0px, 0, 0);\n  transform: translate3d(0px, 0, 0);\n}\n.swiper-container-multirow > .swiper-wrapper {\n  -webkit-box-lines: multiple;\n  -moz-box-lines: multiple;\n  -ms-flex-wrap: wrap;\n  -webkit-flex-wrap: wrap;\n  flex-wrap: wrap;\n}\n.swiper-container-free-mode > .swiper-wrapper {\n  -webkit-transition-timing-function: ease-out;\n  -moz-transition-timing-function: ease-out;\n  -ms-transition-timing-function: ease-out;\n  -o-transition-timing-function: ease-out;\n  transition-timing-function: ease-out;\n  margin: 0 auto;\n}\n.swiper-slide {\n  display: block;\n  -webkit-flex-shrink: 0;\n  -ms-flex: 0 0 auto;\n  flex-shrink: 0;\n  width: 100%;\n  height: 100%;\n  position: relative;\n}\n/* Auto Height */\n.swiper-container-autoheight,\n.swiper-container-autoheight .swiper-slide {\n  height: auto;\n}\n.swiper-container-autoheight .swiper-wrapper {\n  -webkit-box-align: start;\n  -ms-flex-align: start;\n  -webkit-align-items: flex-start;\n  align-items: flex-start;\n  -webkit-transition-property: -webkit-transform, height;\n  -moz-transition-property: -moz-transform;\n  -o-transition-property: -o-transform;\n  -ms-transition-property: -ms-transform;\n  transition-property: transform, height;\n}\n/* a11y */\n.swiper-container .swiper-notification {\n  position: absolute;\n  left: 0;\n  top: 0;\n  pointer-events: none;\n  opacity: 0;\n  z-index: -1000;\n}\n/* IE10 Windows Phone 8 Fixes */\n.swiper-wp8-horizontal {\n  -ms-touch-action: pan-y;\n  touch-action: pan-y;\n}\n.swiper-wp8-vertical {\n  -ms-touch-action: pan-x;\n  touch-action: pan-x;\n}\n/* Arrows */\n.swiper-button-prev,\n.swiper-button-next {\n  position: absolute;\n  top: 50%;\n  width: 27px;\n  height: 44px;\n  margin-top: -22px;\n  z-index: 10;\n  cursor: pointer;\n  -moz-background-size: 27px 44px;\n  -webkit-background-size: 27px 44px;\n  background-size: 27px 44px;\n  background-position: center;\n  background-repeat: no-repeat;\n}\n.swiper-button-prev.swiper-button-disabled,\n.swiper-button-next.swiper-button-disabled {\n  opacity: 0.35;\n  cursor: auto;\n  pointer-events: none;\n}\n.swiper-button-prev,\n.swiper-container-rtl .swiper-button-next {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E\");\n  left: 10px;\n  right: auto;\n}\n.swiper-button-prev.swiper-button-black,\n.swiper-container-rtl .swiper-button-next.swiper-button-black {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E\");\n}\n.swiper-button-prev.swiper-button-white,\n.swiper-container-rtl .swiper-button-next.swiper-button-white {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M0%2C22L22%2C0l2.1%2C2.1L4.2%2C22l19.9%2C19.9L22%2C44L0%2C22L0%2C22L0%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E\");\n}\n.swiper-button-next,\n.swiper-container-rtl .swiper-button-prev {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23007aff'%2F%3E%3C%2Fsvg%3E\");\n  right: 10px;\n  left: auto;\n}\n.swiper-button-next.swiper-button-black,\n.swiper-container-rtl .swiper-button-prev.swiper-button-black {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23000000'%2F%3E%3C%2Fsvg%3E\");\n}\n.swiper-button-next.swiper-button-white,\n.swiper-container-rtl .swiper-button-prev.swiper-button-white {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2027%2044'%3E%3Cpath%20d%3D'M27%2C22L27%2C22L5%2C44l-2.1-2.1L22.8%2C22L2.9%2C2.1L5%2C0L27%2C22L27%2C22z'%20fill%3D'%23ffffff'%2F%3E%3C%2Fsvg%3E\");\n}\n/* Pagination Styles */\n.swiper-pagination {\n  position: absolute;\n  text-align: center;\n  -webkit-transition: 300ms;\n  -moz-transition: 300ms;\n  -o-transition: 300ms;\n  transition: 300ms;\n  -webkit-transform: translate3d(0, 0, 0);\n  -ms-transform: translate3d(0, 0, 0);\n  -o-transform: translate3d(0, 0, 0);\n  transform: translate3d(0, 0, 0);\n  z-index: 10;\n}\n.swiper-pagination.swiper-pagination-hidden {\n  opacity: 0;\n}\n.swiper-pagination-bullet {\n  width: 8px;\n  height: 8px;\n  display: inline-block;\n  border-radius: 100%;\n  background: #000;\n  opacity: 0.2;\n}\nbutton.swiper-pagination-bullet {\n  border: none;\n  margin: 0;\n  padding: 0;\n  box-shadow: none;\n  -moz-appearance: none;\n  -ms-appearance: none;\n  -webkit-appearance: none;\n  appearance: none;\n}\n.swiper-pagination-clickable .swiper-pagination-bullet {\n  cursor: pointer;\n}\n.swiper-pagination-white .swiper-pagination-bullet {\n  background: #fff;\n}\n.swiper-pagination-bullet-active {\n  opacity: 1;\n}\n.swiper-pagination-white .swiper-pagination-bullet-active {\n  background: #fff;\n}\n.swiper-pagination-black .swiper-pagination-bullet-active {\n  background: #000;\n}\n.swiper-container-vertical > .swiper-pagination {\n  right: 10px;\n  top: 50%;\n  -webkit-transform: translate3d(0px, -50%, 0);\n  -moz-transform: translate3d(0px, -50%, 0);\n  -o-transform: translate(0px, -50%);\n  -ms-transform: translate3d(0px, -50%, 0);\n  transform: translate3d(0px, -50%, 0);\n}\n.swiper-container-vertical > .swiper-pagination .swiper-pagination-bullet {\n  margin: 5px 0;\n  display: block;\n}\n.swiper-container-horizontal > .swiper-pagination {\n  bottom: 10px;\n  left: 0;\n  width: 100%;\n}\n.swiper-container-horizontal > .swiper-pagination .swiper-pagination-bullet {\n  margin: 0 5px;\n}\n/* 3D Container */\n.swiper-container-3d {\n  -webkit-perspective: 1200px;\n  -moz-perspective: 1200px;\n  -o-perspective: 1200px;\n  perspective: 1200px;\n}\n.swiper-container-3d .swiper-wrapper,\n.swiper-container-3d .swiper-slide,\n.swiper-container-3d .swiper-slide-shadow-left,\n.swiper-container-3d .swiper-slide-shadow-right,\n.swiper-container-3d .swiper-slide-shadow-top,\n.swiper-container-3d .swiper-slide-shadow-bottom,\n.swiper-container-3d .swiper-cube-shadow {\n  -webkit-transform-style: preserve-3d;\n  -moz-transform-style: preserve-3d;\n  -ms-transform-style: preserve-3d;\n  transform-style: preserve-3d;\n}\n.swiper-container-3d .swiper-slide-shadow-left,\n.swiper-container-3d .swiper-slide-shadow-right,\n.swiper-container-3d .swiper-slide-shadow-top,\n.swiper-container-3d .swiper-slide-shadow-bottom {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n  z-index: 10;\n}\n.swiper-container-3d .swiper-slide-shadow-left {\n  background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 16+, IE10, Opera 12.50+ */\n}\n.swiper-container-3d .swiper-slide-shadow-right {\n  background-image: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 16+, IE10, Opera 12.50+ */\n}\n.swiper-container-3d .swiper-slide-shadow-top {\n  background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 16+, IE10, Opera 12.50+ */\n}\n.swiper-container-3d .swiper-slide-shadow-bottom {\n  background-image: -webkit-gradient(linear, left bottom, left top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0)));\n  /* Safari 4+, Chrome */\n  background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Chrome 10+, Safari 5.1+, iOS 5+ */\n  background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 3.6-15 */\n  background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Opera 11.10-12.00 */\n  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0));\n  /* Firefox 16+, IE10, Opera 12.50+ */\n}\n/* Coverflow */\n.swiper-container-coverflow .swiper-wrapper {\n  /* Windows 8 IE 10 fix */\n  -ms-perspective: 1200px;\n}\n/* Fade */\n.swiper-container-fade.swiper-container-free-mode .swiper-slide {\n  -webkit-transition-timing-function: ease-out;\n  -moz-transition-timing-function: ease-out;\n  -ms-transition-timing-function: ease-out;\n  -o-transition-timing-function: ease-out;\n  transition-timing-function: ease-out;\n}\n.swiper-container-fade .swiper-slide {\n  pointer-events: none;\n}\n.swiper-container-fade .swiper-slide .swiper-slide {\n  pointer-events: none;\n}\n.swiper-container-fade .swiper-slide-active,\n.swiper-container-fade .swiper-slide-active .swiper-slide-active {\n  pointer-events: auto;\n}\n/* Cube */\n.swiper-container-cube {\n  overflow: visible;\n}\n.swiper-container-cube .swiper-slide {\n  pointer-events: none;\n  visibility: hidden;\n  -webkit-transform-origin: 0 0;\n  -moz-transform-origin: 0 0;\n  -ms-transform-origin: 0 0;\n  transform-origin: 0 0;\n  -webkit-backface-visibility: hidden;\n  -moz-backface-visibility: hidden;\n  -ms-backface-visibility: hidden;\n  backface-visibility: hidden;\n  width: 100%;\n  height: 100%;\n  z-index: 1;\n}\n.swiper-container-cube.swiper-container-rtl .swiper-slide {\n  -webkit-transform-origin: 100% 0;\n  -moz-transform-origin: 100% 0;\n  -ms-transform-origin: 100% 0;\n  transform-origin: 100% 0;\n}\n.swiper-container-cube .swiper-slide-active,\n.swiper-container-cube .swiper-slide-next,\n.swiper-container-cube .swiper-slide-prev,\n.swiper-container-cube .swiper-slide-next + .swiper-slide {\n  pointer-events: auto;\n  visibility: visible;\n}\n.swiper-container-cube .swiper-slide-shadow-top,\n.swiper-container-cube .swiper-slide-shadow-bottom,\n.swiper-container-cube .swiper-slide-shadow-left,\n.swiper-container-cube .swiper-slide-shadow-right {\n  z-index: 0;\n  -webkit-backface-visibility: hidden;\n  -moz-backface-visibility: hidden;\n  -ms-backface-visibility: hidden;\n  backface-visibility: hidden;\n}\n.swiper-container-cube .swiper-cube-shadow {\n  position: absolute;\n  left: 0;\n  bottom: 0px;\n  width: 100%;\n  height: 100%;\n  background: #000;\n  opacity: 0.6;\n  -webkit-filter: blur(50px);\n  filter: blur(50px);\n  z-index: 0;\n}\n/* Scrollbar */\n.swiper-scrollbar {\n  border-radius: 10px;\n  position: relative;\n  -ms-touch-action: none;\n  background: rgba(0, 0, 0, 0.1);\n}\n.swiper-container-horizontal > .swiper-scrollbar {\n  position: absolute;\n  left: 1%;\n  bottom: 3px;\n  z-index: 50;\n  height: 5px;\n  width: 98%;\n}\n.swiper-container-vertical > .swiper-scrollbar {\n  position: absolute;\n  right: 3px;\n  top: 1%;\n  z-index: 50;\n  width: 5px;\n  height: 98%;\n}\n.swiper-scrollbar-drag {\n  height: 100%;\n  width: 100%;\n  position: relative;\n  background: rgba(0, 0, 0, 0.5);\n  border-radius: 10px;\n  left: 0;\n  top: 0;\n}\n.swiper-scrollbar-cursor-drag {\n  cursor: move;\n}\n/* Preloader */\n.swiper-lazy-preloader {\n  width: 42px;\n  height: 42px;\n  position: absolute;\n  left: 50%;\n  top: 50%;\n  margin-left: -21px;\n  margin-top: -21px;\n  z-index: 10;\n  -webkit-transform-origin: 50%;\n  -moz-transform-origin: 50%;\n  transform-origin: 50%;\n  -webkit-animation: swiper-preloader-spin 1s steps(12, end) infinite;\n  -moz-animation: swiper-preloader-spin 1s steps(12, end) infinite;\n  animation: swiper-preloader-spin 1s steps(12, end) infinite;\n}\n.swiper-lazy-preloader:after {\n  display: block;\n  content: \"\";\n  width: 100%;\n  height: 100%;\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%236c6c6c'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E\");\n  background-position: 50%;\n  -webkit-background-size: 100%;\n  background-size: 100%;\n  background-repeat: no-repeat;\n}\n.swiper-lazy-preloader-white:after {\n  background-image: url(\"data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D'0%200%20120%20120'%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20xmlns%3Axlink%3D'http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink'%3E%3Cdefs%3E%3Cline%20id%3D'l'%20x1%3D'60'%20x2%3D'60'%20y1%3D'7'%20y2%3D'27'%20stroke%3D'%23fff'%20stroke-width%3D'11'%20stroke-linecap%3D'round'%2F%3E%3C%2Fdefs%3E%3Cg%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(30%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(60%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(90%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(120%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.27'%20transform%3D'rotate(150%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.37'%20transform%3D'rotate(180%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.46'%20transform%3D'rotate(210%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.56'%20transform%3D'rotate(240%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.66'%20transform%3D'rotate(270%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.75'%20transform%3D'rotate(300%2060%2C60)'%2F%3E%3Cuse%20xlink%3Ahref%3D'%23l'%20opacity%3D'.85'%20transform%3D'rotate(330%2060%2C60)'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E\");\n}\n@-webkit-keyframes swiper-preloader-spin {\n  100% {\n    -webkit-transform: rotate(360deg);\n  }\n}\n@keyframes swiper-preloader-spin {\n  100% {\n    transform: rotate(360deg);\n  }\n}\n\n\nion-slides {\n  width: 100%;\n  height: 100%;\n  display: block;\n}\n.slide-zoom {\n  display: block;\n  width: 100%;\n  text-align: center;\n}\n\n.swiper-container {\n  //position: absolute;\n  //left: 0;\n  //top: 0;\n  width: 100%;\n  height: 100%;\n  padding: 0;\n  //display: flex;\n  overflow: hidden;\n}\n\n.swiper-wrapper {\n  position: absolute;\n  left: 0;\n  top: 0;\n  width: 100%;\n  height: 100%;\n  padding: 0;\n  //display: flex;\n}\n\n.swiper-container {\n  //width: 100%;\n  //height: 100%;\n}\n\n.swiper-slide {\n  width: 100%;\n  height: 100%;\n\n  box-sizing: border-box;\n\n  //text-align: center;\n  //font-size: 18px;\n  //background: #fff;\n  /* Center slide text vertically */\n  //display: flex;\n  //justify-content: center;\n  //align-items: center;\n\n  img {\n    width: auto;\n    height: auto;\n    max-width: 100%;\n    max-height: 100%;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_spinner.scss",
    "content": "/**\n * Spinners\n * --------------------------------------------------\n */\n\n.spinner {\n  svg {\n    width: $spinner-width;\n    height: $spinner-height;\n  }\n\n  stroke: $spinner-default-stroke;\n  fill: $spinner-default-fill;\n\n  &.spinner-light {\n    stroke: $spinner-light-stroke;\n    fill: $spinner-light-fill;\n  }\n  &.spinner-stable {\n    stroke: $spinner-stable-stroke;\n    fill: $spinner-stable-fill;\n  }\n  &.spinner-positive {\n    stroke: $spinner-positive-stroke;\n    fill: $spinner-positive-fill;\n  }\n  &.spinner-calm {\n    stroke: $spinner-calm-stroke;\n    fill: $spinner-calm-fill;\n  }\n  &.spinner-balanced {\n    stroke: $spinner-balanced-stroke;\n    fill: $spinner-balanced-fill;\n  }\n  &.spinner-assertive {\n    stroke: $spinner-assertive-stroke;\n    fill: $spinner-assertive-fill;\n  }\n  &.spinner-energized {\n    stroke: $spinner-energized-stroke;\n    fill: $spinner-energized-fill;\n  }\n  &.spinner-royal {\n    stroke: $spinner-royal-stroke;\n    fill: $spinner-royal-fill;\n  }\n  &.spinner-dark {\n    stroke: $spinner-dark-stroke;\n    fill: $spinner-dark-fill;\n  }\n}\n\n.spinner-android {\n  stroke: #4b8bf4;\n}\n\n.spinner-ios,\n.spinner-ios-small {\n  stroke: #69717d;\n}\n\n.spinner-spiral {\n  .stop1 {\n    stop-color: $spinner-light-fill;\n    stop-opacity: 0;\n  }\n\n  &.spinner-light {\n    .stop1 {\n      stop-color: $spinner-default-fill;\n    }\n    .stop2 {\n      stop-color: $spinner-light-fill;\n    }\n  }\n  &.spinner-stable .stop2 {\n    stop-color: $spinner-stable-fill;\n  }\n  &.spinner-positive .stop2 {\n    stop-color: $spinner-positive-fill;\n  }\n  &.spinner-calm .stop2 {\n    stop-color: $spinner-calm-fill;\n  }\n  &.spinner-balanced .stop2 {\n    stop-color: $spinner-balanced-fill;\n  }\n  &.spinner-assertive .stop2 {\n    stop-color: $spinner-assertive-fill;\n  }\n  &.spinner-energized .stop2 {\n    stop-color: $spinner-energized-fill;\n  }\n  &.spinner-royal .stop2 {\n    stop-color: $spinner-royal-fill;\n  }\n  &.spinner-dark .stop2 {\n    stop-color: $spinner-dark-fill;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_tabs.scss",
    "content": "/**\n * Tabs\n * --------------------------------------------------\n * A navigation bar with any number of tab items supported.\n */\n\n.tabs {\n  @include display-flex();\n  @include flex-direction(horizontal);\n  @include justify-content(center);\n  @include translate3d(0,0,0);\n\n  @include tab-style($tabs-default-bg, $tabs-default-border, $tabs-default-text);\n  @include tab-badge-style($tabs-default-text, $tabs-default-bg);\n\n  position: absolute;\n  bottom: 0;\n\n  z-index: $z-index-tabs;\n\n  width: 100%;\n  height: $tabs-height;\n\n  border-style: solid;\n  border-top-width: 1px;\n\n  background-size: 0;\n  line-height: $tabs-height;\n\n  @media (min--moz-device-pixel-ratio: 1.5),\n         (-webkit-min-device-pixel-ratio: 1.5),\n         (min-device-pixel-ratio: 1.5),\n         (min-resolution: 144dpi),\n         (min-resolution: 1.5dppx) {\n    padding-top: 2px;\n    border-top: none !important;\n    border-bottom: none;\n    background-position: top;\n    background-size: 100% 1px;\n    background-repeat: no-repeat;\n  }\n\n}\n/* Allow parent element of tabs to define color, or just the tab itself */\n.tabs-light > .tabs,\n.tabs.tabs-light {\n  @include tab-style($tabs-light-bg, $tabs-light-border, $tabs-light-text);\n  @include tab-badge-style($tabs-light-text, $tabs-light-bg);\n}\n.tabs-stable > .tabs,\n.tabs.tabs-stable {\n  @include tab-style($tabs-stable-bg, $tabs-stable-border, $tabs-stable-text);\n  @include tab-badge-style($tabs-stable-text, $tabs-stable-bg);\n}\n.tabs-positive > .tabs,\n.tabs.tabs-positive {\n  @include tab-style($tabs-positive-bg, $tabs-positive-border, $tabs-positive-text);\n  @include tab-badge-style($tabs-positive-text, $tabs-positive-bg);\n}\n.tabs-calm > .tabs,\n.tabs.tabs-calm {\n  @include tab-style($tabs-calm-bg, $tabs-calm-border, $tabs-calm-text);\n  @include tab-badge-style($tabs-calm-text, $tabs-calm-bg);\n}\n.tabs-assertive > .tabs,\n.tabs.tabs-assertive {\n  @include tab-style($tabs-assertive-bg, $tabs-assertive-border, $tabs-assertive-text);\n  @include tab-badge-style($tabs-assertive-text, $tabs-assertive-bg);\n}\n.tabs-balanced > .tabs,\n.tabs.tabs-balanced {\n  @include tab-style($tabs-balanced-bg, $tabs-balanced-border, $tabs-balanced-text);\n  @include tab-badge-style($tabs-balanced-text, $tabs-balanced-bg);\n}\n.tabs-energized > .tabs,\n.tabs.tabs-energized {\n  @include tab-style($tabs-energized-bg, $tabs-energized-border, $tabs-energized-text);\n  @include tab-badge-style($tabs-energized-text, $tabs-energized-bg);\n}\n.tabs-royal > .tabs,\n.tabs.tabs-royal {\n  @include tab-style($tabs-royal-bg, $tabs-royal-border, $tabs-royal-text);\n  @include tab-badge-style($tabs-royal-text, $tabs-royal-bg);\n}\n.tabs-dark > .tabs,\n.tabs.tabs-dark {\n  @include tab-style($tabs-dark-bg, $tabs-dark-border, $tabs-dark-text);\n  @include tab-badge-style($tabs-dark-text, $tabs-dark-bg);\n}\n\n@mixin tabs-striped($style, $color, $background) {\n  &.#{$style} {\n    .tabs{\n      background-color: $background;\n    }\n    .tab-item {\n      color: rgba($color, $tabs-striped-off-opacity);\n      opacity: 1;\n      .badge{\n        opacity:$tabs-striped-off-opacity;\n      }\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        margin-top: -$tabs-striped-border-width;\n        color: $color;\n        border-style: solid;\n        border-width: $tabs-striped-border-width 0 0 0;\n        border-color: $color;\n      }\n    }\n  }\n  &.tabs-top{\n    .tab-item {\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        .badge {\n          top: 4%;\n        }\n      }\n    }\n  }\n}\n\n@mixin tabs-background($style, $color, $border-color) {\n  .#{$style} {\n    .tabs,\n    &> .tabs{\n      background-color: $color;\n      background-image: linear-gradient(0deg, $border-color, $border-color 50%, transparent 50%);\n      border-color: $border-color;\n    }\n  }\n}\n\n@mixin tabs-striped-background($style, $color) {\n  &.#{$style} {\n    .tabs {\n      background-color: $color;\n      background-image:none;\n    }\n  }\n}\n\n@mixin tabs-color($style, $color) {\n  .#{$style} {\n    .tab-item {\n      color: rgba($color, $tabs-off-opacity);\n      opacity: 1;\n      .badge{\n        opacity:$tabs-off-opacity;\n      }\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        color: $color;\n        border: 0 solid $color;\n        .badge{\n          opacity: 1;\n        }\n      }\n    }\n  }\n}\n\n@mixin tabs-striped-color($style, $color) {\n  &.#{$style} {\n    .tab-item {\n      color: rgba($color, $tabs-striped-off-opacity);\n      opacity: 1;\n      .badge{\n        opacity:$tabs-striped-off-opacity;\n      }\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        margin-top: -$tabs-striped-border-width;\n        color: $color;\n        border: 0 solid $color;\n        border-top-width: $tabs-striped-border-width;\n        .badge{\n          top:$tabs-striped-border-width;\n          opacity: 1;\n        }\n      }\n    }\n  }\n}\n\n.tabs-striped {\n  .tabs {\n    background-color: white;\n    background-image: none;\n    border: none;\n    border-bottom: 1px solid #ddd;\n    padding-top: $tabs-striped-border-width;\n  }\n  .tab-item {\n    // default android tab style\n    &.tab-item-active,\n    &.active,\n    &.activated {\n      margin-top: -$tabs-striped-border-width;\n      border-style: solid;\n      border-width: $tabs-striped-border-width 0 0 0;\n      border-color: $dark;\n      .badge{\n        top:$tabs-striped-border-width;\n        opacity: 1;\n      }\n    }\n  }\n  @include tabs-striped('tabs-light', $dark, $light);\n  @include tabs-striped('tabs-stable', $dark, $stable);\n  @include tabs-striped('tabs-positive', $light, $positive);\n  @include tabs-striped('tabs-calm', $light, $calm);\n  @include tabs-striped('tabs-assertive', $light, $assertive);\n  @include tabs-striped('tabs-balanced', $light, $balanced);\n  @include tabs-striped('tabs-energized', $light, $energized);\n  @include tabs-striped('tabs-royal', $light, $royal);\n  @include tabs-striped('tabs-dark', $light, $dark);\n\n  // doing this twice so striped tabs styles don't override specific bg and color vals\n  @include tabs-striped-background('tabs-background-light', $light);\n  @include tabs-striped-background('tabs-background-stable', $stable);\n  @include tabs-striped-background('tabs-background-positive', $positive);\n  @include tabs-striped-background('tabs-background-calm', $calm);\n  @include tabs-striped-background('tabs-background-assertive', $assertive);\n  @include tabs-striped-background('tabs-background-balanced', $balanced);\n  @include tabs-striped-background('tabs-background-energized',$energized);\n  @include tabs-striped-background('tabs-background-royal', $royal);\n  @include tabs-striped-background('tabs-background-dark', $dark);\n\n  @include tabs-striped-color('tabs-color-light', $light);\n  @include tabs-striped-color('tabs-color-stable', $stable);\n  @include tabs-striped-color('tabs-color-positive', $positive);\n  @include tabs-striped-color('tabs-color-calm', $calm);\n  @include tabs-striped-color('tabs-color-assertive', $assertive);\n  @include tabs-striped-color('tabs-color-balanced', $balanced);\n  @include tabs-striped-color('tabs-color-energized',$energized);\n  @include tabs-striped-color('tabs-color-royal', $royal);\n  @include tabs-striped-color('tabs-color-dark', $dark);\n\n}\n\n@include tabs-background('tabs-background-light', $light, $bar-light-border);\n@include tabs-background('tabs-background-stable', $stable, $bar-stable-border);\n@include tabs-background('tabs-background-positive', $positive, $bar-positive-border);\n@include tabs-background('tabs-background-calm', $calm, $bar-calm-border);\n@include tabs-background('tabs-background-assertive', $assertive, $bar-assertive-border);\n@include tabs-background('tabs-background-balanced', $balanced, $bar-balanced-border);\n@include tabs-background('tabs-background-energized',$energized, $bar-energized-border);\n@include tabs-background('tabs-background-royal', $royal, $bar-royal-border);\n@include tabs-background('tabs-background-dark', $dark, $bar-dark-border);\n\n@include tabs-color('tabs-color-light', $light);\n@include tabs-color('tabs-color-stable', $stable);\n@include tabs-color('tabs-color-positive', $positive);\n@include tabs-color('tabs-color-calm', $calm);\n@include tabs-color('tabs-color-assertive', $assertive);\n@include tabs-color('tabs-color-balanced', $balanced);\n@include tabs-color('tabs-color-energized',$energized);\n@include tabs-color('tabs-color-royal', $royal);\n@include tabs-color('tabs-color-dark', $dark);\n\n@mixin tabs-standard-color($style, $color, $off-color:$dark) {\n  &.#{$style} {\n    .tab-item {\n      color: $off-color;\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        color: $color;\n      }\n    }\n\n  }\n\n  &.tabs-striped.#{$style} {\n    .tab-item {\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        border-color: $color;\n        color: $color;\n      }\n    }\n\n  }\n\n}\n\nion-tabs {\n  @include tabs-standard-color('tabs-color-active-light', $light, $dark);\n  @include tabs-standard-color('tabs-color-active-stable', $stable, $dark);\n  @include tabs-standard-color('tabs-color-active-positive', $positive, $dark);\n  @include tabs-standard-color('tabs-color-active-calm', $calm, $dark);\n  @include tabs-standard-color('tabs-color-active-assertive', $assertive, $dark);\n  @include tabs-standard-color('tabs-color-active-balanced', $balanced, $dark);\n  @include tabs-standard-color('tabs-color-active-energized',$energized, $dark);\n  @include tabs-standard-color('tabs-color-active-royal', $royal, $dark);\n  @include tabs-standard-color('tabs-color-active-dark', $dark, $light);\n}\n\n.tabs-top {\n  &.tabs-striped {\n    padding-bottom:0;\n    .tab-item{\n      background: transparent;\n      // animate the top bar, leave bottom for platform consistency\n      -webkit-transition: color .1s ease;\n      -moz-transition: color .1s ease;\n      -ms-transition: color .1s ease;\n      -o-transition: color .1s ease;\n      transition: color .1s ease;\n      &.tab-item-active,\n      &.active,\n      &.activated {\n        margin-top: $tabs-striped-border-width - 1px;\n        border-width: 0px 0px $tabs-striped-border-width 0px !important;\n        border-style: solid;\n        > .badge, > i{\n          margin-top: -$tabs-striped-border-width + 1px;\n        }\n      }\n      .badge{\n        -webkit-transition: color .2s ease;\n        -moz-transition: color .2s ease;\n        -ms-transition: color .2s ease;\n        -o-transition: color .2s ease;\n        transition: color .2s ease;\n      }\n    }\n   &:not(.tabs-icon-left):not(.tabs-icon-top){\n       .tab-item{\n          &.tab-item-active,\n          &.active,\n          &.activated {\n             .tab-title, i{\n            display:block;\n            margin-top: -$tabs-striped-border-width + 1px;\n          }\n        }\n      }\n    }\n    &.tabs-icon-left{\n       .tab-item{\n          margin-top: 1px;\n          &.tab-item-active,\n          &.active,\n          &.activated {\n            .tab-title, i {\n              margin-top: -0.1em;\n          }\n        }\n      }\n    }\n  }\n}\n\n/* Allow parent element to have tabs-top */\n/* If you change this, change platform.scss as well */\n.tabs-top > .tabs,\n.tabs.tabs-top {\n  top: $bar-height;\n  padding-top: 0;\n  background-position: bottom;\n  border-top-width: 0;\n  border-bottom-width: 1px;\n  .tab-item {\n    &.tab-item-active,\n    &.active,\n    &.activated {\n      .badge {\n        top: 4%;\n      }\n    }\n  }\n}\n.tabs-top ~ .bar-header {\n  border-bottom-width: 0;\n}\n\n.tab-item {\n  @include flex(1);\n  display: block;\n  overflow: hidden;\n\n  max-width: $tab-item-max-width;\n  height: 100%;\n\n  color: inherit;\n  text-align: center;\n  text-decoration: none;\n  text-overflow: ellipsis;\n  white-space: nowrap;\n\n  font-weight: 400;\n  font-size: $tabs-text-font-size;\n  font-family: $font-family-sans-serif;\n\n  opacity: 0.7;\n\n  &:hover {\n    cursor: pointer;\n  }\n  &.tab-hidden{\n    display:none;\n  }\n}\n\n.tabs-item-hide > .tabs,\n.tabs.tabs-item-hide {\n  display: none;\n}\n\n.tabs-icon-top > .tabs .tab-item,\n.tabs-icon-top.tabs .tab-item,\n.tabs-icon-bottom > .tabs .tab-item,\n.tabs-icon-bottom.tabs .tab-item {\n  font-size: $tabs-text-font-size-side-icon;\n  line-height: $tabs-text-font-size;\n}\n\n.tab-item .icon {\n  display: block;\n  margin: 0 auto;\n  height: $tabs-icon-size;\n  font-size: $tabs-icon-size;\n}\n\n.tabs-icon-left.tabs .tab-item,\n.tabs-icon-left > .tabs .tab-item,\n.tabs-icon-right.tabs .tab-item,\n.tabs-icon-right > .tabs .tab-item {\n  font-size: $tabs-text-font-size-side-icon;\n\n  .icon, .tab-title {\n    display: inline-block;\n    vertical-align: top;\n    margin-top: -.1em;\n\n    &:before {\n    font-size: $tabs-icon-size - 8;\n    line-height: $tabs-height;\n    }\n  }\n}\n\n.tabs-icon-left > .tabs .tab-item .icon,\n.tabs-icon-left.tabs .tab-item .icon {\n  padding-right: 3px;\n}\n\n.tabs-icon-right > .tabs .tab-item .icon,\n.tabs-icon-right.tabs .tab-item .icon {\n  padding-left: 3px;\n}\n\n.tabs-icon-only > .tabs .icon,\n.tabs-icon-only.tabs .icon {\n  line-height: inherit;\n}\n\n\n.tab-item.has-badge {\n  position: relative;\n}\n\n.tab-item .badge {\n  position: absolute;\n  top: 4%;\n  right: 33%; // fallback\n  right: calc(50% - 26px);\n  padding: $tabs-badge-padding;\n  height: auto;\n  font-size: $tabs-badge-font-size;\n  line-height: $tabs-badge-font-size + 4;\n}\n\n\n/* Navigational tab */\n\n/* Active state for tab */\n.tab-item.tab-item-active,\n.tab-item.active,\n.tab-item.activated {\n  opacity: 1;\n\n  &.tab-item-light {\n    color: $light;\n  }\n  &.tab-item-stable {\n    color: $stable;\n  }\n  &.tab-item-positive {\n    color: $positive;\n  }\n  &.tab-item-calm {\n    color: $calm;\n  }\n  &.tab-item-assertive {\n    color: $assertive;\n  }\n  &.tab-item-balanced {\n    color: $balanced;\n  }\n  &.tab-item-energized {\n    color: $energized;\n  }\n  &.tab-item-royal {\n    color: $royal;\n  }\n  &.tab-item-dark {\n    color: $dark;\n  }\n}\n\n.item.tabs {\n  @include display-flex();\n  padding: 0;\n\n  .icon:before {\n    position: relative;\n  }\n}\n\n.tab-item.disabled,\n.tab-item[disabled] {\n  opacity: .4;\n  cursor: default;\n  pointer-events: none;\n}\n\n.nav-bar-tabs-top.hide ~ .view-container .tabs-top .tabs{\n  top: 0\n}\n.pane[hide-nav-bar=\"true\"] .has-tabs-top{\n  top:$tabs-height\n}\n\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_toggle.scss",
    "content": "\n/**\n * Toggle\n * --------------------------------------------------\n */\n\n.item-toggle {\n  pointer-events: none;\n}\n\n.toggle {\n  // set the color defaults\n  @include toggle-style($toggle-on-default-border, $toggle-on-default-bg);\n\n  position: relative;\n  display: inline-block;\n  pointer-events: auto;\n  margin: -$toggle-hit-area-expansion;\n  padding: $toggle-hit-area-expansion;\n\n  &.dragging {\n    .handle {\n      background-color: $toggle-handle-dragging-bg-color !important;\n    }\n  }\n\n}\n\n.toggle {\n  &.toggle-light  {\n    @include toggle-style($toggle-on-light-border, $toggle-on-light-bg);\n  }\n  &.toggle-stable  {\n    @include toggle-style($toggle-on-stable-border, $toggle-on-stable-bg);\n  }\n  &.toggle-positive  {\n    @include toggle-style($toggle-on-positive-border, $toggle-on-positive-bg);\n  }\n  &.toggle-calm  {\n    @include toggle-style($toggle-on-calm-border, $toggle-on-calm-bg);\n  }\n  &.toggle-assertive  {\n    @include toggle-style($toggle-on-assertive-border, $toggle-on-assertive-bg);\n  }\n  &.toggle-balanced  {\n    @include toggle-style($toggle-on-balanced-border, $toggle-on-balanced-bg);\n  }\n  &.toggle-energized  {\n    @include toggle-style($toggle-on-energized-border, $toggle-on-energized-bg);\n  }\n  &.toggle-royal  {\n    @include toggle-style($toggle-on-royal-border, $toggle-on-royal-bg);\n  }\n  &.toggle-dark  {\n    @include toggle-style($toggle-on-dark-border, $toggle-on-dark-bg);\n  }\n}\n\n.toggle input {\n  // hide the actual input checkbox\n  display: none;\n}\n\n/* the track appearance when the toggle is \"off\" */\n.toggle .track {\n  @include transition-timing-function(ease-in-out);\n  @include transition-duration($toggle-transition-duration);\n  @include transition-property((background-color, border));\n\n  display: inline-block;\n  box-sizing: border-box;\n  width: $toggle-width;\n  height: $toggle-height;\n  border: solid $toggle-border-width $toggle-off-border-color;\n  border-radius: $toggle-border-radius;\n  background-color: $toggle-off-bg-color;\n  content: ' ';\n  cursor: pointer;\n  pointer-events: none;\n}\n\n/* Fix to avoid background color bleeding */\n/* (occurred on (at least) Android 4.2, Asus MeMO Pad HD7 ME173X) */\n.platform-android4_2 .toggle .track {\n  -webkit-background-clip: padding-box;\n}\n\n/* the handle (circle) thats inside the toggle's track area */\n/* also the handle's appearance when it is \"off\" */\n.toggle .handle {\n  @include transition($toggle-transition-duration cubic-bezier(0, 1.1, 1, 1.1));\n  @include transition-property((background-color, transform));\n  position: absolute;\n  display: block;\n  width: $toggle-handle-width;\n  height: $toggle-handle-height;\n  border-radius: $toggle-handle-radius;\n  background-color: $toggle-handle-off-bg-color;\n  top: $toggle-border-width + $toggle-hit-area-expansion;\n  left: $toggle-border-width + $toggle-hit-area-expansion;\n  box-shadow: 0 2px 7px rgba(0,0,0,.35), 0 1px 1px rgba(0,0,0,.15);\n\n  &:before {\n    // used to create a larger (but hidden) hit area to slide the handle\n    position: absolute;\n    top: -4px;\n    left: ( ($toggle-handle-width / 2) * -1) - 8;\n    padding: ($toggle-handle-height / 2) + 5 ($toggle-handle-width + 7);\n    content: \" \";\n  }\n}\n\n.toggle input:checked + .track .handle {\n  // the handle when the toggle is \"on\"\n  @include translate3d($toggle-width - $toggle-handle-width - ($toggle-border-width * 2), 0, 0);\n  background-color: $toggle-handle-on-bg-color;\n}\n\n.item-toggle.active {\n  box-shadow: none;\n}\n\n.item-toggle,\n.item-toggle.item-complex .item-content {\n  // make sure list item content have enough padding on right to fit the toggle\n  padding-right: ($item-padding * 3) + $toggle-width;\n}\n\n.item-toggle.item-complex {\n  padding-right: 0;\n}\n\n.item-toggle .toggle {\n  // position the toggle to the right within a list item\n  position: absolute;\n  top: ($item-padding / 2) + 2;\n  right: $item-padding;\n  z-index: $z-index-item-toggle;\n}\n\n.toggle input:disabled + .track {\n  opacity: .6;\n}\n\n.toggle-small {\n\n  .track {\n    border: 0;\n    width: 34px;\n    height: 15px;\n    background: #9e9e9e;\n  }\n  input:checked + .track {\n    background: rgba(0,150,137,.5);\n  }\n  .handle {\n    top: 2px;\n    left: 4px;\n    width: 21px;\n    height: 21px;\n    box-shadow: 0 2px 5px rgba(0,0,0,.25);\n  }\n  input:checked + .track .handle {\n    @include translate3d(16px, 0, 0);\n    background: rgb(0,150,137);\n  }\n  &.item-toggle .toggle {\n    top: 19px;\n  }\n\n  .toggle-light  {\n    @include toggle-small-style($toggle-on-light-bg);\n  }\n  .toggle-stable  {\n    @include toggle-small-style($toggle-on-stable-bg);\n  }\n  .toggle-positive  {\n    @include toggle-small-style($toggle-on-positive-bg);\n  }\n  .toggle-calm  {\n    @include toggle-small-style($toggle-on-calm-bg);\n  }\n  .toggle-assertive  {\n    @include toggle-small-style($toggle-on-assertive-bg);\n  }\n  .toggle-balanced  {\n    @include toggle-small-style($toggle-on-balanced-bg);\n  }\n  .toggle-energized  {\n    @include toggle-small-style($toggle-on-energized-bg);\n  }\n  .toggle-royal  {\n    @include toggle-small-style($toggle-on-royal-bg);\n  }\n  .toggle-dark  {\n    @include toggle-small-style($toggle-on-dark-bg);\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_transitions.scss",
    "content": "\n// iOS View Transitions\n// -------------------------------\n\n$ios-transition-duration:              500ms !default;\n$ios-transition-timing-function:       cubic-bezier(.36, .66, .04, 1) !default;\n$ios-transition-container-bg-color:    #000 !default;\n\n\n[nav-view-transition=\"ios\"] {\n\n  [nav-view=\"entering\"],\n  [nav-view=\"leaving\"] {\n    @include transition-duration( $ios-transition-duration );\n    @include transition-timing-function( $ios-transition-timing-function );\n    -webkit-transition-property: opacity, -webkit-transform, box-shadow;\n            transition-property: opacity, transform, box-shadow;\n  }\n\n  &[nav-view-direction=\"forward\"],\n  &[nav-view-direction=\"back\"] {\n    background-color: $ios-transition-container-bg-color;\n  }\n\n  [nav-view=\"active\"],\n  &[nav-view-direction=\"forward\"] [nav-view=\"entering\"],\n  &[nav-view-direction=\"back\"] [nav-view=\"leaving\"] {\n    z-index: $z-index-view-above;\n  }\n\n  &[nav-view-direction=\"back\"] [nav-view=\"entering\"],\n  &[nav-view-direction=\"forward\"] [nav-view=\"leaving\"] {\n    z-index: $z-index-view-below;\n  }\n\n}\n\n\n\n// iOS Nav Bar Transitions\n// -------------------------------\n\n[nav-bar-transition=\"ios\"] {\n\n  .title,\n  .buttons,\n  .back-text {\n    @include transition-duration( $ios-transition-duration );\n    @include transition-timing-function( $ios-transition-timing-function );\n    -webkit-transition-property: opacity, -webkit-transform;\n            transition-property: opacity, transform;\n  }\n\n  [nav-bar=\"active\"],\n  [nav-bar=\"entering\"] {\n    z-index: $z-index-bar-above;\n\n   .bar {\n      background: transparent;\n    }\n  }\n\n  [nav-bar=\"cached\"] {\n    display: block;\n\n    .header-item {\n      display: none;\n    }\n  }\n\n}\n\n\n\n// Android View Transitions\n// -------------------------------\n\n$android-transition-duration:             200ms !default;\n$android-transition-timing-function:      cubic-bezier(0.4, 0.6, 0.2, 1) !default;\n\n\n[nav-view-transition=\"android\"] {\n\n  [nav-view=\"entering\"],\n  [nav-view=\"leaving\"] {\n    @include transition-duration( $android-transition-duration );\n    @include transition-timing-function( $android-transition-timing-function );\n    -webkit-transition-property: -webkit-transform;\n            transition-property: transform;\n  }\n\n  [nav-view=\"active\"],\n  &[nav-view-direction=\"forward\"] [nav-view=\"entering\"],\n  &[nav-view-direction=\"back\"] [nav-view=\"leaving\"] {\n    z-index: $z-index-view-above;\n  }\n\n  &[nav-view-direction=\"back\"] [nav-view=\"entering\"],\n  &[nav-view-direction=\"forward\"] [nav-view=\"leaving\"] {\n    z-index: $z-index-view-below;\n  }\n\n}\n\n\n\n// Android Nav Bar Transitions\n// -------------------------------\n\n[nav-bar-transition=\"android\"] {\n\n  .title,\n  .buttons {\n    @include transition-duration( $android-transition-duration );\n    @include transition-timing-function( $android-transition-timing-function );\n    -webkit-transition-property: opacity;\n            transition-property: opacity;\n  }\n\n  [nav-bar=\"active\"],\n  [nav-bar=\"entering\"] {\n    z-index: $z-index-bar-above;\n\n   .bar {\n      background: transparent;\n    }\n  }\n\n  [nav-bar=\"cached\"] {\n    display: block;\n\n    .header-item {\n      display: none;\n    }\n  }\n\n}\n\n\n\n// Nav Swipe\n// -------------------------------\n\n[nav-swipe=\"fast\"] {\n  [nav-view],\n  .title,\n  .buttons,\n  .back-text {\n    @include transition-duration(50ms);\n    @include transition-timing-function(linear);\n  }\n}\n\n[nav-swipe=\"slow\"] {\n  [nav-view],\n  .title,\n  .buttons,\n  .back-text {\n    @include transition-duration(160ms);\n    @include transition-timing-function(linear);\n  }\n}\n\n\n\n// Transition Settings\n// -------------------------------\n\n[nav-view=\"cached\"],\n[nav-bar=\"cached\"] {\n  display: none;\n}\n\n[nav-view=\"stage\"] {\n  opacity: 0;\n  @include transition-duration( 0 );\n}\n\n[nav-bar=\"stage\"] {\n  .title,\n  .buttons,\n  .back-text {\n    position: absolute;\n    opacity: 0;\n    @include transition-duration(0s);\n  }\n}\n\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_type.scss",
    "content": "\n/**\n * Typography\n * --------------------------------------------------\n */\n\n\n// Body text\n// -------------------------\n\np {\n  margin: 0 0 ($line-height-computed / 2);\n}\n\n\n// Emphasis & misc\n// -------------------------\n\nsmall   { font-size: 85%; }\ncite    { font-style: normal; }\n\n\n// Alignment\n// -------------------------\n\n.text-left           { text-align: left; }\n.text-right          { text-align: right; }\n.text-center         { text-align: center; }\n\n\n// Headings\n// -------------------------\n\nh1, h2, h3, h4, h5, h6,\n.h1, .h2, .h3, .h4, .h5, .h6 {\n  color: $base-color;\n  font-weight: $headings-font-weight;\n  font-family: $headings-font-family;\n  line-height: $headings-line-height;\n\n  small {\n    font-weight: normal;\n    line-height: 1;\n  }\n}\n\nh1, .h1,\nh2, .h2,\nh3, .h3 {\n  margin-top: $line-height-computed;\n  margin-bottom: ($line-height-computed / 2);\n\n  &:first-child {\n    margin-top: 0;\n  }\n\n  + h1, + .h1,\n  + h2, + .h2,\n  + h3, + .h3 {\n    margin-top: ($line-height-computed / 2);\n  }\n}\n\nh4, .h4,\nh5, .h5,\nh6, .h6 {\n  margin-top: ($line-height-computed / 2);\n  margin-bottom: ($line-height-computed / 2);\n}\n\nh1, .h1 { font-size: floor($font-size-base * 2.60); } // ~36px\nh2, .h2 { font-size: floor($font-size-base * 2.15); } // ~30px\nh3, .h3 { font-size: ceil($font-size-base * 1.70); } // ~24px\nh4, .h4 { font-size: ceil($font-size-base * 1.25); } // ~18px\nh5, .h5 { font-size:  $font-size-base; }\nh6, .h6 { font-size: ceil($font-size-base * 0.85); } // ~12px\n\nh1 small, .h1 small { font-size: ceil($font-size-base * 1.70); } // ~24px\nh2 small, .h2 small { font-size: ceil($font-size-base * 1.25); } // ~18px\nh3 small, .h3 small,\nh4 small, .h4 small { font-size: $font-size-base; }\n\n\n// Description Lists\n// -------------------------\n\ndl {\n  margin-bottom: $line-height-computed;\n}\ndt,\ndd {\n  line-height: $line-height-base;\n}\ndt {\n  font-weight: bold;\n}\n\n\n// Blockquotes\n// -------------------------\n\nblockquote {\n  margin: 0 0 $line-height-computed;\n  padding: ($line-height-computed / 2) $line-height-computed;\n  border-left: 5px solid gray;\n\n  p {\n    font-weight: 300;\n    font-size: ($font-size-base * 1.25);\n    line-height: 1.25;\n  }\n\n  p:last-child {\n    margin-bottom: 0;\n  }\n\n  small {\n    display: block;\n    line-height: $line-height-base;\n    &:before {\n      content: '\\2014 \\00A0';// EM DASH, NBSP;\n    }\n  }\n}\n\n\n// Quotes\n// -------------------------\n\nq:before,\nq:after,\nblockquote:before,\nblockquote:after {\n  content: \"\";\n}\n\n\n// Addresses\n// -------------------------\n\naddress {\n  display: block;\n  margin-bottom: $line-height-computed;\n  font-style: normal;\n  line-height: $line-height-base;\n}\n\n\n// Links\n// -------------------------\na {\n  color: $link-color;\n}\n\na.subdued {\n  padding-right: 10px;\n  color: #888;\n  text-decoration: none;\n\n  &:hover {\n    text-decoration: none;\n  }\n  &:last-child {\n    padding-right: 0;\n  }\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_util.scss",
    "content": "\n/**\n * Utility Classes\n * --------------------------------------------------\n */\n\n.hide {\n  display: none;\n}\n.opacity-hide {\n  opacity: 0;\n}\n.grade-b .opacity-hide,\n.grade-c .opacity-hide {\n  opacity: 1;\n  display: none;\n}\n.show {\n  display: block;\n}\n.opacity-show {\n  opacity: 1;\n}\n.invisible {\n  visibility: hidden;\n}\n\n.keyboard-open .hide-on-keyboard-open {\n  display: none;\n}\n\n.keyboard-open .tabs.hide-on-keyboard-open + .pane .has-tabs,\n.keyboard-open .bar-footer.hide-on-keyboard-open + .pane .has-footer {\n  bottom: 0;\n}\n\n.inline {\n  display: inline-block;\n}\n\n.disable-pointer-events {\n  pointer-events: none;\n}\n\n.enable-pointer-events {\n  pointer-events: auto;\n}\n\n.disable-user-behavior {\n  // used to prevent the browser from doing its native behavior. this doesnt\n  // prevent the scrolling, but cancels the contextmenu, tap highlighting, etc\n\n  @include user-select(none);\n  @include touch-callout(none);\n  @include tap-highlight-transparent();\n\n  -webkit-user-drag: none;\n\n  -ms-touch-action: none;\n  -ms-content-zooming: none;\n}\n\n// Fill the screen to block clicks (a better pointer-events: none) for the body\n// to avoid full-page reflows and paints which can cause flickers\n.click-block {\n  position: absolute;\n  top: 0;\n  right: 0;\n  bottom: 0;\n  left: 0;\n  opacity: 0;\n  z-index: $z-index-click-block;\n  @include translate3d(0, 0, 0);\n  overflow: hidden;\n}\n.click-block-hide {\n  @include translate3d(-9999px, 0, 0);\n}\n\n.no-resize {\n  resize: none;\n}\n\n.block {\n  display: block;\n  clear: both;\n  &:after {\n    display: block;\n    visibility: hidden;\n    clear: both;\n    height: 0;\n    content: \".\";\n  }\n}\n\n.full-image {\n  width: 100%;\n}\n\n.clearfix {\n  *zoom: 1;\n  &:before,\n  &:after {\n    display: table;\n    content: \"\";\n    // Fixes Opera/contenteditable bug:\n    // http://nicolasgallagher.com/micro-clearfix-hack/#comment-36952\n    line-height: 0;\n  }\n  &:after {\n    clear: both;\n  }\n}\n\n/**\n * Content Padding\n * --------------------------------------------------\n */\n\n.padding {\n  padding: $content-padding;\n}\n\n.padding-top,\n.padding-vertical {\n  padding-top: $content-padding;\n}\n\n.padding-right,\n.padding-horizontal {\n  padding-right: $content-padding;\n}\n\n.padding-bottom,\n.padding-vertical {\n  padding-bottom: $content-padding;\n}\n\n.padding-left,\n.padding-horizontal {\n  padding-left: $content-padding;\n}\n\n\n/**\n * Scrollable iFrames\n * --------------------------------------------------\n */\n\n.iframe-wrapper {\n  position: fixed;\n  -webkit-overflow-scrolling: touch;\n  overflow: scroll;\n\n  iframe {\n    height: 100%;\n    width: 100%;\n  }\n}\n\n\n/**\n * Rounded\n * --------------------------------------------------\n */\n\n.rounded {\n  border-radius: $border-radius-base;\n}\n\n\n/**\n * Utility Colors\n * --------------------------------------------------\n * Utility colors are added to help set a naming convention. You'll\n * notice we purposely do not use words like \"red\" or \"blue\", but\n * instead have colors which represent an emotion or generic theme.\n */\n\n.light, a.light {\n  color: $light;\n}\n.light-bg {\n  background-color: $light;\n}\n.light-border {\n  border-color: $button-light-border;\n}\n\n.stable, a.stable {\n  color: $stable;\n}\n.stable-bg {\n  background-color: $stable;\n}\n.stable-border {\n  border-color: $button-stable-border;\n}\n\n.positive, a.positive {\n  color: $positive;\n}\n.positive-bg {\n  background-color: $positive;\n}\n.positive-border {\n  border-color: $button-positive-border;\n}\n\n.calm, a.calm {\n  color: $calm;\n}\n.calm-bg {\n  background-color: $calm;\n}\n.calm-border {\n  border-color: $button-calm-border;\n}\n\n.assertive, a.assertive {\n  color: $assertive;\n}\n.assertive-bg {\n  background-color: $assertive;\n}\n.assertive-border {\n  border-color: $button-assertive-border;\n}\n\n.balanced, a.balanced {\n  color: $balanced;\n}\n.balanced-bg {\n  background-color: $balanced;\n}\n.balanced-border {\n  border-color: $button-balanced-border;\n}\n\n.energized, a.energized {\n  color: $energized;\n}\n.energized-bg {\n  background-color: $energized;\n}\n.energized-border {\n  border-color: $button-energized-border;\n}\n\n.royal, a.royal {\n  color: $royal;\n}\n.royal-bg {\n  background-color: $royal;\n}\n.royal-border {\n  border-color: $button-royal-border;\n}\n\n.dark, a.dark {\n  color: $dark;\n}\n.dark-bg {\n  background-color: $dark;\n}\n.dark-border {\n  border-color: $button-dark-border;\n}\n\n[collection-repeat] {\n  /* Position is set by transforms */\n  left: 0 !important;\n  top: 0 !important;\n  position: absolute !important;\n  z-index: 1;\n}\n.collection-repeat-container {\n  position: relative;\n  z-index: 1; //make sure it's above the after-container\n}\n.collection-repeat-after-container {\n  z-index: 0;\n  display: block;\n\n  /* when scrolling horizontally, make sure the after container doesn't take up 100% width */\n  &.horizontal {\n    display: inline-block;\n  }\n}\n\n// ng-show fix for windows phone\n// https://www.hoessl.eu/2014/12/on-using-the-ionic-framework-for-windows-phone-8-1-apps/\n[ng\\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak,\n.x-ng-cloak, .ng-hide:not(.ng-hide-animate) {\n  display: none !important;\n}"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/_variables.scss",
    "content": "\n// Colors\n// -------------------------------\n\n$light:                           #fff !default;\n$stable:                          #f8f8f8 !default;\n$positive:                        #387ef5 !default;\n$calm:                            #11c1f3 !default;\n$balanced:                        #33cd5f !default;\n$energized:                       #ffc900 !default;\n$assertive:                       #ef473a !default;\n$royal:                           #886aea !default;\n$dark:                            #444 !default;\n\n\n// Base\n// -------------------------------\n\n$font-family-sans-serif:           '-apple-system', \"Helvetica Neue\", \"Roboto\", \"Segoe UI\", sans-serif !default;\n\n$font-family-light-sans-serif:    '-apple-system', \"HelveticaNeue-Light\", \"Roboto-Light\", \"Segoe UI-Light\", sans-serif-light !default;\n$font-family-serif:               serif !default;\n$font-family-monospace:           monospace !default;\n\n$font-family-base:                $font-family-sans-serif !default;\n$font-size-base:                  14px !default;\n$font-size-large:                 18px !default;\n$font-size-small:                 11px !default;\n\n$line-height-base:                1.428571429 !default; // 20/14\n$line-height-computed:            floor($font-size-base * $line-height-base) !default; // ~20px\n$line-height-large:               1.33 !default;\n$line-height-small:               1.5 !default;\n\n$headings-font-family:            $font-family-base !default;\n$headings-font-weight:            500 !default;\n$headings-line-height:            1.2 !default;\n\n$base-background-color:           #fff !default;\n$base-color:                      #000 !default;\n\n$link-color:                      $positive !default;\n$link-hover-color:                darken($link-color, 15%) !default;\n\n$content-padding:                 10px !default;\n\n$padding-base-vertical:           6px !default;\n$padding-base-horizontal:         12px !default;\n\n$padding-large-vertical:          10px !default;\n$padding-large-horizontal:        16px !default;\n\n$padding-small-vertical:          5px !default;\n$padding-small-horizontal:        10px !default;\n\n$border-radius-base:              4px !default;\n$border-radius-large:             6px !default;\n$border-radius-small:             3px !default;\n\n\n// Content\n// -------------------------------\n\n$scroll-refresh-icon-color:       #666666 !default;\n\n\n// Buttons\n// -------------------------------\n\n$button-color:                    #222 !default;\n$button-block-margin:             10px !default;\n$button-clear-padding:            6px !default;\n$button-border-radius:            4px !default;\n$button-border-width:             1px !default;\n\n$button-font-size:                16px !default;\n$button-height:                   42px !default;\n$button-padding:                  12px !default;\n$button-icon-size:                24px !default;\n\n$button-large-font-size:          20px !default;\n$button-large-height:             54px !default;\n$button-large-padding:            16px !default;\n$button-large-icon-size:          32px !default;\n\n$button-small-font-size:          12px !default;\n$button-small-height:             28px !default;\n$button-small-padding:            4px !default;\n$button-small-icon-size:          16px !default;\n\n$button-bar-button-font-size:     13px !default;\n$button-bar-button-height:        32px !default;\n$button-bar-button-padding:       8px !default;\n$button-bar-button-icon-size:     20px !default;\n\n$button-default-border:       transparent;\n$button-default-active-border:null;\n\n$button-light-bg:                 $light !default;\n$button-light-text:               #444 !default;\n$button-light-border:             #ddd !default;\n$button-light-active-bg:          #fafafa !default;\n$button-light-active-border:      #ccc !default;\n\n$button-stable-bg:                $stable !default;\n$button-stable-text:              #444 !default;\n$button-stable-border:            #b2b2b2 !default;\n$button-stable-active-bg:         #e5e5e5 !default;\n$button-stable-active-border:     #a2a2a2 !default;\n\n$button-positive-bg:              $positive !default;\n$button-positive-text:            #fff !default;\n$button-positive-border:          darken($positive, 10%) !default;\n$button-positive-active-bg:       darken($positive, 10%) !default;\n$button-positive-active-border:   darken($positive, 10%) !default;\n\n$button-calm-bg:                  $calm !default;\n$button-calm-text:                #fff !default;\n$button-calm-border:              darken($calm, 10%) !default;\n$button-calm-active-bg:           darken($calm, 10%) !default;\n$button-calm-active-border:       darken($calm, 10%) !default;\n\n$button-assertive-bg:             $assertive !default;\n$button-assertive-text:           #fff !default;\n$button-assertive-border:         darken($assertive, 10%) !default;\n$button-assertive-active-bg:      darken($assertive, 10%) !default;\n$button-assertive-active-border:  darken($assertive, 10%) !default;\n\n$button-balanced-bg:              $balanced !default;\n$button-balanced-text:            #fff !default;\n$button-balanced-border:          darken($balanced, 10%) !default;\n$button-balanced-active-bg:       darken($balanced, 10%) !default;\n$button-balanced-active-border:   darken($balanced, 10%) !default;\n\n$button-energized-bg:             $energized !default;\n$button-energized-text:           #fff !default;\n$button-energized-border:         darken($energized, 5%) !default;\n$button-energized-active-bg:      darken($energized, 5%) !default;\n$button-energized-active-border:  darken($energized, 5%) !default;\n\n$button-royal-bg:                 $royal !default;\n$button-royal-text:               #fff !default;\n$button-royal-border:             darken($royal, 8%) !default;\n$button-royal-active-bg:          darken($royal, 8%) !default;\n$button-royal-active-border:      darken($royal, 8%) !default;\n\n$button-dark-bg:                  $dark !default;\n$button-dark-text:                #fff !default;\n$button-dark-border:              #111 !default;\n$button-dark-active-bg:           #262626 !default;\n$button-dark-active-border:       #000 !default;\n\n$button-default-bg:               $button-stable-bg !default;\n$button-default-text:             $button-stable-text !default;\n$button-default-border:           $button-stable-border !default;\n$button-default-active-bg:        $button-stable-active-bg !default;\n$button-default-active-border:    $button-stable-active-border !default;\n\n\n// Bars\n// -------------------------------\n\n$bar-height:                      44px !default;\n$bar-title-font-size:             17px !default;\n$bar-padding-portrait:            5px !default;\n$bar-padding-landscape:           5px !default;\n$bar-transparency:                1 !default;\n\n$bar-footer-height:               $bar-height !default;\n$bar-subheader-height:            $bar-height !default;\n$bar-subfooter-height:            $bar-height !default;\n\n$bar-light-bg:                    rgba($button-light-bg, $bar-transparency) !default;\n$bar-light-text:                  $button-light-text !default;\n$bar-light-border:                $button-light-border !default;\n$bar-light-active-bg:             $button-light-active-bg !default;\n$bar-light-active-border:         $button-light-active-border !default;\n\n$bar-stable-bg:                   rgba($button-stable-bg, $bar-transparency) !default;\n$bar-stable-text:                 $button-stable-text !default;\n$bar-stable-border:               $button-stable-border !default;\n$bar-stable-active-bg:            $button-stable-active-bg !default;\n$bar-stable-active-border:        $button-stable-active-border !default;\n\n$bar-positive-bg:                 rgba($button-positive-bg, $bar-transparency) !default;\n$bar-positive-text:               $button-positive-text !default;\n$bar-positive-border:             $button-positive-border !default;\n$bar-positive-active-bg:          $button-positive-active-bg !default;\n$bar-positive-active-border:      $button-positive-active-border !default;\n\n$bar-calm-bg:                     rgba($button-calm-bg, $bar-transparency) !default;\n$bar-calm-text:                   $button-calm-text !default;\n$bar-calm-border:                 $button-calm-border !default;\n$bar-calm-active-bg:              $button-calm-active-bg !default;\n$bar-calm-active-border:          $button-calm-active-border !default;\n\n$bar-assertive-bg:                rgba($button-assertive-bg, $bar-transparency) !default;\n$bar-assertive-text:              $button-assertive-text !default;\n$bar-assertive-border:            $button-assertive-border !default;\n$bar-assertive-active-bg:         $button-assertive-active-bg !default;\n$bar-assertive-active-border:     $button-assertive-active-border !default;\n\n$bar-balanced-bg:                 rgba($button-balanced-bg, $bar-transparency) !default;\n$bar-balanced-text:               $button-balanced-text !default;\n$bar-balanced-border:             $button-balanced-border !default;\n$bar-balanced-active-bg:          $button-balanced-active-bg !default;\n$bar-balanced-active-border:      $button-balanced-active-border !default;\n\n$bar-energized-bg:                rgba($button-energized-bg, $bar-transparency) !default;\n$bar-energized-text:              $button-energized-text !default;\n$bar-energized-border:            $button-energized-border !default;\n$bar-energized-active-bg:         $button-energized-active-bg !default;\n$bar-energized-active-border:     $button-energized-active-border !default;\n\n$bar-royal-bg:                    rgba($button-royal-bg, $bar-transparency) !default;\n$bar-royal-text:                  $button-royal-text !default;\n$bar-royal-border:                $button-royal-border !default;\n$bar-royal-active-bg:             $button-royal-active-bg !default;\n$bar-royal-active-border:         $button-royal-active-border !default;\n\n$bar-dark-bg:                     rgba($button-dark-bg, $bar-transparency) !default;\n$bar-dark-text:                   $button-dark-text !default;\n$bar-dark-border:                 $button-dark-border !default;\n$bar-dark-active-bg:              $button-dark-active-bg !default;\n$bar-dark-active-border:          $button-dark-active-border !default;\n\n$bar-default-bg:                  $bar-light-bg !default;\n$bar-default-text:                $bar-light-text !default;\n$bar-default-border:              $bar-light-border !default;\n$bar-default-active-bg:           $bar-light-active-bg !default;\n$bar-default-active-border:       $bar-light-active-border !default;\n\n\n// Tabs\n// -------------------------------\n\n$tabs-height:                     49px !default;\n$tabs-text-font-size:             14px !default;\n$tabs-text-font-size-side-icon:   10px !default;\n$tabs-icon-size:                  32px !default;\n$tabs-badge-padding:              1px 6px !default;\n$tabs-badge-font-size:            12px !default;\n\n$tabs-light-bg:                   $button-light-bg !default;\n$tabs-light-border:               $button-light-border !default;\n$tabs-light-text:                 $button-light-text !default;\n\n$tabs-stable-bg:                  $button-stable-bg !default;\n$tabs-stable-border:              $button-stable-border !default;\n$tabs-stable-text:                $button-stable-text !default;\n\n$tabs-positive-bg:                $button-positive-bg !default;\n$tabs-positive-border:            $button-positive-border !default;\n$tabs-positive-text:              $button-positive-text !default;\n\n$tabs-calm-bg:                    $button-calm-bg !default;\n$tabs-calm-border:                $button-calm-border !default;\n$tabs-calm-text:                  $button-calm-text !default;\n\n$tabs-assertive-bg:               $button-assertive-bg !default;\n$tabs-assertive-border:           $button-assertive-border !default;\n$tabs-assertive-text:             $button-assertive-text !default;\n\n$tabs-balanced-bg:                $button-balanced-bg !default;\n$tabs-balanced-border:            $button-balanced-border !default;\n$tabs-balanced-text:              $button-balanced-text !default;\n\n$tabs-energized-bg:               $button-energized-bg !default;\n$tabs-energized-border:           $button-energized-border !default;\n$tabs-energized-text:             $button-energized-text !default;\n\n$tabs-royal-bg:                   $button-royal-bg !default;\n$tabs-royal-border:               $button-royal-border !default;\n$tabs-royal-text:                 $button-royal-text !default;\n\n$tabs-dark-bg:                    $button-dark-bg !default;\n$tabs-dark-border:                $button-dark-border !default;\n$tabs-dark-text:                  $button-dark-text !default;\n\n$tabs-default-bg:                 $tabs-stable-bg !default;\n$tabs-default-border:             $tabs-stable-border !default;\n$tabs-default-text:               $tabs-stable-text !default;\n\n$tab-item-max-width:              150px !default;\n\n$tabs-off-opacity:                0.4 !default;\n$tabs-striped-off-opacity:        $tabs-off-opacity !default;\n$tabs-striped-off-color:          #000 !default;\n$tabs-striped-border-width:       2px !default;\n\n\n// Items\n// -------------------------------\n\n$item-font-size:                  16px !default;\n$item-border-width:               1px !default;\n$item-padding:                    16px !default;\n\n$item-button-font-size:           18px !default;\n$item-button-line-height:         32px !default;\n$item-icon-font-size:             32px !default;\n$item-icon-fill-font-size:        28px !default;\n\n$item-icon-accessory-color:       #ccc !default;\n$item-icon-accessory-font-size:   16px !default;\n\n$item-avatar-width:               40px !default;\n$item-avatar-height:              40px !default;\n$item-avatar-border-radius:       50% !default;\n\n$item-thumbnail-width:            80px !default;\n$item-thumbnail-height:           80px !default;\n$item-thumbnail-margin:           10px !default;\n\n$item-divider-bg:                 #f5f5f5 !default;\n$item-divider-color:              #222 !default;\n$item-divider-padding:            5px 15px !default;\n\n$item-light-bg:                   $button-light-bg !default;\n$item-light-border:               $button-light-border !default;\n$item-light-text:                 $button-light-text !default;\n$item-light-active-bg:            $button-light-active-bg !default;\n$item-light-active-border:        $button-light-active-border !default;\n\n$item-stable-bg:                  $button-stable-bg !default;\n$item-stable-border:              $button-stable-border !default;\n$item-stable-text:                $button-stable-text !default;\n$item-stable-active-bg:           $button-stable-active-bg !default;\n$item-stable-active-border:       $button-stable-active-border !default;\n\n$item-positive-bg:                $button-positive-bg !default;\n$item-positive-border:            $button-positive-border !default;\n$item-positive-text:              $button-positive-text !default;\n$item-positive-active-bg:         $button-positive-active-bg !default;\n$item-positive-active-border:     $button-positive-active-border !default;\n\n$item-calm-bg:                    $button-calm-bg !default;\n$item-calm-border:                $button-calm-border !default;\n$item-calm-text:                  $button-calm-text !default;\n$item-calm-active-bg:             $button-calm-active-bg !default;\n$item-calm-active-border:         $button-calm-active-border !default;\n\n$item-assertive-bg:               $button-assertive-bg !default;\n$item-assertive-border:           $button-assertive-border !default;\n$item-assertive-text:             $button-assertive-text !default;\n$item-assertive-active-bg:        $button-assertive-active-bg !default;\n$item-assertive-active-border:    $button-assertive-active-border !default;\n\n$item-balanced-bg:                $button-balanced-bg !default;\n$item-balanced-border:            $button-balanced-border !default;\n$item-balanced-text:              $button-balanced-text !default;\n$item-balanced-active-bg:         $button-balanced-active-bg !default;\n$item-balanced-active-border:     $button-balanced-active-border !default;\n\n$item-energized-bg:               $button-energized-bg !default;\n$item-energized-border:           $button-energized-border !default;\n$item-energized-text:             $button-energized-text !default;\n$item-energized-active-bg:        $button-energized-active-bg !default;\n$item-energized-active-border:    $button-energized-active-border !default;\n\n$item-royal-bg:                   $button-royal-bg !default;\n$item-royal-border:               $button-royal-border !default;\n$item-royal-text:                 $button-royal-text !default;\n$item-royal-active-bg:            $button-royal-active-bg !default;\n$item-royal-active-border:        $button-royal-active-border !default;\n\n$item-dark-bg:                    $button-dark-bg !default;\n$item-dark-border:                $button-dark-border !default;\n$item-dark-text:                  $button-dark-text !default;\n$item-dark-active-bg:             $button-dark-active-bg !default;\n$item-dark-active-border:         $button-dark-active-border !default;\n\n$item-default-bg:                 $item-light-bg !default;\n$item-default-border:             $item-light-border !default;\n$item-default-text:               $item-light-text !default;\n$item-default-active-bg:          #D9D9D9 !default;\n$item-default-active-border:      $item-light-active-border !default;\n\n\n// Item Editing\n// -------------------------------\n\n$item-edit-transition-duration:   250ms !default;\n$item-edit-transition-function:   ease-in-out !default;\n\n$item-remove-transition-duration:   300ms !default;\n$item-remove-transition-function:   ease-in !default;\n$item-remove-descendents-transition-function:  cubic-bezier(.25,.81,.24,1) !default;\n\n$item-left-edit-left:             8px !default;  // item's left side edit's \"left\" property\n\n$item-right-edit-open-width:      50px !default;\n$item-left-edit-open-width:       50px !default;\n\n$item-delete-icon-size:           24px !default;\n$item-delete-icon-color:          $assertive !default;\n\n$item-reorder-icon-size:          32px !default;\n$item-reorder-icon-color:         $dark !default;\n\n\n// Lists\n// -------------------------------\n\n$list-header-bg:                  transparent !default;\n$list-header-color:               #222 !default;\n$list-header-padding:             5px 15px !default;\n$list-header-margin-top:          20px !default;\n\n\n// Cards\n// -------------------------------\n\n$card-header-bg:                  #F5F5F5 !default;\n$card-body-bg:                    #fff !default;\n$card-footer-bg:                  #F5F5F5 !default;\n\n$card-padding:                    10px !default;\n$card-border-width:               1px !default;\n\n$card-border-color:               #ccc !default;\n$card-border-radius:              2px !default;\n$card-box-shadow:                 0 1px 3px rgba(0, 0, 0, .3) !default;\n\n\n// Forms\n// -------------------------------\n\n$input-height-base:               ($line-height-computed + ($padding-base-vertical * 2) + 2) !default;\n$input-height-large:              (floor($font-size-large * $line-height-large) + ($padding-large-vertical * 2) + 2) !default;\n$input-height-small:              (floor($font-size-small * $line-height-small) + ($padding-small-vertical * 2) + 2) !default;\n\n$input-bg:                        $light !default;\n$input-bg-disabled:               $stable !default;\n\n$input-color:                     #111 !default;\n$input-border:                    $item-default-border !default;\n$input-border-width:              $item-border-width !default;\n$input-label-color:               $dark !default;\n$input-color-placeholder:         lighten($dark, 40%) !default;\n\n\n// Progress\n// -------------------------------\n\n$progress-width:                  100% !default;\n$progress-margin:                 15px auto !default;\n\n\n// Toggle\n// -------------------------------\n\n$toggle-width:                    51px !default;\n$toggle-height:                   31px !default;\n$toggle-border-width:             2px !default;\n$toggle-border-radius:            20px !default;\n\n$toggle-handle-width:             $toggle-height - ($toggle-border-width * 2) !default;\n$toggle-handle-height:            $toggle-handle-width !default;\n$toggle-handle-radius:            $toggle-handle-width !default;\n$toggle-handle-dragging-bg-color: darken(#fff, 5%) !default;\n\n$toggle-off-bg-color:             #fff !default;\n$toggle-off-border-color:         #e6e6e6 !default;\n\n$toggle-on-light-bg:              $button-light-border !default;\n$toggle-on-light-border:          $toggle-on-light-bg !default;\n$toggle-on-stable-bg:             $button-stable-border !default;\n$toggle-on-stable-border:         $toggle-on-stable-bg !default;\n$toggle-on-positive-bg:           $positive !default;\n$toggle-on-positive-border:       $toggle-on-positive-bg !default;\n$toggle-on-calm-bg:               $calm !default;\n$toggle-on-calm-border:           $toggle-on-calm-bg !default;\n$toggle-on-assertive-bg:          $assertive !default;\n$toggle-on-assertive-border:      $toggle-on-assertive-bg !default;\n$toggle-on-balanced-bg:           $balanced !default;\n$toggle-on-balanced-border:       $toggle-on-balanced-bg !default;\n$toggle-on-energized-bg:          $energized !default;\n$toggle-on-energized-border:      $toggle-on-energized-bg !default;\n$toggle-on-royal-bg:              $royal !default;\n$toggle-on-royal-border:          $toggle-on-royal-bg !default;\n$toggle-on-dark-bg:               $dark !default;\n$toggle-on-dark-border:           $toggle-on-dark-bg !default;\n$toggle-on-default-bg:            #4cd964 !default;\n$toggle-on-default-border:        $toggle-on-default-bg !default;\n\n$toggle-handle-off-bg-color:      $light !default;\n$toggle-handle-on-bg-color:       $toggle-handle-off-bg-color !default;\n\n$toggle-transition-duration:      .3s !default;\n\n$toggle-hit-area-expansion:   5px;\n\n\n// Checkbox\n// -------------------------------\n\n$checkbox-width:                  28px !default;\n$checkbox-height:                 28px !default;\n$checkbox-border-radius:          $checkbox-width !default;\n$checkbox-border-width:           1px !default;\n\n$checkbox-off-bg-color:           #fff !default;\n$checkbox-off-border-light:       $button-light-border !default;\n$checkbox-on-bg-light:            $button-light-border !default;\n$checkbox-off-border-stable:      $button-stable-border !default;\n$checkbox-on-bg-stable:           $button-stable-border !default;\n$checkbox-off-border-positive:    $positive !default;\n$checkbox-on-bg-positive:         $positive !default;\n$checkbox-off-border-calm:        $calm !default;\n$checkbox-on-bg-calm:             $calm !default;\n$checkbox-off-border-assertive:   $assertive !default;\n$checkbox-on-bg-assertive:        $assertive !default;\n$checkbox-off-border-balanced:    $balanced !default;\n$checkbox-on-bg-balanced:         $balanced !default;\n$checkbox-off-border-energized:   $energized !default;\n$checkbox-on-bg-energized:        $energized !default;\n$checkbox-off-border-royal:       $royal !default;\n$checkbox-on-bg-royal:            $royal !default;\n$checkbox-off-border-dark:        $dark !default;\n$checkbox-on-bg-dark:             $dark !default;\n$checkbox-off-border-default:     $button-light-border !default;\n$checkbox-on-bg-default:          $positive !default;\n$checkbox-on-border-default:      $positive !default;\n\n$checkbox-check-width:            1px !default;\n$checkbox-check-color:            #fff !default;\n\n\n// Range\n// -------------------------------\n\n$range-track-height:              2px !default;\n$range-slider-width:              28px !default;\n$range-slider-height:             28px !default;\n$range-slider-border-radius:      50% !default;\n$range-icon-size:                 24px !default;\n$range-slider-box-shadow:         0 0 2px rgba(0,0,0,.3), 0 3px 5px rgba(0,0,0,0.2) !default;\n\n$range-light-track-bg:            $button-light-border !default;\n$range-stable-track-bg:           $button-stable-border !default;\n$range-positive-track-bg:         $button-positive-bg !default;\n$range-calm-track-bg:             $button-calm-bg !default;\n$range-balanced-track-bg:         $button-balanced-bg !default;\n$range-assertive-track-bg:        $button-assertive-bg !default;\n$range-energized-track-bg:        $button-energized-bg !default;\n$range-royal-track-bg:            $button-royal-bg !default;\n$range-dark-track-bg:             $button-dark-bg !default;\n$range-default-track-bg:          #ccc !default;\n\n\n// Menus\n// -------------------------------\n\n$menu-bg:                         #fff !default;\n$menu-width:                      275px !default;\n$menu-animation-speed:            200ms !default;\n\n$menu-side-shadow:                -1px 0px 2px rgba(0, 0, 0, 0.2), 1px 0px 2px rgba(0,0,0,0.2) !default;\n\n\n// Modals\n// -------------------------------\n\n$modal-bg-color:                  #fff !default;\n$modal-backdrop-bg-active:        #000 !default;\n$modal-backdrop-bg-inactive:      rgba(0,0,0,0) !default;\n\n$modal-inset-mode-break-point:    680px !default;  // @media min-width\n$modal-inset-mode-top:            20% !default;\n$modal-inset-mode-right:          20% !default;\n$modal-inset-mode-bottom:         20% !default;\n$modal-inset-mode-left:           20% !default;\n$modal-inset-mode-min-height:     240px !default;\n\n\n// Popovers\n// -------------------------------\n\n$popover-bg-color:                $light !default;\n$popover-backdrop-bg-active:      rgba(0,0,0,0.1) !default;\n$popover-backdrop-bg-inactive:    rgba(0,0,0,0) !default;\n$popover-width:                   220px !default;\n$popover-height:                  280px !default;\n$popover-large-break-point:       680px !default;\n$popover-large-width:             360px !default;\n\n$popover-box-shadow:              0 1px 3px rgba(0,0,0,0.4) !default;\n$popover-border-radius:           2px !default;\n\n$popover-box-shadow-ios:          0 0 40px rgba(0,0,0,0.08) !default;\n$popover-border-radius-ios:       10px !default;\n\n$popover-bg-color-android:        #fafafa !default;\n$popover-box-shadow-android:      0 2px 6px rgba(0,0,0,0.35) !default;\n\n\n// Grids\n// -------------------------------\n\n$grid-padding-width:              10px !default;\n$grid-responsive-sm-break:        567px !default;  // smaller than landscape phone\n$grid-responsive-md-break:        767px !default;  // smaller than portrait tablet\n$grid-responsive-lg-break:        1023px !default; // smaller than landscape tablet\n\n\n// Action Sheets\n// -------------------------------\n\n$sheet-margin:                    8px !default;\n$sheet-border-radius:             4px !default;\n\n$sheet-options-bg-color:          #f1f2f3 !default;\n$sheet-options-bg-active-color:   #e4e5e7 !default;\n$sheet-options-text-color:        #007aff !default;\n$sheet-options-border-color:      #d1d3d6 !default;\n\n\n// Popups\n// -------------------------------\n\n$popup-width:                     250px !default;\n$popup-enter-animation:           superScaleIn !default;\n$popup-enter-animation-duration:  0.2s !default;\n$popup-leave-animation-duration:  0.1s !default;\n\n$popup-border-radius:             0px !default;\n$popup-background-color:          rgba(255,255,255,0.9) !default;\n\n$popup-button-border-radius:      2px !default;\n$popup-button-line-height:        20px !default;\n$popup-button-min-height:         45px !default;\n\n\n// Loading\n// -------------------------------\n\n$loading-text-color:              #fff !default;\n$loading-bg-color:                rgba(0,0,0,0.7) !default;\n$loading-padding:                 20px !default;\n$loading-border-radius:           5px !default;\n$loading-font-size:               15px !default;\n\n$loading-backdrop-fadein-duration:0.1s !default;\n$loading-backdrop-bg-color:       rgba(0,0,0,0.4) !default;\n\n\n// Badges\n// -------------------------------\n\n$badge-font-size:                 14px !default;\n$badge-line-height:               16px !default;\n$badge-font-weight:               bold !default;\n$badge-border-radius:             10px !default;\n\n$badge-light-bg:                  $button-light-bg !default;\n$badge-light-text:                $button-light-text !default;\n\n$badge-stable-bg:                 $button-stable-bg !default;\n$badge-stable-text:               $button-stable-text !default;\n\n$badge-positive-bg:               $button-positive-bg !default;\n$badge-positive-text:             $button-positive-text !default;\n\n$badge-calm-bg:                   $button-calm-bg !default;\n$badge-calm-text:                 $button-calm-text !default;\n\n$badge-balanced-bg:               $button-balanced-bg !default;\n$badge-balanced-text:             $button-balanced-text !default;\n\n$badge-assertive-bg:              $button-assertive-bg !default;\n$badge-assertive-text:            $button-assertive-text !default;\n\n$badge-energized-bg:              $button-energized-bg !default;\n$badge-energized-text:            $button-energized-text !default;\n\n$badge-royal-bg:                  $button-royal-bg !default;\n$badge-royal-text:                $button-royal-text !default;\n\n$badge-dark-bg:                   $button-dark-bg !default;\n$badge-dark-text:                 $button-dark-text !default;\n\n$badge-default-bg:                transparent !default;\n$badge-default-text:              #AAAAAA !default;\n\n\n// Spinners\n// -------------------------------\n\n$spinner-width:                   28px !default;\n$spinner-height:                  28px !default;\n\n$spinner-light-stroke:            $light !default;\n$spinner-light-fill:              $light !default;\n\n$spinner-stable-stroke:           $stable !default;\n$spinner-stable-fill:             $stable !default;\n\n$spinner-positive-stroke:         $positive !default;\n$spinner-positive-fill:           $positive !default;\n\n$spinner-calm-stroke:             $calm !default;\n$spinner-calm-fill:               $calm !default;\n\n$spinner-balanced-stroke:         $balanced !default;\n$spinner-balanced-fill:           $balanced !default;\n\n$spinner-assertive-stroke:        $assertive !default;\n$spinner-assertive-fill:          $assertive !default;\n\n$spinner-energized-stroke:        $energized !default;\n$spinner-energized-fill:          $energized !default;\n\n$spinner-royal-stroke:            $royal !default;\n$spinner-royal-fill:              $royal !default;\n\n$spinner-dark-stroke:             $dark !default;\n$spinner-dark-fill:               $dark !default;\n\n$spinner-default-stroke:          $dark !default;\n$spinner-default-fill:            $dark !default;\n\n\n// Z-Indexes\n// -------------------------------\n\n$z-index-bar-title:               0 !default;\n$z-index-item-drag:               0 !default;\n$z-index-item-edit:               0 !default;\n$z-index-menu:                    0 !default;\n$z-index-badge:                   1 !default;\n$z-index-bar-button:              1 !default;\n$z-index-item-options:            1 !default;\n$z-index-pane:                    1 !default;\n$z-index-slider-pager:            1 !default;\n$z-index-view:                    1 !default;\n$z-index-view-below:              2 !default;\n$z-index-item:                    2 !default;\n$z-index-item-checkbox:           3 !default;\n$z-index-item-radio:              3 !default;\n$z-index-item-reorder:            3 !default;\n$z-index-item-toggle:             3 !default;\n$z-index-view-above:              3 !default;\n$z-index-tabs:                    5 !default;\n$z-index-item-reordering:         9 !default;\n$z-index-bar:                     9 !default;\n$z-index-bar-above:               10 !default;\n$z-index-menu-scroll-content:     10 !default;\n$z-index-modal:                   10 !default;\n$z-index-popover:                 10 !default;\n$z-index-action-sheet:            11 !default;\n$z-index-backdrop:                11 !default;\n$z-index-menu-bar-header:         11 !default;\n$z-index-scroll-content-false:    11 !default;\n$z-index-popup:                   12 !default;\n$z-index-loading:                 13 !default;\n$z-index-scroll-bar:              9999 !default;\n$z-index-click-block:             99999 !default;\n\n\n// Platform\n// -------------------------------\n\n$ios-statusbar-height:           20px !default;\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/ionic.scss",
    "content": "@charset \"UTF-8\";\n\n@import\n  // Ionicons\n  \"ionicons/ionicons.scss\",\n\n  // Variables\n  \"mixins\",\n  \"variables\",\n\n  // Base\n  \"reset\",\n  \"scaffolding\",\n  \"type\",\n\n  // Components\n  \"action-sheet\",\n  \"backdrop\",\n  \"bar\",\n  \"tabs\",\n  \"menu\",\n  \"modal\",\n  \"popover\",\n  \"popup\",\n  \"loading\",\n  \"items\",\n  \"list\",\n  \"badge\",\n  \"slide-box\",\n  \"slides\",\n  \"refresher\",\n  \"spinner\",\n\n  // Forms\n  \"form\",\n  \"checkbox\",\n  \"toggle\",\n  \"radio\",\n  \"range\",\n  \"select\",\n  \"progress\",\n\n  // Buttons\n  \"button\",\n  \"button-bar\",\n\n  // Util\n  \"grid\",\n  \"util\",\n  \"platform\",\n\n  // Animations\n  \"animations\",\n  \"transitions\";\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/ionicons/_ionicons-font.scss",
    "content": "// Ionicons Font Path\n// --------------------------\n\n@font-face {\n font-family: $ionicons-font-family;\n src:url(\"#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}\");\n src:url(\"#{$ionicons-font-path}/ionicons.eot?v=#{$ionicons-version}#iefix\") format(\"embedded-opentype\"),\n  url(\"#{$ionicons-font-path}/ionicons.ttf?v=#{$ionicons-version}\") format(\"truetype\"),\n  url(\"#{$ionicons-font-path}/ionicons.woff?v=#{$ionicons-version}\") format(\"woff\"),\n  url(\"#{$ionicons-font-path}/ionicons.woff\") format(\"woff\"), /* for WP8 */\n  url(\"#{$ionicons-font-path}/ionicons.svg?v=#{$ionicons-version}#Ionicons\") format(\"svg\");\n font-weight: normal;\n font-style: normal;\n}\n\n.ion {\n  display: inline-block;\n  font-family: $ionicons-font-family;\n  speak: none;\n  font-style: normal;\n  font-weight: normal;\n  font-variant: normal;\n  text-transform: none;\n  text-rendering: auto;\n  line-height: 1;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/ionicons/_ionicons-icons.scss",
    "content": "// Ionicons Icons\n// --------------------------\n\n.ionicons,\n.#{$ionicons-prefix}alert:before,\n.#{$ionicons-prefix}alert-circled:before,\n.#{$ionicons-prefix}android-add:before,\n.#{$ionicons-prefix}android-add-circle:before,\n.#{$ionicons-prefix}android-alarm-clock:before,\n.#{$ionicons-prefix}android-alert:before,\n.#{$ionicons-prefix}android-apps:before,\n.#{$ionicons-prefix}android-archive:before,\n.#{$ionicons-prefix}android-arrow-back:before,\n.#{$ionicons-prefix}android-arrow-down:before,\n.#{$ionicons-prefix}android-arrow-dropdown:before,\n.#{$ionicons-prefix}android-arrow-dropdown-circle:before,\n.#{$ionicons-prefix}android-arrow-dropleft:before,\n.#{$ionicons-prefix}android-arrow-dropleft-circle:before,\n.#{$ionicons-prefix}android-arrow-dropright:before,\n.#{$ionicons-prefix}android-arrow-dropright-circle:before,\n.#{$ionicons-prefix}android-arrow-dropup:before,\n.#{$ionicons-prefix}android-arrow-dropup-circle:before,\n.#{$ionicons-prefix}android-arrow-forward:before,\n.#{$ionicons-prefix}android-arrow-up:before,\n.#{$ionicons-prefix}android-attach:before,\n.#{$ionicons-prefix}android-bar:before,\n.#{$ionicons-prefix}android-bicycle:before,\n.#{$ionicons-prefix}android-boat:before,\n.#{$ionicons-prefix}android-bookmark:before,\n.#{$ionicons-prefix}android-bulb:before,\n.#{$ionicons-prefix}android-bus:before,\n.#{$ionicons-prefix}android-calendar:before,\n.#{$ionicons-prefix}android-call:before,\n.#{$ionicons-prefix}android-camera:before,\n.#{$ionicons-prefix}android-cancel:before,\n.#{$ionicons-prefix}android-car:before,\n.#{$ionicons-prefix}android-cart:before,\n.#{$ionicons-prefix}android-chat:before,\n.#{$ionicons-prefix}android-checkbox:before,\n.#{$ionicons-prefix}android-checkbox-blank:before,\n.#{$ionicons-prefix}android-checkbox-outline:before,\n.#{$ionicons-prefix}android-checkbox-outline-blank:before,\n.#{$ionicons-prefix}android-checkmark-circle:before,\n.#{$ionicons-prefix}android-clipboard:before,\n.#{$ionicons-prefix}android-close:before,\n.#{$ionicons-prefix}android-cloud:before,\n.#{$ionicons-prefix}android-cloud-circle:before,\n.#{$ionicons-prefix}android-cloud-done:before,\n.#{$ionicons-prefix}android-cloud-outline:before,\n.#{$ionicons-prefix}android-color-palette:before,\n.#{$ionicons-prefix}android-compass:before,\n.#{$ionicons-prefix}android-contact:before,\n.#{$ionicons-prefix}android-contacts:before,\n.#{$ionicons-prefix}android-contract:before,\n.#{$ionicons-prefix}android-create:before,\n.#{$ionicons-prefix}android-delete:before,\n.#{$ionicons-prefix}android-desktop:before,\n.#{$ionicons-prefix}android-document:before,\n.#{$ionicons-prefix}android-done:before,\n.#{$ionicons-prefix}android-done-all:before,\n.#{$ionicons-prefix}android-download:before,\n.#{$ionicons-prefix}android-drafts:before,\n.#{$ionicons-prefix}android-exit:before,\n.#{$ionicons-prefix}android-expand:before,\n.#{$ionicons-prefix}android-favorite:before,\n.#{$ionicons-prefix}android-favorite-outline:before,\n.#{$ionicons-prefix}android-film:before,\n.#{$ionicons-prefix}android-folder:before,\n.#{$ionicons-prefix}android-folder-open:before,\n.#{$ionicons-prefix}android-funnel:before,\n.#{$ionicons-prefix}android-globe:before,\n.#{$ionicons-prefix}android-hand:before,\n.#{$ionicons-prefix}android-hangout:before,\n.#{$ionicons-prefix}android-happy:before,\n.#{$ionicons-prefix}android-home:before,\n.#{$ionicons-prefix}android-image:before,\n.#{$ionicons-prefix}android-laptop:before,\n.#{$ionicons-prefix}android-list:before,\n.#{$ionicons-prefix}android-locate:before,\n.#{$ionicons-prefix}android-lock:before,\n.#{$ionicons-prefix}android-mail:before,\n.#{$ionicons-prefix}android-map:before,\n.#{$ionicons-prefix}android-menu:before,\n.#{$ionicons-prefix}android-microphone:before,\n.#{$ionicons-prefix}android-microphone-off:before,\n.#{$ionicons-prefix}android-more-horizontal:before,\n.#{$ionicons-prefix}android-more-vertical:before,\n.#{$ionicons-prefix}android-navigate:before,\n.#{$ionicons-prefix}android-notifications:before,\n.#{$ionicons-prefix}android-notifications-none:before,\n.#{$ionicons-prefix}android-notifications-off:before,\n.#{$ionicons-prefix}android-open:before,\n.#{$ionicons-prefix}android-options:before,\n.#{$ionicons-prefix}android-people:before,\n.#{$ionicons-prefix}android-person:before,\n.#{$ionicons-prefix}android-person-add:before,\n.#{$ionicons-prefix}android-phone-landscape:before,\n.#{$ionicons-prefix}android-phone-portrait:before,\n.#{$ionicons-prefix}android-pin:before,\n.#{$ionicons-prefix}android-plane:before,\n.#{$ionicons-prefix}android-playstore:before,\n.#{$ionicons-prefix}android-print:before,\n.#{$ionicons-prefix}android-radio-button-off:before,\n.#{$ionicons-prefix}android-radio-button-on:before,\n.#{$ionicons-prefix}android-refresh:before,\n.#{$ionicons-prefix}android-remove:before,\n.#{$ionicons-prefix}android-remove-circle:before,\n.#{$ionicons-prefix}android-restaurant:before,\n.#{$ionicons-prefix}android-sad:before,\n.#{$ionicons-prefix}android-search:before,\n.#{$ionicons-prefix}android-send:before,\n.#{$ionicons-prefix}android-settings:before,\n.#{$ionicons-prefix}android-share:before,\n.#{$ionicons-prefix}android-share-alt:before,\n.#{$ionicons-prefix}android-star:before,\n.#{$ionicons-prefix}android-star-half:before,\n.#{$ionicons-prefix}android-star-outline:before,\n.#{$ionicons-prefix}android-stopwatch:before,\n.#{$ionicons-prefix}android-subway:before,\n.#{$ionicons-prefix}android-sunny:before,\n.#{$ionicons-prefix}android-sync:before,\n.#{$ionicons-prefix}android-textsms:before,\n.#{$ionicons-prefix}android-time:before,\n.#{$ionicons-prefix}android-train:before,\n.#{$ionicons-prefix}android-unlock:before,\n.#{$ionicons-prefix}android-upload:before,\n.#{$ionicons-prefix}android-volume-down:before,\n.#{$ionicons-prefix}android-volume-mute:before,\n.#{$ionicons-prefix}android-volume-off:before,\n.#{$ionicons-prefix}android-volume-up:before,\n.#{$ionicons-prefix}android-walk:before,\n.#{$ionicons-prefix}android-warning:before,\n.#{$ionicons-prefix}android-watch:before,\n.#{$ionicons-prefix}android-wifi:before,\n.#{$ionicons-prefix}aperture:before,\n.#{$ionicons-prefix}archive:before,\n.#{$ionicons-prefix}arrow-down-a:before,\n.#{$ionicons-prefix}arrow-down-b:before,\n.#{$ionicons-prefix}arrow-down-c:before,\n.#{$ionicons-prefix}arrow-expand:before,\n.#{$ionicons-prefix}arrow-graph-down-left:before,\n.#{$ionicons-prefix}arrow-graph-down-right:before,\n.#{$ionicons-prefix}arrow-graph-up-left:before,\n.#{$ionicons-prefix}arrow-graph-up-right:before,\n.#{$ionicons-prefix}arrow-left-a:before,\n.#{$ionicons-prefix}arrow-left-b:before,\n.#{$ionicons-prefix}arrow-left-c:before,\n.#{$ionicons-prefix}arrow-move:before,\n.#{$ionicons-prefix}arrow-resize:before,\n.#{$ionicons-prefix}arrow-return-left:before,\n.#{$ionicons-prefix}arrow-return-right:before,\n.#{$ionicons-prefix}arrow-right-a:before,\n.#{$ionicons-prefix}arrow-right-b:before,\n.#{$ionicons-prefix}arrow-right-c:before,\n.#{$ionicons-prefix}arrow-shrink:before,\n.#{$ionicons-prefix}arrow-swap:before,\n.#{$ionicons-prefix}arrow-up-a:before,\n.#{$ionicons-prefix}arrow-up-b:before,\n.#{$ionicons-prefix}arrow-up-c:before,\n.#{$ionicons-prefix}asterisk:before,\n.#{$ionicons-prefix}at:before,\n.#{$ionicons-prefix}backspace:before,\n.#{$ionicons-prefix}backspace-outline:before,\n.#{$ionicons-prefix}bag:before,\n.#{$ionicons-prefix}battery-charging:before,\n.#{$ionicons-prefix}battery-empty:before,\n.#{$ionicons-prefix}battery-full:before,\n.#{$ionicons-prefix}battery-half:before,\n.#{$ionicons-prefix}battery-low:before,\n.#{$ionicons-prefix}beaker:before,\n.#{$ionicons-prefix}beer:before,\n.#{$ionicons-prefix}bluetooth:before,\n.#{$ionicons-prefix}bonfire:before,\n.#{$ionicons-prefix}bookmark:before,\n.#{$ionicons-prefix}bowtie:before,\n.#{$ionicons-prefix}briefcase:before,\n.#{$ionicons-prefix}bug:before,\n.#{$ionicons-prefix}calculator:before,\n.#{$ionicons-prefix}calendar:before,\n.#{$ionicons-prefix}camera:before,\n.#{$ionicons-prefix}card:before,\n.#{$ionicons-prefix}cash:before,\n.#{$ionicons-prefix}chatbox:before,\n.#{$ionicons-prefix}chatbox-working:before,\n.#{$ionicons-prefix}chatboxes:before,\n.#{$ionicons-prefix}chatbubble:before,\n.#{$ionicons-prefix}chatbubble-working:before,\n.#{$ionicons-prefix}chatbubbles:before,\n.#{$ionicons-prefix}checkmark:before,\n.#{$ionicons-prefix}checkmark-circled:before,\n.#{$ionicons-prefix}checkmark-round:before,\n.#{$ionicons-prefix}chevron-down:before,\n.#{$ionicons-prefix}chevron-left:before,\n.#{$ionicons-prefix}chevron-right:before,\n.#{$ionicons-prefix}chevron-up:before,\n.#{$ionicons-prefix}clipboard:before,\n.#{$ionicons-prefix}clock:before,\n.#{$ionicons-prefix}close:before,\n.#{$ionicons-prefix}close-circled:before,\n.#{$ionicons-prefix}close-round:before,\n.#{$ionicons-prefix}closed-captioning:before,\n.#{$ionicons-prefix}cloud:before,\n.#{$ionicons-prefix}code:before,\n.#{$ionicons-prefix}code-download:before,\n.#{$ionicons-prefix}code-working:before,\n.#{$ionicons-prefix}coffee:before,\n.#{$ionicons-prefix}compass:before,\n.#{$ionicons-prefix}compose:before,\n.#{$ionicons-prefix}connection-bars:before,\n.#{$ionicons-prefix}contrast:before,\n.#{$ionicons-prefix}crop:before,\n.#{$ionicons-prefix}cube:before,\n.#{$ionicons-prefix}disc:before,\n.#{$ionicons-prefix}document:before,\n.#{$ionicons-prefix}document-text:before,\n.#{$ionicons-prefix}drag:before,\n.#{$ionicons-prefix}earth:before,\n.#{$ionicons-prefix}easel:before,\n.#{$ionicons-prefix}edit:before,\n.#{$ionicons-prefix}egg:before,\n.#{$ionicons-prefix}eject:before,\n.#{$ionicons-prefix}email:before,\n.#{$ionicons-prefix}email-unread:before,\n.#{$ionicons-prefix}erlenmeyer-flask:before,\n.#{$ionicons-prefix}erlenmeyer-flask-bubbles:before,\n.#{$ionicons-prefix}eye:before,\n.#{$ionicons-prefix}eye-disabled:before,\n.#{$ionicons-prefix}female:before,\n.#{$ionicons-prefix}filing:before,\n.#{$ionicons-prefix}film-marker:before,\n.#{$ionicons-prefix}fireball:before,\n.#{$ionicons-prefix}flag:before,\n.#{$ionicons-prefix}flame:before,\n.#{$ionicons-prefix}flash:before,\n.#{$ionicons-prefix}flash-off:before,\n.#{$ionicons-prefix}folder:before,\n.#{$ionicons-prefix}fork:before,\n.#{$ionicons-prefix}fork-repo:before,\n.#{$ionicons-prefix}forward:before,\n.#{$ionicons-prefix}funnel:before,\n.#{$ionicons-prefix}gear-a:before,\n.#{$ionicons-prefix}gear-b:before,\n.#{$ionicons-prefix}grid:before,\n.#{$ionicons-prefix}hammer:before,\n.#{$ionicons-prefix}happy:before,\n.#{$ionicons-prefix}happy-outline:before,\n.#{$ionicons-prefix}headphone:before,\n.#{$ionicons-prefix}heart:before,\n.#{$ionicons-prefix}heart-broken:before,\n.#{$ionicons-prefix}help:before,\n.#{$ionicons-prefix}help-buoy:before,\n.#{$ionicons-prefix}help-circled:before,\n.#{$ionicons-prefix}home:before,\n.#{$ionicons-prefix}icecream:before,\n.#{$ionicons-prefix}image:before,\n.#{$ionicons-prefix}images:before,\n.#{$ionicons-prefix}information:before,\n.#{$ionicons-prefix}information-circled:before,\n.#{$ionicons-prefix}ionic:before,\n.#{$ionicons-prefix}ios-alarm:before,\n.#{$ionicons-prefix}ios-alarm-outline:before,\n.#{$ionicons-prefix}ios-albums:before,\n.#{$ionicons-prefix}ios-albums-outline:before,\n.#{$ionicons-prefix}ios-americanfootball:before,\n.#{$ionicons-prefix}ios-americanfootball-outline:before,\n.#{$ionicons-prefix}ios-analytics:before,\n.#{$ionicons-prefix}ios-analytics-outline:before,\n.#{$ionicons-prefix}ios-arrow-back:before,\n.#{$ionicons-prefix}ios-arrow-down:before,\n.#{$ionicons-prefix}ios-arrow-forward:before,\n.#{$ionicons-prefix}ios-arrow-left:before,\n.#{$ionicons-prefix}ios-arrow-right:before,\n.#{$ionicons-prefix}ios-arrow-thin-down:before,\n.#{$ionicons-prefix}ios-arrow-thin-left:before,\n.#{$ionicons-prefix}ios-arrow-thin-right:before,\n.#{$ionicons-prefix}ios-arrow-thin-up:before,\n.#{$ionicons-prefix}ios-arrow-up:before,\n.#{$ionicons-prefix}ios-at:before,\n.#{$ionicons-prefix}ios-at-outline:before,\n.#{$ionicons-prefix}ios-barcode:before,\n.#{$ionicons-prefix}ios-barcode-outline:before,\n.#{$ionicons-prefix}ios-baseball:before,\n.#{$ionicons-prefix}ios-baseball-outline:before,\n.#{$ionicons-prefix}ios-basketball:before,\n.#{$ionicons-prefix}ios-basketball-outline:before,\n.#{$ionicons-prefix}ios-bell:before,\n.#{$ionicons-prefix}ios-bell-outline:before,\n.#{$ionicons-prefix}ios-body:before,\n.#{$ionicons-prefix}ios-body-outline:before,\n.#{$ionicons-prefix}ios-bolt:before,\n.#{$ionicons-prefix}ios-bolt-outline:before,\n.#{$ionicons-prefix}ios-book:before,\n.#{$ionicons-prefix}ios-book-outline:before,\n.#{$ionicons-prefix}ios-bookmarks:before,\n.#{$ionicons-prefix}ios-bookmarks-outline:before,\n.#{$ionicons-prefix}ios-box:before,\n.#{$ionicons-prefix}ios-box-outline:before,\n.#{$ionicons-prefix}ios-briefcase:before,\n.#{$ionicons-prefix}ios-briefcase-outline:before,\n.#{$ionicons-prefix}ios-browsers:before,\n.#{$ionicons-prefix}ios-browsers-outline:before,\n.#{$ionicons-prefix}ios-calculator:before,\n.#{$ionicons-prefix}ios-calculator-outline:before,\n.#{$ionicons-prefix}ios-calendar:before,\n.#{$ionicons-prefix}ios-calendar-outline:before,\n.#{$ionicons-prefix}ios-camera:before,\n.#{$ionicons-prefix}ios-camera-outline:before,\n.#{$ionicons-prefix}ios-cart:before,\n.#{$ionicons-prefix}ios-cart-outline:before,\n.#{$ionicons-prefix}ios-chatboxes:before,\n.#{$ionicons-prefix}ios-chatboxes-outline:before,\n.#{$ionicons-prefix}ios-chatbubble:before,\n.#{$ionicons-prefix}ios-chatbubble-outline:before,\n.#{$ionicons-prefix}ios-checkmark:before,\n.#{$ionicons-prefix}ios-checkmark-empty:before,\n.#{$ionicons-prefix}ios-checkmark-outline:before,\n.#{$ionicons-prefix}ios-circle-filled:before,\n.#{$ionicons-prefix}ios-circle-outline:before,\n.#{$ionicons-prefix}ios-clock:before,\n.#{$ionicons-prefix}ios-clock-outline:before,\n.#{$ionicons-prefix}ios-close:before,\n.#{$ionicons-prefix}ios-close-empty:before,\n.#{$ionicons-prefix}ios-close-outline:before,\n.#{$ionicons-prefix}ios-cloud:before,\n.#{$ionicons-prefix}ios-cloud-download:before,\n.#{$ionicons-prefix}ios-cloud-download-outline:before,\n.#{$ionicons-prefix}ios-cloud-outline:before,\n.#{$ionicons-prefix}ios-cloud-upload:before,\n.#{$ionicons-prefix}ios-cloud-upload-outline:before,\n.#{$ionicons-prefix}ios-cloudy:before,\n.#{$ionicons-prefix}ios-cloudy-night:before,\n.#{$ionicons-prefix}ios-cloudy-night-outline:before,\n.#{$ionicons-prefix}ios-cloudy-outline:before,\n.#{$ionicons-prefix}ios-cog:before,\n.#{$ionicons-prefix}ios-cog-outline:before,\n.#{$ionicons-prefix}ios-color-filter:before,\n.#{$ionicons-prefix}ios-color-filter-outline:before,\n.#{$ionicons-prefix}ios-color-wand:before,\n.#{$ionicons-prefix}ios-color-wand-outline:before,\n.#{$ionicons-prefix}ios-compose:before,\n.#{$ionicons-prefix}ios-compose-outline:before,\n.#{$ionicons-prefix}ios-contact:before,\n.#{$ionicons-prefix}ios-contact-outline:before,\n.#{$ionicons-prefix}ios-copy:before,\n.#{$ionicons-prefix}ios-copy-outline:before,\n.#{$ionicons-prefix}ios-crop:before,\n.#{$ionicons-prefix}ios-crop-strong:before,\n.#{$ionicons-prefix}ios-download:before,\n.#{$ionicons-prefix}ios-download-outline:before,\n.#{$ionicons-prefix}ios-drag:before,\n.#{$ionicons-prefix}ios-email:before,\n.#{$ionicons-prefix}ios-email-outline:before,\n.#{$ionicons-prefix}ios-eye:before,\n.#{$ionicons-prefix}ios-eye-outline:before,\n.#{$ionicons-prefix}ios-fastforward:before,\n.#{$ionicons-prefix}ios-fastforward-outline:before,\n.#{$ionicons-prefix}ios-filing:before,\n.#{$ionicons-prefix}ios-filing-outline:before,\n.#{$ionicons-prefix}ios-film:before,\n.#{$ionicons-prefix}ios-film-outline:before,\n.#{$ionicons-prefix}ios-flag:before,\n.#{$ionicons-prefix}ios-flag-outline:before,\n.#{$ionicons-prefix}ios-flame:before,\n.#{$ionicons-prefix}ios-flame-outline:before,\n.#{$ionicons-prefix}ios-flask:before,\n.#{$ionicons-prefix}ios-flask-outline:before,\n.#{$ionicons-prefix}ios-flower:before,\n.#{$ionicons-prefix}ios-flower-outline:before,\n.#{$ionicons-prefix}ios-folder:before,\n.#{$ionicons-prefix}ios-folder-outline:before,\n.#{$ionicons-prefix}ios-football:before,\n.#{$ionicons-prefix}ios-football-outline:before,\n.#{$ionicons-prefix}ios-game-controller-a:before,\n.#{$ionicons-prefix}ios-game-controller-a-outline:before,\n.#{$ionicons-prefix}ios-game-controller-b:before,\n.#{$ionicons-prefix}ios-game-controller-b-outline:before,\n.#{$ionicons-prefix}ios-gear:before,\n.#{$ionicons-prefix}ios-gear-outline:before,\n.#{$ionicons-prefix}ios-glasses:before,\n.#{$ionicons-prefix}ios-glasses-outline:before,\n.#{$ionicons-prefix}ios-grid-view:before,\n.#{$ionicons-prefix}ios-grid-view-outline:before,\n.#{$ionicons-prefix}ios-heart:before,\n.#{$ionicons-prefix}ios-heart-outline:before,\n.#{$ionicons-prefix}ios-help:before,\n.#{$ionicons-prefix}ios-help-empty:before,\n.#{$ionicons-prefix}ios-help-outline:before,\n.#{$ionicons-prefix}ios-home:before,\n.#{$ionicons-prefix}ios-home-outline:before,\n.#{$ionicons-prefix}ios-infinite:before,\n.#{$ionicons-prefix}ios-infinite-outline:before,\n.#{$ionicons-prefix}ios-information:before,\n.#{$ionicons-prefix}ios-information-empty:before,\n.#{$ionicons-prefix}ios-information-outline:before,\n.#{$ionicons-prefix}ios-ionic-outline:before,\n.#{$ionicons-prefix}ios-keypad:before,\n.#{$ionicons-prefix}ios-keypad-outline:before,\n.#{$ionicons-prefix}ios-lightbulb:before,\n.#{$ionicons-prefix}ios-lightbulb-outline:before,\n.#{$ionicons-prefix}ios-list:before,\n.#{$ionicons-prefix}ios-list-outline:before,\n.#{$ionicons-prefix}ios-location:before,\n.#{$ionicons-prefix}ios-location-outline:before,\n.#{$ionicons-prefix}ios-locked:before,\n.#{$ionicons-prefix}ios-locked-outline:before,\n.#{$ionicons-prefix}ios-loop:before,\n.#{$ionicons-prefix}ios-loop-strong:before,\n.#{$ionicons-prefix}ios-medical:before,\n.#{$ionicons-prefix}ios-medical-outline:before,\n.#{$ionicons-prefix}ios-medkit:before,\n.#{$ionicons-prefix}ios-medkit-outline:before,\n.#{$ionicons-prefix}ios-mic:before,\n.#{$ionicons-prefix}ios-mic-off:before,\n.#{$ionicons-prefix}ios-mic-outline:before,\n.#{$ionicons-prefix}ios-minus:before,\n.#{$ionicons-prefix}ios-minus-empty:before,\n.#{$ionicons-prefix}ios-minus-outline:before,\n.#{$ionicons-prefix}ios-monitor:before,\n.#{$ionicons-prefix}ios-monitor-outline:before,\n.#{$ionicons-prefix}ios-moon:before,\n.#{$ionicons-prefix}ios-moon-outline:before,\n.#{$ionicons-prefix}ios-more:before,\n.#{$ionicons-prefix}ios-more-outline:before,\n.#{$ionicons-prefix}ios-musical-note:before,\n.#{$ionicons-prefix}ios-musical-notes:before,\n.#{$ionicons-prefix}ios-navigate:before,\n.#{$ionicons-prefix}ios-navigate-outline:before,\n.#{$ionicons-prefix}ios-nutrition:before,\n.#{$ionicons-prefix}ios-nutrition-outline:before,\n.#{$ionicons-prefix}ios-paper:before,\n.#{$ionicons-prefix}ios-paper-outline:before,\n.#{$ionicons-prefix}ios-paperplane:before,\n.#{$ionicons-prefix}ios-paperplane-outline:before,\n.#{$ionicons-prefix}ios-partlysunny:before,\n.#{$ionicons-prefix}ios-partlysunny-outline:before,\n.#{$ionicons-prefix}ios-pause:before,\n.#{$ionicons-prefix}ios-pause-outline:before,\n.#{$ionicons-prefix}ios-paw:before,\n.#{$ionicons-prefix}ios-paw-outline:before,\n.#{$ionicons-prefix}ios-people:before,\n.#{$ionicons-prefix}ios-people-outline:before,\n.#{$ionicons-prefix}ios-person:before,\n.#{$ionicons-prefix}ios-person-outline:before,\n.#{$ionicons-prefix}ios-personadd:before,\n.#{$ionicons-prefix}ios-personadd-outline:before,\n.#{$ionicons-prefix}ios-photos:before,\n.#{$ionicons-prefix}ios-photos-outline:before,\n.#{$ionicons-prefix}ios-pie:before,\n.#{$ionicons-prefix}ios-pie-outline:before,\n.#{$ionicons-prefix}ios-pint:before,\n.#{$ionicons-prefix}ios-pint-outline:before,\n.#{$ionicons-prefix}ios-play:before,\n.#{$ionicons-prefix}ios-play-outline:before,\n.#{$ionicons-prefix}ios-plus:before,\n.#{$ionicons-prefix}ios-plus-empty:before,\n.#{$ionicons-prefix}ios-plus-outline:before,\n.#{$ionicons-prefix}ios-pricetag:before,\n.#{$ionicons-prefix}ios-pricetag-outline:before,\n.#{$ionicons-prefix}ios-pricetags:before,\n.#{$ionicons-prefix}ios-pricetags-outline:before,\n.#{$ionicons-prefix}ios-printer:before,\n.#{$ionicons-prefix}ios-printer-outline:before,\n.#{$ionicons-prefix}ios-pulse:before,\n.#{$ionicons-prefix}ios-pulse-strong:before,\n.#{$ionicons-prefix}ios-rainy:before,\n.#{$ionicons-prefix}ios-rainy-outline:before,\n.#{$ionicons-prefix}ios-recording:before,\n.#{$ionicons-prefix}ios-recording-outline:before,\n.#{$ionicons-prefix}ios-redo:before,\n.#{$ionicons-prefix}ios-redo-outline:before,\n.#{$ionicons-prefix}ios-refresh:before,\n.#{$ionicons-prefix}ios-refresh-empty:before,\n.#{$ionicons-prefix}ios-refresh-outline:before,\n.#{$ionicons-prefix}ios-reload:before,\n.#{$ionicons-prefix}ios-reverse-camera:before,\n.#{$ionicons-prefix}ios-reverse-camera-outline:before,\n.#{$ionicons-prefix}ios-rewind:before,\n.#{$ionicons-prefix}ios-rewind-outline:before,\n.#{$ionicons-prefix}ios-rose:before,\n.#{$ionicons-prefix}ios-rose-outline:before,\n.#{$ionicons-prefix}ios-search:before,\n.#{$ionicons-prefix}ios-search-strong:before,\n.#{$ionicons-prefix}ios-settings:before,\n.#{$ionicons-prefix}ios-settings-strong:before,\n.#{$ionicons-prefix}ios-shuffle:before,\n.#{$ionicons-prefix}ios-shuffle-strong:before,\n.#{$ionicons-prefix}ios-skipbackward:before,\n.#{$ionicons-prefix}ios-skipbackward-outline:before,\n.#{$ionicons-prefix}ios-skipforward:before,\n.#{$ionicons-prefix}ios-skipforward-outline:before,\n.#{$ionicons-prefix}ios-snowy:before,\n.#{$ionicons-prefix}ios-speedometer:before,\n.#{$ionicons-prefix}ios-speedometer-outline:before,\n.#{$ionicons-prefix}ios-star:before,\n.#{$ionicons-prefix}ios-star-half:before,\n.#{$ionicons-prefix}ios-star-outline:before,\n.#{$ionicons-prefix}ios-stopwatch:before,\n.#{$ionicons-prefix}ios-stopwatch-outline:before,\n.#{$ionicons-prefix}ios-sunny:before,\n.#{$ionicons-prefix}ios-sunny-outline:before,\n.#{$ionicons-prefix}ios-telephone:before,\n.#{$ionicons-prefix}ios-telephone-outline:before,\n.#{$ionicons-prefix}ios-tennisball:before,\n.#{$ionicons-prefix}ios-tennisball-outline:before,\n.#{$ionicons-prefix}ios-thunderstorm:before,\n.#{$ionicons-prefix}ios-thunderstorm-outline:before,\n.#{$ionicons-prefix}ios-time:before,\n.#{$ionicons-prefix}ios-time-outline:before,\n.#{$ionicons-prefix}ios-timer:before,\n.#{$ionicons-prefix}ios-timer-outline:before,\n.#{$ionicons-prefix}ios-toggle:before,\n.#{$ionicons-prefix}ios-toggle-outline:before,\n.#{$ionicons-prefix}ios-trash:before,\n.#{$ionicons-prefix}ios-trash-outline:before,\n.#{$ionicons-prefix}ios-undo:before,\n.#{$ionicons-prefix}ios-undo-outline:before,\n.#{$ionicons-prefix}ios-unlocked:before,\n.#{$ionicons-prefix}ios-unlocked-outline:before,\n.#{$ionicons-prefix}ios-upload:before,\n.#{$ionicons-prefix}ios-upload-outline:before,\n.#{$ionicons-prefix}ios-videocam:before,\n.#{$ionicons-prefix}ios-videocam-outline:before,\n.#{$ionicons-prefix}ios-volume-high:before,\n.#{$ionicons-prefix}ios-volume-low:before,\n.#{$ionicons-prefix}ios-wineglass:before,\n.#{$ionicons-prefix}ios-wineglass-outline:before,\n.#{$ionicons-prefix}ios-world:before,\n.#{$ionicons-prefix}ios-world-outline:before,\n.#{$ionicons-prefix}ipad:before,\n.#{$ionicons-prefix}iphone:before,\n.#{$ionicons-prefix}ipod:before,\n.#{$ionicons-prefix}jet:before,\n.#{$ionicons-prefix}key:before,\n.#{$ionicons-prefix}knife:before,\n.#{$ionicons-prefix}laptop:before,\n.#{$ionicons-prefix}leaf:before,\n.#{$ionicons-prefix}levels:before,\n.#{$ionicons-prefix}lightbulb:before,\n.#{$ionicons-prefix}link:before,\n.#{$ionicons-prefix}load-a:before,\n.#{$ionicons-prefix}load-b:before,\n.#{$ionicons-prefix}load-c:before,\n.#{$ionicons-prefix}load-d:before,\n.#{$ionicons-prefix}location:before,\n.#{$ionicons-prefix}lock-combination:before,\n.#{$ionicons-prefix}locked:before,\n.#{$ionicons-prefix}log-in:before,\n.#{$ionicons-prefix}log-out:before,\n.#{$ionicons-prefix}loop:before,\n.#{$ionicons-prefix}magnet:before,\n.#{$ionicons-prefix}male:before,\n.#{$ionicons-prefix}man:before,\n.#{$ionicons-prefix}map:before,\n.#{$ionicons-prefix}medkit:before,\n.#{$ionicons-prefix}merge:before,\n.#{$ionicons-prefix}mic-a:before,\n.#{$ionicons-prefix}mic-b:before,\n.#{$ionicons-prefix}mic-c:before,\n.#{$ionicons-prefix}minus:before,\n.#{$ionicons-prefix}minus-circled:before,\n.#{$ionicons-prefix}minus-round:before,\n.#{$ionicons-prefix}model-s:before,\n.#{$ionicons-prefix}monitor:before,\n.#{$ionicons-prefix}more:before,\n.#{$ionicons-prefix}mouse:before,\n.#{$ionicons-prefix}music-note:before,\n.#{$ionicons-prefix}navicon:before,\n.#{$ionicons-prefix}navicon-round:before,\n.#{$ionicons-prefix}navigate:before,\n.#{$ionicons-prefix}network:before,\n.#{$ionicons-prefix}no-smoking:before,\n.#{$ionicons-prefix}nuclear:before,\n.#{$ionicons-prefix}outlet:before,\n.#{$ionicons-prefix}paintbrush:before,\n.#{$ionicons-prefix}paintbucket:before,\n.#{$ionicons-prefix}paper-airplane:before,\n.#{$ionicons-prefix}paperclip:before,\n.#{$ionicons-prefix}pause:before,\n.#{$ionicons-prefix}person:before,\n.#{$ionicons-prefix}person-add:before,\n.#{$ionicons-prefix}person-stalker:before,\n.#{$ionicons-prefix}pie-graph:before,\n.#{$ionicons-prefix}pin:before,\n.#{$ionicons-prefix}pinpoint:before,\n.#{$ionicons-prefix}pizza:before,\n.#{$ionicons-prefix}plane:before,\n.#{$ionicons-prefix}planet:before,\n.#{$ionicons-prefix}play:before,\n.#{$ionicons-prefix}playstation:before,\n.#{$ionicons-prefix}plus:before,\n.#{$ionicons-prefix}plus-circled:before,\n.#{$ionicons-prefix}plus-round:before,\n.#{$ionicons-prefix}podium:before,\n.#{$ionicons-prefix}pound:before,\n.#{$ionicons-prefix}power:before,\n.#{$ionicons-prefix}pricetag:before,\n.#{$ionicons-prefix}pricetags:before,\n.#{$ionicons-prefix}printer:before,\n.#{$ionicons-prefix}pull-request:before,\n.#{$ionicons-prefix}qr-scanner:before,\n.#{$ionicons-prefix}quote:before,\n.#{$ionicons-prefix}radio-waves:before,\n.#{$ionicons-prefix}record:before,\n.#{$ionicons-prefix}refresh:before,\n.#{$ionicons-prefix}reply:before,\n.#{$ionicons-prefix}reply-all:before,\n.#{$ionicons-prefix}ribbon-a:before,\n.#{$ionicons-prefix}ribbon-b:before,\n.#{$ionicons-prefix}sad:before,\n.#{$ionicons-prefix}sad-outline:before,\n.#{$ionicons-prefix}scissors:before,\n.#{$ionicons-prefix}search:before,\n.#{$ionicons-prefix}settings:before,\n.#{$ionicons-prefix}share:before,\n.#{$ionicons-prefix}shuffle:before,\n.#{$ionicons-prefix}skip-backward:before,\n.#{$ionicons-prefix}skip-forward:before,\n.#{$ionicons-prefix}social-android:before,\n.#{$ionicons-prefix}social-android-outline:before,\n.#{$ionicons-prefix}social-angular:before,\n.#{$ionicons-prefix}social-angular-outline:before,\n.#{$ionicons-prefix}social-apple:before,\n.#{$ionicons-prefix}social-apple-outline:before,\n.#{$ionicons-prefix}social-bitcoin:before,\n.#{$ionicons-prefix}social-bitcoin-outline:before,\n.#{$ionicons-prefix}social-buffer:before,\n.#{$ionicons-prefix}social-buffer-outline:before,\n.#{$ionicons-prefix}social-chrome:before,\n.#{$ionicons-prefix}social-chrome-outline:before,\n.#{$ionicons-prefix}social-codepen:before,\n.#{$ionicons-prefix}social-codepen-outline:before,\n.#{$ionicons-prefix}social-css3:before,\n.#{$ionicons-prefix}social-css3-outline:before,\n.#{$ionicons-prefix}social-designernews:before,\n.#{$ionicons-prefix}social-designernews-outline:before,\n.#{$ionicons-prefix}social-dribbble:before,\n.#{$ionicons-prefix}social-dribbble-outline:before,\n.#{$ionicons-prefix}social-dropbox:before,\n.#{$ionicons-prefix}social-dropbox-outline:before,\n.#{$ionicons-prefix}social-euro:before,\n.#{$ionicons-prefix}social-euro-outline:before,\n.#{$ionicons-prefix}social-facebook:before,\n.#{$ionicons-prefix}social-facebook-outline:before,\n.#{$ionicons-prefix}social-foursquare:before,\n.#{$ionicons-prefix}social-foursquare-outline:before,\n.#{$ionicons-prefix}social-freebsd-devil:before,\n.#{$ionicons-prefix}social-github:before,\n.#{$ionicons-prefix}social-github-outline:before,\n.#{$ionicons-prefix}social-google:before,\n.#{$ionicons-prefix}social-google-outline:before,\n.#{$ionicons-prefix}social-googleplus:before,\n.#{$ionicons-prefix}social-googleplus-outline:before,\n.#{$ionicons-prefix}social-hackernews:before,\n.#{$ionicons-prefix}social-hackernews-outline:before,\n.#{$ionicons-prefix}social-html5:before,\n.#{$ionicons-prefix}social-html5-outline:before,\n.#{$ionicons-prefix}social-instagram:before,\n.#{$ionicons-prefix}social-instagram-outline:before,\n.#{$ionicons-prefix}social-javascript:before,\n.#{$ionicons-prefix}social-javascript-outline:before,\n.#{$ionicons-prefix}social-linkedin:before,\n.#{$ionicons-prefix}social-linkedin-outline:before,\n.#{$ionicons-prefix}social-markdown:before,\n.#{$ionicons-prefix}social-nodejs:before,\n.#{$ionicons-prefix}social-octocat:before,\n.#{$ionicons-prefix}social-pinterest:before,\n.#{$ionicons-prefix}social-pinterest-outline:before,\n.#{$ionicons-prefix}social-python:before,\n.#{$ionicons-prefix}social-reddit:before,\n.#{$ionicons-prefix}social-reddit-outline:before,\n.#{$ionicons-prefix}social-rss:before,\n.#{$ionicons-prefix}social-rss-outline:before,\n.#{$ionicons-prefix}social-sass:before,\n.#{$ionicons-prefix}social-skype:before,\n.#{$ionicons-prefix}social-skype-outline:before,\n.#{$ionicons-prefix}social-snapchat:before,\n.#{$ionicons-prefix}social-snapchat-outline:before,\n.#{$ionicons-prefix}social-tumblr:before,\n.#{$ionicons-prefix}social-tumblr-outline:before,\n.#{$ionicons-prefix}social-tux:before,\n.#{$ionicons-prefix}social-twitch:before,\n.#{$ionicons-prefix}social-twitch-outline:before,\n.#{$ionicons-prefix}social-twitter:before,\n.#{$ionicons-prefix}social-twitter-outline:before,\n.#{$ionicons-prefix}social-usd:before,\n.#{$ionicons-prefix}social-usd-outline:before,\n.#{$ionicons-prefix}social-vimeo:before,\n.#{$ionicons-prefix}social-vimeo-outline:before,\n.#{$ionicons-prefix}social-whatsapp:before,\n.#{$ionicons-prefix}social-whatsapp-outline:before,\n.#{$ionicons-prefix}social-windows:before,\n.#{$ionicons-prefix}social-windows-outline:before,\n.#{$ionicons-prefix}social-wordpress:before,\n.#{$ionicons-prefix}social-wordpress-outline:before,\n.#{$ionicons-prefix}social-yahoo:before,\n.#{$ionicons-prefix}social-yahoo-outline:before,\n.#{$ionicons-prefix}social-yen:before,\n.#{$ionicons-prefix}social-yen-outline:before,\n.#{$ionicons-prefix}social-youtube:before,\n.#{$ionicons-prefix}social-youtube-outline:before,\n.#{$ionicons-prefix}soup-can:before,\n.#{$ionicons-prefix}soup-can-outline:before,\n.#{$ionicons-prefix}speakerphone:before,\n.#{$ionicons-prefix}speedometer:before,\n.#{$ionicons-prefix}spoon:before,\n.#{$ionicons-prefix}star:before,\n.#{$ionicons-prefix}stats-bars:before,\n.#{$ionicons-prefix}steam:before,\n.#{$ionicons-prefix}stop:before,\n.#{$ionicons-prefix}thermometer:before,\n.#{$ionicons-prefix}thumbsdown:before,\n.#{$ionicons-prefix}thumbsup:before,\n.#{$ionicons-prefix}toggle:before,\n.#{$ionicons-prefix}toggle-filled:before,\n.#{$ionicons-prefix}transgender:before,\n.#{$ionicons-prefix}trash-a:before,\n.#{$ionicons-prefix}trash-b:before,\n.#{$ionicons-prefix}trophy:before,\n.#{$ionicons-prefix}tshirt:before,\n.#{$ionicons-prefix}tshirt-outline:before,\n.#{$ionicons-prefix}umbrella:before,\n.#{$ionicons-prefix}university:before,\n.#{$ionicons-prefix}unlocked:before,\n.#{$ionicons-prefix}upload:before,\n.#{$ionicons-prefix}usb:before,\n.#{$ionicons-prefix}videocamera:before,\n.#{$ionicons-prefix}volume-high:before,\n.#{$ionicons-prefix}volume-low:before,\n.#{$ionicons-prefix}volume-medium:before,\n.#{$ionicons-prefix}volume-mute:before,\n.#{$ionicons-prefix}wand:before,\n.#{$ionicons-prefix}waterdrop:before,\n.#{$ionicons-prefix}wifi:before,\n.#{$ionicons-prefix}wineglass:before,\n.#{$ionicons-prefix}woman:before,\n.#{$ionicons-prefix}wrench:before,\n.#{$ionicons-prefix}xbox:before\n{\n  @extend .ion;\n}\n.#{$ionicons-prefix}alert:before { content: $ionicon-var-alert; }\n.#{$ionicons-prefix}alert-circled:before { content: $ionicon-var-alert-circled; }\n.#{$ionicons-prefix}android-add:before { content: $ionicon-var-android-add; }\n.#{$ionicons-prefix}android-add-circle:before { content: $ionicon-var-android-add-circle; }\n.#{$ionicons-prefix}android-alarm-clock:before { content: $ionicon-var-android-alarm-clock; }\n.#{$ionicons-prefix}android-alert:before { content: $ionicon-var-android-alert; }\n.#{$ionicons-prefix}android-apps:before { content: $ionicon-var-android-apps; }\n.#{$ionicons-prefix}android-archive:before { content: $ionicon-var-android-archive; }\n.#{$ionicons-prefix}android-arrow-back:before { content: $ionicon-var-android-arrow-back; }\n.#{$ionicons-prefix}android-arrow-down:before { content: $ionicon-var-android-arrow-down; }\n.#{$ionicons-prefix}android-arrow-dropdown:before { content: $ionicon-var-android-arrow-dropdown; }\n.#{$ionicons-prefix}android-arrow-dropdown-circle:before { content: $ionicon-var-android-arrow-dropdown-circle; }\n.#{$ionicons-prefix}android-arrow-dropleft:before { content: $ionicon-var-android-arrow-dropleft; }\n.#{$ionicons-prefix}android-arrow-dropleft-circle:before { content: $ionicon-var-android-arrow-dropleft-circle; }\n.#{$ionicons-prefix}android-arrow-dropright:before { content: $ionicon-var-android-arrow-dropright; }\n.#{$ionicons-prefix}android-arrow-dropright-circle:before { content: $ionicon-var-android-arrow-dropright-circle; }\n.#{$ionicons-prefix}android-arrow-dropup:before { content: $ionicon-var-android-arrow-dropup; }\n.#{$ionicons-prefix}android-arrow-dropup-circle:before { content: $ionicon-var-android-arrow-dropup-circle; }\n.#{$ionicons-prefix}android-arrow-forward:before { content: $ionicon-var-android-arrow-forward; }\n.#{$ionicons-prefix}android-arrow-up:before { content: $ionicon-var-android-arrow-up; }\n.#{$ionicons-prefix}android-attach:before { content: $ionicon-var-android-attach; }\n.#{$ionicons-prefix}android-bar:before { content: $ionicon-var-android-bar; }\n.#{$ionicons-prefix}android-bicycle:before { content: $ionicon-var-android-bicycle; }\n.#{$ionicons-prefix}android-boat:before { content: $ionicon-var-android-boat; }\n.#{$ionicons-prefix}android-bookmark:before { content: $ionicon-var-android-bookmark; }\n.#{$ionicons-prefix}android-bulb:before { content: $ionicon-var-android-bulb; }\n.#{$ionicons-prefix}android-bus:before { content: $ionicon-var-android-bus; }\n.#{$ionicons-prefix}android-calendar:before { content: $ionicon-var-android-calendar; }\n.#{$ionicons-prefix}android-call:before { content: $ionicon-var-android-call; }\n.#{$ionicons-prefix}android-camera:before { content: $ionicon-var-android-camera; }\n.#{$ionicons-prefix}android-cancel:before { content: $ionicon-var-android-cancel; }\n.#{$ionicons-prefix}android-car:before { content: $ionicon-var-android-car; }\n.#{$ionicons-prefix}android-cart:before { content: $ionicon-var-android-cart; }\n.#{$ionicons-prefix}android-chat:before { content: $ionicon-var-android-chat; }\n.#{$ionicons-prefix}android-checkbox:before { content: $ionicon-var-android-checkbox; }\n.#{$ionicons-prefix}android-checkbox-blank:before { content: $ionicon-var-android-checkbox-blank; }\n.#{$ionicons-prefix}android-checkbox-outline:before { content: $ionicon-var-android-checkbox-outline; }\n.#{$ionicons-prefix}android-checkbox-outline-blank:before { content: $ionicon-var-android-checkbox-outline-blank; }\n.#{$ionicons-prefix}android-checkmark-circle:before { content: $ionicon-var-android-checkmark-circle; }\n.#{$ionicons-prefix}android-clipboard:before { content: $ionicon-var-android-clipboard; }\n.#{$ionicons-prefix}android-close:before { content: $ionicon-var-android-close; }\n.#{$ionicons-prefix}android-cloud:before { content: $ionicon-var-android-cloud; }\n.#{$ionicons-prefix}android-cloud-circle:before { content: $ionicon-var-android-cloud-circle; }\n.#{$ionicons-prefix}android-cloud-done:before { content: $ionicon-var-android-cloud-done; }\n.#{$ionicons-prefix}android-cloud-outline:before { content: $ionicon-var-android-cloud-outline; }\n.#{$ionicons-prefix}android-color-palette:before { content: $ionicon-var-android-color-palette; }\n.#{$ionicons-prefix}android-compass:before { content: $ionicon-var-android-compass; }\n.#{$ionicons-prefix}android-contact:before { content: $ionicon-var-android-contact; }\n.#{$ionicons-prefix}android-contacts:before { content: $ionicon-var-android-contacts; }\n.#{$ionicons-prefix}android-contract:before { content: $ionicon-var-android-contract; }\n.#{$ionicons-prefix}android-create:before { content: $ionicon-var-android-create; }\n.#{$ionicons-prefix}android-delete:before { content: $ionicon-var-android-delete; }\n.#{$ionicons-prefix}android-desktop:before { content: $ionicon-var-android-desktop; }\n.#{$ionicons-prefix}android-document:before { content: $ionicon-var-android-document; }\n.#{$ionicons-prefix}android-done:before { content: $ionicon-var-android-done; }\n.#{$ionicons-prefix}android-done-all:before { content: $ionicon-var-android-done-all; }\n.#{$ionicons-prefix}android-download:before { content: $ionicon-var-android-download; }\n.#{$ionicons-prefix}android-drafts:before { content: $ionicon-var-android-drafts; }\n.#{$ionicons-prefix}android-exit:before { content: $ionicon-var-android-exit; }\n.#{$ionicons-prefix}android-expand:before { content: $ionicon-var-android-expand; }\n.#{$ionicons-prefix}android-favorite:before { content: $ionicon-var-android-favorite; }\n.#{$ionicons-prefix}android-favorite-outline:before { content: $ionicon-var-android-favorite-outline; }\n.#{$ionicons-prefix}android-film:before { content: $ionicon-var-android-film; }\n.#{$ionicons-prefix}android-folder:before { content: $ionicon-var-android-folder; }\n.#{$ionicons-prefix}android-folder-open:before { content: $ionicon-var-android-folder-open; }\n.#{$ionicons-prefix}android-funnel:before { content: $ionicon-var-android-funnel; }\n.#{$ionicons-prefix}android-globe:before { content: $ionicon-var-android-globe; }\n.#{$ionicons-prefix}android-hand:before { content: $ionicon-var-android-hand; }\n.#{$ionicons-prefix}android-hangout:before { content: $ionicon-var-android-hangout; }\n.#{$ionicons-prefix}android-happy:before { content: $ionicon-var-android-happy; }\n.#{$ionicons-prefix}android-home:before { content: $ionicon-var-android-home; }\n.#{$ionicons-prefix}android-image:before { content: $ionicon-var-android-image; }\n.#{$ionicons-prefix}android-laptop:before { content: $ionicon-var-android-laptop; }\n.#{$ionicons-prefix}android-list:before { content: $ionicon-var-android-list; }\n.#{$ionicons-prefix}android-locate:before { content: $ionicon-var-android-locate; }\n.#{$ionicons-prefix}android-lock:before { content: $ionicon-var-android-lock; }\n.#{$ionicons-prefix}android-mail:before { content: $ionicon-var-android-mail; }\n.#{$ionicons-prefix}android-map:before { content: $ionicon-var-android-map; }\n.#{$ionicons-prefix}android-menu:before { content: $ionicon-var-android-menu; }\n.#{$ionicons-prefix}android-microphone:before { content: $ionicon-var-android-microphone; }\n.#{$ionicons-prefix}android-microphone-off:before { content: $ionicon-var-android-microphone-off; }\n.#{$ionicons-prefix}android-more-horizontal:before { content: $ionicon-var-android-more-horizontal; }\n.#{$ionicons-prefix}android-more-vertical:before { content: $ionicon-var-android-more-vertical; }\n.#{$ionicons-prefix}android-navigate:before { content: $ionicon-var-android-navigate; }\n.#{$ionicons-prefix}android-notifications:before { content: $ionicon-var-android-notifications; }\n.#{$ionicons-prefix}android-notifications-none:before { content: $ionicon-var-android-notifications-none; }\n.#{$ionicons-prefix}android-notifications-off:before { content: $ionicon-var-android-notifications-off; }\n.#{$ionicons-prefix}android-open:before { content: $ionicon-var-android-open; }\n.#{$ionicons-prefix}android-options:before { content: $ionicon-var-android-options; }\n.#{$ionicons-prefix}android-people:before { content: $ionicon-var-android-people; }\n.#{$ionicons-prefix}android-person:before { content: $ionicon-var-android-person; }\n.#{$ionicons-prefix}android-person-add:before { content: $ionicon-var-android-person-add; }\n.#{$ionicons-prefix}android-phone-landscape:before { content: $ionicon-var-android-phone-landscape; }\n.#{$ionicons-prefix}android-phone-portrait:before { content: $ionicon-var-android-phone-portrait; }\n.#{$ionicons-prefix}android-pin:before { content: $ionicon-var-android-pin; }\n.#{$ionicons-prefix}android-plane:before { content: $ionicon-var-android-plane; }\n.#{$ionicons-prefix}android-playstore:before { content: $ionicon-var-android-playstore; }\n.#{$ionicons-prefix}android-print:before { content: $ionicon-var-android-print; }\n.#{$ionicons-prefix}android-radio-button-off:before { content: $ionicon-var-android-radio-button-off; }\n.#{$ionicons-prefix}android-radio-button-on:before { content: $ionicon-var-android-radio-button-on; }\n.#{$ionicons-prefix}android-refresh:before { content: $ionicon-var-android-refresh; }\n.#{$ionicons-prefix}android-remove:before { content: $ionicon-var-android-remove; }\n.#{$ionicons-prefix}android-remove-circle:before { content: $ionicon-var-android-remove-circle; }\n.#{$ionicons-prefix}android-restaurant:before { content: $ionicon-var-android-restaurant; }\n.#{$ionicons-prefix}android-sad:before { content: $ionicon-var-android-sad; }\n.#{$ionicons-prefix}android-search:before { content: $ionicon-var-android-search; }\n.#{$ionicons-prefix}android-send:before { content: $ionicon-var-android-send; }\n.#{$ionicons-prefix}android-settings:before { content: $ionicon-var-android-settings; }\n.#{$ionicons-prefix}android-share:before { content: $ionicon-var-android-share; }\n.#{$ionicons-prefix}android-share-alt:before { content: $ionicon-var-android-share-alt; }\n.#{$ionicons-prefix}android-star:before { content: $ionicon-var-android-star; }\n.#{$ionicons-prefix}android-star-half:before { content: $ionicon-var-android-star-half; }\n.#{$ionicons-prefix}android-star-outline:before { content: $ionicon-var-android-star-outline; }\n.#{$ionicons-prefix}android-stopwatch:before { content: $ionicon-var-android-stopwatch; }\n.#{$ionicons-prefix}android-subway:before { content: $ionicon-var-android-subway; }\n.#{$ionicons-prefix}android-sunny:before { content: $ionicon-var-android-sunny; }\n.#{$ionicons-prefix}android-sync:before { content: $ionicon-var-android-sync; }\n.#{$ionicons-prefix}android-textsms:before { content: $ionicon-var-android-textsms; }\n.#{$ionicons-prefix}android-time:before { content: $ionicon-var-android-time; }\n.#{$ionicons-prefix}android-train:before { content: $ionicon-var-android-train; }\n.#{$ionicons-prefix}android-unlock:before { content: $ionicon-var-android-unlock; }\n.#{$ionicons-prefix}android-upload:before { content: $ionicon-var-android-upload; }\n.#{$ionicons-prefix}android-volume-down:before { content: $ionicon-var-android-volume-down; }\n.#{$ionicons-prefix}android-volume-mute:before { content: $ionicon-var-android-volume-mute; }\n.#{$ionicons-prefix}android-volume-off:before { content: $ionicon-var-android-volume-off; }\n.#{$ionicons-prefix}android-volume-up:before { content: $ionicon-var-android-volume-up; }\n.#{$ionicons-prefix}android-walk:before { content: $ionicon-var-android-walk; }\n.#{$ionicons-prefix}android-warning:before { content: $ionicon-var-android-warning; }\n.#{$ionicons-prefix}android-watch:before { content: $ionicon-var-android-watch; }\n.#{$ionicons-prefix}android-wifi:before { content: $ionicon-var-android-wifi; }\n.#{$ionicons-prefix}aperture:before { content: $ionicon-var-aperture; }\n.#{$ionicons-prefix}archive:before { content: $ionicon-var-archive; }\n.#{$ionicons-prefix}arrow-down-a:before { content: $ionicon-var-arrow-down-a; }\n.#{$ionicons-prefix}arrow-down-b:before { content: $ionicon-var-arrow-down-b; }\n.#{$ionicons-prefix}arrow-down-c:before { content: $ionicon-var-arrow-down-c; }\n.#{$ionicons-prefix}arrow-expand:before { content: $ionicon-var-arrow-expand; }\n.#{$ionicons-prefix}arrow-graph-down-left:before { content: $ionicon-var-arrow-graph-down-left; }\n.#{$ionicons-prefix}arrow-graph-down-right:before { content: $ionicon-var-arrow-graph-down-right; }\n.#{$ionicons-prefix}arrow-graph-up-left:before { content: $ionicon-var-arrow-graph-up-left; }\n.#{$ionicons-prefix}arrow-graph-up-right:before { content: $ionicon-var-arrow-graph-up-right; }\n.#{$ionicons-prefix}arrow-left-a:before { content: $ionicon-var-arrow-left-a; }\n.#{$ionicons-prefix}arrow-left-b:before { content: $ionicon-var-arrow-left-b; }\n.#{$ionicons-prefix}arrow-left-c:before { content: $ionicon-var-arrow-left-c; }\n.#{$ionicons-prefix}arrow-move:before { content: $ionicon-var-arrow-move; }\n.#{$ionicons-prefix}arrow-resize:before { content: $ionicon-var-arrow-resize; }\n.#{$ionicons-prefix}arrow-return-left:before { content: $ionicon-var-arrow-return-left; }\n.#{$ionicons-prefix}arrow-return-right:before { content: $ionicon-var-arrow-return-right; }\n.#{$ionicons-prefix}arrow-right-a:before { content: $ionicon-var-arrow-right-a; }\n.#{$ionicons-prefix}arrow-right-b:before { content: $ionicon-var-arrow-right-b; }\n.#{$ionicons-prefix}arrow-right-c:before { content: $ionicon-var-arrow-right-c; }\n.#{$ionicons-prefix}arrow-shrink:before { content: $ionicon-var-arrow-shrink; }\n.#{$ionicons-prefix}arrow-swap:before { content: $ionicon-var-arrow-swap; }\n.#{$ionicons-prefix}arrow-up-a:before { content: $ionicon-var-arrow-up-a; }\n.#{$ionicons-prefix}arrow-up-b:before { content: $ionicon-var-arrow-up-b; }\n.#{$ionicons-prefix}arrow-up-c:before { content: $ionicon-var-arrow-up-c; }\n.#{$ionicons-prefix}asterisk:before { content: $ionicon-var-asterisk; }\n.#{$ionicons-prefix}at:before { content: $ionicon-var-at; }\n.#{$ionicons-prefix}backspace:before { content: $ionicon-var-backspace; }\n.#{$ionicons-prefix}backspace-outline:before { content: $ionicon-var-backspace-outline; }\n.#{$ionicons-prefix}bag:before { content: $ionicon-var-bag; }\n.#{$ionicons-prefix}battery-charging:before { content: $ionicon-var-battery-charging; }\n.#{$ionicons-prefix}battery-empty:before { content: $ionicon-var-battery-empty; }\n.#{$ionicons-prefix}battery-full:before { content: $ionicon-var-battery-full; }\n.#{$ionicons-prefix}battery-half:before { content: $ionicon-var-battery-half; }\n.#{$ionicons-prefix}battery-low:before { content: $ionicon-var-battery-low; }\n.#{$ionicons-prefix}beaker:before { content: $ionicon-var-beaker; }\n.#{$ionicons-prefix}beer:before { content: $ionicon-var-beer; }\n.#{$ionicons-prefix}bluetooth:before { content: $ionicon-var-bluetooth; }\n.#{$ionicons-prefix}bonfire:before { content: $ionicon-var-bonfire; }\n.#{$ionicons-prefix}bookmark:before { content: $ionicon-var-bookmark; }\n.#{$ionicons-prefix}bowtie:before { content: $ionicon-var-bowtie; }\n.#{$ionicons-prefix}briefcase:before { content: $ionicon-var-briefcase; }\n.#{$ionicons-prefix}bug:before { content: $ionicon-var-bug; }\n.#{$ionicons-prefix}calculator:before { content: $ionicon-var-calculator; }\n.#{$ionicons-prefix}calendar:before { content: $ionicon-var-calendar; }\n.#{$ionicons-prefix}camera:before { content: $ionicon-var-camera; }\n.#{$ionicons-prefix}card:before { content: $ionicon-var-card; }\n.#{$ionicons-prefix}cash:before { content: $ionicon-var-cash; }\n.#{$ionicons-prefix}chatbox:before { content: $ionicon-var-chatbox; }\n.#{$ionicons-prefix}chatbox-working:before { content: $ionicon-var-chatbox-working; }\n.#{$ionicons-prefix}chatboxes:before { content: $ionicon-var-chatboxes; }\n.#{$ionicons-prefix}chatbubble:before { content: $ionicon-var-chatbubble; }\n.#{$ionicons-prefix}chatbubble-working:before { content: $ionicon-var-chatbubble-working; }\n.#{$ionicons-prefix}chatbubbles:before { content: $ionicon-var-chatbubbles; }\n.#{$ionicons-prefix}checkmark:before { content: $ionicon-var-checkmark; }\n.#{$ionicons-prefix}checkmark-circled:before { content: $ionicon-var-checkmark-circled; }\n.#{$ionicons-prefix}checkmark-round:before { content: $ionicon-var-checkmark-round; }\n.#{$ionicons-prefix}chevron-down:before { content: $ionicon-var-chevron-down; }\n.#{$ionicons-prefix}chevron-left:before { content: $ionicon-var-chevron-left; }\n.#{$ionicons-prefix}chevron-right:before { content: $ionicon-var-chevron-right; }\n.#{$ionicons-prefix}chevron-up:before { content: $ionicon-var-chevron-up; }\n.#{$ionicons-prefix}clipboard:before { content: $ionicon-var-clipboard; }\n.#{$ionicons-prefix}clock:before { content: $ionicon-var-clock; }\n.#{$ionicons-prefix}close:before { content: $ionicon-var-close; }\n.#{$ionicons-prefix}close-circled:before { content: $ionicon-var-close-circled; }\n.#{$ionicons-prefix}close-round:before { content: $ionicon-var-close-round; }\n.#{$ionicons-prefix}closed-captioning:before { content: $ionicon-var-closed-captioning; }\n.#{$ionicons-prefix}cloud:before { content: $ionicon-var-cloud; }\n.#{$ionicons-prefix}code:before { content: $ionicon-var-code; }\n.#{$ionicons-prefix}code-download:before { content: $ionicon-var-code-download; }\n.#{$ionicons-prefix}code-working:before { content: $ionicon-var-code-working; }\n.#{$ionicons-prefix}coffee:before { content: $ionicon-var-coffee; }\n.#{$ionicons-prefix}compass:before { content: $ionicon-var-compass; }\n.#{$ionicons-prefix}compose:before { content: $ionicon-var-compose; }\n.#{$ionicons-prefix}connection-bars:before { content: $ionicon-var-connection-bars; }\n.#{$ionicons-prefix}contrast:before { content: $ionicon-var-contrast; }\n.#{$ionicons-prefix}crop:before { content: $ionicon-var-crop; }\n.#{$ionicons-prefix}cube:before { content: $ionicon-var-cube; }\n.#{$ionicons-prefix}disc:before { content: $ionicon-var-disc; }\n.#{$ionicons-prefix}document:before { content: $ionicon-var-document; }\n.#{$ionicons-prefix}document-text:before { content: $ionicon-var-document-text; }\n.#{$ionicons-prefix}drag:before { content: $ionicon-var-drag; }\n.#{$ionicons-prefix}earth:before { content: $ionicon-var-earth; }\n.#{$ionicons-prefix}easel:before { content: $ionicon-var-easel; }\n.#{$ionicons-prefix}edit:before { content: $ionicon-var-edit; }\n.#{$ionicons-prefix}egg:before { content: $ionicon-var-egg; }\n.#{$ionicons-prefix}eject:before { content: $ionicon-var-eject; }\n.#{$ionicons-prefix}email:before { content: $ionicon-var-email; }\n.#{$ionicons-prefix}email-unread:before { content: $ionicon-var-email-unread; }\n.#{$ionicons-prefix}erlenmeyer-flask:before { content: $ionicon-var-erlenmeyer-flask; }\n.#{$ionicons-prefix}erlenmeyer-flask-bubbles:before { content: $ionicon-var-erlenmeyer-flask-bubbles; }\n.#{$ionicons-prefix}eye:before { content: $ionicon-var-eye; }\n.#{$ionicons-prefix}eye-disabled:before { content: $ionicon-var-eye-disabled; }\n.#{$ionicons-prefix}female:before { content: $ionicon-var-female; }\n.#{$ionicons-prefix}filing:before { content: $ionicon-var-filing; }\n.#{$ionicons-prefix}film-marker:before { content: $ionicon-var-film-marker; }\n.#{$ionicons-prefix}fireball:before { content: $ionicon-var-fireball; }\n.#{$ionicons-prefix}flag:before { content: $ionicon-var-flag; }\n.#{$ionicons-prefix}flame:before { content: $ionicon-var-flame; }\n.#{$ionicons-prefix}flash:before { content: $ionicon-var-flash; }\n.#{$ionicons-prefix}flash-off:before { content: $ionicon-var-flash-off; }\n.#{$ionicons-prefix}folder:before { content: $ionicon-var-folder; }\n.#{$ionicons-prefix}fork:before { content: $ionicon-var-fork; }\n.#{$ionicons-prefix}fork-repo:before { content: $ionicon-var-fork-repo; }\n.#{$ionicons-prefix}forward:before { content: $ionicon-var-forward; }\n.#{$ionicons-prefix}funnel:before { content: $ionicon-var-funnel; }\n.#{$ionicons-prefix}gear-a:before { content: $ionicon-var-gear-a; }\n.#{$ionicons-prefix}gear-b:before { content: $ionicon-var-gear-b; }\n.#{$ionicons-prefix}grid:before { content: $ionicon-var-grid; }\n.#{$ionicons-prefix}hammer:before { content: $ionicon-var-hammer; }\n.#{$ionicons-prefix}happy:before { content: $ionicon-var-happy; }\n.#{$ionicons-prefix}happy-outline:before { content: $ionicon-var-happy-outline; }\n.#{$ionicons-prefix}headphone:before { content: $ionicon-var-headphone; }\n.#{$ionicons-prefix}heart:before { content: $ionicon-var-heart; }\n.#{$ionicons-prefix}heart-broken:before { content: $ionicon-var-heart-broken; }\n.#{$ionicons-prefix}help:before { content: $ionicon-var-help; }\n.#{$ionicons-prefix}help-buoy:before { content: $ionicon-var-help-buoy; }\n.#{$ionicons-prefix}help-circled:before { content: $ionicon-var-help-circled; }\n.#{$ionicons-prefix}home:before { content: $ionicon-var-home; }\n.#{$ionicons-prefix}icecream:before { content: $ionicon-var-icecream; }\n.#{$ionicons-prefix}image:before { content: $ionicon-var-image; }\n.#{$ionicons-prefix}images:before { content: $ionicon-var-images; }\n.#{$ionicons-prefix}information:before { content: $ionicon-var-information; }\n.#{$ionicons-prefix}information-circled:before { content: $ionicon-var-information-circled; }\n.#{$ionicons-prefix}ionic:before { content: $ionicon-var-ionic; }\n.#{$ionicons-prefix}ios-alarm:before { content: $ionicon-var-ios-alarm; }\n.#{$ionicons-prefix}ios-alarm-outline:before { content: $ionicon-var-ios-alarm-outline; }\n.#{$ionicons-prefix}ios-albums:before { content: $ionicon-var-ios-albums; }\n.#{$ionicons-prefix}ios-albums-outline:before { content: $ionicon-var-ios-albums-outline; }\n.#{$ionicons-prefix}ios-americanfootball:before { content: $ionicon-var-ios-americanfootball; }\n.#{$ionicons-prefix}ios-americanfootball-outline:before { content: $ionicon-var-ios-americanfootball-outline; }\n.#{$ionicons-prefix}ios-analytics:before { content: $ionicon-var-ios-analytics; }\n.#{$ionicons-prefix}ios-analytics-outline:before { content: $ionicon-var-ios-analytics-outline; }\n.#{$ionicons-prefix}ios-arrow-back:before { content: $ionicon-var-ios-arrow-back; }\n.#{$ionicons-prefix}ios-arrow-down:before { content: $ionicon-var-ios-arrow-down; }\n.#{$ionicons-prefix}ios-arrow-forward:before { content: $ionicon-var-ios-arrow-forward; }\n.#{$ionicons-prefix}ios-arrow-left:before { content: $ionicon-var-ios-arrow-left; }\n.#{$ionicons-prefix}ios-arrow-right:before { content: $ionicon-var-ios-arrow-right; }\n.#{$ionicons-prefix}ios-arrow-thin-down:before { content: $ionicon-var-ios-arrow-thin-down; }\n.#{$ionicons-prefix}ios-arrow-thin-left:before { content: $ionicon-var-ios-arrow-thin-left; }\n.#{$ionicons-prefix}ios-arrow-thin-right:before { content: $ionicon-var-ios-arrow-thin-right; }\n.#{$ionicons-prefix}ios-arrow-thin-up:before { content: $ionicon-var-ios-arrow-thin-up; }\n.#{$ionicons-prefix}ios-arrow-up:before { content: $ionicon-var-ios-arrow-up; }\n.#{$ionicons-prefix}ios-at:before { content: $ionicon-var-ios-at; }\n.#{$ionicons-prefix}ios-at-outline:before { content: $ionicon-var-ios-at-outline; }\n.#{$ionicons-prefix}ios-barcode:before { content: $ionicon-var-ios-barcode; }\n.#{$ionicons-prefix}ios-barcode-outline:before { content: $ionicon-var-ios-barcode-outline; }\n.#{$ionicons-prefix}ios-baseball:before { content: $ionicon-var-ios-baseball; }\n.#{$ionicons-prefix}ios-baseball-outline:before { content: $ionicon-var-ios-baseball-outline; }\n.#{$ionicons-prefix}ios-basketball:before { content: $ionicon-var-ios-basketball; }\n.#{$ionicons-prefix}ios-basketball-outline:before { content: $ionicon-var-ios-basketball-outline; }\n.#{$ionicons-prefix}ios-bell:before { content: $ionicon-var-ios-bell; }\n.#{$ionicons-prefix}ios-bell-outline:before { content: $ionicon-var-ios-bell-outline; }\n.#{$ionicons-prefix}ios-body:before { content: $ionicon-var-ios-body; }\n.#{$ionicons-prefix}ios-body-outline:before { content: $ionicon-var-ios-body-outline; }\n.#{$ionicons-prefix}ios-bolt:before { content: $ionicon-var-ios-bolt; }\n.#{$ionicons-prefix}ios-bolt-outline:before { content: $ionicon-var-ios-bolt-outline; }\n.#{$ionicons-prefix}ios-book:before { content: $ionicon-var-ios-book; }\n.#{$ionicons-prefix}ios-book-outline:before { content: $ionicon-var-ios-book-outline; }\n.#{$ionicons-prefix}ios-bookmarks:before { content: $ionicon-var-ios-bookmarks; }\n.#{$ionicons-prefix}ios-bookmarks-outline:before { content: $ionicon-var-ios-bookmarks-outline; }\n.#{$ionicons-prefix}ios-box:before { content: $ionicon-var-ios-box; }\n.#{$ionicons-prefix}ios-box-outline:before { content: $ionicon-var-ios-box-outline; }\n.#{$ionicons-prefix}ios-briefcase:before { content: $ionicon-var-ios-briefcase; }\n.#{$ionicons-prefix}ios-briefcase-outline:before { content: $ionicon-var-ios-briefcase-outline; }\n.#{$ionicons-prefix}ios-browsers:before { content: $ionicon-var-ios-browsers; }\n.#{$ionicons-prefix}ios-browsers-outline:before { content: $ionicon-var-ios-browsers-outline; }\n.#{$ionicons-prefix}ios-calculator:before { content: $ionicon-var-ios-calculator; }\n.#{$ionicons-prefix}ios-calculator-outline:before { content: $ionicon-var-ios-calculator-outline; }\n.#{$ionicons-prefix}ios-calendar:before { content: $ionicon-var-ios-calendar; }\n.#{$ionicons-prefix}ios-calendar-outline:before { content: $ionicon-var-ios-calendar-outline; }\n.#{$ionicons-prefix}ios-camera:before { content: $ionicon-var-ios-camera; }\n.#{$ionicons-prefix}ios-camera-outline:before { content: $ionicon-var-ios-camera-outline; }\n.#{$ionicons-prefix}ios-cart:before { content: $ionicon-var-ios-cart; }\n.#{$ionicons-prefix}ios-cart-outline:before { content: $ionicon-var-ios-cart-outline; }\n.#{$ionicons-prefix}ios-chatboxes:before { content: $ionicon-var-ios-chatboxes; }\n.#{$ionicons-prefix}ios-chatboxes-outline:before { content: $ionicon-var-ios-chatboxes-outline; }\n.#{$ionicons-prefix}ios-chatbubble:before { content: $ionicon-var-ios-chatbubble; }\n.#{$ionicons-prefix}ios-chatbubble-outline:before { content: $ionicon-var-ios-chatbubble-outline; }\n.#{$ionicons-prefix}ios-checkmark:before { content: $ionicon-var-ios-checkmark; }\n.#{$ionicons-prefix}ios-checkmark-empty:before { content: $ionicon-var-ios-checkmark-empty; }\n.#{$ionicons-prefix}ios-checkmark-outline:before { content: $ionicon-var-ios-checkmark-outline; }\n.#{$ionicons-prefix}ios-circle-filled:before { content: $ionicon-var-ios-circle-filled; }\n.#{$ionicons-prefix}ios-circle-outline:before { content: $ionicon-var-ios-circle-outline; }\n.#{$ionicons-prefix}ios-clock:before { content: $ionicon-var-ios-clock; }\n.#{$ionicons-prefix}ios-clock-outline:before { content: $ionicon-var-ios-clock-outline; }\n.#{$ionicons-prefix}ios-close:before { content: $ionicon-var-ios-close; }\n.#{$ionicons-prefix}ios-close-empty:before { content: $ionicon-var-ios-close-empty; }\n.#{$ionicons-prefix}ios-close-outline:before { content: $ionicon-var-ios-close-outline; }\n.#{$ionicons-prefix}ios-cloud:before { content: $ionicon-var-ios-cloud; }\n.#{$ionicons-prefix}ios-cloud-download:before { content: $ionicon-var-ios-cloud-download; }\n.#{$ionicons-prefix}ios-cloud-download-outline:before { content: $ionicon-var-ios-cloud-download-outline; }\n.#{$ionicons-prefix}ios-cloud-outline:before { content: $ionicon-var-ios-cloud-outline; }\n.#{$ionicons-prefix}ios-cloud-upload:before { content: $ionicon-var-ios-cloud-upload; }\n.#{$ionicons-prefix}ios-cloud-upload-outline:before { content: $ionicon-var-ios-cloud-upload-outline; }\n.#{$ionicons-prefix}ios-cloudy:before { content: $ionicon-var-ios-cloudy; }\n.#{$ionicons-prefix}ios-cloudy-night:before { content: $ionicon-var-ios-cloudy-night; }\n.#{$ionicons-prefix}ios-cloudy-night-outline:before { content: $ionicon-var-ios-cloudy-night-outline; }\n.#{$ionicons-prefix}ios-cloudy-outline:before { content: $ionicon-var-ios-cloudy-outline; }\n.#{$ionicons-prefix}ios-cog:before { content: $ionicon-var-ios-cog; }\n.#{$ionicons-prefix}ios-cog-outline:before { content: $ionicon-var-ios-cog-outline; }\n.#{$ionicons-prefix}ios-color-filter:before { content: $ionicon-var-ios-color-filter; }\n.#{$ionicons-prefix}ios-color-filter-outline:before { content: $ionicon-var-ios-color-filter-outline; }\n.#{$ionicons-prefix}ios-color-wand:before { content: $ionicon-var-ios-color-wand; }\n.#{$ionicons-prefix}ios-color-wand-outline:before { content: $ionicon-var-ios-color-wand-outline; }\n.#{$ionicons-prefix}ios-compose:before { content: $ionicon-var-ios-compose; }\n.#{$ionicons-prefix}ios-compose-outline:before { content: $ionicon-var-ios-compose-outline; }\n.#{$ionicons-prefix}ios-contact:before { content: $ionicon-var-ios-contact; }\n.#{$ionicons-prefix}ios-contact-outline:before { content: $ionicon-var-ios-contact-outline; }\n.#{$ionicons-prefix}ios-copy:before { content: $ionicon-var-ios-copy; }\n.#{$ionicons-prefix}ios-copy-outline:before { content: $ionicon-var-ios-copy-outline; }\n.#{$ionicons-prefix}ios-crop:before { content: $ionicon-var-ios-crop; }\n.#{$ionicons-prefix}ios-crop-strong:before { content: $ionicon-var-ios-crop-strong; }\n.#{$ionicons-prefix}ios-download:before { content: $ionicon-var-ios-download; }\n.#{$ionicons-prefix}ios-download-outline:before { content: $ionicon-var-ios-download-outline; }\n.#{$ionicons-prefix}ios-drag:before { content: $ionicon-var-ios-drag; }\n.#{$ionicons-prefix}ios-email:before { content: $ionicon-var-ios-email; }\n.#{$ionicons-prefix}ios-email-outline:before { content: $ionicon-var-ios-email-outline; }\n.#{$ionicons-prefix}ios-eye:before { content: $ionicon-var-ios-eye; }\n.#{$ionicons-prefix}ios-eye-outline:before { content: $ionicon-var-ios-eye-outline; }\n.#{$ionicons-prefix}ios-fastforward:before { content: $ionicon-var-ios-fastforward; }\n.#{$ionicons-prefix}ios-fastforward-outline:before { content: $ionicon-var-ios-fastforward-outline; }\n.#{$ionicons-prefix}ios-filing:before { content: $ionicon-var-ios-filing; }\n.#{$ionicons-prefix}ios-filing-outline:before { content: $ionicon-var-ios-filing-outline; }\n.#{$ionicons-prefix}ios-film:before { content: $ionicon-var-ios-film; }\n.#{$ionicons-prefix}ios-film-outline:before { content: $ionicon-var-ios-film-outline; }\n.#{$ionicons-prefix}ios-flag:before { content: $ionicon-var-ios-flag; }\n.#{$ionicons-prefix}ios-flag-outline:before { content: $ionicon-var-ios-flag-outline; }\n.#{$ionicons-prefix}ios-flame:before { content: $ionicon-var-ios-flame; }\n.#{$ionicons-prefix}ios-flame-outline:before { content: $ionicon-var-ios-flame-outline; }\n.#{$ionicons-prefix}ios-flask:before { content: $ionicon-var-ios-flask; }\n.#{$ionicons-prefix}ios-flask-outline:before { content: $ionicon-var-ios-flask-outline; }\n.#{$ionicons-prefix}ios-flower:before { content: $ionicon-var-ios-flower; }\n.#{$ionicons-prefix}ios-flower-outline:before { content: $ionicon-var-ios-flower-outline; }\n.#{$ionicons-prefix}ios-folder:before { content: $ionicon-var-ios-folder; }\n.#{$ionicons-prefix}ios-folder-outline:before { content: $ionicon-var-ios-folder-outline; }\n.#{$ionicons-prefix}ios-football:before { content: $ionicon-var-ios-football; }\n.#{$ionicons-prefix}ios-football-outline:before { content: $ionicon-var-ios-football-outline; }\n.#{$ionicons-prefix}ios-game-controller-a:before { content: $ionicon-var-ios-game-controller-a; }\n.#{$ionicons-prefix}ios-game-controller-a-outline:before { content: $ionicon-var-ios-game-controller-a-outline; }\n.#{$ionicons-prefix}ios-game-controller-b:before { content: $ionicon-var-ios-game-controller-b; }\n.#{$ionicons-prefix}ios-game-controller-b-outline:before { content: $ionicon-var-ios-game-controller-b-outline; }\n.#{$ionicons-prefix}ios-gear:before { content: $ionicon-var-ios-gear; }\n.#{$ionicons-prefix}ios-gear-outline:before { content: $ionicon-var-ios-gear-outline; }\n.#{$ionicons-prefix}ios-glasses:before { content: $ionicon-var-ios-glasses; }\n.#{$ionicons-prefix}ios-glasses-outline:before { content: $ionicon-var-ios-glasses-outline; }\n.#{$ionicons-prefix}ios-grid-view:before { content: $ionicon-var-ios-grid-view; }\n.#{$ionicons-prefix}ios-grid-view-outline:before { content: $ionicon-var-ios-grid-view-outline; }\n.#{$ionicons-prefix}ios-heart:before { content: $ionicon-var-ios-heart; }\n.#{$ionicons-prefix}ios-heart-outline:before { content: $ionicon-var-ios-heart-outline; }\n.#{$ionicons-prefix}ios-help:before { content: $ionicon-var-ios-help; }\n.#{$ionicons-prefix}ios-help-empty:before { content: $ionicon-var-ios-help-empty; }\n.#{$ionicons-prefix}ios-help-outline:before { content: $ionicon-var-ios-help-outline; }\n.#{$ionicons-prefix}ios-home:before { content: $ionicon-var-ios-home; }\n.#{$ionicons-prefix}ios-home-outline:before { content: $ionicon-var-ios-home-outline; }\n.#{$ionicons-prefix}ios-infinite:before { content: $ionicon-var-ios-infinite; }\n.#{$ionicons-prefix}ios-infinite-outline:before { content: $ionicon-var-ios-infinite-outline; }\n.#{$ionicons-prefix}ios-information:before { content: $ionicon-var-ios-information; }\n.#{$ionicons-prefix}ios-information-empty:before { content: $ionicon-var-ios-information-empty; }\n.#{$ionicons-prefix}ios-information-outline:before { content: $ionicon-var-ios-information-outline; }\n.#{$ionicons-prefix}ios-ionic-outline:before { content: $ionicon-var-ios-ionic-outline; }\n.#{$ionicons-prefix}ios-keypad:before { content: $ionicon-var-ios-keypad; }\n.#{$ionicons-prefix}ios-keypad-outline:before { content: $ionicon-var-ios-keypad-outline; }\n.#{$ionicons-prefix}ios-lightbulb:before { content: $ionicon-var-ios-lightbulb; }\n.#{$ionicons-prefix}ios-lightbulb-outline:before { content: $ionicon-var-ios-lightbulb-outline; }\n.#{$ionicons-prefix}ios-list:before { content: $ionicon-var-ios-list; }\n.#{$ionicons-prefix}ios-list-outline:before { content: $ionicon-var-ios-list-outline; }\n.#{$ionicons-prefix}ios-location:before { content: $ionicon-var-ios-location; }\n.#{$ionicons-prefix}ios-location-outline:before { content: $ionicon-var-ios-location-outline; }\n.#{$ionicons-prefix}ios-locked:before { content: $ionicon-var-ios-locked; }\n.#{$ionicons-prefix}ios-locked-outline:before { content: $ionicon-var-ios-locked-outline; }\n.#{$ionicons-prefix}ios-loop:before { content: $ionicon-var-ios-loop; }\n.#{$ionicons-prefix}ios-loop-strong:before { content: $ionicon-var-ios-loop-strong; }\n.#{$ionicons-prefix}ios-medical:before { content: $ionicon-var-ios-medical; }\n.#{$ionicons-prefix}ios-medical-outline:before { content: $ionicon-var-ios-medical-outline; }\n.#{$ionicons-prefix}ios-medkit:before { content: $ionicon-var-ios-medkit; }\n.#{$ionicons-prefix}ios-medkit-outline:before { content: $ionicon-var-ios-medkit-outline; }\n.#{$ionicons-prefix}ios-mic:before { content: $ionicon-var-ios-mic; }\n.#{$ionicons-prefix}ios-mic-off:before { content: $ionicon-var-ios-mic-off; }\n.#{$ionicons-prefix}ios-mic-outline:before { content: $ionicon-var-ios-mic-outline; }\n.#{$ionicons-prefix}ios-minus:before { content: $ionicon-var-ios-minus; }\n.#{$ionicons-prefix}ios-minus-empty:before { content: $ionicon-var-ios-minus-empty; }\n.#{$ionicons-prefix}ios-minus-outline:before { content: $ionicon-var-ios-minus-outline; }\n.#{$ionicons-prefix}ios-monitor:before { content: $ionicon-var-ios-monitor; }\n.#{$ionicons-prefix}ios-monitor-outline:before { content: $ionicon-var-ios-monitor-outline; }\n.#{$ionicons-prefix}ios-moon:before { content: $ionicon-var-ios-moon; }\n.#{$ionicons-prefix}ios-moon-outline:before { content: $ionicon-var-ios-moon-outline; }\n.#{$ionicons-prefix}ios-more:before { content: $ionicon-var-ios-more; }\n.#{$ionicons-prefix}ios-more-outline:before { content: $ionicon-var-ios-more-outline; }\n.#{$ionicons-prefix}ios-musical-note:before { content: $ionicon-var-ios-musical-note; }\n.#{$ionicons-prefix}ios-musical-notes:before { content: $ionicon-var-ios-musical-notes; }\n.#{$ionicons-prefix}ios-navigate:before { content: $ionicon-var-ios-navigate; }\n.#{$ionicons-prefix}ios-navigate-outline:before { content: $ionicon-var-ios-navigate-outline; }\n.#{$ionicons-prefix}ios-nutrition:before { content: $ionicon-var-ios-nutrition; }\n.#{$ionicons-prefix}ios-nutrition-outline:before { content: $ionicon-var-ios-nutrition-outline; }\n.#{$ionicons-prefix}ios-paper:before { content: $ionicon-var-ios-paper; }\n.#{$ionicons-prefix}ios-paper-outline:before { content: $ionicon-var-ios-paper-outline; }\n.#{$ionicons-prefix}ios-paperplane:before { content: $ionicon-var-ios-paperplane; }\n.#{$ionicons-prefix}ios-paperplane-outline:before { content: $ionicon-var-ios-paperplane-outline; }\n.#{$ionicons-prefix}ios-partlysunny:before { content: $ionicon-var-ios-partlysunny; }\n.#{$ionicons-prefix}ios-partlysunny-outline:before { content: $ionicon-var-ios-partlysunny-outline; }\n.#{$ionicons-prefix}ios-pause:before { content: $ionicon-var-ios-pause; }\n.#{$ionicons-prefix}ios-pause-outline:before { content: $ionicon-var-ios-pause-outline; }\n.#{$ionicons-prefix}ios-paw:before { content: $ionicon-var-ios-paw; }\n.#{$ionicons-prefix}ios-paw-outline:before { content: $ionicon-var-ios-paw-outline; }\n.#{$ionicons-prefix}ios-people:before { content: $ionicon-var-ios-people; }\n.#{$ionicons-prefix}ios-people-outline:before { content: $ionicon-var-ios-people-outline; }\n.#{$ionicons-prefix}ios-person:before { content: $ionicon-var-ios-person; }\n.#{$ionicons-prefix}ios-person-outline:before { content: $ionicon-var-ios-person-outline; }\n.#{$ionicons-prefix}ios-personadd:before { content: $ionicon-var-ios-personadd; }\n.#{$ionicons-prefix}ios-personadd-outline:before { content: $ionicon-var-ios-personadd-outline; }\n.#{$ionicons-prefix}ios-photos:before { content: $ionicon-var-ios-photos; }\n.#{$ionicons-prefix}ios-photos-outline:before { content: $ionicon-var-ios-photos-outline; }\n.#{$ionicons-prefix}ios-pie:before { content: $ionicon-var-ios-pie; }\n.#{$ionicons-prefix}ios-pie-outline:before { content: $ionicon-var-ios-pie-outline; }\n.#{$ionicons-prefix}ios-pint:before { content: $ionicon-var-ios-pint; }\n.#{$ionicons-prefix}ios-pint-outline:before { content: $ionicon-var-ios-pint-outline; }\n.#{$ionicons-prefix}ios-play:before { content: $ionicon-var-ios-play; }\n.#{$ionicons-prefix}ios-play-outline:before { content: $ionicon-var-ios-play-outline; }\n.#{$ionicons-prefix}ios-plus:before { content: $ionicon-var-ios-plus; }\n.#{$ionicons-prefix}ios-plus-empty:before { content: $ionicon-var-ios-plus-empty; }\n.#{$ionicons-prefix}ios-plus-outline:before { content: $ionicon-var-ios-plus-outline; }\n.#{$ionicons-prefix}ios-pricetag:before { content: $ionicon-var-ios-pricetag; }\n.#{$ionicons-prefix}ios-pricetag-outline:before { content: $ionicon-var-ios-pricetag-outline; }\n.#{$ionicons-prefix}ios-pricetags:before { content: $ionicon-var-ios-pricetags; }\n.#{$ionicons-prefix}ios-pricetags-outline:before { content: $ionicon-var-ios-pricetags-outline; }\n.#{$ionicons-prefix}ios-printer:before { content: $ionicon-var-ios-printer; }\n.#{$ionicons-prefix}ios-printer-outline:before { content: $ionicon-var-ios-printer-outline; }\n.#{$ionicons-prefix}ios-pulse:before { content: $ionicon-var-ios-pulse; }\n.#{$ionicons-prefix}ios-pulse-strong:before { content: $ionicon-var-ios-pulse-strong; }\n.#{$ionicons-prefix}ios-rainy:before { content: $ionicon-var-ios-rainy; }\n.#{$ionicons-prefix}ios-rainy-outline:before { content: $ionicon-var-ios-rainy-outline; }\n.#{$ionicons-prefix}ios-recording:before { content: $ionicon-var-ios-recording; }\n.#{$ionicons-prefix}ios-recording-outline:before { content: $ionicon-var-ios-recording-outline; }\n.#{$ionicons-prefix}ios-redo:before { content: $ionicon-var-ios-redo; }\n.#{$ionicons-prefix}ios-redo-outline:before { content: $ionicon-var-ios-redo-outline; }\n.#{$ionicons-prefix}ios-refresh:before { content: $ionicon-var-ios-refresh; }\n.#{$ionicons-prefix}ios-refresh-empty:before { content: $ionicon-var-ios-refresh-empty; }\n.#{$ionicons-prefix}ios-refresh-outline:before { content: $ionicon-var-ios-refresh-outline; }\n.#{$ionicons-prefix}ios-reload:before { content: $ionicon-var-ios-reload; }\n.#{$ionicons-prefix}ios-reverse-camera:before { content: $ionicon-var-ios-reverse-camera; }\n.#{$ionicons-prefix}ios-reverse-camera-outline:before { content: $ionicon-var-ios-reverse-camera-outline; }\n.#{$ionicons-prefix}ios-rewind:before { content: $ionicon-var-ios-rewind; }\n.#{$ionicons-prefix}ios-rewind-outline:before { content: $ionicon-var-ios-rewind-outline; }\n.#{$ionicons-prefix}ios-rose:before { content: $ionicon-var-ios-rose; }\n.#{$ionicons-prefix}ios-rose-outline:before { content: $ionicon-var-ios-rose-outline; }\n.#{$ionicons-prefix}ios-search:before { content: $ionicon-var-ios-search; }\n.#{$ionicons-prefix}ios-search-strong:before { content: $ionicon-var-ios-search-strong; }\n.#{$ionicons-prefix}ios-settings:before { content: $ionicon-var-ios-settings; }\n.#{$ionicons-prefix}ios-settings-strong:before { content: $ionicon-var-ios-settings-strong; }\n.#{$ionicons-prefix}ios-shuffle:before { content: $ionicon-var-ios-shuffle; }\n.#{$ionicons-prefix}ios-shuffle-strong:before { content: $ionicon-var-ios-shuffle-strong; }\n.#{$ionicons-prefix}ios-skipbackward:before { content: $ionicon-var-ios-skipbackward; }\n.#{$ionicons-prefix}ios-skipbackward-outline:before { content: $ionicon-var-ios-skipbackward-outline; }\n.#{$ionicons-prefix}ios-skipforward:before { content: $ionicon-var-ios-skipforward; }\n.#{$ionicons-prefix}ios-skipforward-outline:before { content: $ionicon-var-ios-skipforward-outline; }\n.#{$ionicons-prefix}ios-snowy:before { content: $ionicon-var-ios-snowy; }\n.#{$ionicons-prefix}ios-speedometer:before { content: $ionicon-var-ios-speedometer; }\n.#{$ionicons-prefix}ios-speedometer-outline:before { content: $ionicon-var-ios-speedometer-outline; }\n.#{$ionicons-prefix}ios-star:before { content: $ionicon-var-ios-star; }\n.#{$ionicons-prefix}ios-star-half:before { content: $ionicon-var-ios-star-half; }\n.#{$ionicons-prefix}ios-star-outline:before { content: $ionicon-var-ios-star-outline; }\n.#{$ionicons-prefix}ios-stopwatch:before { content: $ionicon-var-ios-stopwatch; }\n.#{$ionicons-prefix}ios-stopwatch-outline:before { content: $ionicon-var-ios-stopwatch-outline; }\n.#{$ionicons-prefix}ios-sunny:before { content: $ionicon-var-ios-sunny; }\n.#{$ionicons-prefix}ios-sunny-outline:before { content: $ionicon-var-ios-sunny-outline; }\n.#{$ionicons-prefix}ios-telephone:before { content: $ionicon-var-ios-telephone; }\n.#{$ionicons-prefix}ios-telephone-outline:before { content: $ionicon-var-ios-telephone-outline; }\n.#{$ionicons-prefix}ios-tennisball:before { content: $ionicon-var-ios-tennisball; }\n.#{$ionicons-prefix}ios-tennisball-outline:before { content: $ionicon-var-ios-tennisball-outline; }\n.#{$ionicons-prefix}ios-thunderstorm:before { content: $ionicon-var-ios-thunderstorm; }\n.#{$ionicons-prefix}ios-thunderstorm-outline:before { content: $ionicon-var-ios-thunderstorm-outline; }\n.#{$ionicons-prefix}ios-time:before { content: $ionicon-var-ios-time; }\n.#{$ionicons-prefix}ios-time-outline:before { content: $ionicon-var-ios-time-outline; }\n.#{$ionicons-prefix}ios-timer:before { content: $ionicon-var-ios-timer; }\n.#{$ionicons-prefix}ios-timer-outline:before { content: $ionicon-var-ios-timer-outline; }\n.#{$ionicons-prefix}ios-toggle:before { content: $ionicon-var-ios-toggle; }\n.#{$ionicons-prefix}ios-toggle-outline:before { content: $ionicon-var-ios-toggle-outline; }\n.#{$ionicons-prefix}ios-trash:before { content: $ionicon-var-ios-trash; }\n.#{$ionicons-prefix}ios-trash-outline:before { content: $ionicon-var-ios-trash-outline; }\n.#{$ionicons-prefix}ios-undo:before { content: $ionicon-var-ios-undo; }\n.#{$ionicons-prefix}ios-undo-outline:before { content: $ionicon-var-ios-undo-outline; }\n.#{$ionicons-prefix}ios-unlocked:before { content: $ionicon-var-ios-unlocked; }\n.#{$ionicons-prefix}ios-unlocked-outline:before { content: $ionicon-var-ios-unlocked-outline; }\n.#{$ionicons-prefix}ios-upload:before { content: $ionicon-var-ios-upload; }\n.#{$ionicons-prefix}ios-upload-outline:before { content: $ionicon-var-ios-upload-outline; }\n.#{$ionicons-prefix}ios-videocam:before { content: $ionicon-var-ios-videocam; }\n.#{$ionicons-prefix}ios-videocam-outline:before { content: $ionicon-var-ios-videocam-outline; }\n.#{$ionicons-prefix}ios-volume-high:before { content: $ionicon-var-ios-volume-high; }\n.#{$ionicons-prefix}ios-volume-low:before { content: $ionicon-var-ios-volume-low; }\n.#{$ionicons-prefix}ios-wineglass:before { content: $ionicon-var-ios-wineglass; }\n.#{$ionicons-prefix}ios-wineglass-outline:before { content: $ionicon-var-ios-wineglass-outline; }\n.#{$ionicons-prefix}ios-world:before { content: $ionicon-var-ios-world; }\n.#{$ionicons-prefix}ios-world-outline:before { content: $ionicon-var-ios-world-outline; }\n.#{$ionicons-prefix}ipad:before { content: $ionicon-var-ipad; }\n.#{$ionicons-prefix}iphone:before { content: $ionicon-var-iphone; }\n.#{$ionicons-prefix}ipod:before { content: $ionicon-var-ipod; }\n.#{$ionicons-prefix}jet:before { content: $ionicon-var-jet; }\n.#{$ionicons-prefix}key:before { content: $ionicon-var-key; }\n.#{$ionicons-prefix}knife:before { content: $ionicon-var-knife; }\n.#{$ionicons-prefix}laptop:before { content: $ionicon-var-laptop; }\n.#{$ionicons-prefix}leaf:before { content: $ionicon-var-leaf; }\n.#{$ionicons-prefix}levels:before { content: $ionicon-var-levels; }\n.#{$ionicons-prefix}lightbulb:before { content: $ionicon-var-lightbulb; }\n.#{$ionicons-prefix}link:before { content: $ionicon-var-link; }\n.#{$ionicons-prefix}load-a:before { content: $ionicon-var-load-a; }\n.#{$ionicons-prefix}load-b:before { content: $ionicon-var-load-b; }\n.#{$ionicons-prefix}load-c:before { content: $ionicon-var-load-c; }\n.#{$ionicons-prefix}load-d:before { content: $ionicon-var-load-d; }\n.#{$ionicons-prefix}location:before { content: $ionicon-var-location; }\n.#{$ionicons-prefix}lock-combination:before { content: $ionicon-var-lock-combination; }\n.#{$ionicons-prefix}locked:before { content: $ionicon-var-locked; }\n.#{$ionicons-prefix}log-in:before { content: $ionicon-var-log-in; }\n.#{$ionicons-prefix}log-out:before { content: $ionicon-var-log-out; }\n.#{$ionicons-prefix}loop:before { content: $ionicon-var-loop; }\n.#{$ionicons-prefix}magnet:before { content: $ionicon-var-magnet; }\n.#{$ionicons-prefix}male:before { content: $ionicon-var-male; }\n.#{$ionicons-prefix}man:before { content: $ionicon-var-man; }\n.#{$ionicons-prefix}map:before { content: $ionicon-var-map; }\n.#{$ionicons-prefix}medkit:before { content: $ionicon-var-medkit; }\n.#{$ionicons-prefix}merge:before { content: $ionicon-var-merge; }\n.#{$ionicons-prefix}mic-a:before { content: $ionicon-var-mic-a; }\n.#{$ionicons-prefix}mic-b:before { content: $ionicon-var-mic-b; }\n.#{$ionicons-prefix}mic-c:before { content: $ionicon-var-mic-c; }\n.#{$ionicons-prefix}minus:before { content: $ionicon-var-minus; }\n.#{$ionicons-prefix}minus-circled:before { content: $ionicon-var-minus-circled; }\n.#{$ionicons-prefix}minus-round:before { content: $ionicon-var-minus-round; }\n.#{$ionicons-prefix}model-s:before { content: $ionicon-var-model-s; }\n.#{$ionicons-prefix}monitor:before { content: $ionicon-var-monitor; }\n.#{$ionicons-prefix}more:before { content: $ionicon-var-more; }\n.#{$ionicons-prefix}mouse:before { content: $ionicon-var-mouse; }\n.#{$ionicons-prefix}music-note:before { content: $ionicon-var-music-note; }\n.#{$ionicons-prefix}navicon:before { content: $ionicon-var-navicon; }\n.#{$ionicons-prefix}navicon-round:before { content: $ionicon-var-navicon-round; }\n.#{$ionicons-prefix}navigate:before { content: $ionicon-var-navigate; }\n.#{$ionicons-prefix}network:before { content: $ionicon-var-network; }\n.#{$ionicons-prefix}no-smoking:before { content: $ionicon-var-no-smoking; }\n.#{$ionicons-prefix}nuclear:before { content: $ionicon-var-nuclear; }\n.#{$ionicons-prefix}outlet:before { content: $ionicon-var-outlet; }\n.#{$ionicons-prefix}paintbrush:before { content: $ionicon-var-paintbrush; }\n.#{$ionicons-prefix}paintbucket:before { content: $ionicon-var-paintbucket; }\n.#{$ionicons-prefix}paper-airplane:before { content: $ionicon-var-paper-airplane; }\n.#{$ionicons-prefix}paperclip:before { content: $ionicon-var-paperclip; }\n.#{$ionicons-prefix}pause:before { content: $ionicon-var-pause; }\n.#{$ionicons-prefix}person:before { content: $ionicon-var-person; }\n.#{$ionicons-prefix}person-add:before { content: $ionicon-var-person-add; }\n.#{$ionicons-prefix}person-stalker:before { content: $ionicon-var-person-stalker; }\n.#{$ionicons-prefix}pie-graph:before { content: $ionicon-var-pie-graph; }\n.#{$ionicons-prefix}pin:before { content: $ionicon-var-pin; }\n.#{$ionicons-prefix}pinpoint:before { content: $ionicon-var-pinpoint; }\n.#{$ionicons-prefix}pizza:before { content: $ionicon-var-pizza; }\n.#{$ionicons-prefix}plane:before { content: $ionicon-var-plane; }\n.#{$ionicons-prefix}planet:before { content: $ionicon-var-planet; }\n.#{$ionicons-prefix}play:before { content: $ionicon-var-play; }\n.#{$ionicons-prefix}playstation:before { content: $ionicon-var-playstation; }\n.#{$ionicons-prefix}plus:before { content: $ionicon-var-plus; }\n.#{$ionicons-prefix}plus-circled:before { content: $ionicon-var-plus-circled; }\n.#{$ionicons-prefix}plus-round:before { content: $ionicon-var-plus-round; }\n.#{$ionicons-prefix}podium:before { content: $ionicon-var-podium; }\n.#{$ionicons-prefix}pound:before { content: $ionicon-var-pound; }\n.#{$ionicons-prefix}power:before { content: $ionicon-var-power; }\n.#{$ionicons-prefix}pricetag:before { content: $ionicon-var-pricetag; }\n.#{$ionicons-prefix}pricetags:before { content: $ionicon-var-pricetags; }\n.#{$ionicons-prefix}printer:before { content: $ionicon-var-printer; }\n.#{$ionicons-prefix}pull-request:before { content: $ionicon-var-pull-request; }\n.#{$ionicons-prefix}qr-scanner:before { content: $ionicon-var-qr-scanner; }\n.#{$ionicons-prefix}quote:before { content: $ionicon-var-quote; }\n.#{$ionicons-prefix}radio-waves:before { content: $ionicon-var-radio-waves; }\n.#{$ionicons-prefix}record:before { content: $ionicon-var-record; }\n.#{$ionicons-prefix}refresh:before { content: $ionicon-var-refresh; }\n.#{$ionicons-prefix}reply:before { content: $ionicon-var-reply; }\n.#{$ionicons-prefix}reply-all:before { content: $ionicon-var-reply-all; }\n.#{$ionicons-prefix}ribbon-a:before { content: $ionicon-var-ribbon-a; }\n.#{$ionicons-prefix}ribbon-b:before { content: $ionicon-var-ribbon-b; }\n.#{$ionicons-prefix}sad:before { content: $ionicon-var-sad; }\n.#{$ionicons-prefix}sad-outline:before { content: $ionicon-var-sad-outline; }\n.#{$ionicons-prefix}scissors:before { content: $ionicon-var-scissors; }\n.#{$ionicons-prefix}search:before { content: $ionicon-var-search; }\n.#{$ionicons-prefix}settings:before { content: $ionicon-var-settings; }\n.#{$ionicons-prefix}share:before { content: $ionicon-var-share; }\n.#{$ionicons-prefix}shuffle:before { content: $ionicon-var-shuffle; }\n.#{$ionicons-prefix}skip-backward:before { content: $ionicon-var-skip-backward; }\n.#{$ionicons-prefix}skip-forward:before { content: $ionicon-var-skip-forward; }\n.#{$ionicons-prefix}social-android:before { content: $ionicon-var-social-android; }\n.#{$ionicons-prefix}social-android-outline:before { content: $ionicon-var-social-android-outline; }\n.#{$ionicons-prefix}social-angular:before { content: $ionicon-var-social-angular; }\n.#{$ionicons-prefix}social-angular-outline:before { content: $ionicon-var-social-angular-outline; }\n.#{$ionicons-prefix}social-apple:before { content: $ionicon-var-social-apple; }\n.#{$ionicons-prefix}social-apple-outline:before { content: $ionicon-var-social-apple-outline; }\n.#{$ionicons-prefix}social-bitcoin:before { content: $ionicon-var-social-bitcoin; }\n.#{$ionicons-prefix}social-bitcoin-outline:before { content: $ionicon-var-social-bitcoin-outline; }\n.#{$ionicons-prefix}social-buffer:before { content: $ionicon-var-social-buffer; }\n.#{$ionicons-prefix}social-buffer-outline:before { content: $ionicon-var-social-buffer-outline; }\n.#{$ionicons-prefix}social-chrome:before { content: $ionicon-var-social-chrome; }\n.#{$ionicons-prefix}social-chrome-outline:before { content: $ionicon-var-social-chrome-outline; }\n.#{$ionicons-prefix}social-codepen:before { content: $ionicon-var-social-codepen; }\n.#{$ionicons-prefix}social-codepen-outline:before { content: $ionicon-var-social-codepen-outline; }\n.#{$ionicons-prefix}social-css3:before { content: $ionicon-var-social-css3; }\n.#{$ionicons-prefix}social-css3-outline:before { content: $ionicon-var-social-css3-outline; }\n.#{$ionicons-prefix}social-designernews:before { content: $ionicon-var-social-designernews; }\n.#{$ionicons-prefix}social-designernews-outline:before { content: $ionicon-var-social-designernews-outline; }\n.#{$ionicons-prefix}social-dribbble:before { content: $ionicon-var-social-dribbble; }\n.#{$ionicons-prefix}social-dribbble-outline:before { content: $ionicon-var-social-dribbble-outline; }\n.#{$ionicons-prefix}social-dropbox:before { content: $ionicon-var-social-dropbox; }\n.#{$ionicons-prefix}social-dropbox-outline:before { content: $ionicon-var-social-dropbox-outline; }\n.#{$ionicons-prefix}social-euro:before { content: $ionicon-var-social-euro; }\n.#{$ionicons-prefix}social-euro-outline:before { content: $ionicon-var-social-euro-outline; }\n.#{$ionicons-prefix}social-facebook:before { content: $ionicon-var-social-facebook; }\n.#{$ionicons-prefix}social-facebook-outline:before { content: $ionicon-var-social-facebook-outline; }\n.#{$ionicons-prefix}social-foursquare:before { content: $ionicon-var-social-foursquare; }\n.#{$ionicons-prefix}social-foursquare-outline:before { content: $ionicon-var-social-foursquare-outline; }\n.#{$ionicons-prefix}social-freebsd-devil:before { content: $ionicon-var-social-freebsd-devil; }\n.#{$ionicons-prefix}social-github:before { content: $ionicon-var-social-github; }\n.#{$ionicons-prefix}social-github-outline:before { content: $ionicon-var-social-github-outline; }\n.#{$ionicons-prefix}social-google:before { content: $ionicon-var-social-google; }\n.#{$ionicons-prefix}social-google-outline:before { content: $ionicon-var-social-google-outline; }\n.#{$ionicons-prefix}social-googleplus:before { content: $ionicon-var-social-googleplus; }\n.#{$ionicons-prefix}social-googleplus-outline:before { content: $ionicon-var-social-googleplus-outline; }\n.#{$ionicons-prefix}social-hackernews:before { content: $ionicon-var-social-hackernews; }\n.#{$ionicons-prefix}social-hackernews-outline:before { content: $ionicon-var-social-hackernews-outline; }\n.#{$ionicons-prefix}social-html5:before { content: $ionicon-var-social-html5; }\n.#{$ionicons-prefix}social-html5-outline:before { content: $ionicon-var-social-html5-outline; }\n.#{$ionicons-prefix}social-instagram:before { content: $ionicon-var-social-instagram; }\n.#{$ionicons-prefix}social-instagram-outline:before { content: $ionicon-var-social-instagram-outline; }\n.#{$ionicons-prefix}social-javascript:before { content: $ionicon-var-social-javascript; }\n.#{$ionicons-prefix}social-javascript-outline:before { content: $ionicon-var-social-javascript-outline; }\n.#{$ionicons-prefix}social-linkedin:before { content: $ionicon-var-social-linkedin; }\n.#{$ionicons-prefix}social-linkedin-outline:before { content: $ionicon-var-social-linkedin-outline; }\n.#{$ionicons-prefix}social-markdown:before { content: $ionicon-var-social-markdown; }\n.#{$ionicons-prefix}social-nodejs:before { content: $ionicon-var-social-nodejs; }\n.#{$ionicons-prefix}social-octocat:before { content: $ionicon-var-social-octocat; }\n.#{$ionicons-prefix}social-pinterest:before { content: $ionicon-var-social-pinterest; }\n.#{$ionicons-prefix}social-pinterest-outline:before { content: $ionicon-var-social-pinterest-outline; }\n.#{$ionicons-prefix}social-python:before { content: $ionicon-var-social-python; }\n.#{$ionicons-prefix}social-reddit:before { content: $ionicon-var-social-reddit; }\n.#{$ionicons-prefix}social-reddit-outline:before { content: $ionicon-var-social-reddit-outline; }\n.#{$ionicons-prefix}social-rss:before { content: $ionicon-var-social-rss; }\n.#{$ionicons-prefix}social-rss-outline:before { content: $ionicon-var-social-rss-outline; }\n.#{$ionicons-prefix}social-sass:before { content: $ionicon-var-social-sass; }\n.#{$ionicons-prefix}social-skype:before { content: $ionicon-var-social-skype; }\n.#{$ionicons-prefix}social-skype-outline:before { content: $ionicon-var-social-skype-outline; }\n.#{$ionicons-prefix}social-snapchat:before { content: $ionicon-var-social-snapchat; }\n.#{$ionicons-prefix}social-snapchat-outline:before { content: $ionicon-var-social-snapchat-outline; }\n.#{$ionicons-prefix}social-tumblr:before { content: $ionicon-var-social-tumblr; }\n.#{$ionicons-prefix}social-tumblr-outline:before { content: $ionicon-var-social-tumblr-outline; }\n.#{$ionicons-prefix}social-tux:before { content: $ionicon-var-social-tux; }\n.#{$ionicons-prefix}social-twitch:before { content: $ionicon-var-social-twitch; }\n.#{$ionicons-prefix}social-twitch-outline:before { content: $ionicon-var-social-twitch-outline; }\n.#{$ionicons-prefix}social-twitter:before { content: $ionicon-var-social-twitter; }\n.#{$ionicons-prefix}social-twitter-outline:before { content: $ionicon-var-social-twitter-outline; }\n.#{$ionicons-prefix}social-usd:before { content: $ionicon-var-social-usd; }\n.#{$ionicons-prefix}social-usd-outline:before { content: $ionicon-var-social-usd-outline; }\n.#{$ionicons-prefix}social-vimeo:before { content: $ionicon-var-social-vimeo; }\n.#{$ionicons-prefix}social-vimeo-outline:before { content: $ionicon-var-social-vimeo-outline; }\n.#{$ionicons-prefix}social-whatsapp:before { content: $ionicon-var-social-whatsapp; }\n.#{$ionicons-prefix}social-whatsapp-outline:before { content: $ionicon-var-social-whatsapp-outline; }\n.#{$ionicons-prefix}social-windows:before { content: $ionicon-var-social-windows; }\n.#{$ionicons-prefix}social-windows-outline:before { content: $ionicon-var-social-windows-outline; }\n.#{$ionicons-prefix}social-wordpress:before { content: $ionicon-var-social-wordpress; }\n.#{$ionicons-prefix}social-wordpress-outline:before { content: $ionicon-var-social-wordpress-outline; }\n.#{$ionicons-prefix}social-yahoo:before { content: $ionicon-var-social-yahoo; }\n.#{$ionicons-prefix}social-yahoo-outline:before { content: $ionicon-var-social-yahoo-outline; }\n.#{$ionicons-prefix}social-yen:before { content: $ionicon-var-social-yen; }\n.#{$ionicons-prefix}social-yen-outline:before { content: $ionicon-var-social-yen-outline; }\n.#{$ionicons-prefix}social-youtube:before { content: $ionicon-var-social-youtube; }\n.#{$ionicons-prefix}social-youtube-outline:before { content: $ionicon-var-social-youtube-outline; }\n.#{$ionicons-prefix}soup-can:before { content: $ionicon-var-soup-can; }\n.#{$ionicons-prefix}soup-can-outline:before { content: $ionicon-var-soup-can-outline; }\n.#{$ionicons-prefix}speakerphone:before { content: $ionicon-var-speakerphone; }\n.#{$ionicons-prefix}speedometer:before { content: $ionicon-var-speedometer; }\n.#{$ionicons-prefix}spoon:before { content: $ionicon-var-spoon; }\n.#{$ionicons-prefix}star:before { content: $ionicon-var-star; }\n.#{$ionicons-prefix}stats-bars:before { content: $ionicon-var-stats-bars; }\n.#{$ionicons-prefix}steam:before { content: $ionicon-var-steam; }\n.#{$ionicons-prefix}stop:before { content: $ionicon-var-stop; }\n.#{$ionicons-prefix}thermometer:before { content: $ionicon-var-thermometer; }\n.#{$ionicons-prefix}thumbsdown:before { content: $ionicon-var-thumbsdown; }\n.#{$ionicons-prefix}thumbsup:before { content: $ionicon-var-thumbsup; }\n.#{$ionicons-prefix}toggle:before { content: $ionicon-var-toggle; }\n.#{$ionicons-prefix}toggle-filled:before { content: $ionicon-var-toggle-filled; }\n.#{$ionicons-prefix}transgender:before { content: $ionicon-var-transgender; }\n.#{$ionicons-prefix}trash-a:before { content: $ionicon-var-trash-a; }\n.#{$ionicons-prefix}trash-b:before { content: $ionicon-var-trash-b; }\n.#{$ionicons-prefix}trophy:before { content: $ionicon-var-trophy; }\n.#{$ionicons-prefix}tshirt:before { content: $ionicon-var-tshirt; }\n.#{$ionicons-prefix}tshirt-outline:before { content: $ionicon-var-tshirt-outline; }\n.#{$ionicons-prefix}umbrella:before { content: $ionicon-var-umbrella; }\n.#{$ionicons-prefix}university:before { content: $ionicon-var-university; }\n.#{$ionicons-prefix}unlocked:before { content: $ionicon-var-unlocked; }\n.#{$ionicons-prefix}upload:before { content: $ionicon-var-upload; }\n.#{$ionicons-prefix}usb:before { content: $ionicon-var-usb; }\n.#{$ionicons-prefix}videocamera:before { content: $ionicon-var-videocamera; }\n.#{$ionicons-prefix}volume-high:before { content: $ionicon-var-volume-high; }\n.#{$ionicons-prefix}volume-low:before { content: $ionicon-var-volume-low; }\n.#{$ionicons-prefix}volume-medium:before { content: $ionicon-var-volume-medium; }\n.#{$ionicons-prefix}volume-mute:before { content: $ionicon-var-volume-mute; }\n.#{$ionicons-prefix}wand:before { content: $ionicon-var-wand; }\n.#{$ionicons-prefix}waterdrop:before { content: $ionicon-var-waterdrop; }\n.#{$ionicons-prefix}wifi:before { content: $ionicon-var-wifi; }\n.#{$ionicons-prefix}wineglass:before { content: $ionicon-var-wineglass; }\n.#{$ionicons-prefix}woman:before { content: $ionicon-var-woman; }\n.#{$ionicons-prefix}wrench:before { content: $ionicon-var-wrench; }\n.#{$ionicons-prefix}xbox:before { content: $ionicon-var-xbox; }"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/ionicons/_ionicons-variables.scss",
    "content": "// Ionicons Variables\n// --------------------------\n\n$ionicons-font-path: \"../fonts\" !default;\n$ionicons-font-family: \"Ionicons\" !default;\n$ionicons-version: \"2.0.1\" !default;\n$ionicons-prefix: ion- !default;\n\n$ionicon-var-alert: \"\\f101\";\n$ionicon-var-alert-circled: \"\\f100\";\n$ionicon-var-android-add: \"\\f2c7\";\n$ionicon-var-android-add-circle: \"\\f359\";\n$ionicon-var-android-alarm-clock: \"\\f35a\";\n$ionicon-var-android-alert: \"\\f35b\";\n$ionicon-var-android-apps: \"\\f35c\";\n$ionicon-var-android-archive: \"\\f2c9\";\n$ionicon-var-android-arrow-back: \"\\f2ca\";\n$ionicon-var-android-arrow-down: \"\\f35d\";\n$ionicon-var-android-arrow-dropdown: \"\\f35f\";\n$ionicon-var-android-arrow-dropdown-circle: \"\\f35e\";\n$ionicon-var-android-arrow-dropleft: \"\\f361\";\n$ionicon-var-android-arrow-dropleft-circle: \"\\f360\";\n$ionicon-var-android-arrow-dropright: \"\\f363\";\n$ionicon-var-android-arrow-dropright-circle: \"\\f362\";\n$ionicon-var-android-arrow-dropup: \"\\f365\";\n$ionicon-var-android-arrow-dropup-circle: \"\\f364\";\n$ionicon-var-android-arrow-forward: \"\\f30f\";\n$ionicon-var-android-arrow-up: \"\\f366\";\n$ionicon-var-android-attach: \"\\f367\";\n$ionicon-var-android-bar: \"\\f368\";\n$ionicon-var-android-bicycle: \"\\f369\";\n$ionicon-var-android-boat: \"\\f36a\";\n$ionicon-var-android-bookmark: \"\\f36b\";\n$ionicon-var-android-bulb: \"\\f36c\";\n$ionicon-var-android-bus: \"\\f36d\";\n$ionicon-var-android-calendar: \"\\f2d1\";\n$ionicon-var-android-call: \"\\f2d2\";\n$ionicon-var-android-camera: \"\\f2d3\";\n$ionicon-var-android-cancel: \"\\f36e\";\n$ionicon-var-android-car: \"\\f36f\";\n$ionicon-var-android-cart: \"\\f370\";\n$ionicon-var-android-chat: \"\\f2d4\";\n$ionicon-var-android-checkbox: \"\\f374\";\n$ionicon-var-android-checkbox-blank: \"\\f371\";\n$ionicon-var-android-checkbox-outline: \"\\f373\";\n$ionicon-var-android-checkbox-outline-blank: \"\\f372\";\n$ionicon-var-android-checkmark-circle: \"\\f375\";\n$ionicon-var-android-clipboard: \"\\f376\";\n$ionicon-var-android-close: \"\\f2d7\";\n$ionicon-var-android-cloud: \"\\f37a\";\n$ionicon-var-android-cloud-circle: \"\\f377\";\n$ionicon-var-android-cloud-done: \"\\f378\";\n$ionicon-var-android-cloud-outline: \"\\f379\";\n$ionicon-var-android-color-palette: \"\\f37b\";\n$ionicon-var-android-compass: \"\\f37c\";\n$ionicon-var-android-contact: \"\\f2d8\";\n$ionicon-var-android-contacts: \"\\f2d9\";\n$ionicon-var-android-contract: \"\\f37d\";\n$ionicon-var-android-create: \"\\f37e\";\n$ionicon-var-android-delete: \"\\f37f\";\n$ionicon-var-android-desktop: \"\\f380\";\n$ionicon-var-android-document: \"\\f381\";\n$ionicon-var-android-done: \"\\f383\";\n$ionicon-var-android-done-all: \"\\f382\";\n$ionicon-var-android-download: \"\\f2dd\";\n$ionicon-var-android-drafts: \"\\f384\";\n$ionicon-var-android-exit: \"\\f385\";\n$ionicon-var-android-expand: \"\\f386\";\n$ionicon-var-android-favorite: \"\\f388\";\n$ionicon-var-android-favorite-outline: \"\\f387\";\n$ionicon-var-android-film: \"\\f389\";\n$ionicon-var-android-folder: \"\\f2e0\";\n$ionicon-var-android-folder-open: \"\\f38a\";\n$ionicon-var-android-funnel: \"\\f38b\";\n$ionicon-var-android-globe: \"\\f38c\";\n$ionicon-var-android-hand: \"\\f2e3\";\n$ionicon-var-android-hangout: \"\\f38d\";\n$ionicon-var-android-happy: \"\\f38e\";\n$ionicon-var-android-home: \"\\f38f\";\n$ionicon-var-android-image: \"\\f2e4\";\n$ionicon-var-android-laptop: \"\\f390\";\n$ionicon-var-android-list: \"\\f391\";\n$ionicon-var-android-locate: \"\\f2e9\";\n$ionicon-var-android-lock: \"\\f392\";\n$ionicon-var-android-mail: \"\\f2eb\";\n$ionicon-var-android-map: \"\\f393\";\n$ionicon-var-android-menu: \"\\f394\";\n$ionicon-var-android-microphone: \"\\f2ec\";\n$ionicon-var-android-microphone-off: \"\\f395\";\n$ionicon-var-android-more-horizontal: \"\\f396\";\n$ionicon-var-android-more-vertical: \"\\f397\";\n$ionicon-var-android-navigate: \"\\f398\";\n$ionicon-var-android-notifications: \"\\f39b\";\n$ionicon-var-android-notifications-none: \"\\f399\";\n$ionicon-var-android-notifications-off: \"\\f39a\";\n$ionicon-var-android-open: \"\\f39c\";\n$ionicon-var-android-options: \"\\f39d\";\n$ionicon-var-android-people: \"\\f39e\";\n$ionicon-var-android-person: \"\\f3a0\";\n$ionicon-var-android-person-add: \"\\f39f\";\n$ionicon-var-android-phone-landscape: \"\\f3a1\";\n$ionicon-var-android-phone-portrait: \"\\f3a2\";\n$ionicon-var-android-pin: \"\\f3a3\";\n$ionicon-var-android-plane: \"\\f3a4\";\n$ionicon-var-android-playstore: \"\\f2f0\";\n$ionicon-var-android-print: \"\\f3a5\";\n$ionicon-var-android-radio-button-off: \"\\f3a6\";\n$ionicon-var-android-radio-button-on: \"\\f3a7\";\n$ionicon-var-android-refresh: \"\\f3a8\";\n$ionicon-var-android-remove: \"\\f2f4\";\n$ionicon-var-android-remove-circle: \"\\f3a9\";\n$ionicon-var-android-restaurant: \"\\f3aa\";\n$ionicon-var-android-sad: \"\\f3ab\";\n$ionicon-var-android-search: \"\\f2f5\";\n$ionicon-var-android-send: \"\\f2f6\";\n$ionicon-var-android-settings: \"\\f2f7\";\n$ionicon-var-android-share: \"\\f2f8\";\n$ionicon-var-android-share-alt: \"\\f3ac\";\n$ionicon-var-android-star: \"\\f2fc\";\n$ionicon-var-android-star-half: \"\\f3ad\";\n$ionicon-var-android-star-outline: \"\\f3ae\";\n$ionicon-var-android-stopwatch: \"\\f2fd\";\n$ionicon-var-android-subway: \"\\f3af\";\n$ionicon-var-android-sunny: \"\\f3b0\";\n$ionicon-var-android-sync: \"\\f3b1\";\n$ionicon-var-android-textsms: \"\\f3b2\";\n$ionicon-var-android-time: \"\\f3b3\";\n$ionicon-var-android-train: \"\\f3b4\";\n$ionicon-var-android-unlock: \"\\f3b5\";\n$ionicon-var-android-upload: \"\\f3b6\";\n$ionicon-var-android-volume-down: \"\\f3b7\";\n$ionicon-var-android-volume-mute: \"\\f3b8\";\n$ionicon-var-android-volume-off: \"\\f3b9\";\n$ionicon-var-android-volume-up: \"\\f3ba\";\n$ionicon-var-android-walk: \"\\f3bb\";\n$ionicon-var-android-warning: \"\\f3bc\";\n$ionicon-var-android-watch: \"\\f3bd\";\n$ionicon-var-android-wifi: \"\\f305\";\n$ionicon-var-aperture: \"\\f313\";\n$ionicon-var-archive: \"\\f102\";\n$ionicon-var-arrow-down-a: \"\\f103\";\n$ionicon-var-arrow-down-b: \"\\f104\";\n$ionicon-var-arrow-down-c: \"\\f105\";\n$ionicon-var-arrow-expand: \"\\f25e\";\n$ionicon-var-arrow-graph-down-left: \"\\f25f\";\n$ionicon-var-arrow-graph-down-right: \"\\f260\";\n$ionicon-var-arrow-graph-up-left: \"\\f261\";\n$ionicon-var-arrow-graph-up-right: \"\\f262\";\n$ionicon-var-arrow-left-a: \"\\f106\";\n$ionicon-var-arrow-left-b: \"\\f107\";\n$ionicon-var-arrow-left-c: \"\\f108\";\n$ionicon-var-arrow-move: \"\\f263\";\n$ionicon-var-arrow-resize: \"\\f264\";\n$ionicon-var-arrow-return-left: \"\\f265\";\n$ionicon-var-arrow-return-right: \"\\f266\";\n$ionicon-var-arrow-right-a: \"\\f109\";\n$ionicon-var-arrow-right-b: \"\\f10a\";\n$ionicon-var-arrow-right-c: \"\\f10b\";\n$ionicon-var-arrow-shrink: \"\\f267\";\n$ionicon-var-arrow-swap: \"\\f268\";\n$ionicon-var-arrow-up-a: \"\\f10c\";\n$ionicon-var-arrow-up-b: \"\\f10d\";\n$ionicon-var-arrow-up-c: \"\\f10e\";\n$ionicon-var-asterisk: \"\\f314\";\n$ionicon-var-at: \"\\f10f\";\n$ionicon-var-backspace: \"\\f3bf\";\n$ionicon-var-backspace-outline: \"\\f3be\";\n$ionicon-var-bag: \"\\f110\";\n$ionicon-var-battery-charging: \"\\f111\";\n$ionicon-var-battery-empty: \"\\f112\";\n$ionicon-var-battery-full: \"\\f113\";\n$ionicon-var-battery-half: \"\\f114\";\n$ionicon-var-battery-low: \"\\f115\";\n$ionicon-var-beaker: \"\\f269\";\n$ionicon-var-beer: \"\\f26a\";\n$ionicon-var-bluetooth: \"\\f116\";\n$ionicon-var-bonfire: \"\\f315\";\n$ionicon-var-bookmark: \"\\f26b\";\n$ionicon-var-bowtie: \"\\f3c0\";\n$ionicon-var-briefcase: \"\\f26c\";\n$ionicon-var-bug: \"\\f2be\";\n$ionicon-var-calculator: \"\\f26d\";\n$ionicon-var-calendar: \"\\f117\";\n$ionicon-var-camera: \"\\f118\";\n$ionicon-var-card: \"\\f119\";\n$ionicon-var-cash: \"\\f316\";\n$ionicon-var-chatbox: \"\\f11b\";\n$ionicon-var-chatbox-working: \"\\f11a\";\n$ionicon-var-chatboxes: \"\\f11c\";\n$ionicon-var-chatbubble: \"\\f11e\";\n$ionicon-var-chatbubble-working: \"\\f11d\";\n$ionicon-var-chatbubbles: \"\\f11f\";\n$ionicon-var-checkmark: \"\\f122\";\n$ionicon-var-checkmark-circled: \"\\f120\";\n$ionicon-var-checkmark-round: \"\\f121\";\n$ionicon-var-chevron-down: \"\\f123\";\n$ionicon-var-chevron-left: \"\\f124\";\n$ionicon-var-chevron-right: \"\\f125\";\n$ionicon-var-chevron-up: \"\\f126\";\n$ionicon-var-clipboard: \"\\f127\";\n$ionicon-var-clock: \"\\f26e\";\n$ionicon-var-close: \"\\f12a\";\n$ionicon-var-close-circled: \"\\f128\";\n$ionicon-var-close-round: \"\\f129\";\n$ionicon-var-closed-captioning: \"\\f317\";\n$ionicon-var-cloud: \"\\f12b\";\n$ionicon-var-code: \"\\f271\";\n$ionicon-var-code-download: \"\\f26f\";\n$ionicon-var-code-working: \"\\f270\";\n$ionicon-var-coffee: \"\\f272\";\n$ionicon-var-compass: \"\\f273\";\n$ionicon-var-compose: \"\\f12c\";\n$ionicon-var-connection-bars: \"\\f274\";\n$ionicon-var-contrast: \"\\f275\";\n$ionicon-var-crop: \"\\f3c1\";\n$ionicon-var-cube: \"\\f318\";\n$ionicon-var-disc: \"\\f12d\";\n$ionicon-var-document: \"\\f12f\";\n$ionicon-var-document-text: \"\\f12e\";\n$ionicon-var-drag: \"\\f130\";\n$ionicon-var-earth: \"\\f276\";\n$ionicon-var-easel: \"\\f3c2\";\n$ionicon-var-edit: \"\\f2bf\";\n$ionicon-var-egg: \"\\f277\";\n$ionicon-var-eject: \"\\f131\";\n$ionicon-var-email: \"\\f132\";\n$ionicon-var-email-unread: \"\\f3c3\";\n$ionicon-var-erlenmeyer-flask: \"\\f3c5\";\n$ionicon-var-erlenmeyer-flask-bubbles: \"\\f3c4\";\n$ionicon-var-eye: \"\\f133\";\n$ionicon-var-eye-disabled: \"\\f306\";\n$ionicon-var-female: \"\\f278\";\n$ionicon-var-filing: \"\\f134\";\n$ionicon-var-film-marker: \"\\f135\";\n$ionicon-var-fireball: \"\\f319\";\n$ionicon-var-flag: \"\\f279\";\n$ionicon-var-flame: \"\\f31a\";\n$ionicon-var-flash: \"\\f137\";\n$ionicon-var-flash-off: \"\\f136\";\n$ionicon-var-folder: \"\\f139\";\n$ionicon-var-fork: \"\\f27a\";\n$ionicon-var-fork-repo: \"\\f2c0\";\n$ionicon-var-forward: \"\\f13a\";\n$ionicon-var-funnel: \"\\f31b\";\n$ionicon-var-gear-a: \"\\f13d\";\n$ionicon-var-gear-b: \"\\f13e\";\n$ionicon-var-grid: \"\\f13f\";\n$ionicon-var-hammer: \"\\f27b\";\n$ionicon-var-happy: \"\\f31c\";\n$ionicon-var-happy-outline: \"\\f3c6\";\n$ionicon-var-headphone: \"\\f140\";\n$ionicon-var-heart: \"\\f141\";\n$ionicon-var-heart-broken: \"\\f31d\";\n$ionicon-var-help: \"\\f143\";\n$ionicon-var-help-buoy: \"\\f27c\";\n$ionicon-var-help-circled: \"\\f142\";\n$ionicon-var-home: \"\\f144\";\n$ionicon-var-icecream: \"\\f27d\";\n$ionicon-var-image: \"\\f147\";\n$ionicon-var-images: \"\\f148\";\n$ionicon-var-information: \"\\f14a\";\n$ionicon-var-information-circled: \"\\f149\";\n$ionicon-var-ionic: \"\\f14b\";\n$ionicon-var-ios-alarm: \"\\f3c8\";\n$ionicon-var-ios-alarm-outline: \"\\f3c7\";\n$ionicon-var-ios-albums: \"\\f3ca\";\n$ionicon-var-ios-albums-outline: \"\\f3c9\";\n$ionicon-var-ios-americanfootball: \"\\f3cc\";\n$ionicon-var-ios-americanfootball-outline: \"\\f3cb\";\n$ionicon-var-ios-analytics: \"\\f3ce\";\n$ionicon-var-ios-analytics-outline: \"\\f3cd\";\n$ionicon-var-ios-arrow-back: \"\\f3cf\";\n$ionicon-var-ios-arrow-down: \"\\f3d0\";\n$ionicon-var-ios-arrow-forward: \"\\f3d1\";\n$ionicon-var-ios-arrow-left: \"\\f3d2\";\n$ionicon-var-ios-arrow-right: \"\\f3d3\";\n$ionicon-var-ios-arrow-thin-down: \"\\f3d4\";\n$ionicon-var-ios-arrow-thin-left: \"\\f3d5\";\n$ionicon-var-ios-arrow-thin-right: \"\\f3d6\";\n$ionicon-var-ios-arrow-thin-up: \"\\f3d7\";\n$ionicon-var-ios-arrow-up: \"\\f3d8\";\n$ionicon-var-ios-at: \"\\f3da\";\n$ionicon-var-ios-at-outline: \"\\f3d9\";\n$ionicon-var-ios-barcode: \"\\f3dc\";\n$ionicon-var-ios-barcode-outline: \"\\f3db\";\n$ionicon-var-ios-baseball: \"\\f3de\";\n$ionicon-var-ios-baseball-outline: \"\\f3dd\";\n$ionicon-var-ios-basketball: \"\\f3e0\";\n$ionicon-var-ios-basketball-outline: \"\\f3df\";\n$ionicon-var-ios-bell: \"\\f3e2\";\n$ionicon-var-ios-bell-outline: \"\\f3e1\";\n$ionicon-var-ios-body: \"\\f3e4\";\n$ionicon-var-ios-body-outline: \"\\f3e3\";\n$ionicon-var-ios-bolt: \"\\f3e6\";\n$ionicon-var-ios-bolt-outline: \"\\f3e5\";\n$ionicon-var-ios-book: \"\\f3e8\";\n$ionicon-var-ios-book-outline: \"\\f3e7\";\n$ionicon-var-ios-bookmarks: \"\\f3ea\";\n$ionicon-var-ios-bookmarks-outline: \"\\f3e9\";\n$ionicon-var-ios-box: \"\\f3ec\";\n$ionicon-var-ios-box-outline: \"\\f3eb\";\n$ionicon-var-ios-briefcase: \"\\f3ee\";\n$ionicon-var-ios-briefcase-outline: \"\\f3ed\";\n$ionicon-var-ios-browsers: \"\\f3f0\";\n$ionicon-var-ios-browsers-outline: \"\\f3ef\";\n$ionicon-var-ios-calculator: \"\\f3f2\";\n$ionicon-var-ios-calculator-outline: \"\\f3f1\";\n$ionicon-var-ios-calendar: \"\\f3f4\";\n$ionicon-var-ios-calendar-outline: \"\\f3f3\";\n$ionicon-var-ios-camera: \"\\f3f6\";\n$ionicon-var-ios-camera-outline: \"\\f3f5\";\n$ionicon-var-ios-cart: \"\\f3f8\";\n$ionicon-var-ios-cart-outline: \"\\f3f7\";\n$ionicon-var-ios-chatboxes: \"\\f3fa\";\n$ionicon-var-ios-chatboxes-outline: \"\\f3f9\";\n$ionicon-var-ios-chatbubble: \"\\f3fc\";\n$ionicon-var-ios-chatbubble-outline: \"\\f3fb\";\n$ionicon-var-ios-checkmark: \"\\f3ff\";\n$ionicon-var-ios-checkmark-empty: \"\\f3fd\";\n$ionicon-var-ios-checkmark-outline: \"\\f3fe\";\n$ionicon-var-ios-circle-filled: \"\\f400\";\n$ionicon-var-ios-circle-outline: \"\\f401\";\n$ionicon-var-ios-clock: \"\\f403\";\n$ionicon-var-ios-clock-outline: \"\\f402\";\n$ionicon-var-ios-close: \"\\f406\";\n$ionicon-var-ios-close-empty: \"\\f404\";\n$ionicon-var-ios-close-outline: \"\\f405\";\n$ionicon-var-ios-cloud: \"\\f40c\";\n$ionicon-var-ios-cloud-download: \"\\f408\";\n$ionicon-var-ios-cloud-download-outline: \"\\f407\";\n$ionicon-var-ios-cloud-outline: \"\\f409\";\n$ionicon-var-ios-cloud-upload: \"\\f40b\";\n$ionicon-var-ios-cloud-upload-outline: \"\\f40a\";\n$ionicon-var-ios-cloudy: \"\\f410\";\n$ionicon-var-ios-cloudy-night: \"\\f40e\";\n$ionicon-var-ios-cloudy-night-outline: \"\\f40d\";\n$ionicon-var-ios-cloudy-outline: \"\\f40f\";\n$ionicon-var-ios-cog: \"\\f412\";\n$ionicon-var-ios-cog-outline: \"\\f411\";\n$ionicon-var-ios-color-filter: \"\\f414\";\n$ionicon-var-ios-color-filter-outline: \"\\f413\";\n$ionicon-var-ios-color-wand: \"\\f416\";\n$ionicon-var-ios-color-wand-outline: \"\\f415\";\n$ionicon-var-ios-compose: \"\\f418\";\n$ionicon-var-ios-compose-outline: \"\\f417\";\n$ionicon-var-ios-contact: \"\\f41a\";\n$ionicon-var-ios-contact-outline: \"\\f419\";\n$ionicon-var-ios-copy: \"\\f41c\";\n$ionicon-var-ios-copy-outline: \"\\f41b\";\n$ionicon-var-ios-crop: \"\\f41e\";\n$ionicon-var-ios-crop-strong: \"\\f41d\";\n$ionicon-var-ios-download: \"\\f420\";\n$ionicon-var-ios-download-outline: \"\\f41f\";\n$ionicon-var-ios-drag: \"\\f421\";\n$ionicon-var-ios-email: \"\\f423\";\n$ionicon-var-ios-email-outline: \"\\f422\";\n$ionicon-var-ios-eye: \"\\f425\";\n$ionicon-var-ios-eye-outline: \"\\f424\";\n$ionicon-var-ios-fastforward: \"\\f427\";\n$ionicon-var-ios-fastforward-outline: \"\\f426\";\n$ionicon-var-ios-filing: \"\\f429\";\n$ionicon-var-ios-filing-outline: \"\\f428\";\n$ionicon-var-ios-film: \"\\f42b\";\n$ionicon-var-ios-film-outline: \"\\f42a\";\n$ionicon-var-ios-flag: \"\\f42d\";\n$ionicon-var-ios-flag-outline: \"\\f42c\";\n$ionicon-var-ios-flame: \"\\f42f\";\n$ionicon-var-ios-flame-outline: \"\\f42e\";\n$ionicon-var-ios-flask: \"\\f431\";\n$ionicon-var-ios-flask-outline: \"\\f430\";\n$ionicon-var-ios-flower: \"\\f433\";\n$ionicon-var-ios-flower-outline: \"\\f432\";\n$ionicon-var-ios-folder: \"\\f435\";\n$ionicon-var-ios-folder-outline: \"\\f434\";\n$ionicon-var-ios-football: \"\\f437\";\n$ionicon-var-ios-football-outline: \"\\f436\";\n$ionicon-var-ios-game-controller-a: \"\\f439\";\n$ionicon-var-ios-game-controller-a-outline: \"\\f438\";\n$ionicon-var-ios-game-controller-b: \"\\f43b\";\n$ionicon-var-ios-game-controller-b-outline: \"\\f43a\";\n$ionicon-var-ios-gear: \"\\f43d\";\n$ionicon-var-ios-gear-outline: \"\\f43c\";\n$ionicon-var-ios-glasses: \"\\f43f\";\n$ionicon-var-ios-glasses-outline: \"\\f43e\";\n$ionicon-var-ios-grid-view: \"\\f441\";\n$ionicon-var-ios-grid-view-outline: \"\\f440\";\n$ionicon-var-ios-heart: \"\\f443\";\n$ionicon-var-ios-heart-outline: \"\\f442\";\n$ionicon-var-ios-help: \"\\f446\";\n$ionicon-var-ios-help-empty: \"\\f444\";\n$ionicon-var-ios-help-outline: \"\\f445\";\n$ionicon-var-ios-home: \"\\f448\";\n$ionicon-var-ios-home-outline: \"\\f447\";\n$ionicon-var-ios-infinite: \"\\f44a\";\n$ionicon-var-ios-infinite-outline: \"\\f449\";\n$ionicon-var-ios-information: \"\\f44d\";\n$ionicon-var-ios-information-empty: \"\\f44b\";\n$ionicon-var-ios-information-outline: \"\\f44c\";\n$ionicon-var-ios-ionic-outline: \"\\f44e\";\n$ionicon-var-ios-keypad: \"\\f450\";\n$ionicon-var-ios-keypad-outline: \"\\f44f\";\n$ionicon-var-ios-lightbulb: \"\\f452\";\n$ionicon-var-ios-lightbulb-outline: \"\\f451\";\n$ionicon-var-ios-list: \"\\f454\";\n$ionicon-var-ios-list-outline: \"\\f453\";\n$ionicon-var-ios-location: \"\\f456\";\n$ionicon-var-ios-location-outline: \"\\f455\";\n$ionicon-var-ios-locked: \"\\f458\";\n$ionicon-var-ios-locked-outline: \"\\f457\";\n$ionicon-var-ios-loop: \"\\f45a\";\n$ionicon-var-ios-loop-strong: \"\\f459\";\n$ionicon-var-ios-medical: \"\\f45c\";\n$ionicon-var-ios-medical-outline: \"\\f45b\";\n$ionicon-var-ios-medkit: \"\\f45e\";\n$ionicon-var-ios-medkit-outline: \"\\f45d\";\n$ionicon-var-ios-mic: \"\\f461\";\n$ionicon-var-ios-mic-off: \"\\f45f\";\n$ionicon-var-ios-mic-outline: \"\\f460\";\n$ionicon-var-ios-minus: \"\\f464\";\n$ionicon-var-ios-minus-empty: \"\\f462\";\n$ionicon-var-ios-minus-outline: \"\\f463\";\n$ionicon-var-ios-monitor: \"\\f466\";\n$ionicon-var-ios-monitor-outline: \"\\f465\";\n$ionicon-var-ios-moon: \"\\f468\";\n$ionicon-var-ios-moon-outline: \"\\f467\";\n$ionicon-var-ios-more: \"\\f46a\";\n$ionicon-var-ios-more-outline: \"\\f469\";\n$ionicon-var-ios-musical-note: \"\\f46b\";\n$ionicon-var-ios-musical-notes: \"\\f46c\";\n$ionicon-var-ios-navigate: \"\\f46e\";\n$ionicon-var-ios-navigate-outline: \"\\f46d\";\n$ionicon-var-ios-nutrition: \"\\f470\";\n$ionicon-var-ios-nutrition-outline: \"\\f46f\";\n$ionicon-var-ios-paper: \"\\f472\";\n$ionicon-var-ios-paper-outline: \"\\f471\";\n$ionicon-var-ios-paperplane: \"\\f474\";\n$ionicon-var-ios-paperplane-outline: \"\\f473\";\n$ionicon-var-ios-partlysunny: \"\\f476\";\n$ionicon-var-ios-partlysunny-outline: \"\\f475\";\n$ionicon-var-ios-pause: \"\\f478\";\n$ionicon-var-ios-pause-outline: \"\\f477\";\n$ionicon-var-ios-paw: \"\\f47a\";\n$ionicon-var-ios-paw-outline: \"\\f479\";\n$ionicon-var-ios-people: \"\\f47c\";\n$ionicon-var-ios-people-outline: \"\\f47b\";\n$ionicon-var-ios-person: \"\\f47e\";\n$ionicon-var-ios-person-outline: \"\\f47d\";\n$ionicon-var-ios-personadd: \"\\f480\";\n$ionicon-var-ios-personadd-outline: \"\\f47f\";\n$ionicon-var-ios-photos: \"\\f482\";\n$ionicon-var-ios-photos-outline: \"\\f481\";\n$ionicon-var-ios-pie: \"\\f484\";\n$ionicon-var-ios-pie-outline: \"\\f483\";\n$ionicon-var-ios-pint: \"\\f486\";\n$ionicon-var-ios-pint-outline: \"\\f485\";\n$ionicon-var-ios-play: \"\\f488\";\n$ionicon-var-ios-play-outline: \"\\f487\";\n$ionicon-var-ios-plus: \"\\f48b\";\n$ionicon-var-ios-plus-empty: \"\\f489\";\n$ionicon-var-ios-plus-outline: \"\\f48a\";\n$ionicon-var-ios-pricetag: \"\\f48d\";\n$ionicon-var-ios-pricetag-outline: \"\\f48c\";\n$ionicon-var-ios-pricetags: \"\\f48f\";\n$ionicon-var-ios-pricetags-outline: \"\\f48e\";\n$ionicon-var-ios-printer: \"\\f491\";\n$ionicon-var-ios-printer-outline: \"\\f490\";\n$ionicon-var-ios-pulse: \"\\f493\";\n$ionicon-var-ios-pulse-strong: \"\\f492\";\n$ionicon-var-ios-rainy: \"\\f495\";\n$ionicon-var-ios-rainy-outline: \"\\f494\";\n$ionicon-var-ios-recording: \"\\f497\";\n$ionicon-var-ios-recording-outline: \"\\f496\";\n$ionicon-var-ios-redo: \"\\f499\";\n$ionicon-var-ios-redo-outline: \"\\f498\";\n$ionicon-var-ios-refresh: \"\\f49c\";\n$ionicon-var-ios-refresh-empty: \"\\f49a\";\n$ionicon-var-ios-refresh-outline: \"\\f49b\";\n$ionicon-var-ios-reload: \"\\f49d\";\n$ionicon-var-ios-reverse-camera: \"\\f49f\";\n$ionicon-var-ios-reverse-camera-outline: \"\\f49e\";\n$ionicon-var-ios-rewind: \"\\f4a1\";\n$ionicon-var-ios-rewind-outline: \"\\f4a0\";\n$ionicon-var-ios-rose: \"\\f4a3\";\n$ionicon-var-ios-rose-outline: \"\\f4a2\";\n$ionicon-var-ios-search: \"\\f4a5\";\n$ionicon-var-ios-search-strong: \"\\f4a4\";\n$ionicon-var-ios-settings: \"\\f4a7\";\n$ionicon-var-ios-settings-strong: \"\\f4a6\";\n$ionicon-var-ios-shuffle: \"\\f4a9\";\n$ionicon-var-ios-shuffle-strong: \"\\f4a8\";\n$ionicon-var-ios-skipbackward: \"\\f4ab\";\n$ionicon-var-ios-skipbackward-outline: \"\\f4aa\";\n$ionicon-var-ios-skipforward: \"\\f4ad\";\n$ionicon-var-ios-skipforward-outline: \"\\f4ac\";\n$ionicon-var-ios-snowy: \"\\f4ae\";\n$ionicon-var-ios-speedometer: \"\\f4b0\";\n$ionicon-var-ios-speedometer-outline: \"\\f4af\";\n$ionicon-var-ios-star: \"\\f4b3\";\n$ionicon-var-ios-star-half: \"\\f4b1\";\n$ionicon-var-ios-star-outline: \"\\f4b2\";\n$ionicon-var-ios-stopwatch: \"\\f4b5\";\n$ionicon-var-ios-stopwatch-outline: \"\\f4b4\";\n$ionicon-var-ios-sunny: \"\\f4b7\";\n$ionicon-var-ios-sunny-outline: \"\\f4b6\";\n$ionicon-var-ios-telephone: \"\\f4b9\";\n$ionicon-var-ios-telephone-outline: \"\\f4b8\";\n$ionicon-var-ios-tennisball: \"\\f4bb\";\n$ionicon-var-ios-tennisball-outline: \"\\f4ba\";\n$ionicon-var-ios-thunderstorm: \"\\f4bd\";\n$ionicon-var-ios-thunderstorm-outline: \"\\f4bc\";\n$ionicon-var-ios-time: \"\\f4bf\";\n$ionicon-var-ios-time-outline: \"\\f4be\";\n$ionicon-var-ios-timer: \"\\f4c1\";\n$ionicon-var-ios-timer-outline: \"\\f4c0\";\n$ionicon-var-ios-toggle: \"\\f4c3\";\n$ionicon-var-ios-toggle-outline: \"\\f4c2\";\n$ionicon-var-ios-trash: \"\\f4c5\";\n$ionicon-var-ios-trash-outline: \"\\f4c4\";\n$ionicon-var-ios-undo: \"\\f4c7\";\n$ionicon-var-ios-undo-outline: \"\\f4c6\";\n$ionicon-var-ios-unlocked: \"\\f4c9\";\n$ionicon-var-ios-unlocked-outline: \"\\f4c8\";\n$ionicon-var-ios-upload: \"\\f4cb\";\n$ionicon-var-ios-upload-outline: \"\\f4ca\";\n$ionicon-var-ios-videocam: \"\\f4cd\";\n$ionicon-var-ios-videocam-outline: \"\\f4cc\";\n$ionicon-var-ios-volume-high: \"\\f4ce\";\n$ionicon-var-ios-volume-low: \"\\f4cf\";\n$ionicon-var-ios-wineglass: \"\\f4d1\";\n$ionicon-var-ios-wineglass-outline: \"\\f4d0\";\n$ionicon-var-ios-world: \"\\f4d3\";\n$ionicon-var-ios-world-outline: \"\\f4d2\";\n$ionicon-var-ipad: \"\\f1f9\";\n$ionicon-var-iphone: \"\\f1fa\";\n$ionicon-var-ipod: \"\\f1fb\";\n$ionicon-var-jet: \"\\f295\";\n$ionicon-var-key: \"\\f296\";\n$ionicon-var-knife: \"\\f297\";\n$ionicon-var-laptop: \"\\f1fc\";\n$ionicon-var-leaf: \"\\f1fd\";\n$ionicon-var-levels: \"\\f298\";\n$ionicon-var-lightbulb: \"\\f299\";\n$ionicon-var-link: \"\\f1fe\";\n$ionicon-var-load-a: \"\\f29a\";\n$ionicon-var-load-b: \"\\f29b\";\n$ionicon-var-load-c: \"\\f29c\";\n$ionicon-var-load-d: \"\\f29d\";\n$ionicon-var-location: \"\\f1ff\";\n$ionicon-var-lock-combination: \"\\f4d4\";\n$ionicon-var-locked: \"\\f200\";\n$ionicon-var-log-in: \"\\f29e\";\n$ionicon-var-log-out: \"\\f29f\";\n$ionicon-var-loop: \"\\f201\";\n$ionicon-var-magnet: \"\\f2a0\";\n$ionicon-var-male: \"\\f2a1\";\n$ionicon-var-man: \"\\f202\";\n$ionicon-var-map: \"\\f203\";\n$ionicon-var-medkit: \"\\f2a2\";\n$ionicon-var-merge: \"\\f33f\";\n$ionicon-var-mic-a: \"\\f204\";\n$ionicon-var-mic-b: \"\\f205\";\n$ionicon-var-mic-c: \"\\f206\";\n$ionicon-var-minus: \"\\f209\";\n$ionicon-var-minus-circled: \"\\f207\";\n$ionicon-var-minus-round: \"\\f208\";\n$ionicon-var-model-s: \"\\f2c1\";\n$ionicon-var-monitor: \"\\f20a\";\n$ionicon-var-more: \"\\f20b\";\n$ionicon-var-mouse: \"\\f340\";\n$ionicon-var-music-note: \"\\f20c\";\n$ionicon-var-navicon: \"\\f20e\";\n$ionicon-var-navicon-round: \"\\f20d\";\n$ionicon-var-navigate: \"\\f2a3\";\n$ionicon-var-network: \"\\f341\";\n$ionicon-var-no-smoking: \"\\f2c2\";\n$ionicon-var-nuclear: \"\\f2a4\";\n$ionicon-var-outlet: \"\\f342\";\n$ionicon-var-paintbrush: \"\\f4d5\";\n$ionicon-var-paintbucket: \"\\f4d6\";\n$ionicon-var-paper-airplane: \"\\f2c3\";\n$ionicon-var-paperclip: \"\\f20f\";\n$ionicon-var-pause: \"\\f210\";\n$ionicon-var-person: \"\\f213\";\n$ionicon-var-person-add: \"\\f211\";\n$ionicon-var-person-stalker: \"\\f212\";\n$ionicon-var-pie-graph: \"\\f2a5\";\n$ionicon-var-pin: \"\\f2a6\";\n$ionicon-var-pinpoint: \"\\f2a7\";\n$ionicon-var-pizza: \"\\f2a8\";\n$ionicon-var-plane: \"\\f214\";\n$ionicon-var-planet: \"\\f343\";\n$ionicon-var-play: \"\\f215\";\n$ionicon-var-playstation: \"\\f30a\";\n$ionicon-var-plus: \"\\f218\";\n$ionicon-var-plus-circled: \"\\f216\";\n$ionicon-var-plus-round: \"\\f217\";\n$ionicon-var-podium: \"\\f344\";\n$ionicon-var-pound: \"\\f219\";\n$ionicon-var-power: \"\\f2a9\";\n$ionicon-var-pricetag: \"\\f2aa\";\n$ionicon-var-pricetags: \"\\f2ab\";\n$ionicon-var-printer: \"\\f21a\";\n$ionicon-var-pull-request: \"\\f345\";\n$ionicon-var-qr-scanner: \"\\f346\";\n$ionicon-var-quote: \"\\f347\";\n$ionicon-var-radio-waves: \"\\f2ac\";\n$ionicon-var-record: \"\\f21b\";\n$ionicon-var-refresh: \"\\f21c\";\n$ionicon-var-reply: \"\\f21e\";\n$ionicon-var-reply-all: \"\\f21d\";\n$ionicon-var-ribbon-a: \"\\f348\";\n$ionicon-var-ribbon-b: \"\\f349\";\n$ionicon-var-sad: \"\\f34a\";\n$ionicon-var-sad-outline: \"\\f4d7\";\n$ionicon-var-scissors: \"\\f34b\";\n$ionicon-var-search: \"\\f21f\";\n$ionicon-var-settings: \"\\f2ad\";\n$ionicon-var-share: \"\\f220\";\n$ionicon-var-shuffle: \"\\f221\";\n$ionicon-var-skip-backward: \"\\f222\";\n$ionicon-var-skip-forward: \"\\f223\";\n$ionicon-var-social-android: \"\\f225\";\n$ionicon-var-social-android-outline: \"\\f224\";\n$ionicon-var-social-angular: \"\\f4d9\";\n$ionicon-var-social-angular-outline: \"\\f4d8\";\n$ionicon-var-social-apple: \"\\f227\";\n$ionicon-var-social-apple-outline: \"\\f226\";\n$ionicon-var-social-bitcoin: \"\\f2af\";\n$ionicon-var-social-bitcoin-outline: \"\\f2ae\";\n$ionicon-var-social-buffer: \"\\f229\";\n$ionicon-var-social-buffer-outline: \"\\f228\";\n$ionicon-var-social-chrome: \"\\f4db\";\n$ionicon-var-social-chrome-outline: \"\\f4da\";\n$ionicon-var-social-codepen: \"\\f4dd\";\n$ionicon-var-social-codepen-outline: \"\\f4dc\";\n$ionicon-var-social-css3: \"\\f4df\";\n$ionicon-var-social-css3-outline: \"\\f4de\";\n$ionicon-var-social-designernews: \"\\f22b\";\n$ionicon-var-social-designernews-outline: \"\\f22a\";\n$ionicon-var-social-dribbble: \"\\f22d\";\n$ionicon-var-social-dribbble-outline: \"\\f22c\";\n$ionicon-var-social-dropbox: \"\\f22f\";\n$ionicon-var-social-dropbox-outline: \"\\f22e\";\n$ionicon-var-social-euro: \"\\f4e1\";\n$ionicon-var-social-euro-outline: \"\\f4e0\";\n$ionicon-var-social-facebook: \"\\f231\";\n$ionicon-var-social-facebook-outline: \"\\f230\";\n$ionicon-var-social-foursquare: \"\\f34d\";\n$ionicon-var-social-foursquare-outline: \"\\f34c\";\n$ionicon-var-social-freebsd-devil: \"\\f2c4\";\n$ionicon-var-social-github: \"\\f233\";\n$ionicon-var-social-github-outline: \"\\f232\";\n$ionicon-var-social-google: \"\\f34f\";\n$ionicon-var-social-google-outline: \"\\f34e\";\n$ionicon-var-social-googleplus: \"\\f235\";\n$ionicon-var-social-googleplus-outline: \"\\f234\";\n$ionicon-var-social-hackernews: \"\\f237\";\n$ionicon-var-social-hackernews-outline: \"\\f236\";\n$ionicon-var-social-html5: \"\\f4e3\";\n$ionicon-var-social-html5-outline: \"\\f4e2\";\n$ionicon-var-social-instagram: \"\\f351\";\n$ionicon-var-social-instagram-outline: \"\\f350\";\n$ionicon-var-social-javascript: \"\\f4e5\";\n$ionicon-var-social-javascript-outline: \"\\f4e4\";\n$ionicon-var-social-linkedin: \"\\f239\";\n$ionicon-var-social-linkedin-outline: \"\\f238\";\n$ionicon-var-social-markdown: \"\\f4e6\";\n$ionicon-var-social-nodejs: \"\\f4e7\";\n$ionicon-var-social-octocat: \"\\f4e8\";\n$ionicon-var-social-pinterest: \"\\f2b1\";\n$ionicon-var-social-pinterest-outline: \"\\f2b0\";\n$ionicon-var-social-python: \"\\f4e9\";\n$ionicon-var-social-reddit: \"\\f23b\";\n$ionicon-var-social-reddit-outline: \"\\f23a\";\n$ionicon-var-social-rss: \"\\f23d\";\n$ionicon-var-social-rss-outline: \"\\f23c\";\n$ionicon-var-social-sass: \"\\f4ea\";\n$ionicon-var-social-skype: \"\\f23f\";\n$ionicon-var-social-skype-outline: \"\\f23e\";\n$ionicon-var-social-snapchat: \"\\f4ec\";\n$ionicon-var-social-snapchat-outline: \"\\f4eb\";\n$ionicon-var-social-tumblr: \"\\f241\";\n$ionicon-var-social-tumblr-outline: \"\\f240\";\n$ionicon-var-social-tux: \"\\f2c5\";\n$ionicon-var-social-twitch: \"\\f4ee\";\n$ionicon-var-social-twitch-outline: \"\\f4ed\";\n$ionicon-var-social-twitter: \"\\f243\";\n$ionicon-var-social-twitter-outline: \"\\f242\";\n$ionicon-var-social-usd: \"\\f353\";\n$ionicon-var-social-usd-outline: \"\\f352\";\n$ionicon-var-social-vimeo: \"\\f245\";\n$ionicon-var-social-vimeo-outline: \"\\f244\";\n$ionicon-var-social-whatsapp: \"\\f4f0\";\n$ionicon-var-social-whatsapp-outline: \"\\f4ef\";\n$ionicon-var-social-windows: \"\\f247\";\n$ionicon-var-social-windows-outline: \"\\f246\";\n$ionicon-var-social-wordpress: \"\\f249\";\n$ionicon-var-social-wordpress-outline: \"\\f248\";\n$ionicon-var-social-yahoo: \"\\f24b\";\n$ionicon-var-social-yahoo-outline: \"\\f24a\";\n$ionicon-var-social-yen: \"\\f4f2\";\n$ionicon-var-social-yen-outline: \"\\f4f1\";\n$ionicon-var-social-youtube: \"\\f24d\";\n$ionicon-var-social-youtube-outline: \"\\f24c\";\n$ionicon-var-soup-can: \"\\f4f4\";\n$ionicon-var-soup-can-outline: \"\\f4f3\";\n$ionicon-var-speakerphone: \"\\f2b2\";\n$ionicon-var-speedometer: \"\\f2b3\";\n$ionicon-var-spoon: \"\\f2b4\";\n$ionicon-var-star: \"\\f24e\";\n$ionicon-var-stats-bars: \"\\f2b5\";\n$ionicon-var-steam: \"\\f30b\";\n$ionicon-var-stop: \"\\f24f\";\n$ionicon-var-thermometer: \"\\f2b6\";\n$ionicon-var-thumbsdown: \"\\f250\";\n$ionicon-var-thumbsup: \"\\f251\";\n$ionicon-var-toggle: \"\\f355\";\n$ionicon-var-toggle-filled: \"\\f354\";\n$ionicon-var-transgender: \"\\f4f5\";\n$ionicon-var-trash-a: \"\\f252\";\n$ionicon-var-trash-b: \"\\f253\";\n$ionicon-var-trophy: \"\\f356\";\n$ionicon-var-tshirt: \"\\f4f7\";\n$ionicon-var-tshirt-outline: \"\\f4f6\";\n$ionicon-var-umbrella: \"\\f2b7\";\n$ionicon-var-university: \"\\f357\";\n$ionicon-var-unlocked: \"\\f254\";\n$ionicon-var-upload: \"\\f255\";\n$ionicon-var-usb: \"\\f2b8\";\n$ionicon-var-videocamera: \"\\f256\";\n$ionicon-var-volume-high: \"\\f257\";\n$ionicon-var-volume-low: \"\\f258\";\n$ionicon-var-volume-medium: \"\\f259\";\n$ionicon-var-volume-mute: \"\\f25a\";\n$ionicon-var-wand: \"\\f358\";\n$ionicon-var-waterdrop: \"\\f25b\";\n$ionicon-var-wifi: \"\\f25c\";\n$ionicon-var-wineglass: \"\\f2b9\";\n$ionicon-var-woman: \"\\f25d\";\n$ionicon-var-wrench: \"\\f2ba\";\n$ionicon-var-xbox: \"\\f30c\";"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/scss/ionicons/ionicons.scss",
    "content": "@charset \"UTF-8\";\n@import \"ionicons-variables\";\n/*!\n  Ionicons, v2.0.1\n  Created by Ben Sperry for the Ionic Framework, http://ionicons.com/\n  https://twitter.com/benjsperry  https://twitter.com/ionicframework\n  MIT License: https://github.com/driftyco/ionicons\n\n  Android-style icons originally built by Google’s\n  Material Design Icons: https://github.com/google/material-design-icons\n  used under CC BY http://creativecommons.org/licenses/by/4.0/\n  Modified icons to fit ionicon’s grid from original.\n*/\n\n@import \"ionicons-font\";\n@import \"ionicons-icons\";\n"
  },
  {
    "path": "28-ionic/dailyreads/mobileapp/www/lib/ionic/version.json",
    "content": "{\n  \"version\": \"1.3.1\",\n  \"codename\": \"el salvador\",\n  \"date\": \"2016-05-12\",\n  \"time\": \"18:21:10\"\n}\n"
  },
  {
    "path": "29-go-unit-testing/.gitignore",
    "content": "github.com/\npkg/\n"
  },
  {
    "path": "29-go-unit-testing/README.md",
    "content": "Learn GoLang For Great Good Part 2: Unit Testing in Go\n---\n\nWelcome to the twenty-ninth post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week we will take our Go knowledge to the next level by learning how to perform unit testing in Go. Unit testing has become an essential skill set for every programmer. [Unit testing](https://en.wikipedia.org/wiki/Unit_testing) is a software testing in which we test individual units of source code. Go has inbuilt support for unit testing. It has a `testing` package that provides infrastructure to write unit tests. In this blog we will focus on writing test cases for a couple of programs we wrote in [part 1](../27-learn-golang-for-great-good/README.md).\n\n## Prerequisite\n\nBefore you can start with this post make sure you have Go installed on your machine. Once you have Go installed, setup your Go workspace by following [https://golang.org/doc/code.html](https://golang.org/doc/code.html) article. This is the recommended way to setup your Go work directory.\n\nAfter following the instructions mentioned in the article you will have a Go workspace directory like `$HOME/dev/git/golang`. Inside the workspace directory, you will have `src`,`pkg`, and `bin` directories inside the `$HOME/dev/git/golang`. Inside the `src` directory, create a directory structure as shown below.\n\n```bash\n$ mkdir -p src/github.com/shekhargulati\n```\n\nNote that `$` is used to signify command-line prompt. You don't have to type `$`.\n\nRestart the terminal to make sure changes are picked. To check, you can run `go env` which will list `GOPATH` among other Go related environment variables. Below is the output of `go env` command on my machine. These might be different for you depending on your operating system.\n\n```bash\n$ go env\n```\n```\nGOARCH=\"amd64\"\nGOBIN=\"\"\nGOEXE=\"\"\nGOHOSTARCH=\"amd64\"\nGOHOSTOS=\"darwin\"\nGOOS=\"darwin\"\nGOPATH=\"/Users/shekhargulati/dev/git/golang\"\nGORACE=\"\"\nGOROOT=\"/usr/local/go\"\nGOTOOLDIR=\"/usr/local/go/pkg/tool/darwin_amd64\"\nGO15VENDOREXPERIMENT=\"1\"\nCC=\"clang\"\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common\"\nCXX=\"clang++\"\nCGO_ENABLED=\"1\"\n```\n\nOnce you have done the above mentioned setup, you should create a new directory called `problems` inside the `src/github.com/shekhargulati` directory and change directory to it.\n\n```bash\n$ mkdir problems && cd problems\n```\n\nThe `problems` directory will have the source code for this blog.\n\nLet's get started with unit testing.\n\n## Write your first unit test\n\nLet's start by writing test case for one of the example problems we discussed in part 1 **EqualsOrNotEquals**. The problem statement was as follows: ***Write a program that invokes a function that takes three integers as parameters and return `true` if all of the three numbers are equal, otherwise it returns `false`.***\n\nLet's start by writing a unit test for this program. In Go, to write a test case you have to create a file with name `<program>_test.go`. Here, you have to replace `<program>` with the name of your program i.e. `equalornotequal` in our case. **Only files that end with `_test.go` will be considered for testing.** Create a new file `equalornotequal_test.go` inside the `problems` directory. Copy and paste the content shown below in the `equalornotequal_test.go` file.\n\n```go\npackage problems\n\nimport \"testing\"\n\nfunc TestShouldReturnTrueWhenThreeNumbersAreEqual(t *testing.T) {\n\tareThreeNumbersEqual := equalOrNotEqual(1, 1, 1)\n\tif !areThreeNumbersEqual {\n\t\tt.Error(\"Expected true, got\", areThreeNumbersEqual)\n\t}\n}\n```\n\nLet's understand the unit test written above line by line.\n\n1. The first statement defines package which will contain our tests. If you remember, in the first post we used package name as `main` for all our programs. When you have an executable program i.e. program which contains `main` method then you have to use `main` package. As we don't need executable program now, we have used package name as `problems`.\n\n2. Then, we defined an import statement which will import the `testing` package. The `testing` package is provided by Go SDK.\n\n3. Then, we defined our test function `TestShouldReturnTrueWhenThreeNumbersAreEqual`. All tests should start with `Test` string. This is the naming convention for Go test cases. Go will find all the exported functions that have name starting with `Test` and run them. The test method accept a pointer of type `testing.T`. The `testing.T` pointer provides support for reporting the output and status of each test.\n\n4. Inside the `TestShouldReturnTrueWhenThreeNumbersAreEqual` test case, we called `equalOrNotEqual` function passing it three 1's. We assigned result in a variable `areThreeNumbersEqual` boolean variable. One thing you will note that there are no assertions. Later in the post we will use an assertion library.\n\n5. Finally, we checked is `areThreeNumbersEqual` is true if not then we call `Error` function passing it our message. If test return false, then `t.Error` will be called which will report a test case failure.\n\nTo run the test case, go has a test command. Run the command shown below to test all the test cases inside the `problems` directory.\n\n```bash\n$ go test\n```\n```\n# _/Users/shekhargulati/dev/git/golang/src/github.com/shekhargulati/problems\n./equalornotequal_test.go:7: undefined: equalOrNotEqual\nFAIL\t_/Users/shekhargulati/dev/git/golang/src/github.com/shekhargulati/problems [build failed]\n```\n\nAs expected, test fails because `equalOrNotEqual` function is undefined as we have not written it yet.\n\nLet's write code for `equalOrNotEqual` function. Create a new file `equalornotequal.go` inside the `problems` directory and copy and paste the code shown below.\n\n```go\npackage problems\n\nfunc equalOrNotEqual(first, second, third int) bool {\n\tif first == second && second == third {\n\t\treturn true\n\t} else {\n\t\treturn false\n\t}\n}\n```\n\nThe code shown above creates a new function `equalOrNotEqual` that checks if three integers are equal or not.\n\nNow, run the test case again using the `go test` command. This time test will pass as shown below.\n\n```bash\n$ go test\n```\n```\nPASS\nok  \tgithub.com/shekhargulati/problems\t0.006s\n```\n\nBy default, go will run all the test cases inside the current directory. If you want to run specific test cases then you can use `-run` option passing it a regex matching test case names. Let's write one more test case that test scenario when numbers are not equal.\n\n```go\nfunc TestShouldReturnFalseWhenThreeNumbersAreNotEqual(t *testing.T) {\n\n\tareThreeNumbersEqual := equalOrNotEqual(1, 2, 3)\n\tif areThreeNumbersEqual {\n\t\tt.Error(\"Expected false, got\", areThreeNumbersEqual)\n\t}\n}\n```\n\nIf you run the test cases using `go test` both the tests will pass.\n\nTo run only `TestShouldReturnTrueWhenThreeNumbersAreEqual` test you can use `-run` option as shown below.\n\n```bash\n$ go test -run TestShouldReturnTrueWhenThreeNumbersAreEqual\n```\n\nRather than writing full name of a test you can pass a regex as well. For example, to run all the test cases that start with `TestShouldReturnTrue` you can run following test case.\n\n```bash\n$ go test -run \"TestShouldReturnTrue.*\"\n```\n\n## Go function names\n\nBefore we move ahead there is one important Go feature that we have not discussed so far but that is very important for everyone to understand. Most of you would have noticed that the standard Go functions that we have used so far like `Println` or `Sort` or `Error` all starts with capital letter. In Go, functions that start with capital letter are exported functions. This means these functions are public so you can use them in your program. All internal functions uses camel case naming convention and are not accessible outside the file. So, if you try to access `equalOrNotEqual` function from another package then you will get a compilation error.\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"github.com/shekhargulati/problems\"\n  )\n\nfunc main() {\n\tfmt.Println(problems.equalOrNotEqual(1, 1, 1))\n}\n```\n\nWhen you will run run the code shown above you will get following compilation errors.\n\n```\n./a.go:9: cannot refer to unexported name problems.equalOrNotEqual\n./a.go:9: undefined: problems.equalOrNotEqual\n```\n\n> **Keep in mind that only functions which starts with a capital letter are exported.**\n\nRename `equalOrNotEqual` function to `EqualOrNotEqual` as this should be exported function.\n\n## Black box testing vs White box testing\n\nGo supports both black box and white box testing. The test that we wrote previously is white box testing as we have access to internal details i.e. private members of a package. Go recommends that you should have tests in the same directory and package allowing you to access the internals. I feel this will lead to tests that don't test the behavior but implementation details. So, I personal like black box testing where I work against the exported functions only.\n\nTo perform black box testing, create a test file like we did previously `equalornotequal.go` and copy and paste the following contents.\n\n```go\npackage problems_test\n\nimport (\n  \"testing\"\n  . \"github.com/shekhargulati/problems\"\n)\n\nfunc TestThreeEqualNumbers(t *testing.T) {\n\tisThreeNumbersEqual := EqualOrNotEqual(1, 1, 1)\n\tif !isThreeNumbersEqual {\n\t\tt.Error(\"\\tExpected true, got \", isThreeNumbersEqual)\n\t}\n}\n```\n\nThere are couple of important changes to note.\n\n1. We have used a different package name `problems_test` instead or `problems`. This means we will have access to only exported functions.\n\n2. In the import statement, we have to import our package `github.com/shekhargulati/problems`. Also, we used `dot-import` so that exported functions are in the `problems_test` package scope.\n\n## Improving test output readability\n\nYou can improve the test readability by adding log statements. The `testing.T` pointer has a lot of logging methods that you can use to make your test output more readable and understandable. Below shown is one such attempt.\n\n```go\nfunc TestThreeEqualNumbers(t *testing.T) {\n\tt.Log(\"Given three numbers are equal\")\n\tt.Logf(\"\\tWhen we make a call to EqualOrNotEqual(%d,%d,%d)\",1,1,1)\n\tisThreeNumbersEqual := EqualOrNotEqual(1, 1, 1)\n\tif isThreeNumbersEqual {\n\t\tt.Log(\"\\tThen we should get\",isThreeNumbersEqual)\n\t}else{\n\t\tt.Error(\"\\tExpected true, got \", isThreeNumbersEqual)\n\t}\n}\n```\n\nWhen you will run the go test command now with `-v` option you will see a much better test output. Please note you have to run tests in verbose mode to see the log messages. If you remove `-v` option, your tests will not print log statements.\n\n```bash\n$ go test -v -run TestThreeEqualNumbers\n```\n```\n=== RUN   TestThreeEqualNumbers\n--- PASS: TestThreeEqualNumbers (0.00s)\n\tequalornotequalblack_test.go:9: Given three numbers are equal\n\tequalornotequalblack_test.go:10: \tWhen we make a call to EqualOrNotEqual(1,1,1)\n\tequalornotequalblack_test.go:13: \tThen we should get true\nPASS\nok  \tgithub.com/shekhargulati/problems\t0.007s\n```\n\n## Running test multiple times\n\nThere are times when you would like to run a test case multiple times. We all have seen flaky tests which run most of the times but fail few times. It is very difficult to reproduce failing flaky tests. The only solution is to run test multiple times. `go test` command allows you to specify the count of times you want to run a test as shown below.\n\n```bash\n$ go test -v -run TestThreeEqualNumbers -count 3\n```\n```\n=== RUN   TestThreeEqualNumbers\n--- PASS: TestThreeEqualNumbers (0.00s)\n\tequalornotequalblack_test.go:9: Given three numbers are equal\n\tequalornotequalblack_test.go:10: \tWhen we make a call to EqualOrNotEqual(1,1,1)\n\tequalornotequalblack_test.go:13: \tThen we should get true\n=== RUN   TestThreeEqualNumbers\n--- PASS: TestThreeEqualNumbers (0.00s)\n\tequalornotequalblack_test.go:9: Given three numbers are equal\n\tequalornotequalblack_test.go:10: \tWhen we make a call to EqualOrNotEqual(1,1,1)\n\tequalornotequalblack_test.go:13: \tThen we should get true\n=== RUN   TestThreeEqualNumbers\n--- PASS: TestThreeEqualNumbers (0.00s)\n\tequalornotequalblack_test.go:9: Given three numbers are equal\n\tequalornotequalblack_test.go:10: \tWhen we make a call to EqualOrNotEqual(1,1,1)\n\tequalornotequalblack_test.go:13: \tThen we should get true\nPASS\nok  \tgithub.com/shekhargulati/problems\t0.006s\n```\n\n## Other options\n\nThere are many other options provided by `go test` command. You can look at all the options by running the `go test --help` command.\n\n## Using assertions\n\nIf you have written tests in any programming language one thing that you will miss is an assertion package. Go SDK does not provide any assertion package but there are many community contributed assertion package. One such popular package is `testify`. You can get the package by using the `go get` command as shown below.\n\n```\n$ go get github.com/stretchr/testify\n```\n\nThis will put the package in the `pkg` directory inside the `$GOPATH`. This is where all packages will be installed.\n\nNow, you can improve your test case by writing assertions as shown below.\n\n```go\npackage problems\n\nimport (\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nfunc TestShouldAssertThatFunctionReturnsFalseWhenThreeNumbersAreNotEqual(t *testing.T) {\n\tisThreeNumbersEqual := EqualOrNotEqual(1, 2, 3)\n\tassert.False(t, isThreeNumbersEqual, \"Expected false got true\")\n}\n```\n\nYou can learn more about this package by reading its [documentation](https://github.com/stretchr/testify).\n\n## Table tests\n\nAnother cool feature provided by Go `testing` package is table tests. Table test allows you to write a test once and run it against a table of data. Table will contain the input and expected output. Let's write test for `closestpair` program. **Given n numbers, find a pair which is closest to each other. For example, given 10, 6, 2, 5 numbers 5,6 is the closest pair.**\n\nOne possible solution is shown below.\n\n```go\npackage problems\n\nimport (\n\t\"math\"\n\t\"sort\"\n)\n\ntype Pair struct {\n\tFirst, Second int\n}\n\nfunc ClosestPair(numbers []int) Pair {\n\tsort.Ints(numbers)\n\tvar pair Pair\n\tvar diff int = math.MaxInt32\n\tfor index := 0; index < len(numbers)-1; index++ {\n\t\tcur := numbers[index]\n\t\tnext := numbers[index+1]\n\t\tif next-cur < diff {\n\t\t\tdiff = next - cur\n\t\t\tpair = Pair{cur, next}\n\t\t}\n\t}\n\treturn pair\n}\n```\n\nTo write table tests, we will create a table `closestPairTests`. It is an array of struct with two fields input array and output Pair. We populate the array with the input and output as shown below.\n\n```go\npackage problems_test\n\nimport (\n\t. \"github.com/shekhargulati/problems\"\n\t\"github.com/stretchr/testify/assert\"\n\t\"testing\"\n)\n\nvar closestPairTests = []struct {\n\tin  []int\n\tout Pair\n}{\n\t{[]int{2, 10, 5, 6, 15}, Pair{5, 6}},\n\t{[]int{2, 4, 5}, Pair{4, 5}},\n\t{[]int{100, 5, 7, 99, 11}, Pair{99, 100}},\n}\n\nfunc TestClosestPair(t *testing.T) {\n\tfor _, tt := range closestPairTests {\n\t\tt.Log(\"Running test for input\", tt.in)\n\t\tpair := ClosestPair(tt.in)\n\t\tassert.Equal(t, tt.out.First, pair.First)\n\t\tassert.Equal(t, tt.out.Second, pair.Second)\n\t}\n}\n```\n\nWhen we run the test case, we iterate over table entries running test for each input and asserting it against expected output.\n\nWhen you will run the test case, you will see the following output.\n\n```bash\n$ go test -v -run TestClosestPair\n```\n```\n=== RUN   TestClosestPair\n--- PASS: TestClosestPair (0.00s)\n\tclosestpair_test.go:20: Running test for input [2 10 5 6 15]\n\tclosestpair_test.go:20: Running test for input [2 4 5]\n\tclosestpair_test.go:20: Running test for input [100 5 7 99 11]\nPASS\nok  \tgithub.com/shekhargulati/problems\t0.009s\n```\n\n------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/42](https://github.com/shekhargulati/52-technologies-in-2016/issues/42).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/29-golang-part2)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "29-golang-github-slacknotification/README.md",
    "content": "Go Language - GitHub System Status API & Slack Notifications\n---------\n\nWelcome to twenty-ninth post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. In a previous [episode](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/27-learn-golang-for-great-good/README.md), we covered the basics of [Golang](https://golang.org/) and saw a number of sample programs to under the basic features in the language. In this episode, we are going to investigate a few more features of the language and combine that into a real life application where we can monitor the status of the GitHub System via its Status API and report its current status directly into a Slack Team page.\n\nIn summary, we are going to do the following:\n- Understand the GitHub System Status API\n- Configure Incoming Webhook Integration for your Slack Team\n- Write a Go program to invoke the GitHub System Status API, receive the response in our Go Application and raise the notification in Slack\n\n> **This is a guest post by [Romin Irani](https://twitter.com/iRomin). 52 technologies series is now open for external contributions so if you would like to contribute a guest post send us a PR.**\n\n\n## GitHub Status API\n\nGithub provides a [JSON API](https://status.github.com/api) to check on the Github Status. It provides multiple endpoints via which you can get the current system status, last message reported and a list of last messages. We are going to look at the last message reported endpoint that is available at [https://status.github.com/api/last-message.json](https://status.github.com/api/last-message.json).\n\n![](images/githubstatusapi1.png)\n\nA sample invocation of the API gives the JSON response as given below:\n\n```json\n{\n  \"status\": \"good\",\n  \"body\": \"Everything operating normally.\",\n  \"created_on\": \"2016-07-12T17:09:55Z\"\n}\n```\n\nThe `status` field returned is of interest to us. The GitHub Status API documentation states that this is set to either good (green) , minor (yellow) or major (red). This article will cover how we can raise the notification and you can easily modify the code to raise the notification only if the status is say \"major\".\n\nThe API call above is a HTTP GET call and we shall we see in a while how we can do that via our Go program.\n\n## Slack Incoming Webhook Integration\n\nThe [Slack API](https://api.slack.com/) provides multiple ways in which applications can integrate with it. One of the mechanisms is [Incoming Webhooks](https://api.slack.com/incoming-webhooks) integration via which you can send messages in real-time to Slack. This means that we can use this integration to send messages to our Slack Team in case GitHub Status is \"major\" or any other combination that you might vis-a-vis the current GitHub Status.\n\nLet us move forward with configuring our Slack Team channel to receive the Incoming Webhook Notification. This will require that we create a Custom Integration. The steps for that are given below:\n\n1. Assuming that you are the Administrator for the Slack Team, you will need to go to the Apps Management page for your Slack Team. This is available at the following URL:\n\n    `https://Your_SlackTeam_URL/apps/manage`\n\n2. Once you are that page, on the left-side you will notice a list of options under Manage. Click on Custom Integrations.\n3. Click on Incoming Webhooks and then Add a Configuration.\n4. We need to now configure which channel to post the message in. So at this screen, select the `#general` channel as shown below. Click on `Add Incoming Webhooks Integration` button.\n\n![](images/slackconfig1.png)\n\n5. This will lead to the configuration details, where you will notice a field at the top labelled `Webhook URL`. Note down this URL since this is the endpoint to which you will have to do a HTTP POST to raise the notification message.\n\n![](images/slackconfig2.png)\n\n6. Note the details that the configuration page also provides  you with i.e. you need to do a HTTP POST with the JSON payload, a sample of which is shown below from my configuration page.\n\n![](images/slackconfig3.png)\n\nClick on `Save`. This completes the Slack Incoming Webhook Integration configuration and you should see that reflect in your Slack Team #general channel as a message. A sample message is shown below:\n\n![](images/slackconfig4.png)\n\nWe are all set now to write our Go program.\n\n## Go Program\n\nBefore we see the code it is important to note what we need to do in our application. The sequence of steps are shown below:\n1. We will do a HTTP GET To the GitHub Status API and retrieve the last message. This means that we will look at how to make HTTP GET client requests from a Go program.\n2. The Last Message is a JSON formatted response that we will **unmarshall** into a higher level language structure in Golang called a Struct.\n3. We will then invoke a local function that will do a HTTP POST to the Slack Incoming Webhook URL that we configured in the previous section.\n\nLet us now take a look at the complete Go program.\n\n```go\n//The application checks for GitHub Status and raises a Slack Notification if it is down\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"time\"\n)\n\nconst (\n\tGitHubStatusAPIURL      = \"https://status.github.com/api/last-message.json\"\n\tSlackIncomingWebhookURL = \"YOUR_SLACK_INCOMING_WEBHOOK_URL\"\n)\n\nfunc check(e error) {\n\tif e != nil {\n\t\tlog.Fatalf(\"Error in GitHubStatus application. Error : %v\", e)\n\t}\n}\n\n//GitHubStatusLastMessage struct\ntype GitHubStatusLastMessage struct {\n\tStatus   string    `json:\"status\"`\n\tMessage  string    `json:\"body\"`\n\tCreateDT time.Time `json:\"created_on\"`\n}\n\nvar githubStatus GitHubStatusLastMessage\n\n//SlackMessage is the struct that we will post to Incoming Slack Webhook URL\ntype SlackMessage struct {\n\tMessage string `json:\"text\"`\n}\n\nfunc main() {\n\n\t//Initiate the GET call to GitHub Status API at https://status.github.com/api/last-message.json\n\tresp, err := http.Get(GitHubStatusAPIURL)\n\tcheck(err)\n\tdefer resp.Body.Close()\n\n\t//Read the Response and unmarshall it into GitHubStatusLastMessage struct\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\terr = json.Unmarshal(body, &githubStatus)\n\tcheck(err)\n\n\t//Check if the GitHub Status reported is major and raise the Alert\n\t//The Status is either good (green) , minor (yellow) or major (red)\n\t//if githubStatus.Status == \"major\" {\n\t//\traiseSlackNotification(githubStatus)\n\t//}\n\traiseSlackNotification(githubStatus)\n}\n\n//raiseSlackNotification does a HTTP POST to the Incoming Webhook Integration in your Slack Team\nfunc raiseSlackNotification(status GitHubStatusLastMessage) {\n\tconst WebhookURL = SlackIncomingWebhookURL\n\tpostParams := SlackMessage{fmt.Sprintf(\"Current Github Status : %v. Message : %v Reported at %v\", status.Status, status.Message, status.CreateDT)}\n\tb, err := json.Marshal(postParams)\n\tif err != nil {\n\t\tlog.Printf(\"Error in creating POST Message. Error : %v\", err)\n\t\treturn\n\t}\n\tv := url.Values{\"payload\": {string(b)}}\n\t_, err = http.PostForm(WebhookURL, v)\n\tif err != nil {\n\t\tlog.Printf(\"Error in sending Slack Notification. Error : %v\", err)\n\t}\n}\n```\n\n## Understanding our Go program\n\nAt the top of the program, we have our standard `import` definitions. We then define 2 `const` that contains the values of our GitHub Status API endpoint and the Slack Incoming Webhook URL.\n\n### Structs in Go\nA `struct` in Go allows us to define a record containing multiple fields. For e.g. think of an Employee `struct` that could contain fields like `FirstName`, `LastName`, `Age` and so on.\n\nIn our case, we are interested in creating a `struct` that will represent the JSON response that we receive from the GitHub Status API. Recall that at the beginning of the article, we covered the JSON response that the GitHub Status API returns and a sample response is shown below again for your reference:\n\n```json\n{\n  \"status\": \"good\",\n  \"body\": \"Everything operating normally.\",\n  \"created_on\": \"2016-07-12T17:09:55Z\"\n}\n```\n\nSo we are definining a struct named `GitHubStatusLastMessage` that captures has the following fields: `Status`, `Message` and `CreateDT`. Notice that we have also declared their respective data types i.e. `string` for `Status` and `Message` and `time.Time` for `CreateDT`. Notice that you have the flexibility of definining your field names that are different from the JSON fields that are returned by the API response. The ``json:\"response_field_name\"`` that you see next to each field is the actual field name that is present in the JSON response.\n\nThe `encoding/json` packge in the standard Go library provides us marshall / unmarshall functions that will map the JSON fields in the response to the appropriate `struct` fields.\n\nSimilarly, we define the `SlackMessage` struct that we are going to create to send a HTTP POST To the Slack Incoming Webhook URL.\n\n### main function\n\nLet us look at the `main` function now. We are going to be using the `net/http` library for the HTTP GET method that we need to invoke the GitHub Status API. The `http.Get` function is invoked on the `GitHubStatusAPIURL` and the response is checked for any errors. If all is good, we are then going to use the `ioutil.ReadAll` function to read all the bytes (JSON response) that have been returned.\n\nNow that we have the bytes, we are simply going to use the `json.Unmarshal` function to marshall the bytes into our `GitHubStatusLastMessage` struct variable. This will do the mapping from the JSON fields to the struct fields and the struct will be populated with the right values.\n\nAt this point we can inspect the `Status` field of the `GitHubStatusLastMessage` struct and determine if we want to raise the notification or not. But for the purposes of this tutorial we have commented this out and are simply invoking the `raiseSlackNotification` function.\n\n### raiseSlackNotification function\n\nThis function first creates a Struct instance of type `SlackMessage` and populates it with the text that we want to raise in our Slack Team channel via a notification.\nThe next step is to marshal this struct i.e. `SlackMessage` struct into a JSON payload via the `json.Marshall` method.\n\nFinally, we are doing a `http.PostForm` to the Slack Incoming Webhook URL by passing the request variable `payload` (as per the Slack Documentation) and the value of the payload is the JSON data that we constructed in the previous step.\n\n## Running the Go program\nThis assumes that you have installed the Go Programming environment on your development machine and are familiar with organizing Go code. The entire source code for the file is present in the `main.go` file that we saw in the previous section.\n\nTo run the code, simply invoke the `go run` command as shown below:\n\n```bash\n$ go run main.go\n```\n\nIf all goes well, you will see the current GitHub Status being reported in your Slack Team `#general` channel. A sample run is shown below:\n\n![](images/slacknotification1.png)\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/40](https://github.com/shekhargulati/52-technologies-in-2016/issues/40).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/29-golang-romin-http)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "29-golang-github-slacknotification/programs/main.go",
    "content": "//The application checks for GitHub Status and raises a Slack Notification if it is down\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"log\"\n\t\"net/http\"\n\t\"net/url\"\n\t\"time\"\n)\n\nconst (\n\tGitHubStatusAPIURL      = \"https://status.github.com/api/last-message.json\"\n\tSlackIncomingWebhookURL = \"YOUR_SLACK_INCOMING_WEBHOOK_URL\"\n)\n\nfunc check(e error) {\n\tif e != nil {\n\t\tlog.Fatalf(\"Error in GitHubStatus application. Error : %v\", e)\n\t}\n}\n\n//GitHubStatusLastMessage struct\ntype GitHubStatusLastMessage struct {\n\tStatus   string    `json:\"status\"`\n\tMessage  string    `json:\"body\"`\n\tCreateDT time.Time `json:\"created_on\"`\n}\n\nvar githubStatus GitHubStatusLastMessage\n\n//SlackMessage is the struct that we will post to Incoming Slack Webhook URL\ntype SlackMessage struct {\n\tMessage string `json:\"text\"`\n}\n\nfunc main() {\n\n\t//Initiate the GET call to GitHub Status API at https://status.github.com/api/last-message.json\n\tresp, err := http.Get(GitHubStatusAPIURL)\n\tcheck(err)\n\tdefer resp.Body.Close()\n\n\t//Read the Response and unmarshall it into GitHubStatusLastMessage struct\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\terr = json.Unmarshal(body, &githubStatus)\n\tcheck(err)\n\n\t//Check if the GitHub Status reported is major and raise the Alert\n\t//The Status is either good (green) , minor (yellow) or major (red)\n\t//if githubStatus.Status == \"major\" {\n\t//\traiseSlackNotification(githubStatus)\n\t//}\n\traiseSlackNotification(githubStatus)\n}\n\n//raiseSlackNotification does a HTTP POST to the Incoming Webhook Integration in your Slack Team\nfunc raiseSlackNotification(status GitHubStatusLastMessage) {\n\tconst WebhookURL = SlackIncomingWebhookURL\n\tpostParams := SlackMessage{fmt.Sprintf(\"Current Github Status : %v. Message : %v Reported at %v\", status.Status, status.Message, status.CreateDT)}\n\tb, err := json.Marshal(postParams)\n\tif err != nil {\n\t\tlog.Printf(\"Error in creating POST Message. Error : %v\", err)\n\t\treturn\n\t}\n\tv := url.Values{\"payload\": {string(b)}}\n\t_, err = http.PostForm(WebhookURL, v)\n\tif err != nil {\n\t\tlog.Printf(\"Error in sending Slack Notification. Error : %v\", err)\n\t}\n}\n"
  },
  {
    "path": "30-dropwizard/README.md",
    "content": "Dropwizard: Your Java Library For Building Microservices\n----\n\nWelcome to the thirtieth post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I decided to spend time on [Dropwizard](http://www.dropwizard.io/1.0.0/docs/). Back in 2013, I first learnt about DropWizard when I was exploring Java micro-frameworks. [Dropwizard] impressed me a lot with its opinionated approach to building ops-friendly, high-performance RESTful backends. You can spin up REST backends in a matter of minutes taking your productivity to the next level. [Dropwizard](http://www.dropwizard.io/1.0.0/docs/) is an open source Java framework which was developed by Yammer to power their JVM based backend. It consists of following components :\n\n* Embedded Jetty : Every application is packaged as a jar instead of war file and starts its own embedded jetty container. There is no WAR file and no external servlet container.\n\n* JAX-RS : Jersey(the reference implementation for JAX-RS) is used to write RESTful web services. So, your existing JAX-RS knowledge is not wasted.\n\n* JSON : The REST services speaks JSON. Jackson library is used to do all the JSON processing.\n\n* Logging : It is done using Logback and SLF4J.\n\n* Hibernate Validator : Dropwizard uses Hibernate Validator API for declarative validation.\n\n* Metrics : Dropwizard has inbuilt support for monitoring using the metrics library. It provides unparalleled insight into what our code does in production.\n\n## Github Repository\nThe code for today’s demo application is available on github: []()\n\n## Prerequisite\n1. Basic Java knowledge is required.\n\n2. Install JDK 8 on your operating system.\n\n3. Download latest version of IntelliJ Idea community edition from the [JetBrains official website](https://www.jetbrains.com/idea/download/). IntelliJ Idea community edition is best IDE for Java developers.\n  ![](images/download-intellij.png)\n\n## Step 1: Create new Java Gradle project\n\nLaunch IntelliJ and click on `Create New Project`. You will see a screen where you will have to select the type of project you want to create.\n\n![](images/create-new-project.png)\n\nPress `Next`, you will be asked to provide `GroupId` and `ArtifactId`.\n\n![](images/enter-groupid.png)\n\nNext, you will be asked to configure few Gradle options. We will enable auto import so that project is kept in sync with `build.gradle`.\n\n![](images/provide-gradle-option.png)\n\nFinally, you will be asked to provide the name and location of the project. As we are going to create a simple blog application we have used name as blog.\n\n![](images/project-name-and-location.png)\n\n## Step 2: Update project to JDK 8\n\nOpen `build.gradle` and define couple of properties as shown below.\n\n```gradle\ngroup 'com.shekhargulati'\nversion '1.0-SNAPSHOT'\n\napply plugin: 'java'\n\nsourceCompatibility = 1.8\ntargetCompatibility = 1.8\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    testCompile group: 'junit', name: 'junit', version: '4.12'\n}\n```\n\n## Step 3: Define Dropwizard dependencies\n\nNow, we will update the `build.gradle` to include the dropwizard-core maven dependency. This will download a bunch of dependencies so please remain patient.\n\n```gradle\ndef dropwizardVersion = '1.0.0'\n\ndependencies {\n    compile 'io.dropwizard:dropwizard-core:' + dropwizardVersion\n    testCompile group: 'junit', name: 'junit', version: '4.12'\n}\n```\n\n## Step 4: Create Configuration class\n\nEvery Dropwizard application has one configuration class which specifies the environment specific parameters. Later in this blog post, we will add MongoDB configuration parameters like host, port, and db name to it. These parameters are specified in a YAML configuration file which is deserialized to an instance of your application's configuration class and validated.\n\nCreate a new class `AppConfiguration` in the `blog` package. This class will extend `io.dropwizard.Configuration` class.\n\n```java\npackage blog;\n\nimport io.dropwizard.Configuration;\n\npublic class AppConfiguration extends Configuration{\n}\n```\n\n## Step 5: Create BlogApplication class\n\nThe Dropwizard project is bootstrapped by an `Application` class. This class pulls together various bundles and commands which provide basic functionality. It also starts the embedded jetty server and extends `io.dropwizard.Application`.\n\n```java\npackage blog;\n\nimport io.dropwizard.Application;\nimport io.dropwizard.setup.Bootstrap;\nimport io.dropwizard.setup.Environment;\n\npublic class BlogApp extends Application<AppConfiguration> {\n\n\n    public static void main(String[] args) throws Exception {\n        new BlogApp().run(\"server\");\n    }\n\n\n    @Override\n    public void run(AppConfiguration configuration, Environment environment) throws Exception {\n\n    }\n\n    @Override\n    public void initialize(Bootstrap<AppConfiguration> bootstrap) {\n    }\n}\n```\n\nThe application class shown above does the following:\n\n1. The class has a main method which acts as our application entry point. Inside the main method, we create an instance of `BlogApp` and call the run method passing it `server` command as its argument. The `server` command will start the embedded jetty server.\n2. The initialize method is called before running the service run method. Currently, we are not doing anything in the service method.\n3. Next, we have `run` method which will be called when application runs. Later in this blog, we will add REST resources inside this method.\n\nYou can run this application now. Just right click on the `BlogApp` class and select `Run BlogApp.main` option. This will launch the inbuilt Jetty server and start server at [http://localhost:8080/](http://localhost:8080/). If you make cURL request to it you will get 404. The reason is that you have not defined any endpoints yet.\n\n```bash\n$ curl -i http://localhost:8080/\n```\n```\nHTTP/1.1 404 Not Found\nDate: Mon, 15 Aug 2016 19:37:38 GMT\nContent-Type: application/json\nContent-Length: 43\n\n{\"code\":404,\"message\":\"HTTP 404 Not Found\"}\n```\n\n## Step 6: Create `IndexResource`\n\nLet us write our first resource which will be invoked when a GET request is made to the `/` url. Create a new JAX-RS resource as shown below. This resource will list all the blogs.\n\n\n```java\npackage blog.resources;\n\n\nimport blog.model.Blog;\nimport com.codahale.metrics.annotation.Timed;\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport java.util.Collections;\nimport java.util.List;\n\n\n@Path(\"/\")\npublic class IndexResource {\n\n    @GET\n    @Produces(value = MediaType.APPLICATION_JSON)\n    @Timed\n    public List<Blog> index() {\n        return Collections.singletonList(\n                new Blog(\"Groovy AST Transformations By Example\",\n                        \"https://github.com/shekhargulati/52-technologies-in-2016/blob/master/32-groovy-ast-transformations/README.md\"));\n    }\n}\n```\n\nThe code shown above is a standard JAX-RS resource class. It is annotated with `@Path` annotation and defines `index` method. The `index` returns a collection of blogs. These blogs will be converted to JSON document. The `@Timed` annotation makes sure that Dropwizard time this method.\n\nThe above mentioned `IndexResource` used a blog representation. It is shown as below. The `Blog` representation uses hibernate validator annotations to make sure the content is valid. For example, we use `@URL` annotation to make sure only valid URLs are stored in the MongoDB database.\n\n```java\npackage blog.model;\n\nimport java.util.Date;\nimport java.util.UUID;\n\nimport org.hibernate.validator.constraints.NotBlank;\nimport org.hibernate.validator.constraints.URL;\n\npublic class Blog {\n\n    private String id = UUID.randomUUID().toString();\n\n    @NotBlank\n    private String title;\n\n    @URL\n    @NotBlank\n    private String url;\n\n    private final Date publishedOn = new Date();\n\n    public Blog() {\n    }\n\n    public Blog(String title, String url) {\n        super();\n        this.title = title;\n        this.url = url;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public String getUrl() {\n        return url;\n    }\n\n    public Date getPublishedOn() {\n        return publishedOn;\n    }\n}\n```\n\nNext, we register `IndexResource` in the application class `run` method. Update the run method in `BlogApp` with the one shown below.\n\n```java\n@Override\npublic void run(AppConfiguration configuration, Environment environment) throws Exception {\n    environment\n            .jersey()\n            .register(new IndexResource());\n}\n```\n\n\nRun the application again by right clicking on the `BlogApp` and then selecting `Run BlogApp.main` option. This time if you make GET request to `http://localhost:8080` you will see our hard coded response.\n\n```bash\n$ curl http://localhost:8080 |jq '.'\n```\n```json\n[\n  {\n    \"id\": \"ec96b252-8dc7-4c84-b26b-d41dd479e8f7\",\n    \"title\": \"Groovy AST Transformations By Example\",\n    \"url\": \"https://github.com/shekhargulati/52-technologies-in-2016/blob/master/32-groovy-ast-transformations/README.md\",\n    \"publishedOn\": 1471290772422\n  }\n]\n```\n\nThe administrative interface is available at [http://localhost:8081/](http://localhost:8081/).\n\n![](images/admin-interface.png)\n\nWe can check the metrics of the `IndexResource` by clicking `Metrics`. The data is available in JSON format.\n\n```json\n\"timers\": {\n    \"blog.resources.IndexResource.index\": {\n      \"count\": 9,\n      \"max\": 0.011309738000000001,\n      \"mean\": 0.00039725750894129734,\n      \"min\": 0.000171131,\n      \"p50\": 0.00040392600000000004,\n      \"p75\": 0.0005585350000000001,\n      \"p95\": 0.0005585350000000001,\n      \"p98\": 0.0005585350000000001,\n      \"p99\": 0.0005585350000000001,\n      \"p999\": 0.011309738000000001,\n      \"stddev\": 0.0004745239115316346,\n      \"m15_rate\": 0.12787342984256184,\n      \"m1_rate\": 0.00982297533390726,\n      \"m5_rate\": 0.05629074869076141,\n      \"mean_rate\": 0.019586528291019135,\n      \"duration_units\": \"seconds\",\n      \"rate_units\": \"calls/second\"\n    }\n}\n```\n\nThe above shows that we have accessed `IndexResource` 9 times.\n\n## Step 7: Configuring MongoDB\n\nAdd the `mongo-jackson-mapper` dependency in `build.gradle`.\n\n```gradle\ncompile 'net.vz.mongodb.jackson:mongo-jackson-mapper:1.4.2'\n```\n\nUpdate the `AppConfiguration` class with MongoDB database details i.e. host, port, and database name.\n\n```java\npackage blog;\n\nimport io.dropwizard.Configuration;\nimport org.codehaus.jackson.annotate.JsonProperty;\nimport org.hibernate.validator.constraints.NotEmpty;\n\nimport javax.validation.constraints.Max;\nimport javax.validation.constraints.Min;\n\npublic class AppConfiguration extends Configuration {\n\n    @JsonProperty\n    @NotEmpty\n    public String mongohost = \"localhost\";\n\n    @JsonProperty\n    @Min(2000)\n    @Max(65535)\n    public int mongoport = 27017;\n\n    @JsonProperty\n    @NotEmpty\n    public String mongodb = \"blogdb\";\n}\n```\n\nNext we will create a new class named MongoManaged which allows us to manage resources on application start and stop. This implements `io.dropwizard.lifecycle.Managed`.\n\n```java\npackage blog.mongo;\n\nimport com.mongodb.Mongo;\nimport io.dropwizard.lifecycle.Managed;\n\npublic class MongoManaged implements Managed {\n\n    private Mongo mongo;\n\n    public MongoManaged(Mongo mongo) {\n        this.mongo = mongo;\n    }\n\n    @Override\n    public void start() throws Exception {\n    }\n\n    @Override\n    public void stop() throws Exception {\n        mongo.close();\n    }\n\n}\n```\n\nIn the code shown above, we close the MongoDB connections in stop method.\n\nNext we will write a `MongoHealthCheck` which will check if MongoDB is connected or not. A health check is Dropwizard feature to do a runtime test to verify the service’s behaviour in production environment.\n\n```java\npackage blog.mongo;\n\nimport com.codahale.metrics.health.HealthCheck;\nimport com.mongodb.Mongo;\n\npublic class MongoHealthCheck extends HealthCheck {\n\n    private Mongo mongo;\n\n    public MongoHealthCheck(Mongo mongo) {\n        this.mongo = mongo;\n    }\n\n    @Override\n    protected Result check() throws Exception {\n        mongo.getDatabaseNames();\n        return Result.healthy();\n    }\n\n}\n```\n\nNow we will update the `BlogApp` class to include the MongoDB configuration.\n\n\n```java\npackage blog;\n\nimport blog.mongo.MongoHealthCheck;\nimport blog.mongo.MongoManaged;\nimport blog.resources.IndexResource;\nimport com.mongodb.Mongo;\nimport io.dropwizard.Application;\nimport io.dropwizard.setup.Bootstrap;\nimport io.dropwizard.setup.Environment;\n\npublic class BlogApp extends Application<AppConfiguration> {\n\n\n    public static void main(String[] args) throws Exception {\n        new BlogApp().run(\"server\");\n    }\n\n\n    @Override\n    public void run(AppConfiguration configuration, Environment environment) throws Exception {\n        Mongo mongo = new Mongo(configuration.mongohost, configuration.mongoport);\n        MongoManaged mongoManaged = new MongoManaged(mongo);\n        environment\n                .lifecycle()\n                .manage(mongoManaged);\n        environment\n                .healthChecks()\n                .register(\"MongoHealthCheck\", new MongoHealthCheck(mongo));\n        environment\n                .jersey()\n                .register(new IndexResource());\n    }\n\n    @Override\n    public void initialize(Bootstrap<AppConfiguration> bootstrap) {\n\n    }\n}\n```\n\nIn the code shown above :\n\n1. A new Mongo instance is created using the `AppConfiguration` object.\n2. A new instance of `MongoManaged` is created and added to the environment.\n3. A health check is added.\n\nRun the application as a main program. You can check if MongoDB is running or not by going to the HealtCheck page loacated at http://localhost:8081/healthcheck. If MongoDB is not running, you will see an exception stacktrace.\n\n\n```bash\n$ curl http://localhost:8081/healthcheck | jq '.'\n```\n\n```json\n{\n  \"MongoHealthCheck\": {\n    \"healthy\": false,\n    \"message\": \"can't call something : Shekhar-2.local/192.18.0.2:27017/admin\",\n    \"error\": {\n      \"message\": \"can't call something : Shekhar-2.local/192.168.1.2:27017/admin\",\n      \"stack\": [\n        \"com.mongodb.DBTCPConnector.call(DBTCPConnector.java:227)\",\n        \"com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:305)\",\n        \"com.mongodb.DB.command(DB.java:160)\",\n        \"com.mongodb.DB.command(DB.java:183)\",\n        \"com.mongodb.Mongo.getDatabaseNames(Mongo.java:327)\",\n        \"blog.mongo.MongoHealthCheck.check(MongoHealthCheck.java:16)\",\n        \"com.codahale.metrics.health.HealthCheck.execute(HealthCheck.java:172)\",\n        \"com.codahale.metrics.health.HealthCheckRegistry.runHealthChecks(HealthCheckRegistry.java:77)\",\n        \"com.codahale.metrics.servlets.HealthCheckServlet.runHealthChecks(HealthCheckServlet.java:120)\",\n        \"com.codahale.metrics.servlets.HealthCheckServlet.doGet(HealthCheckServlet.java:89)\",\n        \"javax.servlet.http.HttpServlet.service(HttpServlet.java:687)\",\n        \"java.lang.Thread.run(Thread.java:745)\"\n      ]\n    }\n  },\n  \"deadlocks\": {\n    \"healthy\": true\n  }\n}\n```\n\nNow, start the MongoDB server and you will see health checks green.\n\n```bash\n$ curl http://localhost:8081/healthcheck | jq '.'\n```\n```json\n{\n  \"MongoHealthCheck\": {\n    \"healthy\": true\n  },\n  \"deadlocks\": {\n    \"healthy\": true\n  }\n}\n```\n\n\n## Step 8 : Create `BlogResource`\n\nNow, we will write the BlogResource class which will be responsible for creating the blog entries.\n\n```java\npackage blog.resources;\n\nimport blog.model.Blog;\nimport com.codahale.metrics.annotation.Timed;\nimport net.vz.mongodb.jackson.JacksonDBCollection;\n\nimport javax.validation.Valid;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\n\n\n@Path(\"/blogs\")\n@Produces(value = MediaType.APPLICATION_JSON)\n@Consumes(value = MediaType.APPLICATION_JSON)\npublic class BlogResource {\n\n    private JacksonDBCollection<Blog, String> collection;\n\n    public BlogResource(JacksonDBCollection<Blog, String> blogs) {\n        this.collection = blogs;\n    }\n\n    @POST\n    @Timed\n    public Response publishNewBlog(@Valid Blog blog) {\n        collection.insert(blog);\n        return Response.noContent().build();\n    }\n}\n```\n\nNext, we will update the `BlogApp` run method to add `BlogResource` as well.\n\n```java\n@Override\npublic void run(AppConfiguration configuration, Environment environment) throws Exception {\n    Mongo mongo = new Mongo(configuration.mongohost, configuration.mongoport);\n    MongoManaged mongoManaged = new MongoManaged(mongo);\n    environment\n            .lifecycle()\n            .manage(mongoManaged);\n    environment\n            .healthChecks()\n            .register(\"MongoHealthCheck\", new MongoHealthCheck(mongo));\n    environment\n            .jersey()\n            .register(new IndexResource());\n\n    DB db = mongo.getDB(configuration.mongodb);\n    JacksonDBCollection<Blog, String> blogs = JacksonDBCollection.wrap(db.getCollection(\"blogs\"), Blog.class, String.class);\n    environment\n            .jersey()\n            .register(new BlogResource(blogs));\n\n}\n```\n\nRun the `BlogApp` class as a Java application. To test the `BlogResource`, make a curl request as shown below:\n\n```bash\n$ curl -i -X POST -H \"Content-Type: application/json\" -d '{\"title\":\"Groovy AST Transformations By Example\",\"url\":\"https://github.com/shekhargulati/52-technologies-in-2016/blob/master/32-groovy-ast-transformations/README.md\"}' http://localhost:8080/blogs\n```\n\n## Step 9 : Update `IndexResource`\n\nFinally, we will update the IndexResource index() method to get all the blog documents from MongoDB.\n\n```java\npackage blog.resources;\n\n\nimport blog.model.Blog;\nimport com.codahale.metrics.annotation.Timed;\nimport net.vz.mongodb.jackson.DBCursor;\nimport net.vz.mongodb.jackson.JacksonDBCollection;\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport java.util.ArrayList;\nimport java.util.List;\n\n\n@Path(\"/\")\npublic class IndexResource {\n\n    private JacksonDBCollection<Blog, String> collection;\n\n    public IndexResource(JacksonDBCollection<Blog, String> blogs) {\n        this.collection = blogs;\n    }\n\n    @GET\n    @Produces(value = MediaType.APPLICATION_JSON)\n    @Timed\n    public List<Blog> index() {\n        DBCursor<Blog> dbCursor = collection.find();\n        List<Blog> blogs = new ArrayList<>();\n        while (dbCursor.hasNext()) {\n            Blog blog = dbCursor.next();\n            blogs.add(blog);\n        }\n        return blogs;\n    }\n\n}\n```\n\nWe will update the `BlogApp` run method to pass the blogs collection to the `IndexResource`.\n\n```java\n@Override\npublic void run(AppConfiguration configuration, Environment environment) throws Exception {\n    Mongo mongo = new Mongo(configuration.mongohost, configuration.mongoport);\n    MongoManaged mongoManaged = new MongoManaged(mongo);\n    environment\n            .lifecycle()\n            .manage(mongoManaged);\n    environment\n            .healthChecks()\n            .register(\"MongoHealthCheck\", new MongoHealthCheck(mongo));\n\n    DB db = mongo.getDB(configuration.mongodb);\n    JacksonDBCollection<Blog, String> blogs = JacksonDBCollection.wrap(db.getCollection(\"blogs\"), Blog.class, String.class);\n    environment\n            .jersey()\n            .register(new IndexResource(blogs));\n    environment\n            .jersey()\n            .register(new BlogResource(blogs));\n\n}\n```\n\nRun the `BlogApp` class as a Java application and test the application.\n\n------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/43](https://github.com/shekhargulati/52-technologies-in-2016/issues/43).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/30-dropwizard)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "30-dropwizard/blog/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Java template\n*.class\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Package Files #\n*.jar\n*.war\n*.ear\n\n# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml\nhs_err_pid*\n### Gradle template\n.gradle\nbuild/\n\n# Ignore Gradle GUI config\ngradle-app.setting\n\n# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)\n!gradle-wrapper.jar\n\n# Cache of project\n.gradletasknamecache\n\n# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898\n# gradle/wrapper/gradle-wrapper.properties\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm\n# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839\n\n# User-specific stuff:\n.idea/\n.idea/workspace.xml\n.idea/tasks.xml\n.idea/dictionaries\n.idea/vcs.xml\n.idea/jsLibraryMappings.xml\n\n# Sensitive or high-churn files:\n.idea/dataSources.ids\n.idea/dataSources.xml\n.idea/dataSources.local.xml\n.idea/sqlDataSources.xml\n.idea/dynamic.xml\n.idea/uiDesigner.xml\n\n# Gradle:\n.idea/gradle.xml\n.idea/libraries\n\n# Mongo Explorer plugin:\n.idea/mongoSettings.xml\n\n## File-based project format:\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\nfabric.properties\n\n"
  },
  {
    "path": "30-dropwizard/blog/build.gradle",
    "content": "group 'com.shekhargulati'\nversion '1.0-SNAPSHOT'\n\napply plugin: 'java'\n\nsourceCompatibility = 1.8\ntargetCompatibility = 1.8\n\nrepositories {\n    mavenCentral()\n}\n\ndef dropwizardVersion = '1.0.0'\n\ndependencies {\n    compile 'io.dropwizard:dropwizard-core:' + dropwizardVersion\n    compile 'net.vz.mongodb.jackson:mongo-jackson-mapper:1.4.2'\n\n    testCompile group: 'junit', name: 'junit', version: '4.12'\n}\n"
  },
  {
    "path": "30-dropwizard/blog/configuration.yml",
    "content": "mongohost: localhost\nmongoport: 27017\nmongodb: blogdb"
  },
  {
    "path": "30-dropwizard/blog/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Tue Aug 16 00:45:59 IST 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.13-all.zip\n"
  },
  {
    "path": "30-dropwizard/blog/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" -a \"$nonstop\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "30-dropwizard/blog/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windows variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "30-dropwizard/blog/settings.gradle",
    "content": "rootProject.name = 'blog'\n\n"
  },
  {
    "path": "30-dropwizard/blog/src/main/java/blog/AppConfiguration.java",
    "content": "package blog;\n\nimport io.dropwizard.Configuration;\nimport org.codehaus.jackson.annotate.JsonProperty;\nimport org.hibernate.validator.constraints.NotEmpty;\n\nimport javax.validation.constraints.Max;\nimport javax.validation.constraints.Min;\n\npublic class AppConfiguration extends Configuration {\n\n    @JsonProperty\n    @NotEmpty\n    public String mongohost = \"localhost\";\n\n    @JsonProperty\n    @Min(2000)\n    @Max(65535)\n    public int mongoport = 27017;\n\n    @JsonProperty\n    @NotEmpty\n    public String mongodb = \"blogdb\";\n}\n\n"
  },
  {
    "path": "30-dropwizard/blog/src/main/java/blog/BlogApp.java",
    "content": "package blog;\n\nimport blog.model.Blog;\nimport blog.mongo.MongoHealthCheck;\nimport blog.mongo.MongoManaged;\nimport blog.resources.BlogResource;\nimport blog.resources.IndexResource;\nimport com.mongodb.DB;\nimport com.mongodb.Mongo;\nimport io.dropwizard.Application;\nimport io.dropwizard.setup.Bootstrap;\nimport io.dropwizard.setup.Environment;\nimport net.vz.mongodb.jackson.JacksonDBCollection;\n\npublic class BlogApp extends Application<AppConfiguration> {\n\n\n    public static void main(String[] args) throws Exception {\n        new BlogApp().run(\"server\");\n    }\n\n\n    @Override\n    public void run(AppConfiguration configuration, Environment environment) throws Exception {\n        Mongo mongo = new Mongo(configuration.mongohost, configuration.mongoport);\n        MongoManaged mongoManaged = new MongoManaged(mongo);\n        environment\n                .lifecycle()\n                .manage(mongoManaged);\n        environment\n                .healthChecks()\n                .register(\"MongoHealthCheck\", new MongoHealthCheck(mongo));\n\n        DB db = mongo.getDB(configuration.mongodb);\n        JacksonDBCollection<Blog, String> blogs = JacksonDBCollection.wrap(db.getCollection(\"blogs\"), Blog.class, String.class);\n        environment\n                .jersey()\n                .register(new IndexResource(blogs));\n        environment\n                .jersey()\n                .register(new BlogResource(blogs));\n\n    }\n\n    @Override\n    public void initialize(Bootstrap<AppConfiguration> bootstrap) {\n\n    }\n}\n"
  },
  {
    "path": "30-dropwizard/blog/src/main/java/blog/model/Blog.java",
    "content": "package blog.model;\n\nimport java.util.Date;\nimport java.util.UUID;\n \nimport org.hibernate.validator.constraints.NotBlank;\nimport org.hibernate.validator.constraints.URL;\n \npublic class Blog {\n \n    private String id = UUID.randomUUID().toString();\n\n    private String _id;\n \n    @NotBlank\n    private String title;\n \n    @URL\n    @NotBlank\n    private String url;\n \n    private final Date publishedOn = new Date();\n \n    public Blog() {\n    }\n \n    public Blog(String title, String url) {\n        super();\n        this.title = title;\n        this.url = url;\n    }\n \n    public String getId() {\n        return id;\n    }\n \n    public String getTitle() {\n        return title;\n    }\n \n    public String getUrl() {\n        return url;\n    }\n \n    public Date getPublishedOn() {\n        return publishedOn;\n    }\n\n    public String get_id() {\n        return _id;\n    }\n}"
  },
  {
    "path": "30-dropwizard/blog/src/main/java/blog/mongo/MongoHealthCheck.java",
    "content": "package blog.mongo;\n\nimport com.codahale.metrics.health.HealthCheck;\nimport com.mongodb.Mongo;\n\npublic class MongoHealthCheck extends HealthCheck {\n \n    private Mongo mongo;\n \n    public MongoHealthCheck(Mongo mongo) {\n        this.mongo = mongo;\n    }\n \n    @Override\n    protected Result check() throws Exception {\n        mongo.getDatabaseNames();\n        return Result.healthy();\n    }\n \n}"
  },
  {
    "path": "30-dropwizard/blog/src/main/java/blog/mongo/MongoManaged.java",
    "content": "package blog.mongo;\n\nimport com.mongodb.Mongo;\nimport io.dropwizard.lifecycle.Managed;\n\npublic class MongoManaged implements Managed {\n\n    private Mongo mongo;\n\n    public MongoManaged(Mongo mongo) {\n        this.mongo = mongo;\n    }\n\n    @Override\n    public void start() throws Exception {\n    }\n\n    @Override\n    public void stop() throws Exception {\n        mongo.close();\n    }\n\n}"
  },
  {
    "path": "30-dropwizard/blog/src/main/java/blog/resources/BlogResource.java",
    "content": "package blog.resources;\n\nimport blog.model.Blog;\nimport com.codahale.metrics.annotation.Timed;\nimport net.vz.mongodb.jackson.JacksonDBCollection;\n\nimport javax.validation.Valid;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\n \n\n@Path(\"/blogs\")\n@Produces(value = MediaType.APPLICATION_JSON)\n@Consumes(value = MediaType.APPLICATION_JSON)\npublic class BlogResource {\n \n    private JacksonDBCollection<Blog, String> collection;\n \n    public BlogResource(JacksonDBCollection<Blog, String> blogs) {\n        this.collection = blogs;\n    }\n \n    @POST\n    @Timed\n    public Response publishNewBlog(@Valid Blog blog) {\n        collection.insert(blog);\n        return Response.noContent().build();\n    }\n}"
  },
  {
    "path": "30-dropwizard/blog/src/main/java/blog/resources/IndexResource.java",
    "content": "package blog.resources;\n\n\nimport blog.model.Blog;\nimport com.codahale.metrics.annotation.Timed;\nimport net.vz.mongodb.jackson.DBCursor;\nimport net.vz.mongodb.jackson.JacksonDBCollection;\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport java.util.ArrayList;\nimport java.util.List;\n\n\n@Path(\"/\")\npublic class IndexResource {\n\n    private JacksonDBCollection<Blog, String> collection;\n\n    public IndexResource(JacksonDBCollection<Blog, String> blogs) {\n        this.collection = blogs;\n    }\n\n    @GET\n    @Produces(value = MediaType.APPLICATION_JSON)\n    @Timed\n    public List<Blog> index() {\n        DBCursor<Blog> dbCursor = collection.find();\n        List<Blog> blogs = new ArrayList<>();\n        while (dbCursor.hasNext()) {\n            Blog blog = dbCursor.next();\n            blogs.add(blog);\n        }\n        return blogs;\n    }\n\n}"
  },
  {
    "path": "31-gradle-tips/README.md",
    "content": "50 Gradle Tips\n----\n\nWelcome to thirty-first week of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) series. This week I decided to write down Gradle tips that I have learnt in last year or so. Over last year or so I have started using Gradle as my primary build tool for JVM based projects. Before using Gradle I was an Apache Maven user. Gradle takes best from both Apache Maven and Apache Ant providing you best of both worlds. Gradle borrows flexibility from Ant and convention over configuration, dependency management and plugins from Maven. Gradle treats task as first class citizen just like Ant.\n\nA Gradle build has three distinct phases - initialization, configuration, and execution. The initialization phase determine which all projects will take part in the build process and create a Project instance for each of the project. During configuration phase, it execute build scripts of all the project that are taking part in build process. Finally, during the execution phase all the tasks configured during the configuration phase are executed.\n\nIn this document, I will list down tips that I have learnt over last year or so.\n\n> **The actual gradle tips is maintained at [github:shekhargulati/gradle-tips](https://github.com/shekhargulati/gradle-tips). If you wish to add any Gradle tip please send send pull request to [github:shekhargulati/gradle-tips](https://github.com/shekhargulati/gradle-tips) project.**\n\n## Tip 1: Use Gradle Wrapper\n\nOne of the Gradle features that impressed me a lot when I was starting with Gradle was support for wrapper scripts. Gradle wrapper makes your project self contained and independent of build tool installation. It lets you run Gradle builds without a previously installed Gradle distribution in a zero configuration manner. This will ensure everyone use same version of the build tool.\n\nTo create Gradle wrapper scripts for your Grade project you can run following command.\n\n```bash\n$ gradle wrapper --gradle-version 2.14.1\n```\n\n> **To run the above command you will need Gradle installed on your machine. If you are on Mac, then you can use `brew install gradle`.**\n\nThis will generate few files in your project -- `gradlew`, `gradlew.bat`, `gradle/wrapper/gradle-wrapper.jar`, and `gradle/wrapper/gradle-wrapper.properties`. Now instead of running `gradle` you should run `gradlew`.\n\n> **Make sure to unignore `gradle-wrapper.jar` in your version control ignone file. By default, version control ignore files ignore jar files.**\n\nAt any point in time, if you wish to upgrade the Gradle version just regenerate the Gradle wrapper scripts passing it the Gradle version you want to use. Let's suppose we want to upgrade to Gradle `3.0-milestone-2` run the command again as shown below.\n\n```bash\n$ gradle wrapper --gradle-version 3.0-milestone-2\n```\n\nAlso, it is a good idea to set an alias for `./gradlew`.\n\n```bash\nalias gradle=\"./gradlew\"\n```\n\n## Tip 2: View Dependency Graph\n\nTo view a dependency graph for your project you can run the following command.\n\n```bash\n$ gradle dependencies\n```\n\n## Tip 3: Build a single project\n\nGradle supports both single and multi-project builds. Let's suppose our multi-project structure looks like as shown below.\n\n```\napp\n  api\n    model\n    rest\n  core\n  web\n  itests\n```\n\nTo build the `rest` project we will run the following command.\n\n```bash\n$ gradle api:rest:build\n```\n\n## Tip 4: Exclude tasks\n\nTo execute a task you use `-x` option. Let's suppose we want to skip tests then we can use following command\n\n```bash\n$ gradle clean build -x test\n```\n\n## Tip 5: Profile your build\n\nGradle has in-built support for profiling. If you are facing performance issues, you should use the `--profile` option to generate profile report. The report displays time taken by different tasks. Let's suppose we want to profile the build task then we can run the following command.\n\n```bash\n$ gradle --profile build\n```\n\nThis will generate report in the `build/reports/profile` directory.\n\n![](images/gradle-profile.png)\n\n## Tip 6: Perform dry run\n\nThere are times when you wish to see all the tasks that will be executed during the build but don't want to execute them. For this scenario Gradle provides `--dry-run` option.\n\n```bash\n$ gradle build --dry-run\n```\n\n## Tip 7: Install project jars into local Maven repository\n\n```bash\n$ gradle install\n```\n\n## Tip 8: View Gradle tasks\n\n```bash\n$ gradle tasks\n```\n\nThe above does not list all the tasks. To view all the tasks you have to pass `--all` flag.\n\n```bash\n$ gradle tasks --all\n```\n\n## Tip 9: Use Gradle daemon\n\nOne of the easiest way to speed your Gradle build is to use Gradle daemon to run your build. Gradle daemon is a long-lived background process that performs bootstrapping only once during its lifetime. Gradle daemon is not enabled by default. To use Gradle daemon, you can use `--daemon` flag to your build command.\n\n```bash\n$ gradle build --daemon\n```\n\n> **It will enabled by default in 3.0.**\n\nPassing the `--daemon` flag each time is cumbersome so you can enable it on your developer machine by adding this flag in the `~/.gradle/gradle.properties` file.\n\n```\norg.gradle.daemon=true\n```\n\n## Tip 10: Parallelize the build\n\nOpen your `~/.gradle/gradle.properties` and add the following line.\n\n```\norg.gradle.parallel=true\n```\n\n## Tip 11: Customize Gradle tasks\n\nYou can customize any Gradle tasks by overriding its `doFirst` and `doLast` life cycle methods. Let's suppose we want add print statements before and after executing tests we can do that by following.\n\n```gradle\napply plugin:'java'\ntest.doFirst {\n    println(\"running tests...\")\n}\ntest.doLast {\n    println(\"done executing tests...\")\n}\n```\n\n## Tip 12: Provide JVM arguments to Gradle daemon\n\nYou can specify JVM arguments to Gradle daemon by entering a line in `~/.gradle/gradle.properties` as shown below.\n\n```\norg.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8\n```\n\n## Tip 13: Run in offline mode\n\n```bash\n$ gradle build --offline\n```\n\n## Tip 14: Enable configure on demand\n\nConfiguration on demand is an incubation feature of Gradle, so it’s not enabled by default yet.\n\n```bash\n$ gradle clean build --configure-on-demand\n```\n\nIf you want to make this a default option, then you can provide this option globally by adding a line to `~/.gradle/gradle.properties`\n\n```\norg.gradle.configureondemand=true\n```\n\n## Tip 15: Refresh Gradle dependency cache\n\n```bash\n$ gradle clean build --refresh-dependencies\n```\n\nYou can also delete the cached files under `~/.gradle/caches`. Next time, when you will run the build it will download all the dependencies and populate your cache.\n\n## Tip 16: Define a local jar dependency\n\nLet's suppose you have a `lib` directory that contains jar file that you need to use in your Gradle project.\n\n```gradle\ndependencies {\n    compile files('libs/myjar.jar')\n}\n```\n\nThis can also be done by following.\n\n```gradle\nrepositories {\n   flatDir {\n       dirs 'libs'\n   }\n}\n\n\ndependencies {\n   compile name: 'myjar'\n}\n```\n\n## Tip 17: Define all jars in a local directory as dependency\n\nIf you need to add all the libraries in a directory then you can do the following:\n\n```gradle\ndependencies {\n    compile fileTree(dir: 'libs', include: ['*.jar'])\n}\n```\n\n## Tip 18: Build project and all project it depends on\n\n```bash\n$ gradle api:model:buildNeeded\n```\n\n## Tip 19: Build project and all its dependents\n\n```\nbash\n$ gradle api:rest:buildDependents\n```\n\n## Tip 20: Provide default tasks to your build script\n\nIt is a good practice to define default tasks for your project so that a first time user of your project can easily get started. In your Gradle script, define `defaultTasks` variable passing it the tasks it should execute.\n\n```gradle\ndefaultTasks \"clean\",\"build\"\n```\n\nNow, if a user will run `gradle` command default tasks will be executed.\n\n## Tip 21: Create checksum for a file\n\n```gradle\napply plugin: 'java'\n\narchivesBaseName = 'checksum-sample'\n\njar.doLast { task ->\n    ant.checksum file: task.archivePath\n}\n```\n\n## Tip 22: Using different name for build file\n\nBy default build file has `build.gradle` as its name. You can use a different name by doing following in the `settings.gradle` file.\n\n```gradle\nrootProject.buildFileName = \"gradle-tips.gradle\"\n```\n\nNow, rename your build file `build.gradle` to `gradle-tips.gradle`\n\n## Tip 23: Using different names for build script in multi-project Gradle project\n\nBy convention, we use `build.gradle` as the name of the Gradle build script. When you are working with a multi-project Gradle project then it make sense to use different names for build scripts. Let's suppose our multi module project looks like this:\n\n```\napp\n  api\n  core\n  web\n  itests\n```\n\nBy default, all of these sub projects will have `build.gradle` as their Gradle build file. We can change that by overriding that in `settings.gradle`\n\n```gradle\nrootProject.children.each {\n    it.buildFileName = it.name + '.gradle'\n}\n```\n\nNow, you can use build.gradle for root project. Sub projects will have `api.gradle`, `core.gradle`, `web.gradle`, and `itests.gradle` as their build definition files.\n\n\n## Tip 24: Using Gradle gui\n\nYou can use Gradle gui by launching it via command-line as shown below.\n\n```bash\n$ gradle --gui\n```\n\nThis will open the Gradle gui as shown below.\n\n![](images/gradle-gui.png)\n\n\n## Tip 25: Create untar task\n\n```gradle\ntask untar( type : Copy) {\n  from tarTree(‘dist.tar.gz’)\n  into ‘destFolder’\n}\n```\n\n## Tip 26: Fail configuration on version conflict\n\nIn your build script, define a configuration block as shown below.\n\n\n```gradle\nconfigurations {\n  compile.resolutionStrategy.failOnVersionConflict()\n}\n```\n\n## Tip 27: Using provided scope in Gradle\n\nYou can use maven like `provided` scope in gradle 2.12+ by using ‘compileOnly’ scope.\n\n```gradle\ndependencies {\n    compileOnly 'javax.servlet:servlet-api:3.0-alpha-1'\n}\n```\n\n## Tip 28: Set Java compile encoding explicitly\n\nIn your `build.gradle` add the following line.\n\n```gradle\ncompileJava.options.encoding = 'UTF-8'\n```\n\n## Tip 29: Disable transitive dependencies resolution\n\nTurn transitive dependencies off for a whole configuration:\n\n```gradle\nconfigurations {\n  compile.transitive = false\n}\n```\n\n## Tip 30: Viewing Gradle version\n\nYou can view Gradle version\n\n```bash\n$ gradle -v\n```\n```\n\n------------------------------------------------------------\nGradle 2.14.1\n------------------------------------------------------------\n\nBuild time:   2016-07-18 06:38:37 UTC\nRevision:     d9e2113d9fb05a5caabba61798bdb8dfdca83719\n\nGroovy:       2.4.4\nAnt:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015\nJVM:          1.8.0_60 (Oracle Corporation 25.60-b23)\nOS:           Mac OS X 10.10.5 x86_64\n```\n\nYou can view the Gradle version that your current build is running by using `GradleVersion.current()`. You can create a task that does the work.\n\n```gradle\ntask gradleVersion {\n    group = \"help\"\n    description = \"Prints Gradle version\"\n\n    doLast {\n        logger.quiet(\"You are using [${GradleVersion.current()}]\")\n    }\n}\n```\n\nWhen you will run it you will see the following:\n\n```bash\n$ gradle gradleVersion\n```\n```\n:gradleVersion\nYou are using [Gradle 2.14.1]\n\nBUILD SUCCESSFUL\n\nTotal time: 0.667 secs\n```\n\n## Tip 31: Disable a task\n\n```gradle\ntaskName.enabled = false\n```\n\nIf you want to disable test task then you can disable it as shown below.\n\n```gradle\ntest.enabled = false\n```\n\n## Tip 32: Init a Gradle project\n\nTo create Java Gradle project that uses testng testing framework you can use the following command.\n\n```bash\n$ gradle init --type java-library --test-framework testng\n```\nIf you want to use JUnit, then don't specify `--test-framework`\n\n```bash\n$ gradle init --type java-library\n```\n\nYou can also create groovy and scala projects as well.\n\n```bash\n$ gradle init --type scala-library\n```\n\n```bash\n$ gradle init --type groovy-library\n```\n\n## Tip 33: Sign artifacts\n\n```gradle\napply plugin: 'signing'\nsigning {\n    sign configurations.archives\n}\n```\n\nIf you only want to sign releases not snapshots then you can do following\n\n```gradle\napply plugin: 'signing'\nsigning {\n    required { !version.endsWith(\"SNAPSHOT”) }\n}\n```\n\n## Tip 34: Running tests in parallel\n\n```gradle\ntest {\n  maxParallelForks = 2\n}\n```\n\n## Tip 35: Set memory for tests\n\n```gradle\ntest {\n    minHeapSize = ‘512m'\n    maxHeapSize = ‘1024m'\n  }\n```\n\n## Tip 36: Using short names for tasks\n\nIf you have a task `buildServerDistribution` then you can call it as shown below.\n\n```bash\n$ gradle bSD\n```\n\nYou have to make sure it is unique among all tasks. If there is another task `buildSafeDistribution` then you have specify\n\n```bash\n$ gradle bSeD\n```\n\n## Tip 37: Learn about a Gradle task\n\n```bash\n$ gradle help --task <task name>\n```\n\n```bash\n$ gradle help --task dependencies\n```\n\n## Tip 38: Run gradle in debug mode\n\n```\n$ gradle clean build --debug\n```\n\n## Tip 39: Continue task execution after task failure\n\n```\n$ gradle clean build --continue\n```\n\n## Tip 40: Convert Maven project to Gradle\n\nGo to your Maven project and run the following command.\n\n```bash\n$ gradle init --type pom\n```\n\n## Tip 41: Force Gradle to rerun tasks even if they are UP-TO-DATE\n\n```bash\n$ gradle build --rerun-tasks\n```\n\n## Tip 42: Use exact version numbers in dependencies\n\nWhen you are declaring dependencies don't use + in your dependencies, rather use exact version numbers. This will make your build faster and reproducible.\n\n## Tip 43: Enable continuous build\n\nIf you wish to continuously run your build then you can use `--continuous` flag. It will look for file changes and whenever it detects one it will rerun the command. To enable continuous tests,\n\n```\n$ gradle test --continuous\n```\n\n## Tip 45: Run a single test case\n\nThere are times when we only when to run a single test case rather than running the full test suite. This can be accomplished by following command.\n\n```bash\n$ gradle test --tests tips.CalculatorTest\n```\n\nTo run only a single test case of `tips.CalculatorTest` you can do following.\n\n```bash\n$ gradle test --tests tips.CalculatorTest.shouldAddTwoNumbers\n```\n\nYou can also use regex to specify multiple tests\n\n```\n$ gradle test --tests \"tips.Calculator*Test\"\n```\n\nYou can also use `--tests` flag multiple times.\n\n```\n$ gradle test --tests tips.CalculatorTest --tests tips.Calculator1Test\n```\n\nTo run a single test in a submodule you can do following\n\n```\n$ gradle api:test --tests app.api.PingResourceTest\n```\n\n## Tip 45: Generate source and javadoc jar\n\n```gradle\ntask sourcesJar(type: Jar, dependsOn: classes) {\n    classifier = 'sources'\n    from sourceSets.main.allSource\n}\n\ntask javadocJar(type: Jar, dependsOn: javadoc) {\n    classifier = 'javadoc'\n    from javadoc.destinationDir\n}\n\nartifacts {\n    archives sourcesJar, javadocJar\n}\n```\n\n## 46: Accessing environment variable in build script\n\nYou can access environment variables in couple of ways\n\n```gradle\nprintln(System.getenv(\"HOME\"))\nprintln(\"$System.env.HOME\")\n```\n\n## 47: Configure test logging\n\nBy default Gradle will only log test failures on console. This at times limits the visibility of which all tests have ran. Gradle allows you to configure it using the testLogging property. To log all the events, you can do following. For more information read [this](https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.logging.TestLoggingContainer.html).\n\n```gradle\ntest {\n    testLogging {\n        events \"passed\", \"skipped\", \"failed\"\n    }\n}\n```\n\nNow, when you will run the `./gradlew clean build` you will see passed tests as well.\n\n```bash\n$ gradle clean test\n```\n```\n:clean\n:compileJava\n:processResources UP-TO-DATE\n:classes\n:compileTestJava\n:processTestResources UP-TO-DATE\n:testClasses\n:test\ntips.CalculatorTest > shouldSubtractTwoNumbers PASSED\n\ntips.CalculatorTest > shouldAddTwoNumbers PASSED\n\ntips.CalculatorTest > shouldSubtractTwoNumbers1 PASSED\n```\n\nOne thing to keep in mind is that `gradle test` command executes the test only when they change. So if you run it second time without any change then no output will be produced. You will see `:test UP-TO-DATE` which means no changes were detected. You can force Gradle to run tests each time by using `./gradlew cleanTest test`.\n\n## Tip 48: Show Standard Output and Error Stream during tests execution\n\n```gradle\ntest {\n    testLogging {\n        events \"passed\", \"skipped\", \"failed\"\n        showStandardStreams = true\n    }\n\n}\n```\n\n## Tip 49: Storing credentials\n\nYou should not hardcode credentials in your `build.gradle` instead you should rely on your user home `~/.gradle/gradle.properties` to store credentials. Let's suppose you want to use a Maven repository protected by credentials. One way to specify credentials is to hard code them in your build.gradle as shown below.\n\n```gradle\nrepositories {\n    maven {\n        credentials {\n            username \"admin\"\n            password \"admin123\"\n        }\n        url \"http://nexus.mycompany.com/\"\n    }\n}\n```\n\nThe better way is to change your personal `~/.gradle/gradle.properties`\n\n```\nnexusUsername = admin\nnexusPassword = admin123\n```\n\nNow, refer this in the `build.gradle`\n\n```gradle\nrepositories {\n    maven {\n        credentials {\n            username \"$nexusUsername\"\n            password \"$nexusPassword\"\n        }\n        url \"http://nexus.mycompany.com/\"\n    }\n}\n```\n\n## Tip 50: Debug a Java executable application\n\nIf your application is packaged as an executable jar that you can run via Gradle then you can debug it by passing `--debug-jvm` option. Spring Boot applications are run as an executable jar. You can use `gradle bootRun` to run the application. To debug the app at port 5005 you can start app in debug mode.\n\n```\n$ gdw <taskname> --debug-jvm\n```\n\n```bash\n$ gradle bootRun --debug-jvm\n```\n\n-----------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/44](https://github.com/shekhargulati/52-technologies-in-2016/issues/44).\n\nYou can follow me on twitter at [https://twitter.com/shekhargulati](https://twitter.com/shekhargulati) or email me at <shekhargulati84@gmail.com>. Also, you can read my blogs at [http://shekhargulati.com/](http://shekhargulati.com/)\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/31-gradle-tips)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "32-groovy-ast-transformations/README.md",
    "content": "Groovy AST Transformations By Example\n-----\n\nWelcome to the thirty-second post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I learnt about Groovy AST transformations. AST transformations allows you to hook into the Groovy compilation process so that you can customize it to meet your needs. This is done at compilation time so you don't pay any cost at runtime. AST transformation is compile-time meta programming. If you have used Groovy you would know that you don't have to write commonly used methods like setters, getters, equals, hashcode, toString, etc. because Groovy can generate them for you. You just apply annotations to your class and voila Groovy add those methods for you. This helps you get rid of the boilerplate code and makes your code clean and readable. AST transformations are very easy to write. You don't have to be a compiler or AST ninja to write an AST transformation. In this blog, you will learn how to write an AST transformation that will add a `toHash` method to a class. `toHash` method will generate a hash for your object. You will be able to provide hash algorithm of your choice. We will use Java's `java.security.MessageDigest` to generate the hash code.\n\nBefore we write our own AST transformation let's look at AST transformation that you see every day. Let's suppose we have a simple Groovy class `Book` that has two fields `title` and `author`.\n\n```groovy\nclass Book {\n\n    String title\n    String author\n}\n```\n\nAfter you compile this code, you will be able to call setters and getters on `Book` object. The setters and getters were added by Groovy using AST transformation.\n\n```groovy\nclass BookTest {\n\n    @Test\n    void 'should be able to set author and title of a book'() {\n\n        def book = new Book()\n        book.setTitle(\"OpenShift Cookbook\")\n        book.setAuthor(\"Shekhar Gulati\")\n\n        assertThat(book.getTitle(), equalTo(\"OpenShift Cookbook\"))\n        assertThat(book.getAuthor(), equalTo(\"Shekhar Gulati\"))\n\n    }\n}\n```\n\nIf you look at the decompiled code you will see setters and getters.\n\n```java\n//\n// Source code recreated from a .class file by IntelliJ IDEA\n// (powered by Fernflower decompiler)\n//\n\npackage playground;\n\nimport groovy.lang.GroovyObject;\nimport groovy.lang.MetaClass;\nimport org.codehaus.groovy.runtime.callsite.CallSite;\nimport org.codehaus.groovy.runtime.typehandling.ShortTypeHandling;\n\npublic class Book implements GroovyObject {\n    private String title;\n    private String author;\n\n    public Book(String title, String author) {\n        CallSite[] var3 = $getCallSiteArray();\n        MetaClass var4 = this.$getStaticMetaClass();\n        this.metaClass = var4;\n        this.title = (String)ShortTypeHandling.castToString(title);\n        this.author = (String)ShortTypeHandling.castToString(author);\n    }\n\n    public String getTitle() {\n        return this.title;\n    }\n\n    public void setTitle(String var1) {\n        this.title = var1;\n    }\n\n    public String getAuthor() {\n        return this.author;\n    }\n\n    public void setAuthor(String var1) {\n        this.author = var1;\n    }\n}\n```\n\nGroovy supports two types of AST transformations -- Global and Local. Global AST transformations apply transformation to each and every class in your project where as local transformation apply transformation to only classes that are declared with an annotation. The transformation that we will write is a local transformation.\n\nLet's write a simple test case in the `playground` package that will drive our code.\n\n```groovy\npackage playground\n\nimport org.junit.Test\nimport static groovy.test.GroovyAssert.assertScript\n\n\nclass HashAstTransformationTests {\n\n\n    @Test\n    void \"class with @Hash annotation should have toHash method that covert to SHA1 hash\"(){\n        assertScript('''\n\n        import playground.Hash\n\n        @Hash\n        class Foo{\n            String msg\n\n            Foo(String msg){\n                this.msg = msg\n            }\n\n            String toString(){\n                this.msg\n            }\n        }\n\n        def hash = new Foo(\"Hello, World!\").toHash()\n        assert hash == \"0a0a9f2a6772942557ab5355d76af442f8f65e01\"\n    ''')\n    }\n}\n```\n\nIn the code shown above, we have written a test case that will execute a script and test whether SHA1 hash of `Hello, World!` string is equal to `0a0a9f2a6772942557ab5355d76af442f8f65e01`.\nIn our test script, we created a simple Groovy class `Foo` and annotated it with `Hash` annotation. Local transformation works by defining annotations on the classes of interest.\n\nWhen you will run this you will get error because `Hash` annotation does not exit.\n\nLet's create a Java annotation called `Hash` in the `playground` package. It is recommend that you write AST transformations in Java.\n\n```java\npackage playground;\n\nimport org.codehaus.groovy.transform.GroovyASTTransformationClass;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Retention(RetentionPolicy.SOURCE)\n@Target(ElementType.TYPE)\npublic @interface Hash {\n\n    String algorithm() default \"SHA1\";\n}\n```\n\nIt is a standard Java annotation. We have declared `Retention` to be `RetentionPolicy.SOURCE` because we don't need this annotation in the compiled code. In the compiled code, we will have the generated methods. `Target` for this annotation is `ElementType.TYPE` as we will declare this annotation on a class. Also, we have defined annotation attribute `algorithm` that will help user decide which hashing algorithm to choose. By default, we will use `SHA1` algorithm.\n\n\nLet's rerun the test again to see the next failure. This time you will be greeted by exception message shown below. This error message clearly says that there is no `toHash` method in the `Foo` class.\n\n```text\ngroovy.lang.MissingMethodException: No signature of method: Foo.toHash() is applicable for argument types: () values: []\n```\n\nNext step is to write an AST transformation that will add the `toHash` method. To do that, let's create class `ToHashAdderAstTransformation` in the `src/main/java/playground` package.\n\n```java\npackage playground;\n\nimport org.codehaus.groovy.ast.ASTNode;\nimport org.codehaus.groovy.ast.ClassNode;\nimport org.codehaus.groovy.control.SourceUnit;\nimport org.codehaus.groovy.transform.AbstractASTTransformation;\nimport org.codehaus.groovy.transform.GroovyASTTransformation;\nimport org.codehaus.groovy.control.CompilePhase;\n\n@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)\npublic class ToHashAdderAstTransformation extends AbstractASTTransformation {\n\n    @Override\n    public void visit(ASTNode[] nodes, SourceUnit source) {\n      System.out.println(String.format(\"Running AST transformation for class %s\", ((ClassNode) nodes[1]).getName()));\n    }\n}\n```\n\n\nLet's understand the code written above.\n\n1. You created a Java class `ToHashAdderAstTransformation` that extends `AbstractASTTransformation`. Groovy will instantiate and invoke all classes that are implementation of `ASTTransformation` interface.\n2. You annotated the `ToHashAdderAstTransformation` class with `GroovyASTTransformation` annotation so that Groovy will know which `CompilePhase` to run your AST transformation in. There are nine compile phases -- `INITIALIZATION`, `PARSING`, `CONVERSION`, `SEMANTIC_ANALYSIS`, `CANONICALIZATION`, `INSTRUCTION_SELECTION`,`CLASS_GENERATION`, `OUTPUT`, and  `FINALIZATION`. We used `SEMANTIC_ANALYSIS` phase as it is the first phase in which local transformation can be applied.\n3. Then, we implemented `visit` method. AST transformations are implemented using the visitor design pattern that's why method name is visit. This method will be invoked when AST transformation will be active. In the method implementation, we just added print statement. The print statement will render name of the class on which transformation will be applied.\n\nIf you run the test case now, you will not see `println` statement. The reason for this is that we have not enabled our AST transformation. To enable AST transformation, you have to declare that using the `GroovyASTTransformationClass` annotation as shown below.\n\n```java\npackage playground;\n\nimport org.codehaus.groovy.transform.GroovyASTTransformationClass;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Retention(RetentionPolicy.SOURCE)\n@Target(ElementType.TYPE)\n@GroovyASTTransformationClass(classes = {ToHashAdderAstTransformation.class})\npublic @interface Hash {\n\n    String algorithm() default \"SHA1\";\n}\n```\n\nRun the test case again and this time you will see  the message printed to console.\n\n```text\nRunning AST transformation for class Foo\n```\n\nSo, we are moving in the right direction. Let's now write the proper implementation of visit method. The implementation will add `toHash` method to the generated class. Replace the code in the `ToHashAdderAstTransformation` with the code shown below.\n\n```java\npackage playground;\n\nimport org.codehaus.groovy.ast.ASTNode;\nimport org.codehaus.groovy.ast.AnnotationNode;\nimport org.codehaus.groovy.ast.ClassNode;\nimport org.codehaus.groovy.ast.MethodNode;\nimport org.codehaus.groovy.ast.builder.AstBuilder;\nimport org.codehaus.groovy.ast.expr.ConstantExpression;\nimport org.codehaus.groovy.control.CompilePhase;\nimport org.codehaus.groovy.control.SourceUnit;\nimport org.codehaus.groovy.transform.AbstractASTTransformation;\nimport org.codehaus.groovy.transform.GroovyASTTransformation;\n\nimport java.util.List;\n\n@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)\npublic class ToHashAdderAstTransformation extends AbstractASTTransformation {\n\n    @Override\n    public void visit(ASTNode[] nodes, SourceUnit source) {\n        AnnotationNode hashAnnotationNode = (AnnotationNode) nodes[0];\n        ConstantExpression hashProvider = (ConstantExpression) hashAnnotationNode.getMember(\"algorithm\");\n        ClassNode classNode = (ClassNode) nodes[1];\n        System.out.println(String.format(\"Running AST transformation for class %s\", classNode.getName()));\n        String hashString = \"import java.security.MessageDigest\\n\" +\n                \"\\n\" +\n                \"class %s {\\n\" +\n                \"    String toHash() {\\n\" +\n                \"        def hash = MessageDigest.getInstance('%s')\\n\" +\n                \"\\n\" +\n                \"hash.update(toString().bytes)\\n\" +\n                \"        toHexString(hash.digest())\\n\" +\n                \"    }\\n\" +\n                \"private String toHexString(byte[] bytes) {\\n\" +\n                \"        StringBuilder result = new StringBuilder()\\n\" +\n                \"        for (int i = 0; i < bytes.length; i++) {\\n\" +\n                \"            result.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16)\\n\" +\n                \"                    .substring(1))\\n\" +\n                \"        }\\n\" +\n                \"        return result.toString()\\n\" +\n                \"    }\" +\n                \"}\";\n        List<ASTNode> astNodes = new AstBuilder()\n                .buildFromString(String.format(hashString, classNode.getName(), hashProvider != null ? hashProvider.getValue() : \"SHA1\"));\n        List<MethodNode> methods = ((ClassNode) astNodes.get(1)).getMethods();\n        MethodNode toHashMethod = methods.get(0);\n        MethodNode toHexStringMethod = methods.get(1);\n        classNode.addMethod(toHashMethod);\n        classNode.addMethod(toHexStringMethod);\n    }\n\n}\n```\n\nLet's understand the code shown above:\n\n1. First, we grab the first two nodes from the `nodes` array. The first node provides information about the annotation and second node is a ClassNode providing information about the class on which annotation was declared.\n2. Then, we defined code to inject in a String. We created a `toHash` method that uses Java `MessageDigest` class to convert a value to a hash.\n3 Then, we converted the String script to list of AST nodes.\n4. Finally, we extracted the first two methods and added them to the `ClassNode`. This will make sure both `toHash` and `toHexString` methods are added to the generated code.\n\nNow, run your test case and it will pass.\n\n------\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/45](https://github.com/shekhargulati/52-technologies-in-2016/issues/45).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/32-groovy-ast-transformations)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### Java template\n*.class\n\n# Mobile Tools for Java (J2ME)\n.mtj.tmp/\n\n# Package Files #\n*.jar\n*.war\n*.ear\n\n# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml\nhs_err_pid*\n### Gradle template\n.gradle\nbuild/\n\n# Ignore Gradle GUI config\ngradle-app.setting\n\n# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)\n!gradle-wrapper.jar\n\n# Cache of project\n.gradletasknamecache\n\n# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898\n# gradle/wrapper/gradle-wrapper.properties\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm\n# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839\n\n# User-specific stuff:\n.idea/\n\n# Sensitive or high-churn files:\n.idea/dataSources.ids\n.idea/dataSources.xml\n.idea/dataSources.local.xml\n.idea/sqlDataSources.xml\n.idea/dynamic.xml\n.idea/uiDesigner.xml\n\n# Gradle:\n.idea/gradle.xml\n.idea/libraries\n\n# Mongo Explorer plugin:\n.idea/mongoSettings.xml\n\n## File-based project format:\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\nfabric.properties\n\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/build.gradle",
    "content": "/*\n * This build file was auto generated by running the Gradle 'init' task\n * by 'shekhargulati' at '8/7/16 2:57 PM' with Gradle 2.12\n *\n * This generated file contains a sample Groovy project to get you started.\n * For more details take a look at the Groovy Quickstart chapter in the Gradle\n * user guide available at https://docs.gradle.org/2.12/userguide/tutorial_groovy_projects.html\n */\n\n// Apply the groovy plugin to add support for Groovy\napply plugin: 'groovy'\napply plugin: 'java'\n\n// In this section you declare where to find the dependencies of your project\nrepositories {\n    // Use 'jcenter' for resolving your dependencies.\n    // You can declare any Maven/Ivy/file repository here.\n    jcenter()\n}\n\n// In this section you declare the dependencies for your production and test code\ndependencies {\n    // We use the latest groovy 2.x version for building this library\n    compile 'org.codehaus.groovy:groovy-all:2.4.7'\n\n    // We use the awesome Spock testing and specification framework\n    testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'\n    testCompile 'junit:junit:4.12'\n}\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Sun Aug 07 16:10:50 IST 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.12-all.zip\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windows variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/settings.gradle",
    "content": "/*\n * This settings file was auto generated by the Gradle buildInit task\n * by 'shekhargulati' at '8/7/16 2:57 PM' with Gradle 2.12\n *\n * The settings file is used to specify which projects to include in your build.\n * In a single project build this file can be empty or even removed.\n *\n * Detailed information about configuring a multi-project build in Gradle can be found\n * in the user guide at https://docs.gradle.org/2.12/userguide/multi_project_builds.html\n */\n\n/*\n// To declare projects as part of a multi-project build use the 'include' method\ninclude 'shared'\ninclude 'api'\ninclude 'services:webservice'\n*/\n\nrootProject.name = 'sha1-ast'\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/src/main/groovy/playground/Book.groovy",
    "content": "package playground\n\n@Hash(algorithm = \"MD5\")\nclass Book {\n\n    String title\n    String author\n\n    Book(String title, String author) {\n        this.title = title\n        this.author = author\n    }\n\n    @Override\n    String toString() {\n        return title + \", \" + author\n    }\n}\n\n\n\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/src/main/java/playground/Hash.java",
    "content": "package playground;\n\nimport org.codehaus.groovy.transform.GroovyASTTransformationClass;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Retention(RetentionPolicy.SOURCE)\n@Target(ElementType.TYPE)\n@GroovyASTTransformationClass(classes = {ToHashAdderAstTransformation.class})\npublic @interface Hash {\n\n    String algorithm() default \"SHA1\";\n}\n\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/src/main/java/playground/ToHashAdderAstTransformation.java",
    "content": "package playground;\n\nimport org.codehaus.groovy.ast.ASTNode;\nimport org.codehaus.groovy.ast.AnnotationNode;\nimport org.codehaus.groovy.ast.ClassNode;\nimport org.codehaus.groovy.ast.MethodNode;\nimport org.codehaus.groovy.ast.builder.AstBuilder;\nimport org.codehaus.groovy.ast.expr.ConstantExpression;\nimport org.codehaus.groovy.control.CompilePhase;\nimport org.codehaus.groovy.control.SourceUnit;\nimport org.codehaus.groovy.transform.AbstractASTTransformation;\nimport org.codehaus.groovy.transform.GroovyASTTransformation;\n\nimport java.util.List;\n\n@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)\npublic class ToHashAdderAstTransformation extends AbstractASTTransformation {\n\n    @Override\n    public void visit(ASTNode[] nodes, SourceUnit source) {\n        AnnotationNode hashAnnotationNode = (AnnotationNode) nodes[0];\n        ConstantExpression hashProvider = (ConstantExpression) hashAnnotationNode.getMember(\"algorithm\");\n        ClassNode classNode = (ClassNode) nodes[1];\n        System.out.println(String.format(\"Running AST transformation for class %s\", classNode.getName()));\n        String hashString = \"import java.security.MessageDigest\\n\" +\n                \"\\n\" +\n                \"class %s {\\n\" +\n                \"    String toHash() {\\n\" +\n                \"        def hash = MessageDigest.getInstance('%s')\\n\" +\n                \"\\n\" +\n                \"hash.update(toString().bytes)\\n\" +\n                \"        toHexString(hash.digest())\\n\" +\n                \"    }\\n\" +\n                \"private String toHexString(byte[] bytes) {\\n\" +\n                \"        StringBuilder result = new StringBuilder()\\n\" +\n                \"        for (int i = 0; i < bytes.length; i++) {\\n\" +\n                \"            result.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16)\\n\" +\n                \"                    .substring(1))\\n\" +\n                \"        }\\n\" +\n                \"        return result.toString()\\n\" +\n                \"    }\" +\n                \"}\";\n        List<ASTNode> astNodes = new AstBuilder()\n                .buildFromString(String.format(hashString, classNode.getName(), hashProvider != null ? hashProvider.getValue() : \"SHA1\"));\n        List<MethodNode> methods = ((ClassNode) astNodes.get(1)).getMethods();\n        MethodNode toHashMethod = methods.get(0);\n        MethodNode toHexStringMethod = methods.get(1);\n        classNode.addMethod(toHashMethod);\n        classNode.addMethod(toHexStringMethod);\n    }\n\n}\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/src/main/resources/hash.java.txt",
    "content": "import java.security.MessageDigest\n\nclass MyClass {\n    String toHash() {\n        def hash = MessageDigest.getInstance('SHA1')\n\n        hash.digest().inject(new StringBuffer()) { sb, it ->\n            sb.append(String.format('%02x', it))\n        }.toString()\n    }\n}"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/src/test/groovy/playground/BookTest.groovy",
    "content": "package playground\n\nimport org.junit.Test\n\nimport static org.hamcrest.CoreMatchers.equalTo\nimport static org.junit.Assert.assertThat\n\nclass BookTest {\n\n    @Test\n    void 'should be able to set author and title of a book'() {\n\n        def book = new Book(\"OpenShift Cookbook\", \"Shekhar Gulati\")\n\n        assertThat(book.getTitle(), equalTo(\"OpenShift Cookbook\"))\n        assertThat(book.getAuthor(), equalTo(\"Shekhar Gulati\"))\n    }\n\n\n}\n"
  },
  {
    "path": "32-groovy-ast-transformations/sha1-ast/src/test/groovy/playground/HashAstTransformationTests.groovy",
    "content": "package playground\n\nimport org.junit.Test\nimport static groovy.test.GroovyAssert.assertScript\n\n\nclass HashAstTransformationTests {\n\n\n    @Test\n    void \"class with @Hash annotation should have toHash method that covert to SHA1 hash\"(){\n        assertScript('''\n\n        import playground.Hash\n\n        @Hash\n        class Foo{\n            String msg\n\n            Foo(String msg){\n                this.msg = msg\n            }\n\n            String toString(){\n                this.msg\n            }\n        }\n\n        def hash = new Foo(\"Hello, World!\").toHash()\n        assert hash == \"0a0a9f2a6772942557ab5355d76af442f8f65e01\"\n    ''')\n    }\n\n    @Test\n    void \"class with @Hash annotation should have toHash method that covert to MD5 hash\"(){\n        assertScript('''\n\n        import playground.Hash\n\n        @Hash(algorithm=\"MD5\")\n        class Foo{\n            String msg\n\n            Foo(String msg){\n                this.msg = msg\n            }\n\n            String toString(){\n                this.msg\n            }\n        }\n\n        def hash = new Foo(\"Hello, World!\").toHash()\n        assert hash == \"65a8e27d8879283831b664bd8b7f0ad4\"\n    ''')\n\n    }\n\n}\n"
  },
  {
    "path": "34-aws-lambda/README.md",
    "content": "Automate Your Static Website Social Notifications with AWS Lambda\n-----\n\nWelcome to thirty-fourth week of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I learnt about AWS Lambda. [AWS Lambda](https://aws.amazon.com/lambda/) is the third compute service from Amazon. It is very different from the existing two compute services EC2(Elastic Compute Cloud) and ECS(Elastic Container Service). AWS Lambda is an event-driven, serverless computing platform that executes your code in response to events. It manages the underlying infrastructure scaling it up or down to meet the event rate. You are only charged for the time your code is executed. AWS Lambda currently supports Java, Python, and Node.js language runtimes. In this blog, we will use Python as our choice of language.\n\n## AWS Lambda use case\n\nIn this blog, we will use AWS Lambda for a simple use case of sending a tweet after a blog is published. I host all my blogs on Github. This way I can use my development workflow to publish blogs. I write all my blogs in Markdown, I commit incrementally locally, once I am done I squash all my commit to a single commit, and finally publish the blog by performing a `git push`. I like this writing workflow but miss the automated way to send notifications. Once I publish a blog, I would like to send a tweet about the blog. To solve this problem I decided to use AWS Lambda along with AWS API gateway.\n\n## The traditional way\n\nLet's think how we will achieve this use case in the traditional way.\n\n1. I will write a simple web application using my favorite language.\n\n2. The web application will expose a HTTP POST REST endpoint where Github will send push updates. This is done using Github webhook support.\n\n3. Whenever our web application will receive a push update with certain a text message we will send a tweet.\n\nTo host such an application I will have to do following:\n\n1. I will have to provision machines that will host my RESTful backend.\n\n2. For each push update, enqueue a job to process it.\n\n3. Provision a second application that will process these jobs. This app will be responsible determining status message, author and url of the post, and finally tweeting about it.\n\n4. We will also have to think about our deployment tool so that we don't deploy manually.\n\n5. Finally, we will have to pay for the time application was running. If you look at the use case, we don't need our application to be up always it only has to do job when there is a push update.\n\nAs you can see this looks like a lot of work. Can we do better? Is there an easy way to build such a use case?\n\n## The lambda way\n\nAWS Lambda provides an event driven compute service that allows you to write functions that respond to events. Lambda functions are stateless and request-driven. These can be triggered by events generated by other AWS services like when an object was PUT to the S3 bucket or a write was made on an Amazon DynamoDB table etc. AWS Lambda allows you to connect different AWS services in a meaningful way to perform a certain task.\n\nLet's look at how we will achieve the above mentioned use case using AWS Lambda.\n\n1. Once I am done with the blog, I will perform a `git push` and my blog will be published on Github.\n\n2. I will configure web hook in my Github repository that will be executed whenever a push is done. The webhook will make a POST request to the HTTP API exposed using AWS API gateway.\n\n3. AWS API gateway will send the request to AWS lambda so that it can process the request.\n\n4. AWS Lambda will invoke the desired lambda function. Lambda function will check whether the commit message contains `new blog` text in it. If it is a new blog then a tweet will be sent.\n\nIn this model, you will learn that we didn't had to think about provisioning infrastructure. There are no servers to manage. Our lambda function will only be executed whenever there is a push event. This means we only pay for our function execution. This makes it very cheap compared to hosting server applications.\n\n## Prerequisite\n\nTo go through this tutorial you will need following:\n\n1. AWS account\n2. Python\n3. AWS CLI and configure it.\n\n## Creating AWS Lambda Function\n\nThere are couple of ways to create AWS lambda functions. One way is to use the AWS GUI and write the Python script in an online editor. This is useful for simple tasks when you don't depend on any external library. Second way is to write lambda function on your machine and then create and upload the lambda function using AWS CLI. We will use the second method as we will use an external Python library to send tweets.\n\nNavigate to a convenient location on your filesystem and create a directory called `tweet-sender`.\n\n```bash\n$ mkdir tweet-sender && cd tweet-sender\n```\n\nWe will use Python virtualenv so that we don't pollute global python.\n\n```bash\n$ virtualenv venv --python=python2.7\n```\n\nNext, activate the virtualenv\n\n```bash\n$ source venv/bin/activate\n```\n\nYou can check that you are using python installation from virtualenv by running `which python`.\n\nPlease install `python-twitter` package using pip as we will use it to send tweets.\n\n```bash\n$ pip install python-twitter\n```\n\nCreate a Python file `tweet_sender.py` that will host our Python script.\n\n```python\nimport twitter\nimport re\n\napi = twitter.Api(consumer_key='consumer_key',\n                    consumer_secret='consumer_secret',\n                    access_token_key='access_token_key,\n                    access_token_secret='access_token_secret')\n\ndef tweet_handler(event, context):\n    commit_message = event[\"head_commit\"][\"message\"]\n    url = event[\"repository\"][\"url\"]\n    print commit_message\n    print url\n    if re.search('new blog', commit_message, re.IGNORECASE):\n        status = \"%s at %s\" % (commit_message, url)\n        api.PostUpdate(status)\n    else:\n        print(\"Commit message was not about new blog so ignoring...\")\n```\n\n> **Please replace `consumer_key`, `consumer_secret`, `access_token_key`, and `access_token_secret` with your Twitter applications credentials. You can create new Twitter application using [Twitter application management portal](https://apps.twitter.com/app/new).**\n\nIn the code shown above we did the following.\n\n* Imported the required packages. `twitter` package will be used for sending tweets and `re` is imported to perform a case insensitive search of `new blog` text in the commit message.\n* Next, we created an instance of twitter API.\n* Finally, we created a function `tweet_handler` that will be responsible for sending tweets. This is the function AWS Lambda service will invoke. It will receive two parameters -- event and context. The `event` object is a dictionary with the message contents. In our case, event will contain the message containing details about the Github push event.\n\nNow, that we have written the Python code to post a tweet let's create AWS Lambda function. To do that, we will use AWS CLI. But before we can create function, we have to package the code in a zip file. The zip file will contain `tweet_sender.py` as well as the dependencies. All the dependencies are inside our virtualenv `venv/lib/python2.7/site-packages/` directory. To create a zip file copy the `tweet_sender.py` as well as all the files and directories in `venv/lib/python2.7/site-packages/` in a tmp directory and then compress everything in the `tmp` directory into a zip file.\n\n```bash\n$ mkdir tmp\n$ cp -r tweet_sender.py venv/lib/python2.7/site-packages/ tmp\n$ cd tmp\n$ zip -r ../tweet-sender.zip .\n```\n\n\nNow that we have zip containing our lambda function code we can create AWS lambda function by running the following command.\n\n```bash\n$ aws lambda create-function --region us-east-1 --function-name TweetSender --zip-file fileb://tweet-sender.zip --role arn:aws:iam::account-id:role/service-role/lambda-role  --handler tweet_sender.tweet_handler --runtime python2.7 --timeout 15 --memory-size 512\n```\n\nYou have to replace `account-id` with your account id.\n\nIt will take couple of minutes to create AWS Lambda function so stay calm.\n\nYou will receive response like as shown below.\n\n```json\n{\n    \"CodeSha256\": \"hhnnnkjnkjnjknnjnkjn=\",\n    \"FunctionName\": \"TweetSender\",\n    \"CodeSize\": 5159818,\n    \"MemorySize\": 512,\n    \"FunctionArn\": \"arn:aws:lambda:us-east-1:1787:function:TweetSender\",\n    \"Version\": \"$LATEST\",\n    \"Role\": \"arn:aws:iam::account-id:role/service-role/lambda-role\",\n    \"Timeout\": 15,\n    \"LastModified\": \"2016-08-22T19:04:39.300+0000\",\n    \"Handler\": \"tweet_sender.tweet_handler\",\n    \"Runtime\": \"python2.7\",\n    \"Description\": \"\"\n}\n```\n\nIf you login into [AWS Lambda console](https://console.aws.amazon.com/lambda/) you will see your newly created function as shown below.\n\n![](images/lambda-function.png)\n\nClick on the lambda function and you will shown `TweetSender` lambda function details.\n\n![](images/tweet-sender-lambda-function.png)\n\nWe can test our lambda function by clicking the `test` button.\n\nYou will have to provide it a valid JSON that this lambda function will expect. This is the portion of the JSON we are interested in. It has both the commit message and url of the repository.\n\n```json\n{\n  \"head_commit\": {\n    \"id\": \"1c791fb44a03c32aaf3deeb93dd02c0cfee77780\",\n    \"tree_id\": \"6f974f0da15eb2ec85ebe98a6b0974eec2fc17f9\",\n    \"distinct\": true,\n    \"message\": \"New blog on AWS lambda\",\n    \"timestamp\": \"2016-08-22T18:54:29+05:30\"\n  },\n  \"repository\": {\n    \"id\": 66274453,\n    \"name\": \"test31\",\n    \"full_name\": \"shekhar-gulati/test31\",\n    \"private\": false,\n    \"html_url\": \"https://github.com/shekhar-gulati/test31\",\n    \"description\": \"New test repo\",\n    \"fork\": false,\n    \"url\": \"https://github.com/shekhar-gulati/test31\"\n  }\n}\n```\n\nIf you execute this function using this test message, a tweet will be sent using the credentials you provided to the python program.\n\n## Add AWS API Gateway\n\nAWS API Gateway will be expose the REST endpoint that will be used by Github. Whenever there will be push event, Github will call the AWS API Gateway. Log in to [API Gateway console](https://console.aws.amazon.com/apigateway/home) and click on `Get Started`. You will be directed to a page where you have to create a new API. Select the New API option as shown below and click `Create API` button.\n\n![](images/create-api.png)\n\nOnce created you will be redirected to your API Gateway page.\n\n![](images/github-webhook-api.png)\n\nAPI Gateway is composed of resources and methods. Create a new resource by selecting it from action dropdown as shown below.\n\n![](images/create-resource.png)\n\nEnter details of your resource and press `Create Resource` button.\n\n![](images/create-new-resource.png)\n\nNext, we will create a HTTP method binding.\n\n![](images/select-method.png)\n\nWe will select the POST method and save it as shown below.\n\n![](images/create-post-method.png)\n\nNext, we will setup the POST method so that it invokes the lamda function.\n\n![](images/setup-api-gateway-method.png)\n\nNext, you will be shown a diagram of how execution will flow.\n\n![](images/api-gateway-workflow.png)\n\nTo make your API accessible, you will have to deploy it. Go to `/webhook` resource and then select Deploy API action.\n\n![](images/deploy-api.png)\n\nCreate a new deployment stage and then create it.\n\n![](images/create-new-deployment-stage.png)\n\n\nFinally, you will get a URL that you can use. It will be like [https://xcnfjkjknecj.execute-api.us-east-1.amazonaws.com/prod/webhook](https://xcnfjkjknecj.execute-api.us-east-1.amazonaws.com/prod/webhook).\n\nNow, we have successfully created our API endpoint that Github can send messages to.\n\n## Create Github webhook\n\nGo to any of your Github repository settings page.\n\n![](images/github-repository.png)\n\nSelect `Webhook & services`\n\n![](images/select-webhook.png)\n\nThen, click on `Add webhook`\n\n![](images/add-webhook.png)\n\n\nNext, you have to provide details about the webhook as shown below. After entering the details, press `Add webhook` button.\n\n![](images/webhook-details.png)\n\nGo to your Github repository and add a new file, commit it with message \"new blog\", and finally push it. In couple of seconds, a tweet will appear in your twitter timeline.\n\n![](images/new-blog-tweet.png)\n\n\n-----\n\n\nThat's all for this week. Please provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/47](https://github.com/shekhargulati/52-technologies-in-2016/issues/47).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/34-aws-lambda)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "34-aws-lambda/code/.gitignore",
    "content": "venv/\n*.pyc\n*.zip\n*.zip.bak\n"
  },
  {
    "path": "34-aws-lambda/code/json_parsing.py",
    "content": "json_str = \"\"\"\n{\n  \"ref\": \"refs/heads/master\",\n  \"before\": \"4246f46e252a10ecd15722b137d1f08d4d9fcf18\",\n  \"after\": \"1c791fb44a03c32aaf3deeb93dd02c0cfee77780\",\n  \"created\": false,\n  \"deleted\": false,\n  \"forced\": false,\n  \"base_ref\": null,\n  \"compare\": \"https://github.com/shekhar-gulati/test31/compare/4246f46e252a...1c791fb44a03\",\n  \"commits\": [\n    {\n      \"id\": \"1c791fb44a03c32aaf3deeb93dd02c0cfee77780\",\n      \"tree_id\": \"6f974f0da15eb2ec85ebe98a6b0974eec2fc17f9\",\n      \"distinct\": true,\n      \"message\": \"New blog on AWS lambda\",\n      \"timestamp\": \"2016-08-22T18:54:29+05:30\",\n      \"url\": \"https://github.com/shekhar-gulati/test31/commit/1c791fb44a03c32aaf3deeb93dd02c0cfee77780\",\n      \"author\": {\n        \"name\": \"Shekhar Gulati\",\n        \"email\": \"shekhar.gulati@gmail.com\",\n        \"username\": \"shekhar-gulati\"\n      },\n      \"committer\": {\n        \"name\": \"GitHub\",\n        \"email\": \"noreply@github.com\",\n        \"username\": \"web-flow\"\n      },\n      \"added\": [\n        \"blog1.md\"\n      ],\n      \"removed\": [\n\n      ],\n      \"modified\": [\n\n      ]\n    }\n  ],\n  \"head_commit\": {\n    \"id\": \"1c791fb44a03c32aaf3deeb93dd02c0cfee77780\",\n    \"tree_id\": \"6f974f0da15eb2ec85ebe98a6b0974eec2fc17f9\",\n    \"distinct\": true,\n    \"message\": \"New blog on AWS lambda\",\n    \"timestamp\": \"2016-08-22T18:54:29+05:30\",\n    \"url\": \"https://github.com/shekhar-gulati/test31/commit/1c791fb44a03c32aaf3deeb93dd02c0cfee77780\",\n    \"author\": {\n      \"name\": \"Shekhar Gulati\",\n      \"email\": \"shekhar.gulati@gmail.com\",\n      \"username\": \"shekhar-gulati\"\n    },\n    \"committer\": {\n      \"name\": \"GitHub\",\n      \"email\": \"noreply@github.com\",\n      \"username\": \"web-flow\"\n    },\n    \"added\": [\n      \"blog1.md\"\n    ],\n    \"removed\": [\n\n    ],\n    \"modified\": [\n\n    ]\n  },\n  \"repository\": {\n    \"id\": 66274453,\n    \"name\": \"test31\",\n    \"full_name\": \"shekhar-gulati/test31\",\n    \"owner\": {\n      \"name\": \"shekhar-gulati\",\n      \"email\": \"shekhar.gulati@gmail.com\"\n    },\n    \"private\": false,\n    \"html_url\": \"https://github.com/shekhar-gulati/test31\",\n    \"description\": \"New test repo\",\n    \"fork\": false,\n    \"url\": \"https://github.com/shekhar-gulati/test31\",\n    \"forks_url\": \"https://api.github.com/repos/shekhar-gulati/test31/forks\",\n    \"keys_url\": \"https://api.github.com/repos/shekhar-gulati/test31/keys{/key_id}\",\n    \"collaborators_url\": \"https://api.github.com/repos/shekhar-gulati/test31/collaborators{/collaborator}\",\n    \"teams_url\": \"https://api.github.com/repos/shekhar-gulati/test31/teams\",\n    \"hooks_url\": \"https://api.github.com/repos/shekhar-gulati/test31/hooks\",\n    \"issue_events_url\": \"https://api.github.com/repos/shekhar-gulati/test31/issues/events{/number}\",\n    \"events_url\": \"https://api.github.com/repos/shekhar-gulati/test31/events\",\n    \"assignees_url\": \"https://api.github.com/repos/shekhar-gulati/test31/assignees{/user}\",\n    \"branches_url\": \"https://api.github.com/repos/shekhar-gulati/test31/branches{/branch}\",\n    \"tags_url\": \"https://api.github.com/repos/shekhar-gulati/test31/tags\",\n    \"blobs_url\": \"https://api.github.com/repos/shekhar-gulati/test31/git/blobs{/sha}\",\n    \"git_tags_url\": \"https://api.github.com/repos/shekhar-gulati/test31/git/tags{/sha}\",\n    \"git_refs_url\": \"https://api.github.com/repos/shekhar-gulati/test31/git/refs{/sha}\",\n    \"trees_url\": \"https://api.github.com/repos/shekhar-gulati/test31/git/trees{/sha}\",\n    \"statuses_url\": \"https://api.github.com/repos/shekhar-gulati/test31/statuses/{sha}\",\n    \"languages_url\": \"https://api.github.com/repos/shekhar-gulati/test31/languages\",\n    \"stargazers_url\": \"https://api.github.com/repos/shekhar-gulati/test31/stargazers\",\n    \"contributors_url\": \"https://api.github.com/repos/shekhar-gulati/test31/contributors\",\n    \"subscribers_url\": \"https://api.github.com/repos/shekhar-gulati/test31/subscribers\",\n    \"subscription_url\": \"https://api.github.com/repos/shekhar-gulati/test31/subscription\",\n    \"commits_url\": \"https://api.github.com/repos/shekhar-gulati/test31/commits{/sha}\",\n    \"git_commits_url\": \"https://api.github.com/repos/shekhar-gulati/test31/git/commits{/sha}\",\n    \"comments_url\": \"https://api.github.com/repos/shekhar-gulati/test31/comments{/number}\",\n    \"issue_comment_url\": \"https://api.github.com/repos/shekhar-gulati/test31/issues/comments{/number}\",\n    \"contents_url\": \"https://api.github.com/repos/shekhar-gulati/test31/contents/{+path}\",\n    \"compare_url\": \"https://api.github.com/repos/shekhar-gulati/test31/compare/{base}...{head}\",\n    \"merges_url\": \"https://api.github.com/repos/shekhar-gulati/test31/merges\",\n    \"archive_url\": \"https://api.github.com/repos/shekhar-gulati/test31/{archive_format}{/ref}\",\n    \"downloads_url\": \"https://api.github.com/repos/shekhar-gulati/test31/downloads\",\n    \"issues_url\": \"https://api.github.com/repos/shekhar-gulati/test31/issues{/number}\",\n    \"pulls_url\": \"https://api.github.com/repos/shekhar-gulati/test31/pulls{/number}\",\n    \"milestones_url\": \"https://api.github.com/repos/shekhar-gulati/test31/milestones{/number}\",\n    \"notifications_url\": \"https://api.github.com/repos/shekhar-gulati/test31/notifications{?since,all,participating}\",\n    \"labels_url\": \"https://api.github.com/repos/shekhar-gulati/test31/labels{/name}\",\n    \"releases_url\": \"https://api.github.com/repos/shekhar-gulati/test31/releases{/id}\",\n    \"deployments_url\": \"https://api.github.com/repos/shekhar-gulati/test31/deployments\",\n    \"created_at\": 1471872004,\n    \"updated_at\": \"2016-08-22T13:20:04Z\",\n    \"pushed_at\": 1471872269,\n    \"git_url\": \"git://github.com/shekhar-gulati/test31.git\",\n    \"ssh_url\": \"git@github.com:shekhar-gulati/test31.git\",\n    \"clone_url\": \"https://github.com/shekhar-gulati/test31.git\",\n    \"svn_url\": \"https://github.com/shekhar-gulati/test31\",\n    \"homepage\": null,\n    \"size\": 0,\n    \"stargazers_count\": 0,\n    \"watchers_count\": 0,\n    \"language\": null,\n    \"has_issues\": true,\n    \"has_downloads\": true,\n    \"has_wiki\": true,\n    \"has_pages\": false,\n    \"forks_count\": 0,\n    \"mirror_url\": null,\n    \"open_issues_count\": 0,\n    \"forks\": 0,\n    \"open_issues\": 0,\n    \"watchers\": 0,\n    \"default_branch\": \"master\",\n    \"stargazers\": 0,\n    \"master_branch\": \"master\"\n  },\n  \"pusher\": {\n    \"name\": \"shekhar-gulati\",\n    \"email\": \"shekhar.gulati@gmail.com\"\n  },\n  \"sender\": {\n    \"login\": \"shekhar-gulati\",\n    \"id\": 13261350,\n    \"avatar_url\": \"https://avatars.githubusercontent.com/u/13261350?v=3\",\n    \"gravatar_id\": \"\",\n    \"url\": \"https://api.github.com/users/shekhar-gulati\",\n    \"html_url\": \"https://github.com/shekhar-gulati\",\n    \"followers_url\": \"https://api.github.com/users/shekhar-gulati/followers\",\n    \"following_url\": \"https://api.github.com/users/shekhar-gulati/following{/other_user}\",\n    \"gists_url\": \"https://api.github.com/users/shekhar-gulati/gists{/gist_id}\",\n    \"starred_url\": \"https://api.github.com/users/shekhar-gulati/starred{/owner}{/repo}\",\n    \"subscriptions_url\": \"https://api.github.com/users/shekhar-gulati/subscriptions\",\n    \"organizations_url\": \"https://api.github.com/users/shekhar-gulati/orgs\",\n    \"repos_url\": \"https://api.github.com/users/shekhar-gulati/repos\",\n    \"events_url\": \"https://api.github.com/users/shekhar-gulati/events{/privacy}\",\n    \"received_events_url\": \"https://api.github.com/users/shekhar-gulati/received_events\",\n    \"type\": \"User\",\n    \"site_admin\": false\n  }\n}\n\"\"\"\n\nimport json\n\ntweet = json.loads(json_str)\n\nprint tweet[\"head_commit\"][\"message\"]\n\n\nprint tweet[\"repository\"][\"url\"]\n"
  },
  {
    "path": "34-aws-lambda/code/tweet_sender.py",
    "content": "import twitter\nimport re\n\napi = twitter.Api(consumer_key='nofTSEsC8jT0MyUkUBfTnWNNO',\n                    consumer_secret='7DAqM3KwlMAIszRGwdlF9nEbavJNs6vVGJjWIUiEJrOZWrURl1',\n                    access_token_key='2375649307-0zNdNzC0ucpXSYjbst0wki27sQFJAvtpTraD1MT',\n                    access_token_secret='DwUlmv11PdNRPQ93bIQeLIzSUsmAjlb3L09QcIPXcSDRf')\n\ndef tweet_handler(event, context):\n    commit_message = event[\"head_commit\"][\"message\"]\n    url = event[\"repository\"][\"url\"]\n    print commit_message\n    print url\n    if re.search('new blog', commit_message, re.IGNORECASE):\n        status = \"%s at %s\" % (commit_message, url)\n        api.PostUpdate(status)\n    else:\n        print(\"Commit message was not about new blog so ignoring...\")\n"
  },
  {
    "path": "36-webpack/README.md",
    "content": "Webpack: The Missing Tutorial &trade; [![TimeToRead](http://ttr.myapis.xyz/ttr.svg?pageUrl=https://github.com/shekhargulati/52-technologies-in-2016/blob/master/36-webpack/README.md)](http://ttr.myapis.xyz/)\n---\n\nWelcome to the thirty-sixth blog of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I started learning [React](https://github.com/facebook/react) for one of my personal side project but soon I discovered that I should learn webpack before. webpack is the module bundler of choice for the react community so sooner or later you will have to learn it. I had no idea about webpack so I decided to spend some time understanding and learning about it. I am primarily a backend developer so it becomes difficult for me to remain up to date with the front end ecosystem. Last time I was working with front end, I used to use tools like Grunt and Bower. I know many people moved from Grunt to Gulp as Gulp is considered more performant and it follows code over configuration paradigm. If you are Java developer then you can think Grunt as Maven and Gulp as Gradle. In this blog, we will start with webpack basics and then move to its usage. Nowadays, gulp, grunt, and bower are considered old school and cool kids have started using webpack.\n\n## Why we need webpack?\n\nBefore we learn about webpack, let's understand why it exists and what problems it is trying to solve. One way to look at it is that [webpack](https://webpack.github.io/) allows you to get rid of bower and gulp/grunt in your application with a single tool: webpack. Rather than using bower to install and manage client side dependencies, you use the standard Node Package Manager(npm) to install and manage front-end dependencies. Most of the grunt/gulp tasks can be performed by webpack as well.\n\n> **Bower is a package manager for client side technologies. It can be used to search , install, uninstall web assets like JavaScript, HTML, and CSS. GruntJS is a JavaScript based command line build tool that helps developers automate repetitive tasks. You can think of it as a JavaScript alternative to Make or Ant. It perform tasks like minification, compilation, unit testing, linting, etc.**\n\nLet's suppose you are building a simple profile page for a web application that the uses jQuery and underscore JavaScript libraries. One way to build our web page would be to include both jQuery and underscore in our HTML page.\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>User Profile</title>\n    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css\" media=\"screen\">\n    <link rel=\"stylesheet\" href=\"/css/style.css\" media=\"screen\">\n  </head>\n  <body>\n    <div class=\"container\">\n      <div class=\"page-header\">\n        <h1 id=\"timeline\"></h1>\n      </div>\n      <ul class=\"timeline\">\n      </ul>\n    </div>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js\"></script>\n    <script src=\"https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js\"></script>\n    <script src=\"js/profile.js\"></script>\n  </body>\n</html>\n```\n\nThe page shown above is a simple HTML page that uses bootstrap for styling. We included jquery and underscore libraries using the script tag.\n\nLet's now look at the `profile.js` which uses our JavaScript libraries. We enclosed our code in an anonymous closure that encapsulates our business logic. If you don't enclose the code in the function, then variables will be in global space which is bad.\n\n```javascript\n(function(){\n  var user = {\n    name : \"Shekhar Gulati\",\n    messages : [\n      \"hello\",\n      \"bye\",\n      \"good night\"\n    ]\n  };\n\n  $(\"#timeline\").text(user.name+ \" Timeline\");\n\n  _.each(user.messages, function(msg){\n    var html = \"<li><div class='timeline-heading'><h4 class='timeline-title'>\"+msg+\"</h4></div></li>\";\n    $(\".timeline\").append(html);\n  });\n\n}());\n```\n\nThis function is evaluated as soon as script is called.\n\nIf you open the web page in a browser, then you will see your profile page as shown below.\n\n![](images/profile.png)\n\nThe above JavaScript code does two things -- 1) getting user information 2) setting up timeline.\n\nWe all know it is a bad practice to mix concerns, so we should write specific modules that do one thing. In the `profile.js` JavaScript file above, we used anonymous closure to encapsulate all our code. There are better ways to write modules in JavaScript. The two popular ways are CommonJS and AMD.\n\n* **A CommonJS module is essentially a reusable piece of JavaScript which exports specific objects, making them available for other modules to `require` in their programs.**\n\n* **Asynchronous Module Definition (AMD) allows you to load modules asynchronously.**\n\nIf you want to learn more about JavaScript modules, then I will refer you to [JavaScript Modules: A Beginner’s Guide](https://medium.freecodecamp.com/javascript-modules-a-beginner-s-guide-783f7d7a5fcc#.627yk09t3).\n\nIn this blog, we will write CommonJS modules. Let's write the timeline module with methods to set the header and timeline. CommonJS allows you import the dependencies using the `require` function. As our timeline module depends on `jquery` and `underscore`, we explicitly declare them with the require keyword.\n\n```javascript\nvar $ = require('jquery');\nvar _ = require('underscore');\n\nfunction timeline(user){\n  this.setHeader = function(){\n      $(\"#timeline\").text(user.name+ \" Timeline\");\n  }\n\n  this.setTimeline = function(){\n    _.each(user.messages, function(msg){\n      var html = \"<li><div class='timeline-heading'><h4 class='timeline-title'>\"+msg+\"</h4></div></li>\";\n      $(\".timeline\").append(html);\n    });\n  }\n}\n\nmodule.exports = timeline;\n```\n\nThe code shown above creates a new module named `timeline`. We defined two functions: `setHeader` and `setTimeline`. We used the special object `module` and added reference of our function timeline to `module.exports`. This is the way you tell the CommonJS module system that you want to expose a function, so that others can use it.\n\nNow we will update `profile.js` to use our `timeline` module. We can even create a new module that will load up the user information, but for now let's go with one module.\n\n\n```javascript\nvar timeline = require('./timeline.js');\nvar user = {\n  name : \"Shekhar Gulati\",\n  messages : [\n    \"hello\",\n    \"bye\",\n    \"good night\"\n  ]\n};\n\nvar timelineModule = new timeline(user);\ntimelineModule.setHeader();\ntimelineModule.setTimeline();\n```\n\nIf you load index.html in your web browser, then you will see an empty page. Looking at the developer tools of your web browser will tell you the error.\n\n```\nprofile.js:1 Uncaught ReferenceError: require is not defined\n```\n\nThe reason is that browsers don't understand module systems like CommonJS. You have to give them JavaScript in the format they expect.\n\n## module bundlers to the rescue\n\nWeb browsers don't understand these well defined modules. You either have to add all your JavaScript code in a single file and then import it, or you have to import all the JavaScript files manually in your page using the `script` tag. We use module bundlers to overcome this problem. Module bundlers combine different modules and their dependencies into a single file in the correct order. They can parse code written using different module systems into the format browser understand. The two popular module bundler are:\n\n1. **browserify**: it packages npm modules, so that you can use them in your browser. When you are working with browserify, you will end up using Grunt or Gulp to perform tasks like linting, running tests, etc. This means you will have to spend time managing multiple tools and their integration.\n\n2. **webpack**: it is an opinionated build system that not only offers module bundling, but can perform all the tasks that Gulp/Grunt can do. Also, webpack is not limited to bundling JavaScript files; it can work with other static assets like CSS, images, html partials, etc. Webpack also supports a very useful feature called `code splitting`. In bigger application, you can split your application into meaningful chunks which are loaded on-demand.\n\n## What is webpack?\n\nThe [official definition of webpack](https://webpack.github.io/) is mentioned below.\n\n> **webpack takes modules with dependencies and generates static assets representing those modules.**\n\nThis definition will make sense now that you understand the problem it is trying to solve. Webpack takes a set of input assets and transforms them into a bundle that you can then use.\n\n![](images/webpack.png)\n\nTransformation is provided by webpack loaders which are the heart of webpack.\n\n\n## webpack in action\n\nTo install webpack on your machine, you need to have node installed. You can download node.js from its [official website](http://nodejs.org/).\n\nOnce you have node.js installed, you can install webpack globally using the following command.\n\n```bash\n$ npm install -g webpack\n```\n\nCreate a new node module using `npm init`. It will create a new file `package.json`.\n\nInstall the dependencies using npm.\n\n```bash\n$ npm install -S jquery\n$ npm install -S underscore\n```\n\nAdditionally, we need to install webpack as a dependency.\n\n```bash\n$ npm install -S webpack\n```\n\nReplace your `index.html` with the code shown below. As you can see, we have removed all the script tags for jquery and underscore. Also, instead of importing `js/profile.js`, we are importing `dist/bundle.js`.\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>User Profile</title>\n    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css\" media=\"screen\">\n    <link rel=\"stylesheet\" href=\"/css/style.css\" media=\"screen\" title=\"no title\">\n\n  </head>\n  <body>\n\n    <div class=\"container\">\n      <div class=\"page-header\">\n        <h1 id=\"timeline\"></h1>\n      </div>\n      <ul class=\"timeline\">\n      </ul>\n\n    </div>\n\n    <script src=\"dist/bundle.js\" charset=\"utf-8\"></script>\n  </body>\n</html>\n\n```\n\nNow, let's use webpack command-line to create bundle for us. To do that type the following command.\n\n```bash\n$ webpack js/profile.js dist/bundle.js\n```\n```\nHash: 6d83c7db8ae0939be3d0\nVersion: webpack 1.13.2\nTime: 350ms\n    Asset    Size  Chunks             Chunk Names\nbundle.js  329 kB       0  [emitted]  main\n   [0] ./js/profile.js 252 bytes {0} [built]\n   [1] ./js/timeline.js 427 bytes {0} [built]\n    + 2 hidden modules\n```\nThe command and its output is shown above.\n\nNow, if you reload your page, you will see the profile page working fine.\n\nYou can also make webpack watch for changes and automatically generate a bundle. To do that you have to launch webpack with watch flag as shown below.\n\n```bash\n$ webpack -w js/profile.js dist/bundle.js\n```\n\nThis time the webpack process will not shutdown and keep running. As you make changes, a new bundle will be generated. You just have to reload your webpage in your browser. Go to `profile.js` and change name as shown below. Refresh your webpage and you will see the changes.\n\n```javascript\nvar user = {\n  name : \"Shekhar Gulati!!!\",\n  messages : [\n    \"hello\",\n    \"bye\",\n    \"good night\"\n  ]\n};\n```\n\nThe code generated by webpack in the `bundle.js` file contains a lot of webpack specific code and your application code with some transformation. If you have to debug your code using your browser devtools, then it will not be friendly. To make it easier for you to debug your code using web tools, you can launch webpack with devtools flag.\n\n\n```bash\n$ webpack -w --devtool source-map js/profile.js dist/bundle.js\n```\n\nThis will generate the source map for the bundle.js file. The source map allows you to map your minified or combined file back to an unbuilt state. This makes it easy to debug your application.\n\nTo test it you can add a debugger statement in profile.js as shown below.\n\n```javascript\nvar timeline = require('./timeline.js');\nvar user = {\n  name : \"Shekhar Gulati\",\n  messages : [\n    \"hello\",\n    \"bye\",\n    \"good night\"\n  ]\n};\n\ndebugger;\nvar timelineModule = new timeline(user);\ntimelineModule.setHeader();\ntimelineModule.setTimeline();\n```\n\nReload the page and the browser will stop the application at the debug location.\n\n![](images/webpack-debugging.png)\n\n\n### requiring CSS\n\nIn the HTML shown above, you will notice that we are loading our stylesheet `/css/style.css`. As I said before, webpack can be used not only with JavaScript but with other static assets like CSS. Remove the reference of `/css/style.css` from `index.html`. We will require the CSS in `profile.js` as shown below.\n\n```javascript\nrequire('../css/style.css');\n\nvar timeline = require('./timeline.js');\nvar user = {\n  name : \"Shekhar Gulati\",\n  messages : [\n    \"hello\",\n    \"bye\",\n    \"good night\"\n  ]\n};\n\nvar timelineModule = new timeline(user);\ntimelineModule.setHeader();\ntimelineModule.setTimeline();\n```\n\nwebpack will reload the changes, and you will see error in the console as shown below.\n\n```\nERROR in ./css/style.css\nModule parse failed: /Users/shekhargulati/dev/52-technologies-in-2016/36-webpack/code/css/style.css Unexpected token (1:0)\nYou may need an appropriate loader to handle this file type.\n```\n\nThe reason for this exception is that webpack by default does not understand CSS. You have to install couple of loaders that can help webpack handle CSS.\n\nInstall the loaders by running the command shown below.\n\n```bash\n$ npm install style-loader css-loader --save-dev\n```\n\nwebpack uses loaders to transform text into the correct format.\n\nYou have to update the `require` statement that we added to import CSS as shown below.\n\n```javascript\nrequire('style!css!../css/style.css');\n```\n\nThe syntax `style!css!` means first apply the `css` transformer to convert the text in `style.css` to CSS and then style the page using the `style` transformer.\n\nExecute the webpack command again to see your changes.\n\n```bash\n$ webpack -w --devtool source-map js/profile.js dist/bundle.js\n```\n\n\n## Using webpack config\n\nRather than specifying all the options using the command line, you can create a configuration file named `webpack.config.js` at the root of your application, and webpack will use it.\n\n```javascript\nmodule.exports = {\n  context: __dirname,\n  devtool: \"source-map\",\n  entry: \"./js/profile.js\",\n  output: {\n    path: __dirname + \"/dist\",\n    filename: \"bundle.js\"\n  }\n}\n```\n\nNow, you can just use `webpack -w`.\n\nRemember that when you added `style!css!` in the `profile.js`, you basically polluted your production code with webpack configuration. We can move that to webpack configuration as shown below.**Please note that you have to relaunch the webpack again to pick up configuration changes.**\n\n```javascript\nvar webpack = require('webpack');\n\nmodule.exports = {\n  context: __dirname,\n  devtool: \"source-map\",\n  entry: \"./js/profile.js\",\n  output: {\n    path: __dirname + \"/dist\",\n    filename: \"bundle.js\"\n  },\n  module:{\n    loaders: [\n      {test : /\\.css$/, loader: 'style!css!'}\n    ]\n  }\n}\n```\n\nThe interesting section is the one with module declaration. Here we have specified that if the file ends with .css, then apply the `style!css!` transformation.\n\nYou can verify that changes are picked up, and your webpage is working fine.\n\n### hot reloading in action\n\nwebpack achieve hot reloading via the `webpack-dev-server`. You have to first install it.\n\n```bash\n$ npm install -g webpack-dev-server\n```\n\nNow you can start the server by running `webpack-dev-server` command.\n\nThis will launch the server at http://localhost:8080/webpack-dev-server/ with the configuration you specified in `webpack.config.js`.\n\n\nYou can change the port by specifying `--port` option.\n\n```bash\n$ webpack-dev-server --port 10000\n```\n```\n http://localhost:10000/webpack-dev-server\n```\n\nThe `webpack-dev-server` configuration can also be specified in the `webpack.config.js` configuration file. You specify that inside the `devServer` section.\n\n```javascript\nmodule.exports = {\n  context: __dirname,\n  devtool: \"source-map\",\n  entry: \"./js/profile.js\",\n  output: {\n    path: __dirname + \"/dist\",\n    filename: \"bundle.js\"\n  },\n  module:{\n    loaders: [\n      {test : /\\.css$/, loader: 'style!css!'}\n    ]\n  },\n  devServer: {\n    inline:true,\n    port: 10000\n  },\n}\n```\n\n-----\n\nThat's all for this week. There are many more goodies in webpack. You can read more about that in webpack [documentation](http://webpack.github.io/docs/).\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/48](https://github.com/shekhargulati/52-technologies-in-2016/issues/48).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/36-webpack)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "36-webpack/code/.gitignore",
    "content": "node_modules/\n"
  },
  {
    "path": "36-webpack/code/css/style.css",
    "content": ".timeline {\n  list-style: none;\n  padding: 20px 0 20px;\n  position: relative;\n}\n\n.timeline:before {\n  top: 0;\n  bottom: 0;\n  position: absolute;\n  content: \" \";\n  width: 3px;\n  background-color: #eeeeee;\n  left: 50%;\n  margin-left: -1.5px;\n}\n\n.timeline > li {\n  margin-bottom: 20px;\n  position: relative;\n}\n\n.timeline > li:before,\n.timeline > li:after {\n  content: \" \";\n  display: table;\n}\n\n.timeline > li:after {\n  clear: both;\n}\n\n.timeline > li:before,\n.timeline > li:after {\n  content: \" \";\n  display: table;\n}\n\n.timeline > li:after {\n  clear: both;\n}\n\n.timeline > li > .timeline-panel {\n  width: 46%;\n  float: left;\n  border: 1px solid #d4d4d4;\n  border-radius: 2px;\n  padding: 20px;\n  position: relative;\n  -webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);\n  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);\n}\n\n.timeline > li > .timeline-panel:before {\n  position: absolute;\n  top: 26px;\n  right: -15px;\n  display: inline-block;\n  border-top: 15px solid transparent;\n  border-left: 15px solid #ccc;\n  border-right: 0 solid #ccc;\n  border-bottom: 15px solid transparent;\n  content: \" \";\n}\n\n.timeline > li > .timeline-panel:after {\n  position: absolute;\n  top: 27px;\n  right: -14px;\n  display: inline-block;\n  border-top: 14px solid transparent;\n  border-left: 14px solid #fff;\n  border-right: 0 solid #fff;\n  border-bottom: 14px solid transparent;\n  content: \" \";\n}\n\n.timeline > li > .timeline-badge {\n  color: #fff;\n  width: 50px;\n  height: 50px;\n  line-height: 50px;\n  font-size: 1.4em;\n  text-align: center;\n  position: absolute;\n  top: 16px;\n  left: 50%;\n  margin-left: -25px;\n  background-color: #999999;\n  z-index: 100;\n  border-top-right-radius: 50%;\n  border-top-left-radius: 50%;\n  border-bottom-right-radius: 50%;\n  border-bottom-left-radius: 50%;\n}\n\n.timeline > li.timeline-inverted > .timeline-panel {\n  float: right;\n}\n\n.timeline > li.timeline-inverted > .timeline-panel:before {\n  border-left-width: 0;\n  border-right-width: 15px;\n  left: -15px;\n  right: auto;\n}\n\n.timeline > li.timeline-inverted > .timeline-panel:after {\n  border-left-width: 0;\n  border-right-width: 14px;\n  left: -14px;\n  right: auto;\n}\n\n.timeline-badge.primary {\n  background-color: #2e6da4 !important;\n}\n\n.timeline-badge.success {\n  background-color: #3f903f !important;\n}\n\n.timeline-badge.warning {\n  background-color: #f0ad4e !important;\n}\n\n.timeline-badge.danger {\n  background-color: #d9534f !important;\n}\n\n.timeline-badge.info {\n  background-color: #5bc0de !important;\n}\n\n.timeline-title {\n  margin-top: 0;\n  color: inherit;\n}\n\n.timeline-body > p,\n.timeline-body > ul {\n  margin-bottom: 0;\n}\n\n.timeline-body > p + p {\n  margin-top: 5px;\n}\n"
  },
  {
    "path": "36-webpack/code/dist/bundle.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t__webpack_require__(1);\n\t\n\tvar timeline = __webpack_require__(5);\n\tvar user = {\n\t  name : \"Shekhar Gulati\",\n\t  messages : [\n\t    \"hello\",\n\t    \"bye\",\n\t    \"good night\"\n\t  ]\n\t};\n\t\n\tvar timelineModule = new timeline(user);\n\ttimelineModule.setHeader(user);\n\ttimelineModule.setTimeline(user);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t// style-loader: Adds some css to the DOM by adding a <style> tag\n\t\n\t// load the styles\n\tvar content = __webpack_require__(2);\n\tif(typeof content === 'string') content = [[module.id, content, '']];\n\t// add the styles to the DOM\n\tvar update = __webpack_require__(4)(content, {});\n\tif(content.locals) module.exports = content.locals;\n\t// Hot Module Replacement\n\tif(false) {\n\t\t// When the styles change, update the <style> tags\n\t\tif(!content.locals) {\n\t\t\tmodule.hot.accept(\"!!./../node_modules/css-loader/index.js!!./style.css\", function() {\n\t\t\t\tvar newContent = require(\"!!./../node_modules/css-loader/index.js!!./style.css\");\n\t\t\t\tif(typeof newContent === 'string') newContent = [[module.id, newContent, '']];\n\t\t\t\tupdate(newContent);\n\t\t\t});\n\t\t}\n\t\t// When the module is disposed, remove the <style> tags\n\t\tmodule.hot.dispose(function() { update(); });\n\t}\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\texports = module.exports = __webpack_require__(3)();\n\t// imports\n\t\n\t\n\t// module\n\texports.push([module.id, \".timeline {\\n  list-style: none;\\n  padding: 20px 0 20px;\\n  position: relative;\\n}\\n\\n.timeline:before {\\n  top: 0;\\n  bottom: 0;\\n  position: absolute;\\n  content: \\\" \\\";\\n  width: 3px;\\n  background-color: #eeeeee;\\n  left: 50%;\\n  margin-left: -1.5px;\\n}\\n\\n.timeline > li {\\n  margin-bottom: 20px;\\n  position: relative;\\n}\\n\\n.timeline > li:before,\\n.timeline > li:after {\\n  content: \\\" \\\";\\n  display: table;\\n}\\n\\n.timeline > li:after {\\n  clear: both;\\n}\\n\\n.timeline > li:before,\\n.timeline > li:after {\\n  content: \\\" \\\";\\n  display: table;\\n}\\n\\n.timeline > li:after {\\n  clear: both;\\n}\\n\\n.timeline > li > .timeline-panel {\\n  width: 46%;\\n  float: left;\\n  border: 1px solid #d4d4d4;\\n  border-radius: 2px;\\n  padding: 20px;\\n  position: relative;\\n  -webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);\\n  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);\\n}\\n\\n.timeline > li > .timeline-panel:before {\\n  position: absolute;\\n  top: 26px;\\n  right: -15px;\\n  display: inline-block;\\n  border-top: 15px solid transparent;\\n  border-left: 15px solid #ccc;\\n  border-right: 0 solid #ccc;\\n  border-bottom: 15px solid transparent;\\n  content: \\\" \\\";\\n}\\n\\n.timeline > li > .timeline-panel:after {\\n  position: absolute;\\n  top: 27px;\\n  right: -14px;\\n  display: inline-block;\\n  border-top: 14px solid transparent;\\n  border-left: 14px solid #fff;\\n  border-right: 0 solid #fff;\\n  border-bottom: 14px solid transparent;\\n  content: \\\" \\\";\\n}\\n\\n.timeline > li > .timeline-badge {\\n  color: #fff;\\n  width: 50px;\\n  height: 50px;\\n  line-height: 50px;\\n  font-size: 1.4em;\\n  text-align: center;\\n  position: absolute;\\n  top: 16px;\\n  left: 50%;\\n  margin-left: -25px;\\n  background-color: #999999;\\n  z-index: 100;\\n  border-top-right-radius: 50%;\\n  border-top-left-radius: 50%;\\n  border-bottom-right-radius: 50%;\\n  border-bottom-left-radius: 50%;\\n}\\n\\n.timeline > li.timeline-inverted > .timeline-panel {\\n  float: right;\\n}\\n\\n.timeline > li.timeline-inverted > .timeline-panel:before {\\n  border-left-width: 0;\\n  border-right-width: 15px;\\n  left: -15px;\\n  right: auto;\\n}\\n\\n.timeline > li.timeline-inverted > .timeline-panel:after {\\n  border-left-width: 0;\\n  border-right-width: 14px;\\n  left: -14px;\\n  right: auto;\\n}\\n\\n.timeline-badge.primary {\\n  background-color: #2e6da4 !important;\\n}\\n\\n.timeline-badge.success {\\n  background-color: #3f903f !important;\\n}\\n\\n.timeline-badge.warning {\\n  background-color: #f0ad4e !important;\\n}\\n\\n.timeline-badge.danger {\\n  background-color: #d9534f !important;\\n}\\n\\n.timeline-badge.info {\\n  background-color: #5bc0de !important;\\n}\\n\\n.timeline-title {\\n  margin-top: 0;\\n  color: inherit;\\n}\\n\\n.timeline-body > p,\\n.timeline-body > ul {\\n  margin-bottom: 0;\\n}\\n\\n.timeline-body > p + p {\\n  margin-top: 5px;\\n}\\n\", \"\"]);\n\t\n\t// exports\n\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\t/*\n\t\tMIT License http://www.opensource.org/licenses/mit-license.php\n\t\tAuthor Tobias Koppers @sokra\n\t*/\n\t// css base code, injected by the css-loader\n\tmodule.exports = function() {\n\t\tvar list = [];\n\t\n\t\t// return the list of modules as css string\n\t\tlist.toString = function toString() {\n\t\t\tvar result = [];\n\t\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\t\tvar item = this[i];\n\t\t\t\tif(item[2]) {\n\t\t\t\t\tresult.push(\"@media \" + item[2] + \"{\" + item[1] + \"}\");\n\t\t\t\t} else {\n\t\t\t\t\tresult.push(item[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result.join(\"\");\n\t\t};\n\t\n\t\t// import a list of modules into the list\n\t\tlist.i = function(modules, mediaQuery) {\n\t\t\tif(typeof modules === \"string\")\n\t\t\t\tmodules = [[null, modules, \"\"]];\n\t\t\tvar alreadyImportedModules = {};\n\t\t\tfor(var i = 0; i < this.length; i++) {\n\t\t\t\tvar id = this[i][0];\n\t\t\t\tif(typeof id === \"number\")\n\t\t\t\t\talreadyImportedModules[id] = true;\n\t\t\t}\n\t\t\tfor(i = 0; i < modules.length; i++) {\n\t\t\t\tvar item = modules[i];\n\t\t\t\t// skip already imported module\n\t\t\t\t// this implementation is not 100% perfect for weird media query combinations\n\t\t\t\t//  when a module is imported multiple times with different media queries.\n\t\t\t\t//  I hope this will never occur (Hey this way we have smaller bundles)\n\t\t\t\tif(typeof item[0] !== \"number\" || !alreadyImportedModules[item[0]]) {\n\t\t\t\t\tif(mediaQuery && !item[2]) {\n\t\t\t\t\t\titem[2] = mediaQuery;\n\t\t\t\t\t} else if(mediaQuery) {\n\t\t\t\t\t\titem[2] = \"(\" + item[2] + \") and (\" + mediaQuery + \")\";\n\t\t\t\t\t}\n\t\t\t\t\tlist.push(item);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\treturn list;\n\t};\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/*\n\t\tMIT License http://www.opensource.org/licenses/mit-license.php\n\t\tAuthor Tobias Koppers @sokra\n\t*/\n\tvar stylesInDom = {},\n\t\tmemoize = function(fn) {\n\t\t\tvar memo;\n\t\t\treturn function () {\n\t\t\t\tif (typeof memo === \"undefined\") memo = fn.apply(this, arguments);\n\t\t\t\treturn memo;\n\t\t\t};\n\t\t},\n\t\tisOldIE = memoize(function() {\n\t\t\treturn /msie [6-9]\\b/.test(window.navigator.userAgent.toLowerCase());\n\t\t}),\n\t\tgetHeadElement = memoize(function () {\n\t\t\treturn document.head || document.getElementsByTagName(\"head\")[0];\n\t\t}),\n\t\tsingletonElement = null,\n\t\tsingletonCounter = 0,\n\t\tstyleElementsInsertedAtTop = [];\n\t\n\tmodule.exports = function(list, options) {\n\t\tif(false) {\n\t\t\tif(typeof document !== \"object\") throw new Error(\"The style-loader cannot be used in a non-browser environment\");\n\t\t}\n\t\n\t\toptions = options || {};\n\t\t// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>\n\t\t// tags it will allow on a page\n\t\tif (typeof options.singleton === \"undefined\") options.singleton = isOldIE();\n\t\n\t\t// By default, add <style> tags to the bottom of <head>.\n\t\tif (typeof options.insertAt === \"undefined\") options.insertAt = \"bottom\";\n\t\n\t\tvar styles = listToStyles(list);\n\t\taddStylesToDom(styles, options);\n\t\n\t\treturn function update(newList) {\n\t\t\tvar mayRemove = [];\n\t\t\tfor(var i = 0; i < styles.length; i++) {\n\t\t\t\tvar item = styles[i];\n\t\t\t\tvar domStyle = stylesInDom[item.id];\n\t\t\t\tdomStyle.refs--;\n\t\t\t\tmayRemove.push(domStyle);\n\t\t\t}\n\t\t\tif(newList) {\n\t\t\t\tvar newStyles = listToStyles(newList);\n\t\t\t\taddStylesToDom(newStyles, options);\n\t\t\t}\n\t\t\tfor(var i = 0; i < mayRemove.length; i++) {\n\t\t\t\tvar domStyle = mayRemove[i];\n\t\t\t\tif(domStyle.refs === 0) {\n\t\t\t\t\tfor(var j = 0; j < domStyle.parts.length; j++)\n\t\t\t\t\t\tdomStyle.parts[j]();\n\t\t\t\t\tdelete stylesInDom[domStyle.id];\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\t\n\tfunction addStylesToDom(styles, options) {\n\t\tfor(var i = 0; i < styles.length; i++) {\n\t\t\tvar item = styles[i];\n\t\t\tvar domStyle = stylesInDom[item.id];\n\t\t\tif(domStyle) {\n\t\t\t\tdomStyle.refs++;\n\t\t\t\tfor(var j = 0; j < domStyle.parts.length; j++) {\n\t\t\t\t\tdomStyle.parts[j](item.parts[j]);\n\t\t\t\t}\n\t\t\t\tfor(; j < item.parts.length; j++) {\n\t\t\t\t\tdomStyle.parts.push(addStyle(item.parts[j], options));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvar parts = [];\n\t\t\t\tfor(var j = 0; j < item.parts.length; j++) {\n\t\t\t\t\tparts.push(addStyle(item.parts[j], options));\n\t\t\t\t}\n\t\t\t\tstylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction listToStyles(list) {\n\t\tvar styles = [];\n\t\tvar newStyles = {};\n\t\tfor(var i = 0; i < list.length; i++) {\n\t\t\tvar item = list[i];\n\t\t\tvar id = item[0];\n\t\t\tvar css = item[1];\n\t\t\tvar media = item[2];\n\t\t\tvar sourceMap = item[3];\n\t\t\tvar part = {css: css, media: media, sourceMap: sourceMap};\n\t\t\tif(!newStyles[id])\n\t\t\t\tstyles.push(newStyles[id] = {id: id, parts: [part]});\n\t\t\telse\n\t\t\t\tnewStyles[id].parts.push(part);\n\t\t}\n\t\treturn styles;\n\t}\n\t\n\tfunction insertStyleElement(options, styleElement) {\n\t\tvar head = getHeadElement();\n\t\tvar lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];\n\t\tif (options.insertAt === \"top\") {\n\t\t\tif(!lastStyleElementInsertedAtTop) {\n\t\t\t\thead.insertBefore(styleElement, head.firstChild);\n\t\t\t} else if(lastStyleElementInsertedAtTop.nextSibling) {\n\t\t\t\thead.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);\n\t\t\t} else {\n\t\t\t\thead.appendChild(styleElement);\n\t\t\t}\n\t\t\tstyleElementsInsertedAtTop.push(styleElement);\n\t\t} else if (options.insertAt === \"bottom\") {\n\t\t\thead.appendChild(styleElement);\n\t\t} else {\n\t\t\tthrow new Error(\"Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.\");\n\t\t}\n\t}\n\t\n\tfunction removeStyleElement(styleElement) {\n\t\tstyleElement.parentNode.removeChild(styleElement);\n\t\tvar idx = styleElementsInsertedAtTop.indexOf(styleElement);\n\t\tif(idx >= 0) {\n\t\t\tstyleElementsInsertedAtTop.splice(idx, 1);\n\t\t}\n\t}\n\t\n\tfunction createStyleElement(options) {\n\t\tvar styleElement = document.createElement(\"style\");\n\t\tstyleElement.type = \"text/css\";\n\t\tinsertStyleElement(options, styleElement);\n\t\treturn styleElement;\n\t}\n\t\n\tfunction createLinkElement(options) {\n\t\tvar linkElement = document.createElement(\"link\");\n\t\tlinkElement.rel = \"stylesheet\";\n\t\tinsertStyleElement(options, linkElement);\n\t\treturn linkElement;\n\t}\n\t\n\tfunction addStyle(obj, options) {\n\t\tvar styleElement, update, remove;\n\t\n\t\tif (options.singleton) {\n\t\t\tvar styleIndex = singletonCounter++;\n\t\t\tstyleElement = singletonElement || (singletonElement = createStyleElement(options));\n\t\t\tupdate = applyToSingletonTag.bind(null, styleElement, styleIndex, false);\n\t\t\tremove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);\n\t\t} else if(obj.sourceMap &&\n\t\t\ttypeof URL === \"function\" &&\n\t\t\ttypeof URL.createObjectURL === \"function\" &&\n\t\t\ttypeof URL.revokeObjectURL === \"function\" &&\n\t\t\ttypeof Blob === \"function\" &&\n\t\t\ttypeof btoa === \"function\") {\n\t\t\tstyleElement = createLinkElement(options);\n\t\t\tupdate = updateLink.bind(null, styleElement);\n\t\t\tremove = function() {\n\t\t\t\tremoveStyleElement(styleElement);\n\t\t\t\tif(styleElement.href)\n\t\t\t\t\tURL.revokeObjectURL(styleElement.href);\n\t\t\t};\n\t\t} else {\n\t\t\tstyleElement = createStyleElement(options);\n\t\t\tupdate = applyToTag.bind(null, styleElement);\n\t\t\tremove = function() {\n\t\t\t\tremoveStyleElement(styleElement);\n\t\t\t};\n\t\t}\n\t\n\t\tupdate(obj);\n\t\n\t\treturn function updateStyle(newObj) {\n\t\t\tif(newObj) {\n\t\t\t\tif(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)\n\t\t\t\t\treturn;\n\t\t\t\tupdate(obj = newObj);\n\t\t\t} else {\n\t\t\t\tremove();\n\t\t\t}\n\t\t};\n\t}\n\t\n\tvar replaceText = (function () {\n\t\tvar textStore = [];\n\t\n\t\treturn function (index, replacement) {\n\t\t\ttextStore[index] = replacement;\n\t\t\treturn textStore.filter(Boolean).join('\\n');\n\t\t};\n\t})();\n\t\n\tfunction applyToSingletonTag(styleElement, index, remove, obj) {\n\t\tvar css = remove ? \"\" : obj.css;\n\t\n\t\tif (styleElement.styleSheet) {\n\t\t\tstyleElement.styleSheet.cssText = replaceText(index, css);\n\t\t} else {\n\t\t\tvar cssNode = document.createTextNode(css);\n\t\t\tvar childNodes = styleElement.childNodes;\n\t\t\tif (childNodes[index]) styleElement.removeChild(childNodes[index]);\n\t\t\tif (childNodes.length) {\n\t\t\t\tstyleElement.insertBefore(cssNode, childNodes[index]);\n\t\t\t} else {\n\t\t\t\tstyleElement.appendChild(cssNode);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction applyToTag(styleElement, obj) {\n\t\tvar css = obj.css;\n\t\tvar media = obj.media;\n\t\n\t\tif(media) {\n\t\t\tstyleElement.setAttribute(\"media\", media)\n\t\t}\n\t\n\t\tif(styleElement.styleSheet) {\n\t\t\tstyleElement.styleSheet.cssText = css;\n\t\t} else {\n\t\t\twhile(styleElement.firstChild) {\n\t\t\t\tstyleElement.removeChild(styleElement.firstChild);\n\t\t\t}\n\t\t\tstyleElement.appendChild(document.createTextNode(css));\n\t\t}\n\t}\n\t\n\tfunction updateLink(linkElement, obj) {\n\t\tvar css = obj.css;\n\t\tvar sourceMap = obj.sourceMap;\n\t\n\t\tif(sourceMap) {\n\t\t\t// http://stackoverflow.com/a/26603875\n\t\t\tcss += \"\\n/*# sourceMappingURL=data:application/json;base64,\" + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + \" */\";\n\t\t}\n\t\n\t\tvar blob = new Blob([css], { type: \"text/css\" });\n\t\n\t\tvar oldSrc = linkElement.href;\n\t\n\t\tlinkElement.href = URL.createObjectURL(blob);\n\t\n\t\tif(oldSrc)\n\t\t\tURL.revokeObjectURL(oldSrc);\n\t}\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar $ = __webpack_require__(6);\n\tvar _ = __webpack_require__(7);\n\t\n\tfunction timeline(user){\n\t  this.setHeader = function(){\n\t      $(\"#timeline\").text(user.name+ \" Timeline\");\n\t  }\n\t\n\t  this.setTimeline = function(){\n\t    _.each(user.messages, function(msg){\n\t      var html = \"<li><div class='timeline-heading'><h4 class='timeline-title'>\"+msg+\"</h4></div></li>\";\n\t      $(\".timeline\").append(html);\n\t    });\n\t  }\n\t}\n\t\n\tmodule.exports = timeline;\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*eslint-disable no-unused-vars*/\n\t/*!\n\t * jQuery JavaScript Library v3.1.0\n\t * https://jquery.com/\n\t *\n\t * Includes Sizzle.js\n\t * https://sizzlejs.com/\n\t *\n\t * Copyright jQuery Foundation and other contributors\n\t * Released under the MIT license\n\t * https://jquery.org/license\n\t *\n\t * Date: 2016-07-07T21:44Z\n\t */\n\t( function( global, factory ) {\n\t\n\t\t\"use strict\";\n\t\n\t\tif ( typeof module === \"object\" && typeof module.exports === \"object\" ) {\n\t\n\t\t\t// For CommonJS and CommonJS-like environments where a proper `window`\n\t\t\t// is present, execute the factory and get jQuery.\n\t\t\t// For environments that do not have a `window` with a `document`\n\t\t\t// (such as Node.js), expose a factory as module.exports.\n\t\t\t// This accentuates the need for the creation of a real `window`.\n\t\t\t// e.g. var jQuery = require(\"jquery\")(window);\n\t\t\t// See ticket #14549 for more info.\n\t\t\tmodule.exports = global.document ?\n\t\t\t\tfactory( global, true ) :\n\t\t\t\tfunction( w ) {\n\t\t\t\t\tif ( !w.document ) {\n\t\t\t\t\t\tthrow new Error( \"jQuery requires a window with a document\" );\n\t\t\t\t\t}\n\t\t\t\t\treturn factory( w );\n\t\t\t\t};\n\t\t} else {\n\t\t\tfactory( global );\n\t\t}\n\t\n\t// Pass this if window is not defined yet\n\t} )( typeof window !== \"undefined\" ? window : this, function( window, noGlobal ) {\n\t\n\t// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n\t// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n\t// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n\t// enough that all such attempts are guarded in a try block.\n\t\"use strict\";\n\t\n\tvar arr = [];\n\t\n\tvar document = window.document;\n\t\n\tvar getProto = Object.getPrototypeOf;\n\t\n\tvar slice = arr.slice;\n\t\n\tvar concat = arr.concat;\n\t\n\tvar push = arr.push;\n\t\n\tvar indexOf = arr.indexOf;\n\t\n\tvar class2type = {};\n\t\n\tvar toString = class2type.toString;\n\t\n\tvar hasOwn = class2type.hasOwnProperty;\n\t\n\tvar fnToString = hasOwn.toString;\n\t\n\tvar ObjectFunctionString = fnToString.call( Object );\n\t\n\tvar support = {};\n\t\n\t\n\t\n\t\tfunction DOMEval( code, doc ) {\n\t\t\tdoc = doc || document;\n\t\n\t\t\tvar script = doc.createElement( \"script\" );\n\t\n\t\t\tscript.text = code;\n\t\t\tdoc.head.appendChild( script ).parentNode.removeChild( script );\n\t\t}\n\t/* global Symbol */\n\t// Defining this global in .eslintrc would create a danger of using the global\n\t// unguarded in another place, it seems safer to define global only for this module\n\t\n\t\n\t\n\tvar\n\t\tversion = \"3.1.0\",\n\t\n\t\t// Define a local copy of jQuery\n\t\tjQuery = function( selector, context ) {\n\t\n\t\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\t\t// Need init if jQuery is called (just allow error to be thrown if not included)\n\t\t\treturn new jQuery.fn.init( selector, context );\n\t\t},\n\t\n\t\t// Support: Android <=4.0 only\n\t\t// Make sure we trim BOM and NBSP\n\t\trtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,\n\t\n\t\t// Matches dashed string for camelizing\n\t\trmsPrefix = /^-ms-/,\n\t\trdashAlpha = /-([a-z])/g,\n\t\n\t\t// Used by jQuery.camelCase as callback to replace()\n\t\tfcamelCase = function( all, letter ) {\n\t\t\treturn letter.toUpperCase();\n\t\t};\n\t\n\tjQuery.fn = jQuery.prototype = {\n\t\n\t\t// The current version of jQuery being used\n\t\tjquery: version,\n\t\n\t\tconstructor: jQuery,\n\t\n\t\t// The default length of a jQuery object is 0\n\t\tlength: 0,\n\t\n\t\ttoArray: function() {\n\t\t\treturn slice.call( this );\n\t\t},\n\t\n\t\t// Get the Nth element in the matched element set OR\n\t\t// Get the whole matched element set as a clean array\n\t\tget: function( num ) {\n\t\t\treturn num != null ?\n\t\n\t\t\t\t// Return just the one element from the set\n\t\t\t\t( num < 0 ? this[ num + this.length ] : this[ num ] ) :\n\t\n\t\t\t\t// Return all the elements in a clean array\n\t\t\t\tslice.call( this );\n\t\t},\n\t\n\t\t// Take an array of elements and push it onto the stack\n\t\t// (returning the new matched element set)\n\t\tpushStack: function( elems ) {\n\t\n\t\t\t// Build a new jQuery matched element set\n\t\t\tvar ret = jQuery.merge( this.constructor(), elems );\n\t\n\t\t\t// Add the old object onto the stack (as a reference)\n\t\t\tret.prevObject = this;\n\t\n\t\t\t// Return the newly-formed element set\n\t\t\treturn ret;\n\t\t},\n\t\n\t\t// Execute a callback for every element in the matched set.\n\t\teach: function( callback ) {\n\t\t\treturn jQuery.each( this, callback );\n\t\t},\n\t\n\t\tmap: function( callback ) {\n\t\t\treturn this.pushStack( jQuery.map( this, function( elem, i ) {\n\t\t\t\treturn callback.call( elem, i, elem );\n\t\t\t} ) );\n\t\t},\n\t\n\t\tslice: function() {\n\t\t\treturn this.pushStack( slice.apply( this, arguments ) );\n\t\t},\n\t\n\t\tfirst: function() {\n\t\t\treturn this.eq( 0 );\n\t\t},\n\t\n\t\tlast: function() {\n\t\t\treturn this.eq( -1 );\n\t\t},\n\t\n\t\teq: function( i ) {\n\t\t\tvar len = this.length,\n\t\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\t\treturn this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );\n\t\t},\n\t\n\t\tend: function() {\n\t\t\treturn this.prevObject || this.constructor();\n\t\t},\n\t\n\t\t// For internal use only.\n\t\t// Behaves like an Array's method, not like a jQuery method.\n\t\tpush: push,\n\t\tsort: arr.sort,\n\t\tsplice: arr.splice\n\t};\n\t\n\tjQuery.extend = jQuery.fn.extend = function() {\n\t\tvar options, name, src, copy, copyIsArray, clone,\n\t\t\ttarget = arguments[ 0 ] || {},\n\t\t\ti = 1,\n\t\t\tlength = arguments.length,\n\t\t\tdeep = false;\n\t\n\t\t// Handle a deep copy situation\n\t\tif ( typeof target === \"boolean\" ) {\n\t\t\tdeep = target;\n\t\n\t\t\t// Skip the boolean and the target\n\t\t\ttarget = arguments[ i ] || {};\n\t\t\ti++;\n\t\t}\n\t\n\t\t// Handle case when target is a string or something (possible in deep copy)\n\t\tif ( typeof target !== \"object\" && !jQuery.isFunction( target ) ) {\n\t\t\ttarget = {};\n\t\t}\n\t\n\t\t// Extend jQuery itself if only one argument is passed\n\t\tif ( i === length ) {\n\t\t\ttarget = this;\n\t\t\ti--;\n\t\t}\n\t\n\t\tfor ( ; i < length; i++ ) {\n\t\n\t\t\t// Only deal with non-null/undefined values\n\t\t\tif ( ( options = arguments[ i ] ) != null ) {\n\t\n\t\t\t\t// Extend the base object\n\t\t\t\tfor ( name in options ) {\n\t\t\t\t\tsrc = target[ name ];\n\t\t\t\t\tcopy = options[ name ];\n\t\n\t\t\t\t\t// Prevent never-ending loop\n\t\t\t\t\tif ( target === copy ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n\t\t\t\t\t\t( copyIsArray = jQuery.isArray( copy ) ) ) ) {\n\t\n\t\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && jQuery.isArray( src ) ? src : [];\n\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && jQuery.isPlainObject( src ) ? src : {};\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\t\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// Return the modified object\n\t\treturn target;\n\t};\n\t\n\tjQuery.extend( {\n\t\n\t\t// Unique for each copy of jQuery on the page\n\t\texpando: \"jQuery\" + ( version + Math.random() ).replace( /\\D/g, \"\" ),\n\t\n\t\t// Assume jQuery is ready without the ready module\n\t\tisReady: true,\n\t\n\t\terror: function( msg ) {\n\t\t\tthrow new Error( msg );\n\t\t},\n\t\n\t\tnoop: function() {},\n\t\n\t\tisFunction: function( obj ) {\n\t\t\treturn jQuery.type( obj ) === \"function\";\n\t\t},\n\t\n\t\tisArray: Array.isArray,\n\t\n\t\tisWindow: function( obj ) {\n\t\t\treturn obj != null && obj === obj.window;\n\t\t},\n\t\n\t\tisNumeric: function( obj ) {\n\t\n\t\t\t// As of jQuery 3.0, isNumeric is limited to\n\t\t\t// strings and numbers (primitives or objects)\n\t\t\t// that can be coerced to finite numbers (gh-2662)\n\t\t\tvar type = jQuery.type( obj );\n\t\t\treturn ( type === \"number\" || type === \"string\" ) &&\n\t\n\t\t\t\t// parseFloat NaNs numeric-cast false positives (\"\")\n\t\t\t\t// ...but misinterprets leading-number strings, particularly hex literals (\"0x...\")\n\t\t\t\t// subtraction forces infinities to NaN\n\t\t\t\t!isNaN( obj - parseFloat( obj ) );\n\t\t},\n\t\n\t\tisPlainObject: function( obj ) {\n\t\t\tvar proto, Ctor;\n\t\n\t\t\t// Detect obvious negatives\n\t\t\t// Use toString instead of jQuery.type to catch host objects\n\t\t\tif ( !obj || toString.call( obj ) !== \"[object Object]\" ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\n\t\t\tproto = getProto( obj );\n\t\n\t\t\t// Objects with no prototype (e.g., `Object.create( null )`) are plain\n\t\t\tif ( !proto ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\n\t\t\t// Objects with prototype are plain iff they were constructed by a global Object function\n\t\t\tCtor = hasOwn.call( proto, \"constructor\" ) && proto.constructor;\n\t\t\treturn typeof Ctor === \"function\" && fnToString.call( Ctor ) === ObjectFunctionString;\n\t\t},\n\t\n\t\tisEmptyObject: function( obj ) {\n\t\n\t\t\t/* eslint-disable no-unused-vars */\n\t\t\t// See https://github.com/eslint/eslint/issues/6125\n\t\t\tvar name;\n\t\n\t\t\tfor ( name in obj ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\t\n\t\ttype: function( obj ) {\n\t\t\tif ( obj == null ) {\n\t\t\t\treturn obj + \"\";\n\t\t\t}\n\t\n\t\t\t// Support: Android <=2.3 only (functionish RegExp)\n\t\t\treturn typeof obj === \"object\" || typeof obj === \"function\" ?\n\t\t\t\tclass2type[ toString.call( obj ) ] || \"object\" :\n\t\t\t\ttypeof obj;\n\t\t},\n\t\n\t\t// Evaluates a script in a global context\n\t\tglobalEval: function( code ) {\n\t\t\tDOMEval( code );\n\t\t},\n\t\n\t\t// Convert dashed to camelCase; used by the css and data modules\n\t\t// Support: IE <=9 - 11, Edge 12 - 13\n\t\t// Microsoft forgot to hump their vendor prefix (#9572)\n\t\tcamelCase: function( string ) {\n\t\t\treturn string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n\t\t},\n\t\n\t\tnodeName: function( elem, name ) {\n\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n\t\t},\n\t\n\t\teach: function( obj, callback ) {\n\t\t\tvar length, i = 0;\n\t\n\t\t\tif ( isArrayLike( obj ) ) {\n\t\t\t\tlength = obj.length;\n\t\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( i in obj ) {\n\t\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn obj;\n\t\t},\n\t\n\t\t// Support: Android <=4.0 only\n\t\ttrim: function( text ) {\n\t\t\treturn text == null ?\n\t\t\t\t\"\" :\n\t\t\t\t( text + \"\" ).replace( rtrim, \"\" );\n\t\t},\n\t\n\t\t// results is for internal usage only\n\t\tmakeArray: function( arr, results ) {\n\t\t\tvar ret = results || [];\n\t\n\t\t\tif ( arr != null ) {\n\t\t\t\tif ( isArrayLike( Object( arr ) ) ) {\n\t\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\t\ttypeof arr === \"string\" ?\n\t\t\t\t\t\t[ arr ] : arr\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tpush.call( ret, arr );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn ret;\n\t\t},\n\t\n\t\tinArray: function( elem, arr, i ) {\n\t\t\treturn arr == null ? -1 : indexOf.call( arr, elem, i );\n\t\t},\n\t\n\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\tmerge: function( first, second ) {\n\t\t\tvar len = +second.length,\n\t\t\t\tj = 0,\n\t\t\t\ti = first.length;\n\t\n\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\tfirst[ i++ ] = second[ j ];\n\t\t\t}\n\t\n\t\t\tfirst.length = i;\n\t\n\t\t\treturn first;\n\t\t},\n\t\n\t\tgrep: function( elems, callback, invert ) {\n\t\t\tvar callbackInverse,\n\t\t\t\tmatches = [],\n\t\t\t\ti = 0,\n\t\t\t\tlength = elems.length,\n\t\t\t\tcallbackExpect = !invert;\n\t\n\t\t\t// Go through the array, only saving the items\n\t\t\t// that pass the validator function\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tcallbackInverse = !callback( elems[ i ], i );\n\t\t\t\tif ( callbackInverse !== callbackExpect ) {\n\t\t\t\t\tmatches.push( elems[ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn matches;\n\t\t},\n\t\n\t\t// arg is for internal usage only\n\t\tmap: function( elems, callback, arg ) {\n\t\t\tvar length, value,\n\t\t\t\ti = 0,\n\t\t\t\tret = [];\n\t\n\t\t\t// Go through the array, translating each of the items to their new values\n\t\t\tif ( isArrayLike( elems ) ) {\n\t\t\t\tlength = elems.length;\n\t\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\t\n\t\t\t\t\tif ( value != null ) {\n\t\t\t\t\t\tret.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t// Go through every key on the object,\n\t\t\t} else {\n\t\t\t\tfor ( i in elems ) {\n\t\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\t\n\t\t\t\t\tif ( value != null ) {\n\t\t\t\t\t\tret.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Flatten any nested arrays\n\t\t\treturn concat.apply( [], ret );\n\t\t},\n\t\n\t\t// A global GUID counter for objects\n\t\tguid: 1,\n\t\n\t\t// Bind a function to a context, optionally partially applying any\n\t\t// arguments.\n\t\tproxy: function( fn, context ) {\n\t\t\tvar tmp, args, proxy;\n\t\n\t\t\tif ( typeof context === \"string\" ) {\n\t\t\t\ttmp = fn[ context ];\n\t\t\t\tcontext = fn;\n\t\t\t\tfn = tmp;\n\t\t\t}\n\t\n\t\t\t// Quick check to determine if target is callable, in the spec\n\t\t\t// this throws a TypeError, but we will just return undefined.\n\t\t\tif ( !jQuery.isFunction( fn ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\n\t\t\t// Simulated bind\n\t\t\targs = slice.call( arguments, 2 );\n\t\t\tproxy = function() {\n\t\t\t\treturn fn.apply( context || this, args.concat( slice.call( arguments ) ) );\n\t\t\t};\n\t\n\t\t\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\t\t\tproxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\t\n\t\t\treturn proxy;\n\t\t},\n\t\n\t\tnow: Date.now,\n\t\n\t\t// jQuery.support is not used in Core but other projects attach their\n\t\t// properties to it so it needs to exist.\n\t\tsupport: support\n\t} );\n\t\n\tif ( typeof Symbol === \"function\" ) {\n\t\tjQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];\n\t}\n\t\n\t// Populate the class2type map\n\tjQuery.each( \"Boolean Number String Function Array Date RegExp Object Error Symbol\".split( \" \" ),\n\tfunction( i, name ) {\n\t\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n\t} );\n\t\n\tfunction isArrayLike( obj ) {\n\t\n\t\t// Support: real iOS 8.2 only (not reproducible in simulator)\n\t\t// `in` check used to prevent JIT error (gh-2145)\n\t\t// hasOwn isn't used here due to false negatives\n\t\t// regarding Nodelist length in IE\n\t\tvar length = !!obj && \"length\" in obj && obj.length,\n\t\t\ttype = jQuery.type( obj );\n\t\n\t\tif ( type === \"function\" || jQuery.isWindow( obj ) ) {\n\t\t\treturn false;\n\t\t}\n\t\n\t\treturn type === \"array\" || length === 0 ||\n\t\t\ttypeof length === \"number\" && length > 0 && ( length - 1 ) in obj;\n\t}\n\tvar Sizzle =\n\t/*!\n\t * Sizzle CSS Selector Engine v2.3.0\n\t * https://sizzlejs.com/\n\t *\n\t * Copyright jQuery Foundation and other contributors\n\t * Released under the MIT license\n\t * http://jquery.org/license\n\t *\n\t * Date: 2016-01-04\n\t */\n\t(function( window ) {\n\t\n\tvar i,\n\t\tsupport,\n\t\tExpr,\n\t\tgetText,\n\t\tisXML,\n\t\ttokenize,\n\t\tcompile,\n\t\tselect,\n\t\toutermostContext,\n\t\tsortInput,\n\t\thasDuplicate,\n\t\n\t\t// Local document vars\n\t\tsetDocument,\n\t\tdocument,\n\t\tdocElem,\n\t\tdocumentIsHTML,\n\t\trbuggyQSA,\n\t\trbuggyMatches,\n\t\tmatches,\n\t\tcontains,\n\t\n\t\t// Instance-specific data\n\t\texpando = \"sizzle\" + 1 * new Date(),\n\t\tpreferredDoc = window.document,\n\t\tdirruns = 0,\n\t\tdone = 0,\n\t\tclassCache = createCache(),\n\t\ttokenCache = createCache(),\n\t\tcompilerCache = createCache(),\n\t\tsortOrder = function( a, b ) {\n\t\t\tif ( a === b ) {\n\t\t\t\thasDuplicate = true;\n\t\t\t}\n\t\t\treturn 0;\n\t\t},\n\t\n\t\t// Instance methods\n\t\thasOwn = ({}).hasOwnProperty,\n\t\tarr = [],\n\t\tpop = arr.pop,\n\t\tpush_native = arr.push,\n\t\tpush = arr.push,\n\t\tslice = arr.slice,\n\t\t// Use a stripped-down indexOf as it's faster than native\n\t\t// https://jsperf.com/thor-indexof-vs-for/5\n\t\tindexOf = function( list, elem ) {\n\t\t\tvar i = 0,\n\t\t\t\tlen = list.length;\n\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\tif ( list[i] === elem ) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn -1;\n\t\t},\n\t\n\t\tbooleans = \"checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped\",\n\t\n\t\t// Regular expressions\n\t\n\t\t// http://www.w3.org/TR/css3-selectors/#whitespace\n\t\twhitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n\t\n\t\t// http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n\t\tidentifier = \"(?:\\\\\\\\.|[\\\\w-]|[^\\0-\\\\xa0])+\",\n\t\n\t\t// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors\n\t\tattributes = \"\\\\[\" + whitespace + \"*(\" + identifier + \")(?:\" + whitespace +\n\t\t\t// Operator (capture 2)\n\t\t\t\"*([*^$|!~]?=)\" + whitespace +\n\t\t\t// \"Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]\"\n\t\t\t\"*(?:'((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\"|(\" + identifier + \"))|)\" + whitespace +\n\t\t\t\"*\\\\]\",\n\t\n\t\tpseudos = \":(\" + identifier + \")(?:\\\\((\" +\n\t\t\t// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n\t\t\t// 1. quoted (capture 3; capture 4 or capture 5)\n\t\t\t\"('((?:\\\\\\\\.|[^\\\\\\\\'])*)'|\\\"((?:\\\\\\\\.|[^\\\\\\\\\\\"])*)\\\")|\" +\n\t\t\t// 2. simple (capture 6)\n\t\t\t\"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes + \")*)|\" +\n\t\t\t// 3. anything else (capture 2)\n\t\t\t\".*\" +\n\t\t\t\")\\\\)|)\",\n\t\n\t\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\t\trwhitespace = new RegExp( whitespace + \"+\", \"g\" ),\n\t\trtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\t\n\t\trcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n\t\trcombinators = new RegExp( \"^\" + whitespace + \"*([>+~]|\" + whitespace + \")\" + whitespace + \"*\" ),\n\t\n\t\trattributeQuotes = new RegExp( \"=\" + whitespace + \"*([^\\\\]'\\\"]*?)\" + whitespace + \"*\\\\]\", \"g\" ),\n\t\n\t\trpseudo = new RegExp( pseudos ),\n\t\tridentifier = new RegExp( \"^\" + identifier + \"$\" ),\n\t\n\t\tmatchExpr = {\n\t\t\t\"ID\": new RegExp( \"^#(\" + identifier + \")\" ),\n\t\t\t\"CLASS\": new RegExp( \"^\\\\.(\" + identifier + \")\" ),\n\t\t\t\"TAG\": new RegExp( \"^(\" + identifier + \"|[*])\" ),\n\t\t\t\"ATTR\": new RegExp( \"^\" + attributes ),\n\t\t\t\"PSEUDO\": new RegExp( \"^\" + pseudos ),\n\t\t\t\"CHILD\": new RegExp( \"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace +\n\t\t\t\t\"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n\t\t\t\t\"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n\t\t\t\"bool\": new RegExp( \"^(?:\" + booleans + \")$\", \"i\" ),\n\t\t\t// For use in libraries implementing .is()\n\t\t\t// We use this for POS matching in `select`\n\t\t\t\"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" +\n\t\t\t\twhitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\" )\n\t\t},\n\t\n\t\trinputs = /^(?:input|select|textarea|button)$/i,\n\t\trheader = /^h\\d$/i,\n\t\n\t\trnative = /^[^{]+\\{\\s*\\[native \\w/,\n\t\n\t\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\t\trquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n\t\n\t\trsibling = /[+~]/,\n\t\n\t\t// CSS escapes\n\t\t// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n\t\trunescape = new RegExp( \"\\\\\\\\([\\\\da-f]{1,6}\" + whitespace + \"?|(\" + whitespace + \")|.)\", \"ig\" ),\n\t\tfunescape = function( _, escaped, escapedWhitespace ) {\n\t\t\tvar high = \"0x\" + escaped - 0x10000;\n\t\t\t// NaN means non-codepoint\n\t\t\t// Support: Firefox<24\n\t\t\t// Workaround erroneous numeric interpretation of +\"0x\"\n\t\t\treturn high !== high || escapedWhitespace ?\n\t\t\t\tescaped :\n\t\t\t\thigh < 0 ?\n\t\t\t\t\t// BMP codepoint\n\t\t\t\t\tString.fromCharCode( high + 0x10000 ) :\n\t\t\t\t\t// Supplemental Plane codepoint (surrogate pair)\n\t\t\t\t\tString.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );\n\t\t},\n\t\n\t\t// CSS string/identifier serialization\n\t\t// https://drafts.csswg.org/cssom/#common-serializing-idioms\n\t\trcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g,\n\t\tfcssescape = function( ch, asCodePoint ) {\n\t\t\tif ( asCodePoint ) {\n\t\n\t\t\t\t// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n\t\t\t\tif ( ch === \"\\0\" ) {\n\t\t\t\t\treturn \"\\uFFFD\";\n\t\t\t\t}\n\t\n\t\t\t\t// Control characters and (dependent upon position) numbers get escaped as code points\n\t\t\t\treturn ch.slice( 0, -1 ) + \"\\\\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + \" \";\n\t\t\t}\n\t\n\t\t\t// Other potentially-special ASCII characters get backslash-escaped\n\t\t\treturn \"\\\\\" + ch;\n\t\t},\n\t\n\t\t// Used for iframes\n\t\t// See setDocument()\n\t\t// Removing the function wrapper causes a \"Permission Denied\"\n\t\t// error in IE\n\t\tunloadHandler = function() {\n\t\t\tsetDocument();\n\t\t},\n\t\n\t\tdisabledAncestor = addCombinator(\n\t\t\tfunction( elem ) {\n\t\t\t\treturn elem.disabled === true;\n\t\t\t},\n\t\t\t{ dir: \"parentNode\", next: \"legend\" }\n\t\t);\n\t\n\t// Optimize for push.apply( _, NodeList )\n\ttry {\n\t\tpush.apply(\n\t\t\t(arr = slice.call( preferredDoc.childNodes )),\n\t\t\tpreferredDoc.childNodes\n\t\t);\n\t\t// Support: Android<4.0\n\t\t// Detect silently failing push.apply\n\t\tarr[ preferredDoc.childNodes.length ].nodeType;\n\t} catch ( e ) {\n\t\tpush = { apply: arr.length ?\n\t\n\t\t\t// Leverage slice if possible\n\t\t\tfunction( target, els ) {\n\t\t\t\tpush_native.apply( target, slice.call(els) );\n\t\t\t} :\n\t\n\t\t\t// Support: IE<9\n\t\t\t// Otherwise append directly\n\t\t\tfunction( target, els ) {\n\t\t\t\tvar j = target.length,\n\t\t\t\t\ti = 0;\n\t\t\t\t// Can't trust NodeList.length\n\t\t\t\twhile ( (target[j++] = els[i++]) ) {}\n\t\t\t\ttarget.length = j - 1;\n\t\t\t}\n\t\t};\n\t}\n\t\n\tfunction Sizzle( selector, context, results, seed ) {\n\t\tvar m, i, elem, nid, match, groups, newSelector,\n\t\t\tnewContext = context && context.ownerDocument,\n\t\n\t\t\t// nodeType defaults to 9, since context defaults to document\n\t\t\tnodeType = context ? context.nodeType : 9;\n\t\n\t\tresults = results || [];\n\t\n\t\t// Return early from calls with invalid selector or context\n\t\tif ( typeof selector !== \"string\" || !selector ||\n\t\t\tnodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {\n\t\n\t\t\treturn results;\n\t\t}\n\t\n\t\t// Try to shortcut find operations (as opposed to filters) in HTML documents\n\t\tif ( !seed ) {\n\t\n\t\t\tif ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {\n\t\t\t\tsetDocument( context );\n\t\t\t}\n\t\t\tcontext = context || document;\n\t\n\t\t\tif ( documentIsHTML ) {\n\t\n\t\t\t\t// If the selector is sufficiently simple, try using a \"get*By*\" DOM method\n\t\t\t\t// (excepting DocumentFragment context, where the methods don't exist)\n\t\t\t\tif ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {\n\t\n\t\t\t\t\t// ID selector\n\t\t\t\t\tif ( (m = match[1]) ) {\n\t\n\t\t\t\t\t\t// Document context\n\t\t\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\t\t\tif ( (elem = context.getElementById( m )) ) {\n\t\n\t\t\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Element context\n\t\t\t\t\t\t} else {\n\t\n\t\t\t\t\t\t\t// Support: IE, Opera, Webkit\n\t\t\t\t\t\t\t// TODO: identify versions\n\t\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\t\tif ( newContext && (elem = newContext.getElementById( m )) &&\n\t\t\t\t\t\t\t\tcontains( context, elem ) &&\n\t\t\t\t\t\t\t\telem.id === m ) {\n\t\n\t\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t// Type selector\n\t\t\t\t\t} else if ( match[2] ) {\n\t\t\t\t\t\tpush.apply( results, context.getElementsByTagName( selector ) );\n\t\t\t\t\t\treturn results;\n\t\n\t\t\t\t\t// Class selector\n\t\t\t\t\t} else if ( (m = match[3]) && support.getElementsByClassName &&\n\t\t\t\t\t\tcontext.getElementsByClassName ) {\n\t\n\t\t\t\t\t\tpush.apply( results, context.getElementsByClassName( m ) );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Take advantage of querySelectorAll\n\t\t\t\tif ( support.qsa &&\n\t\t\t\t\t!compilerCache[ selector + \" \" ] &&\n\t\t\t\t\t(!rbuggyQSA || !rbuggyQSA.test( selector )) ) {\n\t\n\t\t\t\t\tif ( nodeType !== 1 ) {\n\t\t\t\t\t\tnewContext = context;\n\t\t\t\t\t\tnewSelector = selector;\n\t\n\t\t\t\t\t// qSA looks outside Element context, which is not what we want\n\t\t\t\t\t// Thanks to Andrew Dupont for this workaround technique\n\t\t\t\t\t// Support: IE <=8\n\t\t\t\t\t// Exclude object elements\n\t\t\t\t\t} else if ( context.nodeName.toLowerCase() !== \"object\" ) {\n\t\n\t\t\t\t\t\t// Capture the context ID, setting it first if necessary\n\t\t\t\t\t\tif ( (nid = context.getAttribute( \"id\" )) ) {\n\t\t\t\t\t\t\tnid = nid.replace( rcssescape, fcssescape );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontext.setAttribute( \"id\", (nid = expando) );\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Prefix every selector in the list\n\t\t\t\t\t\tgroups = tokenize( selector );\n\t\t\t\t\t\ti = groups.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tgroups[i] = \"#\" + nid + \" \" + toSelector( groups[i] );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewSelector = groups.join( \",\" );\n\t\n\t\t\t\t\t\t// Expand context for sibling selectors\n\t\t\t\t\t\tnewContext = rsibling.test( selector ) && testContext( context.parentNode ) ||\n\t\t\t\t\t\t\tcontext;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif ( newSelector ) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tpush.apply( results,\n\t\t\t\t\t\t\t\tnewContext.querySelectorAll( newSelector )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t} catch ( qsaError ) {\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif ( nid === expando ) {\n\t\t\t\t\t\t\t\tcontext.removeAttribute( \"id\" );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// All others\n\t\treturn select( selector.replace( rtrim, \"$1\" ), context, results, seed );\n\t}\n\t\n\t/**\n\t * Create key-value caches of limited size\n\t * @returns {function(string, object)} Returns the Object data after storing it on itself with\n\t *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n\t *\tdeleting the oldest entry\n\t */\n\tfunction createCache() {\n\t\tvar keys = [];\n\t\n\t\tfunction cache( key, value ) {\n\t\t\t// Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n\t\t\tif ( keys.push( key + \" \" ) > Expr.cacheLength ) {\n\t\t\t\t// Only keep the most recent entries\n\t\t\t\tdelete cache[ keys.shift() ];\n\t\t\t}\n\t\t\treturn (cache[ key + \" \" ] = value);\n\t\t}\n\t\treturn cache;\n\t}\n\t\n\t/**\n\t * Mark a function for special use by Sizzle\n\t * @param {Function} fn The function to mark\n\t */\n\tfunction markFunction( fn ) {\n\t\tfn[ expando ] = true;\n\t\treturn fn;\n\t}\n\t\n\t/**\n\t * Support testing using an element\n\t * @param {Function} fn Passed the created element and returns a boolean result\n\t */\n\tfunction assert( fn ) {\n\t\tvar el = document.createElement(\"fieldset\");\n\t\n\t\ttry {\n\t\t\treturn !!fn( el );\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t} finally {\n\t\t\t// Remove from its parent by default\n\t\t\tif ( el.parentNode ) {\n\t\t\t\tel.parentNode.removeChild( el );\n\t\t\t}\n\t\t\t// release memory in IE\n\t\t\tel = null;\n\t\t}\n\t}\n\t\n\t/**\n\t * Adds the same handler for all of the specified attrs\n\t * @param {String} attrs Pipe-separated list of attributes\n\t * @param {Function} handler The method that will be applied\n\t */\n\tfunction addHandle( attrs, handler ) {\n\t\tvar arr = attrs.split(\"|\"),\n\t\t\ti = arr.length;\n\t\n\t\twhile ( i-- ) {\n\t\t\tExpr.attrHandle[ arr[i] ] = handler;\n\t\t}\n\t}\n\t\n\t/**\n\t * Checks document order of two siblings\n\t * @param {Element} a\n\t * @param {Element} b\n\t * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b\n\t */\n\tfunction siblingCheck( a, b ) {\n\t\tvar cur = b && a,\n\t\t\tdiff = cur && a.nodeType === 1 && b.nodeType === 1 &&\n\t\t\t\ta.sourceIndex - b.sourceIndex;\n\t\n\t\t// Use IE sourceIndex if available on both nodes\n\t\tif ( diff ) {\n\t\t\treturn diff;\n\t\t}\n\t\n\t\t// Check if b follows a\n\t\tif ( cur ) {\n\t\t\twhile ( (cur = cur.nextSibling) ) {\n\t\t\t\tif ( cur === b ) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn a ? 1 : -1;\n\t}\n\t\n\t/**\n\t * Returns a function to use in pseudos for input types\n\t * @param {String} type\n\t */\n\tfunction createInputPseudo( type ) {\n\t\treturn function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && elem.type === type;\n\t\t};\n\t}\n\t\n\t/**\n\t * Returns a function to use in pseudos for buttons\n\t * @param {String} type\n\t */\n\tfunction createButtonPseudo( type ) {\n\t\treturn function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn (name === \"input\" || name === \"button\") && elem.type === type;\n\t\t};\n\t}\n\t\n\t/**\n\t * Returns a function to use in pseudos for :enabled/:disabled\n\t * @param {Boolean} disabled true for :disabled; false for :enabled\n\t */\n\tfunction createDisabledPseudo( disabled ) {\n\t\t// Known :disabled false positives:\n\t\t// IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset)\n\t\t// not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n\t\treturn function( elem ) {\n\t\n\t\t\t// Check form elements and option elements for explicit disabling\n\t\t\treturn \"label\" in elem && elem.disabled === disabled ||\n\t\t\t\t\"form\" in elem && elem.disabled === disabled ||\n\t\n\t\t\t\t// Check non-disabled form elements for fieldset[disabled] ancestors\n\t\t\t\t\"form\" in elem && elem.disabled === false && (\n\t\t\t\t\t// Support: IE6-11+\n\t\t\t\t\t// Ancestry is covered for us\n\t\t\t\t\telem.isDisabled === disabled ||\n\t\n\t\t\t\t\t// Otherwise, assume any non-<option> under fieldset[disabled] is disabled\n\t\t\t\t\t/* jshint -W018 */\n\t\t\t\t\telem.isDisabled !== !disabled &&\n\t\t\t\t\t\t(\"label\" in elem || !disabledAncestor( elem )) !== disabled\n\t\t\t\t);\n\t\t};\n\t}\n\t\n\t/**\n\t * Returns a function to use in pseudos for positionals\n\t * @param {Function} fn\n\t */\n\tfunction createPositionalPseudo( fn ) {\n\t\treturn markFunction(function( argument ) {\n\t\t\targument = +argument;\n\t\t\treturn markFunction(function( seed, matches ) {\n\t\t\t\tvar j,\n\t\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\t\ti = matchIndexes.length;\n\t\n\t\t\t\t// Match elements found at the specified indexes\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( seed[ (j = matchIndexes[i]) ] ) {\n\t\t\t\t\t\tseed[j] = !(matches[j] = seed[j]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\t\n\t/**\n\t * Checks a node for validity as a Sizzle context\n\t * @param {Element|Object=} context\n\t * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n\t */\n\tfunction testContext( context ) {\n\t\treturn context && typeof context.getElementsByTagName !== \"undefined\" && context;\n\t}\n\t\n\t// Expose support vars for convenience\n\tsupport = Sizzle.support = {};\n\t\n\t/**\n\t * Detects XML nodes\n\t * @param {Element|Object} elem An element or a document\n\t * @returns {Boolean} True iff elem is a non-HTML XML node\n\t */\n\tisXML = Sizzle.isXML = function( elem ) {\n\t\t// documentElement is verified for cases where it doesn't yet exist\n\t\t// (such as loading iframes in IE - #4833)\n\t\tvar documentElement = elem && (elem.ownerDocument || elem).documentElement;\n\t\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n\t};\n\t\n\t/**\n\t * Sets document-related variables once based on the current document\n\t * @param {Element|Object} [doc] An element or document object to use to set the document\n\t * @returns {Object} Returns the current document\n\t */\n\tsetDocument = Sizzle.setDocument = function( node ) {\n\t\tvar hasCompare, subWindow,\n\t\t\tdoc = node ? node.ownerDocument || node : preferredDoc;\n\t\n\t\t// Return early if doc is invalid or already selected\n\t\tif ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {\n\t\t\treturn document;\n\t\t}\n\t\n\t\t// Update global variables\n\t\tdocument = doc;\n\t\tdocElem = document.documentElement;\n\t\tdocumentIsHTML = !isXML( document );\n\t\n\t\t// Support: IE 9-11, Edge\n\t\t// Accessing iframe documents after unload throws \"permission denied\" errors (jQuery #13936)\n\t\tif ( preferredDoc !== document &&\n\t\t\t(subWindow = document.defaultView) && subWindow.top !== subWindow ) {\n\t\n\t\t\t// Support: IE 11, Edge\n\t\t\tif ( subWindow.addEventListener ) {\n\t\t\t\tsubWindow.addEventListener( \"unload\", unloadHandler, false );\n\t\n\t\t\t// Support: IE 9 - 10 only\n\t\t\t} else if ( subWindow.attachEvent ) {\n\t\t\t\tsubWindow.attachEvent( \"onunload\", unloadHandler );\n\t\t\t}\n\t\t}\n\t\n\t\t/* Attributes\n\t\t---------------------------------------------------------------------- */\n\t\n\t\t// Support: IE<8\n\t\t// Verify that getAttribute really returns attributes and not properties\n\t\t// (excepting IE8 booleans)\n\t\tsupport.attributes = assert(function( el ) {\n\t\t\tel.className = \"i\";\n\t\t\treturn !el.getAttribute(\"className\");\n\t\t});\n\t\n\t\t/* getElement(s)By*\n\t\t---------------------------------------------------------------------- */\n\t\n\t\t// Check if getElementsByTagName(\"*\") returns only elements\n\t\tsupport.getElementsByTagName = assert(function( el ) {\n\t\t\tel.appendChild( document.createComment(\"\") );\n\t\t\treturn !el.getElementsByTagName(\"*\").length;\n\t\t});\n\t\n\t\t// Support: IE<9\n\t\tsupport.getElementsByClassName = rnative.test( document.getElementsByClassName );\n\t\n\t\t// Support: IE<10\n\t\t// Check if getElementById returns elements by name\n\t\t// The broken getElementById methods don't pick up programmatically-set names,\n\t\t// so use a roundabout getElementsByName test\n\t\tsupport.getById = assert(function( el ) {\n\t\t\tdocElem.appendChild( el ).id = expando;\n\t\t\treturn !document.getElementsByName || !document.getElementsByName( expando ).length;\n\t\t});\n\t\n\t\t// ID find and filter\n\t\tif ( support.getById ) {\n\t\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\t\tif ( typeof context.getElementById !== \"undefined\" && documentIsHTML ) {\n\t\t\t\t\tvar m = context.getElementById( id );\n\t\t\t\t\treturn m ? [ m ] : [];\n\t\t\t\t}\n\t\t\t};\n\t\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\treturn elem.getAttribute(\"id\") === attrId;\n\t\t\t\t};\n\t\t\t};\n\t\t} else {\n\t\t\t// Support: IE6/7\n\t\t\t// getElementById is not reliable as a find shortcut\n\t\t\tdelete Expr.find[\"ID\"];\n\t\n\t\t\tExpr.filter[\"ID\"] =  function( id ) {\n\t\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\tvar node = typeof elem.getAttributeNode !== \"undefined\" &&\n\t\t\t\t\t\telem.getAttributeNode(\"id\");\n\t\t\t\t\treturn node && node.value === attrId;\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\t\n\t\t// Tag\n\t\tExpr.find[\"TAG\"] = support.getElementsByTagName ?\n\t\t\tfunction( tag, context ) {\n\t\t\t\tif ( typeof context.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\t\treturn context.getElementsByTagName( tag );\n\t\n\t\t\t\t// DocumentFragment nodes don't have gEBTN\n\t\t\t\t} else if ( support.qsa ) {\n\t\t\t\t\treturn context.querySelectorAll( tag );\n\t\t\t\t}\n\t\t\t} :\n\t\n\t\t\tfunction( tag, context ) {\n\t\t\t\tvar elem,\n\t\t\t\t\ttmp = [],\n\t\t\t\t\ti = 0,\n\t\t\t\t\t// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too\n\t\t\t\t\tresults = context.getElementsByTagName( tag );\n\t\n\t\t\t\t// Filter out possible comments\n\t\t\t\tif ( tag === \"*\" ) {\n\t\t\t\t\twhile ( (elem = results[i++]) ) {\n\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\ttmp.push( elem );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn tmp;\n\t\t\t\t}\n\t\t\t\treturn results;\n\t\t\t};\n\t\n\t\t// Class\n\t\tExpr.find[\"CLASS\"] = support.getElementsByClassName && function( className, context ) {\n\t\t\tif ( typeof context.getElementsByClassName !== \"undefined\" && documentIsHTML ) {\n\t\t\t\treturn context.getElementsByClassName( className );\n\t\t\t}\n\t\t};\n\t\n\t\t/* QSA/matchesSelector\n\t\t---------------------------------------------------------------------- */\n\t\n\t\t// QSA and matchesSelector support\n\t\n\t\t// matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\t\trbuggyMatches = [];\n\t\n\t\t// qSa(:focus) reports false when true (Chrome 21)\n\t\t// We allow this because of a bug in IE8/9 that throws an error\n\t\t// whenever `document.activeElement` is accessed on an iframe\n\t\t// So, we allow :focus to pass through QSA all the time to avoid the IE error\n\t\t// See https://bugs.jquery.com/ticket/13378\n\t\trbuggyQSA = [];\n\t\n\t\tif ( (support.qsa = rnative.test( document.querySelectorAll )) ) {\n\t\t\t// Build QSA regex\n\t\t\t// Regex strategy adopted from Diego Perini\n\t\t\tassert(function( el ) {\n\t\t\t\t// Select is set to empty string on purpose\n\t\t\t\t// This is to test IE's treatment of not explicitly\n\t\t\t\t// setting a boolean content attribute,\n\t\t\t\t// since its presence should be enough\n\t\t\t\t// https://bugs.jquery.com/ticket/12359\n\t\t\t\tdocElem.appendChild( el ).innerHTML = \"<a id='\" + expando + \"'></a>\" +\n\t\t\t\t\t\"<select id='\" + expando + \"-\\r\\\\' msallowcapture=''>\" +\n\t\t\t\t\t\"<option selected=''></option></select>\";\n\t\n\t\t\t\t// Support: IE8, Opera 11-12.16\n\t\t\t\t// Nothing should be selected when empty strings follow ^= or $= or *=\n\t\t\t\t// The test attribute must be unknown in Opera but \"safe\" for WinRT\n\t\t\t\t// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section\n\t\t\t\tif ( el.querySelectorAll(\"[msallowcapture^='']\").length ) {\n\t\t\t\t\trbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:''|\\\"\\\")\" );\n\t\t\t\t}\n\t\n\t\t\t\t// Support: IE8\n\t\t\t\t// Boolean attributes and \"value\" are not treated correctly\n\t\t\t\tif ( !el.querySelectorAll(\"[selected]\").length ) {\n\t\t\t\t\trbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:value|\" + booleans + \")\" );\n\t\t\t\t}\n\t\n\t\t\t\t// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+\n\t\t\t\tif ( !el.querySelectorAll( \"[id~=\" + expando + \"-]\" ).length ) {\n\t\t\t\t\trbuggyQSA.push(\"~=\");\n\t\t\t\t}\n\t\n\t\t\t\t// Webkit/Opera - :checked should return selected option elements\n\t\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t\t// IE8 throws error here and will not see later tests\n\t\t\t\tif ( !el.querySelectorAll(\":checked\").length ) {\n\t\t\t\t\trbuggyQSA.push(\":checked\");\n\t\t\t\t}\n\t\n\t\t\t\t// Support: Safari 8+, iOS 8+\n\t\t\t\t// https://bugs.webkit.org/show_bug.cgi?id=136851\n\t\t\t\t// In-page `selector#id sibling-combinator selector` fails\n\t\t\t\tif ( !el.querySelectorAll( \"a#\" + expando + \"+*\" ).length ) {\n\t\t\t\t\trbuggyQSA.push(\".#.+[+~]\");\n\t\t\t\t}\n\t\t\t});\n\t\n\t\t\tassert(function( el ) {\n\t\t\t\tel.innerHTML = \"<a href='' disabled='disabled'></a>\" +\n\t\t\t\t\t\"<select disabled='disabled'><option/></select>\";\n\t\n\t\t\t\t// Support: Windows 8 Native Apps\n\t\t\t\t// The type and name attributes are restricted during .innerHTML assignment\n\t\t\t\tvar input = document.createElement(\"input\");\n\t\t\t\tinput.setAttribute( \"type\", \"hidden\" );\n\t\t\t\tel.appendChild( input ).setAttribute( \"name\", \"D\" );\n\t\n\t\t\t\t// Support: IE8\n\t\t\t\t// Enforce case-sensitivity of name attribute\n\t\t\t\tif ( el.querySelectorAll(\"[name=d]\").length ) {\n\t\t\t\t\trbuggyQSA.push( \"name\" + whitespace + \"*[*^$|!~]?=\" );\n\t\t\t\t}\n\t\n\t\t\t\t// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n\t\t\t\t// IE8 throws error here and will not see later tests\n\t\t\t\tif ( el.querySelectorAll(\":enabled\").length !== 2 ) {\n\t\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t\t}\n\t\n\t\t\t\t// Support: IE9-11+\n\t\t\t\t// IE's :disabled selector does not pick up the children of disabled fieldsets\n\t\t\t\tdocElem.appendChild( el ).disabled = true;\n\t\t\t\tif ( el.querySelectorAll(\":disabled\").length !== 2 ) {\n\t\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t\t}\n\t\n\t\t\t\t// Opera 10-11 does not throw on post-comma invalid pseudos\n\t\t\t\tel.querySelectorAll(\"*,:x\");\n\t\t\t\trbuggyQSA.push(\",.*:\");\n\t\t\t});\n\t\t}\n\t\n\t\tif ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||\n\t\t\tdocElem.webkitMatchesSelector ||\n\t\t\tdocElem.mozMatchesSelector ||\n\t\t\tdocElem.oMatchesSelector ||\n\t\t\tdocElem.msMatchesSelector) )) ) {\n\t\n\t\t\tassert(function( el ) {\n\t\t\t\t// Check to see if it's possible to do matchesSelector\n\t\t\t\t// on a disconnected node (IE 9)\n\t\t\t\tsupport.disconnectedMatch = matches.call( el, \"*\" );\n\t\n\t\t\t\t// This should fail with an exception\n\t\t\t\t// Gecko does not error, returns false instead\n\t\t\t\tmatches.call( el, \"[s!='']:x\" );\n\t\t\t\trbuggyMatches.push( \"!=\", pseudos );\n\t\t\t});\n\t\t}\n\t\n\t\trbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join(\"|\") );\n\t\trbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join(\"|\") );\n\t\n\t\t/* Contains\n\t\t---------------------------------------------------------------------- */\n\t\thasCompare = rnative.test( docElem.compareDocumentPosition );\n\t\n\t\t// Element contains another\n\t\t// Purposefully self-exclusive\n\t\t// As in, an element does not contain itself\n\t\tcontains = hasCompare || rnative.test( docElem.contains ) ?\n\t\t\tfunction( a, b ) {\n\t\t\t\tvar adown = a.nodeType === 9 ? a.documentElement : a,\n\t\t\t\t\tbup = b && b.parentNode;\n\t\t\t\treturn a === bup || !!( bup && bup.nodeType === 1 && (\n\t\t\t\t\tadown.contains ?\n\t\t\t\t\t\tadown.contains( bup ) :\n\t\t\t\t\t\ta.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n\t\t\t\t));\n\t\t\t} :\n\t\t\tfunction( a, b ) {\n\t\t\t\tif ( b ) {\n\t\t\t\t\twhile ( (b = b.parentNode) ) {\n\t\t\t\t\t\tif ( b === a ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t};\n\t\n\t\t/* Sorting\n\t\t---------------------------------------------------------------------- */\n\t\n\t\t// Document order sorting\n\t\tsortOrder = hasCompare ?\n\t\tfunction( a, b ) {\n\t\n\t\t\t// Flag for duplicate removal\n\t\t\tif ( a === b ) {\n\t\t\t\thasDuplicate = true;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\n\t\t\t// Sort on method existence if only one input has compareDocumentPosition\n\t\t\tvar compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n\t\t\tif ( compare ) {\n\t\t\t\treturn compare;\n\t\t\t}\n\t\n\t\t\t// Calculate position if both inputs belong to the same document\n\t\t\tcompare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?\n\t\t\t\ta.compareDocumentPosition( b ) :\n\t\n\t\t\t\t// Otherwise we know they are disconnected\n\t\t\t\t1;\n\t\n\t\t\t// Disconnected nodes\n\t\t\tif ( compare & 1 ||\n\t\t\t\t(!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {\n\t\n\t\t\t\t// Choose the first element that is related to our preferred document\n\t\t\t\tif ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tif ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\n\t\t\t\t// Maintain original order\n\t\t\t\treturn sortInput ?\n\t\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t\t0;\n\t\t\t}\n\t\n\t\t\treturn compare & 4 ? -1 : 1;\n\t\t} :\n\t\tfunction( a, b ) {\n\t\t\t// Exit early if the nodes are identical\n\t\t\tif ( a === b ) {\n\t\t\t\thasDuplicate = true;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\n\t\t\tvar cur,\n\t\t\t\ti = 0,\n\t\t\t\taup = a.parentNode,\n\t\t\t\tbup = b.parentNode,\n\t\t\t\tap = [ a ],\n\t\t\t\tbp = [ b ];\n\t\n\t\t\t// Parentless nodes are either documents or disconnected\n\t\t\tif ( !aup || !bup ) {\n\t\t\t\treturn a === document ? -1 :\n\t\t\t\t\tb === document ? 1 :\n\t\t\t\t\taup ? -1 :\n\t\t\t\t\tbup ? 1 :\n\t\t\t\t\tsortInput ?\n\t\t\t\t\t( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :\n\t\t\t\t\t0;\n\t\n\t\t\t// If the nodes are siblings, we can do a quick check\n\t\t\t} else if ( aup === bup ) {\n\t\t\t\treturn siblingCheck( a, b );\n\t\t\t}\n\t\n\t\t\t// Otherwise we need full lists of their ancestors for comparison\n\t\t\tcur = a;\n\t\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\t\tap.unshift( cur );\n\t\t\t}\n\t\t\tcur = b;\n\t\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\t\tbp.unshift( cur );\n\t\t\t}\n\t\n\t\t\t// Walk down the tree looking for a discrepancy\n\t\t\twhile ( ap[i] === bp[i] ) {\n\t\t\t\ti++;\n\t\t\t}\n\t\n\t\t\treturn i ?\n\t\t\t\t// Do a sibling check if the nodes have a common ancestor\n\t\t\t\tsiblingCheck( ap[i], bp[i] ) :\n\t\n\t\t\t\t// Otherwise nodes in our document sort first\n\t\t\t\tap[i] === preferredDoc ? -1 :\n\t\t\t\tbp[i] === preferredDoc ? 1 :\n\t\t\t\t0;\n\t\t};\n\t\n\t\treturn document;\n\t};\n\t\n\tSizzle.matches = function( expr, elements ) {\n\t\treturn Sizzle( expr, null, null, elements );\n\t};\n\t\n\tSizzle.matchesSelector = function( elem, expr ) {\n\t\t// Set document vars if needed\n\t\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\t\tsetDocument( elem );\n\t\t}\n\t\n\t\t// Make sure that attribute selectors are quoted\n\t\texpr = expr.replace( rattributeQuotes, \"='$1']\" );\n\t\n\t\tif ( support.matchesSelector && documentIsHTML &&\n\t\t\t!compilerCache[ expr + \" \" ] &&\n\t\t\t( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&\n\t\t\t( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {\n\t\n\t\t\ttry {\n\t\t\t\tvar ret = matches.call( elem, expr );\n\t\n\t\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\t\tif ( ret || support.disconnectedMatch ||\n\t\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\t\t} catch (e) {}\n\t\t}\n\t\n\t\treturn Sizzle( expr, document, null, [ elem ] ).length > 0;\n\t};\n\t\n\tSizzle.contains = function( context, elem ) {\n\t\t// Set document vars if needed\n\t\tif ( ( context.ownerDocument || context ) !== document ) {\n\t\t\tsetDocument( context );\n\t\t}\n\t\treturn contains( context, elem );\n\t};\n\t\n\tSizzle.attr = function( elem, name ) {\n\t\t// Set document vars if needed\n\t\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\t\tsetDocument( elem );\n\t\t}\n\t\n\t\tvar fn = Expr.attrHandle[ name.toLowerCase() ],\n\t\t\t// Don't get fooled by Object.prototype properties (jQuery #13807)\n\t\t\tval = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?\n\t\t\t\tfn( elem, name, !documentIsHTML ) :\n\t\t\t\tundefined;\n\t\n\t\treturn val !== undefined ?\n\t\t\tval :\n\t\t\tsupport.attributes || !documentIsHTML ?\n\t\t\t\telem.getAttribute( name ) :\n\t\t\t\t(val = elem.getAttributeNode(name)) && val.specified ?\n\t\t\t\t\tval.value :\n\t\t\t\t\tnull;\n\t};\n\t\n\tSizzle.escape = function( sel ) {\n\t\treturn (sel + \"\").replace( rcssescape, fcssescape );\n\t};\n\t\n\tSizzle.error = function( msg ) {\n\t\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n\t};\n\t\n\t/**\n\t * Document sorting and removing duplicates\n\t * @param {ArrayLike} results\n\t */\n\tSizzle.uniqueSort = function( results ) {\n\t\tvar elem,\n\t\t\tduplicates = [],\n\t\t\tj = 0,\n\t\t\ti = 0;\n\t\n\t\t// Unless we *know* we can detect duplicates, assume their presence\n\t\thasDuplicate = !support.detectDuplicates;\n\t\tsortInput = !support.sortStable && results.slice( 0 );\n\t\tresults.sort( sortOrder );\n\t\n\t\tif ( hasDuplicate ) {\n\t\t\twhile ( (elem = results[i++]) ) {\n\t\t\t\tif ( elem === results[ i ] ) {\n\t\t\t\t\tj = duplicates.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t\twhile ( j-- ) {\n\t\t\t\tresults.splice( duplicates[ j ], 1 );\n\t\t\t}\n\t\t}\n\t\n\t\t// Clear input after sorting to release objects\n\t\t// See https://github.com/jquery/sizzle/pull/225\n\t\tsortInput = null;\n\t\n\t\treturn results;\n\t};\n\t\n\t/**\n\t * Utility function for retrieving the text value of an array of DOM nodes\n\t * @param {Array|Element} elem\n\t */\n\tgetText = Sizzle.getText = function( elem ) {\n\t\tvar node,\n\t\t\tret = \"\",\n\t\t\ti = 0,\n\t\t\tnodeType = elem.nodeType;\n\t\n\t\tif ( !nodeType ) {\n\t\t\t// If no nodeType, this is expected to be an array\n\t\t\twhile ( (node = elem[i++]) ) {\n\t\t\t\t// Do not traverse comment nodes\n\t\t\t\tret += getText( node );\n\t\t\t}\n\t\t} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n\t\t\t// Use textContent for elements\n\t\t\t// innerText usage removed for consistency of new lines (jQuery #11153)\n\t\t\tif ( typeof elem.textContent === \"string\" ) {\n\t\t\t\treturn elem.textContent;\n\t\t\t} else {\n\t\t\t\t// Traverse its children\n\t\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\t\tret += getText( elem );\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( nodeType === 3 || nodeType === 4 ) {\n\t\t\treturn elem.nodeValue;\n\t\t}\n\t\t// Do not include comment or processing instruction nodes\n\t\n\t\treturn ret;\n\t};\n\t\n\tExpr = Sizzle.selectors = {\n\t\n\t\t// Can be adjusted by the user\n\t\tcacheLength: 50,\n\t\n\t\tcreatePseudo: markFunction,\n\t\n\t\tmatch: matchExpr,\n\t\n\t\tattrHandle: {},\n\t\n\t\tfind: {},\n\t\n\t\trelative: {\n\t\t\t\">\": { dir: \"parentNode\", first: true },\n\t\t\t\" \": { dir: \"parentNode\" },\n\t\t\t\"+\": { dir: \"previousSibling\", first: true },\n\t\t\t\"~\": { dir: \"previousSibling\" }\n\t\t},\n\t\n\t\tpreFilter: {\n\t\t\t\"ATTR\": function( match ) {\n\t\t\t\tmatch[1] = match[1].replace( runescape, funescape );\n\t\n\t\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\t\tmatch[3] = ( match[3] || match[4] || match[5] || \"\" ).replace( runescape, funescape );\n\t\n\t\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\t\tmatch[3] = \" \" + match[3] + \" \";\n\t\t\t\t}\n\t\n\t\t\t\treturn match.slice( 0, 4 );\n\t\t\t},\n\t\n\t\t\t\"CHILD\": function( match ) {\n\t\t\t\t/* matches from matchExpr[\"CHILD\"]\n\t\t\t\t\t1 type (only|nth|...)\n\t\t\t\t\t2 what (child|of-type)\n\t\t\t\t\t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t\t4 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t\t5 sign of xn-component\n\t\t\t\t\t6 x of xn-component\n\t\t\t\t\t7 sign of y-component\n\t\t\t\t\t8 y of y-component\n\t\t\t\t*/\n\t\t\t\tmatch[1] = match[1].toLowerCase();\n\t\n\t\t\t\tif ( match[1].slice( 0, 3 ) === \"nth\" ) {\n\t\t\t\t\t// nth-* requires argument\n\t\t\t\t\tif ( !match[3] ) {\n\t\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\t\tmatch[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === \"even\" || match[3] === \"odd\" ) );\n\t\t\t\t\tmatch[5] = +( ( match[7] + match[8] ) || match[3] === \"odd\" );\n\t\n\t\t\t\t// other types prohibit arguments\n\t\t\t\t} else if ( match[3] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\t\n\t\t\t\treturn match;\n\t\t\t},\n\t\n\t\t\t\"PSEUDO\": function( match ) {\n\t\t\t\tvar excess,\n\t\t\t\t\tunquoted = !match[6] && match[2];\n\t\n\t\t\t\tif ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\n\t\t\t\t// Accept quoted arguments as-is\n\t\t\t\tif ( match[3] ) {\n\t\t\t\t\tmatch[2] = match[4] || match[5] || \"\";\n\t\n\t\t\t\t// Strip excess characters from unquoted arguments\n\t\t\t\t} else if ( unquoted && rpseudo.test( unquoted ) &&\n\t\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t\t(excess = tokenize( unquoted, true )) &&\n\t\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t\t(excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\t\n\t\t\t\t\t// excess is a negative index\n\t\t\t\t\tmatch[0] = match[0].slice( 0, excess );\n\t\t\t\t\tmatch[2] = unquoted.slice( 0, excess );\n\t\t\t\t}\n\t\n\t\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\t\treturn match.slice( 0, 3 );\n\t\t\t}\n\t\t},\n\t\n\t\tfilter: {\n\t\n\t\t\t\"TAG\": function( nodeNameSelector ) {\n\t\t\t\tvar nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();\n\t\t\t\treturn nodeNameSelector === \"*\" ?\n\t\t\t\t\tfunction() { return true; } :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n\t\t\t\t\t};\n\t\t\t},\n\t\n\t\t\t\"CLASS\": function( className ) {\n\t\t\t\tvar pattern = classCache[ className + \" \" ];\n\t\n\t\t\t\treturn pattern ||\n\t\t\t\t\t(pattern = new RegExp( \"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\" )) &&\n\t\t\t\t\tclassCache( className, function( elem ) {\n\t\t\t\t\t\treturn pattern.test( typeof elem.className === \"string\" && elem.className || typeof elem.getAttribute !== \"undefined\" && elem.getAttribute(\"class\") || \"\" );\n\t\t\t\t\t});\n\t\t\t},\n\t\n\t\t\t\"ATTR\": function( name, operator, check ) {\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\tvar result = Sizzle.attr( elem, name );\n\t\n\t\t\t\t\tif ( result == null ) {\n\t\t\t\t\t\treturn operator === \"!=\";\n\t\t\t\t\t}\n\t\t\t\t\tif ( !operator ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tresult += \"\";\n\t\n\t\t\t\t\treturn operator === \"=\" ? result === check :\n\t\t\t\t\t\toperator === \"!=\" ? result !== check :\n\t\t\t\t\t\toperator === \"^=\" ? check && result.indexOf( check ) === 0 :\n\t\t\t\t\t\toperator === \"*=\" ? check && result.indexOf( check ) > -1 :\n\t\t\t\t\t\toperator === \"$=\" ? check && result.slice( -check.length ) === check :\n\t\t\t\t\t\toperator === \"~=\" ? ( \" \" + result.replace( rwhitespace, \" \" ) + \" \" ).indexOf( check ) > -1 :\n\t\t\t\t\t\toperator === \"|=\" ? result === check || result.slice( 0, check.length + 1 ) === check + \"-\" :\n\t\t\t\t\t\tfalse;\n\t\t\t\t};\n\t\t\t},\n\t\n\t\t\t\"CHILD\": function( type, what, argument, first, last ) {\n\t\t\t\tvar simple = type.slice( 0, 3 ) !== \"nth\",\n\t\t\t\t\tforward = type.slice( -4 ) !== \"last\",\n\t\t\t\t\tofType = what === \"of-type\";\n\t\n\t\t\t\treturn first === 1 && last === 0 ?\n\t\n\t\t\t\t\t// Shortcut for :nth-*(n)\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn !!elem.parentNode;\n\t\t\t\t\t} :\n\t\n\t\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\t\tvar cache, uniqueCache, outerCache, node, nodeIndex, start,\n\t\t\t\t\t\t\tdir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n\t\t\t\t\t\t\tparent = elem.parentNode,\n\t\t\t\t\t\t\tname = ofType && elem.nodeName.toLowerCase(),\n\t\t\t\t\t\t\tuseCache = !xml && !ofType,\n\t\t\t\t\t\t\tdiff = false;\n\t\n\t\t\t\t\t\tif ( parent ) {\n\t\n\t\t\t\t\t\t\t// :(first|last|only)-(child|of-type)\n\t\t\t\t\t\t\tif ( simple ) {\n\t\t\t\t\t\t\t\twhile ( dir ) {\n\t\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\t\twhile ( (node = node[ dir ]) ) {\n\t\t\t\t\t\t\t\t\t\tif ( ofType ?\n\t\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) {\n\t\n\t\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// Reverse direction for :only-* (if we haven't yet done so)\n\t\t\t\t\t\t\t\t\tstart = dir = type === \"only\" && !start && \"nextSibling\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\tstart = [ forward ? parent.firstChild : parent.lastChild ];\n\t\n\t\t\t\t\t\t\t// non-xml :nth-child(...) stores cache data on `parent`\n\t\t\t\t\t\t\tif ( forward && useCache ) {\n\t\n\t\t\t\t\t\t\t\t// Seek `elem` from a previously-cached index\n\t\n\t\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\t\tnode = parent;\n\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\t\n\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\t\n\t\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\t\tdiff = nodeIndex && cache[ 2 ];\n\t\t\t\t\t\t\t\tnode = nodeIndex && parent.childNodes[ nodeIndex ];\n\t\n\t\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\t\n\t\t\t\t\t\t\t\t\t// Fallback to seeking `elem` from the start\n\t\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\t\n\t\t\t\t\t\t\t\t\t// When found, cache indexes on `parent` and break\n\t\t\t\t\t\t\t\t\tif ( node.nodeType === 1 && ++diff && node === elem ) {\n\t\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, nodeIndex, diff ];\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Use previously-cached element index if available\n\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t// ...in a gzip-friendly way\n\t\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\t\n\t\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\t\n\t\t\t\t\t\t\t\t\tcache = uniqueCache[ type ] || [];\n\t\t\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\t\t\tdiff = nodeIndex;\n\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t// xml :nth-child(...)\n\t\t\t\t\t\t\t\t// or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\t\t\t\t\t\t\t\tif ( diff === false ) {\n\t\t\t\t\t\t\t\t\t// Use the same loop as above to seek `elem` from the start\n\t\t\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\t\t\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\t\n\t\t\t\t\t\t\t\t\t\tif ( ( ofType ?\n\t\t\t\t\t\t\t\t\t\t\tnode.nodeName.toLowerCase() === name :\n\t\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) &&\n\t\t\t\t\t\t\t\t\t\t\t++diff ) {\n\t\n\t\t\t\t\t\t\t\t\t\t\t// Cache the index of each encountered element\n\t\t\t\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t\t\t\touterCache = node[ expando ] || (node[ expando ] = {});\n\t\n\t\t\t\t\t\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\t\t\t\t\t\tuniqueCache = outerCache[ node.uniqueID ] ||\n\t\t\t\t\t\t\t\t\t\t\t\t\t(outerCache[ node.uniqueID ] = {});\n\t\n\t\t\t\t\t\t\t\t\t\t\t\tuniqueCache[ type ] = [ dirruns, diff ];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\t\tif ( node === elem ) {\n\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t// Incorporate the offset, then check against cycle size\n\t\t\t\t\t\t\tdiff -= last;\n\t\t\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t},\n\t\n\t\t\t\"PSEUDO\": function( pseudo, argument ) {\n\t\t\t\t// pseudo-class names are case-insensitive\n\t\t\t\t// http://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\t\tvar args,\n\t\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\t\tSizzle.error( \"unsupported pseudo: \" + pseudo );\n\t\n\t\t\t\t// The user may use createPseudo to indicate that\n\t\t\t\t// arguments are needed to create the filter function\n\t\t\t\t// just as Sizzle does\n\t\t\t\tif ( fn[ expando ] ) {\n\t\t\t\t\treturn fn( argument );\n\t\t\t\t}\n\t\n\t\t\t\t// But maintain support for old signatures\n\t\t\t\tif ( fn.length > 1 ) {\n\t\t\t\t\targs = [ pseudo, pseudo, \"\", argument ];\n\t\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\t\tmarkFunction(function( seed, matches ) {\n\t\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\t\tidx = indexOf( seed, matched[i] );\n\t\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[i] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}) :\n\t\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t\t};\n\t\t\t\t}\n\t\n\t\t\t\treturn fn;\n\t\t\t}\n\t\t},\n\t\n\t\tpseudos: {\n\t\t\t// Potentially complex pseudos\n\t\t\t\"not\": markFunction(function( selector ) {\n\t\t\t\t// Trim the selector passed to compile\n\t\t\t\t// to avoid treating leading and trailing\n\t\t\t\t// spaces as combinators\n\t\t\t\tvar input = [],\n\t\t\t\t\tresults = [],\n\t\t\t\t\tmatcher = compile( selector.replace( rtrim, \"$1\" ) );\n\t\n\t\t\t\treturn matcher[ expando ] ?\n\t\t\t\t\tmarkFunction(function( seed, matches, context, xml ) {\n\t\t\t\t\t\tvar elem,\n\t\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\t\ti = seed.length;\n\t\n\t\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\t\t\t\t\tseed[i] = !(matches[i] = elem);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}) :\n\t\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\t\tinput[0] = elem;\n\t\t\t\t\t\tmatcher( input, null, xml, results );\n\t\t\t\t\t\t// Don't keep the element (issue #299)\n\t\t\t\t\t\tinput[0] = null;\n\t\t\t\t\t\treturn !results.pop();\n\t\t\t\t\t};\n\t\t\t}),\n\t\n\t\t\t\"has\": markFunction(function( selector ) {\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\treturn Sizzle( selector, elem ).length > 0;\n\t\t\t\t};\n\t\t\t}),\n\t\n\t\t\t\"contains\": markFunction(function( text ) {\n\t\t\t\ttext = text.replace( runescape, funescape );\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\treturn ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n\t\t\t\t};\n\t\t\t}),\n\t\n\t\t\t// \"Whether an element is represented by a :lang() selector\n\t\t\t// is based solely on the element's language value\n\t\t\t// being equal to the identifier C,\n\t\t\t// or beginning with the identifier C immediately followed by \"-\".\n\t\t\t// The matching of C against the element's language value is performed case-insensitively.\n\t\t\t// The identifier C does not have to be a valid language name.\"\n\t\t\t// http://www.w3.org/TR/selectors/#lang-pseudo\n\t\t\t\"lang\": markFunction( function( lang ) {\n\t\t\t\t// lang value must be a valid identifier\n\t\t\t\tif ( !ridentifier.test(lang || \"\") ) {\n\t\t\t\t\tSizzle.error( \"unsupported lang: \" + lang );\n\t\t\t\t}\n\t\t\t\tlang = lang.replace( runescape, funescape ).toLowerCase();\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\tvar elemLang;\n\t\t\t\t\tdo {\n\t\t\t\t\t\tif ( (elemLang = documentIsHTML ?\n\t\t\t\t\t\t\telem.lang :\n\t\t\t\t\t\t\telem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) ) {\n\t\n\t\t\t\t\t\t\telemLang = elemLang.toLowerCase();\n\t\t\t\t\t\t\treturn elemLang === lang || elemLang.indexOf( lang + \"-\" ) === 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} while ( (elem = elem.parentNode) && elem.nodeType === 1 );\n\t\t\t\t\treturn false;\n\t\t\t\t};\n\t\t\t}),\n\t\n\t\t\t// Miscellaneous\n\t\t\t\"target\": function( elem ) {\n\t\t\t\tvar hash = window.location && window.location.hash;\n\t\t\t\treturn hash && hash.slice( 1 ) === elem.id;\n\t\t\t},\n\t\n\t\t\t\"root\": function( elem ) {\n\t\t\t\treturn elem === docElem;\n\t\t\t},\n\t\n\t\t\t\"focus\": function( elem ) {\n\t\t\t\treturn elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n\t\t\t},\n\t\n\t\t\t// Boolean properties\n\t\t\t\"enabled\": createDisabledPseudo( false ),\n\t\t\t\"disabled\": createDisabledPseudo( true ),\n\t\n\t\t\t\"checked\": function( elem ) {\n\t\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t\tvar nodeName = elem.nodeName.toLowerCase();\n\t\t\t\treturn (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n\t\t\t},\n\t\n\t\t\t\"selected\": function( elem ) {\n\t\t\t\t// Accessing this property makes selected-by-default\n\t\t\t\t// options in Safari work properly\n\t\t\t\tif ( elem.parentNode ) {\n\t\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t\t}\n\t\n\t\t\t\treturn elem.selected === true;\n\t\t\t},\n\t\n\t\t\t// Contents\n\t\t\t\"empty\": function( elem ) {\n\t\t\t\t// http://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t\t// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n\t\t\t\t//   but not by others (comment: 8; processing instruction: 7; etc.)\n\t\t\t\t// nodeType < 6 works because attributes (2) do not appear as children\n\t\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\t\tif ( elem.nodeType < 6 ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t},\n\t\n\t\t\t\"parent\": function( elem ) {\n\t\t\t\treturn !Expr.pseudos[\"empty\"]( elem );\n\t\t\t},\n\t\n\t\t\t// Element/input types\n\t\t\t\"header\": function( elem ) {\n\t\t\t\treturn rheader.test( elem.nodeName );\n\t\t\t},\n\t\n\t\t\t\"input\": function( elem ) {\n\t\t\t\treturn rinputs.test( elem.nodeName );\n\t\t\t},\n\t\n\t\t\t\"button\": function( elem ) {\n\t\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\t\treturn name === \"input\" && elem.type === \"button\" || name === \"button\";\n\t\t\t},\n\t\n\t\t\t\"text\": function( elem ) {\n\t\t\t\tvar attr;\n\t\t\t\treturn elem.nodeName.toLowerCase() === \"input\" &&\n\t\t\t\t\telem.type === \"text\" &&\n\t\n\t\t\t\t\t// Support: IE<8\n\t\t\t\t\t// New HTML5 attribute values (e.g., \"search\") appear with elem.type === \"text\"\n\t\t\t\t\t( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === \"text\" );\n\t\t\t},\n\t\n\t\t\t// Position-in-collection\n\t\t\t\"first\": createPositionalPseudo(function() {\n\t\t\t\treturn [ 0 ];\n\t\t\t}),\n\t\n\t\t\t\"last\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\t\treturn [ length - 1 ];\n\t\t\t}),\n\t\n\t\t\t\"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t\t}),\n\t\n\t\t\t\"even\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\t\tvar i = 0;\n\t\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\t\tmatchIndexes.push( i );\n\t\t\t\t}\n\t\t\t\treturn matchIndexes;\n\t\t\t}),\n\t\n\t\t\t\"odd\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\t\tvar i = 1;\n\t\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\t\tmatchIndexes.push( i );\n\t\t\t\t}\n\t\t\t\treturn matchIndexes;\n\t\t\t}),\n\t\n\t\t\t\"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\t\tfor ( ; --i >= 0; ) {\n\t\t\t\t\tmatchIndexes.push( i );\n\t\t\t\t}\n\t\t\t\treturn matchIndexes;\n\t\t\t}),\n\t\n\t\t\t\"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\t\tfor ( ; ++i < length; ) {\n\t\t\t\t\tmatchIndexes.push( i );\n\t\t\t\t}\n\t\t\t\treturn matchIndexes;\n\t\t\t})\n\t\t}\n\t};\n\t\n\tExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\t\n\t// Add button/input type pseudos\n\tfor ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {\n\t\tExpr.pseudos[ i ] = createInputPseudo( i );\n\t}\n\tfor ( i in { submit: true, reset: true } ) {\n\t\tExpr.pseudos[ i ] = createButtonPseudo( i );\n\t}\n\t\n\t// Easy API for creating new setFilters\n\tfunction setFilters() {}\n\tsetFilters.prototype = Expr.filters = Expr.pseudos;\n\tExpr.setFilters = new setFilters();\n\t\n\ttokenize = Sizzle.tokenize = function( selector, parseOnly ) {\n\t\tvar matched, match, tokens, type,\n\t\t\tsoFar, groups, preFilters,\n\t\t\tcached = tokenCache[ selector + \" \" ];\n\t\n\t\tif ( cached ) {\n\t\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t\t}\n\t\n\t\tsoFar = selector;\n\t\tgroups = [];\n\t\tpreFilters = Expr.preFilter;\n\t\n\t\twhile ( soFar ) {\n\t\n\t\t\t// Comma and first run\n\t\t\tif ( !matched || (match = rcomma.exec( soFar )) ) {\n\t\t\t\tif ( match ) {\n\t\t\t\t\t// Don't consume trailing commas as valid\n\t\t\t\t\tsoFar = soFar.slice( match[0].length ) || soFar;\n\t\t\t\t}\n\t\t\t\tgroups.push( (tokens = []) );\n\t\t\t}\n\t\n\t\t\tmatched = false;\n\t\n\t\t\t// Combinators\n\t\t\tif ( (match = rcombinators.exec( soFar )) ) {\n\t\t\t\tmatched = match.shift();\n\t\t\t\ttokens.push({\n\t\t\t\t\tvalue: matched,\n\t\t\t\t\t// Cast descendant combinators to space\n\t\t\t\t\ttype: match[0].replace( rtrim, \" \" )\n\t\t\t\t});\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t}\n\t\n\t\t\t// Filters\n\t\t\tfor ( type in Expr.filter ) {\n\t\t\t\tif ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n\t\t\t\t\t(match = preFilters[ type ]( match ))) ) {\n\t\t\t\t\tmatched = match.shift();\n\t\t\t\t\ttokens.push({\n\t\t\t\t\t\tvalue: matched,\n\t\t\t\t\t\ttype: type,\n\t\t\t\t\t\tmatches: match\n\t\t\t\t\t});\n\t\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif ( !matched ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\n\t\t// Return the length of the invalid excess\n\t\t// if we're just parsing\n\t\t// Otherwise, throw an error or return tokens\n\t\treturn parseOnly ?\n\t\t\tsoFar.length :\n\t\t\tsoFar ?\n\t\t\t\tSizzle.error( selector ) :\n\t\t\t\t// Cache the tokens\n\t\t\t\ttokenCache( selector, groups ).slice( 0 );\n\t};\n\t\n\tfunction toSelector( tokens ) {\n\t\tvar i = 0,\n\t\t\tlen = tokens.length,\n\t\t\tselector = \"\";\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tselector += tokens[i].value;\n\t\t}\n\t\treturn selector;\n\t}\n\t\n\tfunction addCombinator( matcher, combinator, base ) {\n\t\tvar dir = combinator.dir,\n\t\t\tskip = combinator.next,\n\t\t\tkey = skip || dir,\n\t\t\tcheckNonElements = base && key === \"parentNode\",\n\t\t\tdoneName = done++;\n\t\n\t\treturn combinator.first ?\n\t\t\t// Check against closest ancestor/preceding element\n\t\t\tfunction( elem, context, xml ) {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} :\n\t\n\t\t\t// Check against all ancestor/preceding elements\n\t\t\tfunction( elem, context, xml ) {\n\t\t\t\tvar oldCache, uniqueCache, outerCache,\n\t\t\t\t\tnewCache = [ dirruns, doneName ];\n\t\n\t\t\t\t// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching\n\t\t\t\tif ( xml ) {\n\t\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\t\touterCache = elem[ expando ] || (elem[ expando ] = {});\n\t\n\t\t\t\t\t\t\t// Support: IE <9 only\n\t\t\t\t\t\t\t// Defend against cloned attroperties (jQuery gh-1709)\n\t\t\t\t\t\t\tuniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});\n\t\n\t\t\t\t\t\t\tif ( skip && skip === elem.nodeName.toLowerCase() ) {\n\t\t\t\t\t\t\t\telem = elem[ dir ] || elem;\n\t\t\t\t\t\t\t} else if ( (oldCache = uniqueCache[ key ]) &&\n\t\t\t\t\t\t\t\toldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {\n\t\n\t\t\t\t\t\t\t\t// Assign to newCache so results back-propagate to previous elements\n\t\t\t\t\t\t\t\treturn (newCache[ 2 ] = oldCache[ 2 ]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Reuse newcache so results back-propagate to previous elements\n\t\t\t\t\t\t\t\tuniqueCache[ key ] = newCache;\n\t\n\t\t\t\t\t\t\t\t// A match means we're done; a fail means we have to keep checking\n\t\t\t\t\t\t\t\tif ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {\n\t\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t}\n\t\n\tfunction elementMatcher( matchers ) {\n\t\treturn matchers.length > 1 ?\n\t\t\tfunction( elem, context, xml ) {\n\t\t\t\tvar i = matchers.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( !matchers[i]( elem, context, xml ) ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t} :\n\t\t\tmatchers[0];\n\t}\n\t\n\tfunction multipleContexts( selector, contexts, results ) {\n\t\tvar i = 0,\n\t\t\tlen = contexts.length;\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tSizzle( selector, contexts[i], results );\n\t\t}\n\t\treturn results;\n\t}\n\t\n\tfunction condense( unmatched, map, filter, context, xml ) {\n\t\tvar elem,\n\t\t\tnewUnmatched = [],\n\t\t\ti = 0,\n\t\t\tlen = unmatched.length,\n\t\t\tmapped = map != null;\n\t\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\t\tif ( mapped ) {\n\t\t\t\t\t\tmap.push( i );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn newUnmatched;\n\t}\n\t\n\tfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\t\tif ( postFilter && !postFilter[ expando ] ) {\n\t\t\tpostFilter = setMatcher( postFilter );\n\t\t}\n\t\tif ( postFinder && !postFinder[ expando ] ) {\n\t\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t\t}\n\t\treturn markFunction(function( seed, results, context, xml ) {\n\t\t\tvar temp, i, elem,\n\t\t\t\tpreMap = [],\n\t\t\t\tpostMap = [],\n\t\t\t\tpreexisting = results.length,\n\t\n\t\t\t\t// Get initial elements from seed or context\n\t\t\t\telems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [] ),\n\t\n\t\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\t\telems,\n\t\n\t\t\t\tmatcherOut = matcher ?\n\t\t\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n\t\t\t\t\tpostFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\t\n\t\t\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t\t\t[] :\n\t\n\t\t\t\t\t\t// ...otherwise use results directly\n\t\t\t\t\t\tresults :\n\t\t\t\t\tmatcherIn;\n\t\n\t\t\t// Find primary matches\n\t\t\tif ( matcher ) {\n\t\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t\t}\n\t\n\t\t\t// Apply postFilter\n\t\t\tif ( postFilter ) {\n\t\t\t\ttemp = condense( matcherOut, postMap );\n\t\t\t\tpostFilter( temp, [], context, xml );\n\t\n\t\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\t\ti = temp.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( (elem = temp[i]) ) {\n\t\t\t\t\t\tmatcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif ( seed ) {\n\t\t\t\tif ( postFinder || preFilter ) {\n\t\t\t\t\tif ( postFinder ) {\n\t\t\t\t\t\t// Get the final matcherOut by condensing this intermediate into postFinder contexts\n\t\t\t\t\t\ttemp = [];\n\t\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( (elem = matcherOut[i]) ) {\n\t\t\t\t\t\t\t\t// Restore matcherIn since elem is not yet a final match\n\t\t\t\t\t\t\t\ttemp.push( (matcherIn[i] = elem) );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpostFinder( null, (matcherOut = []), temp, xml );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Move matched elements from seed to results to keep them synchronized\n\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = matcherOut[i]) &&\n\t\t\t\t\t\t\t(temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {\n\t\n\t\t\t\t\t\t\tseed[temp] = !(results[temp] = elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t// Add elements to results, through postFinder if defined\n\t\t\t} else {\n\t\t\t\tmatcherOut = condense(\n\t\t\t\t\tmatcherOut === results ?\n\t\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\t\tmatcherOut\n\t\t\t\t);\n\t\t\t\tif ( postFinder ) {\n\t\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t\t} else {\n\t\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\t\n\tfunction matcherFromTokens( tokens ) {\n\t\tvar checkContext, matcher, j,\n\t\t\tlen = tokens.length,\n\t\t\tleadingRelative = Expr.relative[ tokens[0].type ],\n\t\t\timplicitRelative = leadingRelative || Expr.relative[\" \"],\n\t\t\ti = leadingRelative ? 1 : 0,\n\t\n\t\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\t\treturn elem === checkContext;\n\t\t\t}, implicitRelative, true ),\n\t\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\t\treturn indexOf( checkContext, elem ) > -1;\n\t\t\t}, implicitRelative, true ),\n\t\t\tmatchers = [ function( elem, context, xml ) {\n\t\t\t\tvar ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n\t\t\t\t\t(checkContext = context).nodeType ?\n\t\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\t\t\t\t// Avoid hanging onto element (issue #299)\n\t\t\t\tcheckContext = null;\n\t\t\t\treturn ret;\n\t\t\t} ];\n\t\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n\t\t\t\tmatchers = [ addCombinator(elementMatcher( matchers ), matcher) ];\n\t\t\t} else {\n\t\t\t\tmatcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\t\n\t\t\t\t// Return special upon seeing a positional matcher\n\t\t\t\tif ( matcher[ expando ] ) {\n\t\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\t\tj = ++i;\n\t\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\t\tif ( Expr.relative[ tokens[j].type ] ) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn setMatcher(\n\t\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\t\ti > 1 && toSelector(\n\t\t\t\t\t\t\t// If the preceding token was a descendant combinator, insert an implicit any-element `*`\n\t\t\t\t\t\t\ttokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === \" \" ? \"*\" : \"\" })\n\t\t\t\t\t\t).replace( rtrim, \"$1\" ),\n\t\t\t\t\t\tmatcher,\n\t\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\t\tj < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n\t\t\t\t\t\tj < len && toSelector( tokens )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tmatchers.push( matcher );\n\t\t\t}\n\t\t}\n\t\n\t\treturn elementMatcher( matchers );\n\t}\n\t\n\tfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\t\tvar bySet = setMatchers.length > 0,\n\t\t\tbyElement = elementMatchers.length > 0,\n\t\t\tsuperMatcher = function( seed, context, xml, results, outermost ) {\n\t\t\t\tvar elem, j, matcher,\n\t\t\t\t\tmatchedCount = 0,\n\t\t\t\t\ti = \"0\",\n\t\t\t\t\tunmatched = seed && [],\n\t\t\t\t\tsetMatched = [],\n\t\t\t\t\tcontextBackup = outermostContext,\n\t\t\t\t\t// We must always have either seed elements or outermost context\n\t\t\t\t\telems = seed || byElement && Expr.find[\"TAG\"]( \"*\", outermost ),\n\t\t\t\t\t// Use integer dirruns iff this is the outermost matcher\n\t\t\t\t\tdirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),\n\t\t\t\t\tlen = elems.length;\n\t\n\t\t\t\tif ( outermost ) {\n\t\t\t\t\toutermostContext = context === document || context || outermost;\n\t\t\t\t}\n\t\n\t\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\t\t// Support: IE<9, Safari\n\t\t\t\t// Tolerate NodeList properties (IE: \"length\"; Safari: <number>) matching elements by id\n\t\t\t\tfor ( ; i !== len && (elem = elems[i]) != null; i++ ) {\n\t\t\t\t\tif ( byElement && elem ) {\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\tif ( !context && elem.ownerDocument !== document ) {\n\t\t\t\t\t\t\tsetDocument( elem );\n\t\t\t\t\t\t\txml = !documentIsHTML;\n\t\t\t\t\t\t}\n\t\t\t\t\t\twhile ( (matcher = elementMatchers[j++]) ) {\n\t\t\t\t\t\t\tif ( matcher( elem, context || document, xml) ) {\n\t\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( outermost ) {\n\t\t\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Track unmatched elements for set filters\n\t\t\t\t\tif ( bySet ) {\n\t\t\t\t\t\t// They will have gone through all possible matchers\n\t\t\t\t\t\tif ( (elem = !matcher && elem) ) {\n\t\t\t\t\t\t\tmatchedCount--;\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Lengthen the array for every element, matched or not\n\t\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\t\tunmatched.push( elem );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// `i` is now the count of elements visited above, and adding it to `matchedCount`\n\t\t\t\t// makes the latter nonnegative.\n\t\t\t\tmatchedCount += i;\n\t\n\t\t\t\t// Apply set filters to unmatched elements\n\t\t\t\t// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n\t\t\t\t// equals `i`), unless we didn't visit _any_ elements in the above loop because we have\n\t\t\t\t// no element matchers and no seed.\n\t\t\t\t// Incrementing an initially-string \"0\" `i` allows `i` to remain a string only in that\n\t\t\t\t// case, which will result in a \"00\" `matchedCount` that differs from `i` but is also\n\t\t\t\t// numerically zero.\n\t\t\t\tif ( bySet && i !== matchedCount ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( (matcher = setMatchers[j++]) ) {\n\t\t\t\t\t\tmatcher( unmatched, setMatched, context, xml );\n\t\t\t\t\t}\n\t\n\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\t// Reintegrate element matches to eliminate the need for sorting\n\t\t\t\t\t\tif ( matchedCount > 0 ) {\n\t\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\t\tif ( !(unmatched[i] || setMatched[i]) ) {\n\t\t\t\t\t\t\t\t\tsetMatched[i] = pop.call( results );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Discard index placeholder values to get only actual matches\n\t\t\t\t\t\tsetMatched = condense( setMatched );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Add matches to results\n\t\t\t\t\tpush.apply( results, setMatched );\n\t\n\t\t\t\t\t// Seedless set matches succeeding multiple successful matchers stipulate sorting\n\t\t\t\t\tif ( outermost && !seed && setMatched.length > 0 &&\n\t\t\t\t\t\t( matchedCount + setMatchers.length ) > 1 ) {\n\t\n\t\t\t\t\t\tSizzle.uniqueSort( results );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Override manipulation of globals by nested matchers\n\t\t\t\tif ( outermost ) {\n\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\toutermostContext = contextBackup;\n\t\t\t\t}\n\t\n\t\t\t\treturn unmatched;\n\t\t\t};\n\t\n\t\treturn bySet ?\n\t\t\tmarkFunction( superMatcher ) :\n\t\t\tsuperMatcher;\n\t}\n\t\n\tcompile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {\n\t\tvar i,\n\t\t\tsetMatchers = [],\n\t\t\telementMatchers = [],\n\t\t\tcached = compilerCache[ selector + \" \" ];\n\t\n\t\tif ( !cached ) {\n\t\t\t// Generate a function of recursive functions that can be used to check each element\n\t\t\tif ( !match ) {\n\t\t\t\tmatch = tokenize( selector );\n\t\t\t}\n\t\t\ti = match.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tcached = matcherFromTokens( match[i] );\n\t\t\t\tif ( cached[ expando ] ) {\n\t\t\t\t\tsetMatchers.push( cached );\n\t\t\t\t} else {\n\t\t\t\t\telementMatchers.push( cached );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Cache the compiled function\n\t\t\tcached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\n\t\n\t\t\t// Save selector and tokenization\n\t\t\tcached.selector = selector;\n\t\t}\n\t\treturn cached;\n\t};\n\t\n\t/**\n\t * A low-level selection function that works with Sizzle's compiled\n\t *  selector functions\n\t * @param {String|Function} selector A selector or a pre-compiled\n\t *  selector function built with Sizzle.compile\n\t * @param {Element} context\n\t * @param {Array} [results]\n\t * @param {Array} [seed] A set of elements to match against\n\t */\n\tselect = Sizzle.select = function( selector, context, results, seed ) {\n\t\tvar i, tokens, token, type, find,\n\t\t\tcompiled = typeof selector === \"function\" && selector,\n\t\t\tmatch = !seed && tokenize( (selector = compiled.selector || selector) );\n\t\n\t\tresults = results || [];\n\t\n\t\t// Try to minimize operations if there is only one selector in the list and no seed\n\t\t// (the latter of which guarantees us context)\n\t\tif ( match.length === 1 ) {\n\t\n\t\t\t// Reduce context if the leading compound selector is an ID\n\t\t\ttokens = match[0] = match[0].slice( 0 );\n\t\t\tif ( tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n\t\t\t\t\tsupport.getById && context.nodeType === 9 && documentIsHTML &&\n\t\t\t\t\tExpr.relative[ tokens[1].type ] ) {\n\t\n\t\t\t\tcontext = ( Expr.find[\"ID\"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];\n\t\t\t\tif ( !context ) {\n\t\t\t\t\treturn results;\n\t\n\t\t\t\t// Precompiled matchers will still verify ancestry, so step up a level\n\t\t\t\t} else if ( compiled ) {\n\t\t\t\t\tcontext = context.parentNode;\n\t\t\t\t}\n\t\n\t\t\t\tselector = selector.slice( tokens.shift().value.length );\n\t\t\t}\n\t\n\t\t\t// Fetch a seed set for right-to-left matching\n\t\t\ti = matchExpr[\"needsContext\"].test( selector ) ? 0 : tokens.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\ttoken = tokens[i];\n\t\n\t\t\t\t// Abort if we hit a combinator\n\t\t\t\tif ( Expr.relative[ (type = token.type) ] ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( (find = Expr.find[ type ]) ) {\n\t\t\t\t\t// Search, expanding context for leading sibling combinators\n\t\t\t\t\tif ( (seed = find(\n\t\t\t\t\t\ttoken.matches[0].replace( runescape, funescape ),\n\t\t\t\t\t\trsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context\n\t\t\t\t\t)) ) {\n\t\n\t\t\t\t\t\t// If seed is empty or no tokens remain, we can return early\n\t\t\t\t\t\ttokens.splice( i, 1 );\n\t\t\t\t\t\tselector = seed.length && toSelector( tokens );\n\t\t\t\t\t\tif ( !selector ) {\n\t\t\t\t\t\t\tpush.apply( results, seed );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// Compile and execute a filtering function if one is not provided\n\t\t// Provide `match` to avoid retokenization if we modified the selector above\n\t\t( compiled || compile( selector, match ) )(\n\t\t\tseed,\n\t\t\tcontext,\n\t\t\t!documentIsHTML,\n\t\t\tresults,\n\t\t\t!context || rsibling.test( selector ) && testContext( context.parentNode ) || context\n\t\t);\n\t\treturn results;\n\t};\n\t\n\t// One-time assignments\n\t\n\t// Sort stability\n\tsupport.sortStable = expando.split(\"\").sort( sortOrder ).join(\"\") === expando;\n\t\n\t// Support: Chrome 14-35+\n\t// Always assume duplicates if they aren't passed to the comparison function\n\tsupport.detectDuplicates = !!hasDuplicate;\n\t\n\t// Initialize against the default document\n\tsetDocument();\n\t\n\t// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)\n\t// Detached nodes confoundingly follow *each other*\n\tsupport.sortDetached = assert(function( el ) {\n\t\t// Should return 1, but returns 4 (following)\n\t\treturn el.compareDocumentPosition( document.createElement(\"fieldset\") ) & 1;\n\t});\n\t\n\t// Support: IE<8\n\t// Prevent attribute/property \"interpolation\"\n\t// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx\n\tif ( !assert(function( el ) {\n\t\tel.innerHTML = \"<a href='#'></a>\";\n\t\treturn el.firstChild.getAttribute(\"href\") === \"#\" ;\n\t}) ) {\n\t\taddHandle( \"type|href|height|width\", function( elem, name, isXML ) {\n\t\t\tif ( !isXML ) {\n\t\t\t\treturn elem.getAttribute( name, name.toLowerCase() === \"type\" ? 1 : 2 );\n\t\t\t}\n\t\t});\n\t}\n\t\n\t// Support: IE<9\n\t// Use defaultValue in place of getAttribute(\"value\")\n\tif ( !support.attributes || !assert(function( el ) {\n\t\tel.innerHTML = \"<input/>\";\n\t\tel.firstChild.setAttribute( \"value\", \"\" );\n\t\treturn el.firstChild.getAttribute( \"value\" ) === \"\";\n\t}) ) {\n\t\taddHandle( \"value\", function( elem, name, isXML ) {\n\t\t\tif ( !isXML && elem.nodeName.toLowerCase() === \"input\" ) {\n\t\t\t\treturn elem.defaultValue;\n\t\t\t}\n\t\t});\n\t}\n\t\n\t// Support: IE<9\n\t// Use getAttributeNode to fetch booleans when getAttribute lies\n\tif ( !assert(function( el ) {\n\t\treturn el.getAttribute(\"disabled\") == null;\n\t}) ) {\n\t\taddHandle( booleans, function( elem, name, isXML ) {\n\t\t\tvar val;\n\t\t\tif ( !isXML ) {\n\t\t\t\treturn elem[ name ] === true ? name.toLowerCase() :\n\t\t\t\t\t\t(val = elem.getAttributeNode( name )) && val.specified ?\n\t\t\t\t\t\tval.value :\n\t\t\t\t\tnull;\n\t\t\t}\n\t\t});\n\t}\n\t\n\treturn Sizzle;\n\t\n\t})( window );\n\t\n\t\n\t\n\tjQuery.find = Sizzle;\n\tjQuery.expr = Sizzle.selectors;\n\t\n\t// Deprecated\n\tjQuery.expr[ \":\" ] = jQuery.expr.pseudos;\n\tjQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;\n\tjQuery.text = Sizzle.getText;\n\tjQuery.isXMLDoc = Sizzle.isXML;\n\tjQuery.contains = Sizzle.contains;\n\tjQuery.escapeSelector = Sizzle.escape;\n\t\n\t\n\t\n\t\n\tvar dir = function( elem, dir, until ) {\n\t\tvar matched = [],\n\t\t\ttruncate = until !== undefined;\n\t\n\t\twhile ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {\n\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\tif ( truncate && jQuery( elem ).is( until ) ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tmatched.push( elem );\n\t\t\t}\n\t\t}\n\t\treturn matched;\n\t};\n\t\n\t\n\tvar siblings = function( n, elem ) {\n\t\tvar matched = [];\n\t\n\t\tfor ( ; n; n = n.nextSibling ) {\n\t\t\tif ( n.nodeType === 1 && n !== elem ) {\n\t\t\t\tmatched.push( n );\n\t\t\t}\n\t\t}\n\t\n\t\treturn matched;\n\t};\n\t\n\t\n\tvar rneedsContext = jQuery.expr.match.needsContext;\n\t\n\tvar rsingleTag = ( /^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i );\n\t\n\t\n\t\n\tvar risSimple = /^.[^:#\\[\\.,]*$/;\n\t\n\t// Implement the identical functionality for filter and not\n\tfunction winnow( elements, qualifier, not ) {\n\t\tif ( jQuery.isFunction( qualifier ) ) {\n\t\t\treturn jQuery.grep( elements, function( elem, i ) {\n\t\t\t\treturn !!qualifier.call( elem, i, elem ) !== not;\n\t\t\t} );\n\t\n\t\t}\n\t\n\t\tif ( qualifier.nodeType ) {\n\t\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\t\treturn ( elem === qualifier ) !== not;\n\t\t\t} );\n\t\n\t\t}\n\t\n\t\tif ( typeof qualifier === \"string\" ) {\n\t\t\tif ( risSimple.test( qualifier ) ) {\n\t\t\t\treturn jQuery.filter( qualifier, elements, not );\n\t\t\t}\n\t\n\t\t\tqualifier = jQuery.filter( qualifier, elements );\n\t\t}\n\t\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;\n\t\t} );\n\t}\n\t\n\tjQuery.filter = function( expr, elems, not ) {\n\t\tvar elem = elems[ 0 ];\n\t\n\t\tif ( not ) {\n\t\t\texpr = \":not(\" + expr + \")\";\n\t\t}\n\t\n\t\treturn elems.length === 1 && elem.nodeType === 1 ?\n\t\t\tjQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :\n\t\t\tjQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {\n\t\t\t\treturn elem.nodeType === 1;\n\t\t\t} ) );\n\t};\n\t\n\tjQuery.fn.extend( {\n\t\tfind: function( selector ) {\n\t\t\tvar i, ret,\n\t\t\t\tlen = this.length,\n\t\t\t\tself = this;\n\t\n\t\t\tif ( typeof selector !== \"string\" ) {\n\t\t\t\treturn this.pushStack( jQuery( selector ).filter( function() {\n\t\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\t\tif ( jQuery.contains( self[ i ], this ) ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} ) );\n\t\t\t}\n\t\n\t\t\tret = this.pushStack( [] );\n\t\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tjQuery.find( selector, self[ i ], ret );\n\t\t\t}\n\t\n\t\t\treturn len > 1 ? jQuery.uniqueSort( ret ) : ret;\n\t\t},\n\t\tfilter: function( selector ) {\n\t\t\treturn this.pushStack( winnow( this, selector || [], false ) );\n\t\t},\n\t\tnot: function( selector ) {\n\t\t\treturn this.pushStack( winnow( this, selector || [], true ) );\n\t\t},\n\t\tis: function( selector ) {\n\t\t\treturn !!winnow(\n\t\t\t\tthis,\n\t\n\t\t\t\t// If this is a positional/relative selector, check membership in the returned set\n\t\t\t\t// so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n\t\t\t\ttypeof selector === \"string\" && rneedsContext.test( selector ) ?\n\t\t\t\t\tjQuery( selector ) :\n\t\t\t\t\tselector || [],\n\t\t\t\tfalse\n\t\t\t).length;\n\t\t}\n\t} );\n\t\n\t\n\t// Initialize a jQuery object\n\t\n\t\n\t// A central reference to the root jQuery(document)\n\tvar rootjQuery,\n\t\n\t\t// A simple way to check for HTML strings\n\t\t// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\n\t\t// Strict HTML recognition (#11290: must start with <)\n\t\t// Shortcut simple #id case for speed\n\t\trquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,\n\t\n\t\tinit = jQuery.fn.init = function( selector, context, root ) {\n\t\t\tvar match, elem;\n\t\n\t\t\t// HANDLE: $(\"\"), $(null), $(undefined), $(false)\n\t\t\tif ( !selector ) {\n\t\t\t\treturn this;\n\t\t\t}\n\t\n\t\t\t// Method init() accepts an alternate rootjQuery\n\t\t\t// so migrate can support jQuery.sub (gh-2101)\n\t\t\troot = root || rootjQuery;\n\t\n\t\t\t// Handle HTML strings\n\t\t\tif ( typeof selector === \"string\" ) {\n\t\t\t\tif ( selector[ 0 ] === \"<\" &&\n\t\t\t\t\tselector[ selector.length - 1 ] === \">\" &&\n\t\t\t\t\tselector.length >= 3 ) {\n\t\n\t\t\t\t\t// Assume that strings that start and end with <> are HTML and skip the regex check\n\t\t\t\t\tmatch = [ null, selector, null ];\n\t\n\t\t\t\t} else {\n\t\t\t\t\tmatch = rquickExpr.exec( selector );\n\t\t\t\t}\n\t\n\t\t\t\t// Match html or make sure no context is specified for #id\n\t\t\t\tif ( match && ( match[ 1 ] || !context ) ) {\n\t\n\t\t\t\t\t// HANDLE: $(html) -> $(array)\n\t\t\t\t\tif ( match[ 1 ] ) {\n\t\t\t\t\t\tcontext = context instanceof jQuery ? context[ 0 ] : context;\n\t\n\t\t\t\t\t\t// Option to run scripts is true for back-compat\n\t\t\t\t\t\t// Intentionally let the error be thrown if parseHTML is not present\n\t\t\t\t\t\tjQuery.merge( this, jQuery.parseHTML(\n\t\t\t\t\t\t\tmatch[ 1 ],\n\t\t\t\t\t\t\tcontext && context.nodeType ? context.ownerDocument || context : document,\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t) );\n\t\n\t\t\t\t\t\t// HANDLE: $(html, props)\n\t\t\t\t\t\tif ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {\n\t\t\t\t\t\t\tfor ( match in context ) {\n\t\n\t\t\t\t\t\t\t\t// Properties of context are called as methods if possible\n\t\t\t\t\t\t\t\tif ( jQuery.isFunction( this[ match ] ) ) {\n\t\t\t\t\t\t\t\t\tthis[ match ]( context[ match ] );\n\t\n\t\t\t\t\t\t\t\t// ...and otherwise set as attributes\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthis.attr( match, context[ match ] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn this;\n\t\n\t\t\t\t\t// HANDLE: $(#id)\n\t\t\t\t\t} else {\n\t\t\t\t\t\telem = document.getElementById( match[ 2 ] );\n\t\n\t\t\t\t\t\tif ( elem ) {\n\t\n\t\t\t\t\t\t\t// Inject the element directly into the jQuery object\n\t\t\t\t\t\t\tthis[ 0 ] = elem;\n\t\t\t\t\t\t\tthis.length = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t}\n\t\n\t\t\t\t// HANDLE: $(expr, $(...))\n\t\t\t\t} else if ( !context || context.jquery ) {\n\t\t\t\t\treturn ( context || root ).find( selector );\n\t\n\t\t\t\t// HANDLE: $(expr, context)\n\t\t\t\t// (which is just equivalent to: $(context).find(expr)\n\t\t\t\t} else {\n\t\t\t\t\treturn this.constructor( context ).find( selector );\n\t\t\t\t}\n\t\n\t\t\t// HANDLE: $(DOMElement)\n\t\t\t} else if ( selector.nodeType ) {\n\t\t\t\tthis[ 0 ] = selector;\n\t\t\t\tthis.length = 1;\n\t\t\t\treturn this;\n\t\n\t\t\t// HANDLE: $(function)\n\t\t\t// Shortcut for document ready\n\t\t\t} else if ( jQuery.isFunction( selector ) ) {\n\t\t\t\treturn root.ready !== undefined ?\n\t\t\t\t\troot.ready( selector ) :\n\t\n\t\t\t\t\t// Execute immediately if ready is not present\n\t\t\t\t\tselector( jQuery );\n\t\t\t}\n\t\n\t\t\treturn jQuery.makeArray( selector, this );\n\t\t};\n\t\n\t// Give the init function the jQuery prototype for later instantiation\n\tinit.prototype = jQuery.fn;\n\t\n\t// Initialize central reference\n\trootjQuery = jQuery( document );\n\t\n\t\n\tvar rparentsprev = /^(?:parents|prev(?:Until|All))/,\n\t\n\t\t// Methods guaranteed to produce a unique set when starting from a unique set\n\t\tguaranteedUnique = {\n\t\t\tchildren: true,\n\t\t\tcontents: true,\n\t\t\tnext: true,\n\t\t\tprev: true\n\t\t};\n\t\n\tjQuery.fn.extend( {\n\t\thas: function( target ) {\n\t\t\tvar targets = jQuery( target, this ),\n\t\t\t\tl = targets.length;\n\t\n\t\t\treturn this.filter( function() {\n\t\t\t\tvar i = 0;\n\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\tif ( jQuery.contains( this, targets[ i ] ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tclosest: function( selectors, context ) {\n\t\t\tvar cur,\n\t\t\t\ti = 0,\n\t\t\t\tl = this.length,\n\t\t\t\tmatched = [],\n\t\t\t\ttargets = typeof selectors !== \"string\" && jQuery( selectors );\n\t\n\t\t\t// Positional selectors never match, since there's no _selection_ context\n\t\t\tif ( !rneedsContext.test( selectors ) ) {\n\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\tfor ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {\n\t\n\t\t\t\t\t\t// Always skip document fragments\n\t\t\t\t\t\tif ( cur.nodeType < 11 && ( targets ?\n\t\t\t\t\t\t\ttargets.index( cur ) > -1 :\n\t\n\t\t\t\t\t\t\t// Don't pass non-elements to Sizzle\n\t\t\t\t\t\t\tcur.nodeType === 1 &&\n\t\t\t\t\t\t\t\tjQuery.find.matchesSelector( cur, selectors ) ) ) {\n\t\n\t\t\t\t\t\t\tmatched.push( cur );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );\n\t\t},\n\t\n\t\t// Determine the position of an element within the set\n\t\tindex: function( elem ) {\n\t\n\t\t\t// No argument, return index in parent\n\t\t\tif ( !elem ) {\n\t\t\t\treturn ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;\n\t\t\t}\n\t\n\t\t\t// Index in selector\n\t\t\tif ( typeof elem === \"string\" ) {\n\t\t\t\treturn indexOf.call( jQuery( elem ), this[ 0 ] );\n\t\t\t}\n\t\n\t\t\t// Locate the position of the desired element\n\t\t\treturn indexOf.call( this,\n\t\n\t\t\t\t// If it receives a jQuery object, the first element is used\n\t\t\t\telem.jquery ? elem[ 0 ] : elem\n\t\t\t);\n\t\t},\n\t\n\t\tadd: function( selector, context ) {\n\t\t\treturn this.pushStack(\n\t\t\t\tjQuery.uniqueSort(\n\t\t\t\t\tjQuery.merge( this.get(), jQuery( selector, context ) )\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\n\t\taddBack: function( selector ) {\n\t\t\treturn this.add( selector == null ?\n\t\t\t\tthis.prevObject : this.prevObject.filter( selector )\n\t\t\t);\n\t\t}\n\t} );\n\t\n\tfunction sibling( cur, dir ) {\n\t\twhile ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}\n\t\treturn cur;\n\t}\n\t\n\tjQuery.each( {\n\t\tparent: function( elem ) {\n\t\t\tvar parent = elem.parentNode;\n\t\t\treturn parent && parent.nodeType !== 11 ? parent : null;\n\t\t},\n\t\tparents: function( elem ) {\n\t\t\treturn dir( elem, \"parentNode\" );\n\t\t},\n\t\tparentsUntil: function( elem, i, until ) {\n\t\t\treturn dir( elem, \"parentNode\", until );\n\t\t},\n\t\tnext: function( elem ) {\n\t\t\treturn sibling( elem, \"nextSibling\" );\n\t\t},\n\t\tprev: function( elem ) {\n\t\t\treturn sibling( elem, \"previousSibling\" );\n\t\t},\n\t\tnextAll: function( elem ) {\n\t\t\treturn dir( elem, \"nextSibling\" );\n\t\t},\n\t\tprevAll: function( elem ) {\n\t\t\treturn dir( elem, \"previousSibling\" );\n\t\t},\n\t\tnextUntil: function( elem, i, until ) {\n\t\t\treturn dir( elem, \"nextSibling\", until );\n\t\t},\n\t\tprevUntil: function( elem, i, until ) {\n\t\t\treturn dir( elem, \"previousSibling\", until );\n\t\t},\n\t\tsiblings: function( elem ) {\n\t\t\treturn siblings( ( elem.parentNode || {} ).firstChild, elem );\n\t\t},\n\t\tchildren: function( elem ) {\n\t\t\treturn siblings( elem.firstChild );\n\t\t},\n\t\tcontents: function( elem ) {\n\t\t\treturn elem.contentDocument || jQuery.merge( [], elem.childNodes );\n\t\t}\n\t}, function( name, fn ) {\n\t\tjQuery.fn[ name ] = function( until, selector ) {\n\t\t\tvar matched = jQuery.map( this, fn, until );\n\t\n\t\t\tif ( name.slice( -5 ) !== \"Until\" ) {\n\t\t\t\tselector = until;\n\t\t\t}\n\t\n\t\t\tif ( selector && typeof selector === \"string\" ) {\n\t\t\t\tmatched = jQuery.filter( selector, matched );\n\t\t\t}\n\t\n\t\t\tif ( this.length > 1 ) {\n\t\n\t\t\t\t// Remove duplicates\n\t\t\t\tif ( !guaranteedUnique[ name ] ) {\n\t\t\t\t\tjQuery.uniqueSort( matched );\n\t\t\t\t}\n\t\n\t\t\t\t// Reverse order for parents* and prev-derivatives\n\t\t\t\tif ( rparentsprev.test( name ) ) {\n\t\t\t\t\tmatched.reverse();\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn this.pushStack( matched );\n\t\t};\n\t} );\n\tvar rnotwhite = ( /\\S+/g );\n\t\n\t\n\t\n\t// Convert String-formatted options into Object-formatted ones\n\tfunction createOptions( options ) {\n\t\tvar object = {};\n\t\tjQuery.each( options.match( rnotwhite ) || [], function( _, flag ) {\n\t\t\tobject[ flag ] = true;\n\t\t} );\n\t\treturn object;\n\t}\n\t\n\t/*\n\t * Create a callback list using the following parameters:\n\t *\n\t *\toptions: an optional list of space-separated options that will change how\n\t *\t\t\tthe callback list behaves or a more traditional option object\n\t *\n\t * By default a callback list will act like an event callback list and can be\n\t * \"fired\" multiple times.\n\t *\n\t * Possible options:\n\t *\n\t *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n\t *\n\t *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n\t *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n\t *\t\t\t\t\tvalues (like a Deferred)\n\t *\n\t *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n\t *\n\t *\tstopOnFalse:\tinterrupt callings when a callback returns false\n\t *\n\t */\n\tjQuery.Callbacks = function( options ) {\n\t\n\t\t// Convert options from String-formatted to Object-formatted if needed\n\t\t// (we check in cache first)\n\t\toptions = typeof options === \"string\" ?\n\t\t\tcreateOptions( options ) :\n\t\t\tjQuery.extend( {}, options );\n\t\n\t\tvar // Flag to know if list is currently firing\n\t\t\tfiring,\n\t\n\t\t\t// Last fire value for non-forgettable lists\n\t\t\tmemory,\n\t\n\t\t\t// Flag to know if list was already fired\n\t\t\tfired,\n\t\n\t\t\t// Flag to prevent firing\n\t\t\tlocked,\n\t\n\t\t\t// Actual callback list\n\t\t\tlist = [],\n\t\n\t\t\t// Queue of execution data for repeatable lists\n\t\t\tqueue = [],\n\t\n\t\t\t// Index of currently firing callback (modified by add/remove as needed)\n\t\t\tfiringIndex = -1,\n\t\n\t\t\t// Fire callbacks\n\t\t\tfire = function() {\n\t\n\t\t\t\t// Enforce single-firing\n\t\t\t\tlocked = options.once;\n\t\n\t\t\t\t// Execute callbacks for all pending executions,\n\t\t\t\t// respecting firingIndex overrides and runtime changes\n\t\t\t\tfired = firing = true;\n\t\t\t\tfor ( ; queue.length; firingIndex = -1 ) {\n\t\t\t\t\tmemory = queue.shift();\n\t\t\t\t\twhile ( ++firingIndex < list.length ) {\n\t\n\t\t\t\t\t\t// Run callback and check for early termination\n\t\t\t\t\t\tif ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&\n\t\t\t\t\t\t\toptions.stopOnFalse ) {\n\t\n\t\t\t\t\t\t\t// Jump to end and forget the data so .add doesn't re-fire\n\t\t\t\t\t\t\tfiringIndex = list.length;\n\t\t\t\t\t\t\tmemory = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Forget the data if we're done with it\n\t\t\t\tif ( !options.memory ) {\n\t\t\t\t\tmemory = false;\n\t\t\t\t}\n\t\n\t\t\t\tfiring = false;\n\t\n\t\t\t\t// Clean up if we're done firing for good\n\t\t\t\tif ( locked ) {\n\t\n\t\t\t\t\t// Keep an empty list if we have data for future add calls\n\t\t\t\t\tif ( memory ) {\n\t\t\t\t\t\tlist = [];\n\t\n\t\t\t\t\t// Otherwise, this object is spent\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlist = \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\t// Actual Callbacks object\n\t\t\tself = {\n\t\n\t\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\t\tadd: function() {\n\t\t\t\t\tif ( list ) {\n\t\n\t\t\t\t\t\t// If we have memory from a past run, we should fire after adding\n\t\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\t\tfiringIndex = list.length - 1;\n\t\t\t\t\t\t\tqueue.push( memory );\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t( function add( args ) {\n\t\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\t\tif ( jQuery.isFunction( arg ) ) {\n\t\t\t\t\t\t\t\t\tif ( !options.unique || !self.has( arg ) ) {\n\t\t\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if ( arg && arg.length && jQuery.type( arg ) !== \"string\" ) {\n\t\n\t\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} )( arguments );\n\t\n\t\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\t\tfire();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\n\t\t\t\t// Remove a callback from the list\n\t\t\t\tremove: function() {\n\t\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\t\tvar index;\n\t\t\t\t\t\twhile ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\t\tlist.splice( index, 1 );\n\t\n\t\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\n\t\t\t\t// Check if a given callback is in the list.\n\t\t\t\t// If no argument is given, return whether or not list has callbacks attached.\n\t\t\t\thas: function( fn ) {\n\t\t\t\t\treturn fn ?\n\t\t\t\t\t\tjQuery.inArray( fn, list ) > -1 :\n\t\t\t\t\t\tlist.length > 0;\n\t\t\t\t},\n\t\n\t\t\t\t// Remove all callbacks from the list\n\t\t\t\tempty: function() {\n\t\t\t\t\tif ( list ) {\n\t\t\t\t\t\tlist = [];\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\n\t\t\t\t// Disable .fire and .add\n\t\t\t\t// Abort any current/pending executions\n\t\t\t\t// Clear all callbacks and values\n\t\t\t\tdisable: function() {\n\t\t\t\t\tlocked = queue = [];\n\t\t\t\t\tlist = memory = \"\";\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tdisabled: function() {\n\t\t\t\t\treturn !list;\n\t\t\t\t},\n\t\n\t\t\t\t// Disable .fire\n\t\t\t\t// Also disable .add unless we have memory (since it would have no effect)\n\t\t\t\t// Abort any pending executions\n\t\t\t\tlock: function() {\n\t\t\t\t\tlocked = queue = [];\n\t\t\t\t\tif ( !memory && !firing ) {\n\t\t\t\t\t\tlist = memory = \"\";\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tlocked: function() {\n\t\t\t\t\treturn !!locked;\n\t\t\t\t},\n\t\n\t\t\t\t// Call all callbacks with the given context and arguments\n\t\t\t\tfireWith: function( context, args ) {\n\t\t\t\t\tif ( !locked ) {\n\t\t\t\t\t\targs = args || [];\n\t\t\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\t\t\tqueue.push( args );\n\t\t\t\t\t\tif ( !firing ) {\n\t\t\t\t\t\t\tfire();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\n\t\t\t\t// Call all the callbacks with the given arguments\n\t\t\t\tfire: function() {\n\t\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\n\t\t\t\t// To know if the callbacks have already been called at least once\n\t\t\t\tfired: function() {\n\t\t\t\t\treturn !!fired;\n\t\t\t\t}\n\t\t\t};\n\t\n\t\treturn self;\n\t};\n\t\n\t\n\tfunction Identity( v ) {\n\t\treturn v;\n\t}\n\tfunction Thrower( ex ) {\n\t\tthrow ex;\n\t}\n\t\n\tfunction adoptValue( value, resolve, reject ) {\n\t\tvar method;\n\t\n\t\ttry {\n\t\n\t\t\t// Check for promise aspect first to privilege synchronous behavior\n\t\t\tif ( value && jQuery.isFunction( ( method = value.promise ) ) ) {\n\t\t\t\tmethod.call( value ).done( resolve ).fail( reject );\n\t\n\t\t\t// Other thenables\n\t\t\t} else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {\n\t\t\t\tmethod.call( value, resolve, reject );\n\t\n\t\t\t// Other non-thenables\n\t\t\t} else {\n\t\n\t\t\t\t// Support: Android 4.0 only\n\t\t\t\t// Strict mode functions invoked without .call/.apply get global-object context\n\t\t\t\tresolve.call( undefined, value );\n\t\t\t}\n\t\n\t\t// For Promises/A+, convert exceptions into rejections\n\t\t// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in\n\t\t// Deferred#then to conditionally suppress rejection.\n\t\t} catch ( value ) {\n\t\n\t\t\t// Support: Android 4.0 only\n\t\t\t// Strict mode functions invoked without .call/.apply get global-object context\n\t\t\treject.call( undefined, value );\n\t\t}\n\t}\n\t\n\tjQuery.extend( {\n\t\n\t\tDeferred: function( func ) {\n\t\t\tvar tuples = [\n\t\n\t\t\t\t\t// action, add listener, callbacks,\n\t\t\t\t\t// ... .then handlers, argument index, [final state]\n\t\t\t\t\t[ \"notify\", \"progress\", jQuery.Callbacks( \"memory\" ),\n\t\t\t\t\t\tjQuery.Callbacks( \"memory\" ), 2 ],\n\t\t\t\t\t[ \"resolve\", \"done\", jQuery.Callbacks( \"once memory\" ),\n\t\t\t\t\t\tjQuery.Callbacks( \"once memory\" ), 0, \"resolved\" ],\n\t\t\t\t\t[ \"reject\", \"fail\", jQuery.Callbacks( \"once memory\" ),\n\t\t\t\t\t\tjQuery.Callbacks( \"once memory\" ), 1, \"rejected\" ]\n\t\t\t\t],\n\t\t\t\tstate = \"pending\",\n\t\t\t\tpromise = {\n\t\t\t\t\tstate: function() {\n\t\t\t\t\t\treturn state;\n\t\t\t\t\t},\n\t\t\t\t\talways: function() {\n\t\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t},\n\t\t\t\t\t\"catch\": function( fn ) {\n\t\t\t\t\t\treturn promise.then( null, fn );\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// Keep pipe for back-compat\n\t\t\t\t\tpipe: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\t\tvar fns = arguments;\n\t\n\t\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\t\t\t\t\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\n\t\t\t\t\t\t\t\t// Map tuples (progress, done, fail) to arguments (done, fail, progress)\n\t\t\t\t\t\t\t\tvar fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];\n\t\n\t\t\t\t\t\t\t\t// deferred.progress(function() { bind to newDefer or newDefer.notify })\n\t\t\t\t\t\t\t\t// deferred.done(function() { bind to newDefer or newDefer.resolve })\n\t\t\t\t\t\t\t\t// deferred.fail(function() { bind to newDefer or newDefer.reject })\n\t\t\t\t\t\t\t\tdeferred[ tuple[ 1 ] ]( function() {\n\t\t\t\t\t\t\t\t\tvar returned = fn && fn.apply( this, arguments );\n\t\t\t\t\t\t\t\t\tif ( returned && jQuery.isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify )\n\t\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tnewDefer[ tuple[ 0 ] + \"With\" ](\n\t\t\t\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\t\t\t\tfn ? [ returned ] : arguments\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\tfns = null;\n\t\t\t\t\t\t} ).promise();\n\t\t\t\t\t},\n\t\t\t\t\tthen: function( onFulfilled, onRejected, onProgress ) {\n\t\t\t\t\t\tvar maxDepth = 0;\n\t\t\t\t\t\tfunction resolve( depth, deferred, handler, special ) {\n\t\t\t\t\t\t\treturn function() {\n\t\t\t\t\t\t\t\tvar that = this,\n\t\t\t\t\t\t\t\t\targs = arguments,\n\t\t\t\t\t\t\t\t\tmightThrow = function() {\n\t\t\t\t\t\t\t\t\t\tvar returned, then;\n\t\n\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.3\n\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-59\n\t\t\t\t\t\t\t\t\t\t// Ignore double-resolution attempts\n\t\t\t\t\t\t\t\t\t\tif ( depth < maxDepth ) {\n\t\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\treturned = handler.apply( that, args );\n\t\n\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.1\n\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-48\n\t\t\t\t\t\t\t\t\t\tif ( returned === deferred.promise() ) {\n\t\t\t\t\t\t\t\t\t\t\tthrow new TypeError( \"Thenable self-resolution\" );\n\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ sections 2.3.3.1, 3.5\n\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-54\n\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-75\n\t\t\t\t\t\t\t\t\t\t// Retrieve `then` only once\n\t\t\t\t\t\t\t\t\t\tthen = returned &&\n\t\n\t\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.4\n\t\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-64\n\t\t\t\t\t\t\t\t\t\t\t// Only check objects and functions for thenability\n\t\t\t\t\t\t\t\t\t\t\t( typeof returned === \"object\" ||\n\t\t\t\t\t\t\t\t\t\t\t\ttypeof returned === \"function\" ) &&\n\t\t\t\t\t\t\t\t\t\t\treturned.then;\n\t\n\t\t\t\t\t\t\t\t\t\t// Handle a returned thenable\n\t\t\t\t\t\t\t\t\t\tif ( jQuery.isFunction( then ) ) {\n\t\n\t\t\t\t\t\t\t\t\t\t\t// Special processors (notify) just wait for resolution\n\t\t\t\t\t\t\t\t\t\t\tif ( special ) {\n\t\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special )\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\n\t\t\t\t\t\t\t\t\t\t\t// Normal processors (resolve) also hook into progress\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\n\t\t\t\t\t\t\t\t\t\t\t\t// ...and disregard older resolution values\n\t\t\t\t\t\t\t\t\t\t\t\tmaxDepth++;\n\t\n\t\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special ),\n\t\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tdeferred.notifyWith )\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\t// Handle all other returned values\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\n\t\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\t\tif ( handler !== Identity ) {\n\t\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\t\targs = [ returned ];\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\t\t// Process the value(s)\n\t\t\t\t\t\t\t\t\t\t\t// Default process is resolve\n\t\t\t\t\t\t\t\t\t\t\t( special || deferred.resolveWith )( that, args );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t},\n\t\n\t\t\t\t\t\t\t\t\t// Only normal processors (resolve) catch and reject exceptions\n\t\t\t\t\t\t\t\t\tprocess = special ?\n\t\t\t\t\t\t\t\t\t\tmightThrow :\n\t\t\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\tmightThrow();\n\t\t\t\t\t\t\t\t\t\t\t} catch ( e ) {\n\t\n\t\t\t\t\t\t\t\t\t\t\t\tif ( jQuery.Deferred.exceptionHook ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tjQuery.Deferred.exceptionHook( e,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tprocess.stackTrace );\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.4.1\n\t\t\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-61\n\t\t\t\t\t\t\t\t\t\t\t\t// Ignore post-resolution exceptions\n\t\t\t\t\t\t\t\t\t\t\t\tif ( depth + 1 >= maxDepth ) {\n\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\t\t\t\tif ( handler !== Thrower ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\targs = [ e ];\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeferred.rejectWith( that, args );\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t};\n\t\n\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.1\n\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-57\n\t\t\t\t\t\t\t\t// Re-resolve promises immediately to dodge false rejection from\n\t\t\t\t\t\t\t\t// subsequent errors\n\t\t\t\t\t\t\t\tif ( depth ) {\n\t\t\t\t\t\t\t\t\tprocess();\n\t\t\t\t\t\t\t\t} else {\n\t\n\t\t\t\t\t\t\t\t\t// Call an optional hook to record the stack, in case of exception\n\t\t\t\t\t\t\t\t\t// since it's otherwise lost when execution goes async\n\t\t\t\t\t\t\t\t\tif ( jQuery.Deferred.getStackHook ) {\n\t\t\t\t\t\t\t\t\t\tprocess.stackTrace = jQuery.Deferred.getStackHook();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\twindow.setTimeout( process );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\t\n\t\t\t\t\t\t\t// progress_handlers.add( ... )\n\t\t\t\t\t\t\ttuples[ 0 ][ 3 ].add(\n\t\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\t\tjQuery.isFunction( onProgress ) ?\n\t\t\t\t\t\t\t\t\t\tonProgress :\n\t\t\t\t\t\t\t\t\t\tIdentity,\n\t\t\t\t\t\t\t\t\tnewDefer.notifyWith\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\n\t\t\t\t\t\t\t// fulfilled_handlers.add( ... )\n\t\t\t\t\t\t\ttuples[ 1 ][ 3 ].add(\n\t\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\t\tjQuery.isFunction( onFulfilled ) ?\n\t\t\t\t\t\t\t\t\t\tonFulfilled :\n\t\t\t\t\t\t\t\t\t\tIdentity\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\n\t\t\t\t\t\t\t// rejected_handlers.add( ... )\n\t\t\t\t\t\t\ttuples[ 2 ][ 3 ].add(\n\t\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\t\tjQuery.isFunction( onRejected ) ?\n\t\t\t\t\t\t\t\t\t\tonRejected :\n\t\t\t\t\t\t\t\t\t\tThrower\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ).promise();\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// Get a promise for this deferred\n\t\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdeferred = {};\n\t\n\t\t\t// Add list-specific methods\n\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\t\tvar list = tuple[ 2 ],\n\t\t\t\t\tstateString = tuple[ 5 ];\n\t\n\t\t\t\t// promise.progress = list.add\n\t\t\t\t// promise.done = list.add\n\t\t\t\t// promise.fail = list.add\n\t\t\t\tpromise[ tuple[ 1 ] ] = list.add;\n\t\n\t\t\t\t// Handle state\n\t\t\t\tif ( stateString ) {\n\t\t\t\t\tlist.add(\n\t\t\t\t\t\tfunction() {\n\t\n\t\t\t\t\t\t\t// state = \"resolved\" (i.e., fulfilled)\n\t\t\t\t\t\t\t// state = \"rejected\"\n\t\t\t\t\t\t\tstate = stateString;\n\t\t\t\t\t\t},\n\t\n\t\t\t\t\t\t// rejected_callbacks.disable\n\t\t\t\t\t\t// fulfilled_callbacks.disable\n\t\t\t\t\t\ttuples[ 3 - i ][ 2 ].disable,\n\t\n\t\t\t\t\t\t// progress_callbacks.lock\n\t\t\t\t\t\ttuples[ 0 ][ 2 ].lock\n\t\t\t\t\t);\n\t\t\t\t}\n\t\n\t\t\t\t// progress_handlers.fire\n\t\t\t\t// fulfilled_handlers.fire\n\t\t\t\t// rejected_handlers.fire\n\t\t\t\tlist.add( tuple[ 3 ].fire );\n\t\n\t\t\t\t// deferred.notify = function() { deferred.notifyWith(...) }\n\t\t\t\t// deferred.resolve = function() { deferred.resolveWith(...) }\n\t\t\t\t// deferred.reject = function() { deferred.rejectWith(...) }\n\t\t\t\tdeferred[ tuple[ 0 ] ] = function() {\n\t\t\t\t\tdeferred[ tuple[ 0 ] + \"With\" ]( this === deferred ? undefined : this, arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t};\n\t\n\t\t\t\t// deferred.notifyWith = list.fireWith\n\t\t\t\t// deferred.resolveWith = list.fireWith\n\t\t\t\t// deferred.rejectWith = list.fireWith\n\t\t\t\tdeferred[ tuple[ 0 ] + \"With\" ] = list.fireWith;\n\t\t\t} );\n\t\n\t\t\t// Make the deferred a promise\n\t\t\tpromise.promise( deferred );\n\t\n\t\t\t// Call given func if any\n\t\t\tif ( func ) {\n\t\t\t\tfunc.call( deferred, deferred );\n\t\t\t}\n\t\n\t\t\t// All done!\n\t\t\treturn deferred;\n\t\t},\n\t\n\t\t// Deferred helper\n\t\twhen: function( singleValue ) {\n\t\t\tvar\n\t\n\t\t\t\t// count of uncompleted subordinates\n\t\t\t\tremaining = arguments.length,\n\t\n\t\t\t\t// count of unprocessed arguments\n\t\t\t\ti = remaining,\n\t\n\t\t\t\t// subordinate fulfillment data\n\t\t\t\tresolveContexts = Array( i ),\n\t\t\t\tresolveValues = slice.call( arguments ),\n\t\n\t\t\t\t// the master Deferred\n\t\t\t\tmaster = jQuery.Deferred(),\n\t\n\t\t\t\t// subordinate callback factory\n\t\t\t\tupdateFunc = function( i ) {\n\t\t\t\t\treturn function( value ) {\n\t\t\t\t\t\tresolveContexts[ i ] = this;\n\t\t\t\t\t\tresolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;\n\t\t\t\t\t\tif ( !( --remaining ) ) {\n\t\t\t\t\t\t\tmaster.resolveWith( resolveContexts, resolveValues );\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t};\n\t\n\t\t\t// Single- and empty arguments are adopted like Promise.resolve\n\t\t\tif ( remaining <= 1 ) {\n\t\t\t\tadoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );\n\t\n\t\t\t\t// Use .then() to unwrap secondary thenables (cf. gh-3000)\n\t\t\t\tif ( master.state() === \"pending\" ||\n\t\t\t\t\tjQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {\n\t\n\t\t\t\t\treturn master.then();\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Multiple arguments are aggregated like Promise.all array elements\n\t\t\twhile ( i-- ) {\n\t\t\t\tadoptValue( resolveValues[ i ], updateFunc( i ), master.reject );\n\t\t\t}\n\t\n\t\t\treturn master.promise();\n\t\t}\n\t} );\n\t\n\t\n\t// These usually indicate a programmer mistake during development,\n\t// warn about them ASAP rather than swallowing them by default.\n\tvar rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n\t\n\tjQuery.Deferred.exceptionHook = function( error, stack ) {\n\t\n\t\t// Support: IE 8 - 9 only\n\t\t// Console exists when dev tools are open, which can happen at any time\n\t\tif ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {\n\t\t\twindow.console.warn( \"jQuery.Deferred exception: \" + error.message, error.stack, stack );\n\t\t}\n\t};\n\t\n\t\n\t\n\t\n\tjQuery.readyException = function( error ) {\n\t\twindow.setTimeout( function() {\n\t\t\tthrow error;\n\t\t} );\n\t};\n\t\n\t\n\t\n\t\n\t// The deferred used on DOM ready\n\tvar readyList = jQuery.Deferred();\n\t\n\tjQuery.fn.ready = function( fn ) {\n\t\n\t\treadyList\n\t\t\t.then( fn )\n\t\n\t\t\t// Wrap jQuery.readyException in a function so that the lookup\n\t\t\t// happens at the time of error handling instead of callback\n\t\t\t// registration.\n\t\t\t.catch( function( error ) {\n\t\t\t\tjQuery.readyException( error );\n\t\t\t} );\n\t\n\t\treturn this;\n\t};\n\t\n\tjQuery.extend( {\n\t\n\t\t// Is the DOM ready to be used? Set to true once it occurs.\n\t\tisReady: false,\n\t\n\t\t// A counter to track how many items to wait for before\n\t\t// the ready event fires. See #6781\n\t\treadyWait: 1,\n\t\n\t\t// Hold (or release) the ready event\n\t\tholdReady: function( hold ) {\n\t\t\tif ( hold ) {\n\t\t\t\tjQuery.readyWait++;\n\t\t\t} else {\n\t\t\t\tjQuery.ready( true );\n\t\t\t}\n\t\t},\n\t\n\t\t// Handle when the DOM is ready\n\t\tready: function( wait ) {\n\t\n\t\t\t// Abort if there are pending holds or we're already ready\n\t\t\tif ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Remember that the DOM is ready\n\t\t\tjQuery.isReady = true;\n\t\n\t\t\t// If a normal DOM Ready event fired, decrement, and wait if need be\n\t\t\tif ( wait !== true && --jQuery.readyWait > 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// If there are functions bound, to execute\n\t\t\treadyList.resolveWith( document, [ jQuery ] );\n\t\t}\n\t} );\n\t\n\tjQuery.ready.then = readyList.then;\n\t\n\t// The ready event handler and self cleanup method\n\tfunction completed() {\n\t\tdocument.removeEventListener( \"DOMContentLoaded\", completed );\n\t\twindow.removeEventListener( \"load\", completed );\n\t\tjQuery.ready();\n\t}\n\t\n\t// Catch cases where $(document).ready() is called\n\t// after the browser event has already occurred.\n\t// Support: IE <=9 - 10 only\n\t// Older IE sometimes signals \"interactive\" too soon\n\tif ( document.readyState === \"complete\" ||\n\t\t( document.readyState !== \"loading\" && !document.documentElement.doScroll ) ) {\n\t\n\t\t// Handle it asynchronously to allow scripts the opportunity to delay ready\n\t\twindow.setTimeout( jQuery.ready );\n\t\n\t} else {\n\t\n\t\t// Use the handy event callback\n\t\tdocument.addEventListener( \"DOMContentLoaded\", completed );\n\t\n\t\t// A fallback to window.onload, that will always work\n\t\twindow.addEventListener( \"load\", completed );\n\t}\n\t\n\t\n\t\n\t\n\t// Multifunctional method to get and set values of a collection\n\t// The value/s can optionally be executed if it's a function\n\tvar access = function( elems, fn, key, value, chainable, emptyGet, raw ) {\n\t\tvar i = 0,\n\t\t\tlen = elems.length,\n\t\t\tbulk = key == null;\n\t\n\t\t// Sets many values\n\t\tif ( jQuery.type( key ) === \"object\" ) {\n\t\t\tchainable = true;\n\t\t\tfor ( i in key ) {\n\t\t\t\taccess( elems, fn, i, key[ i ], true, emptyGet, raw );\n\t\t\t}\n\t\n\t\t// Sets one value\n\t\t} else if ( value !== undefined ) {\n\t\t\tchainable = true;\n\t\n\t\t\tif ( !jQuery.isFunction( value ) ) {\n\t\t\t\traw = true;\n\t\t\t}\n\t\n\t\t\tif ( bulk ) {\n\t\n\t\t\t\t// Bulk operations run against the entire set\n\t\t\t\tif ( raw ) {\n\t\t\t\t\tfn.call( elems, value );\n\t\t\t\t\tfn = null;\n\t\n\t\t\t\t// ...except when executing function values\n\t\t\t\t} else {\n\t\t\t\t\tbulk = fn;\n\t\t\t\t\tfn = function( elem, key, value ) {\n\t\t\t\t\t\treturn bulk.call( jQuery( elem ), value );\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\tif ( fn ) {\n\t\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\t\tfn(\n\t\t\t\t\t\telems[ i ], key, raw ?\n\t\t\t\t\t\tvalue :\n\t\t\t\t\t\tvalue.call( elems[ i ], i, fn( elems[ i ], key ) )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn chainable ?\n\t\t\telems :\n\t\n\t\t\t// Gets\n\t\t\tbulk ?\n\t\t\t\tfn.call( elems ) :\n\t\t\t\tlen ? fn( elems[ 0 ], key ) : emptyGet;\n\t};\n\tvar acceptData = function( owner ) {\n\t\n\t\t// Accepts only:\n\t\t//  - Node\n\t\t//    - Node.ELEMENT_NODE\n\t\t//    - Node.DOCUMENT_NODE\n\t\t//  - Object\n\t\t//    - Any\n\t\treturn owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );\n\t};\n\t\n\t\n\t\n\t\n\tfunction Data() {\n\t\tthis.expando = jQuery.expando + Data.uid++;\n\t}\n\t\n\tData.uid = 1;\n\t\n\tData.prototype = {\n\t\n\t\tcache: function( owner ) {\n\t\n\t\t\t// Check if the owner object already has a cache\n\t\t\tvar value = owner[ this.expando ];\n\t\n\t\t\t// If not, create one\n\t\t\tif ( !value ) {\n\t\t\t\tvalue = {};\n\t\n\t\t\t\t// We can accept data for non-element nodes in modern browsers,\n\t\t\t\t// but we should not, see #8335.\n\t\t\t\t// Always return an empty object.\n\t\t\t\tif ( acceptData( owner ) ) {\n\t\n\t\t\t\t\t// If it is a node unlikely to be stringify-ed or looped over\n\t\t\t\t\t// use plain assignment\n\t\t\t\t\tif ( owner.nodeType ) {\n\t\t\t\t\t\towner[ this.expando ] = value;\n\t\n\t\t\t\t\t// Otherwise secure it in a non-enumerable property\n\t\t\t\t\t// configurable must be true to allow the property to be\n\t\t\t\t\t// deleted when data is removed\n\t\t\t\t\t} else {\n\t\t\t\t\t\tObject.defineProperty( owner, this.expando, {\n\t\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\t\tconfigurable: true\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn value;\n\t\t},\n\t\tset: function( owner, data, value ) {\n\t\t\tvar prop,\n\t\t\t\tcache = this.cache( owner );\n\t\n\t\t\t// Handle: [ owner, key, value ] args\n\t\t\t// Always use camelCase key (gh-2257)\n\t\t\tif ( typeof data === \"string\" ) {\n\t\t\t\tcache[ jQuery.camelCase( data ) ] = value;\n\t\n\t\t\t// Handle: [ owner, { properties } ] args\n\t\t\t} else {\n\t\n\t\t\t\t// Copy the properties one-by-one to the cache object\n\t\t\t\tfor ( prop in data ) {\n\t\t\t\t\tcache[ jQuery.camelCase( prop ) ] = data[ prop ];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn cache;\n\t\t},\n\t\tget: function( owner, key ) {\n\t\t\treturn key === undefined ?\n\t\t\t\tthis.cache( owner ) :\n\t\n\t\t\t\t// Always use camelCase key (gh-2257)\n\t\t\t\towner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];\n\t\t},\n\t\taccess: function( owner, key, value ) {\n\t\n\t\t\t// In cases where either:\n\t\t\t//\n\t\t\t//   1. No key was specified\n\t\t\t//   2. A string key was specified, but no value provided\n\t\t\t//\n\t\t\t// Take the \"read\" path and allow the get method to determine\n\t\t\t// which value to return, respectively either:\n\t\t\t//\n\t\t\t//   1. The entire cache object\n\t\t\t//   2. The data stored at the key\n\t\t\t//\n\t\t\tif ( key === undefined ||\n\t\t\t\t\t( ( key && typeof key === \"string\" ) && value === undefined ) ) {\n\t\n\t\t\t\treturn this.get( owner, key );\n\t\t\t}\n\t\n\t\t\t// When the key is not a string, or both a key and value\n\t\t\t// are specified, set or extend (existing objects) with either:\n\t\t\t//\n\t\t\t//   1. An object of properties\n\t\t\t//   2. A key and value\n\t\t\t//\n\t\t\tthis.set( owner, key, value );\n\t\n\t\t\t// Since the \"set\" path can have two possible entry points\n\t\t\t// return the expected data based on which path was taken[*]\n\t\t\treturn value !== undefined ? value : key;\n\t\t},\n\t\tremove: function( owner, key ) {\n\t\t\tvar i,\n\t\t\t\tcache = owner[ this.expando ];\n\t\n\t\t\tif ( cache === undefined ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif ( key !== undefined ) {\n\t\n\t\t\t\t// Support array or space separated string of keys\n\t\t\t\tif ( jQuery.isArray( key ) ) {\n\t\n\t\t\t\t\t// If key is an array of keys...\n\t\t\t\t\t// We always set camelCase keys, so remove that.\n\t\t\t\t\tkey = key.map( jQuery.camelCase );\n\t\t\t\t} else {\n\t\t\t\t\tkey = jQuery.camelCase( key );\n\t\n\t\t\t\t\t// If a key with the spaces exists, use it.\n\t\t\t\t\t// Otherwise, create an array by matching non-whitespace\n\t\t\t\t\tkey = key in cache ?\n\t\t\t\t\t\t[ key ] :\n\t\t\t\t\t\t( key.match( rnotwhite ) || [] );\n\t\t\t\t}\n\t\n\t\t\t\ti = key.length;\n\t\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tdelete cache[ key[ i ] ];\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Remove the expando if there's no more data\n\t\t\tif ( key === undefined || jQuery.isEmptyObject( cache ) ) {\n\t\n\t\t\t\t// Support: Chrome <=35 - 45\n\t\t\t\t// Webkit & Blink performance suffers when deleting properties\n\t\t\t\t// from DOM nodes, so set to undefined instead\n\t\t\t\t// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n\t\t\t\tif ( owner.nodeType ) {\n\t\t\t\t\towner[ this.expando ] = undefined;\n\t\t\t\t} else {\n\t\t\t\t\tdelete owner[ this.expando ];\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\thasData: function( owner ) {\n\t\t\tvar cache = owner[ this.expando ];\n\t\t\treturn cache !== undefined && !jQuery.isEmptyObject( cache );\n\t\t}\n\t};\n\tvar dataPriv = new Data();\n\t\n\tvar dataUser = new Data();\n\t\n\t\n\t\n\t//\tImplementation Summary\n\t//\n\t//\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n\t//\t2. Improve the module's maintainability by reducing the storage\n\t//\t\tpaths to a single mechanism.\n\t//\t3. Use the same single mechanism to support \"private\" and \"user\" data.\n\t//\t4. _Never_ expose \"private\" data to user code (TODO: Drop _data, _removeData)\n\t//\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n\t//\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n\t\n\tvar rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,\n\t\trmultiDash = /[A-Z]/g;\n\t\n\tfunction dataAttr( elem, key, data ) {\n\t\tvar name;\n\t\n\t\t// If nothing was found internally, try to fetch any\n\t\t// data from the HTML5 data-* attribute\n\t\tif ( data === undefined && elem.nodeType === 1 ) {\n\t\t\tname = \"data-\" + key.replace( rmultiDash, \"-$&\" ).toLowerCase();\n\t\t\tdata = elem.getAttribute( name );\n\t\n\t\t\tif ( typeof data === \"string\" ) {\n\t\t\t\ttry {\n\t\t\t\t\tdata = data === \"true\" ? true :\n\t\t\t\t\t\tdata === \"false\" ? false :\n\t\t\t\t\t\tdata === \"null\" ? null :\n\t\n\t\t\t\t\t\t// Only convert to a number if it doesn't change the string\n\t\t\t\t\t\t+data + \"\" === data ? +data :\n\t\t\t\t\t\trbrace.test( data ) ? JSON.parse( data ) :\n\t\t\t\t\t\tdata;\n\t\t\t\t} catch ( e ) {}\n\t\n\t\t\t\t// Make sure we set the data so it isn't changed later\n\t\t\t\tdataUser.set( elem, key, data );\n\t\t\t} else {\n\t\t\t\tdata = undefined;\n\t\t\t}\n\t\t}\n\t\treturn data;\n\t}\n\t\n\tjQuery.extend( {\n\t\thasData: function( elem ) {\n\t\t\treturn dataUser.hasData( elem ) || dataPriv.hasData( elem );\n\t\t},\n\t\n\t\tdata: function( elem, name, data ) {\n\t\t\treturn dataUser.access( elem, name, data );\n\t\t},\n\t\n\t\tremoveData: function( elem, name ) {\n\t\t\tdataUser.remove( elem, name );\n\t\t},\n\t\n\t\t// TODO: Now that all calls to _data and _removeData have been replaced\n\t\t// with direct calls to dataPriv methods, these can be deprecated.\n\t\t_data: function( elem, name, data ) {\n\t\t\treturn dataPriv.access( elem, name, data );\n\t\t},\n\t\n\t\t_removeData: function( elem, name ) {\n\t\t\tdataPriv.remove( elem, name );\n\t\t}\n\t} );\n\t\n\tjQuery.fn.extend( {\n\t\tdata: function( key, value ) {\n\t\t\tvar i, name, data,\n\t\t\t\telem = this[ 0 ],\n\t\t\t\tattrs = elem && elem.attributes;\n\t\n\t\t\t// Gets all values\n\t\t\tif ( key === undefined ) {\n\t\t\t\tif ( this.length ) {\n\t\t\t\t\tdata = dataUser.get( elem );\n\t\n\t\t\t\t\tif ( elem.nodeType === 1 && !dataPriv.get( elem, \"hasDataAttrs\" ) ) {\n\t\t\t\t\t\ti = attrs.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\n\t\t\t\t\t\t\t// Support: IE 11 only\n\t\t\t\t\t\t\t// The attrs elements can be null (#14894)\n\t\t\t\t\t\t\tif ( attrs[ i ] ) {\n\t\t\t\t\t\t\t\tname = attrs[ i ].name;\n\t\t\t\t\t\t\t\tif ( name.indexOf( \"data-\" ) === 0 ) {\n\t\t\t\t\t\t\t\t\tname = jQuery.camelCase( name.slice( 5 ) );\n\t\t\t\t\t\t\t\t\tdataAttr( elem, name, data[ name ] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdataPriv.set( elem, \"hasDataAttrs\", true );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\treturn data;\n\t\t\t}\n\t\n\t\t\t// Sets multiple values\n\t\t\tif ( typeof key === \"object\" ) {\n\t\t\t\treturn this.each( function() {\n\t\t\t\t\tdataUser.set( this, key );\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\treturn access( this, function( value ) {\n\t\t\t\tvar data;\n\t\n\t\t\t\t// The calling jQuery object (element matches) is not empty\n\t\t\t\t// (and therefore has an element appears at this[ 0 ]) and the\n\t\t\t\t// `value` parameter was not undefined. An empty jQuery object\n\t\t\t\t// will result in `undefined` for elem = this[ 0 ] which will\n\t\t\t\t// throw an exception if an attempt to read a data cache is made.\n\t\t\t\tif ( elem && value === undefined ) {\n\t\n\t\t\t\t\t// Attempt to get data from the cache\n\t\t\t\t\t// The key will always be camelCased in Data\n\t\t\t\t\tdata = dataUser.get( elem, key );\n\t\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\t\treturn data;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Attempt to \"discover\" the data in\n\t\t\t\t\t// HTML5 custom data-* attrs\n\t\t\t\t\tdata = dataAttr( elem, key );\n\t\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\t\treturn data;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// We tried really hard, but the data doesn't exist.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// Set the data...\n\t\t\t\tthis.each( function() {\n\t\n\t\t\t\t\t// We always store the camelCased key\n\t\t\t\t\tdataUser.set( this, key, value );\n\t\t\t\t} );\n\t\t\t}, null, value, arguments.length > 1, null, true );\n\t\t},\n\t\n\t\tremoveData: function( key ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tdataUser.remove( this, key );\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\t\n\tjQuery.extend( {\n\t\tqueue: function( elem, type, data ) {\n\t\t\tvar queue;\n\t\n\t\t\tif ( elem ) {\n\t\t\t\ttype = ( type || \"fx\" ) + \"queue\";\n\t\t\t\tqueue = dataPriv.get( elem, type );\n\t\n\t\t\t\t// Speed up dequeue by getting out quickly if this is just a lookup\n\t\t\t\tif ( data ) {\n\t\t\t\t\tif ( !queue || jQuery.isArray( data ) ) {\n\t\t\t\t\t\tqueue = dataPriv.access( elem, type, jQuery.makeArray( data ) );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqueue.push( data );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn queue || [];\n\t\t\t}\n\t\t},\n\t\n\t\tdequeue: function( elem, type ) {\n\t\t\ttype = type || \"fx\";\n\t\n\t\t\tvar queue = jQuery.queue( elem, type ),\n\t\t\t\tstartLength = queue.length,\n\t\t\t\tfn = queue.shift(),\n\t\t\t\thooks = jQuery._queueHooks( elem, type ),\n\t\t\t\tnext = function() {\n\t\t\t\t\tjQuery.dequeue( elem, type );\n\t\t\t\t};\n\t\n\t\t\t// If the fx queue is dequeued, always remove the progress sentinel\n\t\t\tif ( fn === \"inprogress\" ) {\n\t\t\t\tfn = queue.shift();\n\t\t\t\tstartLength--;\n\t\t\t}\n\t\n\t\t\tif ( fn ) {\n\t\n\t\t\t\t// Add a progress sentinel to prevent the fx queue from being\n\t\t\t\t// automatically dequeued\n\t\t\t\tif ( type === \"fx\" ) {\n\t\t\t\t\tqueue.unshift( \"inprogress\" );\n\t\t\t\t}\n\t\n\t\t\t\t// Clear up the last queue stop function\n\t\t\t\tdelete hooks.stop;\n\t\t\t\tfn.call( elem, next, hooks );\n\t\t\t}\n\t\n\t\t\tif ( !startLength && hooks ) {\n\t\t\t\thooks.empty.fire();\n\t\t\t}\n\t\t},\n\t\n\t\t// Not public - generate a queueHooks object, or return the current one\n\t\t_queueHooks: function( elem, type ) {\n\t\t\tvar key = type + \"queueHooks\";\n\t\t\treturn dataPriv.get( elem, key ) || dataPriv.access( elem, key, {\n\t\t\t\tempty: jQuery.Callbacks( \"once memory\" ).add( function() {\n\t\t\t\t\tdataPriv.remove( elem, [ type + \"queue\", key ] );\n\t\t\t\t} )\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\tjQuery.fn.extend( {\n\t\tqueue: function( type, data ) {\n\t\t\tvar setter = 2;\n\t\n\t\t\tif ( typeof type !== \"string\" ) {\n\t\t\t\tdata = type;\n\t\t\t\ttype = \"fx\";\n\t\t\t\tsetter--;\n\t\t\t}\n\t\n\t\t\tif ( arguments.length < setter ) {\n\t\t\t\treturn jQuery.queue( this[ 0 ], type );\n\t\t\t}\n\t\n\t\t\treturn data === undefined ?\n\t\t\t\tthis :\n\t\t\t\tthis.each( function() {\n\t\t\t\t\tvar queue = jQuery.queue( this, type, data );\n\t\n\t\t\t\t\t// Ensure a hooks for this queue\n\t\t\t\t\tjQuery._queueHooks( this, type );\n\t\n\t\t\t\t\tif ( type === \"fx\" && queue[ 0 ] !== \"inprogress\" ) {\n\t\t\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t},\n\t\tdequeue: function( type ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t} );\n\t\t},\n\t\tclearQueue: function( type ) {\n\t\t\treturn this.queue( type || \"fx\", [] );\n\t\t},\n\t\n\t\t// Get a promise resolved when queues of a certain type\n\t\t// are emptied (fx is the type by default)\n\t\tpromise: function( type, obj ) {\n\t\t\tvar tmp,\n\t\t\t\tcount = 1,\n\t\t\t\tdefer = jQuery.Deferred(),\n\t\t\t\telements = this,\n\t\t\t\ti = this.length,\n\t\t\t\tresolve = function() {\n\t\t\t\t\tif ( !( --count ) ) {\n\t\t\t\t\t\tdefer.resolveWith( elements, [ elements ] );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\n\t\t\tif ( typeof type !== \"string\" ) {\n\t\t\t\tobj = type;\n\t\t\t\ttype = undefined;\n\t\t\t}\n\t\t\ttype = type || \"fx\";\n\t\n\t\t\twhile ( i-- ) {\n\t\t\t\ttmp = dataPriv.get( elements[ i ], type + \"queueHooks\" );\n\t\t\t\tif ( tmp && tmp.empty ) {\n\t\t\t\t\tcount++;\n\t\t\t\t\ttmp.empty.add( resolve );\n\t\t\t\t}\n\t\t\t}\n\t\t\tresolve();\n\t\t\treturn defer.promise( obj );\n\t\t}\n\t} );\n\tvar pnum = ( /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/ ).source;\n\t\n\tvar rcssNum = new RegExp( \"^(?:([+-])=|)(\" + pnum + \")([a-z%]*)$\", \"i\" );\n\t\n\t\n\tvar cssExpand = [ \"Top\", \"Right\", \"Bottom\", \"Left\" ];\n\t\n\tvar isHiddenWithinTree = function( elem, el ) {\n\t\n\t\t\t// isHiddenWithinTree might be called from jQuery#filter function;\n\t\t\t// in that case, element will be second argument\n\t\t\telem = el || elem;\n\t\n\t\t\t// Inline style trumps all\n\t\t\treturn elem.style.display === \"none\" ||\n\t\t\t\telem.style.display === \"\" &&\n\t\n\t\t\t\t// Otherwise, check computed style\n\t\t\t\t// Support: Firefox <=43 - 45\n\t\t\t\t// Disconnected elements can have computed display: none, so first confirm that elem is\n\t\t\t\t// in the document.\n\t\t\t\tjQuery.contains( elem.ownerDocument, elem ) &&\n\t\n\t\t\t\tjQuery.css( elem, \"display\" ) === \"none\";\n\t\t};\n\t\n\tvar swap = function( elem, options, callback, args ) {\n\t\tvar ret, name,\n\t\t\told = {};\n\t\n\t\t// Remember the old values, and insert the new ones\n\t\tfor ( name in options ) {\n\t\t\told[ name ] = elem.style[ name ];\n\t\t\telem.style[ name ] = options[ name ];\n\t\t}\n\t\n\t\tret = callback.apply( elem, args || [] );\n\t\n\t\t// Revert the old values\n\t\tfor ( name in options ) {\n\t\t\telem.style[ name ] = old[ name ];\n\t\t}\n\t\n\t\treturn ret;\n\t};\n\t\n\t\n\t\n\t\n\tfunction adjustCSS( elem, prop, valueParts, tween ) {\n\t\tvar adjusted,\n\t\t\tscale = 1,\n\t\t\tmaxIterations = 20,\n\t\t\tcurrentValue = tween ?\n\t\t\t\tfunction() {\n\t\t\t\t\treturn tween.cur();\n\t\t\t\t} :\n\t\t\t\tfunction() {\n\t\t\t\t\treturn jQuery.css( elem, prop, \"\" );\n\t\t\t\t},\n\t\t\tinitial = currentValue(),\n\t\t\tunit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" ),\n\t\n\t\t\t// Starting value computation is required for potential unit mismatches\n\t\t\tinitialInUnit = ( jQuery.cssNumber[ prop ] || unit !== \"px\" && +initial ) &&\n\t\t\t\trcssNum.exec( jQuery.css( elem, prop ) );\n\t\n\t\tif ( initialInUnit && initialInUnit[ 3 ] !== unit ) {\n\t\n\t\t\t// Trust units reported by jQuery.css\n\t\t\tunit = unit || initialInUnit[ 3 ];\n\t\n\t\t\t// Make sure we update the tween properties later on\n\t\t\tvalueParts = valueParts || [];\n\t\n\t\t\t// Iteratively approximate from a nonzero starting point\n\t\t\tinitialInUnit = +initial || 1;\n\t\n\t\t\tdo {\n\t\n\t\t\t\t// If previous iteration zeroed out, double until we get *something*.\n\t\t\t\t// Use string for doubling so we don't accidentally see scale as unchanged below\n\t\t\t\tscale = scale || \".5\";\n\t\n\t\t\t\t// Adjust and apply\n\t\t\t\tinitialInUnit = initialInUnit / scale;\n\t\t\t\tjQuery.style( elem, prop, initialInUnit + unit );\n\t\n\t\t\t// Update scale, tolerating zero or NaN from tween.cur()\n\t\t\t// Break the loop if scale is unchanged or perfect, or if we've just had enough.\n\t\t\t} while (\n\t\t\t\tscale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations\n\t\t\t);\n\t\t}\n\t\n\t\tif ( valueParts ) {\n\t\t\tinitialInUnit = +initialInUnit || +initial || 0;\n\t\n\t\t\t// Apply relative offset (+=/-=) if specified\n\t\t\tadjusted = valueParts[ 1 ] ?\n\t\t\t\tinitialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :\n\t\t\t\t+valueParts[ 2 ];\n\t\t\tif ( tween ) {\n\t\t\t\ttween.unit = unit;\n\t\t\t\ttween.start = initialInUnit;\n\t\t\t\ttween.end = adjusted;\n\t\t\t}\n\t\t}\n\t\treturn adjusted;\n\t}\n\t\n\t\n\tvar defaultDisplayMap = {};\n\t\n\tfunction getDefaultDisplay( elem ) {\n\t\tvar temp,\n\t\t\tdoc = elem.ownerDocument,\n\t\t\tnodeName = elem.nodeName,\n\t\t\tdisplay = defaultDisplayMap[ nodeName ];\n\t\n\t\tif ( display ) {\n\t\t\treturn display;\n\t\t}\n\t\n\t\ttemp = doc.body.appendChild( doc.createElement( nodeName ) ),\n\t\tdisplay = jQuery.css( temp, \"display\" );\n\t\n\t\ttemp.parentNode.removeChild( temp );\n\t\n\t\tif ( display === \"none\" ) {\n\t\t\tdisplay = \"block\";\n\t\t}\n\t\tdefaultDisplayMap[ nodeName ] = display;\n\t\n\t\treturn display;\n\t}\n\t\n\tfunction showHide( elements, show ) {\n\t\tvar display, elem,\n\t\t\tvalues = [],\n\t\t\tindex = 0,\n\t\t\tlength = elements.length;\n\t\n\t\t// Determine new display value for elements that need to change\n\t\tfor ( ; index < length; index++ ) {\n\t\t\telem = elements[ index ];\n\t\t\tif ( !elem.style ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\n\t\t\tdisplay = elem.style.display;\n\t\t\tif ( show ) {\n\t\n\t\t\t\t// Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n\t\t\t\t// check is required in this first loop unless we have a nonempty display value (either\n\t\t\t\t// inline or about-to-be-restored)\n\t\t\t\tif ( display === \"none\" ) {\n\t\t\t\t\tvalues[ index ] = dataPriv.get( elem, \"display\" ) || null;\n\t\t\t\t\tif ( !values[ index ] ) {\n\t\t\t\t\t\telem.style.display = \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( elem.style.display === \"\" && isHiddenWithinTree( elem ) ) {\n\t\t\t\t\tvalues[ index ] = getDefaultDisplay( elem );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( display !== \"none\" ) {\n\t\t\t\t\tvalues[ index ] = \"none\";\n\t\n\t\t\t\t\t// Remember what we're overwriting\n\t\t\t\t\tdataPriv.set( elem, \"display\", display );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// Set the display of the elements in a second loop to avoid constant reflow\n\t\tfor ( index = 0; index < length; index++ ) {\n\t\t\tif ( values[ index ] != null ) {\n\t\t\t\telements[ index ].style.display = values[ index ];\n\t\t\t}\n\t\t}\n\t\n\t\treturn elements;\n\t}\n\t\n\tjQuery.fn.extend( {\n\t\tshow: function() {\n\t\t\treturn showHide( this, true );\n\t\t},\n\t\thide: function() {\n\t\t\treturn showHide( this );\n\t\t},\n\t\ttoggle: function( state ) {\n\t\t\tif ( typeof state === \"boolean\" ) {\n\t\t\t\treturn state ? this.show() : this.hide();\n\t\t\t}\n\t\n\t\t\treturn this.each( function() {\n\t\t\t\tif ( isHiddenWithinTree( this ) ) {\n\t\t\t\t\tjQuery( this ).show();\n\t\t\t\t} else {\n\t\t\t\t\tjQuery( this ).hide();\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\tvar rcheckableType = ( /^(?:checkbox|radio)$/i );\n\t\n\tvar rtagName = ( /<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]+)/i );\n\t\n\tvar rscriptType = ( /^$|\\/(?:java|ecma)script/i );\n\t\n\t\n\t\n\t// We have to close these tags to support XHTML (#13200)\n\tvar wrapMap = {\n\t\n\t\t// Support: IE <=9 only\n\t\toption: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n\t\n\t\t// XHTML parsers do not magically insert elements in the\n\t\t// same way that tag soup parsers do. So we cannot shorten\n\t\t// this by omitting <tbody> or other required elements.\n\t\tthead: [ 1, \"<table>\", \"</table>\" ],\n\t\tcol: [ 2, \"<table><colgroup>\", \"</colgroup></table>\" ],\n\t\ttr: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n\t\ttd: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n\t\n\t\t_default: [ 0, \"\", \"\" ]\n\t};\n\t\n\t// Support: IE <=9 only\n\twrapMap.optgroup = wrapMap.option;\n\t\n\twrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\n\twrapMap.th = wrapMap.td;\n\t\n\t\n\tfunction getAll( context, tag ) {\n\t\n\t\t// Support: IE <=9 - 11 only\n\t\t// Use typeof to avoid zero-argument method invocation on host objects (#15151)\n\t\tvar ret = typeof context.getElementsByTagName !== \"undefined\" ?\n\t\t\t\tcontext.getElementsByTagName( tag || \"*\" ) :\n\t\t\t\ttypeof context.querySelectorAll !== \"undefined\" ?\n\t\t\t\t\tcontext.querySelectorAll( tag || \"*\" ) :\n\t\t\t\t[];\n\t\n\t\treturn tag === undefined || tag && jQuery.nodeName( context, tag ) ?\n\t\t\tjQuery.merge( [ context ], ret ) :\n\t\t\tret;\n\t}\n\t\n\t\n\t// Mark scripts as having already been evaluated\n\tfunction setGlobalEval( elems, refElements ) {\n\t\tvar i = 0,\n\t\t\tl = elems.length;\n\t\n\t\tfor ( ; i < l; i++ ) {\n\t\t\tdataPriv.set(\n\t\t\t\telems[ i ],\n\t\t\t\t\"globalEval\",\n\t\t\t\t!refElements || dataPriv.get( refElements[ i ], \"globalEval\" )\n\t\t\t);\n\t\t}\n\t}\n\t\n\t\n\tvar rhtml = /<|&#?\\w+;/;\n\t\n\tfunction buildFragment( elems, context, scripts, selection, ignored ) {\n\t\tvar elem, tmp, tag, wrap, contains, j,\n\t\t\tfragment = context.createDocumentFragment(),\n\t\t\tnodes = [],\n\t\t\ti = 0,\n\t\t\tl = elems.length;\n\t\n\t\tfor ( ; i < l; i++ ) {\n\t\t\telem = elems[ i ];\n\t\n\t\t\tif ( elem || elem === 0 ) {\n\t\n\t\t\t\t// Add nodes directly\n\t\t\t\tif ( jQuery.type( elem ) === \"object\" ) {\n\t\n\t\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\tjQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );\n\t\n\t\t\t\t// Convert non-html into a text node\n\t\t\t\t} else if ( !rhtml.test( elem ) ) {\n\t\t\t\t\tnodes.push( context.createTextNode( elem ) );\n\t\n\t\t\t\t// Convert html into DOM nodes\n\t\t\t\t} else {\n\t\t\t\t\ttmp = tmp || fragment.appendChild( context.createElement( \"div\" ) );\n\t\n\t\t\t\t\t// Deserialize a standard representation\n\t\t\t\t\ttag = ( rtagName.exec( elem ) || [ \"\", \"\" ] )[ 1 ].toLowerCase();\n\t\t\t\t\twrap = wrapMap[ tag ] || wrapMap._default;\n\t\t\t\t\ttmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];\n\t\n\t\t\t\t\t// Descend through wrappers to the right content\n\t\t\t\t\tj = wrap[ 0 ];\n\t\t\t\t\twhile ( j-- ) {\n\t\t\t\t\t\ttmp = tmp.lastChild;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\tjQuery.merge( nodes, tmp.childNodes );\n\t\n\t\t\t\t\t// Remember the top-level container\n\t\t\t\t\ttmp = fragment.firstChild;\n\t\n\t\t\t\t\t// Ensure the created nodes are orphaned (#12392)\n\t\t\t\t\ttmp.textContent = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// Remove wrapper from fragment\n\t\tfragment.textContent = \"\";\n\t\n\t\ti = 0;\n\t\twhile ( ( elem = nodes[ i++ ] ) ) {\n\t\n\t\t\t// Skip elements already in the context collection (trac-4087)\n\t\t\tif ( selection && jQuery.inArray( elem, selection ) > -1 ) {\n\t\t\t\tif ( ignored ) {\n\t\t\t\t\tignored.push( elem );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\n\t\t\tcontains = jQuery.contains( elem.ownerDocument, elem );\n\t\n\t\t\t// Append to fragment\n\t\t\ttmp = getAll( fragment.appendChild( elem ), \"script\" );\n\t\n\t\t\t// Preserve script evaluation history\n\t\t\tif ( contains ) {\n\t\t\t\tsetGlobalEval( tmp );\n\t\t\t}\n\t\n\t\t\t// Capture executables\n\t\t\tif ( scripts ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( ( elem = tmp[ j++ ] ) ) {\n\t\t\t\t\tif ( rscriptType.test( elem.type || \"\" ) ) {\n\t\t\t\t\t\tscripts.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn fragment;\n\t}\n\t\n\t\n\t( function() {\n\t\tvar fragment = document.createDocumentFragment(),\n\t\t\tdiv = fragment.appendChild( document.createElement( \"div\" ) ),\n\t\t\tinput = document.createElement( \"input\" );\n\t\n\t\t// Support: Android 4.0 - 4.3 only\n\t\t// Check state lost if the name is set (#11217)\n\t\t// Support: Windows Web Apps (WWA)\n\t\t// `name` and `type` must use .setAttribute for WWA (#14901)\n\t\tinput.setAttribute( \"type\", \"radio\" );\n\t\tinput.setAttribute( \"checked\", \"checked\" );\n\t\tinput.setAttribute( \"name\", \"t\" );\n\t\n\t\tdiv.appendChild( input );\n\t\n\t\t// Support: Android <=4.1 only\n\t\t// Older WebKit doesn't clone checked state correctly in fragments\n\t\tsupport.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\t\n\t\t// Support: IE <=11 only\n\t\t// Make sure textarea (and checkbox) defaultValue is properly cloned\n\t\tdiv.innerHTML = \"<textarea>x</textarea>\";\n\t\tsupport.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;\n\t} )();\n\tvar documentElement = document.documentElement;\n\t\n\t\n\t\n\tvar\n\t\trkeyEvent = /^key/,\n\t\trmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,\n\t\trtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n\t\n\tfunction returnTrue() {\n\t\treturn true;\n\t}\n\t\n\tfunction returnFalse() {\n\t\treturn false;\n\t}\n\t\n\t// Support: IE <=9 only\n\t// See #13393 for more info\n\tfunction safeActiveElement() {\n\t\ttry {\n\t\t\treturn document.activeElement;\n\t\t} catch ( err ) { }\n\t}\n\t\n\tfunction on( elem, types, selector, data, fn, one ) {\n\t\tvar origFn, type;\n\t\n\t\t// Types can be a map of types/handlers\n\t\tif ( typeof types === \"object\" ) {\n\t\n\t\t\t// ( types-Object, selector, data )\n\t\t\tif ( typeof selector !== \"string\" ) {\n\t\n\t\t\t\t// ( types-Object, data )\n\t\t\t\tdata = data || selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t\tfor ( type in types ) {\n\t\t\t\ton( elem, type, selector, data, types[ type ], one );\n\t\t\t}\n\t\t\treturn elem;\n\t\t}\n\t\n\t\tif ( data == null && fn == null ) {\n\t\n\t\t\t// ( types, fn )\n\t\t\tfn = selector;\n\t\t\tdata = selector = undefined;\n\t\t} else if ( fn == null ) {\n\t\t\tif ( typeof selector === \"string\" ) {\n\t\n\t\t\t\t// ( types, selector, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = undefined;\n\t\t\t} else {\n\t\n\t\t\t\t// ( types, data, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t} else if ( !fn ) {\n\t\t\treturn elem;\n\t\t}\n\t\n\t\tif ( one === 1 ) {\n\t\t\torigFn = fn;\n\t\t\tfn = function( event ) {\n\t\n\t\t\t\t// Can use an empty set, since event contains the info\n\t\t\t\tjQuery().off( event );\n\t\t\t\treturn origFn.apply( this, arguments );\n\t\t\t};\n\t\n\t\t\t// Use same guid so caller can remove using origFn\n\t\t\tfn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n\t\t}\n\t\treturn elem.each( function() {\n\t\t\tjQuery.event.add( this, types, fn, data, selector );\n\t\t} );\n\t}\n\t\n\t/*\n\t * Helper functions for managing events -- not part of the public interface.\n\t * Props to Dean Edwards' addEvent library for many of the ideas.\n\t */\n\tjQuery.event = {\n\t\n\t\tglobal: {},\n\t\n\t\tadd: function( elem, types, handler, data, selector ) {\n\t\n\t\t\tvar handleObjIn, eventHandle, tmp,\n\t\t\t\tevents, t, handleObj,\n\t\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\t\telemData = dataPriv.get( elem );\n\t\n\t\t\t// Don't attach events to noData or text/comment nodes (but allow plain objects)\n\t\t\tif ( !elemData ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\t\tif ( handler.handler ) {\n\t\t\t\thandleObjIn = handler;\n\t\t\t\thandler = handleObjIn.handler;\n\t\t\t\tselector = handleObjIn.selector;\n\t\t\t}\n\t\n\t\t\t// Ensure that invalid selectors throw exceptions at attach time\n\t\t\t// Evaluate against documentElement in case elem is a non-element node (e.g., document)\n\t\t\tif ( selector ) {\n\t\t\t\tjQuery.find.matchesSelector( documentElement, selector );\n\t\t\t}\n\t\n\t\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\t\tif ( !handler.guid ) {\n\t\t\t\thandler.guid = jQuery.guid++;\n\t\t\t}\n\t\n\t\t\t// Init the element's event structure and main handler, if this is the first\n\t\t\tif ( !( events = elemData.events ) ) {\n\t\t\t\tevents = elemData.events = {};\n\t\t\t}\n\t\t\tif ( !( eventHandle = elemData.handle ) ) {\n\t\t\t\teventHandle = elemData.handle = function( e ) {\n\t\n\t\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\t\treturn typeof jQuery !== \"undefined\" && jQuery.event.triggered !== e.type ?\n\t\t\t\t\t\tjQuery.event.dispatch.apply( elem, arguments ) : undefined;\n\t\t\t\t};\n\t\t\t}\n\t\n\t\t\t// Handle multiple events separated by a space\n\t\t\ttypes = ( types || \"\" ).match( rnotwhite ) || [ \"\" ];\n\t\t\tt = types.length;\n\t\t\twhile ( t-- ) {\n\t\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\t\ttype = origType = tmp[ 1 ];\n\t\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\t\n\t\t\t\t// There *must* be a type, no attaching namespace-only handlers\n\t\t\t\tif ( !type ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\n\t\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\n\t\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\n\t\t\t\t// Update special based on newly reset type\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\n\t\t\t\t// handleObj is passed to all event handlers\n\t\t\t\thandleObj = jQuery.extend( {\n\t\t\t\t\ttype: type,\n\t\t\t\t\torigType: origType,\n\t\t\t\t\tdata: data,\n\t\t\t\t\thandler: handler,\n\t\t\t\t\tguid: handler.guid,\n\t\t\t\t\tselector: selector,\n\t\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n\t\t\t\t\tnamespace: namespaces.join( \".\" )\n\t\t\t\t}, handleObjIn );\n\t\n\t\t\t\t// Init the event handler queue if we're the first\n\t\t\t\tif ( !( handlers = events[ type ] ) ) {\n\t\t\t\t\thandlers = events[ type ] = [];\n\t\t\t\t\thandlers.delegateCount = 0;\n\t\n\t\t\t\t\t// Only use addEventListener if the special events handler returns false\n\t\t\t\t\tif ( !special.setup ||\n\t\t\t\t\t\tspecial.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\t\n\t\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\t\telem.addEventListener( type, eventHandle );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\tif ( special.add ) {\n\t\t\t\t\tspecial.add.call( elem, handleObj );\n\t\n\t\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Add to the element's handler list, delegates in front\n\t\t\t\tif ( selector ) {\n\t\t\t\t\thandlers.splice( handlers.delegateCount++, 0, handleObj );\n\t\t\t\t} else {\n\t\t\t\t\thandlers.push( handleObj );\n\t\t\t\t}\n\t\n\t\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\t\tjQuery.event.global[ type ] = true;\n\t\t\t}\n\t\n\t\t},\n\t\n\t\t// Detach an event or set of events from an element\n\t\tremove: function( elem, types, handler, selector, mappedTypes ) {\n\t\n\t\t\tvar j, origCount, tmp,\n\t\t\t\tevents, t, handleObj,\n\t\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\t\telemData = dataPriv.hasData( elem ) && dataPriv.get( elem );\n\t\n\t\t\tif ( !elemData || !( events = elemData.events ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Once for each type.namespace in types; type may be omitted\n\t\t\ttypes = ( types || \"\" ).match( rnotwhite ) || [ \"\" ];\n\t\t\tt = types.length;\n\t\t\twhile ( t-- ) {\n\t\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\t\ttype = origType = tmp[ 1 ];\n\t\t\t\tnamespaces = ( tmp[ 2 ] || \"\" ).split( \".\" ).sort();\n\t\n\t\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\t\tif ( !type ) {\n\t\t\t\t\tfor ( type in events ) {\n\t\t\t\t\t\tjQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\t\t\thandlers = events[ type ] || [];\n\t\t\t\ttmp = tmp[ 2 ] &&\n\t\t\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" );\n\t\n\t\t\t\t// Remove matching events\n\t\t\t\torigCount = j = handlers.length;\n\t\t\t\twhile ( j-- ) {\n\t\t\t\t\thandleObj = handlers[ j ];\n\t\n\t\t\t\t\tif ( ( mappedTypes || origType === handleObj.origType ) &&\n\t\t\t\t\t\t( !handler || handler.guid === handleObj.guid ) &&\n\t\t\t\t\t\t( !tmp || tmp.test( handleObj.namespace ) ) &&\n\t\t\t\t\t\t( !selector || selector === handleObj.selector ||\n\t\t\t\t\t\t\tselector === \"**\" && handleObj.selector ) ) {\n\t\t\t\t\t\thandlers.splice( j, 1 );\n\t\n\t\t\t\t\t\tif ( handleObj.selector ) {\n\t\t\t\t\t\t\thandlers.delegateCount--;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\t\tif ( origCount && !handlers.length ) {\n\t\t\t\t\tif ( !special.teardown ||\n\t\t\t\t\t\tspecial.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n\t\n\t\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t\t}\n\t\n\t\t\t\t\tdelete events[ type ];\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Remove data and the expando if it's no longer used\n\t\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\t\tdataPriv.remove( elem, \"handle events\" );\n\t\t\t}\n\t\t},\n\t\n\t\tdispatch: function( nativeEvent ) {\n\t\n\t\t\t// Make a writable jQuery.Event from the native event object\n\t\t\tvar event = jQuery.event.fix( nativeEvent );\n\t\n\t\t\tvar i, j, ret, matched, handleObj, handlerQueue,\n\t\t\t\targs = new Array( arguments.length ),\n\t\t\t\thandlers = ( dataPriv.get( this, \"events\" ) || {} )[ event.type ] || [],\n\t\t\t\tspecial = jQuery.event.special[ event.type ] || {};\n\t\n\t\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\t\targs[ 0 ] = event;\n\t\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i ] = arguments[ i ];\n\t\t\t}\n\t\n\t\t\tevent.delegateTarget = this;\n\t\n\t\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\t\tif ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Determine handlers\n\t\t\thandlerQueue = jQuery.event.handlers.call( this, event, handlers );\n\t\n\t\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\t\ti = 0;\n\t\t\twhile ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\t\t\tevent.currentTarget = matched.elem;\n\t\n\t\t\t\tj = 0;\n\t\t\t\twhile ( ( handleObj = matched.handlers[ j++ ] ) &&\n\t\t\t\t\t!event.isImmediatePropagationStopped() ) {\n\t\n\t\t\t\t\t// Triggered event must either 1) have no namespace, or 2) have namespace(s)\n\t\t\t\t\t// a subset or equal to those in the bound event (both can have no namespace).\n\t\t\t\t\tif ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {\n\t\n\t\t\t\t\t\tevent.handleObj = handleObj;\n\t\t\t\t\t\tevent.data = handleObj.data;\n\t\n\t\t\t\t\t\tret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||\n\t\t\t\t\t\t\thandleObj.handler ).apply( matched.elem, args );\n\t\n\t\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\t\tif ( ( event.result = ret ) === false ) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Call the postDispatch hook for the mapped type\n\t\t\tif ( special.postDispatch ) {\n\t\t\t\tspecial.postDispatch.call( this, event );\n\t\t\t}\n\t\n\t\t\treturn event.result;\n\t\t},\n\t\n\t\thandlers: function( event, handlers ) {\n\t\t\tvar i, matches, sel, handleObj,\n\t\t\t\thandlerQueue = [],\n\t\t\t\tdelegateCount = handlers.delegateCount,\n\t\t\t\tcur = event.target;\n\t\n\t\t\t// Support: IE <=9\n\t\t\t// Find delegate handlers\n\t\t\t// Black-hole SVG <use> instance trees (#13180)\n\t\t\t//\n\t\t\t// Support: Firefox <=42\n\t\t\t// Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343)\n\t\t\tif ( delegateCount && cur.nodeType &&\n\t\t\t\t( event.type !== \"click\" || isNaN( event.button ) || event.button < 1 ) ) {\n\t\n\t\t\t\tfor ( ; cur !== this; cur = cur.parentNode || this ) {\n\t\n\t\t\t\t\t// Don't check non-elements (#13208)\n\t\t\t\t\t// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)\n\t\t\t\t\tif ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== \"click\" ) ) {\n\t\t\t\t\t\tmatches = [];\n\t\t\t\t\t\tfor ( i = 0; i < delegateCount; i++ ) {\n\t\t\t\t\t\t\thandleObj = handlers[ i ];\n\t\n\t\t\t\t\t\t\t// Don't conflict with Object.prototype properties (#13203)\n\t\t\t\t\t\t\tsel = handleObj.selector + \" \";\n\t\n\t\t\t\t\t\t\tif ( matches[ sel ] === undefined ) {\n\t\t\t\t\t\t\t\tmatches[ sel ] = handleObj.needsContext ?\n\t\t\t\t\t\t\t\t\tjQuery( sel, this ).index( cur ) > -1 :\n\t\t\t\t\t\t\t\t\tjQuery.find( sel, this, null, [ cur ] ).length;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( matches[ sel ] ) {\n\t\t\t\t\t\t\t\tmatches.push( handleObj );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( matches.length ) {\n\t\t\t\t\t\t\thandlerQueue.push( { elem: cur, handlers: matches } );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Add the remaining (directly-bound) handlers\n\t\t\tif ( delegateCount < handlers.length ) {\n\t\t\t\thandlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } );\n\t\t\t}\n\t\n\t\t\treturn handlerQueue;\n\t\t},\n\t\n\t\taddProp: function( name, hook ) {\n\t\t\tObject.defineProperty( jQuery.Event.prototype, name, {\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true,\n\t\n\t\t\t\tget: jQuery.isFunction( hook ) ?\n\t\t\t\t\tfunction() {\n\t\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\t\t\treturn hook( this.originalEvent );\n\t\t\t\t\t\t}\n\t\t\t\t\t} :\n\t\t\t\t\tfunction() {\n\t\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\t\t\treturn this.originalEvent[ name ];\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\n\t\t\t\tset: function( value ) {\n\t\t\t\t\tObject.defineProperty( this, name, {\n\t\t\t\t\t\tenumerable: true,\n\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\twritable: true,\n\t\t\t\t\t\tvalue: value\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tfix: function( originalEvent ) {\n\t\t\treturn originalEvent[ jQuery.expando ] ?\n\t\t\t\toriginalEvent :\n\t\t\t\tnew jQuery.Event( originalEvent );\n\t\t},\n\t\n\t\tspecial: {\n\t\t\tload: {\n\t\n\t\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\t\tnoBubble: true\n\t\t\t},\n\t\t\tfocus: {\n\t\n\t\t\t\t// Fire native event if possible so blur/focus sequence is correct\n\t\t\t\ttrigger: function() {\n\t\t\t\t\tif ( this !== safeActiveElement() && this.focus ) {\n\t\t\t\t\t\tthis.focus();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdelegateType: \"focusin\"\n\t\t\t},\n\t\t\tblur: {\n\t\t\t\ttrigger: function() {\n\t\t\t\t\tif ( this === safeActiveElement() && this.blur ) {\n\t\t\t\t\t\tthis.blur();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdelegateType: \"focusout\"\n\t\t\t},\n\t\t\tclick: {\n\t\n\t\t\t\t// For checkbox, fire native event so checked state will be right\n\t\t\t\ttrigger: function() {\n\t\t\t\t\tif ( this.type === \"checkbox\" && this.click && jQuery.nodeName( this, \"input\" ) ) {\n\t\t\t\t\t\tthis.click();\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\n\t\t\t\t// For cross-browser consistency, don't fire native .click() on links\n\t\t\t\t_default: function( event ) {\n\t\t\t\t\treturn jQuery.nodeName( event.target, \"a\" );\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\tbeforeunload: {\n\t\t\t\tpostDispatch: function( event ) {\n\t\n\t\t\t\t\t// Support: Firefox 20+\n\t\t\t\t\t// Firefox doesn't alert if the returnValue field is not set.\n\t\t\t\t\tif ( event.result !== undefined && event.originalEvent ) {\n\t\t\t\t\t\tevent.originalEvent.returnValue = event.result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\t\n\tjQuery.removeEvent = function( elem, type, handle ) {\n\t\n\t\t// This \"if\" is needed for plain objects\n\t\tif ( elem.removeEventListener ) {\n\t\t\telem.removeEventListener( type, handle );\n\t\t}\n\t};\n\t\n\tjQuery.Event = function( src, props ) {\n\t\n\t\t// Allow instantiation without the 'new' keyword\n\t\tif ( !( this instanceof jQuery.Event ) ) {\n\t\t\treturn new jQuery.Event( src, props );\n\t\t}\n\t\n\t\t// Event object\n\t\tif ( src && src.type ) {\n\t\t\tthis.originalEvent = src;\n\t\t\tthis.type = src.type;\n\t\n\t\t\t// Events bubbling up the document may have been marked as prevented\n\t\t\t// by a handler lower down the tree; reflect the correct value.\n\t\t\tthis.isDefaultPrevented = src.defaultPrevented ||\n\t\t\t\t\tsrc.defaultPrevented === undefined &&\n\t\n\t\t\t\t\t// Support: Android <=2.3 only\n\t\t\t\t\tsrc.returnValue === false ?\n\t\t\t\treturnTrue :\n\t\t\t\treturnFalse;\n\t\n\t\t\t// Create target properties\n\t\t\t// Support: Safari <=6 - 7 only\n\t\t\t// Target should not be a text node (#504, #13143)\n\t\t\tthis.target = ( src.target && src.target.nodeType === 3 ) ?\n\t\t\t\tsrc.target.parentNode :\n\t\t\t\tsrc.target;\n\t\n\t\t\tthis.currentTarget = src.currentTarget;\n\t\t\tthis.relatedTarget = src.relatedTarget;\n\t\n\t\t// Event type\n\t\t} else {\n\t\t\tthis.type = src;\n\t\t}\n\t\n\t\t// Put explicitly provided properties onto the event object\n\t\tif ( props ) {\n\t\t\tjQuery.extend( this, props );\n\t\t}\n\t\n\t\t// Create a timestamp if incoming event doesn't have one\n\t\tthis.timeStamp = src && src.timeStamp || jQuery.now();\n\t\n\t\t// Mark it as fixed\n\t\tthis[ jQuery.expando ] = true;\n\t};\n\t\n\t// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n\t// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\n\tjQuery.Event.prototype = {\n\t\tconstructor: jQuery.Event,\n\t\tisDefaultPrevented: returnFalse,\n\t\tisPropagationStopped: returnFalse,\n\t\tisImmediatePropagationStopped: returnFalse,\n\t\tisSimulated: false,\n\t\n\t\tpreventDefault: function() {\n\t\t\tvar e = this.originalEvent;\n\t\n\t\t\tthis.isDefaultPrevented = returnTrue;\n\t\n\t\t\tif ( e && !this.isSimulated ) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t},\n\t\tstopPropagation: function() {\n\t\t\tvar e = this.originalEvent;\n\t\n\t\t\tthis.isPropagationStopped = returnTrue;\n\t\n\t\t\tif ( e && !this.isSimulated ) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t},\n\t\tstopImmediatePropagation: function() {\n\t\t\tvar e = this.originalEvent;\n\t\n\t\t\tthis.isImmediatePropagationStopped = returnTrue;\n\t\n\t\t\tif ( e && !this.isSimulated ) {\n\t\t\t\te.stopImmediatePropagation();\n\t\t\t}\n\t\n\t\t\tthis.stopPropagation();\n\t\t}\n\t};\n\t\n\t// Includes all common event props including KeyEvent and MouseEvent specific props\n\tjQuery.each( {\n\t\taltKey: true,\n\t\tbubbles: true,\n\t\tcancelable: true,\n\t\tchangedTouches: true,\n\t\tctrlKey: true,\n\t\tdetail: true,\n\t\teventPhase: true,\n\t\tmetaKey: true,\n\t\tpageX: true,\n\t\tpageY: true,\n\t\tshiftKey: true,\n\t\tview: true,\n\t\t\"char\": true,\n\t\tcharCode: true,\n\t\tkey: true,\n\t\tkeyCode: true,\n\t\tbutton: true,\n\t\tbuttons: true,\n\t\tclientX: true,\n\t\tclientY: true,\n\t\toffsetX: true,\n\t\toffsetY: true,\n\t\tpointerId: true,\n\t\tpointerType: true,\n\t\tscreenX: true,\n\t\tscreenY: true,\n\t\ttargetTouches: true,\n\t\ttoElement: true,\n\t\ttouches: true,\n\t\n\t\twhich: function( event ) {\n\t\t\tvar button = event.button;\n\t\n\t\t\t// Add which for key events\n\t\t\tif ( event.which == null && rkeyEvent.test( event.type ) ) {\n\t\t\t\treturn event.charCode != null ? event.charCode : event.keyCode;\n\t\t\t}\n\t\n\t\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\t\tif ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {\n\t\t\t\treturn ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );\n\t\t\t}\n\t\n\t\t\treturn event.which;\n\t\t}\n\t}, jQuery.event.addProp );\n\t\n\t// Create mouseenter/leave events using mouseover/out and event-time checks\n\t// so that event delegation works in jQuery.\n\t// Do the same for pointerenter/pointerleave and pointerover/pointerout\n\t//\n\t// Support: Safari 7 only\n\t// Safari sends mouseenter too often; see:\n\t// https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n\t// for the description of the bug (it existed in older Chrome versions as well).\n\tjQuery.each( {\n\t\tmouseenter: \"mouseover\",\n\t\tmouseleave: \"mouseout\",\n\t\tpointerenter: \"pointerover\",\n\t\tpointerleave: \"pointerout\"\n\t}, function( orig, fix ) {\n\t\tjQuery.event.special[ orig ] = {\n\t\t\tdelegateType: fix,\n\t\t\tbindType: fix,\n\t\n\t\t\thandle: function( event ) {\n\t\t\t\tvar ret,\n\t\t\t\t\ttarget = this,\n\t\t\t\t\trelated = event.relatedTarget,\n\t\t\t\t\thandleObj = event.handleObj;\n\t\n\t\t\t\t// For mouseenter/leave call the handler if related is outside the target.\n\t\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\t\tif ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {\n\t\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\t\tret = handleObj.handler.apply( this, arguments );\n\t\t\t\t\tevent.type = fix;\n\t\t\t\t}\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t};\n\t} );\n\t\n\tjQuery.fn.extend( {\n\t\n\t\ton: function( types, selector, data, fn ) {\n\t\t\treturn on( this, types, selector, data, fn );\n\t\t},\n\t\tone: function( types, selector, data, fn ) {\n\t\t\treturn on( this, types, selector, data, fn, 1 );\n\t\t},\n\t\toff: function( types, selector, fn ) {\n\t\t\tvar handleObj, type;\n\t\t\tif ( types && types.preventDefault && types.handleObj ) {\n\t\n\t\t\t\t// ( event )  dispatched jQuery.Event\n\t\t\t\thandleObj = types.handleObj;\n\t\t\t\tjQuery( types.delegateTarget ).off(\n\t\t\t\t\thandleObj.namespace ?\n\t\t\t\t\t\thandleObj.origType + \".\" + handleObj.namespace :\n\t\t\t\t\t\thandleObj.origType,\n\t\t\t\t\thandleObj.selector,\n\t\t\t\t\thandleObj.handler\n\t\t\t\t);\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tif ( typeof types === \"object\" ) {\n\t\n\t\t\t\t// ( types-object [, selector] )\n\t\t\t\tfor ( type in types ) {\n\t\t\t\t\tthis.off( type, selector, types[ type ] );\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t}\n\t\t\tif ( selector === false || typeof selector === \"function\" ) {\n\t\n\t\t\t\t// ( types [, fn] )\n\t\t\t\tfn = selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t\tif ( fn === false ) {\n\t\t\t\tfn = returnFalse;\n\t\t\t}\n\t\t\treturn this.each( function() {\n\t\t\t\tjQuery.event.remove( this, types, fn, selector );\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\t\n\tvar\n\t\n\t\t/* eslint-disable max-len */\n\t\n\t\t// See https://github.com/eslint/eslint/issues/3229\n\t\trxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)[^>]*)\\/>/gi,\n\t\n\t\t/* eslint-enable */\n\t\n\t\t// Support: IE <=10 - 11, Edge 12 - 13\n\t\t// In IE/Edge using regex groups here causes severe slowdowns.\n\t\t// See https://connect.microsoft.com/IE/feedback/details/1736512/\n\t\trnoInnerhtml = /<script|<style|<link/i,\n\t\n\t\t// checked=\"checked\" or checked\n\t\trchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n\t\trscriptTypeMasked = /^true\\/(.*)/,\n\t\trcleanScript = /^\\s*<!(?:\\[CDATA\\[|--)|(?:\\]\\]|--)>\\s*$/g;\n\t\n\tfunction manipulationTarget( elem, content ) {\n\t\tif ( jQuery.nodeName( elem, \"table\" ) &&\n\t\t\tjQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, \"tr\" ) ) {\n\t\n\t\t\treturn elem.getElementsByTagName( \"tbody\" )[ 0 ] || elem;\n\t\t}\n\t\n\t\treturn elem;\n\t}\n\t\n\t// Replace/restore the type attribute of script elements for safe DOM manipulation\n\tfunction disableScript( elem ) {\n\t\telem.type = ( elem.getAttribute( \"type\" ) !== null ) + \"/\" + elem.type;\n\t\treturn elem;\n\t}\n\tfunction restoreScript( elem ) {\n\t\tvar match = rscriptTypeMasked.exec( elem.type );\n\t\n\t\tif ( match ) {\n\t\t\telem.type = match[ 1 ];\n\t\t} else {\n\t\t\telem.removeAttribute( \"type\" );\n\t\t}\n\t\n\t\treturn elem;\n\t}\n\t\n\tfunction cloneCopyEvent( src, dest ) {\n\t\tvar i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;\n\t\n\t\tif ( dest.nodeType !== 1 ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\t// 1. Copy private data: events, handlers, etc.\n\t\tif ( dataPriv.hasData( src ) ) {\n\t\t\tpdataOld = dataPriv.access( src );\n\t\t\tpdataCur = dataPriv.set( dest, pdataOld );\n\t\t\tevents = pdataOld.events;\n\t\n\t\t\tif ( events ) {\n\t\t\t\tdelete pdataCur.handle;\n\t\t\t\tpdataCur.events = {};\n\t\n\t\t\t\tfor ( type in events ) {\n\t\t\t\t\tfor ( i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\t\t\tjQuery.event.add( dest, type, events[ type ][ i ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// 2. Copy user data\n\t\tif ( dataUser.hasData( src ) ) {\n\t\t\tudataOld = dataUser.access( src );\n\t\t\tudataCur = jQuery.extend( {}, udataOld );\n\t\n\t\t\tdataUser.set( dest, udataCur );\n\t\t}\n\t}\n\t\n\t// Fix IE bugs, see support tests\n\tfunction fixInput( src, dest ) {\n\t\tvar nodeName = dest.nodeName.toLowerCase();\n\t\n\t\t// Fails to persist the checked state of a cloned checkbox or radio button.\n\t\tif ( nodeName === \"input\" && rcheckableType.test( src.type ) ) {\n\t\t\tdest.checked = src.checked;\n\t\n\t\t// Fails to return the selected option to the default selected state when cloning options\n\t\t} else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n\t\t\tdest.defaultValue = src.defaultValue;\n\t\t}\n\t}\n\t\n\tfunction domManip( collection, args, callback, ignored ) {\n\t\n\t\t// Flatten any nested arrays\n\t\targs = concat.apply( [], args );\n\t\n\t\tvar fragment, first, scripts, hasScripts, node, doc,\n\t\t\ti = 0,\n\t\t\tl = collection.length,\n\t\t\tiNoClone = l - 1,\n\t\t\tvalue = args[ 0 ],\n\t\t\tisFunction = jQuery.isFunction( value );\n\t\n\t\t// We can't cloneNode fragments that contain checked, in WebKit\n\t\tif ( isFunction ||\n\t\t\t\t( l > 1 && typeof value === \"string\" &&\n\t\t\t\t\t!support.checkClone && rchecked.test( value ) ) ) {\n\t\t\treturn collection.each( function( index ) {\n\t\t\t\tvar self = collection.eq( index );\n\t\t\t\tif ( isFunction ) {\n\t\t\t\t\targs[ 0 ] = value.call( this, index, self.html() );\n\t\t\t\t}\n\t\t\t\tdomManip( self, args, callback, ignored );\n\t\t\t} );\n\t\t}\n\t\n\t\tif ( l ) {\n\t\t\tfragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );\n\t\t\tfirst = fragment.firstChild;\n\t\n\t\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\t\tfragment = first;\n\t\t\t}\n\t\n\t\t\t// Require either new content or an interest in ignored elements to invoke the callback\n\t\t\tif ( first || ignored ) {\n\t\t\t\tscripts = jQuery.map( getAll( fragment, \"script\" ), disableScript );\n\t\t\t\thasScripts = scripts.length;\n\t\n\t\t\t\t// Use the original fragment for the last item\n\t\t\t\t// instead of the first because it can end up\n\t\t\t\t// being emptied incorrectly in certain situations (#8070).\n\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\tnode = fragment;\n\t\n\t\t\t\t\tif ( i !== iNoClone ) {\n\t\t\t\t\t\tnode = jQuery.clone( node, true, true );\n\t\n\t\t\t\t\t\t// Keep references to cloned scripts for later restoration\n\t\t\t\t\t\tif ( hasScripts ) {\n\t\n\t\t\t\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\t\t\tjQuery.merge( scripts, getAll( node, \"script\" ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\tcallback.call( collection[ i ], node, i );\n\t\t\t\t}\n\t\n\t\t\t\tif ( hasScripts ) {\n\t\t\t\t\tdoc = scripts[ scripts.length - 1 ].ownerDocument;\n\t\n\t\t\t\t\t// Reenable scripts\n\t\t\t\t\tjQuery.map( scripts, restoreScript );\n\t\n\t\t\t\t\t// Evaluate executable scripts on first document insertion\n\t\t\t\t\tfor ( i = 0; i < hasScripts; i++ ) {\n\t\t\t\t\t\tnode = scripts[ i ];\n\t\t\t\t\t\tif ( rscriptType.test( node.type || \"\" ) &&\n\t\t\t\t\t\t\t!dataPriv.access( node, \"globalEval\" ) &&\n\t\t\t\t\t\t\tjQuery.contains( doc, node ) ) {\n\t\n\t\t\t\t\t\t\tif ( node.src ) {\n\t\n\t\t\t\t\t\t\t\t// Optional AJAX dependency, but won't run scripts if not present\n\t\t\t\t\t\t\t\tif ( jQuery._evalUrl ) {\n\t\t\t\t\t\t\t\t\tjQuery._evalUrl( node.src );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tDOMEval( node.textContent.replace( rcleanScript, \"\" ), doc );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn collection;\n\t}\n\t\n\tfunction remove( elem, selector, keepData ) {\n\t\tvar node,\n\t\t\tnodes = selector ? jQuery.filter( selector, elem ) : elem,\n\t\t\ti = 0;\n\t\n\t\tfor ( ; ( node = nodes[ i ] ) != null; i++ ) {\n\t\t\tif ( !keepData && node.nodeType === 1 ) {\n\t\t\t\tjQuery.cleanData( getAll( node ) );\n\t\t\t}\n\t\n\t\t\tif ( node.parentNode ) {\n\t\t\t\tif ( keepData && jQuery.contains( node.ownerDocument, node ) ) {\n\t\t\t\t\tsetGlobalEval( getAll( node, \"script\" ) );\n\t\t\t\t}\n\t\t\t\tnode.parentNode.removeChild( node );\n\t\t\t}\n\t\t}\n\t\n\t\treturn elem;\n\t}\n\t\n\tjQuery.extend( {\n\t\thtmlPrefilter: function( html ) {\n\t\t\treturn html.replace( rxhtmlTag, \"<$1></$2>\" );\n\t\t},\n\t\n\t\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\t\tvar i, l, srcElements, destElements,\n\t\t\t\tclone = elem.cloneNode( true ),\n\t\t\t\tinPage = jQuery.contains( elem.ownerDocument, elem );\n\t\n\t\t\t// Fix IE cloning issues\n\t\t\tif ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&\n\t\t\t\t\t!jQuery.isXMLDoc( elem ) ) {\n\t\n\t\t\t\t// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2\n\t\t\t\tdestElements = getAll( clone );\n\t\t\t\tsrcElements = getAll( elem );\n\t\n\t\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\t\tfixInput( srcElements[ i ], destElements[ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Copy the events from the original to the clone\n\t\t\tif ( dataAndEvents ) {\n\t\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\t\tsrcElements = srcElements || getAll( elem );\n\t\t\t\t\tdestElements = destElements || getAll( clone );\n\t\n\t\t\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\t\t\tcloneCopyEvent( srcElements[ i ], destElements[ i ] );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tcloneCopyEvent( elem, clone );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Preserve script evaluation history\n\t\t\tdestElements = getAll( clone, \"script\" );\n\t\t\tif ( destElements.length > 0 ) {\n\t\t\t\tsetGlobalEval( destElements, !inPage && getAll( elem, \"script\" ) );\n\t\t\t}\n\t\n\t\t\t// Return the cloned set\n\t\t\treturn clone;\n\t\t},\n\t\n\t\tcleanData: function( elems ) {\n\t\t\tvar data, elem, type,\n\t\t\t\tspecial = jQuery.event.special,\n\t\t\t\ti = 0;\n\t\n\t\t\tfor ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {\n\t\t\t\tif ( acceptData( elem ) ) {\n\t\t\t\t\tif ( ( data = elem[ dataPriv.expando ] ) ) {\n\t\t\t\t\t\tif ( data.events ) {\n\t\t\t\t\t\t\tfor ( type in data.events ) {\n\t\t\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\t\n\t\t\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove's overhead\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\t\telem[ dataPriv.expando ] = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif ( elem[ dataUser.expando ] ) {\n\t\n\t\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\t\telem[ dataUser.expando ] = undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} );\n\t\n\tjQuery.fn.extend( {\n\t\tdetach: function( selector ) {\n\t\t\treturn remove( this, selector, true );\n\t\t},\n\t\n\t\tremove: function( selector ) {\n\t\t\treturn remove( this, selector );\n\t\t},\n\t\n\t\ttext: function( value ) {\n\t\t\treturn access( this, function( value ) {\n\t\t\t\treturn value === undefined ?\n\t\t\t\t\tjQuery.text( this ) :\n\t\t\t\t\tthis.empty().each( function() {\n\t\t\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\t\t\tthis.textContent = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t}, null, value, arguments.length );\n\t\t},\n\t\n\t\tappend: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\t\ttarget.appendChild( elem );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tprepend: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\t\ttarget.insertBefore( elem, target.firstChild );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tbefore: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.parentNode ) {\n\t\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tafter: function() {\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tif ( this.parentNode ) {\n\t\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\tempty: function() {\n\t\t\tvar elem,\n\t\t\t\ti = 0;\n\t\n\t\t\tfor ( ; ( elem = this[ i ] ) != null; i++ ) {\n\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\n\t\t\t\t\t// Prevent memory leaks\n\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\n\t\t\t\t\t// Remove any remaining nodes\n\t\t\t\t\telem.textContent = \"\";\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn this;\n\t\t},\n\t\n\t\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\t\n\t\t\treturn this.map( function() {\n\t\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t\t} );\n\t\t},\n\t\n\t\thtml: function( value ) {\n\t\t\treturn access( this, function( value ) {\n\t\t\t\tvar elem = this[ 0 ] || {},\n\t\t\t\t\ti = 0,\n\t\t\t\t\tl = this.length;\n\t\n\t\t\t\tif ( value === undefined && elem.nodeType === 1 ) {\n\t\t\t\t\treturn elem.innerHTML;\n\t\t\t\t}\n\t\n\t\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\t\tif ( typeof value === \"string\" && !rnoInnerhtml.test( value ) &&\n\t\t\t\t\t!wrapMap[ ( rtagName.exec( value ) || [ \"\", \"\" ] )[ 1 ].toLowerCase() ] ) {\n\t\n\t\t\t\t\tvalue = jQuery.htmlPrefilter( value );\n\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\t\t\telem = this[ i ] || {};\n\t\n\t\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\telem = 0;\n\t\n\t\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t\t} catch ( e ) {}\n\t\t\t\t}\n\t\n\t\t\t\tif ( elem ) {\n\t\t\t\t\tthis.empty().append( value );\n\t\t\t\t}\n\t\t\t}, null, value, arguments.length );\n\t\t},\n\t\n\t\treplaceWith: function() {\n\t\t\tvar ignored = [];\n\t\n\t\t\t// Make the changes, replacing each non-ignored context element with the new content\n\t\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\t\tvar parent = this.parentNode;\n\t\n\t\t\t\tif ( jQuery.inArray( this, ignored ) < 0 ) {\n\t\t\t\t\tjQuery.cleanData( getAll( this ) );\n\t\t\t\t\tif ( parent ) {\n\t\t\t\t\t\tparent.replaceChild( elem, this );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t// Force callback invocation\n\t\t\t}, ignored );\n\t\t}\n\t} );\n\t\n\tjQuery.each( {\n\t\tappendTo: \"append\",\n\t\tprependTo: \"prepend\",\n\t\tinsertBefore: \"before\",\n\t\tinsertAfter: \"after\",\n\t\treplaceAll: \"replaceWith\"\n\t}, function( name, original ) {\n\t\tjQuery.fn[ name ] = function( selector ) {\n\t\t\tvar elems,\n\t\t\t\tret = [],\n\t\t\t\tinsert = jQuery( selector ),\n\t\t\t\tlast = insert.length - 1,\n\t\t\t\ti = 0;\n\t\n\t\t\tfor ( ; i <= last; i++ ) {\n\t\t\t\telems = i === last ? this : this.clone( true );\n\t\t\t\tjQuery( insert[ i ] )[ original ]( elems );\n\t\n\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t// .get() because push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\tpush.apply( ret, elems.get() );\n\t\t\t}\n\t\n\t\t\treturn this.pushStack( ret );\n\t\t};\n\t} );\n\tvar rmargin = ( /^margin/ );\n\t\n\tvar rnumnonpx = new RegExp( \"^(\" + pnum + \")(?!px)[a-z%]+$\", \"i\" );\n\t\n\tvar getStyles = function( elem ) {\n\t\n\t\t\t// Support: IE <=11 only, Firefox <=30 (#15098, #14150)\n\t\t\t// IE throws on elements created in popups\n\t\t\t// FF meanwhile throws on frame elements through \"defaultView.getComputedStyle\"\n\t\t\tvar view = elem.ownerDocument.defaultView;\n\t\n\t\t\tif ( !view || !view.opener ) {\n\t\t\t\tview = window;\n\t\t\t}\n\t\n\t\t\treturn view.getComputedStyle( elem );\n\t\t};\n\t\n\t\n\t\n\t( function() {\n\t\n\t\t// Executing both pixelPosition & boxSizingReliable tests require only one layout\n\t\t// so they're executed at the same time to save the second computation.\n\t\tfunction computeStyleTests() {\n\t\n\t\t\t// This is a singleton, we need to execute it only once\n\t\t\tif ( !div ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tdiv.style.cssText =\n\t\t\t\t\"box-sizing:border-box;\" +\n\t\t\t\t\"position:relative;display:block;\" +\n\t\t\t\t\"margin:auto;border:1px;padding:1px;\" +\n\t\t\t\t\"top:1%;width:50%\";\n\t\t\tdiv.innerHTML = \"\";\n\t\t\tdocumentElement.appendChild( container );\n\t\n\t\t\tvar divStyle = window.getComputedStyle( div );\n\t\t\tpixelPositionVal = divStyle.top !== \"1%\";\n\t\n\t\t\t// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n\t\t\treliableMarginLeftVal = divStyle.marginLeft === \"2px\";\n\t\t\tboxSizingReliableVal = divStyle.width === \"4px\";\n\t\n\t\t\t// Support: Android 4.0 - 4.3 only\n\t\t\t// Some styles come back with percentage values, even though they shouldn't\n\t\t\tdiv.style.marginRight = \"50%\";\n\t\t\tpixelMarginRightVal = divStyle.marginRight === \"4px\";\n\t\n\t\t\tdocumentElement.removeChild( container );\n\t\n\t\t\t// Nullify the div so it wouldn't be stored in the memory and\n\t\t\t// it will also be a sign that checks already performed\n\t\t\tdiv = null;\n\t\t}\n\t\n\t\tvar pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,\n\t\t\tcontainer = document.createElement( \"div\" ),\n\t\t\tdiv = document.createElement( \"div\" );\n\t\n\t\t// Finish early in limited (non-browser) environments\n\t\tif ( !div.style ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\t// Support: IE <=9 - 11 only\n\t\t// Style of cloned element affects source element cloned (#8908)\n\t\tdiv.style.backgroundClip = \"content-box\";\n\t\tdiv.cloneNode( true ).style.backgroundClip = \"\";\n\t\tsupport.clearCloneStyle = div.style.backgroundClip === \"content-box\";\n\t\n\t\tcontainer.style.cssText = \"border:0;width:8px;height:0;top:0;left:-9999px;\" +\n\t\t\t\"padding:0;margin-top:1px;position:absolute\";\n\t\tcontainer.appendChild( div );\n\t\n\t\tjQuery.extend( support, {\n\t\t\tpixelPosition: function() {\n\t\t\t\tcomputeStyleTests();\n\t\t\t\treturn pixelPositionVal;\n\t\t\t},\n\t\t\tboxSizingReliable: function() {\n\t\t\t\tcomputeStyleTests();\n\t\t\t\treturn boxSizingReliableVal;\n\t\t\t},\n\t\t\tpixelMarginRight: function() {\n\t\t\t\tcomputeStyleTests();\n\t\t\t\treturn pixelMarginRightVal;\n\t\t\t},\n\t\t\treliableMarginLeft: function() {\n\t\t\t\tcomputeStyleTests();\n\t\t\t\treturn reliableMarginLeftVal;\n\t\t\t}\n\t\t} );\n\t} )();\n\t\n\t\n\tfunction curCSS( elem, name, computed ) {\n\t\tvar width, minWidth, maxWidth, ret,\n\t\t\tstyle = elem.style;\n\t\n\t\tcomputed = computed || getStyles( elem );\n\t\n\t\t// Support: IE <=9 only\n\t\t// getPropertyValue is only needed for .css('filter') (#12537)\n\t\tif ( computed ) {\n\t\t\tret = computed.getPropertyValue( name ) || computed[ name ];\n\t\n\t\t\tif ( ret === \"\" && !jQuery.contains( elem.ownerDocument, elem ) ) {\n\t\t\t\tret = jQuery.style( elem, name );\n\t\t\t}\n\t\n\t\t\t// A tribute to the \"awesome hack by Dean Edwards\"\n\t\t\t// Android Browser returns percentage for some values,\n\t\t\t// but width seems to be reliably pixels.\n\t\t\t// This is against the CSSOM draft spec:\n\t\t\t// https://drafts.csswg.org/cssom/#resolved-values\n\t\t\tif ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {\n\t\n\t\t\t\t// Remember the original values\n\t\t\t\twidth = style.width;\n\t\t\t\tminWidth = style.minWidth;\n\t\t\t\tmaxWidth = style.maxWidth;\n\t\n\t\t\t\t// Put in the new values to get a computed value out\n\t\t\t\tstyle.minWidth = style.maxWidth = style.width = ret;\n\t\t\t\tret = computed.width;\n\t\n\t\t\t\t// Revert the changed values\n\t\t\t\tstyle.width = width;\n\t\t\t\tstyle.minWidth = minWidth;\n\t\t\t\tstyle.maxWidth = maxWidth;\n\t\t\t}\n\t\t}\n\t\n\t\treturn ret !== undefined ?\n\t\n\t\t\t// Support: IE <=9 - 11 only\n\t\t\t// IE returns zIndex value as an integer.\n\t\t\tret + \"\" :\n\t\t\tret;\n\t}\n\t\n\t\n\tfunction addGetHookIf( conditionFn, hookFn ) {\n\t\n\t\t// Define the hook, we'll check on the first run if it's really needed.\n\t\treturn {\n\t\t\tget: function() {\n\t\t\t\tif ( conditionFn() ) {\n\t\n\t\t\t\t\t// Hook not needed (or it's not possible to use it due\n\t\t\t\t\t// to missing dependency), remove it.\n\t\t\t\t\tdelete this.get;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// Hook needed; redefine it so that the support test is not executed again.\n\t\t\t\treturn ( this.get = hookFn ).apply( this, arguments );\n\t\t\t}\n\t\t};\n\t}\n\t\n\t\n\tvar\n\t\n\t\t// Swappable if display is none or starts with table\n\t\t// except \"table\", \"table-cell\", or \"table-caption\"\n\t\t// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n\t\trdisplayswap = /^(none|table(?!-c[ea]).+)/,\n\t\tcssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" },\n\t\tcssNormalTransform = {\n\t\t\tletterSpacing: \"0\",\n\t\t\tfontWeight: \"400\"\n\t\t},\n\t\n\t\tcssPrefixes = [ \"Webkit\", \"Moz\", \"ms\" ],\n\t\temptyStyle = document.createElement( \"div\" ).style;\n\t\n\t// Return a css property mapped to a potentially vendor prefixed property\n\tfunction vendorPropName( name ) {\n\t\n\t\t// Shortcut for names that are not vendor prefixed\n\t\tif ( name in emptyStyle ) {\n\t\t\treturn name;\n\t\t}\n\t\n\t\t// Check for vendor prefixed names\n\t\tvar capName = name[ 0 ].toUpperCase() + name.slice( 1 ),\n\t\t\ti = cssPrefixes.length;\n\t\n\t\twhile ( i-- ) {\n\t\t\tname = cssPrefixes[ i ] + capName;\n\t\t\tif ( name in emptyStyle ) {\n\t\t\t\treturn name;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction setPositiveNumber( elem, value, subtract ) {\n\t\n\t\t// Any relative (+/-) values have already been\n\t\t// normalized at this point\n\t\tvar matches = rcssNum.exec( value );\n\t\treturn matches ?\n\t\n\t\t\t// Guard against undefined \"subtract\", e.g., when used as in cssHooks\n\t\t\tMath.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || \"px\" ) :\n\t\t\tvalue;\n\t}\n\t\n\tfunction augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {\n\t\tvar i = extra === ( isBorderBox ? \"border\" : \"content\" ) ?\n\t\n\t\t\t// If we already have the right measurement, avoid augmentation\n\t\t\t4 :\n\t\n\t\t\t// Otherwise initialize for horizontal or vertical properties\n\t\t\tname === \"width\" ? 1 : 0,\n\t\n\t\t\tval = 0;\n\t\n\t\tfor ( ; i < 4; i += 2 ) {\n\t\n\t\t\t// Both box models exclude margin, so add it if we want it\n\t\t\tif ( extra === \"margin\" ) {\n\t\t\t\tval += jQuery.css( elem, extra + cssExpand[ i ], true, styles );\n\t\t\t}\n\t\n\t\t\tif ( isBorderBox ) {\n\t\n\t\t\t\t// border-box includes padding, so remove it if we want content\n\t\t\t\tif ( extra === \"content\" ) {\n\t\t\t\t\tval -= jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\t\t\t\t}\n\t\n\t\t\t\t// At this point, extra isn't border nor margin, so remove border\n\t\t\t\tif ( extra !== \"margin\" ) {\n\t\t\t\t\tval -= jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t\t}\n\t\t\t} else {\n\t\n\t\t\t\t// At this point, extra isn't content, so add padding\n\t\t\t\tval += jQuery.css( elem, \"padding\" + cssExpand[ i ], true, styles );\n\t\n\t\t\t\t// At this point, extra isn't content nor padding, so add border\n\t\t\t\tif ( extra !== \"padding\" ) {\n\t\t\t\t\tval += jQuery.css( elem, \"border\" + cssExpand[ i ] + \"Width\", true, styles );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn val;\n\t}\n\t\n\tfunction getWidthOrHeight( elem, name, extra ) {\n\t\n\t\t// Start with offset property, which is equivalent to the border-box value\n\t\tvar val,\n\t\t\tvalueIsBorderBox = true,\n\t\t\tstyles = getStyles( elem ),\n\t\t\tisBorderBox = jQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\";\n\t\n\t\t// Support: IE <=11 only\n\t\t// Running getBoundingClientRect on a disconnected node\n\t\t// in IE throws an error.\n\t\tif ( elem.getClientRects().length ) {\n\t\t\tval = elem.getBoundingClientRect()[ name ];\n\t\t}\n\t\n\t\t// Some non-html elements return undefined for offsetWidth, so check for null/undefined\n\t\t// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285\n\t\t// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668\n\t\tif ( val <= 0 || val == null ) {\n\t\n\t\t\t// Fall back to computed then uncomputed css if necessary\n\t\t\tval = curCSS( elem, name, styles );\n\t\t\tif ( val < 0 || val == null ) {\n\t\t\t\tval = elem.style[ name ];\n\t\t\t}\n\t\n\t\t\t// Computed unit is not pixels. Stop here and return.\n\t\t\tif ( rnumnonpx.test( val ) ) {\n\t\t\t\treturn val;\n\t\t\t}\n\t\n\t\t\t// Check for style in case a browser which returns unreliable values\n\t\t\t// for getComputedStyle silently falls back to the reliable elem.style\n\t\t\tvalueIsBorderBox = isBorderBox &&\n\t\t\t\t( support.boxSizingReliable() || val === elem.style[ name ] );\n\t\n\t\t\t// Normalize \"\", auto, and prepare for extra\n\t\t\tval = parseFloat( val ) || 0;\n\t\t}\n\t\n\t\t// Use the active box-sizing model to add/subtract irrelevant styles\n\t\treturn ( val +\n\t\t\taugmentWidthOrHeight(\n\t\t\t\telem,\n\t\t\t\tname,\n\t\t\t\textra || ( isBorderBox ? \"border\" : \"content\" ),\n\t\t\t\tvalueIsBorderBox,\n\t\t\t\tstyles\n\t\t\t)\n\t\t) + \"px\";\n\t}\n\t\n\tjQuery.extend( {\n\t\n\t\t// Add in style property hooks for overriding the default\n\t\t// behavior of getting and setting a style property\n\t\tcssHooks: {\n\t\t\topacity: {\n\t\t\t\tget: function( elem, computed ) {\n\t\t\t\t\tif ( computed ) {\n\t\n\t\t\t\t\t\t// We should always get a number back from opacity\n\t\t\t\t\t\tvar ret = curCSS( elem, \"opacity\" );\n\t\t\t\t\t\treturn ret === \"\" ? \"1\" : ret;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\t// Don't automatically add \"px\" to these possibly-unitless properties\n\t\tcssNumber: {\n\t\t\t\"animationIterationCount\": true,\n\t\t\t\"columnCount\": true,\n\t\t\t\"fillOpacity\": true,\n\t\t\t\"flexGrow\": true,\n\t\t\t\"flexShrink\": true,\n\t\t\t\"fontWeight\": true,\n\t\t\t\"lineHeight\": true,\n\t\t\t\"opacity\": true,\n\t\t\t\"order\": true,\n\t\t\t\"orphans\": true,\n\t\t\t\"widows\": true,\n\t\t\t\"zIndex\": true,\n\t\t\t\"zoom\": true\n\t\t},\n\t\n\t\t// Add in properties whose names you wish to fix before\n\t\t// setting or getting the value\n\t\tcssProps: {\n\t\t\t\"float\": \"cssFloat\"\n\t\t},\n\t\n\t\t// Get and set the style property on a DOM Node\n\t\tstyle: function( elem, name, value, extra ) {\n\t\n\t\t\t// Don't set styles on text and comment nodes\n\t\t\tif ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Make sure that we're working with the right name\n\t\t\tvar ret, type, hooks,\n\t\t\t\torigName = jQuery.camelCase( name ),\n\t\t\t\tstyle = elem.style;\n\t\n\t\t\tname = jQuery.cssProps[ origName ] ||\n\t\t\t\t( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );\n\t\n\t\t\t// Gets hook for the prefixed version, then unprefixed version\n\t\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\t\n\t\t\t// Check if we're setting a value\n\t\t\tif ( value !== undefined ) {\n\t\t\t\ttype = typeof value;\n\t\n\t\t\t\t// Convert \"+=\" or \"-=\" to relative numbers (#7345)\n\t\t\t\tif ( type === \"string\" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {\n\t\t\t\t\tvalue = adjustCSS( elem, name, ret );\n\t\n\t\t\t\t\t// Fixes bug #9237\n\t\t\t\t\ttype = \"number\";\n\t\t\t\t}\n\t\n\t\t\t\t// Make sure that null and NaN values aren't set (#7116)\n\t\t\t\tif ( value == null || value !== value ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\t// If a number was passed in, add the unit (except for certain CSS properties)\n\t\t\t\tif ( type === \"number\" ) {\n\t\t\t\t\tvalue += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? \"\" : \"px\" );\n\t\t\t\t}\n\t\n\t\t\t\t// background-* props affect original clone's values\n\t\t\t\tif ( !support.clearCloneStyle && value === \"\" && name.indexOf( \"background\" ) === 0 ) {\n\t\t\t\t\tstyle[ name ] = \"inherit\";\n\t\t\t\t}\n\t\n\t\t\t\t// If a hook was provided, use that value, otherwise just set the specified value\n\t\t\t\tif ( !hooks || !( \"set\" in hooks ) ||\n\t\t\t\t\t( value = hooks.set( elem, value, extra ) ) !== undefined ) {\n\t\n\t\t\t\t\tstyle[ name ] = value;\n\t\t\t\t}\n\t\n\t\t\t} else {\n\t\n\t\t\t\t// If a hook was provided get the non-computed value from there\n\t\t\t\tif ( hooks && \"get\" in hooks &&\n\t\t\t\t\t( ret = hooks.get( elem, false, extra ) ) !== undefined ) {\n\t\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\n\t\t\t\t// Otherwise just get the value from the style object\n\t\t\t\treturn style[ name ];\n\t\t\t}\n\t\t},\n\t\n\t\tcss: function( elem, name, extra, styles ) {\n\t\t\tvar val, num, hooks,\n\t\t\t\torigName = jQuery.camelCase( name );\n\t\n\t\t\t// Make sure that we're working with the right name\n\t\t\tname = jQuery.cssProps[ origName ] ||\n\t\t\t\t( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );\n\t\n\t\t\t// Try prefixed name followed by the unprefixed name\n\t\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\t\n\t\t\t// If a hook was provided get the computed value from there\n\t\t\tif ( hooks && \"get\" in hooks ) {\n\t\t\t\tval = hooks.get( elem, true, extra );\n\t\t\t}\n\t\n\t\t\t// Otherwise, if a way to get the computed value exists, use that\n\t\t\tif ( val === undefined ) {\n\t\t\t\tval = curCSS( elem, name, styles );\n\t\t\t}\n\t\n\t\t\t// Convert \"normal\" to computed value\n\t\t\tif ( val === \"normal\" && name in cssNormalTransform ) {\n\t\t\t\tval = cssNormalTransform[ name ];\n\t\t\t}\n\t\n\t\t\t// Make numeric if forced or a qualifier was provided and val looks numeric\n\t\t\tif ( extra === \"\" || extra ) {\n\t\t\t\tnum = parseFloat( val );\n\t\t\t\treturn extra === true || isFinite( num ) ? num || 0 : val;\n\t\t\t}\n\t\t\treturn val;\n\t\t}\n\t} );\n\t\n\tjQuery.each( [ \"height\", \"width\" ], function( i, name ) {\n\t\tjQuery.cssHooks[ name ] = {\n\t\t\tget: function( elem, computed, extra ) {\n\t\t\t\tif ( computed ) {\n\t\n\t\t\t\t\t// Certain elements can have dimension info if we invisibly show them\n\t\t\t\t\t// but it must have a current display style that would benefit\n\t\t\t\t\treturn rdisplayswap.test( jQuery.css( elem, \"display\" ) ) &&\n\t\n\t\t\t\t\t\t// Support: Safari 8+\n\t\t\t\t\t\t// Table columns in Safari have non-zero offsetWidth & zero\n\t\t\t\t\t\t// getBoundingClientRect().width unless display is changed.\n\t\t\t\t\t\t// Support: IE <=11 only\n\t\t\t\t\t\t// Running getBoundingClientRect on a disconnected node\n\t\t\t\t\t\t// in IE throws an error.\n\t\t\t\t\t\t( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?\n\t\t\t\t\t\t\tswap( elem, cssShow, function() {\n\t\t\t\t\t\t\t\treturn getWidthOrHeight( elem, name, extra );\n\t\t\t\t\t\t\t} ) :\n\t\t\t\t\t\t\tgetWidthOrHeight( elem, name, extra );\n\t\t\t\t}\n\t\t\t},\n\t\n\t\t\tset: function( elem, value, extra ) {\n\t\t\t\tvar matches,\n\t\t\t\t\tstyles = extra && getStyles( elem ),\n\t\t\t\t\tsubtract = extra && augmentWidthOrHeight(\n\t\t\t\t\t\telem,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\textra,\n\t\t\t\t\t\tjQuery.css( elem, \"boxSizing\", false, styles ) === \"border-box\",\n\t\t\t\t\t\tstyles\n\t\t\t\t\t);\n\t\n\t\t\t\t// Convert to pixels if value adjustment is needed\n\t\t\t\tif ( subtract && ( matches = rcssNum.exec( value ) ) &&\n\t\t\t\t\t( matches[ 3 ] || \"px\" ) !== \"px\" ) {\n\t\n\t\t\t\t\telem.style[ name ] = value;\n\t\t\t\t\tvalue = jQuery.css( elem, name );\n\t\t\t\t}\n\t\n\t\t\t\treturn setPositiveNumber( elem, value, subtract );\n\t\t\t}\n\t\t};\n\t} );\n\t\n\tjQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,\n\t\tfunction( elem, computed ) {\n\t\t\tif ( computed ) {\n\t\t\t\treturn ( parseFloat( curCSS( elem, \"marginLeft\" ) ) ||\n\t\t\t\t\telem.getBoundingClientRect().left -\n\t\t\t\t\t\tswap( elem, { marginLeft: 0 }, function() {\n\t\t\t\t\t\t\treturn elem.getBoundingClientRect().left;\n\t\t\t\t\t\t} )\n\t\t\t\t\t) + \"px\";\n\t\t\t}\n\t\t}\n\t);\n\t\n\t// These hooks are used by animate to expand properties\n\tjQuery.each( {\n\t\tmargin: \"\",\n\t\tpadding: \"\",\n\t\tborder: \"Width\"\n\t}, function( prefix, suffix ) {\n\t\tjQuery.cssHooks[ prefix + suffix ] = {\n\t\t\texpand: function( value ) {\n\t\t\t\tvar i = 0,\n\t\t\t\t\texpanded = {},\n\t\n\t\t\t\t\t// Assumes a single number if not a string\n\t\t\t\t\tparts = typeof value === \"string\" ? value.split( \" \" ) : [ value ];\n\t\n\t\t\t\tfor ( ; i < 4; i++ ) {\n\t\t\t\t\texpanded[ prefix + cssExpand[ i ] + suffix ] =\n\t\t\t\t\t\tparts[ i ] || parts[ i - 2 ] || parts[ 0 ];\n\t\t\t\t}\n\t\n\t\t\t\treturn expanded;\n\t\t\t}\n\t\t};\n\t\n\t\tif ( !rmargin.test( prefix ) ) {\n\t\t\tjQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;\n\t\t}\n\t} );\n\t\n\tjQuery.fn.extend( {\n\t\tcss: function( name, value ) {\n\t\t\treturn access( this, function( elem, name, value ) {\n\t\t\t\tvar styles, len,\n\t\t\t\t\tmap = {},\n\t\t\t\t\ti = 0;\n\t\n\t\t\t\tif ( jQuery.isArray( name ) ) {\n\t\t\t\t\tstyles = getStyles( elem );\n\t\t\t\t\tlen = name.length;\n\t\n\t\t\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\t\t\tmap[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn map;\n\t\t\t\t}\n\t\n\t\t\t\treturn value !== undefined ?\n\t\t\t\t\tjQuery.style( elem, name, value ) :\n\t\t\t\t\tjQuery.css( elem, name );\n\t\t\t}, name, value, arguments.length > 1 );\n\t\t}\n\t} );\n\t\n\t\n\tfunction Tween( elem, options, prop, end, easing ) {\n\t\treturn new Tween.prototype.init( elem, options, prop, end, easing );\n\t}\n\tjQuery.Tween = Tween;\n\t\n\tTween.prototype = {\n\t\tconstructor: Tween,\n\t\tinit: function( elem, options, prop, end, easing, unit ) {\n\t\t\tthis.elem = elem;\n\t\t\tthis.prop = prop;\n\t\t\tthis.easing = easing || jQuery.easing._default;\n\t\t\tthis.options = options;\n\t\t\tthis.start = this.now = this.cur();\n\t\t\tthis.end = end;\n\t\t\tthis.unit = unit || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n\t\t},\n\t\tcur: function() {\n\t\t\tvar hooks = Tween.propHooks[ this.prop ];\n\t\n\t\t\treturn hooks && hooks.get ?\n\t\t\t\thooks.get( this ) :\n\t\t\t\tTween.propHooks._default.get( this );\n\t\t},\n\t\trun: function( percent ) {\n\t\t\tvar eased,\n\t\t\t\thooks = Tween.propHooks[ this.prop ];\n\t\n\t\t\tif ( this.options.duration ) {\n\t\t\t\tthis.pos = eased = jQuery.easing[ this.easing ](\n\t\t\t\t\tpercent, this.options.duration * percent, 0, 1, this.options.duration\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis.pos = eased = percent;\n\t\t\t}\n\t\t\tthis.now = ( this.end - this.start ) * eased + this.start;\n\t\n\t\t\tif ( this.options.step ) {\n\t\t\t\tthis.options.step.call( this.elem, this.now, this );\n\t\t\t}\n\t\n\t\t\tif ( hooks && hooks.set ) {\n\t\t\t\thooks.set( this );\n\t\t\t} else {\n\t\t\t\tTween.propHooks._default.set( this );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t};\n\t\n\tTween.prototype.init.prototype = Tween.prototype;\n\t\n\tTween.propHooks = {\n\t\t_default: {\n\t\t\tget: function( tween ) {\n\t\t\t\tvar result;\n\t\n\t\t\t\t// Use a property on the element directly when it is not a DOM element,\n\t\t\t\t// or when there is no matching style property that exists.\n\t\t\t\tif ( tween.elem.nodeType !== 1 ||\n\t\t\t\t\ttween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {\n\t\t\t\t\treturn tween.elem[ tween.prop ];\n\t\t\t\t}\n\t\n\t\t\t\t// Passing an empty string as a 3rd parameter to .css will automatically\n\t\t\t\t// attempt a parseFloat and fallback to a string if the parse fails.\n\t\t\t\t// Simple values such as \"10px\" are parsed to Float;\n\t\t\t\t// complex values such as \"rotate(1rad)\" are returned as-is.\n\t\t\t\tresult = jQuery.css( tween.elem, tween.prop, \"\" );\n\t\n\t\t\t\t// Empty strings, null, undefined and \"auto\" are converted to 0.\n\t\t\t\treturn !result || result === \"auto\" ? 0 : result;\n\t\t\t},\n\t\t\tset: function( tween ) {\n\t\n\t\t\t\t// Use step hook for back compat.\n\t\t\t\t// Use cssHook if its there.\n\t\t\t\t// Use .style if available and use plain properties where available.\n\t\t\t\tif ( jQuery.fx.step[ tween.prop ] ) {\n\t\t\t\t\tjQuery.fx.step[ tween.prop ]( tween );\n\t\t\t\t} else if ( tween.elem.nodeType === 1 &&\n\t\t\t\t\t( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||\n\t\t\t\t\t\tjQuery.cssHooks[ tween.prop ] ) ) {\n\t\t\t\t\tjQuery.style( tween.elem, tween.prop, tween.now + tween.unit );\n\t\t\t\t} else {\n\t\t\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\t\n\t// Support: IE <=9 only\n\t// Panic based approach to setting things on disconnected nodes\n\tTween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n\t\tset: function( tween ) {\n\t\t\tif ( tween.elem.nodeType && tween.elem.parentNode ) {\n\t\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t\t}\n\t\t}\n\t};\n\t\n\tjQuery.easing = {\n\t\tlinear: function( p ) {\n\t\t\treturn p;\n\t\t},\n\t\tswing: function( p ) {\n\t\t\treturn 0.5 - Math.cos( p * Math.PI ) / 2;\n\t\t},\n\t\t_default: \"swing\"\n\t};\n\t\n\tjQuery.fx = Tween.prototype.init;\n\t\n\t// Back compat <1.8 extension point\n\tjQuery.fx.step = {};\n\t\n\t\n\t\n\t\n\tvar\n\t\tfxNow, timerId,\n\t\trfxtypes = /^(?:toggle|show|hide)$/,\n\t\trrun = /queueHooks$/;\n\t\n\tfunction raf() {\n\t\tif ( timerId ) {\n\t\t\twindow.requestAnimationFrame( raf );\n\t\t\tjQuery.fx.tick();\n\t\t}\n\t}\n\t\n\t// Animations created synchronously will run synchronously\n\tfunction createFxNow() {\n\t\twindow.setTimeout( function() {\n\t\t\tfxNow = undefined;\n\t\t} );\n\t\treturn ( fxNow = jQuery.now() );\n\t}\n\t\n\t// Generate parameters to create a standard animation\n\tfunction genFx( type, includeWidth ) {\n\t\tvar which,\n\t\t\ti = 0,\n\t\t\tattrs = { height: type };\n\t\n\t\t// If we include width, step value is 1 to do all cssExpand values,\n\t\t// otherwise step value is 2 to skip over Left and Right\n\t\tincludeWidth = includeWidth ? 1 : 0;\n\t\tfor ( ; i < 4; i += 2 - includeWidth ) {\n\t\t\twhich = cssExpand[ i ];\n\t\t\tattrs[ \"margin\" + which ] = attrs[ \"padding\" + which ] = type;\n\t\t}\n\t\n\t\tif ( includeWidth ) {\n\t\t\tattrs.opacity = attrs.width = type;\n\t\t}\n\t\n\t\treturn attrs;\n\t}\n\t\n\tfunction createTween( value, prop, animation ) {\n\t\tvar tween,\n\t\t\tcollection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ \"*\" ] ),\n\t\t\tindex = 0,\n\t\t\tlength = collection.length;\n\t\tfor ( ; index < length; index++ ) {\n\t\t\tif ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {\n\t\n\t\t\t\t// We're done with this property\n\t\t\t\treturn tween;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction defaultPrefilter( elem, props, opts ) {\n\t\tvar prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,\n\t\t\tisBox = \"width\" in props || \"height\" in props,\n\t\t\tanim = this,\n\t\t\torig = {},\n\t\t\tstyle = elem.style,\n\t\t\thidden = elem.nodeType && isHiddenWithinTree( elem ),\n\t\t\tdataShow = dataPriv.get( elem, \"fxshow\" );\n\t\n\t\t// Queue-skipping animations hijack the fx hooks\n\t\tif ( !opts.queue ) {\n\t\t\thooks = jQuery._queueHooks( elem, \"fx\" );\n\t\t\tif ( hooks.unqueued == null ) {\n\t\t\t\thooks.unqueued = 0;\n\t\t\t\toldfire = hooks.empty.fire;\n\t\t\t\thooks.empty.fire = function() {\n\t\t\t\t\tif ( !hooks.unqueued ) {\n\t\t\t\t\t\toldfire();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}\n\t\t\thooks.unqueued++;\n\t\n\t\t\tanim.always( function() {\n\t\n\t\t\t\t// Ensure the complete handler is called before this completes\n\t\t\t\tanim.always( function() {\n\t\t\t\t\thooks.unqueued--;\n\t\t\t\t\tif ( !jQuery.queue( elem, \"fx\" ).length ) {\n\t\t\t\t\t\thooks.empty.fire();\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} );\n\t\t}\n\t\n\t\t// Detect show/hide animations\n\t\tfor ( prop in props ) {\n\t\t\tvalue = props[ prop ];\n\t\t\tif ( rfxtypes.test( value ) ) {\n\t\t\t\tdelete props[ prop ];\n\t\t\t\ttoggle = toggle || value === \"toggle\";\n\t\t\t\tif ( value === ( hidden ? \"hide\" : \"show\" ) ) {\n\t\n\t\t\t\t\t// Pretend to be hidden if this is a \"show\" and\n\t\t\t\t\t// there is still data from a stopped show/hide\n\t\t\t\t\tif ( value === \"show\" && dataShow && dataShow[ prop ] !== undefined ) {\n\t\t\t\t\t\thidden = true;\n\t\n\t\t\t\t\t// Ignore all other no-op show/hide data\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\torig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );\n\t\t\t}\n\t\t}\n\t\n\t\t// Bail out if this is a no-op like .hide().hide()\n\t\tpropTween = !jQuery.isEmptyObject( props );\n\t\tif ( !propTween && jQuery.isEmptyObject( orig ) ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\t// Restrict \"overflow\" and \"display\" styles during box animations\n\t\tif ( isBox && elem.nodeType === 1 ) {\n\t\n\t\t\t// Support: IE <=9 - 11, Edge 12 - 13\n\t\t\t// Record all 3 overflow attributes because IE does not infer the shorthand\n\t\t\t// from identically-valued overflowX and overflowY\n\t\t\topts.overflow = [ style.overflow, style.overflowX, style.overflowY ];\n\t\n\t\t\t// Identify a display type, preferring old show/hide data over the CSS cascade\n\t\t\trestoreDisplay = dataShow && dataShow.display;\n\t\t\tif ( restoreDisplay == null ) {\n\t\t\t\trestoreDisplay = dataPriv.get( elem, \"display\" );\n\t\t\t}\n\t\t\tdisplay = jQuery.css( elem, \"display\" );\n\t\t\tif ( display === \"none\" ) {\n\t\t\t\tif ( restoreDisplay ) {\n\t\t\t\t\tdisplay = restoreDisplay;\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// Get nonempty value(s) by temporarily forcing visibility\n\t\t\t\t\tshowHide( [ elem ], true );\n\t\t\t\t\trestoreDisplay = elem.style.display || restoreDisplay;\n\t\t\t\t\tdisplay = jQuery.css( elem, \"display\" );\n\t\t\t\t\tshowHide( [ elem ] );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Animate inline elements as inline-block\n\t\t\tif ( display === \"inline\" || display === \"inline-block\" && restoreDisplay != null ) {\n\t\t\t\tif ( jQuery.css( elem, \"float\" ) === \"none\" ) {\n\t\n\t\t\t\t\t// Restore the original display value at the end of pure show/hide animations\n\t\t\t\t\tif ( !propTween ) {\n\t\t\t\t\t\tanim.done( function() {\n\t\t\t\t\t\t\tstyle.display = restoreDisplay;\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tif ( restoreDisplay == null ) {\n\t\t\t\t\t\t\tdisplay = style.display;\n\t\t\t\t\t\t\trestoreDisplay = display === \"none\" ? \"\" : display;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tstyle.display = \"inline-block\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\tif ( opts.overflow ) {\n\t\t\tstyle.overflow = \"hidden\";\n\t\t\tanim.always( function() {\n\t\t\t\tstyle.overflow = opts.overflow[ 0 ];\n\t\t\t\tstyle.overflowX = opts.overflow[ 1 ];\n\t\t\t\tstyle.overflowY = opts.overflow[ 2 ];\n\t\t\t} );\n\t\t}\n\t\n\t\t// Implement show/hide animations\n\t\tpropTween = false;\n\t\tfor ( prop in orig ) {\n\t\n\t\t\t// General show/hide setup for this element animation\n\t\t\tif ( !propTween ) {\n\t\t\t\tif ( dataShow ) {\n\t\t\t\t\tif ( \"hidden\" in dataShow ) {\n\t\t\t\t\t\thidden = dataShow.hidden;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tdataShow = dataPriv.access( elem, \"fxshow\", { display: restoreDisplay } );\n\t\t\t\t}\n\t\n\t\t\t\t// Store hidden/visible for toggle so `.stop().toggle()` \"reverses\"\n\t\t\t\tif ( toggle ) {\n\t\t\t\t\tdataShow.hidden = !hidden;\n\t\t\t\t}\n\t\n\t\t\t\t// Show elements before animating them\n\t\t\t\tif ( hidden ) {\n\t\t\t\t\tshowHide( [ elem ], true );\n\t\t\t\t}\n\t\n\t\t\t\t/* eslint-disable no-loop-func */\n\t\n\t\t\t\tanim.done( function() {\n\t\n\t\t\t\t/* eslint-enable no-loop-func */\n\t\n\t\t\t\t\t// The final step of a \"hide\" animation is actually hiding the element\n\t\t\t\t\tif ( !hidden ) {\n\t\t\t\t\t\tshowHide( [ elem ] );\n\t\t\t\t\t}\n\t\t\t\t\tdataPriv.remove( elem, \"fxshow\" );\n\t\t\t\t\tfor ( prop in orig ) {\n\t\t\t\t\t\tjQuery.style( elem, prop, orig[ prop ] );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\t// Per-property setup\n\t\t\tpropTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );\n\t\t\tif ( !( prop in dataShow ) ) {\n\t\t\t\tdataShow[ prop ] = propTween.start;\n\t\t\t\tif ( hidden ) {\n\t\t\t\t\tpropTween.end = propTween.start;\n\t\t\t\t\tpropTween.start = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction propFilter( props, specialEasing ) {\n\t\tvar index, name, easing, value, hooks;\n\t\n\t\t// camelCase, specialEasing and expand cssHook pass\n\t\tfor ( index in props ) {\n\t\t\tname = jQuery.camelCase( index );\n\t\t\teasing = specialEasing[ name ];\n\t\t\tvalue = props[ index ];\n\t\t\tif ( jQuery.isArray( value ) ) {\n\t\t\t\teasing = value[ 1 ];\n\t\t\t\tvalue = props[ index ] = value[ 0 ];\n\t\t\t}\n\t\n\t\t\tif ( index !== name ) {\n\t\t\t\tprops[ name ] = value;\n\t\t\t\tdelete props[ index ];\n\t\t\t}\n\t\n\t\t\thooks = jQuery.cssHooks[ name ];\n\t\t\tif ( hooks && \"expand\" in hooks ) {\n\t\t\t\tvalue = hooks.expand( value );\n\t\t\t\tdelete props[ name ];\n\t\n\t\t\t\t// Not quite $.extend, this won't overwrite existing keys.\n\t\t\t\t// Reusing 'index' because we have the correct \"name\"\n\t\t\t\tfor ( index in value ) {\n\t\t\t\t\tif ( !( index in props ) ) {\n\t\t\t\t\t\tprops[ index ] = value[ index ];\n\t\t\t\t\t\tspecialEasing[ index ] = easing;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tspecialEasing[ name ] = easing;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tfunction Animation( elem, properties, options ) {\n\t\tvar result,\n\t\t\tstopped,\n\t\t\tindex = 0,\n\t\t\tlength = Animation.prefilters.length,\n\t\t\tdeferred = jQuery.Deferred().always( function() {\n\t\n\t\t\t\t// Don't match elem in the :animated selector\n\t\t\t\tdelete tick.elem;\n\t\t\t} ),\n\t\t\ttick = function() {\n\t\t\t\tif ( stopped ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tvar currentTime = fxNow || createFxNow(),\n\t\t\t\t\tremaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),\n\t\n\t\t\t\t\t// Support: Android 2.3 only\n\t\t\t\t\t// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)\n\t\t\t\t\ttemp = remaining / animation.duration || 0,\n\t\t\t\t\tpercent = 1 - temp,\n\t\t\t\t\tindex = 0,\n\t\t\t\t\tlength = animation.tweens.length;\n\t\n\t\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\t\tanimation.tweens[ index ].run( percent );\n\t\t\t\t}\n\t\n\t\t\t\tdeferred.notifyWith( elem, [ animation, percent, remaining ] );\n\t\n\t\t\t\tif ( percent < 1 && length ) {\n\t\t\t\t\treturn remaining;\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.resolveWith( elem, [ animation ] );\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t\tanimation = deferred.promise( {\n\t\t\t\telem: elem,\n\t\t\t\tprops: jQuery.extend( {}, properties ),\n\t\t\t\topts: jQuery.extend( true, {\n\t\t\t\t\tspecialEasing: {},\n\t\t\t\t\teasing: jQuery.easing._default\n\t\t\t\t}, options ),\n\t\t\t\toriginalProperties: properties,\n\t\t\t\toriginalOptions: options,\n\t\t\t\tstartTime: fxNow || createFxNow(),\n\t\t\t\tduration: options.duration,\n\t\t\t\ttweens: [],\n\t\t\t\tcreateTween: function( prop, end ) {\n\t\t\t\t\tvar tween = jQuery.Tween( elem, animation.opts, prop, end,\n\t\t\t\t\t\t\tanimation.opts.specialEasing[ prop ] || animation.opts.easing );\n\t\t\t\t\tanimation.tweens.push( tween );\n\t\t\t\t\treturn tween;\n\t\t\t\t},\n\t\t\t\tstop: function( gotoEnd ) {\n\t\t\t\t\tvar index = 0,\n\t\n\t\t\t\t\t\t// If we are going to the end, we want to run all the tweens\n\t\t\t\t\t\t// otherwise we skip this part\n\t\t\t\t\t\tlength = gotoEnd ? animation.tweens.length : 0;\n\t\t\t\t\tif ( stopped ) {\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t}\n\t\t\t\t\tstopped = true;\n\t\t\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\t\t\tanimation.tweens[ index ].run( 1 );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Resolve when we played the last frame; otherwise, reject\n\t\t\t\t\tif ( gotoEnd ) {\n\t\t\t\t\t\tdeferred.notifyWith( elem, [ animation, 1, 0 ] );\n\t\t\t\t\t\tdeferred.resolveWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdeferred.rejectWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t} ),\n\t\t\tprops = animation.props;\n\t\n\t\tpropFilter( props, animation.opts.specialEasing );\n\t\n\t\tfor ( ; index < length; index++ ) {\n\t\t\tresult = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );\n\t\t\tif ( result ) {\n\t\t\t\tif ( jQuery.isFunction( result.stop ) ) {\n\t\t\t\t\tjQuery._queueHooks( animation.elem, animation.opts.queue ).stop =\n\t\t\t\t\t\tjQuery.proxy( result.stop, result );\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\n\t\tjQuery.map( props, createTween, animation );\n\t\n\t\tif ( jQuery.isFunction( animation.opts.start ) ) {\n\t\t\tanimation.opts.start.call( elem, animation );\n\t\t}\n\t\n\t\tjQuery.fx.timer(\n\t\t\tjQuery.extend( tick, {\n\t\t\t\telem: elem,\n\t\t\t\tanim: animation,\n\t\t\t\tqueue: animation.opts.queue\n\t\t\t} )\n\t\t);\n\t\n\t\t// attach callbacks from options\n\t\treturn animation.progress( animation.opts.progress )\n\t\t\t.done( animation.opts.done, animation.opts.complete )\n\t\t\t.fail( animation.opts.fail )\n\t\t\t.always( animation.opts.always );\n\t}\n\t\n\tjQuery.Animation = jQuery.extend( Animation, {\n\t\n\t\ttweeners: {\n\t\t\t\"*\": [ function( prop, value ) {\n\t\t\t\tvar tween = this.createTween( prop, value );\n\t\t\t\tadjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );\n\t\t\t\treturn tween;\n\t\t\t} ]\n\t\t},\n\t\n\t\ttweener: function( props, callback ) {\n\t\t\tif ( jQuery.isFunction( props ) ) {\n\t\t\t\tcallback = props;\n\t\t\t\tprops = [ \"*\" ];\n\t\t\t} else {\n\t\t\t\tprops = props.match( rnotwhite );\n\t\t\t}\n\t\n\t\t\tvar prop,\n\t\t\t\tindex = 0,\n\t\t\t\tlength = props.length;\n\t\n\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\tprop = props[ index ];\n\t\t\t\tAnimation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];\n\t\t\t\tAnimation.tweeners[ prop ].unshift( callback );\n\t\t\t}\n\t\t},\n\t\n\t\tprefilters: [ defaultPrefilter ],\n\t\n\t\tprefilter: function( callback, prepend ) {\n\t\t\tif ( prepend ) {\n\t\t\t\tAnimation.prefilters.unshift( callback );\n\t\t\t} else {\n\t\t\t\tAnimation.prefilters.push( callback );\n\t\t\t}\n\t\t}\n\t} );\n\t\n\tjQuery.speed = function( speed, easing, fn ) {\n\t\tvar opt = speed && typeof speed === \"object\" ? jQuery.extend( {}, speed ) : {\n\t\t\tcomplete: fn || !fn && easing ||\n\t\t\t\tjQuery.isFunction( speed ) && speed,\n\t\t\tduration: speed,\n\t\t\teasing: fn && easing || easing && !jQuery.isFunction( easing ) && easing\n\t\t};\n\t\n\t\t// Go to the end state if fx are off or if document is hidden\n\t\tif ( jQuery.fx.off || document.hidden ) {\n\t\t\topt.duration = 0;\n\t\n\t\t} else {\n\t\t\topt.duration = typeof opt.duration === \"number\" ?\n\t\t\t\topt.duration : opt.duration in jQuery.fx.speeds ?\n\t\t\t\t\tjQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;\n\t\t}\n\t\n\t\t// Normalize opt.queue - true/undefined/null -> \"fx\"\n\t\tif ( opt.queue == null || opt.queue === true ) {\n\t\t\topt.queue = \"fx\";\n\t\t}\n\t\n\t\t// Queueing\n\t\topt.old = opt.complete;\n\t\n\t\topt.complete = function() {\n\t\t\tif ( jQuery.isFunction( opt.old ) ) {\n\t\t\t\topt.old.call( this );\n\t\t\t}\n\t\n\t\t\tif ( opt.queue ) {\n\t\t\t\tjQuery.dequeue( this, opt.queue );\n\t\t\t}\n\t\t};\n\t\n\t\treturn opt;\n\t};\n\t\n\tjQuery.fn.extend( {\n\t\tfadeTo: function( speed, to, easing, callback ) {\n\t\n\t\t\t// Show any hidden elements after setting opacity to 0\n\t\t\treturn this.filter( isHiddenWithinTree ).css( \"opacity\", 0 ).show()\n\t\n\t\t\t\t// Animate to the value specified\n\t\t\t\t.end().animate( { opacity: to }, speed, easing, callback );\n\t\t},\n\t\tanimate: function( prop, speed, easing, callback ) {\n\t\t\tvar empty = jQuery.isEmptyObject( prop ),\n\t\t\t\toptall = jQuery.speed( speed, easing, callback ),\n\t\t\t\tdoAnimation = function() {\n\t\n\t\t\t\t\t// Operate on a copy of prop so per-property easing won't be lost\n\t\t\t\t\tvar anim = Animation( this, jQuery.extend( {}, prop ), optall );\n\t\n\t\t\t\t\t// Empty animations, or finishing resolves immediately\n\t\t\t\t\tif ( empty || dataPriv.get( this, \"finish\" ) ) {\n\t\t\t\t\t\tanim.stop( true );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tdoAnimation.finish = doAnimation;\n\t\n\t\t\treturn empty || optall.queue === false ?\n\t\t\t\tthis.each( doAnimation ) :\n\t\t\t\tthis.queue( optall.queue, doAnimation );\n\t\t},\n\t\tstop: function( type, clearQueue, gotoEnd ) {\n\t\t\tvar stopQueue = function( hooks ) {\n\t\t\t\tvar stop = hooks.stop;\n\t\t\t\tdelete hooks.stop;\n\t\t\t\tstop( gotoEnd );\n\t\t\t};\n\t\n\t\t\tif ( typeof type !== \"string\" ) {\n\t\t\t\tgotoEnd = clearQueue;\n\t\t\t\tclearQueue = type;\n\t\t\t\ttype = undefined;\n\t\t\t}\n\t\t\tif ( clearQueue && type !== false ) {\n\t\t\t\tthis.queue( type || \"fx\", [] );\n\t\t\t}\n\t\n\t\t\treturn this.each( function() {\n\t\t\t\tvar dequeue = true,\n\t\t\t\t\tindex = type != null && type + \"queueHooks\",\n\t\t\t\t\ttimers = jQuery.timers,\n\t\t\t\t\tdata = dataPriv.get( this );\n\t\n\t\t\t\tif ( index ) {\n\t\t\t\t\tif ( data[ index ] && data[ index ].stop ) {\n\t\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor ( index in data ) {\n\t\t\t\t\t\tif ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {\n\t\t\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\t\tif ( timers[ index ].elem === this &&\n\t\t\t\t\t\t( type == null || timers[ index ].queue === type ) ) {\n\t\n\t\t\t\t\t\ttimers[ index ].anim.stop( gotoEnd );\n\t\t\t\t\t\tdequeue = false;\n\t\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Start the next in the queue if the last step wasn't forced.\n\t\t\t\t// Timers currently will call their complete callbacks, which\n\t\t\t\t// will dequeue but only if they were gotoEnd.\n\t\t\t\tif ( dequeue || !gotoEnd ) {\n\t\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\tfinish: function( type ) {\n\t\t\tif ( type !== false ) {\n\t\t\t\ttype = type || \"fx\";\n\t\t\t}\n\t\t\treturn this.each( function() {\n\t\t\t\tvar index,\n\t\t\t\t\tdata = dataPriv.get( this ),\n\t\t\t\t\tqueue = data[ type + \"queue\" ],\n\t\t\t\t\thooks = data[ type + \"queueHooks\" ],\n\t\t\t\t\ttimers = jQuery.timers,\n\t\t\t\t\tlength = queue ? queue.length : 0;\n\t\n\t\t\t\t// Enable finishing flag on private data\n\t\t\t\tdata.finish = true;\n\t\n\t\t\t\t// Empty the queue first\n\t\t\t\tjQuery.queue( this, type, [] );\n\t\n\t\t\t\tif ( hooks && hooks.stop ) {\n\t\t\t\t\thooks.stop.call( this, true );\n\t\t\t\t}\n\t\n\t\t\t\t// Look for any active animations, and finish them\n\t\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\t\tif ( timers[ index ].elem === this && timers[ index ].queue === type ) {\n\t\t\t\t\t\ttimers[ index ].anim.stop( true );\n\t\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Look for any animations in the old queue and finish them\n\t\t\t\tfor ( index = 0; index < length; index++ ) {\n\t\t\t\t\tif ( queue[ index ] && queue[ index ].finish ) {\n\t\t\t\t\t\tqueue[ index ].finish.call( this );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Turn off finishing flag\n\t\t\t\tdelete data.finish;\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\tjQuery.each( [ \"toggle\", \"show\", \"hide\" ], function( i, name ) {\n\t\tvar cssFn = jQuery.fn[ name ];\n\t\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\t\treturn speed == null || typeof speed === \"boolean\" ?\n\t\t\t\tcssFn.apply( this, arguments ) :\n\t\t\t\tthis.animate( genFx( name, true ), speed, easing, callback );\n\t\t};\n\t} );\n\t\n\t// Generate shortcuts for custom animations\n\tjQuery.each( {\n\t\tslideDown: genFx( \"show\" ),\n\t\tslideUp: genFx( \"hide\" ),\n\t\tslideToggle: genFx( \"toggle\" ),\n\t\tfadeIn: { opacity: \"show\" },\n\t\tfadeOut: { opacity: \"hide\" },\n\t\tfadeToggle: { opacity: \"toggle\" }\n\t}, function( name, props ) {\n\t\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\t\treturn this.animate( props, speed, easing, callback );\n\t\t};\n\t} );\n\t\n\tjQuery.timers = [];\n\tjQuery.fx.tick = function() {\n\t\tvar timer,\n\t\t\ti = 0,\n\t\t\ttimers = jQuery.timers;\n\t\n\t\tfxNow = jQuery.now();\n\t\n\t\tfor ( ; i < timers.length; i++ ) {\n\t\t\ttimer = timers[ i ];\n\t\n\t\t\t// Checks the timer has not already been removed\n\t\t\tif ( !timer() && timers[ i ] === timer ) {\n\t\t\t\ttimers.splice( i--, 1 );\n\t\t\t}\n\t\t}\n\t\n\t\tif ( !timers.length ) {\n\t\t\tjQuery.fx.stop();\n\t\t}\n\t\tfxNow = undefined;\n\t};\n\t\n\tjQuery.fx.timer = function( timer ) {\n\t\tjQuery.timers.push( timer );\n\t\tif ( timer() ) {\n\t\t\tjQuery.fx.start();\n\t\t} else {\n\t\t\tjQuery.timers.pop();\n\t\t}\n\t};\n\t\n\tjQuery.fx.interval = 13;\n\tjQuery.fx.start = function() {\n\t\tif ( !timerId ) {\n\t\t\ttimerId = window.requestAnimationFrame ?\n\t\t\t\twindow.requestAnimationFrame( raf ) :\n\t\t\t\twindow.setInterval( jQuery.fx.tick, jQuery.fx.interval );\n\t\t}\n\t};\n\t\n\tjQuery.fx.stop = function() {\n\t\tif ( window.cancelAnimationFrame ) {\n\t\t\twindow.cancelAnimationFrame( timerId );\n\t\t} else {\n\t\t\twindow.clearInterval( timerId );\n\t\t}\n\t\n\t\ttimerId = null;\n\t};\n\t\n\tjQuery.fx.speeds = {\n\t\tslow: 600,\n\t\tfast: 200,\n\t\n\t\t// Default speed\n\t\t_default: 400\n\t};\n\t\n\t\n\t// Based off of the plugin by Clint Helfers, with permission.\n\t// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/\n\tjQuery.fn.delay = function( time, type ) {\n\t\ttime = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\n\t\ttype = type || \"fx\";\n\t\n\t\treturn this.queue( type, function( next, hooks ) {\n\t\t\tvar timeout = window.setTimeout( next, time );\n\t\t\thooks.stop = function() {\n\t\t\t\twindow.clearTimeout( timeout );\n\t\t\t};\n\t\t} );\n\t};\n\t\n\t\n\t( function() {\n\t\tvar input = document.createElement( \"input\" ),\n\t\t\tselect = document.createElement( \"select\" ),\n\t\t\topt = select.appendChild( document.createElement( \"option\" ) );\n\t\n\t\tinput.type = \"checkbox\";\n\t\n\t\t// Support: Android <=4.3 only\n\t\t// Default value for a checkbox should be \"on\"\n\t\tsupport.checkOn = input.value !== \"\";\n\t\n\t\t// Support: IE <=11 only\n\t\t// Must access selectedIndex to make default options select\n\t\tsupport.optSelected = opt.selected;\n\t\n\t\t// Support: IE <=11 only\n\t\t// An input loses its value after becoming a radio\n\t\tinput = document.createElement( \"input\" );\n\t\tinput.value = \"t\";\n\t\tinput.type = \"radio\";\n\t\tsupport.radioValue = input.value === \"t\";\n\t} )();\n\t\n\t\n\tvar boolHook,\n\t\tattrHandle = jQuery.expr.attrHandle;\n\t\n\tjQuery.fn.extend( {\n\t\tattr: function( name, value ) {\n\t\t\treturn access( this, jQuery.attr, name, value, arguments.length > 1 );\n\t\t},\n\t\n\t\tremoveAttr: function( name ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tjQuery.removeAttr( this, name );\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\tjQuery.extend( {\n\t\tattr: function( elem, name, value ) {\n\t\t\tvar ret, hooks,\n\t\t\t\tnType = elem.nodeType;\n\t\n\t\t\t// Don't get/set attributes on text, comment and attribute nodes\n\t\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Fallback to prop when attributes are not supported\n\t\t\tif ( typeof elem.getAttribute === \"undefined\" ) {\n\t\t\t\treturn jQuery.prop( elem, name, value );\n\t\t\t}\n\t\n\t\t\t// Attribute hooks are determined by the lowercase version\n\t\t\t// Grab necessary hook if one is defined\n\t\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\t\t\t\thooks = jQuery.attrHooks[ name.toLowerCase() ] ||\n\t\t\t\t\t( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );\n\t\t\t}\n\t\n\t\t\tif ( value !== undefined ) {\n\t\t\t\tif ( value === null ) {\n\t\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tif ( hooks && \"set\" in hooks &&\n\t\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\n\t\t\t\telem.setAttribute( name, value + \"\" );\n\t\t\t\treturn value;\n\t\t\t}\n\t\n\t\t\tif ( hooks && \"get\" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\n\t\t\tret = jQuery.find.attr( elem, name );\n\t\n\t\t\t// Non-existent attributes return null, we normalize to undefined\n\t\t\treturn ret == null ? undefined : ret;\n\t\t},\n\t\n\t\tattrHooks: {\n\t\t\ttype: {\n\t\t\t\tset: function( elem, value ) {\n\t\t\t\t\tif ( !support.radioValue && value === \"radio\" &&\n\t\t\t\t\t\tjQuery.nodeName( elem, \"input\" ) ) {\n\t\t\t\t\t\tvar val = elem.value;\n\t\t\t\t\t\telem.setAttribute( \"type\", value );\n\t\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\t\telem.value = val;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\tremoveAttr: function( elem, value ) {\n\t\t\tvar name,\n\t\t\t\ti = 0,\n\t\t\t\tattrNames = value && value.match( rnotwhite );\n\t\n\t\t\tif ( attrNames && elem.nodeType === 1 ) {\n\t\t\t\twhile ( ( name = attrNames[ i++ ] ) ) {\n\t\t\t\t\telem.removeAttribute( name );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t// Hooks for boolean attributes\n\tboolHook = {\n\t\tset: function( elem, value, name ) {\n\t\t\tif ( value === false ) {\n\t\n\t\t\t\t// Remove boolean attributes when set to false\n\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t} else {\n\t\t\t\telem.setAttribute( name, name );\n\t\t\t}\n\t\t\treturn name;\n\t\t}\n\t};\n\t\n\tjQuery.each( jQuery.expr.match.bool.source.match( /\\w+/g ), function( i, name ) {\n\t\tvar getter = attrHandle[ name ] || jQuery.find.attr;\n\t\n\t\tattrHandle[ name ] = function( elem, name, isXML ) {\n\t\t\tvar ret, handle,\n\t\t\t\tlowercaseName = name.toLowerCase();\n\t\n\t\t\tif ( !isXML ) {\n\t\n\t\t\t\t// Avoid an infinite loop by temporarily removing this function from the getter\n\t\t\t\thandle = attrHandle[ lowercaseName ];\n\t\t\t\tattrHandle[ lowercaseName ] = ret;\n\t\t\t\tret = getter( elem, name, isXML ) != null ?\n\t\t\t\t\tlowercaseName :\n\t\t\t\t\tnull;\n\t\t\t\tattrHandle[ lowercaseName ] = handle;\n\t\t\t}\n\t\t\treturn ret;\n\t\t};\n\t} );\n\t\n\t\n\t\n\t\n\tvar rfocusable = /^(?:input|select|textarea|button)$/i,\n\t\trclickable = /^(?:a|area)$/i;\n\t\n\tjQuery.fn.extend( {\n\t\tprop: function( name, value ) {\n\t\t\treturn access( this, jQuery.prop, name, value, arguments.length > 1 );\n\t\t},\n\t\n\t\tremoveProp: function( name ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tdelete this[ jQuery.propFix[ name ] || name ];\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\tjQuery.extend( {\n\t\tprop: function( elem, name, value ) {\n\t\t\tvar ret, hooks,\n\t\t\t\tnType = elem.nodeType;\n\t\n\t\t\t// Don't get/set properties on text, comment and attribute nodes\n\t\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\t\n\t\t\t\t// Fix name and attach hooks\n\t\t\t\tname = jQuery.propFix[ name ] || name;\n\t\t\t\thooks = jQuery.propHooks[ name ];\n\t\t\t}\n\t\n\t\t\tif ( value !== undefined ) {\n\t\t\t\tif ( hooks && \"set\" in hooks &&\n\t\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\t\n\t\t\t\treturn ( elem[ name ] = value );\n\t\t\t}\n\t\n\t\t\tif ( hooks && \"get\" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\n\t\t\treturn elem[ name ];\n\t\t},\n\t\n\t\tpropHooks: {\n\t\t\ttabIndex: {\n\t\t\t\tget: function( elem ) {\n\t\n\t\t\t\t\t// Support: IE <=9 - 11 only\n\t\t\t\t\t// elem.tabIndex doesn't always return the\n\t\t\t\t\t// correct value when it hasn't been explicitly set\n\t\t\t\t\t// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n\t\t\t\t\t// Use proper attribute retrieval(#12072)\n\t\t\t\t\tvar tabindex = jQuery.find.attr( elem, \"tabindex\" );\n\t\n\t\t\t\t\treturn tabindex ?\n\t\t\t\t\t\tparseInt( tabindex, 10 ) :\n\t\t\t\t\t\trfocusable.test( elem.nodeName ) ||\n\t\t\t\t\t\t\trclickable.test( elem.nodeName ) && elem.href ?\n\t\t\t\t\t\t\t\t0 :\n\t\t\t\t\t\t\t\t-1;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\n\t\tpropFix: {\n\t\t\t\"for\": \"htmlFor\",\n\t\t\t\"class\": \"className\"\n\t\t}\n\t} );\n\t\n\t// Support: IE <=11 only\n\t// Accessing the selectedIndex property\n\t// forces the browser to respect setting selected\n\t// on the option\n\t// The getter ensures a default option is selected\n\t// when in an optgroup\n\tif ( !support.optSelected ) {\n\t\tjQuery.propHooks.selected = {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar parent = elem.parentNode;\n\t\t\t\tif ( parent && parent.parentNode ) {\n\t\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t\t}\n\t\t\t\treturn null;\n\t\t\t},\n\t\t\tset: function( elem ) {\n\t\t\t\tvar parent = elem.parentNode;\n\t\t\t\tif ( parent ) {\n\t\t\t\t\tparent.selectedIndex;\n\t\n\t\t\t\t\tif ( parent.parentNode ) {\n\t\t\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\t\n\tjQuery.each( [\n\t\t\"tabIndex\",\n\t\t\"readOnly\",\n\t\t\"maxLength\",\n\t\t\"cellSpacing\",\n\t\t\"cellPadding\",\n\t\t\"rowSpan\",\n\t\t\"colSpan\",\n\t\t\"useMap\",\n\t\t\"frameBorder\",\n\t\t\"contentEditable\"\n\t], function() {\n\t\tjQuery.propFix[ this.toLowerCase() ] = this;\n\t} );\n\t\n\t\n\t\n\t\n\tvar rclass = /[\\t\\r\\n\\f]/g;\n\t\n\tfunction getClass( elem ) {\n\t\treturn elem.getAttribute && elem.getAttribute( \"class\" ) || \"\";\n\t}\n\t\n\tjQuery.fn.extend( {\n\t\taddClass: function( value ) {\n\t\t\tvar classes, elem, cur, curValue, clazz, j, finalValue,\n\t\t\t\ti = 0;\n\t\n\t\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\t\treturn this.each( function( j ) {\n\t\t\t\t\tjQuery( this ).addClass( value.call( this, j, getClass( this ) ) );\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\tif ( typeof value === \"string\" && value ) {\n\t\t\t\tclasses = value.match( rnotwhite ) || [];\n\t\n\t\t\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\t\t\tcurValue = getClass( elem );\n\t\t\t\t\tcur = elem.nodeType === 1 &&\n\t\t\t\t\t\t( \" \" + curValue + \" \" ).replace( rclass, \" \" );\n\t\n\t\t\t\t\tif ( cur ) {\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\twhile ( ( clazz = classes[ j++ ] ) ) {\n\t\t\t\t\t\t\tif ( cur.indexOf( \" \" + clazz + \" \" ) < 0 ) {\n\t\t\t\t\t\t\t\tcur += clazz + \" \";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\t\tfinalValue = jQuery.trim( cur );\n\t\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\t\telem.setAttribute( \"class\", finalValue );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn this;\n\t\t},\n\t\n\t\tremoveClass: function( value ) {\n\t\t\tvar classes, elem, cur, curValue, clazz, j, finalValue,\n\t\t\t\ti = 0;\n\t\n\t\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\t\treturn this.each( function( j ) {\n\t\t\t\t\tjQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\tif ( !arguments.length ) {\n\t\t\t\treturn this.attr( \"class\", \"\" );\n\t\t\t}\n\t\n\t\t\tif ( typeof value === \"string\" && value ) {\n\t\t\t\tclasses = value.match( rnotwhite ) || [];\n\t\n\t\t\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\t\t\tcurValue = getClass( elem );\n\t\n\t\t\t\t\t// This expression is here for better compressibility (see addClass)\n\t\t\t\t\tcur = elem.nodeType === 1 &&\n\t\t\t\t\t\t( \" \" + curValue + \" \" ).replace( rclass, \" \" );\n\t\n\t\t\t\t\tif ( cur ) {\n\t\t\t\t\t\tj = 0;\n\t\t\t\t\t\twhile ( ( clazz = classes[ j++ ] ) ) {\n\t\n\t\t\t\t\t\t\t// Remove *all* instances\n\t\t\t\t\t\t\twhile ( cur.indexOf( \" \" + clazz + \" \" ) > -1 ) {\n\t\t\t\t\t\t\t\tcur = cur.replace( \" \" + clazz + \" \", \" \" );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\t\tfinalValue = jQuery.trim( cur );\n\t\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\t\telem.setAttribute( \"class\", finalValue );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn this;\n\t\t},\n\t\n\t\ttoggleClass: function( value, stateVal ) {\n\t\t\tvar type = typeof value;\n\t\n\t\t\tif ( typeof stateVal === \"boolean\" && type === \"string\" ) {\n\t\t\t\treturn stateVal ? this.addClass( value ) : this.removeClass( value );\n\t\t\t}\n\t\n\t\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\t\treturn this.each( function( i ) {\n\t\t\t\t\tjQuery( this ).toggleClass(\n\t\t\t\t\t\tvalue.call( this, i, getClass( this ), stateVal ),\n\t\t\t\t\t\tstateVal\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\treturn this.each( function() {\n\t\t\t\tvar className, i, self, classNames;\n\t\n\t\t\t\tif ( type === \"string\" ) {\n\t\n\t\t\t\t\t// Toggle individual class names\n\t\t\t\t\ti = 0;\n\t\t\t\t\tself = jQuery( this );\n\t\t\t\t\tclassNames = value.match( rnotwhite ) || [];\n\t\n\t\t\t\t\twhile ( ( className = classNames[ i++ ] ) ) {\n\t\n\t\t\t\t\t\t// Check each className given, space separated list\n\t\t\t\t\t\tif ( self.hasClass( className ) ) {\n\t\t\t\t\t\t\tself.removeClass( className );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tself.addClass( className );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t// Toggle whole class name\n\t\t\t\t} else if ( value === undefined || type === \"boolean\" ) {\n\t\t\t\t\tclassName = getClass( this );\n\t\t\t\t\tif ( className ) {\n\t\n\t\t\t\t\t\t// Store className if set\n\t\t\t\t\t\tdataPriv.set( this, \"__className__\", className );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// If the element has a class name or if we're passed `false`,\n\t\t\t\t\t// then remove the whole classname (if there was one, the above saved it).\n\t\t\t\t\t// Otherwise bring back whatever was previously saved (if anything),\n\t\t\t\t\t// falling back to the empty string if nothing was stored.\n\t\t\t\t\tif ( this.setAttribute ) {\n\t\t\t\t\t\tthis.setAttribute( \"class\",\n\t\t\t\t\t\t\tclassName || value === false ?\n\t\t\t\t\t\t\t\"\" :\n\t\t\t\t\t\t\tdataPriv.get( this, \"__className__\" ) || \"\"\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\thasClass: function( selector ) {\n\t\t\tvar className, elem,\n\t\t\t\ti = 0;\n\t\n\t\t\tclassName = \" \" + selector + \" \";\n\t\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\t\tif ( elem.nodeType === 1 &&\n\t\t\t\t\t( \" \" + getClass( elem ) + \" \" ).replace( rclass, \" \" )\n\t\t\t\t\t\t.indexOf( className ) > -1\n\t\t\t\t) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn false;\n\t\t}\n\t} );\n\t\n\t\n\t\n\t\n\tvar rreturn = /\\r/g,\n\t\trspaces = /[\\x20\\t\\r\\n\\f]+/g;\n\t\n\tjQuery.fn.extend( {\n\t\tval: function( value ) {\n\t\t\tvar hooks, ret, isFunction,\n\t\t\t\telem = this[ 0 ];\n\t\n\t\t\tif ( !arguments.length ) {\n\t\t\t\tif ( elem ) {\n\t\t\t\t\thooks = jQuery.valHooks[ elem.type ] ||\n\t\t\t\t\t\tjQuery.valHooks[ elem.nodeName.toLowerCase() ];\n\t\n\t\t\t\t\tif ( hooks &&\n\t\t\t\t\t\t\"get\" in hooks &&\n\t\t\t\t\t\t( ret = hooks.get( elem, \"value\" ) ) !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn ret;\n\t\t\t\t\t}\n\t\n\t\t\t\t\tret = elem.value;\n\t\n\t\t\t\t\treturn typeof ret === \"string\" ?\n\t\n\t\t\t\t\t\t// Handle most common string cases\n\t\t\t\t\t\tret.replace( rreturn, \"\" ) :\n\t\n\t\t\t\t\t\t// Handle cases where value is null/undef or number\n\t\t\t\t\t\tret == null ? \"\" : ret;\n\t\t\t\t}\n\t\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tisFunction = jQuery.isFunction( value );\n\t\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tvar val;\n\t\n\t\t\t\tif ( this.nodeType !== 1 ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tif ( isFunction ) {\n\t\t\t\t\tval = value.call( this, i, jQuery( this ).val() );\n\t\t\t\t} else {\n\t\t\t\t\tval = value;\n\t\t\t\t}\n\t\n\t\t\t\t// Treat null/undefined as \"\"; convert numbers to string\n\t\t\t\tif ( val == null ) {\n\t\t\t\t\tval = \"\";\n\t\n\t\t\t\t} else if ( typeof val === \"number\" ) {\n\t\t\t\t\tval += \"\";\n\t\n\t\t\t\t} else if ( jQuery.isArray( val ) ) {\n\t\t\t\t\tval = jQuery.map( val, function( value ) {\n\t\t\t\t\t\treturn value == null ? \"\" : value + \"\";\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\n\t\t\t\thooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\n\t\n\t\t\t\t// If set returns undefined, fall back to normal setting\n\t\t\t\tif ( !hooks || !( \"set\" in hooks ) || hooks.set( this, val, \"value\" ) === undefined ) {\n\t\t\t\t\tthis.value = val;\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\tjQuery.extend( {\n\t\tvalHooks: {\n\t\t\toption: {\n\t\t\t\tget: function( elem ) {\n\t\n\t\t\t\t\tvar val = jQuery.find.attr( elem, \"value\" );\n\t\t\t\t\treturn val != null ?\n\t\t\t\t\t\tval :\n\t\n\t\t\t\t\t\t// Support: IE <=10 - 11 only\n\t\t\t\t\t\t// option.text throws exceptions (#14686, #14858)\n\t\t\t\t\t\t// Strip and collapse whitespace\n\t\t\t\t\t\t// https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n\t\t\t\t\t\tjQuery.trim( jQuery.text( elem ) ).replace( rspaces, \" \" );\n\t\t\t\t}\n\t\t\t},\n\t\t\tselect: {\n\t\t\t\tget: function( elem ) {\n\t\t\t\t\tvar value, option,\n\t\t\t\t\t\toptions = elem.options,\n\t\t\t\t\t\tindex = elem.selectedIndex,\n\t\t\t\t\t\tone = elem.type === \"select-one\",\n\t\t\t\t\t\tvalues = one ? null : [],\n\t\t\t\t\t\tmax = one ? index + 1 : options.length,\n\t\t\t\t\t\ti = index < 0 ?\n\t\t\t\t\t\t\tmax :\n\t\t\t\t\t\t\tone ? index : 0;\n\t\n\t\t\t\t\t// Loop through all the selected options\n\t\t\t\t\tfor ( ; i < max; i++ ) {\n\t\t\t\t\t\toption = options[ i ];\n\t\n\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t// IE8-9 doesn't update selected after form reset (#2551)\n\t\t\t\t\t\tif ( ( option.selected || i === index ) &&\n\t\n\t\t\t\t\t\t\t\t// Don't return options that are disabled or in a disabled optgroup\n\t\t\t\t\t\t\t\t!option.disabled &&\n\t\t\t\t\t\t\t\t( !option.parentNode.disabled ||\n\t\t\t\t\t\t\t\t\t!jQuery.nodeName( option.parentNode, \"optgroup\" ) ) ) {\n\t\n\t\t\t\t\t\t\t// Get the specific value for the option\n\t\t\t\t\t\t\tvalue = jQuery( option ).val();\n\t\n\t\t\t\t\t\t\t// We don't need an array for one selects\n\t\t\t\t\t\t\tif ( one ) {\n\t\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t\t// Multi-Selects return an array\n\t\t\t\t\t\t\tvalues.push( value );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn values;\n\t\t\t\t},\n\t\n\t\t\t\tset: function( elem, value ) {\n\t\t\t\t\tvar optionSet, option,\n\t\t\t\t\t\toptions = elem.options,\n\t\t\t\t\t\tvalues = jQuery.makeArray( value ),\n\t\t\t\t\t\ti = options.length;\n\t\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\toption = options[ i ];\n\t\n\t\t\t\t\t\t/* eslint-disable no-cond-assign */\n\t\n\t\t\t\t\t\tif ( option.selected =\n\t\t\t\t\t\t\tjQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\toptionSet = true;\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t/* eslint-enable no-cond-assign */\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Force browsers to behave consistently when non-matching value is set\n\t\t\t\t\tif ( !optionSet ) {\n\t\t\t\t\t\telem.selectedIndex = -1;\n\t\t\t\t\t}\n\t\t\t\t\treturn values;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t// Radios and checkboxes getter/setter\n\tjQuery.each( [ \"radio\", \"checkbox\" ], function() {\n\t\tjQuery.valHooks[ this ] = {\n\t\t\tset: function( elem, value ) {\n\t\t\t\tif ( jQuery.isArray( value ) ) {\n\t\t\t\t\treturn ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\tif ( !support.checkOn ) {\n\t\t\tjQuery.valHooks[ this ].get = function( elem ) {\n\t\t\t\treturn elem.getAttribute( \"value\" ) === null ? \"on\" : elem.value;\n\t\t\t};\n\t\t}\n\t} );\n\t\n\t\n\t\n\t\n\t// Return jQuery for attributes-only inclusion\n\t\n\t\n\tvar rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;\n\t\n\tjQuery.extend( jQuery.event, {\n\t\n\t\ttrigger: function( event, data, elem, onlyHandlers ) {\n\t\n\t\t\tvar i, cur, tmp, bubbleType, ontype, handle, special,\n\t\t\t\teventPath = [ elem || document ],\n\t\t\t\ttype = hasOwn.call( event, \"type\" ) ? event.type : event,\n\t\t\t\tnamespaces = hasOwn.call( event, \"namespace\" ) ? event.namespace.split( \".\" ) : [];\n\t\n\t\t\tcur = tmp = elem = elem || document;\n\t\n\t\t\t// Don't do events on text and comment nodes\n\t\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// focus/blur morphs to focusin/out; ensure we're not firing them right now\n\t\t\tif ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tif ( type.indexOf( \".\" ) > -1 ) {\n\t\n\t\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\t\tnamespaces = type.split( \".\" );\n\t\t\t\ttype = namespaces.shift();\n\t\t\t\tnamespaces.sort();\n\t\t\t}\n\t\t\tontype = type.indexOf( \":\" ) < 0 && \"on\" + type;\n\t\n\t\t\t// Caller can pass in a jQuery.Event object, Object, or just an event type string\n\t\t\tevent = event[ jQuery.expando ] ?\n\t\t\t\tevent :\n\t\t\t\tnew jQuery.Event( type, typeof event === \"object\" && event );\n\t\n\t\t\t// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\t\t\tevent.isTrigger = onlyHandlers ? 2 : 3;\n\t\t\tevent.namespace = namespaces.join( \".\" );\n\t\t\tevent.rnamespace = event.namespace ?\n\t\t\t\tnew RegExp( \"(^|\\\\.)\" + namespaces.join( \"\\\\.(?:.*\\\\.|)\" ) + \"(\\\\.|$)\" ) :\n\t\t\t\tnull;\n\t\n\t\t\t// Clean up the event in case it is being reused\n\t\t\tevent.result = undefined;\n\t\t\tif ( !event.target ) {\n\t\t\t\tevent.target = elem;\n\t\t\t}\n\t\n\t\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\t\tdata = data == null ?\n\t\t\t\t[ event ] :\n\t\t\t\tjQuery.makeArray( data, [ event ] );\n\t\n\t\t\t// Allow special events to draw outside the lines\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\tif ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Determine event propagation path in advance, per W3C events spec (#9951)\n\t\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\t\t\tif ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {\n\t\n\t\t\t\tbubbleType = special.delegateType || type;\n\t\t\t\tif ( !rfocusMorph.test( bubbleType + type ) ) {\n\t\t\t\t\tcur = cur.parentNode;\n\t\t\t\t}\n\t\t\t\tfor ( ; cur; cur = cur.parentNode ) {\n\t\t\t\t\teventPath.push( cur );\n\t\t\t\t\ttmp = cur;\n\t\t\t\t}\n\t\n\t\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\t\tif ( tmp === ( elem.ownerDocument || document ) ) {\n\t\t\t\t\teventPath.push( tmp.defaultView || tmp.parentWindow || window );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Fire handlers on the event path\n\t\t\ti = 0;\n\t\t\twhile ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\n\t\t\t\tevent.type = i > 1 ?\n\t\t\t\t\tbubbleType :\n\t\t\t\t\tspecial.bindType || type;\n\t\n\t\t\t\t// jQuery handler\n\t\t\t\thandle = ( dataPriv.get( cur, \"events\" ) || {} )[ event.type ] &&\n\t\t\t\t\tdataPriv.get( cur, \"handle\" );\n\t\t\t\tif ( handle ) {\n\t\t\t\t\thandle.apply( cur, data );\n\t\t\t\t}\n\t\n\t\t\t\t// Native handler\n\t\t\t\thandle = ontype && cur[ ontype ];\n\t\t\t\tif ( handle && handle.apply && acceptData( cur ) ) {\n\t\t\t\t\tevent.result = handle.apply( cur, data );\n\t\t\t\t\tif ( event.result === false ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tevent.type = type;\n\t\n\t\t\t// If nobody prevented the default action, do it now\n\t\t\tif ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\t\n\t\t\t\tif ( ( !special._default ||\n\t\t\t\t\tspecial._default.apply( eventPath.pop(), data ) === false ) &&\n\t\t\t\t\tacceptData( elem ) ) {\n\t\n\t\t\t\t\t// Call a native DOM method on the target with the same name as the event.\n\t\t\t\t\t// Don't do default actions on window, that's where global variables be (#6170)\n\t\t\t\t\tif ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {\n\t\n\t\t\t\t\t\t// Don't re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\t\ttmp = elem[ ontype ];\n\t\n\t\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t\t}\n\t\n\t\t\t\t\t\t// Prevent re-triggering of the same event, since we already bubbled it above\n\t\t\t\t\t\tjQuery.event.triggered = type;\n\t\t\t\t\t\telem[ type ]();\n\t\t\t\t\t\tjQuery.event.triggered = undefined;\n\t\n\t\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\t\telem[ ontype ] = tmp;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn event.result;\n\t\t},\n\t\n\t\t// Piggyback on a donor event to simulate a different one\n\t\t// Used only for `focus(in | out)` events\n\t\tsimulate: function( type, elem, event ) {\n\t\t\tvar e = jQuery.extend(\n\t\t\t\tnew jQuery.Event(),\n\t\t\t\tevent,\n\t\t\t\t{\n\t\t\t\t\ttype: type,\n\t\t\t\t\tisSimulated: true\n\t\t\t\t}\n\t\t\t);\n\t\n\t\t\tjQuery.event.trigger( e, null, elem );\n\t\t}\n\t\n\t} );\n\t\n\tjQuery.fn.extend( {\n\t\n\t\ttrigger: function( type, data ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tjQuery.event.trigger( type, data, this );\n\t\t\t} );\n\t\t},\n\t\ttriggerHandler: function( type, data ) {\n\t\t\tvar elem = this[ 0 ];\n\t\t\tif ( elem ) {\n\t\t\t\treturn jQuery.event.trigger( type, data, elem, true );\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t\n\tjQuery.each( ( \"blur focus focusin focusout resize scroll click dblclick \" +\n\t\t\"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n\t\t\"change select submit keydown keypress keyup contextmenu\" ).split( \" \" ),\n\t\tfunction( i, name ) {\n\t\n\t\t// Handle event binding\n\t\tjQuery.fn[ name ] = function( data, fn ) {\n\t\t\treturn arguments.length > 0 ?\n\t\t\t\tthis.on( name, null, data, fn ) :\n\t\t\t\tthis.trigger( name );\n\t\t};\n\t} );\n\t\n\tjQuery.fn.extend( {\n\t\thover: function( fnOver, fnOut ) {\n\t\t\treturn this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\n\t\t}\n\t} );\n\t\n\t\n\t\n\t\n\tsupport.focusin = \"onfocusin\" in window;\n\t\n\t\n\t// Support: Firefox <=44\n\t// Firefox doesn't have focus(in | out) events\n\t// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n\t//\n\t// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n\t// focus(in | out) events fire after focus & blur events,\n\t// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n\t// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\n\tif ( !support.focusin ) {\n\t\tjQuery.each( { focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\t\n\t\t\t// Attach a single capturing handler on the document while someone wants focusin/focusout\n\t\t\tvar handler = function( event ) {\n\t\t\t\tjQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );\n\t\t\t};\n\t\n\t\t\tjQuery.event.special[ fix ] = {\n\t\t\t\tsetup: function() {\n\t\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\t\tattaches = dataPriv.access( doc, fix );\n\t\n\t\t\t\t\tif ( !attaches ) {\n\t\t\t\t\t\tdoc.addEventListener( orig, handler, true );\n\t\t\t\t\t}\n\t\t\t\t\tdataPriv.access( doc, fix, ( attaches || 0 ) + 1 );\n\t\t\t\t},\n\t\t\t\tteardown: function() {\n\t\t\t\t\tvar doc = this.ownerDocument || this,\n\t\t\t\t\t\tattaches = dataPriv.access( doc, fix ) - 1;\n\t\n\t\t\t\t\tif ( !attaches ) {\n\t\t\t\t\t\tdoc.removeEventListener( orig, handler, true );\n\t\t\t\t\t\tdataPriv.remove( doc, fix );\n\t\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdataPriv.access( doc, fix, attaches );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t} );\n\t}\n\tvar location = window.location;\n\t\n\tvar nonce = jQuery.now();\n\t\n\tvar rquery = ( /\\?/ );\n\t\n\t\n\t\n\t// Cross-browser xml parsing\n\tjQuery.parseXML = function( data ) {\n\t\tvar xml;\n\t\tif ( !data || typeof data !== \"string\" ) {\n\t\t\treturn null;\n\t\t}\n\t\n\t\t// Support: IE 9 - 11 only\n\t\t// IE throws on parseFromString with invalid input.\n\t\ttry {\n\t\t\txml = ( new window.DOMParser() ).parseFromString( data, \"text/xml\" );\n\t\t} catch ( e ) {\n\t\t\txml = undefined;\n\t\t}\n\t\n\t\tif ( !xml || xml.getElementsByTagName( \"parsererror\" ).length ) {\n\t\t\tjQuery.error( \"Invalid XML: \" + data );\n\t\t}\n\t\treturn xml;\n\t};\n\t\n\t\n\tvar\n\t\trbracket = /\\[\\]$/,\n\t\trCRLF = /\\r?\\n/g,\n\t\trsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,\n\t\trsubmittable = /^(?:input|select|textarea|keygen)/i;\n\t\n\tfunction buildParams( prefix, obj, traditional, add ) {\n\t\tvar name;\n\t\n\t\tif ( jQuery.isArray( obj ) ) {\n\t\n\t\t\t// Serialize array item.\n\t\t\tjQuery.each( obj, function( i, v ) {\n\t\t\t\tif ( traditional || rbracket.test( prefix ) ) {\n\t\n\t\t\t\t\t// Treat each array item as a scalar.\n\t\t\t\t\tadd( prefix, v );\n\t\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// Item is non-scalar (array or object), encode its numeric index.\n\t\t\t\t\tbuildParams(\n\t\t\t\t\t\tprefix + \"[\" + ( typeof v === \"object\" && v != null ? i : \"\" ) + \"]\",\n\t\t\t\t\t\tv,\n\t\t\t\t\t\ttraditional,\n\t\t\t\t\t\tadd\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} );\n\t\n\t\t} else if ( !traditional && jQuery.type( obj ) === \"object\" ) {\n\t\n\t\t\t// Serialize object item.\n\t\t\tfor ( name in obj ) {\n\t\t\t\tbuildParams( prefix + \"[\" + name + \"]\", obj[ name ], traditional, add );\n\t\t\t}\n\t\n\t\t} else {\n\t\n\t\t\t// Serialize scalar item.\n\t\t\tadd( prefix, obj );\n\t\t}\n\t}\n\t\n\t// Serialize an array of form elements or a set of\n\t// key/values into a query string\n\tjQuery.param = function( a, traditional ) {\n\t\tvar prefix,\n\t\t\ts = [],\n\t\t\tadd = function( key, valueOrFunction ) {\n\t\n\t\t\t\t// If value is a function, invoke it and use its return value\n\t\t\t\tvar value = jQuery.isFunction( valueOrFunction ) ?\n\t\t\t\t\tvalueOrFunction() :\n\t\t\t\t\tvalueOrFunction;\n\t\n\t\t\t\ts[ s.length ] = encodeURIComponent( key ) + \"=\" +\n\t\t\t\t\tencodeURIComponent( value == null ? \"\" : value );\n\t\t\t};\n\t\n\t\t// If an array was passed in, assume that it is an array of form elements.\n\t\tif ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n\t\n\t\t\t// Serialize the form elements\n\t\t\tjQuery.each( a, function() {\n\t\t\t\tadd( this.name, this.value );\n\t\t\t} );\n\t\n\t\t} else {\n\t\n\t\t\t// If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t\t\t// did it), otherwise encode params recursively.\n\t\t\tfor ( prefix in a ) {\n\t\t\t\tbuildParams( prefix, a[ prefix ], traditional, add );\n\t\t\t}\n\t\t}\n\t\n\t\t// Return the resulting serialization\n\t\treturn s.join( \"&\" );\n\t};\n\t\n\tjQuery.fn.extend( {\n\t\tserialize: function() {\n\t\t\treturn jQuery.param( this.serializeArray() );\n\t\t},\n\t\tserializeArray: function() {\n\t\t\treturn this.map( function() {\n\t\n\t\t\t\t// Can add propHook for \"elements\" to filter or add form elements\n\t\t\t\tvar elements = jQuery.prop( this, \"elements\" );\n\t\t\t\treturn elements ? jQuery.makeArray( elements ) : this;\n\t\t\t} )\n\t\t\t.filter( function() {\n\t\t\t\tvar type = this.type;\n\t\n\t\t\t\t// Use .is( \":disabled\" ) so that fieldset[disabled] works\n\t\t\t\treturn this.name && !jQuery( this ).is( \":disabled\" ) &&\n\t\t\t\t\trsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&\n\t\t\t\t\t( this.checked || !rcheckableType.test( type ) );\n\t\t\t} )\n\t\t\t.map( function( i, elem ) {\n\t\t\t\tvar val = jQuery( this ).val();\n\t\n\t\t\t\treturn val == null ?\n\t\t\t\t\tnull :\n\t\t\t\t\tjQuery.isArray( val ) ?\n\t\t\t\t\t\tjQuery.map( val, function( val ) {\n\t\t\t\t\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t\t\t\t\t} ) :\n\t\t\t\t\t\t{ name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t\t} ).get();\n\t\t}\n\t} );\n\t\n\t\n\tvar\n\t\tr20 = /%20/g,\n\t\trhash = /#.*$/,\n\t\trts = /([?&])_=[^&]*/,\n\t\trheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg,\n\t\n\t\t// #7653, #8125, #8152: local protocol detection\n\t\trlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,\n\t\trnoContent = /^(?:GET|HEAD)$/,\n\t\trprotocol = /^\\/\\//,\n\t\n\t\t/* Prefilters\n\t\t * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n\t\t * 2) These are called:\n\t\t *    - BEFORE asking for a transport\n\t\t *    - AFTER param serialization (s.data is a string if s.processData is true)\n\t\t * 3) key is the dataType\n\t\t * 4) the catchall symbol \"*\" can be used\n\t\t * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n\t\t */\n\t\tprefilters = {},\n\t\n\t\t/* Transports bindings\n\t\t * 1) key is the dataType\n\t\t * 2) the catchall symbol \"*\" can be used\n\t\t * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n\t\t */\n\t\ttransports = {},\n\t\n\t\t// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n\t\tallTypes = \"*/\".concat( \"*\" ),\n\t\n\t\t// Anchor tag for parsing the document origin\n\t\toriginAnchor = document.createElement( \"a\" );\n\t\toriginAnchor.href = location.href;\n\t\n\t// Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\n\tfunction addToPrefiltersOrTransports( structure ) {\n\t\n\t\t// dataTypeExpression is optional and defaults to \"*\"\n\t\treturn function( dataTypeExpression, func ) {\n\t\n\t\t\tif ( typeof dataTypeExpression !== \"string\" ) {\n\t\t\t\tfunc = dataTypeExpression;\n\t\t\t\tdataTypeExpression = \"*\";\n\t\t\t}\n\t\n\t\t\tvar dataType,\n\t\t\t\ti = 0,\n\t\t\t\tdataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || [];\n\t\n\t\t\tif ( jQuery.isFunction( func ) ) {\n\t\n\t\t\t\t// For each dataType in the dataTypeExpression\n\t\t\t\twhile ( ( dataType = dataTypes[ i++ ] ) ) {\n\t\n\t\t\t\t\t// Prepend if requested\n\t\t\t\t\tif ( dataType[ 0 ] === \"+\" ) {\n\t\t\t\t\t\tdataType = dataType.slice( 1 ) || \"*\";\n\t\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );\n\t\n\t\t\t\t\t// Otherwise append\n\t\t\t\t\t} else {\n\t\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).push( func );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n\t\n\t// Base inspection function for prefilters and transports\n\tfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {\n\t\n\t\tvar inspected = {},\n\t\t\tseekingTransport = ( structure === transports );\n\t\n\t\tfunction inspect( dataType ) {\n\t\t\tvar selected;\n\t\t\tinspected[ dataType ] = true;\n\t\t\tjQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {\n\t\t\t\tvar dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );\n\t\t\t\tif ( typeof dataTypeOrTransport === \"string\" &&\n\t\t\t\t\t!seekingTransport && !inspected[ dataTypeOrTransport ] ) {\n\t\n\t\t\t\t\toptions.dataTypes.unshift( dataTypeOrTransport );\n\t\t\t\t\tinspect( dataTypeOrTransport );\n\t\t\t\t\treturn false;\n\t\t\t\t} else if ( seekingTransport ) {\n\t\t\t\t\treturn !( selected = dataTypeOrTransport );\n\t\t\t\t}\n\t\t\t} );\n\t\t\treturn selected;\n\t\t}\n\t\n\t\treturn inspect( options.dataTypes[ 0 ] ) || !inspected[ \"*\" ] && inspect( \"*\" );\n\t}\n\t\n\t// A special extend for ajax options\n\t// that takes \"flat\" options (not to be deep extended)\n\t// Fixes #9887\n\tfunction ajaxExtend( target, src ) {\n\t\tvar key, deep,\n\t\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\t\n\t\tfor ( key in src ) {\n\t\t\tif ( src[ key ] !== undefined ) {\n\t\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t\t}\n\t\t}\n\t\tif ( deep ) {\n\t\t\tjQuery.extend( true, target, deep );\n\t\t}\n\t\n\t\treturn target;\n\t}\n\t\n\t/* Handles responses to an ajax request:\n\t * - finds the right dataType (mediates between content-type and expected dataType)\n\t * - returns the corresponding response\n\t */\n\tfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\t\n\t\tvar ct, type, finalDataType, firstDataType,\n\t\t\tcontents = s.contents,\n\t\t\tdataTypes = s.dataTypes;\n\t\n\t\t// Remove auto dataType and get content-type in the process\n\t\twhile ( dataTypes[ 0 ] === \"*\" ) {\n\t\t\tdataTypes.shift();\n\t\t\tif ( ct === undefined ) {\n\t\t\t\tct = s.mimeType || jqXHR.getResponseHeader( \"Content-Type\" );\n\t\t\t}\n\t\t}\n\t\n\t\t// Check if we're dealing with a known content-type\n\t\tif ( ct ) {\n\t\t\tfor ( type in contents ) {\n\t\t\t\tif ( contents[ type ] && contents[ type ].test( ct ) ) {\n\t\t\t\t\tdataTypes.unshift( type );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\t// Check to see if we have a response for the expected dataType\n\t\tif ( dataTypes[ 0 ] in responses ) {\n\t\t\tfinalDataType = dataTypes[ 0 ];\n\t\t} else {\n\t\n\t\t\t// Try convertible dataTypes\n\t\t\tfor ( type in responses ) {\n\t\t\t\tif ( !dataTypes[ 0 ] || s.converters[ type + \" \" + dataTypes[ 0 ] ] ) {\n\t\t\t\t\tfinalDataType = type;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( !firstDataType ) {\n\t\t\t\t\tfirstDataType = type;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Or just use first one\n\t\t\tfinalDataType = finalDataType || firstDataType;\n\t\t}\n\t\n\t\t// If we found a dataType\n\t\t// We add the dataType to the list if needed\n\t\t// and return the corresponding response\n\t\tif ( finalDataType ) {\n\t\t\tif ( finalDataType !== dataTypes[ 0 ] ) {\n\t\t\t\tdataTypes.unshift( finalDataType );\n\t\t\t}\n\t\t\treturn responses[ finalDataType ];\n\t\t}\n\t}\n\t\n\t/* Chain conversions given the request and the original response\n\t * Also sets the responseXXX fields on the jqXHR instance\n\t */\n\tfunction ajaxConvert( s, response, jqXHR, isSuccess ) {\n\t\tvar conv2, current, conv, tmp, prev,\n\t\t\tconverters = {},\n\t\n\t\t\t// Work with a copy of dataTypes in case we need to modify it for conversion\n\t\t\tdataTypes = s.dataTypes.slice();\n\t\n\t\t// Create converters map with lowercased keys\n\t\tif ( dataTypes[ 1 ] ) {\n\t\t\tfor ( conv in s.converters ) {\n\t\t\t\tconverters[ conv.toLowerCase() ] = s.converters[ conv ];\n\t\t\t}\n\t\t}\n\t\n\t\tcurrent = dataTypes.shift();\n\t\n\t\t// Convert to each sequential dataType\n\t\twhile ( current ) {\n\t\n\t\t\tif ( s.responseFields[ current ] ) {\n\t\t\t\tjqXHR[ s.responseFields[ current ] ] = response;\n\t\t\t}\n\t\n\t\t\t// Apply the dataFilter if provided\n\t\t\tif ( !prev && isSuccess && s.dataFilter ) {\n\t\t\t\tresponse = s.dataFilter( response, s.dataType );\n\t\t\t}\n\t\n\t\t\tprev = current;\n\t\t\tcurrent = dataTypes.shift();\n\t\n\t\t\tif ( current ) {\n\t\n\t\t\t\t// There's only work to do if current dataType is non-auto\n\t\t\t\tif ( current === \"*\" ) {\n\t\n\t\t\t\t\tcurrent = prev;\n\t\n\t\t\t\t// Convert response if prev dataType is non-auto and differs from current\n\t\t\t\t} else if ( prev !== \"*\" && prev !== current ) {\n\t\n\t\t\t\t\t// Seek a direct converter\n\t\t\t\t\tconv = converters[ prev + \" \" + current ] || converters[ \"* \" + current ];\n\t\n\t\t\t\t\t// If none found, seek a pair\n\t\t\t\t\tif ( !conv ) {\n\t\t\t\t\t\tfor ( conv2 in converters ) {\n\t\n\t\t\t\t\t\t\t// If conv2 outputs current\n\t\t\t\t\t\t\ttmp = conv2.split( \" \" );\n\t\t\t\t\t\t\tif ( tmp[ 1 ] === current ) {\n\t\n\t\t\t\t\t\t\t\t// If prev can be converted to accepted input\n\t\t\t\t\t\t\t\tconv = converters[ prev + \" \" + tmp[ 0 ] ] ||\n\t\t\t\t\t\t\t\t\tconverters[ \"* \" + tmp[ 0 ] ];\n\t\t\t\t\t\t\t\tif ( conv ) {\n\t\n\t\t\t\t\t\t\t\t\t// Condense equivalence converters\n\t\t\t\t\t\t\t\t\tif ( conv === true ) {\n\t\t\t\t\t\t\t\t\t\tconv = converters[ conv2 ];\n\t\n\t\t\t\t\t\t\t\t\t// Otherwise, insert the intermediate dataType\n\t\t\t\t\t\t\t\t\t} else if ( converters[ conv2 ] !== true ) {\n\t\t\t\t\t\t\t\t\t\tcurrent = tmp[ 0 ];\n\t\t\t\t\t\t\t\t\t\tdataTypes.unshift( tmp[ 1 ] );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Apply converter (if not an equivalence)\n\t\t\t\t\tif ( conv !== true ) {\n\t\n\t\t\t\t\t\t// Unless errors are allowed to bubble, catch and return them\n\t\t\t\t\t\tif ( conv && s.throws ) {\n\t\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tstate: \"parsererror\",\n\t\t\t\t\t\t\t\t\terror: conv ? e : \"No conversion from \" + prev + \" to \" + current\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\t\treturn { state: \"success\", data: response };\n\t}\n\t\n\tjQuery.extend( {\n\t\n\t\t// Counter for holding the number of active queries\n\t\tactive: 0,\n\t\n\t\t// Last-Modified header cache for next request\n\t\tlastModified: {},\n\t\tetag: {},\n\t\n\t\tajaxSettings: {\n\t\t\turl: location.href,\n\t\t\ttype: \"GET\",\n\t\t\tisLocal: rlocalProtocol.test( location.protocol ),\n\t\t\tglobal: true,\n\t\t\tprocessData: true,\n\t\t\tasync: true,\n\t\t\tcontentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n\t\n\t\t\t/*\n\t\t\ttimeout: 0,\n\t\t\tdata: null,\n\t\t\tdataType: null,\n\t\t\tusername: null,\n\t\t\tpassword: null,\n\t\t\tcache: null,\n\t\t\tthrows: false,\n\t\t\ttraditional: false,\n\t\t\theaders: {},\n\t\t\t*/\n\t\n\t\t\taccepts: {\n\t\t\t\t\"*\": allTypes,\n\t\t\t\ttext: \"text/plain\",\n\t\t\t\thtml: \"text/html\",\n\t\t\t\txml: \"application/xml, text/xml\",\n\t\t\t\tjson: \"application/json, text/javascript\"\n\t\t\t},\n\t\n\t\t\tcontents: {\n\t\t\t\txml: /\\bxml\\b/,\n\t\t\t\thtml: /\\bhtml/,\n\t\t\t\tjson: /\\bjson\\b/\n\t\t\t},\n\t\n\t\t\tresponseFields: {\n\t\t\t\txml: \"responseXML\",\n\t\t\t\ttext: \"responseText\",\n\t\t\t\tjson: \"responseJSON\"\n\t\t\t},\n\t\n\t\t\t// Data converters\n\t\t\t// Keys separate source (or catchall \"*\") and destination types with a single space\n\t\t\tconverters: {\n\t\n\t\t\t\t// Convert anything to text\n\t\t\t\t\"* text\": String,\n\t\n\t\t\t\t// Text to html (true = no transformation)\n\t\t\t\t\"text html\": true,\n\t\n\t\t\t\t// Evaluate text as a json expression\n\t\t\t\t\"text json\": JSON.parse,\n\t\n\t\t\t\t// Parse text as xml\n\t\t\t\t\"text xml\": jQuery.parseXML\n\t\t\t},\n\t\n\t\t\t// For options that shouldn't be deep extended:\n\t\t\t// you can add your own custom options here if\n\t\t\t// and when you create one that shouldn't be\n\t\t\t// deep extended (see ajaxExtend)\n\t\t\tflatOptions: {\n\t\t\t\turl: true,\n\t\t\t\tcontext: true\n\t\t\t}\n\t\t},\n\t\n\t\t// Creates a full fledged settings object into target\n\t\t// with both ajaxSettings and settings fields.\n\t\t// If target is omitted, writes into ajaxSettings.\n\t\tajaxSetup: function( target, settings ) {\n\t\t\treturn settings ?\n\t\n\t\t\t\t// Building a settings object\n\t\t\t\tajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :\n\t\n\t\t\t\t// Extending ajaxSettings\n\t\t\t\tajaxExtend( jQuery.ajaxSettings, target );\n\t\t},\n\t\n\t\tajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n\t\tajaxTransport: addToPrefiltersOrTransports( transports ),\n\t\n\t\t// Main method\n\t\tajax: function( url, options ) {\n\t\n\t\t\t// If url is an object, simulate pre-1.5 signature\n\t\t\tif ( typeof url === \"object\" ) {\n\t\t\t\toptions = url;\n\t\t\t\turl = undefined;\n\t\t\t}\n\t\n\t\t\t// Force options to be an object\n\t\t\toptions = options || {};\n\t\n\t\t\tvar transport,\n\t\n\t\t\t\t// URL without anti-cache param\n\t\t\t\tcacheURL,\n\t\n\t\t\t\t// Response headers\n\t\t\t\tresponseHeadersString,\n\t\t\t\tresponseHeaders,\n\t\n\t\t\t\t// timeout handle\n\t\t\t\ttimeoutTimer,\n\t\n\t\t\t\t// Url cleanup var\n\t\t\t\turlAnchor,\n\t\n\t\t\t\t// Request state (becomes false upon send and true upon completion)\n\t\t\t\tcompleted,\n\t\n\t\t\t\t// To know if global events are to be dispatched\n\t\t\t\tfireGlobals,\n\t\n\t\t\t\t// Loop variable\n\t\t\t\ti,\n\t\n\t\t\t\t// uncached part of the url\n\t\t\t\tuncached,\n\t\n\t\t\t\t// Create the final options object\n\t\t\t\ts = jQuery.ajaxSetup( {}, options ),\n\t\n\t\t\t\t// Callbacks context\n\t\t\t\tcallbackContext = s.context || s,\n\t\n\t\t\t\t// Context for global events is callbackContext if it is a DOM node or jQuery collection\n\t\t\t\tglobalEventContext = s.context &&\n\t\t\t\t\t( callbackContext.nodeType || callbackContext.jquery ) ?\n\t\t\t\t\t\tjQuery( callbackContext ) :\n\t\t\t\t\t\tjQuery.event,\n\t\n\t\t\t\t// Deferreds\n\t\t\t\tdeferred = jQuery.Deferred(),\n\t\t\t\tcompleteDeferred = jQuery.Callbacks( \"once memory\" ),\n\t\n\t\t\t\t// Status-dependent callbacks\n\t\t\t\tstatusCode = s.statusCode || {},\n\t\n\t\t\t\t// Headers (they are sent all at once)\n\t\t\t\trequestHeaders = {},\n\t\t\t\trequestHeadersNames = {},\n\t\n\t\t\t\t// Default abort message\n\t\t\t\tstrAbort = \"canceled\",\n\t\n\t\t\t\t// Fake xhr\n\t\t\t\tjqXHR = {\n\t\t\t\t\treadyState: 0,\n\t\n\t\t\t\t\t// Builds headers hashtable if needed\n\t\t\t\t\tgetResponseHeader: function( key ) {\n\t\t\t\t\t\tvar match;\n\t\t\t\t\t\tif ( completed ) {\n\t\t\t\t\t\t\tif ( !responseHeaders ) {\n\t\t\t\t\t\t\t\tresponseHeaders = {};\n\t\t\t\t\t\t\t\twhile ( ( match = rheaders.exec( responseHeadersString ) ) ) {\n\t\t\t\t\t\t\t\t\tresponseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmatch = responseHeaders[ key.toLowerCase() ];\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn match == null ? null : match;\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// Raw string\n\t\t\t\t\tgetAllResponseHeaders: function() {\n\t\t\t\t\t\treturn completed ? responseHeadersString : null;\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// Caches the header\n\t\t\t\t\tsetRequestHeader: function( name, value ) {\n\t\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\t\tname = requestHeadersNames[ name.toLowerCase() ] =\n\t\t\t\t\t\t\t\trequestHeadersNames[ name.toLowerCase() ] || name;\n\t\t\t\t\t\t\trequestHeaders[ name ] = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// Overrides response content-type header\n\t\t\t\t\toverrideMimeType: function( type ) {\n\t\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\t\ts.mimeType = type;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// Status-dependent callbacks\n\t\t\t\t\tstatusCode: function( map ) {\n\t\t\t\t\t\tvar code;\n\t\t\t\t\t\tif ( map ) {\n\t\t\t\t\t\t\tif ( completed ) {\n\t\n\t\t\t\t\t\t\t\t// Execute the appropriate callbacks\n\t\t\t\t\t\t\t\tjqXHR.always( map[ jqXHR.status ] );\n\t\t\t\t\t\t\t} else {\n\t\n\t\t\t\t\t\t\t\t// Lazy-add the new callbacks in a way that preserves old ones\n\t\t\t\t\t\t\t\tfor ( code in map ) {\n\t\t\t\t\t\t\t\t\tstatusCode[ code ] = [ statusCode[ code ], map[ code ] ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t},\n\t\n\t\t\t\t\t// Cancel the request\n\t\t\t\t\tabort: function( statusText ) {\n\t\t\t\t\t\tvar finalText = statusText || strAbort;\n\t\t\t\t\t\tif ( transport ) {\n\t\t\t\t\t\t\ttransport.abort( finalText );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdone( 0, finalText );\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\n\t\t\t// Attach deferreds\n\t\t\tdeferred.promise( jqXHR );\n\t\n\t\t\t// Add protocol if not provided (prefilters might expect it)\n\t\t\t// Handle falsy url in the settings object (#10093: consistency with old signature)\n\t\t\t// We also use the url parameter if available\n\t\t\ts.url = ( ( url || s.url || location.href ) + \"\" )\n\t\t\t\t.replace( rprotocol, location.protocol + \"//\" );\n\t\n\t\t\t// Alias method option to type as per ticket #12004\n\t\t\ts.type = options.method || options.type || s.method || s.type;\n\t\n\t\t\t// Extract dataTypes list\n\t\t\ts.dataTypes = ( s.dataType || \"*\" ).toLowerCase().match( rnotwhite ) || [ \"\" ];\n\t\n\t\t\t// A cross-domain request is in order when the origin doesn't match the current origin.\n\t\t\tif ( s.crossDomain == null ) {\n\t\t\t\turlAnchor = document.createElement( \"a\" );\n\t\n\t\t\t\t// Support: IE <=8 - 11, Edge 12 - 13\n\t\t\t\t// IE throws exception on accessing the href property if url is malformed,\n\t\t\t\t// e.g. http://example.com:80x/\n\t\t\t\ttry {\n\t\t\t\t\turlAnchor.href = s.url;\n\t\n\t\t\t\t\t// Support: IE <=8 - 11 only\n\t\t\t\t\t// Anchor's host property isn't correctly set when s.url is relative\n\t\t\t\t\turlAnchor.href = urlAnchor.href;\n\t\t\t\t\ts.crossDomain = originAnchor.protocol + \"//\" + originAnchor.host !==\n\t\t\t\t\t\turlAnchor.protocol + \"//\" + urlAnchor.host;\n\t\t\t\t} catch ( e ) {\n\t\n\t\t\t\t\t// If there is an error parsing the URL, assume it is crossDomain,\n\t\t\t\t\t// it can be rejected by the transport if it is invalid\n\t\t\t\t\ts.crossDomain = true;\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Convert data if not already a string\n\t\t\tif ( s.data && s.processData && typeof s.data !== \"string\" ) {\n\t\t\t\ts.data = jQuery.param( s.data, s.traditional );\n\t\t\t}\n\t\n\t\t\t// Apply prefilters\n\t\t\tinspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\t\n\t\t\t// If request was aborted inside a prefilter, stop there\n\t\t\tif ( completed ) {\n\t\t\t\treturn jqXHR;\n\t\t\t}\n\t\n\t\t\t// We can fire global events as of now if asked to\n\t\t\t// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)\n\t\t\tfireGlobals = jQuery.event && s.global;\n\t\n\t\t\t// Watch for a new set of requests\n\t\t\tif ( fireGlobals && jQuery.active++ === 0 ) {\n\t\t\t\tjQuery.event.trigger( \"ajaxStart\" );\n\t\t\t}\n\t\n\t\t\t// Uppercase the type\n\t\t\ts.type = s.type.toUpperCase();\n\t\n\t\t\t// Determine if request has content\n\t\t\ts.hasContent = !rnoContent.test( s.type );\n\t\n\t\t\t// Save the URL in case we're toying with the If-Modified-Since\n\t\t\t// and/or If-None-Match header later on\n\t\t\t// Remove hash to simplify url manipulation\n\t\t\tcacheURL = s.url.replace( rhash, \"\" );\n\t\n\t\t\t// More options handling for requests with no content\n\t\t\tif ( !s.hasContent ) {\n\t\n\t\t\t\t// Remember the hash so we can put it back\n\t\t\t\tuncached = s.url.slice( cacheURL.length );\n\t\n\t\t\t\t// If data is available, append data to url\n\t\t\t\tif ( s.data ) {\n\t\t\t\t\tcacheURL += ( rquery.test( cacheURL ) ? \"&\" : \"?\" ) + s.data;\n\t\n\t\t\t\t\t// #9682: remove data so that it's not used in an eventual retry\n\t\t\t\t\tdelete s.data;\n\t\t\t\t}\n\t\n\t\t\t\t// Add anti-cache in uncached url if needed\n\t\t\t\tif ( s.cache === false ) {\n\t\t\t\t\tcacheURL = cacheURL.replace( rts, \"\" );\n\t\t\t\t\tuncached = ( rquery.test( cacheURL ) ? \"&\" : \"?\" ) + \"_=\" + ( nonce++ ) + uncached;\n\t\t\t\t}\n\t\n\t\t\t\t// Put hash and anti-cache on the URL that will be requested (gh-1732)\n\t\t\t\ts.url = cacheURL + uncached;\n\t\n\t\t\t// Change '%20' to '+' if this is encoded form body content (gh-2658)\n\t\t\t} else if ( s.data && s.processData &&\n\t\t\t\t( s.contentType || \"\" ).indexOf( \"application/x-www-form-urlencoded\" ) === 0 ) {\n\t\t\t\ts.data = s.data.replace( r20, \"+\" );\n\t\t\t}\n\t\n\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\tif ( s.ifModified ) {\n\t\t\t\tif ( jQuery.lastModified[ cacheURL ] ) {\n\t\t\t\t\tjqXHR.setRequestHeader( \"If-Modified-Since\", jQuery.lastModified[ cacheURL ] );\n\t\t\t\t}\n\t\t\t\tif ( jQuery.etag[ cacheURL ] ) {\n\t\t\t\t\tjqXHR.setRequestHeader( \"If-None-Match\", jQuery.etag[ cacheURL ] );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Set the correct header, if data is being sent\n\t\t\tif ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n\t\t\t\tjqXHR.setRequestHeader( \"Content-Type\", s.contentType );\n\t\t\t}\n\t\n\t\t\t// Set the Accepts header for the server, depending on the dataType\n\t\t\tjqXHR.setRequestHeader(\n\t\t\t\t\"Accept\",\n\t\t\t\ts.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?\n\t\t\t\t\ts.accepts[ s.dataTypes[ 0 ] ] +\n\t\t\t\t\t\t( s.dataTypes[ 0 ] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\" ) :\n\t\t\t\t\ts.accepts[ \"*\" ]\n\t\t\t);\n\t\n\t\t\t// Check for headers option\n\t\t\tfor ( i in s.headers ) {\n\t\t\t\tjqXHR.setRequestHeader( i, s.headers[ i ] );\n\t\t\t}\n\t\n\t\t\t// Allow custom headers/mimetypes and early abort\n\t\t\tif ( s.beforeSend &&\n\t\t\t\t( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {\n\t\n\t\t\t\t// Abort if not done already and return\n\t\t\t\treturn jqXHR.abort();\n\t\t\t}\n\t\n\t\t\t// Aborting is no longer a cancellation\n\t\t\tstrAbort = \"abort\";\n\t\n\t\t\t// Install callbacks on deferreds\n\t\t\tcompleteDeferred.add( s.complete );\n\t\t\tjqXHR.done( s.success );\n\t\t\tjqXHR.fail( s.error );\n\t\n\t\t\t// Get transport\n\t\t\ttransport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\t\n\t\t\t// If no transport, we auto-abort\n\t\t\tif ( !transport ) {\n\t\t\t\tdone( -1, \"No Transport\" );\n\t\t\t} else {\n\t\t\t\tjqXHR.readyState = 1;\n\t\n\t\t\t\t// Send global event\n\t\t\t\tif ( fireGlobals ) {\n\t\t\t\t\tglobalEventContext.trigger( \"ajaxSend\", [ jqXHR, s ] );\n\t\t\t\t}\n\t\n\t\t\t\t// If request was aborted inside ajaxSend, stop there\n\t\t\t\tif ( completed ) {\n\t\t\t\t\treturn jqXHR;\n\t\t\t\t}\n\t\n\t\t\t\t// Timeout\n\t\t\t\tif ( s.async && s.timeout > 0 ) {\n\t\t\t\t\ttimeoutTimer = window.setTimeout( function() {\n\t\t\t\t\t\tjqXHR.abort( \"timeout\" );\n\t\t\t\t\t}, s.timeout );\n\t\t\t\t}\n\t\n\t\t\t\ttry {\n\t\t\t\t\tcompleted = false;\n\t\t\t\t\ttransport.send( requestHeaders, done );\n\t\t\t\t} catch ( e ) {\n\t\n\t\t\t\t\t// Rethrow post-completion exceptions\n\t\t\t\t\tif ( completed ) {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Propagate others as results\n\t\t\t\t\tdone( -1, e );\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\t// Callback for when everything is done\n\t\t\tfunction done( status, nativeStatusText, responses, headers ) {\n\t\t\t\tvar isSuccess, success, error, response, modified,\n\t\t\t\t\tstatusText = nativeStatusText;\n\t\n\t\t\t\t// Ignore repeat invocations\n\t\t\t\tif ( completed ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tcompleted = true;\n\t\n\t\t\t\t// Clear timeout if it exists\n\t\t\t\tif ( timeoutTimer ) {\n\t\t\t\t\twindow.clearTimeout( timeoutTimer );\n\t\t\t\t}\n\t\n\t\t\t\t// Dereference transport for early garbage collection\n\t\t\t\t// (no matter how long the jqXHR object will be used)\n\t\t\t\ttransport = undefined;\n\t\n\t\t\t\t// Cache response headers\n\t\t\t\tresponseHeadersString = headers || \"\";\n\t\n\t\t\t\t// Set readyState\n\t\t\t\tjqXHR.readyState = status > 0 ? 4 : 0;\n\t\n\t\t\t\t// Determine if successful\n\t\t\t\tisSuccess = status >= 200 && status < 300 || status === 304;\n\t\n\t\t\t\t// Get response data\n\t\t\t\tif ( responses ) {\n\t\t\t\t\tresponse = ajaxHandleResponses( s, jqXHR, responses );\n\t\t\t\t}\n\t\n\t\t\t\t// Convert no matter what (that way responseXXX fields are always set)\n\t\t\t\tresponse = ajaxConvert( s, response, jqXHR, isSuccess );\n\t\n\t\t\t\t// If successful, handle type chaining\n\t\t\t\tif ( isSuccess ) {\n\t\n\t\t\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\t\t\tif ( s.ifModified ) {\n\t\t\t\t\t\tmodified = jqXHR.getResponseHeader( \"Last-Modified\" );\n\t\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\t\tjQuery.lastModified[ cacheURL ] = modified;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmodified = jqXHR.getResponseHeader( \"etag\" );\n\t\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\t\tjQuery.etag[ cacheURL ] = modified;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// if no content\n\t\t\t\t\tif ( status === 204 || s.type === \"HEAD\" ) {\n\t\t\t\t\t\tstatusText = \"nocontent\";\n\t\n\t\t\t\t\t// if not modified\n\t\t\t\t\t} else if ( status === 304 ) {\n\t\t\t\t\t\tstatusText = \"notmodified\";\n\t\n\t\t\t\t\t// If we have data, let's convert it\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatusText = response.state;\n\t\t\t\t\t\tsuccess = response.data;\n\t\t\t\t\t\terror = response.error;\n\t\t\t\t\t\tisSuccess = !error;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\n\t\t\t\t\t// Extract error from statusText and normalize for non-aborts\n\t\t\t\t\terror = statusText;\n\t\t\t\t\tif ( status || !statusText ) {\n\t\t\t\t\t\tstatusText = \"error\";\n\t\t\t\t\t\tif ( status < 0 ) {\n\t\t\t\t\t\t\tstatus = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\n\t\t\t\t// Set data for the fake xhr object\n\t\t\t\tjqXHR.status = status;\n\t\t\t\tjqXHR.statusText = ( nativeStatusText || statusText ) + \"\";\n\t\n\t\t\t\t// Success/Error\n\t\t\t\tif ( isSuccess ) {\n\t\t\t\t\tdeferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n\t\t\t\t}\n\t\n\t\t\t\t// Status-dependent callbacks\n\t\t\t\tjqXHR.statusCode( statusCode );\n\t\t\t\tstatusCode = undefined;\n\t\n\t\t\t\tif ( fireGlobals ) {\n\t\t\t\t\tglobalEventContext.trigger( isSuccess ? \"ajaxSuccess\" : \"ajaxError\",\n\t\t\t\t\t\t[ jqXHR, s, isSuccess ? success : error ] );\n\t\t\t\t}\n\t\n\t\t\t\t// Complete\n\t\t\t\tcompleteDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\n\t\n\t\t\t\tif ( fireGlobals ) {\n\t\t\t\t\tglobalEventContext.trigger( \"ajaxComplete\", [ jqXHR, s ] );\n\t\n\t\t\t\t\t// Handle the global AJAX counter\n\t\t\t\t\tif ( !( --jQuery.active ) ) {\n\t\t\t\t\t\tjQuery.event.trigger( \"ajaxStop\" );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\n\t\t\treturn jqXHR;\n\t\t},\n\t\n\t\tgetJSON: function( url, data, callback ) {\n\t\t\treturn jQuery.get( url, data, callback, \"json\" );\n\t\t},\n\t\n\t\tgetScript: function( url, callback ) {\n\t\t\treturn jQuery.get( url, undefined, callback, \"script\" );\n\t\t}\n\t} );\n\t\n\tjQuery.each( [ \"get\", \"post\" ], function( i, method ) {\n\t\tjQuery[ method ] = function( url, data, callback, type ) {\n\t\n\t\t\t// Shift arguments if data argument was omitted\n\t\t\tif ( jQuery.isFunction( data ) ) {\n\t\t\t\ttype = type || callback;\n\t\t\t\tcallback = data;\n\t\t\t\tdata = undefined;\n\t\t\t}\n\t\n\t\t\t// The url can be an options object (which then must have .url)\n\t\t\treturn jQuery.ajax( jQuery.extend( {\n\t\t\t\turl: url,\n\t\t\t\ttype: method,\n\t\t\t\tdataType: type,\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: callback\n\t\t\t}, jQuery.isPlainObject( url ) && url ) );\n\t\t};\n\t} );\n\t\n\t\n\tjQuery._evalUrl = function( url ) {\n\t\treturn jQuery.ajax( {\n\t\t\turl: url,\n\t\n\t\t\t// Make this explicit, since user can override this through ajaxSetup (#11264)\n\t\t\ttype: \"GET\",\n\t\t\tdataType: \"script\",\n\t\t\tcache: true,\n\t\t\tasync: false,\n\t\t\tglobal: false,\n\t\t\t\"throws\": true\n\t\t} );\n\t};\n\t\n\t\n\tjQuery.fn.extend( {\n\t\twrapAll: function( html ) {\n\t\t\tvar wrap;\n\t\n\t\t\tif ( this[ 0 ] ) {\n\t\t\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\t\t\thtml = html.call( this[ 0 ] );\n\t\t\t\t}\n\t\n\t\t\t\t// The elements to wrap the target around\n\t\t\t\twrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );\n\t\n\t\t\t\tif ( this[ 0 ].parentNode ) {\n\t\t\t\t\twrap.insertBefore( this[ 0 ] );\n\t\t\t\t}\n\t\n\t\t\t\twrap.map( function() {\n\t\t\t\t\tvar elem = this;\n\t\n\t\t\t\t\twhile ( elem.firstElementChild ) {\n\t\t\t\t\t\telem = elem.firstElementChild;\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn elem;\n\t\t\t\t} ).append( this );\n\t\t\t}\n\t\n\t\t\treturn this;\n\t\t},\n\t\n\t\twrapInner: function( html ) {\n\t\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\t\treturn this.each( function( i ) {\n\t\t\t\t\tjQuery( this ).wrapInner( html.call( this, i ) );\n\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\treturn this.each( function() {\n\t\t\t\tvar self = jQuery( this ),\n\t\t\t\t\tcontents = self.contents();\n\t\n\t\t\t\tif ( contents.length ) {\n\t\t\t\t\tcontents.wrapAll( html );\n\t\n\t\t\t\t} else {\n\t\t\t\t\tself.append( html );\n\t\t\t\t}\n\t\t\t} );\n\t\t},\n\t\n\t\twrap: function( html ) {\n\t\t\tvar isFunction = jQuery.isFunction( html );\n\t\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tjQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );\n\t\t\t} );\n\t\t},\n\t\n\t\tunwrap: function( selector ) {\n\t\t\tthis.parent( selector ).not( \"body\" ).each( function() {\n\t\t\t\tjQuery( this ).replaceWith( this.childNodes );\n\t\t\t} );\n\t\t\treturn this;\n\t\t}\n\t} );\n\t\n\t\n\tjQuery.expr.pseudos.hidden = function( elem ) {\n\t\treturn !jQuery.expr.pseudos.visible( elem );\n\t};\n\tjQuery.expr.pseudos.visible = function( elem ) {\n\t\treturn !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );\n\t};\n\t\n\t\n\t\n\t\n\tjQuery.ajaxSettings.xhr = function() {\n\t\ttry {\n\t\t\treturn new window.XMLHttpRequest();\n\t\t} catch ( e ) {}\n\t};\n\t\n\tvar xhrSuccessStatus = {\n\t\n\t\t\t// File protocol always yields status code 0, assume 200\n\t\t\t0: 200,\n\t\n\t\t\t// Support: IE <=9 only\n\t\t\t// #1450: sometimes IE returns 1223 when it should be 204\n\t\t\t1223: 204\n\t\t},\n\t\txhrSupported = jQuery.ajaxSettings.xhr();\n\t\n\tsupport.cors = !!xhrSupported && ( \"withCredentials\" in xhrSupported );\n\tsupport.ajax = xhrSupported = !!xhrSupported;\n\t\n\tjQuery.ajaxTransport( function( options ) {\n\t\tvar callback, errorCallback;\n\t\n\t\t// Cross domain only allowed if supported through XMLHttpRequest\n\t\tif ( support.cors || xhrSupported && !options.crossDomain ) {\n\t\t\treturn {\n\t\t\t\tsend: function( headers, complete ) {\n\t\t\t\t\tvar i,\n\t\t\t\t\t\txhr = options.xhr();\n\t\n\t\t\t\t\txhr.open(\n\t\t\t\t\t\toptions.type,\n\t\t\t\t\t\toptions.url,\n\t\t\t\t\t\toptions.async,\n\t\t\t\t\t\toptions.username,\n\t\t\t\t\t\toptions.password\n\t\t\t\t\t);\n\t\n\t\t\t\t\t// Apply custom fields if provided\n\t\t\t\t\tif ( options.xhrFields ) {\n\t\t\t\t\t\tfor ( i in options.xhrFields ) {\n\t\t\t\t\t\t\txhr[ i ] = options.xhrFields[ i ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Override mime type if needed\n\t\t\t\t\tif ( options.mimeType && xhr.overrideMimeType ) {\n\t\t\t\t\t\txhr.overrideMimeType( options.mimeType );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// X-Requested-With header\n\t\t\t\t\t// For cross-domain requests, seeing as conditions for a preflight are\n\t\t\t\t\t// akin to a jigsaw puzzle, we simply never set it to be sure.\n\t\t\t\t\t// (it can always be set on a per-request basis or even using ajaxSetup)\n\t\t\t\t\t// For same-domain requests, won't change header if already provided.\n\t\t\t\t\tif ( !options.crossDomain && !headers[ \"X-Requested-With\" ] ) {\n\t\t\t\t\t\theaders[ \"X-Requested-With\" ] = \"XMLHttpRequest\";\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Set headers\n\t\t\t\t\tfor ( i in headers ) {\n\t\t\t\t\t\txhr.setRequestHeader( i, headers[ i ] );\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Callback\n\t\t\t\t\tcallback = function( type ) {\n\t\t\t\t\t\treturn function() {\n\t\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\t\tcallback = errorCallback = xhr.onload =\n\t\t\t\t\t\t\t\t\txhr.onerror = xhr.onabort = xhr.onreadystatechange = null;\n\t\n\t\t\t\t\t\t\t\tif ( type === \"abort\" ) {\n\t\t\t\t\t\t\t\t\txhr.abort();\n\t\t\t\t\t\t\t\t} else if ( type === \"error\" ) {\n\t\n\t\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t\t// On a manual native abort, IE9 throws\n\t\t\t\t\t\t\t\t\t// errors on any property access that is not readyState\n\t\t\t\t\t\t\t\t\tif ( typeof xhr.status !== \"number\" ) {\n\t\t\t\t\t\t\t\t\t\tcomplete( 0, \"error\" );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tcomplete(\n\t\n\t\t\t\t\t\t\t\t\t\t\t// File: protocol always yields status 0; see #8605, #14207\n\t\t\t\t\t\t\t\t\t\t\txhr.status,\n\t\t\t\t\t\t\t\t\t\t\txhr.statusText\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcomplete(\n\t\t\t\t\t\t\t\t\t\txhrSuccessStatus[ xhr.status ] || xhr.status,\n\t\t\t\t\t\t\t\t\t\txhr.statusText,\n\t\n\t\t\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t\t\t// IE9 has no XHR2 but throws on binary (trac-11426)\n\t\t\t\t\t\t\t\t\t\t// For XHR2 non-text, let the caller handle it (gh-2498)\n\t\t\t\t\t\t\t\t\t\t( xhr.responseType || \"text\" ) !== \"text\"  ||\n\t\t\t\t\t\t\t\t\t\ttypeof xhr.responseText !== \"string\" ?\n\t\t\t\t\t\t\t\t\t\t\t{ binary: xhr.response } :\n\t\t\t\t\t\t\t\t\t\t\t{ text: xhr.responseText },\n\t\t\t\t\t\t\t\t\t\txhr.getAllResponseHeaders()\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\n\t\t\t\t\t// Listen to events\n\t\t\t\t\txhr.onload = callback();\n\t\t\t\t\terrorCallback = xhr.onerror = callback( \"error\" );\n\t\n\t\t\t\t\t// Support: IE 9 only\n\t\t\t\t\t// Use onreadystatechange to replace onabort\n\t\t\t\t\t// to handle uncaught aborts\n\t\t\t\t\tif ( xhr.onabort !== undefined ) {\n\t\t\t\t\t\txhr.onabort = errorCallback;\n\t\t\t\t\t} else {\n\t\t\t\t\t\txhr.onreadystatechange = function() {\n\t\n\t\t\t\t\t\t\t// Check readyState before timeout as it changes\n\t\t\t\t\t\t\tif ( xhr.readyState === 4 ) {\n\t\n\t\t\t\t\t\t\t\t// Allow onerror to be called first,\n\t\t\t\t\t\t\t\t// but that will not handle a native abort\n\t\t\t\t\t\t\t\t// Also, save errorCallback to a variable\n\t\t\t\t\t\t\t\t// as xhr.onerror cannot be accessed\n\t\t\t\t\t\t\t\twindow.setTimeout( function() {\n\t\t\t\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\t\t\t\terrorCallback();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Create the abort callback\n\t\t\t\t\tcallback = callback( \"abort\" );\n\t\n\t\t\t\t\ttry {\n\t\n\t\t\t\t\t\t// Do send the request (this may raise an exception)\n\t\t\t\t\t\txhr.send( options.hasContent && options.data || null );\n\t\t\t\t\t} catch ( e ) {\n\t\n\t\t\t\t\t\t// #14683: Only rethrow if this hasn't been notified as an error yet\n\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\tthrow e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\n\t\t\t\tabort: function() {\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t} );\n\t\n\t\n\t\n\t\n\t// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\n\tjQuery.ajaxPrefilter( function( s ) {\n\t\tif ( s.crossDomain ) {\n\t\t\ts.contents.script = false;\n\t\t}\n\t} );\n\t\n\t// Install script dataType\n\tjQuery.ajaxSetup( {\n\t\taccepts: {\n\t\t\tscript: \"text/javascript, application/javascript, \" +\n\t\t\t\t\"application/ecmascript, application/x-ecmascript\"\n\t\t},\n\t\tcontents: {\n\t\t\tscript: /\\b(?:java|ecma)script\\b/\n\t\t},\n\t\tconverters: {\n\t\t\t\"text script\": function( text ) {\n\t\t\t\tjQuery.globalEval( text );\n\t\t\t\treturn text;\n\t\t\t}\n\t\t}\n\t} );\n\t\n\t// Handle cache's special case and crossDomain\n\tjQuery.ajaxPrefilter( \"script\", function( s ) {\n\t\tif ( s.cache === undefined ) {\n\t\t\ts.cache = false;\n\t\t}\n\t\tif ( s.crossDomain ) {\n\t\t\ts.type = \"GET\";\n\t\t}\n\t} );\n\t\n\t// Bind script tag hack transport\n\tjQuery.ajaxTransport( \"script\", function( s ) {\n\t\n\t\t// This transport only deals with cross domain requests\n\t\tif ( s.crossDomain ) {\n\t\t\tvar script, callback;\n\t\t\treturn {\n\t\t\t\tsend: function( _, complete ) {\n\t\t\t\t\tscript = jQuery( \"<script>\" ).prop( {\n\t\t\t\t\t\tcharset: s.scriptCharset,\n\t\t\t\t\t\tsrc: s.url\n\t\t\t\t\t} ).on(\n\t\t\t\t\t\t\"load error\",\n\t\t\t\t\t\tcallback = function( evt ) {\n\t\t\t\t\t\t\tscript.remove();\n\t\t\t\t\t\t\tcallback = null;\n\t\t\t\t\t\t\tif ( evt ) {\n\t\t\t\t\t\t\t\tcomplete( evt.type === \"error\" ? 404 : 200, evt.type );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\n\t\t\t\t\t// Use native DOM manipulation to avoid our domManip AJAX trickery\n\t\t\t\t\tdocument.head.appendChild( script[ 0 ] );\n\t\t\t\t},\n\t\t\t\tabort: function() {\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t} );\n\t\n\t\n\t\n\t\n\tvar oldCallbacks = [],\n\t\trjsonp = /(=)\\?(?=&|$)|\\?\\?/;\n\t\n\t// Default jsonp settings\n\tjQuery.ajaxSetup( {\n\t\tjsonp: \"callback\",\n\t\tjsonpCallback: function() {\n\t\t\tvar callback = oldCallbacks.pop() || ( jQuery.expando + \"_\" + ( nonce++ ) );\n\t\t\tthis[ callback ] = true;\n\t\t\treturn callback;\n\t\t}\n\t} );\n\t\n\t// Detect, normalize options and install callbacks for jsonp requests\n\tjQuery.ajaxPrefilter( \"json jsonp\", function( s, originalSettings, jqXHR ) {\n\t\n\t\tvar callbackName, overwritten, responseContainer,\n\t\t\tjsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?\n\t\t\t\t\"url\" :\n\t\t\t\ttypeof s.data === \"string\" &&\n\t\t\t\t\t( s.contentType || \"\" )\n\t\t\t\t\t\t.indexOf( \"application/x-www-form-urlencoded\" ) === 0 &&\n\t\t\t\t\trjsonp.test( s.data ) && \"data\"\n\t\t\t);\n\t\n\t\t// Handle iff the expected data type is \"jsonp\" or we have a parameter to set\n\t\tif ( jsonProp || s.dataTypes[ 0 ] === \"jsonp\" ) {\n\t\n\t\t\t// Get callback name, remembering preexisting value associated with it\n\t\t\tcallbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?\n\t\t\t\ts.jsonpCallback() :\n\t\t\t\ts.jsonpCallback;\n\t\n\t\t\t// Insert callback into url or form data\n\t\t\tif ( jsonProp ) {\n\t\t\t\ts[ jsonProp ] = s[ jsonProp ].replace( rjsonp, \"$1\" + callbackName );\n\t\t\t} else if ( s.jsonp !== false ) {\n\t\t\t\ts.url += ( rquery.test( s.url ) ? \"&\" : \"?\" ) + s.jsonp + \"=\" + callbackName;\n\t\t\t}\n\t\n\t\t\t// Use data converter to retrieve json after script execution\n\t\t\ts.converters[ \"script json\" ] = function() {\n\t\t\t\tif ( !responseContainer ) {\n\t\t\t\t\tjQuery.error( callbackName + \" was not called\" );\n\t\t\t\t}\n\t\t\t\treturn responseContainer[ 0 ];\n\t\t\t};\n\t\n\t\t\t// Force json dataType\n\t\t\ts.dataTypes[ 0 ] = \"json\";\n\t\n\t\t\t// Install callback\n\t\t\toverwritten = window[ callbackName ];\n\t\t\twindow[ callbackName ] = function() {\n\t\t\t\tresponseContainer = arguments;\n\t\t\t};\n\t\n\t\t\t// Clean-up function (fires after converters)\n\t\t\tjqXHR.always( function() {\n\t\n\t\t\t\t// If previous value didn't exist - remove it\n\t\t\t\tif ( overwritten === undefined ) {\n\t\t\t\t\tjQuery( window ).removeProp( callbackName );\n\t\n\t\t\t\t// Otherwise restore preexisting value\n\t\t\t\t} else {\n\t\t\t\t\twindow[ callbackName ] = overwritten;\n\t\t\t\t}\n\t\n\t\t\t\t// Save back as free\n\t\t\t\tif ( s[ callbackName ] ) {\n\t\n\t\t\t\t\t// Make sure that re-using the options doesn't screw things around\n\t\t\t\t\ts.jsonpCallback = originalSettings.jsonpCallback;\n\t\n\t\t\t\t\t// Save the callback name for future use\n\t\t\t\t\toldCallbacks.push( callbackName );\n\t\t\t\t}\n\t\n\t\t\t\t// Call if it was a function and we have a response\n\t\t\t\tif ( responseContainer && jQuery.isFunction( overwritten ) ) {\n\t\t\t\t\toverwritten( responseContainer[ 0 ] );\n\t\t\t\t}\n\t\n\t\t\t\tresponseContainer = overwritten = undefined;\n\t\t\t} );\n\t\n\t\t\t// Delegate to script\n\t\t\treturn \"script\";\n\t\t}\n\t} );\n\t\n\t\n\t\n\t\n\t// Support: Safari 8 only\n\t// In Safari 8 documents created via document.implementation.createHTMLDocument\n\t// collapse sibling forms: the second one becomes a child of the first one.\n\t// Because of that, this security measure has to be disabled in Safari 8.\n\t// https://bugs.webkit.org/show_bug.cgi?id=137337\n\tsupport.createHTMLDocument = ( function() {\n\t\tvar body = document.implementation.createHTMLDocument( \"\" ).body;\n\t\tbody.innerHTML = \"<form></form><form></form>\";\n\t\treturn body.childNodes.length === 2;\n\t} )();\n\t\n\t\n\t// Argument \"data\" should be string of html\n\t// context (optional): If specified, the fragment will be created in this context,\n\t// defaults to document\n\t// keepScripts (optional): If true, will include scripts passed in the html string\n\tjQuery.parseHTML = function( data, context, keepScripts ) {\n\t\tif ( typeof data !== \"string\" ) {\n\t\t\treturn [];\n\t\t}\n\t\tif ( typeof context === \"boolean\" ) {\n\t\t\tkeepScripts = context;\n\t\t\tcontext = false;\n\t\t}\n\t\n\t\tvar base, parsed, scripts;\n\t\n\t\tif ( !context ) {\n\t\n\t\t\t// Stop scripts or inline event handlers from being executed immediately\n\t\t\t// by using document.implementation\n\t\t\tif ( support.createHTMLDocument ) {\n\t\t\t\tcontext = document.implementation.createHTMLDocument( \"\" );\n\t\n\t\t\t\t// Set the base href for the created document\n\t\t\t\t// so any parsed elements with URLs\n\t\t\t\t// are based on the document's URL (gh-2965)\n\t\t\t\tbase = context.createElement( \"base\" );\n\t\t\t\tbase.href = document.location.href;\n\t\t\t\tcontext.head.appendChild( base );\n\t\t\t} else {\n\t\t\t\tcontext = document;\n\t\t\t}\n\t\t}\n\t\n\t\tparsed = rsingleTag.exec( data );\n\t\tscripts = !keepScripts && [];\n\t\n\t\t// Single tag\n\t\tif ( parsed ) {\n\t\t\treturn [ context.createElement( parsed[ 1 ] ) ];\n\t\t}\n\t\n\t\tparsed = buildFragment( [ data ], context, scripts );\n\t\n\t\tif ( scripts && scripts.length ) {\n\t\t\tjQuery( scripts ).remove();\n\t\t}\n\t\n\t\treturn jQuery.merge( [], parsed.childNodes );\n\t};\n\t\n\t\n\t/**\n\t * Load a url into a page\n\t */\n\tjQuery.fn.load = function( url, params, callback ) {\n\t\tvar selector, type, response,\n\t\t\tself = this,\n\t\t\toff = url.indexOf( \" \" );\n\t\n\t\tif ( off > -1 ) {\n\t\t\tselector = jQuery.trim( url.slice( off ) );\n\t\t\turl = url.slice( 0, off );\n\t\t}\n\t\n\t\t// If it's a function\n\t\tif ( jQuery.isFunction( params ) ) {\n\t\n\t\t\t// We assume that it's the callback\n\t\t\tcallback = params;\n\t\t\tparams = undefined;\n\t\n\t\t// Otherwise, build a param string\n\t\t} else if ( params && typeof params === \"object\" ) {\n\t\t\ttype = \"POST\";\n\t\t}\n\t\n\t\t// If we have elements to modify, make the request\n\t\tif ( self.length > 0 ) {\n\t\t\tjQuery.ajax( {\n\t\t\t\turl: url,\n\t\n\t\t\t\t// If \"type\" variable is undefined, then \"GET\" method will be used.\n\t\t\t\t// Make value of this field explicit since\n\t\t\t\t// user can override it through ajaxSetup method\n\t\t\t\ttype: type || \"GET\",\n\t\t\t\tdataType: \"html\",\n\t\t\t\tdata: params\n\t\t\t} ).done( function( responseText ) {\n\t\n\t\t\t\t// Save response for use in complete callback\n\t\t\t\tresponse = arguments;\n\t\n\t\t\t\tself.html( selector ?\n\t\n\t\t\t\t\t// If a selector was specified, locate the right elements in a dummy div\n\t\t\t\t\t// Exclude scripts to avoid IE 'Permission Denied' errors\n\t\t\t\t\tjQuery( \"<div>\" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :\n\t\n\t\t\t\t\t// Otherwise use the full result\n\t\t\t\t\tresponseText );\n\t\n\t\t\t// If the request succeeds, this function gets \"data\", \"status\", \"jqXHR\"\n\t\t\t// but they are ignored because response was set above.\n\t\t\t// If it fails, this function gets \"jqXHR\", \"status\", \"error\"\n\t\t\t} ).always( callback && function( jqXHR, status ) {\n\t\t\t\tself.each( function() {\n\t\t\t\t\tcallback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );\n\t\t\t\t} );\n\t\t\t} );\n\t\t}\n\t\n\t\treturn this;\n\t};\n\t\n\t\n\t\n\t\n\t// Attach a bunch of functions for handling common AJAX events\n\tjQuery.each( [\n\t\t\"ajaxStart\",\n\t\t\"ajaxStop\",\n\t\t\"ajaxComplete\",\n\t\t\"ajaxError\",\n\t\t\"ajaxSuccess\",\n\t\t\"ajaxSend\"\n\t], function( i, type ) {\n\t\tjQuery.fn[ type ] = function( fn ) {\n\t\t\treturn this.on( type, fn );\n\t\t};\n\t} );\n\t\n\t\n\t\n\t\n\tjQuery.expr.pseudos.animated = function( elem ) {\n\t\treturn jQuery.grep( jQuery.timers, function( fn ) {\n\t\t\treturn elem === fn.elem;\n\t\t} ).length;\n\t};\n\t\n\t\n\t\n\t\n\t/**\n\t * Gets a window from an element\n\t */\n\tfunction getWindow( elem ) {\n\t\treturn jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;\n\t}\n\t\n\tjQuery.offset = {\n\t\tsetOffset: function( elem, options, i ) {\n\t\t\tvar curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,\n\t\t\t\tposition = jQuery.css( elem, \"position\" ),\n\t\t\t\tcurElem = jQuery( elem ),\n\t\t\t\tprops = {};\n\t\n\t\t\t// Set position first, in-case top/left are set even on static elem\n\t\t\tif ( position === \"static\" ) {\n\t\t\t\telem.style.position = \"relative\";\n\t\t\t}\n\t\n\t\t\tcurOffset = curElem.offset();\n\t\t\tcurCSSTop = jQuery.css( elem, \"top\" );\n\t\t\tcurCSSLeft = jQuery.css( elem, \"left\" );\n\t\t\tcalculatePosition = ( position === \"absolute\" || position === \"fixed\" ) &&\n\t\t\t\t( curCSSTop + curCSSLeft ).indexOf( \"auto\" ) > -1;\n\t\n\t\t\t// Need to be able to calculate position if either\n\t\t\t// top or left is auto and position is either absolute or fixed\n\t\t\tif ( calculatePosition ) {\n\t\t\t\tcurPosition = curElem.position();\n\t\t\t\tcurTop = curPosition.top;\n\t\t\t\tcurLeft = curPosition.left;\n\t\n\t\t\t} else {\n\t\t\t\tcurTop = parseFloat( curCSSTop ) || 0;\n\t\t\t\tcurLeft = parseFloat( curCSSLeft ) || 0;\n\t\t\t}\n\t\n\t\t\tif ( jQuery.isFunction( options ) ) {\n\t\n\t\t\t\t// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)\n\t\t\t\toptions = options.call( elem, i, jQuery.extend( {}, curOffset ) );\n\t\t\t}\n\t\n\t\t\tif ( options.top != null ) {\n\t\t\t\tprops.top = ( options.top - curOffset.top ) + curTop;\n\t\t\t}\n\t\t\tif ( options.left != null ) {\n\t\t\t\tprops.left = ( options.left - curOffset.left ) + curLeft;\n\t\t\t}\n\t\n\t\t\tif ( \"using\" in options ) {\n\t\t\t\toptions.using.call( elem, props );\n\t\n\t\t\t} else {\n\t\t\t\tcurElem.css( props );\n\t\t\t}\n\t\t}\n\t};\n\t\n\tjQuery.fn.extend( {\n\t\toffset: function( options ) {\n\t\n\t\t\t// Preserve chaining for setter\n\t\t\tif ( arguments.length ) {\n\t\t\t\treturn options === undefined ?\n\t\t\t\t\tthis :\n\t\t\t\t\tthis.each( function( i ) {\n\t\t\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t\t\t} );\n\t\t\t}\n\t\n\t\t\tvar docElem, win, rect, doc,\n\t\t\t\telem = this[ 0 ];\n\t\n\t\t\tif ( !elem ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\t// Support: IE <=11 only\n\t\t\t// Running getBoundingClientRect on a\n\t\t\t// disconnected node in IE throws an error\n\t\t\tif ( !elem.getClientRects().length ) {\n\t\t\t\treturn { top: 0, left: 0 };\n\t\t\t}\n\t\n\t\t\trect = elem.getBoundingClientRect();\n\t\n\t\t\t// Make sure element is not hidden (display: none)\n\t\t\tif ( rect.width || rect.height ) {\n\t\t\t\tdoc = elem.ownerDocument;\n\t\t\t\twin = getWindow( doc );\n\t\t\t\tdocElem = doc.documentElement;\n\t\n\t\t\t\treturn {\n\t\t\t\t\ttop: rect.top + win.pageYOffset - docElem.clientTop,\n\t\t\t\t\tleft: rect.left + win.pageXOffset - docElem.clientLeft\n\t\t\t\t};\n\t\t\t}\n\t\n\t\t\t// Return zeros for disconnected and hidden elements (gh-2310)\n\t\t\treturn rect;\n\t\t},\n\t\n\t\tposition: function() {\n\t\t\tif ( !this[ 0 ] ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tvar offsetParent, offset,\n\t\t\t\telem = this[ 0 ],\n\t\t\t\tparentOffset = { top: 0, left: 0 };\n\t\n\t\t\t// Fixed elements are offset from window (parentOffset = {top:0, left: 0},\n\t\t\t// because it is its only offset parent\n\t\t\tif ( jQuery.css( elem, \"position\" ) === \"fixed\" ) {\n\t\n\t\t\t\t// Assume getBoundingClientRect is there when computed position is fixed\n\t\t\t\toffset = elem.getBoundingClientRect();\n\t\n\t\t\t} else {\n\t\n\t\t\t\t// Get *real* offsetParent\n\t\t\t\toffsetParent = this.offsetParent();\n\t\n\t\t\t\t// Get correct offsets\n\t\t\t\toffset = this.offset();\n\t\t\t\tif ( !jQuery.nodeName( offsetParent[ 0 ], \"html\" ) ) {\n\t\t\t\t\tparentOffset = offsetParent.offset();\n\t\t\t\t}\n\t\n\t\t\t\t// Add offsetParent borders\n\t\t\t\tparentOffset = {\n\t\t\t\t\ttop: parentOffset.top + jQuery.css( offsetParent[ 0 ], \"borderTopWidth\", true ),\n\t\t\t\t\tleft: parentOffset.left + jQuery.css( offsetParent[ 0 ], \"borderLeftWidth\", true )\n\t\t\t\t};\n\t\t\t}\n\t\n\t\t\t// Subtract parent offsets and element margins\n\t\t\treturn {\n\t\t\t\ttop: offset.top - parentOffset.top - jQuery.css( elem, \"marginTop\", true ),\n\t\t\t\tleft: offset.left - parentOffset.left - jQuery.css( elem, \"marginLeft\", true )\n\t\t\t};\n\t\t},\n\t\n\t\t// This method will return documentElement in the following cases:\n\t\t// 1) For the element inside the iframe without offsetParent, this method will return\n\t\t//    documentElement of the parent window\n\t\t// 2) For the hidden or detached element\n\t\t// 3) For body or html element, i.e. in case of the html node - it will return itself\n\t\t//\n\t\t// but those exceptions were never presented as a real life use-cases\n\t\t// and might be considered as more preferable results.\n\t\t//\n\t\t// This logic, however, is not guaranteed and can change at any point in the future\n\t\toffsetParent: function() {\n\t\t\treturn this.map( function() {\n\t\t\t\tvar offsetParent = this.offsetParent;\n\t\n\t\t\t\twhile ( offsetParent && jQuery.css( offsetParent, \"position\" ) === \"static\" ) {\n\t\t\t\t\toffsetParent = offsetParent.offsetParent;\n\t\t\t\t}\n\t\n\t\t\t\treturn offsetParent || documentElement;\n\t\t\t} );\n\t\t}\n\t} );\n\t\n\t// Create scrollLeft and scrollTop methods\n\tjQuery.each( { scrollLeft: \"pageXOffset\", scrollTop: \"pageYOffset\" }, function( method, prop ) {\n\t\tvar top = \"pageYOffset\" === prop;\n\t\n\t\tjQuery.fn[ method ] = function( val ) {\n\t\t\treturn access( this, function( elem, method, val ) {\n\t\t\t\tvar win = getWindow( elem );\n\t\n\t\t\t\tif ( val === undefined ) {\n\t\t\t\t\treturn win ? win[ prop ] : elem[ method ];\n\t\t\t\t}\n\t\n\t\t\t\tif ( win ) {\n\t\t\t\t\twin.scrollTo(\n\t\t\t\t\t\t!top ? val : win.pageXOffset,\n\t\t\t\t\t\ttop ? val : win.pageYOffset\n\t\t\t\t\t);\n\t\n\t\t\t\t} else {\n\t\t\t\t\telem[ method ] = val;\n\t\t\t\t}\n\t\t\t}, method, val, arguments.length );\n\t\t};\n\t} );\n\t\n\t// Support: Safari <=7 - 9.1, Chrome <=37 - 49\n\t// Add the top/left cssHooks using jQuery.fn.position\n\t// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084\n\t// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347\n\t// getComputedStyle returns percent when specified for top/left/bottom/right;\n\t// rather than make the css module depend on the offset module, just check for it here\n\tjQuery.each( [ \"top\", \"left\" ], function( i, prop ) {\n\t\tjQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,\n\t\t\tfunction( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\t\t\t\t\tcomputed = curCSS( elem, prop );\n\t\n\t\t\t\t\t// If curCSS returns percentage, fallback to offset\n\t\t\t\t\treturn rnumnonpx.test( computed ) ?\n\t\t\t\t\t\tjQuery( elem ).position()[ prop ] + \"px\" :\n\t\t\t\t\t\tcomputed;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t} );\n\t\n\t\n\t// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods\n\tjQuery.each( { Height: \"height\", Width: \"width\" }, function( name, type ) {\n\t\tjQuery.each( { padding: \"inner\" + name, content: type, \"\": \"outer\" + name },\n\t\t\tfunction( defaultExtra, funcName ) {\n\t\n\t\t\t// Margin is only for outerHeight, outerWidth\n\t\t\tjQuery.fn[ funcName ] = function( margin, value ) {\n\t\t\t\tvar chainable = arguments.length && ( defaultExtra || typeof margin !== \"boolean\" ),\n\t\t\t\t\textra = defaultExtra || ( margin === true || value === true ? \"margin\" : \"border\" );\n\t\n\t\t\t\treturn access( this, function( elem, type, value ) {\n\t\t\t\t\tvar doc;\n\t\n\t\t\t\t\tif ( jQuery.isWindow( elem ) ) {\n\t\n\t\t\t\t\t\t// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)\n\t\t\t\t\t\treturn funcName.indexOf( \"outer\" ) === 0 ?\n\t\t\t\t\t\t\telem[ \"inner\" + name ] :\n\t\t\t\t\t\t\telem.document.documentElement[ \"client\" + name ];\n\t\t\t\t\t}\n\t\n\t\t\t\t\t// Get document width or height\n\t\t\t\t\tif ( elem.nodeType === 9 ) {\n\t\t\t\t\t\tdoc = elem.documentElement;\n\t\n\t\t\t\t\t\t// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],\n\t\t\t\t\t\t// whichever is greatest\n\t\t\t\t\t\treturn Math.max(\n\t\t\t\t\t\t\telem.body[ \"scroll\" + name ], doc[ \"scroll\" + name ],\n\t\t\t\t\t\t\telem.body[ \"offset\" + name ], doc[ \"offset\" + name ],\n\t\t\t\t\t\t\tdoc[ \"client\" + name ]\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\n\t\t\t\t\treturn value === undefined ?\n\t\n\t\t\t\t\t\t// Get width or height on the element, requesting but not forcing parseFloat\n\t\t\t\t\t\tjQuery.css( elem, type, extra ) :\n\t\n\t\t\t\t\t\t// Set width or height on the element\n\t\t\t\t\t\tjQuery.style( elem, type, value, extra );\n\t\t\t\t}, type, chainable ? margin : undefined, chainable );\n\t\t\t};\n\t\t} );\n\t} );\n\t\n\t\n\tjQuery.fn.extend( {\n\t\n\t\tbind: function( types, data, fn ) {\n\t\t\treturn this.on( types, null, data, fn );\n\t\t},\n\t\tunbind: function( types, fn ) {\n\t\t\treturn this.off( types, null, fn );\n\t\t},\n\t\n\t\tdelegate: function( selector, types, data, fn ) {\n\t\t\treturn this.on( types, selector, data, fn );\n\t\t},\n\t\tundelegate: function( selector, types, fn ) {\n\t\n\t\t\t// ( namespace ) or ( selector, types [, fn] )\n\t\t\treturn arguments.length === 1 ?\n\t\t\t\tthis.off( selector, \"**\" ) :\n\t\t\t\tthis.off( types, selector || \"**\", fn );\n\t\t}\n\t} );\n\t\n\tjQuery.parseJSON = JSON.parse;\n\t\n\t\n\t\n\t\n\t// Register as a named AMD module, since jQuery can be concatenated with other\n\t// files that may use define, but not via a proper concatenation script that\n\t// understands anonymous AMD modules. A named AMD is safest and most robust\n\t// way to register. Lowercase jquery is used because AMD module names are\n\t// derived from file names, and jQuery is normally delivered in a lowercase\n\t// file name. Do this after creating the global so that if an AMD module wants\n\t// to call noConflict to hide this version of jQuery, it will work.\n\t\n\t// Note that for maximum portability, libraries that are not jQuery should\n\t// declare themselves as anonymous modules, and avoid setting a global if an\n\t// AMD loader is present. jQuery is a special case. For more information, see\n\t// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon\n\t\n\tif ( true ) {\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t\t\treturn jQuery;\n\t\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t}\n\t\n\t\n\t\n\t\n\t\n\tvar\n\t\n\t\t// Map over jQuery in case of overwrite\n\t\t_jQuery = window.jQuery,\n\t\n\t\t// Map over the $ in case of overwrite\n\t\t_$ = window.$;\n\t\n\tjQuery.noConflict = function( deep ) {\n\t\tif ( window.$ === jQuery ) {\n\t\t\twindow.$ = _$;\n\t\t}\n\t\n\t\tif ( deep && window.jQuery === jQuery ) {\n\t\t\twindow.jQuery = _jQuery;\n\t\t}\n\t\n\t\treturn jQuery;\n\t};\n\t\n\t// Expose jQuery and $ identifiers, even in AMD\n\t// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)\n\t// and CommonJS for browser emulators (#13566)\n\tif ( !noGlobal ) {\n\t\twindow.jQuery = window.$ = jQuery;\n\t}\n\t\n\t\n\treturn jQuery;\n\t} );\n\n\n/***/ },\n/* 7 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//     Underscore.js 1.8.3\n\t//     http://underscorejs.org\n\t//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n\t//     Underscore may be freely distributed under the MIT license.\n\t\n\t(function() {\n\t\n\t  // Baseline setup\n\t  // --------------\n\t\n\t  // Establish the root object, `window` in the browser, or `exports` on the server.\n\t  var root = this;\n\t\n\t  // Save the previous value of the `_` variable.\n\t  var previousUnderscore = root._;\n\t\n\t  // Save bytes in the minified (but not gzipped) version:\n\t  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;\n\t\n\t  // Create quick reference variables for speed access to core prototypes.\n\t  var\n\t    push             = ArrayProto.push,\n\t    slice            = ArrayProto.slice,\n\t    toString         = ObjProto.toString,\n\t    hasOwnProperty   = ObjProto.hasOwnProperty;\n\t\n\t  // All **ECMAScript 5** native function implementations that we hope to use\n\t  // are declared here.\n\t  var\n\t    nativeIsArray      = Array.isArray,\n\t    nativeKeys         = Object.keys,\n\t    nativeBind         = FuncProto.bind,\n\t    nativeCreate       = Object.create;\n\t\n\t  // Naked function reference for surrogate-prototype-swapping.\n\t  var Ctor = function(){};\n\t\n\t  // Create a safe reference to the Underscore object for use below.\n\t  var _ = function(obj) {\n\t    if (obj instanceof _) return obj;\n\t    if (!(this instanceof _)) return new _(obj);\n\t    this._wrapped = obj;\n\t  };\n\t\n\t  // Export the Underscore object for **Node.js**, with\n\t  // backwards-compatibility for the old `require()` API. If we're in\n\t  // the browser, add `_` as a global object.\n\t  if (true) {\n\t    if (typeof module !== 'undefined' && module.exports) {\n\t      exports = module.exports = _;\n\t    }\n\t    exports._ = _;\n\t  } else {\n\t    root._ = _;\n\t  }\n\t\n\t  // Current version.\n\t  _.VERSION = '1.8.3';\n\t\n\t  // Internal function that returns an efficient (for current engines) version\n\t  // of the passed-in callback, to be repeatedly applied in other Underscore\n\t  // functions.\n\t  var optimizeCb = function(func, context, argCount) {\n\t    if (context === void 0) return func;\n\t    switch (argCount == null ? 3 : argCount) {\n\t      case 1: return function(value) {\n\t        return func.call(context, value);\n\t      };\n\t      case 2: return function(value, other) {\n\t        return func.call(context, value, other);\n\t      };\n\t      case 3: return function(value, index, collection) {\n\t        return func.call(context, value, index, collection);\n\t      };\n\t      case 4: return function(accumulator, value, index, collection) {\n\t        return func.call(context, accumulator, value, index, collection);\n\t      };\n\t    }\n\t    return function() {\n\t      return func.apply(context, arguments);\n\t    };\n\t  };\n\t\n\t  // A mostly-internal function to generate callbacks that can be applied\n\t  // to each element in a collection, returning the desired result — either\n\t  // identity, an arbitrary callback, a property matcher, or a property accessor.\n\t  var cb = function(value, context, argCount) {\n\t    if (value == null) return _.identity;\n\t    if (_.isFunction(value)) return optimizeCb(value, context, argCount);\n\t    if (_.isObject(value)) return _.matcher(value);\n\t    return _.property(value);\n\t  };\n\t  _.iteratee = function(value, context) {\n\t    return cb(value, context, Infinity);\n\t  };\n\t\n\t  // An internal function for creating assigner functions.\n\t  var createAssigner = function(keysFunc, undefinedOnly) {\n\t    return function(obj) {\n\t      var length = arguments.length;\n\t      if (length < 2 || obj == null) return obj;\n\t      for (var index = 1; index < length; index++) {\n\t        var source = arguments[index],\n\t            keys = keysFunc(source),\n\t            l = keys.length;\n\t        for (var i = 0; i < l; i++) {\n\t          var key = keys[i];\n\t          if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];\n\t        }\n\t      }\n\t      return obj;\n\t    };\n\t  };\n\t\n\t  // An internal function for creating a new object that inherits from another.\n\t  var baseCreate = function(prototype) {\n\t    if (!_.isObject(prototype)) return {};\n\t    if (nativeCreate) return nativeCreate(prototype);\n\t    Ctor.prototype = prototype;\n\t    var result = new Ctor;\n\t    Ctor.prototype = null;\n\t    return result;\n\t  };\n\t\n\t  var property = function(key) {\n\t    return function(obj) {\n\t      return obj == null ? void 0 : obj[key];\n\t    };\n\t  };\n\t\n\t  // Helper for collection methods to determine whether a collection\n\t  // should be iterated as an array or as an object\n\t  // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength\n\t  // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094\n\t  var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;\n\t  var getLength = property('length');\n\t  var isArrayLike = function(collection) {\n\t    var length = getLength(collection);\n\t    return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;\n\t  };\n\t\n\t  // Collection Functions\n\t  // --------------------\n\t\n\t  // The cornerstone, an `each` implementation, aka `forEach`.\n\t  // Handles raw objects in addition to array-likes. Treats all\n\t  // sparse array-likes as if they were dense.\n\t  _.each = _.forEach = function(obj, iteratee, context) {\n\t    iteratee = optimizeCb(iteratee, context);\n\t    var i, length;\n\t    if (isArrayLike(obj)) {\n\t      for (i = 0, length = obj.length; i < length; i++) {\n\t        iteratee(obj[i], i, obj);\n\t      }\n\t    } else {\n\t      var keys = _.keys(obj);\n\t      for (i = 0, length = keys.length; i < length; i++) {\n\t        iteratee(obj[keys[i]], keys[i], obj);\n\t      }\n\t    }\n\t    return obj;\n\t  };\n\t\n\t  // Return the results of applying the iteratee to each element.\n\t  _.map = _.collect = function(obj, iteratee, context) {\n\t    iteratee = cb(iteratee, context);\n\t    var keys = !isArrayLike(obj) && _.keys(obj),\n\t        length = (keys || obj).length,\n\t        results = Array(length);\n\t    for (var index = 0; index < length; index++) {\n\t      var currentKey = keys ? keys[index] : index;\n\t      results[index] = iteratee(obj[currentKey], currentKey, obj);\n\t    }\n\t    return results;\n\t  };\n\t\n\t  // Create a reducing function iterating left or right.\n\t  function createReduce(dir) {\n\t    // Optimized iterator function as using arguments.length\n\t    // in the main function will deoptimize the, see #1991.\n\t    function iterator(obj, iteratee, memo, keys, index, length) {\n\t      for (; index >= 0 && index < length; index += dir) {\n\t        var currentKey = keys ? keys[index] : index;\n\t        memo = iteratee(memo, obj[currentKey], currentKey, obj);\n\t      }\n\t      return memo;\n\t    }\n\t\n\t    return function(obj, iteratee, memo, context) {\n\t      iteratee = optimizeCb(iteratee, context, 4);\n\t      var keys = !isArrayLike(obj) && _.keys(obj),\n\t          length = (keys || obj).length,\n\t          index = dir > 0 ? 0 : length - 1;\n\t      // Determine the initial value if none is provided.\n\t      if (arguments.length < 3) {\n\t        memo = obj[keys ? keys[index] : index];\n\t        index += dir;\n\t      }\n\t      return iterator(obj, iteratee, memo, keys, index, length);\n\t    };\n\t  }\n\t\n\t  // **Reduce** builds up a single result from a list of values, aka `inject`,\n\t  // or `foldl`.\n\t  _.reduce = _.foldl = _.inject = createReduce(1);\n\t\n\t  // The right-associative version of reduce, also known as `foldr`.\n\t  _.reduceRight = _.foldr = createReduce(-1);\n\t\n\t  // Return the first value which passes a truth test. Aliased as `detect`.\n\t  _.find = _.detect = function(obj, predicate, context) {\n\t    var key;\n\t    if (isArrayLike(obj)) {\n\t      key = _.findIndex(obj, predicate, context);\n\t    } else {\n\t      key = _.findKey(obj, predicate, context);\n\t    }\n\t    if (key !== void 0 && key !== -1) return obj[key];\n\t  };\n\t\n\t  // Return all the elements that pass a truth test.\n\t  // Aliased as `select`.\n\t  _.filter = _.select = function(obj, predicate, context) {\n\t    var results = [];\n\t    predicate = cb(predicate, context);\n\t    _.each(obj, function(value, index, list) {\n\t      if (predicate(value, index, list)) results.push(value);\n\t    });\n\t    return results;\n\t  };\n\t\n\t  // Return all the elements for which a truth test fails.\n\t  _.reject = function(obj, predicate, context) {\n\t    return _.filter(obj, _.negate(cb(predicate)), context);\n\t  };\n\t\n\t  // Determine whether all of the elements match a truth test.\n\t  // Aliased as `all`.\n\t  _.every = _.all = function(obj, predicate, context) {\n\t    predicate = cb(predicate, context);\n\t    var keys = !isArrayLike(obj) && _.keys(obj),\n\t        length = (keys || obj).length;\n\t    for (var index = 0; index < length; index++) {\n\t      var currentKey = keys ? keys[index] : index;\n\t      if (!predicate(obj[currentKey], currentKey, obj)) return false;\n\t    }\n\t    return true;\n\t  };\n\t\n\t  // Determine if at least one element in the object matches a truth test.\n\t  // Aliased as `any`.\n\t  _.some = _.any = function(obj, predicate, context) {\n\t    predicate = cb(predicate, context);\n\t    var keys = !isArrayLike(obj) && _.keys(obj),\n\t        length = (keys || obj).length;\n\t    for (var index = 0; index < length; index++) {\n\t      var currentKey = keys ? keys[index] : index;\n\t      if (predicate(obj[currentKey], currentKey, obj)) return true;\n\t    }\n\t    return false;\n\t  };\n\t\n\t  // Determine if the array or object contains a given item (using `===`).\n\t  // Aliased as `includes` and `include`.\n\t  _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {\n\t    if (!isArrayLike(obj)) obj = _.values(obj);\n\t    if (typeof fromIndex != 'number' || guard) fromIndex = 0;\n\t    return _.indexOf(obj, item, fromIndex) >= 0;\n\t  };\n\t\n\t  // Invoke a method (with arguments) on every item in a collection.\n\t  _.invoke = function(obj, method) {\n\t    var args = slice.call(arguments, 2);\n\t    var isFunc = _.isFunction(method);\n\t    return _.map(obj, function(value) {\n\t      var func = isFunc ? method : value[method];\n\t      return func == null ? func : func.apply(value, args);\n\t    });\n\t  };\n\t\n\t  // Convenience version of a common use case of `map`: fetching a property.\n\t  _.pluck = function(obj, key) {\n\t    return _.map(obj, _.property(key));\n\t  };\n\t\n\t  // Convenience version of a common use case of `filter`: selecting only objects\n\t  // containing specific `key:value` pairs.\n\t  _.where = function(obj, attrs) {\n\t    return _.filter(obj, _.matcher(attrs));\n\t  };\n\t\n\t  // Convenience version of a common use case of `find`: getting the first object\n\t  // containing specific `key:value` pairs.\n\t  _.findWhere = function(obj, attrs) {\n\t    return _.find(obj, _.matcher(attrs));\n\t  };\n\t\n\t  // Return the maximum element (or element-based computation).\n\t  _.max = function(obj, iteratee, context) {\n\t    var result = -Infinity, lastComputed = -Infinity,\n\t        value, computed;\n\t    if (iteratee == null && obj != null) {\n\t      obj = isArrayLike(obj) ? obj : _.values(obj);\n\t      for (var i = 0, length = obj.length; i < length; i++) {\n\t        value = obj[i];\n\t        if (value > result) {\n\t          result = value;\n\t        }\n\t      }\n\t    } else {\n\t      iteratee = cb(iteratee, context);\n\t      _.each(obj, function(value, index, list) {\n\t        computed = iteratee(value, index, list);\n\t        if (computed > lastComputed || computed === -Infinity && result === -Infinity) {\n\t          result = value;\n\t          lastComputed = computed;\n\t        }\n\t      });\n\t    }\n\t    return result;\n\t  };\n\t\n\t  // Return the minimum element (or element-based computation).\n\t  _.min = function(obj, iteratee, context) {\n\t    var result = Infinity, lastComputed = Infinity,\n\t        value, computed;\n\t    if (iteratee == null && obj != null) {\n\t      obj = isArrayLike(obj) ? obj : _.values(obj);\n\t      for (var i = 0, length = obj.length; i < length; i++) {\n\t        value = obj[i];\n\t        if (value < result) {\n\t          result = value;\n\t        }\n\t      }\n\t    } else {\n\t      iteratee = cb(iteratee, context);\n\t      _.each(obj, function(value, index, list) {\n\t        computed = iteratee(value, index, list);\n\t        if (computed < lastComputed || computed === Infinity && result === Infinity) {\n\t          result = value;\n\t          lastComputed = computed;\n\t        }\n\t      });\n\t    }\n\t    return result;\n\t  };\n\t\n\t  // Shuffle a collection, using the modern version of the\n\t  // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).\n\t  _.shuffle = function(obj) {\n\t    var set = isArrayLike(obj) ? obj : _.values(obj);\n\t    var length = set.length;\n\t    var shuffled = Array(length);\n\t    for (var index = 0, rand; index < length; index++) {\n\t      rand = _.random(0, index);\n\t      if (rand !== index) shuffled[index] = shuffled[rand];\n\t      shuffled[rand] = set[index];\n\t    }\n\t    return shuffled;\n\t  };\n\t\n\t  // Sample **n** random values from a collection.\n\t  // If **n** is not specified, returns a single random element.\n\t  // The internal `guard` argument allows it to work with `map`.\n\t  _.sample = function(obj, n, guard) {\n\t    if (n == null || guard) {\n\t      if (!isArrayLike(obj)) obj = _.values(obj);\n\t      return obj[_.random(obj.length - 1)];\n\t    }\n\t    return _.shuffle(obj).slice(0, Math.max(0, n));\n\t  };\n\t\n\t  // Sort the object's values by a criterion produced by an iteratee.\n\t  _.sortBy = function(obj, iteratee, context) {\n\t    iteratee = cb(iteratee, context);\n\t    return _.pluck(_.map(obj, function(value, index, list) {\n\t      return {\n\t        value: value,\n\t        index: index,\n\t        criteria: iteratee(value, index, list)\n\t      };\n\t    }).sort(function(left, right) {\n\t      var a = left.criteria;\n\t      var b = right.criteria;\n\t      if (a !== b) {\n\t        if (a > b || a === void 0) return 1;\n\t        if (a < b || b === void 0) return -1;\n\t      }\n\t      return left.index - right.index;\n\t    }), 'value');\n\t  };\n\t\n\t  // An internal function used for aggregate \"group by\" operations.\n\t  var group = function(behavior) {\n\t    return function(obj, iteratee, context) {\n\t      var result = {};\n\t      iteratee = cb(iteratee, context);\n\t      _.each(obj, function(value, index) {\n\t        var key = iteratee(value, index, obj);\n\t        behavior(result, value, key);\n\t      });\n\t      return result;\n\t    };\n\t  };\n\t\n\t  // Groups the object's values by a criterion. Pass either a string attribute\n\t  // to group by, or a function that returns the criterion.\n\t  _.groupBy = group(function(result, value, key) {\n\t    if (_.has(result, key)) result[key].push(value); else result[key] = [value];\n\t  });\n\t\n\t  // Indexes the object's values by a criterion, similar to `groupBy`, but for\n\t  // when you know that your index values will be unique.\n\t  _.indexBy = group(function(result, value, key) {\n\t    result[key] = value;\n\t  });\n\t\n\t  // Counts instances of an object that group by a certain criterion. Pass\n\t  // either a string attribute to count by, or a function that returns the\n\t  // criterion.\n\t  _.countBy = group(function(result, value, key) {\n\t    if (_.has(result, key)) result[key]++; else result[key] = 1;\n\t  });\n\t\n\t  // Safely create a real, live array from anything iterable.\n\t  _.toArray = function(obj) {\n\t    if (!obj) return [];\n\t    if (_.isArray(obj)) return slice.call(obj);\n\t    if (isArrayLike(obj)) return _.map(obj, _.identity);\n\t    return _.values(obj);\n\t  };\n\t\n\t  // Return the number of elements in an object.\n\t  _.size = function(obj) {\n\t    if (obj == null) return 0;\n\t    return isArrayLike(obj) ? obj.length : _.keys(obj).length;\n\t  };\n\t\n\t  // Split a collection into two arrays: one whose elements all satisfy the given\n\t  // predicate, and one whose elements all do not satisfy the predicate.\n\t  _.partition = function(obj, predicate, context) {\n\t    predicate = cb(predicate, context);\n\t    var pass = [], fail = [];\n\t    _.each(obj, function(value, key, obj) {\n\t      (predicate(value, key, obj) ? pass : fail).push(value);\n\t    });\n\t    return [pass, fail];\n\t  };\n\t\n\t  // Array Functions\n\t  // ---------------\n\t\n\t  // Get the first element of an array. Passing **n** will return the first N\n\t  // values in the array. Aliased as `head` and `take`. The **guard** check\n\t  // allows it to work with `_.map`.\n\t  _.first = _.head = _.take = function(array, n, guard) {\n\t    if (array == null) return void 0;\n\t    if (n == null || guard) return array[0];\n\t    return _.initial(array, array.length - n);\n\t  };\n\t\n\t  // Returns everything but the last entry of the array. Especially useful on\n\t  // the arguments object. Passing **n** will return all the values in\n\t  // the array, excluding the last N.\n\t  _.initial = function(array, n, guard) {\n\t    return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));\n\t  };\n\t\n\t  // Get the last element of an array. Passing **n** will return the last N\n\t  // values in the array.\n\t  _.last = function(array, n, guard) {\n\t    if (array == null) return void 0;\n\t    if (n == null || guard) return array[array.length - 1];\n\t    return _.rest(array, Math.max(0, array.length - n));\n\t  };\n\t\n\t  // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.\n\t  // Especially useful on the arguments object. Passing an **n** will return\n\t  // the rest N values in the array.\n\t  _.rest = _.tail = _.drop = function(array, n, guard) {\n\t    return slice.call(array, n == null || guard ? 1 : n);\n\t  };\n\t\n\t  // Trim out all falsy values from an array.\n\t  _.compact = function(array) {\n\t    return _.filter(array, _.identity);\n\t  };\n\t\n\t  // Internal implementation of a recursive `flatten` function.\n\t  var flatten = function(input, shallow, strict, startIndex) {\n\t    var output = [], idx = 0;\n\t    for (var i = startIndex || 0, length = getLength(input); i < length; i++) {\n\t      var value = input[i];\n\t      if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {\n\t        //flatten current level of array or arguments object\n\t        if (!shallow) value = flatten(value, shallow, strict);\n\t        var j = 0, len = value.length;\n\t        output.length += len;\n\t        while (j < len) {\n\t          output[idx++] = value[j++];\n\t        }\n\t      } else if (!strict) {\n\t        output[idx++] = value;\n\t      }\n\t    }\n\t    return output;\n\t  };\n\t\n\t  // Flatten out an array, either recursively (by default), or just one level.\n\t  _.flatten = function(array, shallow) {\n\t    return flatten(array, shallow, false);\n\t  };\n\t\n\t  // Return a version of the array that does not contain the specified value(s).\n\t  _.without = function(array) {\n\t    return _.difference(array, slice.call(arguments, 1));\n\t  };\n\t\n\t  // Produce a duplicate-free version of the array. If the array has already\n\t  // been sorted, you have the option of using a faster algorithm.\n\t  // Aliased as `unique`.\n\t  _.uniq = _.unique = function(array, isSorted, iteratee, context) {\n\t    if (!_.isBoolean(isSorted)) {\n\t      context = iteratee;\n\t      iteratee = isSorted;\n\t      isSorted = false;\n\t    }\n\t    if (iteratee != null) iteratee = cb(iteratee, context);\n\t    var result = [];\n\t    var seen = [];\n\t    for (var i = 0, length = getLength(array); i < length; i++) {\n\t      var value = array[i],\n\t          computed = iteratee ? iteratee(value, i, array) : value;\n\t      if (isSorted) {\n\t        if (!i || seen !== computed) result.push(value);\n\t        seen = computed;\n\t      } else if (iteratee) {\n\t        if (!_.contains(seen, computed)) {\n\t          seen.push(computed);\n\t          result.push(value);\n\t        }\n\t      } else if (!_.contains(result, value)) {\n\t        result.push(value);\n\t      }\n\t    }\n\t    return result;\n\t  };\n\t\n\t  // Produce an array that contains the union: each distinct element from all of\n\t  // the passed-in arrays.\n\t  _.union = function() {\n\t    return _.uniq(flatten(arguments, true, true));\n\t  };\n\t\n\t  // Produce an array that contains every item shared between all the\n\t  // passed-in arrays.\n\t  _.intersection = function(array) {\n\t    var result = [];\n\t    var argsLength = arguments.length;\n\t    for (var i = 0, length = getLength(array); i < length; i++) {\n\t      var item = array[i];\n\t      if (_.contains(result, item)) continue;\n\t      for (var j = 1; j < argsLength; j++) {\n\t        if (!_.contains(arguments[j], item)) break;\n\t      }\n\t      if (j === argsLength) result.push(item);\n\t    }\n\t    return result;\n\t  };\n\t\n\t  // Take the difference between one array and a number of other arrays.\n\t  // Only the elements present in just the first array will remain.\n\t  _.difference = function(array) {\n\t    var rest = flatten(arguments, true, true, 1);\n\t    return _.filter(array, function(value){\n\t      return !_.contains(rest, value);\n\t    });\n\t  };\n\t\n\t  // Zip together multiple lists into a single array -- elements that share\n\t  // an index go together.\n\t  _.zip = function() {\n\t    return _.unzip(arguments);\n\t  };\n\t\n\t  // Complement of _.zip. Unzip accepts an array of arrays and groups\n\t  // each array's elements on shared indices\n\t  _.unzip = function(array) {\n\t    var length = array && _.max(array, getLength).length || 0;\n\t    var result = Array(length);\n\t\n\t    for (var index = 0; index < length; index++) {\n\t      result[index] = _.pluck(array, index);\n\t    }\n\t    return result;\n\t  };\n\t\n\t  // Converts lists into objects. Pass either a single array of `[key, value]`\n\t  // pairs, or two parallel arrays of the same length -- one of keys, and one of\n\t  // the corresponding values.\n\t  _.object = function(list, values) {\n\t    var result = {};\n\t    for (var i = 0, length = getLength(list); i < length; i++) {\n\t      if (values) {\n\t        result[list[i]] = values[i];\n\t      } else {\n\t        result[list[i][0]] = list[i][1];\n\t      }\n\t    }\n\t    return result;\n\t  };\n\t\n\t  // Generator function to create the findIndex and findLastIndex functions\n\t  function createPredicateIndexFinder(dir) {\n\t    return function(array, predicate, context) {\n\t      predicate = cb(predicate, context);\n\t      var length = getLength(array);\n\t      var index = dir > 0 ? 0 : length - 1;\n\t      for (; index >= 0 && index < length; index += dir) {\n\t        if (predicate(array[index], index, array)) return index;\n\t      }\n\t      return -1;\n\t    };\n\t  }\n\t\n\t  // Returns the first index on an array-like that passes a predicate test\n\t  _.findIndex = createPredicateIndexFinder(1);\n\t  _.findLastIndex = createPredicateIndexFinder(-1);\n\t\n\t  // Use a comparator function to figure out the smallest index at which\n\t  // an object should be inserted so as to maintain order. Uses binary search.\n\t  _.sortedIndex = function(array, obj, iteratee, context) {\n\t    iteratee = cb(iteratee, context, 1);\n\t    var value = iteratee(obj);\n\t    var low = 0, high = getLength(array);\n\t    while (low < high) {\n\t      var mid = Math.floor((low + high) / 2);\n\t      if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;\n\t    }\n\t    return low;\n\t  };\n\t\n\t  // Generator function to create the indexOf and lastIndexOf functions\n\t  function createIndexFinder(dir, predicateFind, sortedIndex) {\n\t    return function(array, item, idx) {\n\t      var i = 0, length = getLength(array);\n\t      if (typeof idx == 'number') {\n\t        if (dir > 0) {\n\t            i = idx >= 0 ? idx : Math.max(idx + length, i);\n\t        } else {\n\t            length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;\n\t        }\n\t      } else if (sortedIndex && idx && length) {\n\t        idx = sortedIndex(array, item);\n\t        return array[idx] === item ? idx : -1;\n\t      }\n\t      if (item !== item) {\n\t        idx = predicateFind(slice.call(array, i, length), _.isNaN);\n\t        return idx >= 0 ? idx + i : -1;\n\t      }\n\t      for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {\n\t        if (array[idx] === item) return idx;\n\t      }\n\t      return -1;\n\t    };\n\t  }\n\t\n\t  // Return the position of the first occurrence of an item in an array,\n\t  // or -1 if the item is not included in the array.\n\t  // If the array is large and already in sort order, pass `true`\n\t  // for **isSorted** to use binary search.\n\t  _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);\n\t  _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);\n\t\n\t  // Generate an integer Array containing an arithmetic progression. A port of\n\t  // the native Python `range()` function. See\n\t  // [the Python documentation](http://docs.python.org/library/functions.html#range).\n\t  _.range = function(start, stop, step) {\n\t    if (stop == null) {\n\t      stop = start || 0;\n\t      start = 0;\n\t    }\n\t    step = step || 1;\n\t\n\t    var length = Math.max(Math.ceil((stop - start) / step), 0);\n\t    var range = Array(length);\n\t\n\t    for (var idx = 0; idx < length; idx++, start += step) {\n\t      range[idx] = start;\n\t    }\n\t\n\t    return range;\n\t  };\n\t\n\t  // Function (ahem) Functions\n\t  // ------------------\n\t\n\t  // Determines whether to execute a function as a constructor\n\t  // or a normal function with the provided arguments\n\t  var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {\n\t    if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);\n\t    var self = baseCreate(sourceFunc.prototype);\n\t    var result = sourceFunc.apply(self, args);\n\t    if (_.isObject(result)) return result;\n\t    return self;\n\t  };\n\t\n\t  // Create a function bound to a given object (assigning `this`, and arguments,\n\t  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if\n\t  // available.\n\t  _.bind = function(func, context) {\n\t    if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));\n\t    if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');\n\t    var args = slice.call(arguments, 2);\n\t    var bound = function() {\n\t      return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));\n\t    };\n\t    return bound;\n\t  };\n\t\n\t  // Partially apply a function by creating a version that has had some of its\n\t  // arguments pre-filled, without changing its dynamic `this` context. _ acts\n\t  // as a placeholder, allowing any combination of arguments to be pre-filled.\n\t  _.partial = function(func) {\n\t    var boundArgs = slice.call(arguments, 1);\n\t    var bound = function() {\n\t      var position = 0, length = boundArgs.length;\n\t      var args = Array(length);\n\t      for (var i = 0; i < length; i++) {\n\t        args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];\n\t      }\n\t      while (position < arguments.length) args.push(arguments[position++]);\n\t      return executeBound(func, bound, this, this, args);\n\t    };\n\t    return bound;\n\t  };\n\t\n\t  // Bind a number of an object's methods to that object. Remaining arguments\n\t  // are the method names to be bound. Useful for ensuring that all callbacks\n\t  // defined on an object belong to it.\n\t  _.bindAll = function(obj) {\n\t    var i, length = arguments.length, key;\n\t    if (length <= 1) throw new Error('bindAll must be passed function names');\n\t    for (i = 1; i < length; i++) {\n\t      key = arguments[i];\n\t      obj[key] = _.bind(obj[key], obj);\n\t    }\n\t    return obj;\n\t  };\n\t\n\t  // Memoize an expensive function by storing its results.\n\t  _.memoize = function(func, hasher) {\n\t    var memoize = function(key) {\n\t      var cache = memoize.cache;\n\t      var address = '' + (hasher ? hasher.apply(this, arguments) : key);\n\t      if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);\n\t      return cache[address];\n\t    };\n\t    memoize.cache = {};\n\t    return memoize;\n\t  };\n\t\n\t  // Delays a function for the given number of milliseconds, and then calls\n\t  // it with the arguments supplied.\n\t  _.delay = function(func, wait) {\n\t    var args = slice.call(arguments, 2);\n\t    return setTimeout(function(){\n\t      return func.apply(null, args);\n\t    }, wait);\n\t  };\n\t\n\t  // Defers a function, scheduling it to run after the current call stack has\n\t  // cleared.\n\t  _.defer = _.partial(_.delay, _, 1);\n\t\n\t  // Returns a function, that, when invoked, will only be triggered at most once\n\t  // during a given window of time. Normally, the throttled function will run\n\t  // as much as it can, without ever going more than once per `wait` duration;\n\t  // but if you'd like to disable the execution on the leading edge, pass\n\t  // `{leading: false}`. To disable execution on the trailing edge, ditto.\n\t  _.throttle = function(func, wait, options) {\n\t    var context, args, result;\n\t    var timeout = null;\n\t    var previous = 0;\n\t    if (!options) options = {};\n\t    var later = function() {\n\t      previous = options.leading === false ? 0 : _.now();\n\t      timeout = null;\n\t      result = func.apply(context, args);\n\t      if (!timeout) context = args = null;\n\t    };\n\t    return function() {\n\t      var now = _.now();\n\t      if (!previous && options.leading === false) previous = now;\n\t      var remaining = wait - (now - previous);\n\t      context = this;\n\t      args = arguments;\n\t      if (remaining <= 0 || remaining > wait) {\n\t        if (timeout) {\n\t          clearTimeout(timeout);\n\t          timeout = null;\n\t        }\n\t        previous = now;\n\t        result = func.apply(context, args);\n\t        if (!timeout) context = args = null;\n\t      } else if (!timeout && options.trailing !== false) {\n\t        timeout = setTimeout(later, remaining);\n\t      }\n\t      return result;\n\t    };\n\t  };\n\t\n\t  // Returns a function, that, as long as it continues to be invoked, will not\n\t  // be triggered. The function will be called after it stops being called for\n\t  // N milliseconds. If `immediate` is passed, trigger the function on the\n\t  // leading edge, instead of the trailing.\n\t  _.debounce = function(func, wait, immediate) {\n\t    var timeout, args, context, timestamp, result;\n\t\n\t    var later = function() {\n\t      var last = _.now() - timestamp;\n\t\n\t      if (last < wait && last >= 0) {\n\t        timeout = setTimeout(later, wait - last);\n\t      } else {\n\t        timeout = null;\n\t        if (!immediate) {\n\t          result = func.apply(context, args);\n\t          if (!timeout) context = args = null;\n\t        }\n\t      }\n\t    };\n\t\n\t    return function() {\n\t      context = this;\n\t      args = arguments;\n\t      timestamp = _.now();\n\t      var callNow = immediate && !timeout;\n\t      if (!timeout) timeout = setTimeout(later, wait);\n\t      if (callNow) {\n\t        result = func.apply(context, args);\n\t        context = args = null;\n\t      }\n\t\n\t      return result;\n\t    };\n\t  };\n\t\n\t  // Returns the first function passed as an argument to the second,\n\t  // allowing you to adjust arguments, run code before and after, and\n\t  // conditionally execute the original function.\n\t  _.wrap = function(func, wrapper) {\n\t    return _.partial(wrapper, func);\n\t  };\n\t\n\t  // Returns a negated version of the passed-in predicate.\n\t  _.negate = function(predicate) {\n\t    return function() {\n\t      return !predicate.apply(this, arguments);\n\t    };\n\t  };\n\t\n\t  // Returns a function that is the composition of a list of functions, each\n\t  // consuming the return value of the function that follows.\n\t  _.compose = function() {\n\t    var args = arguments;\n\t    var start = args.length - 1;\n\t    return function() {\n\t      var i = start;\n\t      var result = args[start].apply(this, arguments);\n\t      while (i--) result = args[i].call(this, result);\n\t      return result;\n\t    };\n\t  };\n\t\n\t  // Returns a function that will only be executed on and after the Nth call.\n\t  _.after = function(times, func) {\n\t    return function() {\n\t      if (--times < 1) {\n\t        return func.apply(this, arguments);\n\t      }\n\t    };\n\t  };\n\t\n\t  // Returns a function that will only be executed up to (but not including) the Nth call.\n\t  _.before = function(times, func) {\n\t    var memo;\n\t    return function() {\n\t      if (--times > 0) {\n\t        memo = func.apply(this, arguments);\n\t      }\n\t      if (times <= 1) func = null;\n\t      return memo;\n\t    };\n\t  };\n\t\n\t  // Returns a function that will be executed at most one time, no matter how\n\t  // often you call it. Useful for lazy initialization.\n\t  _.once = _.partial(_.before, 2);\n\t\n\t  // Object Functions\n\t  // ----------------\n\t\n\t  // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.\n\t  var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');\n\t  var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',\n\t                      'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];\n\t\n\t  function collectNonEnumProps(obj, keys) {\n\t    var nonEnumIdx = nonEnumerableProps.length;\n\t    var constructor = obj.constructor;\n\t    var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;\n\t\n\t    // Constructor is a special case.\n\t    var prop = 'constructor';\n\t    if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);\n\t\n\t    while (nonEnumIdx--) {\n\t      prop = nonEnumerableProps[nonEnumIdx];\n\t      if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {\n\t        keys.push(prop);\n\t      }\n\t    }\n\t  }\n\t\n\t  // Retrieve the names of an object's own properties.\n\t  // Delegates to **ECMAScript 5**'s native `Object.keys`\n\t  _.keys = function(obj) {\n\t    if (!_.isObject(obj)) return [];\n\t    if (nativeKeys) return nativeKeys(obj);\n\t    var keys = [];\n\t    for (var key in obj) if (_.has(obj, key)) keys.push(key);\n\t    // Ahem, IE < 9.\n\t    if (hasEnumBug) collectNonEnumProps(obj, keys);\n\t    return keys;\n\t  };\n\t\n\t  // Retrieve all the property names of an object.\n\t  _.allKeys = function(obj) {\n\t    if (!_.isObject(obj)) return [];\n\t    var keys = [];\n\t    for (var key in obj) keys.push(key);\n\t    // Ahem, IE < 9.\n\t    if (hasEnumBug) collectNonEnumProps(obj, keys);\n\t    return keys;\n\t  };\n\t\n\t  // Retrieve the values of an object's properties.\n\t  _.values = function(obj) {\n\t    var keys = _.keys(obj);\n\t    var length = keys.length;\n\t    var values = Array(length);\n\t    for (var i = 0; i < length; i++) {\n\t      values[i] = obj[keys[i]];\n\t    }\n\t    return values;\n\t  };\n\t\n\t  // Returns the results of applying the iteratee to each element of the object\n\t  // In contrast to _.map it returns an object\n\t  _.mapObject = function(obj, iteratee, context) {\n\t    iteratee = cb(iteratee, context);\n\t    var keys =  _.keys(obj),\n\t          length = keys.length,\n\t          results = {},\n\t          currentKey;\n\t      for (var index = 0; index < length; index++) {\n\t        currentKey = keys[index];\n\t        results[currentKey] = iteratee(obj[currentKey], currentKey, obj);\n\t      }\n\t      return results;\n\t  };\n\t\n\t  // Convert an object into a list of `[key, value]` pairs.\n\t  _.pairs = function(obj) {\n\t    var keys = _.keys(obj);\n\t    var length = keys.length;\n\t    var pairs = Array(length);\n\t    for (var i = 0; i < length; i++) {\n\t      pairs[i] = [keys[i], obj[keys[i]]];\n\t    }\n\t    return pairs;\n\t  };\n\t\n\t  // Invert the keys and values of an object. The values must be serializable.\n\t  _.invert = function(obj) {\n\t    var result = {};\n\t    var keys = _.keys(obj);\n\t    for (var i = 0, length = keys.length; i < length; i++) {\n\t      result[obj[keys[i]]] = keys[i];\n\t    }\n\t    return result;\n\t  };\n\t\n\t  // Return a sorted list of the function names available on the object.\n\t  // Aliased as `methods`\n\t  _.functions = _.methods = function(obj) {\n\t    var names = [];\n\t    for (var key in obj) {\n\t      if (_.isFunction(obj[key])) names.push(key);\n\t    }\n\t    return names.sort();\n\t  };\n\t\n\t  // Extend a given object with all the properties in passed-in object(s).\n\t  _.extend = createAssigner(_.allKeys);\n\t\n\t  // Assigns a given object with all the own properties in the passed-in object(s)\n\t  // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)\n\t  _.extendOwn = _.assign = createAssigner(_.keys);\n\t\n\t  // Returns the first key on an object that passes a predicate test\n\t  _.findKey = function(obj, predicate, context) {\n\t    predicate = cb(predicate, context);\n\t    var keys = _.keys(obj), key;\n\t    for (var i = 0, length = keys.length; i < length; i++) {\n\t      key = keys[i];\n\t      if (predicate(obj[key], key, obj)) return key;\n\t    }\n\t  };\n\t\n\t  // Return a copy of the object only containing the whitelisted properties.\n\t  _.pick = function(object, oiteratee, context) {\n\t    var result = {}, obj = object, iteratee, keys;\n\t    if (obj == null) return result;\n\t    if (_.isFunction(oiteratee)) {\n\t      keys = _.allKeys(obj);\n\t      iteratee = optimizeCb(oiteratee, context);\n\t    } else {\n\t      keys = flatten(arguments, false, false, 1);\n\t      iteratee = function(value, key, obj) { return key in obj; };\n\t      obj = Object(obj);\n\t    }\n\t    for (var i = 0, length = keys.length; i < length; i++) {\n\t      var key = keys[i];\n\t      var value = obj[key];\n\t      if (iteratee(value, key, obj)) result[key] = value;\n\t    }\n\t    return result;\n\t  };\n\t\n\t   // Return a copy of the object without the blacklisted properties.\n\t  _.omit = function(obj, iteratee, context) {\n\t    if (_.isFunction(iteratee)) {\n\t      iteratee = _.negate(iteratee);\n\t    } else {\n\t      var keys = _.map(flatten(arguments, false, false, 1), String);\n\t      iteratee = function(value, key) {\n\t        return !_.contains(keys, key);\n\t      };\n\t    }\n\t    return _.pick(obj, iteratee, context);\n\t  };\n\t\n\t  // Fill in a given object with default properties.\n\t  _.defaults = createAssigner(_.allKeys, true);\n\t\n\t  // Creates an object that inherits from the given prototype object.\n\t  // If additional properties are provided then they will be added to the\n\t  // created object.\n\t  _.create = function(prototype, props) {\n\t    var result = baseCreate(prototype);\n\t    if (props) _.extendOwn(result, props);\n\t    return result;\n\t  };\n\t\n\t  // Create a (shallow-cloned) duplicate of an object.\n\t  _.clone = function(obj) {\n\t    if (!_.isObject(obj)) return obj;\n\t    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);\n\t  };\n\t\n\t  // Invokes interceptor with the obj, and then returns obj.\n\t  // The primary purpose of this method is to \"tap into\" a method chain, in\n\t  // order to perform operations on intermediate results within the chain.\n\t  _.tap = function(obj, interceptor) {\n\t    interceptor(obj);\n\t    return obj;\n\t  };\n\t\n\t  // Returns whether an object has a given set of `key:value` pairs.\n\t  _.isMatch = function(object, attrs) {\n\t    var keys = _.keys(attrs), length = keys.length;\n\t    if (object == null) return !length;\n\t    var obj = Object(object);\n\t    for (var i = 0; i < length; i++) {\n\t      var key = keys[i];\n\t      if (attrs[key] !== obj[key] || !(key in obj)) return false;\n\t    }\n\t    return true;\n\t  };\n\t\n\t\n\t  // Internal recursive comparison function for `isEqual`.\n\t  var eq = function(a, b, aStack, bStack) {\n\t    // Identical objects are equal. `0 === -0`, but they aren't identical.\n\t    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n\t    if (a === b) return a !== 0 || 1 / a === 1 / b;\n\t    // A strict comparison is necessary because `null == undefined`.\n\t    if (a == null || b == null) return a === b;\n\t    // Unwrap any wrapped objects.\n\t    if (a instanceof _) a = a._wrapped;\n\t    if (b instanceof _) b = b._wrapped;\n\t    // Compare `[[Class]]` names.\n\t    var className = toString.call(a);\n\t    if (className !== toString.call(b)) return false;\n\t    switch (className) {\n\t      // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n\t      case '[object RegExp]':\n\t      // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n\t      case '[object String]':\n\t        // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n\t        // equivalent to `new String(\"5\")`.\n\t        return '' + a === '' + b;\n\t      case '[object Number]':\n\t        // `NaN`s are equivalent, but non-reflexive.\n\t        // Object(NaN) is equivalent to NaN\n\t        if (+a !== +a) return +b !== +b;\n\t        // An `egal` comparison is performed for other numeric values.\n\t        return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n\t      case '[object Date]':\n\t      case '[object Boolean]':\n\t        // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n\t        // millisecond representations. Note that invalid dates with millisecond representations\n\t        // of `NaN` are not equivalent.\n\t        return +a === +b;\n\t    }\n\t\n\t    var areArrays = className === '[object Array]';\n\t    if (!areArrays) {\n\t      if (typeof a != 'object' || typeof b != 'object') return false;\n\t\n\t      // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n\t      // from different frames are.\n\t      var aCtor = a.constructor, bCtor = b.constructor;\n\t      if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&\n\t                               _.isFunction(bCtor) && bCtor instanceof bCtor)\n\t                          && ('constructor' in a && 'constructor' in b)) {\n\t        return false;\n\t      }\n\t    }\n\t    // Assume equality for cyclic structures. The algorithm for detecting cyclic\n\t    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n\t\n\t    // Initializing stack of traversed objects.\n\t    // It's done here since we only need them for objects and arrays comparison.\n\t    aStack = aStack || [];\n\t    bStack = bStack || [];\n\t    var length = aStack.length;\n\t    while (length--) {\n\t      // Linear search. Performance is inversely proportional to the number of\n\t      // unique nested structures.\n\t      if (aStack[length] === a) return bStack[length] === b;\n\t    }\n\t\n\t    // Add the first object to the stack of traversed objects.\n\t    aStack.push(a);\n\t    bStack.push(b);\n\t\n\t    // Recursively compare objects and arrays.\n\t    if (areArrays) {\n\t      // Compare array lengths to determine if a deep comparison is necessary.\n\t      length = a.length;\n\t      if (length !== b.length) return false;\n\t      // Deep compare the contents, ignoring non-numeric properties.\n\t      while (length--) {\n\t        if (!eq(a[length], b[length], aStack, bStack)) return false;\n\t      }\n\t    } else {\n\t      // Deep compare objects.\n\t      var keys = _.keys(a), key;\n\t      length = keys.length;\n\t      // Ensure that both objects contain the same number of properties before comparing deep equality.\n\t      if (_.keys(b).length !== length) return false;\n\t      while (length--) {\n\t        // Deep compare each member\n\t        key = keys[length];\n\t        if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;\n\t      }\n\t    }\n\t    // Remove the first object from the stack of traversed objects.\n\t    aStack.pop();\n\t    bStack.pop();\n\t    return true;\n\t  };\n\t\n\t  // Perform a deep comparison to check if two objects are equal.\n\t  _.isEqual = function(a, b) {\n\t    return eq(a, b);\n\t  };\n\t\n\t  // Is a given array, string, or object empty?\n\t  // An \"empty\" object has no enumerable own-properties.\n\t  _.isEmpty = function(obj) {\n\t    if (obj == null) return true;\n\t    if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;\n\t    return _.keys(obj).length === 0;\n\t  };\n\t\n\t  // Is a given value a DOM element?\n\t  _.isElement = function(obj) {\n\t    return !!(obj && obj.nodeType === 1);\n\t  };\n\t\n\t  // Is a given value an array?\n\t  // Delegates to ECMA5's native Array.isArray\n\t  _.isArray = nativeIsArray || function(obj) {\n\t    return toString.call(obj) === '[object Array]';\n\t  };\n\t\n\t  // Is a given variable an object?\n\t  _.isObject = function(obj) {\n\t    var type = typeof obj;\n\t    return type === 'function' || type === 'object' && !!obj;\n\t  };\n\t\n\t  // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.\n\t  _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {\n\t    _['is' + name] = function(obj) {\n\t      return toString.call(obj) === '[object ' + name + ']';\n\t    };\n\t  });\n\t\n\t  // Define a fallback version of the method in browsers (ahem, IE < 9), where\n\t  // there isn't any inspectable \"Arguments\" type.\n\t  if (!_.isArguments(arguments)) {\n\t    _.isArguments = function(obj) {\n\t      return _.has(obj, 'callee');\n\t    };\n\t  }\n\t\n\t  // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,\n\t  // IE 11 (#1621), and in Safari 8 (#1929).\n\t  if (typeof /./ != 'function' && typeof Int8Array != 'object') {\n\t    _.isFunction = function(obj) {\n\t      return typeof obj == 'function' || false;\n\t    };\n\t  }\n\t\n\t  // Is a given object a finite number?\n\t  _.isFinite = function(obj) {\n\t    return isFinite(obj) && !isNaN(parseFloat(obj));\n\t  };\n\t\n\t  // Is the given value `NaN`? (NaN is the only number which does not equal itself).\n\t  _.isNaN = function(obj) {\n\t    return _.isNumber(obj) && obj !== +obj;\n\t  };\n\t\n\t  // Is a given value a boolean?\n\t  _.isBoolean = function(obj) {\n\t    return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n\t  };\n\t\n\t  // Is a given value equal to null?\n\t  _.isNull = function(obj) {\n\t    return obj === null;\n\t  };\n\t\n\t  // Is a given variable undefined?\n\t  _.isUndefined = function(obj) {\n\t    return obj === void 0;\n\t  };\n\t\n\t  // Shortcut function for checking if an object has a given property directly\n\t  // on itself (in other words, not on a prototype).\n\t  _.has = function(obj, key) {\n\t    return obj != null && hasOwnProperty.call(obj, key);\n\t  };\n\t\n\t  // Utility Functions\n\t  // -----------------\n\t\n\t  // Run Underscore.js in *noConflict* mode, returning the `_` variable to its\n\t  // previous owner. Returns a reference to the Underscore object.\n\t  _.noConflict = function() {\n\t    root._ = previousUnderscore;\n\t    return this;\n\t  };\n\t\n\t  // Keep the identity function around for default iteratees.\n\t  _.identity = function(value) {\n\t    return value;\n\t  };\n\t\n\t  // Predicate-generating functions. Often useful outside of Underscore.\n\t  _.constant = function(value) {\n\t    return function() {\n\t      return value;\n\t    };\n\t  };\n\t\n\t  _.noop = function(){};\n\t\n\t  _.property = property;\n\t\n\t  // Generates a function for a given object that returns a given property.\n\t  _.propertyOf = function(obj) {\n\t    return obj == null ? function(){} : function(key) {\n\t      return obj[key];\n\t    };\n\t  };\n\t\n\t  // Returns a predicate for checking whether an object has a given set of\n\t  // `key:value` pairs.\n\t  _.matcher = _.matches = function(attrs) {\n\t    attrs = _.extendOwn({}, attrs);\n\t    return function(obj) {\n\t      return _.isMatch(obj, attrs);\n\t    };\n\t  };\n\t\n\t  // Run a function **n** times.\n\t  _.times = function(n, iteratee, context) {\n\t    var accum = Array(Math.max(0, n));\n\t    iteratee = optimizeCb(iteratee, context, 1);\n\t    for (var i = 0; i < n; i++) accum[i] = iteratee(i);\n\t    return accum;\n\t  };\n\t\n\t  // Return a random integer between min and max (inclusive).\n\t  _.random = function(min, max) {\n\t    if (max == null) {\n\t      max = min;\n\t      min = 0;\n\t    }\n\t    return min + Math.floor(Math.random() * (max - min + 1));\n\t  };\n\t\n\t  // A (possibly faster) way to get the current timestamp as an integer.\n\t  _.now = Date.now || function() {\n\t    return new Date().getTime();\n\t  };\n\t\n\t   // List of HTML entities for escaping.\n\t  var escapeMap = {\n\t    '&': '&amp;',\n\t    '<': '&lt;',\n\t    '>': '&gt;',\n\t    '\"': '&quot;',\n\t    \"'\": '&#x27;',\n\t    '`': '&#x60;'\n\t  };\n\t  var unescapeMap = _.invert(escapeMap);\n\t\n\t  // Functions for escaping and unescaping strings to/from HTML interpolation.\n\t  var createEscaper = function(map) {\n\t    var escaper = function(match) {\n\t      return map[match];\n\t    };\n\t    // Regexes for identifying a key that needs to be escaped\n\t    var source = '(?:' + _.keys(map).join('|') + ')';\n\t    var testRegexp = RegExp(source);\n\t    var replaceRegexp = RegExp(source, 'g');\n\t    return function(string) {\n\t      string = string == null ? '' : '' + string;\n\t      return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;\n\t    };\n\t  };\n\t  _.escape = createEscaper(escapeMap);\n\t  _.unescape = createEscaper(unescapeMap);\n\t\n\t  // If the value of the named `property` is a function then invoke it with the\n\t  // `object` as context; otherwise, return it.\n\t  _.result = function(object, property, fallback) {\n\t    var value = object == null ? void 0 : object[property];\n\t    if (value === void 0) {\n\t      value = fallback;\n\t    }\n\t    return _.isFunction(value) ? value.call(object) : value;\n\t  };\n\t\n\t  // Generate a unique integer id (unique within the entire client session).\n\t  // Useful for temporary DOM ids.\n\t  var idCounter = 0;\n\t  _.uniqueId = function(prefix) {\n\t    var id = ++idCounter + '';\n\t    return prefix ? prefix + id : id;\n\t  };\n\t\n\t  // By default, Underscore uses ERB-style template delimiters, change the\n\t  // following template settings to use alternative delimiters.\n\t  _.templateSettings = {\n\t    evaluate    : /<%([\\s\\S]+?)%>/g,\n\t    interpolate : /<%=([\\s\\S]+?)%>/g,\n\t    escape      : /<%-([\\s\\S]+?)%>/g\n\t  };\n\t\n\t  // When customizing `templateSettings`, if you don't want to define an\n\t  // interpolation, evaluation or escaping regex, we need one that is\n\t  // guaranteed not to match.\n\t  var noMatch = /(.)^/;\n\t\n\t  // Certain characters need to be escaped so that they can be put into a\n\t  // string literal.\n\t  var escapes = {\n\t    \"'\":      \"'\",\n\t    '\\\\':     '\\\\',\n\t    '\\r':     'r',\n\t    '\\n':     'n',\n\t    '\\u2028': 'u2028',\n\t    '\\u2029': 'u2029'\n\t  };\n\t\n\t  var escaper = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\t\n\t  var escapeChar = function(match) {\n\t    return '\\\\' + escapes[match];\n\t  };\n\t\n\t  // JavaScript micro-templating, similar to John Resig's implementation.\n\t  // Underscore templating handles arbitrary delimiters, preserves whitespace,\n\t  // and correctly escapes quotes within interpolated code.\n\t  // NB: `oldSettings` only exists for backwards compatibility.\n\t  _.template = function(text, settings, oldSettings) {\n\t    if (!settings && oldSettings) settings = oldSettings;\n\t    settings = _.defaults({}, settings, _.templateSettings);\n\t\n\t    // Combine delimiters into one regular expression via alternation.\n\t    var matcher = RegExp([\n\t      (settings.escape || noMatch).source,\n\t      (settings.interpolate || noMatch).source,\n\t      (settings.evaluate || noMatch).source\n\t    ].join('|') + '|$', 'g');\n\t\n\t    // Compile the template source, escaping string literals appropriately.\n\t    var index = 0;\n\t    var source = \"__p+='\";\n\t    text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {\n\t      source += text.slice(index, offset).replace(escaper, escapeChar);\n\t      index = offset + match.length;\n\t\n\t      if (escape) {\n\t        source += \"'+\\n((__t=(\" + escape + \"))==null?'':_.escape(__t))+\\n'\";\n\t      } else if (interpolate) {\n\t        source += \"'+\\n((__t=(\" + interpolate + \"))==null?'':__t)+\\n'\";\n\t      } else if (evaluate) {\n\t        source += \"';\\n\" + evaluate + \"\\n__p+='\";\n\t      }\n\t\n\t      // Adobe VMs need the match returned to produce the correct offest.\n\t      return match;\n\t    });\n\t    source += \"';\\n\";\n\t\n\t    // If a variable is not specified, place data values in local scope.\n\t    if (!settings.variable) source = 'with(obj||{}){\\n' + source + '}\\n';\n\t\n\t    source = \"var __t,__p='',__j=Array.prototype.join,\" +\n\t      \"print=function(){__p+=__j.call(arguments,'');};\\n\" +\n\t      source + 'return __p;\\n';\n\t\n\t    try {\n\t      var render = new Function(settings.variable || 'obj', '_', source);\n\t    } catch (e) {\n\t      e.source = source;\n\t      throw e;\n\t    }\n\t\n\t    var template = function(data) {\n\t      return render.call(this, data, _);\n\t    };\n\t\n\t    // Provide the compiled source as a convenience for precompilation.\n\t    var argument = settings.variable || 'obj';\n\t    template.source = 'function(' + argument + '){\\n' + source + '}';\n\t\n\t    return template;\n\t  };\n\t\n\t  // Add a \"chain\" function. Start chaining a wrapped Underscore object.\n\t  _.chain = function(obj) {\n\t    var instance = _(obj);\n\t    instance._chain = true;\n\t    return instance;\n\t  };\n\t\n\t  // OOP\n\t  // ---------------\n\t  // If Underscore is called as a function, it returns a wrapped object that\n\t  // can be used OO-style. This wrapper holds altered versions of all the\n\t  // underscore functions. Wrapped objects may be chained.\n\t\n\t  // Helper function to continue chaining intermediate results.\n\t  var result = function(instance, obj) {\n\t    return instance._chain ? _(obj).chain() : obj;\n\t  };\n\t\n\t  // Add your own custom functions to the Underscore object.\n\t  _.mixin = function(obj) {\n\t    _.each(_.functions(obj), function(name) {\n\t      var func = _[name] = obj[name];\n\t      _.prototype[name] = function() {\n\t        var args = [this._wrapped];\n\t        push.apply(args, arguments);\n\t        return result(this, func.apply(_, args));\n\t      };\n\t    });\n\t  };\n\t\n\t  // Add all of the Underscore functions to the wrapper object.\n\t  _.mixin(_);\n\t\n\t  // Add all mutator Array functions to the wrapper.\n\t  _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {\n\t    var method = ArrayProto[name];\n\t    _.prototype[name] = function() {\n\t      var obj = this._wrapped;\n\t      method.apply(obj, arguments);\n\t      if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];\n\t      return result(this, obj);\n\t    };\n\t  });\n\t\n\t  // Add all accessor Array functions to the wrapper.\n\t  _.each(['concat', 'join', 'slice'], function(name) {\n\t    var method = ArrayProto[name];\n\t    _.prototype[name] = function() {\n\t      return result(this, method.apply(this._wrapped, arguments));\n\t    };\n\t  });\n\t\n\t  // Extracts the result from a wrapped and chained object.\n\t  _.prototype.value = function() {\n\t    return this._wrapped;\n\t  };\n\t\n\t  // Provide unwrapping proxy for some methods used in engine operations\n\t  // such as arithmetic and JSON stringification.\n\t  _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;\n\t\n\t  _.prototype.toString = function() {\n\t    return '' + this._wrapped;\n\t  };\n\t\n\t  // AMD registration happens at the end for compatibility with AMD loaders\n\t  // that may not enforce next-turn semantics on modules. Even though general\n\t  // practice for AMD registration is to be anonymous, underscore registers\n\t  // as a named module because, like jQuery, it is a base library that is\n\t  // popular enough to be bundled in a third party lib, but not be part of\n\t  // an AMD load request. Those cases could generate an error when an\n\t  // anonymous define() is called outside of a loader request.\n\t  if (true) {\n\t    !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t      return _;\n\t    }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t  }\n\t}.call(this));\n\n\n/***/ }\n/******/ ]);\n//# sourceMappingURL=bundle.js.map"
  },
  {
    "path": "36-webpack/code/index.html",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta charset=\"utf-8\">\n    <title>User Profile</title>\n    <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css\" media=\"screen\">\n  </head>\n  <body>\n\n    <div class=\"container\">\n      <div class=\"page-header\">\n        <h1 id=\"timeline\"></h1>\n      </div>\n      <ul class=\"timeline\">\n      </ul>\n\n    </div>\n\n    <script src=\"dist/bundle.js\" charset=\"utf-8\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "36-webpack/code/js/profile.js",
    "content": "require('../css/style.css');\n\nvar timeline = require('./timeline.js');\nvar user = {\n  name : \"Shekhar Gulati\",\n  messages : [\n    \"hello\",\n    \"bye\",\n    \"good night\"\n  ]\n};\n\nvar timelineModule = new timeline(user);\ntimelineModule.setHeader(user);\ntimelineModule.setTimeline(user);\n"
  },
  {
    "path": "36-webpack/code/js/timeline.js",
    "content": "var $ = require('jquery');\nvar _ = require('underscore');\n\nfunction timeline(user){\n  this.setHeader = function(){\n      $(\"#timeline\").text(user.name+ \" Timeline\");\n  }\n\n  this.setTimeline = function(){\n    _.each(user.messages, function(msg){\n      var html = \"<li><div class='timeline-heading'><h4 class='timeline-title'>\"+msg+\"</h4></div></li>\";\n      $(\".timeline\").append(html);\n    });\n  }\n}\n\nmodule.exports = timeline;\n"
  },
  {
    "path": "36-webpack/code/package.json",
    "content": "{\n  \"name\": \"traditional\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"bootstrap\": \"^3.3.7\",\n    \"jquery\": \"^3.1.0\",\n    \"underscore\": \"^1.8.3\",\n    \"webpack\": \"^1.13.2\"\n  },\n  \"devDependencies\": {\n    \"bootstrap\": \"^3.3.7\",\n    \"css-loader\": \"^0.24.0\",\n    \"style-loader\": \"^0.13.1\"\n  }\n}\n"
  },
  {
    "path": "36-webpack/code/webpack.config.js",
    "content": "var webpack = require('webpack');\n\nmodule.exports = {\n  context: __dirname,\n  devtool: \"source-map\",\n  entry: \"./js/profile.js\",\n  output: {\n    path: __dirname + \"/dist\",\n    filename: \"bundle.js\"\n  },\n  module:{\n    loaders: [\n      {test : /\\.css$/, loader: 'style!css!'}\n    ]\n  },\n  devServer: {\n    inline:true,\n    port: 10000\n  },\n}\n"
  },
  {
    "path": "37-spring-boot-scala/README.md",
    "content": "Building \"Bootiful\" Scala Web Applications with Spring Boot\n---\n\nWelcome to the thirty-seventh post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I started work on a project where I decided to use [Spring Boot](http://projects.spring.io/spring-boot/). Scala is my preferred programming language so I decided to use Scala and Spring Boot together. The reason I decided to use Spring Boot Scala combo is because web frameworks in Scala community are over-complicated and over-engineered. They just don't feel natural and lacks good documentation. More often than not they make you unproductive as you spend time fighting with the framework rather than working on your business problem. On the other hand, I find [Spring Boot](http://projects.spring.io/spring-boot/) productive and matching my taste. Spring Boot documentation and community support helps you in case you are struck. Spring Boot lives up to its vision as mentioned on its [website](http://projects.spring.io/spring-boot/).\n\n> **Takes an opinionated view of building production-ready Spring applications. Spring Boot favors convention over configuration and is designed to get you up and running as quickly as possible.**\n\nIn this post, I will quickly show you how to use Spring Boot with Scala by converting Spring Boot's official [*Building a RESTful Web Service*](https://spring.io/guides/gs/rest-service/) guide to Scala.\n\n## Prerequisite\n\nTo work through this post, you will need following installed on your machine.\n\n1. Your favorite IDE. I use IntelliJ community edition and it provides everything you need for Java and Scala development\n2. [JDK 1.8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) or later\n3. [Gradle 2.3 or above](http://www.gradle.org/downloads)\n4. [Scala 2.11.8](http://www.scala-lang.org/download/)\n\n## What you will build?\n\nYou’ll build a service that will accept HTTP GET requests at:\n\n```\nhttp://localhost:8080/greeting\n```\n\nand respond with a JSON representation of a greeting:\n\n```json\n{\"id\":1,\"content\":\"Hello, World!\"}\n```\n\nYou can customize the greeting with an optional `name` parameter in the query string:\n\n```\nhttp://localhost:8080/greeting?name=User\n```\n\nThe `name` parameter value overrides the default value of \"World\" and is reflected in the response:\n\n```json\n{\"id\":1,\"content\":\"Hello, User!\"}\n```\n\n## Step 1: Create a Scala Gradle project\n\nWe will be using Gradle as our build tool. Spring Boot has good support for Gradle. Navigate to a convenient location on your file system and create a new directory to house your application source code.\n\n```bash\n$ mkdir gs-rest-service && cd gs-rest-service\n```\n\nNow, we will use Gradle init plugin to bootstrap a Scala project by typing the command shown below.\n\n```bash\n$ gradle init --type scala-library\n```\n\nThe created Scala project has following features:\n\n* Uses the **scala** plugin\n* Uses the **jcenter** dependency repository\n* Uses **Scala 2.11.8**\n* Uses **ScalaTest** for testing\n* Has directories in the **conventional locations** for source code\n* Uses the **Zinc** Scala compiler by default\n\nYou can read more about init plugin in the official [documentation](https://docs.gradle.org/current/userguide/build_init_plugin.html).\n\nNow, you can import the project in your favorite IDE.\n\n## Step 2: Bootify the project\n\nNow, that our project is ready. Let's add Spring Boot to the project. Open the `build.gradle` file and copy the content mentioned below to it.\n\n```groovy\nbuildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath(\"org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE\")\n    }\n}\n\napply plugin: 'scala'\napply plugin: 'spring-boot'\n\njar {\n    baseName = 'gs-rest-service'\n    version = '0.1.0-SNAPSHOT'\n}\n\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    compile 'org.scala-lang:scala-library:2.11.8'\n    compile(\"org.springframework.boot:spring-boot-starter-web\")\n\n    testCompile 'junit:junit:4.12'\n    testCompile 'org.springframework.boot:spring-boot-starter-test'\n}\n```\n\nIn the `build.gradle` shown above we did following:\n\n1. We applied `scala` plugin so that Gradle treat this project as a Scala project.\n2. We applied `spring-boot` plugin. `spring-boot` plugin provides features like creating a single executable jar, searches for main method to flag as a runnable class, built-in dependency resolver that sets the version number to match Spring Boot dependencies.\n3. We defined the name of the jar and version.\n4. We added Scala and Spring Boot dependencies to the `dependencies` section.\n\n\n## Step 3: Writing test\n\nWe follow TDD and write our test first. Spring Boot provides very good support for testing via Spring MVC Test infrastructure. Inside `src/test/scala` create a new project `hello` and create a test with following content.\n\n```scala\npackage hello\n\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.springframework.beans.factory.annotation.Autowired\nimport org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc\nimport org.springframework.boot.test.context.SpringBootTest\nimport org.springframework.test.context.junit4.SpringRunner\nimport org.springframework.test.web.servlet.MockMvc\nimport org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get\nimport org.springframework.test.web.servlet.result.MockMvcResultMatchers\nimport org.springframework.test.web.servlet.result.MockMvcResultMatchers.status\n\n@RunWith(classOf[SpringRunner])\n@SpringBootTest\n@AutoConfigureMockMvc\nclass GreetingControllerTest {\n\n  @Autowired\n  var mockMvc: MockMvc = _\n\n  @Test\n  def helloWorldMessageWhenNameParameterIsNotSet(): Unit = {\n    mockMvc.perform(get(\"/greeting\"))\n      .andExpect(status().isOk)\n      .andExpect(MockMvcResultMatchers.content().json(\"\"\"{\"id\":1,\"content\":\"Hello, World!\"}\"\"\"))\n  }\n\n  @Test\n  def helloUserWhenNameParameterIsSetToUser(): Unit = {\n    mockMvc.perform(get(\"/greeting\").param(\"name\",\"User\"))\n      .andExpect(status().isOk)\n      .andExpect(MockMvcResultMatchers.content().json(\"\"\"{\"id\":2,\"content\":\"Hello, User!\"}\"\"\"))\n  }\n\n}\n```\n\nTo learn more about Spring Boot testing support refer to [testing guide](https://spring.io/guides/gs/testing-web/).\n\n## Step 4: Create GreetingController\n\nNow, we will write `GreetingController` that will provide the REST API. Create a new package `hello` inside the `src/main/scala` directory and populate it with following code.\n\n```scala\npackage hello\n\nimport java.util.concurrent.atomic.AtomicLong\n\nimport hello.GreetingController.Greeting\nimport org.springframework.web.bind.annotation.{RequestMapping, RequestParam, RestController}\n\nimport scala.beans.BeanProperty\n\n@RestController\nclass GreetingController {\n\n  val template: String = \"Hello, %s\"\n  val counter: AtomicLong = new AtomicLong()\n\n  @RequestMapping(path = Array(\"/greeting\"))\n  def greeting(@RequestParam(value = \"name\", defaultValue = \"World\") name: String) =\n    new Greeting(counter.incrementAndGet(), template.format(name))\n\n\n}\n```\n\n## Step 5: Create a resource representation\n\nCreate a companion object of `GreetingController` that will hold the `Greeting` representation.\n\n```scala\nobject GreetingController {\n\n  class Greeting(@BeanProperty var id: Long, @BeanProperty var content: String)\n\n}\n```\n\nScala classes does not follow Java bean conventions. So, you have annotate class variables with `@BeanProperty` annotation.\n\n## Step 6: Make the application executable\n\nSpring Boot applications are normally packaged as executable JARs. To make an executable JAR, your JAR should have a class with a `main` method.\n\n```scala\npackage hello\n\nimport org.springframework.boot.SpringApplication\nimport org.springframework.boot.autoconfigure.SpringBootApplication\n\nobject Application extends App {\n\n  SpringApplication.run(classOf[Application], args: _*)\n\n}\n\n@SpringBootApplication\nclass Application\n```\n\n## Step 7: Run the application\n\nExecute the command shown below to run the Spring Boot application.\n\n```bash\n$ ./gradlew bootRun\n```\n\nThis will start the application at port 8080. You can access your app at http://localhost:8080/greeting/\n\nTest the application by making a cURL request.\n\n```bash\n$ curl -i http://localhost:8080/greeting?name=Shekhar\n```\n```\nHTTP/1.1 200\nContent-Type: application/json;charset=UTF-8\nTransfer-Encoding: chunked\nDate: Sun, 11 Sep 2016 20:53:26 GMT\n\n{\"id\":4,\"content\":\"Hello, Shekhar\"}\n```\n\n-----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/55](https://github.com/shekhargulati/52-technologies-in-2016/issues/55).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/37-spring-boot-scala)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/.gitignore",
    "content": "# Created by .ignore support plugin (hsz.mobi)\n### JetBrains template\n# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm\n# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839\n\n# User-specific stuff:\n.idea/workspace.xml\n.idea/tasks.xml\n.idea/dictionaries\n.idea/vcs.xml\n.idea/jsLibraryMappings.xml\n\n# Sensitive or high-churn files:\n.idea/dataSources.ids\n.idea/dataSources.xml\n.idea/dataSources.local.xml\n.idea/sqlDataSources.xml\n.idea/dynamic.xml\n.idea/uiDesigner.xml\n\n# Gradle:\n.idea/gradle.xml\n.idea/libraries\n\n# Mongo Explorer plugin:\n.idea/mongoSettings.xml\n\n## File-based project format:\n*.iws\n\n## Plugin-specific files:\n\n# IntelliJ\n/out/\n\n# mpeltonen/sbt-idea plugin\n.idea_modules/\n\n# JIRA plugin\natlassian-ide-plugin.xml\n\n# Crashlytics plugin (for Android Studio and IntelliJ)\ncom_crashlytics_export_strings.xml\ncrashlytics.properties\ncrashlytics-build.properties\nfabric.properties\n### Scala template\n*.class\n*.log\n\n# sbt specific\n.cache\n.history\n.lib/\ndist/*\ntarget/\nlib_managed/\nsrc_managed/\nproject/boot/\nproject/plugins/project/\n\n# Scala-IDE specific\n.scala_dependencies\n.worksheet\n### Gradle template\n.gradle\nbuild/\n\n# Ignore Gradle GUI config\ngradle-app.setting\n\n# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)\n!gradle-wrapper.jar\n\n# Cache of project\n.gradletasknamecache\n\n# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898\n# gradle/wrapper/gradle-wrapper.properties\n\n.idea/\n\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/build.gradle",
    "content": "buildscript {\n    repositories {\n        mavenCentral()\n    }\n    dependencies {\n        classpath(\"org.springframework.boot:spring-boot-gradle-plugin:1.4.0.RELEASE\")\n    }\n}\n\napply plugin: 'scala'\napply plugin: 'spring-boot'\n\njar {\n    baseName = 'gs-rest-service'\n    version = '0.1.0-SNAPSHOT'\n}\n\nrepositories {\n    jcenter()\n}\n\ndependencies {\n    compile 'org.scala-lang:scala-library:2.11.8'\n    compile(\"org.springframework.boot:spring-boot-starter-web\")\n\n    testCompile 'junit:junit:4.12'\n    testCompile 'org.springframework.boot:spring-boot-starter-test'\n}\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Mon Sep 12 01:26:09 IST 2016\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-2.12-all.zip\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windows variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/settings.gradle",
    "content": "/*\n * This settings file was auto generated by the Gradle buildInit task\n * by 'shekhargulati' at '9/12/16 1:03 AM' with Gradle 2.12\n *\n * The settings file is used to specify which projects to include in your build.\n * In a single project build this file can be empty or even removed.\n *\n * Detailed information about configuring a multi-project build in Gradle can be found\n * in the user guide at https://docs.gradle.org/2.12/userguide/multi_project_builds.html\n */\n\n/*\n// To declare projects as part of a multi-project build use the 'include' method\ninclude 'shared'\ninclude 'api'\ninclude 'services:webservice'\n*/\n\nrootProject.name = 'gs-rest-service'\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/src/main/scala/hello/Application.scala",
    "content": "package hello\n\nimport org.springframework.boot.SpringApplication\nimport org.springframework.boot.autoconfigure.SpringBootApplication\n\nobject Application extends App {\n\n  SpringApplication.run(classOf[Application], args: _*)\n\n}\n\n@SpringBootApplication\nclass Application\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/src/main/scala/hello/GreetingController.scala",
    "content": "package hello\n\nimport java.util.concurrent.atomic.AtomicLong\n\nimport hello.GreetingController.Greeting\nimport org.springframework.web.bind.annotation.{RequestMapping, RequestParam, RestController}\n\nimport scala.beans.BeanProperty\n\n@RestController\nclass GreetingController {\n\n  val template: String = \"Hello, %s!\"\n  val counter: AtomicLong = new AtomicLong()\n\n  @RequestMapping(path = Array(\"/greeting\"))\n  def greeting(@RequestParam(value = \"name\", defaultValue = \"World\") name: String) =\n    new Greeting(counter.incrementAndGet(), template.format(name))\n\n\n}\n\nobject GreetingController {\n\n  class Greeting(@BeanProperty var id: Long, @BeanProperty var content: String)\n\n}\n"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/src/main/scala/hello/PingController.scala",
    "content": "package hello\n\nimport org.springframework.web.bind.annotation.{RequestMapping, RestController}\n\n@RestController\nclass PingResource {\n\n  @RequestMapping(path = Array(\"/ping\"))\n  def ping(): String = \"pong\"\n\n}"
  },
  {
    "path": "37-spring-boot-scala/gs-rest-service/src/test/scala/hello/GreetingControllerTest.scala",
    "content": "package hello\n\nimport org.junit.Test\nimport org.junit.runner.RunWith\nimport org.springframework.beans.factory.annotation.Autowired\nimport org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc\nimport org.springframework.boot.test.context.SpringBootTest\nimport org.springframework.test.context.junit4.SpringRunner\nimport org.springframework.test.web.servlet.MockMvc\nimport org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get\nimport org.springframework.test.web.servlet.result.MockMvcResultMatchers\nimport org.springframework.test.web.servlet.result.MockMvcResultMatchers.status\n\n@RunWith(classOf[SpringRunner])\n@SpringBootTest\n@AutoConfigureMockMvc\nclass GreetingControllerTest {\n\n  @Autowired\n  var mockMvc: MockMvc = _\n\n  @Test\n  def helloWorldMessageWhenNameParameterIsNotSet(): Unit = {\n    mockMvc.perform(get(\"/greeting\"))\n      .andExpect(status().isOk)\n      .andExpect(MockMvcResultMatchers.content().json(\"\"\"{\"id\":1,\"content\":\"Hello, World!\"}\"\"\"))\n  }\n\n  @Test\n  def helloUserWhenNameParameterIsSetToUser(): Unit = {\n    mockMvc.perform(get(\"/greeting\").param(\"name\",\"User\"))\n      .andExpect(status().isOk)\n      .andExpect(MockMvcResultMatchers.content().json(\"\"\"{\"id\":2,\"content\":\"Hello, User!\"}\"\"\"))\n  }\n\n\n\n}\n"
  },
  {
    "path": "38-akka/README.md",
    "content": "Actor System Termination on JVM Shutdown\n----\n\nWelcome to the thirty-eight post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. In my day job, I work on a backend system that uses Akka. [Akka](http://akka.io/) is a toolkit and runtime for building highly concurrent, distributed and resilient message driven systems. I will write an in-depth Akka tutorial some other week. This week I will talk about a specific problem that I was trying to solve. We have two applications that talk over each other via [Akka remoting](http://doc.akka.io/docs/akka/current/scala/remoting.html). First application can shutdown the second application programmatically by sending a message to the second application ActorSystem.  Shutdown here means you can exit the JVM. To make sure we do a clean shutdown, we added JVM shutdown hook that terminates the ActorSystem.\n\nThis was implemented as shown below.\n\n```scala\npackage playground\n\nimport akka.actor.{Actor, ActorRef, ActorSystem, Props, Terminated}\nimport akka.dispatch.MonitorableThreadFactory\nimport playground.App1ControlActor.Stop\n\nimport scala.concurrent.duration.Duration\nimport scala.concurrent.{Await, Future}\n\nobject App1 extends App {\n\n  private val system: ActorSystem = ActorSystem(\"app1-akka-system\")\n\n  private val actor: ActorRef = system.actorOf(Props[App1ControlActor])\n\n  Runtime.getRuntime.addShutdownHook(MonitorableThreadFactory(\"monitoring-thread-factory\", false,\n    Some(Thread.currentThread().getContextClassLoader)).newThread(new Runnable {\n    override def run(): Unit = {\n      val terminate: Future[Terminated] = system.terminate()\n      Await.result(terminate, Duration(\"10 seconds\"))\n    }\n  }))\n\n  actor ! Stop\n\n}\n\n\nclass App1ControlActor extends Actor {\n\n  import App1ControlActor._\n\n  override def receive: Receive = {\n    case Stop =>\n      println(\"Stopping application\")\n      System.exit(1)\n  }\n\n\n}\n\nobject App1ControlActor {\n\n  case object Stop\n\n}\n```\n\nIn the code shown above, we did the following:\n\n1. We created an ActorSystem with name `app1-akka-system`. This ActorSystem was then used to create an Actor `App1ControlActor`.\n2. We registered a JVM shutdown hook that terminates the ActorSystem. To terminate the `ActorSystem`, we made a call to `system.terminate` method. The `system.terminate` give back a future. We waited 10 seconds for future to finish.\n3. We send the `Stop` message to `App1ControlActor`. The actor shutdown the JVM by calling `System.exit`.\n\nIf you will run the Scala application shown above it will run fine. You will not see any exception. This code was working in production system for more than a year. The output that you will see in the console is shown below.\n\n```\nStopping application\n\nProcess finished with exit code 1\n```\n\nThis week I was asked to improve logging of this code. I just had to add a log statement on ActorSystem termination. This looked easy so I added `registerOnTermination` call. The `registerOnTermination` register a block of code (callback) to run after `ActorSystem.shutdown` has been issued and all actors in this actor system have been stopped.\n\n```scala\nobject App1 extends App {\n\n  private val system: ActorSystem = ActorSystem(\"app1-akka-system\")\n\n  private val actor: ActorRef = system.actorOf(Props[App1ControlActor])\n\n  Runtime.getRuntime.addShutdownHook(MonitorableThreadFactory(\"monitoring-thread-factory\", false,\n    Some(Thread.currentThread().getContextClassLoader)).newThread(new Runnable {\n    override def run(): Unit = {\n      val terminate: Future[Terminated] = system.terminate()\n      Await.result(terminate, Duration(\"10 seconds\"))\n    }\n  }))\n\n  system.registerOnTermination {\n    println(\"ActorSystem terminated\")\n  }\n\n  actor ! Stop\n\n\n}\n```\n\nRun the code again. You will notice that `ActorSystem terminated` was never printed.\n\nThis made me wonder if termination was successful. Also, I tried to understand why I don't see any exception in the console.\n\nI was not sure why we are using `MonitorableThreadFactory` so I removed it and created a thread manually as shown below.\n\n```scala\nobject App1 extends App {\n\n  private val system: ActorSystem = ActorSystem(\"app1-akka-system\")\n\n  private val actor: ActorRef = system.actorOf(Props[App1ControlActor])\n\n  Runtime.getRuntime.addShutdownHook(new Thread(new Runnable {\n    override def run(): Unit = {\n      val terminate: Future[Terminated] = system.terminate()\n      Await.result(terminate, Duration(\"10 seconds\"))\n    }\n  }))\n\n  system.registerOnTermination {\n    println(\"ActorSystem terminated\")\n  }\n\n  actor ! Stop\n\n\n}\n```\nWhen you run this code, you will see exception in the console. The future timeout after 10 seconds. The reason we were not seeing exception with `MonitorableThreadFactory` is that we were using the default Noop uncaught exception handler which was not logging exception scenarios.\n\n```\nStopping application\nException in thread \"Thread-0\" java.util.concurrent.TimeoutException: Futures timed out after [10 seconds]\n\tat scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219)\n\tat scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223)\n\tat scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190)\n\tat scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53)\n\tat scala.concurrent.Await$.result(package.scala:190)\n\tat playground.App1$$anon$1.run(App1.scala:19)\n\tat java.lang.Thread.run(Thread.java:745)\n```\n\nTo make sure I give sufficient time to ActorSystem for termination I changed duration to `Duration.Inf`. It made system never terminate.\n\nThis looked to us a deadlock where `ActorSystem` waits for all actors to terminate and Actor is waiting for system to exit.\n\nTo solve this use case, we scheduled the JVM exit using the ActorSystem `scheduler`. This meant `App1ControlActor` can successfully shut down and does not have to wait for JVM to exit. Hence, avoiding dead lock.\n\n```scala\nclass App1ControlActor extends Actor {\n\n  import App1ControlActor._\n\n  override def receive: Receive = {\n    case Stop =>\n      println(\"Stopping application\")\n      implicit val executionContext: ExecutionContext = context.system.dispatcher\n      context.system.scheduler.scheduleOnce(Duration.Zero)(System.exit(1))\n  }\n\n\n}\n```\n\n\nIf you run the code now, it will work fine. The console will show correct output as shown below.\n\n```\nStopping application\nActorSystem terminated\n```\n\n-----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by posting a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/57](https://github.com/shekhargulati/52-technologies-in-2016/issues/57).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/38-akka)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "39-docker/README.md",
    "content": "Docker for Java Developers Part 1\n--------\n\nWelcome to thirty-ninth post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) series. This week I had to give a talk on Docker ecosystem so I spent a lot of my after office hours preparing for the talk. [Docker](http://docker.com/) is a container technology that allows us to package an application and its dependencies together in a filesystem so that they can be deployed together on any server. This helps us achieve package once deploy anywhere. So, in the next few posts of this series, we will learn how Java developers can get started with Docker.\n\nI first learnt about Docker in 2013 when OpenShift decided to rewrite itself using Docker and Kubernetes. At that time, I wrote [Docker: The Missing Tutorial](https://blog.openshift.com/day-21-docker-the-missing-tutorial/) post to share my understanding of Docker with the community. Since then, I have followed Docker ecosystem and used it in few of my projects. Docker has matured from a cool project to a container platform with a very rich toolset.\n\n> **This blog is part of my year long blog series [52 Technologies in 2016](https://github.com/shekhargulati/52-technologies-in-2016)**\n\n## Docker Introduction\n\nDeployment is a complicated problem and a lot can go wrong during the deployment phase. It usually involves a series of steps that have to be performed repeatedly to make your application run on servers. Deployments can go wrong because of various reasons. Some of these are mentioned below.\n\n1. There could be disparity between different environments that could cause deployment failure.\n2. An application dependency might be missing in production environment that could lead to deployment failure.\n3. Lack of automation might result in a failure.\n\nOver the last decade, we have seen many efforts to make deployments easy and reliable. For me, Google App Engine was the first such system that made deployment a non-issue. Google App Engine was the first Platform as a Service solution that I used to build Java applications back in 2008. You can deploy applications to servers running in Google datacenter from within your IDE. After that I have seen many PaaS like Heroku and OpenShift that made application deployment much more easier. Deployment became just a `git push`.\n\nMost PaaS providers realized that using virtual machines as their unit of computation is not efficient. Virtual Machines are too heavy weight for most use cases and they will not be able to run profitable business with them. So, they started looking for other lightweight options. One such option was LXC (Linux Containers). LXC (Linux Containers) is an operating-system-level virtualization method for running multiple isolated Linux systems (containers) on a control host using a single Linux kernel. This looked like a promising option that can give the efficiency needed to run millions of applications. My first interaction with a system that had something like containers underneath was OpenShift. OpenShift versions prior to 3 had a concept of gears, which was a wrapping around cgroups and namespaces and secured using SELinux. This allowed them to achieve high density of gears on a single virtual machine. OpenShift gears lacked easy way to build them and they were kind of custom hack.\n\nIn 2013, Docker originated as a side project of Solomon Hykes, co-founder and CEO of Dotcloud. Dot Cloud was another PaaS provider just like Heroku and OpenShift, which was also playing with idea of using containers to sandbox and isolate different applications. Docker received a lot of attention and buzz so Dotcloud renamed itself to Docker Inc in 2013. Since then Docker has become the most popular container technology.\n\nDocker container wraps software and its dependencies in a filesystem that can be installed on a server. Docker helps to:\n\n1. Build: Package an application into an image\n2. Ship: Share image with others using registries\n3. Run: instantiate an image into a container\n\n## Getting started with Docker\n\nDownload Docker for your operating system from the [Docker website](https://www.docker.com/products/overview).\n\nIf you are a Mac user then download it from [https://download.docker.com/mac/stable/Docker.dmg](https://download.docker.com/mac/stable/Docker.dmg). Once downloaded install it on your machine.  You will see Docker whale icon in your Mac Menu Bar at the top of your screen as shown below.\n\n![](images/docker-for-mac.png)\n\nAs you can see Docker is running. You can restart or quit the Docker using this user interface. If you click on the Preferences option then you can see how much memory and CPU is allocated to it.\n\n![](images/docker-preferences.png)\n\n### Running a Java 8 container\n\nLet's start working with Docker by launching a Java 8 container. When you install Docker, it installs both the Docker server and command-lien client. Docker command-line client that we can use to interact with the Docker server. To run a Java 8 container, you can use the `run` command as shown below.\n\n```\n$ docker run openjdk:8\n```\n\nIn the command shown above, we said that we want to run Java container using the `openjdk:8` image. `docker run` command runs a container using the default command defined in its image. Image name is comprised of two parts -- name and label. openjdk is the name and 8 is the label. 8 here signifies that we want to use OpenJDK 8. This makes it feasible to use the same image name for different versions. There are different labels for different version of Java. You can view all OpenJDK versions available as Docker images [here](https://hub.docker.com/_/openjdk/).\n\n> **The `openjdk` is the official image of Java now. The `java` image is deprecated. It is recommended that you use `openjdk` images instead of `java` images.**\n\nIf you execute the above command, you will not see any visible output. We can check all the running containers using the `ps` command.\n\n```\n$ docker ps\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES\n```\n\nAs you can see there are no running containers. To see all the container irrespective of their state you can use `--all` option as shown below.\n\n```\n$ docker ps --all\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS                     PORTS               NAMES\nb320d9235f10        openjdk:8           \"/bin/bash\"         2 minutes ago       Exited (0) 2 minutes ago                       thirsty_hodgkin\n```\n\nAs you can see container ran, executed the `/bin/bash` command and then exited. Docker containers die when process they launched on startup dies. As `/bin/bash` is a short lived process so container exited.\n\nWe can launch container in interactive mode with a pseudo tty terminal by using the `-it` options.\n\n```bash\n$ docker run -it openjdk:8\nroot@0118e01e0bcc:/#\n```\n\nThis will launch the container and attach a pseudo TTY terminal to it. Open a new terminal and you will see the running container.\n\n```bash\n$ docker ps\n```\n```\nCONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES\n0118e01e0bcc        openjdk:8           \"/bin/bash\"         42 seconds ago      Up 41 seconds                           sad_banach\n```\n\nThis time you will see that container is `Up 41 seconds`. When you run a container, docker gives it a unique id denoted that you can see under the CONTAINER ID column.\n\nYou can check the exact version of Java by running `java -version` inside the container as shown below.\n\n```bash\nroot@0118e01e0bcc:/# java -version\n```\n```\nopenjdk version \"1.8.0_102\"\nOpenJDK Runtime Environment (build 1.8.0_102-8u102-b14.1-1~bpo8+1-b14)\nOpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)\n```\n\nYou can check the JAVA_HOME environment variable as shown below.\n\n```bash\nroot@0118e01e0bcc:/# echo $JAVA_HOME\n```\n```\n/usr/lib/jvm/java-8-openjdk-amd64/\n```\n\nNow, we will run a simple Java program in our container. There is no text editor installed in the container so we will clone a Gist from Github to the container's `code` directory. Let's create a directory `code` inside the container's user home directory and navigate to it.\n\n```\nroot@0118e01e0bcc:/# mkdir ~/code && cd ~/code\nroot@0118e01e0bcc:~/code#\n```\n\nThe container comes with git installed. So, we will use git to clone a Github gist as shown below.\n\n```bash\nroot@0118e01e0bcc:~/code# git clone https://gist.github.com/79941605ae314c544e8ad93651df666a.git .\n```\n```\nCloning into '.'...\nremote: Counting objects: 5, done.\nremote: Compressing objects: 100% (3/3), done.\nremote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0\nUnpacking objects: 100% (5/5), done.\nChecking connectivity... done.\n```\n\nLet's look at the content of our program.\n\n```\nroot@0118e01e0bcc:~/code# cat EvenNumbers.java\n```\n```java\nimport java.util.stream.IntStream;\n\npublic class EvenNumbers {\n\n    public static void main(String[] args) {\n        IntStream\n                .rangeClosed(1, 10)\n                .filter(i -> i % 2 == 0)\n                .forEach(System.out::println);\n    }\n}\n```\n\nIt is a simple program that prints first five even numbers using Java 8 features. Now, compile and run your Java program by running command shown below.\n\n```bash\nroot@0118e01e0bcc:~/code# javac EvenNumbers.java\nroot@0118e01e0bcc:~/code# java EvenNumbers\n```\n```\n2\n4\n6\n8\n10\n```\n\nExit the container. After you exit the container, container is stopped. At anytime you can start the container by using the `docker start <container_id>` command. To remove the container, you can use `docker rm <container_id>` command. Please replace `container_id` with your container id.\n\nTo remove all the stopped containers you can run the following command on your host system.\n\n```bash\n$ docker rm $(docker ps -aq --filter=status=exited)\n```\n\n## Running an application inside a container\n\nIn this blog, we will use a simple todo application `taskman` that I built using Spring Boot. The application expose two REST endpoint -- 1) `/api/tasks` POST endpoint to create new tasks 2) `/api/tasks` GET endpoint to fetch all the tasks. We will start with an in-memory database and later use a real database. We will start by doing what we did in previous section. We will launch a Java 8 container in an interactive mode.\n\n```bash\n→ docker run -it openjdk:8\nroot@ddfd44abc1a9:/#\n```\nopenjdk:8 container has git installed so we will use git to clone the `taskman` application.\n\n```\nroot@ddfd44abc1a9:/# mkdir ~/code && cd ~/code\nroot@ddfd44abc1a9:~/code# git clone https://github.com/shekhargulati/taskman.git\nroot@ddfd44abc1a9:~/code# cd taskman/\n```\n\nThis is a Gradle application.\n\n```\nroot@ddfd44abc1a9:~/code/taskman# ls -l\ntotal 36\n-rw-r--r-- 1 root root   53 Oct  6 16:23 README.md\n-rw-r--r-- 1 root root 1010 Oct  6 16:23 build.gradle\ndrwxr-xr-x 2 root root 4096 Oct  6 16:23 docker\ndrwxr-xr-x 3 root root 4096 Oct  6 16:23 gradle\n-rwxr-xr-x 1 root root 5046 Oct  6 16:23 gradlew\n-rw-r--r-- 1 root root 2314 Oct  6 16:23 gradlew.bat\n-rw-r--r-- 1 root root   30 Oct  6 16:23 settings.gradle\ndrwxr-xr-x 3 root root 4096 Oct  6 16:23 src\n```\n\nThis is a Spring Boot application that we can start using a Gradle task `bootRun`. This step will take time as gradlew will first download Gradle and then download taskman dependencies. Please remain patient.\n\n```\nroot@ddfd44abc1a9:~/code/taskman# ./gradlew clean bootRun\n```\n\nOnce finished, you will see following printed in your console.\n\n```\n2016-10-06 16:30:51.299  INFO 52 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)\n2016-10-06 16:30:51.302  INFO 52 --- [           main] taskman.TaskManApp                       : Started TaskManApp in 4.397 seconds (JVM running for 4.757)\n```\n\nThe application has started on port 8080 inside the container. The application is not accessible from our host system so to test our application we will launch another container. Containers started with default option can see each other. Let's first find out the IP Address of our container running Spring Boot application. This is done using `inspect` command as shown below. Run the command shown below on your host system.\n\n```bash\n$ docker inspect --format '{{.NetworkSettings.IPAddress}}' <container_id>\n```\n\nWe will assume above command returned IPAddress `172.17.0.2` for rest of this section.\n\nLaunch a second container that we will use to make request to our container running Spring Boot application using the command shown below.\n\n```bash\n$ docker run -it openjdk:8\nroot@6430367d97d3:/#\n```\n\nYou can execute ping command to verify you are able to connect with our application container.\n\n```bash\nroot@6430367d97d3:/# ping 172.17.0.2\nPING 172.17.0.2 (172.17.0.2): 56 data bytes\n64 bytes from 172.17.0.2: icmp_seq=0 ttl=64 time=0.252 ms\n```\n\nLet's make couple of HTTP request to create and fetch tasks using cURL. cURL is already installed in our container so we can use it directly.\n\n```\nroot@6430367d97d3:/# curl -H \"Content-Type: application/json\" -X POST -d '{\"title\": \"Writing post on Docker\"}' http://172.17.0.2:8080/api/tasks\n{\"id\":1,\"title\":\"Writing post on Docker\",\"completed\":false}\nroot@6430367d97d3:/#\nroot@6430367d97d3:/# curl -i http://172.17.0.2:8080/api/tasks\nHTTP/1.1 200\nContent-Type: application/json;charset=UTF-8\nTransfer-Encoding: chunked\nDate: Thu, 06 Oct 2016 16:46:45 GMT\n\n[{\"id\":1,\"title\":\"Writing post on Docker\",\"completed\":false}]\n```\n\nStop both the containers and remove them.\n\n## Writing your first Dockerfile\n\nPerforming commands with in the container is good for testing but to make the process repeatable we will need to codify it. Docker makes it easy to define how you want to build Docker images. Docker provides a set of commands that you write in a file that tells how image should be built. This file is named Dockerfile.\n\nNavigate to a convinient location on your filesystem and clone the repository.\n\n```\n$ git clone git@github.com:shekhargulati/taskman.git\n```\n\nLet's create a new file Dockerfile in the project root and populate it with following contents.\n\n```\nFROM openjdk:8\nMAINTAINER \"Shekhar Gulati\"\nENV APP_DIR /app\nADD . $APP_DIR/\nWORKDIR $APP_DIR\nEXPOSE 8080\nENTRYPOINT [\"./gradlew\",\"clean\",\"bootRun\"]\n```\n\nLet's understand the Dockerfile:\n\n1. `FROM` command is used to specify the base image you want to use for your container image. This should be the first command in your Dockerfile. This is the image we will build our container image on. We used `openjdk:8` image as we want to run a Java 8 application.\n\n2. `MAINTAINER` commands allows you to specify author of the image.\n\n3. Next, we used `ENV` command to set a environment variable. This is done to make sure we don't repeat ourselves. Our application code will be copied to `/app` directory. This also means container will have APP_DIR environment variable set.\n\n4. Then, we used `ADD` command to copy all files and directory from host to container. This will make sure our Java application code is inside the container `/app` directory.\n\n5. Next, we set `WORKDIR` that sets the working directory for any `RUN`, `CMD`, `ENTRYPOINT`, `COPY` and `ADD` instructions that follow it in the Dockerfile.\n\n6. Then, we told Docker that this container will listens on port 8080. ***EXPOSE does not make the ports of the container accessible to the host. To do that, you must use either the -p flag to publish a range of ports or the -P flag to publish all of the exposed ports.***\n\n7. Lastly, we used `ENTRYPOINT` to specify which command will run when container will be launched. We used Gradle command that will build the project and start the embedded tomcat at port 8080.\n\n\nNow, that we have created the Dockerfile let's build the image from it. But, before we do that we need to create a file `.dockerignore` that is used to specify which all files and directories we don't want to copy to the container. In the Dockerfile shown above, we used `ADD` command to copy the sources from host system to container. By default, it will copy everything inside the current directory to the container. It does not make sense to copy IDE directory or build directory to the container so we can ignore them. Create a new file `.dockerignore` inside the project root and populate it with following contents.\n\n```\nbuild/\n.idea/\n.gradle/\ndocker/\n```\n\nNow, we can build the image using the build command as shown below. On the host system, execute the following command.\n\n```\n$ docker build -t taskman .\n```\n\nThe above command will create an image with name `taskman`. You can view the image by executing following command. You can also specify tag with an image name like `taskman:1.0.0`. If you don't specify then latest is used.\n\n```\n$ docker images\nREPOSITORY          TAG                 IMAGE ID            CREATED              SIZE\ntaskman             latest              b0509739bca3        About a minute ago   641.1 MB\n```\n\nNow, you can start the container using the run command as shown below. This command will take time as it will run a full Gradle build and then start the tomcat server. Each time you run a container using this image Gradle will download full dependencies.\n\n```\n$ docker run -it -p 9080:8080 taskman\n```\n\nIn the command shown above, we start the container in an interactive mode and exposed port 8080 of the container to port 9080 on local host using the `-p` option. Once container boots up, you will be able to access application at [http://localhost:9080](http://localhost:9080). You can view all tasks at [http://localhost:9080/api/tasks](http://localhost:9080/api/tasks). If you are using Docker machine then you replace localhost with value of `docker-machine ip <machine_name>` command.\n\nOne problem with building the project in a container is that it will take a long time to start the container as each time you launch the container from this image. Also, each container will have its own Gradle cache where all dependencies will be downloaded. We can do better by using the Gradle cache of local system using Docker volumes.\n\n## Using volume to share Gradle repository cache\n\nIn previous section, we saw that each time we launch container we were downloading all the dependencies. Rather than downloading files in the container, we could share our .gradle directory and mount it in the container at `/root/.gradle`. The `/root/.gradle` is the location where Gradle will look for all the dependencies. If this directory is not found then Gradle creates it and downloads all dependencies.\n\nDocker has a concept of volume that creates a mount point on the container where host directory is mounted. This makes it possible to share a persistent file system with the container. To launch a container, that uses host `.gradle` directory we will execute the following command.\n\n```\n$ docker run -it -p 9080:8080 -v ~/.gradle:/root/.gradle taskman\n```\n\nIn the command shown above, we used `-v` option to create a mount point on the container that references host `~/.gradle` directory. Volumes makes it possible for container and data to have independent lifecycle. We all data outlives application. Later in this post, we will use volume to store MySQL container data.\n\n## Running container in the detached mode\n\nSo, far we have been running containers in foreground but it make sense to run long running processes like servers in the detached mode. Docker makes it possible using the `-d` option.\n\n```\n$ docker run -it -d -p 9080:8080 -v ~/.gradle:/root/.gradle taskman\n```\n\nThis will return the container id of the container. To see the logs you can use logs command as shown below.\n\n```\n$ docker logs -f <container_id>\n```\n\nThe `-f` option is used to follow the logs.\n\n## Using Gradle plugin to build Docker image\n\nSo far we have build Docker image manually using docker build command. This is fine for development and quick playing around but for real deployments you would need to build Docker images during the project build lifecyle. Also, rather than using Gradle to launch application we will run Spring Boot apps as executable jar.\n\nTo build images during the application build, we will use [Gradle Docker plugin by Transmode](https://github.com/Transmode/gradle-docker). We can automate that process so that on each build we also build a Docker image. To do that we have to enable Docker Gradle plugin in `build.gradle`.\n\n```gradle\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath(\"org.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE\")\n        classpath('se.transmode.gradle:gradle-docker:1.2')\n    }\n}\ngroup 'com.shekhargulati'\nversion '1.0.0'\n\napply plugin: 'java'\napply plugin: 'spring-boot'\napply plugin: 'docker'\n\nsourceCompatibility = 1.8\n\njar {\n    baseName = \"taskman\"\n    version = ''\n}\n\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    compile(\"org.springframework.boot:spring-boot-starter-web\")\n    compile(\"org.springframework.boot:spring-boot-starter-data-jpa\")\n    compile(\"mysql:mysql-connector-java:5.1.39\")\n    compile(\"org.hsqldb:hsqldb:2.3.4\")\n\n    testCompile(\"org.springframework.boot:spring-boot-starter-test\")\n}\n\n\ntask buildDocker(type: Docker, dependsOn: build) {\n    push = false\n    applicationName = jar.baseName\n    dockerfile = file('docker/Dockerfile')\n    doFirst {\n        copy {\n            from jar\n            into stageDir\n        }\n    }\n}\n```\n\nIn the build script shown above, we first declared dependeny of plugin, then enabled it, and finally created a task `buildDocker` that will use the `Dockerfile` present in the `docker` directory. The `buildDocker` tasks copies the `taskman` jar to the staging directory.\n\nAlso, we will move Dockerfile from the application root to a new folder `docker` inside the root. Also, we will change the Dockerfile so that we don't build the application within the container but rather use the executable JAR generated by Spring Boot Gradle plugin.\n\n```\nFROM openjdk:8\nMAINTAINER \"Shekhar Gulati\"\nENV APP_DIR /app\nADD taskman.jar $APP_DIR/\nWORKDIR $APP_DIR\nEXPOSE 8080\nENTRYPOINT [\"java\",\"-jar\",\"taskman.jar\"]\n```\n\nTo build the image we will use Gradle command `./gradlew clean buildDocker`. The `buildDocker` is the task that we have declared in our `build.gradle`. Once command finishes successfully, we can verify the our image is created successfully. The image will have different name now. Docker Gradle plugin uses `${project.group}/${applicationName}:${tagVersion}` scheme to generate name for the Docker image. Please refer to the [documentation to learn more about it](https://github.com/Transmode/gradle-docker#task-configuration-through-task-properties).\n\n```\n$ docker images\nREPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE\ncom.shekhargulati/taskman   1.0.0               7f5a94fa6cbc        4 seconds ago       670.2 MB\n```\n\nYou can launch container from this image by executing following command.\n\n```\n$ docker run -p 8080:8080 com.shekhargulati/taskman:1.0.0\n```\n\nThis time you will notice that application launched quickly as we didn't had to build the project. Once container boots up, you will be able to access application at [http://localhost:9080](http://localhost:9080). You can view all tasks at [http://localhost:9080/api/tasks](http://localhost:9080/api/tasks). If you are using Docker machine then you replace localhost with value of `docker-machine ip <machine_name>` command.\n\n## Making HSQL write to filesystem\n\nSo far we have been using HSQL in an in-memory mode. So, application looses data on each restart. We could make our application use file backed db by specifying `spring.datasource.url` property. But, rather than changing the value in the `application.properties` we can pass it with the application launch command as shown below.\n\n```\n$ docker run -it -d -p 9080:8080 com.shekhargulati/taskman:1.0.0 --spring.datasource.url=jdbc:hsqldb:file:/data/taskman-db\n```\n\nYou can connect to the container and see the data directory.\n\n```\n$ docker exec -it <container_id> /bin/bash\nroot@fce9195dbc87:/data# ls\ntaskman-db.lck\ttaskman-db.log\ttaskman-db.properties  taskman-db.script  taskman-db.tmp\n```\n\nIt is not a good idea to write to container file system. You can start a container with filesystem in readonly mode.\n\n```\n$ docker run -it --read-only -p 9080:8080 com.shekhargulati/taskman:1.0.0 --spring.datasource.url=jdbc:hsqldb:file:/data/taskman-db\n```\n\nApplication will fail to start. The reason is embedded tomcat needs a writable `/tmp` directory.\n\n```\norg.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to create tempDir. java.io.tmpdir is set to /tmp\n\tat org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.4.1.RELEASE.jar!/:1.4.1.RELEASE]\n\tat org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:535) ~[spring-context-4.3.3.RELEASE.jar!/:4.3.3.RELEASE]\n```\n\nThis is done using volume option as shown below.\n\n```\n$ docker run -it --read-only -p 9080:8080 -v /tmp com.shekhargulati/taskman:1.0.0 --spring.datasource.url=jdbc:hsqldb:file:/data/taskman-db\n```\n\nThis time also it will fail to start because HSQL fails to write.\n\n```\nCaused by: org.hsqldb.HsqlException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@16359e63[file =/data/taskman-db.lck, exists=false, locked=false, valid=false, ] method: openRAF reason: java.io.FileNotFoundException: /data/taskman-db.lck (No such file or directory)\n```\n\nNow, we will use volume to provide HSQL a directory on host system where it can write data.\n\n```\n$ docker run -it -d --read-only -p 9080:8080 -v /tmp -v ~/docker/data:/data com.shekhargulati/taskman:1.0.0 --spring.datasource.url=jdbc:hsqldb:file:/data/taskman-db\n```\n\n> **It is also a good idea to add a bash function that remove dangling images and volumes and  stopped containers as shown below. Thanks [Xinjiang Shao](https://github.com/soleo) for suggesting this tip.**\n\n> ```\n  docker-cleanup() {\n      docker rm $(docker ps -a -q);\n      docker rmi $(docker images -q -f dangling=true);\n      docker volume rm $(docker volume ls -qf dangling=true)\n  }\n  ```\n\n----\n\nThat's all for this week. In the next post, we will learn how to use MySQL database with our application. We will cover Docker networking basics that makes multi container applications tick.\n\n\nPlease provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/60](https://github.com/shekhargulati/52-technologies-in-2016/issues/60).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/39-docker-part1)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "40-docker-cron/README.md",
    "content": "Using Docker Containers As Cron Jobs\n----\n\nWelcome to the fortieth post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I was working on a problem that required cron jobs. The use case was that after user registers with the application, we will create a cron job that will track his/her social activities. We will have one container per user. I wanted to keep cron jobs to work in a different process from the main application so that different concerns of the application don't intermingle. In my view, containers provide the right abstraction to solve this use case. The added advantage that we achieve by using Docker containers is that we can configure their restart policy. This means if a container goes down for some reason it will be restarted automatically.  I kept these containers dumb so the only thing container had to do is to make an HTTP request to fetch the data and store that in the database. In this post, I will share how I did it.\n\n> **This post assumes you know how to work with Docker containers. In case you are new to Docker, you can read [my getting started post on Docker](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/39-docker/README.md).**\n\n## Creating a container for cron jobs\n\nNavigate to a convenient location on your filesystem and create a directory for this project.\n\n```bash\n$ mkdir cron-example && cd cron-example\n```\n\nNext, we will create a cron job that will execute a Python script every minute to check Github API status. Create a file with name `crontab` that will specify what you want to do as shown below.\n\n```bash\n* * * * * root /usr/local/bin/python /app/app.py >> /var/log/cron.log 2>&1\n# You need an empty line at the end of the file so that it is considered a valid cron file.\n```\n\nCron job will be executed by `root` user as that is the only user we have inside the container.\n\nThe Python script is very simple as shown below. It uses Python requests API to make a GET request. Create a new file `app.py` inside the `cron-example` directory.\n\n```python\nimport requests\n\nr = requests.get('https://status.github.com/api/status.json')\nprint(r.text)\n```\n\n### Writing a Dockerfile\n\nNow, we will create a `Dockerfile` that will build the required container.\n\n```docker\nFROM python:2.7\nMAINTAINER \"Shekhar Gulati\"\nRUN apt-get update -y\nRUN apt-get install cron -yqq\nCOPY crontab /etc/cron.d/github-status-cron\nRUN chmod 0644 /etc/cron.d/github-status-cron\nRUN touch /var/log/cron.log\nENV APP_DIR /app\nCOPY app.py requirements.txt $APP_DIR/\nWORKDIR $APP_DIR\nRUN pip install -r requirements.txt\nCMD cron && tail -f /var/log/cron.log\n```\n\nLet's understand what we did above:\n\n1. We used `FROM` command to specify our base image. We used `python:2.7` as our base image as we want to execute a Python script.\n\n2. Next, we installed `cron` package using the `RUN` command. Earlier, debian images used to have cron package installed but now we will have to install it ourselves.\n\n3. Next, we copied the `crontab` file from our local system to the container `cron.d` directory using `COPY` command.\n\n4. Then, we made cron job executable using the `RUN` command.\n\n5. Next, we created the log file for the cron job.\n\n6. Then, we copied  `app.py` and `requirements.txt` to the `APP_DIR`. Then, we installed our application dependencies using `pip install`. This will install `requests` Python library. The dependencies are specified in `requirements.txt` file.\n\n7. Finally, we specified the command that container will use on startup using `CMD` command.\n\nTo build the image, run the following command from within `cron-example` directory.\n\n```\n$ docker build -t cron-example .\n```\n\nThis will build the image. You can verify that your image exists by running following command.\n\n```\n$ docker images |grep cron-example\n```\n```\ncron-example        latest              8febf10b92b2        2 minutes ago       696.9 MB\n```\n\nYou can run the cron container using the command shown below. Every one minute you will see a line that prints status of Github API.\n\n```\n$ docker run -it cron-example\n```\n```\n{\"status\":\"good\",\"last_updated\":\"2016-10-19T03:27:03Z\"}\n{\"status\":\"good\",\"last_updated\":\"2016-10-19T03:28:01Z\"}\n{\"status\":\"good\",\"last_updated\":\"2016-10-19T03:28:56Z\"}\n...\n```\n\n## Using environment variables\n\nOnce you have move beyond a simple cron job, a common requirement you might have is to access environment variables in your Python script. Environment variables could contain information about database or other configuration data. Let's see what will happen if we have try to access environment variables in our Python script.\n\nChange the `app.py` to following.\n\n```python\nimport requests\nimport os\n\nprint(os.environ['MY_ENV_VARIABLE'])\n\nr = requests.get('https://status.github.com/api/status.json')\nprint(r.text)\n```\n\nNow, build the image again. This time it will be very quick to build the image.\n\n```\n$ docker build -t cron-example .\n```\n\nNow, run the container using the command shown below. Note that we are passing environment variable using the `-e` option.\n\n```\n$ docker run -it -e MY_ENV_VARIABLE=hello cron-example\n```\n\nYou will have to wait a minute to see the output. After a minute, you will see following:\n\n```\nTraceback (most recent call last):\n  File \"/app/app.py\", line 4, in <module>\n    print(os.environ['MY_ENV_VARIABLE'])\n  File \"/usr/local/lib/python2.7/UserDict.py\", line 40, in __getitem__\n    raise KeyError(key)\nKeyError: 'MY_ENV_VARIABLE'\n```\n\nAs you can see from the output shown above, our Python script couldn't find environment variable `MY_ENV_VARIABLE`. The reason is cron job does not pass environment variables to the Python script.\n\nTo stop the container, press `CTRL+C`.\n\nTo fix this, we will have to create a bash script that will pass the environment variables to the cron job as shown below. Create a script `run-crond.sh` as shown below.\n\n```bash\n#!/bin/bash\n\nenv | egrep '^MY' | cat - /tmp/my_cron > /etc/cron.d/github-status-cron\n\ncron && tail -f /var/log/cron.log\n```\n\nWe will also have to update Dockerfile so that it runs the bash script at startup rather than cron.\n\n```docker\nFROM python:2.7\nMAINTAINER \"Shekhar Gulati\"\nRUN apt-get update -y\nRUN apt-get install cron -yqq\nCOPY crontab /tmp/my_cron\nCOPY run-crond.sh run-crond.sh\nRUN chmod -v +x /run-crond.sh\nRUN touch /var/log/cron.log\nENV APP_DIR /app\nCOPY app.py requirements.txt $APP_DIR/\nWORKDIR $APP_DIR\nRUN pip install -r requirements.txt\n# Run the command on container startup\nCMD [\"/run-crond.sh\"]\n```\n\nNow, build the image again.\n\n```\n$ docker build -t cron-example .\n```\n\nNow, run the container using the command shown below. This time environment variable will be correctly passed to the Python script and you will see `hello` printed each time as well.\n\n```\n$ docker run -it -e MY_ENV_VARIABLE=hello cron-example\n```\n```\nhello\n{\"status\":\"good\",\"last_updated\":\"2016-10-19T03:58:53Z\"}\nhello\n{\"status\":\"good\",\"last_updated\":\"2016-10-19T03:59:43Z\"}\n```\n\n----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/63](https://github.com/shekhargulati/52-technologies-in-2016/issues/63).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/40-docker-cron)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "40-docker-cron/cron-example/.dockerignore",
    "content": "venv/\n"
  },
  {
    "path": "40-docker-cron/cron-example/.gitignore",
    "content": "venv/\n*.pyc\n"
  },
  {
    "path": "40-docker-cron/cron-example/Dockerfile",
    "content": "FROM python:2.7\nMAINTAINER \"Shekhar Gulati\"\nRUN apt-get update -y\nRUN apt-get install cron -yqq\nCOPY crontab /tmp/my_cron\nCOPY run-crond.sh run-crond.sh\nRUN chmod -v +x /run-crond.sh\nRUN touch /var/log/cron.log\nENV APP_DIR /app\nCOPY app.py requirements.txt $APP_DIR/\nWORKDIR $APP_DIR\nRUN pip install -r requirements.txt\n# Run the command on container startup\nCMD [\"/run-crond.sh\"]\n"
  },
  {
    "path": "40-docker-cron/cron-example/app.py",
    "content": "import requests\nimport os\n\nprint(os.environ['MY_ENV_VARIABLE'])\n\nr = requests.get('https://status.github.com/api/status.json')\nprint(r.text)\n"
  },
  {
    "path": "40-docker-cron/cron-example/crontab",
    "content": "* * * * * root /usr/local/bin/python /app/app.py >> /var/log/cron.log 2>&1\n# You need an empty line at the end of the file so that it is considered a valid cron file.\n"
  },
  {
    "path": "40-docker-cron/cron-example/requirements.txt",
    "content": "requests==2.11.1\nwsgiref==0.1.2\n"
  },
  {
    "path": "40-docker-cron/cron-example/run-crond.sh",
    "content": "#!/bin/bash\n\nenv | egrep '^MY' | cat - /tmp/my_cron > /etc/cron.d/github-status-cron\n\ncron && tail -f /var/log/cron.log\n"
  },
  {
    "path": "41-akka-dispatcher/README.md",
    "content": "\nUnderstanding Akka Dispatchers [![TimeToRead](http://ttr.myapis.xyz/ttr.svg?pageUrl=https://github.com/shekhargulati/52-technologies-in-2016/blob/master/41-akka-dispatcher/README.md)](http://ttr.myapis.xyz/)\n---\n\nWelcome to the forty-first post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) blog series. This week I had to work on tuning a execution engine that is built using Akka. [Akka](http://akka.io/) is a toolkit and runtime for building highly concurrent, distributed and resilient message driven systems. This post assumes you already know Akka. Actor needs a dispatcher to perform its task. A dispatcher relies on executor to provide thread. There are two types of executors a dispatcher can have: 1) `fork-join-executor` 2) `thread-pool-executor`. In this post, we will understand how you can configure `fork-join-executor` and `thread-pool-executor` to meet your needs.\n\n## A Simple Akka Based Execution Engine\n\nBefore we learn how to tune dispatcher, let's write a simple execution engine that executes a list of tasks as shown below.\n\n```scala\nimport java.time.LocalDateTime\nimport java.util.concurrent.TimeUnit\n\nimport akka.actor.{Actor, ActorSystem, Props}\nimport akka.pattern._\nimport akka.util.Timeout\nimport playground.dispatcher.tasks.{Status, Task}\n\nimport scala.concurrent.duration.{Duration, _}\nimport scala.concurrent.{Await, ExecutionContext, Future}\n\nclass TaskExecutionEngine(system: ActorSystem) {\n\n  def run(tasks: List[Task]): List[Status] = {\n    implicit val executionContext: ExecutionContext = system.dispatchers.defaultGlobalDispatcher\n    val futures = tasks.map(task => {\n      val actorRef = system.actorOf(Props[TaskActor])\n      implicit val timeout: Timeout = Timeout(1, TimeUnit.MINUTES)\n      (actorRef ? task).map(_.asInstanceOf[Status])\n    })\n    val statuses: List[Status] = Await.result(Future.sequence(futures), Duration.Inf)\n    statuses\n  }\n\n}\n\nobject TaskExecutionEngine {\n  def apply(): TaskExecutionEngine = new TaskExecutionEngine(ActorSystem(\"tasky\"))\n}\n\nclass TaskActor extends Actor {\n  override def receive: Receive = {\n    case task: Task =>\n      val result = task()\n      sender() ! result\n  }\n}\n\n\nobject tasks {\n\n  trait Status\n\n  case object success extends Status\n\n  case class Failure(code: Int, message: String) extends Status\n\n  type Task = () => Status\n\n  class WaitTask(timeToWait: Duration = 5 seconds) extends Task {\n    override def apply(): Status = {\n      println(s\"${LocalDateTime.now()} >> Executing WaitTask...\")\n      Thread.sleep(timeToWait.toMillis)\n      println(s\"${LocalDateTime.now()} >> Executed WaitTask...\")\n      success\n    }\n  }\n\n  class CmdTask(cmd: String) extends Task {\n\n    import sys.process._\n\n    override def apply(): Status = {\n      println(s\"${LocalDateTime.now()} >> Executing CmdTask...\")\n      val exitCode = cmd.!\n      println(s\"${LocalDateTime.now()} >> Executed CmdTask...\")\n      if (exitCode == 0) success else Failure(exitCode, s\"command $cmd failed\")\n    }\n  }\n}\n```\n\nLet's understand what the code snippet shown above does:\n\n1. We created a `TaskExecutionEngine` class that defines a method `run`. `TaskExecutionEngine` takes an `ActorSystem` at construction time. We created the companion object that provides a newly created `ActorSystem` to the engine. The `run` method takes a list of tasks for execution and return list of task execution result. `Task` is a function with signature `() => Status`. `Status` is trait that has two implementations -- `success` or `Failure`. The `run` method sends a message to `TaskActor` for each task. We used ask pattern, which returns the Future. We used `Future.sequence` to convert a `List[Future[Status]]` to a single Future of statues `Future[List[Status]]`. Finally, we awaited for all futures to finish and return `List[Status]` to the client.\n\n2. `TaskActor` is a simple Actor that executes a task and return the response back to the `sender`.\n\n3. Next, we have two task implementations -- `WaitTask` and `CmdTask`. As their name suggests, `WaitTask` sleeps for the configured duration and `CmdTask` executes a command and returns success if exit code is 0 otherwise it returns `Failure`.\n\n\nTo execute this code, we have a simple client that creates few tasks and submit them to engine for execution.\n\n```scala\nimport scala.concurrent.duration._\n\nobject Tasky extends App {\n  val engine = TaskExecutionEngine()\n\n  val statuses = engine.run(List(new WaitTask(5 seconds), new WaitTask(5 seconds), new WaitTask(5 seconds)))\n  statuses.foreach(println(_))\n  engine.shutdown()\n}\n```\n\nThe code shown above creates a list of tasks and give tasks to `TaskExecutionEngine` for execution. It finally prints the result of each task.\n\nIf you run the `Tasky` app you will see following output. All the three tasks start execution at the same time, then task execution happens, and finally all tasks are completed.\n\n```\n2016-12-04T22:40:44.280 >> Executing WaitTask...\n2016-12-04T22:40:44.280 >> Executing WaitTask...\n2016-12-04T22:40:44.280 >> Executing WaitTask...\n2016-12-04T22:40:49.290 >> Executed WaitTask...\n2016-12-04T22:40:49.290 >> Executed WaitTask...\n2016-12-04T22:40:49.290 >> Executed WaitTask...\nsuccess\nsuccess\nsuccess\n```\n\n## The default dispatcher\n\nA dispatcher is responsible for assigning threads to the Akka Actor when there are messages in the Actor's mailbox. Akka creates a default dispatcher that is shared by all the actors. A user can create multiple dispatchers and assign them to different actors. Dispatcher is governed by its configuration. If you don't create any dispatcher and don't override the default configuration then you are using the default dispatcher configuration specified in `reference.conf`.\n\n```\ndefault-dispatcher {\n      type = \"Dispatcher\"\n\n      executor = \"fork-join-executor\"\n\n      fork-join-executor {\n        parallelism-min = 8\n        parallelism-factor = 3.0\n        parallelism-max = 64\n      }\n\n      shutdown-timeout = 1s\n\n      throughput = 5\n}\n```\n\nIn the configuration shown above:\n\n1. `fork-join-executor.parallelism-min` defines minimum number of threads `fork-join-executor` managed ThreadPool can have. The default value is 8.\n\n2. `fork-join-executor.parallelism-factor` defines a factor for calculating number of threads from available processors. The default value is 3.\n\n3. `fork-join-executor.parallelism-max` defines maximum number of threads `fork-join-executor` managed ThreadPool can have. The default value is 64.\n\nTo understand this, let's run a quick experiment to see how many messages an actor can process in parallel. Change the client code to as shown below.\n\n```scala\nimport scala.concurrent.duration._\n\nobject Tasky extends App {\n  val engine = TaskExecutionEngine()\n  val statuses = engine.run(1 to 100 map(_ => new WaitTask(5 seconds)) toList)\n  statuses.foreach(println(_))\n}\n```\n\nWe are submitting 100 tasks to `TaskExecutionEngine`. On my machine, when I ran this code I saw that engine processed 24 messages in one go and rest other messages were put in the queue. The number 24 comes from multiplication of number of cores on your machine with `parallelism-factor`. My machine has 8 cores and default value of parallelism-factor is 3 so we got 24 threads (8x3).\n\n> **On mac, you can find number of cores using the command `sysctl -n hw.ncpu`**.\n\nLet's suppose my machine had only one core then according to the calculation mentioned above I could have got 1x3 i.e. 3 threads but instead we will get 8 threads because that's the minimum number of threads `default-dispatcher` can have.\n\n## Configuring our own dispatcher\n\nLet's now understand how we can provide our own dispatcher. Create a new file `application.conf` inside the `src/main/resources` directory as shown below.\n\n```\ntask-dispatcher {\n  type = \"Dispatcher\"\n  executor = \"fork-join-executor\"\n  fork-join-executor {\n    parallelism-min = 100\n    parallelism-max = 200\n  }\n}\n```\n\nIn the configuration shown above, we have specified that we need minimum 100 threads. This will make 100 tasks execute in parallel.\n\nWe will have to update the `TaskExecutionEngine` code to use the `task-dispatcher` as shown below.\n\n```scala\nclass TaskExecutionEngine(system: ActorSystem) {\n\n  def run(tasks: List[Task]): List[Status] = {\n    implicit val executionContext: ExecutionContext = system.dispatchers.lookup(\"task-dispatcher\")\n    val futures = tasks.map(task => {\n      val actorRef = system.actorOf(Props[TaskActor].withDispatcher(\"task-dispatcher\"))\n      implicit val timeout: Timeout = Timeout(1, TimeUnit.MINUTES)\n      (actorRef ? task).map(_.asInstanceOf[Status])\n    })\n    val statuses: List[Status] = Await.result(Future.sequence(futures), Duration.Inf)\n    statuses\n  }\n\n}\n```\n\nIf you run this code with the Tasky client that creates 100 tasks as shown below.\n\n```scala\nimport playground.dispatcher.tasks._\n\nimport scala.concurrent.duration._\n\nobject Tasky extends App {\n  val engine = TaskExecutionEngine()\n  val statuses = engine.run((1 to 100) map (_ => new WaitTask(2 seconds)) toList)\n  statuses.foreach(println(_))\n  engine.shutdown()\n}\n```\n\nYou will notice that all 100 started at almost same time.  If you run this with default configuration 24(`parallelism-factor*number_of_cores`) tasks will be processed in parallel.\n\n```\n// part of output\n2016-12-04T22:46:51.590 >> Executing WaitTask...\n2016-12-04T22:46:51.588 >> Executing WaitTask...\n2016-12-04T22:46:51.587 >> Executing WaitTask...\n2016-12-04T22:46:51.590 >> Executing WaitTask...\n2016-12-04T22:46:51.589 >> Executing WaitTask...\n2016-12-04T22:46:51.590 >> Executing WaitTask...\n2016-12-04T22:46:51.590 >> Executing WaitTask...\n2016-12-04T22:46:51.589 >> Executing WaitTask...\n2016-12-04T22:46:51.588 >> Executing WaitTask...\n2016-12-04T22:46:53.592 >> Executed WaitTask...\n2016-12-04T22:46:53.592 >> Executed WaitTask...\n2016-12-04T22:46:53.592 >> Executed WaitTask...\n2016-12-04T22:46:53.592 >> Executed WaitTask...\n2016-12-04T22:46:53.595 >> Executed WaitTask...\n2016-12-04T22:46:53.595 >> Executed WaitTask...\n```\n\n## Using `thread-pool-executor`\n\n`fork-join-executor` allows you to have a static thread pool configuration where number of threads will be between `parallelism-min` and `parallelism-max` bounds. You can use `thread-pool-executor` if you want your thread pool to have dynamic nature.\n\n```\ntask-dispatcher {\n  type = \"Dispatcher\"\n  executor = \"thread-pool-executor\"\n\n  thread-pool-executor {\n    fixed-pool-size = off\n\n    core-pool-size-min = 8\n\n    core-pool-size-factor = 3.0\n\n    core-pool-size-max = 64\n\n    max-pool-size-min = 8\n\n    max-pool-size-factor = 3.0\n\n    max-pool-size-max = 64\n\n    task-queue-size = -1\n  }\n}\n```\n\nIn the configuration shown above, we changed the executor to `thread-pool-executor`. This a\n\n| Property                                | Description                              | Default |\n| :-------------------------------------- | :--------------------------------------- | :------ |\n| thread-pool-executor.fixed-pool-size    | Whether ThreadPool should be fixed pool or not | off     |\n| thread-pool-executor.core-pool-size-min | Sets the minimum core thread pool size   | 8       |\n| thread-pool-executor.core-pool-size-max | Sets the maximum core thread pool size   | 64      |\n| thread-pool-executor.max-pool-size-min  | Sets the minimum max pool size           | 8       |\n| thread-pool-executor.max-pool-size-max  | Sets the maximum value for max pool size | 64      |\n| thread-pool-executor.task-queue-size    | Sets size of the queue used by thread pool executor. This value define how quick the pool size will grow when there are more thread requests than threads. | -1      |\n\n`thread-pool-executor` differs from `fork-join-executor` in that it allows us to have a dynamic thread pool that can grow and shrink depending on the load. `thread-pool-executor` has `core-pool-size-*` and `max-pool-size-*` properties that control how `thread-pool-executor` grows. `core-pool-size-*` are used to define minimum number of threads that ThreadPool will have. This works similarly to how `fork-join-executor` works.\n\nIf you run the `Tasky` app using this configuration, you will see the same behavior as we observed with default values of `fork-join-executor`. `TaskExecutionEngine` will process 24 tasks at a time. This is because my machine has 8 cores and `core-pool-size-factor` is 3.0.\n\nYou might have noticed that we have also specified `max-pool-size-*` properties of ThreadPoolExecutor. So, you might think why ThreadPoolExecutor didn't created more threads as max value could go up to 64. The reason for it is the configuration property `thread-pool-executor.task-queue-size`. ThreadPoolExecutor automatically adjust the thread pool size according to the bounds set by `core-pool-size` and `max-pool-size` configuration properties. When a new task is submitted for execution and there are fewer than `core-pool-size` threads running, executor will create a new thread for the task execution. When you hit the limit of `core-pool-size`, a new thread will only be created when queue is full. The size of queue is governed by `task-queue-size` property. The default value of `task-queue-size` is -1. The value -1 means queue is unbounded and pool size will never increase beyond what's configured in `core-pool-size`.\n\nLet's change the configuration to the one shown below.\n\n```\ntask-dispatcher {\n  type = \"Dispatcher\"\n  executor = \"thread-pool-executor\"\n\n  thread-pool-executor {\n    core-pool-size-min = 8\n\n    core-pool-size-max = 64\n\n    max-pool-size-min = 100\n\n    max-pool-size-max = 200\n\n    task-queue-size = 20\n  }\n}\n```\n\nWhen you run the code now, you will see dynamic nature of `thread-pool-executor` in action. `thread-pool-executor` will create 24 threads as configured using `core-pool-size`. The first 24 tasks will be executed by these 24 threads. After the first 24 tasks, `thread-pool-executor` will wait till queue has 20 messages. Once queue is full, `thread-pool-executor` will use the `max-pool-size` configuration to create threads. This will go on until we reach 81 tasks. After that task-queue-size will go below 20 so remaining 19 tasks will be executed after threads are freed.\n\n----\n\nThat's all for this week.\n\nPlease provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/67](https://github.com/shekhargulati/52-technologies-in-2016/issues/67).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/40-akka)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "42-docker-compose/README.md",
    "content": "# Using Docker Compose with wait-for-it\n\nWelcome to forty-second post of [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) series. Today, we will learn about Docker Compose, a tool for defining and running multi-container Docker applications. If you are new to Docker then you can read week  [39 post](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/39-docker/README.md) where I discussed basics of running a  Java application inside Docker containers. This post will start from where we left the last post so that we can understand the need for Docker Compose and the problems it solves. This post will also cover how to use Docker Compose with [wait-for-it](https://github.com/vishnubob/wait-for-it). `wait-for-it` is a simple bash utility to test and wait for the availability of TCP host and port. The need for `wait-for-it` arises when you want to make sure a container is up and running before another container. Let's suppose we have two containers — one running a web application and another running a database like mysql. Most of the times you would want MySQL container to be up and running before web application container starts(most applications try to connect to DB at startup). To handle such situations, you will need to use solutions like `wait-for-it`.\n\n## The need for multiple containers\n\n>  **A container should do one thing and do that well.**\n\nIn a real application, you will have one or more containers for each services and different services will work together to do the job. In the week 39 post, we had a Java application that was using a file based HSQL database to persist the data in a volume. In real applications, you will have a persistent databases like MySQL.  So, you will have two containers — one running our Java application and second running MySQL database. Let's see how we will connect multiple containers together.\n\nCreate a new network\n\n```bash\n$ docker network create 52-tech-blog\n```\n\nRun a new docker container in `52-tech-blog` network.\n\n```shell\n$ docker run -d --name db --net 52-tech-blog -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=taskman mysql\n```\n\nNow, we will start the application container in the same network `52-tech-blog` as shown below.\n\n```shell\n$ docker run -p 8080:8080 --net 52-tech-blog -e TASKMAN_DB_PASSWORD=password com.shekhargulati/taskman:1.0.0 --spring.profiles.active=docker\n```\n\nWe have defined a environment variable `TASKMAN_DB_PASSWORD` that contains password to connect to the database.  Also, we specified a Spring profile `docker` so that our application connect to MySQL database.\n\nOnce application is created, you can access it at [http://localhost:8080/api/tasks](http://localhost:8080/api/tasks).\n\n> **Please note `com.shekhargulati/taskman:1.0.0` is the image that we created in week 39 post. Please refer to that post in case you want to create that image. The container is built using following Dockerfile.**\n>\n> ```dockerfile\n> FROM openjdk:8\n> MAINTAINER \"Shekhar Gulati\"\n> ENV APP_DIR /app\n> ADD taskman.jar $APP_DIR/\n> WORKDIR $APP_DIR\n> EXPOSE 8080\n> CMD [\"java\",\"-jar\",\"taskman.jar\",\"--spring.profiles.active=docker\"]\n> ```\n\n## Docker Compose\n\nThe main problem with the workflow mentioned in previous section is that it is manual and error prone. Docker Compose makes it easy to compose multi-container applications together. It consists of two parts:\n\n1. A YAML file where you document and configure all of the application dependencies like cache, database, queue. This file usually named `docker-compose.yml`.\n2. A command-line tool that reads the docker-compose.yml file and launches the containers defined in the file. You can manage all the containers for a project using this tool.\n\n## Install Docker Compose\n\nTo install Docker Compose on your machine, you can read installation instructions mentioned in the [Compose documentation](https://docs.docker.com/compose/install/).\n\n## Writing a Compose file\n\nWe can automate the manual task of creating network and starting containers by defining them in the Docker Compose file.  Create a new file `docker-compose.yml` in your project root and define the services as shown below.\n\n```yaml\nversion: '2'\nservices:\n  db:\n    image: mysql:latest\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: taskman\n  web:\n    image: com.shekhargulati/taskman:1.0.0\n    ports:\n      - \"8080:8080\"\n    depends_on:\n      - db\n    environment:\n      - TASKMAN_DB_PASSWORD=password\n```\n\nAs you can see above we have two services — `db` and `web`. In the `docker-compose.yml` shown above:\n\n* we defined two services db and web\n* db uses mysql:latest image and web uses `com.shekhargulati/taskman:1.0.0` image\n* web container forwards the exposed port 8080 on the container to port 8080 on the host machine.\n* `web`  depends on `db` so compose will start the mysql container before starting the web container. But, compose will not wait for `db` container to be accessible. So, if your application tries to connect with the database during startup there is a posibility that application is unable to connect to db. This will lead to application startup failure. We will see how to handle it in next section.\n*  exposed enviroment variables for each container.\n\nLet's use Docker compose to launch our multi container application. In the directory where you have `docker-compose.yml`, `Dockerfile` , and `taskman.jar` run the following command.\n\n```\n$ docker-compose up\n```\n\nThis will build the web container and start the containers. On startup of web container, you will see exception as shown below. The reason is your web container tried to connect to db container but it was not yet fully started.\n\n```\nweb_1  | com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure\nweb_1  |\nweb_1  | The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.\nweb_1  | \tat sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_102]\nweb_1  | \tat sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_102]\nweb_1  | \tat sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_102]\nweb_1  | \tat java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_102]\nweb_1  | \tat com.mysql.jdbc.Util.handleNewInstance(Util.java:404) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\nweb_1  | \tat com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:988) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\nweb_1  | \tat com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\nweb_1  | \tat com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\nweb_1  | \tat com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\nweb_1  | \tat com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\nweb_1  | \tat com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\nweb_1  | \tat com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) ~[mysql-connector-java-5.1.39.jar!/:5.1.39]\n```\n\nThis is a very common use case and it might feel surprising that Compose does not support it.  Compose team has maintained that they will not support this use case.\n\n> To run compose in detached mode, you can use `docker-compose up -d`\n\n## Using wait-for-it\n\nIn this section, I will show how to use Docker Compose with [wait-for-it](https://github.com/vishnubob/wait-for-it). It took me sometime to figure out how to use it so I am writing it down for developers who might also need to use wait-for-it someday.\n\nTo use it, first copy the [wait-for-it.sh](https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh) in your project directory. Then, change Dockerfile to as shown below.\n\n```dockerfile\nFROM openjdk:8\nMAINTAINER \"Shekhar Gulati\"\nENV APP_DIR /app\nADD taskman.jar $APP_DIR/\nADD wait-for-it.sh $APP_DIR/\nWORKDIR $APP_DIR\nEXPOSE 8080\nCMD [\"java\",\"-jar\",\"taskman.jar\",\"--spring.profiles.active=docker\"]\n```\n\nUpdate `docker-compose.yml` to as shown below.\n\n```yaml\nversion: '2'\nservices:\n  db:\n    image: mysql:latest\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: taskman\n  web:\n    build: .\n    entrypoint: ./wait-for-it.sh db:3306 --strict -- java -jar taskman.jar --spring.profiles.active=docker\n    ports:\n      - \"8080:8080\"\n    depends_on:\n      - db\n    environment:\n      - TASKMAN_DB_PASSWORD=password\n```\n\nStart the containers again using `docker-compose up` command. This time application should start fine. In the logs, you will see\n\n```\nweb_1  | wait-for-it.sh: waiting 15 seconds for db:3306\n```\n\nThis time application will start fine. There will be no exception in the logs. You can access application at http://localhost:8080/api/tasks.\n\nOnce you are done, you can stop and remove the containers and associated volumes using the command mentioned below.\n\n```shell\n$ docker-compose stop && docker-compose rm -vf\n```\n\n------\n\nThat's all for this week.\n\nPlease provide your valuable feedback by adding a comment to [https://github.com/shekhargulati/52-technologies-in-2016/issues/68](https://github.com/shekhargulati/52-technologies-in-2016/issues/68).\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016/40-akka)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "42-docker-compose/code/with-waitforit/Dockerfile",
    "content": "FROM openjdk:8\nMAINTAINER \"Shekhar Gulati\"\nENV APP_DIR /app\nADD taskman.jar $APP_DIR/\nADD wait-for-it.sh $APP_DIR/\nWORKDIR $APP_DIR\nEXPOSE 8080\nCMD [\"java\",\"-jar\",\"taskman.jar\",\"--spring.profiles.active=docker\"]\n"
  },
  {
    "path": "42-docker-compose/code/with-waitforit/docker-compose.yml",
    "content": "version: '2'\nservices:\n  db:\n    image: mysql:latest\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: taskman\n  web:\n    build: .\n    entrypoint: ./wait-for-it.sh db:3306 --strict -- java -jar taskman.jar --spring.profiles.active=docker\n    ports:\n      - \"8080:8080\"\n    depends_on:\n      - db\n    environment:\n      - TASKMAN_DB_PASSWORD=password\n"
  },
  {
    "path": "42-docker-compose/code/with-waitforit/wait-for-it.sh",
    "content": "#!/usr/bin/env bash\n#   Use this script to test if a given TCP host/port are available\n\ncmdname=$(basename $0)\n\nechoerr() { if [[ $QUIET -ne 1 ]]; then echo \"$@\" 1>&2; fi }\n\nusage()\n{\n    cat << USAGE >&2\nUsage:\n    $cmdname host:port [-s] [-t timeout] [-- command args]\n    -h HOST | --host=HOST       Host or IP under test\n    -p PORT | --port=PORT       TCP port under test\n                                Alternatively, you specify the host and port as host:port\n    -s | --strict               Only execute subcommand if the test succeeds\n    -q | --quiet                Don't output any status messages\n    -t TIMEOUT | --timeout=TIMEOUT\n                                Timeout in seconds, zero for no timeout\n    -- COMMAND ARGS             Execute command with args after the test finishes\nUSAGE\n    exit 1\n}\n\nwait_for()\n{\n    if [[ $TIMEOUT -gt 0 ]]; then\n        echoerr \"$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT\"\n    else\n        echoerr \"$cmdname: waiting for $HOST:$PORT without a timeout\"\n    fi\n    start_ts=$(date +%s)\n    while :\n    do\n        (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1\n        result=$?\n        if [[ $result -eq 0 ]]; then\n            end_ts=$(date +%s)\n            echoerr \"$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds\"\n            break\n        fi\n        sleep 1\n    done\n    return $result\n}\n\nwait_for_wrapper()\n{\n    # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692\n    if [[ $QUIET -eq 1 ]]; then\n        timeout $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &\n    else\n        timeout $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &\n    fi\n    PID=$!\n    trap \"kill -INT -$PID\" INT\n    wait $PID\n    RESULT=$?\n    if [[ $RESULT -ne 0 ]]; then\n        echoerr \"$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT\"\n    fi\n    return $RESULT\n}\n\n# process arguments\nwhile [[ $# -gt 0 ]]\ndo\n    case \"$1\" in\n        *:* )\n        hostport=(${1//:/ })\n        HOST=${hostport[0]}\n        PORT=${hostport[1]}\n        shift 1\n        ;;\n        --child)\n        CHILD=1\n        shift 1\n        ;;\n        -q | --quiet)\n        QUIET=1\n        shift 1\n        ;;\n        -s | --strict)\n        STRICT=1\n        shift 1\n        ;;\n        -h)\n        HOST=\"$2\"\n        if [[ $HOST == \"\" ]]; then break; fi\n        shift 2\n        ;;\n        --host=*)\n        HOST=\"${1#*=}\"\n        shift 1\n        ;;\n        -p)\n        PORT=\"$2\"\n        if [[ $PORT == \"\" ]]; then break; fi\n        shift 2\n        ;;\n        --port=*)\n        PORT=\"${1#*=}\"\n        shift 1\n        ;;\n        -t)\n        TIMEOUT=\"$2\"\n        if [[ $TIMEOUT == \"\" ]]; then break; fi\n        shift 2\n        ;;\n        --timeout=*)\n        TIMEOUT=\"${1#*=}\"\n        shift 1\n        ;;\n        --)\n        shift\n        CLI=\"$@\"\n        break\n        ;;\n        --help)\n        usage\n        ;;\n        *)\n        echoerr \"Unknown argument: $1\"\n        usage\n        ;;\n    esac\ndone\n\nif [[ \"$HOST\" == \"\" || \"$PORT\" == \"\" ]]; then\n    echoerr \"Error: you need to provide a host and port to test.\"\n    usage\nfi\n\nTIMEOUT=${TIMEOUT:-15}\nSTRICT=${STRICT:-0}\nCHILD=${CHILD:-0}\nQUIET=${QUIET:-0}\n\nif [[ $CHILD -gt 0 ]]; then\n    wait_for\n    RESULT=$?\n    exit $RESULT\nelse\n    if [[ $TIMEOUT -gt 0 ]]; then\n        wait_for_wrapper\n        RESULT=$?\n    else\n        wait_for\n        RESULT=$?\n    fi\nfi\n\nif [[ $CLI != \"\" ]]; then\n    if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then\n        echoerr \"$cmdname: strict mode, refusing to execute subprocess\"\n        exit $RESULT\n    fi\n    exec $CLI\nelse\n    exit $RESULT\nfi\n"
  },
  {
    "path": "42-docker-compose/code/without-waitforit/Dockerfile",
    "content": "FROM openjdk:8\nMAINTAINER \"Shekhar Gulati\"\nENV APP_DIR /app\nADD taskman.jar $APP_DIR/\nWORKDIR $APP_DIR\nEXPOSE 8080\nCMD [\"java\",\"-jar\",\"taskman.jar\",\"--spring.profiles.active=docker\"]\n"
  },
  {
    "path": "42-docker-compose/code/without-waitforit/docker-compose.yml",
    "content": "version: '2'\nservices:\n  db:\n    image: mysql:latest\n    restart: always\n    environment:\n      MYSQL_ROOT_PASSWORD: password\n      MYSQL_DATABASE: taskman\n  web:\n    build: .\n    ports:\n      - \"8080:8080\"\n    depends_on:\n      - db\n    environment:\n      - TASKMAN_DB_PASSWORD=password\n"
  },
  {
    "path": "43-graphql/README.md",
    "content": "GraphQL - building a pokedex in React with GraphQL\n-----\n\nWelcome to the forty-third post of the [52-technologies-in-2016](https://github.com/shekhargulati/52-technologies-in-2016) series. This week, we will explore [GraphQL](http://graphql.org), a query language that is starting to get more and more attention. Facebook, who internally used GraphQL since 2012 and released a first specification and reference implementation of GraphQL in 2015 announced GraphQL to be [production ready] in September 2016. What followed is a trend of more and more companies starting to use GraphQL, such as [GitHub](https://youtu.be/hT-4pVmkGt0), [Coursera](https://youtu.be/JC-UJwBKc2Y) and [Shopify](https://youtu.be/Wlu_PWCjc6Y).\n\nIn this post we will explore GraphQL by building a pokedex application with GraphQL. You can find an interactive, read-only demo of the pokedex [here](http://demo.learnapollo.com).\n\n![](./images/pokedex.png)\n\n> **This is a guest post by [Nilan Marktanner](htt ps://github.com/marktani). 52 technologies series is now open for external contributions so if you would like to contribute a guest post send us a PR.**\n\n## Introduction to GraphQL\n\nOne of the main benefits of using GraphQL is how so called queries allow clients to specify their data requirements in a declarative way. Instead of collecting all the data from different endpoints, as is usual with REST, queries allow an exact and fine-grained selection of data fields that are then resolved by the server. This leads to prevention of data over- and underfetching, two common problems of REST.\n\nAs this approach shifts complexity from the clients to the server, we will focus on the client-side in this article. Let's take a quick glance at GraphQL schemas, exposed by GraphQL servers first, though.\n\n### GraphQL schema\n\nWhen you build an app, you usually have to think about the data model you need. With GraphQL, this is done by defining the so called GraphQL schema. It exposes queries (for fetching data) and mutations (for modifying data), that are based on primitive types (such as integers, booleans or strings) and object types. Let's have a look at the two object types that we'll need in this article.\n\n<details>\n<summary>GraphQL schema</summary>\n```idl\ntype Trainer {\n  id: String!\n  name: String!\n  ownedPokemons: [Pokemon]\n}\n\ntype Pokemon {\n  id: String!\n  url: String!\n  name: String!\n  trainer: Trainer\n}\n```\n</details>\n\n### Queries\n\nIn our pokedex application, we'll display pokemons that have a `name` and a `url` and are related to the trainer that owns them. A trainer has a `name` and a list of owned pokemons. Both types have the required `id` field (denoted by the `!` in `String!`) that is used to identify different nodes. A node is a data item in our data graph.\n\nThese types will then be used by the GraphQL server to expose different queries and mutation. Let's explore common choices for those! One of them is a query that simply returns all nodes of a specific type, in our case that could be the `allPokemons` query. We can use it like this:\n\n<details>\n<summary>query</summary>\n```graphql\nquery {\n  allPokemons {\n    id\n    name\n  }\n}\n```\n</details>\n\nIf you want to follow along with the queries we use, head over to [the interactive GraphiQL tool](https://api.graph.cool/simple/v1/ciwjew0qz0l8d0122v7smvmxu) connecting you to the pokemon project that we setup for this article. If you copy the above query and hit the play button, you should see this result:\n\n<details>\n<summary>response</summary>\n```json\n{\n  \"data\": {\n    \"allPokemons\": [\n      {\n        \"id\": \"ciwnmyvxn94uo0161477dicbm\",\n        \"name\": \"Pikachu\"\n      },\n      {\n        \"id\": \"ciwnmzhwn953o0161h7vwlhdw\",\n        \"name\": \"Squirtle\"\n      },\n      {\n        \"id\": \"ciwnn0kxq95oy0161ib2wu50g\",\n        \"name\": \"Bulbasaur\"\n      },\n      {\n        \"id\": \"ciwnn11i1960l0161861mxdc1\",\n        \"name\": \"Charmander\"\n      }\n    ]\n  }\n}\n```\n</details>\n\nThe GraphiQL tool is maintained by Facebook and highlights another benefit of GraphQL. The GraphQL schema contains so called introspection queries that make all information about the type system available. This allows for the automatically generated documentation in the top right corner of the tool or the great auto-complete feature.\n\nNow go ahead and use the auto-complete feature of GraphiQL with `Ctrl+Space` to add the `url` field to the `allPokemons` query, run it and examine the result. Woah! Changing queries is as easy as that - just include whatever fields you want and run the query. There's one more crucial property of queries. Let us run the following query together:\n\n<details>\n<summary>query</summary>\n```graphql\nquery {\n  allPokemons {\n    id\n    name\n    trainer {\n      name\n    }\n  }\n}\n```\n</details>\n\nYou should see this result:\n\n<details>\n<summary>response</summary>\n```json\n{\n  \"data\": {\n    \"allPokemons\": [\n      {\n        \"id\": \"ciwnmyvxn94uo0161477dicbm\",\n        \"name\": \"Pikachu\",\n        \"trainer\": {\n          \"name\": \"Ash Ketchum\"\n        }\n      },\n      {\n        \"id\": \"ciwnmzhwn953o0161h7vwlhdw\",\n        \"name\": \"Squirtle\",\n        \"trainer\": {\n          \"name\": \"Ash Ketchum\"\n        }\n      },\n      {\n        \"id\": \"ciwnn0kxq95oy0161ib2wu50g\",\n        \"name\": \"Bulbasaur\",\n        \"trainer\": {\n          \"name\": \"Ash Ketchum\"\n        }\n      },\n      {\n        \"id\": \"ciwnn11i1960l0161861mxdc1\",\n        \"name\": \"Charmander\",\n        \"trainer\": {\n          \"name\": \"Ash Ketchum\"\n        }\n      }\n    ]\n  }\n}\n```\n</details>\n\nJust like with normal fields, we can even select related nodes in our query. This dramatically decreases the number of queries needed and allows for quick prototyping and development of frontend applications. Instead of the time-draining skimming through dozens of potential endpoints, you can simply explore the possible queries interactively which has a great effect on developer experience.\n\nLet's try another query that fetches a single trainer object. Our GraphQL server exposes the `Trainer` query to fetch specific trainer nodes. We can either specify the trainer by an `id` or a `name`. Let's fetch all information on the trainer `Ash Ketchum`:\n\n<details>\n<summary>query</summary>\n```graphql\nquery {\n  Trainer(name: \"Ash Ketchum\") {\n    id\n    name\n    ownedPokemons {\n      name\n    }\n  }\n}\n```\n</details>\n\nRun the query in GraphiQL and you should see this result:\n\n<details>\n<summary>response</summary>\n```json\n{\n  \"data\": {\n    \"Trainer\": {\n      \"id\": \"ciwnmyn2a9ayt0175axsnyux1\",\n      \"name\": \"Ash Ketchum\",\n      \"ownedPokemons\": [\n        {\n          \"name\": \"Pikachu\"\n        },\n        {\n          \"name\": \"Squirtle\"\n        },\n        {\n          \"name\": \"Bulbasaur\"\n        },\n        {\n          \"name\": \"Charmander\"\n        }\n      ]\n    }\n  }\n}\n```\n</details>\n\n### Mutations\n\nMutations can be used to modify data. Again, the available mutations depend on the GraphQL server. Typical examples include mutations that allow to create, update or delete nodes of a specific type. In our case, we could use the `createPokemon` mutation to create a new pokemon associated with the trainer `Ash Ketchum` like this:\n\n<details>\n<summary>query</summary>\n```graphql\nmutation {\n  createPokemon(\n    name: \"Gyarados\"\n    url: \"http://cdn.bulbagarden.net/upload/thumb/4/41/130Gyarados.png/600px-130Gyarados.png\"\n    trainerId: \"ciwnmyn2a9ayt0175axsnyux1\"\n  ) {\n    id\n  }\n}\n```\n</details>\n\nUsually, this mutation would create the new `Gyarados` pokemon node and relate it to the `Ash Ketchum` trainer node (note the id we're passing in for `trainerId`). As the project is read-only though, we receive a permission error:\n\n<details>\n<summary>response</summary>\n```json\n{\n  \"data\": {\n    \"createPokemon\": null\n  },\n  \"errors\": [\n    {\n      \"locations\": [\n        {\n          \"line\": 12,\n          \"column\": 3\n        }\n      ],\n      \"path\": [\n        \"createPokemon\"\n      ],\n      \"code\": 3008,\n      \"message\": \"Insufficient permissions for this mutation\",\n      \"requestId\": \"cix3dug8buz0h0178nd376peo\"\n    }\n  ]\n}\n```\n</details>\n\n## Building a pokedex\n\nWith this quick introduction to GraphQL, we are now ready to focus completely on the client side of our pokedex application.\nQueries or mutations as seen above can simply be sent using plain http requests to the server. However, to benefit from things like client side caching and higher order components that integrate well with React, we are using [Apollo GraphQL client](http://dev.apollodata.com).\n\n### Initializing Apollo Client\n\nOur pokedex application will need different routes for different tasks. The route path `/` is reserved for our `Pokedex` component where we simply display all pokemons of ouf trainer. `/view/:pokemonId` will be used to display the details of a specific pokemon using the `PokemonPage` component. To create a pokemon and associate it with a specific trainer in the `AddPokemonCard` component, we use the route `/create/:trainerId`.\n\nTo make use of Apollo, we initialize a new client and connect it to our GraphQL server by configuring its network interface. Then we use the `ApolloProvider` component provided in `react-apollo` to wrap our route components with the Apollo client, so they can later send queries or mutations to our GraphQL server.\n\nThis leads us to the following route setup in `index.js`:\n\n<details>\n<summary>index.js</summary>\n```js\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport Pokedex from './components/Pokedex'\nimport PokemonPage from './components/PokemonPage'\nimport AddPokemonCard from './components/AddPokemonCard'\nimport { Router, Route, browserHistory } from 'react-router'\nimport ApolloClient, { createNetworkInterface } from 'apollo-client'\nimport { ApolloProvider } from 'react-apollo'\nimport 'tachyons'\nimport './index.css'\n\nconst client = new ApolloClient({\n  networkInterface: createNetworkInterface({ uri: 'https://api.graph.cool/simple/v1/ciwjew0qz0l8d0122v7smvmxu'}),\n  dataIdFromObject: o => o.id\n})\n\nReactDOM.render((\n  <ApolloProvider client={client}>\n    <Router history={browserHistory}>\n      <Route path='/' component={Pokedex} />\n      <Route path='/view/:pokemonId' component={PokemonPage} />\n      <Route path='/create/:trainerId' component={AddPokemonCard} />\n    </Router>\n  </ApolloProvider>\n  ),\n  document.getElementById('root')\n)\n```\n</details>\n\nWe use the function `dataIdFromObject` to define how a node can be identified. In our case, all nodes have a unique `id` field so we can use it for this purpose.\n\n### Sending queries\n\n![](./images/pokemonpage.png)\n\nLet's have a closer look at the `PokemonPage` component now, where we display details of a specific pokemon.\n\n<details>\n<summary>PokemonPage.js</summary>\n```js\nimport React from 'react'\nimport { withRouter } from 'react-router'\nimport { graphql } from 'react-apollo'\nimport gql from 'graphql-tag'\n\nimport PokemonCard from './PokemonCard'\n\nclass PokemonPage extends React.Component {\n\n  static propTypes = {\n    data: React.PropTypes.shape({\n      loading: React.PropTypes.bool,\n      error: React.PropTypes.object,\n      Pokemon: React.PropTypes.object,\n    }).isRequired,\n    router: React.PropTypes.object.isRequired,\n    params: React.PropTypes.object.isRequired,\n  }\n\n  render () {\n    if (this.props.data.loading) {\n      return (<div>Loading</div>)\n    }\n\n    if (this.props.data.error) {\n      console.log(this.props.data.error)\n      return (<div>An unexpexted error occured</div>)\n    }\n\n    return (\n      <div>\n        <PokemonCard pokemon={this.props.data.Pokemon} handleCancel={this.goBack}/>\n      </div>\n    )\n  }\n\n  goBack = () => {\n    this.props.router.replace('/')\n  }\n}\n```\n</details>\n\nNote the special `data` object that we define as part of the props. This prop will be injected by Apollo after sending a query. It contains information on the loading or error status of the query in `data.loading` and `data.error` respectively. In the render method, we see that we can use `data.loading` to render a loading state until the query response comes in that we can use to pass the `pokemon` obtained from the query down to another component, `PokemonCard` in this case.\n\nSo how do we actually send the query resulting in the response `data`? First, we can use the `gql` function from `graphql-tag` to define a query:\n\n<details>\n<summary>PokemonQuery</summary>\n```js\nconst PokemonQuery = gql`query PokemonQuery($id: ID!) {\n    Pokemon(id: $id) {\n      id\n      url\n      name\n    }\n  }\n`\n```\n</details>\n\nNote that the query receives the `id` variable that we can use to select the specific pokemon we want to query.\nWe can then send this query and inject its response to the `PokemonPage` component by using the `graphql` function from `react-apollo`:\n\n<details>\n<summary>PokemonPage.js</summary>\n```js\nconst PokemonPageWithData = graphql(PokemonQuery, {\n  options: (ownProps) => ({\n      variables: {\n        id: ownProps.params.pokemonId\n      }\n    })\n  }\n)(withRouter(PokemonPage))\n\nexport default PokemonPageWithData\n```\n</details>\n\nNote how we can access the router parameters with `ownProps.params` to use the path variable as the `id` variable for our `PokemonQuery`.\n\n### Sending mutations\n\n![](./images/addpokemon.png)\n\nLet's see how we can use mutations with Apollo Client by looking a the `AddPokemonCard` component. Again, we can define the mutation with `gql`:\n\n<details>\n<summary>createPokemonMutation</summary>\n```js\nconst createPokemonMutation = gql`\n  mutation createPokemon($name: String!, $url: String!, $trainerId: ID) {\n    createPokemon(name: $name, url: $url, trainerId: $trainerId) {\n      trainer {\n        id\n        ownedPokemons {\n          id\n        }\n      }\n    }\n  }\n`\n```\n</details>\n\nThis time, we define the `name`, `url` and `trainerId` variables for the mutation, which is the needed information for the `createPokemon` mutation, as seen in the last section. When we use `graphql` now to wrap the existing `AddPokemonCard` component with the mutation, we don't specify the mutation variables yet:\n\n<details>\n<summary>AddPokemonCard.js</summary>\n```js\nconst AddPokemonCardWithMutation = graphql(createPokemonMutation)(withRouter(AddPokemonCard))\n\nexport default AddPokemonCardWithMutation\n```\n</details>\n\nInstead of injecting a `data` prop as before, wrapping mutations will inject a `mutate` prop that can be used to actually fire the mutation. We can see that in the `handleSave` function of the `AddPokemonCard` component:\n\n<details>\n<summary>AddPokemonCard.js</summary>\n```js\nhandleSave = () => {\n  const {name, url} = this.state\n  const trainerId = this.props.params.trainerId\n  this.props.mutate({variables: {name, url, trainerId}})\n    .then(() => {\n      this.props.router.replace('/')\n    })\n}\n```\n</details>\n\nWe take the currently entered information for the `name` and `url` input elements and the path variable `trainerId` and use them for our mutation. Calling the `mutate` function with these variables will return a promise that we can use to navigate back to the `Pokedex` component where now a new pokemon should be displayed.\n\n## Wrap Up\n\nThat's it! In this blog post, we saw how we can send GraphQL queries and mutations using Apollo Client in React. The best way to learn more about GraphQL and Apollo is [Learn Apollo](https://learnapollo.com), featuring a hands-on tutorial where you will build a fully-featured pokedex application in multiple technologies such as React, React Native or ExponentJS.\n\nTo setup a GraphQL backend in minutes, check out [Graphcool](https://graph.cool) enabling you to implement your business logic with any language and includes realtime subscriptions, user management, service integrations and more.\n\n[![](http://i.imgur.com/FxHTGm4.png)](https://www.youtube.com/watch?v=wSkZFfuAToM)\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2016 Shekhar Gulati\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n"
  },
  {
    "path": "README.md",
    "content": "\n52 technologies in 2016 [![GitHub Stats](https://img.shields.io/badge/github-stats-brightgreen.svg)](http://githubstats.com/shekhargulati/52-technologies-in-2016)  [![SayThanks](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/shekhargulati)\n--------\n\nI have taken a challenge to learn a new technology every week in 2016. The goal is to learn a new technology, build a simple application using it, and blog about it.\n\n> **I have decided to discontinue this series after writing 42 blogs. No more blogs will be published in this series. Thanks for your support.**\n\n## Contributing to the 52 technologies in 2016 series\n\nPlease contribute if you see an error or something that could be better! Raise an [issue](https://github.com/shekhargulati/52-technologies-in-2016/issues) or send me a pull request to improve. Contributions of all kinds, including corrections, additions, improvements, and translations, are welcome!\n\n## Open for external blogs\n\nIf you would like to write a guest post for 52-technologies-in-2016 series then send a PR with a blog post.\n\n## Technologies covered in 52 technologies in 2016 series\n\nBelow is the list of technologies covered in this series:\n\n1. **[Week 1: January 03, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/01-finatra)** [Finatra - Build Beautiful REST API The Twitter Way](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/01-finatra/README.md). In this tutorial, we will learn how to write Scala REST APIs using Twitter's open source framework Finatra. We will build an application from scratch covering all the steps required to build the application.\n\n2. **[Week 2: January 10, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/02-sbt)** [SBT: The Missing Tutorial](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/02-sbt/README.md). In this tutorial, we will learn sbt build tool. sbt is a general purpose build tool written in Scala. It is best suited for Scala application development.\n\n3. **[Week 3: January 17, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/03-stanford-corenlp)** [Sentiment Analysis in Scala with Stanford CoreNLP](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/03-stanford-corenlp/README.md). In this tutorial, we will learn how to use Stanford CoreNLP library for performing sentiment analysis of unstructured text in Scala.\n\n4. **[Week 4: January 24, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/04-slick)** [Slick: Functional Relational Mapping for Mere Mortals Part 1](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/04-slick/README.md). In this tutorial, we will learn how to get started with Slick so that we can interact with relational databases in our Scala applications. Slick is a powerful Scala library to work with relational databases.\n\n5. **[Week 5: January 31, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/05-slick)** [Slick: Functional Relational Mapping for Mere Mortals Part 2: Querying Data](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/05-slick/README.md). In this tutorial, we will learn how to perform `select` queries with Slick. Slick allows you to work with database tables in the same way as you work with Scala collections. This means that you can use methods like `map`, `filter`, `sort`, etc. to process data in your table.\n\n6. **[Week 6: February 07, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/06-okhttp)** [Building A Lightweight REST API Client with Scala and OkHttp](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/06-okhttp/README.md). In this tutorial, we will learn how to build REST API client for Medium's REST API using Scala and OkHttp. OkHttp is an open source Java HTTP client library focussed on efficiency.\n\n7. **[Week 7: February 14, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/07-hugo)** [Hugo: A Modern WebSite Engine That Just Works](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/07-hugo/README.md). In this tutorial, we will learn how to build a static website using Hugo. Hugo is a static site generator written in Go programming language.\n\n8. **[Week 8: February 21, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/08-coreos)** [CoreOS for Application Developers](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/08-coreos/README.md). The goal of this tutorial is to help application developers understand why they should care about CoreOS and show them how to work with CoreOS cluster running on top of Amazon EC2. CoreOS is an Open source Linux distribution built to run and manage highly scalable and fault tolerant systems.\n\n9. **[Week 9: February 28, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/09-cloudvision)** [Realtime People Counter with Google's Cloud Vision API and RxJava](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/09-cloudvision/README.md). Google recently released Cloud Vision API that enables developers to incorporate image recognition in their applications. Image Recognition allow developers to build applications that can understand content of images.  In this tutorial, we will learn how to build a realtime people counter.\n\n10. **[Week 10: March 06, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/10-gatling)** [Gatling: The Ultimate Load Testing Tools for Programmers](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/10-gatling/README.md). Gatling is a high performance open source **load testing** tool built on top of Scala, Netty, and Akka. It is a next generation, modern load testing tools very different from existing tools like Apache JMeter. In this tutorial, you will learn how to write load tests using Gatling.\n\n11. **Week 11: March 13, 2016** **[Tweet Deduplication](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/11-tweet-deduplication/README.md)**: This week I decided to write a tweet deduplication library. The library will give you a stream of deduplicated tweets.\n\n12. **Week 11: March 13, 2016** **[TextBlob](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/11-textblob/README.md)**. TextBlob is an open source text processing library written in Python. It can be used to perform various natural language processing tasks such as part-of-speech tagging, noun-phrase extraction, sentiment analysis, text translation, and many more.\n\n13. **[Week 12: March 20, 2016](https://github.com/shekhargulati/play-the-missing-tutorial)** [Play Framework](https://github.com/shekhargulati/play-the-missing-tutorial). Play framework is a MVC style web application framework for JVM. It provides API for both Java and Scala programming languages. I am maintaining this tutorial in a separate [GitHub repository](https://github.com/shekhargulati/play-the-missing-tutorial).\n\n14. **[Week 13: March 27, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/13-arangodb)** [ArangoDB: Polyglot Persistence Without Cost](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/13-arangodb/README.md). ArangoDB is an open source NoSQL database that provides flexible data model. You can use ArangoDB to model data using combination of document, graph, and key value data modeling styles.\n\n15. **[Week 14: April 03, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/14-kafka)** [Apache Kafka](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/14-kafka/README.md). I have not yet written this article.\n\n16. **[Week 15: April 10, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/15-huginn)** [Airline Bot Platform with Huginn](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/15-huginn/README.md). This week I decided to build a bot platform using **Huginn** that can perform a lot of tasks for which we normally use mobile apps. Our goal was to show them that they should think beyond mobile apps and look into the world of bots as bots can be less intrusive, more secure, and does not require installation. Apps are dead, long live bots.\n\n17. **[Week 16: April 17, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/16-newspaper)** [Building Your \"Read It Later\" App using Python and Newspaper Library](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/16-newspaper/README.md).In this tutorial, you will learn how we can use a Python library newspaper to perform article extraction and build a simple \"Read It Later\" application.\n\n18. **[Week 17: April 24, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/17-typescript)** [Let's Learn TypeScript](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/17-typescript/README.md). This week I decided to learn TypeScript so I will discuss how you can get started with TypeScript. TypeScript is a typed superset of JavaScript, which means that it supports all the JavaScript features plus it adds static typing to the language.\n\n19. **[Week 18: May 01, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/18-mesos)** [Getting Started with Apache Mesos](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/18-mesos/README.md). This week we will learn about [Apache Mesos](http://mesos.apache.org/) -- an open source cluster manager and scheduler for your datacenter.\n\n20. **[Week 19: May 08, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/19-bees)** [Load testing with bees](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/19-bees/README.md). This week I discovered a Python utility called `beeswithmachineguns` that can load test a web application by launching many micro EC2 instances.\n\n21. **[Week 20: May 15, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/20-json)** [5 open source projects that will make working with JSON awesome and fun](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/20-json/README.md). This week I will share my 5 favorite open source projects that makes working with JSON easy and fun. I use them on regular basis and find them very useful whenever I am working with JSON.\n\n22. **[Week 21: May 22, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/21-strman)** [Java 8 String Manipulation Library](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/21-strman/README.md). This week I wrote and released a Java 8 library to work with String.\n\n23. **[Week 22: May 29, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/22-regex)** [Making Sense of Regular Expressions](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/22-regex/README.md). In this tutorial, I will walk you through a series of examples that will help you learn about regular expressions. I will end this tutorial by covering a library [VerbalExpressions](https://github.com/VerbalExpressions) that you can use to programmatically build regular expressions.\n\n24. **[Week 23: June 5, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/23-android-part1)** [Building An Android Application Part 1](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/23-android-part1/README.md). In this tutorial, we will develop an Android app that will be used to report and track missing kids. Today, we will only cover photo capturing capability of the application. Like any camera application, this application will enable users to capture photos, save them to an album, and finally upload them to the backend servers.\n\n25. **[Week 24: June 12, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/24-jekyll-to-wordpress)** [Moving back to WordPress from Jekyll](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/24-jekyll-to-wordpress/README.md). In this blog, I will share my experience of running a Jekyll blog and then migrating it back to WordPress.\n\n26. **[Week 25: June 19, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/25-angular-dragula)** [Trello Clone with Angular Dragula](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/25-angular-dragula/README.md). In this blog, I will cover how you can build Trello like drag and drop list interface with Angular Dragula.\n\n27. **[Week 26: June 26, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/26-android-part2)** [Building An Android Application Part 2](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/26-android-part2/README.md). In this blog, we will extend the Android application we built in week 23.  We will use an Android library Glide to handle the image preview. We will also add sharing functionality using Android's inbuilt sharing support using ShareActionProvider.\n\n28. **[Week 27: July 03, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/27-learn-golang-for-great-good)** [Learn GoLang For Great Good -- Part 1](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/27-learn-golang-for-great-good/README.md). In this blog, we will learn Go programming language by writing a number of small programs. Go is an object oriented programming language with memory management builtin.\n\n29. **[Week 28: July 10, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/28-ionic)** [Build mobile apps using Ionic Framework](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/28-ionic/README.md). In this blog, we will build a hybrid mobile app using Ionic and Cordova. The complete application will have a server side which will send JSON data, consumed by the application. The mobile app is written in ECMAScript.\n\n30. **[Week 29: July 15, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/29-golang-github-slacknotification)** [Go Language - GitHub System Status API & Slack Notifications](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/29-golang-github-slacknotification/README.md). In this blog, we are going to investigate a few more features of the language and combine that into a real life application where we can monitor the status of the GitHub System via its Status API and report its current status directly into a Slack Team page.\n\n31. **[Week 29: July 17, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/29-go-unit-testing)** [Learn GoLang For Great Good Part 2: Unit Testing in Go](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/29-go-unit-testing/README.md). This week we will take our Go knowledge to the next level by learning how to perform unit testing in Go. Unit testing has become an essential skill set for every programmer.\n\n32. **[Week 30: July 24, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/30-dropwizard)** [Dropwizard: Your Java Library For Building Microservices](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/30-dropwizard/README.md) This blog covers how to build Java REST backend using Dropwizard library.\n\n33. **[Week 31: July 31, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/31-gradle-tips)** [50 Gradle Tips](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/31-gradle-tips/README.md). Over last year or so I have started using Gradle as my primary build tool for JVM based projects. In this document, I will list down tips that I have learnt over last year or so.\n\n34. **[Week 32: August 7, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/32-groovy-ast-transformations)** [Groovy AST Transformations By Example](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/32-groovy-ast-transformations/README.md). This week I learnt about Groovy AST transformations. AST transformations allows you to hook into the Groovy compilation process so that you can customize it to meet your needs. In this blog, you will learn how to write an AST transformation that will add a `toHash` method to a class. `toHash` method will generate a hash for your object. You will be able to provide hash algorithm of your choice. We will use Java's `java.security.MessageDigest` to generate the hash code.\n\n35. **[Week 34: August 21, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/34-aws-lambda)** [Automating Your Static Website Social Notifications with AWS Lambda](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/34-aws-lambda/README.md). AWS Lambda is an event-driven, serverless computing platform that executes your code in response to events. It manages the underlying infrastructure scaling it up or down to meet the event rate. You are only charged for the time your code is executed. AWS Lambda currently supports Java, Python, and Node.js language runtimes.\n\n36. **[Week 36: September 04, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/36-webpack)** [Webpack: The Missing Tutorial](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/36-webpack/README.md). webpack takes modules with dependencies and generates static assets representing those modules.\n\n37. **[Week 37: September 11, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/37-spring-boot-scala)** [Building \"Bootiful\" Scala Web Applications with Spring Boot](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/37-spring-boot-scala/README.md). In this post, I will quickly show you how to use Spring Boot with Scala by converting Spring Boot's official *Building a RESTful Web Service* guide to Scala.\n\n38. **[Week 38: September 18, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/38-akka)** [Actor System Termination on JVM Shutdown](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/38-akka/README.md). In this short post, I will discuss how to cleanly shutdown Akka ActorSystem on JVM exit.\n\n39. **[Week 39: October 07, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/39-docker)** [Docker for Java Developers Part 1](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/39-docker/README.md). This week I had to give a talk on Docker ecosystem so I spent a lot of my after office hours preparing for the talk. [Docker](http://docker.com/) is a container technology that allows us to package an application and its dependencies together in a filesystem so that they can be deployed together on any server. This helps us achieve package once deploy anywhere. So, in the next few posts of this series, we will learn how Java developers can get started with Docker.\n\n40. **[Week 40: October 19, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/40-docker-cron)** [Using Docker Containers As Cron Jobs](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/40-docker-cron/README.md): This week I was working on a problem that required cron jobs. The use case was that after user registers with the application, we will create a cron job that will track his/her social activities. We will have one container per user. I wanted to keep cron jobs to work in a different process from the main application so that different concerns of the application don't intermingle. In my view, containers provide the right abstraction to solve this use case.\n\n41. **[Week 41: December 04, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/41-akka-dispatcher)** [Understanding Akka Dispatcher](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/41-akka-dispatcher/README.md):  [Akka](http://akka.io/) is a toolkit and runtime for building highly concurrent, distributed and resilient message driven systems. This post assumes you already know Akka. Actor needs a dispatcher to perform its task. A dispatcher relies on executor to provide thread. There are two types of executors a dispatcher can have: 1) `fork-join-executor` 2) `thread-pool-executor`. In this post, we will understand how you can configure `fork-join-executor` and `thread-pool-executor` to meet your needs.\n\n42. **[Week 42: December 08, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/42-docker-compose)** [Using Docker Compose with wait-for-it](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/42-docker-compose/README.md):   Today, we will learn about Docker Compose, a tool for defining and running multi-container Docker applications. This post will also cover how to use Docker Compose with [wait-for-it](https://github.com/vishnubob/wait-for-it). `wait-for-it` is a simple bash utility to test and wait for the availability of TCP host and port.\n\n43. **[Week 43: December 26, 2016](https://github.com/shekhargulati/52-technologies-in-2016/tree/master/43-graphql)** [GraphQL - building a pokedex in React with GraphQL](https://github.com/shekhargulati/52-technologies-in-2016/blob/master/43-graphql/README.md): [GraphQL](http://graphql.org), a query language that is starting to get more and more attention. Facebook, who internally used GraphQL since 2012 and released a first specification and reference implementation of GraphQL in 2015 announced GraphQL to be [production ready] in September 2016. What followed is a trend of more and more companies starting to use GraphQL, such as GitHub, Coursera and Shopify.\n\n-----------\nYou can follow me on twitter at [https://twitter.com/shekhargulati](https://twitter.com/shekhargulati) or email me at <shekhargulati84@gmail.com>. Also, you can read my blogs at [http://shekhargulati.com/](http://shekhargulati.com/)\n\n[![Analytics](https://ga-beacon.appspot.com/UA-59411913-2/shekhargulati/52-technologies-in-2016)](https://github.com/igrigorik/ga-beacon)\n"
  },
  {
    "path": "authors.md",
    "content": "Authors\n---\n\nBelow is the list of people who have contributed blogs to 52 technology series.\n\n\n1. [Shekhar Gulati](https://github.com/shekhargulati)\n2. [Rahul Sharma](https://github.com/rahul0208)\n3. [Romin Irani](https://twitter.com/iRomin)\n4. [Nilan Marktanner](https://github.com/marktani)\n\nBelow is the list of people who have contributed fixes to blogs:\n\n1. [Ojabo John Heart](https://github.com/MrHeart)\n2. [Hanns Holger Rutz](https://github.com/Sciss)\n3. [mail2vks](https://github.com/mail2vks)\n"
  },
  {
    "path": "who-is-talking-about.md",
    "content": "What People Are Saying About 52-technologies-in-2016 series?\n---\n\n## Link\n\n1. [Building a group that learns and write about new technologies](https://www.v2ex.com/t/274467)\n2. [HackerNews mention](https://news.ycombinator.com/item?id=11559777)\n3. [TheChangeLog March NewsLetter](http://email.changelog.com/t/ViewEmail/t/C919E40148EF9E0B/B7C81A4C9BD39AC4C68C6A341B5D209E)\n4. HackerNews Front page [https://news.ycombinator.com/item?id=12430479](https://news.ycombinator.com/item?id=12430479)\n5. Week 2 SBT tutorial is mentioned recommended by [Coursera Scala course taught by Martin Odersky](https://www.coursera.org/learn/progfun1/supplement/uV974/sbt-tutorial).\n6. Week 7 Hugo post became [official Hugo quickstart](http://gohugo.io/overview/quickstart/)\n7. [ChangeLog Issue 122](http://email.changelog.com/t/ViewEmail/t/DFC70C605DFB76A1/B7C81A4C9BD39AC4C68C6A341B5D209E), September 11th 2016 again mentioned 52-technologies-in-2016 series.\n8. [A guy wrote a short post](http://www.briandupreez.net/2016/09/re-inspired.html) on 52-technologies-in-2016 giving him inspiration to get back to blogging.\n9. [SDTimes mentioned](http://sdtimes.com/sd-times-github-project-week-quill/) 52-technologies-in-2016 series in their Github project of the week.\n10. [A beginner's reference guide to TypeScript Language](http://www.jjude.com/ts/) mentions 52-technologies-in-2016 week 17 blog on TypeScript post.\n11. A [Russian blogger talking](http://artemdemo.me/blog/%D1%83%D1%87%D0%B8%D0%BC-52-%D0%BD%D0%BE%D0%B2%D1%8B%D0%B5-%D1%82%D0%B5%D1%85%D0%BD%D0%BE%D0%BB%D0%BE%D0%B3%D0%B8%D0%B8-%D0%B2-2016/) about 52-technologies-in-2016 series\n12. A [German blogger](https://boehrsi.de/?action=c-public_blog-post&id=2830&content=52_neue_technologien_lernen_mit_shekhar_gulati) posted about 52-technologies-in-2016\n13. Quora [answer on interesting Github projects](https://www.quora.com/Where-can-I-find-interesting-projects-I-can-code)\n14. A [Chinese article covers 52-tech series](http://www.voyax.me/2016/09/19/%E3%80%8A%E7%A8%8B%E5%BA%8F%E5%91%98%E4%BF%AE%E7%82%BC%E4%B9%8B%E9%81%93%E3%80%8B%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0%E2%80%94%E2%80%94%E6%B3%A8%E9%87%8D%E5%AE%9E%E6%95%88%E7%9A%84%E5%93%B2%E5%AD%A6/).\n15. [This week in Scala](http://www.cakesolutions.net/teamblogs/this-week-in-scala-05/12/2016) by Cake Solutions covered Akka dispatcher post.\n16. [Hackernoon mentions 52-technologies-in-2016](https://hackernoon.com/27-popular-new-github-repositories-for-web-developers-in-2016-27cdcbba9779#.bd1jcip14) as one of the popular Github repositories of 2016 for web developers.\n\nPopular Tweets\n---\n\n1. TheChangeLog https://twitter.com/changelog/status/705851109143912448\n2. The Practical Dev https://twitter.com/ThePracticalDev/status/773299374130618368\n3. Umar Hansa https://twitter.com/umaar/status/773192074925670400\n4. Justin https://twitter.com/justinwr/status/772844486116409344\n5. Josh Long https://twitter.com/starbuxman/status/765429961666600961\n6. ArangoDB https://twitter.com/starbuxman/status/765429961666600961\n7. Go News https://twitter.com/golang_news/status/754721829441400832\n8. Python Weekly https://twitter.com/golang_news/status/754721829441400832\n9. Alexander Schmidt https://twitter.com/Bloggerschmidt/status/724826819023740929\n10. DJo https://twitter.com/LaFermeDuWeb/status/724480629904150528\n11. Chris Heilmann https://twitter.com/codepo8/status/772905349770645504\n12. Read all tweets [here](https://twitter.com/search?vertical=default&q=52-technologies-in-2016&src=typd)\n"
  }
]